instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Here's what I would like to do: I'm taking pictures with a webcam at regular intervals. Sort of like a time lapse thing. However, if nothing has really changed, that is, the picture pretty much looks the same, I don't want to store the latest snapshot. I imagine there's some way of quantifying the difference, and I w...
You can achieve this using Python by comparing the current webcam frame with the previous frame to quantify the difference. A common method to do this is to convert the images to grayscale, compute the absolute difference between the two frames, and then quantify the difference using techniques like thresholding or cal...
17,097
[ { "from": "human", "value": "Here's what I would like to do:\nI'm taking pictures with a webcam at regular intervals. Sort of like a time lapse thing. However, if nothing has really changed, that is, the picture pretty much looks the same, I don't want to store the latest snapshot.\nI imagine there's some...
I have a link that I dynamically create which looks something like the following: <a onclick="Edit('value from a text column here')" href="javascript:void(null);">Edit</a> with the Edit function then taking the passed in value and putting it into a Yahoo Rich Text Editor. This works well except for when there is a sin...
When dealing with dynamic JavaScript and HTML content, special characters like single quotes can lead to syntax errors. In your case, when the text contains a single quote, it breaks the string that you are passing into the `Edit` function. To address this issue while staying as close to your current structure as pos...
19,532
[ { "from": "human", "value": "I have a link that I dynamically create which looks something like the following:\n<a onclick=\"Edit('value from a text column here')\" href=\"javascript:void(null);\">Edit</a>\n\nwith the Edit function then taking the passed in value and putting it into a Yahoo Rich Text Editor...
I have a Dynamic Data website built in Visual Studio 2008 using .NET 3.5 SP1. The site works OK on my Vista machine, but I get the following error when running it on a Windows XP machine: Server Error in '/FlixManagerWeb' Application. -------------------------------------------------------------------------------...
The error message you are encountering indicates a 404 error, which means the requested resource (your Dynamic Data website) is not found on the Windows XP machine. Since your site works correctly on your Vista machine, it's likely that there are some differences in the setup between the two environments. Below are som...
19,758
[ { "from": "human", "value": "I have a Dynamic Data website built in Visual Studio 2008 using .NET 3.5 SP1. The site works OK on my Vista machine, but I get the following error when running it on a Windows XP machine:\n\nServer Error in '/FlixManagerWeb'\n Application.\n ----------------------------------...
I have taken a copy of a database home with me so I can do some testing. However when I try to run a stored procedure I get Cannot open user default database. Login failed.. I have checked and checked and checked I can open tables in the databases login to sql management studio and access the default as well as other ...
The error message "Cannot open user default database. Login failed." typically indicates that the user account you're using to connect to SQL Server is configured to use a default database that cannot be accessed or doesn't exist. This can happen when migrating databases from one SQL Server version to another, such as ...
21,976
[ { "from": "human", "value": "I have taken a copy of a database home with me so I can do some testing. However when I try to run a stored procedure I get Cannot open user default database. Login failed.. \nI have checked and checked and checked I can open tables in the databases login to sql management studi...
In a number of applications we create an MSI Installer with the Visual Studio Setup Project. In most cases, the install works fine, but every now and then the previous version was not uninstalled correctly. The user ends up with two icons on the desktop, and in the Add/Remove program list, the application appears twice...
Issues with MSI installers, particularly when upgrading versions, can arise from various factors. Here are some common causes and potential solutions to help you address the problem of having remnants of old installations: ### Common Causes 1. **Product Code Change**: If the Product Code is changed every time you bui...
18,854
[ { "from": "human", "value": "In a number of applications we create an MSI Installer with the Visual Studio Setup Project. In most cases, the install works fine, but every now and then the previous version was not uninstalled correctly. The user ends up with two icons on the desktop, and in the Add/Remove pr...
I have an instance of a general purpose class that will be executed both under ASP.NET and a stand alone program. This code is sensative to the process where it is being run - that is, there are certin methods that should not called if running under ASP.NET. How do you determine if the code is executing in an ASP.NET p...
Determining whether your code is running under an ASP.NET process can be important for ensuring that certain operations are performed only in a stand-alone context. Here are a couple of approaches you can use to check if the code is being executed in an ASP.NET environment: ### Approach 1: Check the HttpContext One o...
21,957
[ { "from": "human", "value": "I have an instance of a general purpose class that will be executed both under\nASP.NET and a stand alone program. This code is sensative to the process where it\nis being run - that is, there are certin methods that should not called if\nrunning under ASP.NET. How do you determ...
I looked at the AdaCore site, as well as for A# (which now appears to be owned by AdaCore) and neither appear to be free (although I could have misread something). Any recommendations?
If you're looking for free or open-source alternatives for Ada development, here are a few recommendations: 1. **GNAT**: The GNAT compiler is part of the GNU Compiler Collection (GCC) and is available for free. It supports Ada and is widely used for both educational and professional purposes. You can find it as part o...
17,681
[ { "from": "human", "value": "I looked at the AdaCore site, as well as for A# (which now appears to be owned by AdaCore) and neither appear to be free (although I could have misread something). Any recommendations?\n" }, { "from": "gpt", "value": "If you're looking for free or open-source alterna...
I've been using Visual Studio for a long time and the constant shuffling of the code tabs at the top drives me bonkers. I was wondering if there were any add-ins that might change this or other UI behavior. Things that might be cool: Sticky Tabs that won't go away. Multi-code file collapsible tabs (maybe each tab bein...
Visual Studio has a robust ecosystem of extensions and add-ins that can enhance your development experience and address some of the frustrations you've mentioned regarding tab management. While there may not be a specific add-in that offers all the features you've described, here are some suggestions and tips that may ...
10,070
[ { "from": "human", "value": "I've been using Visual Studio for a long time and the constant shuffling of the code tabs at the top drives me bonkers. I was wondering if there were any add-ins that might change this or other UI behavior.\nThings that might be cool:\n\nSticky Tabs that won't go away.\nMulti-co...
I have 2 fields in the database month (numeric) and year (numeric) and I want to combine them in a report that combines those 2 fields and format them with MMM-YYYY. e.g 7-2008 becomes Jul-2008. How do I do that?
To combine the numeric fields `month` and `year` into a formatted string like "MMM-YYYY" (e.g., "Jul-2008") in a database query, you can use SQL functions. The exact functions to use may vary depending on the database system you're working with (e.g., MySQL, PostgreSQL, SQL Server, etc.). Here's how you can do it for ...
19,981
[ { "from": "human", "value": "I have 2 fields in the database month (numeric) and year (numeric) and I want to combine them in a report that combines those 2 fields and format them with MMM-YYYY. e.g 7-2008 becomes Jul-2008. How do I do that?\n" }, { "from": "gpt", "value": "To combine the numeri...
I use XFire to create a webservice wrapper around my application. XFire provides the webservice interface and WSDL at runtime (or creates them at compile time, don't know exactly). Many of our customers don't know webservices very well and additionally they simply don't read any external documentation like Javadoc. I k...
Adding documentation directly into the WSDL file generated by XFire can indeed improve usability for customers who may not be familiar with web services or who do not read external documentation. Here are a few methods you can consider for adding documentation: ### 1. Using Annotations While XFire itself does not nat...
15,803
[ { "from": "human", "value": "I use XFire to create a webservice wrapper around my application. XFire provides the webservice interface and WSDL at runtime (or creates them at compile time, don't know exactly).\nMany of our customers don't know webservices very well and additionally they simply don't read an...
This question was inspired by a similar question: How does delete[] “know” the size of the operand array? My question is a little different: Is there any way to determine the size of a C++ array programmatically? And if not, why? Every function I've seen that takes an array also requires an integer parameter to give...
In C++, when you allocate an array using `new` (like `new int[256]`), what you actually create is a block of memory on the heap that contains `256` integers. However, the pointer variable (in your case `int* arr`) only holds the address of the first element of that allocated memory, which is why `sizeof(arr)` returns t...
20,763
[ { "from": "human", "value": "This question was inspired by a similar question: How does delete[] “know” the size of the operand array?\nMy question is a little different: Is there any way to determine the size of a C++ array programmatically? And if not, why? Every function I've seen that takes an array ...
I'm writing a simple CMS. I want to be able to load a View, having it included inside a master page, and then scan the HTML so that I can replace some custom tags (like {{blog}} with my own blog output) and then serve it up to the browser. How can I get access to the HTML from the ViewResult in order to intercept it?
To accomplish your goal of modifying the HTML generated by a ViewResult in an ASP.NET MVC application, you will need to capture the HTML after the view has been rendered but before it is sent to the browser. One common approach to achieve this is by using an Action Filter or creating a custom Result. Here’s a step-by-...
19,521
[ { "from": "human", "value": "I'm writing a simple CMS.\nI want to be able to load a View, having it included inside a master page, and then scan the HTML so that I can replace some custom tags (like {{blog}} with my own blog output) and then serve it up to the browser.\nHow can I get access to the HTML from...
Objective-C has no namespaces; it's much like C, everything is within one global namespace. Common practice is to prefix classes with initials, e.g. if you are working at IBM, you could prefix them with "IBM"; if you work for Microsoft, you could use "MS"; and so on. Sometimes the initials refer to the project, e.g. Ad...
In Objective-C, you cannot directly manipulate namespaces like you can in C with `dlopen()` and `dlsym()`, since Objective-C is a strict superset of C and has its own class and method resolution mechanics. However, there are a few approaches you can take to work around namespace collisions when using external framework...
17,699
[ { "from": "human", "value": "Objective-C has no namespaces; it's much like C, everything is within one global namespace. Common practice is to prefix classes with initials, e.g. if you are working at IBM, you could prefix them with \"IBM\"; if you work for Microsoft, you could use \"MS\"; and so on. Sometim...
Yesterday, I discovered the Subversion (SVN) blame feature, and I was wondering, is this feature available from Eclipse?
Yes, the Subversion (SVN) blame feature is available in Eclipse. If you are using an Eclipse IDE with the Subversion plugin (like Subclipse or Subversive), you can easily view the blame information for files in your project. Here’s how you can do it: 1. **Open the File**: First, make sure you have the file for which ...
23,319
[ { "from": "human", "value": "Yesterday, I discovered the Subversion (SVN) blame feature, and I was wondering, is this feature available from Eclipse?\n" }, { "from": "gpt", "value": "Yes, the Subversion (SVN) blame feature is available in Eclipse. If you are using an Eclipse IDE with the Subvers...
I have installed CherryPy 3.1.0,. Here is what happens when I try to run tutorial 9: $ cd /Library/Python/2.5/site-packages/cherrypy/tutorial/ $ python tut09_files.py Traceback (most recent call last): File "tut09_files.py", line 48, in <module> from cherrypy.lib import static ImportError: cannot import name stat...
The error you are encountering indicates that the `static` module cannot be found within the `cherrypy.lib` package. This issue can arise for several reasons. Given that you are using CherryPy version 3.1.0, it's worth noting that this version is quite old, and certain modules may have been structured or named differen...
21,319
[ { "from": "human", "value": "I have installed CherryPy 3.1.0,. Here is what happens when I try to run tutorial 9:\n$ cd /Library/Python/2.5/site-packages/cherrypy/tutorial/\n$ python tut09_files.py\nTraceback (most recent call last):\n File \"tut09_files.py\", line 48, in <module>\n from cherrypy.lib im...
I have some NSViews that I'm putting in one of two layouts depending on the size of my window. I'm adjusting the layout when the relevant superview receives the resizeSubviewsWithOldSize method. This works, but I'd like to animate the change. So naturally I tried calling the animator proxy when I set the new frames, b...
Animating layout changes during a user drag (like resizing a window) in AppKit can be challenging, as UIKit does in iOS. NSViews typically do not animate layout changes while a window is being resized due to performance reasons, and NSView's built-in animation capabilities are generally suspended during these operation...
13,907
[ { "from": "human", "value": "I have some NSViews that I'm putting in one of two layouts depending on the size of my window.\nI'm adjusting the layout when the relevant superview receives the resizeSubviewsWithOldSize method.\nThis works, but I'd like to animate the change. So naturally I tried calling the ...
I'm working on an application to edit name/value pairs using a property grid. Some of the properties in my class file are ListDictionary collections. Is there an Editor attribute that I can apply at the property declaration that will make the Collection Editor work at runtime? If not, is it possible to inherit from C...
In .NET, the `CollectionEditor` is a useful class that allows you to provide a UI for editing collections in a property grid. However, the `CollectionEditor` is designed to work with specific collection types like `Array`, `List<T>`, `Dictionary<TKey, TValue>`, etc. If you're using `ListDictionary`, you may not directl...
20,689
[ { "from": "human", "value": "I'm working on an application to edit name/value pairs using a property grid. \nSome of the properties in my class file are ListDictionary collections. Is there \nan Editor attribute that I can apply at the property declaration that will make the\nCollection Editor work at runti...
Flex Builder often fails to connect to the app that it's supposed to debug. After a minute or so it times-out and says that it couldn't connect. The only way I can get it to stop doing this is by restarting Eclipse. Very annoying. Anyone know why this is? I'm using FB 3.1 and Firefox on Win XP. Many thanks!
It sounds like you're experiencing a frustrating issue with Flex Builder (FB) failing to connect to your application for debugging. Here are several troubleshooting steps you can try to resolve this issue: 1. **Check Your Configuration**: Ensure that your project settings and Flex Builder configurations are correct. D...
21,280
[ { "from": "human", "value": "Flex Builder often fails to connect to the app that it's supposed to debug. After a minute or so it times-out and says that it couldn't connect. The only way I can get it to stop doing this is by restarting Eclipse.\nVery annoying. Anyone know why this is?\nI'm using FB 3.1 a...
Wikipedia says Ruby is a functional language, but I'm not convinced. Why or why not?
Ruby is primarily an object-oriented programming (OOP) language, but it also supports some functional programming (FP) paradigms. Here's a breakdown of why Ruby can be considered functional to some extent and why it is predominantly viewed as an OOP language: ### Why Ruby is Considered Functional: 1. **First-Class Fu...
19,690
[ { "from": "human", "value": "Wikipedia says Ruby is a functional language, but I'm not convinced. Why or why not?\n" }, { "from": "gpt", "value": "Ruby is primarily an object-oriented programming (OOP) language, but it also supports some functional programming (FP) paradigms. Here's a breakdown ...
I wonder if this would be doable ? To insert an array into one field in the database. For instance I have a title, I want to have that title with only one id, but it's going to be bilingually used on the website. It feels a bit unnecessary to make another table to have their global ids and then another table with the a...
Storing an array directly in a single field of a relational database like MySQL is not considered a best practice. While you could technically serialize the array and store it as a string, it would make your database design less efficient and more complex when it comes to querying, updating, and manipulating the data. ...
17,789
[ { "from": "human", "value": "I wonder if this would be doable ? To insert an array into one field in the database.\nFor instance I have a title, I want to have that title with only one id, but it's going to be bilingually used on the website.\nIt feels a bit unnecessary to make another table to have their g...
Does anyone know a way to auto-generate database tables for a given class? I'm not looking for an entire persistence layer - I already have a data access solution I'm using, but I suddenly have to store a lot of information from a large number of classes and I really don't want to have to create all these tables by ha...
Auto-generating database tables based on class definitions can be accomplished through reflection and some thoughtful handling of property types. Here's a basic approach you can take in C# to achieve this: ### Basic Approach for Simple Types For your first example with `string` and `int`, you can use reflection to en...
14,426
[ { "from": "human", "value": "Does anyone know a way to auto-generate database tables for a given class? I'm not looking for an entire persistence layer - I already have a data access solution I'm using, but I suddenly have to store a lot of information from a large number of classes and I really don't want...
Originally I thought to ask if there would be an easy way to provide an automatically managed last update field with MS Access. After some googling I found following approach: Private Sub Form_Dirty(Cancel As Integer) Me.Last_Update = Date() End Sub Which seems to do the job. I thought I'd share it with others to...
Your approach of using the `Form_Dirty` event to update a "Last_Update" field in Microsoft Access is a straightforward and effective method. This event triggers whenever a change is made to the form, allowing you to set the "Last_Update" field to the current date whenever the form's data is modified. Here are a few poi...
17,340
[ { "from": "human", "value": "Originally I thought to ask if there would be an easy way to provide an automatically managed last update field with MS Access.\nAfter some googling I found following approach:\nPrivate Sub Form_Dirty(Cancel As Integer)\n\n Me.Last_Update = Date()\n\nEnd Sub\n\nWhich seems to ...
When connecting to remote hosts via ssh, I frequently want to bring a file on that system to the local system for viewing or processing. Is there a way to copy the file over without (a) opening a new terminal/pausing the ssh session (b) authenticating again to either the local or remote hosts which works (c) even when...
Yes, you can copy files from a remote host to your local machine while still within an SSH session without opening a new terminal or re-authenticating. One common tool for this purpose is `scp`, but since you want to avoid opening a new terminal, you can use SSH's built-in capability to execute commands remotely. Here’...
16,392
[ { "from": "human", "value": "When connecting to remote hosts via ssh, I frequently want to bring a file on that system to the local system for viewing or processing. Is there a way to copy the file over without (a) opening a new terminal/pausing the ssh session (b) authenticating again to either the local ...
I do not understand how I can authenticate a user in a Facebook Flash application. I have read from the documentation that Facebook platform gives arguments, such as user id and session secret, to the Flash application, but how can I inside the Flash application make sure that these arguments are correct and not fake? ...
When authenticating a user in a Facebook Flash application, it’s crucial to ensure that the user has indeed authenticated with Facebook and that the credentials you receive are valid and not tampered with. Here are some steps you can take to properly authenticate a user: ### Authenticating a User in a Facebook Flash A...
19,409
[ { "from": "human", "value": "I do not understand how I can authenticate a user in a Facebook Flash application. I have read from the documentation that Facebook platform gives arguments, such as user id and session secret, to the Flash application, but how can I inside the Flash application make sure that t...
Weve recently been trying to work on an application that uses pandastream to encode our videos, we are sending the videos successfully, and the response that we get back is in YAML, however the only tool that we can find (YAML for .NET) is not parsing the file. Has anyone else ran into this, or have any insight on the...
When dealing with YAML parsing in .NET, there are several libraries available besides "YAML for .NET" that you can use, and some of them are more widely adopted and well-supported. Here are a few options you might consider: 1. **YamlDotNet**: - **Description**: This is one of the most popular libraries for parsing ...
17,909
[ { "from": "human", "value": "Weve recently been trying to work on an application that uses pandastream to encode our videos, we are sending the videos successfully, and the response that we get back is in YAML, however the only tool that we can find (YAML for .NET) is not parsing the file. Has anyone else ...
In Ruby: for i in A do # some code end is the same as: A.each do |i| # some code end for is not a kernel method: What exactly is "for" in ruby Is there a way to use other keywords to do similar things? Something like: total = sum i in I {x[i]} mapping to: total = I.sum {|i] x[i]}
In Ruby, the `for` keyword is a loop construct that iterates over a collection. It is indeed not a kernel method; instead, it is a language construct that behaves similarly to the `each` method of Enumerable. The syntax of the `for` loop is more straightforward and closely resembles loops in other programming languages...
21,327
[ { "from": "human", "value": "In Ruby:\nfor i in A do\n # some code\nend\n\nis the same as: \nA.each do |i|\n # some code\nend\n\nfor is not a kernel method:\n\nWhat exactly is \"for\" in ruby\nIs there a way to use other keywords to do similar things? \n\nSomething like:\n total = sum i in I {x[i]}\n\n...
I have a checkstyle suppression filter setup (e.g. ignore magic numbers in unit test code). The suppression xml file resides in the same folder as the checkstyle xml file. However, where this file actually is varies: on my windows dev box it is in d:\dev\shared\checkstyle\config on the Linux CI server it will be in /ro...
To ensure that your Checkstyle configuration is able to consistently locate the suppression filter XML file regardless of the environment, you can utilize a relative path approach. Since the suppression XML file always resides in the same folder as the Checkstyle XML file, you can reference it using a relative path bas...
20,225
[ { "from": "human", "value": "I have a checkstyle suppression filter setup (e.g. ignore magic numbers in unit test code).\nThe suppression xml file resides in the same folder as the checkstyle xml file. However, where this file actually is varies:\non my windows dev box it is in d:\\dev\\shared\\checkstyle\\...
I'm creating a DSL with a template-like editor, much like the rule systems in Alice. Users will be able to select relationships from a list as well as the objects to apply the relation to. These two lists should be filtered based on the acceptable types -- for instance, if the relationship is "greater than" then the ...
Creating a Domain-Specific Language (DSL) with type checking and filtering logic is a nuanced task, but there are several open-source libraries and frameworks that can help you implement this in Java or other languages. Here are some suggestions: ### 1. **ANTLR (ANother Tool for Language Recognition)** - **Descript...
15,303
[ { "from": "human", "value": "I'm creating a DSL with a template-like editor, much like the rule systems in Alice. Users will be able to select relationships from a list as well as the objects to apply the relation to. These two lists should be filtered based on the acceptable types -- for instance, if the...
We are trying to create some tests that reference an vendors custom grid. Unfortunatly QTP only recognises it as a WinObject which is quite useless. We need to be able to navigate the grid and change cell values, double click on a cell(without using X,Y co-ordinates) etc. Ideally we want to get QTP to understand that ...
To interact with a custom grid in QTP (now known as UFT - Unified Functional Testing), where it is recognized only as a WinObject, you can use a combination of methods to manipulate the grid more effectively. Here are some approaches you can consider to achieve better interaction with the custom grid: ### 1. **Using t...
20,499
[ { "from": "human", "value": "We are trying to create some tests that reference an vendors custom grid. Unfortunatly QTP only recognises it as a WinObject which is quite useless. We need to be able to navigate the grid and change cell values, double click on a cell(without using X,Y co-ordinates) etc.\nIdea...
I might be missing something obvious but is there a reference somewhere about what exceptions are thrown by functions in .NET and why the exception might be thrown? As an example, I was recently trying out Linq in Visual C# 2008 and I was loading an XML file into an XDocument. It was only through testing that I realis...
In .NET, understanding which exceptions can be thrown by specific methods can indeed be a bit challenging, as the documentation may not always provide detailed information about every possible exception. However, there are some resources and strategies that can help you identify these exceptions. ### 1. **Official Doc...
18,719
[ { "from": "human", "value": "I might be missing something obvious but is there a reference somewhere about what exceptions are thrown by functions in .NET and why the exception might be thrown? \nAs an example, I was recently trying out Linq in Visual C# 2008 and I was loading an XML file into an XDocument....
Is it possible to use a C++ .lib file from within a C# program?
Yes, it is possible to use a C++ `.lib` file from within a C# program, but there are specific steps and considerations you need to take into account. Here are a few approaches you can use to achieve this: ### 1. **Use P/Invoke (Platform Invocation Services)** If the `.lib` file is associated with a DLL (Dynamic Link ...
16,571
[ { "from": "human", "value": "Is it possible to use a C++ .lib file from within a C# program?\n" }, { "from": "gpt", "value": "Yes, it is possible to use a C++ `.lib` file from within a C# program, but there are specific steps and considerations you need to take into account. Here are a few appro...
Possible Duplicate: What is the difference between "typename" and "class" template parameters? When defining a function template or class template in C++, one can write this: template <class T> ... or one can write this: template <typename T> ... Is there a good reason to prefer one over the other? I accepted the ...
You're correct that in C++, the `typename` and `class` keywords can be used interchangeably when defining template type parameters. This equivalence often leads to a debate about which keyword to use, and opinions vary among developers. ### Key Points: 1. **Equivalence**: `template <class T>` and `template <typename ...
21,009
[ { "from": "human", "value": "\nPossible Duplicate:\nWhat is the difference between \"typename\" and \"class\" template parameters?\n\nWhen defining a function template or class template in C++, one can write this:\ntemplate <class T> ...\n\nor one can write this:\ntemplate <typename T> ...\n\nIs there a goo...
I am looking to integrate Crystal Reports 2008 into a Windows Forms application. I would like to avoid direct connections from my client application to the database, while giving the user the "complete" report experience. Is it possible to for Crystal Reports 2008 to execute a report on a server into a client-side Wind...
Yes, it is indeed possible to integrate Crystal Reports 2008 into a Windows Forms application while avoiding direct database connections from the client application. This approach allows you to generate reports on a server and display them in a client-side control. Here are the steps you can follow to achieve this set...
16,286
[ { "from": "human", "value": "I am looking to integrate Crystal Reports 2008 into a Windows Forms application. I would like to avoid direct connections from my client application to the database, while giving the user the \"complete\" report experience. Is it possible to for Crystal Reports 2008 to execute a...
What do you use to validate an email address on a ASP.NET form. I want to make sure that it contains no XSS exploits. This is ASP.NET 1.1
Validating an email address in an ASP.NET 1.1 application involves a couple of steps to ensure that the input is not only a valid email format but also does not contain any potential XSS (Cross-Site Scripting) exploits. ### Basic Email Validation 1. **Regular Expression Validation**: You can use a regular expression ...
15,861
[ { "from": "human", "value": "What do you use to validate an email address on a ASP.NET form. I want to make sure that it contains no XSS exploits.\nThis is ASP.NET 1.1\n" }, { "from": "gpt", "value": "Validating an email address in an ASP.NET 1.1 application involves a couple of steps to ensure ...
Are there any performance benefits of using SQL Server 2008 over SQL Server 2005?
Yes, there are several performance benefits of using SQL Server 2008 over SQL Server 2005. Here are some key improvements that can enhance performance: 1. **Improved Query Optimizer**: SQL Server 2008 introduced an enhanced query optimizer, which can result in more efficient execution plans and improved performance fo...
20,098
[ { "from": "human", "value": "Are there any performance benefits of using SQL Server 2008 over SQL Server 2005?\n" }, { "from": "gpt", "value": "Yes, there are several performance benefits of using SQL Server 2008 over SQL Server 2005. Here are some key improvements that can enhance performance:\...
How can I copy and paste in irb (Interactive Ruby Shell) on Windows?
Copying and pasting in the Interactive Ruby Shell (IRB) on Windows can depend on the terminal or command prompt you are using. Here are a few common methods for different environments: ### Command Prompt (cmd): 1. **Copying:** - Select the text you want to copy with your mouse. - Right-click the selected area t...
21,305
[ { "from": "human", "value": "How can I copy and paste in irb (Interactive Ruby Shell) on Windows?\n" }, { "from": "gpt", "value": "Copying and pasting in the Interactive Ruby Shell (IRB) on Windows can depend on the terminal or command prompt you are using. Here are a few common methods for diff...
We are attempting to install BizTalk Server 2006 R2 on a fresh server with x64 Windows 2008. The basic configuration is complaining that the “Default Web Site” we select for the BAM Portal installation is not validated due to “IIS is not 32-bit enabled.” Despite setting the appPool (Classic mode) 32-bit property to Tru...
Installing BizTalk Server 2006 R2 on a Windows Server 2008 (x64) environment can indeed be challenging due to compatibility issues. The error you're encountering, which states that "IIS is not 32-bit enabled," typically occurs when the IIS application pool is not configured to support 32-bit applications. Here are a fe...
19,529
[ { "from": "human", "value": "We are attempting to install BizTalk Server 2006 R2 on a fresh server with x64 Windows 2008. The basic configuration is complaining that the “Default Web Site” we select for the BAM Portal installation is not validated due to “IIS is not 32-bit enabled.” Despite setting the appP...
I have a compiled swf file and a I can't edit it, but the movie is working fine (but gives an error message with a message box). I am using it from an other movie (load with as3 code). When the loader movie loads it the error message box appears. I wonder is it possible to disable the errors while loading a movie with ...
In Flash Player, particularly when using ActionScript 3 (AS3), error messages can occur for a variety of reasons, such as attempting to access a property or method on a null object. Unfortunately, there's no built-in way in AS3 to completely disable error messages or suppress the error dialogs that pop up in the standa...
19,775
[ { "from": "human", "value": "I have a compiled swf file and a I can't edit it, but the movie is working fine (but gives an error message with a message box).\nI am using it from an other movie (load with as3 code).\nWhen the loader movie loads it the error message box appears.\nI wonder is it possible to di...
I noticed when a file is executed on Windows (.exe or .dll), it is locked and cannot be deleted, moved or modified. Linux, on the other hand, does not lock executing files and you can delete, move, or modify them. Why does Windows lock when Linux does not? Is there an advantage to locking?
The difference in how Windows and Linux handle file locking during execution is rooted in their design philosophies and system architectures. ### Reasons for Locking Executables on Windows 1. **File System Design**: Windows uses the NTFS (New Technology File System) which includes features that lock files when they a...
18,909
[ { "from": "human", "value": "I noticed when a file is executed on Windows (.exe or .dll), it is locked and cannot be deleted, moved or modified.\nLinux, on the other hand, does not lock executing files and you can delete, move, or modify them.\nWhy does Windows lock when Linux does not? Is there an advantag...
Is there a way to attach an event to a foreign / separate window from an .NET process that when the foreign window is closed or is about to close my application can be notified? I found this http://msdn.microsoft.com/en-us/library/ms229658.aspx But that seems to only be for the .NET compact framework. I am looking for ...
In .NET, you don't have direct built-in support for event handling on foreign windows, but you can achieve the desired behavior by using Windows API calls to monitor the target window's messages. You can use the `SetWinEventHook` function from the Windows API to monitor events on another window. For example, you can l...
16,991
[ { "from": "human", "value": "Is there a way to attach an event to a foreign / separate window from an .NET process that when the foreign window is closed or is about to close my application can be notified?\nI found this http://msdn.microsoft.com/en-us/library/ms229658.aspx\nBut that seems to only be for th...
Trying to honor a feature request from our customers, I'd like that my application, when Internet is available, check on our website if a new version is available. The problem is that I have no idea about what have to be done on the server side. I can imagine that my application (developped in C++ using Qt) has to send...
To implement a version-checking feature in your application, you'll need both a client-side component (your C++ Qt application) and a server-side component that can respond to version-check requests. Let's break this down step by step. ### 1. Client-Side (C++ Qt Application) Your application will need to perform an H...
16,759
[ { "from": "human", "value": "Trying to honor a feature request from our customers, I'd like that my application, when Internet is available, check on our website if a new version is available.\nThe problem is that I have no idea about what have to be done on the server side.\nI can imagine that my applicati...
Since content of web applications is dynamically generated it would appear that AdSense is not going to produce relevant ads. Is there a way to increase relevancy of the AdSense ads for the web application? Is it possible to achieve Gmail-like ad functionality at all for third-party applications? Is there a better ad p...
Enhancing the relevancy of AdSense ads for dynamically generated content in web applications can indeed be a challenge, but there are a few strategies you can employ: ### 1. **Improve Content Structure**: - **Meta Tags**: Ensure that each dynamically generated page has appropriate meta tags (like title, description...
19,246
[ { "from": "human", "value": "Since content of web applications is dynamically generated it would appear that AdSense is not going to produce relevant ads.\nIs there a way to increase relevancy of the AdSense ads for the web application?\nIs it possible to achieve Gmail-like ad functionality at all for third...
I have an "ldquo", "rdquo" and several other entities under my RSS feed. Seems like if I add <!DOCTYPE rss [ <!ENTITY % HTMLspec PUBLIC "-//W3C//ENTITIES Latin 1 for XHTML//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent"> %HTMLspec; below the xml tag and above the rss tag then I'll be able to include ...
To use the `<!DOCTYPE>` declaration with external entities in your RSS feed, it's essential to ensure that you're using a valid and correctly referenced DTD (Document Type Definition). Here are some points to consider that might help you troubleshoot the issue: 1. **Correct Placement**: Make sure that your `<!DOCTYPE>...
19,363
[ { "from": "human", "value": "I have an \"ldquo\", \"rdquo\" and several other entities under my RSS feed. Seems like if I add\n<!DOCTYPE rss [\n <!ENTITY % HTMLspec PUBLIC\n \"-//W3C//ENTITIES Latin 1 for XHTML//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent\">\n %HTMLspec; \n\nbelow the xml...
When you're using Tiles with Struts and do... request.getRequestURL() ...you get the URL to e.g. /WEB-INF/jsp/layout/newLayout.jsp instead of the real URL that was entered/clicked by the user, something like /context/action.do. In newer Struts versions, 1.3.x and after, you can use the solution mentioned on javaranch ...
In Struts 1.2.x, there is no built-in `ORIGINAL_URI_KEY` attribute like in later versions to retrieve the original URL requested by the user. However, you can still achieve this by manually capturing the original request URL in a custom filter or through a Struts interceptor (or Action). Here's a simple way to capture...
20,049
[ { "from": "human", "value": "When you're using Tiles with Struts and do...\nrequest.getRequestURL()\n\n...you get the URL to e.g. /WEB-INF/jsp/layout/newLayout.jsp instead of the real URL that was entered/clicked by the user, something like /context/action.do.\nIn newer Struts versions, 1.3.x and after, you...
I am working on rails project and I am trying to get exceptions to be logged to the rails log files. I know I can call logger.error $! to get the first line of the exception logged to the file. But, I want to get the entire trace stack logged as well. How do I log the entire trace back of an exception using the defa...
To log the entire stack trace of an exception using the default Rails logger, you can utilize the `logger.error` method along with the `backtrace` method from the exception object. The `backtrace` method returns an array of strings, where each string represents a line in the stack trace. You can join these lines into a...
22,359
[ { "from": "human", "value": "I am working on rails project and I am trying to get exceptions to be logged to the rails log files. I know I can call logger.error $! to get the first line of the exception logged to the file. But, I want to get the entire trace stack logged as well. How do I log the entire ...
Has anyone used Mono, the open source .NET implementation on a large or medium sized project? I'm wondering if it's ready for real world, production environments. Is it stable, fast, compatible, ... enough to use? Does it take a lot of effort to port projects to the Mono runtime, or is it really, really compatible enou...
Yes, many developers and companies have successfully used Mono, the open-source .NET implementation, in medium to large-sized projects. Mono has been around since 2004 and has evolved significantly over the years. Here are some key points regarding its readiness for production environments: ### Stability - **Mature Fr...
20,126
[ { "from": "human", "value": "Has anyone used Mono, the open source .NET implementation on a large or medium sized project? I'm wondering if it's ready for real world, production environments. Is it stable, fast, compatible, ... enough to use? Does it take a lot of effort to port projects to the Mono runtime...
Problem : I have multiple projects checked out in my depot. I also have multiple pending numbered change lists, each change list containing checked out files specific to its project. When I check out a new file, it appears in the default change list instead of in the change list that is relevant to its project and I ne...
In Perforce, there is no built-in feature that automatically links a project folder to a specific numbered changelist so that new checkouts go directly into that changelist. However, you can streamline your workflow with a combination of Perforce features and external scripts. Here are some suggestions: 1. **Use Custo...
22,166
[ { "from": "human", "value": "Problem : I have multiple projects checked out in my depot. I also have multiple pending numbered change lists, each change list containing checked out files specific to its project. When I check out a new file, it appears in the default change list instead of in the change list...
We recently attempted to break apart some of our Visual Studio projects into libraries, and everything seemed to compile and build fine in a test project with one of the library projects as a dependency. However, attempting to run the application gave us the following nasty run-time error message: Run-Time Check Failu...
The issue you encountered, "Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call," is indeed serious and often indicates a mismatch in calling conventions or stack corruption. Changing the "Basic Runtime Checks" setting from "Both (/RTC1)" to "Default" effectively suppresses the ru...
20,237
[ { "from": "human", "value": "We recently attempted to break apart some of our Visual Studio projects into libraries, and everything seemed to compile and build fine in a test project with one of the library projects as a dependency. However, attempting to run the application gave us the following nasty run-...
If you have a domain object, and you want to do something useful and central to that domain object's responsibility like ensure it is valid, you sometimes need to access the state of related objects in order to perform this validation. How to avoid the domain object needing to call out to a Repository or Data Access L...
This is a common challenge in Domain-Driven Design (DDD) and software architecture in general, especially when trying to balance encapsulation, purity of the domain model, and practicality. Here are several strategies you could consider to maintain a pure domain layer while ensuring that your domain objects can perform...
16,959
[ { "from": "human", "value": "If you have a domain object, and you want to do something useful and central to that domain object's responsibility like ensure it is valid, you sometimes need to access the state of related objects in order to perform this validation. \nHow to avoid the domain object needing to...
In short, how do you unit test an error condition such as EINTR on a system call. One particular example I'm working on, which could be a case all by itself, is whether it's necessary to call fclose again when it returns EOF with (errno==EINTR). The behavior depends on the implementation of fclose: // Given an open FIL...
To unit test an error condition such as `EINTR` on a system call, you can use several approaches, depending on the context of the system call and the flexibility of your testing environment. Here's a general outline of how to approach this, along with a specific strategy for your `fclose` example. ### General Approach...
20,111
[ { "from": "human", "value": "In short, how do you unit test an error condition such as EINTR on a system call.\nOne particular example I'm working on, which could be a case all by itself, is whether it's necessary to call fclose again when it returns EOF with (errno==EINTR). The behavior depends on the impl...
What would be the most efficient way of recording to a log (.txt) from a console program on C# and .NET 2.2? My program loops multiple times always outputting different data based on what the user wants, so I'm searching for the most efficient way to achieve this. I know I can always reopen a stream and then close it, ...
To efficiently log data from a multi-threaded console application in C# and .NET 2.2, you'll want to implement a logging mechanism that minimizes overhead and ensures thread safety. Here’s a recommended approach using a single `StreamWriter` instance that can handle concurrent logging requests without needing to open a...
17,687
[ { "from": "human", "value": "What would be the most efficient way of recording to a log (.txt) from a console program on C# and .NET 2.2? My program loops multiple times always outputting different data based on what the user wants, so I'm searching for the most efficient way to achieve this.\nI know I can ...
I'm new to postgreSQL and I have a simple question: I'm trying to create a simple script that creates a DB so I can later call it like this: psql -f createDB.sql I want the script to call other scripts (separate ones for creating tables, adding constraints, functions etc), like this: \i script1.sql \i script2.sql It ...
It looks like you've already figured out the issue with the slashes in your file paths! Just to provide a bit more context for others who might encounter a similar situation, here's a summary and some best practices: ### Understanding the Issue When using the `\i` command in `psql`, it's important to specify file path...
22,801
[ { "from": "human", "value": "I'm new to postgreSQL and I have a simple question:\nI'm trying to create a simple script that creates a DB so I can later call it like this:\npsql -f createDB.sql\n\nI want the script to call other scripts (separate ones for creating tables, adding constraints, functions etc), ...
What install tool can I use to create Virtual Directory on IIS? OpenSource, free or to do in C#.
To create a Virtual Directory on IIS programmatically using C#, you can use the **Microsoft.Web.Administration** namespace, which is part of the **IIS Management SDK**. This SDK is included with IIS and is available for free. Here's a step-by-step guide on how to create a virtual directory using C#: 1. **Add Referenc...
20,029
[ { "from": "human", "value": "What install tool can I use to create Virtual Directory on IIS? OpenSource, free or to do in C#. \n" }, { "from": "gpt", "value": "To create a Virtual Directory on IIS programmatically using C#, you can use the **Microsoft.Web.Administration** namespace, which is par...
My IDE crashes any time I try add a new component to the toolbar. I've already tried Resetting the toolbar. Where does the the information about the toolbar exist on the filesystem to see what may be the offending control?
The specific location of the toolbar configuration files can vary depending on the Integrated Development Environment (IDE) you are using. Here are some general guidelines for a few popular IDEs: 1. **Visual Studio**: - Visual Studio stores its settings in `.vssettings` files. These can often be found in the user p...
18,539
[ { "from": "human", "value": "My IDE crashes any time I try add a new component to the toolbar. I've already tried Resetting the toolbar. \nWhere does the the information about the toolbar exist on the filesystem to see what may be the offending control?\n" }, { "from": "gpt", "value": "The spec...
Currently running Server 2003 but am looking at reinstalling in the near future due to a change of direction with the domains. Should I take this opportunity to install Windows Server 2008 instead? I would love to play with new technology and the server is only for a small home business so downtime/performance issues a...
Given your situation, it would definitely be worth considering an upgrade to Windows Server 2008 or even a newer version if your hardware supports it. Here are a few points to consider: 1. **End of Life**: Windows Server 2003 has reached its end of life, which means it no longer receives security updates or support fr...
22,814
[ { "from": "human", "value": "Currently running Server 2003 but am looking at reinstalling in the near future due to a change of direction with the domains. Should I take this opportunity to install Windows Server 2008 instead?\nI would love to play with new technology and the server is only for a small home...
I would like to replace the default malloc at link time to use a custom malloc. But when I try to redefine malloc in my program, I get this error: MSVCRT.lib(MSVCR80.dll) : error LNK2005: _malloc already defined in test.lib(test.obj) This works perfectly on any Unix, and it works on Windows with most functions, but no...
The issue you're encountering is due to how the C runtime library on Windows, particularly MSVC, handles certain standard library functions like `malloc`. When you define `malloc` in your own code, you're trying to override an existing symbol that is part of the C runtime, which leads to a conflict at link time. In Un...
15,370
[ { "from": "human", "value": "I would like to replace the default malloc at link time to use a custom malloc. But when I try to redefine malloc in my program, I get this error:\nMSVCRT.lib(MSVCR80.dll) : error LNK2005: _malloc already defined in test.lib(test.obj)\n\nThis works perfectly on any Unix, and it ...
I'm trying to build a proxy module for .NET, but I'm having trouble copying the Headers from the current request to the new request. I am setting the headers of the new request, because I want the proxy to support SOAP requests. Here is a portion of my code. I can post everything if need, but this is the only part t...
You're correct that some HTTP headers cannot be set directly on `HttpWebRequest.Headers`. This is a built-in security mechanism in .NET to prevent certain headers from being tampered with. For example, headers like "Content-Length", "Host", "Transfer-Encoding", etc., must be set through specific properties on the `Http...
21,233
[ { "from": "human", "value": "I'm trying to build a proxy module for .NET, but I'm having trouble copying the Headers from the current request to the new request. I am setting the headers of the new request, because I want the proxy to support SOAP requests. Here is a portion of my code. I can post everyt...
Here's a hypothetical situation I've been wondering about lately. Suppose I have an interactive page created in ASP.NET and Ajax that I want multiple users to be able to manipulate at the same time. What would be the best way to maintain this page's state? Especially if the page was relatively ephemeral, and did not...
Maintaining the state of a game like checkers in an interactive ASP.NET application where multiple users can manipulate the board concurrently does pose some interesting challenges, particularly since you want to avoid the overhead of a traditional database. Here are several approaches you can consider: ### 1. In-Memo...
19,647
[ { "from": "human", "value": "Here's a hypothetical situation I've been wondering about lately. Suppose I have an interactive page created in ASP.NET and Ajax that I want multiple users to be able to manipulate at the same time. What would be the best way to maintain this page's state? Especially if the p...
Is there a way to run an Amazon EC2 AMI image in Windows? I'd like to be able to do some testing and configuration locally. I'm looking for something like Virtual PC.
Running an Amazon EC2 AMI image locally on Windows isn't directly supported, as AMIs are specifically designed for use within the AWS environment. However, there are ways to convert the AMI into a format that can be used with local virtualization software like VirtualBox or VMware. Here’s a general approach to achieve ...
17,433
[ { "from": "human", "value": "Is there a way to run an Amazon EC2 AMI image in Windows? I'd like to be able to do some testing and configuration locally. I'm looking for something like Virtual PC.\n" }, { "from": "gpt", "value": "Running an Amazon EC2 AMI image locally on Windows isn't directly...
I'm trying to build a mapping table to associate the IDs of new rows in a table with those that they're copied from. The OUTPUT INTO clause seems perfect for that, but it doesn't seem to behave according to the documentation. My code: DECLARE @Missing TABLE (SrcContentID INT PRIMARY KEY ) INSERT INTO @Missing ( S...
It looks like you're trying to leverage the `OUTPUT INTO` clause in SQL Server to create a mapping of inserted IDs to their source IDs. However, the error you are encountering is due to the fact that the `OUTPUT` clause can only access columns from the table that you are actually inserting into, and it cannot reference...
20,934
[ { "from": "human", "value": "I'm trying to build a mapping table to associate the IDs of new rows in a table with those that they're copied from. The OUTPUT INTO clause seems perfect for that, but it doesn't seem to behave according to the documentation. \nMy code:\nDECLARE @Missing TABLE (SrcContentID INT ...
Generally, MVC frameeworks have a structure that looks something like: /models /views /controllers /utils However, in a web application suite, I've decided that clumping all models, views, and controllers together probably wouldn't be the best for clarity, unless I treated the system as one application instead of an a...
It's great that you're thinking carefully about the structure of your application suite, as organization can significantly impact the maintainability and scalability of your project. Each of the options you presented has its merits, but here are some additional thoughts, including a potential fourth option, as well as ...
17,637
[ { "from": "human", "value": "Generally, MVC frameeworks have a structure that looks something like:\n/models\n/views\n/controllers\n/utils\n\nHowever, in a web application suite, I've decided that clumping all models, views, and controllers together probably wouldn't be the best for clarity, unless I treate...
I am trying to use a DynamicResource in Storyboard contained within a ControlTemplate. But, when I try to do this, I get a 'Cannot freeze this Storyboard timeline tree for use across threads' error. What is going on here?
The error message "Cannot freeze this Storyboard timeline tree for use across threads" indicates that you're trying to use a `Storyboard` that is associated with a `DynamicResource` in a way that is not thread-safe. This is commonly encountered in WPF when resources are being accessed across different threads, especial...
20,370
[ { "from": "human", "value": "I am trying to use a DynamicResource in Storyboard contained within a ControlTemplate.\nBut, when I try to do this, I get a 'Cannot freeze this Storyboard timeline tree for use across threads' error.\nWhat is going on here?\n" }, { "from": "gpt", "value": "The error ...
I know a Haskell module name, but I can't figure out in what package it is defined. This is bad because I can't compile without a package exposing this module. Specificaly it is Text.Regex that I can't locate, but I would like to know how to solve that problem in general.
If you have a Haskell module name and you want to find out which package it belongs to, there are several approaches you can take: ### 1. Use Hackage Hackage is the Haskell community's central package archive. You can search for modules directly on Hackage: 1. Go to [Hackage](https://hackage.haskell.org/). 2. Use th...
21,486
[ { "from": "human", "value": "I know a Haskell module name, but I can't figure out in what package it is defined. This is bad because I can't compile without a package exposing this module.\nSpecificaly it is Text.Regex that I can't locate, but I would like to know how to solve that problem in general.\n" ...
Is there a simple and lightweight program to search over a text file and replace a string with regex?
Yes, there are several lightweight programs and tools that you can use to search for a string in a text file and replace it using regular expressions (regex). Here are a few options: ### 1. **Sed (Stream Editor)** `sed` is a command-line tool that is available on most Unix-like operating systems. **Example command:**...
19,500
[ { "from": "human", "value": "Is there a simple and lightweight program to search over a text file and replace a string with regex?\n" }, { "from": "gpt", "value": "Yes, there are several lightweight programs and tools that you can use to search for a string in a text file and replace it using re...
Is it possible for Eclipse to read stdin from a file?
Yes, it is possible for Eclipse to read standard input (stdin) from a file, but it typically requires some setup because Eclipse, by default, does not directly support redirecting stdin from a file when running Java applications through its IDE. However, there are a few approaches you can consider: ### Method 1: Modif...
17,089
[ { "from": "human", "value": "Is it possible for Eclipse to read stdin from a file?\n" }, { "from": "gpt", "value": "Yes, it is possible for Eclipse to read standard input (stdin) from a file, but it typically requires some setup because Eclipse, by default, does not directly support redirecting ...
Can iPhone applications compiled against 2.1 be successfully installed via iTunes on a 2.0 device? I know iPhone applications compiled with 2.1 can run on a 2.0 device (assuming they're not using anything new from 2.1). But am not sure if iTunes will let the install take place. Does anyone have concrete information on ...
When it comes to iPhone applications, the compatibility between different SDK versions can be a bit tricky. Generally speaking, applications compiled against a newer SDK (like 2.1) can run on devices with older firmware (like 2.0), provided that the app does not utilize any APIs or features exclusive to the newer versi...
22,318
[ { "from": "human", "value": "Can iPhone applications compiled against 2.1 be successfully installed via iTunes on a 2.0 device?\nI know iPhone applications compiled with 2.1 can run on a 2.0 device (assuming they're not using anything new from 2.1). But am not sure if iTunes will let the install take place....
What are all the C++ blogs that you follow? Please add one url for one posting.
As an AI language model, I don’t have the capability to follow blogs or access content directly from the internet. However, I can suggest some popular C++ blogs that many developers find useful: 1. **C++ Weekly** URL: [C++ Weekly Blog](https://www.cplusplusweekly.com/) A blog by Jason Turner, focused on C++ ...
20,117
[ { "from": "human", "value": "What are all the C++ blogs that you follow?\nPlease add one url for one posting.\n" }, { "from": "gpt", "value": "As an AI language model, I don’t have the capability to follow blogs or access content directly from the internet. However, I can suggest some popular C+...
I can't be sure if my code is sucking, or if it's just that the browsers haven't caught up with the spec yet. My goal is to simulate list markers using generated content, so as to get e.g. continuation of the counters from list to list in pure CSS. So the code below, which I think is correct according to the spec, is l...
Your approach to simulating list markers using CSS counters is almost correct, but there are a few issues with the code you provided. The use of `display: marker` and `marker-offset` is not widely supported in browsers and is not part of the current CSS specifications for generated content. Instead, you can achieve yo...
18,408
[ { "from": "human", "value": "I can't be sure if my code is sucking, or if it's just that the browsers haven't caught up with the spec yet.\nMy goal is to simulate list markers using generated content, so as to get e.g. continuation of the counters from list to list in pure CSS.\nSo the code below, which I t...
Is there such a thing as unit test generation? If so... ...does it work well? ...What are the auto generation solutions that are available for .NET? ...are there examples of using a technology like this? ...is this only good for certain types of applications, or could it be used to replace all manually written unit te...
### Unit Test Generation Yes, there is such a thing as unit test generation, which refers to the automated creation of unit tests for software applications. The primary goal of unit test generation is to improve code quality, reduce bugs, and save time by automating the tedious and repetitive tasks associated with wri...
19,260
[ { "from": "human", "value": "Is there such a thing as unit test generation? If so...\n...does it work well? \n...What are the auto generation solutions that are available for .NET?\n...are there examples of using a technology like this?\n...is this only good for certain types of applications, or could it be...
I try to define a schema for XML documents I receive. The documents look like: <root> <items> <group name="G-1"> <item name="I-1"/> <item name="I-2"/> <item name="I-3"/> <item name="I-4"/> </group> </items> <data> <group name="G-1" plac...
XML Schema (XSD) does allow for the creation of complex types and restrictions based on the hierarchical structure of your XML, but it cannot enforce context-sensitive constraints directly within the schema itself. Specifically, you can't create rules that say "this element can only have these children if it's under th...
16,833
[ { "from": "human", "value": "I try to define a schema for XML documents I receive.\nThe documents look like:\n<root>\n <items>\n <group name=\"G-1\">\n <item name=\"I-1\"/>\n <item name=\"I-2\"/>\n <item name=\"I-3\"/>\n <item name=\"I-4\"/>\n </g...
I've got a table of hardware and a table of incidents. Each hardware has a unique tag, and the incidents are tied to the tag. How can I select all the hardware which has at least one incident listed as unresolved? I can't just do a join, because then if one piece of hardware had multiple unresolved issues, it would sho...
To select all hardware that has at least one unresolved incident while avoiding duplicates, you can use a `SELECT DISTINCT` statement along with a `JOIN` on your tables. Alternatively, you can use a subquery to achieve this. Here's how you can do both: ### Option 1: Using `JOIN` and `DISTINCT` Assuming your hardware ...
22,336
[ { "from": "human", "value": "I've got a table of hardware and a table of incidents. Each hardware has a unique tag, and the incidents are tied to the tag.\nHow can I select all the hardware which has at least one incident listed as unresolved?\nI can't just do a join, because then if one piece of hardware h...
I am looking for the best way to test if a website is alive from a C# application. Background My application consists of a Winforms UI, a backend WCF service and a website to publish content to the UI and other consumers. To prevent the situation where the UI starts up and fails to work properly because of a missing WC...
Your current solution using `WebRequest` is a straightforward and effective approach for checking if a website is alive. Making a request to a test page that performs checks and returns a status is a common practice. However, there are a few considerations and alternative approaches you might want to take into account ...
20,230
[ { "from": "human", "value": "I am looking for the best way to test if a website is alive from a C# application.\nBackground\nMy application consists of a Winforms UI, a backend WCF service and a website to publish content to the UI and other consumers. To prevent the situation where the UI starts up and fai...
I have been developing websites for a couple of years now and I almost never check if my pages are valid HTML and CSS. My check is by using a site such as browsershots.org and checking how it looks in all the different browsers. However recently I have been taking a college course and the prof wants us to validate ever...
Validating your HTML and CSS is indeed an important practice, and there are several reasons why you should care about it: 1. **Browser Compatibility**: While modern browsers are quite forgiving and can often render non-valid HTML and CSS without issues, there may be cases where invalid code results in inconsistent ren...
21,912
[ { "from": "human", "value": "I have been developing websites for a couple of years now and I almost never check if my pages are valid HTML and CSS. My check is by using a site such as browsershots.org and checking how it looks in all the different browsers. However recently I have been taking a college cour...
What is the benefit of Connectedness as defined by Resource Oriented Architecture (ROA)? The way I understand it, the crux of Connectedness is the ability to crawl the entire application state using only the root URIs. But how useful is that really? For example, imagine that HTTP GET http://example.com/users/joe return...
Your observations about Resource Oriented Architecture (ROA) and the concept of Connectedness highlight some important aspects of how resource links and URIs work in a RESTful context. While your understanding is on the right track, let’s delve deeper into the benefits of Connectedness and clarify why it is advantageou...
20,013
[ { "from": "human", "value": "What is the benefit of Connectedness as defined by Resource Oriented Architecture (ROA)? The way I understand it, the crux of Connectedness is the ability to crawl the entire application state using only the root URIs.\nBut how useful is that really?\nFor example, imagine that H...
What's the easiest way of me converting the simpler regex format that most users are used to into the correct re python regex string? As an example, I need to convert this: string = "*abc+de?" to this: string = ".*abc.+de.?" Of course I could loop through the string and build up another string character by character,...
To convert the simpler regex format into Python's `re` regex format, you can create a mapping for the special characters that you want to convert. Using the `str.replace()` method and a few substitutions can make this process much cleaner and more efficient than looping through each character manually. Here's how you ...
23,583
[ { "from": "human", "value": "What's the easiest way of me converting the simpler regex format that most users are used to into the correct re python regex string?\nAs an example, I need to convert this:\nstring = \"*abc+de?\"\n\nto this:\nstring = \".*abc.+de.?\"\n\nOf course I could loop through the string...
When I'm working on a project, sometimes I'll design the GUI first and then write the backend code to make it work, but other times I'll do the opposite and make the GUI once I have the system working. How do you choose which way round to code and are there any particular types of project or circumstances that would le...
Choosing whether to design the GUI (Graphical User Interface) first or to develop the backend code first often depends on the nature of the project, your development methodology, and your specific goals. Here are some considerations for both approaches: ### Designing the GUI First **Advantages:** 1. **User-Centric De...
21,182
[ { "from": "human", "value": "When I'm working on a project, sometimes I'll design the GUI first and then write the backend code to make it work, but other times I'll do the opposite and make the GUI once I have the system working. How do you choose which way round to code and are there any particular types ...
Is there any way to access the file object used by a CSV writer/reader object after it has been instantiated? I openned up the csv module, and it appears it's contest are builtin. I also tried setting the file object as a property but I get the following error: AttributeError: '_csv.writer' object has no attribute 'f...
In Python's `csv` module, when you instantiate a `csv.writer` or `csv.reader`, they do not expose their internal file object directly. The writer and reader objects are typically designed to work with file-like objects, but they do not provide a straightforward way to access the underlying file object after instantiati...
21,472
[ { "from": "human", "value": "Is there any way to access the file object used by a CSV writer/reader object after it has been instantiated? I openned up the csv module, and it appears it's contest are builtin. I also tried setting the file object as a property but I get the following error:\nAttributeError...
is it possible to include a servlet in a jsp page? if so how?
Yes, it is possible to include the output of a servlet in a JSP (JavaServer Pages) page. However, you cannot include a servlet directly as you would with a static file. Instead, you can achieve this by forwarding a request from the JSP page to the servlet or by using an `<jsp:include>` directive or tag to include the s...
16,942
[ { "from": "human", "value": "is it possible to include a servlet in a jsp page? if so how?\n" }, { "from": "gpt", "value": "Yes, it is possible to include the output of a servlet in a JSP (JavaServer Pages) page. However, you cannot include a servlet directly as you would with a static file. Ins...
I am trying to mock-up an API and am using separate apps within Django to represent different web services. I would like App A to take in a link that corresponds to App B and parse the json response. Is there a way to dynamically construct the url to App B so that I can test the code in development and not change to m...
Certainly! To achieve the goal of dynamically constructing the URL to a different app within your Django project, you can leverage Django's built-in features for URL management along with environment variables for different environments (development, production). This way, you can avoid hardcoding URLs like `localhost`...
16,598
[ { "from": "human", "value": "I am trying to mock-up an API and am using separate apps within Django to represent different web services. I would like App A to take in a link that corresponds to App B and parse the json response. \nIs there a way to dynamically construct the url to App B so that I can test t...
I need to get the "td" element of a table. I do not have the ability to add a mouseover or onclick event to the "td" element, so I need to add them with JQUERY. I need JQUERY to add the mouseover and onclick event to the all "td" elements in the table. Thats what I need, maybe someone can help me out?
Certainly! You can use jQuery to add mouseover and click events to all `<td>` elements in a table. Below is an example of how to do this. First, ensure you have included jQuery in your HTML file. You can do this by adding the following line in your `<head>` section: ```html <script src="https://ajax.googleapis.com/aj...
19,094
[ { "from": "human", "value": "I need to get the \"td\" element of a table. I do not have the ability to add a mouseover or onclick event to the \"td\" element, so I need to add them with JQUERY.\nI need JQUERY to add the mouseover and onclick event to the all \"td\" elements in the table.\nThats what I need...
I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted. The dopey way to do this would be to try every entry in /dev that corresponds to a writable devices (hd* and sd*)...... Is there a better solution, or should I stick with this one?
There are definitely better solutions than manually checking every entry in `/dev` for writable devices. Here are a few approaches you can use to identify all writable storage devices attached to a machine, regardless of their mount status: ### 1. Using `lsblk` The `lsblk` command provides a convenient way to list al...
21,168
[ { "from": "human", "value": "I have a need to find all of the writable storage devices attached to a given machine, whether or not they are mounted.\nThe dopey way to do this would be to try every entry in /dev that corresponds to a writable devices (hd* and sd*)......\nIs there a better solution, or should...
I am using Installshield 2008 Developer Edition and need to run SQL scripts against an existing SQL Server 2005 Express. When I do this without InstallShield, I would have to have some ODBC drivers installed for example. How does InstallShield do this? Does it include some sort of driver? Or does it depend on preexist...
InstallShield does not include SQL Server ODBC drivers or any database drivers by default. Instead, it relies on the pre-existing drivers that are installed on the target machine where the installation is taking place. When you use InstallShield to run SQL scripts against SQL Server 2005 Express, you need to ensure t...
21,468
[ { "from": "human", "value": "I am using Installshield 2008 Developer Edition and need to run SQL scripts against an existing SQL Server 2005 Express. When I do this without InstallShield, I would have to have some ODBC drivers installed for example. \nHow does InstallShield do this? Does it include some sor...
I am sure to become a scrum master could really add value to the process I am following, however I believe that the background of the area of the application I am working on help more to get better planning and scheduling done for the project
It sounds like you’re recognizing the dual importance of both Scrum Master skills and domain knowledge in enhancing the effectiveness of your project management. Here are a few points to consider that could help you leverage both aspects effectively: ### 1. **Role of the Scrum Master** - **Facilitator**: The Scrum ...
20,630
[ { "from": "human", "value": "I am sure to become a scrum master could really add value to the process I am following, however I believe that the background of the area of the application I am working on help more to get better planning and scheduling done for the project\n" }, { "from": "gpt", "...
Converting my current code project to TDD, I've noticed something. class Foo { public event EventHandler Test; public void SomeFunction() { //snip... Test(this, new EventArgs()); } } There are two dangers I can see when testing this code and relying on a code coverage tool to determine if ...
You’ve raised some excellent points regarding the limitations of code coverage tools and the potential pitfalls in testing, particularly in relation to events and event handlers. Let’s delve deeper into your concerns and explore potential solutions. ### Key Issues 1. **Event Handler Safety**: As you noted, calling an...
20,045
[ { "from": "human", "value": "Converting my current code project to TDD, I've noticed something.\nclass Foo {\n public event EventHandler Test;\n\n public void SomeFunction() {\n //snip...\n Test(this, new EventArgs());\n }\n}\n\nThere are two dangers I can see when testing this code a...
We're using SQL Server 2005 in a project. The users of the system have the ability to search some objects by using 'keywords'. The way we implement this is by creating a full-text catalog for the significant columns in each table that may contain these 'keywords' and then using CONTAINS to search for the keywords the u...
You're on the right track with adjusting the noise word configuration in SQL Server's full-text indexing, but the behavior you're experiencing is due to the fact that SQL Server's full-text search has some inherent limitations when dealing with specific types of queries and data. Here are some steps and considerations...
18,580
[ { "from": "human", "value": "We're using SQL Server 2005 in a project. The users of the system have the ability to search some objects by using 'keywords'. The way we implement this is by creating a full-text catalog for the significant columns in each table that may contain these 'keywords' and then using ...
I currently have a class and I'm trying to create an easy GUI to create a collection of this class. Most of the attributes of this class are strings. However, one of the attributes I want the user to be able to set is an Enum. Therefore, I would like the user interface, to have a dropdownlist for this enum, to restric...
To create a dropdown list for an Enum in a DataGridView while using C# and .NET 2.0, you can achieve this by utilizing a `DataGridViewComboBoxColumn`. Here’s how you can set it up, whether you choose to use a DataTable or a list of your objects. ### Using DataTable If you're using a `DataTable`, you can create a `Dat...
17,374
[ { "from": "human", "value": "I currently have a class and I'm trying to create an easy GUI to create a collection of this class. Most of the attributes of this class are strings. However, one of the attributes I want the user to be able to set is an Enum. Therefore, I would like the user interface, to have...
Other than standard OO concepts, what are some other strategies that allow for producing good, clean PHP code when a framework is not being used?
Producing clean and maintainable PHP code without relying on a framework can be achieved through various strategies beyond standard Object-Oriented (OO) concepts. Here are some techniques and best practices: ### 1. **Follow PSR Standards:** - Adhere to PHP Standards Recommendations (PSR) such as PSR-1 (Basic Coding...
18,380
[ { "from": "human", "value": "Other than standard OO concepts, what are some other strategies that allow for producing good, clean PHP code when a framework is not being used?\n" }, { "from": "gpt", "value": "Producing clean and maintainable PHP code without relying on a framework can be achieved...
I just saw this behaviour and I'm a bit surprised by it... If I add 3 or 4 elements to a Dictionary, and then do a "For Each" to get all the keys, they appear in the same order I added them. The reason this surprises me is that a Dictionary is supposed to be a HashTable internally, so I expected things to come out in A...
Your observation is correct, and it's understandable to find it surprising. In .NET (and many other languages), the `Dictionary<TKey, TValue>` maintains the order of elements as they are added. This behavior is a result of how `Dictionary<TKey, TValue>` is implemented, which may differ from other implementations of has...
21,000
[ { "from": "human", "value": "I just saw this behaviour and I'm a bit surprised by it...\nIf I add 3 or 4 elements to a Dictionary, and then do a \"For Each\" to get all the keys, they appear in the same order I added them.\nThe reason this surprises me is that a Dictionary is supposed to be a HashTable inte...
I was wondering if there was a .NET-compatible CLR that was implemented using the CLI (common language infrastructure), e.g., using .NET itself, or at least if there were any resources that would help with building one. Basically, something like a .NET program that loads assemblies as MemoryStreams, parses the bytecode...
Creating a .NET-compatible Common Language Runtime (CLR) that is implemented in a .NET language and runs Common Intermediate Language (CIL) is an ambitious and interesting project. While there isn't a complete and widely recognized implementation of such a CLR in existence, there are a few resources and approaches you ...
17,307
[ { "from": "human", "value": "I was wondering if there was a .NET-compatible CLR that was implemented using the CLI (common language infrastructure), e.g., using .NET itself, or at least if there were any resources that would help with building one.\nBasically, something like a .NET program that loads assemb...
I am currently in the process of making a new ASP.net MVC website, and find myself using Html.Encode all over the place, which is good practice, but gets pretty messy. I think a good way to clean this up would be if I could overload an operator to automatically do Html encoding. Previously: <%= Html.Encode( ViewData['...
While you cannot overload operators directly in ASP.NET MVC or make use of them in the way you're describing with HTML encoding, you can achieve a similar result by using extension methods or custom HTML helpers to clean up your views. Here's a way to create a custom HTML helper that does the encoding for you: ### C...
23,001
[ { "from": "human", "value": "I am currently in the process of making a new ASP.net MVC website, and find myself using Html.Encode all over the place, which is good practice, but gets pretty messy. I think a good way to clean this up would be if I could overload an operator to automatically do Html encoding....
Was reading up a bit on my C++, and found this article about RTTI (Runtime Type Identification): http://msdn.microsoft.com/en-us/library/70ky2y6k(VS.80).aspx . Well, that's another subject :) - However, I stumbled upon a weird saying in the type_info-class, namely about the ::name-method. It says: "The type_info::name ...
To implement a method that returns a `const char*` pointing to a cached string without requiring the caller to deallocate it, you can use a static or a member variable to store the string. This way, the string is allocated once and remains valid for the lifetime of the program or the object. Here’s a simple example: `...
20,306
[ { "from": "human", "value": "Was reading up a bit on my C++, and found this article about RTTI (Runtime Type Identification):\nhttp://msdn.microsoft.com/en-us/library/70ky2y6k(VS.80).aspx . Well, that's another subject :) - However, I stumbled upon a weird saying in the type_info-class, namely about the ::n...
What is the best way in Perl to copy files to a yet-to-be-created destination directory tree? Something like copy("test.txt","tardir/dest1/dest2/text.txt"); won't work since the directory tardir/dest1/dest2 does not yet exist. What is the best way to copy with directory creation in Perl?
To copy files to a destination directory that may not yet exist in Perl, you can use the `File::Path` module to create the necessary directory tree before performing the file copy. You can combine the `File::Copy` module for copying files and `File::Path` for creating directories. Here's an example of how to do this: ...
23,083
[ { "from": "human", "value": "What is the best way in Perl to copy files to a yet-to-be-created destination directory tree?\nSomething like\ncopy(\"test.txt\",\"tardir/dest1/dest2/text.txt\");\n\nwon't work since the directory tardir/dest1/dest2 does not yet exist. What is the best way to copy with directory...
I would like to know the best way to use a datagrid control linked to a combination (join) of data tables in a way that both simply allows both display, creation of new rows in underlying tables and deletion. The datagrid appears to offer the latter capabilities but I have not found a way that I am happy with to do mor...
To effectively use a DataGrid control for displaying, creating, and deleting rows while managing relationships between multiple tables (like your Customer and Order tables), you can follow these steps: ### 1. Design the Data Structure Create a ViewModel or Data Transfer Object that encapsulates the data you want to d...
19,864
[ { "from": "human", "value": "I would like to know the best way to use a datagrid control linked to a combination (join) of data tables in a way that both simply allows both display, creation of new rows in underlying tables and deletion.\nThe datagrid appears to offer the latter capabilities but I have not ...
I have a backroundrb scheduled task that takes quite a long time to run. However it seems that the process is ending after only 2.5 minutes. My background.yml file: :schedules: :named_worker: :task_name: :trigger_args: 0 0 12 * * * * :data: input_data I have zero activity on the server when the proce...
The issue you're experiencing with your BackgroundRB scheduled task stopping after approximately 2.5 minutes may be related to the server settings or the configuration of the BackgroundRB server itself. Here are a few potential solutions and troubleshooting steps you can consider: ### 1. Check Timeout Settings Backgro...
15,680
[ { "from": "human", "value": "I have a backroundrb scheduled task that takes quite a long time to run. However it seems that the process is ending after only 2.5 minutes.\nMy background.yml file:\n:schedules:\n :named_worker:\n :task_name:\n :trigger_args: 0 0 12 * * * *\n :data: input_data\n\n...
I saw Scott Meyers' "Effective C++" third edition book having a small section on "Template Programming". Any other book/links containing information on "effective" usage of templates ?
Certainly! Template programming in C++ is a powerful feature, and there are several excellent resources that cover effective usage. Here are some books and online resources that delve into template programming in detail: ### Books 1. **"C++ Templates: The Complete Guide" by David Vandevoorde, Nicolai M. Josuttis, and...
17,850
[ { "from": "human", "value": "I saw Scott Meyers' \"Effective C++\" third edition book having a small section on \"Template Programming\".\nAny other book/links containing information on \"effective\" usage of templates ?\n" }, { "from": "gpt", "value": "Certainly! Template programming in C++ is ...
I have the following serialization method: Private Function SerializeData(ByVal data As cData) As String If data IsNot Nothing Then Dim xml_stream As New MemoryStream() Dim sr As StreamReader Dim xs As New XmlSerializer(GetType(cData)) xml_stream = New MemoryS...
In .NET, the `XmlSerializer` does not provide an option to disable indentation directly during serialization. However, you can achieve the desired compact format by using `XmlWriter` with specific settings. Here’s how you can modify your `SerializeData` method to produce compact XML without indentation: ```vb Privat...
22,827
[ { "from": "human", "value": "I have the following serialization method:\n Private Function SerializeData(ByVal data As cData) As String\n If data IsNot Nothing Then\n Dim xml_stream As New MemoryStream()\n Dim sr As StreamReader\n Dim xs As New XmlSerializer(GetTyp...
I have a string which is like this: this is [bracket test] "and quotes test " I'm trying to write something in Python to split it up by space while ignoring spaces within square braces and quotes. The result I'm looking for is: ['this','is','bracket test','and quotes test ']
To achieve the desired result of splitting the string while ignoring spaces within square brackets and quotes, you can use the `re` module in Python, which provides support for regular expressions. Here's a function that will do exactly that: ```python import re def custom_split(s): # Use a regex pattern to match...
23,698
[ { "from": "human", "value": "I have a string which is like this:\nthis is [bracket test] \"and quotes test \"\nI'm trying to write something in Python to split it up by space while ignoring spaces within square braces and quotes. The result I'm looking for is:\n['this','is','bracket test','and quotes test '...
I have an assembly in the GAC which gets loaded when I'm debugging a web app. However, I've changed that assembly in the web app that I'm debugging but VS2008/Cassini is picking up the one in the GAC. How do I make VS2008/Cassini use the one that I'm debugging?
When working with ASP.NET applications in Visual Studio 2008, if you have an assembly that is registered in the Global Assembly Cache (GAC) and you want to ensure that your application uses the version from your project rather than the one in the GAC, you can follow these steps: 1. **Remove the Assembly from the GAC**...
20,781
[ { "from": "human", "value": "I have an assembly in the GAC which gets loaded when I'm debugging a web app. However, I've changed that assembly in the web app that I'm debugging but VS2008/Cassini is picking up the one in the GAC.\nHow do I make VS2008/Cassini use the one that I'm debugging?\n" }, { ...
Not so long ago I was in an interview, that required solving two very interesting problems. I'm curious how would you approach the solutions. Problem 1 : Product of everything except current Write a function that takes as input two integer arrays of length len, input and index, and generates a third array, result, suc...
Let's break down the solutions for each of the problems you've presented. ### Problem 1: Product of Everything Except Current The goal here is to create an array `result` such that `result[i]` is the product of all elements in `input` except `input[index[i]]`. The solution requires that we run it in linear time, whic...
15,386
[ { "from": "human", "value": "Not so long ago I was in an interview, that required solving two very interesting problems. I'm curious how would you approach the solutions.\nProblem 1 :\nProduct of everything except current \nWrite a function that takes as input two integer arrays of length len, input and ind...
After looking at other questions related to sharing solutions between VS 2005 and VS 2008 it seems that the way to go is to have two solution files (one for VS 2005 and one for VS 2008). However, if the solution is under source control (VisualSVN in our case), how would we maintain two solution files and not keep ove...
Yes, it is indeed possible to maintain two solution files for different versions of Visual Studio while using source control, such as VisualSVN. Here are some strategies to handle this situation: ### 1. Create a .sln File Per Visual Studio Version Keep two separate `.sln` files in your project structure, for example:...
22,831
[ { "from": "human", "value": "After looking at other questions related to sharing solutions between VS 2005 and VS 2008 it seems that the way to go is to have two solution files (one for VS 2005 and one for VS 2008). \nHowever, if the solution is under source control (VisualSVN in our case), how would we ma...