instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I've been playing around with the ASP.NET MVC Framework and the one thing that's really confusing me is how I'm meant to do server side validation of posted form data. I presume I don't post back to the same URL, but if I don't, how do I redisplay the form with the entered data and error messages? Also, where should ...
Server-side validation in ASP.NET MVC can be approached in a systematic way, and understanding how to handle it will help clarify the process for you. Here's a breakdown of how to manage server-side validation for posted form data in an MVC application. ### 1. Posting Back to the Same URL In ASP.NET MVC, it's common ...
5,123
[ { "from": "human", "value": "I've been playing around with the ASP.NET MVC Framework and the one thing that's really confusing me is how I'm meant to do server side validation of posted form data. I presume I don't post back to the same URL, but if I don't, how do I redisplay the form with the entered data...
I've got a menu that contains, among other things, some most-recently-used file paths. The paths to these files can be long, so the text sometimes gets clipped like "C:\Progra...\foo.txt" I'd like to pop a tooltip with the full path when the user hovers over the item, but this doesn't seem possible with the Tooltip cl...
In .NET 2.0, the `Tooltip` class has limited capabilities, particularly regarding displaying tooltips for controls in certain scenarios. However, you can still achieve the desired tooltip behavior for your menu items, such as displaying full file paths, by following a few steps. Here’s a general approach you can use: ...
4,773
[ { "from": "human", "value": "I've got a menu that contains, among other things, some most-recently-used file paths. The paths to these files can be long, so the text sometimes gets clipped like \"C:\\Progra...\\foo.txt\"\nI'd like to pop a tooltip with the full path when the user hovers over the item, but ...
I'm having trouble connecting (via the Socket and XMLSocket classes) to a TCP listener after a connect timeout. I have a flash applet that needs to maintain a TCP connection to a server. I have implemented timeouts using Timers, a ping-pong system, etc. However, there's a problem. Upon calling Socket.connect(), the fla...
It sounds like you’re facing a frustrating issue with the Flash Socket and XMLSocket classes, particularly with connection handling after a failed attempt. The behavior you’re describing—where subsequent connect attempts to the same host and port are ignored after a timeout—can indeed be problematic. Here are a few str...
5,589
[ { "from": "human", "value": "I'm having trouble connecting (via the Socket and XMLSocket classes) to a TCP listener after a connect timeout.\nI have a flash applet that needs to maintain a TCP connection to a server. I have implemented timeouts using Timers, a ping-pong system, etc. However, there's a probl...
We are using VS 2008 Team System with the automated test suite, and upon running tests the test host "randomly" locks up. I actually have to kill the VSTestHost process and re-run the tests to get something to happen, otherwise all tests sit in a "pending" state. Has anyone experience similar behavior and know of a fix...
The issue you are experiencing with Visual Studio 2008 Team System and the VSTestHost process hanging can be frustrating. There are a few common troubleshooting steps and potential solutions that may help resolve this issue: ### 1. **Update Visual Studio**: Ensure that you have all the latest updates and patches for ...
4,492
[ { "from": "human", "value": "We are using VS 2008 Team System with the automated test suite, and upon running tests the test host \"randomly\" locks up. I actually have to kill the VSTestHost process and re-run the tests to get something to happen, otherwise all tests sit in a \"pending\" state.\nHas anyone...
If one wants to paginate results from a data source that supports pagination we have to go to a process of: defining the page size - that is the number of results to show per page; fetch each page requested by the user using an offset = page number (0 based) * page size show the results of the fetched page. All this ...
Yes, the issue you've identified is a common challenge in pagination when the underlying data can change while a user is navigating through the pages. Here are some practical solutions to help mitigate this problem: ### 1. **Versioning or Snapshotting** - **Description**: When a user starts paginating, take a "snap...
4,299
[ { "from": "human", "value": "If one wants to paginate results from a data source that supports pagination we have to go to a process of:\n\ndefining the page size - that is the number of results to show per page;\nfetch each page requested by the user using an offset = page number (0 based) * page size\nsho...
Reading over the responses to this question Disadvantages of Test Driven Development? I got the impression there is alot of misunderstanding on what TDD is and how it should be conducted. It may prove useful to address these issues here.
Certainly! Test Driven Development (TDD) is a software development process that emphasizes writing tests before writing the corresponding production code. While TDD has numerous advantages, it also has its share of disadvantages and misconceptions. Let’s address some common misunderstandings about TDD and then outline ...
6,103
[ { "from": "human", "value": "Reading over the responses to this question Disadvantages of Test Driven Development? I got the impression there is alot of misunderstanding on what TDD is and how it should be conducted. It may prove useful to address these issues here.\n" }, { "from": "gpt", "value...
I have a custom (code-based) workflow, deployed in WSS via features in a .wsp file. The workflow is configured with a custom task content type (ie, the Workflow element contains a TaskListContentTypeId attribute). This content type's declaration contains a FormUrls element pointing to a custom task edit page. When the...
The exception you're encountering with the error message "Invalid field name" and the reference to the `FormURN` site column typically arises when the workflow engine tries to create a task item based on the custom task content type you've defined. The fact that the exception refers to `FormURN` suggests that the workf...
4,204
[ { "from": "human", "value": "I have a custom (code-based) workflow, deployed in WSS via features in a .wsp file. The workflow is configured with a custom task content type (ie, the Workflow element contains a TaskListContentTypeId attribute). This content type's declaration contains a FormUrls element poin...
Google Maps used to do this bit where when you hit the "Print" link, what would be sent to the printer wasn't exactly what you had on the screen, but rather a differently-formatted version of mostly the same information. It appears that they've largely moved away from this concept (I guess people didn't understand it) ...
Creating a printer-friendly version of a webpage without needing a separate page can be accomplished using CSS media queries. The idea is to define styles specifically for the print media type so that when the user hits "Print," the browser applies those styles, resulting in a cleaner, more readable version of the cont...
4,594
[ { "from": "human", "value": "Google Maps used to do this bit where when you hit the \"Print\" link, what would be sent to the printer wasn't exactly what you had on the screen, but rather a differently-formatted version of mostly the same information.\nIt appears that they've largely moved away from this co...
I am trying to validate the WPF form against an object. The validation fires when I type something in the textbox lose focus come back to the textbox and then erase whatever I have written. But if I just load the WPF application and tab off the textbox without writing and erasing anything from the textbox, then it is n...
The issue you are encountering is related to how the WPF data binding and validation work, specifically with the timing of updates and the firing of validation rules. When using `IDataErrorInfo`, the validation is invoked when the property changes, and for that to happen correctly, the property needs to notify the bind...
8,292
[ { "from": "human", "value": "I am trying to validate the WPF form against an object. The validation fires when I type something in the textbox lose focus come back to the textbox and then erase whatever I have written. But if I just load the WPF application and tab off the textbox without writing and erasin...
I have done a bit of testing on this myself (During the server side processing of a DWR Framework Ajax request handler to be exact) and it seems you CAN successfully manipulate cookies, but this goes against much that I have read on Ajax best practices and how browsers interpret the response from an XmlHttpRequest. No...
When considering the handling of cookies in the context of Ajax requests and the DWR (Direct Web Remoting) Framework, there are several key aspects to keep in mind regarding best practices and browser behavior. ### Server-Side Cookie Manipulation 1. **Trustworthiness**: As you've discovered, it's generally acceptable...
5,703
[ { "from": "human", "value": "I have done a bit of testing on this myself (During the server side processing of a DWR Framework Ajax request handler to be exact) and it seems you CAN successfully manipulate cookies, but this goes against much that I have read on Ajax best practices and how browsers interpret...
I would like to display details of an xml error log to a user in a winforms application and am looking for the best control to do the job. The error data contains all of the sever variables at the time that the error occurred. These have been formatted into an XML document that looks something to the effect of: <error>...
To display the XML error log data in a user-friendly format in a WinForms application, you can use a combination of a `ListView`, `DataGridView`, or a simple `TextBox` with formatting. Below are two approaches that would work well for displaying the information, allowing users to see key-value pairs in a structured man...
2,084
[ { "from": "human", "value": "I would like to display details of an xml error log to a user in a winforms application and am looking for the best control to do the job.\nThe error data contains all of the sever variables at the time that the error occurred. These have been formatted into an XML document that...
I've been looking into different web statistics programs for my site, and one promising one is Visitors. Unfortunately, it's a C program and I don't know how to call it from the web server. I've tried using PHP's shell_exec, but my web host (NFSN) has PHP's safe mode on and it's giving me an error message. Is there a w...
Running a C program from a web server when PHP's safe mode is enabled can be tricky. Safe mode restricts certain functionalities for security reasons, including the ability to execute shell commands. However, you can potentially run your C program using CGI (Common Gateway Interface), which is a standard for interfacin...
6,648
[ { "from": "human", "value": "I've been looking into different web statistics programs for my site, and one promising one is Visitors. Unfortunately, it's a C program and I don't know how to call it from the web server. I've tried using PHP's shell_exec, but my web host (NFSN) has PHP's safe mode on and it's...
Is the documentation for Rich Edit Controls really as bad (wrong?) as it seems to be? Right now I'm manually calling LoadLibrary("riched20.dll") in order to get a Rich Edit Control to show up. The documentation for Rich Edit poorly demonstrates this in the first code sample for using Rich Edit controls. It talks abou...
The documentation for Rich Edit controls can indeed be a bit unclear and sometimes lacks important details, leading to confusion for developers. However, there is a standard way to initialize and use Rich Edit controls in your application without manually loading the `riched20.dll`. ### Using Rich Edit Controls Proper...
4,864
[ { "from": "human", "value": "Is the documentation for Rich Edit Controls really as bad (wrong?) as it seems to be? Right now I'm manually calling LoadLibrary(\"riched20.dll\") in order to get a Rich Edit Control to show up. The documentation for Rich Edit poorly demonstrates this in the first code sample ...
I've been googling for a while now, and can't figure out how to create an event in the calendar on a newer Palm OS device. Any ideas on how to do this? I'm guessing that I'll be creating a record in the calendar database, but the format of the data in that record, and which database to put it in, I don't know.
Creating an event in the calendar on a Palm OS device involves interacting with the Calendar application and typically requires understanding the structure of the databases used by Palm OS. Here’s a basic outline of how to create a calendar event programmatically. ### 1. **Database Structure**: The calendar data is...
4,565
[ { "from": "human", "value": "I've been googling for a while now, and can't figure out how to create an event in the calendar on a newer Palm OS device. Any ideas on how to do this? I'm guessing that I'll be creating a record in the calendar database, but the format of the data in that record, and which da...
What is the best way to profile a controller action in Ruby on Rails. Currently I am using the brute-force method of throwing in puts Time.now calls between what I think will be a bottleneck. But that feels really, really dirty. There has got to be a better way.
Profiling a controller action in Ruby on Rails can indeed be done more effectively than using `puts Time.now` statements. Here are several better methods you can use to profile and identify bottlenecks in your Rails applications: ### 1. Rails Built-in Logging Rails provides built-in logging that can give you insights ...
4,227
[ { "from": "human", "value": "What is the best way to profile a controller action in Ruby on Rails. Currently I am using the brute-force method of throwing in puts Time.now calls between what I think will be a bottleneck. But that feels really, really dirty. There has got to be a better way.\n" }, { ...
We have a few projects that involve building an application that is composed of maybe 50% custom functionality, but then pulls in, say, a wiki, a forum, and other components that are "wheels" that have already been invented that we do not wish to re-write from scratch. These third-party applications usually have their ...
Integrating multiple third-party applications into a cohesive application can indeed be challenging, especially when dealing with differences in databases, themes, and authentication systems. Here are some best practices to consider for successful integration: ### 1. **Component Selection**: - **API-first Approach*...
5,679
[ { "from": "human", "value": "We have a few projects that involve building an application that is composed of maybe 50% custom functionality, but then pulls in, say, a wiki, a forum, and other components that are \"wheels\" that have already been invented that we do not wish to re-write from scratch.\nThese ...
Does anyone know IF, WHEN or HOW I can get Memcached running on a Windows 64bit environment? I'm setting up a new hosting solution and would much prefer to run a 64bit OS, and since it's an ASP.Net MVC solution with SQL Server DB, the OS is either going to be Windows Server 2003 or (hopefully!) 2008. I know that this ...
Running Memcached on a Windows 64-bit environment can indeed be a challenge, as the original Memcached server was primarily developed for Unix-like systems. The available Windows ports tend to be 32-bit, which complicates matters when you want to run a 64-bit server. Below are some options and suggestions that might he...
5,579
[ { "from": "human", "value": "Does anyone know IF, WHEN or HOW I can get Memcached running on a Windows 64bit environment? \nI'm setting up a new hosting solution and would much prefer to run a 64bit OS, and since it's an ASP.Net MVC solution with SQL Server DB, the OS is either going to be Windows Server 20...
I'm trying to write a page that calls PHP that's stored in a MySQL database. The page that is stored in the MySQL database contains PHP (and HTML) code which I want to run on page load. How could I go about doing this?
Executing PHP code stored in a MySQL database poses significant security risks, and it is generally not recommended. However, if you still wish to pursue this for a controlled environment or specific use case, here's a method you could follow. Please ensure you are taking the necessary precautions to avoid potential se...
6,677
[ { "from": "human", "value": "I'm trying to write a page that calls PHP that's stored in a MySQL database. The page that is stored in the MySQL database contains PHP (and HTML) code which I want to run on page load.\nHow could I go about doing this?\n" }, { "from": "gpt", "value": "Executing PHP ...
I am constantly learning new tools, even old fashioned ones, because I like to use the right solution for the problem. Nevertheless, I wonder if there is still any reason to learn some of them. awk for example is interesting to me, but for simple text processing, I can use grep, cut, sed, etc. while for complex ones, I...
The decision to learn a tool like `awk` depends on a few key factors, including your specific use cases, the frequency with which you'll apply the tool, and your overall goals in learning new technologies. Here are some points to consider: ### Pros of Learning `awk` 1. **Efficiency for Text Processing**: `awk` is par...
8,005
[ { "from": "human", "value": "I am constantly learning new tools, even old fashioned ones, because I like to use the right solution for the problem.\nNevertheless, I wonder if there is still any reason to learn some of them. awk for example is interesting to me, but for simple text processing, I can use grep...
I have a script that takes a table name and generates a control file by querying all the columns/rows the table. This works fine for numeric and character data but fails on timestamp data so I need to adjust the script to output the timestamp data into the control in such a way that it can be read in properly. So esse...
When creating a control file for loading data into a database, the format of the timestamp data is crucial to ensure that the database understands it correctly. Different database systems may require different formats for timestamp data, but here are some general guidelines and an example format that you can use for ma...
4,756
[ { "from": "human", "value": "I have a script that takes a table name and generates a control file by querying all the columns/rows the table. This works fine for numeric and character data but fails on timestamp data so I need to adjust the script to output the timestamp data into the control in such a way...
I stumbled over this passage in the Django tutorial: Django models have a default str() method that calls unicode() and converts the result to a UTF-8 bytestring. This means that unicode(p) will return a Unicode string, and str(p) will return a normal string, with characters encoded as UTF-8. Now, I'm confused becaus...
Your confusion is understandable, especially since the terminology around Unicode and string representations can be a bit convoluted. Let's clarify some of the concepts involved. 1. **Unicode**: Unicode itself is not an encoding but a standard for character representation. It defines a unique number (code point) for e...
4,730
[ { "from": "human", "value": "I stumbled over this passage in the Django tutorial:\n\nDjango models have a default str() method that calls unicode() and converts the result to a UTF-8 bytestring. This means that unicode(p) will return a Unicode string, and str(p) will return a normal string, with characters ...
I have corporate proxy that supports https but not HTTP CONNECT (even after authentication). It just gives 403 Forbidden in response anything but HTTP or HTTPS URLS. It uses HTTP authenication, not NTLM. It is well documented the urllib2 does not work with https thru a proxy. App Engine trys to connect to a https URL u...
When dealing with a restrictive corporate proxy that only supports HTTPS and not HTTP CONNECT, it can indeed be quite challenging, especially when the tools or libraries you’re using (like `urllib2` in Python) rely on certain proxy features. Here are some alternative approaches you can try: ### 1. Use `requests` Libra...
6,447
[ { "from": "human", "value": "I have corporate proxy that supports https but not HTTP CONNECT (even after authentication). It just gives 403 Forbidden in response anything but HTTP or HTTPS URLS. It uses HTTP authenication, not NTLM. It is well documented the urllib2 does not work with https thru a proxy. Ap...
Is there a way to auto discover a specific WCF service in the network? I don't want to config my client with the address if this is possible.
Yes, it is possible to auto-discover WCF (Windows Communication Foundation) services on a network using a few different approaches. Here are some common techniques you can use for service discovery without hard-coding the endpoint address in the client configuration. ### 1. **Using UDDI (Universal Description, Discove...
5,610
[ { "from": "human", "value": "Is there a way to auto discover a specific WCF service in the network? I don't want to config my client with the address if this is possible.\n" }, { "from": "gpt", "value": "Yes, it is possible to auto-discover WCF (Windows Communication Foundation) services on a ne...
First off, there's a bit of background to this issue available on my blog: http://www.codebork.com/coding/2008/06/25/message-passing-a-plug-framework.html http://www.codebork.com/coding/2008/07/31/message-passing-2.html I'm aware that the descriptions aren't hugely clear, so I'll try to summarise what I'm attempting...
Your challenge seems to revolve around effectively managing events and notifications in your plug-in architecture without creating excessive coupling or complexity. Here are some potential solutions and considerations for your situation: ### 1. **Use a Centralized Event Aggregator** You can implement an Event Aggregat...
5,019
[ { "from": "human", "value": "First off, there's a bit of background to this issue available on my blog:\n\nhttp://www.codebork.com/coding/2008/06/25/message-passing-a-plug-framework.html\nhttp://www.codebork.com/coding/2008/07/31/message-passing-2.html \n\nI'm aware that the descriptions aren't hugely clear...
I have a .csv file that is frequently updated (about 20 to 30 times per minute). I want to insert the newly added lines to a database as soon as they are written to the file. The FileSystemWatcher class listens to the file system change notifications and can raise an event whenever there is a change in a specified file...
Certainly! Using `FileSystemWatcher` is a common approach to monitor changes in a file, but as you've noted, it won't directly give you the specific lines that were added or removed. Here are a couple of approaches to handle this situation more effectively and elegantly: ### Option 1: Use a Buffer and Timestamp 1. **...
4,372
[ { "from": "human", "value": "I have a .csv file that is frequently updated (about 20 to 30 times per minute). I want to insert the newly added lines to a database as soon as they are written to the file.\nThe FileSystemWatcher class listens to the file system change notifications and can raise an event when...
I really like the interface for Yahoo Pipes (http://pipes.yahoo.com/pipes/) and would like to create a similar interface for a different problem. Are there any libraries that would allow me to create an interface with the same basic look and feel? I especially like how the pipes behave and how they are not just straig...
Creating a web-based application with an interface similar to Yahoo Pipes, which allows for visual data manipulation and flow, can be achieved using various JavaScript libraries. Here are a few libraries and frameworks that can help you achieve that kind of functionality and aesthetics: 1. **D3.js**: - D3.js (Data-...
4,153
[ { "from": "human", "value": "I really like the interface for Yahoo Pipes (http://pipes.yahoo.com/pipes/) and would like to create a similar interface for a different problem. Are there any libraries that would allow me to create an interface with the same basic look and feel? \nI especially like how the pip...
I cannot find an elegant way to get the return value from a stored procedure when using TableAdapters. It appears the TableAdapter does not support SQL stored procedure return values when using a non-scalar stored procedure call. You'd expect the return value from the auto-generated function would be the return value f...
When working with TableAdapters in .NET and SQL Server, you may encounter limitations when trying to retrieve a return value from a stored procedure, especially if the procedure performs data manipulation and is primarily used for operations other than returning a single value. While it's true that TableAdapters typic...
6,301
[ { "from": "human", "value": "I cannot find an elegant way to get the return value from a stored procedure when using TableAdapters.\nIt appears the TableAdapter does not support SQL stored procedure return values when using a non-scalar stored procedure call. You'd expect the return value from the auto-gene...
The firewall I'm behind is running Microsoft ISA server in NTLM-only mode. Hash anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method? ... or am I just being lazy? Note: rubysspi-1.2.4 does not work. This also works for "igem", part of the IronRuby project
If you're behind a Microsoft ISA server configured in NTLM-only mode, installing Ruby gems can indeed be challenging due to the authentication requirements. Here are a few methods you might try to get your gems installed or updated: ### 1. Using `rubygems` with Proxy Settings You can configure RubyGems to use your HT...
6,243
[ { "from": "human", "value": "The firewall I'm behind is running Microsoft ISA server in NTLM-only mode. Hash anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method?\n... or am I just being lazy?\nNote: rubysspi-1.2.4 does not work.\nThis also works for \"igem\", part...
I've seen lots of examples of making an entire regular expression case-insensitive. What I'm wondering about is having just part of the expression be case-insensitive. For example, let's say I have a string like this: fooFOOfOoFoOBARBARbarbarbAr What if I want to match all occurrences of "foo" regardless of case but ...
You're correct that many regex flavors support inline mode changes, allowing you to make specific parts of a regular expression case-insensitive while keeping the rest case-sensitive. Here's a breakdown of how to achieve this in various languages that support this feature, along with some notes for others that might no...
5,330
[ { "from": "human", "value": "I've seen lots of examples of making an entire regular expression case-insensitive. What I'm wondering about is having just part of the expression be case-insensitive.\nFor example, let's say I have a string like this:\nfooFOOfOoFoOBARBARbarbarbAr\n\nWhat if I want to match all...
I'm trying to write a console (as in terminal, not gaming console) pong game in python and I'm having trouble figuring how best to (re)draw the game. I was thinking of having an 2d array as a sort of bitmap, editing the array to reflect the ball/paddles new positions and then casting each row to a string and printing i...
Creating a console-based Pong game in Python is a fun and interesting project! You're correct in noting that handling the output to the console can be challenging, especially when you want to ensure that old frames do not persist on the screen. ### Options for Redrawing in Console: 1. **Using ANSI Escape Codes:** ...
7,125
[ { "from": "human", "value": "I'm trying to write a console (as in terminal, not gaming console) pong game in python and I'm having trouble figuring how best to (re)draw the game.\nI was thinking of having an 2d array as a sort of bitmap, editing the array to reflect the ball/paddles new positions and then c...
I'm looking for a Java library for SWIFT messages. I want to parse SWIFT messages into an object model validate SWIFT messages (including SWIFT network validation rules) build / change SWIFT messages by using an object model Theoretically, I need to support all SWIFT message types. But at the moment I need MT103+, MT...
If you're looking for Java libraries to work with SWIFT messages, there are a few alternatives to the ones you mentioned. Here are some options that might meet your requirements: ### 1. **SWIFT MT Library** The SWIFT MT Library is a Java library specifically designed to parse, validate, and create SWIFT MT messages. I...
3,929
[ { "from": "human", "value": "I'm looking for a Java library for SWIFT messages. I want to\n\nparse SWIFT messages into an object model\nvalidate SWIFT messages (including SWIFT network validation rules)\nbuild / change SWIFT messages by using an object model\n\nTheoretically, I need to support all SWIFT mes...
The problem: I have a class which contains a template method execute which calls another method _execute. Subclasses are supposed to overwrite _execute to implement some specific functionality. This functionality should be documented in the docstring of _execute. Advanced users can create their own subclasses to exten...
You can achieve this by using a metaclass to automatically set the docstring of the `execute` method to be the same as that of the `_execute` method in subclasses. Below, I provide a sample implementation that demonstrates this approach. ### Implementation Using a Metaclass Here's how you can implement it using a met...
5,102
[ { "from": "human", "value": "The problem: I have a class which contains a template method execute which calls another method _execute. Subclasses are supposed to overwrite _execute to implement some specific functionality. This functionality should be documented in the docstring of _execute. \nAdvanced user...
I already know how to: Load properties files into my Spring configuration using: <context:property-placeholder location="aaa/bbb/ccc/stuff.properties"/> Build properties objects on the fly using: <props><prop key="abc">some value</prop></props> But what I cant do, and would be really useful, is to have Spring load a...
In Spring, you can load properties from a file and create a `Properties` object that you can then inject into your beans. Here's a way to achieve that using XML configuration. ### Step 1: Load Properties from a File You can load properties from a file using `<context:property-placeholder>` as you have already done. B...
6,692
[ { "from": "human", "value": "I already know how to:\nLoad properties files into my Spring configuration using:\n<context:property-placeholder location=\"aaa/bbb/ccc/stuff.properties\"/> \n\nBuild properties objects on the fly using:\n<props><prop key=\"abc\">some value</prop></props>\n\nBut what I cant do, ...
I have a set of WCF web services connected to dynamically by a desktop application. My problem is the really detailed config settings that WCF requires to work. Getting SSL to work involves custom settings. Getting MTOM or anything else to work requires more. You want compression? Here we go again... WCF is really powe...
Making WCF services easier to configure for users who are not WCF experts is indeed a common challenge. Auto-discovery mechanisms and dynamic configuration can help streamline this process. Here are several approaches and considerations that might help you achieve this goal: ### 1. **Service Metadata Exchange (MEX) En...
5,835
[ { "from": "human", "value": "I have a set of WCF web services connected to dynamically by a desktop application.\nMy problem is the really detailed config settings that WCF requires to work. Getting SSL to work involves custom settings. Getting MTOM or anything else to work requires more. You want compressi...
I have an application that runs as a child application in a virtual directory. I want to pass a value from the parent application, but I believe that Session is keyed per application, and won't work. To further complicate things, the parent application is WebForms, while the child is NVelocity MVC. Does anyone know a t...
In scenarios where you have a parent application and a child application running under different application pools or virtual directories, sharing session state directly can indeed be tricky due to the isolation of sessions in ASP.NET. However, there are a few workarounds that you can consider to pass the logged-in use...
6,615
[ { "from": "human", "value": "I have an application that runs as a child application in a virtual directory.\nI want to pass a value from the parent application, but I believe that Session is keyed per application, and won't work.\nTo further complicate things, the parent application is WebForms, while the c...
What, if any, considerations (HTML, CSS, JavaScript) should you take when designing for Google Chrome?
When designing for Google Chrome, there are several considerations across HTML, CSS, and JavaScript to ensure that your web applications are performant, user-friendly, and visually appealing. Here are some key points to keep in mind: ### HTML Considerations 1. **Semantic HTML**: Use semantic tags (like `<header>`, `<...
4,368
[ { "from": "human", "value": "What, if any, considerations (HTML, CSS, JavaScript) should you take when designing for Google Chrome? \n" }, { "from": "gpt", "value": "When designing for Google Chrome, there are several considerations across HTML, CSS, and JavaScript to ensure that your web applic...
Say you have 2 database servers, one database is the 'master' database where all write operations are performed, it is treated as the 'real/original' database. The other server's database is to be a mirror copy of the master database (slave?), which will be used for read only operations for a certain part of the appli...
Setting up a slave database that mirrors a master database involves configuring database replication. The specifics can vary depending on the database management system (DBMS) you are using, but the general principles are similar across platforms. ### Steps to Set Up a Slave Database 1. **Choose Your Database Managem...
4,968
[ { "from": "human", "value": "Say you have 2 database servers, one database is the 'master' database where all write operations are performed, it is treated as the 'real/original' database. The other server's database is to be a mirror copy of the master database (slave?), which will be used for read only o...
In our application we've run into an error numerous times where we get error CS0433, which complains about a name collison in two separate dlls. This is an ASP.NET app developed in C# using webforms. It always complained about A TimeLog page. Anyone have advice for resolving this error?
The CS0433 error in C# indicates that there is a name collision between types in your application, typically caused by two different assemblies (DLLs) containing a type with the same fully-qualified name. This can happen in ASP.NET applications, especially if you have multiple DLLs that reference the same types or have...
7,407
[ { "from": "human", "value": "In our application we've run into an error numerous times where we get error CS0433, which complains about a name collison in two separate dlls. This is an ASP.NET app developed in C# using webforms. It always complained about A TimeLog page. Anyone have advice for resolving ...
I am getting an 403 access forbidden when attempting to open a page under a vhost where the document root is sitting on a different drive than where apache is sitting. I installed using the apachefriends release. This is my httpd-vhosts.conf file: NameVirtualHost 127.0.0.1 <VirtualHost 127.0.0.1> ServerName foo.loc...
The 403 Forbidden error you’re encountering when trying to access the `bar.localhost` virtual host is often due to insufficient permissions or misconfigured settings in your Apache configuration. Here are some steps to troubleshoot and potentially resolve the issue: 1. **Directory Permissions**: Ensure that the Apa...
5,326
[ { "from": "human", "value": "I am getting an 403 access forbidden when attempting to open a page under a vhost where the document root is sitting on a different drive than where apache is sitting. I installed using the apachefriends release. This is my httpd-vhosts.conf file: \n\nNameVirtualHost 127.0.0.1\n...
I've created a custom exception for a very specific problem that can go wrong. I receive data from another system, and I raise the exception if it bombs while trying to parse that data. In my custom exception, I added a field called "ResponseData", so I can track exactly what my code couldn't handle. In custom exceptio...
When designing custom exceptions, it's essential to strike a balance between providing useful information for debugging and keeping the exception message manageable and meaningful. Given your scenario, here are some considerations for both options: ### Option 1: Record extra information from a field in a custom except...
7,317
[ { "from": "human", "value": "I've created a custom exception for a very specific problem that can go wrong. I receive data from another system, and I raise the exception if it bombs while trying to parse that data. In my custom exception, I added a field called \"ResponseData\", so I can track exactly what ...
I'm developing a multi-threaded application for a Linux embedded platform. At the moment I'm setting the stack size for each thread (via pthread_set_attr) to a fairly large default value. I would like to fine tune that value for each thread to something smaller to reduce my application's memory usage. I could go throug...
In a Linux environment, particularly when working on an embedded platform, measuring stack usage of threads can indeed be a bit more complex than in systems like VxWorks. However, there are several approaches and tools you can use to measure stack usage in a Linux multi-threaded application: 1. **Manual Instrumentatio...
6,076
[ { "from": "human", "value": "I'm developing a multi-threaded application for a Linux embedded platform.\nAt the moment I'm setting the stack size for each thread (via pthread_set_attr) to a fairly large default value. I would like to fine tune that value for each thread to something smaller to reduce my app...
Our family no longer uses our Mixman DM2 USB controller for making music. This frees it up for me to use as an auxiliary keyboard with 31 "keys" (and a few "sliders"). I had the crazy idea to use these buttons to send keyboard shortcuts to Visual Studio. It just seems easier pressing one key than some of the finger-...
Yes, using a USB controller like the Mixman DM2 to send keyboard shortcuts is a creative idea! While it may not be as common, there are several utilities that can help you achieve your goal. Here are a few options that might work for your setup: 1. **AutoHotkey**: This powerful scripting language can read inputs from ...
7,490
[ { "from": "human", "value": "Our family no longer uses our Mixman DM2 USB controller for making music. This frees it up for me to use as an auxiliary keyboard with 31 \"keys\" (and a few \"sliders\"). I had the crazy idea to use these buttons to send keyboard shortcuts to Visual Studio. It just seems eas...
I know and have Xcode, but I was wondering if there were any other complete development environments that support Objective-C? I'm not looking for solutions with vim or emacs, nor editors like BBEdit that support syntax highlighting, but a full fledged IDE with: code completion compilation debugging refactoring Extra...
While Xcode is the primary IDE for Objective-C development, there are a few alternatives that might meet your requirements. Below are some complete development environments that support Objective-C, along with some of their features: 1. **AppCode by JetBrains**: - Features: Code completion, compilation, debugging, ...
6,061
[ { "from": "human", "value": "I know and have Xcode, but I was wondering if there were any other complete development environments that support Objective-C? I'm not looking for solutions with vim or emacs, nor editors like BBEdit that support syntax highlighting, but a full fledged IDE with:\n\ncode completi...
I have windows 2003 terminal servers, multi-core. I'm looking for a way to monitor individual CPU core usage on these servers. It is possible for an end-user to have a run-away process (e.g. Internet Explorer or Outlook). The core for that process may spike to near 100% leaving the other cores 'normal'. Thus, the ...
Monitoring CPU core usage on Windows Server 2003 can be a bit tricky, especially since it is a legacy system that lacks some of the advanced features found in newer versions of Windows Server. However, there are several methods and tools you can use to accomplish your monitoring and management goals: ### Tools to Moni...
4,806
[ { "from": "human", "value": "I have windows 2003 terminal servers, multi-core. I'm looking for a way to monitor individual CPU core usage on these servers. It is possible for an end-user to have a run-away process (e.g. Internet Explorer or Outlook). The core for that process may spike to near 100% leav...
How, if you have a database per client of a web application instead of one database used by all clients, do you go about providing updates and enhancements to all databases efficiently? How do you roll out changes to schema and code in such a scenario?
Managing multiple databases per client in a web application can be challenging, especially when it comes to efficiently rolling out updates and enhancements. Here’s a structured approach to tackle schema and code changes in such an environment: ### 1. **Version Control for Database Schema** - **Schema Versioning**...
3,571
[ { "from": "human", "value": "How, if you have a database per client of a web application instead of one database used by all clients, do you go about providing updates and enhancements to all databases efficiently?\nHow do you roll out changes to schema and code in such a scenario?\n" }, { "from": "...
In VS .NET, when you are selecting a folder for a project, a dialog that looks like an OpenFileDialog or SaveFileDialog is displayed, but is set up to accept only folders. Ever since I've seen this I've wanted to know how it's done. I am aware of the FolderBrowserDialog, but I've never really liked that dialog. It s...
Creating a custom file dialog that only accepts folders is indeed possible, but it involves some low-level work, especially when trying to replicate the functionality of dialogs like OpenFileDialog or SaveFileDialog in .NET. Although .NET does not provide a direct way to configure these dialogs to behave like you descr...
3,159
[ { "from": "human", "value": "In VS .NET, when you are selecting a folder for a project, a dialog that looks like an OpenFileDialog or SaveFileDialog is displayed, but is set up to accept only folders. Ever since I've seen this I've wanted to know how it's done. I am aware of the FolderBrowserDialog, but I...
In WPF, is it possible for a DataTrigger to bind to an attached property? I essentially want to use a converter on an attached property to provide a style when a particular validation rule has been broken. I am using markup like the following: <DataTrigger Binding="{Binding Path=Validation.Errors, ...
In WPF, the `Validation` class provides a way to validate data, and the `Validation.Errors` property is used to retrieve a collection of validation errors for a given element. However, the issue you are encountering stems from trying to bind directly to `Validation.Errors` on a `TextBox`. The `Validation` property is n...
6,487
[ { "from": "human", "value": "In WPF, is it possible for a DataTrigger to bind to an attached property?\nI essentially want to use a converter on an attached property to provide a style when a particular validation rule has been broken. I am using markup like the following:\n<DataTrigger Binding=\"{Binding P...
I'd like to indicate to the user of a web app that a long-running task is being performed. Once upon a time, this concept would have been communicated to the user by displaying an hourglass. Nowadays, it seems to be an animated spinning circle. (e.g., when you are loading a new tab in Firefox, or booting in Mac OS X. ...
The spinning indicator you're referring to is commonly called a "loading spinner" or "loading animation." It is used to indicate that a task is in progress and the system is still responsive. You can easily create a loading spinner using CSS for the animation and JavaScript (or jQuery) to control its visibility. Here'...
5,894
[ { "from": "human", "value": "I'd like to indicate to the user of a web app that a long-running task is being performed. Once upon a time, this concept would have been communicated to the user by displaying an hourglass. Nowadays, it seems to be an animated spinning circle. (e.g., when you are loading a new...
I've got two controls in my Interface Builder file, and each of those controls I've created a separate delegate class for in code (Control1Delegate and Control2Delegate). I created two "Objects" in interface builder, made them of that type, and connected the controls to them as delegates. The delegates work just fine. ...
In your scenario, sharing information between two delegate classes can be handled in a few different ways. Here are some common approaches to consider: ### 1. Use a Shared Data Model Create a shared data model class that both delegate classes can access. This is typically a separate class that holds the state or infor...
5,229
[ { "from": "human", "value": "I've got two controls in my Interface Builder file, and each of those controls I've created a separate delegate class for in code (Control1Delegate and Control2Delegate). I created two \"Objects\" in interface builder, made them of that type, and connected the controls to them a...
boolean a = false, b = true; if ( a && b ) { ... }; In most languages, b will not get evaluated because a is false so a && b cannot be true. My question is, wouldn't short circuiting be slower in terms of architecture? In a pipeline, do you just stall while waiting to get the result of a to determine if b should be ev...
Short-circuit evaluation is a programming construct where the evaluation of a logical expression stops as soon as the overall result is determined. For the logical AND (`&&`) operator, if the first operand evaluates to false, the second operand is not evaluated because the entire expression cannot possibly be true. For...
5,355
[ { "from": "human", "value": "boolean a = false, b = true;\nif ( a && b ) { ... };\n\nIn most languages, b will not get evaluated because a is false so a && b cannot be true. My question is, wouldn't short circuiting be slower in terms of architecture? In a pipeline, do you just stall while waiting to get th...
I am looking for an easy way to check if an object in C# is serializable. As we know you make an object serializable by either implementing the ISerializable interface or by placing the [Serializable] at the top of the class. What I am looking for is a quick way to check this without having to reflect the class to get ...
You're on the right track! In C#, if you want to check if an object is serializable, using the `typeof(T).IsSerializable` is indeed a straightforward and efficient way to do it. Here's a refined version of your approach: ```csharp using System; public static class SerializationHelper { public static bool IsSeria...
7,376
[ { "from": "human", "value": "I am looking for an easy way to check if an object in C# is serializable.\nAs we know you make an object serializable by either implementing the ISerializable interface or by placing the [Serializable] at the top of the class.\nWhat I am looking for is a quick way to check this ...
Summary Hi All, OK, further into my adventures with custom controls... In summary, here is that I have learned of three main "classes" of custom controls. Please feel free to correct me if any of this is wrong! UserControls - Which inherit from UserControl and are contained within an ASCX file. These are pretty limite...
Hi there! It sounds like you're diving deep into the world of custom controls, which is an important and sometimes complex area of web development. Your summary of the three main classes of custom controls is accurate, and I can provide some additional insights and answers to your questions. ### Classes of Custom Con...
5,917
[ { "from": "human", "value": "Summary\nHi All,\nOK, further into my adventures with custom controls...\nIn summary, here is that I have learned of three main \"classes\" of custom controls. Please feel free to correct me if any of this is wrong!\n\nUserControls - Which inherit from UserControl and are contai...
I am writing a program that needs to send out an email every hour on the hour, but at a time local to the user. Say I have 2 users in different time zones. John is in New York and Fred is in Los Angeles. The server is in Chicago. If I want to send an email at 6 PM local to each user, I'd have to send the email to John ...
To achieve the requirement of sending emails at a specified local time for users in different time zones using .NET and SQL Server, here's a structured approach you can follow: ### Step 1: Import Time Zone Information into SQL Server You can use the XML file containing time zone information to populate a SQL Server t...
5,282
[ { "from": "human", "value": "I am writing a program that needs to send out an email every hour on the hour, but at a time local to the user.\nSay I have 2 users in different time zones. John is in New York and Fred is in Los Angeles. The server is in Chicago. If I want to send an email at 6 PM local to each...
I've found a few (unfortunately, they are bookmarked at home and I'm at work, so no links), but I was wondering if anyone had any opinions about any of them (love it, hate it, whatever) so I could make a good decision. I think I'm going to use Cygwin for my Unix commands on Windows, but I'm not sure how well that's goi...
Cygwin is indeed a popular choice for running Unix-like commands on Windows, and many users appreciate its ability to provide a familiar environment for those coming from a Unix or Linux background. Here are some of the pros and cons of using Cygwin, along with some alternatives you might consider: ### Cygwin **Pros:*...
5,248
[ { "from": "human", "value": "I've found a few (unfortunately, they are bookmarked at home and I'm at work, so no links), but I was wondering if anyone had any opinions about any of them (love it, hate it, whatever) so I could make a good decision. I think I'm going to use Cygwin for my Unix commands on Wind...
I've tried to write a string replace function in C, which works on a char *, which has been allocated using malloc(). It's a little different in that it will find and replace strings, rather than characters in the starting string. It's trivial to do if the search and replace strings are the same length (or the replace...
You're on the right track with your `strrep` function, but there are several issues and points of improvement related to memory management, particularly with the use of `realloc`. Let's address those step by step and provide a corrected version of your code. ### Key Issues: 1. **Reallocation**: The result of `realloc...
3,533
[ { "from": "human", "value": "I've tried to write a string replace function in C, which works on a char *, which has been allocated using malloc(). It's a little different in that it will find and replace strings, rather than characters in the starting string.\nIt's trivial to do if the search and replace s...
I'm trying to create a standard way of rolling out web applications for our company. Currently we do it with zip files, vbscript/javascript, and manual some steps. For thick client installs we generate MSI installers using Wise/Wix. We don't create installers currently for websites as in general they are just xcopy...
When it comes to deploying web applications, there are various approaches, and the choice largely depends on the specific requirements of the application, the environment it runs in, and the preferences of the development and operations teams. Here’s a breakdown of some common practices and tools used in the industry f...
7,637
[ { "from": "human", "value": "I'm trying to create a standard way of rolling out web applications for our company. Currently we do it with zip files, vbscript/javascript, and manual some steps. \nFor thick client installs we generate MSI installers using Wise/Wix. We don't create installers currently for ...
Is there a way to implement forms authentication, but only for a specific URL. For example, I would want the formsAuthentication to protect the site on staging.mydomain.com but not hinder access to www.mydomain.com if the web.config accidentally got moved over to the production site.
Yes, you can implement forms authentication for a specific URL while allowing unauthenticated access to other URLs, such as your production site. This can be achieved by configuring the `web.config` files of your ASP.NET application appropriately. Here’s how to set it up: 1. **Use Separate web.config Files**: If you ...
4,680
[ { "from": "human", "value": "Is there a way to implement forms authentication, but only for a specific URL. For example, I would want the formsAuthentication to protect the site on staging.mydomain.com but not hinder access to www.mydomain.com if the web.config accidentally got moved over to the production...
I want to show a chromeless modal window with a close button in the upper right corner. Is this possible?
Yes, it is possible to create a chromeless modal window with a close button in the upper right corner using HTML, CSS, and JavaScript. Below is a simple example that demonstrates how to achieve this: ### HTML ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content=...
3,850
[ { "from": "human", "value": "I want to show a chromeless modal window with a close button in the upper right corner.\nIs this possible?\n" }, { "from": "gpt", "value": "Yes, it is possible to create a chromeless modal window with a close button in the upper right corner using HTML, CSS, and Java...
We have a client that has Oracle Standard, and a project that would be ten times easier addressed using OLAP. However, Oracle only supports OLAP in the Enterprise version. Migration to enterprise is not possible I'm thinking of doing some manual simulation of OLAP, creating relational tables to simulate the technology....
If migration to Oracle Enterprise Edition is not possible and you want to simulate OLAP capabilities, there are several approaches and open-source tools you could consider: ### 1. **Using Open Source OLAP Tools** There are a number of open-source OLAP tools that you can use to handle multidimensional analysis and rep...
3,835
[ { "from": "human", "value": "We have a client that has Oracle Standard, and a project that would be ten times easier addressed using OLAP. However, Oracle only supports OLAP in the Enterprise version.\nMigration to enterprise is not possible\nI'm thinking of doing some manual simulation of OLAP, creating re...
When creating scrollable user controls with .NET and WinForms I have repeatedly encountered situations where, for example, a vertical scrollbar pops up, overlapping the control's content, causing a horizontal scrollbar to also be needed. Ideally the content would shrink just a bit to make room for the vertical scrollb...
Yes, there are better ways to manage scrollbars in a WinForms application when using scrollable user controls. You can adjust the layout of your controls and use the `ScrollBar` properties effectively to create a more user-friendly experience. Below are several strategies to handle the scrollbar issue: ### 1. Adjust t...
5,751
[ { "from": "human", "value": "When creating scrollable user controls with .NET and WinForms I have repeatedly encountered situations where, for example, a vertical scrollbar pops up, overlapping the control's content, causing a horizontal scrollbar to also be needed. Ideally the content would shrink just a ...
Using .Net (C#), how can you work with USB devices? How can you detect USB events (connections/disconnections) and how do you communicate with devices (read/write). Is there a native .Net solution to do this?
Working with USB devices in .NET can be achieved through several approaches, although there is no direct built-in support in the .NET Framework or .NET Core/5+ for USB communication. However, you can use a few libraries and Windows API calls to interact with USB devices. Below, I'll detail how to detect USB events and ...
5,022
[ { "from": "human", "value": "Using .Net (C#), how can you work with USB devices? \nHow can you detect USB events (connections/disconnections) and how do you communicate with devices (read/write).\nIs there a native .Net solution to do this?\n" }, { "from": "gpt", "value": "Working with USB devic...
I'm looking for an open source search indexing library. It will be used for embedded web application so it should have a small code size. Preferably, written in C, C++ or PHP and does not require any database to be installed for storing indexes. Indexes should be stored on a file instead (e.g., xml, txt). I tried to lo...
Given your requirements for a lightweight, open-source search indexing library that can work on an embedded web application without requiring a database, here are some options to consider: 1. **Tantivy (Rust)**: While not C, C++, or PHP, Tantivy is a full-text search engine library written in Rust. It's lightweight, f...
6,587
[ { "from": "human", "value": "I'm looking for an open source search indexing library. It will be used for embedded web application so it should have a small code size. Preferably, written in C, C++ or PHP and does not require any database to be installed for storing indexes. Indexes should be stored on a fil...
Nikhil Kothari's Script# is quite possibly one of the most amazing concepts I've seen in the JavaScript arena for quite some time. This question isn't about JavaScript, but rather about language compilation in the .NET runtime. I've been rather interested in how, using the .NET platform, one can write a compiler for a ...
Creating a compiler that can operate alongside an existing compiler, like C#, and generate multiple outputs (for instance, an assembly and JavaScript) from the same source code, is an intriguing endeavor. This approach involves several key concepts in compiler design, language interoperability, and leveraging the .NET ...
6,583
[ { "from": "human", "value": "Nikhil Kothari's Script# is quite possibly one of the most amazing concepts I've seen in the JavaScript arena for quite some time. This question isn't about JavaScript, but rather about language compilation in the .NET runtime.\nI've been rather interested in how, using the .NET...
Background: At my company we are developing a bunch applications that are using the same core dll's. These dll's are using Spring.net's IoC-container to wire things up (auto-wiring). All applications are using the same spring configuration file, and this configuration file points to many classes in many different dll's...
When it comes to managing memory usage in .NET applications, understanding how assemblies (DLLs) are loaded and how Just-In-Time (JIT) compilation works is important. Let's break down your concerns regarding the use of Spring.NET's IoC container and the implications of loading multiple DLLs. ### 1. DLL Loading and Mem...
6,436
[ { "from": "human", "value": "Background: At my company we are developing a bunch applications that are using the same core dll's. These dll's are using Spring.net's IoC-container to wire things up (auto-wiring). All applications are using the same spring configuration file, and this configuration file point...
I'm trying to find if there is a reliable way (using SQLite) to find the ID of the next row to be inserted, before it gets inserted. I need to use the id for another insert statement, but don't have the option of instantly inserting and getting the next row. Is predicting the next id as simple as getting the last id an...
In SQLite, the `INTEGER PRIMARY KEY` column automatically increments and is designed to provide a unique identifier for each row. The mechanism behind the IDs involves a hidden table that keeps track of the last inserted row ID. While you can retrieve the last inserted ID using the `last_insert_rowid()` function, it'...
7,244
[ { "from": "human", "value": "I'm trying to find if there is a reliable way (using SQLite) to find the ID of the next row to be inserted, before it gets inserted. I need to use the id for another insert statement, but don't have the option of instantly inserting and getting the next row.\nIs predicting the n...
How can I efficiently and effectively detect the version and, for that matter, any available information about the instance of Silverlight currently running on the browser?
To detect the version of Silverlight that is currently running in a browser, you can use JavaScript to interact with the Silverlight plugin. The following approach can help you retrieve the version and other details of the Silverlight instance: ### Step-by-step Guide to Detect Silverlight Version 1. **Check for Silve...
3,248
[ { "from": "human", "value": "How can I efficiently and effectively detect the version and, for that matter, any available information about the instance of Silverlight currently running on the browser?\n" }, { "from": "gpt", "value": "To detect the version of Silverlight that is currently runnin...
I'm using the After Effects CS3 Javascript API to dynamically create and change text layers in a composition. Or at least I'm trying to because I can't seem to find the right property to change to alter the actual text of the TextLayer object.
In After Effects CS3, you can dynamically create and change text layers using the JavaScript API, specifically by modifying the text source of a `TextLayer`. The `TextLayer` object contains a property called `text`, which you can manipulate to change the text displayed in the layer. Here's how you can change the text ...
6,960
[ { "from": "human", "value": "I'm using the After Effects CS3 Javascript API to dynamically create and change text layers in a composition.\nOr at least I'm trying to because I can't seem to find the right property to change to alter the actual text of the TextLayer object.\n" }, { "from": "gpt", ...
I'm trying to refer to a drive whose letter may change. I'd like to refer to it by its label (e.g., MyLabel (v:) within a Batch File. It can be referred to by V:\ . I'd like to refer to it by MyLabel. (This was posted on Experts Echange for a month with no answer. Let's see how fast SO answers it )
You can achieve this by using a batch script that searches for the drive by its label and then assigns it to a variable. Here’s a step-by-step approach to accomplish that: 1. First, you will need to identify the drive letter based on the label. 2. Then, you can use that drive letter for your further operations. Here’...
3,720
[ { "from": "human", "value": "I'm trying to refer to a drive whose letter may change. I'd like to refer to it by its label (e.g., MyLabel (v:) within a Batch File. It can be referred to by V:\\ . I'd like to refer to it by MyLabel.\n(This was posted on Experts Echange for a month with no answer. Let's see h...
I'm trying to check, using an automated discovery tool, when JAR files in remote J2EE application servers have changed content. Currently, the system downloads the whole JAR using WMI to checksum it locally, which is slow for large JARs. For UNIXy servers (and Windows servers with Cygwin), I can just log in over SSH an...
If you want to calculate the checksum of a JAR file on a Windows server without installing additional software, you can use PowerShell, which is included by default in modern versions of Windows. This approach allows you to compute the MD5 hash of a JAR file using native Windows tools. Here's a step-by-step guide to a...
5,936
[ { "from": "human", "value": "I'm trying to check, using an automated discovery tool, when JAR files in remote J2EE application servers have changed content. Currently, the system downloads the whole JAR using WMI to checksum it locally, which is slow for large JARs.\nFor UNIXy servers (and Windows servers w...
I have a Data Access Object TransactionDao. When you call TransactionDao.Save(transaction) I would like for it to setting a transaction.IsSaved=true flag (this is a simplification the actual thing I'm trying to do is not quite so banal). So when mocking my TransactionDao with RhinoMocks how can I indicate that it sho...
In Rhino Mocks, when you want to set up a method to do something with the input parameters, you can use the `Do` method to specify the behavior. Based on your requirement of modifying the transaction object to set `IsSaved` to `true`, you can define a delegate that will carry out that action. Here’s how you can do thi...
8,091
[ { "from": "human", "value": "I have a Data Access Object TransactionDao. When you call TransactionDao.Save(transaction) I would like for it to setting a transaction.IsSaved=true flag (this is a simplification the actual thing I'm trying to do is not quite so banal). So when mocking my TransactionDao with ...
I hope I can explain this clearly enough, but if not let me know and I'll try to clarify. I'm currently developing a site using ColdFusion and have a mod_rewrite rule in place to make it look like the site is using PHP. Any requests for index.php get processed by index.cfm (the rule maps *.php to *.cfm). This works gre...
It sounds like you're on the right track with your approach using `mod_rewrite`, and the challenge of returning a 404 status for direct requests to `.cfm` files while still allowing requests that are rewritten from `.php` to `.cfm` is a common scenario. You can accomplish this with some careful configuration of your `....
5,006
[ { "from": "human", "value": "I hope I can explain this clearly enough, but if not let me know and I'll try to clarify.\nI'm currently developing a site using ColdFusion and have a mod_rewrite rule in place to make it look like the site is using PHP. Any requests for index.php get processed by index.cfm (the...
I am re-factoring some code and am wondering about the use of a lock in the instance constructor. public class MyClass { private static Int32 counter = 0; private Int32 myCount; public MyClass() { lock(this) { counter++; myCount = counter; } } } Please confirm...
Your understanding of the code and the use of locks in the constructor is correct, but let's clarify a few points: 1. **Instance constructors are not inherently thread-safe:** The instance constructor itself does not guarantee thread safety. If multiple threads create instances of `MyClass` simultaneously, they can in...
7,728
[ { "from": "human", "value": "I am re-factoring some code and am wondering about the use of a lock in the instance constructor.\npublic class MyClass {\n\n private static Int32 counter = 0;\n private Int32 myCount;\n\n public MyClass() {\n\n lock(this) {\n counter++;\n m...
While refactoring code and ridding myself of all those #defines that we're now taught to hate, I came across this beauty used to calculate the number of elements in a structure: #define STRUCTSIZE(s) (sizeof(s) / sizeof(*s)) Very useful as it is but can it be converted into an inline function or template? OK, ARRAYSIZ...
Yes, you can convert the `#define` macro `STRUCTSIZE` into a more type-safe inline function or template. However, since the original macro is intended to compute the size of an array, it's best to keep its purpose clear in the new implementation. Here’s how you can implement it in C++ using a template function: ### U...
9,057
[ { "from": "human", "value": "While refactoring code and ridding myself of all those #defines that we're now taught to hate, I came across this beauty used to calculate the number of elements in a structure:\n#define STRUCTSIZE(s) (sizeof(s) / sizeof(*s))\n\nVery useful as it is but can it be converted into ...
I use to run $s =~ s/[^[:print:]]//g; on Perl to get rid of non printable characters. In Python there's no POSIX regex classes, and I can't write [:print:] having it mean what I want. I know of no way in Python to detect if a character is printable or not. What would you do? EDIT: It has to support Unicode characte...
To achieve a similar functionality in Python to remove non-printable characters, including support for Unicode, you can define a function that checks if a character is printable using the built-in `str.isprintable()` method. This method is available in Python 3 and checks if a character is considered printable, meaning...
8,428
[ { "from": "human", "value": "I use to run\n$s =~ s/[^[:print:]]//g;\n\non Perl to get rid of non printable characters. \nIn Python there's no POSIX regex classes, and I can't write [:print:] having it mean what I want. I know of no way in Python to detect if a character is printable or not. \nWhat would you...
Is there any good alternative to ASpell? It's nice open source, but haven't been updated for a while. The performance is not too good and I am having trouble creating a custom worklist with non-alpha characters.
Yes, there are several good alternatives to ASpell that you might consider, especially if you're looking for more up-to-date options or improved performance. Here are a few notable ones: 1. **Hunspell**: This is one of the most popular spell checkers and is used by many applications, including LibreOffice and Mozilla ...
9,148
[ { "from": "human", "value": "Is there any good alternative to ASpell? It's nice open source, but haven't been updated for a while. The performance is not too good and I am having trouble creating a custom worklist with non-alpha characters.\n" }, { "from": "gpt", "value": "Yes, there are sever...
As the title says, how can I find the current operating system in python?
You can find the current operating system in Python using the `platform` module or the `os` module. Here are a couple of methods to achieve this: ### Method 1: Using the `platform` module The `platform` module provides a convenient way to get information about the operating system. ```python import platform # Get t...
8,490
[ { "from": "human", "value": "As the title says, how can I find the current operating system in python?\n" }, { "from": "gpt", "value": "You can find the current operating system in Python using the `platform` module or the `os` module. Here are a couple of methods to achieve this:\n\n### Method ...
How many lines of code can a .java file contain? Does it depend on the JVM being used?
There is no strict limit on the number of lines of code a `.java` file can contain imposed by the Java programming language itself. However, practical considerations and conventions suggest keeping the length of individual files manageable for readability and maintainability. ### Factors Influencing File Size: 1. **R...
8,187
[ { "from": "human", "value": "How many lines of code can a .java file contain? Does it depend on the JVM being used?\n" }, { "from": "gpt", "value": "There is no strict limit on the number of lines of code a `.java` file can contain imposed by the Java programming language itself. However, practi...
What does the volatile keyword do? In C++ what problem does it solve? In my case, I have never knowingly needed it.
In C++, the `volatile` keyword is used as a type qualifier that tells the compiler not to optimize certain variables. Specifically, it indicates that a variable can be changed by something outside the control of the code section in which it appears, such as hardware, other threads, or an interrupt service routine. ##...
6,865
[ { "from": "human", "value": "What does the volatile keyword do? In C++ what problem does it solve?\nIn my case, I have never knowingly needed it.\n" }, { "from": "gpt", "value": "In C++, the `volatile` keyword is used as a type qualifier that tells the compiler not to optimize certain variables....
A .container can contain many .components, and .components themselves can contain .containers (which in turn can contain .components etc. etc.) Given code like this: $(".container .component").each(function(){ $(".container", this).css('border', '1px solid #f00'); }); What do I need to add to the line within the bra...
To select only the nested `.containers` that have their CSS width set to `auto`, you can use the `filter` method in jQuery. Here's how you can modify your code: ```javascript $(".container .component").each(function() { $(".container", this).filter(function() { return $(this).css('width') === 'auto'; }).css('b...
9,327
[ { "from": "human", "value": "A .container can contain many .components, and .components themselves can contain .containers (which in turn can contain .components etc. etc.)\nGiven code like this:\n$(\".container .component\").each(function(){\n $(\".container\", this).css('border', '1px solid #f00');\n});\...
I want to create a box like this with title: Can any one please let me know if there is a default CSS tag to do this? Or do I need to create my custom style?
To create a styled box with a title, you can use a combination of HTML and CSS. There isn't a specific default CSS tag that does this exactly, so you will need to create a custom style. Below is an example of how you can achieve this: ### HTML ```html <div class="custom-box"> <h2 class="box-title">Your Title Here<...
7,630
[ { "from": "human", "value": "I want to create a box like this with title:\n\nCan any one please let me know if there is a default CSS tag to do this? Or do I need to create my custom style?\n" }, { "from": "gpt", "value": "To create a styled box with a title, you can use a combination of HTML an...
Question in the title. And what happens when all 3 of $_GET[foo], $_POST[foo] and $_COOKIE[foo] exist? Which one of them gets included to $_REQUEST?
In PHP, the `$_REQUEST` superglobal array is a merged array that combines the contents of `$_GET`, `$_POST`, and `$_COOKIE`. The order of precedence for the values in `$_REQUEST` is determined by the `request_order` directive in the `php.ini` configuration file, which controls the order in which `$_GET`, `$_POST`, and ...
8,042
[ { "from": "human", "value": "Question in the title.\nAnd what happens when all 3 of $_GET[foo], $_POST[foo] and $_COOKIE[foo] exist? Which one of them gets included to $_REQUEST?\n" }, { "from": "gpt", "value": "In PHP, the `$_REQUEST` superglobal array is a merged array that combines the conten...
Imagine this directory structure: app/ __init__.py sub1/ __init__.py mod1.py sub2/ __init__.py mod2.py I'm coding mod1, and I need to import something from mod2. How should I do it? I tried from ..sub2 import mod2, but I'm getting an "Attempted relative import in non-package". I google...
To successfully perform a relative import from `mod1.py` in `sub1` to `mod2.py` in `sub2`, you need to make sure you're running your code in a way that recognizes `app` as a package. Here's the correct approach: ### Directory Structure ```plaintext app/ __init__.py sub1/ __init__.py mod1.py sub2...
7,746
[ { "from": "human", "value": "Imagine this directory structure:\napp/\n __init__.py\n sub1/\n __init__.py\n mod1.py\n sub2/\n __init__.py\n mod2.py\n\nI'm coding mod1, and I need to import something from mod2. How should I do it?\nI tried from ..sub2 import mod2, but I'm getting an ...
The Visual Studio refactoring support for C# is quite good nowadays (though not half as good as some Java IDE's I've seen already) but I'm really missing C++ support. I have seen Refactor! and am currently trying it out, but maybe one of you guys know a better tool or plugin? I've been working with Visual Assist X no...
It's great to hear that you're finding Visual Assist X helpful for your C++ development in Visual Studio! While it is indeed one of the most popular tools for C++ refactoring and development assistance, there are a few other tools and plugins that you might find useful: 1. **ReSharper C++**: JetBrains offers a C++ ver...
6,971
[ { "from": "human", "value": "The Visual Studio refactoring support for C# is quite good nowadays (though not half as good as some Java IDE's I've seen already) but I'm really missing C++ support.\nI have seen Refactor! and am currently trying it out, but maybe one of you guys know a better tool or plugin?\...
I have a problem with IIS 6.0 ceasing to work for an ASP.NET application after installing Service Pack 1 for .NET 3.5. I have 2 identical virtual dedicated servers. Installing SP1 on the first had no adverse effect. Installing it on the second caused ASP.NET pages to start returning 404 page not found. Static .html pag...
It sounds like you're experiencing a specific issue related to the ASP.NET configuration on your IIS 6.0 server after installing .NET Framework 3.5 Service Pack 1. While some servers might be unaffected, others may run into configuration problems. Here are some steps you can take to troubleshoot and potentially resolve...
7,950
[ { "from": "human", "value": "I have a problem with IIS 6.0 ceasing to work for an ASP.NET application after installing Service Pack 1 for .NET 3.5.\nI have 2 identical virtual dedicated servers. Installing SP1 on the first had no adverse effect. Installing it on the second caused ASP.NET pages to start retu...
I am looking for a way to delete all files older than 7 days in a batch file. I've searched around the web, and found some examples with hundreds of lines of code, and others that required installing extra command line utilities to accomplish the task. Similar things can be done in BASH in just a couple lines of code....
Certainly! You can create a simple batch file to delete files older than 7 days using built-in Windows commands without any additional utilities or PowerShell. Here’s a straightforward example that should meet your needs: ```batch @echo off setlocal REM Set the directory where you want to delete files set "target_dir...
7,416
[ { "from": "human", "value": "I am looking for a way to delete all files older than 7 days in a batch file. I've searched around the web, and found some examples with hundreds of lines of code, and others that required installing extra command line utilities to accomplish the task.\nSimilar things can be do...
I am a little curious about the cute little kaleidoscopic images associated with each user on this site. How are those generated? Possibilities are: A list of images is already there in some folder and it is chosen randomly. The image is generated whenever a user registers. In any case, I am more interested in what ...
The cute kaleidoscopic images associated with users on various platforms can be generated using a couple of different methods, and the specifics can vary based on the design choices of the site. Here are the two main possibilities you mentioned: 1. **Pre-existing Images**: In this approach, a set of pre-defined kaleid...
8,412
[ { "from": "human", "value": "I am a little curious about the cute little kaleidoscopic images associated with each user on this site.\nHow are those generated? Possibilities are:\n\nA list of images is already there in some folder and it is chosen randomly.\nThe image is generated whenever a user registers....
I'm deploying to Ubuntu slice on slicehost, using Rails 2.1.0 (from gem) If I try mongrel_rails start or script/server I get this error: Rails requires RubyGems >= 0.9.4. Please install RubyGems When I type gem -v I have version 1.2.0 installed. Any quick tips on what to look at to fix?
It looks like you have RubyGems installed, but Rails is not detecting it properly. Here are a few steps you can take to troubleshoot and resolve this issue: 1. **Check Your Ruby Version**: Make sure you are using a compatible Ruby version for Rails 2.1.0. You can check your Ruby version with: ```bash ruby -v ...
5,511
[ { "from": "human", "value": "I'm deploying to Ubuntu slice on slicehost, using Rails 2.1.0 (from gem)\nIf I try mongrel_rails start or script/server I get this error:\n Rails requires RubyGems >= 0.9.4. Please install RubyGems\n\nWhen I type gem -v I have version 1.2.0 installed. Any quick tips on what to l...
I'm already using salted hashing to store passwords in my database, which means that I should be immune to rainbow table attacks. I had a thought, though: what if someone does get hold of my database? It contains the users' email addresses. I can't really hash these, because I'll be using them to send notification emai...
Yes, encrypting email addresses (and potentially other sensitive information) in your database is a good practice to help protect user data in the event of a database breach. Here are some important points to consider: 1. **Encryption vs. Hashing**: As you've noted, hashing is a one-way function typically used for pas...
8,474
[ { "from": "human", "value": "I'm already using salted hashing to store passwords in my database, which means that I should be immune to rainbow table attacks.\nI had a thought, though: what if someone does get hold of my database? It contains the users' email addresses. I can't really hash these, because I'...
Here is the problem I have: I have a lot (tens of thousands) of mp3 files that my users would like to be able to search. Is there is software out there that you've used or heard good things about that would allow me to index that content and put it in a database so I can search on it later?
Yes, there are several tools and software solutions available that can help you index and search through a large collection of MP3 files. Here are a few options to consider: 1. **Elasticsearch with a Plugin**: Elasticsearch is a powerful search engine that can handle large datasets efficiently. You can use it in combi...
6,531
[ { "from": "human", "value": "Here is the problem I have:\nI have a lot (tens of thousands) of mp3 files that my users would like to be able to search. Is there is software out there that you've used or heard good things about that would allow me to index that content and put it in a database so I can search...
I've been looking for a way to convert an mp3 to aac programmatically or via the command line with no luck. Ideally, I'd have a snippet of code that I could call from my rails app that converts an mp3 to an aac. I installed ffmpeg and libfaac and was able to create an aac file with the following command: ffmpeg -i te...
To convert MP3 files to AAC format programmatically or via the command line, you can use FFmpeg, which is a powerful multimedia framework. You're on the right track with your use of FFmpeg, but it seems like there may be a couple of issues with your command that could be affecting the output file. ### FFmpeg Command f...
6,435
[ { "from": "human", "value": "I've been looking for a way to convert an mp3 to aac programmatically or via the command line with no luck. Ideally, I'd have a snippet of code that I could call from my rails app that converts an mp3 to an aac. I installed ffmpeg and libfaac and was able to create an aac file...
From basic things likes page views per second to more advanced stuff like cpu or memory usage. Any ideas?
Certainly! Monitoring and analyzing performance metrics is crucial for understanding the health and efficiency of systems, applications, and services. Here are some basic and advanced metrics you can consider tracking: ### Basic Metrics 1. **Page Views Per Second (PV/s)**: - Tracks the number of views your web pag...
6,662
[ { "from": "human", "value": "From basic things likes page views per second to more advanced stuff like cpu or memory usage. Any ideas?\n" }, { "from": "gpt", "value": "Certainly! Monitoring and analyzing performance metrics is crucial for understanding the health and efficiency of systems, appli...
I need to provide statistics on how many lines of code (LOC) associated with a system. The application part is easy but I need to also include any code residing within the SQL Server database. This would apply to stored procedures, functions, triggers, etc. How can I easily get that info? Can it be done (accurately) w...
Yes, you can obtain the lines of code (LOC) for various database objects such as stored procedures, functions, and triggers in SQL Server using T-SQL. SQL Server stores metadata about these objects in its system views, which you can query to extract the code and then calculate the LOC. Here's how you can do it: 1. **...
6,010
[ { "from": "human", "value": "I need to provide statistics on how many lines of code (LOC) associated with a system. The application part is easy but I need to also include any code residing within the SQL Server database. This would apply to stored procedures, functions, triggers, etc. \nHow can I easily ge...
Does anyone know of any free tools that can assist in converting an SQL2005 database back to SQL2000 format? I know that you can script all the objects and then do a dump of the data, but this is a lot of work to do manually.
Converting a SQL Server 2005 database back to SQL Server 2000 can indeed be a bit challenging, as SQL Server 2005 introduced features that are not supported in SQL Server 2000. While there's no perfect tool for this specific task, here are a few approaches and tools that might help you: 1. **SQL Server Management Stud...
7,185
[ { "from": "human", "value": "Does anyone know of any free tools that can assist in converting an SQL2005 database back to SQL2000 format? I know that you can script all the objects and then do a dump of the data, but this is a lot of work to do manually.\n" }, { "from": "gpt", "value": "Convert...
How can I assign a keyboard shortcut to a VBA macro in Outlook 2007? I know how to create a tool for the macro and put it in a menu with an underscore shortcut. This solution requires me to use a shortcut of Alt + {menu key} + {tool key}. What if I want to assign it to Alt + F12 or something like that? The Visual Basic...
In Outlook 2007, assigning a custom keyboard shortcut like `Alt + F12` directly to a VBA macro is not supported by default through the standard user interface. However, there are workarounds that you can implement to achieve this. ### Method 1: Use a Form or Custom Ribbon 1. **Create a Custom Form or Ribbon:** Yo...
6,533
[ { "from": "human", "value": "How can I assign a keyboard shortcut to a VBA macro in Outlook 2007?\nI know how to create a tool for the macro and put it in a menu with an underscore shortcut. This solution requires me to use a shortcut of Alt + {menu key} + {tool key}. What if I want to assign it to Alt + F1...
In a drop down list, I need to add spaces in front of the options in the list. I am trying <select> <option>&#32;&#32;Sample</option> </select> for adding two spaces but it displays no spaces. How can I add spaces before option texts?
HTML and browsers typically collapse multiple spaces into a single space, which is why you're not seeing the intended spaces before the option text in the dropdown list. To create visual indentation in dropdown options, you can use the `padding` or `text-indent` CSS property. However, keep in mind that CSS properties ...
1,327
[ { "from": "human", "value": "In a drop down list, I need to add spaces in front of the options in the list. I am trying\n<select>\n<option>&#32;&#32;Sample</option>\n</select>\n\nfor adding two spaces but it displays no spaces. How can I add spaces before option texts?\n" }, { "from": "gpt", "va...
How do I call MySQL stored procedures from Perl? Stored procedure functionality is fairly new to MySQL and the MySQL modules for Perl don't seem to have caught up yet.
To call MySQL stored procedures from Perl, you can use the `DBI` (Database Interface) module, which is a standard way to interface with databases in Perl. Although stored procedures might be relatively new to MySQL, the DBI module allows you to execute them by sending a specific SQL command. Here's how you can do it: ...
6,319
[ { "from": "human", "value": "How do I call MySQL stored procedures from Perl? Stored procedure functionality is fairly new to MySQL and the MySQL modules for Perl don't seem to have caught up yet.\n" }, { "from": "gpt", "value": "To call MySQL stored procedures from Perl, you can use the `DBI` (...
How do I end a Tkinter program? Let's say I have this code: from Tkinter import * def quit(): # code to exit root = Tk() Button(root, text="Quit", command=quit).pack() root.mainloop() How should I define the quit function to exit my application?
To properly terminate a Tkinter application, you should use the `destroy()` method on the root window. This method will close the Tkinter window and end the main loop, allowing the program to exit cleanly. Here's how you can define the `quit()` function in your code: ```python from Tkinter import * def quit(): ro...
8,817
[ { "from": "human", "value": "How do I end a Tkinter program? Let's say I have this code:\nfrom Tkinter import *\n\ndef quit():\n # code to exit\n\nroot = Tk()\nButton(root, text=\"Quit\", command=quit).pack()\nroot.mainloop()\n\nHow should I define the quit function to exit my application?\n" }, { ...
In Java, I have a String and I want to encode it as a byte array (in UTF8, or some other encoding). Alternately, I have a byte array (in some known encoding) and I want to convert it into a Java String. How do I do these conversions?
In Java, you can easily convert a `String` to a byte array and vice versa using the `String` and `Charset` classes. Here are examples of how to encode a `String` to a byte array and how to decode a byte array back to a `String` using UTF-8 encoding. ### Encoding a String to a Byte Array To convert a `String` to a byt...
7,844
[ { "from": "human", "value": "In Java, I have a String and I want to encode it as a byte array (in UTF8, or some other encoding). Alternately, I have a byte array (in some known encoding) and I want to convert it into a Java String. How do I do these conversions?\n" }, { "from": "gpt", "value": "...
I have experienced an annoying issue with Visual Studio 2005... sometimes when I rebuild, and even if I do a Rebuild Solution, it will come back with no errors or warnings, but then when I later edit another code file, even without changing it, and rebuild, it will find an error or warning in that other file. Clearly,...
It sounds like you're encountering a common issue with Visual Studio's build system, where it doesn't always detect changes in files correctly, especially in older versions like Visual Studio 2005. Here are some steps you can take to ensure that every file gets recompiled: 1. **Clean and Rebuild**: - Before you do ...
3,952
[ { "from": "human", "value": "I have experienced an annoying issue with Visual Studio 2005... sometimes when I rebuild, and even if I do a Rebuild Solution, it will come back with no errors or warnings, but then when I later edit another code file, even without changing it, and rebuild, it will find an error...
How do you get all the classes in a namespace through reflection in C#?
In C#, you can use reflection to get all the classes within a specific namespace. The `Assembly` class provides methods to retrieve the types defined in it, and you can filter these types based on their namespace. Here's a step-by-step example: 1. Get the assembly that contains the types you want to inspect. This is ...
8,766
[ { "from": "human", "value": "How do you get all the classes in a namespace through reflection in C#?\n" }, { "from": "gpt", "value": "In C#, you can use reflection to get all the classes within a specific namespace. The `Assembly` class provides methods to retrieve the types defined in it, and y...