instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I have discovered through trial and error that the MATLAB engine function is not completely thread safe.
Does anyone know the rules?
Discovered through trial and error:
On Windows, the connection to MATLAB is via COM, so the COM Apartment threading rules apply. All calls must occur in the same thread, but multiple con... | Your observations regarding the thread safety of the MATLAB Engine API are largely correct, and it’s important to understand the underlying rules to avoid potential issues while using MATLAB from other programming environments, especially when dealing with threads. Below, I summarize the key points and threading rules ... | 25,655 | [
{
"from": "human",
"value": "I have discovered through trial and error that the MATLAB engine function is not completely thread safe.\nDoes anyone know the rules?\nDiscovered through trial and error:\nOn Windows, the connection to MATLAB is via COM, so the COM Apartment threading rules apply. All calls mus... |
I am currently looking for a way to be notified when a child is added to the visual or logical children.
I am aware of the Visual::OnVisualChildrenChanged method, but it does not apply to me since I can't always inherit and override this function. I am looking for an event.
So, is there a way for the owner of a Framew... | In WPF (Windows Presentation Foundation), there is no built-in event that directly notifies you when a child is added to the visual or logical tree of a `FrameworkElement` or `Visual`. However, you can achieve similar functionality using a combination of `PropertyChanged` notifications and attaching event handlers to m... | 23,270 | [
{
"from": "human",
"value": "I am currently looking for a way to be notified when a child is added to the visual or logical children.\nI am aware of the Visual::OnVisualChildrenChanged method, but it does not apply to me since I can't always inherit and override this function. I am looking for an event.\nS... |
Is there a way to determine the number of users that have active sessions in an ASP.NET application? I have an admin/tools page in a particular application, and I would like to display info regarding all open sessions, such as the number of sessions, and perhaps the requesting machines' addresses, or other credential ... | Yes, you can track active sessions in an ASP.NET application using different techniques. Below are methods for both ASP.NET Web Forms and ASP.NET MVC/Web API applications.
### Using `Session` State in ASP.NET
1. **Session State Management**: You can store active sessions in a shared data structure, such as a static l... | 21,522 | [
{
"from": "human",
"value": "Is there a way to determine the number of users that have active sessions in an ASP.NET application? I have an admin/tools page in a particular application, and I would like to display info regarding all open sessions, such as the number of sessions, and perhaps the requesting ... |
I would like to stress test a win32 application by sending a lot of random keystrokes to it, and I wonder if anyone could point me to some software I could use. Ideally, I should be able to specify which keystrokes can be sent, and control rate (random min/max).
| To stress test a Win32 application by sending random keystrokes, you can use several software tools that allow for automation and scripting. Here are some options you might find useful:
1. **AutoHotkey (AHK)**:
- AutoHotkey is a powerful and flexible scripting language for Windows that allows you to automate almost... | 26,263 | [
{
"from": "human",
"value": "I would like to stress test a win32 application by sending a lot of random keystrokes to it, and I wonder if anyone could point me to some software I could use. Ideally, I should be able to specify which keystrokes can be sent, and control rate (random min/max).\n"
},
{
... |
I'm in the early phases of developing a brand spanking new site with Spring + Tiles. The site needs dynamically generated breadcrumbs.
What I mean by dynamic is that the user may reach a certain site from multiple starting points. If I have views for Customers, Orders and Products, the user could reach a Product direct... | Creating dynamic breadcrumbs in a Spring application can be approached in various ways, and your concerns about maintaining a clean solution are valid. Here are several methods to create a dynamic breadcrumb structure without cluttering your controllers:
### 1. **Using a Centralized Breadcrumb Service:**
Instead of m... | 22,366 | [
{
"from": "human",
"value": "I'm in the early phases of developing a brand spanking new site with Spring + Tiles. The site needs dynamically generated breadcrumbs.\nWhat I mean by dynamic is that the user may reach a certain site from multiple starting points. If I have views for Customers, Orders and Produ... |
The code below shows a sample that I've used recently to explain the different behaviour of structs and classes to someone brand new to development. Is there a better way of doing so? (Yes - the code uses public fields - that's purely for brevity)
namespace StructsVsClasses
{
class Program
{
static void... | Your code snippet effectively illustrates the fundamental differences between structs and classes in C#. To further enhance its educational value, consider the following suggestions:
1. **Add Comments**: Explain each section of the code to guide the reader through the concepts of value types vs reference types.
2. **... | 9,916 | [
{
"from": "human",
"value": "The code below shows a sample that I've used recently to explain the different behaviour of structs and classes to someone brand new to development. Is there a better way of doing so? (Yes - the code uses public fields - that's purely for brevity)\nnamespace StructsVsClasses\n{\... |
Am I allowed to place <noscript> in the <head>?
| Yes, you can place a `<noscript>` tag in the `<head>` section of an HTML document, but it may not be very effective or semantically correct. The `<noscript>` tag is intended to provide alternative content for users who have JavaScript disabled in their browsers. Typically, it is used in the body of the document to offe... | 26,796 | [
{
"from": "human",
"value": "Am I allowed to place <noscript> in the <head>?\n"
},
{
"from": "gpt",
"value": "Yes, you can place a `<noscript>` tag in the `<head>` section of an HTML document, but it may not be very effective or semantically correct. The `<noscript>` tag is intended to provide a... |
I need to migrate Access databases to SQL Server 2005. Since this needs to be done from within a setup so that a customers' installation is transparently migrated to SQL Server 2005, I wonder if it is possible to automate the SSMA toolkit from Microsoft.
| Yes, you can automate the SQL Server Migration Assistant (SSMA) for Access to migrate Access databases to SQL Server 2005. While SSMA is primarily a graphical tool, you can run it through a command-line interface, which allows you to automate the process as part of your setup.
### Steps to Automate SSMA for Access Mig... | 24,049 | [
{
"from": "human",
"value": "I need to migrate Access databases to SQL Server 2005. Since this needs to be done from within a setup so that a customers' installation is transparently migrated to SQL Server 2005, I wonder if it is possible to automate the SSMA toolkit from Microsoft.\n"
},
{
"from": ... |
I want to dynamically add menuitems to my master page based on membership security login role. From what I've read RenderAction in the master page html could perhaps do this. Since I'm fumbling thru this I am not sure how it would look and how in the controller I check my current role. I am considering creating a table... | To dynamically add menu items to your master page (or layout) in an ASP.NET MVC application based on the user's role, you can follow these steps:
1. **Create a Table for Menu Items**: You would need a table that associates roles with menu items. For instance, your table could have columns for the role ID, menu item na... | 24,026 | [
{
"from": "human",
"value": "I want to dynamically add menuitems to my master page based on membership security login role. From what I've read RenderAction in the master page html could perhaps do this. Since I'm fumbling thru this I am not sure how it would look and how in the controller I check my curren... |
I have a HTML file that has code similar to the following.
<table>
<tr>
<td id="MyCell">Hello World</td>
</tr>
</table>
I am using javascript like the following to get the value
document.getElementById(cell2.Element.id).innerText
This returns the text "Hello World" with only 1 space between hello and wor... | In HTML, multiple consecutive spaces are collapsed into a single space when rendered in the browser. If you want to preserve multiple spaces in the text, you'll need to use a different approach. Here are some possible solutions:
### Option 1: Use Non-Breaking Spaces (` `)
You can replace spaces in your HTML with... | 27,369 | [
{
"from": "human",
"value": "I have a HTML file that has code similar to the following.\n<table>\n <tr>\n <td id=\"MyCell\">Hello World</td>\n </tr>\n</table>\n\nI am using javascript like the following to get the value\ndocument.getElementById(cell2.Element.id).innerText\n\nThis returns the text ... |
By HTTP Streaming Comet, I mean the "forever iframe" / "forever xhr" variations that don't close the connection after data has been pushed from the server, as opposed to standard polling and long polling which close and resend a new request for every server push event.
I looked at the dojo.io.cometd package and it seem... | It's great to hear that you made progress in implementing HTTP streaming with Comet-style techniques for WebKit browsers! Let’s summarize the key points and provide some additional insights that might help you or others looking to implement similar functionality.
### Key Points for HTTP Streaming Comet in WebKit
1. *... | 16,454 | [
{
"from": "human",
"value": "By HTTP Streaming Comet, I mean the \"forever iframe\" / \"forever xhr\" variations that don't close the connection after data has been pushed from the server, as opposed to standard polling and long polling which close and resend a new request for every server push event.\nI lo... |
If I have variable of type IEnumerable<List<string>> is there a LINQ statement or lambda expression I can apply to it which will combine the lists returning an IEnumerable<string>?
| Yes, you can use LINQ to combine the lists in an `IEnumerable<List<string>>` into a single `IEnumerable<string>`. One common way to achieve this is to use the `SelectMany` method, which flattens the nested collections.
Here is an example of how you can do this:
```csharp
IEnumerable<List<string>> lists = new List<Lis... | 26,351 | [
{
"from": "human",
"value": "If I have variable of type IEnumerable<List<string>> is there a LINQ statement or lambda expression I can apply to it which will combine the lists returning an IEnumerable<string>? \n"
},
{
"from": "gpt",
"value": "Yes, you can use LINQ to combine the lists in an `IE... |
I have a WordPress installation with an .htaccess file that looks like this:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
I tried installing a fresh copy of Word... | When you install a new WordPress site in a subdirectory, the existing `.htaccess` file in your root WordPress installation may interfere with the routing of requests to the subdirectory. To allow access to the new WordPress installation in the subdirectory without causing 404 errors in the root installation, you can mo... | 25,622 | [
{
"from": "human",
"value": "I have a WordPress installation with an .htaccess file that looks like this:\n# BEGIN WordPress\n<IfModule mod_rewrite.c>\nRewriteEngine On\nRewriteBase /\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{REQUEST_FILENAME} !-d\nRewriteRule . /index.php [L]\n</IfModule>\n# END ... |
I have a C# console app "App1" that reads a row of data from a table in a SQL Server 2005 DB. I want App1 to pass all the data in this row to App2, another C# console app. What is the best way to do this?
My first (naive) attempt was to do this:
object[] o = myrow.ItemArray;
// make a string that separates each item ... | Passing data between two console applications can be achieved in several ways. While your initial approach using a space-separated string works in some simple cases, it does have the issues you identified (e.g., handling spaces in values and managing fixed ordering). Using XML or JSON as a data format would be a more r... | 20,489 | [
{
"from": "human",
"value": "I have a C# console app \"App1\" that reads a row of data from a table in a SQL Server 2005 DB. I want App1 to pass all the data in this row to App2, another C# console app. What is the best way to do this?\nMy first (naive) attempt was to do this:\nobject[] o = myrow.ItemArra... |
I need to know the default port settings for the following services
SQL Server
SQL Browser
SQL Reporting services
SQL Analysis services
I need to know the port settings for these services for different versions of SQL Server (2000,2005,2008)
Also let me know whether the default port setting will change based on sql ... | The default port settings for SQL Server services can vary slightly between different versions, but there are some consistent defaults that you can rely on. Below are the default port settings for the services you mentioned across SQL Server versions 2000, 2005, and 2008.
### 1. **SQL Server (Database Engine)**
- **De... | 25,413 | [
{
"from": "human",
"value": "I need to know the default port settings for the following services\n\nSQL Server\nSQL Browser\nSQL Reporting services\nSQL Analysis services\n\nI need to know the port settings for these services for different versions of SQL Server (2000,2005,2008)\nAlso let me know whether t... |
I have a problem regarding getting the path of a user control. The scenario is as follows:
In a aspx i have multiple user controls. In one of those user conrtols i need to loop through the other user controls and get the physical path of them. Is there any easy way to do this?
| To get the physical path of user controls in an ASP.NET Web Forms application, you can loop through the controls in the page's control hierarchy. However, remember that user controls themselves do not have a built-in method to retrieve their physical paths directly; you will need to construct the path based on their fi... | 25,839 | [
{
"from": "human",
"value": "I have a problem regarding getting the path of a user control. The scenario is as follows:\nIn a aspx i have multiple user controls. In one of those user conrtols i need to loop through the other user controls and get the physical path of them. Is there any easy way to do this?\... |
I have an ASP.NET page which has a button it it. The button click launches a modal dialog box using JavaScript. Based on the value returned by the modal dialog box, I want to proceed with, or cancel the post back that happens. How do I do this?
| To achieve the desired functionality where the ASP.NET page's postback can be canceled based on the user's input from a modal dialog, you can utilize JavaScript to control the postback process. Here's a step-by-step guide on how to implement this:
### Step 1: Create the ASP.NET Page
You'll need a button that, when cli... | 22,645 | [
{
"from": "human",
"value": "I have an ASP.NET page which has a button it it. The button click launches a modal dialog box using JavaScript. Based on the value returned by the modal dialog box, I want to proceed with, or cancel the post back that happens. How do I do this?\n"
},
{
"from": "gpt",
... |
Is there a distributed version control system (like git or Mercurial) that can be used as an embedded library in Java applications (to implement versioned and synchronizable storage for application data), ideally written in pure Java and under a permissive license?
| Yes, there are a few options for distributed version control systems that can be embedded into Java applications, and are written in Java. Here are some notable projects:
1. **JGit**:
- **Description**: JGit is a lightweight, pure Java implementation of the Git version control system. It is designed to be embedded... | 25,856 | [
{
"from": "human",
"value": "Is there a distributed version control system (like git or Mercurial) that can be used as an embedded library in Java applications (to implement versioned and synchronizable storage for application data), ideally written in pure Java and under a permissive license?\n"
},
{
... |
What is the correct way to setup a named pipe in C# across a network?
Currently I have two machines, 'client' and 'server'.
Server sets up its pipe in the following manner:
NamedPipeServerStream pipeServer = new NamedPipeServerStream(
"pipe",
PipeDirection.InOut,
10,
PipeTransmissionMode.Byte,
PipeO... | When working with named pipes in C# across a network, it's essential to ensure that both the server and client are set up correctly, especially regarding the machine names and access permissions. The exception you're encountering (`System.UnauthorizedAccessException`) indicates that there may be issues related to permi... | 25,282 | [
{
"from": "human",
"value": "What is the correct way to setup a named pipe in C# across a network?\nCurrently I have two machines, 'client' and 'server'.\nServer sets up its pipe in the following manner:\nNamedPipeServerStream pipeServer = new NamedPipeServerStream(\n \"pipe\",\n PipeDirection.InOut,\... |
I inherited this gigantic legacy Java web app using Struts 1.2.4. I have a specific question regarding Actions. Most of the pages have exactly one Action, and the processExecute() methods are hideous monsters (very long and tons of nested if statements based on request parameters).
Given that Actions are an implementat... | Refactoring a legacy Java web application that uses Struts 1.2.4 can indeed be a challenging task, especially when dealing with monolithic Action classes that have grown over time into "hideous monsters." Here are some thoughts on the questions you posed:
### 1. Is this the right direction?
Yes, refactoring these mon... | 21,424 | [
{
"from": "human",
"value": "I inherited this gigantic legacy Java web app using Struts 1.2.4. I have a specific question regarding Actions. Most of the pages have exactly one Action, and the processExecute() methods are hideous monsters (very long and tons of nested if statements based on request parameter... |
I'm new to using the NetBeans IDE. When I try to look at the documentation for say the java API (example, System class), it says that the javadoc is not installed. How do I install the documentation?
| To install Java documentation for the NetBeans IDE, follow these steps:
1. **Download Java Documentation**:
- Go to the [Oracle Java SE Downloads](https://www.oracle.com/java/technologies/javase-downloads.html) or [OpenJDK](https://openjdk.java.net/) website, depending on which version of Java you are using.
- F... | 24,327 | [
{
"from": "human",
"value": "I'm new to using the NetBeans IDE. When I try to look at the documentation for say the java API (example, System class), it says that the javadoc is not installed. How do I install the documentation?\n"
},
{
"from": "gpt",
"value": "To install Java documentation for ... |
I'm working on a project in Java using the spring framework, hibernate and tomcat.
Background:
I have a form page which takes data, validates, processes it and ultimately persists the data using hibernate. In processing the data I do some special command (model)
manipulation prior to persisting using hibernate.
Probl... | It sounds like you're experiencing a classic case of double form submissions in a web application, which can occur for several reasons. Here are some steps you can take to diagnose and solve the problem in your Spring application:
### 1. **Check for Double Clicks:**
Ensure that the form submission is being triggered b... | 25,175 | [
{
"from": "human",
"value": "I'm working on a project in Java using the spring framework, hibernate and tomcat.\nBackground:\nI have a form page which takes data, validates, processes it and ultimately persists the data using hibernate. In processing the data I do some special command (model) \nmanipulatio... |
I keep hearing people complaining that C++ doesn't have garbage collection. I also hear that the C++ Standards Committee is looking at adding it to the language. I'm afraid I just don't see the point to it... using RAII with smart pointers eliminates the need for it, right?
My only experience with garbage collection wa... | You bring up some valid points regarding C++ and its current memory management practices, particularly with RAII (Resource Acquisition Is Initialization) and smart pointers. Indeed, these techniques have provided C++ developers with powerful tools for managing memory effectively without needing garbage collection (GC).... | 22,504 | [
{
"from": "human",
"value": "I keep hearing people complaining that C++ doesn't have garbage collection. I also hear that the C++ Standards Committee is looking at adding it to the language. I'm afraid I just don't see the point to it... using RAII with smart pointers eliminates the need for it, right?\nMy ... |
Is it possible to automatically launch an application from a USB flash drive (bypassing windows prompt asking user what he wants to do)? on windows XP or vista.
I looked into "autorun.inf" and "open" entry seems to work only for CD drives for Windows XP SP2+ and Vista. Is it possible to launch program automatically on ... | Automatically launching an application from a USB flash drive without user intervention (such as bypassing prompts) is very limited due to security restrictions imposed by Windows, especially in later versions. Here’s an overview of how it worked in the past and the current limitations:
### Autorun and Windows Securit... | 26,559 | [
{
"from": "human",
"value": "Is it possible to automatically launch an application from a USB flash drive (bypassing windows prompt asking user what he wants to do)? on windows XP or vista.\nI looked into \"autorun.inf\" and \"open\" entry seems to work only for CD drives for Windows XP SP2+ and Vista. Is i... |
When I was taking CS in college (mid 80's), one of the ideas that was constantly repeated was to always write loops which test at the top (while...) rather than at the bottom (do ... while) of the loop. These notions were often backed up with references to studies which showed that loops which tested at the top were st... | The choice between using a top-test loop (like `while`) and a bottom-test loop (like `do...while`) can depend on several factors, including the specific logic of the program, readability, and coding style preferences.
### Top-Test vs. Bottom-Test Loops
1. **Top-Test Loops (`while`)**:
- **Pros**:
- The ... | 24,706 | [
{
"from": "human",
"value": "When I was taking CS in college (mid 80's), one of the ideas that was constantly repeated was to always write loops which test at the top (while...) rather than at the bottom (do ... while) of the loop. These notions were often backed up with references to studies which showed t... |
I have a linked list that I want to sort part of, eg:
std::sort(someIterator, otherIterator, predicate);
std::sort requires random-access iterators so this approach doesn't work. There is a specialisation std::list::sort, but that can only sort the entire list. I don't think I have enough access to the list members to... | You're correct that `std::sort` requires random-access iterators, which means you cannot directly use it with a linked list (`std::list`). The special member function `std::list::sort` sorts the entire list, and unfortunately, there is no built-in mechanism in `std::list` to sort only a portion of the list.
However, y... | 22,076 | [
{
"from": "human",
"value": "I have a linked list that I want to sort part of, eg:\nstd::sort(someIterator, otherIterator, predicate);\n\nstd::sort requires random-access iterators so this approach doesn't work. There is a specialisation std::list::sort, but that can only sort the entire list. I don't think... |
Ok, so at some point in time, somebody checked in some files with names that require a case sensitive file system into the trunk of a repository that I constantly check out. This of course leads to my local working copy locking up when I try to check it out (on my Windows computer). Is there any way that I can set my... | Subversion (SVN) itself does not provide a built-in feature to ignore case sensitivity on a per-working-copy basis. However, there are a few strategies you can consider to work around the issue you're facing with case-sensitive filenames in a repository while working on a Windows system (which is case-insensitive by de... | 26,277 | [
{
"from": "human",
"value": "Ok, so at some point in time, somebody checked in some files with names that require a case sensitive file system into the trunk of a repository that I constantly check out. This of course leads to my local working copy locking up when I try to check it out (on my Windows compu... |
I am trying to implement the following functionality:
class WeightResolver {
WeightMonitor _source;
bool _cancelled;
Weight _threshold;
public Cancel() {
_cancelled = true;
}
public Weight Resolve(){
_cancelled = false;
while(_source.CurrentWeight < threshold ) {
if(_cancelled)
... | You're correct that the issue arises from the blocking nature of your `Resolve` method. The current implementation of `Resolve` runs a tight loop that continuously checks the condition but doesn't yield control back to the thread scheduler. This means that while `Resolve` is executing, it won't allow other threads (inc... | 24,441 | [
{
"from": "human",
"value": "I am trying to implement the following functionality:\nclass WeightResolver {\n WeightMonitor _source;\n bool _cancelled;\n Weight _threshold;\n\n public Cancel() {\n _cancelled = true;\n }\n public Weight Resolve(){\n _cancelled = false;\n while(_source.Cur... |
When iterating over elements of a vector it is preferred to use iterators instead of an index (see Why use iterators instead of array indices?).
std::vector<T> vec;
std::vector<T>::iterator it;
for ( it = vec.begin(); it != vec.end(); ++it )
{
// do work
}
However, it can be necessary to use the index in the body ... | When considering performance and flexibility/extensibility, let's break down the three options you've provided for iterating over a `std::vector` while needing to access the index.
1. **Revert to the indexed loop**:
```cpp
std::vector<T> vec;
size_t i;
for ( i = 0; i < vec.size(); ++i )
{
// use ... | 21,834 | [
{
"from": "human",
"value": "When iterating over elements of a vector it is preferred to use iterators instead of an index (see Why use iterators instead of array indices?). \nstd::vector<T> vec;\nstd::vector<T>::iterator it;\nfor ( it = vec.begin(); it != vec.end(); ++it )\n{\n // do work\n}\n\nHowever, ... |
I have a database called foo and a database called bar. I have a table in foo called tblFoobar that I want to move (data and all) to database bar from database foo. What is the SQL statement to do this?
| To move a table from one database to another in SQL, you typically need to create the table in the destination database, copy the data from the source table to the new table, and then drop the original table if you no longer need it.
Here’s a step-by-step process to do this:
1. **Create the table in the destination d... | 26,500 | [
{
"from": "human",
"value": "I have a database called foo and a database called bar. I have a table in foo called tblFoobar that I want to move (data and all) to database bar from database foo. What is the SQL statement to do this?\n"
},
{
"from": "gpt",
"value": "To move a table from one databa... |
My company is using Python for a relatively simple embedded project. Is anyone else out there using Python on embedded platforms? Overall it's working well for us, quick to develop apps, quick to debug. I like the overall "conciseness" of the language.
The only real problem I have in day to day work is that the lack... | Yes, many companies and developers are using Python for embedded projects. While Python is traditionally associated with higher-level applications, its use in embedded systems has been growing, especially with the advent of platforms like MicroPython and CircuitPython, which are designed for microcontrollers. These env... | 25,371 | [
{
"from": "human",
"value": "My company is using Python for a relatively simple embedded project. Is anyone else out there using Python on embedded platforms? Overall it's working well for us, quick to develop apps, quick to debug. I like the overall \"conciseness\" of the language.\nThe only real proble... |
How can I delete the session information from my browser by using javascript? Is it possible to do?
| In JavaScript, you cannot directly delete session information from a browser, such as cookies or other session data, because browsers enforce strict security and privacy guidelines. However, you can manipulate certain types of session data using JavaScript. Here's how you can handle session-related data:
1. **Session ... | 26,439 | [
{
"from": "human",
"value": "How can I delete the session information from my browser by using javascript? Is it possible to do?\n"
},
{
"from": "gpt",
"value": "In JavaScript, you cannot directly delete session information from a browser, such as cookies or other session data, because browsers... |
OK, first for context look at the Windows desktop; You can take items (folders, files) on the desktop and drag them around to different places and they "stay" where you dragged them. This seems to be a pretty useful feature to offer users so as to allow them to create their own "groupings" of items.
My question is th... | Yes, in .NET, there are several ways to implement a drag-and-drop functionality that allows you to rearrange items within a control, similar to how items can be rearranged on a Windows desktop. While the standard `ListView` control does not support this behavior out-of-the-box in "LargeIcon" mode, you can achieve this ... | 23,810 | [
{
"from": "human",
"value": "OK, first for context look at the Windows desktop; You can take items (folders, files) on the desktop and drag them around to different places and they \"stay\" where you dragged them. This seems to be a pretty useful feature to offer users so as to allow them to create their ... |
I have a laptop running Ubuntu that I would like to act as a Subversion server. Both for myself to commit to locally, and for others remotely. What are the steps required to get this working? Please include steps to:
Get and configure Apache, and necessary modules (I know there are other ways to create a SVN server, b... | Setting up an Apache-based Subversion (SVN) server on Ubuntu is a great way to manage your version control needs. Below are step-by-step instructions to get you started. This guide assumes you're using a version of Ubuntu that's compatible with the instructions (the process should be similar across versions).
### Step... | 14,592 | [
{
"from": "human",
"value": "I have a laptop running Ubuntu that I would like to act as a Subversion server. Both for myself to commit to locally, and for others remotely. What are the steps required to get this working? Please include steps to:\n\nGet and configure Apache, and necessary modules (I know the... |
When I try to run a particular stored procedure on my MS SQL 2005 database, I get an error like the following:
Subquery returned more than 1 value. This is not permitted when
the subquery follows =, !=, <, <= , >, >= or when the subquery
is used as an expression
The SP in query is very long and calls other SPs. This ... | When dealing with the "Subquery returned more than 1 value" error in a complex stored procedure in SQL Server, especially in older versions like SQL Server 2005, the error message can be vague, making it challenging to debug. Here are several strategies you can use to identify the source of the error:
### 1. **Check t... | 25,584 | [
{
"from": "human",
"value": "When I try to run a particular stored procedure on my MS SQL 2005 database, I get an error like the following:\nSubquery returned more than 1 value. This is not permitted when\nthe subquery follows =, !=, <, <= , >, >= or when the subquery\nis used as an expression\n\nThe SP in ... |
Does the placement of a function have an effect on the performance of closures within scope? If so, where is the optimal place to put these functions? If not, is the implied association by closure enough reason to place a function in another place logically?
For instance, if foo does not rely on the value of localSta... | The placement of functions in relation to their closures can have implications for readability and organization of code, but in JavaScript, the actual performance in terms of execution time and memory usage is typically not significantly affected by whether a function is declared before or after a variable it closes ov... | 24,823 | [
{
"from": "human",
"value": "Does the placement of a function have an effect on the performance of closures within scope? If so, where is the optimal place to put these functions? If not, is the implied association by closure enough reason to place a function in another place logically?\nFor instance, if ... |
In Facebook's Compose Message, each name that appears in the TO field uses a nice LABEL with an X. Click on the X, and you remove name from the To sender field. I see this same feature again in other web2.0 social networking apps.
Are there open source tools that let me make those nice X LABELS after you click on the... | Yes, there are several open-source JavaScript libraries and tools that can help you implement a feature similar to the "nice X labels" you described for handling the "To" field with autocomplete suggestions. Here are a few popular options:
1. **Select2**: This is a jQuery-based replacement for select boxes that allows... | 22,754 | [
{
"from": "human",
"value": "In Facebook's Compose Message, each name that appears in the TO field uses a nice LABEL with an X. Click on the X, and you remove name from the To sender field. I see this same feature again in other web2.0 social networking apps.\nAre there open source tools that let me make ... |
How do I parse the first, middle, and last name out of a fullname field with SQL?
I need to try to match up on names that are not a direct match on full name. I'd like to be able to take the full name field and break it up into first, middle and last name.
The data does not include any prefixes or suffixes. The midd... | Parsing a full name into first, middle, and last names can be somewhat tricky, especially when you consider variations in name formats. However, since your data follows the format 'First Middle Last', here are some practical SQL solutions that will help you extract the first, middle, and last names.
Assuming that you... | 18,689 | [
{
"from": "human",
"value": "How do I parse the first, middle, and last name out of a fullname field with SQL? \nI need to try to match up on names that are not a direct match on full name. I'd like to be able to take the full name field and break it up into first, middle and last name. \nThe data does not... |
Python's IDLE has 'Check Module' (Alt-X) to check the syntax which can be called without needing to run the code. Is there an equivalent way to do this in Emacs instead of running and executing the code?
| Yes, in Emacs, you can check the syntax of Python code without executing it by using the built-in syntax checker called `flycheck`. If you don't want to run the code at all, you can also use the `python-mode` commands to check for syntax errors. Here are some options you can use:
1. **Using Flycheck**:
- First, ens... | 26,855 | [
{
"from": "human",
"value": "Python's IDLE has 'Check Module' (Alt-X) to check the syntax which can be called without needing to run the code. Is there an equivalent way to do this in Emacs instead of running and executing the code?\n"
},
{
"from": "gpt",
"value": "Yes, in Emacs, you can check t... |
I have placed the TreeView in the update panel and HoverNodeStyle-Font-Underline="true"
when ever mouse hover underline will be shown.But after post back there is no underline when mouse over
| It sounds like you're encountering an issue with maintaining the hover effect of the `TreeView` control within an `UpdatePanel` in ASP.NET after a postback. When using `UpdatePanel`, certain client-side styles and scripts may be lost unless they are explicitly re-applied after the partial postback.
To ensure that the... | 24,421 | [
{
"from": "human",
"value": "I have placed the TreeView in the update panel and HoverNodeStyle-Font-Underline=\"true\"\nwhen ever mouse hover underline will be shown.But after post back there is no underline when mouse over \n"
},
{
"from": "gpt",
"value": "It sounds like you're encountering an ... |
I'm trying to get something very subtle to work, it looks pretty awful right now. I'm trying to paint the background of a TGroupBox which I have overloaded the paint function of so that the corners are show through to their parent object. I've got a bunch of nested group boxes that look very decent without XPThemes.
... | To create a transparent background effect for a `TGroupBox` in Delphi, especially to show the parent form or other controls through it, you can use the `SetLayeredWindowAttributes` function, or alternatively, you can draw your control with a custom painting method. Since you mentioned you're creating a form generator a... | 21,354 | [
{
"from": "human",
"value": "I'm trying to get something very subtle to work, it looks pretty awful right now. I'm trying to paint the background of a TGroupBox which I have overloaded the paint function of so that the corners are show through to their parent object. I've got a bunch of nested group boxes ... |
I am looking to improve the performance of my site, not because it is performing badly but just as a general exercise. The usual suggestion for asp.net sites is to remove viewstate wherever possible. I believe this can be done by each control on a page separately or for the whole page.
My question is if I disable the p... | When you disable the ViewState for a page in an ASP.NET Web Forms application, it will indeed disable the ViewState for all controls on that page, including those that are part of a MasterPage. However, there are a few nuances to keep in mind:
1. **Page-Level ViewState**: If you set the `EnableViewState` property to `... | 24,973 | [
{
"from": "human",
"value": "I am looking to improve the performance of my site, not because it is performing badly but just as a general exercise. The usual suggestion for asp.net sites is to remove viewstate wherever possible. I believe this can be done by each control on a page separately or for the whol... |
I am trying to do a search in my Eclipse (Java) workspace to find all instances of static variables that are not final.
I tried various regexes but they do not result in any matches. Can someone suggest a regex that will match all lines containing static and not containing final, and not ending in a {?
The last part ab... | To search for lines in your Java code that contain the keyword `static`, do not contain the keyword `final`, and do not end with a `{`, you can use the following regex pattern:
```regex
\bstatic\b(?!.*\bfinal\b)[^{}]*[^{}]\s*;?\s*$
```
### Explanation:
- `\bstatic\b`: Matches the word `static` as a whole word (using ... | 27,964 | [
{
"from": "human",
"value": "I am trying to do a search in my Eclipse (Java) workspace to find all instances of static variables that are not final.\nI tried various regexes but they do not result in any matches. Can someone suggest a regex that will match all lines containing static and not containing fina... |
I need to change the permissions of a directory to be owned by the Everyone user with all access rights on this directory. I'm a bit new to the Win32 API, so I'm somewhat lost in the SetSecurity* functions.
| To change the permissions of a directory in Windows using the Win32 API, you'll need to make use of a combination of functions to set the security descriptor for that directory. The process involves creating a security descriptor, an access control list (ACL), and then applying these to the directory.
Here's a simplif... | 20,845 | [
{
"from": "human",
"value": "I need to change the permissions of a directory to be owned by the Everyone user with all access rights on this directory. I'm a bit new to the Win32 API, so I'm somewhat lost in the SetSecurity* functions.\n"
},
{
"from": "gpt",
"value": "To change the permissions ... |
i have a repeater that will output a series of items:
<asp:repeater ... runat="Server">
<itemtemplate>
<a href="<%# GetItemLink(...) %>"><%# GetItemText %></a>
<itemtemplate>
<asp:repeater>
But some items will not have an associated link, so i don't want them to be clickable. i tried making it a runat=serv... | In ASP.NET Web Forms, if you want to conditionally render an anchor tag or just plain text based on whether an item has an associated link, you can do this in a clean way by using a `PlaceHolder` or directly rendering either an anchor or a span based on your condition.
Here's how you can do this within your `Repeater`... | 25,529 | [
{
"from": "human",
"value": "i have a repeater that will output a series of items:\n<asp:repeater ... runat=\"Server\">\n <itemtemplate>\n <a href=\"<%# GetItemLink(...) %>\"><%# GetItemText %></a>\n <itemtemplate>\n<asp:repeater>\n\nBut some items will not have an associated link, so i don't want ... |
I am currently looking at different ORM solutions for a project that is planned for this spring. Entity Framework is one of the products I am looking closer at, but EF 2.0 would be quite a lot more interesting.
Has there been any indications to when version 2.0 of Entity Framework is planned to be released? With .Net 4... | Entity Framework 2.0 does not exist as a standalone version, but rather, Entity Framework evolved significantly over the years through various iterations. The version that you might be referring to, EF 4.0, was released alongside .NET Framework 4.0. EF 4.0 introduced many new features and improvements over its predeces... | 28,020 | [
{
"from": "human",
"value": "I am currently looking at different ORM solutions for a project that is planned for this spring. Entity Framework is one of the products I am looking closer at, but EF 2.0 would be quite a lot more interesting.\nHas there been any indications to when version 2.0 of Entity Framew... |
Recently I have started playing with jQuery, and have been following a couple of tutorials. Now I feel slightly competent with using it (it's pretty easy), and I thought it would be cool if I were able to make a 'console' on my webpage (as in, you press the ` key like you do in FPS games, etc.), and then have it Ajax i... | Creating a console-like interface on your webpage using jQuery is a fun project! Here's a step-by-step guide on how to implement this feature, along with explanations on how to handle text input and use AJAX to send it to the server.
### Step 1: HTML Setup
First, create a simple HTML structure for your console.
```ht... | 20,374 | [
{
"from": "human",
"value": "Recently I have started playing with jQuery, and have been following a couple of tutorials. Now I feel slightly competent with using it (it's pretty easy), and I thought it would be cool if I were able to make a 'console' on my webpage (as in, you press the ` key like you do in ... |
Any ideas how i can best drive a USB POS printer from c#.
POS printers are usually serial, TCP/IP or USB based.
I know how to accomplish serial and TCP/IP but have no idea about communications through USB in C#.
I know that there is a layer available from Microsoft called POS.NET, but I want to try and avoid using this... | To communicate with a USB POS printer from C#, you typically have a few different approaches, especially if you want to avoid using Microsoft's POS.NET. Below are some strategies and libraries you can use for USB communications:
### 1. Use Windows API (WinUSB)
If you're comfortable with Windows API calls, you can inte... | 24,478 | [
{
"from": "human",
"value": "Any ideas how i can best drive a USB POS printer from c#.\nPOS printers are usually serial, TCP/IP or USB based.\nI know how to accomplish serial and TCP/IP but have no idea about communications through USB in C#.\nI know that there is a layer available from Microsoft called POS... |
I'm attempting to write a Python C extension that reads packed binary data (it is stored as structs of structs) and then parses it out into Python objects. Everything works as expected on a 32 bit machine (the binary files are always written on 32bit architecture), but not on a 64 bit box. Is there a "preferred" way... | When writing a Python C extension to read packed binary data, especially when dealing with structures, you need to be careful about data types and their sizes, particularly when switching between different architectures (32-bit vs 64-bit).
### Key Data Types to Watch For
1. **`size_t` and `int`**: On a 64-bit system,... | 25,054 | [
{
"from": "human",
"value": "I'm attempting to write a Python C extension that reads packed binary data (it is stored as structs of structs) and then parses it out into Python objects. Everything works as expected on a 32 bit machine (the binary files are always written on 32bit architecture), but not on ... |
So basically, I have two tabs which contain regular and special e-mails. In order to get e-mails, you have to click on a calendar date and AJAX will then query the database for the regular e-mails and special e-mails. There is a next and previous button to navigate through the results gotten for the selected date. The ... | Your situation is quite common in applications that handle different views or types of data, such as your email system with regular and special emails. Here are some strategies that can help you manage the state of the two tabs while keeping your code clean and maintainable:
### 1. **Use a State Management Object**
Y... | 25,275 | [
{
"from": "human",
"value": "So basically, I have two tabs which contain regular and special e-mails. In order to get e-mails, you have to click on a calendar date and AJAX will then query the database for the regular e-mails and special e-mails. There is a next and previous button to navigate through the r... |
Is there a special project type for creating a WCF to be hosted in IIS?
| Yes, when creating a Windows Communication Foundation (WCF) service to be hosted in Internet Information Services (IIS), you typically use a special project type in Visual Studio called "WCF Service Application."
### Steps to create a WCF Service Application:
1. **Open Visual Studio**: Launch Visual Studio.
2. **Cre... | 26,131 | [
{
"from": "human",
"value": "Is there a special project type for creating a WCF to be hosted in IIS?\n"
},
{
"from": "gpt",
"value": "Yes, when creating a Windows Communication Foundation (WCF) service to be hosted in Internet Information Services (IIS), you typically use a special project type ... |
I want to know how to use variables for objects and function names in Python. In PHP, you can do this:
$className = "MyClass";
$newObject = new $className();
How do you do this sort of thing in Python? Or, am I totally not appreciating some fundamental difference with Python, and if so, what is it?
| In Python, you can achieve similar functionality to PHP's variable variables, but the approach is different because Python does not support direct variable-based naming of classes or functions in the same way PHP does.
Here are several ways you can use variables to refer to classes and functions in Python:
### Using ... | 23,045 | [
{
"from": "human",
"value": "I want to know how to use variables for objects and function names in Python. In PHP, you can do this:\n$className = \"MyClass\";\n\n$newObject = new $className();\n\nHow do you do this sort of thing in Python? Or, am I totally not appreciating some fundamental difference with P... |
I've been trying to SSL working on my IW program for the last little while and I keep running up against the 'Could not load SSL Library'. I've followed every piece of advice I could find on the subject, but still no joy. I've tried the suggested DLLs in both the local directory and in system32.
Does anyone have a defi... | It sounds like you're having a tough time getting SSL to work with your IntraWeb (IW) and Indy components in Delphi 2007 on a Vista machine. The "Could not load SSL Library" error typically indicates that the necessary OpenSSL DLLs cannot be found or loaded correctly. Here’s a comprehensive approach to help you resolve... | 20,990 | [
{
"from": "human",
"value": "I've been trying to SSL working on my IW program for the last little while and I keep running up against the 'Could not load SSL Library'. I've followed every piece of advice I could find on the subject, but still no joy. I've tried the suggested DLLs in both the local directory... |
If I define a constant in a Perl module, how do I use that constant in my main program? (Or how do I call that constant in the main program?)
| To define a constant in a Perl module and use it in your main program, you can follow these steps:
1. **Define the Constant in the Module**: In your Perl module, use the `constant` pragma to define your constant. Here’s an example of how to do this:
```perl
# MyModule.pm
package MyModule;
use strict;
... | 26,287 | [
{
"from": "human",
"value": "If I define a constant in a Perl module, how do I use that constant in my main program? (Or how do I call that constant in the main program?)\n"
},
{
"from": "gpt",
"value": "To define a constant in a Perl module and use it in your main program, you can follow these... |
When trying to install Visual Studio 2008 I get the following message straight away:
"You must uninstall all pre-release
products in a specific order before
you can continue with setup."
And then it gived me this link on how to do that.
I've been working on this problem for quite some time now, uninstalling the... | It sounds like you are dealing with a legacy issue where remnants of a pre-release version of the .NET Framework or Visual Studio are causing problems during the installation of Visual Studio 2008. Here's a structured approach to resolve the issue, including how to undo the batch script you ran:
### Step 1: Undo the B... | 22,609 | [
{
"from": "human",
"value": "When trying to install Visual Studio 2008 I get the following message straight away: \n\n\"You must uninstall all pre-release\n products in a specific order before\n you can continue with setup.\"\n\n\nAnd then it gived me this link on how to do that.\nI've been working on thi... |
How can I check the version of my script against an online file to see if it's the latest version?
For clarification, I'm talking about a script I wrote, not the version of PHP. I'd like to incorporate a way for the end user to tell when I've updated the script.
| To check if your script is the latest version compared to an online file, you can follow these general steps:
### 1. Versioning Your Script
First, make sure that your script has a version number. You can define a constant or a variable in your script, like so:
```php
define('SCRIPT_VERSION', '1.0.0');
```
### 2. St... | 26,368 | [
{
"from": "human",
"value": "How can I check the version of my script against an online file to see if it's the latest version?\nFor clarification, I'm talking about a script I wrote, not the version of PHP. I'd like to incorporate a way for the end user to tell when I've updated the script.\n"
},
{
... |
Making a small app, and I want a function to execute 50% of the time. So if I were to dbl click the exe half the time the function would execute, and the other half it wouldn't. I can't seem to find anyway to easily do this, the one solution I tried seemed to determine the chance on compile rather than on run. Thank... | You can achieve the desired functionality of executing a function 50% of the time using a random number generator. Below is a simple example in Python, which you can adapt based on the programming language you're using. The key idea is to use the `random` module to generate a random number, and then check if that numbe... | 24,527 | [
{
"from": "human",
"value": "Making a small app, and I want a function to execute 50% of the time. So if I were to dbl click the exe half the time the function would execute, and the other half it wouldn't. I can't seem to find anyway to easily do this, the one solution I tried seemed to determine the cha... |
The problem/comic in question: http://xkcd.com/287/
I'm not sure this is the best way to do it, but here's what I've come up with so far. I'm using CFML, but it should be readable by anyone.
<cffunction name="testCombo" returntype="boolean">
<cfargument name="currentCombo" type="string" required="true" />
<cfa... | The problem you're trying to solve is essentially finding combinations of items (in this case, food items with specific costs) that add up to a target value (15.05). Your current implementation uses a brute-force approach by recursively generating combinations, which can be inefficient, especially as the number of item... | 21,221 | [
{
"from": "human",
"value": "The problem/comic in question: http://xkcd.com/287/\n\nI'm not sure this is the best way to do it, but here's what I've come up with so far. I'm using CFML, but it should be readable by anyone.\n<cffunction name=\"testCombo\" returntype=\"boolean\">\n <cfargument name=\"curre... |
I have a multi-timezone web application that stores all of the datetime values in UTC in the database, when actions happen on the server, I can easily convert the time into UTC.
However, when a client enters a time or time span, what is the best way to detect and store it?
I am currently doing the following:
Get the v... | Your current approach for handling timezones in a web application is reasonable, but there are indeed more elegant solutions that can improve user experience and reduce complexity. Here are some suggestions:
### 1. Use JavaScript Date Libraries
Utilize libraries like **Moment.js** (deprecated but widely used) or **dat... | 22,209 | [
{
"from": "human",
"value": "I have a multi-timezone web application that stores all of the datetime values in UTC in the database, when actions happen on the server, I can easily convert the time into UTC.\nHowever, when a client enters a time or time span, what is the best way to detect and store it?\nI a... |
How can I go about making my routes recognise an optional prefix parameter as follows:
/*lang/controller/id
In that the lang part is optional, and has a default value if it's not specified in the URL:
/en/posts/1 => lang = en
/fr/posts/1 => lang = fr
/posts/1 => lang = en
EDIT
Ideally, I'm looking to do this... | To create a routing setup in a Ruby on Rails application that recognizes an optional prefix parameter (for language) while providing a default value when it's not specified, you can achieve this using the `constraints` option in your routes. Below is a guide on how to set this up:
### 1. Define Routes with Optional La... | 20,520 | [
{
"from": "human",
"value": "How can I go about making my routes recognise an optional prefix parameter as follows:\n/*lang/controller/id\n\nIn that the lang part is optional, and has a default value if it's not specified in the URL:\n/en/posts/1 => lang = en\n/fr/posts/1 => lang = fr\n/posts/1 => ... |
I want to write a Songbird extension binds the multimedia keys available on all Apple Mac OS X platforms. Unfortunately this isn't an easy google search and I can't find any docs.
Can anyone point me resources on accessing these keys or tell me how to do it?
I have extensive programming experience, but this will be my... | Creating a Songbird extension to bind multimedia keys on macOS can indeed be a bit complex, especially since it involves interacting with lower-level system events rather than standard key events. Below, I’ll provide you with a general approach and resources that can help you get started.
### Understanding Multimedia ... | 11,128 | [
{
"from": "human",
"value": "I want to write a Songbird extension binds the multimedia keys available on all Apple Mac OS X platforms. Unfortunately this isn't an easy google search and I can't find any docs.\nCan anyone point me resources on accessing these keys or tell me how to do it?\nI have extensive ... |
I have a problem with Visual C++ 2008. I have installed opencv and I've created a new program and I build it with no errors. However, it complains about not finding MSVCR90D.dll when debugging. In release mode there is no problem at all.
I do have MSVCR90D.dll in one of Winsxs folders. Does anyone know a get-around to... | The issue you are encountering with `MSVCR90D.dll` when debugging in Visual C++ 2008 is related to the Visual C++ runtime libraries. The `D` in the filename indicates that this is a Debug version of the runtime library, which is required when your project is set to Debug mode.
Here are several steps you can take to re... | 25,973 | [
{
"from": "human",
"value": "I have a problem with Visual C++ 2008. I have installed opencv and I've created a new program and I build it with no errors. However, it complains about not finding MSVCR90D.dll when debugging. In release mode there is no problem at all. \nI do have MSVCR90D.dll in one of Winsxs... |
How can you get MSSQL server to accept Unicode data by default into a VARCHAR or NVARCHAR column?
I know that you can do it by placing a N in front of the string to be placed in the field but to by quite honest this seems a bit archaic in 2008 and particuarily with using SQL Server 2005.
| In SQL Server, the handling of character data types is crucial for correctly storing and retrieving Unicode characters. Here's a breakdown of how you can work with `VARCHAR` and `NVARCHAR` in a way that accommodates Unicode data:
1. **Understanding Data Types**:
- `VARCHAR`: Used for non-Unicode data. It can store ... | 24,840 | [
{
"from": "human",
"value": "How can you get MSSQL server to accept Unicode data by default into a VARCHAR or NVARCHAR column?\nI know that you can do it by placing a N in front of the string to be placed in the field but to by quite honest this seems a bit archaic in 2008 and particuarily with using SQL Se... |
What programming languages support arbitrary precision arithmetic and could you give a short example of how to print an arbitrary number of digits?
| Several programming languages support arbitrary precision arithmetic, either natively or through libraries. Here are a few notable ones along with examples of how to print an arbitrary number of digits:
### 1. Python
Python's built-in `int` type supports arbitrary precision, and you can use the `decimal` module for de... | 22,807 | [
{
"from": "human",
"value": "What programming languages support arbitrary precision arithmetic and could you give a short example of how to print an arbitrary number of digits?\n"
},
{
"from": "gpt",
"value": "Several programming languages support arbitrary precision arithmetic, either natively ... |
I want to perform some transformations on C source code. I need a tool on linux that generates a complete AST from the source code so that I can apply my transformations on this AST and then convert it back to the C source code. I tried ELSA but it is not getting compiled. (I am using Ubuntu 8.4). Can anyone suggest a ... | If you're looking for a tool to generate an Abstract Syntax Tree (AST) from C source code, apply transformations, and then convert it back to C source code, there are several alternatives to ELSA that you can consider:
1. **Clang**: Clang is a powerful compiler for C/C++ that comes with a robust libTooling library. Yo... | 26,626 | [
{
"from": "human",
"value": "I want to perform some transformations on C source code. I need a tool on linux that generates a complete AST from the source code so that I can apply my transformations on this AST and then convert it back to the C source code. I tried ELSA but it is not getting compiled. (I am... |
Is there any way to set a system wide memory limit a process can use in Windows XP? I have a couple of unstable apps which do work ok for most of the time but can hit a bug which results in eating whole memory in a matter of seconds (or at least I suppose that's it). This results in a hard reset as Windows becomes tota... | In Windows XP, there isn't a built-in way to set system-wide memory limits for individual processes like you can with `/etc/limits` in Linux. However, there are a few potential workarounds and third-party tools you might consider to achieve similar functionality:
1. **Windows System Resource Manager (WSRM)**: While WS... | 24,998 | [
{
"from": "human",
"value": "Is there any way to set a system wide memory limit a process can use in Windows XP? I have a couple of unstable apps which do work ok for most of the time but can hit a bug which results in eating whole memory in a matter of seconds (or at least I suppose that's it). This result... |
I've got a 44Khz audio stream from a CD, represented as an array of 16 bit PCM samples. I'd like to cut it down to an 11KHz stream. How do I do that? From my days of engineering class many years ago, I know that the stream won't be able to describe anything over 5500Hz accurately anymore, so I assume I want to cut e... | To downsample your audio stream from 44 kHz to 11 kHz, you'll need to apply a low-pass filter to the signal to prevent aliasing before you decimate (reduce the sample rate). The coefficients you mentioned (like `{1, 4, 12, 12, 4, 1}`) are part of a FIR (Finite Impulse Response) filter designed to smooth the signal befo... | 24,255 | [
{
"from": "human",
"value": "I've got a 44Khz audio stream from a CD, represented as an array of 16 bit PCM samples. I'd like to cut it down to an 11KHz stream. How do I do that? From my days of engineering class many years ago, I know that the stream won't be able to describe anything over 5500Hz accura... |
This is similar to this question, but I want to include the path relative to the current directory in unix. If I do the following:
ls -LR | grep .txt
It doesn't include the full paths. For example, I have the following directory structure:
test1/file.txt
test2/file1.txt
test2/file2.txt
The code above will return:
fil... | To include the relative paths of the `.txt` files in your output, you can use the `find` command instead of `ls` and `grep`. The `find` command will allow you to search for files matching a specific pattern and will include their paths relative to the current directory.
Here's how you can do it:
```bash
find . -type ... | 27,591 | [
{
"from": "human",
"value": "This is similar to this question, but I want to include the path relative to the current directory in unix. If I do the following:\nls -LR | grep .txt\n\nIt doesn't include the full paths. For example, I have the following directory structure:\ntest1/file.txt\ntest2/file1.txt\nt... |
Is exposing CRUD operations through SOAP web services a bad idea? My instinct tells me that it is not least of which because the overhead of doing database calls overhead could be huge. I'm struggling to find documentation for/against this (anti)pattern so I was wondering if anyone could point me to some documentation ... | Exposing CRUD operations directly through SOAP web services can indeed be considered an anti-pattern for several reasons. Here are some key points to consider:
### Reasons Why It's an Anti-Pattern:
1. **Overhead and Granularity**: SOAP is designed for message-oriented communication, and exposing low-level CRUD operat... | 23,576 | [
{
"from": "human",
"value": "Is exposing CRUD operations through SOAP web services a bad idea? My instinct tells me that it is not least of which because the overhead of doing database calls overhead could be huge. I'm struggling to find documentation for/against this (anti)pattern so I was wondering if any... |
I have one action I want to perform when a TSpeedButton is pressed and another I want to perform when the same button is "unpressed". I know there's no onunpress event, but is there any easy way for me to get an action to execute when a different button is pressed?
procedure ActionName.ActionNameExecute(Sender: TObje... | To handle the "unpressed" state of a `TSpeedButton` in Delphi, you can use the `OnClick` event for the button and manage the state yourself. Since `TSpeedButton` doesn’t have a direct "on unpress" event, one way to achieve this is by using a boolean variable to track the button's state and handle the logic accordingly.... | 24,577 | [
{
"from": "human",
"value": "I have one action I want to perform when a TSpeedButton is pressed and another I want to perform when the same button is \"unpressed\". I know there's no onunpress event, but is there any easy way for me to get an action to execute when a different button is pressed? \nprocedur... |
I have a one-dimensional array of strings in JavaScript that I'd like to turn into a comma-separated list. Is there a simple way in garden-variety JavaScript (or jQuery) to turn that into a comma-separated list? (I know how to iterate through the array and build the string myself by concatenation if that's the only way... | Yes, there's a very simple way to turn a one-dimensional array of strings into a comma-separated list in JavaScript using the `join()` method. You don't need to manually iterate through the array or use concatenation. Here's how you can do it:
### Using Vanilla JavaScript
```javascript
const array = ["apple", "banana... | 27,595 | [
{
"from": "human",
"value": "I have a one-dimensional array of strings in JavaScript that I'd like to turn into a comma-separated list. Is there a simple way in garden-variety JavaScript (or jQuery) to turn that into a comma-separated list? (I know how to iterate through the array and build the string mysel... |
How to unit test WCF services? Any 3rd Party tools available?
| Unit testing WCF (Windows Communication Foundation) services can be a bit different than unit testing regular classes due to their reliance on service contracts, bindings, and hosting environments. However, with the right approach and tools, it can be effectively accomplished. Here are some strategies and third-party t... | 22,277 | [
{
"from": "human",
"value": "How to unit test WCF services? Any 3rd Party tools available?\n"
},
{
"from": "gpt",
"value": "Unit testing WCF (Windows Communication Foundation) services can be a bit different than unit testing regular classes due to their reliance on service contracts, bindings, ... |
Since length is a JavaScript property, does it matter whether I use
for( var i = 0; i < myArray.length; i++ )
OR
var myArrayLength = myArray.length;
for( var i = 0; i < myArrayLength ; i++ )
| Yes, there is a difference between the two approaches you've presented, and it can affect performance in certain scenarios.
### 1. Using `myArray.length` directly in the loop condition:
```javascript
for (var i = 0; i < myArray.length; i++) {
// do something with myArray[i]
}
```
In this approach, the `myArray.l... | 21,391 | [
{
"from": "human",
"value": "Since length is a JavaScript property, does it matter whether I use\nfor( var i = 0; i < myArray.length; i++ )\n\nOR\nvar myArrayLength = myArray.length;\nfor( var i = 0; i < myArrayLength ; i++ )\n\n\n"
},
{
"from": "gpt",
"... |
I am attempting to do something simple (I thought) - securing my application using roles-based security using Active Directory groups in our Domain.
Specifically, I need to show/hide items on a page depending upon whether the currently logged in user is part of domain\groupA in Active Directory. For some reason, it is ... | To secure your application using roles-based security with Active Directory groups, you’re on the right track. Here’s a clear outline of what you need to do to achieve this.
### Step-by-Step Guide
1. **Enable Windows Authentication in IIS:**
- Ensure that Windows Authentication is enabled in your IIS settings for ... | 21,062 | [
{
"from": "human",
"value": "I am attempting to do something simple (I thought) - securing my application using roles-based security using Active Directory groups in our Domain.\nSpecifically, I need to show/hide items on a page depending upon whether the currently logged in user is part of domain\\groupA i... |
(mingw32, windows xp)
Hello, I am attempting to migrate from Java to c++. I am confused and frustrated about finding, installing, and compiling non-standard c++ libraries. in Java it's so convenient they stuffed every functionality and documentation ever needed in java's standard api. Is there a list of essential c++ l... | I understand your frustration! C++ can indeed be challenging when it comes to finding and integrating libraries, especially when you're coming from a more unified and high-level environment like Java. Here’s a list of essential C++ libraries and suggestions on how to handle library management more effectively.
### Com... | 22,642 | [
{
"from": "human",
"value": "(mingw32, windows xp)\nHello, I am attempting to migrate from Java to c++. I am confused and frustrated about finding, installing, and compiling non-standard c++ libraries. in Java it's so convenient they stuffed every functionality and documentation ever needed in java's standa... |
I'm taking on the re-architecting of a pair of applications which use Hibernate in one case, and a combination of Hibernate and a Java Content Repository (specifially JackRabbit) in the second.
A key issue in the rearchitecting is to improve performance, so I'm wondering whether there's any value in bringing in a DBA f... | Your concerns about performance and the role of a DBA in the context of applications using Hibernate and JackRabbit are valid and worth considering carefully. Here are several points to take into account as you evaluate the necessity of a DBA during the re-architecting phase of your applications:
### 1. **Understandin... | 21,800 | [
{
"from": "human",
"value": "I'm taking on the re-architecting of a pair of applications which use Hibernate in one case, and a combination of Hibernate and a Java Content Repository (specifially JackRabbit) in the second.\nA key issue in the rearchitecting is to improve performance, so I'm wondering whethe... |
As just stated in a recent question and answer, you can't inherit from a static class. How does one enforce the rules that go along with static classes inside VB.NET? Since the framework is compatible between C# and VB it would make sense that there would be a way to mark a class static, but there doesn't seem to be ... | In VB.NET, unlike C#, there is no direct keyword for declaring a class as static. However, you can achieve a similar effect by making the class **not instantiable** and containing only shared (static in C#) members. Here's how you can enforce rules similar to a static class:
### 1. Use a Private Constructor
You can m... | 27,206 | [
{
"from": "human",
"value": "As just stated in a recent question and answer, you can't inherit from a static class. How does one enforce the rules that go along with static classes inside VB.NET? Since the framework is compatible between C# and VB it would make sense that there would be a way to mark a cl... |
Background: We develop win32 applications, and use the "Thompson Toolkit" on windows to give us a unix-like shell that we use as our command-line.
We have a GUI program (with a WinMain and message loop) that we want to write to the console, but printf and so on don't work, even when we launch the program from the conso... | To write to the console from a Win32 GUI application, you need to attach your application to the console that launched it, or create a new console for the GUI application. Since your program is designed to be a GUI application with a message loop, it typically does not have a console associated with it by default.
He... | 23,786 | [
{
"from": "human",
"value": "Background: We develop win32 applications, and use the \"Thompson Toolkit\" on windows to give us a unix-like shell that we use as our command-line.\nWe have a GUI program (with a WinMain and message loop) that we want to write to the console, but printf and so on don't work, ev... |
I have a popen() function which executes tail -f sometextfile. Aslong as there is data in the filestream obviously I can get the data through fgets(). Now, if no new data comes from tail, fgets() hangs. I tried ferror() and feof() to no avail. How can I make sure fgets() doesn't try to read data when nothing new is in ... | When you're dealing with a stream that can block, such as a process output from `tail -f`, using `fgets()` will indeed cause your program to hang if there's no new data. While `select()` is a common solution in Unix-like environments, it doesn't work well with anonymous pipes in Windows.
Instead, you can use the Windo... | 22,120 | [
{
"from": "human",
"value": "I have a popen() function which executes tail -f sometextfile. Aslong as there is data in the filestream obviously I can get the data through fgets(). Now, if no new data comes from tail, fgets() hangs. I tried ferror() and feof() to no avail. How can I make sure fgets() doesn't... |
Is there an open source alternative (similar to ultraedit) to handle files with filesize >200 MBytes?
| Yes, there are several open-source alternatives to UltraEdit that can handle large files (over 200 MB). Here are some of them:
1. **GNU Emacs**: Emacs is a highly extensible and customizable text editor that can handle large files. It may take some configuration to optimize performance for very large files, but it is ... | 26,656 | [
{
"from": "human",
"value": "Is there an open source alternative (similar to ultraedit) to handle files with filesize >200 MBytes?\n"
},
{
"from": "gpt",
"value": "Yes, there are several open-source alternatives to UltraEdit that can handle large files (over 200 MB). Here are some of them:\n\n1.... |
I have two different grid controls on the same form. They share the same context menu. I am having trouble determining which control is the owner when I select the context menu item.
| When you have two different grid controls sharing the same context menu, you can determine which control is the owner of the context menu when a menu item is selected by using the `sender` object in the event handler for the context menu item. Here’s how you can handle it in a typical scenario:
1. **Assign the same ev... | 24,880 | [
{
"from": "human",
"value": "I have two different grid controls on the same form. They share the same context menu. I am having trouble determining which control is the owner when I select the context menu item. \n"
},
{
"from": "gpt",
"value": "When you have two different grid controls sharing ... |
All I need is a way to make a property of one class only 'settable' from one other class (a sort of manager class).
Is this even possible in c#?
My colleague 'reliably' informs me that I have a design flaw, but I feel I should at least ask the community before I concede defeat!
| Yes, it is possible to make a property of one class only settable from another class in C#. This can be achieved by using access modifiers and encapsulation. Below is a simple example illustrating how to implement this pattern.
### Example Implementation
```csharp
public class Manager
{
public void SetProperty(Ch... | 26,462 | [
{
"from": "human",
"value": "All I need is a way to make a property of one class only 'settable' from one other class (a sort of manager class).\nIs this even possible in c#?\nMy colleague 'reliably' informs me that I have a design flaw, but I feel I should at least ask the community before I concede defeat... |
Is there any way to validate the width and height of image when uploaded?
using javascript of server side ? like jsp, aspx etc?
| Yes, you can validate the width and height of an uploaded image using both client-side (JavaScript) and server-side (JSP, ASP.NET, etc.) methods. Here’s how you can do it in both environments:
### Client-Side Validation (JavaScript)
You can use JavaScript to validate the image dimensions before the file is uploaded. ... | 19,320 | [
{
"from": "human",
"value": "Is there any way to validate the width and height of image when uploaded?\nusing javascript of server side ? like jsp, aspx etc?\n"
},
{
"from": "gpt",
"value": "Yes, you can validate the width and height of an uploaded image using both client-side (JavaScript) and s... |
I'm trying to bind a List<T> to a DataGridView control, and I'm not having any luck creating custom bindings.
I have tried:
gvProgramCode.DataBindings.Add(new Binding("Opcode",code,"Opcode"));
It throws an exception, saying that nothing was found by that property name.
The name of the column in question is "Opcode". T... | You're correct that the `DataGridView` control and its data bindings work with properties rather than fields. When you're binding data to controls in Windows Forms, it typically requires public properties to properly handle the data binding. Here's how to resolve the issue.
### Steps to Bind a `List<T>` to a `DataGrid... | 23,571 | [
{
"from": "human",
"value": "I'm trying to bind a List<T> to a DataGridView control, and I'm not having any luck creating custom bindings.\nI have tried:\ngvProgramCode.DataBindings.Add(new Binding(\"Opcode\",code,\"Opcode\"));\n\nIt throws an exception, saying that nothing was found by that property name.\... |
VS2008 Code Analysis will flag a spelling mistake in an identifier using the IdentifiersShouldBeSpelledCorrectly warning type.
This process is using an American dictionary by default because words are being flagged that are correctly spelt using the British spelling. For example, words like "Organisation" and "Customis... | As of Visual Studio 2008, there is no built-in option to directly change the default dictionary used by Code Analysis for spelling checks. The Code Analysis tool uses the default American English dictionary and does not provide a direct way to switch to British English or any other language.
However, there are a coupl... | 26,965 | [
{
"from": "human",
"value": "VS2008 Code Analysis will flag a spelling mistake in an identifier using the IdentifiersShouldBeSpelledCorrectly warning type.\nThis process is using an American dictionary by default because words are being flagged that are correctly spelt using the British spelling. For exampl... |
I'm trying to understand how hibernate query cache really works.
What I see now is that Hibernate does not update its second-level cache automatically when I insert new entities into the database (although I'm using only Hibernate calls).
The only way I have found to make it work was to manually clean the cache after ... | Your understanding of Hibernate's caching mechanisms is mostly correct, but there are some key points about how the first-level, second-level, and query caches work, especially concerning the use of annotations and cache strategies in your scenario.
### Key Points About Caching in Hibernate
1. **First-Level Cache**:... | 25,251 | [
{
"from": "human",
"value": "I'm trying to understand how hibernate query cache really works. \nWhat I see now is that Hibernate does not update its second-level cache automatically when I insert new entities into the database (although I'm using only Hibernate calls).\nThe only way I have found to make it ... |
I work at a company that, for some reason, insists that all our development documentation should be in MS Word format. Which, being a binary format, means we cannot:
Diff versions of a document against each other (so peer reviewing them is a pain - because of the domain we work in, peer reviews for all changes are es... | It's understandable that working with MS Word can pose challenges for version control and text search capabilities, especially in a development context. Here are some alternative documentation formats and tools, along with ammunition to advocate for change:
### Alternative Formats & Tools
1. **Markdown**
- **Why:*... | 21,610 | [
{
"from": "human",
"value": "I work at a company that, for some reason, insists that all our development documentation should be in MS Word format. Which, being a binary format, means we cannot:\n\nDiff versions of a document against each other (so peer reviewing them is a pain - because of the domain we w... |
Is there a Python class that wraps the file interface (read, write etc.) around a string? I mean something like the stringstream classes in C++.
I was thinking of using it to redirect the output of print into a string, like this
sys.stdout = string_wrapper()
print "foo", "bar", "baz"
s = sys.stdout.to_string() #now s =... | Yes, Python provides a convenient way to wrap strings in a file-like interface using the `io.StringIO` class from the `io` module. This allows you to redirect output to a string easily.
Here’s how you can achieve the functionality you described:
```python
import sys
import io
# Create a StringIO object to capture th... | 27,001 | [
{
"from": "human",
"value": "Is there a Python class that wraps the file interface (read, write etc.) around a string? I mean something like the stringstream classes in C++.\nI was thinking of using it to redirect the output of print into a string, like this\nsys.stdout = string_wrapper()\nprint \"foo\", \"... |
If I am transferring data over a web service, does it guarantee that the end of file was reached?
what about the data send, does it guarantee it wasn't corrupted somehow?
(using asp.net web services)
| When transferring data over a web service, there are a few considerations regarding data integrity and the guarantee of reaching the end of the file.
### End of File Guarantee
1. **HTTP Protocol**: If you're using ASP.NET Web Services (which typically use HTTP/HTTPS as the transport protocol), the HTTP protocol does ... | 25,809 | [
{
"from": "human",
"value": "If I am transferring data over a web service, does it guarantee that the end of file was reached?\nwhat about the data send, does it guarantee it wasn't corrupted somehow?\n(using asp.net web services)\n"
},
{
"from": "gpt",
"value": "When transferring data over a we... |
In the Web Flow below I bind form data to a flow variable (lifeCycleForm) on a submit event in the view state. I have verified that the name, label and description properties are all populated as expected.
However, when the expression in the action state is evaluated all three properties are null. My form bean is seria... | Hi Brian,
It looks like you are encountering issues with form data binding during unit testing of your Spring WebFlow configuration. This is a common situation when working with unit tests, as Spring WebFlow's test framework does not automatically simulate the request parameter binding that occurs in a real web enviro... | 24,027 | [
{
"from": "human",
"value": "In the Web Flow below I bind form data to a flow variable (lifeCycleForm) on a submit event in the view state. I have verified that the name, label and description properties are all populated as expected.\nHowever, when the expression in the action state is evaluated all three ... |
Which is the best timer approach for a C# console batch application that has to process as follows:
Connect to datasources
process batch until timeout occurs or processing complete. "Do something with datasources"
stop console app gracefully.
related question: How do you add a timer to a C# console application
| To implement a timer approach for a C# console batch application that processes data until a timeout occurs or until processing is complete, you can utilize the `System.Timers.Timer` class. This timer allows you to execute a callback method at specified intervals, which is suitable for checking your processing status o... | 20,438 | [
{
"from": "human",
"value": "Which is the best timer approach for a C# console batch application that has to process as follows:\n\nConnect to datasources\nprocess batch until timeout occurs or processing complete. \"Do something with datasources\"\nstop console app gracefully.\n\nrelated question: How do y... |
We have a web app that allows users to upload documents, create their own documents, and so on. Uploaded files are stored on Amazon S3, created information is stored in a MySQL database. What I'm looking for is some sort of search engine, where I feed it all of our text documents, each with a unique ID, and it builds a... | There are several search engine options that you could consider for your web application, each with its own strengths and weaknesses. Let's go over the candidates you mentioned, as well as a few additional options:
### 1. **MySQL Full-Text Search**
- **Pros**: Easy to integrate if you're already using MySQL. No additi... | 22,943 | [
{
"from": "human",
"value": "We have a web app that allows users to upload documents, create their own documents, and so on. Uploaded files are stored on Amazon S3, created information is stored in a MySQL database. What I'm looking for is some sort of search engine, where I feed it all of our text document... |
Just a curiosity: is there an already-coded way to convert a printed traceback back to the exception that generated it? :) Or to a sys.exc_info-like structure?
| Converting a printed traceback back to an exception object or a `sys.exc_info`-like structure isn't straightforward, as Python's traceback doesn't retain enough information to reconstruct the original exception fully. However, you can parse the traceback text and create a new exception with some of its details, but you... | 25,040 | [
{
"from": "human",
"value": "Just a curiosity: is there an already-coded way to convert a printed traceback back to the exception that generated it? :) Or to a sys.exc_info-like structure?\n"
},
{
"from": "gpt",
"value": "Converting a printed traceback back to an exception object or a `sys.exc_i... |
I use TortoiseSVN 1.5.3 and VisualSVN 1.5.3 (Subversion 1.5.2)
Suppose that I create a new branch (/branches/branch1) of the trunk(/trunk) then someone (also using TortoiseSVN 1.5.3) merges their branch back into the trunk.
I try to merge from the trunk into the branch (to aquire all changes which might have beemn mer... | It sounds like you're encountering an issue with how merge tracking is handled in TortoiseSVN 1.5.3 and Subversion 1.5.2. In SVN, merge tracking was introduced to make it easier to keep track of what changes have been merged where. However, there are some nuances when it comes to using it effectively.
Here are some po... | 22,723 | [
{
"from": "human",
"value": "I use TortoiseSVN 1.5.3 and VisualSVN 1.5.3 (Subversion 1.5.2)\nSuppose that I create a new branch (/branches/branch1) of the trunk(/trunk) then someone (also using TortoiseSVN 1.5.3) merges their branch back into the trunk. \nI try to merge from the trunk into the branch (to aq... |
I have an app where I would like to support device rotation in certain views but other don't particularly make sense in Landscape mode, so as I swapping the views out I would like to force the rotation to be set to portrait.
There is an undocumented property setter on UIDevice that does the trick but obviously generate... | Forcing a device orientation programmatically in iOS is not officially supported, and using private APIs (like the one you mentioned with `UIDevice`) can lead to issues, especially with App Store submissions. Instead, you should rely on the supported interface orientations and manage transitions effectively.
Here's ho... | 20,358 | [
{
"from": "human",
"value": "I have an app where I would like to support device rotation in certain views but other don't particularly make sense in Landscape mode, so as I swapping the views out I would like to force the rotation to be set to portrait.\nThere is an undocumented property setter on UIDevice ... |
So lets say I have a dataset based on:
SELECT TopicLink.*, Topic.Name AS FromTopicName, Topic_1.Name AS ToTopicName
FROM TopicLink INNER JOIN
Topic ON TopicLink.FromTopicId = Topic.TopicId INNER JOIN
Topic AS Topic_1 ON TopicLink.ToTopicId = Topic_1.TopicId
With ... | In ADO.NET, while you do lose some of the "magic" that comes with old ADO regarding automatic data updates in a multi-table query using a `Recordset`, there are still ways to achieve similar functionality with some limitations and additional setup.
### Using `DataAdapter` and `CommandBuilder`
In ADO.NET, you can util... | 25,603 | [
{
"from": "human",
"value": "So lets say I have a dataset based on:\nSELECT TopicLink.*, Topic.Name AS FromTopicName, Topic_1.Name AS ToTopicName\nFROM TopicLink INNER JOIN\n Topic ON TopicLink.FromTopicId = Topic.TopicId INNER JOIN\n Topic AS Topic_1 ON... |
I need to upsize a split Access database, i.e., one that's currently split between tow mdb files, a front-end and back-end. I see many webpages that in essence say, "run the Upsizing Wizard." My first, very basic question:
Should I be running this wizard in my front-end mdb or my back-end mdb?
I assume I don't want to ... | When upsizing a split Access database to SQL Server, you will run the Upsizing Wizard on the **backend MDB** file, which contains your tables. The purpose of the wizard is to transfer the data from the Access backend to SQL Server.
Here’s a step-by-step guide on how to proceed:
### Step 1: Use the Upsizing Wizard
1.... | 24,422 | [
{
"from": "human",
"value": "I need to upsize a split Access database, i.e., one that's currently split between tow mdb files, a front-end and back-end. I see many webpages that in essence say, \"run the Upsizing Wizard.\" My first, very basic question:\nShould I be running this wizard in my front-end mdb o... |
If I have the following string:
string s = "abcdefghab";
Then how do I get a string (or char[]) that has just the characters that are repeated in the original string using C# and LINQ. In my example I want to end up with "ab".
Although not necessary, I was trying to do this in a single line of LINQ and had so far come... | You can achieve this using LINQ by grouping the characters in the string and then selecting those that appear more than once. Here's how you can do it in a single line:
```csharp
using System;
using System.Linq;
class Program
{
static void Main()
{
string s = "abcdefghab";
// One-liner using ... | 26,810 | [
{
"from": "human",
"value": "If I have the following string:\nstring s = \"abcdefghab\";\n\nThen how do I get a string (or char[]) that has just the characters that are repeated in the original string using C# and LINQ. In my example I want to end up with \"ab\".\nAlthough not necessary, I was trying to do ... |
I have a windows application running at the backend. I have functions in this applications mapped to hot keys. Like if I put a message box into this function and give hot key as Alt+Ctrl+D. then on pressing Alt, Ctrl and D together the message box comes up. My application is working fine till this point.
Now I want to... | To implement the functionality you described, you can use a combination of the Windows API and some libraries to facilitate keyboard and clipboard operations in your Windows application. Below, I provide an outline of the steps you can take to achieve this.
### Required Libraries
1. **System.Windows.Forms** - For clip... | 24,659 | [
{
"from": "human",
"value": "I have a windows application running at the backend. I have functions in this applications mapped to hot keys. Like if I put a message box into this function and give hot key as Alt+Ctrl+D. then on pressing Alt, Ctrl and D together the message box comes up. My application is wor... |
I found this page describing the Muenchian method, but I think I'm applying it wrong.
Consider that this would return a set of ages:
/doc/class/person/descriptive[(@name='age')]/value
1..2..2..2..3..3..4..7
But I would like a nodeset only one node for each age.
1..2..3..4..7
Each of these seem to return all of the... | It looks like you're trying to extract unique values from a set of nodes using XPath. The expressions you're currently using to filter for unique values are close, but there's a slight adjustment needed to ensure you're correctly identifying unique values.
To get unique values, you should focus on applying the `not()`... | 24,928 | [
{
"from": "human",
"value": "I found this page describing the Muenchian method, but I think I'm applying it wrong.\nConsider that this would return a set of ages:\n/doc/class/person/descriptive[(@name='age')]/value\n\n\n1..2..2..2..3..3..4..7\n\nBut I would like a nodeset only one node for each age.\n\n1..2... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.