instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Courses for people who are being introduced to programming very often include a code project, which I think is a nice way to learn. However, such projects often feel too artificial, and are thus not very rewarding to work on. What are your ideas of rewarding code projects? (Preferably easy to begin, and extendable at w...
Here are some ideas for rewarding programming projects that are accessible to beginners but can also be extended for more advanced learners. These projects aim to engage students' interests while providing room for creativity and complexity. 1. **Personal Journal or Diary App**: - **Beginner Level**: Create a simpl...
5,957
[ { "from": "human", "value": "Courses for people who are being introduced to programming very often include a code project, which I think is a nice way to learn. However, such projects often feel too artificial, and are thus not very rewarding to work on.\nWhat are your ideas of rewarding code projects? (Pre...
I start by creating a string variable with some non-ascii utf-8 encoded data on it: >>> text = 'á' >>> text '\xc3\xa1' >>> text.decode('utf-8') u'\xe1' Using unicode() on it raises errors... >>> unicode(text) Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeDecodeError: 'ascii' codec can...
The behavior you're observing is due to the way Python 2 handles string and Unicode types, as well as the differences between the `str` and `unicode` types. In Python 2, there are two main types for text data: 1. **`str`**: This is a byte string, which can contain raw bytes, including non-ASCII characters encoded in ...
6,935
[ { "from": "human", "value": "I start by creating a string variable with some non-ascii utf-8 encoded data on it:\n>>> text = 'á'\n>>> text\n'\\xc3\\xa1'\n>>> text.decode('utf-8')\nu'\\xe1'\n\nUsing unicode() on it raises errors...\n>>> unicode(text)\nTraceback (most recent call last):\n File \"<stdin>\", l...
I recently installed Windows 2008 Server to replace a crashed hard drive on a web server with a variety of web pages including several classic ASP applications. One of these makes extensive use of file uploads using a com tool that has worked for several years. More information: My users did not provide good informati...
The error code `800a0035` typically indicates that there is a "file not found" issue in your Classic ASP application. However, since you mentioned that smaller files upload without issue and larger files do not, the problem could be related to configuration settings on the server that limit file upload sizes. Here are...
8,157
[ { "from": "human", "value": "I recently installed Windows 2008 Server to replace a crashed hard drive on a web server with a variety of web pages including several classic ASP applications. One of these makes extensive use of file uploads using a com tool that has worked for several years.\nMore information...
I'd like a short smallest possible javascript routine that when a mousedown occurs on a button it first responds just like a mouseclick and then if the user keeps the button pressed it responds as if the user was continously sending mouseclicks and after a while with the button held down acts as if the user was acceler...
You can achieve this by using JavaScript's `setInterval` to simulate the repeated click functionality with acceleration when the mouse button is held down. Below is a minimal example: ```javascript const button = document.createElement('button'); button.textContent = 'Click and Hold Me'; document.body.appendChild(butt...
9,271
[ { "from": "human", "value": "I'd like a short smallest possible javascript routine that when a mousedown occurs on a button it first responds just like a mouseclick and then if the user keeps the button pressed it responds as if the user was continously sending mouseclicks and after a while with the button ...
I'd like to be able to write a ruby program that can restart without dropping it's socket connections.
Creating a Ruby application that can restart without dropping its socket connections is a challenging task because, typically, when a process restarts, it loses all its current state, including active connections. However, there are strategies you can use to achieve near-zero downtime and maintain persistent connection...
6,079
[ { "from": "human", "value": "I'd like to be able to write a ruby program that can restart without dropping it's socket connections.\n" }, { "from": "gpt", "value": "Creating a Ruby application that can restart without dropping its socket connections is a challenging task because, typically, when...
I have a problem in my project with the .designer which as everyone know is autogenerated and I ahvent changed at all. One day I was working fine, I did a back up and next day boom! the project suddenly stops working and sends a message that the designer cant procees a code line... and due to this I get more errores (2...
It sounds like you're encountering issues with a Windows Forms application that uses a designer-generated file (the `.designer.vb` file). The error you're seeing suggests that there's a problem with how the designer is processing the `InitializeComponent` method, specifically with the `ReportSource` assignment for the ...
5,012
[ { "from": "human", "value": "I have a problem in my project with the .designer which as everyone know is autogenerated and I ahvent changed at all. One day I was working fine, I did a back up and next day boom! the project suddenly stops working and sends a message that the designer cant procees a code line...
(another post here reminded me of this annoyance! this is not a dup!) I use VS2008 with multiple monitors. I have VS open on one and the app I'm debugging, reference pages, etc.. on the other. The problem is when I open a find window (Ctrl-F or click on the "Find in Files" icon) the window opens smack-dab in the mi...
This issue with Visual Studio 2008 and multi-monitor setups can indeed be frustrating. Unfortunately, VS2008 does not provide built-in settings to manage window placements for dialog boxes like the Find window, but there are a few workarounds you can try to improve the situation: 1. **Adjust Display Settings**: Someti...
7,811
[ { "from": "human", "value": "(another post here reminded me of this annoyance! this is not a dup!)\nI use VS2008 with multiple monitors. I have VS open on one and the app I'm debugging, reference pages, etc.. on the other. \nThe problem is when I open a find window (Ctrl-F or click on the \"Find in Files...
It seems to me that it would work perfectly well to do tail-recursion optimization in both C and C++, yet while debugging I never seem to see a frame stack that indicates this optimization. That is kind of good, because the stack tells me how deep the recursion is. However, the optimization would be kind of nice as wel...
Tail recursion optimization (TRO) can be a useful optimization in C and C++, but its implementation and support can vary widely among different compilers. Here's a detailed explanation regarding its support, checking for optimizations, and considerations with destructors in C++. ### Tail Recursion Optimization in C an...
3,777
[ { "from": "human", "value": "It seems to me that it would work perfectly well to do tail-recursion optimization in both C and C++, yet while debugging I never seem to see a frame stack that indicates this optimization. That is kind of good, because the stack tells me how deep the recursion is. However, the ...
I am currently developing a .NET application, which consists of 20 projects. Some of those projects are compiled using .NET 3.5, some others are still .NET 2.0 projects (so far no problem). The problem is that if I include an external component I always get the following warning: Found conflicts between different vers...
The warning you're encountering, "Found conflicts between different versions of the same dependent assembly," indicates that your application is trying to use multiple versions of the same assembly (library). This commonly happens when different projects reference different versions of the same assembly or when an asse...
7,224
[ { "from": "human", "value": "I am currently developing a .NET application, which consists of 20 projects. Some of those projects are compiled using .NET 3.5, some others are still .NET 2.0 projects (so far no problem).\nThe problem is that if I include an external component I always get the following warnin...
I would like to create an SSL connection for generic TCP communication. I think I figured out how to do it in the code, using the info here: http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx What I'm having trouble with is creating a cert so I can test this out. I tried makecert.exe testCert,...
To create a self-signed SSL certificate for testing purposes, you can use the following methods based on your platform. Below, I've outlined how to generate a self-signed certificate with associated private keys using PowerShell, which is available on Windows. ### Using PowerShell (Windows) 1. **Open PowerShell as an...
3,343
[ { "from": "human", "value": "I would like to create an SSL connection for generic TCP communication. I think I figured out how to do it in the code, using the info here: http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx\nWhat I'm having trouble with is creating a cert so I can test...
The application my team is currently developing has a DLL that is used to perform all database access. The application can not use a trusted connection because the database is behind a firewall and the domain server is not. So it appears that the connection string needs to have a DB username and password. The DLL cu...
Storing sensitive information such as database usernames and passwords securely is crucial, especially when dealing with applications that can be reverse-engineered. Here are several approaches you can consider for storing and managing the database connection string securely without hardcoding it in the DLL: ### 1. **...
4,818
[ { "from": "human", "value": "The application my team is currently developing has a DLL that is used to perform all database access. The application can not use a trusted connection because the database is behind a firewall and the domain server is not. So it appears that the connection string needs to hav...
I've been asked to implement some code that will update a row in a MS SQL Server database and then use a stored proc to insert the update in a history table. We can't add a stored proc to do this since we don't control the database. I know in stored procs you can do the update and then call execute on another stored ...
Yes, you can achieve this using a single SQL command by leveraging a transaction to ensure that both the update and the call to the stored procedure are executed as part of the same transaction. In this way, you can ensure that if either operation fails, the changes will be rolled back, preserving the integrity of your...
6,767
[ { "from": "human", "value": "I've been asked to implement some code that will update a row in a MS SQL Server database and then use a stored proc to insert the update in a history table. We can't add a stored proc to do this since we don't control the database. I know in stored procs you can do the update...
Adding an element to the head of an alist (Associative list) is simple enough: > (cons '(ding . 53) '((foo . 42) (bar . 27))) ((ding . 53) (foo . 42) (bar . 27)) Appending to the tail of an alist is a bit trickier though. After some experimenting, I produced this: > (define (alist-append alist pair) `(,@alist ,pair)) ...
Your approach using `,@` in the `alist-append` function is a valid way to append a pair to the end of an associative list (alist) in Scheme, and it does work correctly. However, it's common practice to use a more straightforward method to achieve the same result without resorting to quasi-quoting and unquoting, which m...
9,320
[ { "from": "human", "value": "Adding an element to the head of an alist (Associative list) is simple enough:\n> (cons '(ding . 53) '((foo . 42) (bar . 27)))\n((ding . 53) (foo . 42) (bar . 27))\n\nAppending to the tail of an alist is a bit trickier though. After some experimenting, I produced this:\n> (defin...
The question I want to ask is thus: Is casting down the inheritance tree (ie. towards a more specialiased class) from inside an abstract class excusable, or even a good thing, or is it always a poor choice with better options available? Now, the example of why I think it can be used for good. I recently implemented Ben...
Your question touches on a complex topic in object-oriented design, particularly when dealing with inheritance and the principles of polymorphism. Let's break down the considerations. ### Casting Down the Inheritance Tree 1. **When Is It Justifiable?** - **Specific Use Cases**: If you have a very specific scenario...
8,220
[ { "from": "human", "value": "The question I want to ask is thus:\nIs casting down the inheritance tree (ie. towards a more specialiased class) from inside an abstract class excusable, or even a good thing, or is it always a poor choice with better options available?\nNow, the example of why I think it can b...
Was considering the System.Collections.ObjectModel ObservableCollection<T> class. This one is strange because it has an Add Method which takes one item only. No AddRange or equivalent. the Notification event arguments has a NewItems property, which is a IList (of objects.. not T) My need here is to add a batch of ...
The `ObservableCollection<T>` class in .NET is indeed designed to provide notifications for individual changes made to the collection, such as adding or removing items, which is why it only includes an `Add` method for single items rather than an `AddRange` method for adding multiple items at once. The change notificat...
6,202
[ { "from": "human", "value": "Was considering the System.Collections.ObjectModel ObservableCollection<T> class. This one is strange because \n\nit has an Add Method which takes one item only. No AddRange or equivalent. \nthe Notification event arguments has a NewItems property, which is a IList (of objects....
So I have an object which has some fields, doesn't really matter what. I have a generic list of these objects. List<MyObject> myObjects = new List<MyObject>(); myObjects.Add(myObject1); myObjects.Add(myObject2); myObjects.Add(myObject3); So I want to remove objects from my list based on some criteria. For instance, my...
You can use a lambda expression as an inline predicate when using the `RemoveAll` method. This approach allows you to define the condition directly within the method call without the need for creating a separate delegate or method. Here's how you can achieve that: ```csharp using System; using System.Collections.Gene...
7,216
[ { "from": "human", "value": "So I have an object which has some fields, doesn't really matter what.\nI have a generic list of these objects.\nList<MyObject> myObjects = new List<MyObject>();\nmyObjects.Add(myObject1);\nmyObjects.Add(myObject2);\nmyObjects.Add(myObject3);\n\nSo I want to remove objects from ...
What I'm trying to do here is get the headers of a given URL so I can determine the MIME type. I want to be able to see if http://somedomain/foo/ will return an HTML document or a JPEG image for example. Thus, I need to figure out how to send a HEAD request so that I can read the MIME type without having to download th...
Yes, you can easily send a HEAD request to a URL to retrieve the headers, which will include the `Content-Type` header that indicates the MIME type of the resource without downloading the entire content. There are several ways to achieve this, depending on the programming language or tools you prefer to use. ### Using...
7,540
[ { "from": "human", "value": "What I'm trying to do here is get the headers of a given URL so I can determine the MIME type. I want to be able to see if http://somedomain/foo/ will return an HTML document or a JPEG image for example. Thus, I need to figure out how to send a HEAD request so that I can read th...
I have a container div with a fixed width and height, with overflow: hidden. I want a horizontal row of float: left divs within this container. Divs which are floated left will naturally push onto the 'line' below after they read the right bound of their parent. This will happen even if the height of the parent should ...
To achieve the desired effect where floated elements stay on the same line within a fixed height and width container without wrapping to the next line, you can use a combination of CSS properties. One effective approach is to use `display: flex` on the parent container along with `overflow: hidden` to maintain the fixe...
5,027
[ { "from": "human", "value": "I have a container div with a fixed width and height, with overflow: hidden.\nI want a horizontal row of float: left divs within this container. Divs which are floated left will naturally push onto the 'line' below after they read the right bound of their parent. This will happe...
Most program languages have some kind of exception handling; some languages have return codes, others have try/catch, or rescue/retry, etc., each with its own pecularities in readability, robustness, and practical effectiveness in a large group development effort. Which one is the best and why ?
The question of which exception handling mechanism is "the best" does not have a definitive answer, as it largely depends on the context in which a programming language is used, the preferences of the development team, and the specific requirements of the project. However, we can analyze some common paradigms of except...
5,805
[ { "from": "human", "value": "Most program languages have some kind of exception handling; some languages have return codes, others have try/catch, or rescue/retry, etc., each with its own pecularities in readability, robustness, and practical effectiveness in a large group development effort. Which one is t...
I am hitting some performance bottlenecks with my C# client inserting bulk data into a SQL Server 2005 database and I'm looking for ways in which to speed up the process. I am already using the SqlClient.SqlBulkCopy (which is based on TDS) to speed up the data transfer across the wire which helped a lot, but I'm still ...
There are several strategies you can employ to speed up the bulk data insert into your SQL Server 2005 database. Based on your description, you're already utilizing `SqlBulkCopy`, which is excellent for transferring large volumes of data quickly. However, you can further optimize your data import process by considering...
5,296
[ { "from": "human", "value": "I am hitting some performance bottlenecks with my C# client inserting bulk data into a SQL Server 2005 database and I'm looking for ways in which to speed up the process.\nI am already using the SqlClient.SqlBulkCopy (which is based on TDS) to speed up the data transfer across t...
I'm trying to run a LINQ to SQL query that returns a result in a grid view in a search engine style listing. In the simplified example below, is it possible to populate the collection with a comma-separated list of any children that the parent has (NAMESOFCHILDREN) in a single query? var family = from p in db.Parents...
Yes, you can achieve that by using the `GroupBy` and `Select` methods to create a comma-separated list of the children's names in a single LINQ to SQL query. Here's how you can modify your LINQ query to include the names of the children as a comma-separated list: ```csharp var family = from p in db.Parents ...
9,559
[ { "from": "human", "value": "I'm trying to run a LINQ to SQL query that returns a result in a grid view in a search engine style listing. \nIn the simplified example below, is it possible to populate the collection with a comma-separated list of any children that the parent has (NAMESOFCHILDREN) in a singl...
I'm trying to make a two-column page using a div-based layout (no tables please!). Problem is, I can't grow the left div to match the height of the right one. My right div typically has a lot of content. Here's a paired down example of my template to illustrate the problem. <div style="float:left; width: 150px; bord...
To make the left `<div>` (the navigation) grow to match the height of the right `<div>` (the content), you can use a CSS technique called "clearfix" or you can use a flexbox layout. Since you're avoiding tables, I recommend using flexbox, as it provides a more modern and efficient way to handle layout issues like this....
6,777
[ { "from": "human", "value": "I'm trying to make a two-column page using a div-based layout (no tables please!). Problem is, I can't grow the left div to match the height of the right one. My right div typically has a lot of content. \nHere's a paired down example of my template to illustrate the problem.\...
I've just started working on an ASP.NET project which I hope to open source once it gets to a suitable stage. It's basically going to be a library that can be used by existing websites. My preference is to support ASP.NET 2.0 through 3.5, but I wondered how many people I would be leaving out by not supporting ASP.NET 1...
While ASP.NET 1.1 was a significant release in the early 2000s, its usage has dramatically declined over the years as newer versions have been released. By the time ASP.NET 2.0 and 3.5 came out, most developers and organizations began migrating to take advantage of the new features, performance improvements, and securi...
6,330
[ { "from": "human", "value": "I've just started working on an ASP.NET project which I hope to open source once it gets to a suitable stage. It's basically going to be a library that can be used by existing websites. My preference is to support ASP.NET 2.0 through 3.5, but I wondered how many people I would b...
I'm wondering if people can suggest the best tutorial that will walk me through the best way to do Drag and Drop with control collision detection etc, using MS Silverlight V2. I've done the Jesse Liberty tutorials at Silverlight.net, and they were a good introduction, but I'm looking for something a bit deeper. Suggest...
It looks like you already have some great resources lined up for learning about drag and drop functionality in Silverlight V2. Here’s a summary of the links you mentioned, along with a few additional suggestions that may help deepen your understanding: 1. **ADEF Web Server - Drag and Drop Test**: - [ADEF Web Server...
8,021
[ { "from": "human", "value": "I'm wondering if people can suggest the best tutorial that will walk me through the best way to do Drag and Drop with control collision detection etc, using MS Silverlight V2.\nI've done the Jesse Liberty tutorials at Silverlight.net, and they were a good introduction, but I'm l...
How can I use .NET DataSet.Select method to search records that match a DateTime? What format should I use to enter my dates in?
The `DataSet.Select` method allows you to filter records in a `DataTable` using a specified filter expression, which is similar to a SQL WHERE clause. When you want to filter by a `DateTime`, you need to ensure that the format of the date string you use in the filter expression is compatible with how dates are represen...
6,166
[ { "from": "human", "value": "How can I use .NET DataSet.Select method to search records that match a DateTime?\nWhat format should I use to enter my dates in?\n" }, { "from": "gpt", "value": "The `DataSet.Select` method allows you to filter records in a `DataTable` using a specified filter expre...
Are there any free tools that implement evidence-based scheduling like Joel talks about? There is FogBugz, of course, but I am looking for a simple and free tool that can apply EBS on some tasks that I give estimates (and actual times which are complete) for.
Yes, while FogBugz is the most well-known tool for implementing evidence-based scheduling (EBS), there are a few other free or open-source tools that can help you apply EBS principles to your tasks. Here are some options: 1. **Trello with Power-Ups**: Trello is a flexible project management tool that can be customized...
5,566
[ { "from": "human", "value": "Are there any free tools that implement evidence-based scheduling like Joel talks about? There is FogBugz, of course, but I am looking for a simple and free tool that can apply EBS on some tasks that I give estimates (and actual times which are complete) for.\n" }, { "fr...
Do you know any grid control compatible with .NET and Mono? DataGridView seems to be quite buggy on Mono, and GTK# controls depends on GTK+ so you need to install it in windows machines where, usually, it's not present.
Yes, there are several grid controls that are compatible with .NET and Mono that you might consider using, especially if you're facing issues with `DataGridView` or prefer not to rely on GTK# controls. Here are some alternatives: 1. **Syncfusion DataGrid**: Syncfusion provides a comprehensive suite of components for ....
8,424
[ { "from": "human", "value": "Do you know any grid control compatible with .NET and Mono?\nDataGridView seems to be quite buggy on Mono, and GTK# controls depends on GTK+ so you need to install it in windows machines where, usually, it's not present.\n" }, { "from": "gpt", "value": "Yes, there ar...
Is there any way to parse a string in the format HH:MM into a Date (or other) object using the standard libraries? I know that I can parse something like "9/17/2008 10:30" into a Date object using var date:Date = new Date(Date.parse("9/17/2008 10:30"); But I want to parse just 10:30 by itself. The following code will...
In ActionScript, the built-in `Date` class does not directly support parsing just time strings like "HH:MM" to create a `Date` object. The `Date.parse` method is designed to parse complete date-time strings that include both date and time components. However, you can still achieve your goal by creating a `Date` object...
4,683
[ { "from": "human", "value": "Is there any way to parse a string in the format HH:MM into a Date (or other) object using the standard libraries?\nI know that I can parse something like \"9/17/2008 10:30\" into a Date object using\nvar date:Date = new Date(Date.parse(\"9/17/2008 10:30\");\n\nBut I want to par...
What's the best way to go about validating that a document follows some version of HTML (prefereably that I can specify)? I'd like to be able to know where the failures occur, as in a web-based validator, except in a native Python app.
Validating HTML documents against a specific version of HTML can be done in Python using libraries that can parse and validate HTML content. Here are a few approaches you can take: ### 1. Using `html5lib` for HTML5 Validation `html5lib` is a pure-Python library that parses HTML in a manner compatible with modern brow...
5,558
[ { "from": "human", "value": "What's the best way to go about validating that a document follows some version of HTML (prefereably that I can specify)? I'd like to be able to know where the failures occur, as in a web-based validator, except in a native Python app.\n" }, { "from": "gpt", "value":...
In Visual Studio you can create a template XML document from an existing schema. The new XML Schema Explorer in VS2008 SP1 takes this a stage further and can create a sample XML document complete with data. Is there a class library in .NET to do this automatically without having to use Visual Studio? I found the XmlSam...
As of my knowledge cutoff in October 2023, there isn't a built-in class library specifically in .NET that automatically generates a sample XML document from an XSD schema without using Visual Studio. However, you can achieve this functionality using existing libraries and tools, including: ### 1. **XmlSchema Class (Sy...
7,352
[ { "from": "human", "value": "In Visual Studio you can create a template XML document from an existing schema. The new XML Schema Explorer in VS2008 SP1 takes this a stage further and can create a sample XML document complete with data.\nIs there a class library in .NET to do this automatically without havin...
I have a simple WPF application which I am trying to start. I am following the Microsoft Patterns and Practices "Composite Application Guidance for WPF". I've followed their instructions however my WPF application fails immediately with a "TypeInitializationException". The InnerException property reveals that "The ty...
The `TypeInitializationException` you're encountering, especially with the inner exception pointing to `BaseUriHelper`, often relates to issues with application configuration or the loading of assemblies. Below are a few common steps and potential solutions to troubleshoot and resolve the issue: ### 1. Check for Confi...
5,435
[ { "from": "human", "value": "I have a simple WPF application which I am trying to start. I am following the Microsoft Patterns and Practices \"Composite Application Guidance for WPF\". I've followed their instructions however my WPF application fails immediately with a \"TypeInitializationException\".\nTh...
I'd like to add dvd burning functionality to my .Net app (running on Windows Server 2003), are there any good components available? I've used the NeroCOM sdk that used to come with Nero but they no longer support the sdk in the latest versions of Nero. I learned that Microsoft has created an IMAPI2 upgrade for Window...
For adding DVD burning functionality to your .NET application running on Windows Server 2003, you have a few options. Since you've mentioned the limitations with the NeroCOM SDK and your interest in using IMAPI2, here are some recommendations: ### 1. **IMAPI2 (Image Mastering API)** IMAPI2 is a solid choice for burni...
5,521
[ { "from": "human", "value": "I'd like to add dvd burning functionality to my .Net app (running on Windows Server 2003), are there any good components available? I've used the NeroCOM sdk that used to come with Nero but they no longer support the sdk in the latest versions of Nero. I learned that Microsoft...
or "How do I answer questions on SO in Firefox using gVim inside the textboxes?"
To answer questions on Stack Overflow (SO) using gVim inside the textboxes while browsing with Firefox, you can follow these steps: 1. **Install gVim**: Ensure you have gVim installed on your system. You can download it from the official Vim website if you haven't already. 2. **Set Up a Clipboard Manager**: Since you...
7,256
[ { "from": "human", "value": "or \"How do I answer questions on SO in Firefox using gVim inside the textboxes?\"\n" }, { "from": "gpt", "value": "To answer questions on Stack Overflow (SO) using gVim inside the textboxes while browsing with Firefox, you can follow these steps:\n\n1. **Install gVi...
Is it possible to customize the syntax highlighting in Visual Studio 2005? Up to now, I found no way to do this. In eclipse for example, it's possible to setup custom highlighting.
Visual Studio 2005 has limited support for customizing syntax highlighting compared to some more modern IDEs like Eclipse. However, you can still make some adjustments to the color settings for different elements in your code. Here are the steps to customize the syntax highlighting in Visual Studio 2005: 1. **Open th...
8,813
[ { "from": "human", "value": "Is it possible to customize the syntax highlighting in Visual Studio 2005? Up to now, I found no way to do this.\nIn eclipse for example, it's possible to setup custom highlighting.\n" }, { "from": "gpt", "value": "Visual Studio 2005 has limited support for customizi...
I've kind of backed myself into a corner here. I have a series of UserControls that inherit from a parent, which contains a couple of methods and events to simplify things so I don't have to write lines and lines of near-identical code. As you do. The parent contains no other controls. What I want to do is just have on...
It sounds like you're encountering an issue related to method overriding in a class hierarchy, particularly with event handlers. When you define a method in the parent control that has the same signature as an event handler in a derived class, Visual Studio (and the C# compiler) will produce a warning because it sees t...
6,540
[ { "from": "human", "value": "I've kind of backed myself into a corner here.\nI have a series of UserControls that inherit from a parent, which contains a couple of methods and events to simplify things so I don't have to write lines and lines of near-identical code. As you do. The parent contains no other c...
In how many languages is Null not equal to anything not even Null?
In many programming languages, `null` or its equivalent is not equal to anything, including itself. This behavior is typically seen in languages that follow the principles of "Type Theory" or have a specific implementation for `null` values. Here are some notable examples: 1. **JavaScript**: In JavaScript, `null` is e...
6,685
[ { "from": "human", "value": "In how many languages is Null not equal to anything not even Null?\n" }, { "from": "gpt", "value": "In many programming languages, `null` or its equivalent is not equal to anything, including itself. This behavior is typically seen in languages that follow the princi...
When someone logs into a site using Open ID, what goes on behind the scene? can someone explain to me the work flow/steps of what happens during a typical login from a partner open ID site? (like this site) i.e. when I login at myopenid, what is passed into this site? how does SO know it was a correct login?
When you log in to a site using OpenID, there is a series of steps that takes place to authenticate your identity using an OpenID provider (such as MyOpenID). Here's a typical workflow of what happens behind the scenes during an OpenID login: ### 1. User Initiates Login - You click the "Log in with OpenID" button on t...
5,972
[ { "from": "human", "value": "When someone logs into a site using Open ID, what goes on behind the scene?\ncan someone explain to me the work flow/steps of what happens during a typical login from a partner open ID site? (like this site)\ni.e. when I login at myopenid, what is passed into this site? how does...
Using Oracle 10g, accessed via Perl DBI, I have a table with a few tens of million rows being updated a few times per second while being read from much more frequently form another process. Soon the update frequency will increase by an order of magnitude (maybe two). Someone suggested that committing every N updates in...
Using Oracle 10g with Perl DBI for high-frequency updates and reads can indeed lead to performance bottlenecks, especially as the update frequency increases. Here's a breakdown of your questions: ### 1. Will committing every N updates be faster or slower? It generally will be faster when compared to committing after e...
6,643
[ { "from": "human", "value": "Using Oracle 10g, accessed via Perl DBI, I have a table with a few tens of million rows being updated a few times per second while being read from much more frequently form another process.\nSoon the update frequency will increase by an order of magnitude (maybe two).\nSomeone s...
OK, this kind of follows on from my previous question. What I would really like to do is create some sort of attribute which allows me to decorate a method that will break the build. Much like the Obsolete("reason", true) attribute, but without falsely identifying obsolete code. To clarify: I dont want it to break the ...
Creating a custom attribute that breaks the build when certain methods are called can be a useful tool in managing code quality and ensuring certain methods are not used in production. In C#, you can achieve this by leveraging Roslyn analyzers. Here’s a general guide on how to create an attribute that serves your purpo...
1,650
[ { "from": "human", "value": "OK, this kind of follows on from my previous question.\nWhat I would really like to do is create some sort of attribute which allows me to decorate a method that will break the build. Much like the Obsolete(\"reason\", true) attribute, but without falsely identifying obsolete co...
When I use CTRL+H I end up on the Java Search tab. I would very much like a shortcut to go directly to File Search instead. Is that possible? See image here for what I'm talking about:
Yes, you can change the keybindings in your IDE (such as Eclipse or IntelliJ IDEA) to customize your shortcuts. To directly access the File Search tab instead of the Java Search tab when using `CTRL+H`, follow these steps based on the IDE you are using: ### For Eclipse: 1. **Open Preferences:** - Go to `Window` > `...
7,600
[ { "from": "human", "value": "When I use CTRL+H I end up on the Java Search tab. I would very much like a shortcut to go directly to File Search instead. Is that possible?\nSee image here for what I'm talking about:\n\n" }, { "from": "gpt", "value": "Yes, you can change the keybindings in your ID...
I would like to convert a string into a node. I have a method that is defined to take a node, but the value I have is a string (it is hard coded). How do I turn that string into a node? So, given an XQuery method: define function foo($bar as node()*) as node() { (: unimportant details :) } I have a string that I wan...
In XQuery, you can convert a string into a node using the `parse-xml` function. This function takes a string containing well-formed XML and converts it into an XML node. Below is an example of how you can use `parse-xml` to convert your string into a node and then pass it to the `foo` function. Assuming you have a str...
9,718
[ { "from": "human", "value": "I would like to convert a string into a node. I have a method that is defined to take a node, but the value I have is a string (it is hard coded). How do I turn that string into a node?\nSo, given an XQuery method:\ndefine function foo($bar as node()*) as node() {\n (: unimport...
I am stress testing a .NET web application. I did this for 2 reasons: I wanted to see what performance was like under real world conditions and also to make sure we hadn't missed any problems during testing. We had 30 concurrent users in the application using it as they would during the normal course of their jobs. Mo...
Improving the performance of your .NET web application, especially under concurrent load, requires a systematic approach. Here are several strategies you can employ: ### 1. **Optimize Server Resources** - **Increase RAM:** 2 GB of RAM is quite limited for a web application. Consider increasing the memory available to ...
7,040
[ { "from": "human", "value": "I am stress testing a .NET web application. I did this for 2 reasons: I wanted to see what performance was like under real world conditions and also to make sure we hadn't missed any problems during testing. We had 30 concurrent users in the application using it as they would d...
Are there any free (non-GPL) libraries for .NET that provide IMAP4 server side functionality? E.g. handles the socket level and message handshaking so that an IMAP4 client (such as outlook) can retrieve, read, edit and/or delete messages. I am not trying to connect to an IMAP4 server, I'd like the assistance to imple...
As of my last update in October 2023, there are limited options for free libraries that allow you to implement an IMAP4 server in .NET without being restricted by the GPL license. Here are a few possibilities you can explore: 1. **MailKit**: - While MailKit itself is primarily designed for client-side operations, i...
7,237
[ { "from": "human", "value": "Are there any free (non-GPL) libraries for .NET that provide IMAP4 server side functionality?\nE.g. handles the socket level and message handshaking so that an IMAP4 client (such as outlook) can retrieve, read, edit and/or delete messages. \nI am not trying to connect to an IMA...
In order to perform a case-sensitive search/replace on a table in a SQL Server 2000/2005 database, you must use the correct collation. How do you determine whether the default collation for a database is case-sensitive, and if it isn't, how to perform a case-sensitive search/replace?
To determine whether the default collation for a SQL Server 2000/2005 database is case-sensitive, you can use the following query to retrieve the collation settings of the database: ```sql SELECT DATABASEPROPERTYEX('YourDatabaseName', 'Collation') AS DatabaseCollation; ``` Replace `'YourDatabaseName'` with the name o...
8,415
[ { "from": "human", "value": "In order to perform a case-sensitive search/replace on a table in a SQL Server 2000/2005 database, you must use the correct collation.\nHow do you determine whether the default collation for a database is case-sensitive, and if it isn't, how to perform a case-sensitive search/re...
I've been playing with RSS feeds this week, and for my next trick I want to build one for our internal application log. We have a centralized database table that our myriad batch and intranet apps use for posting log messages. I want to create an RSS feed off of this table, but I'm not sure how to handle the volume- ...
Creating an RSS feed for your internal application log can be a great way to monitor activity, but handling a high volume of log entries efficiently is crucial. Here are some strategies you can consider to manage the volume effectively: 1. **Limit the Feed Size**: Instead of providing all entries, limit the number of ...
7,910
[ { "from": "human", "value": "I've been playing with RSS feeds this week, and for my next trick I want to build one for our internal application log. We have a centralized database table that our myriad batch and intranet apps use for posting log messages. I want to create an RSS feed off of this table, bu...
Prefixing variable and method names with an underscore is a common convention for marking things as private. Why does all the methods on the page tracker class in the Google Analytics tracking code (ga.js) start with an underscore, even the ones that are clearly public, like _getTracker and _trackPageView?
In the context of the Google Analytics tracking code (ga.js), the prefixing of method names with an underscore (e.g., `_getTracker`, `_trackPageView`) is indeed a convention that suggests these methods are intended to be treated as internal or private. However, the reasons for this pattern can vary: 1. **Internal API*...
8,270
[ { "from": "human", "value": "Prefixing variable and method names with an underscore is a common convention for marking things as private. Why does all the methods on the page tracker class in the Google Analytics tracking code (ga.js) start with an underscore, even the ones that are clearly public, like _ge...
I've built one, but I'm convinced it's wrong. I had a table for customer details, and another table with the each date staying (i.e. a week's holiday would have seven records). Is there a better way? I code in PHP with MySQL
Based on your description, it sounds like you're managing customer details and their stay dates in a relational database. While your approach isn't necessarily wrong, it may not be the most efficient or normalized design. Here's a suggestion on how to improve your database schema. ### Suggested Database Schema 1. **C...
5,300
[ { "from": "human", "value": "I've built one, but I'm convinced it's wrong.\nI had a table for customer details, and another table with the each date staying (i.e. a week's holiday would have seven records).\nIs there a better way?\nI code in PHP with MySQL\n" }, { "from": "gpt", "value": "Based ...
I have searched for such a plugin but haven't found any. I need a facility to "tag" my java files. Similar to tagging on stackoverflow. I want to be able to group my files based on projects/tasks I wam working on. Mylyn helps a little but it dynamically changes the context (list of resources associated with a task) bas...
If you're looking for a simple tagging mechanism for your Java files in your workspace, there are a few approaches you might consider, even if there isn't a dedicated plugin that meets your exact needs. Here are some options: 1. **File Naming Conventions**: - You can modify the names of your files to include tags. ...
7,470
[ { "from": "human", "value": "I have searched for such a plugin but haven't found any. I need a facility to \"tag\" my java files. Similar to tagging on stackoverflow.\nI want to be able to group my files based on projects/tasks I wam working on. Mylyn helps a little but it dynamically changes the context (l...
Best practices recommend not installing Sql Server to run as SYSTEM. What is the bare minumum you need to give the user account you create for it?
When installing SQL Server, it's a best practice to create a dedicated user account for the SQL Server service instead of running it under the built-in SYSTEM account. This enhances security by following the principle of least privilege. Here are the bare minimum permissions and considerations for the dedicated user ac...
8,939
[ { "from": "human", "value": "Best practices recommend not installing Sql Server to run as SYSTEM. What is the bare minumum you need to give the user account you create for it?\n" }, { "from": "gpt", "value": "When installing SQL Server, it's a best practice to create a dedicated user account fo...
What culprits are the most likely to cause a 404 resource not found error when a page in a given .WAR, autocreated by Sun's J2EE deploytool, is trying to load a Servlet in the same .WAR file? Eg: HTTP Status 404 - /MyServlet/MyServlettype Status reportmessage /MyServlet/MyServletdescription The requested resource (/...
A 404 Resource Not Found error can be caused by several factors when a servlet in a .WAR file is not being found. Here are some common culprits to consider: ### 1. **Incorrect Servlet Mapping in web.xml:** - The servlet may not be properly mapped in the `web.xml` deployment descriptor file. Ensure the `<servlet>` a...
7,301
[ { "from": "human", "value": "What culprits are the most likely to cause a 404 resource not found error when a page in a given .WAR, autocreated by Sun's J2EE deploytool, is trying to load a Servlet in the same .WAR file?\n\nEg:\n\n HTTP Status 404 - /MyServlet/MyServlettype Status reportmessage /MyServlet/M...
I am having trouble with my Visual Studio 2005 IntelliSense for some time now. It used to work fine, but for some reason the 'Updating IntelliSense...' does no longer seem to be able to complete for the solution I'm working on currenly- it simply gets stuck somewhere at about 3-bars of progress and blocks one of my pre...
It sounds like you're encountering a frustrating issue with IntelliSense in Visual Studio 2005, especially considering the complexity of your project. Here are several approaches you can try to resolve the issue: 1. **Delete the .ncb File Again**: You've mentioned that you've already tried this, but it's worth doing o...
7,859
[ { "from": "human", "value": "I am having trouble with my Visual Studio 2005 IntelliSense for some time now.\nIt used to work fine, but for some reason the 'Updating IntelliSense...' does no longer seem to be able to complete for the solution I'm working on currenly- it simply gets stuck somewhere at about 3...
If the major axis of the ellipse is vertical or horizontal, it's easy to calculate the bounding box, but what about when the ellipse is rotated? The only way I can think of so far is to calculate all the points around the perimeter and find the max/min x and y values. It seems like there should be a simpler way. If the...
To find the axis-aligned bounding box (AABB) of a rotated ellipse without explicitly calculating all perimeter points, you can use some properties of ellipses and their parametric equations. ### Equation of a Rotated Ellipse A general equation of a rotated ellipse can be written as: \[ \frac{(x - h)^2}{a^2} + \frac{...
6,178
[ { "from": "human", "value": "If the major axis of the ellipse is vertical or horizontal, it's easy to calculate the bounding box, but what about when the ellipse is rotated?\nThe only way I can think of so far is to calculate all the points around the perimeter and find the max/min x and y values. It seems ...
Say I have a table called myTable. What is the SQL command to return all of the field names of this table? If the answer is database specific then I need SQL Server right now but would be interested in seeing the solution for other database systems as well.
To retrieve the field (column) names of a table in SQL Server, you can use the following query: ```sql SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'myTable'; ``` This query selects the `COLUMN_NAME` from the `INFORMATION_SCHEMA.COLUMNS` view, filtering by the table name you specify. ### Oth...
8,957
[ { "from": "human", "value": "Say I have a table called myTable. What is the SQL command to return all of the field names of this table? If the answer is database specific then I need SQL Server right now but would be interested in seeing the solution for other database systems as well.\n" }, { "fr...
I've seen SaaS applications hosted in many different ways. Is it a good idea to split features and modules across multiple databases? For example, putting things like the User table on one DB and feature/app specific tables on another DB and perhaps other commonly shared tables in another DB?
Splitting features and modules across multiple databases in a Software as a Service (SaaS) application can have both advantages and disadvantages. Whether it is a good idea depends on various factors, including the architecture of your application, the size of your user base, and the complexity of your features. Here a...
6,273
[ { "from": "human", "value": "I've seen SaaS applications hosted in many different ways. Is it a good idea to split features and modules across multiple databases? For example, putting things like the User table on one DB and feature/app specific tables on another DB and perhaps other commonly shared tables ...
I read the Git manual, FAQ, Git - SVN crash course, etc. and they all explain this and that, but nowhere can you find a simple instruction like: SVN repository in: svn://myserver/path/to/svn/repos Git repository in: git://myserver/path/to/git/repos git-do-the-magic-svn-import-with-history \ svn://myserver/path/to/svn/r...
Certainly! If you want to convert an SVN repository to a Git repository while preserving the history, follow these steps: ### Prerequisites Make sure you have `git` and `git-svn` installed on your system. You can typically install them using your package manager. For example, on Ubuntu, you can do: ```bash sudo apt-g...
5,448
[ { "from": "human", "value": "I read the Git manual, FAQ, Git - SVN crash course, etc. and they all explain this and that, but nowhere can you find a simple instruction like:\nSVN repository in: svn://myserver/path/to/svn/repos\nGit repository in: git://myserver/path/to/git/repos\ngit-do-the-magic-svn-import...
I switched locally from subversion 1.4 to 1.5, our server still runs 1.4. Since then every merge takes ages to perform. What took only a couple of seconds is now in the area of 5-10 minutes (or more). There is no difference between the command line client and tortoise (so we talk about the windows versions). Has anybod...
The issue you're experiencing could be due to several factors related to the differences between Subversion 1.4 and 1.5, especially considering that your local client is now a newer version while your server remains on an older version. Here are some potential causes and solutions to consider: 1. **Merge Algorithm Cha...
2,437
[ { "from": "human", "value": "I switched locally from subversion 1.4 to 1.5, our server still runs 1.4. Since then every merge takes ages to perform. What took only a couple of seconds is now in the area of 5-10 minutes (or more). There is no difference between the command line client and tortoise (so we tal...
I am looking for a tool that can serialize and/or transform SQL Result Sets into XML. Getting dumbed down XML generation from SQL result sets is simple and trivial, but that's not what I need. The solution has to be database neutral, and accepts only regular SQL query results (no db xml support used). A particular chal...
It sounds like you're looking for a specialized tool or library that can handle complex transformations of SQL result sets directly into XML, particularly with support for nested structures, without relying on intermediate object representation, and that also supports streaming for large data sets. Here are a few optio...
5,496
[ { "from": "human", "value": "I am looking for a tool that can serialize and/or transform SQL Result Sets into XML. Getting dumbed down XML generation from SQL result sets is simple and trivial, but that's not what I need.\nThe solution has to be database neutral, and accepts only regular SQL query results (...
Besides the LD_PRELOAD trick , and Linux Kernel Modules that replace a certain syscall with one provided by you , is there any possibility to intercept a syscall ( open for example ) , so that it first goes through your function , before it reaches the actual open ?
Yes, besides the LD_PRELOAD technique and Linux Kernel Modules (LKM), there are other methods to intercept system calls in Linux. Here are a few possibilities: 1. **ptrace**: The `ptrace` system call allows a process to observe and control the execution of another process. By using `ptrace`, you can intercept system c...
8,430
[ { "from": "human", "value": "Besides the LD_PRELOAD trick , and Linux Kernel Modules that replace a certain syscall with one provided by you , is there any possibility to intercept a syscall ( open for example ) , so that it first goes through your function , before it reaches the actual open ?\n" }, { ...
How do I find out which sound files the user has configured in the control panel? Example: I want to play the sound for "Device connected". Which API can be used to query the control panel sound settings? I see that there are some custom entries made by third party programs in the control panel dialog, so there has to ...
To query and play sounds associated with system events, like "Device connected," you can indeed use the `PlaySound` function in the Windows API. This function can play sounds that are specified in the registry. Here's a brief overview of how you can query and play system sounds, including the specific sound for "Devic...
6,210
[ { "from": "human", "value": "How do I find out which sound files the user has configured in the control panel?\nExample: I want to play the sound for \"Device connected\".\nWhich API can be used to query the control panel sound settings?\nI see that there are some custom entries made by third party programs...
I know the colours are changed in Environment > Fonts and Colors but I haven't found out which Display Item the object is. Can someone please tell how I can colour the following code: lblMessage.Text = "You have successfully answered my question!" I have the string coloured pink, I would like the lblMessage purple an...
To customize the syntax highlighting in your code editor (like Visual Studio, for example) to color specific parts of your code, you need to identify the appropriate display items in the settings. Below is a general guide on how to achieve your goal of coloring the different parts of the code snippet: ### Steps to Cus...
8,796
[ { "from": "human", "value": "I know the colours are changed in Environment > Fonts and Colors but I haven't found out which Display Item the object is.\nCan someone please tell how I can colour the following code:\n\nlblMessage.Text = \"You have successfully answered my question!\"\n\nI have the string colo...
This is a follow up question to This Question. I like (and understand) the solution there. However, in the code I am working in, another way to solve the same problem is used: function exist(sFN) { if(self[sFN]) return true; return false; } It seems to work fine, although I don't understand how. Does it work?...
The function you've provided checks for the existence of a property in the global scope (`self` object), which is often used in web browsers to refer to the global context (similar to `window` in browsers). Here's a breakdown of how your `exist` function works: ### How it Works ```javascript function exist(sFN) { ...
7,508
[ { "from": "human", "value": "This is a follow up question to This Question. \nI like (and understand) the solution there. However, in the code I am working in, another way to solve the same problem is used:\nfunction exist(sFN) {\n if(self[sFN]) return true;\n return false;\n}\n\nIt seems to work fine...
I am just starting out with DI & unit testing and have hit a snag which I am sure is a no brainer for those more experienced devs : I have a class called MessageManager which receives data and saves it to a db. Within the same assembly (project in Visual Studio) I have created a repository interface with all the method...
It sounds like you're encountering a circular dependency issue, which is a common challenge when setting up Dependency Injection (DI) and structuring your projects in a clean and maintainable way. Here’s a breakdown of how you can approach this problem: ### Problem Breakdown 1. **Circular Dependency**: - `MessageM...
5,964
[ { "from": "human", "value": "I am just starting out with DI & unit testing and have hit a snag which I am sure is a no brainer for those more experienced devs :\nI have a class called MessageManager which receives data and saves it to a db. Within the same assembly (project in Visual Studio) I have created ...
So far, I've only used Rational Quantify. I've heard great things about Intel's VTune, but have never tried it! Edit: I'm mostly looking for software that will instrument the code, as I guess that's about the only way to get very fine results. See also: What are some good profilers for native C++ on Windows?
When looking for profilers that can instrument C++ code on Windows to gather fine-grained performance data, you have several excellent options aside from Rational Quantify and Intel VTune. Here are some of the top profilers you might consider: 1. **Intel VTune Profiler**: - As you mentioned, VTune is a powerful pro...
5,481
[ { "from": "human", "value": "So far, I've only used Rational Quantify. I've heard great things about Intel's VTune, but have never tried it!\nEdit: I'm mostly looking for software that will instrument the code, as I guess that's about the only way to get very fine results.\n\nSee also:\nWhat are some good p...
Given a moderately complex XML structure (dozens of elements, hundreds of attributes) with no XSD and a desire to create an object model, what's an elegant way to avoid writing boilerplate from_xml() and to_xml() methods? For instance, given: <Foo bar="1"><Bat baz="blah"/></Foo> How do I avoid writing endless sequenc...
To build an elegant object model from a complex XML structure while avoiding boilerplate code for serialization (i.e., `from_xml` and `to_xml` methods), you can leverage Ruby's metaprogramming capabilities. This approach allows you to dynamically define these methods based on the structure of your XML. Here's how you ...
5,879
[ { "from": "human", "value": "Given a moderately complex XML structure (dozens of elements, hundreds of attributes) with no XSD and a desire to create an object model, what's an elegant way to avoid writing boilerplate from_xml() and to_xml() methods? \nFor instance, given:\n<Foo bar=\"1\"><Bat baz=\"blah\"/...
So I get that most of you are frowning at me for not currently using any source control. I want to, I really do, now that I've spent some time reading the questions / answers here. I am a hobby programmer and really don't do much more than tinker, but I've been bitten a couple of times now not having the 'time mach...
It's great to hear that you're looking to get into version control! It can really save you from losing work and allows you to experiment without fear. Let's break down how you can effectively use source control in your workflow, specifically for your PHP projects. ### Basic Understanding of Source Control 1. **Reposi...
4,090
[ { "from": "human", "value": "So I get that most of you are frowning at me for not currently using any source control. I want to, I really do, now that I've spent some time reading the questions / answers here. I am a hobby programmer and really don't do much more than tinker, but I've been bitten a coup...
I've got a C++ program that uses SQLite. I want to store the SQL queries in a separate file -- a plain-text file, not a source code file -- but embed that file in the executable file like a resource. (This has to run on Linux, so I can't store it as an actual resource as far as I know, though that would be perfect if i...
On Linux, you do not have a built-in resource system like Windows does, but there are several ways to achieve your goal of embedding a plain-text file within a C++ executable. Below are some common approaches that you can consider: ### 1. Use a Preprocessor to Include the File You can use a preprocessor tool (like `xx...
7,055
[ { "from": "human", "value": "I've got a C++ program that uses SQLite. I want to store the SQL queries in a separate file -- a plain-text file, not a source code file -- but embed that file in the executable file like a resource.\n(This has to run on Linux, so I can't store it as an actual resource as far as...
I re-image one of my machines regularly; and have a script that I run after the OS install completes to configure my machine; such that it works how I like. I happen to have my data on another drive...and I'd like to add code to my script to change the location of the Documents directory from "C:\Users\bryansh\Document...
You can change the location of the Documents directory for a user by modifying the Windows Registry and updating the folder's location using the `mklink` command. Here's a simple approach to do this via a script after the OS installation. ### Using PowerShell Script You can create a PowerShell script to change the Do...
6,121
[ { "from": "human", "value": "I re-image one of my machines regularly; and have a script that I run after the OS install completes to configure my machine; such that it works how I like.\nI happen to have my data on another drive...and I'd like to add code to my script to change the location of the Documents...
When using os.system() it's often necessary to escape filenames and other arguments passed as parameters to commands. How can I do this? Preferably something that would work on multiple operating systems/shells but in particular for bash. I'm currently doing the following, but am sure there must be a library function...
Using `os.system()` can lead to various issues, especially with escaping filenames and arguments. For a more robust solution, especially when you need to handle filenames containing special characters, consider using `subprocess` instead of `os.system()`. The `subprocess` module is more powerful and allows for better h...
7,992
[ { "from": "human", "value": "When using os.system() it's often necessary to escape filenames and other arguments passed as parameters to commands. How can I do this? Preferably something that would work on multiple operating systems/shells but in particular for bash.\nI'm currently doing the following, bu...
What's the proper way to convert from a scientific notation string such as "1.234567E-06" to a floating point variable using C#?
In C#, you can convert a scientific notation string, such as "1.234567E-06", to a floating point variable using the `float.Parse` or `double.Parse` methods. Both methods can handle scientific notation strings. Here’s how to do it: ### Using `float.Parse` If you want to convert the string to a `float` type: ```csharp...
9,222
[ { "from": "human", "value": "What's the proper way to convert from a scientific notation string such as \"1.234567E-06\" to a floating point variable using C#?\n" }, { "from": "gpt", "value": "In C#, you can convert a scientific notation string, such as \"1.234567E-06\", to a floating point vari...
Are there any Common Lisp implementations for .Net?
Yes, there are a few Common Lisp implementations that can work with .NET, although they may not be as widely known or used as other programming languages that target the .NET ecosystem. Here are a couple of options: 1. **CLISP**: While CLISP itself is not specifically designed for .NET, it can be integrated into .NET ...
8,559
[ { "from": "human", "value": "Are there any Common Lisp implementations for .Net?\n" }, { "from": "gpt", "value": "Yes, there are a few Common Lisp implementations that can work with .NET, although they may not be as widely known or used as other programming languages that target the .NET ecosyst...
As the title states, I'd be interested to find a safe feature-based (that is, without using navigator.appName or navigator.appVersion) way to detect Google Chrome. By feature-based I mean, for example: if(window.ActiveXObject) { // internet explorer! } Edit: As it's been pointed out, the question doesn't make much...
Detecting a specific browser like Google Chrome using feature detection can be tricky, as browsers often share a lot of common features. However, there are some properties and features that can help you identify Chrome, at least to a certain degree. Here are a few feature-based checks that you can use to infer that th...
5,662
[ { "from": "human", "value": "As the title states, I'd be interested to find a safe feature-based (that is, without using navigator.appName or navigator.appVersion) way to detect Google Chrome.\nBy feature-based I mean, for example:\nif(window.ActiveXObject) {\n // internet explorer!\n}\n\nEdit: As it's b...
I'm trying to run a batch file, as another user, from my web app. For some reason, the batch file hangs! I can see "cmd.exe" running in the task manager, but it just sits there forever, unable to be killed, and the batch file is not running. Here's my code: SecureString password = new SecureString(); foreach (char c in...
The issue you're experiencing when running a batch file as another user from your web app is quite common, particularly because of how standard input/output is managed when launching processes in a different context. When you use `RedirectStandardOutput` with `UseShellExecute` set to `false`, you're trying to read th...
4,033
[ { "from": "human", "value": "I'm trying to run a batch file, as another user, from my web app. For some reason, the batch file hangs! I can see \"cmd.exe\" running in the task manager, but it just sits there forever, unable to be killed, and the batch file is not running. Here's my code:\nSecureString passw...
How do I convert a datetime string in local time to a string in UTC time? I'm sure I've done this before, but can't find it and SO will hopefully help me (and others) do that in future. Clarification: For example, if I have 2008-09-17 14:02:00 in my local timezone (+10), I'd like to generate a string with the equivale...
To convert a datetime string from local time to UTC, you can use Python's `pytz` library along with the `datetime` module. This approach allows you to handle time zone conversions properly, including considerations for Daylight Saving Time (DST). Here’s how to do it step by step: 1. **Install the `pytz` library**: If...
9,250
[ { "from": "human", "value": "How do I convert a datetime string in local time to a string in UTC time?\nI'm sure I've done this before, but can't find it and SO will hopefully help me (and others) do that in future.\nClarification: For example, if I have 2008-09-17 14:02:00 in my local timezone (+10), I'd ...
How do you schedule a task in Windows XP to run when you shut down windows. Such that I want to run a simple command line program I wrote in c# everytime I shut down windows. There doesn't seem to be an option in scheduled tasks to perform this task when my computer shuts down.
In Windows XP, you cannot directly schedule a task to run at shutdown through the Task Scheduler. However, you can achieve this using the Windows Event Viewer and creating a batch file or script that runs your C# program when the system shuts down. Here’s how you can set it up: ### Step 1: Create a Batch File 1. **Cr...
7,348
[ { "from": "human", "value": "How do you schedule a task in Windows XP to run when you shut down windows. Such that I want to run a simple command line program I wrote in c# everytime I shut down windows. There doesn't seem to be an option in scheduled tasks to perform this task when my computer shuts down.\...
I have a Perl script where I maintain a very simple cache using a hash table. I would like to clear the hash once it occupies more than n bytes, to avoid Perl (32-bit) running out of memory and crashing. I can do a check on the number of keys-value pairs: if (scalar keys %cache > $maxSize) { %cache = (); } But is ...
In Perl, while you cannot directly check the memory usage of a hash, you can estimate its memory footprint using a combination of the size of the keys and values in the hash. This involves calculating the memory size based on the number of keys and their values. However, it's important to note that this is only an esti...
6,870
[ { "from": "human", "value": "I have a Perl script where I maintain a very simple cache using a hash table. I would like to clear the hash once it occupies more than n bytes, to avoid Perl (32-bit) running out of memory and crashing. \nI can do a check on the number of keys-value pairs:\nif (scalar keys %cac...
I have a strange problem with my cake (cake_1.2.0.7296-rc2). My start()-action runs twice, under certain circumstances, even though only one request is made. The triggers seem to be : - loading an object like: $this->Questionnaire->read(null, $questionnaire_id); - accessing $this-data If I disable the call to loadAver...
Hi Stu, It looks like you're encountering an issue where the `start()` method in your `questionnaires_controller` is being triggered more than once under certain conditions. This kind of problem can often arise due to several common issues, particularly with how CakePHP handles requests and redirects. Here are a few t...
4,935
[ { "from": "human", "value": "I have a strange problem with my cake (cake_1.2.0.7296-rc2).\nMy start()-action runs twice, under certain circumstances, even though only one request is made.\nThe triggers seem to be :\n- loading an object like: $this->Questionnaire->read(null, $questionnaire_id);\n- accessing ...
I would like to have a Guile script, which implements functions, which output test result messages according to the TAP protocol.
The Test Anything Protocol (TAP) is a simple text-based interface used for reporting test results. Below is a Guile script that implements functions to output test result messages according to the TAP protocol. This script includes functions for starting a test, printing passing tests, failing tests, and completing the...
5,952
[ { "from": "human", "value": "I would like to have a Guile script, which implements functions, which output test result messages according to the TAP protocol.\n" }, { "from": "gpt", "value": "The Test Anything Protocol (TAP) is a simple text-based interface used for reporting test results. Below...
I've used subversion for a while, and used the svnmerge.py script for a while in my old job to manage merges between branches. I believe Subversion 1.5 is now out, and was supposed to have some branch / merge management system integrated with it. So, can someone give me a quick overview of how to track merges in a bra...
Subversion 1.5 introduced a built-in mechanism for tracking merges between branches, which significantly enhances the merge management capabilities compared to previous versions. Here’s a quick overview of how to use this feature and some considerations to keep in mind: ### Tracking Merges in Subversion 1.5 1. **Merg...
4,649
[ { "from": "human", "value": "I've used subversion for a while, and used the svnmerge.py script for a while in my old job to manage merges between branches. I believe Subversion 1.5 is now out, and was supposed to have some branch / merge management system integrated with it.\nSo, can someone give me a quic...
I'm interested in finding good icons/images that can be used in both 'free' and proprietary programs. Please include a description of any license restrictions associated with the source of the icons you suggest.
There are several sources where you can find good icons and images that can be used in both free and proprietary programs. Below are some popular options along with a description of their license restrictions: ### 1. **Flaticon** - **Website**: [Flaticon.com](https://www.flaticon.com) - **License**: Flaticon offers bo...
3,985
[ { "from": "human", "value": "I'm interested in finding good icons/images that can be used in both 'free' and proprietary programs. \nPlease include a description of any license restrictions associated with the source of the icons you suggest.\n" }, { "from": "gpt", "value": "There are several so...
I'm looking into writing a audio syntesizer in Java, and was wondering if anybody has any advice or good resources for writing such a program. I'm looking for info on generating raw sound waves, how to output them into a usable form (playing over speakers), as well as general theory on the topic. Thanks guys.
Writing an audio synthesizer in Java is a rewarding endeavor! Here are some tips, resources, and general theories that you can explore to help you with your project: ### 1. **Understanding Sound Synthesis Basics** Before diving into coding, it's important to grasp the basics of sound synthesis: - **Waveforms**: Famili...
2,334
[ { "from": "human", "value": "I'm looking into writing a audio syntesizer in Java, and was wondering if anybody has any advice or good resources for writing such a program. I'm looking for info on generating raw sound waves, how to output them into a usable form (playing over speakers), as well as general th...
I have to choose an online WYSIWYG editor. I'm pending between TinyMCE and Xinha. My application is developed in Asp.Net 3.5. Could you help me with with some pros and cons?
Certainly! Both TinyMCE and Xinha are popular WYSIWYG editors, but they have their own unique features, strengths, and weaknesses. Here’s a comparison to help you make your decision, particularly in the context of an ASP.NET 3.5 application: ### TinyMCE #### Pros: 1. **Popularity and Community Support**: TinyMCE is w...
7,374
[ { "from": "human", "value": "I have to choose an online WYSIWYG editor. I'm pending between TinyMCE and Xinha. My application is developed in Asp.Net 3.5. Could you help me with with some pros and cons? \n" }, { "from": "gpt", "value": "Certainly! Both TinyMCE and Xinha are popular WYSIWYG edito...
Has anyone successfully talked profibus from a .NET application? If you did, what device/card did you use to accomplish this, what was the application, and did you use any kind of preexisting or available code?
Yes, it is indeed possible to communicate with PROFIBUS from a .NET application, though it typically requires a specific setup including compatible hardware and libraries. Here’s an overview of the general approach, including hardware and software options: ### Hardware 1. **PROFIBUS Interface Cards**: - **SIEMENS ...
7,086
[ { "from": "human", "value": "Has anyone successfully talked profibus from a .NET application?\nIf you did, what device/card did you use to accomplish this, what was the application, and did you use any kind of preexisting or available code?\n" }, { "from": "gpt", "value": "Yes, it is indeed poss...
Is there a tool to automatically search through my site and test all the links? I hate running across bad urls.
Yes, there are several tools available that can automatically search through your site and test all the links to identify any broken URLs. Here are some popular options: 1. **Screaming Frog SEO Spider**: This is a desktop application that crawls your website and checks for broken links, along with other SEO-related in...
9,407
[ { "from": "human", "value": "Is there a tool to automatically search through my site and test all the links? I hate running across bad urls.\n" }, { "from": "gpt", "value": "Yes, there are several tools available that can automatically search through your site and test all the links to identify ...
I need to store app specific configuration in rails. But it has to be: reachable in any file (model, view, helpers and controllers environment specified (or not), that means each environment can overwrite the configs specified in environment.rb I've tried to use environment.rb and put something like USE_USER_APP = tr...
In Rails, if you want to set up app-specific configurations that are accessible in all parts of your application (models, views, controllers, etc.), and allow each environment (development, test, production) to override these configurations, you can use the `Rails.application.config` method for this purpose. Here's ho...
8,222
[ { "from": "human", "value": "I need to store app specific configuration in rails. But it has to be:\n\nreachable in any file (model, view, helpers and controllers\nenvironment specified (or not), that means each environment can overwrite the configs specified in environment.rb\n\nI've tried to use environme...
I've used Excel PivotTable to analyze data from my database because it allows me to "slice and dice" very quickly. As we know what is in our database tables, we all can write SQL queries that do what PivotTable does. But I am wondering why PivotTable can construct the queries so fast while it knows nothing about the d...
The efficiency and speed of constructing ad-hoc SQL queries using tools like Excel PivotTables can be attributed to several factors: ### 1. **Intuitive User Interface** PivotTables provide a user-friendly interface that allows users to drag and drop fields without needing to know the underlying SQL syntax or data rela...
3,779
[ { "from": "human", "value": "I've used Excel PivotTable to analyze data from my database because it allows me to \"slice and dice\" very quickly. As we know what is in our database tables, we all can write SQL queries that do what PivotTable does. \nBut I am wondering why PivotTable can construct the querie...
I've read time and time again that TDD/test first is more difficult with MSTest than it is with other testing frameworks such as nUnit, MBUnit, etc... What are some suggested manual workarounds and/or 3rd party bits that you suggest when MSTest is the only option due to infrastructure policy? I'm mainly wondering about...
Test-Driven Development (TDD) using MSTest can indeed present some challenges compared to other testing frameworks like NUnit or MbUnit, primarily due to certain limitations in MSTest, especially in older versions like that found in Visual Studio 2008. However, there are ways to enhance your testing experience and make...
6,403
[ { "from": "human", "value": "I've read time and time again that TDD/test first is more difficult with MSTest than it is with other testing frameworks such as nUnit, MBUnit, etc... What are some suggested manual workarounds and/or 3rd party bits that you suggest when MSTest is the only option due to infrastr...
Anyone happen to have a sample script for recursing a given directory in a filesystem with Powershell? Ultimately what I'm wanting to do is create a script that will generate NSIS file lists for me given a directory. Something very similar to what was done here with a BASH script.
Sure! You can use PowerShell to recurse through a directory and generate a list of files, which you can then format for NSIS (Nullsoft Scriptable Install System). Below is a sample PowerShell script that demonstrates how to do this: ```powershell # Set the directory you want to scan $directoryPath = "C:\Path\To\Your\D...
7,796
[ { "from": "human", "value": "Anyone happen to have a sample script for recursing a given directory in a filesystem with Powershell? Ultimately what I'm wanting to do is create a script that will generate NSIS file lists for me given a directory. Something very similar to what was done here with a BASH scrip...
Does anyone know of some good resources related to setting up heirarchical user account systems? I'm currently setting one up and am struggling with some of the more complex logic (especially with determining permissions). I was hoping I might be able to find some resources to help me along. Some Background: I'm buildi...
Designing a hierarchical user account system with nested groups and permissions can indeed be complex, especially when users can belong to multiple groups. Here are some resources and strategies that can help you manage the permissions logic: ### Resources 1. **Access Control Models**: - **RBAC (Role-Based Access ...
6,975
[ { "from": "human", "value": "Does anyone know of some good resources related to setting up heirarchical user account systems? I'm currently setting one up and am struggling with some of the more complex logic (especially with determining permissions). I was hoping I might be able to find some resources to h...
I asked a couple of coworkers about AnkhSVN and neither one of them was happy with it. One of them went as far as saying that AnkhSVN has messed up his devenv several times. What's your experience with AnkhSVN? I really miss having an IDE integrated source control tool.
AnkhSVN is a popular Subversion (SVN) client that integrates directly with Visual Studio, allowing developers to manage source control operations within their IDE. However, experiences with AnkhSVN can vary significantly among users. Some common complaints about AnkhSVN include: 1. **Stability Issues**: Some users ha...
8,723
[ { "from": "human", "value": "I asked a couple of coworkers about AnkhSVN and neither one of them was happy with it. One of them went as far as saying that AnkhSVN has messed up his devenv several times.\nWhat's your experience with AnkhSVN? I really miss having an IDE integrated source control tool.\n" },...
I'm using jquery ajax to post updates back to my server. I'm concerned about making sure I have put in place appropriate measures so that only my AJAX calls can post data. My stack is PHP on Apache against a MySQL backend. Advice greatly appreciated!
When implementing AJAX calls in a web application, it's crucial to ensure that these calls are secure to prevent unauthorized access and potential attacks such as Cross-Site Request Forgery (CSRF) and Cross-Site Scripting (XSS). Here are several measures you can take to help secure your AJAX requests: ### 1. **CSRF Pr...
5,970
[ { "from": "human", "value": "I'm using jquery ajax to post updates back to my server. I'm concerned about making sure I have put in place appropriate measures so that only my AJAX calls can post data.\nMy stack is PHP on Apache against a MySQL backend.\nAdvice greatly appreciated!\n" }, { "from": "g...
Possible Duplicate: How do I check for nulls in an '==' operator overload without infinite recursion? When I overload the == operator for objects I typically write something like this: public static bool operator ==(MyObject uq1, MyObject uq2) { if (((object)uq1 == null) || ((object)uq2 == null)) return ...
When overloading the `==` operator in C#, it's important to handle null checks correctly to avoid recursion issues. As you've noted, directly comparing the instances may lead to infinite recursion because `uq1` and `uq2` are both of type `MyObject`. Your current approach using a cast to `object` for null checks is a ...
5,683
[ { "from": "human", "value": "\nPossible Duplicate:\nHow do I check for nulls in an '==' operator overload without infinite recursion? \n\nWhen I overload the == operator for objects I typically write something like this:\n public static bool operator ==(MyObject uq1, MyObject uq2) {\n if (((object...
I've been put in charge of coming up with a training itinerary for my team at work for a migration from c++ to Visual Studio 2008 with C#. The actual language switch I'm not too worried about, its the learning curve to Visual Studio. What does everything think would be the best way to set up a training course? I w...
Creating a training itinerary for your team's migration from C++ to C# using Visual Studio 2008 is a great opportunity to ensure they are well-equipped to make the transition smoothly. Here's a suggested training course outline that balances theoretical knowledge with practical, hands-on experience: ### Training Itine...
5,859
[ { "from": "human", "value": "I've been put in charge of coming up with a training itinerary for my team at work for a migration from c++ to Visual Studio 2008 with C#. \nThe actual language switch I'm not too worried about, its the learning curve to Visual Studio. What does everything think would be the b...
I have noticed that cURL in PHP returns different data when told to output to a file via CURLOPT_FILE as it does when told to send the output to a string via CURLOPT_RETURNTRANSFER. _RETURNTRANSFER seems to strip newlines and extra white space as if parsing it for display as standard HTML code. _FILE on the other hand...
It's great to hear that you found the solution to your problem regarding the parsing of line endings in PHP! Indeed, the difference between using single quotes and double quotes in PHP can affect how strings are interpreted. Here's a brief recap of the behavior of single and double quotes in PHP: - **Single Quotes (`...
8,949
[ { "from": "human", "value": "I have noticed that cURL in PHP returns different data when told to output to a file via CURLOPT_FILE as it does when told to send the output to a string via CURLOPT_RETURNTRANSFER.\n_RETURNTRANSFER seems to strip newlines and extra white space as if parsing it for display as st...
What options / methods / software are available to convert a JAR file to a managed .NET assembly? Please provide all commercial and non-commercial methods in the answer. These don't include solutions which require Java to be installed on the host machine.
Converting a JAR (Java ARchive) file to a managed .NET assembly can be a complex task due to the differences in language and runtime environments. However, several options are available to achieve this, both commercial and non-commercial. Below are some methods and software that do not require Java to be installed on t...
6,090
[ { "from": "human", "value": "What options / methods / software are available to convert a JAR file to a managed .NET assembly?\nPlease provide all commercial and non-commercial methods in the answer.\nThese don't include solutions which require Java to be installed on the host machine.\n" }, { "from...
I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET web application. I've got pages such as PasswordRecovery.aspx that are accessable to only Anonymous users. When I click my login link from such a page, the login page has a ReturnUrl parameter in the address bar: ...
To address the issue you're encountering with the `ReturnUrl` parameter in ASP.NET Forms Authentication, you need to ensure that the application properly checks access permissions after a user logs in. The return URL can point to a page that should not be accessible to authenticated users, such as `PasswordRecovery.asp...
6,576
[ { "from": "human", "value": "I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET web application. I've got pages such as PasswordRecovery.aspx that are accessable to only Anonymous users. When I click my login link from such a page, the login page has a ...
I am looking for good templates for writing both technical and functional specs on a project or work request. What do you use? How deep do you get while writing the specs? What general tips should I be aware of? My company needs these badly. Currently we do not use these documents at all. Edit I have read Joel's take a...
Writing effective technical and functional specifications is crucial for ensuring clarity and alignment among stakeholders in a project. Here are some templates, tips, and best practices to consider when creating these documents. ### Templates #### 1. **Functional Specification Template** **Title Page** - Project Na...
2,407
[ { "from": "human", "value": "I am looking for good templates for writing both technical and functional specs on a project or work request.\nWhat do you use? How deep do you get while writing the specs? What general tips should I be aware of?\nMy company needs these badly. Currently we do not use these docum...
(I'm using Visual C++ 2008) I've always heard that main() is required to return an integer, but here I didn't put in return 0; and and it compiled with 0 errors and 0 warnings! In the debug window it says the program has exited with code 0. If this function is named anything other than main(), the compiler complains ...
The behavior you're observing in Visual C++ 2008 is not a bug, but rather a specific behavior defined by the C++ standard. In C++, the `main()` function is the entry point of a program, and according to the C++ standard, it is required to return an integer. The return value of `main()` is used to indicate to the opera...
5,040
[ { "from": "human", "value": "(I'm using Visual C++ 2008) I've always heard that main() is required to return an integer, but here I didn't put in return 0; and and it compiled with 0 errors and 0 warnings! In the debug window it says the program has exited with code 0. If this function is named anything o...
I have a nullable property, and I want to return a null value. How do I do that in VB.NET ? Currently I use this solution, but I think there might be a better way. Public Shared ReadOnly Property rubrique_id() As Nullable(Of Integer) Get If Current.Request.QueryString("rid") <> "" Then ...
In VB.NET, when dealing with a nullable type (like `Nullable(Of Integer)`), you can simply return `Nothing` to represent a null value. In your current implementation, you are using `New Nullable(Of Integer).Value`, which is not necessary. You can simplify your property to make it clearer and more concise. Here is a re...
6,629
[ { "from": "human", "value": "I have a nullable property, and I want to return a null value. How do I do that in VB.NET ?\nCurrently I use this solution, but I think there might be a better way.\n Public Shared ReadOnly Property rubrique_id() As Nullable(Of Integer)\n Get\n If Current.Re...
I'm looking for a very simple tool to monitor the bandwidth of all my applications. No need for extra features like traffic spying, I'm just interested by bandwidth. I already know Wireshark (which is great), but what I'm looking for is more something like TcpView (great tool from Sysinternals) with current bandwidth ...
If you're looking for a simple tool to monitor the bandwidth of all your applications on Windows without the extra features like traffic spying, here are a few options you might find helpful: 1. **NetSpeedMonitor**: This is a lightweight network bandwidth monitoring tool that displays the current upload and download s...
8,569
[ { "from": "human", "value": "I'm looking for a very simple tool to monitor the bandwidth of all my applications.\nNo need for extra features like traffic spying, I'm just interested by bandwidth.\nI already know Wireshark (which is great), but what I'm looking for is more something like TcpView (great tool...
I know there are a lot of positive things mod-rewrite accomplishes. But are there any negative? Obviously if you have poorly written rules your going to have problems. But what if you have a high volume site and your constantly using mod-rewrite, is it going to have a significant impact on performance? I did a quick s...
You're correct that mod_rewrite is a powerful tool for URL manipulation in Apache, providing numerous benefits such as cleaner URLs, improved SEO, and easier site navigation. However, there are potential downsides to consider, especially for high-traffic sites. Here are some points to keep in mind regarding the negativ...
5,263
[ { "from": "human", "value": "I know there are a lot of positive things mod-rewrite accomplishes. But are there any negative? Obviously if you have poorly written rules your going to have problems. But what if you have a high volume site and your constantly using mod-rewrite, is it going to have a significa...