instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I'm looking for the equivalent of the Unix 'tail' command that will allow me to watch the output of a log file while it is being written to.
| The Unix `tail` command has a very useful option that allows you to monitor a log file in real-time as new lines are added to it. You can use the `-f` (or `--follow`) option for this purpose.
Here’s the basic usage:
```bash
tail -f /path/to/your/logfile.log
```
This command will display the last few lines of the spe... | 25,506 | [
{
"from": "human",
"value": "I'm looking for the equivalent of the Unix 'tail' command that will allow me to watch the output of a log file while it is being written to.\n"
},
{
"from": "gpt",
"value": "The Unix `tail` command has a very useful option that allows you to monitor a log file in rea... |
Hopefully I haven't misunderstood the meaning of "duck typing", but from what I've read, it means that I should write code based on how an object responds to methods rather than what type/class it is.
Here's the code:
def convert_hash(hash)
if hash.keys.all? { |k| k.is_a?(Integer) }
return hash
elsif hash.keys.... | You're correct in your understanding of duck typing—it emphasizes behavior over explicit type checking. In your code, you're trying to ensure that the keys in the hash are either `Integer` or `Property` objects and then convert `Property` objects to their `id` properties.
Instead of iterating over the keys twice with ... | 21,389 | [
{
"from": "human",
"value": "Hopefully I haven't misunderstood the meaning of \"duck typing\", but from what I've read, it means that I should write code based on how an object responds to methods rather than what type/class it is.\nHere's the code:\ndef convert_hash(hash)\n if hash.keys.all? { |k| k.is_a?... |
I have a Selenium test case that enters dates into a date selector made up of three pulldowns (year, month, and day).
select validity_Y label=2008
select validity_M label=08
select validity_D label=08
This part gets repeated a lot throughout the test case. I'd like to reduce it by defining my custom action "selectVal... | To reduce redundancy in your Selenium test case by creating a custom action or macro for selecting a validity date, you can use the following approaches depending on the language and framework you are using for your Selenium tests. Below are options for popular frameworks:
### 1. Using a Programming Language (e.g., Py... | 19,191 | [
{
"from": "human",
"value": "I have a Selenium test case that enters dates into a date selector made up of three pulldowns (year, month, and day). \nselect validity_Y label=2008\nselect validity_M label=08\nselect validity_D label=08\n\nThis part gets repeated a lot throughout the test case. I'd like to red... |
We are currently running a SQL Job that archives data daily at every 10PM. However, the end users complains that from 10PM to 12, the page shows a time out error.
Here's the pseudocode of the job
while @jobArchive = 1 and @countProcecessedItem < @maxItem
exec ArchiveItems @countProcecessedItem out
if error oc... | Based on the information you've provided, it seems that the SQL job you are running to archive data could be causing timeouts for your end users due to the operations it performs, particularly the locking and blocking behavior that can arise from heavy data manipulations during the archive process. Here are some sugges... | 18,890 | [
{
"from": "human",
"value": "We are currently running a SQL Job that archives data daily at every 10PM. However, the end users complains that from 10PM to 12, the page shows a time out error.\nHere's the pseudocode of the job\nwhile @jobArchive = 1 and @countProcecessedItem < @maxItem\n exec ArchiveItem... |
I received an error when an referenced .NET Framework 2.0 assembly tried to execute the following line of code in an IIS hosted WCF service:
Error Message:
exePath must be specified when not
running inside a stand alone exe.
Source Code:
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
Has a... | The error you’re encountering stems from the use of `ConfigurationManager.OpenExeConfiguration`, which is typically meant for console or standalone applications, not for services hosted in IIS. Since your WCF service is running in the context of IIS, it cannot directly open an EXE configuration file like a standalone a... | 23,983 | [
{
"from": "human",
"value": "I received an error when an referenced .NET Framework 2.0 assembly tried to execute the following line of code in an IIS hosted WCF service:\nError Message:\n\nexePath must be specified when not\n running inside a stand alone exe.\n\nSource Code:\nConfigurationManager.OpenExeCo... |
In my webapplication (C#, .Net 3.5), made up of a core class library (containing the business logic, data layer and a couple of utility classes), a windows service project, a webservice project and the website project, I have a couple of static classes in the core library used by all other projects. These classes (for ... | Your concerns about the current design with static classes requiring an initialization method are valid, and this is a common pattern that can lead to issues in flexibility and maintainability. Here are a few alternative approaches you might consider to improve the design of your logging functionality in a way that add... | 19,444 | [
{
"from": "human",
"value": "In my webapplication (C#, .Net 3.5), made up of a core class library (containing the business logic, data layer and a couple of utility classes), a windows service project, a webservice project and the website project, I have a couple of static classes in the core library used b... |
Consider the following interface in Java:
public interface I {
public final String KEY = "a";
}
And the following class:
public class A implements I {
public String KEY = "b";
public String getKey() {
return KEY;
}
}
Why is it possible for class A to come along and override interface I's fina... | In Java, when you declare a constant in an interface (like `KEY` in interface `I`), it is implicitly `public`, `static`, and `final`. This means that `KEY` in the interface can be accessed in any implementing class without needing to create an instance of the interface.
In your example:
```java
public interface I {
... | 23,250 | [
{
"from": "human",
"value": "Consider the following interface in Java:\npublic interface I {\n public final String KEY = \"a\";\n}\n\nAnd the following class:\npublic class A implements I {\n public String KEY = \"b\";\n\n public String getKey() {\n return KEY;\n }\n}\n\nWhy is it possibl... |
I understand the difference between String and StringBuilder (StringBuilder being mutable) but is there a large performance difference between the two?
The program I’m working on has a lot of case driven string appends (500+). Is using StringBuilder a better choice?
| Yes, using `StringBuilder` is generally a better choice for scenarios where you need to perform a lot of string manipulations, especially in a loop or when appending strings multiple times.
### Performance Differences:
1. **Immutability of Strings**:
- Strings in languages like Java and C# are immutable, meaning ... | 11,968 | [
{
"from": "human",
"value": "I understand the difference between String and StringBuilder (StringBuilder being mutable) but is there a large performance difference between the two? \nThe program I’m working on has a lot of case driven string appends (500+). Is using StringBuilder a better choice?\n"
},
... |
I have a neural network written in Erlang, and I just bought a GeForce GTX 260 card with a 240 core GPU on it. Is it trivial to use CUDA as glue to run this on the graphics card?
| Using CUDA to offload neural network computations to a GPU can significantly speed up processing, but integrating CUDA with an Erlang application is not straightforward. Here are some points to consider:
1. **Erlang and CUDA**: Erlang is primarily a functional programming language designed for concurrent systems, whil... | 21,226 | [
{
"from": "human",
"value": "I have a neural network written in Erlang, and I just bought a GeForce GTX 260 card with a 240 core GPU on it. Is it trivial to use CUDA as glue to run this on the graphics card?\n"
},
{
"from": "gpt",
"value": "Using CUDA to offload neural network computations to a ... |
If I have a class representing access to one table in my database in a class:table relationship, so I can hide table details in one class. But as any useful application I have to query several tables. How can I accomodate this using the class:table design?
| To accommodate querying multiple tables while maintaining a class:table relationship, you can adopt a few design patterns and architectural strategies. Here are some suggestions:
### 1. **Repository Pattern**
The Repository pattern allows you to abstract the data access layer and work with collections of objects. You... | 19,623 | [
{
"from": "human",
"value": "If I have a class representing access to one table in my database in a class:table relationship, so I can hide table details in one class. But as any useful application I have to query several tables. How can I accomodate this using the class:table design?\n"
},
{
"from"... |
I guess the real question is:
If I don't care about dirty reads, will adding the with (NOLOCK) hint to a SELECT statement affect the performance of:
the current SELECT statement
other transactions against the given table
Example:
Select *
from aTable with (NOLOCK)
| When you use the `WITH (NOLOCK)` hint in a SELECT statement in SQL Server, it allows the query to read data without acquiring shared locks. This can potentially improve the performance of the current SELECT statement because it does not block other transactions that are trying to read or write to the same table. Here's... | 22,674 | [
{
"from": "human",
"value": "I guess the real question is: \nIf I don't care about dirty reads, will adding the with (NOLOCK) hint to a SELECT statement affect the performance of:\n\nthe current SELECT statement \nother transactions against the given table\n\nExample:\nSelect * \nfrom aTable with (NOLOCK)... |
which library better for faster java application swt or swing?
| When comparing SWT (Standard Widget Toolkit) and Swing in terms of performance for Java applications, it's important to consider several factors, including rendering speed, resource usage, and platform integration.
### SWT (Standard Widget Toolkit)
- **Native Performance**: SWT uses native OS widgets, meaning it can p... | 22,230 | [
{
"from": "human",
"value": "which library better for faster java application swt or swing?\n"
},
{
"from": "gpt",
"value": "When comparing SWT (Standard Widget Toolkit) and Swing in terms of performance for Java applications, it's important to consider several factors, including rendering speed... |
We may start converting an old VS2003 MFC project to use the fancy new features provided by the MFC Feature Pack and VS2008. Several of the new UI controls would be very nice except for one thing - they automatically save their information to the registry. I don't have a problem with the registry, but for the multiple ... | Migrating an old MFC application to utilize the new features in the MFC Feature Pack while redirecting settings from the registry to a database is definitely a non-trivial task. Unfortunately, MFC doesn't provide a straightforward way to globally override the registry access methods since it is designed to use registry... | 22,709 | [
{
"from": "human",
"value": "We may start converting an old VS2003 MFC project to use the fancy new features provided by the MFC Feature Pack and VS2008. Several of the new UI controls would be very nice except for one thing - they automatically save their information to the registry. I don't have a problem... |
I'm trying to subclass NSCell for use in a NSTableView. The cell I want to create is fairly complicated so it would be very useful if I could design it in Interface Builder and then load the NSCell from a nib.
Is this possible? How do I do it?
| Subclassing `NSCell` and loading it from a nib is a bit tricky, as `NSCell` itself is not designed to be loaded directly from Interface Builder. Instead, `NSCell` is typically used for lightweight custom rendering of simple views. However, you can achieve a similar effect using a combination of `NSView`, `NSNib`, and `... | 19,021 | [
{
"from": "human",
"value": "I'm trying to subclass NSCell for use in a NSTableView. The cell I want to create is fairly complicated so it would be very useful if I could design it in Interface Builder and then load the NSCell from a nib.\nIs this possible? How do I do it?\n"
},
{
"from": "gpt",
... |
What is the best procedure for deploying web apps that rely on cron jobs (for cache maintenance, db updates, ...)? For things like DB schema changes, there are tools such as DBDeploy for managing the changes between versions, but how do you automate updates to the crontab?
I know that the actual cron files are store... | Deploying web apps that rely on cron jobs involves a few steps to ensure that everything is done smoothly, especially when dealing with updates or changes to cron jobs. Here’s a best-practice procedure for handling cron jobs in a deployment environment:
### 1. Use a Version Control System
Maintain your cron job defin... | 20,441 | [
{
"from": "human",
"value": "What is the best procedure for deploying web apps that rely on cron jobs (for cache maintenance, db updates, ...)? For things like DB schema changes, there are tools such as DBDeploy for managing the changes between versions, but how do you automate updates to the crontab? \nI... |
Suppose I am writing an application in C++ and C#. I want to write the low level parts in C++ and write the high level logic in C#. How can I load a .NET assembly from my C++ program and start calling methods and accessing the properties of my C# classes?
| To load a .NET assembly from a C++ program and call methods or access properties of C# classes, you can use the .NET interoperability (COM interop or C++/CLI) methods. Below is a general approach using the C++/CLI approach, as it provides a more seamless way to interact with .NET assemblies.
### Steps to Load a .NET A... | 16,624 | [
{
"from": "human",
"value": "Suppose I am writing an application in C++ and C#. I want to write the low level parts in C++ and write the high level logic in C#. How can I load a .NET assembly from my C++ program and start calling methods and accessing the properties of my C# classes?\n"
},
{
"from... |
Basically I am looking to accomplish something similar to the affect that yelp uses to have the map follow you down the page on their search results page but I'd rather have it be instantaneous rather than have it catch up a few seconds after you scroll. I also don't want to just set the position to "fixed" because I ... | What you're looking to achieve—having a map element that scrolls until it reaches a specific point and then becomes "fixed" until it can scroll again—can indeed be accomplished using a combination of CSS and JavaScript. While there may not be a drop-in solution that meets all your requirements perfectly, you can create... | 21,286 | [
{
"from": "human",
"value": "Basically I am looking to accomplish something similar to the affect that yelp uses to have the map follow you down the page on their search results page but I'd rather have it be instantaneous rather than have it catch up a few seconds after you scroll. I also don't want to ju... |
I have a class in system-C with some data members as such:
long double x[8];
I'm initializing it in the construction like this:
for (i = 0; i < 8; ++i) {
x[i] = 0;
}
But the first time I use it in my code I have garbage there.
Because of the way the system is built I can't connect a debugger easily. Are there an... | If you want to track when a specific variable is modified without a debugger, there are a few approaches you can take, particularly in C++ and SystemC. Here are some methods you can consider:
### 1. **Use Setter Functions**
One of the most straightforward approaches is to encapsulate your data member access within get... | 16,211 | [
{
"from": "human",
"value": "I have a class in system-C with some data members as such:\nlong double x[8];\n\nI'm initializing it in the construction like this:\nfor (i = 0; i < 8; ++i) {\n x[i] = 0;\n}\n\nBut the first time I use it in my code I have garbage there.\nBecause of the way the system is buil... |
Can it be done or the only way is to configure it on IIS?
| To provide a more accurate answer, I need more context about what you're trying to achieve. However, generally speaking, there are multiple ways to configure and manage web applications, including:
1. **IIS (Internet Information Services)**: This is the traditional way to host .NET applications on Windows servers. It ... | 24,351 | [
{
"from": "human",
"value": "Can it be done or the only way is to configure it on IIS?\n"
},
{
"from": "gpt",
"value": "To provide a more accurate answer, I need more context about what you're trying to achieve. However, generally speaking, there are multiple ways to configure and manage web app... |
How can I get tab completion to work for selecting CVS modules under Linux (preferably using bash) ?
For example, "cvs co " + tab would list the modules I can checkout. I've heard it's easy to do using zsh, but still I didn't manage to get it working either.
Also, how can I list all available modules (or repositories?... | To enable tab completion for CVS modules in a bash shell on Linux, you can use a custom completion function. Here's how to set it up:
### Step 1: Define the Completion Function
You can define a function that retrieves the available modules from your CVSROOT and then makes use of bash's programmable completion. Add th... | 20,891 | [
{
"from": "human",
"value": "How can I get tab completion to work for selecting CVS modules under Linux (preferably using bash) ?\nFor example, \"cvs co \" + tab would list the modules I can checkout. I've heard it's easy to do using zsh, but still I didn't manage to get it working either. \nAlso, how can I... |
class Foo(models.Model):
title = models.CharField(max_length=20)
slug = models.SlugField()
Is there a built-in way to get the slug field to autopopulate based on the title? Perhaps in the Admin and outside of the Admin.
| Yes, you can set up the `slug` field to automatically populate based on the `title` field both in the Django Admin and when creating instances of the model programmatically outside of the Admin.
Here's how to achieve that:
### 1. Auto-populate the slug field in the Admin
You can override the `save` method of your mo... | 19,190 | [
{
"from": "human",
"value": "class Foo(models.Model):\n title = models.CharField(max_length=20)\n slug = models.SlugField()\n\nIs there a built-in way to get the slug field to autopopulate based on the title? Perhaps in the Admin and outside of the Admin.\n"
},
{
"from": "gpt",
"value": "Y... |
EDITED (after 1st answer):
Can anyone help by pointing to some good references for the creation and presentation of a 3D environment (a real room) on a website.
Ideally it will not involve too much expense or too high a learning curve as this is a one off requirement for a small project.
| Creating and presenting a 3D environment on a website can be done effectively with various tools and resources that are user-friendly and cost-effective. Here are some options and references that could help you:
### Tools for Creating 3D Environments
1. **SketchUp**:
- **Description**: A user-friendly 3D modeling ... | 19,676 | [
{
"from": "human",
"value": "EDITED (after 1st answer):\nCan anyone help by pointing to some good references for the creation and presentation of a 3D environment (a real room) on a website.\nIdeally it will not involve too much expense or too high a learning curve as this is a one off requirement for a sma... |
We are currently experiencing intermittent mail queue stoppages. I'm seeking diagnostic help in another area.
In the meantime, is there a way to restart the CF mail queue without restarting the service as a whole?
CF8 standard
Win2k3
Solution: We are now checking the age of the oldest file in the mail queue. When it... | To restart the ColdFusion (CF) mail queue without restarting the entire ColdFusion service, you can use a few methods. Since you're using ColdFusion 8 on Windows Server 2003, here are steps and options to consider:
### Method 1: Use the Administrator Console
1. **Log into the ColdFusion Administrator**:
- Open you... | 14,805 | [
{
"from": "human",
"value": "We are currently experiencing intermittent mail queue stoppages. I'm seeking diagnostic help in another area.\nIn the meantime, is there a way to restart the CF mail queue without restarting the service as a whole?\nCF8 standard\nWin2k3\nSolution: We are now checking the age o... |
Is there a macro that does it? Which DTE objects to use?
| It seems like your question is regarding a macro involving DTE (Development Tools Environment) objects, which is commonly used in Microsoft development environments such as Visual Studio.
To create a macro that automates tasks using DTE objects, you typically work with the `DTE` object that represents the development ... | 21,281 | [
{
"from": "human",
"value": "Is there a macro that does it? Which DTE objects to use?\n"
},
{
"from": "gpt",
"value": "It seems like your question is regarding a macro involving DTE (Development Tools Environment) objects, which is commonly used in Microsoft development environments such as Visu... |
I have some source files that have comments written in Japanese. When I open these files in Visual Studio they appear like this:
à–¾FNCAP‰¹—p‚̃XƒŒƒbƒh
I am using the English version of WinXP, but is there a way to get Visual Studio to display the actual Japanese characters rather than the random jibberish it currentl... | The issue you're encountering with Japanese text appearing as gibberish is likely due to encoding mismatches. Visual Studio may not be recognizing the file's encoding correctly, and as a result, it's not displaying the Japanese characters properly. Here’s how to resolve this:
### Steps to Display Japanese Characters i... | 23,000 | [
{
"from": "human",
"value": "I have some source files that have comments written in Japanese. When I open these files in Visual Studio they appear like this:\nà–¾FNCAP‰¹—p‚̃XƒŒƒbƒh\n\nI am using the English version of WinXP, but is there a way to get Visual Studio to display the actual Japanese characters ... |
I'm using Entity Framework O/R mapper from Microsoft and using entity classes (generated classes that are mapped to DB objects) as a business objects.
Is this OK? Please state your cons or pros. What to do in a case of WCF communication between business layer and presentation, how to send those objects as data members... | Using Entity Framework (EF) generated classes as business objects can be a common practice, but it comes with both pros and cons. Here’s an overview of the advantages and disadvantages:
### Pros
1. **Simplicity**: Using EF-generated classes as business objects can simplify your architecture. You avoid the need for sep... | 22,497 | [
{
"from": "human",
"value": "I'm using Entity Framework O/R mapper from Microsoft and using entity classes (generated classes that are mapped to DB objects) as a business objects. \nIs this OK? Please state your cons or pros. What to do in a case of WCF communication between business layer and presentation,... |
How can I get list all the files within a folder recursively in Java?
| To list all files within a folder recursively in Java, you can use the `java.nio.file` package which provides a more modern and flexible way of handling file operations compared to the older `java.io` package. Below is a simple example using the `Files.walk()` method, which allows you to traverse a directory tree.
Her... | 17,528 | [
{
"from": "human",
"value": "How can I get list all the files within a folder recursively in Java? \n"
},
{
"from": "gpt",
"value": "To list all files within a folder recursively in Java, you can use the `java.nio.file` package which provides a more modern and flexible way of handling file opera... |
What are the key differences between HTML4 and HTML5 draft?
Please keep the answers related to changed syntax and added/removed html elements.
| HTML5 introduced several significant changes to the syntax, elements, and attributes compared to HTML4. Here are the key differences specifically related to changed syntax, added, or removed HTML elements:
### 1. **Doctype Declaration**
- **HTML4**: The doctype declaration is long and verbose:
```html
<!DOCTYPE HT... | 19,264 | [
{
"from": "human",
"value": "What are the key differences between HTML4 and HTML5 draft?\nPlease keep the answers related to changed syntax and added/removed html elements.\n"
},
{
"from": "gpt",
"value": "HTML5 introduced several significant changes to the syntax, elements, and attributes compa... |
I want to do something like the following in spring:
<beans>
...
<bean id="bean1" ... />
<bean id="bean2">
<property name="propName" value="bean1.foo" />
...
I would think that this would access the getFoo() method of bean1 and call the setPropName() method of bean2, but this doesn't seem to work.
| In Spring, when configuring beans using XML, the value attribute of the `<property>` element does not support direct access to properties of other beans using dot notation like `"bean1.foo"`.
To achieve the desired result where you want to inject a property from one bean into another, you will need to use Spring's pro... | 21,357 | [
{
"from": "human",
"value": "I want to do something like the following in spring:\n<beans>\n ...\n <bean id=\"bean1\" ... />\n <bean id=\"bean2\">\n <property name=\"propName\" value=\"bean1.foo\" />\n...\n\nI would think that this would access the getFoo() method of bean1 and call the setPr... |
I have an ASP.NET linkbutton control on my form. I would like to use it for javascript on the client side and prevent it from posting back to the server. (I'd like to use the linkbutton control so I can skin it and disable it in some cases, so a straight up tag is not preferred).
How do I prevent it from posting back ... | To prevent an ASP.NET LinkButton from posting back to the server while still allowing you to use it for client-side JavaScript, you can do this in several ways. The recommended approach is to handle the `OnClientClick` property and return `false` to stop the postback.
Here's how you can implement it:
1. Use the `OnCl... | 21,524 | [
{
"from": "human",
"value": "I have an ASP.NET linkbutton control on my form. I would like to use it for javascript on the client side and prevent it from posting back to the server. (I'd like to use the linkbutton control so I can skin it and disable it in some cases, so a straight up tag is not preferred... |
I ran across the following code in Ely Greenfield's SuperImage from his Book component - I understand loader.load() but what does the rest of do?
loader.load((newSource is URLRequest)? newSource:new URLRequest(newSource));
It looks like some kind of crazy inline if statement but still, I'm a little preplexed. And if ... | The line of code you've encountered is using a **ternary operator** (also known as a conditional operator), which is a compact way of expressing an `if-else` statement in a single line. The syntax for the ternary operator is:
```plaintext
condition ? valueIfTrue : valueIfFalse
```
In the code you provided:
```plaint... | 21,905 | [
{
"from": "human",
"value": "I ran across the following code in Ely Greenfield's SuperImage from his Book component - I understand loader.load() but what does the rest of do?\nloader.load((newSource is URLRequest)? newSource:new URLRequest(newSource));\n\nIt looks like some kind of crazy inline if statement... |
What are the relative merits of the xdoc and apt formats for writing websites of Maven projects? Is one more expressive than the other? Has one got better tool support than the other?
| When it comes to writing documentation for Maven projects, two common formats are **XDoc** and **APT** (All Purpose Text). Here’s a comparative overview of their relative merits, expressiveness, and tool support:
### XDoc
**Merits:**
- **XML-based:** XDoc is based on XML, which means it adheres to a stricter syntax, m... | 15,513 | [
{
"from": "human",
"value": "What are the relative merits of the xdoc and apt formats for writing websites of Maven projects? Is one more expressive than the other? Has one got better tool support than the other?\n"
},
{
"from": "gpt",
"value": "When it comes to writing documentation for Maven p... |
In my understanding of Servlet, the Servlet will be instantiated by the Container, its init() method will be called once, and the servlet will live like a singleton until the JVM shuts down.
I do not expect my servlet to be serialized, since it will be constructed new when the app server recovers or is starts up normal... | Your understanding of servlets and their lifecycle is largely correct. Servlets are indeed instantiated by the servlet container, and the `init()` method is called once when the servlet is loaded. The servlet typically remains in memory for the duration of the application, until the container shuts down or the servlet ... | 21,657 | [
{
"from": "human",
"value": "In my understanding of Servlet, the Servlet will be instantiated by the Container, its init() method will be called once, and the servlet will live like a singleton until the JVM shuts down.\nI do not expect my servlet to be serialized, since it will be constructed new when the ... |
I have a mindmp file from a target's application crash. Is it possible for me to rebuild the dll/pdb files for a version of software and have windbg load symbols correctly?
My problem is that our pdb files are only kept for major releases (unfortunately). This is a daily build, which I can rebuild myself, but I'm gett... | To correctly load symbols in WinDbg for your DLL/PDB files, especially given the context of a daily build and the errors you're encountering, follow these steps:
### 1. Matching Builds
Ensure that the DLL and PDB are built from the same source code version. If your source code for the DLL has changed since the last bu... | 20,224 | [
{
"from": "human",
"value": "I have a mindmp file from a target's application crash. Is it possible for me to rebuild the dll/pdb files for a version of software and have windbg load symbols correctly? \nMy problem is that our pdb files are only kept for major releases (unfortunately). This is a daily build... |
How do I connect to a MSSQL database using Perl's DBI module in Windows?
| To connect to a Microsoft SQL Server (MSSQL) database using Perl's DBI module on a Windows machine, you'll need to follow these steps:
1. **Install Required Modules**: First, you need to ensure that you have the DBI module and a driver that allows DBI to communicate with MSSQL. The most common driver for MSSQL is `DBD... | 19,483 | [
{
"from": "human",
"value": "How do I connect to a MSSQL database using Perl's DBI module in Windows?\n"
},
{
"from": "gpt",
"value": "To connect to a Microsoft SQL Server (MSSQL) database using Perl's DBI module on a Windows machine, you'll need to follow these steps:\n\n1. **Install Required M... |
I'm curious as to if there are any best practices relating to JQuery when constructing encapsulated code blocks.
Generally, when I construct a page I like to encapsulate the functions used within that page inside an object. This allows me some encapsulation when building applications. There's nothing I hate more than s... | When working with jQuery and JavaScript in general, encapsulating your code is a good practice to improve maintainability, readability, and prevent global namespace pollution. Here are some best practices that jQuery enthusiasts often use to create cleanly encapsulated structures, along with the rationale behind them:
... | 17,157 | [
{
"from": "human",
"value": "I'm curious as to if there are any best practices relating to JQuery when constructing encapsulated code blocks.\nGenerally, when I construct a page I like to encapsulate the functions used within that page inside an object. This allows me some encapsulation when building applic... |
In the following HTML, I'd like the frame around the image to be snug -- not to stretch out and take up all the available width in the parent container. I know there are a couple of ways to do this (including horrible things like manually setting its width to a particular number of pixels), but what is the right way?
E... | To achieve a snug frame around the image without making it take up all the available width in the parent container, you can utilize the `display: inline-block` property for the `.pictureframe` class instead of `display: block`. This allows the frame to wrap around the content tightly and not stretch to fill the width o... | 23,176 | [
{
"from": "human",
"value": "In the following HTML, I'd like the frame around the image to be snug -- not to stretch out and take up all the available width in the parent container. I know there are a couple of ways to do this (including horrible things like manually setting its width to a particular number... |
I have a question about how to deploy WPF application into a PC without Framework 3.5.
If a PC just installs Windows XP and sp3, Is it possible to design a setup package that can install WPF Application directly on this PC?
The situation is like this:
I designed a simple WPF Application. And I want to get its setup pa... | Deploying a WPF application on a system without .NET Framework 3.5 pre-installed is not straightforward. WPF (Windows Presentation Foundation) relies heavily on the .NET Framework, and specifically, version 3.5 (or higher) is required for WPF applications to run.
### Deployment Considerations
1. **Prerequisites**: WP... | 21,313 | [
{
"from": "human",
"value": "I have a question about how to deploy WPF application into a PC without Framework 3.5.\nIf a PC just installs Windows XP and sp3, Is it possible to design a setup package that can install WPF Application directly on this PC?\n\nThe situation is like this:\nI designed a simple WP... |
I have 2 classes with a LINQ association between them i.e.:
Table1: Table2:
ID ID
Name Description
ForiegnID
The association here is between Table1.ID -> Table2.ForiegnID
I need to be able to change the value of Table2.ForiegnID, however I can't and think it is because of the as... | It sounds like you're facing a challenge when trying to update a foreign key field in your database tables due to the association defined in your Entity Framework model (or similar ORM using LINQ). The issue could be due to several reasons, such as foreign key constraints in your database or how your objects are being ... | 20,602 | [
{
"from": "human",
"value": "I have 2 classes with a LINQ association between them i.e.:\nTable1: Table2:\nID ID\nName Description\n ForiegnID\n\nThe association here is between Table1.ID -> Table2.ForiegnID\nI need to be able to change the value of Table2.ForiegnID, h... |
The existing site has it own "users" table in a database. I'm wondering how to integrate PHPList with the existing site so that a user can check the newsletter during registration. I installed phplist thru cpanel.
Any help is greatly appreciated.
| Integrating PHPList with your existing user database so that users can opt-in to newsletters during registration can be achieved with the following steps. Here’s a broad overview of the approach:
### Step 1: Understand PHPList and Your Users Table
Before integration, ensure you understand how PHPList stores its subsc... | 19,830 | [
{
"from": "human",
"value": "The existing site has it own \"users\" table in a database. I'm wondering how to integrate PHPList with the existing site so that a user can check the newsletter during registration. I installed phplist thru cpanel.\nAny help is greatly appreciated.\n"
},
{
"from": "gpt"... |
I am writing a web server in Java and I want it to support HTTP 1.1 Keep-Alive connections. But how can I tell when the client is done sending requests for a given connection? (like a double end-of-line or something).
Lets see how stackoverflow handles this very obscure question -- answers for which, on Google, are mi... | When you're implementing an HTTP 1.1 web server that supports Keep-Alive connections, you’re on the right track by considering how to determine when a client has finished sending requests. Here's a plain-English explanation of how you can manage this, along with some strategies.
### Understanding Keep-Alive
1. **What... | 14,260 | [
{
"from": "human",
"value": "I am writing a web server in Java and I want it to support HTTP 1.1 Keep-Alive connections. But how can I tell when the client is done sending requests for a given connection? (like a double end-of-line or something). \nLets see how stackoverflow handles this very obscure questi... |
I have an application which uses a UDL file where the connection string specifies "Provider=SQLNCLI.1" which doesn't work on a specific machine because sqlncli.dll is not installed.
Another .Net app however, where the connection string is in app.config and does not specifically show the provider does worrk. The "Change... | The behavior you're observing can be explained by the differences in how .NET applications connect to SQL Server versus applications that use OLE DB or ODBC providers.
1. **Providers Overview**:
- **SQL Native Client (SQLNCLI)**: This is a native OLE DB and ODBC provider that was designed specifically for SQL Serve... | 22,383 | [
{
"from": "human",
"value": "I have an application which uses a UDL file where the connection string specifies \"Provider=SQLNCLI.1\" which doesn't work on a specific machine because sqlncli.dll is not installed.\nAnother .Net app however, where the connection string is in app.config and does not specifical... |
Situation: Some Bank has an old legacy ABS (Automatic bank system).
Bank wants to:
notify old legacy CRM system about client's account changes (Publish operation).
check PIN codes of client cards (Request/Response operation) - in synchronious mode.
ABS is implemented in very old private technologies with StoredProce... | Integrating a modern Java/.NET (ESB) application with a legacy system like an old Automatic Bank System (ABS) that primarily operates through stored procedures can be a challenge. Below are some approaches for both Publish (Write) and Request/Response (Read) operations, focusing on ensuring synchronous communication an... | 20,896 | [
{
"from": "human",
"value": "Situation: Some Bank has an old legacy ABS (Automatic bank system). \nBank wants to:\n\nnotify old legacy CRM system about client's account changes (Publish operation).\ncheck PIN codes of client cards (Request/Response operation) - in synchronious mode.\n\nABS is implemented in... |
Currently, I'm in the process of hiring a web developer who will be working on a site that processes credit cards. While he won't have the credentials to log into the payment gateway's UI he will have access to the API login and transaction key since it's embedded in the application's code.
I'd like to be aware of all ... | When hiring a web developer who will have access to sensitive information such as the API login and transaction key for a payment gateway like Authorize.net, it's essential to consider the potential risks and "what if" scenarios that could arise. Here are some of the risks associated with giving the developer this leve... | 20,753 | [
{
"from": "human",
"value": "Currently, I'm in the process of hiring a web developer who will be working on a site that processes credit cards. While he won't have the credentials to log into the payment gateway's UI he will have access to the API login and transaction key since it's embedded in the applica... |
Rep steps:
create example .NET form application
put a TextBox on the form
wire a function up to the TextBox's Enter event
When you run this application, the Control.Enter event fires when focus first goes to the TextBox. However, if you click away into another application and then click back into the test applicatio... | In a .NET Windows Forms application, the `Enter` and `Leave` events for controls like `TextBox` only fire when the control gains or loses focus within the same application. As you've noted, moving to another application and then back doesn't trigger these events again.
To handle the scenario where your `TextBox` needs... | 21,120 | [
{
"from": "human",
"value": "Rep steps:\n\ncreate example .NET form application\nput a TextBox on the form\nwire a function up to the TextBox's Enter event\n\nWhen you run this application, the Control.Enter event fires when focus first goes to the TextBox. However, if you click away into another applicati... |
I'm working on a home project that involves comparing images to a database of images (using a quadrant - or so - histogram approach). I wanted to know what my options are in regards to web cams or other image capture devices that:
Are easy to work with with the
Windows SDK (particularly
DirectShow, which I plan to us... | When selecting a webcam or image capture device for a project that involves image comparison using DirectShow and C#, there are several factors to consider to ensure compatibility and ease of use with the Windows SDK. Here are some recommendations and considerations:
### Recommendations for Webcams
1. **Logitech C920... | 19,711 | [
{
"from": "human",
"value": "I'm working on a home project that involves comparing images to a database of images (using a quadrant - or so - histogram approach). I wanted to know what my options are in regards to web cams or other image capture devices that:\n\nAre easy to work with with the\nWindows SDK ... |
I've looked at Microsoft GLEE (non-commerical use) and other libraries for drawing graphs, but I need a good commercial use graph API to show complex routes through the Internet.
I need to be able to show a large number of nodes and vertexes. Any Ideas?
| If you're looking for a commercial-use graph API to visualize complex routes through the internet with a large number of nodes and edges, here are several options you might consider:
1. **D3.js**: This is a powerful JavaScript library for producing dynamic, interactive data visualizations in web browsers. It can handl... | 21,190 | [
{
"from": "human",
"value": "I've looked at Microsoft GLEE (non-commerical use) and other libraries for drawing graphs, but I need a good commercial use graph API to show complex routes through the Internet.\nI need to be able to show a large number of nodes and vertexes. Any Ideas?\n"
},
{
"from":... |
I'm writing a little debug app for a bit of kit we're developing and I'd like to roll it out to a few users to see if they can provoke any crashes. Does anyone know a way of effectively wrapping a wxPython app to catch any and all unhandled exceptions that would cause the app to crash?
Ideally I'd want to capture all o... | Certainly! You can wrap your wxPython application to catch unhandled exceptions and log them, along with standard output and error streams, to a file. Below is a basic example of how you can achieve this using a custom `wx.App` subclass. This example captures unhandled exceptions and standard output/error streams and r... | 19,176 | [
{
"from": "human",
"value": "I'm writing a little debug app for a bit of kit we're developing and I'd like to roll it out to a few users to see if they can provoke any crashes. Does anyone know a way of effectively wrapping a wxPython app to catch any and all unhandled exceptions that would cause the app to... |
Can anyone tell me why this code behaves the way it does? See comments embedded in the code...
Am I missing something really obvious here?
using System;
namespace ConsoleApplication3
{
public class Program
{
static void Main(string[] args)
{
var c = new MyChild();
c.X();
... | This is a very interesting question regarding delegate behavior in C#. The key to understanding the difference in behavior between `Invoke()` and `BeginInvoke()` in your code lies in how the `BeginInvoke()` method works in terms of context and the execution flow.
Let's break down the relevant parts of your code:
1. Y... | 23,190 | [
{
"from": "human",
"value": "Can anyone tell me why this code behaves the way it does? See comments embedded in the code...\nAm I missing something really obvious here?\nusing System;\nnamespace ConsoleApplication3\n{\n public class Program\n {\n static void Main(string[] args)\n {\n ... |
Which family should I start to learn? (Never did any programming on microcontroller)
| If you're new to programming microcontrollers, there are a few popular families that are beginner-friendly and widely supported. Here are some recommendations to consider:
1. **Arduino:**
- **Overview:** Arduino boards (such as the Arduino Uno, Nano, or Mega) are perhaps the most popular choice for beginners. They ... | 17,299 | [
{
"from": "human",
"value": "Which family should I start to learn? (Never did any programming on microcontroller)\n"
},
{
"from": "gpt",
"value": "If you're new to programming microcontrollers, there are a few popular families that are beginner-friendly and widely supported. Here are some recomm... |
I try to write KSH script for processing a file consisting of name-value pairs, several of them on each line.
Format is:
NAME1 VALUE1,NAME2 VALUE2,NAME3 VALUE3, etc
Suppose I write:
read l
IFS=","
set -A nvls $l
echo "$nvls[2]"
This will give me second name-value pair, nice and easy. Now, suppose that the task is ext... | To achieve your goal of processing a line of name-value pairs in KSH while correctly handling commas within the values, you can utilize a combination of string manipulation techniques along with the `IFS` variable. Since you're using an older version of KSH without support for `read -A`, you will need to manually handl... | 15,264 | [
{
"from": "human",
"value": "I try to write KSH script for processing a file consisting of name-value pairs, several of them on each line.\nFormat is:\nNAME1 VALUE1,NAME2 VALUE2,NAME3 VALUE3, etc\n\nSuppose I write:\nread l\nIFS=\",\"\nset -A nvls $l\necho \"$nvls[2]\"\n\nThis will give me second name-value... |
The most favorite feature of StackOverflow for me is that it can automatically detect code in post and set appropriate color to the code.
I'm wondering how the color is set. When I do a Ctrl+F5 on a page, the code seems first be black text, then change to be colorful. Is it done by jQuery?
| The feature you’re observing on Stack Overflow, where code is automatically syntax-highlighted after the page loads, is typically implemented using JavaScript libraries rather than jQuery specifically.
When you first load the page, the raw code is displayed in a default style (often just plain black text). After the ... | 24,727 | [
{
"from": "human",
"value": "The most favorite feature of StackOverflow for me is that it can automatically detect code in post and set appropriate color to the code.\nI'm wondering how the color is set. When I do a Ctrl+F5 on a page, the code seems first be black text, then change to be colorful. Is it don... |
When I open a solution in VS 2008, I don't want it to open all the files that I had open last time. I just want it to open the solution. Can't see a config option for this, is it possible?
| In Visual Studio 2008, there is no direct option in the settings to prevent the IDE from reopening all previously opened files when you load a solution. However, you can achieve the desired behavior through a workaround by clearing the list of recently opened files. Here are a couple of methods you can use:
### Method... | 15,491 | [
{
"from": "human",
"value": "When I open a solution in VS 2008, I don't want it to open all the files that I had open last time. I just want it to open the solution. Can't see a config option for this, is it possible?\n"
},
{
"from": "gpt",
"value": "In Visual Studio 2008, there is no direct o... |
I've downloaded the IKVM sources (http://www.ikvm.net/) from http://sourceforge.net/cvs/?group_id=69637
Now I'm trying to get it to build in Visual Studio 2008 and am stuck. Does anyone know of documentation of how to build the thing, or could even give me pointers?
I've tried opening the ikvm8.sln, which opens all the... | It looks like you've already gone through quite a journey trying to build IKVM from source! Here’s a consolidated guide to help others who may face similar challenges, especially for building IKVM in Visual Studio 2008 or via NAnt.
### Step-by-Step Guide to Building IKVM
1. **Install Prerequisites**:
- Make sure y... | 18,750 | [
{
"from": "human",
"value": "I've downloaded the IKVM sources (http://www.ikvm.net/) from http://sourceforge.net/cvs/?group_id=69637\nNow I'm trying to get it to build in Visual Studio 2008 and am stuck. Does anyone know of documentation of how to build the thing, or could even give me pointers?\nI've tried... |
I have some controller methods I'd like to share. What is the best practice for doing this in ruby on rails? Should I create an abstract class that my controllers extend, or should I create module and add it in to each controller? Below are the controller methods I want to share:
def driving_directions
@address_to = ... | In Ruby on Rails, both abstract classes and modules can be used to share code between controllers, but the best approach depends on your specific use case. Here’s a breakdown of each option, along with recommendations for your scenario:
### Option 1: Abstract Class
Creating an abstract class that your controllers exte... | 17,466 | [
{
"from": "human",
"value": "I have some controller methods I'd like to share. What is the best practice for doing this in ruby on rails? Should I create an abstract class that my controllers extend, or should I create module and add it in to each controller? Below are the controller methods I want to share... |
Can you give me some pointers on making C# code and Java code interoperate?
Let's define the interoperation as something simple: allow (from Java code) the instantiantion and method calling of a class defined in C#, and, possibly, the other way around as well.
Is this even possible natively? (i.e. without some proxy/s... | Interoperability between C# and Java can be quite complex due to the differences in their runtime environments, libraries, and the languages themselves. Here are some pointers on making C# and Java code interoperate:
### 1. Native Interoperation
Unfortunately, there is no direct native interoperation mechanism betwee... | 22,589 | [
{
"from": "human",
"value": "Can you give me some pointers on making C# code and Java code interoperate? \nLet's define the interoperation as something simple: allow (from Java code) the instantiantion and method calling of a class defined in C#, and, possibly, the other way around as well.\nIs this even po... |
In a previous job we had a classic ASP application that no one wanted to migrate to ASP.NET. The things that it did, it did very well.
However there was some new functionality that needed to be added that just seemed best suited to ASP.NET. The decision was made to allow the system to become a weird hybrid of ASP a... | Creating a hybrid system that uses both classic ASP and ASP.NET can be quite challenging, especially when it comes to session management. The integration of two different technologies often leads to complexities that can compromise security, performance, and maintainability. Your concerns about using form variables or ... | 13,046 | [
{
"from": "human",
"value": "In a previous job we had a classic ASP application that no one wanted to migrate to ASP.NET. The things that it did, it did very well. \nHowever there was some new functionality that needed to be added that just seemed best suited to ASP.NET. The decision was made to allow th... |
I've got a question concerning fields in databases which are measures that might be displayed in different units but are stored only in one, such as "height", for example.
Where should the "pattern unit" be stated?. Of course, in the documentation, etc... But we all know nobody reads the documentation and that self-doc... | Your question touches on an important aspect of database design, specifically regarding the storage of measures with varying units. Here are some considerations regarding your approach:
### Pros of Including Units in Field Names:
1. **Clarity**: Including the unit in the field name (e.g., `height_cm`) makes it immedia... | 15,560 | [
{
"from": "human",
"value": "I've got a question concerning fields in databases which are measures that might be displayed in different units but are stored only in one, such as \"height\", for example.\nWhere should the \"pattern unit\" be stated?. Of course, in the documentation, etc... But we all know no... |
In Java, I have a subclass Vertex of the Java3D class Point3f. Now Point3f computes equals() based on the values of its coordinates, but for my Vertex class I want to be stricter: two vertices are only equal if they are the same object. So far, so good:
class Vertex extends Point3f {
// ...
public boolean equ... | Let's break down your questions regarding the design of your `Vertex` class and how to manage the `equals()` and `hashCode()` methods.
### 1. Should you want such a shallow equals()?
It's important to consider the implications of overriding `equals()` to only compare object references (using `this == other`). Here ar... | 20,285 | [
{
"from": "human",
"value": "In Java, I have a subclass Vertex of the Java3D class Point3f. Now Point3f computes equals() based on the values of its coordinates, but for my Vertex class I want to be stricter: two vertices are only equal if they are the same object. So far, so good:\nclass Vertex extends Poi... |
I am selecting from a table that has an XML column using T-SQL. I would like to select a certain type of node and have a row created for each one.
For instance, suppose I am selecting from a people table. This table has an XML column for addresses. The XML is formated similar to the following:
<address>
<street>Stree... | To achieve the desired results where you select from a table containing XML data and generate a row for each address node, you can use the `nodes()` method in T-SQL to shred the XML and the `value()` method to extract the required information from each address node. Below is an example query that demonstrates how to do... | 23,805 | [
{
"from": "human",
"value": "I am selecting from a table that has an XML column using T-SQL. I would like to select a certain type of node and have a row created for each one.\nFor instance, suppose I am selecting from a people table. This table has an XML column for addresses. The XML is formated similar t... |
I have a Web Service (ASMX) with a few Web methods on our production Web server. On a separate internal Web server (which isn't publicly exposed) I have another Web site that will use the ASMX's public web methods. What are some of the best ways to secure the Web service such that only the internal Web server can acc... | Securing your ASMX web service to ensure that only your internal web server can access it requires implementing several security measures. Here are some best practices you can consider:
1. **IP Whitelisting**:
- Configure your web server's firewall to allow access to the ASMX web service only from the IP address of... | 18,632 | [
{
"from": "human",
"value": "I have a Web Service (ASMX) with a few Web methods on our production Web server. On a separate internal Web server (which isn't publicly exposed) I have another Web site that will use the ASMX's public web methods. What are some of the best ways to secure the Web service such ... |
I tried searching around, but I couldn't find anything that would help me out.
I'm trying to do this in SQL:
declare @locationType varchar(50);
declare @locationID int;
SELECT column1, column2
FROM viewWhatever
WHERE
CASE @locationType
WHEN 'location' THEN account_location = @locationID
WHEN 'area' THEN xxx_lo... | In SQL, the `CASE` statement cannot be used directly in the `WHERE` clause to conditionally apply different criteria based on your variable. Instead, you can use logical operators (`AND`, `OR`) to achieve the desired behavior.
Here’s how you can rewrite your query:
```sql
DECLARE @locationType VARCHAR(50);
DECLARE @... | 25,810 | [
{
"from": "human",
"value": "I tried searching around, but I couldn't find anything that would help me out.\nI'm trying to do this in SQL:\ndeclare @locationType varchar(50);\ndeclare @locationID int;\n\nSELECT column1, column2\nFROM viewWhatever\nWHERE\nCASE @locationType\n WHEN 'location' THEN account_... |
I have lots and lots of data in various structures. Are there any better platforms other than Excel charts which can help me.
| Yes, there are several platforms and tools that can help you visualize and analyze your data more effectively than Excel charts, especially if you have large and complex datasets. Here are some popular alternatives:
1. **Tableau**: A powerful data visualization tool that allows users to create a wide range of interact... | 13,622 | [
{
"from": "human",
"value": "I have lots and lots of data in various structures. Are there any better platforms other than Excel charts which can help me.\n"
},
{
"from": "gpt",
"value": "Yes, there are several platforms and tools that can help you visualize and analyze your data more effectivel... |
I frequently encounter some definitions for Win32API structures (but not limited to it) that have a cbSize member as in the following example.
typedef struct _TEST {
int cbSize;
// other members follow
} TEST, *PTEST;
And then we use it like this:
TEST t = { sizeof(TEST) };
...
or
TEST t;
t.cbSize = sizeof(TE... | Your understanding of the `cbSize` member in structures used in the Win32 API is correct. The `cbSize` member serves several important purposes, primarily related to versioning and ensuring compatibility between different versions of a structure or between different components (like DLLs and applications).
### Key Pur... | 16,848 | [
{
"from": "human",
"value": "I frequently encounter some definitions for Win32API structures (but not limited to it) that have a cbSize member as in the following example.\ntypedef struct _TEST {\n int cbSize;\n // other members follow\n} TEST, *PTEST;\n\nAnd then we use it like this:\nTEST t = { size... |
I am trying to use Lucene Java 2.3.2 to implement search on a catalog of products. Apart from the regular fields for a product, there is field called 'Category'. A product can fall in multiple categories. Currently, I use FilteredQuery to search for the same search term with every Category to get the number of results ... | Using Lucene 2.3.2 to search across multiple categories and then aggregating the results can indeed be inefficient if you're making multiple calls with `FilteredQuery`. Instead of filtering your query multiple times for each category, you can take advantage of Lucene's ability to handle Boolean queries or use the `Mult... | 20,992 | [
{
"from": "human",
"value": "I am trying to use Lucene Java 2.3.2 to implement search on a catalog of products. Apart from the regular fields for a product, there is field called 'Category'. A product can fall in multiple categories. Currently, I use FilteredQuery to search for the same search term with eve... |
On a 32-bit CPU, an integer is 4 bytes and a short integer is 2 bytes. If I am writing a C/C++ application that uses many numeric values that will always fit within the provided range of a short integer, is it more efficient to use 4 byte integers or 2 byte integers?
I have heard it suggested that 4 byte integers are ... | In the context of a 32-bit CPU, there are several considerations regarding the efficiency of using `int` (4 bytes) versus `short` (2 bytes) when dealing with numeric values that fit within the range of a `short`.
### Memory Considerations
1. **Memory Alignment**: Many 32-bit CPUs are optimized for accessing data types... | 21,473 | [
{
"from": "human",
"value": "On a 32-bit CPU, an integer is 4 bytes and a short integer is 2 bytes. If I am writing a C/C++ application that uses many numeric values that will always fit within the provided range of a short integer, is it more efficient to use 4 byte integers or 2 byte integers?\nI have he... |
Is there a way to set a different value for service startup timeout per service?
I can change it using the ServicesPipeTimeout registry key, but it's per machine (http://support.microsoft.com/kb/824344).
At the moment the only thing I thought about was to do all the time-consuming startup actions in a different thread.... | In Windows, the `ServicesPipeTimeout` registry key indeed sets a global timeout for all services on the machine, and there is no built-in method to configure a separate startup timeout for individual services. However, you can manage service startup delays and timeouts in a few alternative ways, although they may not d... | 21,553 | [
{
"from": "human",
"value": "Is there a way to set a different value for service startup timeout per service?\nI can change it using the ServicesPipeTimeout registry key, but it's per machine (http://support.microsoft.com/kb/824344).\nAt the moment the only thing I thought about was to do all the time-consu... |
I have an app with a large ListView which is terribly slow so I'm implementing VirtualMode. MSDN does not seem to cover how I would add and delete new items in the middle of the listview.
For example, the ListView has 1000 items (representing files on disk) and after the initial population of the ListView (by the Retri... | When working with a `ListView` in virtual mode, managing the data source can be a bit tricky, especially when you're dealing with adding, deleting, and updating items. Here's how to handle your specific scenarios:
### Question 1: Updating the ListView after changes
To notify the `ListView` that items have been change... | 22,931 | [
{
"from": "human",
"value": "I have an app with a large ListView which is terribly slow so I'm implementing VirtualMode. MSDN does not seem to cover how I would add and delete new items in the middle of the listview.\nFor example, the ListView has 1000 items (representing files on disk) and after the initia... |
Mixing the use of primitive data types and their respective wrapper classes, in Java, can lead to a lot of bugs. The following example illustrates the issue:
int i = 4;
...
if (i == 10)
doStuff();
Later on you figure that you want the variable i to be either defined or undefined, so you change the above instantiatio... | Using wrapper classes (like `Integer`, `Double`, etc.) instead of primitive data types (like `int`, `double`, etc.) in Java certainly has its pros and cons. Let's break down the advantages and disadvantages of using wrapper classes and discuss the implications for performance, memory, and potential pitfalls.
### Advan... | 16,370 | [
{
"from": "human",
"value": "Mixing the use of primitive data types and their respective wrapper classes, in Java, can lead to a lot of bugs. The following example illustrates the issue:\nint i = 4;\n...\nif (i == 10)\n doStuff();\n\nLater on you figure that you want the variable i to be either defined or ... |
Could you please explain what the practical usage is for the internal keyword in C#?
I know that the internal modifier limits access to the current assembly, but when and in which circumstance should I use it?
| The `internal` keyword in C# is an access modifier that restricts the visibility of a class, method, property, or any other member to the current assembly. This means that the member is accessible only within the same project (or DLL) but not from other projects that reference it. Here are some practical usages and cir... | 21,708 | [
{
"from": "human",
"value": "Could you please explain what the practical usage is for the internal keyword in C#?\nI know that the internal modifier limits access to the current assembly, but when and in which circumstance should I use it?\n"
},
{
"from": "gpt",
"value": "The `internal` keyword ... |
I'm developing a simple console application in Visual Studio 2008 and want to run it in the output window inside Visual Studio 2008, instead of having a separate command prompt window come up. Is there a way to do this?
| In Visual Studio 2008, you can run your console application in the output window instead of a separate command prompt window by making a few adjustments. However, you will need to capture the output and display it in the Visual Studio console output instead of the default console window. Here are a couple of methods to... | 18,235 | [
{
"from": "human",
"value": "I'm developing a simple console application in Visual Studio 2008 and want to run it in the output window inside Visual Studio 2008, instead of having a separate command prompt window come up. Is there a way to do this?\n"
},
{
"from": "gpt",
"value": "In Visual Stud... |
If I already have a database schema complete, can the entity framework somehow generate the storage schema for me?
Or if I have the classes developed, can it generate the other xml's desribing the classes and their relationships?
| Entity Framework (EF) can work in two primary approaches: Database First and Code First. Depending on which approach you are using, EF has different capabilities for generating storage schemas or mapping files.
### 1. Database First Approach
If you have an existing database schema, you can use the Database First appro... | 22,464 | [
{
"from": "human",
"value": "If I already have a database schema complete, can the entity framework somehow generate the storage schema for me?\nOr if I have the classes developed, can it generate the other xml's desribing the classes and their relationships?\n"
},
{
"from": "gpt",
"value": "Ent... |
I have some problems on a site with the concurrent access to a list. This list keeps a cart of items, and multiple deletes are crashing the site.
Which is the best method to sync them?
Is a lock enough?
The lock option seems to be ugly because the code is spread all over the place and is pretty messy.
Update:
This is ... | To handle concurrent access to a shared list in a multi-threaded environment, especially for operations like adding or removing items from the list (like a shopping cart), you need to ensure thread safety to prevent crashes or data corruption. Since you mentioned that the code is spread all over the place and you’re li... | 20,912 | [
{
"from": "human",
"value": "I have some problems on a site with the concurrent access to a list. This list keeps a cart of items, and multiple deletes are crashing the site.\nWhich is the best method to sync them? \nIs a lock enough?\nThe lock option seems to be ugly because the code is spread all over the... |
I have used Visual Studio for a long time, but one feature I have never used is the macro system. I saw a post where someone mentioned he used macros (no elaboration) so I was wondering is it really worth the time investing in learning how to create macros?
If so, what kind of stuff do you make?
There was similar post(... | The macro system in Visual Studio can be a powerful feature, especially if you frequently perform repetitive tasks or have specific workflows that could benefit from automation. While some users find it essential to their productivity, others may not feel the need for macros, especially if their workflow doesn't involv... | 20,190 | [
{
"from": "human",
"value": "I have used Visual Studio for a long time, but one feature I have never used is the macro system. I saw a post where someone mentioned he used macros (no elaboration) so I was wondering is it really worth the time investing in learning how to create macros?\nIf so, what kind of ... |
For obvious productivity reasons, I make an effort of learning and using as many of the keyboard shortcuts for the various Re# commands.
However, it seems that the unit test runner does not have any associated shortcut keys. I want to be able to select certain tests and be able to run or debug them without resorting t... | In JetBrains Rider, you can indeed run and debug unit tests without using the mouse, thanks to the ability to configure keyboard shortcuts. Here's how you can set up shortcuts for running and debugging unit tests:
1. **Open Settings/Preferences:**
- Go to `File` > `Settings` (or `Ctrl` + `Alt` + `S` on Windows/Linu... | 21,015 | [
{
"from": "human",
"value": "For obvious productivity reasons, I make an effort of learning and using as many of the keyboard shortcuts for the various Re# commands. \nHowever, it seems that the unit test runner does not have any associated shortcut keys. I want to be able to select certain tests and be abl... |
Is there a library function that performs binary search on a list/tuple and return the position of the item if found and 'False' (-1, None, etc.) if not?
I found the functions bisect_left/right in the bisect module, but they still return a position even if the item is not in the list. That's perfectly fine for their in... | In Python, there isn't a built-in library function that directly performs a binary search and returns a position if found or `None` (or another false value) if not found. However, you can achieve the functionality you're looking for using the `bisect` module as you mentioned, by combining it with a simple check.
Here'... | 20,494 | [
{
"from": "human",
"value": "Is there a library function that performs binary search on a list/tuple and return the position of the item if found and 'False' (-1, None, etc.) if not?\nI found the functions bisect_left/right in the bisect module, but they still return a position even if the item is not in th... |
When is it a good idea to use PHP_EOL?
I sometimes see this in code samples of PHP. Does this handle DOS/Mac/Unix endline issues?
| `PHP_EOL` is a predefined constant in PHP that represents the correct End Of Line (EOL) character(s) for the platform on which the PHP script is running. It is particularly useful when you want to ensure that your output has the appropriate line endings regardless of the environment, making your code more portable and ... | 18,439 | [
{
"from": "human",
"value": "When is it a good idea to use PHP_EOL?\nI sometimes see this in code samples of PHP. Does this handle DOS/Mac/Unix endline issues?\n"
},
{
"from": "gpt",
"value": "`PHP_EOL` is a predefined constant in PHP that represents the correct End Of Line (EOL) character(s) fo... |
Usually when I build a site, I put all the CSS into one file, and all the properties that relate to a set of elements are defined at once. Like this:
#myElement {
color: #fff;
background-color: #000;
padding: 10px;
border: 1px solid #ccc;
font-size: 14pt;
}
.myClass {
font-size: 12pt;
paddi... | When it comes to organizing your CSS, there are both advantages and disadvantages to splitting it into multiple files versus consolidating everything into a single file. Here’s a breakdown of the considerations, including the potential performance implications of repeating selectors and some tools that can help you man... | 19,700 | [
{
"from": "human",
"value": "Usually when I build a site, I put all the CSS into one file, and all the properties that relate to a set of elements are defined at once. Like this:\n#myElement {\n color: #fff;\n background-color: #000;\n padding: 10px;\n border: 1px solid #ccc;\n font-size: 14p... |
Anyway, I'm a little confused about when to propagate an exception and when to wrap it, and the differences.
At the moment, my understanding tells me that wrapping an exception would involve taking an exception like DriveNotFound (in IO) and then wrap it with the general IOException.
But with the concept of propagating... | Your questions about exception handling reveal some important aspects of writing robust and maintainable code. Let's break down your concerns and clarify concepts related to propagating, wrapping, and handling exceptions.
### Propagating vs. Wrapping Exceptions
1. **Propagating Exceptions**:
- This occurs when an... | 20,326 | [
{
"from": "human",
"value": "Anyway, I'm a little confused about when to propagate an exception and when to wrap it, and the differences.\nAt the moment, my understanding tells me that wrapping an exception would involve taking an exception like DriveNotFound (in IO) and then wrap it with the general IOExce... |
This semester, I took a course in computer graphics at my University. At the moment, we're starting to get into some of the more advanced stuff like heightmaps, averaging normals, tesselation etc.
I come from an object-oriented background, so I'm trying to put everything we do into reusable classes. I've had good succe... | It's great to hear that you're diving into advanced topics in computer graphics! Your experience reflects a common challenge many developers face when trying to apply object-oriented principles in OpenGL programming, particularly due to the stateful nature of the OpenGL API. Here are some insights and best practices th... | 19,263 | [
{
"from": "human",
"value": "This semester, I took a course in computer graphics at my University. At the moment, we're starting to get into some of the more advanced stuff like heightmaps, averaging normals, tesselation etc.\nI come from an object-oriented background, so I'm trying to put everything we do ... |
I just want a quick way (and preferably not using a while loop)of createing a table of every date between date @x and date @y so I can left outer join to some stats tables, some of which will have no records for certain days in between, allowing me to mark missing days with a 0
| To create a table of every date between two given dates in SQL without using a while loop, you can use a Common Table Expression (CTE) or a numbers/tally table. Below are two approaches that demonstrate how to accomplish this task.
### Approach 1: Using a CTE
You can use a recursive Common Table Expression (CTE) to ... | 9,029 | [
{
"from": "human",
"value": "I just want a quick way (and preferably not using a while loop)of createing a table of every date between date @x and date @y so I can left outer join to some stats tables, some of which will have no records for certain days in between, allowing me to mark missing days with a 0\... |
I found an article on getting active tcp/udp connections on a machine.
http://www.codeproject.com/KB/IP/iphlpapi.aspx
My issue however is I need to be able to determine active connections remotely - to see if a particular port is running or listening without tampering with the machine.
Is this possible?
Doesn't seem li... | Determining active TCP/UDP connections on a remote machine without tampering with it can indeed be challenging and raises several security concerns. Here are some approaches you can consider:
### 1. **Network Scanning Tools**
There are tools like Nmap that allow you to scan a remote machine to see which ports are open... | 20,182 | [
{
"from": "human",
"value": "I found an article on getting active tcp/udp connections on a machine.\nhttp://www.codeproject.com/KB/IP/iphlpapi.aspx\nMy issue however is I need to be able to determine active connections remotely - to see if a particular port is running or listening without tampering with the... |
Hi are there any pros / cons relating to the speed that a stored procedure executes when using an IF statement or choosing to use a CASE statement instead?
| When considering the execution speed of stored procedures in relational databases, both `IF` statements and `CASE` statements can have performance implications depending on how they're used, but generally, the impact on performance is minimal compared to other factors. Here are some pros and cons of using `IF` versus `... | 19,525 | [
{
"from": "human",
"value": "Hi are there any pros / cons relating to the speed that a stored procedure executes when using an IF statement or choosing to use a CASE statement instead?\n"
},
{
"from": "gpt",
"value": "When considering the execution speed of stored procedures in relational databa... |
I'm using libcurl in a Win32 C++ application.
I have the curllib.vcproj project added to my solution and set my other projects to depend on it.
How do I build it with SSL support enabled?
| To build libcurl with SSL support enabled in a Win32 C++ application using Visual Studio, you need to follow several steps to ensure that the OpenSSL libraries are properly linked. Here's a step-by-step guide to help you with the process:
### Step 1: Download OpenSSL
1. Go to the [OpenSSL website](https://www.openssl... | 20,113 | [
{
"from": "human",
"value": "I'm using libcurl in a Win32 C++ application.\nI have the curllib.vcproj project added to my solution and set my other projects to depend on it.\nHow do I build it with SSL support enabled?\n"
},
{
"from": "gpt",
"value": "To build libcurl with SSL support enabled in... |
How would one structure a table for an entity that can have a one to many relationship to itself? Specifically, I'm working on an app to track animal breeding. Each animal has an ID; it's also got a sire ID and a dame ID. So it's possible to have a one to many from the sire or dame to its offspring. I would be incl... | You're on the right track with your thought process for modeling the one-to-many relationship between animals and their parents in a breeding context. Here's how you can approach designing the database schema, along with an explanation of the design choices.
### Single Table Approach
You can model the relationships w... | 20,362 | [
{
"from": "human",
"value": "How would one structure a table for an entity that can have a one to many relationship to itself? Specifically, I'm working on an app to track animal breeding. Each animal has an ID; it's also got a sire ID and a dame ID. So it's possible to have a one to many from the sire o... |
I'm trying to achieve the equivalent of a WinForms ListView with its View property set to View.List. Visually, the following works fine. The file names in my Listbox go from top to bottom, and then wrap to a new column.
Here's the basic XAML I'm working with:
<ListBox Name="thelist"
IsSynchronizedWithCurrentItem="T... | To achieve the desired behavior of a ListBox in WPF that mimics the ListView control's column wrapping and appropriate arrow key navigation, you'll need to implement some custom logic in handling the keyboard events. The goal is to allow navigation between items that correctly respects the layout of the `WrapPanel`, en... | 15,097 | [
{
"from": "human",
"value": "I'm trying to achieve the equivalent of a WinForms ListView with its View property set to View.List. Visually, the following works fine. The file names in my Listbox go from top to bottom, and then wrap to a new column.\nHere's the basic XAML I'm working with:\n<ListBox Name=\"t... |
Object o = new Long[0]
System.out.println( o.getClass().isArray() )
System.out.println( o.getClass().getName() )
Class ofArray = ???
Running the first 3 lines emits;
true
[Ljava.lang.Long;
How do I get ??? to be type long? I could parse the string and do a Class.forname(), but thats grotty. What's the easy way?
| In Java, you can get the component type of an array directly from its class object using the `getComponentType()` method. Given your example, where `o` is an instance of an array of `Long`, you can determine the type `long` (the primitive type) by following these steps:
1. Use `o.getClass().getComponentType()` to get ... | 20,769 | [
{
"from": "human",
"value": "Object o = new Long[0]\nSystem.out.println( o.getClass().isArray() )\nSystem.out.println( o.getClass().getName() )\nClass ofArray = ???\n\nRunning the first 3 lines emits;\ntrue\n[Ljava.lang.Long;\n\nHow do I get ??? to be type long? I could parse the string and do a Class.for... |
I am debugging with breakpoints and I realize the assert call? I thought it was only for unit tests. What does it do more than breakpoint? Since I can breakpoint, why should I use Assert?
| Assertions and breakpoints are both useful tools in debugging, but they serve different purposes and operate in different ways. Here's a comparison to clarify their roles:
### Assertions
1. **Purpose**: Assertions are used to check for conditions that should always be true at a particular point in your code. They hel... | 22,897 | [
{
"from": "human",
"value": "I am debugging with breakpoints and I realize the assert call? I thought it was only for unit tests. What does it do more than breakpoint? Since I can breakpoint, why should I use Assert?\n"
},
{
"from": "gpt",
"value": "Assertions and breakpoints are both useful too... |
I am trying to get the value of some ListViewSubItems, but I have no idea what values it uses for its keys. I have some simple code:
protected override void OnItemDrag(ItemDragEventArgs e)
{
base.OnItemDrag(e);
ListViewItem item = e.Item as ListViewItem;
string val = item.Su... | To access `ListViewSubItems` by their keys (i.e., the names of the columns), you can use the `ListViewItem`'s `ListView` property to get a reference to the `ListView` and then find the index of the column based on its name. Here's how you can do it:
1. Get the `ListView` that contains the `ListViewItem`.
2. Find the i... | 22,708 | [
{
"from": "human",
"value": "I am trying to get the value of some ListViewSubItems, but I have no idea what values it uses for its keys. I have some simple code:\n protected override void OnItemDrag(ItemDragEventArgs e)\n {\n base.OnItemDrag(e); \n ListViewItem item = e.Item ... |
How can I detect mouse clicks regardless of the window the mouse is in?
Perferabliy in python, but if someone can explain it in any langauge I might be able to figure it out.
I found this on microsoft's site:
http://msdn.microsoft.com/en-us/library/ms645533(VS.85).aspx
But I don't see how I can detect or pick up the no... | To detect mouse clicks globally (i.e., regardless of which window is in focus) in Python without relying on libraries such as Pygame, you can use the `pywin32` library, which allows you to interact with the Windows API directly.
Here's a simple example demonstrating how to use `pywin32` to listen for mouse clicks glo... | 20,662 | [
{
"from": "human",
"value": "How can I detect mouse clicks regardless of the window the mouse is in?\nPerferabliy in python, but if someone can explain it in any langauge I might be able to figure it out.\nI found this on microsoft's site:\nhttp://msdn.microsoft.com/en-us/library/ms645533(VS.85).aspx\nBut I... |
I have the following string expression in a PowerShell script:
"select count(*) cnt from ${schema}.${table} where ${col.column_name} is null"
The schema and table resolve to the values of $schema and $table, respectively. However, an empty string is supplied for ${col.column_name}. How can I dot into the member of a v... | In PowerShell, when you want to include a property of an object in a string and that property is dynamic (or subject to change), you can achieve this using string interpolation with a subexpression. You can use `$()` to evaluate an expression within the string.
Here's how you can modify your string to handle the case ... | 23,988 | [
{
"from": "human",
"value": "I have the following string expression in a PowerShell script:\n\"select count(*) cnt from ${schema}.${table} where ${col.column_name} is null\"\n\nThe schema and table resolve to the values of $schema and $table, respectively. However, an empty string is supplied for ${col.colu... |
Initialization would include creating all the required tables, constraints and populating the tables.
edit: Is there already a project doing this?
| Yes, there are several projects and tools that handle the initialization of databases by creating tables, defining constraints, and populating them with initial data. Here are a few categories and examples of such projects:
1. **Database Migration Tools**:
- **Flyway**: A database migration tool that allows you to ... | 23,223 | [
{
"from": "human",
"value": "Initialization would include creating all the required tables, constraints and populating the tables.\nedit: Is there already a project doing this?\n"
},
{
"from": "gpt",
"value": "Yes, there are several projects and tools that handle the initialization of databases ... |
I'm currently learning functional programming in my spare time with Scala, and I have an idle newbie question.
I can see the elegance of having immutable objects when doing something like calculating a Haar wavelet transform - i.e. when the data itself being represented by the objects doesn't change.
But I saw a blog w... | Your question touches on a fundamental aspect of functional programming and how immutability can be applied in larger-scale systems, such as a massively multiplayer online game (MMORPG). Let’s explore how immutability can be effectively utilized in such scenarios, along with potential trade-offs.
### Immutability in G... | 19,274 | [
{
"from": "human",
"value": "I'm currently learning functional programming in my spare time with Scala, and I have an idle newbie question.\nI can see the elegance of having immutable objects when doing something like calculating a Haar wavelet transform - i.e. when the data itself being represented by the ... |
I've just installed PowerBuilder 11.5. I'm trying to use the PowerBuilder Runtime Packager that comes with it to create an MSI with the PowerBuilder runtime DLLs. But when I hit create, about a third of the way through I get the error "Linking Msi for PowerBuilder.NET runtime get an error." (The poor English is verbati... | The issue you're experiencing with the PowerBuilder Runtime Packager is not uncommon, and there are several troubleshooting steps you can take to resolve the "Linking Msi for PowerBuilder.NET runtime get an error" message.
### Troubleshooting Steps
1. **Verify Installation Integrity**:
- Make sure that your PowerB... | 22,490 | [
{
"from": "human",
"value": "I've just installed PowerBuilder 11.5. I'm trying to use the PowerBuilder Runtime Packager that comes with it to create an MSI with the PowerBuilder runtime DLLs. But when I hit create, about a third of the way through I get the error \"Linking Msi for PowerBuilder.NET runtime g... |
I have a few 'helper' style extension methods I use quite regularly now (they are mostly quite simple, intuitive, and work for good not evil, so please don't have this descend into a discussion around whether or not I should use them). They are largely extending core .NET CLR classes.
Currently, I have to copy the 'Ext... | Yes, you can definitely wrap your extension methods in a separate class library (DLL) project, which allows you to reuse them across multiple projects within a solution. This approach has several benefits, including easier maintenance, version control, and organization. Here's a step-by-step guide on how to do this:
#... | 20,816 | [
{
"from": "human",
"value": "I have a few 'helper' style extension methods I use quite regularly now (they are mostly quite simple, intuitive, and work for good not evil, so please don't have this descend into a discussion around whether or not I should use them). They are largely extending core .NET CLR cl... |
MSDN says
If the function fails, the return value is WAIT_FAILED. To get extended error information, call GetLastError.
The code is:
HANDLE m_mutex_handle; /**< m_mutex_handle. The handle to the created mutex. */
m_mutex_handle = ::CreateMutex( 0, false, NULL );
::WaitForSingleObject( m_mutex_handle, INFINITE... | When using the Windows API function `CreateMutex`, there are several reasons why it might fail and return `WAIT_FAILED` when you subsequently call `WaitForSingleObject` on the mutex handle. Let's break down the potential issues:
### 1. **Invalid Handle**
- If `CreateMutex` fails, it returns `NULL`. If you pass this... | 23,193 | [
{
"from": "human",
"value": "MSDN says\n\nIf the function fails, the return value is WAIT_FAILED. To get extended error information, call GetLastError.\n\nThe code is:\nHANDLE m_mutex_handle; /**< m_mutex_handle. The handle to the created mutex. */\nm_mutex_handle = ::CreateMutex( 0, false, NULL );\... |
I'm using the build-helper-maven-plugin to add it to my build, but I'd
like to see the XREF source for this extra source directory as well.
FYI:
maven-jxr-plugin - The JXR plugin produces a cross-reference of the project's sources. The generated reports make it easier for the user to reference or find specific lines of... | To include the XREF source for an extra source directory when using the `build-helper-maven-plugin` along with the `maven-jxr-plugin`, you'll need to ensure that your additional source directory is correctly configured and integrated into the Maven build lifecycle. Below are the steps to accomplish this:
1. **Add Extr... | 16,842 | [
{
"from": "human",
"value": "I'm using the build-helper-maven-plugin to add it to my build, but I'd\nlike to see the XREF source for this extra source directory as well.\nFYI:\nmaven-jxr-plugin - The JXR plugin produces a cross-reference of the project's sources. The generated reports make it easier for the... |
HTML (or maybe just XHTML?) is relatively strict when it comes to non-standard attributes on tags. If they aren't part of the spec, then your code is considered non-compliant.
Non-standard attributes can be fairly useful for passing along meta-data to Javascript however. For instance, if a link is suppose to show a pop... | When deciding between using non-standard attributes and embedding metadata within child elements (like a `<span>`), it's important to weigh the pros and cons of each approach. Here are some considerations for both methods:
### Method 1: Non-standard Attributes
#### Pros:
- **Conciseness:** Using a non-standard attrib... | 21,318 | [
{
"from": "human",
"value": "HTML (or maybe just XHTML?) is relatively strict when it comes to non-standard attributes on tags. If they aren't part of the spec, then your code is considered non-compliant.\nNon-standard attributes can be fairly useful for passing along meta-data to Javascript however. For in... |
If you have a hash (or reference to a hash) in perl with many dimensions and you want to iterate across all values, what's the best way to do it. In other words, if we have
$f->{$x}{$y}, I want something like
foreach ($x, $y) (deep_keys %{$f})
{
}
instead of
foreach $x (keys %f)
{
foreach $y (keys %{$f->{$x... | In Perl, if you want to iterate through all keys and values of a multi-dimensional hash (or a hash reference) in a cleaner way than using nested loops, you can use a recursive subroutine to traverse the hash. Below is an example of how to accomplish this.
### Example Code
```perl
use strict;
use warnings;
# Sample m... | 22,426 | [
{
"from": "human",
"value": "If you have a hash (or reference to a hash) in perl with many dimensions and you want to iterate across all values, what's the best way to do it. In other words, if we have\n$f->{$x}{$y}, I want something like\nforeach ($x, $y) (deep_keys %{$f})\n{\n}\n\ninstead of \nforeach $x... |
Anyone point my at a utility for syncing sql server logins after restoring a database to a different server?
I know I can do it with scripts, but I've been using a wonderful little utility - 'Db Maint Sync SQL Logins' (http://www.dbmaint.com/SyncSqlLogins.asp) to do it on sql server 2000 which unfortunately doesn't s... | If you're looking for a utility to sync SQL Server logins after restoring a database to a different server, especially for SQL Server 2005 and later versions, you might consider the following options:
1. **SQL Server Management Studio (SSMS) Scripts**: Although you're not keen on writing scripts, SSMS can generate the... | 23,384 | [
{
"from": "human",
"value": "Anyone point my at a utility for syncing sql server logins after restoring a database to a different server? \nI know I can do it with scripts, but I've been using a wonderful little utility - 'Db Maint Sync SQL Logins' (http://www.dbmaint.com/SyncSqlLogins.asp) to do it on sql... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.