instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Occasionally a program on a Windows machine goes crazy and just hangs. So I'll call up the task manager and hit the "End Process" button for it. However, this doesn't always work; if I try it enough times then it'll usually die eventually, but I'd really like to be able to just kill it immediately. On Linux I could ...
In Windows, you can use the `taskkill` command in the Command Prompt to forcefully terminate processes, similar to using `kill -9` in Linux. This command allows you to specify the process you want to terminate, and you can use the `/F` flag to forcefully kill it. Here’s how you can do it: 1. **Open Command Prompt**: ...
17,608
[ { "from": "human", "value": "Occasionally a program on a Windows machine goes crazy and just hangs. So I'll call up the task manager and hit the \"End Process\" button for it. However, this doesn't always work; if I try it enough times then it'll usually die eventually, but I'd really like to be able to j...
We have a rather large object graph that needs to be serialized and deserialized in a lot of different ways (modes). In some modes we want certain properties to be deserialized and in some we don't. In future modes it might also be possible that there are more options for properties than yes or no. The problem is now h...
You’re grappling with a common challenge in designing flexible and maintainable serialization mechanisms, particularly when the object graph is complex and the serialization modes can vary significantly. Both of your approaches have their merits, but they also have drawbacks as you've identified. Here are some suggesti...
13,621
[ { "from": "human", "value": "We have a rather large object graph that needs to be serialized and deserialized in a lot of different ways (modes). In some modes we want certain properties to be deserialized and in some we don't. In future modes it might also be possible that there are more options for proper...
Do you have any tips for effective profiling using Netbeans? The profiler is quite nice and powerful. I've used it to find problems in some of my Eclipse RCP client applications. However, I get the feeling that I could get some more value out of it. Normally I set it to profile either all my classes (starting with xx...
Using the NetBeans Profiler can significantly enhance your application's performance, especially in the context of Eclipse RCP client applications. Here are some additional tips to maximize the effectiveness of your profiling efforts: ### 1. **Use CPU and Memory Profiling Together** - While you may primarily focus ...
12,946
[ { "from": "human", "value": "Do you have any tips for effective profiling using Netbeans?\nThe profiler is quite nice and powerful. I've used it to find problems in some of my Eclipse RCP client applications. However, I get the feeling that I could get some more value out of it.\nNormally I set it to prof...
I'm looking for a good ASP.NET RichTextBox component that integrates fairly easily with .NET Framework 3.5 Ajax, specifically one that can easily provide its values from inside an UpdatePanel. I got burned by RicherComponents RichTextBox which still does not reference the Framework 3.5. thanks!
When looking for a rich text editor component that works well with ASP.NET and .NET Framework 3.5, especially in conjunction with UpdatePanels for AJAX updates, you'll want to consider a few options. Here are some popular rich text editors that should meet your needs: ### 1. **CKEditor** - **Description:** CKEditor is...
13,760
[ { "from": "human", "value": "I'm looking for a good ASP.NET RichTextBox component that integrates fairly easily with .NET Framework 3.5 Ajax, specifically one that can easily provide its values from inside an UpdatePanel.\nI got burned by RicherComponents RichTextBox which still does not reference the Frame...
I wrote a short bash script to complete a task that involves creating a temporary directory and storing various files in it and performing various operations on it. In my first pass I just created the temp dir at /tmp/$$.$script", but then I tested the script on a computer where I didn't have write access to /tmp/, and...
When you're creating a temporary directory in a bash script, it's important to choose a location that is both writable and logical for the user running the script. Here are a few suggestions for alternative locations to consider for your temporary directory: 1. **Current Directory**: Using the current working director...
15,853
[ { "from": "human", "value": "I wrote a short bash script to complete a task that involves creating a temporary directory and storing various files in it and performing various operations on it.\nIn my first pass I just created the temp dir at /tmp/$$.$script\", but then I tested the script on a computer whe...
What are the access.log.* files?
The `access.log.*` files are typically log files used by web servers to record access requests made to the server. Each entry in these logs generally contains information about requests to the server, such as the IP address of the client, the timestamp of the request, the requested URL, the HTTP method used (GET, POST,...
16,307
[ { "from": "human", "value": "What are the access.log.* files?\n" }, { "from": "gpt", "value": "The `access.log.*` files are typically log files used by web servers to record access requests made to the server. Each entry in these logs generally contains information about requests to the server, ...
I'm using hibernate validator framework with Spring. A class implementing the Spring Validator validates objects with Hibernate's ClassValidator. To localize ClassValidator's error messages I need to pass a ResourceBundle into the class' constructor. My ApplicationCountext has a MessageSource bean (ReloadableResourceBu...
To convert a `MessageSource` (like `ReloadableResourceBundleMessageSource`) to a `ResourceBundle`, you would typically create a custom adapter since there is no built-in adapter in Spring that directly converts a `MessageSource` to a `ResourceBundle`. However, you can achieve this by creating a custom implementation of...
15,932
[ { "from": "human", "value": "I'm using hibernate validator framework with Spring. A class implementing the Spring Validator validates objects with Hibernate's ClassValidator. To localize ClassValidator's error messages I need to pass a ResourceBundle into the class' constructor. My ApplicationCountext has a...
I have a container div that holds two internal divs; both should take 100% width and 100% height within the container. I set both internal divs to 100% height. That works fine in Firefox, however in IE the divs do not stretch to 100% height but only the height of the text inside them. The following is a simplified vers...
The issue you're encountering with Internet Explorer (IE) stems from how it handles the height of elements and the `float` property. In particular, if the parent element's height is set to `auto`, the child elements with 100% height will not stretch as expected. Instead, they will only take the height of their content....
16,231
[ { "from": "human", "value": "I have a container div that holds two internal divs; both should take 100% width and 100% height within the container.\nI set both internal divs to 100% height. That works fine in Firefox, however in IE the divs do not stretch to 100% height but only the height of the text insid...
I get the following warning when using java.net.URLEncoder.encode: warning: [deprecation] encode(java.lang.String) in java.net.URLEncoder has been deprecated What should I be using instead?
The `java.net.URLEncoder.encode(String s)` method has been deprecated because it does not specify a character encoding scheme. It is recommended to use an overloaded version of the `encode` method that allows you to specify the character encoding explicitly. Instead of using: ```java String encodedString = URLEncoder...
21,368
[ { "from": "human", "value": "I get the following warning when using java.net.URLEncoder.encode:\nwarning: [deprecation] encode(java.lang.String)\n in java.net.URLEncoder has been deprecated\nWhat should I be using instead?\n" }, { "from": "gpt", "value": "The `java.net.URLEncoder.encode(...
I had developed an application in visual Studio 2005. whenever i run that application active directory locks domain my account. I really cant understand what am i doing wrong.
When an application is causing Active Directory to lock out your account, it typically means that the application is repeatedly trying to authenticate to the domain with invalid credentials. Here are some common reasons and steps you can take to troubleshoot the issue: ### Common Reasons for Account Lockout 1. **Inco...
18,260
[ { "from": "human", "value": "I had developed an application in visual Studio 2005. whenever i run that application active directory locks domain my account. I really cant understand what am i doing wrong.\n" }, { "from": "gpt", "value": "When an application is causing Active Directory to lock ou...
We are using ActiveMQ 5.2 as our implementation of choice and we picked it a while ago. It performs well enough for our use right now. Since its been a while, I was wondering what other Java Message Service implementations are in use and why? Surely there are more than a few.
Certainly! ActiveMQ 5.2 is quite an old version, and while it served well for many applications, there are now several other Java Message Service (JMS) implementations that might be worth considering. Here’s a list of some popular JMS implementations and a brief overview of why they are used: ### 1. **Apache ActiveMQ ...
15,551
[ { "from": "human", "value": "We are using ActiveMQ 5.2 as our implementation of choice and we picked it a while ago. It performs well enough for our use right now. Since its been a while, I was wondering what other Java Message Service implementations are in use and why? Surely there are more than a few....
I would like the fastest and most accurate function boolean isReachable(String host, int port) that passes the following JUnit tests under the conditions below. Timeout values are specified by the JUnit test itself, and may be considered "unreachable." Please note: All answers must be platform-independent. This means t...
To create a function `isReachable(String host, int port)` that meets the specified requirements and passes the JUnit tests, you can use a socket-based approach. This method involves attempting to open a socket connection to the specified host and port within a defined timeout. If the connection is successful, we consid...
18,759
[ { "from": "human", "value": "I would like the fastest and most accurate function boolean isReachable(String host, int port) that passes the following JUnit tests under the conditions below. Timeout values are specified by the JUnit test itself, and may be considered \"unreachable.\"\nPlease note: All answer...
What is the best way to divide a 32 bit integer into four (unsigned) chars in C#.
To divide a 32-bit integer into four unsigned bytes (or `byte` values) in C#, you can use bitwise operations. Each byte in a 32-bit integer can be extracted using right shifts and bitwise AND operations. Here's an example of how you can do this: ```csharp using System; class Program { static void Main() { ...
18,167
[ { "from": "human", "value": "What is the best way to divide a 32 bit integer into four (unsigned) chars in C#.\n" }, { "from": "gpt", "value": "To divide a 32-bit integer into four unsigned bytes (or `byte` values) in C#, you can use bitwise operations. Each byte in a 32-bit integer can be extra...
How can i release the memory that I used for a variable (e.g. a long string) in C?
In C, memory management is crucial since it allows you to control how memory is allocated and released, particularly when working with dynamic memory. If you allocate memory for a variable (like a long string) using functions like `malloc`, `calloc`, or `realloc`, you are responsible for freeing that memory when you ar...
18,229
[ { "from": "human", "value": "How can i release the memory that I used for a variable (e.g. a long string) in C?\n" }, { "from": "gpt", "value": "In C, memory management is crucial since it allows you to control how memory is allocated and released, particularly when working with dynamic memory. ...
This was a question raised by one of the Software Engineers in my organisation. I'm interested in the broadest definition.
It seems like you might have forgotten to include the specific question that was raised by the Software Engineer in your organization. Could you please provide the question or topic you're interested in? That way, I can give you the broadest definition or explanation related to it.
22,352
[ { "from": "human", "value": "This was a question raised by one of the Software Engineers in my organisation. I'm interested in the broadest definition.\n" }, { "from": "gpt", "value": "It seems like you might have forgotten to include the specific question that was raised by the Software Engine...
I'm wondering, how expensive it is to have many threads in waiting state in java 1.6 x64. To be more specific, I'm writing application which runs across many computers and sends/receives data from one to another. I feel more comfortable to have separate thread for each connected machine and task, like 1) sending data, ...
In Java, especially in version 1.6, having a large number of threads can lead to various performance implications, even if many of those threads are in a waiting or sleeping state. Here are some considerations regarding the use of threads in your application: ### Memory Overhead 1. **Thread Stack Size**: Each thread ...
9,829
[ { "from": "human", "value": "I'm wondering, how expensive it is to have many threads in waiting state in java 1.6 x64.\nTo be more specific, I'm writing application which runs across many computers and sends/receives data from one to another. I feel more comfortable to have separate thread for each connecte...
I have been reading a lot of XQuery tutorials on the website. Almost all of them are teaching me XQuery syntax. Let's say I have understood the XQuery syntax, how am I going to actually implement XQuery on my website? For example, I have book.xml: <?xml version="1.0" encoding="iso-8859-1" ?> <books> <book> <title>Do...
To implement XQuery in your website and generate HTML based on your XML data, you'll typically follow these steps: 1. **Set Up an XQuery Processor**: You'll need a way to execute XQuery code. Some common XQuery processors include BaseX, Saxon, and eXist-db. You can choose one depending on your project needs. 2. **Cre...
12,393
[ { "from": "human", "value": "I have been reading a lot of XQuery tutorials on the website. Almost all of them are teaching me XQuery syntax. Let's say I have understood the XQuery syntax, how am I going to actually implement XQuery on my website?\nFor example, I have book.xml:\n<?xml version=\"1.0\" encodin...
We maintain a system that has over a million lines of COBOL code. Does someone have suggestions about how to migrate to a GUI (probably Windows based) without losing all the business logic we have written in COBOL? And yes, some of the business logic is buried inside the current user interface.
Migrating a legacy COBOL system with significant business logic embedded in its current user interface to a modern GUI environment is a complex task, but it can be accomplished with careful planning and execution. Here are some suggestions to help guide the process: ### 1. Analyze and Document Existing Code - **Unders...
14,407
[ { "from": "human", "value": "We maintain a system that has over a million lines of COBOL code. Does someone have suggestions about how to migrate to a GUI (probably Windows based) without losing all the business logic we have written in COBOL? And yes, some of the business logic is buried inside the current...
We want to try Ext JS on new project. Is there any well-known best practice for integrating Ext JS with server side Java (Spring/Hibernate/JS) application? Is DWR a good choice for that?
Integrating Ext JS with a server-side Java application, especially when using frameworks like Spring and Hibernate, can be quite effective if done properly. Here are some well-known best practices and approaches for integrating these technologies: ### Best Practices for Integrating Ext JS with Java (Spring/Hibernate) ...
11,436
[ { "from": "human", "value": "We want to try Ext JS on new project. Is there any well-known best practice for integrating Ext JS with server side Java (Spring/Hibernate/JS) application? Is DWR a good choice for that?\n" }, { "from": "gpt", "value": "Integrating Ext JS with a server-side Java appl...
I want to use an image or icon as a custom cursor in WPF app. How can I do that?
In a WPF application, you can create a custom cursor using an image or icon by creating a cursor from a bitmap or drawing and then setting that cursor to your window or specific controls. Here’s how to do it step by step: ### Step 1: Add the Image to Your Project 1. First, add the image (PNG, JPEG, or ICO) that you w...
12,649
[ { "from": "human", "value": "I want to use an image or icon as a custom cursor in WPF app. How can I do that?\n" }, { "from": "gpt", "value": "In a WPF application, you can create a custom cursor using an image or icon by creating a cursor from a bitmap or drawing and then setting that cursor to...
I need a way to update the month value on a dateTime field in my db. I'm being past an int value for the month and need to use that for the update. Is it possible to do this in the sql statement or would I be best doing it in c# in the webservice?
You can definitely update the month value of a `DateTime` field directly in SQL, but you will need to ensure that your logic handles the overflow correctly (e.g., if you update from January to February, you should be careful with the day values). Here's how you could do it in SQL: ### SQL Update Example Assuming yo...
14,663
[ { "from": "human", "value": "I need a way to update the month value on a dateTime field in my db. I'm being past an int value for the month and need to use that for the update. \nIs it possible to do this in the sql statement or would I be best doing it in c# in the webservice?\n" }, { "from": "gpt"...
Right now, my SVN repository is on my laptop's HDD (although I use a code hosting service for more "critical" personal projects) and I just copy the directory over on a weekly basis (which will eventually be scripted or perhaps I'll make an app for the hell of it). Am I at risk for corrupting my SVN repository? So far,...
Using an SVN (Subversion) repository locally on your laptop's HDD and periodically copying it to a different location can present some risks, but whether you are at risk of corruption largely depends on how you are performing the copy and the underlying health of your storage media. Here are some considerations to keep...
16,797
[ { "from": "human", "value": "Right now, my SVN repository is on my laptop's HDD (although I use a code hosting service for more \"critical\" personal projects) and I just copy the directory over on a weekly basis (which will eventually be scripted or perhaps I'll make an app for the hell of it). Am I at ris...
I have created a user control to handle adding comments to certain business entities, like contacts and customers. Works great ... except for one issue. I am using a ListView control to edit and delete comments, and a separate area, on the same user control to add a new comment. All of this is wrapped in an UpdatePan...
To prevent the issue of duplicate comments being created upon refreshing the browser after a new comment has been added, you can implement the following strategies: ### 1. Use a Confirmation Mechanism Instead of directly submitting the comment when the user clicks the "Add Comment" button, you can show a confirmation...
16,417
[ { "from": "human", "value": "I have created a user control to handle adding comments to certain business entities, like contacts and customers. Works great ... except for one issue.\nI am using a ListView control to edit and delete comments, and a separate area, on the same user control to add a new commen...
I'm trying to use boost::signal to implement a callback mechanism, and I'm getting a memory access assert in the boost::signal code on even the most trivial usage of the library. I have simplified it down to this code: #include <boost/signal.hpp> typedef boost::signal<void (void)> Event; int main(int argc, char* argv...
It looks like you are experiencing a memory access issue with `boost::signal` in your code. First, I would recommend checking the following: 1. **Library Linking**: Ensure that you are correctly linking against the `boost_signals` library in your project settings. Since `boost::signal` is not a header-only library, yo...
18,724
[ { "from": "human", "value": "I'm trying to use boost::signal to implement a callback mechanism, and I'm getting a memory access assert in the boost::signal code on even the most trivial usage of the library. I have simplified it down to this code:\n#include <boost/signal.hpp>\n\ntypedef boost::signal<void (...
I'm on a Hardy Heron Ubuntu build, BTW.
That's great! Ubuntu Hardy Heron (8.04 LTS) is quite an old release, having been launched in April 2008. If you're running it, you might encounter some challenges, especially in terms of software compatibility, security, and updates, as it reached its end of life in 2013. Is there something specific you need help with...
21,500
[ { "from": "human", "value": "I'm on a Hardy Heron Ubuntu build, BTW.\n" }, { "from": "gpt", "value": "That's great! Ubuntu Hardy Heron (8.04 LTS) is quite an old release, having been launched in April 2008. If you're running it, you might encounter some challenges, especially in terms of softwar...
This may not be strictly programming related but more OS-structure related. Running Vista 32 bit on a brand new laptop with 3GB of memory, Running idle the system consumes about 40% of its memory. Other then the fact that this is outrageous on its own right, the OS should be able to fit all of the processes nicely into...
The behavior you're observing can be explained by understanding how modern operating systems, including Windows Vista, manage memory. Even when there is sufficient physical memory available, several factors can lead to page faults. 1. **Virtual Memory Management**: Windows (and many other operating systems) uses a con...
17,497
[ { "from": "human", "value": "This may not be strictly programming related but more OS-structure related.\nRunning Vista 32 bit on a brand new laptop with 3GB of memory, Running idle the system consumes about 40% of its memory. Other then the fact that this is outrageous on its own right, the OS should be ab...
After following the instructions in INSTALL.W64 I have two problems: The code is still written to the "out32" folder. I need to be able to link to both 32-bit and 64-bit versions of the library on my workstation, so I don't want the 64-bit versions to clobber the 32-bit libs. The output is still 32-bit! This means tha...
To resolve the issues you're experiencing with building the 64-bit version of the library and outputting to the correct folder, follow these steps: ### 1. Specify the Output Directory First, ensure that you're correctly specifying the output directory for the 64-bit build in your build scripts or project settings. Yo...
13,749
[ { "from": "human", "value": "After following the instructions in INSTALL.W64 I have two problems:\n\nThe code is still written to the \"out32\" folder. I need to be able to link to both 32-bit and 64-bit versions of the library on my workstation, so I don't want the 64-bit versions to clobber the 32-bit lib...
I do not currently have this issue, but you never know, and thought experiments are always fun. Ignoring the obvious problems that you would have to have with your architecture to even be attempting this, let's assume that you had some horribly-written code of someone else's design, and you needed to do a bunch of wide...
When dealing with poorly written code and numerous operations that may throw exceptions, having a method to gracefully handle potential errors can be quite beneficial. While C# doesn't have a direct equivalent to "on error resume next", you can implement a centralized approach to handle exceptions for a block of code. ...
16,182
[ { "from": "human", "value": "I do not currently have this issue, but you never know, and thought experiments are always fun.\nIgnoring the obvious problems that you would have to have with your architecture to even be attempting this, let's assume that you had some horribly-written code of someone else's de...
For intense number-crunching i'm considering using fixed point instead of floating point. Of course it'll matter how many bytes the fixed point type is in size, on what CPU it'll be running on, if i can use (for Intel) the MMX or SSE or whatever new things come up... I'm wondering if these days when floating point run...
When considering whether to use fixed-point arithmetic instead of floating-point on modern CPUs, it's essential to take into account several factors, including the nature of your computations, the target architecture, and the specific application domain. Here’s a high-level overview of the performance considerations an...
14,769
[ { "from": "human", "value": "For intense number-crunching i'm considering using fixed point instead of floating point. Of course it'll matter how many bytes the fixed point type is in size, on what CPU it'll be running on, if i can use (for Intel) the MMX or SSE or whatever new things come up...\nI'm wonde...
I am on a committee that would benefit from an online application that allows the members to collaborate w/ members. I would want the ability to post messages and upload documents. Is there any free, easy to install on your server apps that you would suggest?
There are several free and open-source applications that can facilitate collaboration among committee members through messaging and document sharing. Here are some options that you might find useful and relatively easy to install on your server: 1. **Nextcloud**: - **Overview**: Nextcloud is a powerful file-sharing...
16,929
[ { "from": "human", "value": "I am on a committee that would benefit from an online application that allows the members to collaborate w/ members.\nI would want the ability to post messages and upload documents.\nIs there any free, easy to install on your server apps that you would suggest?\n" }, { "...
How can I capture enter keypresses anywhere on my form and force it to fire the submit button event?
To capture Enter keypresses anywhere on a form and trigger the submit button event, you can use JavaScript to listen for keypress events and check if the pressed key is the Enter key. If it is, you can then programmatically trigger the form submission. Below are examples in plain JavaScript and jQuery. ### Using Plain...
16,277
[ { "from": "human", "value": "How can I capture enter keypresses anywhere on my form and force it to fire the submit button event?\n" }, { "from": "gpt", "value": "To capture Enter keypresses anywhere on a form and trigger the submit button event, you can use JavaScript to listen for keypress eve...
Let me first say, we validate every field on the server side, so this a question about client-side usability. What is the conventional wisdom on exactly when to validate and format html form input fields using javascript? As an example, we have a phone number field. We allow numbers, spaces, parentheses, and hyphens. ...
When it comes to client-side usability for form input fields like a phone number, there's a balance to strike between providing a smooth user experience and ensuring valid input. Here’s a general overview of the conventional wisdom regarding when to validate and format form inputs, specifically for a phone number field...
12,217
[ { "from": "human", "value": "Let me first say, we validate every field on the server side, so this a question\nabout client-side usability.\nWhat is the conventional wisdom on exactly when to validate and format html form input fields using javascript?\nAs an example, we have a phone number field. We allow...
I have the following template <h2>one</h2> <xsl:apply-templates select="one"/> <h2>two</h2> <xsl:apply-templates select="two"/> <h2>three</h2> <xsl:apply-templates select="three"/> I would like to only display the headers (one,two,three) if there is at least one member of the corresponding template. How do I check for...
To conditionally display headers based on whether there are members of the corresponding template in XSLT, you can use the `count()` function to check if there are any nodes that match your criteria. If the count is greater than zero, you can display the header and apply the templates. Here's an example of how you mig...
18,400
[ { "from": "human", "value": "I have the following template\n<h2>one</h2>\n<xsl:apply-templates select=\"one\"/>\n<h2>two</h2>\n<xsl:apply-templates select=\"two\"/>\n<h2>three</h2>\n<xsl:apply-templates select=\"three\"/>\n\nI would like to only display the headers (one,two,three) if there is at least one m...
in sharepoint webservices, I can use getListItems() to obtain the child elements of a list. In a document library, sometimes the element is a folder. "ows_FSObjType = 1" Is there any way to ask SP for the child elements of this folder? Querying with getListItems() using the folder ID gives me a SOAP Exception. Edit: ...
In SharePoint web services, when working with document libraries, the `getListItems()` method is indeed commonly used to retrieve items from a list. If you encounter a folder (identified by `ows_FSObjType = 1`), retrieving its contents requires a slightly different approach, since it is essentially a sub-list within th...
15,213
[ { "from": "human", "value": "in sharepoint webservices, I can use getListItems() to obtain the child elements of a list.\nIn a document library, sometimes the element is a folder. \n\"ows_FSObjType = 1\"\n\nIs there any way to ask SP for the child elements of this folder?\nQuerying with getListItems() using...
Is the standard Java 1.6 javax.xml.parsers.DocumentBuilder class thread safe? Is it safe to call the parse() method from several threads in parallel? The JavaDoc doesn't mention the issue, but the JavaDoc for the same class in Java 1.4 specifically says that it isn't meant to be concurrent; so can I assume that in 1.6 ...
The `javax.xml.parsers.DocumentBuilder` class is not thread-safe. This means that it is not safe to call the `parse()` method from multiple threads in parallel using the same `DocumentBuilder` instance. In Java 1.4, the documentation explicitly stated that `DocumentBuilder` instances are not meant to be used concurren...
20,000
[ { "from": "human", "value": "Is the standard Java 1.6 javax.xml.parsers.DocumentBuilder class thread safe? Is it safe to call the parse() method from several threads in parallel?\nThe JavaDoc doesn't mention the issue, but the JavaDoc for the same class in Java 1.4 specifically says that it isn't meant to b...
Put differently: Is there a good reason to choose a loosely-typed collection over a type-safe one (HashTable vs. Dictionary)? Are they still there only for compatibility? As far as I understand, generic collections not only are type-safe, but their performance is better. Here's a comprehensive article on the topic: An...
You're correct in noting that generic collections in C#, such as `Dictionary<TKey, TValue>`, are type-safe and typically offer better performance compared to their non-generic counterparts, like `Hashtable`. Here's a breakdown of why one might still choose a loosely-typed collection over a type-safe one, as well as som...
16,539
[ { "from": "human", "value": "Put differently:\nIs there a good reason to choose a loosely-typed collection over a type-safe one (HashTable vs. Dictionary)? Are they still there only for compatibility?\nAs far as I understand, generic collections not only are type-safe, but their performance is better.\n\nHe...
It seems like a standard requirement: next time the user launches the application, open the window in the same position and state as it was before. Here's my wish list: Window position same as it was Unless the screen has resized and the old position is now off screen. Splitters should retain their position Tab con...
It sounds like you are looking to implement a robust session management feature for your application. This is a common requirement for desktop applications to enhance user experience. Below, I’ll summarize your wish list along with some potential strategies you could employ to implement each feature effectively. ### ...
15,913
[ { "from": "human", "value": "It seems like a standard requirement: next time the user launches the application, open the window in the same position and state as it was before. Here's my wish list:\n\nWindow position same as it was\n\n\nUnless the screen has resized and the old position is now off screen.\n...
we're have a client that needs to get interactive messages from a server, from clients that are distributed around the world behind all kinds of firewalls with all kinds of ports closed. The only thing we can rely on is HTTP port 80 (and HTTPS 443). The design is basically modeled after XMPP (the Jabber protocol), usin...
It sounds like you're encountering several issues related to the handling of long-lived HTTP connections with IIS on a Windows Server 2003 environment. Here are some areas you could investigate to improve your implementation: ### 1. **Increase Connection Limits** IIS has a default limit on the number of simultaneous c...
14,489
[ { "from": "human", "value": "we're have a client that needs to get interactive messages from a server, from clients that are distributed around the world behind all kinds of firewalls with all kinds of ports closed. The only thing we can rely on is HTTP port 80 (and HTTPS 443).\nThe design is basically mode...
I've run across this sort of thing on multiple websites and was wondering what it was called, does anyone know? Here's a screenshot.
It seems you're referring to an image or a screenshot, but I can't view images directly. If you describe the content or the type of thing you see in the screenshot, I might be able to help you identify it! Common elements could include infographics, charts, memes, or UI components, among others. Let me know more detail...
22,235
[ { "from": "human", "value": "I've run across this sort of thing on multiple websites and was wondering what it was called, does anyone know? Here's a screenshot.\n" }, { "from": "gpt", "value": "It seems you're referring to an image or a screenshot, but I can't view images directly. If you descr...
The .Net generated code for a form with the "DefaultButton" attribute set contains poor javascript that allows the functionality to work in IE but not in other browsers (Firefox specifcially). Hitting enter key does submit the form with all browsers but Firefox cannot disregard the key press when it happens inside of ...
To work around the issue of the Enter key submitting the form in Firefox when you are focused on a `<textarea>` in an ASP.NET 2.0 application, you can prevent the default form submission behavior when the Enter key is pressed within the `<textarea>` element. This can be accomplished using JavaScript or jQuery. ### Lig...
17,711
[ { "from": "human", "value": "The .Net generated code for a form with the \"DefaultButton\" attribute set contains poor javascript that allows the functionality to work in IE but not in other browsers (Firefox specifcially). \nHitting enter key does submit the form with all browsers but Firefox cannot disreg...
One of the vagaries of my development system (Codegear C++Builder) is that some of the auto-generated headers insist on having... using namespace xyzzy ...statements in them, which impact on my code when I least want or expect it. Is there a way I can somehow cancel/override a previous "using" statement to avoid this...
In C++, there is no direct way to "cancel" or "override" a `using` directive once it has been declared. The language does not provide a mechanism like `ununusing` or anything similar. However, there are a few strategies you can use to mitigate the issues caused by unwanted `using` statements in your generated headers. ...
16,867
[ { "from": "human", "value": "One of the vagaries of my development system (Codegear C++Builder) is that some of the auto-generated headers insist on having... \nusing namespace xyzzy\n\n...statements in them, which impact on my code when I least want or expect it.\nIs there a way I can somehow cancel/overri...
Does anybody know of an up to date tutorial on using Ajax with ASP.net MVC? Most of what I can find seems to talk about older versions of MVC and I suspect that this is an area where there has been a lot of change of late.
Yes, using Ajax with ASP.NET MVC is a common practice, and while many tutorials exist, it's essential to look for updated resources that reflect the latest practices. Here’s a brief overview of how to use Ajax with ASP.NET MVC, along with some resources for in-depth tutorials. ### Basic Steps to Use Ajax with ASP.NET ...
17,259
[ { "from": "human", "value": "Does anybody know of an up to date tutorial on using Ajax with ASP.net MVC? Most of what I can find seems to talk about older versions of MVC and I suspect that this is an area where there has been a lot of change of late. \n" }, { "from": "gpt", "value": "Yes, usi...
I need to call an external dll from c#. This is the header definition: enum WatchMode { WATCH_MODE_SYSTEM = 0, WATCH_MODE_APPLICATION = 1 }; LONG ADS_API WDT_GetMode ( LONG i_hHandle, WatchMode * o_pWatchMode ); I've added the enum and the call in C#: public enum WatchMode { WATCH_MODE_SYSTEM ...
When working with P/Invoke in C# to call external DLL functions, especially when passing parameters by reference, it's important to ensure that the calling conventions and data types are compatible between C# and the native code. Given the information you've provided, let's address a few common causes for the `AccessVi...
17,267
[ { "from": "human", "value": "I need to call an external dll from c#. This is the header definition:\nenum WatchMode { \n WATCH_MODE_SYSTEM = 0, \n WATCH_MODE_APPLICATION = 1 }; \n\nLONG ADS_API WDT_GetMode ( LONG i_hHandle, WatchMode * o_pWatchMode );\n\nI've added the enum and the call in C#...
How can I figure out, how many files needs to be recompiled before I start the build process. Sometimes I don't remember how many basic header files I changed so a Rebuild All would be better than a simple build. There seams to be no option for this, but IMHO it must be possible (f.e. XCode give me this information). U...
In Visual Studio, there isn't a direct built-in feature that will show you exactly how many files will be recompiled before you start a build process. However, there are some strategies you can use to determine the potential impact of your changes and estimate whether a quick test build or a full rebuild is appropriate...
2,877
[ { "from": "human", "value": "How can I figure out, how many files needs to be recompiled before I start the build process.\nSometimes I don't remember how many basic header files I changed so a Rebuild All would be better than a simple build. There seams to be no option for this, but IMHO it must be possibl...
I have an ASP .NET 2.0 website connected to a SQL Server 2005 database. The site is pretty simple and stores information about staff, including salary. What is the best way to encrypt the salary value so no-one (including myself) can ever see what it is, except for the authorised staff using the web-app? I don't want ...
To secure sensitive information like salary in your ASP.NET 2.0 web application while using SQL Server 2005, you will indeed want to handle encryption and decryption on the web server (in your Business Logic Layer - BLL). Here’s a structured approach to achieve this: ### 1. Encryption/Decryption on the Web Server You...
15,136
[ { "from": "human", "value": "I have an ASP .NET 2.0 website connected to a SQL Server 2005 database. The site is pretty simple and stores information about staff, including salary. \nWhat is the best way to encrypt the salary value so no-one (including myself) can ever see what it is, except for the authori...
I know we cannot do this at class level but at method level we can always do this. var myList=new List<string> // or something else like this This question came to my mind since wherever we declare variable like this. We always provide the type information at the RHS of the expression. So compiler doesn't need to do...
In C#, variable declarations and initializations can indeed be done with and without explicit types, but there are specific rules regarding where and how this can occur—particularly in relation to class-level (or field-level) and method-level variables. ### Class-Level Variables At the class level, you must explicitl...
17,814
[ { "from": "human", "value": "I know we cannot do this at class level but at method level we can always do this. \nvar myList=new List<string> // or something else like this\n\nThis question came to my mind since wherever we declare variable like this. We always provide the type information at the RHS of the...
I am creating an XLS worksheet that would be used to collect data from the users. I have restricted the user input using validations. In order to easily be able to print the worksheet i have set the lenghts of the columns. Have made the relevant columns wrap. However i would like to protect the worksheet such that User...
To achieve your desired functionality in an Excel worksheet, you'll need to carefully set up cell formatting and protection settings. Here's a step-by-step guide to help you accomplish this: ### Step 1: Set Up Your Worksheet 1. **Enter Data Validations**: First, create your drop-down lists and any data validation rule...
16,153
[ { "from": "human", "value": "I am creating an XLS worksheet that would be used to collect data from the users. I have restricted the user input using validations. In order to easily be able to print the worksheet i have set the lenghts of the columns. Have made the relevant columns wrap.\nHowever i would li...
When developing a module (device driver, middleware, etc...) that will run in the kernel space, we would like to have some way to capture the reason an operation might fail. In VxWorks, The errno mechanism seems to be a good way to do this. Is it possible to define my own errno values?
In VxWorks, you can indeed define your own error values that can be used in a manner similar to the standard `errno` mechanism. However, the approach to do this depends on your specific version of VxWorks and the context in which you are working. To define custom error codes, you typically follow these steps: 1. **Ch...
18,570
[ { "from": "human", "value": "When developing a module (device driver, middleware, etc...) that will run in the kernel space, we would like to have some way to capture the reason an operation might fail. \nIn VxWorks, The errno mechanism seems to be a good way to do this.\nIs it possible to define my own err...
did anyone tried monitoring memcached statistics with openNMS? If you did, what did you use?
Yes, monitoring Memcached statistics with OpenNMS is possible, and there are various approaches you can take to achieve this. Here are some common methods: 1. **SNMP Monitoring**: If you have Memcached configured to expose its statistics via SNMP, you can set up OpenNMS to monitor these SNMP OIDs. To do this, you may ...
15,120
[ { "from": "human", "value": "did anyone tried monitoring memcached statistics with openNMS?\nIf you did, what did you use?\n" }, { "from": "gpt", "value": "Yes, monitoring Memcached statistics with OpenNMS is possible, and there are various approaches you can take to achieve this. Here are some ...
Between Eclipse/SWT or Netbeans/Matisse, what does either Java GUI editor give you in terms of rapid development and maintainability?
Both Eclipse/SWT and NetBeans/Matisse are popular tools for developing Java GUI applications, and they each provide unique features that contribute to rapid development and maintainability. Here's a comparison of the two in these contexts: ### Eclipse/SWT **Rapid Development:** 1. **Rich Client Platform (RCP):** Ecli...
12,651
[ { "from": "human", "value": "Between Eclipse/SWT or Netbeans/Matisse, what does either Java GUI editor give you in terms of rapid development and maintainability?\n" }, { "from": "gpt", "value": "Both Eclipse/SWT and NetBeans/Matisse are popular tools for developing Java GUI applications, and th...
In my work I deal mostly with C# code nowadays, with a sprinkle of java from time to time. What I absolutely love about Eclipse (and I know people using it daily love it even more) is a sophisticated code formatter, able to mould code into any coding standard one might imagine. Is there such a tool for C#? Visual Studi...
For C#, there are several tools that can help you achieve the sophisticated code formatting capabilities you're looking for, including running from the console and being configurable via text files. Here are a few options to consider: ### 1. **dotnet-format** - **Overview**: A command-line tool that formats C# code ba...
11,336
[ { "from": "human", "value": "In my work I deal mostly with C# code nowadays, with a sprinkle of java from time to time. What I absolutely love about Eclipse (and I know people using it daily love it even more) is a sophisticated code formatter, able to mould code into any coding standard one might imagine. ...
I'm trying to make things simpler. Here is my code: If Threading.Monitor.TryEnter(syncRoot) Then Try 'do something Finally Threading.Monitor.Exit(syncRoot) End Try Else 'do something else End If This is even worse than the ReaderWriterLock in terms of...
To simplify your code and reduce noise while still achieving the same locking behavior, you can consider using `lock` in C# or `SyncLock` in VB.NET. Both of these constructs provide a cleaner syntax for handling synchronization. They automatically handle acquiring and releasing the lock, which reduces the boilerplate c...
19,085
[ { "from": "human", "value": "I'm trying to make things simpler. Here is my code:\n If Threading.Monitor.TryEnter(syncRoot) Then\n Try\n 'do something\n Finally\n Threading.Monitor.Exit(syncRoot)\n End Try\n Else\n 'do something else\n End If\n\nThis...
How do I go about programmatically updating the FILEVERSION string in an MFC app? I have a build process that I use to generate a header file which contains the SVN rev for a given release. I'm using SvnRev from http://www.compuphase.com/svnrev.htm to update a header file which I use to set the caption bar of my MFC ap...
To programmatically update the `FILEVERSION` string in your MFC application and utilize the SVN revision information from your header file, you'll want to follow these steps: 1. **Create/Update a Header File**: Use your existing build process with `svnrev` to generate a header file (let's call it `VersionInfo.h`) t...
10,123
[ { "from": "human", "value": "How do I go about programmatically updating the FILEVERSION string in an MFC app? I have a build process that I use to generate a header file which contains the SVN rev for a given release. I'm using SvnRev from http://www.compuphase.com/svnrev.htm to update a header file which ...
How do I register a custom protocol with Windows so that when clicking a link in an email or on a web page my application is opened and the parameters from the URL are passed to it?
To register a custom protocol with Windows, you need to modify the Windows Registry. This will allow your application to be opened when a user clicks a link with that custom protocol. Here’s a step-by-step guide on how to do this: ### Step 1: Choose a Custom Protocol Name Decide on a unique protocol name that will no...
12,320
[ { "from": "human", "value": "How do I register a custom protocol with Windows so that when clicking a link in an email or on a web page my application is opened and the parameters from the URL are passed to it?\n" }, { "from": "gpt", "value": "To register a custom protocol with Windows, you need...
I have a "numeric textbox" in C# .NET which is nothing more than a derivation of Textbox, with some added logic to prevent the user entering anything non-numeric. As part of this, I have added a Value property of type double? (or Nullable<double>). It's nullable to support the case where the user doesn't enter anything...
This issue arises because the Windows Forms designer doesn't handle `Nullable<T>` types very well when initializing properties. Specifically, it seems to have trouble converting a default integer value (like `1`) into a `Nullable<double>`. Here are some approaches you can consider to work around the problem: ### 1. C...
18,007
[ { "from": "human", "value": "I have a \"numeric textbox\" in C# .NET which is nothing more than a derivation of Textbox, with some added logic to prevent the user entering anything non-numeric. As part of this, I have added a Value property of type double? (or Nullable<double>). It's nullable to support the...
My Apache server runs on some non-default (not-root) account. When it tries to run a python script which in turn executes a subversion check-out command, 'svn checkout' fails with the following error message: svn: Can't open file '/root/.subversion/servers': Permission denied At the same time running that python scrip...
The issue you're encountering stems from the fact that the Apache server runs with a different user account than your command line user, which is likely why you're seeing the "Permission denied" error for the `svn checkout` command when executed through the Apache server. When the command is run from the command line,...
14,753
[ { "from": "human", "value": "My Apache server runs on some non-default (not-root) account. When it tries to run a python script which in turn executes a subversion check-out command, 'svn checkout' fails with the following error message:\nsvn: Can't open file '/root/.subversion/servers': Permission denied\n...
Subversion is a great way to update our web applications on our servers. With a simple svn update all changed files get... well, changed. Except for the omnipresent configuration files such as config.php which hold the database access configuration, server paths etc. And are therefore different on my local development ...
You are facing a common challenge when using version control systems like Subversion (SVN) for web applications, especially when dealing with environment-specific configuration files. Here are a few approaches you can consider to manage your configuration files without resorting to setting them as svn:ignore: ### 1. *...
19,050
[ { "from": "human", "value": "Subversion is a great way to update our web applications on our servers. With a simple svn update all changed files get... well, changed.\nExcept for the omnipresent configuration files such as config.php which hold the database access configuration, server paths etc. And are th...
I'm using the mockrunner package from http://mockrunner.sourceforge.net/ to set up a mock queue for JUnit testing an XML filter which operates like this: sets recognized properties for an ftp server to put and get xml input and a jms queue server that keeps track of jobs. Remotely there waits a server that actually pa...
To set up a mock queue and an FTP server for your JUnit tests using the MockRunner package, you can follow the steps outlined below. This will help you create a local environment to test your XML filter without the need for EJB or JNDI. ### Step 1: Setup Dependencies Ensure that you have the MockRunner package and an...
13,723
[ { "from": "human", "value": "I'm using the mockrunner package from http://mockrunner.sourceforge.net/ to set up a mock queue for JUnit testing an XML filter which operates like this:\n\nsets recognized properties for an ftp server to put and get xml input and a jms queue server that keeps track of jobs. Rem...
What are your disaster recovery plans for Windows Sharepoint Services 3.0 ? Currently we are backuping all databases (1 content, admin, search and config) using sql backup tools, and backuping the front end server via dataprotector. To test our backups, we use another server farm, restore the content database (followin...
Your disaster recovery plan for Windows SharePoint Services 3.0 (WSS 3.0) is on the right track, but there are a few considerations to keep in mind regarding reliability, supported scenarios, and best practices. Here's a breakdown of your approach and some recommendations: ### Backup Strategy 1. **Database Backups**: ...
16,083
[ { "from": "human", "value": "What are your disaster recovery plans for Windows Sharepoint Services 3.0 ?\nCurrently we are backuping all databases (1 content, admin, search and config) using sql backup tools, and backuping the front end server via dataprotector.\nTo test our backups, we use another server f...
This code produces a FileNotFoundException, but ultimately runs without issue: void ReadXml() { XmlSerializer serializer = new XmlSerializer(typeof(MyClass)); //... } Here is the exception: A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll Additional information: Coul...
The `FileNotFoundException` you are encountering when using `XmlSerializer` is a common issue that occurs when the .NET runtime tries to locate the XML serialization assembly for your type but cannot find it. This happens because the serialization assembly is generated at runtime and needs to be available for your code...
15,849
[ { "from": "human", "value": "This code produces a FileNotFoundException, but ultimately runs without issue:\nvoid ReadXml()\n{\n XmlSerializer serializer = new XmlSerializer(typeof(MyClass));\n //...\n}\n\nHere is the exception:\n\nA first chance exception of type 'System.IO.FileNotFoundException' occ...
I currently have an application that gets hit with over 20,000 users daily and they mostly look at one data table. This data table is filled with about 20 rows but is pulled from a "datatable" in a db with 200,000-600,000 records of information in the table. Edit: These 20 rows are "dynamic" and do change if the user ...
To optimize the performance of your application, especially given the requirements of handling 20,000 daily users with dynamic data, it’s essential to approach this problem strategically. Here are answers to your questions and additional recommendations: ### Question 1: Caching All Rows **Filling Application State wi...
13,959
[ { "from": "human", "value": "I currently have an application that gets hit with over 20,000 users daily and they mostly look at one data table. This data table is filled with about 20 rows but is pulled from a \"datatable\" in a db with 200,000-600,000 records of information in the table. Edit: These 20 ro...
OK, so see questions like this one and this one and the question I have is - does one have to use Expression Blend to do Silverlight development or can any of it be done with just Visual Studio? (2008, in this case) I haven't gotten started using Silverlight yet and through my workplace's MSDN I can get Expression Blen...
You do not have to use Expression Blend to do Silverlight development; you can certainly develop Silverlight applications using just Visual Studio 2008. Visual Studio provides a robust environment for coding and debugging Silverlight applications, and it includes tools for XAML editing, which is essential for UI design...
20,169
[ { "from": "human", "value": "OK, so see questions like this one and this one and the question I have is - does one have to use Expression Blend to do Silverlight development or can any of it be done with just Visual Studio? (2008, in this case)\nI haven't gotten started using Silverlight yet and through my ...
I have a web application running on a Gentoo-based LAMP stack. My customers buy the software as a service and I host everything. However, there is some demand for on-site deployment inside the clients' own networks. Currently, because I host the system, there is no built-in license management in the app. I bill based o...
Implementing a licensing system for your web application, especially one that caters to both cloud and on-site deployments, involves careful consideration of security, usability, and flexibility. Here are several approaches and frameworks you can consider, along with best practices to meet your requirements: ### Licen...
10,066
[ { "from": "human", "value": "I have a web application running on a Gentoo-based LAMP stack. My customers buy the software as a service and I host everything. However, there is some demand for on-site deployment inside the clients' own networks.\nCurrently, because I host the system, there is no built-in lic...
Without running this code, identify which Foo method will be called: class A { public void Foo( int n ) { Console.WriteLine( "A::Foo" ); } } class B : A { /* note that A::Foo and B::Foo are not related at all */ public void Foo( double n ) { Console.WriteLine( "B::Foo" ); } } static v...
The method that will be called in this scenario is `A::Foo`. Here’s why: 1. **Method Overloading and Method Hiding**: In the provided code, class `B` defines a method `Foo` that takes a `double` parameter, which is completely unrelated to the `Foo` method in class `A` that takes an `int` parameter. This is an example...
20,054
[ { "from": "human", "value": "Without running this code, identify which Foo method will be called:\nclass A\n{\n public void Foo( int n )\n {\n Console.WriteLine( \"A::Foo\" );\n }\n}\n\nclass B : A\n{\n /* note that A::Foo and B::Foo are not related at all */\n public void Foo( double n )\n ...
If I can do this, how do I call Java code (methods for instance) from within JavaScript code, in Wicket.
In Apache Wicket, you can call Java methods from JavaScript primarily using the Wicket AJAX functionality. This allows you to execute server-side Java methods in response to client-side events in JavaScript. Below is an example of how to do this in Wicket. ### Step-by-Step Guide 1. **Create a Wicket Web Application**...
15,594
[ { "from": "human", "value": "If I can do this, how do I call Java code (methods for instance) from within JavaScript code, in Wicket. \n" }, { "from": "gpt", "value": "In Apache Wicket, you can call Java methods from JavaScript primarily using the Wicket AJAX functionality. This allows you to ex...
Trying to create my first iPhone app that would play back audio. When I try to set up playback, messages like these appear in gdb: =shlibs-removed,shlib-info=[num="54",name="AudioIPCPlugIn",kind="B",dyld-addr="0x2c2000",reason="dyld",requested-state="E",state="E",path="/System/Library/Extensions/AudioIPCDriver.kext/Co...
The messages you are seeing in gdb (the GNU Debugger) seem to be related to the loading of audio-related plugins (specifically `AudioIPCPlugIn` and `AppleHDAHALPlugIn`) on your iOS simulator or device. Here’s a breakdown of what these messages could mean and how they relate to your audio playback functionality: 1. **D...
18,670
[ { "from": "human", "value": "Trying to create my first iPhone app that would play back audio. When I try to set up playback, messages like these appear in gdb:\n\n=shlibs-removed,shlib-info=[num=\"54\",name=\"AudioIPCPlugIn\",kind=\"B\",dyld-addr=\"0x2c2000\",reason=\"dyld\",requested-state=\"E\",state=\"E\...
I am using a .NET Windows Forms DataGridView and I need to edit a DataBound column (that binds on a boolean DataTable column). For this I specify the cell template like this: DataGridViewColumn column = new DataGridViewColumn(new DataGridViewCheckBoxCell()); You see that I need a CheckBox cell template. The problem I f...
When working with a `DataGridView` in a Windows Forms application and you want to use a `DataGridViewCheckBoxColumn` bound to a boolean value from a `DataTable`, you need to ensure a couple of things: 1. **Set the Data Property**: Make sure that the data source is correctly set to allow editing. 2. **Use the Correct C...
15,657
[ { "from": "human", "value": "I am using a .NET Windows Forms DataGridView and I need to edit a DataBound column (that binds on a boolean DataTable column). For this I specify the cell template like this:\nDataGridViewColumn column = new DataGridViewColumn(new DataGridViewCheckBoxCell());\nYou see that I nee...
I'm patching connect() to redirect network traffic as part of a library (NetHooker) and this works well, but it depends on ws2_32.dll remaining the same and doesn't work if the syscall is used directly. So what I'm wondering is if there's a way to catch the syscall itself without a driver. Anyone know if this is poss...
Intercepting system calls directly without a driver is a complex task and generally not recommended due to the potential risks and stability issues it can introduce to the operating system. However, there are a few approaches you might consider if you're looking to capture or redirect network traffic at the system call...
16,688
[ { "from": "human", "value": "I'm patching connect() to redirect network traffic as part of a library (NetHooker) and this works well, but it depends on ws2_32.dll remaining the same and doesn't work if the syscall is used directly. So what I'm wondering is if there's a way to catch the syscall itself witho...
How do you delete all the cookies for the current domain using JavaScript?
To delete all cookies for the current domain using JavaScript, you can iterate through all the cookies and set their expiration dates to a past date. Here's a simple function that does this: ```javascript function deleteAllCookies() { // Get all cookies for the current document const cookies = document.cookie....
19,749
[ { "from": "human", "value": "How do you delete all the cookies for the current domain using JavaScript?\n" }, { "from": "gpt", "value": "To delete all cookies for the current domain using JavaScript, you can iterate through all the cookies and set their expiration dates to a past date. Here's a ...
I know mime_content_type() is deprecated, but it seemed to me the alternative is worse at the moment. Finfo seems to require adding files and changing ini directions on windows; I don't want to require this for the script I am making. I need to find the mimetype of files, but when calling mime_content_type($filename) o...
It seems you're encountering issues with the deprecated `mime_content_type()` function on Windows, as well as difficulties with the `mime_magic` extension, which can be tricky to configure properly. Given that `mime_content_type()` is deprecated and you're looking for an alternative that doesn't require extensive conf...
20,250
[ { "from": "human", "value": "I know mime_content_type() is deprecated, but it seemed to me the alternative is worse at the moment. Finfo seems to require adding files and changing ini directions on windows; I don't want to require this for the script I am making.\nI need to find the mimetype of files, but w...
How can I construct the following string in an Excel formula: Maurice "The Rocket" Richard If I'm using single quotes, it's trivial: ="Maurice 'The Rocket' Richard" but what about double quotes?
To construct the string `Maurice "The Rocket" Richard` in an Excel formula using double quotes, you need to use two double quotes to represent a single double quote within the string. Here’s how you can write it: ```excel ="Maurice ""The Rocket"" Richard" ``` In this formula: - `""` is used to represent a single do...
21,718
[ { "from": "human", "value": "How can I construct the following string in an Excel formula:\n\nMaurice \"The Rocket\" Richard\n\nIf I'm using single quotes, it's trivial: =\"Maurice 'The Rocket' Richard\" but what about double quotes?\n" }, { "from": "gpt", "value": "To construct the string `Maur...
Is it good, bad, or indifferent to run SQL Server on your webserver? I'm using Server 2008 and SQL Server 2005, but I don't think that matters to this question.
Running SQL Server on your web server is generally considered bad practice for several reasons, even though it may be technically possible. Here are some points to consider: ### **Performance Concerns** - **Resource Contention**: Both the web server and the database server require CPU, memory, and disk I/O. If they ar...
17,960
[ { "from": "human", "value": "Is it good, bad, or indifferent to run SQL Server on your webserver? \nI'm using Server 2008 and SQL Server 2005, but I don't think that matters to this question.\n" }, { "from": "gpt", "value": "Running SQL Server on your web server is generally considered bad prac...
I'm a LINQ to XML newbie, and a KML newbie as well; so bear with me. My goal is to extract individual Placemarks from a KML file. My KML begins thusly: <?xml version="1.0" encoding="utf-8"?> <Document xmlns="http://earth.google.com/kml/2.0"> <name>Concessions</name> <visibility>1</visibility> <Folder> <visib...
The issue you're experiencing is related to XML namespaces. The KML document you provided has a default namespace (`xmlns="http://earth.google.com/kml/2.0"`), which means that elements like `<Placemark>` and `<Document>` are part of that namespace. When querying these elements using LINQ to XML, you need to include the...
18,629
[ { "from": "human", "value": "I'm a LINQ to XML newbie, and a KML newbie as well; so bear with me. \nMy goal is to extract individual Placemarks from a KML file. My KML begins thusly:\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Document xmlns=\"http://earth.google.com/kml/2.0\">\n <name>Concessions</name>...
So, there is a horribly written site that I occasionally help out with that was originally written in classic ASP. It was then "ported" to ASP.NET by moving the global variables to the code behind and leaving the rest of the code in the aspx...Its a huge mess. On some pages, an occasional race condition seems to be tri...
Dealing with race conditions and performance issues in an ASP.NET application that has been poorly ported from classic ASP can be quite challenging. Here are some tools and strategies you can use to diagnose and hopefully resolve the issues you're facing: ### 1. **Performance Monitoring Tools:** - **Windows Perform...
16,474
[ { "from": "human", "value": "So, there is a horribly written site that I occasionally help out with that was originally written in classic ASP.\nIt was then \"ported\" to ASP.NET by moving the global variables to the code behind and leaving the rest of the code in the aspx...Its a huge mess.\nOn some pages,...
I've got a data object with a component in it that is an System.Collections.Generic.IList, and I'd like to reflect changes to that list into a Gtk# NodeView, so that when an item is added to the list, the NodeView will get a new item added to it. How would I listen for changes to an IList? I have considered wrapping...
To listen for changes to an `IList` in C#, especially if you want to reflect those changes in a GTK# `NodeView`, you'll indeed need a mechanism to notify your GTK# application about changes to the list. The typical `IList` interface does not have built-in change notifications, so you will need to implement a solution t...
14,959
[ { "from": "human", "value": "I've got a data object with a component in it that is an System.Collections.Generic.IList, and I'd like to reflect changes to that list into a Gtk# NodeView, so that when an item is added to the list, the NodeView will get a new item added to it. \nHow would I listen for change...
I'm doing some experiments with Microsoft Dynamics CRM. You interact with it through web services and I have added a Web Reference to my project. The web service interface is very rich, and the generated "Reference.cs" is some 90k loc. I'm using the web reference in a console application. I often change something, rec...
It sounds like you are experiencing a common issue with the overhead of SOAP-based web service clients due to runtime XML serialization. Here are several strategies you might consider to alleviate the slow instantiation of the `CrmService` object: 1. **Pre-generate Serialization Assemblies**: You can use the `sgen.exe...
15,382
[ { "from": "human", "value": "I'm doing some experiments with Microsoft Dynamics CRM. You interact with it through web services and I have added a Web Reference to my project. The web service interface is very rich, and the generated \"Reference.cs\" is some 90k loc. \nI'm using the web reference in a consol...
I have a SqlCommand that I want to call Prepare() on whose CommandType = Text (it cannot be a stored procedure). In order to do this, I need to set the Size attribute on the parameters to be non-zero otherwise an exception is thrown. Are there any negative effects from setting the Size on all parameters to the maximum ...
Setting the `Size` property of parameters to the maximum possible size in SQL commands can have several implications, both positive and negative. Here’s a breakdown of the effects and alternatives: ### Negative Effects of Setting Maximum Size 1. **Memory Usage**: Allocating large sizes for parameters can lead to high...
16,791
[ { "from": "human", "value": "I have a SqlCommand that I want to call Prepare() on whose CommandType = Text (it cannot be a stored procedure).\nIn order to do this, I need to set the Size attribute on the parameters to be non-zero otherwise an exception is thrown. Are there any negative effects from setting ...
The goal: Any language. The smallest function which will return whether a string is a palindrome. Here is mine in Python: R=lambda s:all(a==b for a,b in zip(s,reversed(s))) 50 characters. The accepted answer will be the current smallest one - this will change as smaller ones are found. Please specify the language your...
Here is a solution in Python that is 39 characters long: ```python R=lambda s:s==s[::-1] ``` This function checks if the string `s` is equal to its reverse (`s[::-1]`).
22,411
[ { "from": "human", "value": "The goal: Any language. The smallest function which will return whether a string is a palindrome. Here is mine in Python:\nR=lambda s:all(a==b for a,b in zip(s,reversed(s)))\n\n50 characters.\nThe accepted answer will be the current smallest one - this will change as smaller one...
How can I disable all table constrains in Oracle with a single command? This can be either for a single table, a list of tables, or for all tables.
In Oracle, there isn't a single command to disable all constraints for a table, a list of tables, or all tables at once. However, you can achieve this with a combination of SQL commands. You can construct a PL/SQL block to dynamically disable constraints on the specified tables or use a query to generate the necessary ...
18,705
[ { "from": "human", "value": "How can I disable all table constrains in Oracle with a single command?\nThis can be either for a single table, a list of tables, or for all tables.\n" }, { "from": "gpt", "value": "In Oracle, there isn't a single command to disable all constraints for a table, a lis...
Can this be done w/ linqtosql? SELECT City, SUM(DATEDIFF(minute,StartDate,Completed)) AS Downtime FROM Incidents GROUP BY City
Yes, you can achieve the same result using LINQ to SQL. You can use the `GroupBy` method along with `Select` to perform the grouping and aggregation. However, in LINQ, you'll need to calculate the difference in minutes between `StartDate` and `Completed` in a different way, since LINQ does not have a built-in `DATEDIFF...
18,866
[ { "from": "human", "value": "Can this be done w/ linqtosql?\nSELECT City, SUM(DATEDIFF(minute,StartDate,Completed)) AS Downtime\nFROM Incidents\nGROUP BY City\n\n" }, { "from": "gpt", "value": "Yes, you can achieve the same result using LINQ to SQL. You can use the `GroupBy` method along with `S...
I have two controllers which share most of their code (but must be, nonetheless, different controllers). The obvious solution (to me, at least) is to create a class, and make the two controllers inherit from it. The thing is... where to put it? Now I have it in app_controller.php, but it's kind of messy there.
Creating a base class for your controllers to share common functionality is a great way to adhere to the DRY (Don't Repeat Yourself) principle. However, placing shared code in `app_controller.php` can lead to a cluttered and less organized structure. Here are some recommended approaches to better organize your shared c...
17,359
[ { "from": "human", "value": "I have two controllers which share most of their code (but must be, nonetheless, different controllers). The obvious solution (to me, at least) is to create a class, and make the two controllers inherit from it. The thing is... where to put it? Now I have it in app_controller.ph...
Usually pagination queries look like this. Is there a better way instead of making two almost equal methods, one of which executing "select *..." and the other one "count *..."? public List<Cat> findCats(String name, int offset, int limit) { Query q = session.createQuery("from Cat where name=:name"); q.setStr...
You can certainly optimize your code to reduce duplication and improve readability. One way to achieve this is by creating a single method that can handle both fetching the paginated list of cats and counting the total number of cats based on the provided criteria. You can do this by allowing the method to accept a fla...
18,556
[ { "from": "human", "value": "Usually pagination queries look like this. Is there a better way instead of making two almost equal methods, one of which executing \"select *...\" and the other one \"count *...\"?\npublic List<Cat> findCats(String name, int offset, int limit) {\n\n Query q = session.createQ...
I can't find any information about this on either www.episerver.com or world.episerver.com, anyone knows?
It seems you're looking for specific information related to Episerver, which is now known as Optimizely. If you're having trouble finding information on their official websites, here are a few suggestions to help you: 1. **Use the Search Function**: Both www.episerver.com and world.episerver.com have search functions....
19,891
[ { "from": "human", "value": "I can't find any information about this on either www.episerver.com or world.episerver.com, anyone knows?\n" }, { "from": "gpt", "value": "It seems you're looking for specific information related to Episerver, which is now known as Optimizely. If you're having troubl...
I'm writing some server code that talks to a client process via STDIN. I'm trying to write a snippet of perl code that asynchronously receives responses from the client's STDOUT. The blocking version of the code might look like this: sub _read_from_client { my ($file_handle) = @_; while (my $line = <$file_handle>...
In a Win32 environment, dealing with asynchronous I/O can be challenging because the standard Perl I/O functions are blocking by default. To read from the client's STDOUT asynchronously, you can use the `IO::Select` module, which provides a way to wait for I/O operations on multiple handles. This is useful in your case...
17,888
[ { "from": "human", "value": "I'm writing some server code that talks to a client process via STDIN. I'm trying to write a snippet of perl code that asynchronously receives responses from the client's STDOUT. The blocking version of the code might look like this:\nsub _read_from_client\n{\n my ($file_handl...
whether command line or GUI, I'd be interested in testing every of them.
It sounds like you're interested in exploring both command line interfaces (CLI) and graphical user interfaces (GUI) for various tasks or software. Here are some suggestions for how you might go about testing both types of interfaces across different applications: ### Command Line Interfaces (CLI) 1. **Linux Shells**:...
13,716
[ { "from": "human", "value": "whether command line or GUI, I'd be interested in testing every of them.\n" }, { "from": "gpt", "value": "It sounds like you're interested in exploring both command line interfaces (CLI) and graphical user interfaces (GUI) for various tasks or software. Here are some...
I would like to automate the process of setting up a new PC, this would include downloading and installing the latest windows and office updates; installing software from a network share (some software will require a restart so the script would need to be able to login and continue) adding PC to a domain and setting up...
Yes, it is possible to automate the process of setting up a new PC with the tasks you described. You can achieve this by using a combination of PowerShell and batch scripts, as they are powerful tools for Windows environments and can handle tasks related to updates, installations, domain joining, and user account manag...
12,935
[ { "from": "human", "value": "I would like to automate the process of setting up a new PC, this would include downloading and installing the latest windows and office updates; installing software from a network share (some software will require a restart so the script would need to be able to login and conti...
I have a table column that needs to be limited to a certain width - say 100 pixels. At times the text in that column is wider than this and contains no spaces. For example: a_really_long_string_of_text_like_this_with_no_line_breaks_makes_the_table_unhappy I would like to calculate the width of text server-side and ad...
Calculating the pixel width of text in a specific font can be a bit tricky, especially if you're trying to do it server-side without knowing the rendered size. However, you can indeed achieve this using a one-time JavaScript script that can measure the width of characters in the desired font. Here's a quick and effect...
15,071
[ { "from": "human", "value": "I have a table column that needs to be limited to a certain width - say 100 pixels. At times the text in that column is wider than this and contains no spaces. For example:\na_really_long_string_of_text_like_this_with_no_line_breaks_makes_the_table_unhappy\n\nI would like to ca...
What library should be included to use TransparentBlt? This is VC98 (Visual Studio 6) linking to the Gdi32.lib. (Other GDI functions such as BitBlt link as expected), and the compilers compiles with out error or warning. Even though the Gdi32.lib is included, yet the linker returns this error: mtcombo.obj : error LNK2...
The error you are encountering indicates that the linker is unable to find the implementation for the `TransparentBlt` function. Since you're using Visual Studio 6 (VC98), which is quite old, it's important to ensure that you are correctly linking against the appropriate libraries. The `TransparentBlt` function is par...
16,654
[ { "from": "human", "value": "What library should be included to use TransparentBlt?\nThis is VC98 (Visual Studio 6) linking to the Gdi32.lib. (Other GDI functions such as BitBlt link as expected), and the compilers compiles with out error or warning.\nEven though the Gdi32.lib is included, yet the linker re...
I would like users to submit a URL that is valid but also is an image, ending with .jpg, .png, or .gif.
To ensure that users submit a valid URL that points to an image file ending with `.jpg`, `.png`, or `.gif`, you can implement the following validation steps: 1. **Check if the URL is well-formed**: Use a regular expression or built-in URL validation methods to verify that the URL structure is correct. 2. **Verify the...
17,399
[ { "from": "human", "value": "I would like users to submit a URL that is valid but also is an image, ending with .jpg, .png, or .gif.\n" }, { "from": "gpt", "value": "To ensure that users submit a valid URL that points to an image file ending with `.jpg`, `.png`, or `.gif`, you can implement the ...
Creating hashes of hashes in Ruby allows for convenient two (or more) dimensional lookups. However, when inserting one must always check if the first index already exists in the hash. For example: h = Hash.new h['x'] = Hash.new if not h.key?('x') h['x']['y'] = value_to_insert It would be preferable to do the followin...
Yes, you can achieve this behavior in Ruby by using a custom subclass of `Hash` that automatically initializes nested hashes as needed. Here's an implementation of such a class: ```ruby class NestedHash < Hash def initialize super { |hash, key| hash[key] = NestedHash.new } end def [](key) super || Nes...
19,896
[ { "from": "human", "value": "Creating hashes of hashes in Ruby allows for convenient two (or more) dimensional lookups. However, when inserting one must always check if the first index already exists in the hash. For example:\nh = Hash.new\nh['x'] = Hash.new if not h.key?('x')\nh['x']['y'] = value_to_inser...
I'm using the following code, using the SharpZipLib library, to add files to a .zip file, but each file is being stored with its full path. I need to only store the file, in the 'root' of the .zip file. string[] files = Directory.GetFiles(folderPath); using (ZipFile zipFile = ZipFile.Create(zipFilePath)) { zipFil...
To add files to a ZIP archive using the SharpZipLib library while storing them in the root directory (without their full paths), you need to specify just the file name when adding them to the ZIP file, rather than the full path. Here's how you can modify your code to achieve that: ```csharp using System.IO; using ICS...
20,434
[ { "from": "human", "value": "I'm using the following code, using the SharpZipLib library, to add files to a .zip file, but each file is being stored with its full path. I need to only store the file, in the 'root' of the .zip file.\nstring[] files = Directory.GetFiles(folderPath);\nusing (ZipFile zipFile =...
I am seeing some rather weird behavior with PowerShell, it looks like custom functions might need a "parenthesis wrapper" to evaluate as you might expect them. Given a simple PowerShell function: function Return-True { return $true } and then some sample code to invoke it: PS C:\> Return-True True PS C:\> Return-True ...
The behavior you are observing in PowerShell relates to how expressions are evaluated and how the return value of a function is treated based on the context in which it is called. ### Explanation of the Behavior 1. **Direct Invocation (Return-True)**: - When you call `Return-True` without parentheses, PowerShell e...
16,989
[ { "from": "human", "value": "I am seeing some rather weird behavior with PowerShell, it looks like custom functions might need a \"parenthesis wrapper\" to evaluate as you might expect them. Given a simple PowerShell function:\nfunction Return-True { return $true }\n\nand then some sample code to invoke it:...
I will preface this question by saying, I do not think it is solvable. I also have a workaround, I can create a stored procedure with an OUTPUT to accomplish this, it is just easier to code the sections where I need this checksum using a function. This code will not work because of the Exec SP_ExecuteSQL @SQL calls. An...
You're correct that you cannot execute dynamic SQL within a function in SQL Server. Functions in SQL Server are designed to be deterministic and cannot have side effects, which includes executing dynamic SQL or modifying state outside the function's own context. In your case, if you need to compute a checksum dynamica...
12,872
[ { "from": "human", "value": "I will preface this question by saying, I do not think it is solvable. I also have a workaround, I can create a stored procedure with an OUTPUT to accomplish this, it is just easier to code the sections where I need this checksum using a function.\nThis code will not work becaus...
Under the View-Model-ViewModel pattern for WPF, I am trying to databind the Heights and Widths of various definitions for grid controls, so I can store the values the user sets them to after using a GridSplitter. However, the normal pattern doesn't seem to work for these particular properties. Note: I'm posting this as...
In WPF, data binding works best with dependency properties, but certain properties, like the `Height` and `Width` of `RowDefinition` and `ColumnDefinition`, do not support two-way binding out of the box due to the way they are set up in the visual tree. These properties are often set in code or through XAML and don't a...
15,106
[ { "from": "human", "value": "Under the View-Model-ViewModel pattern for WPF, I am trying to databind the Heights and Widths of various definitions for grid controls, so I can store the values the user sets them to after using a GridSplitter. However, the normal pattern doesn't seem to work for these particu...
I am encountering error like test(10)[1].csv file cannot be found at C:\Documents and Settings\Ron\Local Settings\Temporary Internet Files\Content.IE5\PQ0STUVW When trying to do export of CSV file using the following codes. Anyone have any idea what could be wrong? This issue does not occur in IE7 / Firefox and is ...
The issue you're encountering when exporting a CSV file using IE6 is likely related to how that particular browser handles file downloads and attachments. Here are a few things to consider and possible solutions: 1. **Content-Disposition Header**: Ensure that the filename you are providing in the `Content-Disposition`...
17,002
[ { "from": "human", "value": "I am encountering error like \ntest(10)[1].csv file cannot be found at \nC:\\Documents and Settings\\Ron\\Local Settings\\Temporary Internet Files\\Content.IE5\\PQ0STUVW\n\nWhen trying to do export of CSV file using the following codes.\nAnyone have any idea what could be wrong...
I just wanna ask what would be better approach to supply these objects in my unit tests. In my unit test I am testing CSLA object. CSLA object is internally using one property and one method of ApplicationUser object. ApplicationUser is inherited from IPrincipal. The properties are: 1) ApplicationContext.User.IsInRole(...
In your unit test scenario, you're trying to mock an `IPrincipal` and its `IIdentity` property using Rhino Mocks. However, as you've experienced, it can be tricky to mock nested properties (like `Identity.Name`), especially when they are not being directly invoked in a straightforward manner. ### Solution 1: Create a...
14,620
[ { "from": "human", "value": "I just wanna ask what would be better approach to supply these objects in my unit tests.\nIn my unit test I am testing CSLA object. CSLA object is internally using one property and one method of ApplicationUser object. ApplicationUser is inherited from IPrincipal.\nThe propertie...
Having just witnessed Sound Load technology on the Nintendo DS game Bangai-O Spritis. I was curious as to how this technology works? Does anyone have any links, documentation or sample code on implementing such a feature, that would allow the state of an application to be saved and loaded via audio?
Sound Load technology, as seen in games like **Bangai-O Spirits** on the Nintendo DS, utilizes audio signals to encode and decode data. This technology allows users to save game states or data by recording audio that can then be played back to retrieve the saved information. The concept behind it is relatively straight...
12,423
[ { "from": "human", "value": "Having just witnessed Sound Load technology on the Nintendo DS game Bangai-O Spritis. I was curious as to how this technology works? Does anyone have any links, documentation or sample code on implementing such a feature, that would allow the state of an application to be saved ...
Whats the best way to detect collisions in a 2d game sprites? I am currently working in allegro and G++
Detecting collisions in a 2D game can be approached in various ways depending on the requirements of your game, the complexity of your sprites, and the performance considerations you need to take into account. Below are some common methods for detecting collisions between sprites in a 2D game, especially when using a l...
11,501
[ { "from": "human", "value": "Whats the best way to detect collisions in a 2d game sprites? I am currently working in allegro and G++\n" }, { "from": "gpt", "value": "Detecting collisions in a 2D game can be approached in various ways depending on the requirements of your game, the complexity of ...
Disclaimer: I am new to Winforms. I need to declare a datatable that I can load with data when the main form loads. I then want to be able to reference the datatable from within events like when a button is clicked etc. Where/how should I declare this?
Welcome to WinForms! To declare a `DataTable` that you can load with data and reference in various events, you can follow these steps: 1. **Declare the DataTable** at the class level in your main form. This allows the DataTable to be accessible in different methods within the form, including event handlers. 2. **Init...
16,733
[ { "from": "human", "value": "Disclaimer: I am new to Winforms.\nI need to declare a datatable that I can load with data when the main form loads. I then want to be able to reference the datatable from within events like when a button is clicked etc.\nWhere/how should I declare this?\n" }, { "from": ...
I would like to debug an embedded system containing gdb remotely using some kind of gui (ie like ddd). The embedded system does not have the sources or build symbols. However my local x windows box has. However the execution must happen on the embedded system. How can I from my development box drive gdb remotely with s...
To debug an embedded system using GDB remotely with a graphical interface, you can set up a GDB server on the embedded device and use a GUI front-end on your development machine. Since you mentioned that the embedded system does not have the sources or build symbols, you will primarily be able to use GDB for disassembl...
15,866
[ { "from": "human", "value": "I would like to debug an embedded system containing gdb remotely using some kind of gui (ie like ddd). The embedded system does not have the sources or build symbols. However my local x windows box has. However the execution must happen on the embedded system. How can I from my ...