instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I have a webservice that when called without specifying a callback will return a JSON string using application/json as the content type.
When a callback is specified it will wrap the JSON string in a callback function, so it's not really valid JSON anymore. My question is, should I serve it as application/javascript in... | When you are providing a JSONP response (where the JSON is wrapped in a callback function), you should serve it with the MIME type `application/javascript`. This is because the response is no longer just a JSON object; it is executable JavaScript code.
Using `application/javascript` communicates to the client that the... | 10,394 | [
{
"from": "human",
"value": "I have a webservice that when called without specifying a callback will return a JSON string using application/json as the content type.\nWhen a callback is specified it will wrap the JSON string in a callback function, so it's not really valid JSON anymore. My question is, shou... |
The Open/Closed Principle states that software entities (classes, modules, etc.) should be open for extension, but closed for modification. What does this mean, and why is it an important principle of good object-oriented design?
| The Open/Closed Principle (OCP) is one of the key principles of object-oriented design, encapsulated in the SOLID principles. It states that software entities such as classes, modules, and functions should be open for extension but closed for modification. Let’s break down what this means and why it is important.
### ... | 6,949 | [
{
"from": "human",
"value": "The Open/Closed Principle states that software entities (classes, modules, etc.) should be open for extension, but closed for modification. What does this mean, and why is it an important principle of good object-oriented design?\n"
},
{
"from": "gpt",
"value": "The ... |
I have the following string:
cn=abcd,cn=groups,dc=domain,dc=com
Can a regular expression be used here to extract the string after the first cn= and before the first ,? In the example above the answer should be abcd.
| Yes, you can use a regular expression to extract the desired substring from the given string. The regular expression will look for the pattern that starts with `cn=` and captures everything after it until the first comma `,`.
Here’s a suitable regular expression for your case:
```
cn=([^,]+)
```
### Explanation:
- `... | 8,991 | [
{
"from": "human",
"value": "I have the following string:\ncn=abcd,cn=groups,dc=domain,dc=com\n\nCan a regular expression be used here to extract the string after the first cn= and before the first ,? In the example above the answer should be abcd. \n"
},
{
"from": "gpt",
"value": "Yes, you can ... |
I am facing a problem with .NET generics. The thing I want to do is saving an array of generics types (GraphicsItem):
public class GraphicsItem<T>
{
private T _item;
public void Load(T item)
{
_item = item;
}
}
How can I save such open generic type in an array?
| In .NET, when you're working with open generic types, you can’t directly instantiate an array of an open generic type like `GraphicsItem<T>`. However, you can use a couple of approaches to work around this limitation.
### Option 1: Use a Non-Generic Base Class or Interface
One way to store different generic types in ... | 5,364 | [
{
"from": "human",
"value": "I am facing a problem with .NET generics. The thing I want to do is saving an array of generics types (GraphicsItem):\npublic class GraphicsItem<T>\n{\n private T _item;\n\n public void Load(T item)\n {\n _item = item;\n }\n}\n\nHow can I save such open generi... |
In one of my applications I have a 1gb database table that is used for reference data. It has a huge amounts of reads coming off that table but there are no writes ever. I was wondering if there's any way that data could be loaded into RAM so that it doesn't have to be accessed from disk?
I'm using SQL Server 2005
| In SQL Server 2005, you can optimize your application to reduce the need for disk access and potentially load data into RAM using several strategies, even though SQL Server 2005 does not offer as many advanced options as more recent versions. Here are a few approaches you can consider:
### 1. **Use Caching in Your App... | 6,384 | [
{
"from": "human",
"value": "In one of my applications I have a 1gb database table that is used for reference data. It has a huge amounts of reads coming off that table but there are no writes ever. I was wondering if there's any way that data could be loaded into RAM so that it doesn't have to be accessed ... |
I am performing a find and replace on the line feed character ( ) and replacing it with the paragraph close and paragraph open tags using the following code:
<xsl:template match="/STORIES/STORY">
<component>
<xsl:if test="boolean(ARTICLEBODY)">
<p>
<xsl:call-template name=... | Yes, you can modify your XSLT to handle the situation where multiple consecutive line feed characters (` `) are replaced with only a single set of paragraph close and open tags (`</p><p>`). To achieve this, you can use a slightly different approach by first normalizing the line feeds into a single line feed charact... | 4,400 | [
{
"from": "human",
"value": "I am performing a find and replace on the line feed character ( ) and replacing it with the paragraph close and paragraph open tags using the following code:\n<xsl:template match=\"/STORIES/STORY\"> \n <component>\n <xsl:if test=\"boolean(ARTICLEBODY)\">\n ... |
In my C++ program I want to parse a small piece of XML, insert some nodes, then extract the new XML (preferably as a std::string).
RapidXml has been recommended to me, but I can't see how to retrieve the XML back as a text string.
(I could iterate over the nodes and attributes and build it myself, but surely there's a ... | In RapidXML, there's indeed a convenient way to retrieve the XML as a string. However, RapidXML doesn't have built-in functionality to directly convert the entire XML document back to a `std::string` object. Instead, you can utilize the built-in functions to serialize the XML to a memory buffer and then convert that bu... | 5,220 | [
{
"from": "human",
"value": "In my C++ program I want to parse a small piece of XML, insert some nodes, then extract the new XML (preferably as a std::string).\nRapidXml has been recommended to me, but I can't see how to retrieve the XML back as a text string.\n(I could iterate over the nodes and attributes... |
I've to admin a small website for my alumni group which is hosted by my ISV. The url is something like www.myIsv.com/myWebSite/ which is quite ugly and very forgetable. The main admin of the webserver has registered a domain name www.mysmallwebsite.com and put a index.html with this content:
<html>
<head>
<title>www.my... | Using a frameset to redirect to another site can indeed cause issues with certain functionalities, particularly with PHP sessions. This is because the session cookie is tied to the domain, and when you access your site through a frame on a different domain (your ISV's site), the session cookies from the original site m... | 5,942 | [
{
"from": "human",
"value": "I've to admin a small website for my alumni group which is hosted by my ISV. The url is something like www.myIsv.com/myWebSite/ which is quite ugly and very forgetable. The main admin of the webserver has registered a domain name www.mysmallwebsite.com and put a index.html with ... |
I'm having trouble getting the following to work in SQL Server 2k, but it works in 2k5:
--works in 2k5, not in 2k
create view foo as
SELECT usertable.legacyCSVVarcharCol as testvar
FROM usertable
WHERE rsrcID in
( select val
from
dbo.fnSplitStringToInt(usertable.legacyCSVVarcharCo... | The issue you're encountering is indeed a limitation of SQL Server 2000's handling of subqueries that reference outer query columns. In SQL Server 2000, you cannot directly use a column from the outer query in a subquery in the way you're attempting.
### Why It Fails
In your first example:
```sql
SELECT t1.*
FROM u... | 5,165 | [
{
"from": "human",
"value": "I'm having trouble getting the following to work in SQL Server 2k, but it works in 2k5:\n--works in 2k5, not in 2k\n\ncreate view foo as \nSELECT usertable.legacyCSVVarcharCol as testvar \nFROM usertable \nWHERE rsrcID in\n ( select val \n from\n d... |
We are using classic asp to call a C# dll and in the C# dll we are using System.Drawing.Printing.PrinterSettings.InstalledPrinters to get a list of availabe printers. If the printers are not shared they will not show up when a user trys to print. The Local System account can see and print to them from a VB6 dll and Adm... | When you are dealing with printer permissions in a Windows environment, especially when it comes to services or applications running under different user accounts (like Local System, Administrators, or regular user accounts), there are a few factors that can influence whether a printer is visible and accessible.
Here ... | 5,600 | [
{
"from": "human",
"value": "We are using classic asp to call a C# dll and in the C# dll we are using System.Drawing.Printing.PrinterSettings.InstalledPrinters to get a list of availabe printers. If the printers are not shared they will not show up when a user trys to print. The Local System account can see... |
I create a new Button object but did not specify the command option upon creation. Is there a way in Tkinter to change the command (onclick) function after the object has been created?
| Yes, in Tkinter, you can change the command of a Button object after it has been created. You can do this by using the `config` method of the Button widget.
Here’s how you can do it:
1. Create the Button without specifying the command.
2. Use the `config` method to set a new command later.
Here’s an example:
```pyt... | 8,445 | [
{
"from": "human",
"value": "I create a new Button object but did not specify the command option upon creation. Is there a way in Tkinter to change the command (onclick) function after the object has been created?\n"
},
{
"from": "gpt",
"value": "Yes, in Tkinter, you can change the command of a ... |
Is there a way to tell MS SQL that a query is not too important and that it can (and should) take its time?
Likewise is there a way to tell MS SQL that it should give higher priority to a query?
| In Microsoft SQL Server, you have several options for managing the priority and resource allocation of queries, although there's no explicit "low priority" or "high priority" flag you can set on individual queries. Instead, you can leverage various mechanisms to indirectly influence the behavior of the SQL Server query... | 2,641 | [
{
"from": "human",
"value": "Is there a way to tell MS SQL that a query is not too important and that it can (and should) take its time?\nLikewise is there a way to tell MS SQL that it should give higher priority to a query?\n"
},
{
"from": "gpt",
"value": "In Microsoft SQL Server, you have seve... |
I am developing a J2ME application that has a large amount of data to store on the device (in the region of 1MB but variable). I can't rely on the file system so I'm stuck the Record Management System (RMS), which allows multiple record stores but each have a limited size. My initial target platform, Blackberry, limits... | Storing a large amount of data using the Record Management System (RMS) in J2ME can be challenging, especially with the 64KB limit on BlackBerry devices. Here are several strategies you could consider for effectively managing and storing your data while maintaining integrity and reducing complexity:
### 1. **Splitting... | 2,826 | [
{
"from": "human",
"value": "I am developing a J2ME application that has a large amount of data to store on the device (in the region of 1MB but variable). I can't rely on the file system so I'm stuck the Record Management System (RMS), which allows multiple record stores but each have a limited size. My in... |
I've got some Java code using a servlet and Apache Commons FileUpload to upload a file to a set directory. It's working fine for character data (e.g. text files) but image files are coming out garbled. I can open them but the image doesn't look like it should. Here's my code:
Servlet
protected void doPost(HttpServlet... | It looks like the problem with your file upload code stems from how you read the bytes from the input stream in the `StreamUtils.getBytes` method. Specifically, you're not writing the actual bytes read from the input stream to the `ByteArrayOutputStream` correctly.
Here's the issue in your code:
```java
byteStream.wr... | 7,354 | [
{
"from": "human",
"value": "I've got some Java code using a servlet and Apache Commons FileUpload to upload a file to a set directory. It's working fine for character data (e.g. text files) but image files are coming out garbled. I can open them but the image doesn't look like it should. Here's my code:\... |
I am having a really hard time attempting to debug LINQ to SQL and submitting changes.
I have been using http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx, which works great for debugging simple queries.
I'm working in the DataContext Class for my project with the following snippet fro... | It sounds like you're encountering a tricky issue with LINQ to SQL's `SubmitChanges()` method. The error message "Index was outside the bounds of the array" often indicates that there is an issue with the data being submitted, especially when it comes to primary key constraints, relationships, or how the data is being ... | 4,757 | [
{
"from": "human",
"value": "I am having a really hard time attempting to debug LINQ to SQL and submitting changes.\nI have been using http://weblogs.asp.net/scottgu/archive/2007/07/31/linq-to-sql-debug-visualizer.aspx, which works great for debugging simple queries.\nI'm working in the DataContext Class fo... |
Feel free to edit the title if you know how to formulate the question better. (Tagging is a problem as well.) The problem may be too difficult in this general form, so let us consider a concrete example.
You get a screenful of stackoverflow questions by requesting /questions ?sort=newest page. Next page link leads to /... | ### Title: Handling Pagination for New Content on Dynamic Websites
When dealing with pagination in a dynamic environment where new content can be added (like Stack Overflow), it's essential to ensure that users do not see duplicate content when navigating between pages. The issue arises because if new questions are ad... | 6,557 | [
{
"from": "human",
"value": "Feel free to edit the title if you know how to formulate the question better. (Tagging is a problem as well.) The problem may be too difficult in this general form, so let us consider a concrete example.\nYou get a screenful of stackoverflow questions by requesting /questions ?s... |
I'm trying to rebuild an old metronome application that was originally written using MFC in C++ to be written in .NET using C#. One of the issues I'm running into is getting the timer to "tick" accurately enough.
For example, assuming an easy BPM (beats per minute) of 120, the timer should tick every .5 seconds (or 50... | To achieve more accurate timing for your metronome application in C#, you can consider using the `System.Timers.Timer` or `System.Threading.Timer`, which can offer more precision than the standard `System.Windows.Forms.Timer`. However, for the best accuracy, you might want to consider using a more specialized approach,... | 4,311 | [
{
"from": "human",
"value": "I'm trying to rebuild an old metronome application that was originally written using MFC in C++ to be written in .NET using C#. One of the issues I'm running into is getting the timer to \"tick\" accurately enough.\nFor example, assuming an easy BPM (beats per minute) of 120, t... |
I recently ran into an issue with linq on a shared host.
The host is Shared Intellect and they support v3.5 of the framework. However, I am uncertain to whether they have SP1 installed. My suspicion is that they do not.
I have a simple News table that has the following structure:
NewsID uniqueidentifier
Titl... | It sounds like you're running into a common issue with LINQ and anonymous types in specific environments, particularly when it comes to differences in .NET Framework versions and service packs.
### Answering Your Questions
1. **Has anyone else encountered this and if so, is there a "quick" fix?**
- Yes, this issue... | 4,421 | [
{
"from": "human",
"value": "I recently ran into an issue with linq on a shared host.\nThe host is Shared Intellect and they support v3.5 of the framework. However, I am uncertain to whether they have SP1 installed. My suspicion is that they do not.\nI have a simple News table that has the following struc... |
If I have a table structure that is:
code, description, isdeleted
where code is the primary key.
The user creates a record, then later on deletes it. Because I am using soft deletes the isdeleted will be set to true. Then in my queries I would be doing a select with the where clause and not isdeleted
Now if a user go... | This is a common scenario when implementing soft deletes in database design. Your considerations are valid, and there are a few approaches to handle this situation, each with its advantages and disadvantages. Here are some options to consider:
### Option 1: Prevent Re-use of Soft Deleted Codes
- **Pros**:
- Preserve... | 6,984 | [
{
"from": "human",
"value": "If I have a table structure that is: \ncode, description, isdeleted\n\nwhere code is the primary key.\nThe user creates a record, then later on deletes it. Because I am using soft deletes the isdeleted will be set to true. Then in my queries I would be doing a select with the wh... |
I'm trying to find a way to fake the result of a method called from within another method.
I have a "LoadData" method which calls a separate helper to get some data and then it will transform it (I'm interested in testing the transformed result).
So I have code like this:
public class MyClass(){
public void LoadData(... | To test the `LoadData` method and control the output of the `Helper.GetSomeData()` method, you can certainly use a mocking framework. Since you mentioned you have some limited experience with Rhino Mocks, I'll provide an example using that framework. However, I will also briefly mention an alternative approach in case ... | 6,661 | [
{
"from": "human",
"value": "I'm trying to find a way to fake the result of a method called from within another method.\nI have a \"LoadData\" method which calls a separate helper to get some data and then it will transform it (I'm interested in testing the transformed result).\nSo I have code like this:\np... |
I have a XmlDocument in java, created with the Weblogic XmlDocument parser.
I want to replace the content of a tag in this XMLDocument with my own data, or insert the tag if it isn't there.
<customdata>
<tag1 />
<tag2>mfkdslmlfkm</tag2>
<location />
<tag3 />
</customdata>
For example I want to insert a URL... | To replace or insert a tag's content in an `XmlDocument` using the WebLogic XML cursor API, your current approach is mostly correct, but it can indeed be simplified. Here's a refactored version of your code that should do what you need more clearly. This version does the following:
1. It checks if the `<location>` tag... | 5,474 | [
{
"from": "human",
"value": "I have a XmlDocument in java, created with the Weblogic XmlDocument parser.\nI want to replace the content of a tag in this XMLDocument with my own data, or insert the tag if it isn't there.\n<customdata>\n <tag1 />\n <tag2>mfkdslmlfkm</tag2>\n <location />\n <tag3 />\n<... |
I'm creating a custom drop down list with AJAX dropdownextender. Inside my drop panel I have linkbuttons for my options.
<asp:Label ID="ddl_Remit" runat="server" Text="Select remit address."
Style="display: block; width: 300px; padding:2px; padding-right: 50px; font-family: Tahoma; font-size: 11px;" />
<asp:Panel ... | To address the issue you're facing with dynamically creating `LinkButton` controls and trying to trigger client-side JavaScript functions or server-side event handlers, let’s break down your approach and identify the key issues and how to resolve them.
### Key Issues
1. **Client-side Script with HTML**: When you creat... | 4,715 | [
{
"from": "human",
"value": "I'm creating a custom drop down list with AJAX dropdownextender. Inside my drop panel I have linkbuttons for my options.\n<asp:Label ID=\"ddl_Remit\" runat=\"server\" Text=\"Select remit address.\"\n Style=\"display: block; width: 300px; padding:2px; padding-right: 50px; fon... |
The System.Windows.Threading.DispatcherObject class (which DependencyObject is based on) contains a useful function, called CheckAccess(), that determines whether or not the code is running on the UI thread.
When I wanted to use it yesterday, I was puzzled to find out that Intellisense didn't show the function (nor Ver... | The `EditorBrowsable(EditorBrowsableState.Never)` attribute is indeed a design choice made by the developers of the .NET Framework, particularly for classes like `DispatcherObject` and `Dispatcher`. Here’s a breakdown of why this might be the case and the reasoning behind these design decisions:
### Purpose of `CheckA... | 5,771 | [
{
"from": "human",
"value": "The System.Windows.Threading.DispatcherObject class (which DependencyObject is based on) contains a useful function, called CheckAccess(), that determines whether or not the code is running on the UI thread.\nWhen I wanted to use it yesterday, I was puzzled to find out that Inte... |
We have an InnoDB database that is about 70 GB and we expect it to grow to several hundred GB in the next 2 to 3 years. About 60 % of the data belong to a single table. Currently the database is working quite well as we have a server with 64 GB of RAM, so almost the whole database fits into memory, but we’re concerned ... | Given your situation, it sounds like you've already done some significant planning and improvements to accommodate the growing size of your database. Since you're dealing with a substantial amount of data, let’s discuss your options for managing and scaling your database effectively as you move forward.
1. **MySQL Par... | 4,432 | [
{
"from": "human",
"value": "We have an InnoDB database that is about 70 GB and we expect it to grow to several hundred GB in the next 2 to 3 years. About 60 % of the data belong to a single table. Currently the database is working quite well as we have a server with 64 GB of RAM, so almost the whole databa... |
What do you think is the best way to create SEO friendly URLs (dynamically) in Rails?
| Creating SEO-friendly URLs in a Ruby on Rails application can significantly enhance the visibility of your website on search engines. Here are some best practices for generating dynamic, SEO-friendly URLs in Rails:
### 1. **Use Friendly IDs**
Using a "friendly" version of your identifiers (like slugs) in your URLs is... | 4,693 | [
{
"from": "human",
"value": "What do you think is the best way to create SEO friendly URLs (dynamically) in Rails?\n"
},
{
"from": "gpt",
"value": "Creating SEO-friendly URLs in a Ruby on Rails application can significantly enhance the visibility of your website on search engines. Here are some ... |
I would like to get data from from different webpages such as addresses of restaurants or dates of different events for a given location and so on. What is the best library I can use for extracting this data from a given set of sites?
| To extract data from different webpages, you can use several libraries that are designed for web scraping. The best library for you will depend on your specific use case, but here are some popular options:
1. **Beautiful Soup**:
- A widely-used library for web scraping in Python. It allows you to parse HTML and XM... | 4,034 | [
{
"from": "human",
"value": "I would like to get data from from different webpages such as addresses of restaurants or dates of different events for a given location and so on. What is the best library I can use for extracting this data from a given set of sites? \n"
},
{
"from": "gpt",
"value":... |
I am developing a mid-size application with VB2008. To better test my application I am following a MVP/Supervising Controller approach.
My question is: What are your recommendations to separate responsibilites? So far I've come up with a winform with an instance of a controller and with an instance of my class. The con... | When you're developing an application using the MVP (Model-View-Presenter) or Supervising Controller design pattern, it's important to clearly separate the responsibilities of each component. Here’s a basic guideline on how you might structure your application using VB2008, along with an example.
### Responsibilities ... | 2,366 | [
{
"from": "human",
"value": "I am developing a mid-size application with VB2008. To better test my application I am following a MVP/Supervising Controller approach.\nMy question is: What are your recommendations to separate responsibilites? So far I've come up with a winform with an instance of a controller... |
I want to catch all unhandled exceptions thrown in a remote object on the server and log them there before I translate them into some custom exception so that specific exceptions do not cross the client/server boundary.
I think I have to use a custom channel sync, but can anyone confirm this and/or have any other advic... | To catch unhandled exceptions thrown in a remote object on the server and log them before translating them into custom exceptions for the client, you will need to implement a mechanism to intercept these exceptions. Using a custom channel sink is indeed one way to achieve this in .NET Remoting. Here’s a general approac... | 5,322 | [
{
"from": "human",
"value": "I want to catch all unhandled exceptions thrown in a remote object on the server and log them there before I translate them into some custom exception so that specific exceptions do not cross the client/server boundary.\nI think I have to use a custom channel sync, but can anyon... |
When using the php include function the include is succesfully executed, but it is also outputting a char before the output of the include is outputted, the char is of hex value 3F and I have no idea where it is coming from, although it seems to happen with every include.
At first I thbought it was file encoding, but ... | The issue you're encountering, where a character with a hex value of `3F` (which corresponds to the `?` character) is appearing before the output of your include file, can be related to a few different factors. Here are some potential causes and solutions to explore:
### 1. **File Encoding**
Even though you mentioned ... | 7,294 | [
{
"from": "human",
"value": "When using the php include function the include is succesfully executed, but it is also outputting a char before the output of the include is outputted, the char is of hex value 3F and I have no idea where it is coming from, although it seems to happen with every include. \nAt f... |
We are trying to implement a REST API for an application we have now. We want to expose read/write capabilities for various resources using the REST API. How do we implement the "form" part of this? I get how to expose "read" of our data by creating RESTful URLs that essentially function as method calls and return the ... | You're on the right track with your understanding of REST and HTTP methods. Let's break this down into parts to clarify how to handle both the read and write (edit) capabilities in a RESTful API, especially when working with an AJAX-based user interface.
### 1. **Implementing Read Operations**
As you've already noted... | 5,030 | [
{
"from": "human",
"value": "We are trying to implement a REST API for an application we have now. We want to expose read/write capabilities for various resources using the REST API. How do we implement the \"form\" part of this? I get how to expose \"read\" of our data by creating RESTful URLs that essenti... |
I would like to give a class a unique ID every time a new one is instantiated. For example with a class named Foo i would like to be able to do the following
dim a as New Foo()
dim b as New Foo()
and a would get a unique id and b would get a unique ID. The ids only have to be unique over run time so i would just lik... | Your implementation is on the right track, but there are a couple of issues with the way you've defined the `_nextId` variable. In Visual Basic .NET (VB.NET), a `Shared ReadOnly` variable cannot be modified after its initial declaration. The `ReadOnly` keyword means that you can only assign a value to it when it is dec... | 5,523 | [
{
"from": "human",
"value": "I would like to give a class a unique ID every time a new one is instantiated. For example with a class named Foo i would like to be able to do the following\ndim a as New Foo()\ndim b as New Foo()\n\nand a would get a unique id and b would get a unique ID. The ids only have t... |
I have a need to create a "transactional" process using an external API that does not support COM+ or .NET transactions (Sharepoint to be exact)
What I need to do is to be able to perform a number of processes in a sequence, but any failure in that sequence means that I will have to manually undo all of the previous st... | When working with an external API that does not support transaction management (like SharePoint in your case), implementing a transactional process can be challenging. Since you need to perform multiple steps in sequence and be able to roll back any completed steps in case of a failure, you might consider the following... | 4,771 | [
{
"from": "human",
"value": "I have a need to create a \"transactional\" process using an external API that does not support COM+ or .NET transactions (Sharepoint to be exact)\nWhat I need to do is to be able to perform a number of processes in a sequence, but any failure in that sequence means that I will ... |
I have an exe with an App.Config file. Now I want to create a wrapper dll around the exe in order to consume some of the functionalities.
The question is how can I access the app.config property in the exe from the wrapper dll?
Maybe I should be a little bit more in my questions, I have the following app.config content... | To access the `app.config` settings of an executable from a wrapper DLL, you can use the `ConfigurationManager` class from the `System.Configuration` namespace. However, there are a few nuances to consider:
1. **Assembly Context**: The `app.config` file of the executable is loaded into the application domain where the... | 6,990 | [
{
"from": "human",
"value": "I have an exe with an App.Config file. Now I want to create a wrapper dll around the exe in order to consume some of the functionalities.\nThe question is how can I access the app.config property in the exe from the wrapper dll?\nMaybe I should be a little bit more in my questio... |
When I'm creating a user for my web application, an SMTP email (using ASP.NET's SmtpClient) is sent to the user with the
automatically generated password. However, sometimes what I notice is that it times out and the new user simply won't receive the email with the password.
Alright, so I'll display a message indicatin... | Handling email notifications during user creation in a web application requires a balance between ensuring users receive their passwords promptly and managing the potential for timeouts and failures in the email-sending process. Here are some best practices and considerations for your situation:
### 1. **Retry Mechani... | 7,027 | [
{
"from": "human",
"value": "When I'm creating a user for my web application, an SMTP email (using ASP.NET's SmtpClient) is sent to the user with the\nautomatically generated password. However, sometimes what I notice is that it times out and the new user simply won't receive the email with the password.\nA... |
I need to enumerate though generic IList<> of objects. The contents of the list may change, as in being added or removed by other threads, and this will kill my enumeration with a "Collection was modified; enumeration operation may not execute."
What is a good way of doing threadsafe foreach on a IList<>? prefferably w... | When dealing with a generic `IList<T>` in a multithreaded environment where you need to enumerate over it while accounting for possible modifications from other threads, you can use various approaches to make your enumeration thread-safe without cloning the entire list or the objects within it.
### 1. Use a Lock
One ... | 6,944 | [
{
"from": "human",
"value": "I need to enumerate though generic IList<> of objects. The contents of the list may change, as in being added or removed by other threads, and this will kill my enumeration with a \"Collection was modified; enumeration operation may not execute.\"\nWhat is a good way of doing th... |
There's plenty of them out there but none of them do what I would like them to do.
Most of them crash when opening a file or simply corrupt the data. Many don't run at all. It seems to me that most were written 3-4 years ago for AS2 .sols and no longer work with FP9/AS3 sols. I'd attempt to write my own using AIR but I... | It sounds like you're dealing with a challenging issue related to reading and writing Flash Shared Object (.sol) files, particularly with changes in the format that may have occurred since Flash Player 9 and the transition to ActionScript 3 (AS3).
Since you're looking for a solution to read, edit, and save .sol files,... | 6,304 | [
{
"from": "human",
"value": "There's plenty of them out there but none of them do what I would like them to do.\nMost of them crash when opening a file or simply corrupt the data. Many don't run at all. It seems to me that most were written 3-4 years ago for AS2 .sols and no longer work with FP9/AS3 sols. I... |
In an embedded application (written in C, on a 32-bit processor) with hard real-time constraints, the execution time of critical code (specially interrupts) needs to be constant.
How do you insure that time variability is not introduced in the execution of the code, specifically due to the processor's caches (be it L1,... | To ensure that execution time variability is minimized due to the processor's caches in an embedded application with hard real-time constraints, you can adopt several strategies that focus on cache behavior and memory management. Below are some of the key techniques:
### 1. **Cache Locking**:
- If supported by your... | 5,960 | [
{
"from": "human",
"value": "In an embedded application (written in C, on a 32-bit processor) with hard real-time constraints, the execution time of critical code (specially interrupts) needs to be constant.\nHow do you insure that time variability is not introduced in the execution of the code, specificall... |
Does anyone know of an open source module or a good method for handling application errors and e-mailing them to an admin and/or saving to a database?
| Yes, there are several open-source modules and methods for handling application errors and notifying administrators via email or logging them to a database. The best option often depends on the programming language and framework you're using. Below are some suggestions for popular languages:
### 1. **Python**
- **Sent... | 4,281 | [
{
"from": "human",
"value": "Does anyone know of an open source module or a good method for handling application errors and e-mailing them to an admin and/or saving to a database?\n"
},
{
"from": "gpt",
"value": "Yes, there are several open-source modules and methods for handling application err... |
Now that LINQ to SQL is a little more mature, I'd like to know of any techniques people are using to create an n-tiered solution using the technology, because it does not seem that obvious to me.
| Creating an n-tier architecture using LINQ to SQL can be quite effective, and while LINQ to SQL is a relatively straightforward ORM (Object-Relational Mapping) tool, designing your application in an n-tier fashion requires careful consideration. Below are some techniques and best practices to help you implement an n-ti... | 5,177 | [
{
"from": "human",
"value": "Now that LINQ to SQL is a little more mature, I'd like to know of any techniques people are using to create an n-tiered solution using the technology, because it does not seem that obvious to me.\n"
},
{
"from": "gpt",
"value": "Creating an n-tier architecture using ... |
Does C# have the notion of private / protected inheritance, and if not, why?
C++
class Foo : private Bar {
public:
...
};
C#
public abstract NServlet class : private System.Web.UI.Page
{
// error "type expected"
}
I am implementing a "servlet like" concept in an .aspx page and I don't want the concret... | C# does not support the concept of private or protected inheritance in the same way that C++ does. In C++, you can control the visibility of the base class's members in derived classes using private and protected inheritance. However, C# uses a different model for inheritance and access control.
### Reasons for C#'s D... | 6,222 | [
{
"from": "human",
"value": "Does C# have the notion of private / protected inheritance, and if not, why?\nC++\n\n\nclass Foo : private Bar {\n public:\n ...\n }; \n\n\nC#\n\n\npublic abstract NServlet class : private System.Web.UI.Page\n{\n // error \"type expected\"\n}\n\n\nI am implementing a \"serv... |
What are some simple algorithm or data structure related "white boarding" problems that you find effective during the candidate screening process?
I have some simple ones that I use to validate problem solving skills and that can be simply expressed but have some opportunity for the application of some heuristics.
One ... | Here are some effective whiteboarding problems along with key points to evaluate in candidates' answers:
### 1. **Fibonacci Sequence**
**Problem:** Write a function that computes the nth Fibonacci number.
**What to Look For:**
- Efficiency: Candidates should recognize the difference between a naive recursive ... | 5,152 | [
{
"from": "human",
"value": "What are some simple algorithm or data structure related \"white boarding\" problems that you find effective during the candidate screening process?\nI have some simple ones that I use to validate problem solving skills and that can be simply expressed but have some opportunity ... |
I am trying to understand left outer joins in LINQ to Entity. For example I have the following 3 tables:
Company, CompanyProduct, Product
The CompanyProduct is linked to its two parent tables, Company and Product.
I want to return all of the Company records and the associated CompanyProduct whether the CompanyProduct e... | To achieve the same result as your SQL query using LINQ to Entity, you can use method syntax or query syntax. I'll show you both approaches.
### Method Syntax
Using method syntax, you can use `GroupJoin` to perform a left outer join:
```csharp
using (var context = new YourDbContext())
{
var productId = 14; // The... | 4,391 | [
{
"from": "human",
"value": "I am trying to understand left outer joins in LINQ to Entity. For example I have the following 3 tables:\nCompany, CompanyProduct, Product\nThe CompanyProduct is linked to its two parent tables, Company and Product.\nI want to return all of the Company records and the associated... |
I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports...
| Certainly! If you're looking for updates primarily in SQL syntax, locking mechanisms, and other core database capabilities, here are some trends and developments that have emerged across various SQL databases, particularly in the last few years up to 2023:
### New SQL Syntax Features
1. **Common Table Expressions (CT... | 7,001 | [
{
"from": "human",
"value": "I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports...\n"
},
{
"from": "gpt",
"value": "Certainly! If you're looking for updates primarily in SQL synta... |
I'm using Microsft Visual C# 2008 and am creating WPF applications. If you create a new solution and pick the WPF application template it lets you provide a single string to name the solution.
It then automatically turns that string into a base project name and a namespace using underscores instead of spaces. It als... | Customizing the names of the main classes and namespaces in a WPF application created with Microsoft Visual C# 2008 can be done safely by following these steps:
### Step 1: Rename the Solution and Project
1. **Close Visual Studio**: Ensure that the solution is closed.
2. **Rename Solution Folder**: If you want to ren... | 5,484 | [
{
"from": "human",
"value": "I'm using Microsft Visual C# 2008 and am creating WPF applications. If you create a new solution and pick the WPF application template it lets you provide a single string to name the solution.\nIt then automatically turns that string into a base project name and a namespace usi... |
So, to simplify my life I want to be able to append from 1 to 7 additional characters on the end of some jpg images my program is processing*. These are dummy padding (fillers, etc - probably all 0x00) just to make the file size a multiple of 8 bytes for block encryption.
Having tried this out with a few programs, it ... | Appending bytes to the end of a JPEG file after the End of Image (EOI) marker (0xFF D9) is generally acceptable for your purposes. The JPEG file format specification indicates that the EOI marker marks the end of the image data, and anything that follows this marker is technically not considered part of the image itsel... | 6,255 | [
{
"from": "human",
"value": "So, to simplify my life I want to be able to append from 1 to 7 additional characters on the end of some jpg images my program is processing*. These are dummy padding (fillers, etc - probably all 0x00) just to make the file size a multiple of 8 bytes for block encryption.\nHavi... |
I have an ASP.NET webforms application (3.5 SP1) that I'm working on, and attempting to enable gzip fpr HTML and CSS that comes down the pipe. I'm using this implementation (and tried a few others that hook into Application_BeginRequest), and it seems to be corrupting the external CSS file that the pages use, but inter... | It sounds like you're experiencing issues with GZIP compression in your ASP.NET Web Forms application, especially when serving external CSS files. Here are some steps and considerations to help you troubleshoot and potentially resolve the issue:
### 1. GZIP Implementation
Ensure that your GZIP implementation is corre... | 5,357 | [
{
"from": "human",
"value": "I have an ASP.NET webforms application (3.5 SP1) that I'm working on, and attempting to enable gzip fpr HTML and CSS that comes down the pipe. I'm using this implementation (and tried a few others that hook into Application_BeginRequest), and it seems to be corrupting the extern... |
I've been trying to implement a C#-like event system in C++ with the tr1 function templates used to store a function that handles the event.
I created a vector so that multiple listeners can be attached to this event, i.e.:
vector< function<void (int)> > listenerList;
I'd like to be able to remove a handler from the... | You're correct that managing listeners in an event system, especially in C++, can get a bit clumsy. In particular, managing the lifecycle of those listeners and allowing for easy detachment is a crucial aspect of a well-designed event system.
While you can certainly store listeners as `std::function` in a `std::vector... | 5,582 | [
{
"from": "human",
"value": "I've been trying to implement a C#-like event system in C++ with the tr1 function templates used to store a function that handles the event. \nI created a vector so that multiple listeners can be attached to this event, i.e.:\nvector< function<void (int)> > listenerList;\n\nI'd... |
I've been running into a peculiar issue with certain Java applications in the HP-UX environment.
The heap is set to -mx512, yet, looking at the memory regions for this java process using gpm, it shows it using upwards of 1.6GBs of RSS memory, with 1.1GB allocated to the DATA region. Grows quite rapidly over a 24-48h... | In a Java application, memory management occurs in different regions, namely the Java heap and native (C) heap. Here's a breakdown of how these two memory regions work, along with answers to your specific questions:
### Java Heap vs. C Heap
1. **Java Heap**:
- This is where all Java objects and class instances are... | 4,198 | [
{
"from": "human",
"value": "I've been running into a peculiar issue with certain Java applications in the HP-UX environment. \nThe heap is set to -mx512, yet, looking at the memory regions for this java process using gpm, it shows it using upwards of 1.6GBs of RSS memory, with 1.1GB allocated to the DATA ... |
I am trying to determine the best time efficient algorithm to accomplish the task described below.
I have a set of records. For this set of records I have connection data which indicates how pairs of records from this set connect to one another. This basically represents an undirected graph, with the records being the ... | To find all simple paths between two vertices in an undirected graph efficiently, you can utilize a backtracking algorithm combined with depth-first search (DFS). However, given the potential size of the graph (hundreds of thousands of records), care must be taken to avoid performance issues and excessive memory usage.... | 5,062 | [
{
"from": "human",
"value": "I am trying to determine the best time efficient algorithm to accomplish the task described below.\nI have a set of records. For this set of records I have connection data which indicates how pairs of records from this set connect to one another. This basically represents an und... |
I am trying to call a shell script that sets a bunch of environment variables on our server from a mercurial hook. The shell script gets called fine when a new changegroup comes in, but the environment variables aren't carrying over past the call to the shell script.
My hgrc file on the respository looks like this:
[ho... | When running a shell script from a Mercurial hook, the environment variables set by the script do not persist beyond the life of that script. This is because each hook is executed in a separate subshell. Therefore, any environment variables set in that subshell are not available to the calling process or any subsequent... | 7,011 | [
{
"from": "human",
"value": "I am trying to call a shell script that sets a bunch of environment variables on our server from a mercurial hook. The shell script gets called fine when a new changegroup comes in, but the environment variables aren't carrying over past the call to the shell script.\nMy hgrc fi... |
Most of the work being done at my company is Qt-based C++, and it's all checked into a Subversion repository. Until now, all work on the codebase has been done purely with nano, or perhaps Kate. Being new here, I would like to take advantage of setting up Eclipse -properly- to edit my local copy of the tree. I have the... | Setting up Eclipse with CDT, Qt integration, and Subclipse for a Qt-based C++ project in a Subversion repository requires several steps. Here's a guide to help you properly configure your Eclipse environment:
### 1. **Install Required Plugins**
Make sure you have the following plugins installed:
- **CDT** (C/C++ Devel... | 5,101 | [
{
"from": "human",
"value": "Most of the work being done at my company is Qt-based C++, and it's all checked into a Subversion repository. Until now, all work on the codebase has been done purely with nano, or perhaps Kate. Being new here, I would like to take advantage of setting up Eclipse -properly- to e... |
I use .NET XML technologies quite extensively on my work. One of the things the I like very much is the XSLT engine, more precisely the extensibility of it. However there one little piece which keeps being a source of annoyance. Nothing major or something we can't live with but it is preventing us from producing the be... | To manage namespace declarations more efficiently in .NET when using `XmlWriter`, you can take advantage of the `XmlWriterSettings` and the ability to control namespace declaration behavior through the `WriteStartElement` method. Below are suggestions on how to handle unnecessary namespace declarations and how to overr... | 5,816 | [
{
"from": "human",
"value": "I use .NET XML technologies quite extensively on my work. One of the things the I like very much is the XSLT engine, more precisely the extensibility of it. However there one little piece which keeps being a source of annoyance. Nothing major or something we can't live with but ... |
I have the following Java 6 code:
Query q = em.createNativeQuery(
"select T.* " +
"from Trip T join Itinerary I on (T.itinerary_id=I.id) " +
"where I.launchDate between :start and :end " +
"or ADDDATE(I.launchDate, I.equipmentPullDayOfTrip) between :start and :end",
"TripRes... | The syntax error you are encountering in your Java code is due to the placement of the `@SqlResultSetMapping` annotation. Annotations in Java, such as `@SqlResultSetMapping`, need to be placed above the declaration they are describing, typically on an entity class.
In your provided code snippet, the `@SqlResultSetMap... | 6,654 | [
{
"from": "human",
"value": "I have the following Java 6 code:\n Query q = em.createNativeQuery( \n \"select T.* \" +\n \"from Trip T join Itinerary I on (T.itinerary_id=I.id) \" +\n \"where I.launchDate between :start and :end \" +\n \"or ADDDATE(I.launchDate, I.equipmentPull... |
Say instead of returning void a method you returned a reference to the class even if it didn't make any particular semantic sense. It seems to me like it would give you more options on how the methods are called, allowing you to use it in a fluent-interface-like style and I can't really think of any disadvantages sinc... | The idea of returning a reference to the class instance (often referred to as `this`) from methods instead of returning `void` can indeed facilitate a fluent interface style. This pattern allows for method chaining, where you can chain multiple method calls together in a single line, leading to more readable and expres... | 6,621 | [
{
"from": "human",
"value": "Say instead of returning void a method you returned a reference to the class even if it didn't make any particular semantic sense. It seems to me like it would give you more options on how the methods are called, allowing you to use it in a fluent-interface-like style and I can... |
I've encountered the term "multi-agent computing" as of late, and I don't quite get what it is. I've read a book about it, but that didn't answer the fundamental question of what an agent was.
Does someone out there have a pointer to some reference which is clear and concise and answers the question without a load of b... | Multi-agent computing (MAC) is a subfield of computer science and artificial intelligence that focuses on systems composed of multiple interacting agents. To understand this concept clearly, it's essential to first define what an "agent" is.
### What is an Agent?
In the context of multi-agent systems, an agent can be... | 6,776 | [
{
"from": "human",
"value": "I've encountered the term \"multi-agent computing\" as of late, and I don't quite get what it is. I've read a book about it, but that didn't answer the fundamental question of what an agent was.\nDoes someone out there have a pointer to some reference which is clear and concise ... |
I have a new 1 TB drive coming in tomorrow. What is the best way to divide this space for a development workstation?
The biggest problem I think I'm going to have is that some partitions (probably /usr) will become to small after a bit of use. Other partitions are probably to huge. The swap drive for example is current... | When partitioning a new 1 TB drive for a development workstation, you'll want to strike a balance between adequate space for various directories (like `/usr`, `/var`, and `/home`), while also allowing for flexibility to adapt to future needs. Below are some considerations and a suggested partitioning scheme:
### Consi... | 2,884 | [
{
"from": "human",
"value": "I have a new 1 TB drive coming in tomorrow. What is the best way to divide this space for a development workstation?\nThe biggest problem I think I'm going to have is that some partitions (probably /usr) will become to small after a bit of use. Other partitions are probably to h... |
What I mean by autolinking is the process by which wiki links inlined in page content are generated into either a hyperlink to the page (if it does exist) or a create link (if the page doesn't exist).
With the parser I am using, this is a two step process - first, the page content is parsed and all of the links to wiki... | Handling autolinking in a wiki system efficiently is crucial, especially as the number of pages increases. Here are some considerations to help you decide the best approach:
### 1. **Cached List vs. Individual Lookups**
**Cached List:**
- **Pros:**
- **Performance:** A cached list of existing pages allows for fast ... | 4,334 | [
{
"from": "human",
"value": "What I mean by autolinking is the process by which wiki links inlined in page content are generated into either a hyperlink to the page (if it does exist) or a create link (if the page doesn't exist).\nWith the parser I am using, this is a two step process - first, the page cont... |
I have a web application that should behave differently for internal users than external ones. The web application is available over the Internet, and therefore obviously to the internal users as well.
All the users are anonymous, not authenticated, but the page should render differently for internal users than externa... | To differentiate between internal and external users in a web application, relying solely on `Request.UserHostName` can indeed lead to inconsistencies due to factors like network configurations, proxies, and NAT. Here are some alternative approaches you can consider:
### 1. Use `Request.UserHostAddress`
Instead of `Re... | 2,680 | [
{
"from": "human",
"value": "I have a web application that should behave differently for internal users than external ones. The web application is available over the Internet, and therefore obviously to the internal users as well.\nAll the users are anonymous, not authenticated, but the page should render d... |
At my job, I have a clutch of six Windows services that I am responsible for, written in C# 2003. Each of these services contain a timer that fires every minute or so, where the majority of their work happens.
My problem is that, as these services run, they start to consume more and more CPU time through each iteration... | It sounds like you're dealing with a frustrating problem that's likely due to resource management and memory usage in your long-running Windows services. Given that you're using .NET 1.1 and NHibernate, there are a few areas you could explore for potential leaks or inefficiencies that may be leading to the CPU usage in... | 2,574 | [
{
"from": "human",
"value": "At my job, I have a clutch of six Windows services that I am responsible for, written in C# 2003. Each of these services contain a timer that fires every minute or so, where the majority of their work happens.\nMy problem is that, as these services run, they start to consume mor... |
We are changing our remote log-in security process at my workplace, and we are concerned that the new system does not use multi-factor authentication as the old one did. (We had been using RSA key-fobs, but they are being replaced due to cost.) The new system is an anti-phishing image system which has been misunderstoo... | Yes, it is indeed possible to implement a software-based token system on user PCs that could serve as a true second factor in a multi-factor authentication (MFA) setup. Here's how it can work and how it fits into the definitions of authentication factors:
### 1. Understanding Authentication Factors
In a multi-factor a... | 6,851 | [
{
"from": "human",
"value": "We are changing our remote log-in security process at my workplace, and we are concerned that the new system does not use multi-factor authentication as the old one did. (We had been using RSA key-fobs, but they are being replaced due to cost.) The new system is an anti-phishing... |
My asp.net page will render different controls based on which report a user has selected e.g. some reports require 5 drop downs, some two checkboxes and 6 dropdowns).
They can select a report using two methods. With SelectedReport=MyReport in the query string, or by selecting it from a dropdown. And it's a common case ... | In ASP.NET, the query string is indeed read-only, and while you can't modify it directly, you can achieve your goal by using a combination of client-side JavaScript and server-side handling. Here's an approach to modify the query string based on the selected value of your dropdown while preserving the ViewState.
### A... | 7,031 | [
{
"from": "human",
"value": "My asp.net page will render different controls based on which report a user has selected e.g. some reports require 5 drop downs, some two checkboxes and 6 dropdowns).\nThey can select a report using two methods. With SelectedReport=MyReport in the query string, or by selecting i... |
I installed ActiveReports from their site. The version was labeled as .NET 2.0 build 5.2.1013.2 (for Visual Studio 2005 and 2008). I have an ASP.NET project in VS 2008 which has 2.0 as target framework. I added all the tools in the DataDynamics namespace to the toolbox, created a new project, added a new report.
When ... | It sounds like you're facing a couple of issues with integrating ActiveReports into your ASP.NET project. Let's go through some steps to troubleshoot and resolve the problem:
1. **Check Toolbox Configuration**:
- After adding the DataDynamics components to the toolbox, make sure that they are properly added. You c... | 4,897 | [
{
"from": "human",
"value": "I installed ActiveReports from their site. The version was labeled as .NET 2.0 build 5.2.1013.2 (for Visual Studio 2005 and 2008). I have an ASP.NET project in VS 2008 which has 2.0 as target framework. I added all the tools in the DataDynamics namespace to the toolbox, created... |
When you subscribe to an event on an object from within a form, you are essentially handing over control of your callback method to the event source. You have no idea whether that event source will choose to trigger the event on a different thread.
The problem is that when the callback is invoked, you cannot assume tha... | You’re right to point out the challenges associated with updating UI controls from event callbacks that may be triggered on a different thread. In many GUI frameworks (like WinForms, WPF, etc.), UI controls are generally not thread-safe, meaning that they should only be accessed or modified from the thread on which the... | 4,854 | [
{
"from": "human",
"value": "When you subscribe to an event on an object from within a form, you are essentially handing over control of your callback method to the event source. You have no idea whether that event source will choose to trigger the event on a different thread.\nThe problem is that when the ... |
Let's take a web development environment, where developers checkout a project onto their local machines, work on it, and check in changes to development.
These changes are further tested on development and moved live on a regular schedule (eg weekly, monthly, etc.).
Is it possible to have an auto-moveup of the latest t... | Yes, it is possible to automatically deploy the latest tagged version of a project to a live environment at a scheduled time, such as 8 AM on Monday mornings. This can typically be accomplished using a combination of a version control system (VCS) like Git and automation tools such as cron jobs, CI/CD (Continuous Integ... | 4,731 | [
{
"from": "human",
"value": "Let's take a web development environment, where developers checkout a project onto their local machines, work on it, and check in changes to development.\nThese changes are further tested on development and moved live on a regular schedule (eg weekly, monthly, etc.).\nIs it poss... |
I am trying to paginate the results of an SQL query for use on a web page. The language and the database backend are PHP and SQLite.
The code I'm using works something like this (page numbering starts at 0)
http://example.com/table?page=0
page = request(page)
per = 10 // results per page
offset = page * per
// take o... | You're right to consider the implications of how you're currently handling pagination in your application. There are several strategies you could consider to optimize the performance and efficiency of your pagination logic in PHP with SQLite, and it often depends on the specific context and requirements of your applica... | 4,275 | [
{
"from": "human",
"value": "I am trying to paginate the results of an SQL query for use on a web page. The language and the database backend are PHP and SQLite.\nThe code I'm using works something like this (page numbering starts at 0)\nhttp://example.com/table?page=0\npage = request(page)\nper = 10 // re... |
I have a javascript function that manipulates the DOM when it is called (adds CSS classes, etc). This is invoked when the user changes some values in a form. When the document is first loading, I want to invoke this function to prepare the initial state (which is simpler in this case than setting up the DOM from the ... | Both approaches you've mentioned are valid for invoking a function after the DOM is ready, but they have different implications and considerations:
### Option 1: Using `window.onload`
```javascript
window.onload = function() {
updateDOM("myElement");
};
```
**Pros:**
- Ensures that all resources (images, stylesh... | 5,134 | [
{
"from": "human",
"value": "I have a javascript function that manipulates the DOM when it is called (adds CSS classes, etc). This is invoked when the user changes some values in a form. When the document is first loading, I want to invoke this function to prepare the initial state (which is simpler in th... |
How can I go about hosting flash content inside a WPF form and still use transparency/alpha on my WPF window? Hosting a WinForms flash controls does not allow this.
| Hosting Flash content inside a WPF application while maintaining window transparency can be a bit tricky due to the way both technologies handle rendering and compositing. Flash content typically does not support the alpha channel required for transparency in WPF. However, you can achieve a solution using a few differe... | 4,175 | [
{
"from": "human",
"value": "How can I go about hosting flash content inside a WPF form and still use transparency/alpha on my WPF window? Hosting a WinForms flash controls does not allow this.\n"
},
{
"from": "gpt",
"value": "Hosting Flash content inside a WPF application while maintaining win... |
There are about 200 projects in cvs and at least 100 projects in vss. Some are inactive code in maintenance mode. Some are legacy apps. Some are old apps no longer in use. About 10% are in active development. The plan is to move everything to perforce my end of year 2009.
Has anyone done a large migration like this?
H... | Migrating from CVS (Concurrent Versions System) and VSS (Visual SourceSafe) to Perforce (Helix Core) is a significant task, especially with the number of projects you mentioned. Here are some best practices and considerations based on industry experiences and common challenges associated with such migrations:
### Best... | 5,116 | [
{
"from": "human",
"value": "There are about 200 projects in cvs and at least 100 projects in vss. Some are inactive code in maintenance mode. Some are legacy apps. Some are old apps no longer in use. About 10% are in active development. The plan is to move everything to perforce my end of year 2009.\nHas a... |
I'm looking for a simple, sample snippet of C# code to monitor an Oracle database and basically check for its last update. It could be either command line (great for future integration with Nagios) or GUI. I've did some prototypes but the code tend to get lengthy as I'm still kind of learning the language.
Any suggesti... | Certainly! Below is a simple C# console application that connects to an Oracle database and checks for the last update time of a specified table. This example assumes you are using the Oracle Data Provider for .NET (ODP.NET). You'll need to install the ODP.NET package via NuGet if you haven't already.
### Step 1: Inst... | 6,465 | [
{
"from": "human",
"value": "I'm looking for a simple, sample snippet of C# code to monitor an Oracle database and basically check for its last update. It could be either command line (great for future integration with Nagios) or GUI. I've did some prototypes but the code tend to get lengthy as I'm still ki... |
I am facing problem with an Oracle Query in a .net 2.0 based windows application. I am using System.Data.OracleClient to connect to oracle database. Name of database is myDB. Below the the connection string I am using:
Data Source=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)
(HOST = 172.16.0.24)(PORT = 152... | The behavior you're encountering is likely related to the way Oracle handles the concept of schemas and object visibility. In Oracle, if you do not specify a schema (database name), it will default to the schema that corresponds to the user you are connected with. If your database `myDB` corresponds to a different sche... | 5,179 | [
{
"from": "human",
"value": "I am facing problem with an Oracle Query in a .net 2.0 based windows application. I am using System.Data.OracleClient to connect to oracle database. Name of database is myDB. Below the the connection string I am using:\nData Source=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOC... |
I am building a public website using ASP.NET, as part of the deliverable I need to do an Admin Site for data entry of the stuff shown in the public site, I was wondering what techniques or procedures are people using to validate entries using ASP.NET MVC.
| When building an ASP.NET MVC application, validation of user input is crucial for ensuring data integrity and security. Here are several techniques and procedures commonly used for validating entries in an admin site for data entry:
### 1. **Data Annotations**
ASP.NET MVC provides a built-in way to validate model pro... | 1,547 | [
{
"from": "human",
"value": "I am building a public website using ASP.NET, as part of the deliverable I need to do an Admin Site for data entry of the stuff shown in the public site, I was wondering what techniques or procedures are people using to validate entries using ASP.NET MVC.\n"
},
{
"from":... |
Does anyone have any practical suggestions about how to manage feature creep in GUIs?
I'm getting strong pressure from both internal and external sources to add, modify, tweak, etc. I always cringe when someone approaches me with the words "wouldn't it be nice if...?". I can't just turn around and yell "NO" at them, b... | Managing feature creep in GUIs is a common challenge in software development, especially when working with stakeholders who are eager to see new functionalities. Here are some practical suggestions to help you navigate these discussions and maintain focus on the core objectives of your project:
### 1. **Establish Clea... | 3,078 | [
{
"from": "human",
"value": "Does anyone have any practical suggestions about how to manage feature creep in GUIs? \nI'm getting strong pressure from both internal and external sources to add, modify, tweak, etc. I always cringe when someone approaches me with the words \"wouldn't it be nice if...?\". I can... |
Every few days VS2008 decides to get mad at me and fails to generate a designer file claiming it cannot find the file specified and that it's missing an assembly. Here's the scenario:
The aspx page has a reference to a custom user control (inheriting UserControl) which references another assembly in the backend. Ther... | Dealing with Visual Studio 2008 designer issues can be quite frustrating, especially when it seems to randomly fail to generate designer files. Here are several suggestions you can try to resolve the problem:
1. **Clean and Rebuild Solution**: Make sure to perform a full clean and then rebuild the entire solution. Som... | 5,234 | [
{
"from": "human",
"value": "Every few days VS2008 decides to get mad at me and fails to generate a designer file claiming it cannot find the file specified and that it's missing an assembly. Here's the scenario:\nThe aspx page has a reference to a custom user control (inheriting UserControl) which referen... |
On a web page I want to dynamically render very basic flow diagrams, i.e. a few boxes joined by lines. Ideally the user could then click on one of these boxes (DIVs?) and be taken to a different page. Resorting to Flash seems like an overkill. Is anyone aware of any client-side (i.e. server agnostic) Javascript or CSS ... | Absolutely! There are several client-side libraries that can help you create flow diagrams with clickable boxes without resorting to Flash. Here are some options you might consider:
### 1. **D3.js**
D3.js is a powerful JavaScript library for producing dynamic, interactive data visualizations in web browsers. You can c... | 539 | [
{
"from": "human",
"value": "On a web page I want to dynamically render very basic flow diagrams, i.e. a few boxes joined by lines. Ideally the user could then click on one of these boxes (DIVs?) and be taken to a different page. Resorting to Flash seems like an overkill. Is anyone aware of any client-side ... |
I'm building a group calendar application that needs to support recurring events, but all the solutions I've come up with to handle these events seem like a hack. I can limit how far ahead one can look, and then generate all the events at once. Or I can store the events as repeating and dynamically display them when on... | When it comes to modeling recurring events in a calendar application, there are a few best practices that can help you handle both the occurrence of these events and the ability to modify or delete specific instances. Here’s a structured approach you might consider:
### 1. Data Model Design
#### a. Event Table
Create... | 5,084 | [
{
"from": "human",
"value": "I'm building a group calendar application that needs to support recurring events, but all the solutions I've come up with to handle these events seem like a hack. I can limit how far ahead one can look, and then generate all the events at once. Or I can store the events as repea... |
Here's my problem - I'd like to communicate between two websites and I'm looking for a clean solution. The current solution uses Javascript but there are nasty workarounds because of (understandable) cross-site scripting restrictions.
At the moment, website A opens a modal window containing website B using a jQuery plu... | Communicating between two different websites while avoiding cross-site scripting issues can be challenging. However, there are several modern approaches you can consider that offer cleaner solutions than the workaround you described. Here are a few suggestions:
### 1. **Cross-Origin Resource Sharing (CORS)**
If you co... | 6,216 | [
{
"from": "human",
"value": "Here's my problem - I'd like to communicate between two websites and I'm looking for a clean solution. The current solution uses Javascript but there are nasty workarounds because of (understandable) cross-site scripting restrictions.\nAt the moment, website A opens a modal wind... |
I'm a 1-2 man band at work, and so far I've been using VSS for two reasons 1) the company was using that when I started a few months ago, and 2) it is friendly with Visual Studio.
Needless to say, I would very much like to upgrade to a not-so-archaic source control system. However, I don't want to give up the friendli... | You're definitely not alone in wanting to transition away from Visual SourceSafe (VSS) to a more modern and reliable source control system. Many developers have made similar moves, and fortunately, there are some great options available that are compatible with Visual Studio and provide a smoother, more robust experien... | 5,036 | [
{
"from": "human",
"value": "I'm a 1-2 man band at work, and so far I've been using VSS for two reasons 1) the company was using that when I started a few months ago, and 2) it is friendly with Visual Studio.\nNeedless to say, I would very much like to upgrade to a not-so-archaic source control system. How... |
What are the best practices for checking in BIN directories in a collaborative development environment using SVN? Should project level references be excluded from checkin? Is it easier to just add all bin directories?
I develop a lot of DotNetNuke sites and it seems that in a multi-developer environment, it's always ... | When working with a collaborative development environment using SVN (Subversion) and specifically with DotNetNuke (DNN) sites, managing the `bin` directories effectively is crucial for ensuring a smooth setup for new developers. Here are some best practices to consider:
### 1. **Exclude `bin` Directories from Check-In... | 2,252 | [
{
"from": "human",
"value": "What are the best practices for checking in BIN directories in a collaborative development environment using SVN? Should project level references be excluded from checkin? Is it easier to just add all bin directories?\nI develop a lot of DotNetNuke sites and it seems that in a... |
Here's the scenario:
A C# Windows Application project stored in SVN is used to create an executable. Normally, a build server handles the build process and creates builds at regular intervals which are used by testing. In this particular instance I was asked to modify a specific build and create the executable.
I'm n... | In scenarios like this, where you have consistent source code but different behavior from executables built on different machines, there are several factors to consider that might lead to discrepancies. Here are some possibilities and how you might investigate them:
### Factors to Consider
1. **Regional Settings / Cu... | 5,725 | [
{
"from": "human",
"value": "Here's the scenario: \nA C# Windows Application project stored in SVN is used to create an executable. Normally, a build server handles the build process and creates builds at regular intervals which are used by testing. In this particular instance I was asked to modify a specif... |
I'm going to try something with the format of this question and I'm very open to suggestions about a better way to handle it.
I didn't want to just dump a bunch of code in the question so I've posted the code for the class on refactormycode.
base class for easy class property handling
My thought was that people can eit... | Your approach to handling getters and setters using PHP's magic `__call` method is quite innovative and has its merits in terms of reducing boilerplate code. However, as you've identified, it also has significant downsides, especially around clarity, documentation, and maintainability.
Here are some thoughts and sugge... | 1,404 | [
{
"from": "human",
"value": "I'm going to try something with the format of this question and I'm very open to suggestions about a better way to handle it.\nI didn't want to just dump a bunch of code in the question so I've posted the code for the class on refactormycode.\nbase class for easy class property ... |
I have a large, hi-def JavaScript-intensive image banner for a site I'm designing. What is everyone's opinion of using iframes so that you incur the load time only once? Is there a CSS alternative to the iframe?
Feel free to preview the site.
It is very much a work in progress.
| Using iframes for a large, JavaScript-intensive image banner can have both advantages and disadvantages. Here are some points to consider:
### Advantages of using iframes:
1. **Isolation**: Iframes allow you to encapsulate the content, meaning that any JavaScript or CSS conflicts with the main page's styles/scripts ca... | 4,706 | [
{
"from": "human",
"value": "I have a large, hi-def JavaScript-intensive image banner for a site I'm designing. What is everyone's opinion of using iframes so that you incur the load time only once? Is there a CSS alternative to the iframe?\nFeel free to preview the site.\nIt is very much a work in progre... |
Where is the best tutorial for getting Ruby On Rails working on a windows box with Mongrel? I'm a complete novice at server management, so the more detailed the better!
| Getting Ruby on Rails set up on a Windows machine can be a bit challenging, especially if you're new to server management. Here's a step-by-step guide to help you get started with Ruby on Rails and Mongrel on Windows.
### Step 1: Install Ruby
1. **Download RubyInstaller**: Go to [RubyInstaller for Windows](https://ru... | 5,599 | [
{
"from": "human",
"value": "Where is the best tutorial for getting Ruby On Rails working on a windows box with Mongrel? I'm a complete novice at server management, so the more detailed the better!\n"
},
{
"from": "gpt",
"value": "Getting Ruby on Rails set up on a Windows machine can be a bit c... |
I'm setting up a web application with a FreeBSD PostgreSQL back-end. I'm looking for some database performance optimization tool/technique.
| Optimizing a PostgreSQL database on FreeBSD for a web application involves several strategies and tools. Here are some techniques and tools you can use to improve the performance of your database:
### Configuration Optimization
1. **PostgreSQL Configuration**:
- Adjust the `postgresql.conf` settings based on your ... | 4,828 | [
{
"from": "human",
"value": "I'm setting up a web application with a FreeBSD PostgreSQL back-end. I'm looking for some database performance optimization tool/technique.\n"
},
{
"from": "gpt",
"value": "Optimizing a PostgreSQL database on FreeBSD for a web application involves several strategies ... |
Being new to Objective-C (but a long term C/++) programmer I'm looking for advice/recommendations on naming conventions for variables.
My personal preference would be to utilize a prefix for instance variables both for clarity within functions and to prevent shadowing of function parameters. However I'm a fan of proper... | It's great to hear that you're diving into Objective-C with your background in C and C++. Naming conventions and variable management are essential for writing clean and maintainable code, especially in a language like Objective-C.
### Naming Conventions:
1. **Instance Variables**:
- It is common to use an undersco... | 5,138 | [
{
"from": "human",
"value": "Being new to Objective-C (but a long term C/++) programmer I'm looking for advice/recommendations on naming conventions for variables.\nMy personal preference would be to utilize a prefix for instance variables both for clarity within functions and to prevent shadowing of functi... |
I have a small diagnostic VB.Net application ( 2 forms, 20 subs & functions) written using VB.Net 2008 that targets Framework 2.0 and higher, but now I realize I need to support Framework 1.1. I'm looking for the most efficient way to accomplish this given these constraints:
I don't know which parts of the applicati... | Supporting .NET Framework 1.1 while having developed with VB.NET 2008 (which targets 2.0 and higher) requires careful consideration, especially since there are many differences in the frameworks. Here are some strategies you can consider for efficiently downgrading your application:
### 1. Analyze the Code for 2.0-Spe... | 5,871 | [
{
"from": "human",
"value": "I have a small diagnostic VB.Net application ( 2 forms, 20 subs & functions) written using VB.Net 2008 that targets Framework 2.0 and higher, but now I realize I need to support Framework 1.1. I'm looking for the most efficient way to accomplish this given these constraints:\n... |
Using C# and WPF under .NET (rather than Windows Forms or console), what is the correct way to create an application that can only be run as a single instance?
I know it has something to do with some mythical thing called a mutex, rarely can I find someone that bothers to stop and explain what one of these are.
The cod... | Creating a single-instance WPF application using a mutex is indeed a common approach. A mutex (short for "mutual exclusion") is a synchronization primitive that can be used to manage access to a resource across multiple threads or processes. In the context of your application, you can use a mutex to ensure that only on... | 3,320 | [
{
"from": "human",
"value": "Using C# and WPF under .NET (rather than Windows Forms or console), what is the correct way to create an application that can only be run as a single instance?\nI know it has something to do with some mythical thing called a mutex, rarely can I find someone that bothers to stop ... |
I'm getting some strange, intermittent, data aborts (< 5% of the time) in some of my code, when calling memset(). The problem is that is usually doesn't happen unless the code is running for a couple days, so it's hard to catch it in the act.
I'm using the following code:
char *msg = (char*)malloc(sizeof(char)*2048);
... | Based on the provided code snippet and the description of your intermittent data aborts, there are several potential issues that could lead to undefined behavior, including memory corruption, buffer overflows, and improper use of memory. Here are some specific areas to examine and suggestions for improvement:
1. **Buf... | 5,344 | [
{
"from": "human",
"value": "I'm getting some strange, intermittent, data aborts (< 5% of the time) in some of my code, when calling memset(). The problem is that is usually doesn't happen unless the code is running for a couple days, so it's hard to catch it in the act.\nI'm using the following code:\ncha... |
How would you make the contents of Flex RIA applications accessible to Google, so that Google can index the content and shows links to the right items in your Flex RIA. Consider a online shop, created in Flex, where the offered items shall be indexed by Google. Then a link on Google should open the corresponding produc... | Making the contents of Flex RIA applications accessible to Google involves a few key strategies, especially since Flex applications are often rendered client-side and may not provide content in a format that search engines can easily crawl. Here are the steps you can take to ensure that the content in your Flex RIA app... | 2,425 | [
{
"from": "human",
"value": "How would you make the contents of Flex RIA applications accessible to Google, so that Google can index the content and shows links to the right items in your Flex RIA. Consider a online shop, created in Flex, where the offered items shall be indexed by Google. Then a link on Go... |
I've looked at several URL rewriters for ASP.Net and IIS and was wondering what everyone else uses, and why.
Here are the ones that I have used or looked at:
ThunderMain URLRewriter: used in a previous project, didn't quite have the flexibility/performance we were looking for
Ewal UrlMapper: used in a current project... | It's great that you're exploring different URL rewriting options for ASP.Net and IIS! URL rewriting is an essential aspect of modern web development for improving SEO, user experience, and managing application routing. Here's a quick overview of some popular options, along with considerations that may help you decide w... | 5,290 | [
{
"from": "human",
"value": "I've looked at several URL rewriters for ASP.Net and IIS and was wondering what everyone else uses, and why. \nHere are the ones that I have used or looked at:\n\nThunderMain URLRewriter: used in a previous project, didn't quite have the flexibility/performance we were looking f... |
We have an external service that is currently accessible via the http (port 80, non-SSL) and https (port 443, SSL) addresses.
What is the best way to limit connections to only the https address? Is it something we can do via IIS or does it have to be done via code.
Additional info: Regular ASP.NET web service (.asmx) r... | To restrict access to your ASP.NET web service so that it only accepts connections over HTTPS, you can implement several strategies. Here are the most effective ways to achieve this in IIS, especially considering that you're working with IIS on Windows Server 2003:
### Method 1: Redirect HTTP to HTTPS in IIS
1. **Con... | 2,836 | [
{
"from": "human",
"value": "We have an external service that is currently accessible via the http (port 80, non-SSL) and https (port 443, SSL) addresses.\nWhat is the best way to limit connections to only the https address? Is it something we can do via IIS or does it have to be done via code.\nAdditional ... |
I set up a website to use SqlMembershipProvider as written on this page.
I followed every step. I have the database, I modified the Web.config to use this provider, with the correct connection string, and the authentication mode is set to Forms. Created some users to test with.
I created a Login.aspx and put the Login ... | It sounds like you're experiencing an issue where the user is not being authenticated properly, even though the cookie is being created. Here are some troubleshooting steps and potential solutions to help you resolve the issue:
1. **Verify Connection String**: Double-check that your connection string in `Web.config` i... | 3,395 | [
{
"from": "human",
"value": "I set up a website to use SqlMembershipProvider as written on this page.\nI followed every step. I have the database, I modified the Web.config to use this provider, with the correct connection string, and the authentication mode is set to Forms. Created some users to test with.... |
Say you want a simple maze on an N by M grid, with one path through, and a good number of dead ends, but that looks "right" (i.e. like someone made it by hand without too many little tiny dead ends and all that). Is there a known way to do this?
| Yes, creating a simple maze on an N by M grid that has a single path and includes dead ends while maintaining an aesthetically pleasing structure is definitely possible. Here are a few methods you can use to achieve this:
### 1. Depth-First Search (DFS) Algorithm
This is a common algorithm for maze generation. You can... | 5,999 | [
{
"from": "human",
"value": "Say you want a simple maze on an N by M grid, with one path through, and a good number of dead ends, but that looks \"right\" (i.e. like someone made it by hand without too many little tiny dead ends and all that). Is there a known way to do this?\n"
},
{
"from": "gpt",
... |
I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET web application. It keeps redirecting to a Login.aspx page at the root of my application that does not exist. My login page is within a folder.
| When you're using ASP.NET's Forms Authentication and encounter an issue where the application keeps redirecting to a `Login.aspx` page that does not exist, there are a few things to check in your configuration and code. Here are steps you can follow to troubleshoot and fix this issue:
### 1. Check Web.config Settings
... | 6,200 | [
{
"from": "human",
"value": "I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET web application. It keeps redirecting to a Login.aspx page at the root of my application that does not exist. My login page is within a folder.\n"
},
{
"from": "gpt"... |
I'm currently working on an application where we have a SQL-Server database and I need to get a full text search working that allows us to search people's names.
Currently the user can enter a into a name field that searches 3 different varchar cols. First, Last, Middle names
So say I have 3 rows with the following inf... | It looks like you are having issues with your full-text search in SQL Server when it comes to searching for names in your `Person` table. Here are a few key points to consider regarding the behavior of full-text search and some solutions to improve your implementation.
### Understanding Full-Text Search
1. **Phrase S... | 3,279 | [
{
"from": "human",
"value": "I'm currently working on an application where we have a SQL-Server database and I need to get a full text search working that allows us to search people's names.\nCurrently the user can enter a into a name field that searches 3 different varchar cols. First, Last, Middle names\n... |
In a project I am interfacing between C++ and a C library that uses stdbool.h defined as such.
#ifndef _STDBOOL_H
#define _STDBOOL_H
/* C99 Boolean types for compilers without C99 support */
/* http://www.opengroup.org/onlinepubs/009695399/basedefs/stdbool.h.html */
#if !defined(__cplusplus)
#if !defined(__GNUC__)
/*... | When interfacing between C and C++ code, especially when dealing with types defined in the C standard library, it's important to ensure that the types and their sizes remain consistent across both languages. The `stdbool.h` header you provided introduces the `bool` type as `_Bool`, which is a 1-byte boolean in C, while... | 4,479 | [
{
"from": "human",
"value": "In a project I am interfacing between C++ and a C library that uses stdbool.h defined as such.\n#ifndef _STDBOOL_H\n#define _STDBOOL_H\n\n/* C99 Boolean types for compilers without C99 support */\n/* http://www.opengroup.org/onlinepubs/009695399/basedefs/stdbool.h.html */\n#if !... |
Two RAID volumes, VMware kernel/console running on a RAID1, vmdks live on a RAID5. Entering a login at the console just results in SCSI errors, no password prompt. Praise be, the VMs are actually still running. We're thinking, though, that upon reboot the kernel may not start again and the VMs will be down.
We have da... | Your approach sounds reasonable, and I can offer some further insights and considerations to help ensure you can successfully navigate this situation. Here’s a refined version of your plan with some additional options and precautions:
### Immediate Actions
1. **Use VMware Converter**:
- As you've suggested, use VM... | 3,406 | [
{
"from": "human",
"value": "Two RAID volumes, VMware kernel/console running on a RAID1, vmdks live on a RAID5. Entering a login at the console just results in SCSI errors, no password prompt. Praise be, the VMs are actually still running. We're thinking, though, that upon reboot the kernel may not start a... |
Is it possible, in Windows XP, to copy files to a Network Place from the command line, a batch file or, even better, a PowerShell script?
What sent me down this road of research was trying to publish files to a WSS 3.0 document library from a user's machine. I can't map a drive to the library in question because the WS... | In Windows XP, you cannot use PowerShell as it was not natively included with the operating system until Windows PowerShell 1.0 was released for Windows XP in 2006. However, if you have PowerShell installed, you can indeed use it to work with network resources. For the sake of completeness, I'll provide you with option... | 5,137 | [
{
"from": "human",
"value": "Is it possible, in Windows XP, to copy files to a Network Place from the command line, a batch file or, even better, a PowerShell script?\nWhat sent me down this road of research was trying to publish files to a WSS 3.0 document library from a user's machine. I can't map a drive... |
I've got a program that periodically updates its database schema. Sometimes, one of the DDL statements might fail and if it does, I want to roll back all the changes. I wrap the update in a transaction like so:
BEGIN TRAN;
CREATE TABLE A (PKey int NOT NULL IDENTITY, NewFieldKey int NULL, CONSTRAINT PK_A PRIMARY KEY ... | In Oracle, DDL (Data Definition Language) statements such as `CREATE`, `ALTER`, and `DROP` do indeed commit any previous work in the current transaction. This behavior is different from SQL Server, where DDL can be part of a transaction block.
Unfortunately, there is no way to turn off this implicit commit behavior in... | 7,718 | [
{
"from": "human",
"value": "I've got a program that periodically updates its database schema. Sometimes, one of the DDL statements might fail and if it does, I want to roll back all the changes. I wrap the update in a transaction like so:\nBEGIN TRAN;\n\nCREATE TABLE A (PKey int NOT NULL IDENTITY, NewFie... |
Do not waste your time with this question. Follow up to: What is so bad about singletons?
Please feel free to bitch on Singleton.
Inappropriate usage of Singleton may cause lot of paint. What kind of problem do you experienced with singleton? What is common misuse of this pattern?
After some digging into Corey's answ... | Singletons can certainly stir up a lot of debate among software developers, and for good reason. While the Singleton pattern can be useful in some scenarios, it's often misused or leads to various issues in software design. Here are some common problems and misuses associated with the Singleton pattern:
### 1. **Globa... | 4,745 | [
{
"from": "human",
"value": "Do not waste your time with this question. Follow up to: What is so bad about singletons?\n\nPlease feel free to bitch on Singleton.\nInappropriate usage of Singleton may cause lot of paint. What kind of problem do you experienced with singleton? What is common misuse of this pa... |
I am trying to build out a useful 3d game engine out of the Ogre3d rendering engine for mocking up some of the ideas i have come up with and have come to a bit of a crossroads. There are a number of scripting languages that are available and i was wondering if there were one or two that were vetted and had a proper fol... | When it comes to integrating a scripting language into a 3D game engine like Ogre3D, you have a few solid options, each with its own advantages and community support. Here's a breakdown of some popular scripting languages you might consider:
### 1. **Lua**
- **Pros**:
- Lua is lightweight, fast, and designed for em... | 6,594 | [
{
"from": "human",
"value": "I am trying to build out a useful 3d game engine out of the Ogre3d rendering engine for mocking up some of the ideas i have come up with and have come to a bit of a crossroads. There are a number of scripting languages that are available and i was wondering if there were one or ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.