qid int64 4 8.14M | question stringlengths 20 48.3k | answers list | date stringlengths 10 10 | metadata list | input stringlengths 12 45k | output stringlengths 2 31.8k |
|---|---|---|---|---|---|---|
6,430 | <p>I'm suddenly back to WinForms, after years of web development, and am having trouble with something that should be simple. I have an <code>ArrayList</code> of business objects bound to a Windows Forms <code>DataGrid</code>. I'd like the user to be able to edit the cells, and when finished, press a Save button. ... | [
{
"answer_id": 6435,
"author": "NotMyself",
"author_id": 303,
"author_profile": "https://Stackoverflow.com/users/303",
"pm_score": 4,
"selected": true,
"text": "<pre class=\"lang-cs prettyprint-override\"><code>foreach(var row in DataGrid1.Rows)\n{\n DoStuff(row);\n}\n//Or -------------... | 2008/08/08 | [
"https://Stackoverflow.com/questions/6430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/785/"
] | I'm suddenly back to WinForms, after years of web development, and am having trouble with something that should be simple. I have an `ArrayList` of business objects bound to a Windows Forms `DataGrid`. I'd like the user to be able to edit the cells, and when finished, press a Save button. At that point I'd like to iter... | ```cs
foreach(var row in DataGrid1.Rows)
{
DoStuff(row);
}
//Or ---------------------------------------------
foreach(DataGridRow row in DataGrid1.Rows)
{
DoStuff(row);
}
//Or ---------------------------------------------
for(int i = 0; i< DataGrid1.Rows.Count - 1; i++)
{
DoStuff(DataGrid1.Rows[i]);
}
``` |
6,441 | <p>The following code works great in IE, but not in FF or Safari. I can't for the life of me work out why. The code is <em>supposed</em> to disable radio buttons if you select the "Disable 2 radio buttons" option. It should enable the radio buttons if you select the "Enable both radio buttons" op... | [
{
"answer_id": 6456,
"author": "Polsonby",
"author_id": 137,
"author_profile": "https://Stackoverflow.com/users/137",
"pm_score": 2,
"selected": false,
"text": "<p>Well, IE has a somewhat non-standard object model; what you're doing shouldn't work but you're getting away with it because ... | 2008/08/08 | [
"https://Stackoverflow.com/questions/6441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232/"
] | The following code works great in IE, but not in FF or Safari. I can't for the life of me work out why. The code is *supposed* to disable radio buttons if you select the "Disable 2 radio buttons" option. It should enable the radio buttons if you select the "Enable both radio buttons" option. These both work...
However... | To get FF to mimic IE's behavior when using the keyboard, you can use the keyup event on the select box. In your example (I am not a fan of attaching event handlers this way, but that's another topic), it would be like this:
```
<select name="user" id="selUser" onchange="javascript:SetLocationOptions()" onkeyup="javas... |
6,467 | <p>I need to do date arithmetic in Unix shell scripts that I use to control the execution of third party programs. </p>
<p>I'm using a function to increment a day and another to decrement: </p>
<pre><code>IncrementaDia(){
echo $1 | awk '
BEGIN {
diasDelMes[1] = 31
diasDelMes[2] = 28
diasDelMes... | [
{
"answer_id": 6468,
"author": "abyx",
"author_id": 573,
"author_profile": "https://Stackoverflow.com/users/573",
"pm_score": 6,
"selected": false,
"text": "<p>Assuming you have <a href=\"http://www.gnu.org/software/coreutils/manual/coreutils.html#date-invocation\" rel=\"noreferrer\">GNU... | 2008/08/08 | [
"https://Stackoverflow.com/questions/6467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/527/"
] | I need to do date arithmetic in Unix shell scripts that I use to control the execution of third party programs.
I'm using a function to increment a day and another to decrement:
```
IncrementaDia(){
echo $1 | awk '
BEGIN {
diasDelMes[1] = 31
diasDelMes[2] = 28
diasDelMes[3] = 31
dias... | I have written a bash script for converting dates expressed in English into conventional
mm/dd/yyyy dates. It is called **ComputeDate**.
Here are some examples of its use. For brevity I have placed the output of each invocation
on the same line as the invocation, separarted by a colon (:). The quotes shown below are *... |
6,475 | <p>In a machine with AIX without <code>PERL</code> I need to filter records that will be considered duplicated if they have the same id and if they were registered between a period of four hours. </p>
<p>I implemented this filter using <code>AWK</code> and work pretty well but I need a solution much faster: </p>
<pre... | [
{
"answer_id": 6813,
"author": "David",
"author_id": 381,
"author_profile": "https://Stackoverflow.com/users/381",
"pm_score": 1,
"selected": false,
"text": "<p>If your data file contains all your records (i.e. it includes records that do not have dupicate ids within the file) you could ... | 2008/08/08 | [
"https://Stackoverflow.com/questions/6475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/527/"
] | In a machine with AIX without `PERL` I need to filter records that will be considered duplicated if they have the same id and if they were registered between a period of four hours.
I implemented this filter using `AWK` and work pretty well but I need a solution much faster:
```
# Generar lista de Duplicados
awk '... | This sounds like a job for an actual database. Even something like SQLite could probably help you reasonably well here. The big problem I see is your definition of "within 4 hours". That's a sliding window problem, which means you can't simply quantize all the data to 4 hour segments... you have to compute all "nearby"... |
6,499 | <p>There are a few ways to get class-like behavior in javascript, the most common seem to be prototype based like this:</p>
<pre><code>function Vector(x, y, x) {
this.x = x;
this.y = y;
this.z = z;
return this;
}
Vector.prototype.length = function () { return Math.sqrt(this.x * this.x ... ); }
</code>... | [
{
"answer_id": 6508,
"author": "Adhip Gupta",
"author_id": 384,
"author_profile": "https://Stackoverflow.com/users/384",
"pm_score": 2,
"selected": false,
"text": "<p>Well, I don't really have an expert opinion on this.\nI usually end up using closures based approach just because it keep... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/784/"
] | There are a few ways to get class-like behavior in javascript, the most common seem to be prototype based like this:
```
function Vector(x, y, x) {
this.x = x;
this.y = y;
this.z = z;
return this;
}
Vector.prototype.length = function () { return Math.sqrt(this.x * this.x ... ); }
```
and closure bas... | Assigning functions to the prototype is better (for public methods) because all instances of the class will share the same copy of the method. If you assign the function inside the constructor as in the second example, every time you create a new instance, the constructor creates a new copy of the length function and a... |
6,557 | <p>It seems that a List object cannot be stored in a List variable in C#, and can't even be explicitly cast that way.</p>
<pre><code>List<string> sl = new List<string>();
List<object> ol;
ol = sl;
</code></pre>
<p>results in Cannot implicitly convert type <code>System.Collections.Generic.List<str... | [
{
"answer_id": 6559,
"author": "Rex M",
"author_id": 67,
"author_profile": "https://Stackoverflow.com/users/67",
"pm_score": 4,
"selected": false,
"text": "<p>The reason is that a generic class like <code>List<></code> is, for most purposes, treated externally as a normal class. e.... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6557",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/797/"
] | It seems that a List object cannot be stored in a List variable in C#, and can't even be explicitly cast that way.
```
List<string> sl = new List<string>();
List<object> ol;
ol = sl;
```
results in Cannot implicitly convert type `System.Collections.Generic.List<string>` to `System.Collections.Generic.List<object>`
... | Think of it this way, if you were to do such a cast, and then add an object of type Foo to the list, the list of strings is no longer consistent. If you were to iterate the first reference, you would get a class cast exception because once you hit the Foo instance, the Foo could not be converted to string!
As a side n... |
6,578 | <p>I'm just beginning to have a look at Objective-C and Cocoa with a view to playing with the iPhone SDK. I'm reasonably comfortable with C's <code>malloc</code> and <code>free</code> concept, but Cocoa's references counting scheme has me rather confused. I'm told it's very elegant once you understand it, but I'm just ... | [
{
"answer_id": 6592,
"author": "Ecton",
"author_id": 457,
"author_profile": "https://Stackoverflow.com/users/457",
"pm_score": 3,
"selected": false,
"text": "<p>Objective-C uses <a href=\"http://en.wikipedia.org/wiki/Reference_counting\" rel=\"noreferrer\">Reference Counting</a>, which m... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/797/"
] | I'm just beginning to have a look at Objective-C and Cocoa with a view to playing with the iPhone SDK. I'm reasonably comfortable with C's `malloc` and `free` concept, but Cocoa's references counting scheme has me rather confused. I'm told it's very elegant once you understand it, but I'm just not over the hump yet.
H... | Let's start with `retain` and `release`; `autorelease` is really just a special case once you understand the basic concepts.
In Cocoa, each object keeps track of how many times it is being referenced (specifically, the `NSObject` base class implements this). By calling `retain` on an object, you are telling it that y... |
6,623 | <p>After changing the output directory of a visual studio project it started to fail to build with an error very much like: </p>
<pre><code>C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin\sgen.exe /assembly:C:\p4root\Zantaz\trunk\EASDiscovery\EASDiscoveryCaseManagement\obj\Release\EASDiscoveryCaseManagement.... | [
{
"answer_id": 6875,
"author": "pauldoo",
"author_id": 755,
"author_profile": "https://Stackoverflow.com/users/755",
"pm_score": 0,
"selected": false,
"text": "<p>I've not seen this particular problem, but recently for us a \"C1001: An internal error has occurred in the compiler\" type c... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/361/"
] | After changing the output directory of a visual studio project it started to fail to build with an error very much like:
```
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\bin\sgen.exe /assembly:C:\p4root\Zantaz\trunk\EASDiscovery\EASDiscoveryCaseManagement\obj\Release\EASDiscoveryCaseManagement.dll /proxytypes ... | see [msdn](http://msdn.microsoft.com/en-us/library/bk3w6240(VS.80).aspx) for the options to sgen.exe [you have the command line, you can play with it manually... delete your .XmlSerializers.dll or use /force though]
Today I also ran across how to more [manually specify the sgen options](http://www.kiwidude.com/blog/20... |
6,628 | <p>What is the difference, if any, between these methods of indexing into a PHP array:</p>
<pre><code>$array[$index]
$array["$index"]
$array["{$index}"]
</code></pre>
<p>I'm interested in both the performance and functional differences.</p>
<h3>Update:</h3>
<p>(In response to @Jeremy) I'm not sure t... | [
{
"answer_id": 6629,
"author": "Paige Ruten",
"author_id": 813,
"author_profile": "https://Stackoverflow.com/users/813",
"pm_score": 0,
"selected": false,
"text": "<p>If $index is a string there is no difference because $index, \"$index\", and \"{$index}\" all evaluate to the same string... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/103/"
] | What is the difference, if any, between these methods of indexing into a PHP array:
```
$array[$index]
$array["$index"]
$array["{$index}"]
```
I'm interested in both the performance and functional differences.
### Update:
(In response to @Jeremy) I'm not sure that's right. I ran this code:
```
$array = array(10... | see @svec and @jeremy above. All array indices are of type 'int' first, then type 'string', and will be cast to that as PHP sees fit.
Performance wise, $index should be faster than "$index" and "{$index}" (which are the same).
Once you start a double-quote string, PHP will go into interpolation mode and treat it as ... |
6,639 | <p>How should I load files into my Java application?</p>
| [
{
"answer_id": 6640,
"author": "Will",
"author_id": 816,
"author_profile": "https://Stackoverflow.com/users/816",
"pm_score": 6,
"selected": false,
"text": "<p><strong>The short answer</strong></p>\n\n<p>Use one of these two methods:</p>\n\n<ul>\n<li><a href=\"http://java.sun.com/javase/... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/816/"
] | How should I load files into my Java application? | **The short answer**
Use one of these two methods:
* [`Class.getResource(String)`](http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getResource(java.lang.String))
* [`Class.getResourceAsStream(String)`](http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getResourceAsStream(java.lang.String))
For ex... |
6,642 | <p>I was trying to add a favicon to a website earlier and looked for a better way to implement this than to dump a <code>favicon.ico</code> file in the root of the website.</p>
<p>I found this nice little guide: <a href="http://www.w3.org/2005/10/howto-favicon" rel="noreferrer">How to Add a Favicon</a>. However, the p... | [
{
"answer_id": 6643,
"author": "Brandon Wood",
"author_id": 423,
"author_profile": "https://Stackoverflow.com/users/423",
"pm_score": 0,
"selected": false,
"text": "<p>This is how they're doing it right here on Stack Overflow:</p>\n\n<pre><code><link rel=\"shortcut icon\" href=\"/favi... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/810/"
] | I was trying to add a favicon to a website earlier and looked for a better way to implement this than to dump a `favicon.ico` file in the root of the website.
I found this nice little guide: [How to Add a Favicon](http://www.w3.org/2005/10/howto-favicon). However, the preferred method did not work in IE (7) and the se... | This is what I always use:
```
<link rel="icon" href="favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
```
The second one is for IE. The first one is for other browsers. |
6,681 | <p>I'm still new to the ASP.NET world, so I could be way off base here, but so far this is to the best of my (limited) knowledge!</p>
<p>Let's say I have a standard business object "Contact" in the <em>Business</em> namespace. I write a Web Service to retrieve a Contact's info from a database and return it. I then wri... | [
{
"answer_id": 6704,
"author": "Lance Fisher",
"author_id": 571,
"author_profile": "https://Stackoverflow.com/users/571",
"pm_score": 4,
"selected": true,
"text": "<p>You are on the right track. To get the data from the proxy object back into one of your own objects, you have to do left... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/832/"
] | I'm still new to the ASP.NET world, so I could be way off base here, but so far this is to the best of my (limited) knowledge!
Let's say I have a standard business object "Contact" in the *Business* namespace. I write a Web Service to retrieve a Contact's info from a database and return it. I then write a client appli... | You are on the right track. To get the data from the proxy object back into one of your own objects, you have to do left-hand-right-hand code. i.e. copy property values. I'll bet you that there is already a generic method out there that uses reflection.
Some people will use something other than a web service (.net rem... |
6,785 | <p>Suppose I have a stringbuilder in C# that does this:</p>
<pre><code>StringBuilder sb = new StringBuilder();
string cat = "cat";
sb.Append("the ").Append(cat).(" in the hat");
string s = sb.ToString();
</code></pre>
<p>would that be as efficient or any more efficient as having:</p>
<pre><code>string cat = "cat";
s... | [
{
"answer_id": 6786,
"author": "GateKiller",
"author_id": 383,
"author_profile": "https://Stackoverflow.com/users/383",
"pm_score": -1,
"selected": false,
"text": "<p>I would suggest not, since String.Format was not designed for concatenation, it was design for formatting the output of v... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/493/"
] | Suppose I have a stringbuilder in C# that does this:
```
StringBuilder sb = new StringBuilder();
string cat = "cat";
sb.Append("the ").Append(cat).(" in the hat");
string s = sb.ToString();
```
would that be as efficient or any more efficient as having:
```
string cat = "cat";
string s = String.Format("The {0} in t... | **NOTE:** This answer was written when .NET 2.0 was the current version. This may no longer apply to later versions.
`String.Format` uses a `StringBuilder` internally:
```
public static string Format(IFormatProvider provider, string format, params object[] args)
{
if ((format == null) || (args == null))
{
... |
6,811 | <p>Before reading anything else, please take time to read the <a href="https://stackoverflow.com/questions/1615/how-can-i-modify-xfdl-files-update-1">original thread</a>.</p>
<p>Overview: a .xfdl file is a gzipped .xml file which has then been encoded in base64. I wish to de-encode the .xfdl into xml which I can the... | [
{
"answer_id": 6825,
"author": "John Downey",
"author_id": 200,
"author_profile": "https://Stackoverflow.com/users/200",
"pm_score": 0,
"selected": false,
"text": "<p>Different implementations of the gzip algorithm will always produce slightly different but still correct files, also the ... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6811",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25/"
] | Before reading anything else, please take time to read the [original thread](https://stackoverflow.com/questions/1615/how-can-i-modify-xfdl-files-update-1).
Overview: a .xfdl file is a gzipped .xml file which has then been encoded in base64. I wish to de-encode the .xfdl into xml which I can then modify and then re-en... | As far as I know you cannot find the compression level of an already compressed file. When you are compressing the file you can specify the compression level with -# where the # is from 1 to 9 (1 being the fastest compression and 9 being the most compressed file). In practice you should never compare a compressed file ... |
6,816 | <p>I was hoping someone could help me out with a problem I'm having using the java search function in Eclipse on a particular project.</p>
<p>When using the java search on one particular project, I get an error message saying <code>Class file name must end with .class</code> (see stack trace below). This does not seem... | [
{
"answer_id": 6840,
"author": "McDowell",
"author_id": 304,
"author_profile": "https://Stackoverflow.com/users/304",
"pm_score": 7,
"selected": true,
"text": "<p>Two more general-purpose mechanisms for fixing some of Eclipse's idiosyncrasies:</p>\n\n<ul>\n<li>Close and open the project<... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/797/"
] | I was hoping someone could help me out with a problem I'm having using the java search function in Eclipse on a particular project.
When using the java search on one particular project, I get an error message saying `Class file name must end with .class` (see stack trace below). This does not seem to be happening on a... | Two more general-purpose mechanisms for fixing some of Eclipse's idiosyncrasies:
* Close and open the project
* Delete the project (but not from disk!) and reimport it as an existing project
Failing that, [bugs.eclipse.org](https://bugs.eclipse.org/bugs/buglist.cgi?query_format=specific&order=relevance+desc&bug_statu... |
6,890 | <p>I have some code for starting a thread on the .NET CF 2.0:</p>
<pre><code>ThreadStart tStart = new ThreadStart(MyMethod);
Thread t = new Thread(tStart);
t.Start();
</code></pre>
<p>If I call this inside a loop the items completely out of order. How do introduce a wait after <code>t.Start()</code>, so that the work... | [
{
"answer_id": 6935,
"author": "Kev",
"author_id": 419,
"author_profile": "https://Stackoverflow.com/users/419",
"pm_score": 2,
"selected": false,
"text": "<p>If I'm reading this properly, you're starting work items on bunch of threads but you're concerned that the threads are completing... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/636/"
] | I have some code for starting a thread on the .NET CF 2.0:
```
ThreadStart tStart = new ThreadStart(MyMethod);
Thread t = new Thread(tStart);
t.Start();
```
If I call this inside a loop the items completely out of order. How do introduce a wait after `t.Start()`, so that the work on the thread completes before the c... | How much order do you need to impose on the threads? If you just need all of the work started in the loop to finish before the code continues, but you don't care about the order the work within the loop finishes, then calling Join is the answer. To add more detail to [Kevin Kenny's answer,](https://stackoverflow.com/qu... |
6,891 | <p>I have come across the following type of code many a times, and I wonder if this is a good practice (from Performance perspective) or not:</p>
<pre><code>try
{
... // some code
}
catch (Exception ex)
{
... // Do something
throw new CustomException(ex);
}
</code></pre>
<p>Basically, what the coder is do... | [
{
"answer_id": 6910,
"author": "David",
"author_id": 381,
"author_profile": "https://Stackoverflow.com/users/381",
"pm_score": 0,
"selected": false,
"text": "<p>The throw in your first example has the overhead of the creation of a new CustomException object.</p>\n\n<p>The re-throw in you... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/380/"
] | I have come across the following type of code many a times, and I wonder if this is a good practice (from Performance perspective) or not:
```
try
{
... // some code
}
catch (Exception ex)
{
... // Do something
throw new CustomException(ex);
}
```
Basically, what the coder is doing is that they are encom... | @Brad Tutterow
The exception is not being lost in the first case, it is being passed in to the constructor. I will agree with you on the rest though, the second approach is a very bad idea because of the loss of stack trace. When I worked with .NET, I ran into many cases where other programmers did just that, and it f... |
6,899 | <p>To illustrate, assume that I have two tables as follows:</p>
<pre><code>VehicleID Name
1 Chuck
2 Larry
LocationID VehicleID City
1 1 New York
2 1 Seattle
3 1 Vancouver
4 2 Los Angeles
5 2 Houston
</code></pre>
<p>... | [
{
"answer_id": 6961,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 6,
"selected": false,
"text": "<p>I don't belive there's a way to do it within one query, but you can play tricks like this with a temporary variable:</p... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/799/"
] | To illustrate, assume that I have two tables as follows:
```
VehicleID Name
1 Chuck
2 Larry
LocationID VehicleID City
1 1 New York
2 1 Seattle
3 1 Vancouver
4 2 Los Angeles
5 2 Houston
```
I want to write a query to... | If you're using SQL Server 2005, you could use the FOR XML PATH command.
```
SELECT [VehicleID]
, [Name]
, (STUFF((SELECT CAST(', ' + [City] AS VARCHAR(MAX))
FROM [Location]
WHERE (VehicleID = Vehicle.VehicleID)
FOR XML PATH ('')), 1, 2, '')) AS Locations
FROM [Vehicle]
```
It... |
6,904 | <p>I'm trying to use the CoreCon API in Visual Studio 2008 to programmatically launch device emulators. When I call <code>device.Connect()</code>, I inexplicably get a DirectoryNotFoundException. I get it if I try it in PowerShell or in C# Console Application. Here's the code I'm using:</p>
<pre><code>static void Main... | [
{
"answer_id": 6928,
"author": "Kev",
"author_id": 419,
"author_profile": "https://Stackoverflow.com/users/419",
"pm_score": 0,
"selected": false,
"text": "<p>I tried this and it works ok. Can you paste in the whole exception and stack trace?</p>\n\n<p><strong>Updated:</strong> Strangely... | 2008/08/09 | [
"https://Stackoverflow.com/questions/6904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/631/"
] | I'm trying to use the CoreCon API in Visual Studio 2008 to programmatically launch device emulators. When I call `device.Connect()`, I inexplicably get a DirectoryNotFoundException. I get it if I try it in PowerShell or in C# Console Application. Here's the code I'm using:
```
static void Main(string[] args)
{
Da... | It can be found at `<systemdrive>:\Program files\Common Files\Microsoft Shared\CoreCon\1.0\Bin`.
This is the path where you can get this dll, so add this dll to your project. |
6,973 | <p>When attempting to compile my C# project, I get the following error:</p>
<pre><code>'C:\Documents and Settings\Dan\Desktop\Rowdy Pixel\Apps\CleanerMenu\CleanerMenu\obj\Debug\CSC97.tmp' is not a valid Win32 resource file.
</code></pre>
<p>Having gone through many Google searches, I have determined that this is usua... | [
{
"answer_id": 6977,
"author": "Mike Stone",
"author_id": 122,
"author_profile": "https://Stackoverflow.com/users/122",
"pm_score": 0,
"selected": false,
"text": "<p>Is this a file you created and added to the project or did it mysteriously show up?</p>\n\n<p>You can maybe check your .cs... | 2008/08/10 | [
"https://Stackoverflow.com/questions/6973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/752/"
] | 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 im... | I don't know if this will help, but from [this forum](http://forums.msdn.microsoft.com/en-US/csharplanguage/thread/4217bec6-ea65-465f-8510-757558b36094/):
>
> Add an .ico file to the application section of the properties page, and recieved the error thats been described, when I checked the Icon file with an icon edit... |
7,034 | <p>I have a data structure that represents a directed graph, and I want to render that dynamically on an HTML page. These graphs will usually be just a few nodes, maybe ten at the very upper end, so my guess is that performance isn't going to be a big deal. Ideally, I'd like to be able to hook it in with jQuery so tha... | [
{
"answer_id": 12844,
"author": "Sam Coles",
"author_id": 804,
"author_profile": "https://Stackoverflow.com/users/804",
"pm_score": 5,
"selected": false,
"text": "<p><a href=\"http://www.jsviz.org\" rel=\"nofollow noreferrer\">JsVIS</a> was pretty nice, but slow with larger graphs, and h... | 2008/08/10 | [
"https://Stackoverflow.com/questions/7034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/404/"
] | I have a data structure that represents a directed graph, and I want to render that dynamically on an HTML page. These graphs will usually be just a few nodes, maybe ten at the very upper end, so my guess is that performance isn't going to be a big deal. Ideally, I'd like to be able to hook it in with jQuery so that us... | I've just put together what you may be looking for: <http://www.graphdracula.net>
It's JavaScript with directed graph layouting, SVG and you can even drag the nodes around. Still needs some tweaking, but is totally usable. You create nodes and edges easily with JavaScript code like this:
```
var g = new Graph();
g.ad... |
7,074 | <p>What are the differences between these two and which one should I use?</p>
<pre><code>string s = "Hello world!";
String s = "Hello world!";
</code></pre>
| [
{
"answer_id": 7077,
"author": "Derek Park",
"author_id": 872,
"author_profile": "https://Stackoverflow.com/users/872",
"pm_score": 14,
"selected": true,
"text": "<p><a href=\"https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/string\" rel=\"noreferrer\"><code>st... | 2008/08/10 | [
"https://Stackoverflow.com/questions/7074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/571/"
] | What are the differences between these two and which one should I use?
```
string s = "Hello world!";
String s = "Hello world!";
``` | [`string`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/string) is an alias in C# for [`System.String`](https://learn.microsoft.com/en-us/dotnet/api/system.string).
So technically, there is no difference. It's like [`int` *vs.* `System.Int32`](https://stackoverflow.com/questions/62503/... |
7,084 | <p>I've worked on a number of different embedded systems. They have all used <code>typedef</code>s (or <code>#defines</code>) for types such as <code>UINT32</code>.</p>
<p>This is a good technique as it drives home the size of the type to the programmer and makes you more conscious of chances for overflow etc.</p>
<... | [
{
"answer_id": 7091,
"author": "Zooba",
"author_id": 891,
"author_profile": "https://Stackoverflow.com/users/891",
"pm_score": 1,
"selected": false,
"text": "<p>Consistency, convenience and readability. \"UINT32\" is much more readable and writeable than \"unsigned long long\", which is ... | 2008/08/10 | [
"https://Stackoverflow.com/questions/7084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/888/"
] | I've worked on a number of different embedded systems. They have all used `typedef`s (or `#defines`) for types such as `UINT32`.
This is a good technique as it drives home the size of the type to the programmer and makes you more conscious of chances for overflow etc.
But on some systems you know that the compiler an... | I use type abstraction very rarely. Here are my arguments, sorted in increasing order of subjectivity:
1. Local variables are different from struct members and arrays in the sense that you want them to fit in a register. On a 32b/64b target, a local `int16_t` can make code slower compared to a local int since the comp... |
7,095 | <p>In other words, is this Singleton implementation thread safe:</p>
<pre><code>public class Singleton
{
private static Singleton instance;
private Singleton() { }
static Singleton()
{
instance = new Singleton();
}
public static Singleton Instance
{
get { return instance;... | [
{
"answer_id": 7104,
"author": "Dominic Cooney",
"author_id": 878,
"author_profile": "https://Stackoverflow.com/users/878",
"pm_score": 2,
"selected": false,
"text": "<p>The <a href=\"http://www.ecma-international.org/publications/standards/Ecma-335.htm\" rel=\"nofollow noreferrer\">Comm... | 2008/08/10 | [
"https://Stackoverflow.com/questions/7095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/373/"
] | In other words, is this Singleton implementation thread safe:
```
public class Singleton
{
private static Singleton instance;
private Singleton() { }
static Singleton()
{
instance = new Singleton();
}
public static Singleton Instance
{
get { return instance; }
}
}
``... | Static constructors are guaranteed to be run only once per application domain, before any instances of a class are created or any static members are accessed. <https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/static-constructors>
The implementation shown is thread safe for the init... |
7,118 | <p>Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and <a href="http://en.wikipedia.org/wiki/Safari_%28web_browser%29" rel="noreferrer">Safari</a>. In Firefox, you can use <a href="http://en.wikipedia.org/wiki/Firebug" rel="noreferrer">Firebug's</a> <a href="http://getfire... | [
{
"answer_id": 7126,
"author": "Yaakov Ellis",
"author_id": 51,
"author_profile": "https://Stackoverflow.com/users/51",
"pm_score": 2,
"selected": false,
"text": "<p>A post on the IE Blog, <em><a href=\"http://blogs.msdn.com/ie/archive/2004/10/26/247912.aspx\" rel=\"nofollow noreferrer\"... | 2008/08/10 | [
"https://Stackoverflow.com/questions/7118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/889/"
] | Currently, I don't really have a good method of debugging JavaScript in Internet Explorer and [Safari](http://en.wikipedia.org/wiki/Safari_%28web_browser%29). In Firefox, you can use [Firebug's](http://en.wikipedia.org/wiki/Firebug) [logging feature](http://getfirebug.com/logging.html) and [command Line functions](http... | For Safari you need to enable the "Develop" menu via Preferences (in Safari 3.1; see [the entry in Apple's Safari development FAQ](http://developer.apple.com/internet/safari/faq.html#anchor14)) or via
```
$ defaults write com.apple.Safari IncludeDebugMenu 1
```
at the terminal in Mac OS X. Then from the Develop menu... |
7,212 | <p>What I'd like to do is something like the following:</p>
<pre><code>FooClass.prototype.method = function():String
{
return "Something";
}
var foo:FooClass = new FooClass();
foo.method();
</code></pre>
<p>Which is to say, I'd like to extend a generated class with a single method, not via inheritance but via th... | [
{
"answer_id": 8886,
"author": "aib",
"author_id": 1088,
"author_profile": "https://Stackoverflow.com/users/1088",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, such a thing is possible.</p>\n\n<p>In fact, your example is very close to the solution.</p>\n\n<p>Try</p>\n\n<pre><code>fo... | 2008/08/10 | [
"https://Stackoverflow.com/questions/7212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/266/"
] | What I'd like to do is something like the following:
```
FooClass.prototype.method = function():String
{
return "Something";
}
var foo:FooClass = new FooClass();
foo.method();
```
Which is to say, I'd like to extend a generated class with a single method, not via inheritance but via the prototype.
The class is... | Yes, such a thing is possible.
In fact, your example is very close to the solution.
Try
```
foo["method"]();
```
instead of
```
foo.method();
``` |
7,244 | <p>What I want to do is something like this: I have enums with combined flagged values.</p>
<pre><code>public static class EnumExtension
{
public static bool IsSet<T>( this T input, T matchTo )
where T:enum //the constraint I want that doesn't exist in C#3
{
return (input & match... | [
{
"answer_id": 7385,
"author": "Ronnie",
"author_id": 193,
"author_profile": "https://Stackoverflow.com/users/193",
"pm_score": 4,
"selected": false,
"text": "<p>Darren, that would work if the types were specific enumerations - for general enumerations to work you have to cast them to in... | 2008/08/10 | [
"https://Stackoverflow.com/questions/7244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905/"
] | What I want to do is something like this: I have enums with combined flagged values.
```
public static class EnumExtension
{
public static bool IsSet<T>( this T input, T matchTo )
where T:enum //the constraint I want that doesn't exist in C#3
{
return (input & matchTo) != 0;
}
}
```
... | **EDIT: This is now live in version 0.0.0.2 of UnconstrainedMelody.**
(As requested on my [blog post about enum constraints](http://codeblog.jonskeet.uk/2009/09/10/generic-constraints-for-enums-and-delegates/). I've included the basic facts below for the sake of a standalone answer.)
The best solution is to wait for ... |
7,245 | <p>What's the most efficient algorithm to find the rectangle with the largest area which will fit in the empty space?</p>
<p>Let's say the screen looks like this ('#' represents filled area):</p>
<pre><code>....................
..............######
##..................
.................###
.................###
#####.... | [
{
"answer_id": 7250,
"author": "Mark Renouf",
"author_id": 758,
"author_profile": "https://Stackoverflow.com/users/758",
"pm_score": 2,
"selected": false,
"text": "<p>@lassevk</p>\n\n<pre><code> // 4. Outer double-for-loop to consider all possible positions \n // for topleft cor... | 2008/08/10 | [
"https://Stackoverflow.com/questions/7245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/758/"
] | What's the most efficient algorithm to find the rectangle with the largest area which will fit in the empty space?
Let's say the screen looks like this ('#' represents filled area):
```
....................
..............######
##..................
.................###
.................###
#####...............
#####.... | @lassevk
I found the referenced article, from DDJ: [The Maximal Rectangle Problem](http://www.ddj.com/184410529) |
7,260 | <p>How do I setup Public-Key Authentication for SSH?</p>
| [
{
"answer_id": 7481,
"author": "roo",
"author_id": 716,
"author_profile": "https://Stackoverflow.com/users/716",
"pm_score": 3,
"selected": false,
"text": "<p>For windows <a href=\"http://the.earth.li/~sgtatham/putty/0.53b/htmldoc/Chapter8.html\" rel=\"noreferrer\">this</a> is a good int... | 2008/08/10 | [
"https://Stackoverflow.com/questions/7260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/889/"
] | How do I setup Public-Key Authentication for SSH? | If you have SSH installed, you should be able to run..
```
ssh-keygen
```
Then go through the steps, you'll have two files, `id_rsa` and `id_rsa.pub` (the first is your private key, the second is your public key - the one you copy to remote machines)
Then, connect to the remote machine you want to login to, to the ... |
7,277 | <p>I'm generating some XML documents and when it comes to the address part I have fragments that look like this:</p>
<pre><code><Address>15 Sample St
Example Bay
Some Country</Address>
</code></pre>
<p>The XSLT that I have for converting this to XHTML has some funky recursive template to convert newline c... | [
{
"answer_id": 7280,
"author": "Mark Renouf",
"author_id": 758,
"author_profile": "https://Stackoverflow.com/users/758",
"pm_score": -1,
"selected": false,
"text": "<p>Yes, I think using a <a href=\"http://en.wikipedia.org/wiki/CDATA\" rel=\"nofollow noreferrer\">CDATA</a> block would pr... | 2008/08/10 | [
"https://Stackoverflow.com/questions/7277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/755/"
] | I'm generating some XML documents and when it comes to the address part I have fragments that look like this:
```
<Address>15 Sample St
Example Bay
Some Country</Address>
```
The XSLT that I have for converting this to XHTML has some funky recursive template to convert newline characters within strings to <br/> tags... | It's generally considered bad practice to rely on linebreaks, since it's a fragile way to differentiate data. While most XML processors will preserve any whitespace you put in your XML, it's not guaranteed.
The real problem is that most applications that output your XML into a readable format consider all whitespace ... |
7,287 | <p>Lately I had to change some code on older systems where not all of the code has unit tests.<br>
Before making the changes I want to write tests, but each class created a lot of dependencies and other anti-patterns which made testing quite hard.<br>
Obviously, I wanted to refactor the code to make it easier to test, ... | [
{
"answer_id": 7296,
"author": "Mike Stone",
"author_id": 122,
"author_profile": "https://Stackoverflow.com/users/122",
"pm_score": 4,
"selected": true,
"text": "<p>First of all, <a href=\"http://devver.net/blog/2008/07/tips-for-unit-testing/\" rel=\"noreferrer\">here's a great article w... | 2008/08/10 | [
"https://Stackoverflow.com/questions/7287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/573/"
] | Lately I had to change some code on older systems where not all of the code has unit tests.
Before making the changes I want to write tests, but each class created a lot of dependencies and other anti-patterns which made testing quite hard.
Obviously, I wanted to refactor the code to make it easier to test, write... | First of all, [here's a great article with tips on unit testing](http://devver.net/blog/2008/07/tips-for-unit-testing/). Secondly, I found a great way to avoid making tons of changes in old code is to just refactor it a little until you can test it. One easy way to do this is to make private members protected, and then... |
7,364 | <p>Does anyone know of a good method for editing PDFs in PHP? Preferably open-source/zero-license cost methods. :)</p>
<p>I am thinking along the lines of opening a PDF file, replacing text in the PDF and then writing out the modified version of the PDF?</p>
<p>On the front-end</p>
| [
{
"answer_id": 7377,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": -1,
"selected": false,
"text": "<p>We use <a href=\"http://www.pdflib.com/pdflib-gmbh/\" rel=\"nofollow noreferrer\">pdflib</a> to create PDF files from ... | 2008/08/10 | [
"https://Stackoverflow.com/questions/7364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277/"
] | Does anyone know of a good method for editing PDFs in PHP? Preferably open-source/zero-license cost methods. :)
I am thinking along the lines of opening a PDF file, replacing text in the PDF and then writing out the modified version of the PDF?
On the front-end | If you are taking a 'fill in the blank' approach, you can precisely position text anywhere you want on the page. So it's relatively easy (if not a bit tedious) to add the missing text to the document. For example with Zend Framework:
```
<?php
require_once 'Zend/Pdf.php';
$pdf = Zend_Pdf::load('blank.pdf');
$page = $... |
7,398 | <p>I haven't seen any questions relating to GNU autoconf/automake builds, but I'm hoping at least some of you out there are familiar with it. Here goes:</p>
<p>I have a project (I'll call it myproject) that includes another project (vendor). The vendor project is a standalone project maintained by someone else. Inc... | [
{
"answer_id": 9214,
"author": "David Joyner",
"author_id": 1146,
"author_profile": "https://Stackoverflow.com/users/1146",
"pm_score": 2,
"selected": false,
"text": "<p>It's definitely a hack, but I post-process the autogen'd <code>config.h</code> file:</p>\n\n<pre><code>sed -e 's/.*PAC... | 2008/08/10 | [
"https://Stackoverflow.com/questions/7398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/737/"
] | I haven't seen any questions relating to GNU autoconf/automake builds, but I'm hoping at least some of you out there are familiar with it. Here goes:
I have a project (I'll call it myproject) that includes another project (vendor). The vendor project is a standalone project maintained by someone else. Including a proj... | Some notes:
* you didn't mention how `config.h` was included - with quotes or angle brackets. See [this other question](https://stackoverflow.com/questions/21593/what-is-the-difference-between-include-filename-and-include-filename) for more information on the difference. In short, `config.h` is typically included with... |
7,470 | <p>After a couple of hours fighting with the <a href="http://gallery.menalto.com/" rel="nofollow noreferrer">Gallery2</a> <a href="http://codex.gallery2.org/Gallery2:Modules:rss" rel="nofollow noreferrer">RSS module</a> and getting only the message, "no feeds have yet been defined", I gave up. Based on <a href="http:/... | [
{
"answer_id": 7471,
"author": "ESV",
"author_id": 150,
"author_profile": "https://Stackoverflow.com/users/150",
"pm_score": 1,
"selected": false,
"text": "<p>My eventual (and hopefully temporary) solution to this problem was a Python CGI script. My script follows for anyone who might f... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/150/"
] | After a couple of hours fighting with the [Gallery2](http://gallery.menalto.com/) [RSS module](http://codex.gallery2.org/Gallery2:Modules:rss) and getting only the message, "no feeds have yet been defined", I gave up. Based on [a Google search for "no feeds have yet been defined"](http://www.google.com/search?q=%22no+f... | My eventual (and hopefully temporary) solution to this problem was a Python CGI script. My script follows for anyone who might find it useful (despite the fact that this is a total hack).
```
#!/usr/bin/python
"""A CGI script to produce an RSS feed of top-level Gallery2 albums."""
#import cgi
#import cgitb; cgitb.en... |
7,477 | <p>I'm currently working on an internal sales application for the company I work for, and I've got a form that allows the user to change the delivery address.</p>
<p>Now I think it would look much nicer, if the textarea I'm using for the main address details would just take up the area of the text in it, and automatic... | [
{
"answer_id": 7523,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": 7,
"selected": true,
"text": "<p>Facebook does it, when you write on people's walls, but only resizes vertically.</p>\n\n<p>Horizontal resize strikes me ... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/841/"
] | I'm currently working on an internal sales application for the company I work for, and I've got a form that allows the user to change the delivery address.
Now I think it would look much nicer, if the textarea I'm using for the main address details would just take up the area of the text in it, and automatically resiz... | Facebook does it, when you write on people's walls, but only resizes vertically.
Horizontal resize strikes me as being a mess, due to word-wrap, long lines, and so on, but vertical resize seems to be pretty safe and nice.
None of the Facebook-using-newbies I know have ever mentioned anything about it or been confused... |
7,489 | <p>I've made many different seperate parts of a GUI system for the Nintendo DS, like buttons and textboxes and select boxes, but I need a way of containing these classes in one Gui class, so that I can draw everything to the screen all at once, and check all the buttons at once to check if any are being pressed. My que... | [
{
"answer_id": 7506,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>One useful strategy to keep in mind might be the <a href=\"http://en.wikipedia.org/wiki/Composite_pattern\" rel=\"nofollow no... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/813/"
] | I've made many different seperate parts of a GUI system for the Nintendo DS, like buttons and textboxes and select boxes, but I need a way of containing these classes in one Gui class, so that I can draw everything to the screen all at once, and check all the buttons at once to check if any are being pressed. My questi... | This question is very similar to one I was going to post, only mine is for Sony PSP programming.
I've been toying with something for a while, I've consulted some books and [VTMs](http://www.3dbuzz.com/xcart/product.php?productid=30&cat=12&page=1), and so far this is a rough idea of a simple ui systems.
```
class uiEl... |
7,503 | <p>I know almost nothing about linq.</p>
<p>I'm doing this:</p>
<pre><code>var apps = from app in Process.GetProcesses()
where app.ProcessName.Contains( "MyAppName" ) && app.MainWindowHandle != IntPtr.Zero
select app;
</code></pre>
<p>Which gets me all the running processes which match that criteria.... | [
{
"answer_id": 7509,
"author": "FryHard",
"author_id": 231,
"author_profile": "https://Stackoverflow.com/users/231",
"pm_score": 0,
"selected": false,
"text": "<p>Assuming that in your first example apps is an IEnumerable you could make use of the .Count and .FirstOrDefault properties to... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/234/"
] | 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 o... | @FryHard FirstOrDefault will work but remember that it returns null if none are found. This code isn't tested but should be close to what you want:
```
var app = Process.GetProcesses().FirstOrDefault(p => p.ProcessName.Contains("MyAppName") && p.MainWindowHandle != IntPtr.Zero);
if (app == null)
return;
SetForeg... |
7,525 | <p>So, I need some help. I am working on a project in C++. However, I think I have somehow managed to corrupt my heap. This is based on the fact that I added an <code>std::string</code> to a class and assigning it a value from another <code>std::string</code>:</p>
<pre><code>std::string hello = "Hello, world.\n";
/* e... | [
{
"answer_id": 7536,
"author": "JimDaniel",
"author_id": 63,
"author_profile": "https://Stackoverflow.com/users/63",
"pm_score": 0,
"selected": false,
"text": "<p>As far as I can tell your code is correct. Assuming exampleString is an std::string that has class scope like you describe, y... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61/"
] | So, I need some help. I am working on a project in C++. However, I think I have somehow managed to corrupt my heap. This is based on the fact that I added an `std::string` to a class and assigning it a value from another `std::string`:
```
std::string hello = "Hello, world.\n";
/* exampleString = "Hello, world.\n" wou... | These are relatively cheap mechanisms for possibly solving the problem:
1. Keep an eye on my [heap corruption question](https://stackoverflow.com/questions/1069/heap-corruption-under-win32-how-to-locate) - I'm updating with the answers as they shake out. The first was balancing `new[]` and `delete[]`, but you're alrea... |
7,535 | <p>What is the best way to use SQL Server 2008 as a development database, but ensure that the database is compatible with SQL Server 2005?</p>
| [
{
"answer_id": 7547,
"author": "vzczc",
"author_id": 224,
"author_profile": "https://Stackoverflow.com/users/224",
"pm_score": 5,
"selected": true,
"text": "<p>This can be done via SQL Enterprise Manager or like this: </p>\n\n<pre><code>ALTER DATABASE <database> \nSET COMPATIBILIT... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/708/"
] | What is the best way to use SQL Server 2008 as a development database, but ensure that the database is compatible with SQL Server 2005? | This can be done via SQL Enterprise Manager or like this:
```
ALTER DATABASE <database>
SET COMPATIBILITY_LEVEL = { 80 | 90 | 100 }
```
Use 90 for 2005 compatibility.
This replaces the functionality used for previous releases, the stored procedure *sp\_dbcmptlevel*. |
7,539 | <p>Recently I tried understanding the use of <strong>java.math.MathContext</strong> but failed to understand properly. Is it used for rounding in <code>java.math.BigDecimal</code>. If yes why does not it round the decimal digits but even mantissa part.</p>
<p>From API docs, I came to know that it follows the standard ... | [
{
"answer_id": 7550,
"author": "Derek Park",
"author_id": 872,
"author_profile": "https://Stackoverflow.com/users/872",
"pm_score": 3,
"selected": false,
"text": "<p>If I'm understanding you correctly, it sounds like you're expecting the MathContext to control how many digits should be k... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/959/"
] | Recently I tried understanding the use of **java.math.MathContext** but failed to understand properly. Is it used for rounding in `java.math.BigDecimal`. If yes why does not it round the decimal digits but even mantissa part.
From API docs, I came to know that it follows the standard specified in `ANSI X3.274-1996` an... | @jatan
>
> Thanks for you answer. It makes sense. Can you please explain me MathContext in the context of BigDecimal#round method.
>
>
>
There's nothing special about `BigDecimal.round()` *vs.* any other `BigDecimal` method. In all cases, the `MathContext` specifies the number of significant digits and the roundi... |
7,558 | <p>I am displaying a list of items using a SAP ABAP column tree model, basically a tree of folder and files, with columns.</p>
<p>I want to load the sub-nodes of folders dynamically, so I'm using the EXPAND_NO_CHILDREN event which is firing correctly.</p>
<p>Unfortunately, after I add the new nodes and items to the tre... | [
{
"answer_id": 14159,
"author": "Pat Hermens",
"author_id": 1677,
"author_profile": "https://Stackoverflow.com/users/1677",
"pm_score": 2,
"selected": false,
"text": "<p>It's been a while since I've played with SAP, but I always found the SAP Library to be particularly helpful when I got... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am displaying a list of items using a SAP ABAP column tree model, basically a tree of folder and files, with columns.
I want to load the sub-nodes of folders dynamically, so I'm using the EXPAND\_NO\_CHILDREN event which is firing correctly.
Unfortunately, after I add the new nodes and items to the tree, the folder... | It's been a while since I've played with SAP, but I always found the SAP Library to be particularly helpful when I got stuck...
I managed to come up with this one for you:
<http://help.sap.com/saphelp_nw04/helpdata/en/47/aa7a18c80a11d3a6f90000e83dd863/frameset.htm>, specifically:
>
> *When you add new nodes to the ... |
7,586 | <p>I was trying to get my head around XAML and thought that I would try writing some code. </p>
<p>Trying to add a grid with 6 by 6 column definitions then add a text block into one of the grid cells. I don't seem to be able to reference the cell that I want. There is no method on the grid that I can add the text blo... | [
{
"answer_id": 7590,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 4,
"selected": true,
"text": "<p>WPF makes use of a funky thing called <a href=\"http://msdn.microsoft.com/en-us/library/ms749011.aspx\" rel=\"noreferrer... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I was trying to get my head around XAML and thought that I would try writing some code.
Trying to add a grid with 6 by 6 column definitions then add a text block into one of the grid cells. I don't seem to be able to reference the cell that I want. There is no method on the grid that I can add the text block too. The... | WPF makes use of a funky thing called [attached properties](http://msdn.microsoft.com/en-us/library/ms749011.aspx). So in your XAML you might write this:
```
<TextBlock Grid.Row="0" Grid.Column="0" />
```
And this will effectively move the TextBlock into cell (0,0) of your grid.
In code this looks a little strange.... |
7,592 | <p>I want to create a client side mail creator web page. I know the problems of using the mailto action in an html form (not standard, no default mail appication set on the client). But the web page isn't very important, and they don't care very much.</p>
<p>The mail created by the mailto action has the syntax:</p>
<... | [
{
"answer_id": 7597,
"author": "Mike Stone",
"author_id": 122,
"author_profile": "https://Stackoverflow.com/users/122",
"pm_score": -1,
"selected": false,
"text": "<p>Is there a reason you can't just send the data to a page which handles sending the mail? It is pretty easy to send an em... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518/"
] | I want to create a client side mail creator web page. I know the problems of using the mailto action in an html form (not standard, no default mail appication set on the client). But the web page isn't very important, and they don't care very much.
The mail created by the mailto action has the syntax:
>
> subject: u... | What we used in a projet is a popup window that opens a mailto: link, it is the only way we found to compose a mail within the default mail client that works with all mail clients (at least all our clients used).
```
var addresses = "";//between the speech mark goes the receptient. Seperate addresses with a ;
var body... |
7,596 | <p>First of all, I know how to build a Java application. But I have always been puzzled about where to put my classes. There are proponents for organizing the packages in a strictly domain oriented fashion, others separate by tier.</p>
<p>I myself have always had problems with </p>
<ul>
<li>naming, </li>
<li>placing<... | [
{
"answer_id": 7599,
"author": "graham.reeds",
"author_id": 342,
"author_profile": "https://Stackoverflow.com/users/342",
"pm_score": 2,
"selected": false,
"text": "<p>Class names should always be descriptive and self-explanatory. If you have multiple domains of responsibility for your c... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/917/"
] | First of all, I know how to build a Java application. But I have always been puzzled about where to put my classes. There are proponents for organizing the packages in a strictly domain oriented fashion, others separate by tier.
I myself have always had problems with
* naming,
* placing
So,
1. Where do you put you... | I've really come to like Maven's [Standard Directory Layout](http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html "S").
One of the key ideas for me is to have two source roots - one for production code and one for test code like so:
```
MyProject/src/main/java/com/acme/Widget... |
7,614 | <p>What is the best way of testing a function that throws on failure? Or testing a function that is fairly immune to failure?</p>
<p>For instance; I have a <code>I/O Completion Port</code> class that throws in the constructor if it can't initialise the port correctly. This uses the <code>Win32</code> function of <code... | [
{
"answer_id": 7624,
"author": "Mike Stone",
"author_id": 122,
"author_profile": "https://Stackoverflow.com/users/122",
"pm_score": 2,
"selected": false,
"text": "<p>It is definitely worthwhile to test failure conditions, both that your class properly throws an exception when you want it... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342/"
] | What is the best way of testing a function that throws on failure? Or testing a function that is fairly immune to failure?
For instance; I have a `I/O Completion Port` class that throws in the constructor if it can't initialise the port correctly. This uses the `Win32` function of `CreateIoCompletionPort` in the initi... | It is definitely worthwhile to test failure conditions, both that your class properly throws an exception when you want it to and that exceptions are handled properly in the class.
This can easily be done if you are acting on an object passed in to the constructor... just pass in a mock. If not, I tend to prefer to ha... |
7,651 | <p>I have an array in Perl:</p>
<pre><code>my @my_array = ("one","two","three","two","three");
</code></pre>
<p>How do I remove the duplicates from the array?</p>
| [
{
"answer_id": 7657,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 8,
"selected": true,
"text": "<p>You can do something like this as demonstrated in <a href=\"http://perldoc.perl.org/perlfaq4.html#How-can-I-remove-duplic... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/381/"
] | I have an array in Perl:
```
my @my_array = ("one","two","three","two","three");
```
How do I remove the duplicates from the array? | You can do something like this as demonstrated in [perlfaq4](http://perldoc.perl.org/perlfaq4.html#How-can-I-remove-duplicate-elements-from-a-list-or-array%3f):
```
sub uniq {
my %seen;
grep !$seen{$_}++, @_;
}
my @array = qw(one two three two three);
my @filtered = uniq(@array);
print "@filtered\n";
```
O... |
7,664 | <p>I am wrapping existing C++ code from a <strong>BSD</strong> project in our own custom wrapper and I want to integrate it to our code with as few changes as possible. This code uses <code>fprintf</code> to print to <strong>stderr</strong> in order to log / report errors.</p>
<p>I want to redirect this to an alternat... | [
{
"answer_id": 7669,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 4,
"selected": true,
"text": "<p>You can use a similar technique on Windows, you just need to use different words for the same concepts. :) This article: ... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/912/"
] | I am wrapping existing C++ code from a **BSD** project in our own custom wrapper and I want to integrate it to our code with as few changes as possible. This code uses `fprintf` to print to **stderr** in order to log / report errors.
I want to redirect this to an alternative place within the same process. On **Unix** ... | You can use a similar technique on Windows, you just need to use different words for the same concepts. :) This article: <http://msdn.microsoft.com/en-us/library/ms682499.aspx> uses a win32 pipe to handle I/O from another process, you just have to do the same thing with threads within the same process. Of course, in yo... |
7,665 | <p>Given an absolute or relative path (in a Unix-like system), I would like to determine the full path of the target after resolving any intermediate symlinks. Bonus points for also resolving ~username notation at the same time.</p>
<p>If the target is a directory, it might be possible to chdir() into the directory an... | [
{
"answer_id": 7666,
"author": "kauppi",
"author_id": 964,
"author_profile": "https://Stackoverflow.com/users/964",
"pm_score": 8,
"selected": true,
"text": "<p>According to the standards, <code>pwd -P</code> should return the path with symlinks resolved.</p>\n\n<p>C function <code>char ... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/893/"
] | Given an absolute or relative path (in a Unix-like system), I would like to determine the full path of the target after resolving any intermediate symlinks. Bonus points for also resolving ~username notation at the same time.
If the target is a directory, it might be possible to chdir() into the directory and then cal... | According to the standards, `pwd -P` should return the path with symlinks resolved.
C function `char *getcwd(char *buf, size_t size)` from `unistd.h` should have the same behaviour.
[getcwd](http://www.opengroup.org/onlinepubs/009695399/functions/getcwd.html)
[pwd](http://www.opengroup.org/onlinepubs/009695399/utilit... |
7,685 | <p>I was recently brushing up on some fundamentals and found merge sorting a linked list to be a pretty good challenge. If you have a good implementation then show it off here.</p>
| [
{
"answer_id": 7802,
"author": "John with waffle",
"author_id": 279,
"author_profile": "https://Stackoverflow.com/users/279",
"pm_score": 3,
"selected": false,
"text": "<p>One interesting way is to maintain a stack, and only merge if the list on the stack has the same number of elements,... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/608/"
] | I was recently brushing up on some fundamentals and found merge sorting a linked list to be a pretty good challenge. If you have a good implementation then show it off here. | Wonder why it should be big challenge as it is stated here, here is a straightforward implementation in Java with out any "clever tricks".
```java
//The main function
public static Node merge_sort(Node head)
{
if(head == null || head.next == null)
return head;
Node middle = getMiddle(head); //g... |
7,707 | <p>I have an element which may contain very big amounts of data, but I don't want it to ruin the page layout, so I set <code>max-height: 100px</code> and <code>overflow:auto</code>, hoping for scrollbars to appear when the content does not fit. </p>
<p>It all works fine in Firefox and IE7, but IE8 behaves as if <code>... | [
{
"answer_id": 668205,
"author": "James Koch",
"author_id": 79509,
"author_profile": "https://Stackoverflow.com/users/79509",
"pm_score": 2,
"selected": false,
"text": "<p>I saw this logged as a fixed bug in RC1. But I've found a variation that seems to cause a hard assert render failur... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/979/"
] | I have an element which may contain very big amounts of data, but I don't want it to ruin the page layout, so I set `max-height: 100px` and `overflow:auto`, hoping for scrollbars to appear when the content does not fit.
It all works fine in Firefox and IE7, but IE8 behaves as if `overflow:hidden` was present instead ... | This is a really nasty bug as it affects us heavily on Stack Overflow with `<pre>` code blocks, which have `max-height:600` and `width:auto`.
It is logged as a bug in the final version of IE8 with no fix.
<http://connect.microsoft.com/IE/feedback/ViewFeedback.aspx?FeedbackID=408759>
There is a really, really hacky C... |
7,719 | <p>Is there any way to capture the MouseDown even from the .NET 2.0 TextBox control?
I know the inherited Control class has the event, but it's not exposed in TextBox.
Is there a way to override the event handler?</p>
<p>I also tried the OpenNETCF TextBox2 control which does have the MouseDown event exposed, but no ma... | [
{
"answer_id": 7799,
"author": "GateKiller",
"author_id": 383,
"author_profile": "https://Stackoverflow.com/users/383",
"pm_score": 0,
"selected": false,
"text": "<p>According to the .Net Framework, the <a href=\"http://www.csharpfriends.com/quickstart/aspplus/samples/classbrowser/cs/cla... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | Is there any way to capture the MouseDown even from the .NET 2.0 TextBox control?
I know the inherited Control class has the event, but it's not exposed in TextBox.
Is there a way to override the event handler?
I also tried the OpenNETCF TextBox2 control which does have the MouseDown event exposed, but no matter what ... | Looks like you're right. Bummer. No MouseOver event.
One of the fallbacks that always works with .NET, though, is P/Invoke. Someone already took the time to do this for the .NET CF TextBox. I found this on CodeProject:
<http://www.codeproject.com/KB/cs/TextBox_subclassing.aspx>
Hope this helps |
7,720 | <p>I am writing an application in Java for the desktop using the Eclipse SWT library for GUI rendering. I think SWT helps Java get over the biggest hurdle for acceptance on the desktop: namely providing a Java application with a consistent, responsive interface that looks like that belonging to any other app on your d... | [
{
"answer_id": 7747,
"author": "basszero",
"author_id": 287,
"author_profile": "https://Stackoverflow.com/users/287",
"pm_score": 1,
"selected": false,
"text": "<p><a href=\"http://www.ej-technologies.com/products/install4j/overview.html\" rel=\"nofollow noreferrer\">Install4J</a>. Not f... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/998/"
] | I am writing an application in Java for the desktop using the Eclipse SWT library for GUI rendering. I think SWT helps Java get over the biggest hurdle for acceptance on the desktop: namely providing a Java application with a consistent, responsive interface that looks like that belonging to any other app on your deskt... | To follow up on pauxu's answer, I'm using launch4j and NSIS on a project of mine and thought it would be helpful to show just how I'm using them. Here's what I'm doing for Windows. BTW, I'm creating .app and .dmg for Mac, but haven't figured out what to do for Linux yet.
Project Copies of launch4j and NSIS
-----------... |
7,737 | <p>Is there a good way for displaying unicode text in opengl under Windows? For example, when you have to deal with different languages. The most common approach like</p>
<pre><code>#define FONTLISTRANGE 128
GLuint list;
list = glGenLists(FONTLISTRANGE);
wglUseFontBitmapsW(hDC, 0, FONTLISTRANGE, list);
</code></pre>
... | [
{
"answer_id": 7745,
"author": "basszero",
"author_id": 287,
"author_profile": "https://Stackoverflow.com/users/287",
"pm_score": 2,
"selected": false,
"text": "<p>You may have to generate you own \"glyph cache\" in texture memory as you go, potentially with some sort of LRU policy to av... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1007/"
] | Is there a good way for displaying unicode text in opengl under Windows? For example, when you have to deal with different languages. The most common approach like
```
#define FONTLISTRANGE 128
GLuint list;
list = glGenLists(FONTLISTRANGE);
wglUseFontBitmapsW(hDC, 0, FONTLISTRANGE, list);
```
just won't do because y... | You could also group the characters by language. Load each language table as needed, and when you need to switch languages, unload the previous language table and load the new one. |
7,758 | <p>I'm getting all learned up about binding in WPF. I'm having a lot of trouble debugging the parse errors in my xaml, though. Can somebody pretty please tell me what's wrong with this little piece? :</p>
<pre><code><Border Name="TrackBackground"
Margin="0"
CornerRadius="2"
Grid.R... | [
{
"answer_id": 7776,
"author": "Arcturus",
"author_id": 900,
"author_profile": "https://Stackoverflow.com/users/900",
"pm_score": 0,
"selected": false,
"text": "<p>First of all its a matter of casing...</p>\n\n<p>Change <pre><code>Part_Track</code></pre> to <pre><code>PART_Track</code></... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93/"
] | I'm getting all learned up about binding in WPF. I'm having a lot of trouble debugging the parse errors in my xaml, though. Can somebody pretty please tell me what's wrong with this little piece? :
```
<Border Name="TrackBackground"
Margin="0"
CornerRadius="2"
Grid.Row="1"
Grid.Col... | The ElementName property on a Binding is not supported in Silverlight.
You will notice, if you go into the code behind or inspect the Binding object in class explorer, it doesn't have a property named ElementName. |
7,773 | <p>I have a ASP.NET page with an asp:button that is not visible. I can't turn it visible with JavaScript because it is not rendered to the page.</p>
<p>What can I do to resolve this?</p>
| [
{
"answer_id": 7777,
"author": "Dave Ward",
"author_id": 60,
"author_profile": "https://Stackoverflow.com/users/60",
"pm_score": 6,
"selected": true,
"text": "<p>If you need to manipulate it on the client side, you can't use the Visible property on the server side. Instead, set its CSS ... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1013/"
] | I have a ASP.NET page with an asp:button that is not visible. I can't turn it visible with JavaScript because it is not rendered to the page.
What can I do to resolve this? | If you need to manipulate it on the client side, you can't use the Visible property on the server side. Instead, set its CSS display style to "none". For example:
```
<asp:Label runat="server" id="Label1" style="display: none;" />
```
Then, you could make it visible on the client side with:
```
document.getElementB... |
7,846 | <p>I would like to use a language that I am familiar with - Java, C#, Ruby, PHP, C/C++, although examples in any language or pseudocode are more than welcome.</p>
<p>What is the best way of splitting a large XML document into smaller sections that are still valid XML? For my purposes, I need to split them into roughly... | [
{
"answer_id": 7853,
"author": "DannySmurf",
"author_id": 1028,
"author_profile": "https://Stackoverflow.com/users/1028",
"pm_score": 3,
"selected": true,
"text": "<p>Well of course you can always extract the top-level elements (whether this is the granularity you want is up to you). In ... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572/"
] | I would like to use a language that I am familiar with - Java, C#, Ruby, PHP, C/C++, although examples in any language or pseudocode are more than welcome.
What is the best way of splitting a large XML document into smaller sections that are still valid XML? For my purposes, I need to split them into roughly thirds or... | Well of course you can always extract the top-level elements (whether this is the granularity you want is up to you). In C#, you'd use the XmlDocument class. For example, if your XML file looked something like this:
```
<Document>
<Piece>
Some text
</Piece>
<Piece>
Some other text
</Piece>
</Document... |
7,864 | <p>As I learn more and more about OOP, and start to implement various design patterns, I keep coming back to cases where people are hating on <a href="http://en.wikipedia.org/wiki/Active_record_pattern" rel="noreferrer">Active Record</a>.</p>
<p>Often, people say that it doesn't scale well (citing Twitter as their pri... | [
{
"answer_id": 7908,
"author": "Tim Sullivan",
"author_id": 722,
"author_profile": "https://Stackoverflow.com/users/722",
"pm_score": 2,
"selected": false,
"text": "<p>The main thing that I've seen with regards to complaints about Active Record is that when you create a model around a ta... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/751/"
] | As I learn more and more about OOP, and start to implement various design patterns, I keep coming back to cases where people are hating on [Active Record](http://en.wikipedia.org/wiki/Active_record_pattern).
Often, people say that it doesn't scale well (citing Twitter as their prime example) -- but nobody actually exp... | There's [ActiveRecord the Design Pattern](http://en.wikipedia.org/wiki/Active_record_pattern) and [ActiveRecord the Rails ORM Library](http://api.rubyonrails.com/classes/ActiveRecord/Base.html), and there's also a ton of knock-offs for .NET, and other languages.
These are all different things. They mostly follow that ... |
7,880 | <p>I want to open a file for reading, the C++ way. I need to be able to do it for:</p>
<ul>
<li><p>text files, which would involve some sort of read line function.</p></li>
<li><p>binary files, which would provide a way to read raw data into a <code>char*</code> buffer.</p></li>
</ul>
| [
{
"answer_id": 7886,
"author": "DannySmurf",
"author_id": 1028,
"author_profile": "https://Stackoverflow.com/users/1028",
"pm_score": 5,
"selected": true,
"text": "<p>There are three ways to do this, depending on your needs. You could use the old-school C way and call <code>fopen</code>/... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/432/"
] | I want to open a file for reading, the C++ way. I need to be able to do it for:
* text files, which would involve some sort of read line function.
* binary files, which would provide a way to read raw data into a `char*` buffer. | There are three ways to do this, depending on your needs. You could use the old-school C way and call `fopen`/`fread`/`fclose`, or you could use the C++ fstream facilities (`ifstream`/`ofstream`), or if you're using MFC, use the `CFile` class, which provides functions to accomplish actual file operations.
All of these... |
7,884 | <p>I've just come across this in a WHERE clause:</p>
<pre><code>AND NOT (t.id = @id)
</code></pre>
<p>How does this compare with:</p>
<pre><code>AND t.id != @id
</code></pre>
<p>Or with:</p>
<pre><code>AND t.id <> @id
</code></pre>
<p>I'd always write the latter myself, but clearly someone else thinks diffe... | [
{
"answer_id": 7887,
"author": "Tim Sullivan",
"author_id": 722,
"author_profile": "https://Stackoverflow.com/users/722",
"pm_score": 3,
"selected": false,
"text": "<p>There will be no performance hit, both statements are perfectly equal.</p>\n\n<p>HTH</p>\n"
},
{
"answer_id": 78... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1030/"
] | I've just come across this in a WHERE clause:
```
AND NOT (t.id = @id)
```
How does this compare with:
```
AND t.id != @id
```
Or with:
```
AND t.id <> @id
```
I'd always write the latter myself, but clearly someone else thinks differently. Is one going to perform any better than the other? I know that using `... | These 3 will get the same exact execution plan
```
declare @id varchar(40)
select @id = '172-32-1176'
select * from authors
where au_id <> @id
select * from authors
where au_id != @id
select * from authors
where not (au_id = @id)
```
It will also depend on the selectivity of the index itself of course. I always u... |
7,885 | <p>Perl has OOP features, but they are somewhat rarely used. How do you create and use Perl objects with methods and properties?</p>
| [
{
"answer_id": 7960,
"author": "Bruce Alderman",
"author_id": 311,
"author_profile": "https://Stackoverflow.com/users/311",
"pm_score": 2,
"selected": false,
"text": "<p>The official tutorial on the <a href=\"http://search.cpan.org/dist/perl/pod/perltoot.pod\" rel=\"nofollow noreferrer\"... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/432/"
] | Perl has OOP features, but they are somewhat rarely used. How do you create and use Perl objects with methods and properties? | You should definitely take a look at [`Moose`](http://search.cpan.org/perldoc?Moose).
```
package Point;
use Moose; # automatically turns on strict and warnings
has 'x' => (is => 'rw', isa => 'Int');
has 'y' => (is => 'rw', isa => 'Int');
sub clear {
my $self = shift;
$self->x(0);
$self->y(0);
}
```
Mo... |
7,917 | <p>I'm importing some data from a <code>CSV</code> file, and numbers that are larger than <code>1000</code> get turned into <code>1,100</code> etc. </p>
<p>What's a good way to remove both the quotes and the comma from this so I can put it into an <code>int</code> field?</p>
<p><strong>Edit:</strong> </p>
<p>The dat... | [
{
"answer_id": 7934,
"author": "Eldila",
"author_id": 889,
"author_profile": "https://Stackoverflow.com/users/889",
"pm_score": 0,
"selected": false,
"text": "<p>You could use this perl command.</p>\n\n<pre><code>Perl -lne 's/[,|\"]//; print' file.txt > newfile.txt\n</code></pre>\n\n<... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/402/"
] | I'm importing some data from a `CSV` file, and numbers that are larger than `1000` get turned into `1,100` etc.
What's a good way to remove both the quotes and the comma from this so I can put it into an `int` field?
**Edit:**
The data is actually already in a MySQL table, so I need to be able to this using SQL. S... | Here is a good case for regular expressions. You can run a find and replace on the data either before you import (easier) or later on if the SQL import accepted those characters (not nearly as easy). But in either case, you have any number of methods to do a find and replace, be it editors, scripting languages, GUI pro... |
7,933 | <p>Is there some means of querying the system tables to establish which tables are using what locking schemes? I took a look at the columns in <strong>sysobjects</strong> but nothing jumped out.</p>
| [
{
"answer_id": 7935,
"author": "SQLMenace",
"author_id": 740,
"author_profile": "https://Stackoverflow.com/users/740",
"pm_score": 0,
"selected": false,
"text": "<p>take a look at the syslockinfo and syslocks system tables\nyou can also run the sp_lock proc</p>\n"
},
{
"answer_id... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1030/"
] | Is there some means of querying the system tables to establish which tables are using what locking schemes? I took a look at the columns in **sysobjects** but nothing jumped out. | aargh, just being an idiot:
```
SELECT name, lockscheme(name)
FROM sysobjects
WHERE type="U"
ORDER BY name
``` |
7,937 | <p>When using IE, you cannot put an absolutely positioned div over a select input element. That's because the select element is considered an ActiveX object and is on top of every HTML element in the page.</p>
<p>I already saw people hiding selects when opening a popup div, that leads to pretty bad user experience hav... | [
{
"answer_id": 7942,
"author": "TheSmurf",
"author_id": 1975282,
"author_profile": "https://Stackoverflow.com/users/1975282",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think there is. I've tried to solve this problem at my job. Hiding the select control was the best we could ... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/268/"
] | When using IE, you cannot put an absolutely positioned div over a select input element. That's because the select element is considered an ActiveX object and is on top of every HTML element in the page.
I already saw people hiding selects when opening a popup div, that leads to pretty bad user experience having contro... | I don't know anything better than an Iframe
But it does occur to me that this could be added in JS by looking for a couple of variables
1. IE 6
2. A high Z-Index (you tend to have to set a z-index if you are floating a div over)
3. A box element
Then a script that looks for these items and just add an iframe layer ... |
7,981 | <p>I'm working on bringing some old code from 1998 up to the 21st century. One of the first steps in the process is converting the printf statements to <a href="http://qt-project.org/doc/qt-4.8/qstring.html" rel="nofollow noreferrer">QString</a> variables. No matter how many times I look back at printf though, I alwa... | [
{
"answer_id": 7988,
"author": "TheSmurf",
"author_id": 1975282,
"author_profile": "https://Stackoverflow.com/users/1975282",
"pm_score": 0,
"selected": false,
"text": "<p>a. decimal, four significant digits </p>\n\n<p>b. Not sure</p>\n\n<p>c. hex, minimum 4 characters </p>\n\n<p>d. Also... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25/"
] | I'm working on bringing some old code from 1998 up to the 21st century. One of the first steps in the process is converting the printf statements to [QString](http://qt-project.org/doc/qt-4.8/qstring.html) variables. No matter how many times I look back at printf though, I always end up forgetting one thing or the othe... | Danny is mostly right.
a. unsigned decimal, minimum 4 characters, space padded
b. floating point, minimum 16 digits before the decimal (0 padded), 1 digit after the decimal
c. hex, minimum 4 characters, 0 padded, letters are printed in upper case
d. same as above, but minimum 2 characters
e. e is assumed t... |
7,991 | <p>I'm using the .NETCF (Windows Mobile) <code>Graphics</code> class and the <code>DrawString()</code> method to render a single character to the screen.</p>
<p>The problem is that I can't seem to get it centred properly. No matter what I set for the Y coordinate of the location of the string render, it always comes o... | [
{
"answer_id": 8010,
"author": "John",
"author_id": 33,
"author_profile": "https://Stackoverflow.com/users/33",
"pm_score": 2,
"selected": false,
"text": "<p>You can use an instance of the <code>StringFormat</code> object passed into the <code>DrawString</code> method to center the text.... | 2008/08/11 | [
"https://Stackoverflow.com/questions/7991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | I'm using the .NETCF (Windows Mobile) `Graphics` class and the `DrawString()` method to render a single character to the screen.
The problem is that I can't seem to get it centred properly. No matter what I set for the Y coordinate of the location of the string render, it always comes out lower than that and the large... | Through a combination of the suggestions I got, I came up with this:
```
private void DrawLetter()
{
Graphics g = this.CreateGraphics();
float width = ((float)this.ClientRectangle.Width);
float height = ((float)this.ClientRectangle.Width);
float emSize = height;
Font ... |
8,004 | <p>I use <a href="http://rsync.samba.org/" rel="nofollow noreferrer">rsync</a> to synchronize files to Windows clients in a server agnostic way. What methods are available to send the progress of rsync to the parent process for display in a gui progress bar?</p>
<p>I imagine two or three choices exist. (1) Watch STDOU... | [
{
"answer_id": 8007,
"author": "Lars Mæhlum",
"author_id": 960,
"author_profile": "https://Stackoverflow.com/users/960",
"pm_score": 1,
"selected": false,
"text": "<p>.NET has a pretty straight forward way to read and watch STDOUT. <br />\nI guess this would be the cleanest way, since it... | 2008/08/11 | [
"https://Stackoverflow.com/questions/8004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1027/"
] | I use [rsync](http://rsync.samba.org/) to synchronize files to Windows clients in a server agnostic way. What methods are available to send the progress of rsync to the parent process for display in a gui progress bar?
I imagine two or three choices exist. (1) Watch STDOUT (2) Watch rsync.exe log file, similar to unix... | For this type of tasks, I use my own [AutoIt](http://www.autoitscript.com/autoit3/) script (freeware, Windows only). The script redirects the standard output into a graphical window, displaying it with the ability to scroll back, etc (very useful in long processes like XCOPYs / PKZIPs to check if any error did happen).... |
8,021 | <p>I'd like to allow a user to set up an SSH tunnel to a particular machine on a particular port (say, 5000), but I want to restrict this user as much as possible. (Authentication will be with public/private keypair).</p>
<p>I know I need to edit the relevant ~/.ssh/authorized_keys file, but I'm not sure exactly what ... | [
{
"answer_id": 8023,
"author": "Michael Pryor",
"author_id": 245,
"author_profile": "https://Stackoverflow.com/users/245",
"pm_score": -1,
"selected": false,
"text": "<p>See <a href=\"http://www.networknewz.com/networknewz-10-20030707AuthenticatingbyPublicKeyOpenSSH.html\" rel=\"nofollow... | 2008/08/11 | [
"https://Stackoverflow.com/questions/8021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/742/"
] | I'd like to allow a user to set up an SSH tunnel to a particular machine on a particular port (say, 5000), but I want to restrict this user as much as possible. (Authentication will be with public/private keypair).
I know I need to edit the relevant ~/.ssh/authorized\_keys file, but I'm not sure exactly what content t... | On Ubuntu 11.10, I found I could block ssh commands, sent with and without -T, and block scp copying, while allowing port forwarding to go through.
Specifically I have a redis-server on "somehost" bound to localhost:6379 that I wish to share securely via ssh tunnels to other hosts that have a keyfile and will ssh in ... |
8,042 | <p>The new extensions in .Net 3.5 allow functionality to be split out from interfaces.</p>
<p>For instance in .Net 2.0</p>
<pre><code>public interface IHaveChildren {
string ParentType { get; }
int ParentId { get; }
List<IChild> GetChildren()
}
</code></pre>
<p>Can (in 3.5) become:</p>
<pre><code... | [
{
"answer_id": 8054,
"author": "TheSmurf",
"author_id": 1975282,
"author_profile": "https://Stackoverflow.com/users/1975282",
"pm_score": 0,
"selected": false,
"text": "<p>One problem I can see is that, in a large company, this pattern could allow the code to become difficult (if not imp... | 2008/08/11 | [
"https://Stackoverflow.com/questions/8042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905/"
] | The new extensions in .Net 3.5 allow functionality to be split out from interfaces.
For instance in .Net 2.0
```
public interface IHaveChildren {
string ParentType { get; }
int ParentId { get; }
List<IChild> GetChildren()
}
```
Can (in 3.5) become:
```
public interface IHaveChildren {
string Paren... | I think the judicious use of extension methods put interfaces on a more equatable position with (abstract) base classes.
**Versioning.** One advantage base classes have over interfaces is that you can easily add new virtual members in a later version, whereas adding members to an interface will break implementers buil... |
8,128 | <p>How do I calculate the CRC32 (Cyclic Redundancy Checksum) of a string in .NET?</p>
| [
{
"answer_id": 8130,
"author": "Pete",
"author_id": 76,
"author_profile": "https://Stackoverflow.com/users/76",
"pm_score": 6,
"selected": true,
"text": "<p>This guy seems to have your answer.</p>\n\n<blockquote>\n <p><a href=\"https://damieng.com/blog/2006/08/08/calculating_crc32_in_c_... | 2008/08/11 | [
"https://Stackoverflow.com/questions/8128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17/"
] | How do I calculate the CRC32 (Cyclic Redundancy Checksum) of a string in .NET? | This guy seems to have your answer.
>
> <https://damieng.com/blog/2006/08/08/calculating_crc32_in_c_and_net>
>
>
>
And in case the blog ever goes away or breaks the url, here's the github link:
>
> <https://github.com/damieng/DamienGKit/blob/master/CSharp/DamienG.Library/Security/Cryptography/Crc32.cs>
>
>
> ... |
8,145 | <p>How can I find the high water mark (the historical maximum number of concurrent users) in an <strong>oracle database (9i)</strong>.</p>
| [
{
"answer_id": 8161,
"author": "ninesided",
"author_id": 1030,
"author_profile": "https://Stackoverflow.com/users/1030",
"pm_score": 4,
"selected": true,
"text": "<p>This should do the trick:</p>\n\n<pre><code>SELECT sessions_highwater FROM v$license;\n</code></pre>\n"
},
{
"answ... | 2008/08/11 | [
"https://Stackoverflow.com/questions/8145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685/"
] | How can I find the high water mark (the historical maximum number of concurrent users) in an **oracle database (9i)**. | This should do the trick:
```
SELECT sessions_highwater FROM v$license;
``` |
8,147 | <p>Using <a href="http://www.codeplex.com/aspnet" rel="nofollow noreferrer">preview 4</a> of <a href="http://asp.net/mvc" rel="nofollow noreferrer">ASP.NET MVC</a>
Code like:</p>
<pre><code><%= Html.CheckBox( "myCheckBox", "Click Here", "True", false ) %>
</code></pre>
<p>only outputs:</p>
<pre><code><inpu... | [
{
"answer_id": 8171,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 0,
"selected": false,
"text": "<p>Apparently this is a bug. Because they are adding it to potential rendering values, they just forgot to include it. I wo... | 2008/08/11 | [
"https://Stackoverflow.com/questions/8147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/193/"
] | Using [preview 4](http://www.codeplex.com/aspnet) of [ASP.NET MVC](http://asp.net/mvc)
Code like:
```
<%= Html.CheckBox( "myCheckBox", "Click Here", "True", false ) %>
```
only outputs:
```
<input type="checkbox" value="True" name="myCheckBox" />
```
There is a `name` there for the form post back but no `id` ... | Try this:
```
<%= Html.CheckBox("myCheckbox", "Click here", "True", false, new {_id ="test" })%>
```
For any keyword you can use an underscore before the name of the attribute. Instead of class you use \_class. Since class is a keyword in C#, and also the name of the attribute in HTML. Now, "id" isn't a keyword in ... |
8,154 | <p>I'm using Pylons (a python framework) to serve a simple web application, but it seems to die from time to time, with this in the error log: <code>(2006, 'MySQL server has gone away')</code></p>
<p>I did a bit of checking, and saw that this was because the connections to MySQL were not being renewed. This shouldn't ... | [
{
"answer_id": 15261,
"author": "Jon Bright",
"author_id": 1813,
"author_profile": "https://Stackoverflow.com/users/1813",
"pm_score": 2,
"selected": false,
"text": "<p>You might want to check MySQL's timeout variables:</p>\n\n<pre><code>show variables like '%timeout%';\n</code></pre>\n\... | 2008/08/11 | [
"https://Stackoverflow.com/questions/8154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/736/"
] | I'm using Pylons (a python framework) to serve a simple web application, but it seems to die from time to time, with this in the error log: `(2006, 'MySQL server has gone away')`
I did a bit of checking, and saw that this was because the connections to MySQL were not being renewed. This shouldn't be a problem though, ... | I think I fixed it. It's turns out I had a simple config error. My ini file read:
```
sqlalchemy.default.url = [connection string here]
sqlalchemy.pool_recycle = 1800
```
The problem is that my `environment.py` file declared that the engine would only map keys with the prefix: `sqlalchemy.default` so `pool_recycle` ... |
8,213 | <p>I need to import a csv file into <strong>Firebird</strong> and I've spent a couple of hours trying out some tools and none fit my needs.</p>
<p>The main problem is that all the tools I've been trying like <a href="http://www.sqlmanager.net/products/ibfb/dataimport" rel="noreferrer">EMS Data Import</a> and <a href="... | [
{
"answer_id": 8216,
"author": "Vaibhav",
"author_id": 380,
"author_profile": "https://Stackoverflow.com/users/380",
"pm_score": 3,
"selected": false,
"text": "<p>Well, if it's a CSV, and it this is a one time process, open up the file in Excel, and then write formulas to populate your d... | 2008/08/11 | [
"https://Stackoverflow.com/questions/8213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/727/"
] | I need to import a csv file into **Firebird** and I've spent a couple of hours trying out some tools and none fit my needs.
The main problem is that all the tools I've been trying like [EMS Data Import](http://www.sqlmanager.net/products/ibfb/dataimport) and [Firebird Data Wizard](http://www.sqlmaestro.com/products/fi... | It's a bit crude - but for one off jobs, I sometimes use Excel.
If you import the CSV file into Excel, you can create a formula which creates an INSERT statement by using string concatenation in the formula. So - if your CSV file has 3 columns that appear in columns A, B, and C in Excel, you could write a formula like... |
8,236 | <p>How can I figure out the size of a file, in bytes?</p>
<pre><code>#include <stdio.h>
unsigned int fsize(char* file){
//what goes here?
}
</code></pre>
| [
{
"answer_id": 8241,
"author": "Ecton",
"author_id": 457,
"author_profile": "https://Stackoverflow.com/users/457",
"pm_score": 2,
"selected": false,
"text": "<p>If you're fine with using the std c library:</p>\n\n<pre><code>#include <sys/stat.h>\noff_t fsize(char *file) {\n stru... | 2008/08/11 | [
"https://Stackoverflow.com/questions/8236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/432/"
] | How can I figure out the size of a file, in bytes?
```
#include <stdio.h>
unsigned int fsize(char* file){
//what goes here?
}
``` | On Unix-like systems, you can use POSIX system calls: [`stat` on a path](https://en.wikipedia.org/wiki/Stat_(system_call)), or `fstat` on an already-open file descriptor (POSIX [man page](https://man7.org/linux/man-pages/man3/fstat.3p.html), Linux [man page](https://man7.org/linux/man-pages/man2/lstat.2.html)).
(Get... |
8,348 | <p>Imagine an object you are working with has a collection of other objects associated with it, for example, the Controls collection on a WinForm. You want to check for a certain object in the collection, but the collection doesn't have a <code>Contains()</code> method. There are several ways of dealing with this.</p... | [
{
"answer_id": 8350,
"author": "Ryan Fox",
"author_id": 55,
"author_profile": "https://Stackoverflow.com/users/55",
"pm_score": 0,
"selected": false,
"text": "<p>If, while writing your code, you expect this object to be in the collection, and then during runtime you find that it isn't, I... | 2008/08/11 | [
"https://Stackoverflow.com/questions/8348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/940/"
] | Imagine an object you are working with has a collection of other objects associated with it, for example, the Controls collection on a WinForm. You want to check for a certain object in the collection, but the collection doesn't have a `Contains()` method. There are several ways of dealing with this.
* Implement your ... | I would have to say that this is pretty bad practice. Whilst some people might be happy to say that looping through the collection is less efficient to throwing an exception, there is an overhead to throwing an exception. I would also question why you are using a collection to access an item by key when you would be be... |
8,355 | <p>What is the best way to transparently rewrite a URL over an SSL connection with Apache 2.2?</p>
<p>Apache 2 does not natively support multiple name-based virtual hosts for an SSL connection and I have heard that mod_rewrite can help with this. I would like to do something like this:</p>
<p>I have set up the server... | [
{
"answer_id": 8389,
"author": "UnkwnTech",
"author_id": 115,
"author_profile": "https://Stackoverflow.com/users/115",
"pm_score": 0,
"selected": false,
"text": "<p>There is apaches mod_rewrite, or you could setup apache to direct <a href=\"https://dbadmin.example.com\" rel=\"nofollow no... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277/"
] | What is the best way to transparently rewrite a URL over an SSL connection with Apache 2.2?
Apache 2 does not natively support multiple name-based virtual hosts for an SSL connection and I have heard that mod\_rewrite can help with this. I would like to do something like this:
I have set up the server so that the sit... | Configure a single VirtualHost to serve both secure.example.com and dbadmin.example.com (making it the only \*:443 VirtualHost achieves this). You can then use [mod\_rewrite](http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html) to adjust the URI for requests to dbadmin.example.com:
```
<VirtualHost *:443>
Server... |
8,371 | <p>How do you redirect HTTPS to HTTP?. That is, the opposite of what (seemingly) everyone teaches.</p>
<p>I have a server on HTTPS for which I paid an SSL certification for and a mirror for which I haven't and keep around for just for emergencies so it doesn't merit getting a certification for.</p>
<p>On my client's ... | [
{
"answer_id": 8380,
"author": "ejunker",
"author_id": 796,
"author_profile": "https://Stackoverflow.com/users/796",
"pm_score": 8,
"selected": true,
"text": "<p>This has not been tested but I think this should work using mod_rewrite</p>\n\n<pre><code>RewriteEngine On\nRewriteCond %{HTTP... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547/"
] | How do you redirect HTTPS to HTTP?. That is, the opposite of what (seemingly) everyone teaches.
I have a server on HTTPS for which I paid an SSL certification for and a mirror for which I haven't and keep around for just for emergencies so it doesn't merit getting a certification for.
On my client's desktops I have S... | This has not been tested but I think this should work using mod\_rewrite
```
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}
``` |
8,441 | <p>I'm using <code>.htaccess</code> and <code>mod_rewrite</code> to point to files that reside behind the DocumentRoot. My folder structure looks like this:</p>
<pre><code>home/
webroot/
other_files/
</code></pre>
<p>I have a <code>.htaccess</code> file in webroot with the following content:</p>
<pre>
Rewrit... | [
{
"answer_id": 8454,
"author": "Ryan Ahearn",
"author_id": 75,
"author_profile": "https://Stackoverflow.com/users/75",
"pm_score": 5,
"selected": true,
"text": "<p>I believe you need to add a section with </p>\n\n<pre><code><Directory \"/home/other_files\">\n (options)\n</Direc... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57/"
] | I'm using `.htaccess` and `mod_rewrite` to point to files that reside behind the DocumentRoot. My folder structure looks like this:
```
home/
webroot/
other_files/
```
I have a `.htaccess` file in webroot with the following content:
```
RewriteEngine on
RewriteRule ^(.*)$ /home/other_files/$1
```
If I tr... | I believe you need to add a section with
```
<Directory "/home/other_files">
(options)
</Directory>
```
to your server configuration before apache will be able to serve anything from it. For an example, my DocumentRoot is /var/www but there is this section in the default available site:
```
Alias /doc/ "/usr/sha... |
8,447 | <p>From time to time I see an enum like the following:</p>
<pre><code>[Flags]
public enum Options
{
None = 0,
Option1 = 1,
Option2 = 2,
Option3 = 4,
Option4 = 8
}
</code></pre>
<p>I don't understand what exactly the <code>[Flags]</code> attribute does.</p>
<p>Anyone have a good explanation or... | [
{
"answer_id": 8455,
"author": "Jay Mooney",
"author_id": 733,
"author_profile": "https://Stackoverflow.com/users/733",
"pm_score": 4,
"selected": false,
"text": "<p>Flags allow you to use bitmasking inside your enumeration. This allows you to combine enumeration values, while retaining... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/580/"
] | From time to time I see an enum like the following:
```
[Flags]
public enum Options
{
None = 0,
Option1 = 1,
Option2 = 2,
Option3 = 4,
Option4 = 8
}
```
I don't understand what exactly the `[Flags]` attribute does.
Anyone have a good explanation or example they could post? | The `[Flags]` attribute should be used whenever the enumerable represents a collection of possible values, rather than a single value. Such collections are often used with bitwise operators, for example:
```
var allowedColors = MyColor.Red | MyColor.Green | MyColor.Blue;
```
Note that the `[Flags]` attribute **doesn... |
8,448 | <p>Anyone have a decent example, preferably practical/useful, they could post demonstrating the concept?</p>
| [
{
"answer_id": 8457,
"author": "Patrick",
"author_id": 429,
"author_profile": "https://Stackoverflow.com/users/429",
"pm_score": 2,
"selected": false,
"text": "<p>It's a fairly simple process. Take a function, bind one of its arguments and return a new function. For example:</p>\n\n<pre>... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/580/"
] | Anyone have a decent example, preferably practical/useful, they could post demonstrating the concept? | >
> (Edit: a small [Ocaml FP Koan](http://web.archive.org/web/20041012103936/http%3A//www.bagley.org/~doug/ocaml/Notes/okoans.shtml) to start things off)
>
>
>
> >
> > **The Koan of Currying (A koan about food, that is not about food)**
> >
> >
> >
> > >
> > > A student came to Jacques Garrigue and said, "I do... |
8,451 | <p>I want to create an allocator which provides memory with the following attributes:</p>
<ul>
<li>cannot be paged to disk. </li>
<li>is incredibly hard to access through an attached debugger</li>
</ul>
<p>The idea is that this will contain sensitive information (like licence information) which should be inaccessi... | [
{
"answer_id": 8476,
"author": "Mark Harrison",
"author_id": 116,
"author_profile": "https://Stackoverflow.com/users/116",
"pm_score": 2,
"selected": false,
"text": "<p>What you are asking for is handled at the OS level. Once the data is in your program, it is liable to be paged out.</p... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/716/"
] | I want to create an allocator which provides memory with the following attributes:
* cannot be paged to disk.
* is incredibly hard to access through an attached debugger
The idea is that this will contain sensitive information (like licence information) which should be inaccessible to the user. I have done the usual ... | You can't really protect against memory access. You can probably prevent paging if you are running as an admin or as the system, but you cannot prevent the admin or system from reading your memory. Even if you could somehow completely block other processes from reading your memory (which you can't), another process cou... |
8,452 | <p>I've done some WPF programing and one thing I never got was the command pattern. Every example seems to be for built in ones, edit, cut, paste. Anyone have an example or suggestion of best practice for custom commands?</p>
| [
{
"answer_id": 8471,
"author": "Nidonocu",
"author_id": 483,
"author_profile": "https://Stackoverflow.com/users/483",
"pm_score": 6,
"selected": true,
"text": "<p>Ah ha! A question I can answer! Firstly, I should mention that I have personally found it easier to define and hook up comman... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/580/"
] | I've done some WPF programing and one thing I never got was the command pattern. Every example seems to be for built in ones, edit, cut, paste. Anyone have an example or suggestion of best practice for custom commands? | Ah ha! A question I can answer! Firstly, I should mention that I have personally found it easier to define and hook up commands in code rather than in XAML. It allows me to hook up the handlers for the commands a little more flexibly than an all XAML approach does.
You should work out what commands you want to have an... |
8,472 | <p>It looks like we'll be adding <a href="http://en.wikipedia.org/wiki/Captcha" rel="noreferrer">CAPTCHA</a> support to Stack Overflow. This is necessary to prevent bots, spammers, and other malicious scripted activity. We only want human beings to post or edit things here!</p>
<p>We'll be using a JavaScript (jQuery) ... | [
{
"answer_id": 8474,
"author": "Jeff Atwood",
"author_id": 1,
"author_profile": "https://Stackoverflow.com/users/1",
"pm_score": 2,
"selected": false,
"text": "<p>Someone also suggest the Raphael JavaScript library, which apparently let you draw on the client in all popular browsers:</p>... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1/"
] | It looks like we'll be adding [CAPTCHA](http://en.wikipedia.org/wiki/Captcha) support to Stack Overflow. This is necessary to prevent bots, spammers, and other malicious scripted activity. We only want human beings to post or edit things here!
We'll be using a JavaScript (jQuery) CAPTCHA as a first line of defense:
<... | [A method that I have developed](http://gatekiller.co.uk/Post/JavaScript_Captcha) and which seems to work perfectly (although I probably don't get as much comment spam as you), is to have a hidden field and fill it with a bogus value e.g.:
```html
<input type="hidden" name="antispam" value="lalalala" />
```
I then h... |
8,485 | <p>I'm using ASP.NET MVC Preview 4 and would like to know how to use the routing engine for form submissions.</p>
<p>For example, I have a route like this:</p>
<pre><code>routes.MapRoute(
"TestController-TestAction",
"TestController.mvc/TestAction/{paramName}",
new { controller = "... | [
{
"answer_id": 8495,
"author": "Haacked",
"author_id": 598,
"author_profile": "https://Stackoverflow.com/users/598",
"pm_score": 2,
"selected": false,
"text": "<p>In your route, get rid of the {paramName} part of the URL. It should be:</p>\n\n<p>TestController.mvc/TestAction</p>\n\n<p>As... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/364/"
] | I'm using ASP.NET MVC Preview 4 and would like to know how to use the routing engine for form submissions.
For example, I have a route like this:
```
routes.MapRoute(
"TestController-TestAction",
"TestController.mvc/TestAction/{paramName}",
new { controller = "TestController", acti... | Solution:
```
public ActionResult TestAction(string paramName)
{
if (!String.IsNullOrEmpty(Request["paramName"]))
{
return RedirectToAction("TestAction", new { paramName = Request["paramName"]});
}
/* ... */
}
``` |
8,493 | <p>Are there any handy general items you put in your .procmailrc file?</p>
| [
{
"answer_id": 8629,
"author": "Marie Fischer",
"author_id": 719,
"author_profile": "https://Stackoverflow.com/users/719",
"pm_score": 3,
"selected": false,
"text": "<p>Just simple things - move messages to appropriate folders, forward some stuff to an email2sms address, move spam to spa... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/459/"
] | Are there any handy general items you put in your .procmailrc file? | Many mailers prefix a mail's subject with "Re: " when replying, if that prefix isn't already there. German Outlook instead prefixes with "AW: " (for "AntWort") if that prefix isn't already there. Unfortunately, these two behaviours clash, resulting in mail subjects like "Re: AW: Re: AW: Re: AW: Re: AW: Lunch". So I now... |
8,532 | <p>I've had an app doing prefix searches for a while. Recently the index size was increased and it turned out that some prefixes were too darned numerous for lucene to handle. It kept throwing me a <a href="http://web.archive.org/web/20080901205009/http://lucene.apache.org:80/java/2_3_2/api/core/org/apache/lucene/sear... | [
{
"answer_id": 9085,
"author": "Ryan Ahearn",
"author_id": 75,
"author_profile": "https://Stackoverflow.com/users/75",
"pm_score": 4,
"selected": true,
"text": "<p>I've hit this before. It has to do with the fact that lucene, under the covers, turns many (all?) things into boolean queri... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/459/"
] | I've had an app doing prefix searches for a while. Recently the index size was increased and it turned out that some prefixes were too darned numerous for lucene to handle. It kept throwing me a [Too Many Clauses](http://web.archive.org/web/20080901205009/http://lucene.apache.org:80/java/2_3_2/api/core/org/apache/lucen... | I've hit this before. It has to do with the fact that lucene, under the covers, turns many (all?) things into boolean queries when you call Query.rewrite()
From: <http://web.archive.org/web/20110915061619/http://lucene.apache.org:80/java/2_2_0/api/org/apache/lucene/search/Query.html>
```
public Query rewrite(IndexRea... |
8,549 | <p>Is there any Visual Studio Add-In that can do the remove method refactoring?<br>
Suppose you have the following method: </p>
<pre><code>Result DoSomething(parameters)
{
return ComputeResult(parameters);
}
</code></pre>
<p>Or the variant where Result is void.</p>
<p>The purpose of the refactoring is t... | [
{
"answer_id": 8551,
"author": "Lars Mæhlum",
"author_id": 960,
"author_profile": "https://Stackoverflow.com/users/960",
"pm_score": 1,
"selected": false,
"text": "<p>When it comes to refactoring like that, try out <a href=\"http://www.jetbrains.com/resharper/index.html\" rel=\"nofollow ... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1065/"
] | Is there any Visual Studio Add-In that can do the remove method refactoring?
Suppose you have the following method:
```
Result DoSomething(parameters)
{
return ComputeResult(parameters);
}
```
Or the variant where Result is void.
The purpose of the refactoring is to replace all the calls to DoSometh... | If I understand the question, then Resharper calls this 'inline method' - `Ctrl` - `R` + `I` |
8,566 | <p>First off, this is a question about a desktop application using Windows Forms, not an <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">ASP.NET</a> question.</p>
<p>I need to interact with controls on other forms. I am trying to access the controls by using, for example, the following...</p>
... | [
{
"answer_id": 8567,
"author": "Rob Cooper",
"author_id": 832,
"author_profile": "https://Stackoverflow.com/users/832",
"pm_score": 4,
"selected": false,
"text": "<p>I personally would recommend <em>NOT</em> doing it... If it's responding to some sort of action and it needs to change its... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/551/"
] | First off, this is a question about a desktop application using Windows Forms, not an [ASP.NET](http://en.wikipedia.org/wiki/ASP.NET) question.
I need to interact with controls on other forms. I am trying to access the controls by using, for example, the following...
```
otherForm.Controls["nameOfControl"].Visible = ... | Instead of making the control public, you can create a property that controls its visibility:
```
public bool ControlIsVisible
{
get { return control.Visible; }
set { control.Visible = value; }
}
```
This creates a proper accessor to that control that won't expose the control's whole set of properties. |
8,569 | <p>I'm currently trying to get into the Java EE development with the Spring framework. As I'm new to Spring, it is hard to imaging how a good running project should start off.</p>
<p>Do you have any <em>best practices</em>, tipps or major <em>DO NOTs</em> for a starter? How did you start with Spring - big project or s... | [
{
"answer_id": 8571,
"author": "Michael Neale",
"author_id": 699,
"author_profile": "https://Stackoverflow.com/users/699",
"pm_score": 2,
"selected": false,
"text": "<p>Whilst its been years since I have used spring, and I can't say I am a fan of it, I know that the App Fuse tool (<a hre... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/834/"
] | I'm currently trying to get into the Java EE development with the Spring framework. As I'm new to Spring, it is hard to imaging how a good running project should start off.
Do you have any *best practices*, tipps or major *DO NOTs* for a starter? How did you start with Spring - big project or small tutorial-like appli... | Small tip - I've found it helpful to modularize and clearly label my Spring xml context files based on application concern. Here's an example for a web app I worked on:
* `MyProject / src / main / resources / spring /`
+ ***datasource.xml*** - My single data source bean.
+ ***persistence.xml*** - My DAOs/Repositorie... |
8,625 | <p>I have a class that I want to use to store "properties" for another class. These properties simply have a name and a value. Ideally, what I would like is to be able to add <em>typed</em> properties, so that the "value" returned is always of the type that I want it to be.</p>
<p>The type should always be a primitive... | [
{
"answer_id": 8632,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": false,
"text": "<p>You could possibly use a construct such as a <a href=\"http://www.boost.org/community/generic_programming.html#traits\" ... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/832/"
] | I have a class that I want to use to store "properties" for another class. These properties simply have a name and a value. Ideally, what I would like is to be able to add *typed* properties, so that the "value" returned is always of the type that I want it to be.
The type should always be a primitive. This class subc... | I am not sure whether I understood your intentions correctly, but let's see if this one helps.
```
public class TypedProperty<T> : Property where T : IConvertible
{
public T TypedValue
{
get { return (T)Convert.ChangeType(base.Value, typeof(T)); }
set { base.Value = value.ToString();}
}
}
... |
8,626 | <p>Is there anyplace where one can download a virtual machine containing a working install of some Linux distro with Globus Toolkit and some development tools (Java) for testing purposes? A real deployment of a grid is more complicated but I just need something portable, for development.</p>
| [
{
"answer_id": 8632,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": false,
"text": "<p>You could possibly use a construct such as a <a href=\"http://www.boost.org/community/generic_programming.html#traits\" ... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1065/"
] | Is there anyplace where one can download a virtual machine containing a working install of some Linux distro with Globus Toolkit and some development tools (Java) for testing purposes? A real deployment of a grid is more complicated but I just need something portable, for development. | I am not sure whether I understood your intentions correctly, but let's see if this one helps.
```
public class TypedProperty<T> : Property where T : IConvertible
{
public T TypedValue
{
get { return (T)Convert.ChangeType(base.Value, typeof(T)); }
set { base.Value = value.ToString();}
}
}
... |
8,651 | <p>I am trying to load Linq on my .Net 3.5 enabled web server by adding the following to my .aspx page:</p>
<pre><code><%@ Import Namespace="System.Query" %>
</code></pre>
<p>However, this fails and tells me it cannot find the namespace.</p>
<blockquote>
<p>The type or namespace name 'Query' does not exist i... | [
{
"answer_id": 8657,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 0,
"selected": false,
"text": "<p>The <code>var hello</code> stuff is compiler magic and will work without Linq.</p>\n\n<p>Try adding a reference to <code>System... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/383/"
] | I am trying to load Linq on my .Net 3.5 enabled web server by adding the following to my .aspx page:
```
<%@ Import Namespace="System.Query" %>
```
However, this fails and tells me it cannot find the namespace.
>
> The type or namespace name 'Query' does not exist in the namespace 'System'
>
>
>
I have also t... | >
> I have version 2 selected in IIS and I
>
>
>
Well, surely that's your problem? Select 3.5.
Actually, here's the real info:
<http://www.hanselman.com/blog/HowToSetAnIISApplicationOrAppPoolToUseASPNET35RatherThan20.aspx> |
8,669 | <p>I'm trying to write a Crystal Report which has totals grouped in a different way to the main report. The only way I've been able to do this so far is to use a subreport for the totals, but it means having to hit the data source again to retrieve the same data, which seems like nonsense. Here's a simplified example:<... | [
{
"answer_id": 8751,
"author": "N8g",
"author_id": 1104,
"author_profile": "https://Stackoverflow.com/users/1104",
"pm_score": 1,
"selected": false,
"text": "<p>The only way I can think of doing this without a second run through the data would be by creating some formulas to do running t... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1030/"
] | I'm trying to write a Crystal Report which has totals grouped in a different way to the main report. The only way I've been able to do this so far is to use a subreport for the totals, but it means having to hit the data source again to retrieve the same data, which seems like nonsense. Here's a simplified example:
``... | Hmm... as nice as it is to call the stored proc from the report and have it all contained in one location, however we found (like you) that you eventually hit a point where you can't get crystal to do what you want even tho the data is right there.
We ended up introducing a business layer which sits under the report a... |
8,681 | <p>If you're using Opera 9.5x you may notice that our client-side <a href="http://docs.jquery.com/Plugins/Validation" rel="noreferrer">JQuery.Validate</a> code is disabled here at Stack Overflow.</p>
<pre><code>function initValidation() {
if (navigator.userAgent.indexOf("Opera") != -1) return;
$("#post-text").... | [
{
"answer_id": 8712,
"author": "Neall",
"author_id": 619,
"author_profile": "https://Stackoverflow.com/users/619",
"pm_score": 0,
"selected": false,
"text": "<p>I can't seem to reproduce this bug. Can you give more details?</p>\n\n<p>I have my copy of Opera masquerading as Firefox so the... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1/"
] | If you're using Opera 9.5x you may notice that our client-side [JQuery.Validate](http://docs.jquery.com/Plugins/Validation) code is disabled here at Stack Overflow.
```
function initValidation() {
if (navigator.userAgent.indexOf("Opera") != -1) return;
$("#post-text").rules("add", { required: true, minlength: ... | turns out the problem was in the
```
{ debug : true }
```
option for the JQuery.Validate initializer. **With this removed, things work fine in Opera.** Thanks to Jörn Zaefferer for helping us figure this out!
Oh, and the $50 will be donated to the JQuery project. :) |
8,685 | <p>I'm trying to use <code>strtotime()</code> to respond to a button click to advance -1 and +1 days (two buttons) relative to the day advanced to on the previous click. </p>
<p><strong>Example:</strong> </p>
<ul>
<li>It's the 10th of the month, I click "-1 day" button, and now the date reads as the 9th. </li>
<li... | [
{
"answer_id": 8689,
"author": "Philip Reynolds",
"author_id": 1087,
"author_profile": "https://Stackoverflow.com/users/1087",
"pm_score": 1,
"selected": false,
"text": "<p>Kevin, you work off a solid absolute base (i.e. a date / time), not a relative time period. You then convert to the... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1149/"
] | I'm trying to use `strtotime()` to respond to a button click to advance -1 and +1 days (two buttons) relative to the day advanced to on the previous click.
**Example:**
* It's the 10th of the month, I click "-1 day" button, and now the date reads as the 9th.
* I click the "-1 day" button again and now the readout s... | Working from previous calls to the same script isn't really a good idea for this type of thing.
What you want to do is always pass two values to your script, the date, and the movement. (the below example is simplified so that you only pass the date, and it will always add one day to it)
Example
<http://www.site.com... |
8,691 | <p>For a C# UserControl on Windows Mobile (though please answer if you know it for full Windows...it might work) how do you change what shows up in the Designer Properties window for one of the Control's public Properties. For example:</p>
<pre><code>private Color blah = Color.Black;
public Color Blah
{
get { re... | [
{
"answer_id": 8693,
"author": "John",
"author_id": 33,
"author_profile": "https://Stackoverflow.com/users/33",
"pm_score": 3,
"selected": false,
"text": "<p><code>DesignerCategory</code> is used to say if the class is a form, component etc.</p>\n\n<p>For full windows the attribute you w... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | For a C# UserControl on Windows Mobile (though please answer if you know it for full Windows...it might work) how do you change what shows up in the Designer Properties window for one of the Control's public Properties. For example:
```
private Color blah = Color.Black;
public Color Blah
{
get { return this.blah;... | Is this of use to you? I am not into CF development, but it looks like you need to add some XML metadata to enable it:
<http://blogs.msdn.com/bluecollar/archive/2007/02/08/adding-compact-framework-design-time-attributes-or-more-fun-with-textboxes.aspx>
Interesting read.. Looks like a lot of design time support was st... |
8,692 | <p>What are the libraries that support XPath? Is there a full implementation? How is the library used? Where is its website?</p>
| [
{
"answer_id": 8699,
"author": "James Sulak",
"author_id": 207,
"author_profile": "https://Stackoverflow.com/users/207",
"pm_score": 6,
"selected": false,
"text": "<p>The <a href=\"http://lxml.de/\" rel=\"noreferrer\">lxml package</a> supports xpath. It seems to work pretty well, althou... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What are the libraries that support XPath? Is there a full implementation? How is the library used? Where is its website? | [libxml2](http://xmlsoft.org/python.html) has a number of advantages:
1. Compliance to the [spec](http://www.w3.org/TR/xpath)
2. Active development and a community participation
3. Speed. This is really a python wrapper around a C implementation.
4. Ubiquity. The libxml2 library is pervasive and thus well tested.
Dow... |
8,728 | <p>I've got an MDI application written in Delphi 2006 which runs XP with the default theme. </p>
<p>Is there a way of controlling the appearance of the MDI Children to avoid the large XP-style title bar on each window? </p>
<p>I've tried setting the <code>BorderStyle</code> of the <code>MDIChildren</code> to <code>bs... | [
{
"answer_id": 8792,
"author": "onnodb",
"author_id": 1037,
"author_profile": "https://Stackoverflow.com/users/1037",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think there is; in my experience, MDI in Delphi is very strictly limited and controlled by its implementation in the... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1008/"
] | I've got an MDI application written in Delphi 2006 which runs XP with the default theme.
Is there a way of controlling the appearance of the MDI Children to avoid the large XP-style title bar on each window?
I've tried setting the `BorderStyle` of the `MDIChildren` to `bsSizeToolWin` but they are still rendered as ... | All your need - overload procedure CreateWindowHandle, like this:
```
unit CHILDWIN;
interface
uses Windows, Classes, Graphics, Forms, Controls, StdCtrls;
type
TMDIChild = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
procedure CreateWindowHandle(const Params: TCreateP... |
8,763 | <p>I'm trying to rebuild an old metronome application that was originally written using <code>MFC</code> in C++ to be written in <code>.NET</code> using <code>C#</code>. One of the issues I'm running into is playing the midi files that are used to represent the metronome "clicks".</p>
<p>I've found a few articles onli... | [
{
"answer_id": 8773,
"author": "Whisk",
"author_id": 908,
"author_profile": "https://Stackoverflow.com/users/908",
"pm_score": 1,
"selected": false,
"text": "<p>I can't claim to know much about it, but I don't think it's that straightforward - Carl Franklin of <a href=\"http://www.dotnet... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1108/"
] | I'm trying to rebuild an old metronome application that was originally written using `MFC` in C++ to be written in `.NET` using `C#`. One of the issues I'm running into is playing the midi files that are used to represent the metronome "clicks".
I've found a few articles online about playing `MIDI` in .NET, but most o... | I think you'll need to p/invoke out to the windows api to be able to play midi files from .net.
This codeproject article does a good job on explaining how to do this:
[vb.net article to play midi files](http://www.codeproject.com/KB/audio-video/vbnetSoundClass.aspx)
To rewrite this is c# you'd need the following impo... |
8,790 | <p>I have a build script and as part of that script it copies a jar file to a directory, for ease lets call it the utils jar. the utils jar is built by another build script sitting in another directory. What im trying to do have my build script run the utils build script so that I can ensure the utils jar is up to da... | [
{
"answer_id": 8805,
"author": "Theo",
"author_id": 1109,
"author_profile": "https://Stackoverflow.com/users/1109",
"pm_score": 6,
"selected": true,
"text": "<p>I've got something similar set up: I have a main Ant build.xml which calls a separate build.xml that takes care of building my ... | 2008/08/12 | [
"https://Stackoverflow.com/questions/8790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/292/"
] | I have a build script and as part of that script it copies a jar file to a directory, for ease lets call it the utils jar. the utils jar is built by another build script sitting in another directory. What im trying to do have my build script run the utils build script so that I can ensure the utils jar is up to date.
... | I've got something similar set up: I have a main Ant build.xml which calls a separate build.xml that takes care of building my tests. This is how I do it:
```
<target name="build-tests">
<subant target="build">
<fileset dir="${test.home}" includes="build.xml"/>
</subant>
</target>
```
The trick is to u... |