instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
What exactly does null do performance and storage (space) wise in MySQL? For example: TINYINT: 1 Byte TINYINT w/NULL 1 byte + somehow stores NULL?
In MySQL, handling `NULL` values has implications for both performance and storage (space) when it comes to data types. Here’s how it works, particularly focusing on `TINYINT` and how `NULL` is managed: ### Storage Space 1. **Regular Data Type Storage:** - When you define a column as `TINYINT`, it occupies 1 byte ...
22,900
[ { "from": "human", "value": "What exactly does null do performance and storage (space) wise in MySQL?\nFor example:\nTINYINT: 1 Byte\nTINYINT w/NULL 1 byte + somehow stores NULL?\n" }, { "from": "gpt", "value": "In MySQL, handling `NULL` values has implications for both performance and storage (...
I didn't realize until recently that Perl 5.10 had significant new features and I was wondering if anyone could give me some good resources for learning about those. I searched for them on Google and all I found was some slides and a quick overview. Some of the features (to me at least) would be nice if they had more...
Perl 5.10 was indeed a significant release, bringing a variety of new features and enhancements to the language. Here are some resources that can help you learn more about the features introduced in Perl 5.10: 1. **Perl 5.10 Release Notes**: - The official release notes provide a comprehensive overview of all chang...
22,269
[ { "from": "human", "value": "I didn't realize until recently that Perl 5.10 had significant new features and I was wondering if anyone could give me some good resources for learning about those. I searched for them on Google and all I found was some slides and a quick overview. Some of the features (to me...
I'm looking for a way to validate the SQL schema on a production DB after updating an application version. If the application does not match the DB schema version, there should be a way to warn the user and list the changes needed. Is there a tool or a framework (to use programatically) with built-in features to do tha...
Validating the SQL schema against a production database after an application version update is a critical step in ensuring the integrity and proper functioning of your application. While commercial tools like Redgate's SQL Compare are popular, there are several free or open-source options and approaches you can conside...
19,988
[ { "from": "human", "value": "I'm looking for a way to validate the SQL schema on a production DB after updating an application version. If the application does not match the DB schema version, there should be a way to warn the user and list the changes needed.\nIs there a tool or a framework (to use program...
How can I make my compilation optimized for Windows 64 bit?
Optimizing your compilation for Windows 64-bit architecture involves a combination of compiler settings, code practices, and project configuration. Here are some general steps you can follow: ### 1. Choose the Right Compiler Make sure you're using a compiler that supports 64-bit compilation, such as: - **Microsoft Vi...
19,562
[ { "from": "human", "value": "How can I make my compilation optimized for Windows 64 bit?\n" }, { "from": "gpt", "value": "Optimizing your compilation for Windows 64-bit architecture involves a combination of compiler settings, code practices, and project configuration. Here are some general step...
I have a bit of code that basically reads an XML document using the XMLDocument.Load(uri) method which works fine, but doesn't work so well if the call is made through a proxy. I was wondering if anyone knew of a way to make this call (or achieve the same effect) through a proxy?
To read an XML document through a proxy in C#, you'll want to make use of the `HttpWebRequest` or `HttpClient` classes instead of directly using the `XmlDocument.Load(uri)` method. Both of these classes allow you to configure proxy settings more easily. Here's an example using `HttpClient` with a proxy: ### Using Htt...
22,291
[ { "from": "human", "value": "I have a bit of code that basically reads an XML document using the XMLDocument.Load(uri) method which works fine, but doesn't work so well if the call is made through a proxy.\nI was wondering if anyone knew of a way to make this call (or achieve the same effect) through a prox...
I need to evaluate a mathmatical expression that is presented to me as a string in C#. Example noddy but gets the point across that the string as the expression. I need the evaluate to then populate an int. There is no Eval() in C# like in others langugaes... String myString = "3*4"; Edit: I am on VS2008 Tried the M...
It's great to hear that you found a solution using `CodeDom` and `DataTable.Compute()`. Both approaches can be effective for evaluating mathematical expressions in C#. Below, I'll provide a brief overview of both methods along with an example for each. ### Method 1: Using `DataTable.Compute()` The `DataTable.Compute(...
18,679
[ { "from": "human", "value": "I need to evaluate a mathmatical expression that is presented to me as a string in C#. Example noddy but gets the point across that the string as the expression.\nI need the evaluate to then populate an int.\nThere is no Eval() in C# like in others langugaes...\nString myString...
I need to build a high performance winforms data grid using Visual Studio 2005, and I'm at a loss with where to start. I've build plenty of data grid applications, but none of those were very good when the data was constantly refreshing. The grid is going to be roughly 100 rows by 40 columns, and each cell in the grid ...
Building a high-performance data grid in WinForms that can handle frequent updates efficiently is indeed a challenge, especially with the constraints you've outlined. Here’s a structured approach to tackle this problem using Visual Studio 2005 (or 2008): ### 1. Custom Data Structure Use a custom data structure to repr...
16,995
[ { "from": "human", "value": "I need to build a high performance winforms data grid using Visual Studio 2005, and I'm at a loss with where to start. I've build plenty of data grid applications, but none of those were very good when the data was constantly refreshing.\nThe grid is going to be roughly 100 rows...
I am writing an internal Java Applet to do file uploads via HTTP. I started using the built in ClientHttpRequest which worked great if I want to post one after another. When I try to have multiple threads post at the same time, something on the server side freaks out and the connection will hang for large files while...
It sounds like you're dealing with a couple of issues: managing multiple concurrent uploads and handling timeouts effectively. Below are some suggestions to improve your setup with Apache HttpClient and manage concurrent uploads. ### 1. Using Apache HttpClient for Concurrent Requests First, make sure you’re using the...
17,118
[ { "from": "human", "value": "I am writing an internal Java Applet to do file uploads via HTTP. I started using the built in ClientHttpRequest which worked great if I want to post one after another. When I try to have multiple threads post at the same time, something on the server side freaks out and the c...
I'm building my first flex app and am currently bussy splitting it up in multiple components to make it maintainable. I have a screen which holds a list that is displayed and filled after a succesfull login attempt: Part of the main app: <mx:ViewStack id="vsAdmin" height="100%" width="100%"> <mx:TabNavigator id="adm...
The behavior you're experiencing is likely related to the timing of when the component `compBeheerdersAdmin` is fully initialized and ready to execute methods such as `requestBeheerdersList()`. When you switch to the `vsAdmin` view after a fresh load, it is possible that the component is not yet fully initialized, so c...
20,718
[ { "from": "human", "value": "I'm building my first flex app and am currently bussy splitting it up in multiple components to make it maintainable.\nI have a screen which holds a list that is displayed and filled after a succesfull login attempt:\nPart of the main app:\n<mx:ViewStack id=\"vsAdmin\" height=\"...
When using py2exe to distribute Python applications with wxPython, some MSVC DLLs are usually needed to make the .exe work on freshly installed machines. In particular, the two most common DLLs are msvcp71.dll and msvcr71.dll The former can be included in the .exe using this tip. However, the latter is just placed in t...
When using `py2exe` to bundle your Python application, it can be challenging to ensure that all required DLLs are included in the executable. In particular, including the `msvcr71.dll` within the .exe file can be tricky. Here’s how you can include both `msvcp71.dll` and `msvcr71.dll` in your final `.exe`. ### Steps to...
19,774
[ { "from": "human", "value": "When using py2exe to distribute Python applications with wxPython, some MSVC DLLs are usually needed to make the .exe work on freshly installed machines. In particular, the two most common DLLs are msvcp71.dll and msvcr71.dll\nThe former can be included in the .exe using this ti...
EDIT What small things which are too easy to overlook do I need to do before deploying a rails application? I have set up another question for any task that takes more than a minute or two, and so ought to be scheduled into a deployment process. In this question I'm mostly concerned with on-line config options and sim...
Before deploying a Rails application, there are several small but important details that are often overlooked. Here’s a checklist of items to consider that are usually quick to address but can significantly affect your application’s performance, security, and usability in production: ### Configuration & Environment Se...
10,984
[ { "from": "human", "value": "EDIT\nWhat small things which are too easy to overlook do I need to do before deploying a rails application? \nI have set up another question for any task that takes more than a minute or two, and so ought to be scheduled into a deployment process. In this question I'm mostly co...
I'm using the ASP.NET 3.5 SP1 System.Web.Routing with classic WebForms, as described in http://chriscavanagh.wordpress.com/2008/04/25/systemwebrouting-with-webforms-sample/ All works fine, I have custom SEO urls and even the postback works. But there is a case where the postback always fails and I get a: Validation of ...
The issue you're encountering with the "Validation of viewstate MAC failed" error when using routing with multiple sub-paths in your ASP.NET Web Forms application can be attributed to how ASP.NET manages ViewState and routing. When you route URLs in ASP.NET Web Forms, and especially when you have complex routing paths...
23,826
[ { "from": "human", "value": "I'm using the ASP.NET 3.5 SP1 System.Web.Routing with classic WebForms, as described in http://chriscavanagh.wordpress.com/2008/04/25/systemwebrouting-with-webforms-sample/\nAll works fine, I have custom SEO urls and even the postback works. But there is a case where the postbac...
I would like to determine the operating system of the host that my Java program is running programmatically (for example: I would like to be able to load different properties based on whether I am on a Windows or Unix platform). What is the safest way to do this with 100% reliability?
In Java, you can determine the operating system on which your program is running by checking the system properties. The `System.getProperty()` method can be used to retrieve the `os.name` property, which provides information about the operating system. Here’s how you can safely determine the operating system: ```java...
22,373
[ { "from": "human", "value": "I would like to determine the operating system of the host that my Java program is running programmatically (for example: I would like to be able to load different properties based on whether I am on a Windows or Unix platform). What is the safest way to do this with 100% reliab...
I am working on a Software Project that needs to be translated into 30 languages. This means that changing any string incurs into a relatively high cost. Additionally, translation does not happen overnight, because the translation package needs to be worked by different translators, so this might take a while. Adding...
Managing strings in a software project that requires translation into multiple languages can be challenging. Here are some tips to ease the impact of translation and help you maintain better control over your strings in a Java application using Resource Bundles: ### 1. Centralize String Management - **Use a String Ma...
17,992
[ { "from": "human", "value": "I am working on a Software Project that needs to be translated into 30 languages. This means that changing any string incurs into a relatively high cost. Additionally, translation does not happen overnight, because the translation package needs to be worked by different transl...
Lets say on my page I have this function: function ReturnFoo(bar) { return bar.toString() + "foo"; } Now, I would like to have this called from ASP .NET, hopefully with the ASP .NET AJAX framework, as I am already using it in this codebase (I have already spent the 100k, might as well use it). Also, I would like...
To call a JavaScript function from ASP.NET and retrieve its output, you'll typically need to use AJAX to make an asynchronous request from the client-side to the server-side. However, since you're restricted to ASP.NET 2.0, your options will be somewhat limited compared to later versions of ASP.NET. Since the `ReturnF...
21,705
[ { "from": "human", "value": "Lets say on my page I have this function:\n function ReturnFoo(bar)\n {\n return bar.toString() + \"foo\";\n }\n\nNow, I would like to have this called from ASP .NET, hopefully with the ASP .NET AJAX framework, as I am already using it in this codebase (I have already spent th...
How do I view the SQL that is generated by nHibernate? version 1.2
To view the SQL generated by NHibernate version 1.2, you can enable SQL logging in your application. Here are a few methods to achieve that: ### 1. Using NHibernate's built-in logging You can configure NHibernate to log SQL statements directly. To do this, modify your NHibernate configuration settings. You typically ...
21,315
[ { "from": "human", "value": "How do I view the SQL that is generated by nHibernate? version 1.2\n" }, { "from": "gpt", "value": "To view the SQL generated by NHibernate version 1.2, you can enable SQL logging in your application. Here are a few methods to achieve that:\n\n### 1. Using NHibernat...
Currently all our files are stored on a Windows network drive and with 15 members of staff and 3 external workers, file control is beginning to become a bit of a nightmare. Even though we have a policy in place, people still seem to save file to their PCs, make changes, and copy them back without notifying anyone, send...
Given your requirements for a file management system that can be installed in-house, is user-friendly, supports version control, and allows for different user access levels, here are some open-source solutions to consider: ### 1. **Nextcloud** - **Description:** Nextcloud is a powerful, self-hosted file sync and shari...
21,365
[ { "from": "human", "value": "Currently all our files are stored on a Windows network drive and with 15 members of staff and 3 external workers, file control is beginning to become a bit of a nightmare. Even though we have a policy in place, people still seem to save file to their PCs, make changes, and copy...
The ASP.NET application that I am currently responsible for at my day job has hit its limit in terms of its ability to scale inside a single server. Obviously we are working toward moving session out of process and the test and hopefully deploy date draws near. I would like to draw on the experiencies of people using t...
When considering load balancing solutions for an ASP.NET application, it's essential to weigh the advantages and disadvantages of built-in Windows load balancing against dedicated appliance solutions. Here are some insights based on common experiences from the field: ### Built-in Windows Load Balancing (NLB) **Advant...
19,261
[ { "from": "human", "value": "The ASP.NET application that I am currently responsible for at my day job has hit its limit in terms of its ability to scale inside a single server. Obviously we are working toward moving session out of process and the test and hopefully deploy date draws near. I would like to d...
I continue to get this error: Object '%s' cannot be renamed because the object participates in enforced dependencies I need to find a script that will help me to find all the dependencies that there is with this table. I will need to drop them, rename, then bring them back. SQL Server 2005
To address the issue of object dependencies in SQL Server 2005 when trying to rename a table, you will first need to identify the dependencies on that table. Here’s a script that you can run to find all the objects that depend on your specified table: ```sql -- Replace 'YourTableName' with the name of your table DECLA...
22,935
[ { "from": "human", "value": "I continue to get this error:\nObject '%s' cannot be renamed because the object participates in enforced dependencies\n\nI need to find a script that will help me to find all the dependencies that there is with this table. I will need to drop them, rename, then bring them back.\...
I'm working on a commercial (not open source) C++ project that runs on a linux-based system. I need to do some regex within the C++ code. (I know: I now have 2 problems.) QUESTION: What libraries do people who regularly do regex from C/C++ recommend I look into? A quick search has brought the following to my atte...
When it comes to regular expressions in C++, there are several options you can consider. Here’s a brief overview of the libraries you've mentioned, as well as a couple of additional recommendations: 1. **Boost.Regex**: - Part of the larger Boost C++ Libraries, Boost.Regex is a robust and widely-used library for reg...
19,882
[ { "from": "human", "value": "I'm working on a commercial (not open source) C++ project that runs on a linux-based system. I need to do some regex within the C++ code. (I know: I now have 2 problems.)\nQUESTION: What libraries do people who regularly do regex from C/C++ recommend I look into? A quick s...
How to test if a line segment intersects an axis-aligned rectange in 2D? The segment is defined with its two ends: p1, p2. The rectangle is defined with top-left and bottom-right points.
To test if a line segment defined by two endpoints \( p_1 \) and \( p_2 \) intersects an axis-aligned rectangle defined by its top-left corner \( (x_{\text{min}}, y_{\text{min}}) \) and bottom-right corner \( (x_{\text{max}}, y_{\text{max}}) \), you can follow these steps: ### Step 1: Check if either endpoint is insid...
14,715
[ { "from": "human", "value": "How to test if a line segment intersects an axis-aligned rectange in 2D? The segment is defined with its two ends: p1, p2. The rectangle is defined with top-left and bottom-right points.\n" }, { "from": "gpt", "value": "To test if a line segment defined by two endpoi...
I have only a basic knowledge of css, is it possible to inherit a property from one style into another style. So for instance I could inherit the font size specified in my default paragrah tag settings into my hyperlink tags. The reason I want to do this is to make it easier to maintain multiple styles.
Yes, it is possible to achieve a form of inheritance or reuse of styles in CSS, but CSS does not have a direct way to "inherit" styles in the way you might be thinking, particularly for properties like font size. However, there are several techniques that you can use to make your styles more maintainable and ensure con...
21,068
[ { "from": "human", "value": "I have only a basic knowledge of css, is it possible to inherit a property from one style into another style. So for instance I could inherit the font size specified in my default paragrah tag settings into my hyperlink tags.\nThe reason I want to do this is to make it easier to...
I was wondering if there is a native C++ (or STL/Boost) function which will search a CString for a specified string? e.g. CString strIn = "Test number 1"; CString strQuery = "num"; bool fRet = SomeFn(strIn, StrQuery); if( fRet == true ) { // Ok strQuery was found in strIn ... I have found a small number of functi...
The `CString` class from MFC (Microsoft Foundation Classes) indeed provides several methods to search for substrings, and you can use the `Find` method to accomplish what you're looking for. Here's an example of how you could implement your function using `CString::Find` to determine if `strQuery` is contained within ...
24,074
[ { "from": "human", "value": "I was wondering if there is a native C++ (or STL/Boost) function which will search a CString for a specified string?\ne.g.\nCString strIn = \"Test number 1\";\nCString strQuery = \"num\";\n\nbool fRet = SomeFn(strIn, StrQuery);\n\nif( fRet == true )\n{\n // Ok strQuery was foun...
near the top of the code i see things like, btn_dropdown._visible = false; mcMenuBkg._visible = false; but I can't find these assets anywhere in the library or in any code, how does this make any sense? The movie clips in the library that look the same have different names and I can delete them entirely and they still...
It sounds like you are working with a Flash (ActionScript) project, and you are encountering some common issues related to asset visibility and the linkage of movie clips. Here are some possibilities to consider: 1. **Class Reference**: If the assets `btn_dropdown` and `mcMenuBkg` are instances of movie clips that are...
23,949
[ { "from": "human", "value": "near the top of the code i see things like, \nbtn_dropdown._visible = false;\nmcMenuBkg._visible = false;\nbut I can't find these assets anywhere in the library or in any code, how does this make any sense?\nThe movie clips in the library that look the same have different names ...
I am adding series and panes to a Developer's Express Chart Control in code on a windows form application. I would like to only show the x-axis labels for the first pane. The showInPanes property is telling me it is read only. How do I set this propert in code?
In Developer Express (DevExpress) Chart Control, the `ShowInPanes` property is indeed read-only, but you can control the visibility of the x-axis labels for each pane by managing the `AxisX` properties of each series directly. To show the x-axis labels only for the first pane, you can set the `Visible` property of the...
21,246
[ { "from": "human", "value": "I am adding series and panes to a Developer's Express Chart Control in code on a windows form application. I would like to only show the x-axis labels for the first pane. The showInPanes property is telling me it is read only. How do I set this propert in code?\n" }, { ...
I have small page which has label, DropDownList and a submit button. <div> <asp:label id="Message" runat="server"/> <br /> Which city do you wish to look at on hotels for?<br /><br /> <asp:dropdownlist id="Dropdownlist1" runat="server" EnableViewState="true"> </asp:dropdownlist> ...
It sounds like you're encountering a classic issue related to the lifecycle of ASP.NET pages and how controls retain their state between postbacks. Let's break down your problem and address the various aspects. ### Understanding the ASP.NET Page Lifecycle 1. **Page Load**: When the page is first requested, the `Page_...
22,088
[ { "from": "human", "value": "I have small page which has label, DropDownList and a submit button.\n<div>\n <asp:label id=\"Message\" runat=\"server\"/>\n <br />\n Which city do you wish to look at on hotels for?<br /><br />\n <asp:dropdownlist id=\"Dropdownlist1\" runat=\"server\" En...
As I understand it, the command to ignore the content of a directory using SVN is this: svn propset svn:ignore "*" tmp/ This should set the ignore property on the content of the tmp directory, right? In other words, the wildcard is set to be the ignore value on the tmp directory. Trouble is, here's what is happening o...
It seems like you're encountering a strange behavior when trying to set the `svn:ignore` property using the command line on your Windows Vista machine. The command you used is correct for setting the ignore property on the `tmp` directory, and it should indeed ignore all content within that directory. The output you'r...
24,336
[ { "from": "human", "value": "As I understand it, the command to ignore the content of a directory using SVN is this:\nsvn propset svn:ignore \"*\" tmp/\n\nThis should set the ignore property on the content of the tmp directory, right? In other words, the wildcard is set to be the ignore value on the tmp dir...
I created an Interop user control in VS2005. When the user control is shown inside VB6, it does not pickup/use the XP styles (The buttons and the tabs look like VB6 buttons/tabs). How do I get the XP styles to work with my control while it is in VB6?
To get your Interop user control to utilize XP styles when hosted in VB6, you may need to take a few specific steps. This situation occurs because the VB6 environment does not automatically apply Windows XP visual styles to ActiveX controls. Here's how you can achieve that: ### Step 1: Ensure Your Control Supports Vis...
19,566
[ { "from": "human", "value": "I created an Interop user control in VS2005. When the user control is shown inside VB6, it does not pickup/use the XP styles (The buttons and the tabs look like VB6 buttons/tabs). \nHow do I get the XP styles to work with my control while it is in VB6?\n" }, { "from": "g...
What's the best way for a common library to know what context - a.k.a. the calling app - it is in? I'm in a very controlled enterprise environment... is there a better way for the library to know what application it is getting called from than reading a setting in the config file? What do you use for this type of thing...
In a controlled enterprise environment where applications are expected to use a common library, there are several approaches you can take to determine the calling application context more robustly than simply reading from a configuration file. Here are a few alternatives, considering that you're looking for something a...
22,904
[ { "from": "human", "value": "What's the best way for a common library to know what context - a.k.a. the calling app - it is in? I'm in a very controlled enterprise environment... is there a better way for the library to know what application it is getting called from than reading a setting in the config fil...
If I have a class that needs to implement an interface but one or more of the methods on that interface don't make sense in the context of this particular class, what should I do? For example, lets say I'm implementing an adapter pattern where I want to create a wrapper class that implements java.util.Map by wrapping s...
When implementing an interface in a class that does not logically support all of its methods, you have a few options depending on the use case and requirements of your application. Here are some common strategies: ### 1. **Throw UnsupportedOperationException** For methods that are not applicable to the implementation...
20,146
[ { "from": "human", "value": "If I have a class that needs to implement an interface but one or more of the methods on that interface don't make sense in the context of this particular class, what should I do?\nFor example, lets say I'm implementing an adapter pattern where I want to create a wrapper class t...
Is there a way to define a generic constraint in Java which would be analogous to the following C# generic constratint ? class Class1<I,T> where I : Interface1, Class2 : I I'm trying to do it like this: class Class1<I extends Interface1, T extends I & Class2> But the compiler complains about the "Class2" part: Type p...
In Java, generic type constraints work a bit differently than in C#. In C#, you can specify multiple constraints with a syntax that allows you to mix interfaces and base classes. However, in Java, you cannot use multiple bounds in the same way. In your case, you want to specify that `T` should be both an implementatio...
22,295
[ { "from": "human", "value": "Is there a way to define a generic constraint in Java which would be analogous to the following C# generic constratint ?\nclass Class1<I,T> where I : Interface1, Class2 : I\n\nI'm trying to do it like this:\nclass Class1<I extends Interface1, T extends I & Class2>\n\nBut the com...
I know that you can do this in SQL Server 2005, but I'm at a loss for 2000.
It seems you're looking for a specific feature or functionality in SQL Server 2000 that you know exists in SQL Server 2005. Could you clarify what you are trying to achieve? Some common tasks that people often want help with when transitioning from SQL Server 2000 to 2005 include: - Data manipulation (inserts, updates...
26,986
[ { "from": "human", "value": "I know that you can do this in SQL Server 2005, but I'm at a loss for 2000.\n" }, { "from": "gpt", "value": "It seems you're looking for a specific feature or functionality in SQL Server 2000 that you know exists in SQL Server 2005. Could you clarify what you are try...
When writing async method implementations using the BeginInvoke/EndInvoke pattern the code might look something like the following (and to save you guessing this is an async wrapper around a cache): IAsyncResult BeginPut(string key, object value) { Action<string, object> put = this.cache.Put; return put.BeginIn...
You can simplify your implementation by using a common interface or base class that your delegates can share, rather than checking each delegate type explicitly. One approach is to create a wrapper class around your delegate, allowing you to store the delegate in a type-safe way without the need to check its exact type...
17,613
[ { "from": "human", "value": "When writing async method implementations using the BeginInvoke/EndInvoke pattern the code might look something like the following (and to save you guessing this is an async wrapper around a cache):\nIAsyncResult BeginPut(string key, object value)\n{\n Action<string, object> ...
I could use some help writing a regular expression. In my Django application, users can hit the following URL: http://www.example.com/A1/B2/C3 I'd like to create a regular expression that allows accepts any of the following as a valid URL: http://www.example.com/A1 http://www.example.com/A1/B2 http://www.example....
You're on the right track with your regex, but there are a couple of improvements we can make to ensure it correctly matches the desired URL patterns. The goal is to capture the cases where you have one, two, or three segments after the domain, and we can use grouping effectively to achieve this. Here's an updated ver...
23,508
[ { "from": "human", "value": "I could use some help writing a regular expression. In my Django application, users can hit the following URL:\nhttp://www.example.com/A1/B2/C3\n\nI'd like to create a regular expression that allows accepts any of the following as a valid URL:\nhttp://www.example.com/A1 \nhttp...
Given the following idioms: 1) variable = value1 if condition variable = value2 2) variable = value2 if not condition variable = value1 3) if condition variable = value2 else variable = value1 4) if not condition variable = value1 else variable = value2 Which do you prefer, and why? We assume the most commo...
When it comes to choosing between the provided idioms for conditional variable assignment, preference often boils down to readability, maintainability, and the common execution paths. Here's a breakdown of each idiom based on these factors: 1. **Idiom 1**: ```python variable = value1 if condition var...
22,322
[ { "from": "human", "value": "Given the following idioms:\n1)\nvariable = value1\nif condition\n variable = value2\n2)\nvariable = value2\nif not condition\n variable = value1\n3)\nif condition\n variable = value2\nelse\n variable = value1\n4)\nif not condition\n variable = value1\nelse\n variable = va...
Currently, I've got images (max. 6MB) stored as BLOB in a InnoDB table. As the size of the data is growing, the nightly backup is growing slower and slower hindering normal performance. So, the binary data needs to go to the file system. (pointers to the files will be kept in the DB.) The data has a tree like relation:...
Your approach to store images in the filesystem while maintaining a directory structure that keeps user and album data organized is sound, and your updates to the strategy indicate that you're considering various factors to optimize it. Here’s a refined outline of your plan with some considerations: ### Directory Stru...
23,538
[ { "from": "human", "value": "Currently, I've got images (max. 6MB) stored as BLOB in a InnoDB table.\nAs the size of the data is growing, the nightly backup is growing slower and slower hindering normal performance.\nSo, the binary data needs to go to the file system. (pointers to the files will be kept in ...
I have a xml which is max 3 levels deep. Now by using C# or Xpath what the best method to check the whether all the child nodes under a parent node are empty. Thanks in Advance.
To check whether all child nodes under a parent node are empty using C# and XPath, you can follow these steps: 1. Load the XML document. 2. Use XPath to select the parent node. 3. Iterate through its child nodes and check if they are empty. Here's a sample C# code snippet demonstrating how to do this: ```csharp usin...
23,212
[ { "from": "human", "value": "I have a xml which is max 3 levels deep. Now by using C# or Xpath what the best method to check the whether all the child nodes under a parent node are empty.\nThanks in Advance.\n" }, { "from": "gpt", "value": "To check whether all child nodes under a parent node ar...
Specifically, I want to listen to when programs are run and record information such as: timestamp, executable, windows name and user.
To listen for when programs are run in a Windows environment and record information like the timestamp, executable name, window name, and user, you can use a combination of Windows Event Logging, PowerShell scripting, and potentially a Windows service or a background application. Here’s a step-by-step guide on how to ...
19,197
[ { "from": "human", "value": "Specifically, I want to listen to when programs are run and record information such as: timestamp, executable, windows name and user.\n" }, { "from": "gpt", "value": "To listen for when programs are run in a Windows environment and record information like the timesta...
I used to be able to launch a locally installed helper application by registering a given mime-type in the Windows registry. This enabled me to allow users to be able to click once on a link to the current install of our internal browser application. This worked fine in Internet Explorer 5 (most of the time) and Firefo...
The challenge you are facing with Internet Explorer (IE) 7 not passing the full path to the downloaded install package is indeed a known issue, and you're correct that it makes the task more complicated. However, you can still manage to get the physical path from the virtual path that IE provides using a couple of pote...
17,677
[ { "from": "human", "value": "I used to be able to launch a locally installed helper application by registering a given mime-type in the Windows registry. This enabled me to allow users to be able to click once on a link to the current install of our internal browser application. This worked fine in Internet...
Is it currently possible to translate C# code into an Abstract Syntax Tree? Edit: some clarification; I don't necessarily expect the compiler to generate the AST for me - a parser would be fine, although I'd like to use something "official." Lambda expressions are unfortunately not going to be sufficient given they don...
Yes, it is possible to translate C# code into an Abstract Syntax Tree (AST). There are several libraries and tools available that can help you parse C# code and generate an AST representation. Here are a few options: 1. **Roslyn**: The .NET Compiler Platform, commonly known as Roslyn, is the most official way to work ...
21,270
[ { "from": "human", "value": "Is it currently possible to translate C# code into an Abstract Syntax Tree?\nEdit: some clarification; I don't necessarily expect the compiler to generate the AST for me - a parser would be fine, although I'd like to use something \"official.\" Lambda expressions are unfortunate...
After my form.Form validates the user input values I pass them to a separate (external) process for further processing. This external process can potentially find further errors in the values. Is there a way to inject these errors into the already validated form so they can be displayed via the usual form error display...
Injecting external errors into an already validated form can be a useful way to maintain user experience while ensuring that all potential issues with the input values are communicated effectively. Here’s a recommended approach to achieve this: ### Method: Augmenting Form Validation with External Errors 1. **Form Str...
17,349
[ { "from": "human", "value": "After my form.Form validates the user input values I pass them to a separate (external) process for further processing. This external process can potentially find further errors in the values.\nIs there a way to inject these errors into the already validated form so they can be ...
Is there any way to retrieve relevance values with results with the array returned by ThinkingSphinx? Percentages, points or whatever, just something I can work with?
Yes, you can retrieve relevance values with the results returned by Thinking Sphinx. When you perform a search using Thinking Sphinx, it provides you with an array of results, each containing a `:weight` key that represents the relevance score (or weight) of that particular result. Here’s how you can access the releva...
25,440
[ { "from": "human", "value": "Is there any way to retrieve relevance values with results with the array returned by ThinkingSphinx? \nPercentages, points or whatever, just something I can work with?\n" }, { "from": "gpt", "value": "Yes, you can retrieve relevance values with the results returned ...
Which is faster? someCondition has the same probability of being true as it has of being false. Insertion: arrayList = Array("apple", "pear","grape") if someCondition then ' insert "banana" element end if Deletion: arrayList = Array("apple","banana","pear","grape") if not someCondition then ' remove "banana" ...
In VB6, the speed of insertion and deletion operations in an array largely depends on the underlying mechanics of how arrays are managed in memory. Given your context and the provided scenario, let's clarify the performance aspects of both operations: ### Insertion vs. Deletion 1. **Insertion**: - Inserting an ele...
19,375
[ { "from": "human", "value": "Which is faster? someCondition has the same probability of being true as it has of being false.\nInsertion:\narrayList = Array(\"apple\", \"pear\",\"grape\")\nif someCondition then\n ' insert \"banana\" element\nend if\n\nDeletion:\narrayList = Array(\"apple\",\"banana\",\"p...
My C# class must be able to process a high volume of events received via a tcp stream style socket connection. The volume of event messages received from the tcp server by the class's socket is completely variable. For instance, sometimes it will only receive one event message in a period of ten seconds and at other ti...
To achieve the desired behavior of processing event messages in batches while ensuring they are processed sequentially, you can adopt a producer-consumer model. In this model, your class acts as a producer that adds incoming event messages to a queue and a single consumer that processes these messages in batches. Here'...
15,771
[ { "from": "human", "value": "My C# class must be able to process a high volume of events received via a tcp stream style socket connection. The volume of event messages received from the tcp server by the class's socket is completely variable. For instance, sometimes it will only receive one event message i...
I want to invert a 4x4 matrix. My numbers are stored in fixed-point format (1.15.16 to be exact). With floating-point arithmetic I usually just build the adjoint matrix and divide by the determinant (e.g. brute force the solution). That worked for me so far, but when dealing with fixed point numbers I get an unacceptab...
Inverting a matrix in fixed-point arithmetic can indeed be challenging due to precision loss during multiplication and division. Here are some approaches you might consider that help maintain numerical stability while working with fixed-point representations: ### 1. **LU Decomposition:** Using LU decomposition can pro...
21,564
[ { "from": "human", "value": "I want to invert a 4x4 matrix. My numbers are stored in fixed-point format (1.15.16 to be exact).\nWith floating-point arithmetic I usually just build the adjoint matrix and divide by the determinant (e.g. brute force the solution). That worked for me so far, but when dealing wi...
I have a class library with some extension methods written in C# and an old website written in VB. I want to call my extension methods from the VB code but they don't appear in intelisense and I get compile errors when I visit the site. I have got all the required Imports because other classes contained in the same nam...
The issue you're experiencing with using C# extension methods in VB.NET is a common one due to the way extension methods are implemented and utilized across different languages. Here are some steps and considerations to resolve the issue: ### 1. Extension Method Syntax in VB.NET In VB.NET, you cannot use the extension...
20,967
[ { "from": "human", "value": "I have a class library with some extension methods written in C# and an old website written in VB.\nI want to call my extension methods from the VB code but they don't appear in intelisense and I get compile errors when I visit the site.\nI have got all the required Imports beca...
I have this solution for a single button: myButton.Attributes.Add("onclick", "this.disabled=true;" + GetPostBackEventReference(myButton).ToString()); Which works pretty well for one button, any ideas on how to expand this to 2 buttons?
Certainly! To handle the disabling of two buttons with a single JavaScript function while ensuring that both buttons can still trigger their respective postbacks, you can modify your approach slightly. The main idea is to disable the clicked button and allow the other button to remain enabled. Here's a modified versio...
20,548
[ { "from": "human", "value": "I have this solution for a single button:\nmyButton.Attributes.Add(\"onclick\", \"this.disabled=true;\" + GetPostBackEventReference(myButton).ToString());\n\nWhich works pretty well for one button, any ideas on how to expand this to 2 buttons?\n" }, { "from": "gpt", ...
I'm thinking about trying out MVC later today for a new app we're starting up, but I'm curious if it's an all or nothing thing or if I can still party like it's 2006 with viewstate and other crutches at the same time...
MVC (Model-View-Controller) is a software architectural pattern that allows for a more organized and modular way to build applications. However, it does not require you to abandon all the older technologies or practices you're familiar with, such as ViewState. You can definitely mix and match the approaches, especially...
24,326
[ { "from": "human", "value": "I'm thinking about trying out MVC later today for a new app we're starting up, but I'm curious if it's an all or nothing thing or if I can still party like it's 2006 with viewstate and other crutches at the same time...\n" }, { "from": "gpt", "value": "MVC (Model-Vie...
Is there a way to write a BitmapEffect in 100% Managed Code? I know that it would run a lot slower than using unmanaged code, but I'd like to write a BitmapEffect but its been a long time since I've done any C++ programing, plus the application might have to run in partial trust (so unmanaged code won't be permissible)...
In WPF, `BitmapEffect` is a class that was used for applying bitmap effects to visual elements. However, it's important to note that `BitmapEffect` has been deprecated since .NET Framework 3.5 and is not recommended for use in newer applications. Instead, you may want to consider using `Effect`, which leverages pixel s...
17,975
[ { "from": "human", "value": "Is there a way to write a BitmapEffect in 100% Managed Code? I know that it would run a lot slower than using unmanaged code, but I'd like to write a BitmapEffect but its been a long time since I've done any C++ programing, plus the application might have to run in partial trust...
What are metaclasses? What are they used for?
Metaclasses in Python are a somewhat advanced concept that allows developers to customize class creation. In Python, everything is an object, including classes themselves. A metaclass is essentially a class of a class that defines how a class behaves. In other words, while classes define the structure and behavior of o...
16,566
[ { "from": "human", "value": "What are metaclasses? What are they used for?\n" }, { "from": "gpt", "value": "Metaclasses in Python are a somewhat advanced concept that allows developers to customize class creation. In Python, everything is an object, including classes themselves. A metaclass is e...
My singleton accessor method is usually some variant of: static MyClass *gInstance = NULL; + (MyClass *)instance { @synchronized(self) { if (gInstance == NULL) gInstance = [[self alloc] init]; } return(gInstance); } What could I be doing to improve this?
Your singleton accessor method is a good starting point, but there are a few improvements that can enhance its safety and performance, particularly in a multithreaded environment. Here are some recommendations: 1. **Thread-Safe Initialization**: Your current implementation uses a synchronized block, which is a step in...
23,224
[ { "from": "human", "value": "My singleton accessor method is usually some variant of:\nstatic MyClass *gInstance = NULL;\n\n+ (MyClass *)instance\n{\n @synchronized(self)\n {\n if (gInstance == NULL)\n gInstance = [[self alloc] init];\n }\n\n return(gInstance);\n}\n\nWhat could...
Does anyone have code to do this?
Sure! However, I'll need a bit more context to provide you with the code you need. Could you please specify what you are trying to accomplish? Whether it's a specific programming task, a type of algorithm, or anything else, just let me know!
27,169
[ { "from": "human", "value": "Does anyone have code to do this?\n" }, { "from": "gpt", "value": "Sure! However, I'll need a bit more context to provide you with the code you need. Could you please specify what you are trying to accomplish? Whether it's a specific programming task, a type of algor...
Which is better (for the user, for longevity, for performance, for whatever) to have: http://{site}/{login} e.g. http://wildobs.com/adam_jack or http://{site}/user/{login} Pros of former: User feels more special. URLs are shorter. Cons of former: Cannot have users w/ logins matching keywords, and keywords likely gro...
When considering URL structures for user profiles, both options have their merits and drawbacks. Here’s a deeper look at both, focusing on the pros and cons you mentioned, as well as some additional considerations that may affect longevity, user experience, and SEO. ### Option 1: `http://{site}/{login}` **Pros:** 1. ...
21,399
[ { "from": "human", "value": "Which is better (for the user, for longevity, for performance, for whatever) to have:\nhttp://{site}/{login} e.g. http://wildobs.com/adam_jack\nor\nhttp://{site}/user/{login}\nPros of former:\n\nUser feels more special.\nURLs are shorter.\n\nCons of former:\n\nCannot have users ...
I have a table of items, each of which has a date associated with it. If I have the date associated with one item, how do I query the database with SQL to get the 'previous' and 'subsequent' items in the table? It is not possible to simply add (or subtract) a value, as the dates do not have a regular gap between them. ...
To achieve the desired outcomes for both cases, you can use SQL queries with the appropriate logic to handle the relationships between the dates and their associated keys. Below, I'll provide SQL queries for each of the specified scenarios. ### 1. Unique Dates Case #### Given Sample Data ``` Table: Items +------+ | D...
19,717
[ { "from": "human", "value": "I have a table of items, each of which has a date associated with it. If I have the date associated with one item, how do I query the database with SQL to get the 'previous' and 'subsequent' items in the table?\nIt is not possible to simply add (or subtract) a value, as the date...
I would like to declare a dropdown box in a view in an ASP.NET MVC application, for letting the user select a lookup value. I know how to declare plain text boxes but is there an official helper for declaring dropdown boxes (date time pickers and the rest)?. I also don't know what structure I should pass to my view for...
In ASP.NET MVC, you can use the `Html.DropDownListFor` helper to create dropdown boxes (also referred to as select lists) in your views. Below, I will guide you through the entire process of creating a dropdown box in a view, passing data to it, and sending the selected value back to the controller. ### 1. Model Prepa...
19,182
[ { "from": "human", "value": "I would like to declare a dropdown box in a view in an ASP.NET MVC application, for letting the user select a lookup value. I know how to declare plain text boxes but is there an official helper for declaring dropdown boxes (date time pickers and the rest)?.\nI also don't know w...
I'm working on what I think is a pretty standard django site, but am having trouble getting my admin section to display the proper fields. Here's my models.py: class Tech(models.Model): name = models.CharField(max_length = 30) class Project(models.Model): title = models.CharField(max_length = 50) techs = m...
It looks like you are attempting to set up a Many-to-Many relationship in Django's admin interface, but there are some misunderstandings in your `admin.py` configuration and the way Many-to-Many fields are handled in Django. Here's how to properly configure your admin for the `Project` model to include the `Tech` obje...
21,249
[ { "from": "human", "value": "I'm working on what I think is a pretty standard django site, but am having trouble getting my admin section to display the proper fields.\nHere's my models.py:\nclass Tech(models.Model):\n name = models.CharField(max_length = 30)\n\nclass Project(models.Model):\n title = ...
My application hangs. Pressing the home button doesn't return to the springboard anymore. Additionally pressing the power button for 10 seconds doesn't turn the iphone off at all. Is there any way to force a shutdown?
If your iPhone is unresponsive and normal methods of restarting it aren't working, you can try performing a force restart. The method for force restarting depends on the model of your iPhone: ### For iPhone 8 and later: 1. Quickly press and release the **Volume Up** button. 2. Quickly press and release the **Volume Do...
22,678
[ { "from": "human", "value": "My application hangs. Pressing the home button doesn't return to the springboard anymore. Additionally pressing the power button for 10 seconds doesn't turn the iphone off at all.\nIs there any way to force a shutdown?\n" }, { "from": "gpt", "value": "If your iPhone ...
Is there a way to get rid of the selection rectangle when clicking a link which does not refresh the current page entirely?
Yes, there are ways to eliminate or style the selection rectangle (also known as the "focus outline") that appears when you click on a link or button without refreshing the page. The selection rectangle is primarily intended for accessibility, helping users know which element is focused. However, if you want to disable...
20,419
[ { "from": "human", "value": "Is there a way to get rid of the selection rectangle when clicking a link which does not refresh the current page entirely?\n" }, { "from": "gpt", "value": "Yes, there are ways to eliminate or style the selection rectangle (also known as the \"focus outline\") that a...
The usual method of URL-encoding a unicode character is to split it into 2 %HH codes. (\u4161 => %41%61) But, how is unicode distinguished when decoding? How do you know that %41%61 is \u4161 vs. \x41\x61 ("Aa")? Are 8-bit characters, that require encoding, preceded by %00? Or, is the point that unicode characters are ...
When dealing with URL encoding and Unicode, it's important to understand how encoding and decoding processes work, particularly in the context of URL percent-encoding. ### URL Encoding Basics 1. **Basic Encoding**: - ASCII characters (values 0-127) are typically represented directly in a URL. - Non-ASCII charac...
21,811
[ { "from": "human", "value": "The usual method of URL-encoding a unicode character is to split it into 2 %HH codes. (\\u4161 => %41%61)\nBut, how is unicode distinguished when decoding? How do you know that %41%61 is \\u4161 vs. \\x41\\x61 (\"Aa\")?\nAre 8-bit characters, that require encoding, preceded by %...
In PHP it is easy to pass parameter using $_GET[] and $_POST[]. Is there something like that in JavaScript? I hope I can pass parameters from addresses or forms.
Yes, in JavaScript, you can achieve similar functionality to PHP's `$_GET[]` and `$_POST[]` by using the built-in `URLSearchParams` interface for query parameters and the `FormData` object for form submissions. Let's look at both scenarios: ### 1. Passing Parameters via URL (Query Parameters) You can extract query pa...
22,419
[ { "from": "human", "value": "In PHP it is easy to pass parameter using $_GET[] and $_POST[]. Is there something like that in JavaScript? I hope I can pass parameters from addresses or forms.\n" }, { "from": "gpt", "value": "Yes, in JavaScript, you can achieve similar functionality to PHP's `$_GE...
I have some accesses from 192.168.0.71 on my apache logs. I looked up this IP (because my server almost exclusively takes requests from 127.0.0.1, and I saw that it's reserved for "special purposes." What types of purposes might those be? Edit: I didn't tell you, typing 192.168.0.71 brings me straight to my site, ju...
The IP addresses you've mentioned—127.0.0.1 and 192.168.0.71—serve different purposes within networking, even though both can result in accessing the same web server, depending on the server's configuration. ### 127.0.0.1 (Loopback Address) - **Purpose**: This IP address is known as the "loopback" address. It is used ...
22,028
[ { "from": "human", "value": "I have some accesses from 192.168.0.71 on my apache logs. I looked up this IP (because my server almost exclusively takes requests from 127.0.0.1, and I saw that it's reserved for \"special purposes.\" What types of purposes might those be?\n\nEdit:\nI didn't tell you, typing ...
I'm using @media print in my external css file to hide menus etc. However while printing the little triangle of a dropdownlist still shows. Is there a css setting available to hide it as well and only print the selected item?
To hide the dropdown arrow (the little triangle) in a `<select>` element while printing, you can use CSS to specifically target the `<select>` elements and their pseudo-elements. Unfortunately, some browsers have limited support for styling the dropdown arrow directly using CSS. However, you can still hide it by using ...
25,200
[ { "from": "human", "value": "I'm using @media print in my external css file to hide menus etc. However while printing the little triangle of a dropdownlist still shows. Is there a css setting available to hide it as well and only print the selected item?\n" }, { "from": "gpt", "value": "To hide ...
I've been trying to get up to speed on some of the newer features in C# and one of them that I haven't had occasion to use is anonymous types. I understand the usage as it pertains to LINQ queries and I looked at this SO post which asked a similar question. Most of the examples I've seen on the net are related to LINQ...
Absolutely! While anonymous types are often showcased in the context of LINQ, they can also provide utility in other scenarios. Here are some interesting and novel use cases for anonymous types: ### 1. Temporary Data Structures Anonymous types can be beneficial when you need a lightweight data structure for temporary ...
18,935
[ { "from": "human", "value": "I've been trying to get up to speed on some of the newer features in C# and one of them that I haven't had occasion to use is anonymous types.\nI understand the usage as it pertains to LINQ queries and I looked at this SO post which asked a similar question. Most of the example...
I have the following code in my Django application: if 'book' in authorForm.changed_data: #Do something here... I realize Django can tell me which values have changed in my form by utilizing the "changed_data" list object, but I'd like to know the new values of the fields that have changed. Any thoughts?
To get the new values of the fields that have changed in your Django form, you can access the `cleaned_data` dictionary of the form. The `cleaned_data` contains the validated data from the form, which includes the new values. You can modify your code to retrieve the new values of the changed fields as follows: ```pyt...
25,108
[ { "from": "human", "value": "I have the following code in my Django application:\nif 'book' in authorForm.changed_data:\n #Do something here...\n\nI realize Django can tell me which values have changed in my form by utilizing the \"changed_data\" list object, but I'd like to know the new values of the fie...
I changed the MembershipProvider in my ASP.net MVC website, and now the stylesheet for the login page isn't referenced correctly. Below is a copy of the forms tag in my web.config if that could be the reason. It looks identical though to the one generated by a new project with the exception of the name and timeout attr...
The issue you're facing is related to the path used to reference your CSS file. In ASP.NET MVC, the paths for resources can change based on the structure of your application and how the views are rendered. Specifically, when a request is made to a different URL (like your login page) that results in a different routing...
24,103
[ { "from": "human", "value": "I changed the MembershipProvider in my ASP.net MVC website, and now the stylesheet for the login page isn't referenced correctly. Below is a copy of the forms tag in my web.config if that could be the reason. It looks identical though to the one generated by a new project with t...
I have two iterators, a list and an itertools.count object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two: >>> import itertools >>> c = itertools.count(1) >>> items = ['foo', 'bar'] >>> merged = imerge(items, c) # the mythi...
You can achieve the alternating merge of the two iterators using the `itertools.chain` and `itertools.zip` functions in combination. You can create a custom iterator that alternates between values from both the list and the `itertools.count` object. Here's a concise way to implement `imerge`: ```python import itertool...
24,799
[ { "from": "human", "value": "I have two iterators, a list and an itertools.count object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:\n>>> import itertools\n>>> c = itertools.count(1)\n>>> items = ['foo', 'bar'...
What is the difference between overflow:hidden and display:none?
The properties `overflow: hidden` and `display: none` are both used in CSS, but they serve different purposes and affect the layout and visibility of elements in distinct ways. ### `overflow: hidden` - **Purpose**: This property is used to control the behavior of content that overflows an element's box. It will hide a...
24,145
[ { "from": "human", "value": "What is the difference between overflow:hidden and display:none?\n" }, { "from": "gpt", "value": "The properties `overflow: hidden` and `display: none` are both used in CSS, but they serve different purposes and affect the layout and visibility of elements in distinc...
Suppose the following configuration: Drive D ... Data, Drive E .... TempDB, Drive F ... Log. and suppose all drives are on separate spindles with respective drive controllers. Concerning performance; is the above configuration optimal, decent, or not advisable? With budgetary constraints in mind, can any of these DB's ...
The configuration you provided, with Drive D for data, Drive E for TempDB, and Drive F for log files, is a reasonable setup, especially since each drive is on a separate spindle with its own controller. Let's evaluate the performance aspects of this configuration: ### Performance Evaluation: 1. **Drive D (Data)**: ...
21,756
[ { "from": "human", "value": "Suppose the following configuration:\nDrive D ... Data, Drive E .... TempDB, Drive F ... Log.\nand suppose all drives are on separate spindles with respective drive controllers.\nConcerning performance; is the above configuration optimal, decent, or not advisable?\nWith budgetar...
I cureently have a set up like below Public ClassA property _classB as ClassB End Class Public ClassB property _someProperty as someProperty End Class what I want to do is to databind object A to a gridview with one of the columns being databound to ClassB._someProperty. When I try to databind it as Classb._...
It sounds like you're encountering a common issue when attempting to bind nested properties to a GridView in a .NET application. When you want to bind a property of an object that is nested within another object, you typically need to specify the property path correctly. In your case, you have `ClassA` containing a pro...
21,237
[ { "from": "human", "value": "I cureently have a set up like below \nPublic ClassA\n\nproperty _classB as ClassB\n\nEnd Class\n\nPublic ClassB\n\nproperty _someProperty as someProperty \n\nEnd Class\n\nwhat I want to do is to databind object A to a gridview with one of the columns being databound to Class...
I added a project to an existing solution that is currently under source control using TFS, but for some reason I cannot check in the new project. When I view my pending changes, none of the files in the new project show up. None of the files have a plus (for a new file) next to them. What did I do wrong? How do I ...
It sounds like the new project you added to your existing solution in TFS (Team Foundation Server) has not been properly included in source control, which is why you cannot see the pending changes related to those files. Here are a few steps you can follow to resolve this issue: 1. **Check the Source Control Bindings*...
23,644
[ { "from": "human", "value": "I added a project to an existing solution that is currently under source control using TFS, but for some reason I cannot check in the new project. When I view my pending changes, none of the files in the new project show up. None of the files have a plus (for a new file) next ...
Let's say that I have a widget that displays summary information about how many posts or comments that I have on a site. What's the cleanest way to persist this information across controllers? Including the instance variables in the application controller seems like a bad idea. Having a before filter that loads the da...
To persist and share widget information like post and comment counts across different controllers in a Rails application without code duplication or overusing instance variables, you have a few cleaner options than introducing a plugin like Cells. Here are some approaches you might consider: ### 1. **Application Helpe...
17,821
[ { "from": "human", "value": "Let's say that I have a widget that displays summary information about how many posts or comments that I have on a site.\nWhat's the cleanest way to persist this information across controllers? \nIncluding the instance variables in the application controller seems like a bad ide...
I have a rather big number of source files that I need parse and extract all string literals and put them in a file as play old java constant. For exemple: Label l = new Label("Cat"); Would become: Label l = new Label(Constants.CAT); And in Constants.java I would have: public final static String CAT = "Cat"; I do no...
While many IDEs provide various refactoring tools and features for working with Java code, there might not be a built-in feature that precisely automates the task you're describing. However, you can achieve this goal through a combination of using existing IDE features, custom scripts, or tools specifically designed fo...
18,046
[ { "from": "human", "value": "I have a rather big number of source files that I need parse and extract all string literals and put them in a file as play old java constant.\nFor exemple:\nLabel l = new Label(\"Cat\");\n\nWould become:\nLabel l = new Label(Constants.CAT);\n\nAnd in Constants.java I would have...
Thanks a million everyone for everyone's response. Unfortunately, none of the solutions appear to be working on my end, and my guess is that the example I've provided is messed up. So let me try again. My table looks like this: contract project activity row1 1000 8000 10 row2 1000 8000 20 row3...
To achieve your goal of finding contracts that have only one unique activity value, you can use a SQL query that groups the data by the `contract` and counts the distinct `activity` values. Here's how you can write that query: ```sql SELECT contract, activity FROM your_table_name GROUP BY contract, activity HAVING COU...
24,985
[ { "from": "human", "value": "Thanks a million everyone for everyone's response. Unfortunately, none of the solutions appear to be working on my end, and my guess is that the example I've provided is messed up.\nSo let me try again.\nMy table looks like this:\n contract project activity\nrow1 1000 ...
I've heard people talking about "base 64 encoding" here and there. What is it used for?
Base64 encoding is a method for converting binary data into a text format that can be easily transmitted or stored in environments that are designed to handle textual data. It is commonly used for several purposes: 1. **Data Transmission**: Base64 is often used in email (MIME) to encode binary attachments, ensuring th...
25,525
[ { "from": "human", "value": "I've heard people talking about \"base 64 encoding\" here and there. What is it used for?\n" }, { "from": "gpt", "value": "Base64 encoding is a method for converting binary data into a text format that can be easily transmitted or stored in environments that are des...
I have a section of makefile that has this sort of structure: bob: ifdef DEBUG @echo running endif @echo chug chug chug ifdef DEBUG @echo done endif bobit: @echo "before" @make bob @echo "after" I'm simplifying greatly here, all the echo's are actually non trivial blocks of commands and t...
To achieve the desired behavior in a Makefile, especially when it comes to reusing a block of code with conditionals, you need to use the `define` directive in a way that allows you to evaluate the content dynamically. Using `eval` and `call` is indeed the right approach. Here's how you can structure your Makefile to ...
22,452
[ { "from": "human", "value": "I have a section of makefile that has this sort of structure:\n\nbob:\nifdef DEBUG\n @echo running\nendif\n @echo chug chug chug\nifdef DEBUG\n @echo done\nendif \n\nbobit:\n @echo \"before\"\n @make bob\n @echo \"after\"\n\nI'm simplifying greatly here, all...
I need to build a simple HTTP server in C. Any guidance? Links? Samples?
Certainly! Building a simple HTTP server in C can be a fun project. Below, I’ll provide a basic example and some key concepts to help you understand how to create an HTTP server in C. ### Basic Concepts 1. **Socket Programming**: You'll need to use the socket API to create a socket, bind it to a port, listen for inco...
18,964
[ { "from": "human", "value": "I need to build a simple HTTP server in C. Any guidance? Links? Samples?\n" }, { "from": "gpt", "value": "Certainly! Building a simple HTTP server in C can be a fun project. Below, I’ll provide a basic example and some key concepts to help you understand how to creat...
I have defined tomcat:catalina:5.5.23 as a dependency to the cargo plugin, however I still get the following exception: java.lang.ClassNotFoundException: org.apache.catalina.Connector at java.net.URLClassLoader$1.run(URLClassLoader.java:200) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLC...
The `ClassNotFoundException` you are experiencing indicates that the class `org.apache.catalina.Connector`, which is part of the Tomcat API, is not available on the classpath when the Cargo plugin is trying to load it. This can occur for several reasons when configuring an embedded Tomcat server with the Cargo plugin. ...
21,874
[ { "from": "human", "value": "I have defined tomcat:catalina:5.5.23 as a dependency to the cargo plugin, however I still get the following exception:\njava.lang.ClassNotFoundException: org.apache.catalina.Connector\nat java.net.URLClassLoader$1.run(URLClassLoader.java:200)\nat java.security.AccessController....
I am getting a very non specific error when trying to connect to SQL server on remote server. I feel like I have made all the correct settings, allow TCP/IP, restarted the service, added rights to NT AUTHORITY\NETWORK SERVICE and other related users for the database. I can get to the aspx page, but as soon as I hit sub...
The error you're encountering indicates that your application is unable to establish a connection to the SQL Server database. This can be caused by a variety of issues. Here are some troubleshooting steps you can follow to help identify and resolve the problem: 1. **Check SQL Server Services**: - Ensure that the SQ...
23,684
[ { "from": "human", "value": "I am getting a very non specific error when trying to connect to SQL server on remote server. I feel like I have made all the correct settings, allow TCP/IP, restarted the service, added rights to NT AUTHORITY\\NETWORK SERVICE and other related users for the database. I can get ...
Many developers will claim that moving from one programming language to another is relatively simple especially if the languages are based on similar paradigms. However, in practice the effort comes not from learning the syntax of the language but in developing a deep understanding of the language nuances and more impo...
When developers switch from one programming language to another, the overheads they face can be categorized into several key areas, regardless of whether the languages are within the same paradigm or from different paradigms. Here’s a breakdown of those challenges: ### Overheads in Moving Between Languages in the Same...
20,156
[ { "from": "human", "value": "Many developers will claim that moving from one programming language to another is relatively simple especially if the languages are based on similar paradigms. However, in practice the effort comes not from learning the syntax of the language but in developing a deep understand...
I know it is easy to recommend several cross platform libraries. However, are there benefits to treating each platform individually for your product? Yes there will be some base libraries used in all platforms, but UI and some other things would be different on each platform. I have no restriction that the product mu...
Treating each platform individually can indeed have several benefits, especially when it comes to delivering a product that feels native to each operating system. Here are some key advantages to consider: ### 1. **Native User Experience** - **Consistency with Platform Guidelines**: Each operating system has its own...
19,746
[ { "from": "human", "value": "I know it is easy to recommend several cross platform libraries. \nHowever, are there benefits to treating each platform individually for your product? \nYes there will be some base libraries used in all platforms, but UI and some other things would be different on each platform...
I'm trying to assign application pool to one web site in IIS7 using vb script: ' Connect to the WMI WebAdministration namespace.' Set oWebAdmin = GetObject("winmgmts:root\WebAdministration") ' Retrieve the application and display its Web site name and path.' Set oApp = oWebAdmin.Get("Application.SiteName='Default Web ...
Assigning an application pool to a website in IIS using VBScript can be tricky, especially with the specifics of how to access the WMI or the `WebAdministration` namespace. However, using the right syntax and making sure you are properly accessing the objects is crucial. To change the application pool of a website, y...
24,440
[ { "from": "human", "value": "I'm trying to assign application pool to one web site in IIS7 using vb script:\n' Connect to the WMI WebAdministration namespace.'\nSet oWebAdmin = GetObject(\"winmgmts:root\\WebAdministration\")\n\n' Retrieve the application and display its Web site name and path.'\nSet oApp = ...
I have a web application where users enter arbitrary sql queries for later batch processing. We want to validate the syntax of the query without actually executing it. Some of the queries will take a long time, which is why we don't want to execute them. I'm using Oracle's dbms_sql.parse to do this. However, I now have...
In Oracle, while you can use `DBMS_SQL.PARSE` to validate the syntax of a query without executing it, to retrieve the result set's metadata (i.e., the number and type of the result columns), you'll need to perform an additional step that usually involves executing the statement to obtain the metadata. However, since y...
22,289
[ { "from": "human", "value": "I have a web application where users enter arbitrary sql queries for later batch processing. We want to validate the syntax of the query without actually executing it. Some of the queries will take a long time, which is why we don't want to execute them. I'm using Oracle's dbms_...
C# .NET 3.5. I'm trying to understand the intrinsic limitation of the C# Action object. Within the lamda (are those, in fact, lamdas?), we can perform assignments, call functions, even execute a ternary operation, but we can't execute a multi-statement operation. Is this because the single-statement execution is just...
It looks like you've already identified the issue you encountered with the C# `Action` delegate and lambda expressions. To summarize and clarify your findings: 1. **Lambda Expressions**: The code snippets you provided use lambda expressions, which are a feature in C# that allows you to write inline expressions and del...
23,507
[ { "from": "human", "value": "C# .NET 3.5. I'm trying to understand the intrinsic limitation of the C# Action object. Within the lamda (are those, in fact, lamdas?), we can perform assignments, call functions, even execute a ternary operation, but we can't execute a multi-statement operation.\nIs this beca...
I have a WPF project defined like this: MyApp.sln MyAppWPF MyApp.Domain In one of my xaml files in the MyAppWPF project I'm trying to reference a class defined in MyApp.Domain project. I have a project reference in MyAppWPF to MyApp.Domain. I am trying to create the reference like this: <Window x:Class="MyAppW...
In WPF, when you want to reference a class from another project, your `xmlns` declaration in the XAML file needs to be set up correctly. Since you've confirmed that you can instantiate the class in the code-behind, the issue might be related to how the namespace is defined in the XAML. ### Check the Namespace Declarat...
21,802
[ { "from": "human", "value": "I have a WPF project defined like this:\n\nMyApp.sln\n MyAppWPF\n MyApp.Domain\n\nIn one of my xaml files in the MyAppWPF project I'm trying to reference a class defined in MyApp.Domain project. I have a project reference in MyAppWPF to MyApp.Domain. I am trying to create th...
I have built a complex query mechanism which I want to provide a factory for in order to assist people with common query patterns. My methods are all revealed via WCF as a SOAP web service. What is the best way to ensure that my factory is easy to use across all clients that may wish to use my service (as I don't expec...
Creating a factory for common query patterns in your WCF SOAP web service is an excellent idea to enhance usability for clients, especially when considering a diverse range of technologies that might consume your service. Here’s a structured approach to help you design this factory while considering ease of use and cro...
18,181
[ { "from": "human", "value": "I have built a complex query mechanism which I want to provide a factory for in order to assist people with common query patterns. My methods are all revealed via WCF as a SOAP web service. What is the best way to ensure that my factory is easy to use across all clients that may...
I'm working on a client site who is using Umbraco as a CMS. I need to create a custom 404 error page. I've tried doing it in the IIS config but umbraco overrides that. Does anyone know how to create a custom 404 error page in Umbraco? Is there a way to create a custom error page for runtime errors?
Creating a custom 404 error page in Umbraco can be accomplished by following a few steps. While you initially tried setting it up in IIS, Umbraco does handle routing itself, which is why the configuration may have been overridden. Here’s how to set it up correctly in Umbraco: ### Creating a Custom 404 Error Page 1. *...
17,777
[ { "from": "human", "value": "I'm working on a client site who is using Umbraco as a CMS. I need to create a custom 404 error page. I've tried doing it in the IIS config but umbraco overrides that. \nDoes anyone know how to create a custom 404 error page in Umbraco?\nIs there a way to create a custom error p...
How can I convert an Int64 to an Int32 type in F# without using the Microsoft.FSharp.Compatibility.Int32.of_int64? I'm doing this because interactive doesn't seem to work when I try: open Microsoft.FSharp.Compatibility With FSharp.PowerPack added as a reference it says: error FS0039: The namespace 'Compatibility' is...
In F#, you can convert an `Int64` (also known as `int64`) to an `Int32` (`int`) without using the `Microsoft.FSharp.Compatibility.Int32.of_int64` function. You can do this using the built-in conversion functions provided by the .NET Framework. Here’s how you can achieve this: ### Using Direct Cast with `int` You can ...
24,083
[ { "from": "human", "value": "How can I convert an Int64 to an Int32 type in F# without using the Microsoft.FSharp.Compatibility.Int32.of_int64?\nI'm doing this because interactive doesn't seem to work when I try:\nopen Microsoft.FSharp.Compatibility\n\nWith FSharp.PowerPack added as a reference it says: \n\...
Warning: Java newbie. Been looking at XUI for Java. Its looks quite interesting. Sort of liek a WPF way of designing interfaces. But googling around I don't see much other than articles saying it had been released. So is it used much or a bit niche? Are there other similar frameworks for Java? Was looking at JavaFX bu...
It's great that you're exploring UI frameworks in Java! You're correct in noting that there are numerous frameworks available, which can indeed be overwhelming, especially for a newcomer. Here's a breakdown of some options, including XUI, along with some context on their usage and characteristics. ### XUI XUI is a rel...
18,809
[ { "from": "human", "value": "Warning: Java newbie. \nBeen looking at XUI for Java. Its looks quite interesting. Sort of liek a WPF way of designing interfaces. But googling around I don't see much other than articles saying it had been released. So is it used much or a bit niche?\nAre there other similar fr...
We have a web service that is deployed on 2 separate machines in different locations. Is it possible to monitor the url that a person used to call our webservice using java code? We have a 3DNS url set up and we want all clients to use this url as oppossed hitting the boxes directly with the correct port numbers in the...
Yes, it is possible to monitor the URLs that clients use to call your web service in Java. There are several approaches you can take to achieve this, depending on the web framework you are using (e.g., Spring, JAX-RS, Servlet API) and the specifics of your application architecture. Below are some general methods you ca...
18,030
[ { "from": "human", "value": "We have a web service that is deployed on 2 separate machines in different locations. Is it possible to monitor the url that a person used to call our webservice using java code? We have a 3DNS url set up and we want all clients to use this url as oppossed hitting the boxes dire...
Say you have a large PHP project and suddenly, when attempting to run it, you just end up with a blank page. The script terminates and you want to find exactly where that is with as little effort as possible. Is there a tool/program/command/IDE that can, on PHP script termination, tell you the location of a script exit...
When dealing with a blank page in a PHP project, the typical issue is a fatal error or an uncaught exception. To diagnose the problem efficiently, there are a few strategies and tools that you can use: ### 1. **Error Reporting**: Make sure that error reporting is turned on. This will help you see any errors that are b...
21,954
[ { "from": "human", "value": "Say you have a large PHP project and suddenly, when attempting to run it, you just end up with a blank page. The script terminates and you want to find exactly where that is with as little effort as possible.\nIs there a tool/program/command/IDE that can, on PHP script terminati...
Suppose I have a bunch of varchar(6000) fields in a table and want to change those to text fields. What are the ramifications of the stored procedures whose arguments are of type varchar(6000). Does each stored procedure also need those argument data types changed?
Yes, if you change the column types from `varchar(6000)` to `text`, it is important to consider how this change affects any stored procedures that use those columns as parameters. Here are the key points to keep in mind: 1. **Parameter Type Changes**: If your stored procedures have parameters defined as `varchar(6000)...
24,702
[ { "from": "human", "value": "Suppose I have a bunch of varchar(6000) fields in a table and want to change those to text fields. What are the ramifications of the stored procedures whose arguments are of type varchar(6000). Does each stored procedure also need those argument data types changed?\n" }, {...
Is it possible to define a class in C# such that class GenericCollection<T> : SomeBaseCollection<T> where T : Delegate I couldn't for the life of me accomplish this last night in .NET 3.5. I tried using delegate, Delegate, Action<T> and Func<T, T> It seems to me that this should be allowable in some way. I'm trying to...
In C#, you cannot directly constrain a generic type parameter to `Delegate` or a derived type of `Delegate`. The generic type constraints in C# are limited to certain types: class, struct, new(), base class types, interfaces, and types with a default constructor. Unfortunately, `Delegate` is not one of those types that...
23,678
[ { "from": "human", "value": "Is it possible to define a class in C# such that\nclass GenericCollection<T> : SomeBaseCollection<T> where T : Delegate\n\nI couldn't for the life of me accomplish this last night in .NET 3.5. I tried using\ndelegate, Delegate, Action<T> and Func<T, T>\nIt seems to me that this ...
I want to read all items of a feed in C#. The solutions I've found are only for the latest items like just the last 10 days. Anybody has a good solution for this?
To read all items from an RSS feed in C#, you can use the `System.ServiceModel.Syndication` namespace, which is part of the .NET Framework. This allows you to retrieve and process RSS or Atom feeds effectively. Here’s a simple example demonstrating how to read all items from an RSS feed: 1. **Add a reference to the n...
22,180
[ { "from": "human", "value": "I want to read all items of a feed in C#. The solutions I've found are only for the latest items like just the last 10 days.\nAnybody has a good solution for this? \n" }, { "from": "gpt", "value": "To read all items from an RSS feed in C#, you can use the `System.Ser...
I'm personally an advocate of the ternary operator: () ? : I do realize that it has its place, but I have come across many programmers that are completely against ever using it, and some that use it too often. What are your feelings on it? What interesting code have you seen using it?
The ternary operator (`condition ? valueIfTrue : valueIfFalse`) is a useful tool in programming for expressing simple conditional logic in a concise manner. It can enhance readability when used appropriately, especially for simple conditions. However, overuse or misuse can lead to code that is difficult to read and und...
22,719
[ { "from": "human", "value": "I'm personally an advocate of the ternary operator: () ? : \nI do realize that it has its place, but I have come across many programmers that are completely against ever using it, and some that use it too often.\nWhat are your feelings on it? What interesting code have you seen...
This might be a similar problem to my earlier two questions - see here and here but I'm trying to use the _detail command to automatically click the link so I can scrape the details page for each individual event. The code I'm using is: require 'rubygems' require 'scrubyt' nuffield_data = Scrubyt::Extractor.define do ...
It looks like you're trying to use Scrubyt to scrape event details from the Nuffield Theatre website, but you're running into an issue where the URLs you're trying to access for the event details may be relative links, which could result in a 404 error when accessed directly. ### Addressing the Relative Links 1. **Co...
20,413
[ { "from": "human", "value": "This might be a similar problem to my earlier two questions - see here and here but I'm trying to use the _detail command to automatically click the link so I can scrape the details page for each individual event.\nThe code I'm using is:\nrequire 'rubygems'\nrequire 'scrubyt'\n\...
I've read some of the recent language vs. language questions with interest... Perl vs. Python, Python vs. Java, Can one language be better than another? One thing I've noticed is that a lot of us have very superficial reasons for disliking languages. We notice these things at first glance and they turn us off. We shu...
It's always interesting to hear people's experiences with different programming languages and the biases they may initially have. Here are some of my language hangups and superficial features that have bothered me, along with how I’ve gotten over them: ### Swift: When I first encountered Swift, the abundance of syntac...
22,239
[ { "from": "human", "value": "I've read some of the recent language vs. language questions with interest... Perl vs. Python, Python vs. Java, Can one language be better than another?\nOne thing I've noticed is that a lot of us have very superficial reasons for disliking languages. We notice these things at ...
I have never quite understood how/why I would use Maven modules (reactor builds). We have tens of libraries that we share (as dependencies) among our products, and between libraries as well. If we were to switch to making them Maven modules, how would we set it up, both in SVN and in our working copies? Do Maven modul...
Understanding how to effectively use Maven modules (also known as reactor builds) can help improve your project structure, dependency management, and build process. Here’s a breakdown of what you need to know about setting up Maven modules, their organization, and their relationship with your version control system (SV...
19,365
[ { "from": "human", "value": "I have never quite understood how/why I would use Maven modules (reactor builds).\nWe have tens of libraries that we share (as dependencies) among our products, and between libraries as well. If we were to switch to making them Maven modules, how would we set it up, both in SVN...
Lately I've been using XPathDocument and XNavigator to parse an XML file for a given XPath and attribute. It's been working very well, when I know in advance what the XPath is. Sometimes though, the XPath will be one of several possible XPath values, and I'd like to be able to test whether or not a given XPath exists....
To check whether an XPath exists without encountering exceptions, you can simply check if the result of `SelectSingleNode` is `null`. This is the standard approach when dealing with `XPathNavigator`. If the XPath doesn't match any nodes in the XML, `SelectSingleNode` will return `null`, which you can use to determine w...
25,533
[ { "from": "human", "value": "Lately I've been using XPathDocument and XNavigator to parse an XML file for a given XPath and attribute. It's been working very well, when I know in advance what the XPath is. \nSometimes though, the XPath will be one of several possible XPath values, and I'd like to be able to...
I have a Visual Studio 2005 solution that includes a setup project. The setup project specifies "d:\somefolder" as the Application Folder DefaultLocation property. When installing on a machine without any partitions mapped to "d:", the resulting installer craps out with the message "The volume d:\ is currently unava...
To allow users to change the installation path while keeping the default location set to `d:\somefolder`, you can adjust the properties of your setup project in Visual Studio 2005. Here’s how to do it: 1. **Open your Setup Project**: Open the solution containing your setup project in Visual Studio 2005. 2. **Access t...
22,698
[ { "from": "human", "value": "I have a Visual Studio 2005 solution that includes a setup project. The setup project specifies \"d:\\somefolder\" as the Application Folder DefaultLocation property. When installing on a machine without any partitions mapped to \"d:\", the resulting installer craps out with th...
I need a way to bind POJO objects to an external entity, that could be XML, YAML, structured text or anything easy to write and maintain in order to create Mock data for unit testing and TDD. Below are some libraries I tried, but the main problems with them were that I am stuck (for at least more 3 months) to Java 1.4....
Given the constraints of using Java 1.4 and the need for a library that allows binding of POJO (Plain Old Java Object) classes to external data formats like XML or YAML with low overhead and minimal setup, here are some potential solutions you could consider: ### 1. Simple XML Parser You can use a simple XML parser l...
20,282
[ { "from": "human", "value": "I need a way to bind POJO objects to an external entity, that could be XML, YAML, structured text or anything easy to write and maintain in order to create Mock data for unit testing and TDD. Below are some libraries I tried, but the main problems with them were that I am stuck ...