instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
Resharper certainly thinks so, and out of the box it will nag you to convert
Dooberry dooberry = new Dooberry();
to
var dooberry = new Dooberry();
Is that really considered the best style?
| The use of `var` in C# can be a topic of debate among developers regarding style and readability. Here are some points to consider when deciding whether to use `var` or explicit types like `Dooberry`:
### Pros of Using `var`:
1. **Conciseness**: Using `var` can make code shorter and cleaner, especially when dealing wi... | 3,119 | [
{
"from": "human",
"value": "Resharper certainly thinks so, and out of the box it will nag you to convert\nDooberry dooberry = new Dooberry();\n\nto\nvar dooberry = new Dooberry();\n\nIs that really considered the best style?\n"
},
{
"from": "gpt",
"value": "The use of `var` in C# can be a topic... |
Is it possible to use Microsoft Entity Framework with Oracle database?
| Yes, it is possible to use Microsoft Entity Framework with an Oracle database. While Entity Framework (EF) is typically used with SQL Server, there are several providers that allow you to connect EF to Oracle databases. Here are some commonly used options:
1. **Oracle Data Provider for .NET (ODP.NET)**: Oracle provide... | 2,882 | [
{
"from": "human",
"value": "Is it possible to use Microsoft Entity Framework with Oracle database?\n"
},
{
"from": "gpt",
"value": "Yes, it is possible to use Microsoft Entity Framework with an Oracle database. While Entity Framework (EF) is typically used with SQL Server, there are several pro... |
As the title mentions, I have a timeout callback handler on an ajax call, and I want to be able to test that condition but nothing is coming to mind immediately on ways I can force my application to hit that state, any suggestions?
| Testing a timeout callback handler in an AJAX call can be tricky, but there are several approaches you can take to simulate the timeout condition and ensure that your application correctly handles it. Here are some strategies you can use:
1. **Mocking the AJAX Call**: Use a mocking library (like Sinon.js, Jest, or oth... | 2,927 | [
{
"from": "human",
"value": "As the title mentions, I have a timeout callback handler on an ajax call, and I want to be able to test that condition but nothing is coming to mind immediately on ways I can force my application to hit that state, any suggestions?\n"
},
{
"from": "gpt",
"value": "Te... |
According to this discussion, the iphone agreement says that it doesn't allow "loading of plugins or running interpreted code that has been downloaded".
Technically, I would like to download scripts from our server (embedded in a proprietary protocol).
Does this mean I wouldn't be allowed to run a runtime like v8 in an... | The clause you're referencing from Apple's App Store Review Guidelines generally prohibits apps from loading external code or running interpreted code that has been downloaded from the internet. This includes, but is not limited to, JavaScript engines or similar runtimes that execute code fetched from a server.
Specif... | 5,882 | [
{
"from": "human",
"value": "According to this discussion, the iphone agreement says that it doesn't allow \"loading of plugins or running interpreted code that has been downloaded\".\nTechnically, I would like to download scripts from our server (embedded in a proprietary protocol).\nDoes this mean I would... |
Let's say you have a variable in a makefile fragment like the following:
MY_LIST=a b c d
How do I then reverse the order of that list? I need:
$(warning MY_LIST=${MY_LIST})
to show
MY_LIST=d c b a
Edit: the real problem is that
ld -r some_object.o ${MY_LIST}
produces an a.out with undefined symbols because the ... | To reverse the order of a space-separated list in a Makefile, you can use a simple Makefile function combined with the `foreach` function to create a reversed list. Here’s a way to do that:
```makefile
MY_LIST = a b c d
# Function to reverse the list
reverse = $(foreach x,$(1),$(lastword $(x)) $(call reverse,$(filter... | 4,009 | [
{
"from": "human",
"value": "Let's say you have a variable in a makefile fragment like the following:\nMY_LIST=a b c d\n\nHow do I then reverse the order of that list? I need:\n$(warning MY_LIST=${MY_LIST}) \n\nto show\nMY_LIST=d c b a\n\nEdit: the real problem is that \nld -r some_object.o ${MY_LIST}\n\n... |
I am working on a C++ code base that was recently moved from X/Motif to Qt. I am trying to write a Perl script that will replace all occurrences of Boolean (from X) with bool. The script just does a simple replacement.
s/\bBoolean\b/bool/g
There are a few conditions.
1) We have CORBA in our code and \b matches ... | To refine your Perl script further based on your requirements, let's address the new conditions you provided:
1. **Avoid matches in strings:** We can use a negative lookbehind to ensure that `Boolean` isn't preceded by a quote (`"`), which indicates the start of a string.
2. **Avoid matches in comments:** We need to ... | 2,953 | [
{
"from": "human",
"value": "I am working on a C++ code base that was recently moved from X/Motif to Qt. I am trying to write a Perl script that will replace all occurrences of Boolean (from X) with bool. The script just does a simple replacement. \ns/\\bBoolean\\b/bool/g\n\nThere are a few conditions. ... |
Given a latitude and longitude, what is the easiest way to find the name of the city and the US zip code of that location.
(This is similar to https://stackoverflow.com/questions/23572/latitude-longitude-database, except I want to convert in the opposite direction.)
Related question: Get street address at lat/long pai... | To convert a latitude and longitude into a city name and US ZIP code, you can use a variety of geocoding services. Here are some easy-to-use options:
### 1. **Google Maps Geocoding API**
Google provides a geocoding API that allows you to convert geographic coordinates into a human-readable address. Here’s how you can ... | 2,812 | [
{
"from": "human",
"value": "Given a latitude and longitude, what is the easiest way to find the name of the city and the US zip code of that location.\n(This is similar to https://stackoverflow.com/questions/23572/latitude-longitude-database, except I want to convert in the opposite direction.)\n\nRelated ... |
I think this is specific to IE 6.0 but...
In JavaScript I add a div to the DOM. I assign an id attribute. When I later try to pick up the div by the id all I get is null.
Any suggestions?
Example:
var newDiv = document.createElement("DIV");
newDiv.setAttribute("ID", "obj_1000");
document.appendChild(newDiv);
alert("Ad... | The issue you're experiencing seems to stem from a couple of factors, particularly when working with Internet Explorer 6.0. Here are a few important points to consider:
1. **Case Sensitivity**: While HTML is generally case insensitive, JavaScript properties and methods are case sensitive. In your code, you use `setAtt... | 4,529 | [
{
"from": "human",
"value": "I think this is specific to IE 6.0 but...\nIn JavaScript I add a div to the DOM. I assign an id attribute. When I later try to pick up the div by the id all I get is null.\nAny suggestions?\nExample:\nvar newDiv = document.createElement(\"DIV\");\nnewDiv.setAttribute(\"ID\", \"o... |
I have a database with a few dozen tables interlinked with foreign keys. Under normal circumstances, I want the default ON DELETE RESTRICT behavior for those constraints. But when trying to share a snapshot of the database with a consultant, I needed to remove some sensitive data. I wish that my memory of a DELETE FROM... | Your approach of modifying the foreign key constraints temporarily to allow cascading deletes is a valid method, but it can be a bit cumbersome and error-prone. Here are a few alternative strategies that you might find more efficient for handling similar situations in the future:
### 1. **Use a Transaction with Tempor... | 2,745 | [
{
"from": "human",
"value": "I have a database with a few dozen tables interlinked with foreign keys. Under normal circumstances, I want the default ON DELETE RESTRICT behavior for those constraints. But when trying to share a snapshot of the database with a consultant, I needed to remove some sensitive dat... |
While CtrlX works fine in vim under windows, CtrlA selects all (duh).
Is there a way to increment a number with a keystroke under windows?
| In Vim, you can increment a number under the cursor by using the `CTRL-A` command. However, as you mentioned, `CTRL-A` selects all in many Windows applications. If you want to increment a number in Vim while using Windows, you can still use Vim's built-in functionality.
### To increment a number:
1. Position the curso... | 3,588 | [
{
"from": "human",
"value": "While CtrlX works fine in vim under windows, CtrlA selects all (duh).\nIs there a way to increment a number with a keystroke under windows?\n"
},
{
"from": "gpt",
"value": "In Vim, you can increment a number under the cursor by using the `CTRL-A` command. However, as... |
I've tried two different methods of reusing code. I have a solution full of just class library projects with generic code that I reuse in almost every project I work on. When I get to work on a new project, I will reuse code from this code library in one of two ways:
I have tried bringing the projects I need from this... | Reusing code across projects is a common challenge, and both methods you've tried have their merits. However, there are additional strategies and best practices you can adopt to improve your code reuse experience. Here are some suggestions:
### 1. NuGet Packages
Creating a NuGet package from your class library allows... | 1,741 | [
{
"from": "human",
"value": "I've tried two different methods of reusing code. I have a solution full of just class library projects with generic code that I reuse in almost every project I work on. When I get to work on a new project, I will reuse code from this code library in one of two ways:\n\nI have t... |
Has anyone found a useful solution to the DesignMode problem when developing controls?
The issue is that if you nest controls then DesignMode only works for the first level. The second and lower levels DesignMode will always return FALSE.
The standard hack has been to look at the name of the process that is running an... | The issue you're encountering with `DesignMode` in nested controls is a well-known limitation in the Windows Forms and WPF frameworks. When developing custom controls, particularly those that are used in design-time environments (like Visual Studio), `DesignMode` can be a tricky attribute to manage.
### Workarounds an... | 1,169 | [
{
"from": "human",
"value": "Has anyone found a useful solution to the DesignMode problem when developing controls?\nThe issue is that if you nest controls then DesignMode only works for the first level. The second and lower levels DesignMode will always return FALSE.\nThe standard hack has been to look at... |
I am trying to upload a file or stream of data to our web server and I cant find a decent way of doing this. I have tried both WebClient and WebRequest both have their problems.
WebClient
Nice and easy but you do not get any notification that the asynchronous upload has completed, and the UploadProgressChanged event ... | If you're working in a Silverlight environment and need to upload multiple binary files with progress notifications, you're facing some limitations due to the framework's restrictions. However, you can accomplish your goal by using `HttpWebRequest` with an `IProgress<T>` implementation, and performing the upload in a w... | 2,388 | [
{
"from": "human",
"value": "I am trying to upload a file or stream of data to our web server and I cant find a decent way of doing this. I have tried both WebClient and WebRequest both have their problems. \nWebClient\nNice and easy but you do not get any notification that the asynchronous upload has comp... |
I'm wanting extra security for a particular point in my web app. So I want to lock the database (SQL Server 2005). Any suggestions or is this even necessary with SQL Server?
Edit on question:
The query is failing silently with no errors messages logged, and does not occur inside of a transaction.
Final Solution:
I neve... | It sounds like you encountered a frustrating issue with SQL Server 2005 and decided to switch to MySQL for better performance and functionality. While SQL Server is a robust database management system, there are certainly valid reasons why developers might choose to use a different database depending on their specific ... | 1,927 | [
{
"from": "human",
"value": "I'm wanting extra security for a particular point in my web app. So I want to lock the database (SQL Server 2005). Any suggestions or is this even necessary with SQL Server?\nEdit on question:\nThe query is failing silently with no errors messages logged, and does not occur insi... |
Has anyone been able to get an NHibernate-based project up and running on a shared web host?
NHibernate does a whole lot of fancy stuff with reflection behind the scenes but the host that I'm using at the moment only allows applications to run in medium trust, which limits what you can do with reflection, and it's thro... | Running NHibernate on a shared web host that operates under medium trust can indeed be quite challenging due to the various restrictions that affect its reflective capabilities. Here are a few suggestions and considerations for selecting a hosting provider that can accommodate NHibernate:
### Hosting Providers
1. **We... | 3,161 | [
{
"from": "human",
"value": "Has anyone been able to get an NHibernate-based project up and running on a shared web host?\nNHibernate does a whole lot of fancy stuff with reflection behind the scenes but the host that I'm using at the moment only allows applications to run in medium trust, which limits what... |
Continuing the "Hidden features of ..." meme, let's share the lesser-known but useful features of Ruby programming language.
Try to limit this discussion with core Ruby, without any Ruby on Rails stuff.
See also:
Hidden features of C#
Hidden features of Java
Hidden features of JavaScript
Hidden features of Ruby on Rai... | One hidden feature of Ruby is the `ObjectSpace` module, which provides a way to interact with and manipulate the Ruby object space.
### Example:
You can use `ObjectSpace.each_object` to iterate over all objects of a given class. This can be particularly useful for debugging or analyzing memory usage.
```ruby
requir... | 5,554 | [
{
"from": "human",
"value": "Continuing the \"Hidden features of ...\" meme, let's share the lesser-known but useful features of Ruby programming language.\nTry to limit this discussion with core Ruby, without any Ruby on Rails stuff.\nSee also:\n\nHidden features of C#\nHidden features of Java\nHidden feat... |
Lot of googling did not help me! Are there any good dictionary web based available?
I am looking for a site which can send me the meaning of words if we pass the word through query string!
| Yes, there are several web-based dictionary APIs that you can use to look up word meanings by sending a query string. Here are a few options:
1. **Oxford Dictionaries API**: The Oxford Dictionaries provide an API that allows you to retrieve word definitions, synonyms, antonyms, and translations. You'll need to sign up... | 4,074 | [
{
"from": "human",
"value": "Lot of googling did not help me! Are there any good dictionary web based available? \nI am looking for a site which can send me the meaning of words if we pass the word through query string!\n"
},
{
"from": "gpt",
"value": "Yes, there are several web-based dictionary... |
I can never remember the differences in regular expression syntax used by tools like grep and AWK, or languages like Python and PHP. Generally, Perl has the most expansive syntax, but I'm often hamstrung by the limitations of even egrep ("extended" grep).
Is there a site that lists the differences in a concise and easy... | Yes, there are several resources that can help you compare the differences in regular expression syntax across various tools and programming languages. While I can't provide links directly, I can suggest a few approaches and resources you might find helpful:
1. **Regex101**: This is an interactive website that allows ... | 3,073 | [
{
"from": "human",
"value": "I can never remember the differences in regular expression syntax used by tools like grep and AWK, or languages like Python and PHP. Generally, Perl has the most expansive syntax, but I'm often hamstrung by the limitations of even egrep (\"extended\" grep).\nIs there a site that... |
A few weeks ago, I was assigned to evaluate all our programmers. I'm very uncomfortable with this since I was the one who taught everyone the shop's programming language (they all got out of college not knowing the language and as luck would have it, I'm very proficient with it.). On the evaluation, I was very biased o... | Evaluating programmers can be a challenging task, especially when you have personal connections and are invested in their success. Here are some insights based on your questions:
### Evaluation Questions
#### As a Programmer:
1. **Technical Skills**
- What new technologies or programming languages have you learned... | 1,681 | [
{
"from": "human",
"value": "A few weeks ago, I was assigned to evaluate all our programmers. I'm very uncomfortable with this since I was the one who taught everyone the shop's programming language (they all got out of college not knowing the language and as luck would have it, I'm very proficient with it.... |
I have always thought that the .equals() method in java should be overridden to be made specific to the class you have created. In other words to look for equivalence of two different instances rather than two references to the same instance. However I have encountered other programmers who seem to think that the defau... | Overriding the `.equals()` method in Java is a critical design decision that can significantly affect how instances of a class are compared. Below are arguments for and against overriding the `equals()` method:
### Arguments for Overriding `equals()`
1. **Logical Equivalence**:
- The primary purpose of overriding ... | 1,246 | [
{
"from": "human",
"value": "I have always thought that the .equals() method in java should be overridden to be made specific to the class you have created. In other words to look for equivalence of two different instances rather than two references to the same instance. However I have encountered other pro... |
I found a question here about blogs on software development, but I would like to know which blogs on software testing this community reads.
If you just have to recommend more than one blog, post each one in separate answer, so others can vote on specific blog. :)
Thanks!
Edit: I am not interested in sites that aggregat... | One highly recommended blog on software testing is **"Ministry of Testing"**. It offers a wealth of resources, tutorials, and insights into various aspects of software testing, including automation, manual testing, and quality assurance practices. The community aspect is also strong, with forums and events that promote... | 6,674 | [
{
"from": "human",
"value": "I found a question here about blogs on software development, but I would like to know which blogs on software testing this community reads.\nIf you just have to recommend more than one blog, post each one in separate answer, so others can vote on specific blog. :)\nThanks!\nEdit... |
I have an external variable coming in as a string and I would like to do a switch/case on it. How do I do that in xquery?
| In XQuery, there is no built-in `switch` or `case` statement like you might find in other programming languages. However, you can use the `let` statement combined with `if` conditions or a series of nested `if-then-else` statements to achieve similar behavior.
Here's a general approach to simulating a switch/case stru... | 3,620 | [
{
"from": "human",
"value": "I have an external variable coming in as a string and I would like to do a switch/case on it. How do I do that in xquery?\n"
},
{
"from": "gpt",
"value": "In XQuery, there is no built-in `switch` or `case` statement like you might find in other programming languages.... |
I'm developing a Sharepoint application and use .NET AjaxControlToolkit library, we are adding a custom aspx page to the Sharepoint. Sharepoint 2007 run in quirks mode so I've made some modification to the AJAX library to make it behave like it normally should. The problem is, the other team already uses the AJAX libra... | In ASP.NET (and especially in SharePoint), handling multiple versions of the same assembly can indeed be challenging, particularly when dealing with the bin folder and the way assemblies are referenced. Here are some strategies you might consider:
### 1. Using Assembly Binding Redirects
You can use assembly binding r... | 1,621 | [
{
"from": "human",
"value": "I'm developing a Sharepoint application and use .NET AjaxControlToolkit library, we are adding a custom aspx page to the Sharepoint. Sharepoint 2007 run in quirks mode so I've made some modification to the AJAX library to make it behave like it normally should. The problem is, t... |
To experiment, I've (long ago) implemented Conway's Game of Life (and I'm aware of this related question!).
My implementation worked by keeping 2 arrays of booleans, representing the 'last state', and the 'state being updated' (the 2 arrays being swapped at each iteration). While this is reasonably fast, I've often won... | Optimizing Conway's Game of Life can involve several strategies aimed at reducing the number of computations needed each iteration. Here are some techniques that you might find useful, along with some details on how to implement them:
1. **Use a Sparse Representation**: If your grid contains a lot of dead cells, consi... | 3,035 | [
{
"from": "human",
"value": "To experiment, I've (long ago) implemented Conway's Game of Life (and I'm aware of this related question!).\nMy implementation worked by keeping 2 arrays of booleans, representing the 'last state', and the 'state being updated' (the 2 arrays being swapped at each iteration). Whi... |
I have a backup of an SQL Server DB in .bak format which I've successfully managed to restore to a local instance of SQL Server Express. I now want to export both the structure and data in a format that MySQL will accept. The tools that I use for MySQL management typically allow me to import/export .sql files, but unfo... | Yes, migrating a database from SQL Server to MySQL can be accomplished by exporting the structure and data into a format that MySQL accepts, typically a `.sql` file. Here’s a step-by-step guide on how to do this using tools available in SQL Server and MySQL:
### Step 1: Generate a Script for Database Structure
1. **O... | 1,608 | [
{
"from": "human",
"value": "I have a backup of an SQL Server DB in .bak format which I've successfully managed to restore to a local instance of SQL Server Express. I now want to export both the structure and data in a format that MySQL will accept. The tools that I use for MySQL management typically allow... |
Plug-in systems in C++ are hard because the ABI is not properly defined, and each compiler (or version thereof) follows its own rules. However, COM on Windows shows that it's possible to create a minimal plug-in system that allows programmers with different compilers to create plug-ins for a host application using a s... | Creating a C++ plug-in system that allows for interoperability between different compilers and versions is indeed challenging due to the language's complexities and the differences in how compilers handle certain features. Below are some considerations and suggestions based on your query:
### Features of C++ You Can C... | 1,052 | [
{
"from": "human",
"value": "Plug-in systems in C++ are hard because the ABI is not properly defined, and each compiler (or version thereof) follows its own rules. However, COM on Windows shows that it's possible to create a minimal plug-in system that allows programmers with different compilers to create ... |
So I've been using InstantRails to check out Ruby on rails. I've been using Notepad++ for the editing. Now I don't want to install Ruby or Rails on my machine. Is there any walk through/tutorial on how to integrate Radrails or Netbeans with InstantRails?
| If you're using InstantRails to develop Ruby on Rails applications without installing Ruby or Rails directly on your machine, you can indeed integrate a robust IDE like RadRails or NetBeans to enhance your coding experience. Here's a general guide on how to set up either of these IDEs with InstantRails.
### Using RadR... | 1,877 | [
{
"from": "human",
"value": "So I've been using InstantRails to check out Ruby on rails. I've been using Notepad++ for the editing. Now I don't want to install Ruby or Rails on my machine. Is there any walk through/tutorial on how to integrate Radrails or Netbeans with InstantRails? \n"
},
{
"from":... |
I've got two models: Message and Attachment. Each attachment is attached to a specific message, using a ForeignKey on the Attachment model. Both models have an auto_now DateTimeField called updated. I'm trying to make it so that when any attachment is saved, it also sets the updated field on the associated message to n... | The code you've written won't work as intended due to a couple of reasons. Let’s break it down:
1. **Incorrect `super()` Call**: When you call `super(Attachment, self).save()`, you should pass any necessary arguments (like `*args` and `**kwargs`) to the `save()` method of the parent class. However, if you're overridin... | 3,448 | [
{
"from": "human",
"value": "I've got two models: Message and Attachment. Each attachment is attached to a specific message, using a ForeignKey on the Attachment model. Both models have an auto_now DateTimeField called updated. I'm trying to make it so that when any attachment is saved, it also sets the upd... |
I'm about to start on a large Qt application, which is made up of smaller components (groups of classes that work together). For example, there might be a dialog that is used in the project, but should be developed on its own before being integrated into the project. Instead of working on it in another folder somewhere... | Yes, you can definitely organize your Qt application into smaller components and use subfolders within your project to manage them effectively. Qt supports this kind of modular development, and there are several ways to incorporate subdirectories or modules into your main project without the need to copy files around. ... | 3,024 | [
{
"from": "human",
"value": "I'm about to start on a large Qt application, which is made up of smaller components (groups of classes that work together). For example, there might be a dialog that is used in the project, but should be developed on its own before being integrated into the project. Instead of ... |
I have a string that has some Environment.Newline in it. I'd like to strip those from the string and instead, replace the Newline with something like a comma.
What would be, in your opinion, the best way to do this using C#.NET 2.0?
| In C#.NET 2.0, you can easily replace occurrences of `Environment.NewLine` in a string with a comma (or any other delimiter) using the `String.Replace` method. Here's a simple example to demonstrate how you can achieve this:
```csharp
using System;
class Program
{
static void Main()
{
// Example input... | 4,267 | [
{
"from": "human",
"value": "I have a string that has some Environment.Newline in it. I'd like to strip those from the string and instead, replace the Newline with something like a comma. \nWhat would be, in your opinion, the best way to do this using C#.NET 2.0?\n"
},
{
"from": "gpt",
"value": ... |
Is there an IDE that I can load on a Blackberry, E71, or an iPhone?
| As of my last knowledge update in October 2023, there are limited options for full-featured Integrated Development Environments (IDEs) on older mobile devices like BlackBerry and Nokia E71, as well as on the iPhone. However, you might find some lightweight coding environments and text editors available for mobile platf... | 4,824 | [
{
"from": "human",
"value": "Is there an IDE that I can load on a Blackberry, E71, or an iPhone?\n"
},
{
"from": "gpt",
"value": "As of my last knowledge update in October 2023, there are limited options for full-featured Integrated Development Environments (IDEs) on older mobile devices like Bl... |
I would like to automatically generate PDF documents from WebObjects based on mulitpage forms. Assuming I have a class which can assemble the related forms (java/wod files) is there a good way to then parse the individual forms into a PDF instead of going to the screen?
| Generating PDF documents from WebObjects applications involves a few steps, especially if you want to convert multi-page forms into a well-structured PDF. Here are some general steps and options you can consider:
### Step 1: Assemble the Forms
Assuming you already have a class that can assemble the related forms, you'... | 1,956 | [
{
"from": "human",
"value": "I would like to automatically generate PDF documents from WebObjects based on mulitpage forms. Assuming I have a class which can assemble the related forms (java/wod files) is there a good way to then parse the individual forms into a PDF instead of going to the screen?\n"
},
... |
I'm trying to read binary data using C#. I have all the information about the layout of the data in the files I want to read. I'm able to read the data "chunk by chunk", i.e. getting the first 40 bytes of data converting it to a string, get the next 40 bytes.
Since there are at least three slightly different version of... | To read binary data directly into a struct in C#, you need to ensure that the struct is laid out correctly and that you are reading data types that match the size and layout of the struct's fields. In your example, you're trying to read strings directly from the binary data which won't work as expected because strings ... | 2,185 | [
{
"from": "human",
"value": "I'm trying to read binary data using C#. I have all the information about the layout of the data in the files I want to read. I'm able to read the data \"chunk by chunk\", i.e. getting the first 40 bytes of data converting it to a string, get the next 40 bytes.\nSince there are ... |
I am a web-developer working in PHP. I have some limited experience with using Test Driven Development in C# desktop applications. In that case we used nUnit for the unit testing framework.
I would like to start using TDD in new projects but I'm really not sure where to begin.
What recommendations do you have for a PH... | Great to hear that you're interested in adopting Test Driven Development (TDD) in your PHP projects! TDD can greatly improve the quality of your code and help you catch bugs earlier in the development process. Here are some recommendations for PHP unit testing frameworks and resources to help you get started with TDD.
... | 1,272 | [
{
"from": "human",
"value": "I am a web-developer working in PHP. I have some limited experience with using Test Driven Development in C# desktop applications. In that case we used nUnit for the unit testing framework.\nI would like to start using TDD in new projects but I'm really not sure where to begin. ... |
I know almost nothing about linq.
I'm doing this:
var apps = from app in Process.GetProcesses()
where app.ProcessName.Contains( "MyAppName" ) && app.MainWindowHandle != IntPtr.Zero
select app;
Which gets me all the running processes which match that criteria.
But I don't know how to get the first one. The exam... | You're correct that using `First()` can lead to an exception if no processes match your criteria. A better way to retrieve the first matching process without throwing an exception is to use `FirstOrDefault()`. This method will return the first matching process or `null` if none are found, which allows you to handle the... | 4,008 | [
{
"from": "human",
"value": "I know almost nothing about linq.\nI'm doing this:\nvar apps = from app in Process.GetProcesses()\n where app.ProcessName.Contains( \"MyAppName\" ) && app.MainWindowHandle != IntPtr.Zero\n select app;\n\nWhich gets me all the running processes which match that criteria.\nB... |
As the title already states, I'm trying to declare a nested function and return a pointer to that function. I want this function 'not' to return a new function pointer which will return the negation of whatever the original function was.
Here is what I have:
someType not( someType original ) {
int isNot( ListEntry*... | To create a nested function that returns a pointer to a new function which negates the result of the original function, there are a few adjustments and improvements we can make to your code. In C, you cannot return a pointer to a local stack variable, such as `isNot`, because that variable will be out of scope and inva... | 3,060 | [
{
"from": "human",
"value": "As the title already states, I'm trying to declare a nested function and return a pointer to that function. I want this function 'not' to return a new function pointer which will return the negation of whatever the original function was.\nHere is what I have:\nsomeType not( some... |
Does anyone know of a library (preferably php) or algorithm for auto-generating regex's from some common descriptions?
For example, have a form with the possible options of:
- Length (=x, between x & y, etc)
- Starts with
- Ends with
- Character(s) x(yz) at index i
- Specify one or more alternative behavior ba... | Creating a library or system that generates regular expressions based on user-defined criteria is indeed a complex task, but it's a feasible one. While there may not be an existing PHP library that does exactly what you're looking for, you can certainly build one by combining some existing functionalities and libraries... | 1,431 | [
{
"from": "human",
"value": "Does anyone know of a library (preferably php) or algorithm for auto-generating regex's from some common descriptions?\nFor example, have a form with the possible options of:\n - Length (=x, between x & y, etc)\n - Starts with\n - Ends with\n - Character(s) x(yz) at index i\n... |
Do you expect your WPF developers to know expression blend?
Any good resources for learning more about Blend?
[UPDATE] Does knowing blend make you more productive?
| As a WPF developer, familiarity with Expression Blend can be beneficial but may not be strictly required, depending on the specific needs of your project and team. Here are some considerations:
### Expectations of WPF Developers Knowing Expression Blend
1. **Design and Prototyping:** Expression Blend is primarily a de... | 3,015 | [
{
"from": "human",
"value": "Do you expect your WPF developers to know expression blend?\nAny good resources for learning more about Blend?\n[UPDATE] Does knowing blend make you more productive?\n"
},
{
"from": "gpt",
"value": "As a WPF developer, familiarity with Expression Blend can be benefic... |
How do I enumerate the properties of a JavaScript object?
I actually want to list all the defined variables and their values, but I've learned that defining a variable actually creates a property of the window object.
| In JavaScript, you can enumerate the properties of an object using various methods. If you want to list all defined variables (which are properties of the global `window` object in a browser environment), you can use the following methods:
### 1. Using `for...in` Loop
You can iterate over the properties of the `window... | 3,852 | [
{
"from": "human",
"value": "How do I enumerate the properties of a JavaScript object?\nI actually want to list all the defined variables and their values, but I've learned that defining a variable actually creates a property of the window object.\n"
},
{
"from": "gpt",
"value": "In JavaScript, ... |
What is the best way to implement, from a web page a download action using asp.net 2.0?
Log files for a action are created in a directory called [Application Root]/Logs. I have the full path and want to provide a button, that when clicked will download the log file from the IIS server to the users local pc.
| To implement a download action for log files in an ASP.NET 2.0 web application, you can create an HTTP handler or a page that handles the file download. Here’s a step-by-step guide on how to achieve this:
### Step 1: Create the Download Page
You can create a new ASP.NET page (e.g., `DownloadLog.aspx`) where you will ... | 2,783 | [
{
"from": "human",
"value": "What is the best way to implement, from a web page a download action using asp.net 2.0?\nLog files for a action are created in a directory called [Application Root]/Logs. I have the full path and want to provide a button, that when clicked will download the log file from the II... |
Is there a graceful way to handle passing a list of ids as a parameter to a stored procedure?
For instance, I want departments 1, 2, 5, 7, 20 returned by my stored procedure. In the past, I have passed in a comma delimited list of ids, like the below code, but feel really dirty doing it.
SQL Server 2005 is my only ap... | Passing a comma-delimited list of IDs to a stored procedure can lead to various issues, including SQL injection vulnerabilities, data type conversion issues, and performance drawbacks. However, there are cleaner and safer ways to handle this in SQL Server 2005.
### Recommended Approaches
1. **Using a Table-Valued Par... | 825 | [
{
"from": "human",
"value": "Is there a graceful way to handle passing a list of ids as a parameter to a stored procedure? \nFor instance, I want departments 1, 2, 5, 7, 20 returned by my stored procedure. In the past, I have passed in a comma delimited list of ids, like the below code, but feel really dirt... |
I have installed and setup RubyCAS-Server and RubyCAS-Client on my machine. Login works perfectly but when I try to logout I get this error message from the RubyCAS-Server:
Camping Problem!
CASServer::Controllers::Logout.GET
ActiveRecord::StatementInvalid Mysql::Error: Unknown column 'username' in 'where clause': SEL... | The error you're encountering suggests that there is an issue with the SQL query being generated during the logout process of RubyCAS-Server. Specifically, it's attempting to query the `casserver_pgt` table using a column named `username`, which does not exist. The `casserver_pgt` table is typically used for holding Pr... | 2,088 | [
{
"from": "human",
"value": "I have installed and setup RubyCAS-Server and RubyCAS-Client on my machine. Login works perfectly but when I try to logout I get this error message from the RubyCAS-Server:\nCamping Problem!\n\nCASServer::Controllers::Logout.GET\n\nActiveRecord::StatementInvalid Mysql::Error: Un... |
When attempting to compile my C# project, I get the following error:
'C:\Documents and Settings\Dan\Desktop\Rowdy Pixel\Apps\CleanerMenu\CleanerMenu\obj\Debug\CSC97.tmp' is not a valid Win32 resource file.
Having gone through many Google searches, I have determined that this is usually caused by a 256x256 image inside... | It seems like you've already done a great job troubleshooting the issue with the invalid Win32 resource file error. Here are some additional steps you can take to further isolate and resolve the problem:
1. **Check the Icon File**: Since you mentioned that the icon file is a potential culprit, ensure that the icon fil... | 1,876 | [
{
"from": "human",
"value": "When attempting to compile my C# project, I get the following error:\n'C:\\Documents and Settings\\Dan\\Desktop\\Rowdy Pixel\\Apps\\CleanerMenu\\CleanerMenu\\obj\\Debug\\CSC97.tmp' is not a valid Win32 resource file.\n\nHaving gone through many Google searches, I have determined... |
Occasionally, I've come across a webpage that tries to pop open a new window (for user input, or something important), but the popup blocker prevents this from happening.
What methods can the calling window use to make sure the new window launched properly?
| To ensure that a new window is successfully launched without being blocked by a popup blocker, the calling window can consider the following methods:
1. **User Interaction Requirement**: Most modern browsers will allow popups that are triggered directly by user interactions, such as clicking a button or link. Ensure t... | 2,554 | [
{
"from": "human",
"value": "Occasionally, I've come across a webpage that tries to pop open a new window (for user input, or something important), but the popup blocker prevents this from happening.\nWhat methods can the calling window use to make sure the new window launched properly?\n"
},
{
"fro... |
It's about PHP but I've no doubt many of the same comments will apply to other languages.
Simply put, what are the differences in the different types of loop for PHP? Is one faster/better than the others or should I simply put in the most readable loop?
for ($i = 0; $i < 10; $i++)
{
# code...
}
foreach ($array as... | In PHP, as in many programming languages, there are several types of loops that you can use to iterate over code blocks. Each loop has its own use case and characteristics. Let's look at the three types you mentioned: `for`, `foreach`, and `do while`.
### 1. For Loop
```php
for ($i = 0; $i < 10; $i++) {
# code...
... | 1,013 | [
{
"from": "human",
"value": "It's about PHP but I've no doubt many of the same comments will apply to other languages.\nSimply put, what are the differences in the different types of loop for PHP? Is one faster/better than the others or should I simply put in the most readable loop?\nfor ($i = 0; $i < 10; $... |
What is a good way to remove the code from display pages when developing with PHP. Often the pages I work on need to be editted by an outside person. This person is often confused by lots of blocks of PHP, and also likes to break my code.
I've tried moving blocks of code out into functions, so now there are functions s... | When developing with PHP and aiming to keep the code clear and maintainable for users who are not familiar with coding, there are several best practices you can follow to improve your workflow and reduce confusion. Here are some effective strategies:
### 1. **Use Templating Engines**
Consider using a templating engin... | 1,312 | [
{
"from": "human",
"value": "What is a good way to remove the code from display pages when developing with PHP. Often the pages I work on need to be editted by an outside person. This person is often confused by lots of blocks of PHP, and also likes to break my code.\nI've tried moving blocks of code out in... |
What are the options? How popular are they? Do these IDEs give similar/better functionality compared to visual studio?
| When it comes to Integrated Development Environments (IDEs), there are several popular options available, each with its strengths and weaknesses compared to Visual Studio. Here's an overview of some popular IDEs, their functionalities, and how they stack up against Visual Studio:
### 1. **JetBrains Rider**
- **Popu... | 56 | [
{
"from": "human",
"value": "What are the options? How popular are they? Do these IDEs give similar/better functionality compared to visual studio?\n"
},
{
"from": "gpt",
"value": "When it comes to Integrated Development Environments (IDEs), there are several popular options available, each with... |
I loaded a custom DataTable into an UltraChart of type GanttChart.
The data loads successfully.
Do you know if it possible to add support for mouse resize(drag) to the tasks that show up into the chart?
I have not been able to figure out if this is supported by the Infragistics control.
| The Infragistics UltraChart control, including the GanttChart type, does not natively support resizing tasks directly through mouse drag events out of the box. However, you can implement this functionality with some custom handling of mouse events and updating the underlying data source of the chart.
Here’s a high-lev... | 2,410 | [
{
"from": "human",
"value": "I loaded a custom DataTable into an UltraChart of type GanttChart.\nThe data loads successfully.\nDo you know if it possible to add support for mouse resize(drag) to the tasks that show up into the chart?\nI have not been able to figure out if this is supported by the Infragisti... |
I am looking for a 3rd party solution to integrate a QR code reader in Windows Mobile Applications (.NET Compact Framework). The component should integrate Reader (camera) and Decoder (algorithm).
I tried out the QuickMark reader, which can be called outside the application and communicates using Windows Messages. It w... | Integrating a QR code reader into a Windows Mobile application using the .NET Compact Framework can be challenging due to the limited support and options available for that platform. However, there are a few potential solutions you could explore:
1. **ZXing.Net**: ZXing (Zebra Crossing) is a widely used open-source li... | 3,449 | [
{
"from": "human",
"value": "I am looking for a 3rd party solution to integrate a QR code reader in Windows Mobile Applications (.NET Compact Framework). The component should integrate Reader (camera) and Decoder (algorithm).\nI tried out the QuickMark reader, which can be called outside the application and... |
I'm interested in seeing a good diff algorithm, possibly in Javascript, for rendering a side-by-side diff of two HTML pages. The idea would be that the diff would show the differences of the rendered HTML.
To clarify, I want to be able to see the side-by-side diffs as rendered output. So if I delete a paragraph, the si... | To achieve a side-by-side diff of two rendered HTML pages in JavaScript, you can use a combination of libraries that help with the diffing process and rendering the differences in a user-friendly manner. Here's a high-level approach you can follow, including code snippets to help you get started.
### Step 1: Set Up Yo... | 435 | [
{
"from": "human",
"value": "I'm interested in seeing a good diff algorithm, possibly in Javascript, for rendering a side-by-side diff of two HTML pages. The idea would be that the diff would show the differences of the rendered HTML.\nTo clarify, I want to be able to see the side-by-side diffs as rendered ... |
I have a ASP.NET 1.1 application, and I'm trying to find out why when I change a ComboBox which value is used to fill another one (parent-child relation), two postbacks are produced.
I have checked and checked the code, and I can't find the cause.
Here are both call stacks which end in a page_load
First postback (gener... | The issue of having two postbacks in an ASP.NET Web Forms application can often be perplexing. Here are several things you can check to diagnose why your application is producing an extra postback when you change the value of a ComboBox.
### 1. **Check for JavaScript Errors:**
- Inspect your browser's developer con... | 2,596 | [
{
"from": "human",
"value": "I have a ASP.NET 1.1 application, and I'm trying to find out why when I change a ComboBox which value is used to fill another one (parent-child relation), two postbacks are produced.\nI have checked and checked the code, and I can't find the cause.\nHere are both call stacks whi... |
I'm working on an application where users have to make a call and type a verification number with the keypad of their phone.
I would like to be able to detect if the number they type is correct or not. The phone system does not have access to a list of valid numbers, but instead, it will validate the number against an ... | To design a numerical verification code that meets your requirements, we can utilize a checksum algorithm to ensure that any valid code adheres to certain rules, making it challenging to guess, hard to get right by mistake, and manageable in terms of the number of combinations. Below is a suggested approach to create s... | 1,219 | [
{
"from": "human",
"value": "I'm working on an application where users have to make a call and type a verification number with the keypad of their phone.\nI would like to be able to detect if the number they type is correct or not. The phone system does not have access to a list of valid numbers, but instea... |
I have a workspace for running an H.263 Video Encoder in a loop for 31 times i.e. the main is executed 31 times to generate 31 different encoded bit streams. This MS Visual Studio 2005 Workspace has all C source files. When i create a "DEBUG" configuration for the workspace and build and execute it, it runs fine, i.e. ... | Debugging issues that only occur in release mode can be challenging due to differences in optimizations, code inlining, memory alignment, and other factors that might not affect debug builds. Here are some steps and pointers to help you identify and resolve the problem:
1. **Uninitialized Variables**: Since you mentio... | 2,741 | [
{
"from": "human",
"value": "I have a workspace for running an H.263 Video Encoder in a loop for 31 times i.e. the main is executed 31 times to generate 31 different encoded bit streams. This MS Visual Studio 2005 Workspace has all C source files. When i create a \"DEBUG\" configuration for the workspace an... |
When prototyping initial GUI functionality with a customer is it better to use a pen/paper drawing or to mock something up using a tool and show them that ?
The argument against a tool generated design being that the customer can sometimes focus on the low-level specifics of the mock-up rather than taking a higher leve... | When prototyping initial GUI functionality with a customer, both pen/paper sketches and tool-generated mock-ups have their advantages and disadvantages. The choice between the two often depends on the context, the goals of the meeting, and the preferences of the customer.
### Pen/Paper Drawings
**Advantages:**
1. **F... | 2,793 | [
{
"from": "human",
"value": "When prototyping initial GUI functionality with a customer is it better to use a pen/paper drawing or to mock something up using a tool and show them that ?\nThe argument against a tool generated design being that the customer can sometimes focus on the low-level specifics of th... |
I can't tell from the Python documentation whether the re.compile(x) function may throw an exception (assuming you pass in a string). I imagine there is something that could be considered an invalid regular expression. The larger question is, where do I go to find if a given Python library call may throw exception(s) a... | Yes, the `re.compile(x)` function can throw exceptions if the string `x` is not a valid regular expression. Specifically, if you pass an invalid regular expression pattern to `re.compile()`, it will raise a `re.error` exception.
To find out if a given Python library function may throw exceptions and what those excepti... | 4,535 | [
{
"from": "human",
"value": "I can't tell from the Python documentation whether the re.compile(x) function may throw an exception (assuming you pass in a string). I imagine there is something that could be considered an invalid regular expression. The larger question is, where do I go to find if a given Pyt... |
I need to remove duplicate rows from a fairly large SQL Server table (i.e. 300,000+ rows).
The rows, of course, will not be perfect duplicates because of the existence of the RowID identity field.
MyTable
RowID int not null identity(1,1) primary key,
Col1 varchar(20) not null,
Col2 varchar(2048) not null,
Col3 tinyint ... | To remove duplicate rows from your SQL Server table while retaining one instance of each duplicate, you can use the following approach, which involves using a Common Table Expression (CTE) or a temporary table with the `ROW_NUMBER()` window function. This function allows you to assign a unique sequential integer to row... | 2,014 | [
{
"from": "human",
"value": "I need to remove duplicate rows from a fairly large SQL Server table (i.e. 300,000+ rows).\nThe rows, of course, will not be perfect duplicates because of the existence of the RowID identity field.\nMyTable\nRowID int not null identity(1,1) primary key,\nCol1 varchar(20) not nul... |
How do you define your UserControls as being in a namespace below the project namespace, ie. [RootNameSpace].[SubSectionOfProgram].Controls?
Edit due to camainc's answer: I also have a constraint that I have to have all the code in a single project.
Edit to finalise question: As I suspected it isn't possible to do what... | In a single-project setup in .NET, you typically organize your classes and UserControls into namespaces that reflect your project's structure. However, when you want to define a UserControl within a specific subsection of your project namespace (e.g., `[RootNamespace].[SubSectionOfProgram].Controls`), you do so by expl... | 1,798 | [
{
"from": "human",
"value": "How do you define your UserControls as being in a namespace below the project namespace, ie. [RootNameSpace].[SubSectionOfProgram].Controls?\nEdit due to camainc's answer: I also have a constraint that I have to have all the code in a single project.\nEdit to finalise question: ... |
Related to my CouchDB question.
Can anyone explain MapReduce in terms a numbnuts could understand?
| Absolutely! Let’s break down MapReduce in simple terms using an analogy.
### Think of It Like a Pizza Shop
Imagine you run a pizza shop, and you have a lot of customer orders that come in. You want to figure out some things about those orders, like how many pizzas of each type you've sold.
#### **1. Map Step: Making... | 2,442 | [
{
"from": "human",
"value": "Related to my CouchDB question.\nCan anyone explain MapReduce in terms a numbnuts could understand?\n"
},
{
"from": "gpt",
"value": "Absolutely! Let’s break down MapReduce in simple terms using an analogy.\n\n### Think of It Like a Pizza Shop\n\nImagine you run a piz... |
Simply, are there any Java Developer specific Linux distros?
| Yes, there are some Linux distributions that are particularly well-suited for Java development, though they may not be specifically branded as "Java Developer distros." Here are a few that are commonly used by Java developers:
1. **Ubuntu**: A popular choice among developers, Ubuntu has extensive community support and... | 4,919 | [
{
"from": "human",
"value": "Simply, are there any Java Developer specific Linux distros?\n"
},
{
"from": "gpt",
"value": "Yes, there are some Linux distributions that are particularly well-suited for Java development, though they may not be specifically branded as \"Java Developer distros.\" He... |
Example:
select ename from emp where hiredate = todate('01/05/81','dd/mm/yy')
and
select ename from emp where hiredate = todate('01/05/81','dd/mm/rr')
return different results
| The two SQL queries you provided use the `TO_DATE` function with different format masks for the date, which can lead to different interpretations of the date string when querying a database.
Here's a breakdown of the two queries:
1. **Query with `dd/mm/yy` format**:
```sql
select ename from emp where hiredate =... | 3,266 | [
{
"from": "human",
"value": "Example:\nselect ename from emp where hiredate = todate('01/05/81','dd/mm/yy')\n\nand \nselect ename from emp where hiredate = todate('01/05/81','dd/mm/rr')\n\nreturn different results\n"
},
{
"from": "gpt",
"value": "The two SQL queries you provided use the `TO_DATE... |
Has anyone built a website with IronPython and ASP.NET. What were your experiences and is the combination ready for prime-time?
| IronPython is an implementation of Python running on the .NET Framework, which allows developers to integrate Python with .NET applications, including ASP.NET web applications. While it's feasible to build a website using IronPython and ASP.NET, there are some considerations and experiences shared by developers in the ... | 3,016 | [
{
"from": "human",
"value": "Has anyone built a website with IronPython and ASP.NET. What were your experiences and is the combination ready for prime-time?\n"
},
{
"from": "gpt",
"value": "IronPython is an implementation of Python running on the .NET Framework, which allows developers to integ... |
How to decide whether to use threads or create separate process altogether in your application to achieve parallelism.
| Deciding between using threads or processes for achieving parallelism in your application involves evaluating several factors, including the nature of the task, performance requirements, resource constraints, and complexity. Here are key considerations to help you make the choice:
### 1. **Nature of the Task**
- **... | 2,090 | [
{
"from": "human",
"value": "How to decide whether to use threads or create separate process altogether in your application to achieve parallelism.\n"
},
{
"from": "gpt",
"value": "Deciding between using threads or processes for achieving parallelism in your application involves evaluating sever... |
Is there a standard convention (like phpdoc or python's docstring) for commenting C# code so that class documentation can be automatically generated from the source code?
| Yes, C# uses XML documentation comments for generating class documentation from the source code. This is similar to PHPDoc and Python's docstrings. These comments are placed directly above the class, method, property, or other members in your code and are enclosed in triple slashes (`///`).
When you use XML documenta... | 578 | [
{
"from": "human",
"value": "Is there a standard convention (like phpdoc or python's docstring) for commenting C# code so that class documentation can be automatically generated from the source code?\n"
},
{
"from": "gpt",
"value": "Yes, C# uses XML documentation comments for generating class do... |
I have a silverlight 2 beta 2 application that accesses a WCF web service. Because of this, it currently can only use basicHttp binding. The webservice will return fairly large amounts of XML data. This seems fairly wasteful from a bandwidth usage standpoint as the response, if zipped, would be smaller by a factor o... | It sounds like you've successfully figured out how to enable dynamic compression for your WCF web service responses in a Silverlight 2 application using IIS 7 without needing to implement a custom compression solution yourself.
To summarize the key points for anyone who might be facing a similar situation:
1. **Dyna... | 4,341 | [
{
"from": "human",
"value": "I have a silverlight 2 beta 2 application that accesses a WCF web service. Because of this, it currently can only use basicHttp binding. The webservice will return fairly large amounts of XML data. This seems fairly wasteful from a bandwidth usage standpoint as the response, ... |
How would you go about finding out how much memory is being used by an object? I know it is possible to find out how much is used by a block of code, but not by an instantiated object (anytime during its life), which is what I want.
| In Python, there isn't a built-in way to directly measure the memory usage of a single object, but you can achieve this using the `sys` module, specifically the `sys.getsizeof()` function. This function returns the size of an object in bytes. However, it's important to note that `sys.getsizeof()` only provides the size... | 3,253 | [
{
"from": "human",
"value": "How would you go about finding out how much memory is being used by an object? I know it is possible to find out how much is used by a block of code, but not by an instantiated object (anytime during its life), which is what I want. \n"
},
{
"from": "gpt",
"value": "... |
I have a web application that generates a medium sized XML dataset to be consumed by a third party.
I thought it would be a good idea to provide some form of schema document for the XML that I generate so I pasted the XML into Visual Studio and got it to generate an XSD.
The annoying thing is that my XML doesn't valida... | Creating a schema for your XML dataset can indeed improve interoperability and help ensure that the data adheres to certain rules. The challenges you're facing with the XSD generated from Visual Studio are not uncommon; automated tools can sometimes produce schemas that don't fit your specific data structure, or they m... | 1,359 | [
{
"from": "human",
"value": "I have a web application that generates a medium sized XML dataset to be consumed by a third party.\nI thought it would be a good idea to provide some form of schema document for the XML that I generate so I pasted the XML into Visual Studio and got it to generate an XSD.\nThe a... |
I downloaded and installed the Aptana Studio free version. But apparently, to install the Radrails plugin for ruby on rails development you have to connect to the internet. I don't have internet on my machine right now. So is there a way I could download the installer from another machine and copy it over my existing A... | If you're looking to install the RadRails plugin for Aptana Studio without direct internet access on your development machine, you can try the following approach:
### Step-by-Step Guide to Offline Installation:
1. **Use a Machine with Internet Access:**
- On a different machine that has internet access, go to the ... | 3,516 | [
{
"from": "human",
"value": "I downloaded and installed the Aptana Studio free version. But apparently, to install the Radrails plugin for ruby on rails development you have to connect to the internet. I don't have internet on my machine right now. So is there a way I could download the installer from anoth... |
We've just started using LINQ to SQL at work for our DAL & we haven't really come up with a standard for out caching model. Previously we had being using a base 'DAL' class that implemented a cache manager property that all our DAL classes inherited from, but now we don't have that. I'm wondering if anyone has come u... | Setting up a caching architecture in a LINQ to SQL environment can indeed be a bit different from traditional approaches, but it can be structured to ensure that caching is consistent, efficient, and maintainable across your application. Below are some recommendations to help you develop a caching strategy that can wor... | 1,102 | [
{
"from": "human",
"value": "We've just started using LINQ to SQL at work for our DAL & we haven't really come up with a standard for out caching model. Previously we had being using a base 'DAL' class that implemented a cache manager property that all our DAL classes inherited from, but now we don't have ... |
I've followed the CouchDB project with interest over the last couple of years, and see it is now an Apache Incubator project. Prior to that, the CouchDB web site was full of do not use for production code type disclaimers, so I'd done no more than keep an eye on it. I'd be interested to know your experiences if you've ... | CouchDB is a NoSQL database that uses a schema-free model and is designed to handle large amounts of data across distributed systems. Since becoming an Apache Incubator project, it has garnered more attention and a broader user base. Here are some insights and experiences from using CouchDB in live projects and technol... | 2,426 | [
{
"from": "human",
"value": "I've followed the CouchDB project with interest over the last couple of years, and see it is now an Apache Incubator project. Prior to that, the CouchDB web site was full of do not use for production code type disclaimers, so I'd done no more than keep an eye on it. I'd be inter... |
Sometimes I get Oracle connection problems because I can't figure out which tnsnames.ora file my database client is using.
What's the best way to figure this out? ++happy for various platform solutions.
| Determining which `tnsnames.ora` file your Oracle client is using can depend on the environment you are working in (Windows, Linux, etc.), but here are some methods you can use across different platforms:
### General Steps:
1. **Locate the ORACLE_HOME Environment Variable**:
- The `tnsnames.ora` file is typically ... | 70 | [
{
"from": "human",
"value": "Sometimes I get Oracle connection problems because I can't figure out which tnsnames.ora file my database client is using.\nWhat's the best way to figure this out? ++happy for various platform solutions. \n"
},
{
"from": "gpt",
"value": "Determining which `tnsname... |
We're attemtping to merge our DLL's into one for deployment, thus ILMerge. Almost everything seems to work great. We have a couple web controls that use ClientScript.RegisterClientScriptResource and these are 404-ing after the merge (These worked before the merge).
For example one of our controls would look like
name... | When you merge multiple assemblies into a single DLL using ILMerge, any embedded resources (like JavaScript files or CSS files) must be referenced using their new namespacing. After the merge, the resource's location in the merged assembly might change, affecting how you register and reference it.
Here are a few step... | 2,212 | [
{
"from": "human",
"value": "We're attemtping to merge our DLL's into one for deployment, thus ILMerge. Almost everything seems to work great. We have a couple web controls that use ClientScript.RegisterClientScriptResource and these are 404-ing after the merge (These worked before the merge).\nFor exampl... |
I'm working on a tool that will generate the source code for an interface and a couple classes implementing that interface. My output isn't particularly complicated, so it's not going to be hard to make the output conform to our normal code formatting standards.
But this got me thinking: how human-readable does auto-g... | When generating code, the human-readability of the output can vary based on several factors, including the complexity of the generated code, the intended audience, and the use case. Here are some considerations to help guide your decision on how much effort to expend on making auto-generated code human-readable:
### 1... | 2,433 | [
{
"from": "human",
"value": "I'm working on a tool that will generate the source code for an interface and a couple classes implementing that interface. My output isn't particularly complicated, so it's not going to be hard to make the output conform to our normal code formatting standards.\nBut this got m... |
How can I find out which node in a tree list the context menu has been activated? For instance right-clicking a node and selecting an option from the menu.
I can't use the TreeViews' SelectedNode property because the node is only been right-clicked and not selected.
| To determine which node in a tree structure has had its context menu activated (typically through a right-click action), you can handle the context menu's opening event, specifically by tracking the mouse position to identify the node under the cursor.
Here's a step-by-step guide to achieving this in a typical WinForm... | 2,370 | [
{
"from": "human",
"value": "How can I find out which node in a tree list the context menu has been activated? For instance right-clicking a node and selecting an option from the menu. \nI can't use the TreeViews' SelectedNode property because the node is only been right-clicked and not selected.\n"
},
... |
What are the most common problems that can be solved with both these data structures?
It would be good for me to have also recommendations on books that:
Implement the structures
Implement and explain the reasoning of the algorithms that use them
| Certainly! Here are some common problems that can be effectively solved using two popular data structures: **Stacks** and **Queues**.
### Common Problems
1. **Stack-related Problems**:
- **Expression Evaluation**: Used in evaluating postfix and infix expressions.
- **Backtracking Problems**: Such as solving puz... | 2,568 | [
{
"from": "human",
"value": "What are the most common problems that can be solved with both these data structures?\nIt would be good for me to have also recommendations on books that:\n\nImplement the structures\nImplement and explain the reasoning of the algorithms that use them\n\n"
},
{
"from": "... |
How do I get started?
| To help you effectively, could you please clarify what you're looking to get started with? For example, are you interested in a specific hobby, career, learning a new skill, or something else entirely? Let me know, and I'll provide tailored guidance! | 6,730 | [
{
"from": "human",
"value": "How do I get started?\n"
},
{
"from": "gpt",
"value": "To help you effectively, could you please clarify what you're looking to get started with? For example, are you interested in a specific hobby, career, learning a new skill, or something else entirely? Let me kno... |
I've had a little search and I was wondering if there is back compatibility for the .NET framework.
The real question is, if there's a program that uses .NET Framework 1.1, can I install 3.5 and be done, or do I have to install 1.1 and then if something uses 3.5 I have to install 3.5 as well?
| .NET Framework versions are generally designed to be backward compatible, meaning that if you install a newer version, it should support applications built for earlier versions. Specifically:
- If you install .NET Framework 3.5, it is designed to run applications that were built for .NET Framework 2.0, 3.0, and 3.5. H... | 5,563 | [
{
"from": "human",
"value": "I've had a little search and I was wondering if there is back compatibility for the .NET framework.\nThe real question is, if there's a program that uses .NET Framework 1.1, can I install 3.5 and be done, or do I have to install 1.1 and then if something uses 3.5 I have to insta... |
Can/Should I use a LIKE criteria as part of an INNER JOIN when building a stored procedure/query? I'm not sure I'm asking the right thing, so let me explain.
I'm creating a procedure that is going to take a list of keywords to be searched for in a column that contains text. If I was sitting at the console, I'd execute ... | Using the `LIKE` clause in an `INNER JOIN` as you described is not directly possible in SQL Server. The `JOIN` operation is typically used to match rows based on equality conditions (such as `ON dbo.Card.Id = @tblExclusiveCard.CardId`). However, for a keyword search within a text column using `LIKE`, you will want to u... | 2,772 | [
{
"from": "human",
"value": "Can/Should I use a LIKE criteria as part of an INNER JOIN when building a stored procedure/query? I'm not sure I'm asking the right thing, so let me explain.\nI'm creating a procedure that is going to take a list of keywords to be searched for in a column that contains text. If ... |
I'm the second dev and a recent hire here at a PHP/MySQL shop. I was hired mostly due to my experience in wrangling some sort of process out of a chaotic mess. At least, that's what I did at my last company. ;)
Since I've been here (a few months now), I've brought on board my boss, my product manager and several othe... | Hi Beaudetious,
It sounds like you're in a challenging but exciting situation! You're clearly passionate about improving processes and fostering a collaborative environment, which is great. However, as you've noted, not everyone is on the same page, and that's something you’ll need to navigate carefully. Here are some... | 2,341 | [
{
"from": "human",
"value": "I'm the second dev and a recent hire here at a PHP/MySQL shop. I was hired mostly due to my experience in wrangling some sort of process out of a chaotic mess. At least, that's what I did at my last company. ;)\nSince I've been here (a few months now), I've brought on board my... |
I've been writing C and C++ code for almost twenty years, but there's one aspect of these languages that I've never really understood. I've obviously used regular casts i.e.
MyClass *m = (MyClass *)ptr;
all over the place, but there seem to be two other types of casts, and I don't know the difference. What's the diffe... | The three lines of code you provided showcase different casting mechanisms in C++. Here's a detailed breakdown of each cast and when to use them:
1. **C-style Cast**:
```cpp
MyClass *m = (MyClass *)ptr;
```
- This is a C-style cast, which is the traditional way of casting from C. It can perform a variety o... | 1,580 | [
{
"from": "human",
"value": "I've been writing C and C++ code for almost twenty years, but there's one aspect of these languages that I've never really understood. I've obviously used regular casts i.e.\nMyClass *m = (MyClass *)ptr;\n\nall over the place, but there seem to be two other types of casts, and I... |
anyone have any experience using this?
if so, is it worth while?
| It seems like you're asking about a specific product or service, but you didn't mention its name. Could you provide more details about what you're referring to? That way, I can give you more targeted information or feedback based on user experiences. | 6,585 | [
{
"from": "human",
"value": "anyone have any experience using this?\nif so, is it worth while?\n"
},
{
"from": "gpt",
"value": "It seems like you're asking about a specific product or service, but you didn't mention its name. Could you provide more details about what you're referring to? That wa... |
I want some links to include a fragment identifier. Like some of the URLs on this site:
Debugging: IE6 + SSL + AJAX + post form = 404 error#5626
Is there a way to do this with any of the built-in methods in MVC? Or would I have to roll my own HTML helpers?
| In ASP.NET MVC, you can easily create URLs with fragment identifiers (also known as hash fragments) using built-in HTML helpers. You don’t need to roll your own helpers for this purpose; you can simply append the fragment to the generated URL.
### Using the `Html.ActionLink` Helper
The `Html.ActionLink` method allows... | 3,452 | [
{
"from": "human",
"value": "I want some links to include a fragment identifier. Like some of the URLs on this site:\nDebugging: IE6 + SSL + AJAX + post form = 404 error#5626\nIs there a way to do this with any of the built-in methods in MVC? Or would I have to roll my own HTML helpers?\n"
},
{
"fro... |
When building projects in C++, I've found debugging linking errors to be tricky, especially when picking up other people's code. What strategies do people use for debugging and fixing linking errors?
| Debugging linking errors in C++ can indeed be challenging, especially when dealing with other people's code. However, there are several strategies you can use to effectively identify and resolve these issues. Here are some common approaches:
### 1. **Understand the Types of Linking Errors:**
- **Undefined Reference... | 2,323 | [
{
"from": "human",
"value": "When building projects in C++, I've found debugging linking errors to be tricky, especially when picking up other people's code. What strategies do people use for debugging and fixing linking errors?\n"
},
{
"from": "gpt",
"value": "Debugging linking errors in C++ c... |
I have been working with a string[] array in C# that gets returned from a function call. I could possibly cast to a Generic collection, but I was wondering if there was a better way to do it, possibly by using a temp array.
What is the best way to remove duplicates from a C# array?
| In C#, there are multiple ways to remove duplicates from a string array. Here are a couple of the most common methods, including the use of a temporary array and the more modern approach using LINQ.
### Method 1: Using a Temporary Array
You can create a temporary array to store unique values while iterating through t... | 2,869 | [
{
"from": "human",
"value": "I have been working with a string[] array in C# that gets returned from a function call. I could possibly cast to a Generic collection, but I was wondering if there was a better way to do it, possibly by using a temp array.\nWhat is the best way to remove duplicates from a C# ar... |
Please note that this question is from 2008 and now is of only historic interest.
What's the best way to create an iPhone application that runs in landscape mode from the start, regardless of the position of the device?
Both programmatically and using the Interface Builder.
| To create an iPhone application that runs in landscape mode from the start, you'll need to set the device orientation in both programmatically and using the Interface Builder. Here’s how you can achieve this:
### 1. Using Interface Builder
1. **Open Your Project in Xcode**: Launch Xcode and open your project.
2. *... | 2,294 | [
{
"from": "human",
"value": "Please note that this question is from 2008 and now is of only historic interest.\n\nWhat's the best way to create an iPhone application that runs in landscape mode from the start, regardless of the position of the device?\nBoth programmatically and using the Interface Builder.\... |
I seem right now to be embroiled in a debate with another programmer on this project who thinks that views have no merits. He proposes a system that PHP looks something like this:
$draw = new Draw;
$nav = $draw->wideHeaderBox().
$draw->left().
$draw->image().
Image::get($image,60,array('id'=>'header_image'... | Your colleague's approach to using a controller to manage all aspects of the view logic in PHP has its merits, but it also has significant downsides that make using a dedicated view layer more beneficial in many cases. Here are some reasons why you might prefer views over this approach:
### Separation of Concerns
1. ... | 3,531 | [
{
"from": "human",
"value": "I seem right now to be embroiled in a debate with another programmer on this project who thinks that views have no merits. He proposes a system that PHP looks something like this:\n$draw = new Draw;\n$nav = $draw->wideHeaderBox().\n$draw->left().\n $draw->image().\n I... |
We currently deploy web applications by creating a database and running SQL scripts through query analyzer. Then we copy the output from "publish website" and set up that website in IIS.
We have seen websetup in visual studio, but that part seems to be thinly documented. For example, we are not clear how to ask the u... | Deploying web applications can indeed be a challenging process, especially when you're looking to balance manual intervention with automation. Let's explore the practical trade-offs, as well as potential strategies for improving your deployment process.
### Trade-offs Between Manual Intervention and Automation
1. **M... | 2,010 | [
{
"from": "human",
"value": "We currently deploy web applications by creating a database and running SQL scripts through query analyzer. Then we copy the output from \"publish website\" and set up that website in IIS.\nWe have seen websetup in visual studio, but that part seems to be thinly documented. Fo... |
So WPF doesn't support standard sorting or filtering behavior for views of CompositeCollections, so what would be a best practice for solving this problem.
There are two or more object collections of different types. You want to combine them into a single sortable and filterable collection (withing having to manually ... | You're on the right track with your approach to create a composite collection that combines objects from different types into a single sortable and filterable collection. However, there are a few more elegant alternatives that can help streamline the process and take advantage of WPF's binding and data templating featu... | 1,946 | [
{
"from": "human",
"value": "So WPF doesn't support standard sorting or filtering behavior for views of CompositeCollections, so what would be a best practice for solving this problem. \nThere are two or more object collections of different types. You want to combine them into a single sortable and filterab... |
Would like to programmically change the connecton string for a database which utilizes the membership provider of asp.net within a windows application. The system.configuration namespace allows changes to the user settings, however, we would like to adjust a application setting? Does one need to write a class with util... | To programmatically change the connection string for a database in an ASP.NET application, you can work with the `System.Configuration` namespace to read and modify the application's configuration file (typically `Web.config` for ASP.NET applications).
Here are the steps you can follow to change the connection string:... | 2,565 | [
{
"from": "human",
"value": "Would like to programmically change the connecton string for a database which utilizes the membership provider of asp.net within a windows application. The system.configuration namespace allows changes to the user settings, however, we would like to adjust a application setting?... |
When running a Java app from eclipse my ImageIcon shows up just fine.
But after creating a jar the path to the image obviously gets screwed up.
Is there a way to extract an image from the jar at runtime so I can then open it up? Or, is there a better way to do this?
I'd like to distribute a single jar file if possible... | When you package your Java application into a JAR file, resources such as images are typically included in the JAR. The main thing you need to ensure is that you're loading these resources correctly at runtime. You can't access the images as file paths directly when they're inside a JAR; instead, you should use the cla... | 3,376 | [
{
"from": "human",
"value": "When running a Java app from eclipse my ImageIcon shows up just fine.\nBut after creating a jar the path to the image obviously gets screwed up.\nIs there a way to extract an image from the jar at runtime so I can then open it up? Or, is there a better way to do this?\nI'd like... |
How does a stack overflow occur and what are the ways to make sure it doesn't happen, or ways to prevent one?
| A **stack overflow** occurs when a program uses more stack space than is allocated, typically due to excessive or infinite recursion or excessive allocation of local variables. The stack is a special region of memory used for storing temporary data such as function parameters, return addresses, and local variables. Whe... | 2,674 | [
{
"from": "human",
"value": "How does a stack overflow occur and what are the ways to make sure it doesn't happen, or ways to prevent one?\n"
},
{
"from": "gpt",
"value": "A **stack overflow** occurs when a program uses more stack space than is allocated, typically due to excessive or infinite r... |
I've been taking a look at some different products for .NET which propose to speed up development time by providing a way for business objects to map seamlessly to an automatically generated database. I've never had a problem writing a data access layer, but I'm wondering if this type of product will really save the ti... | Using Object-Relational Mapping (ORM) tools can indeed save time and effort in development, especially when it comes to database interactions. Here are some points to consider regarding the potential benefits and drawbacks of adopting ORM tools like those from DevExpress or similar products:
### Benefits of Using ORM ... | 1,488 | [
{
"from": "human",
"value": "I've been taking a look at some different products for .NET which propose to speed up development time by providing a way for business objects to map seamlessly to an automatically generated database. I've never had a problem writing a data access layer, but I'm wondering if thi... |
In the company that i work, we develop all the GUI in C#, but the application kernel is mainly developed in Delphi 5 (for historical reasons), with a lot of components made in COM+. Related to this very specific sort of application a I two questions:
Experienced guys in Delphi and/or COM, do you have any workrounds to... | Working with TLB (Type Library) interfaces in Delphi, especially older versions like Delphi 5, can indeed be challenging. Here are some strategies and workarounds for the specific issues you're facing:
### Workarounds for TLB Interface Bugs
1. **Minimize Direct TLB Edits**:
- Whenever possible, avoid editing TLBs... | 2,071 | [
{
"from": "human",
"value": "In the company that i work, we develop all the GUI in C#, but the application kernel is mainly developed in Delphi 5 (for historical reasons), with a lot of components made in COM+. Related to this very specific sort of application a I two questions:\n\nExperienced guys in Delph... |
I need some advice as to how I easily can separate test runs for unit tests and integration test in Visual Studio. Often, or always, I structure the solution as presented in the above picture: separate projects for unit tests and integration tests. The unit tests is run very frequently while the integration tests natu... | To achieve the functionality you’re looking for in Visual Studio with ReSharper, you can set up custom keyboard shortcuts to run specific sets of tests based on your project structure. Below are the steps you can follow to configure this setup in Visual Studio 2008 with ReSharper 4 and NUnit.
### Step 1: Organize Your... | 1,654 | [
{
"from": "human",
"value": "\nI need some advice as to how I easily can separate test runs for unit tests and integration test in Visual Studio. Often, or always, I structure the solution as presented in the above picture: separate projects for unit tests and integration tests. The unit tests is run very f... |
So I'm getting a new job working with databases (Microsoft SQL Server to be precise). I know nothing about SQL much less SQL Server. They said they'd train me, but I want to take some initiative to learn about it on my own to be ahead. Where's the best place to start (tutorials, books, etc)? I want to learn more ab... | Congratulations on your new job! It’s great that you want to take the initiative to learn SQL and SQL Server. Here are some recommendations for resources that can help you get started with the SQL language specifically:
### Online Tutorials and Courses
1. **W3Schools SQL Tutorial**: This is a great starting point for... | 330 | [
{
"from": "human",
"value": "So I'm getting a new job working with databases (Microsoft SQL Server to be precise). I know nothing about SQL much less SQL Server. They said they'd train me, but I want to take some initiative to learn about it on my own to be ahead. Where's the best place to start (tutoria... |
I'm developing an Excel 2007 add-in using Visual Studio Tools for Office (2008). I have one sheet with several ListObjects on it, which are being bound to datatables on startup. When they are bound, they autosize correctly.
The problem comes when they are re-bound. I have a custom button on the ribbon bar which goes... | The error you're encountering when rebinding `ListObject` in Excel can happen for several reasons, such as trying to resize the `ListObject` when there are objects below it, or when Excel can't dynamically adjust the size of the `ListObject` due to existing cell contents or formatting issues.
Here are several steps yo... | 2,768 | [
{
"from": "human",
"value": "I'm developing an Excel 2007 add-in using Visual Studio Tools for Office (2008). I have one sheet with several ListObjects on it, which are being bound to datatables on startup. When they are bound, they autosize correctly.\nThe problem comes when they are re-bound. I have a ... |
I want to do what myopenid does -- once you've logged, you can click a button that generates you an SSL certificate; the browser then downloads this certificate and stores it. When you later go back to yourid.myopenid.com, your browser can use its stored certificate for authentication so you don't ever need a password... | Implementing a certificate-based authentication system like MyOpenID involves several steps, including generating SSL certificates, storing them securely, and validating them when users return. Below is a high-level guide to set you on the right path using Rails, along with some additional recommendations.
### Steps t... | 601 | [
{
"from": "human",
"value": "I want to do what myopenid does -- once you've logged, you can click a button that generates you an SSL certificate; the browser then downloads this certificate and stores it. When you later go back to yourid.myopenid.com, your browser can use its stored certificate for authent... |
We are a small team of 3 developers (2 experienced but new to this particular business sector) developing a functionally complex product. We're using Scrum and have a demo at the end of each sprint. Its clear that the functional team have plenty of ideas but these are not well communicated to the development team an... | Improving communication between your development team and the functional team is key to ensuring that everyone is aligned and that the product being developed meets business needs. Here are some recommendations that focus on enhancing the quality of input from the functional team and creating a shared understanding of ... | 2,232 | [
{
"from": "human",
"value": "We are a small team of 3 developers (2 experienced but new to this particular business sector) developing a functionally complex product. We're using Scrum and have a demo at the end of each sprint. Its clear that the functional team have plenty of ideas but these are not wel... |
Is there a one line function call that quits the program and displays a message? I know in Perl it's as simple as:
die("Message goes here")
I'm tired of typing this:
puts "Message goes here"
exit
| Yes, in Ruby, you can achieve a similar functionality in a single line using `abort`. Here's how you can do it:
```ruby
abort("Message goes here")
```
The `abort` method displays the message and exits the program with a non-zero status code, indicating that an error occurred. | 6,298 | [
{
"from": "human",
"value": "Is there a one line function call that quits the program and displays a message? I know in Perl it's as simple as:\ndie(\"Message goes here\")\n\nI'm tired of typing this:\nputs \"Message goes here\"\nexit\n\n"
},
{
"from": "gpt",
"value": "Yes, in Ruby, you can achi... |
Is it possible to add a custom tab to a project properties page in the Visual Studio 2008?
What I want to do is to be able to add a custom tab to properties page for the projects created from default project templates (WPF Application, WPF custom controls library, etc).
| Yes, it is possible to add a custom tab to the project properties page in Visual Studio 2008. To do this, you'll need to create a Visual Studio package (VSPackage) that extends the project system and adds your custom properties page.
Here's a high-level overview of the steps involved in creating a custom properties pa... | 3,211 | [
{
"from": "human",
"value": "Is it possible to add a custom tab to a project properties page in the Visual Studio 2008?\nWhat I want to do is to be able to add a custom tab to properties page for the projects created from default project templates (WPF Application, WPF custom controls library, etc).\n"
},... |
I'm need to find a method to programmatically determine which disk drive Windows is using to boot. In other words, I need a way from Windows to determine which drive the BIOS is using to boot the whole system.
Does Windows expose an interface to discover this? With how big the Windows API is, I'm hoping there is somet... | To determine which physical disk Windows used to boot, you can leverage the Windows API, specifically the `SetupDiGetDeviceRegistryProperty` function, along with the device information set that corresponds to storage devices. You will also need to access the `BOOTDISK` registry entry, which specifies the drive used to ... | 1,603 | [
{
"from": "human",
"value": "I'm need to find a method to programmatically determine which disk drive Windows is using to boot. In other words, I need a way from Windows to determine which drive the BIOS is using to boot the whole system. \nDoes Windows expose an interface to discover this? With how big the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.