qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
2,775
<p>Here's what I use:</p> <pre><code>SELECT CAST(FLOOR(CAST(getdate() as FLOAT)) as DATETIME) </code></pre> <p>I'm thinking there may be a better and more elegant way.</p> <p>Requirements:</p> <ul> <li>It has to be as fast as possible (the less casting, the better).</li> <li>The final result has to be a <code>datet...
[ { "answer_id": 2781, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Stackoverflow.com/users/91", "pm_score": 4, "selected": false, "text": "CAST FLOOR CAST Select Convert(varchar(11), getdate(),101)" }, { "answer_id": 3130, "author": "Marek Grzenkowicz"...
2008/08/05
[ "https://Stackoverflow.com/questions/2775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/434/" ]
2,780
<p>Let's say that we have an ARGB color:</p> <pre><code>Color argb = Color.FromARGB(127, 69, 12, 255); //Light Urple. </code></pre> <p>When this is painted on top of an existing color, the colors will blend. So when it is blended with white, the resulting color is <code>Color.FromARGB(255, 162, 133, 255);</code></p> ...
[ { "answer_id": 2789, "author": "Louis Brandy", "author_id": 2089740, "author_profile": "https://Stackoverflow.com/users/2089740", "pm_score": 5, "selected": true, "text": "alpha=argb.alpha()\nr = (alpha/255)*argb.r() + (1 - alpha/255)*blend.r()\ng = (alpha/255)*argb.g() + (1 - alpha/255)...
2008/08/05
[ "https://Stackoverflow.com/questions/2780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45/" ]
2,785
<p>Should you set all the objects to <code>null</code> (<code>Nothing</code> in VB.NET) once you have finished with them? </p> <p>I understand that in .NET it is essential to dispose of any instances of objects that implement the <code>IDisposable</code> interface to release some resources although the object can stil...
[ { "answer_id": 2794, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": -1, "selected": false, "text": ".dispose()" }, { "answer_id": 2813, "author": "Steve T", "author_id": 415, "author_profile": "https://St...
2008/08/05
[ "https://Stackoverflow.com/questions/2785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33/" ]
2,798
<p>I've always been intrigued by Map Routing, but I've never found any good introductory (or even advanced!) level tutorials on it. Does anybody have any pointers, hints, etc?</p> <p><strong>Update:</strong> I'm primarily looking for pointers as to how a map system is implemented (data structures, algorithms, etc).</p...
[ { "answer_id": 139714, "author": "Guillermo Phillips", "author_id": 441661, "author_profile": "https://Stackoverflow.com/users/441661", "pm_score": 2, "selected": false, "text": "nodes edges nodes route cost distance time NextNode node cost cost" }, { "answer_id": 7464631, "a...
2008/08/05
[ "https://Stackoverflow.com/questions/2798", "https://Stackoverflow.com", "https://Stackoverflow.com/users/116/" ]
2,804
<p>I have an application that displays an image inside of a Windows Forms <code>PictureBox</code> control. The <code>SizeMode</code> of the control is set to <code>Zoom</code> so that the image contained in the <code>PictureBox</code> will be displayed in an aspect-correct way regardless of the dimensions of the <code...
[ { "answer_id": 3078, "author": "fastcall", "author_id": 328, "author_profile": "https://Stackoverflow.com/users/328", "pm_score": 3, "selected": false, "text": "// Recompute the image scaling the zoom mode uses to fit the image on screen\nimageScale ::= min(pictureBox.width / image.width...
2008/08/05
[ "https://Stackoverflow.com/questions/2804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/328/" ]
2,811
<p>I have a table with a structure like the following:</p> <hr /> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>LocationID</th> <th>AccountNumber</th> </tr> </thead> <tbody> <tr> <td>long-guid-here</td> <td>12345</td> </tr> <tr> <td>long-guid-here</td> <td>54321</td> </tr> </tbody> </table> <...
[ { "answer_id": 2825, "author": "Chris Leon", "author_id": 289, "author_profile": "https://Stackoverflow.com/users/289", "pm_score": 3, "selected": true, "text": "SELECT\n 1 AS Tag,\n 0 AS Parent,\n AccountNumber AS [Root!1!AccountNumber!element]\nFROM\n Location.LocationMDAcc...
2008/08/05
[ "https://Stackoverflow.com/questions/2811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/448/" ]
2,815
<p>I would like to make a nightly cron job that fetches my stackoverflow page and diffs it from the previous day's page, so I can see a change summary of my questions, answers, ranking, etc.</p> <p>Unfortunately, I couldn't get the right set of cookies, etc, to make this work. Any ideas?</p> <p>Also, when the beta i...
[ { "answer_id": 2818, "author": "sparkes", "author_id": 269, "author_profile": "https://Stackoverflow.com/users/269", "pm_score": 2, "selected": false, "text": "--load-cookies (filename)\n" }, { "answer_id": 2819, "author": "Grant", "author_id": 30, "author_profile": "...
2008/08/05
[ "https://Stackoverflow.com/questions/2815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/116/" ]
2,840
<p>How do I page results in SQL Server 2005?</p> <p>I tried it in SQL Server 2000, but there was no reliable way to do this. I'm now wondering if SQL Server 2005 has any built in method?</p> <p>What I mean by paging is, for example, if I list users by their username, I want to be able to only return the first 10 reco...
[ { "answer_id": 2843, "author": "Pat", "author_id": 36, "author_profile": "https://Stackoverflow.com/users/36", "pm_score": 6, "selected": true, "text": "the Row_Number() SELECT Row_Number() OVER(ORDER BY UserName) As RowID, UserFirstName, UserLastName\nFROM Users\n RowID SELECT * \nFROM ...
2008/08/05
[ "https://Stackoverflow.com/questions/2840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
2,844
<pre><code>#include &lt;stdio.h&gt; int main() { unsigned long long int num = 285212672; //FYI: fits in 29 bits int normalInt = 5; printf("My number is %d bytes wide and its value is %ul. A normal number is %d.\n", sizeof(num), num, normalInt); return 0; } </code></pre> <p>Output:</p> <pre><code>My nu...
[ { "answer_id": 2850, "author": "John Downey", "author_id": 200, "author_profile": "https://Stackoverflow.com/users/200", "pm_score": 10, "selected": true, "text": "printf(\"%llu\", 285212672);\n" }, { "answer_id": 2851, "author": "sparkes", "author_id": 269, "author_p...
2008/08/05
[ "https://Stackoverflow.com/questions/2844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/432/" ]
2,871
<p>What would be the best way to fill a C# struct from a byte[] array where the data was from a C/C++ struct? The C struct would look something like this (my C is very rusty):</p> <pre><code>typedef OldStuff { CHAR Name[8]; UInt32 User; CHAR Location[8]; UInt32 TimeStamp; UInt32 Sequence; CHAR...
[ { "answer_id": 2887, "author": "Coincoin", "author_id": 42, "author_profile": "https://Stackoverflow.com/users/42", "pm_score": 8, "selected": true, "text": "SomeByteArray SomeByteArray IntPtr PtrToStructure NewStuff ByteArrayToNewStuff(byte[] bytes)\n{\n GCHandle handle = GCHandle.Al...
2008/08/05
[ "https://Stackoverflow.com/questions/2871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/206/" ]
2,873
<p>I'm working on a project where I'm coding in C in a UNIX environment. I've been using the lint tool to check my source code. Lint has been around a long time (since 1979), can anyone suggest a more recent code analysis tool I could use ? Preferably a tool that is free.</p>
[ { "answer_id": 2927, "author": "svec", "author_id": 103, "author_profile": "https://Stackoverflow.com/users/103", "pm_score": 6, "selected": true, "text": "-Werror -Wall valgrind" }, { "answer_id": 31055169, "author": "Nicolas Jean", "author_id": 4830306, "author_prof...
2008/08/05
[ "https://Stackoverflow.com/questions/2873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381/" ]
2,874
<p>I have a control that is modelled on a <strong>ComboBox</strong>. I want to render the control so that the control <strong>border</strong> looks like that of a standard <strong>Windows ComboBox</strong>. Specifically, I have followed the MSDN documentation and all the rendering of the control is correct except for r...
[ { "answer_id": 13372, "author": "Patrik Svensson", "author_id": 936, "author_profile": "https://Stackoverflow.com/users/936", "pm_score": 4, "selected": false, "text": "// Create the renderer.\nif (VisualStyleInformation.IsSupportedByOS \n && VisualStyleInformation.IsEnabledByUser) \n...
2008/08/05
[ "https://Stackoverflow.com/questions/2874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/441/" ]
2,898
<p>Let me preface this question by saying I use TextMate on Mac OSX for my text needs and I am in love with it. Anything comparable on the Linux platform? I'll mostly use it for coding python/ruby.</p> <p>Doing a google search yielded outdated answers.</p> <p>Edit: Since there has been some concern about the 'meri...
[ { "answer_id": 2066166, "author": "Wayne Conrad", "author_id": 238886, "author_profile": "https://Stackoverflow.com/users/238886", "pm_score": 1, "selected": false, "text": "# Local Variables:\n# tab-width: 2\n# ruby-indent-level: 2\n# indent-tabs-mode: nil\n# End:\n" } ]
2008/08/05
[ "https://Stackoverflow.com/questions/2898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25/" ]
2,900
<p>I am getting the following error:</p> <blockquote> <p>Access denied for user 'apache'@'localhost' (using password: NO)</p> </blockquote> <p>When using the following code:</p> <pre><code>&lt;?php include("../includes/connect.php"); $query = "SELECT * from story"; $result = mysql_query($query) or die(mysql_err...
[ { "answer_id": 2908, "author": "Teifion", "author_id": 1384652, "author_profile": "https://Stackoverflow.com/users/1384652", "pm_score": 1, "selected": false, "text": "<?php\ninclude(\"../includes/connect.php\");\n\n$query = \"SELECT * from story\";\n$result = mysql_query($query) or die(...
2008/08/05
[ "https://Stackoverflow.com/questions/2900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/454/" ]
2,913
<p>Does anyone have some good hints for writing test code for database-backend development where there is a heavy dependency on state?</p> <p>Specifically, I want to write tests for code that retrieve records from the database, but the answers will depend on the data in the database (which may change over time).</p> ...
[ { "answer_id": 16710, "author": "Peter Stuifzand", "author_id": 1633, "author_profile": "https://Stackoverflow.com/users/1633", "pm_score": 1, "selected": false, "text": "DELETE * FROM table" } ]
2008/08/05
[ "https://Stackoverflow.com/questions/2913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/277/" ]
2,914
<p>Occasionally, I've come across a webpage that tries to pop open a new window (for user input, or something important), but the popup blocker prevents this from happening.</p> <p>What methods can the calling window use to make sure the new window launched properly?</p>
[ { "answer_id": 2917, "author": "omar", "author_id": 453, "author_profile": "https://Stackoverflow.com/users/453", "pm_score": 9, "selected": true, "text": "var newWin = window.open(url); \n\nif(!newWin || newWin.closed || typeof newWin.closed=='undefined') \n{ \n //POPUP B...
2008/08/05
[ "https://Stackoverflow.com/questions/2914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/434/" ]
2,933
<p>Python works on multiple platforms and can be used for desktop and web applications, thus I conclude that there is some way to compile it into an executable for Mac, Windows and Linux.</p> <p>The problem being I have no idea where to start or how to write a GUI with it, can anybody shed some light on this and point...
[ { "answer_id": 2937, "author": "lubos hasko", "author_id": 275, "author_profile": "https://Stackoverflow.com/users/275", "pm_score": 9, "selected": true, "text": "PyQt" }, { "answer_id": 41966334, "author": "PythonProgrammi", "author_id": 6464947, "author_profile": "h...
2008/08/05
[ "https://Stackoverflow.com/questions/2933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
2,968
<p>For parsing player commands, I've most often used the <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#split%28java.lang.String%29" rel="noreferrer">split</a> method to split a string by delimiters and then to then just figure out the rest by a series of <code>if</code>s or <code>switch</code>...
[ { "answer_id": 2971, "author": "Mike Stone", "author_id": 122, "author_profile": "https://Stackoverflow.com/users/122", "pm_score": 1, "selected": false, "text": "String command = \"kick person\";\nStringTokenizer tokens = new StringTokenizer(command);\nString action = null;\n\nif (token...
2008/08/05
[ "https://Stackoverflow.com/questions/2968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/362/" ]
2,993
<p>I'm in an environment with a lot of computers that haven't been properly inventoried. Basically, no one knows which IP goes with which mac address and which hostname. So I wrote the following:</p> <pre><code># This script goes down the entire IP range and attempts to # retrieve the Hostname and mac address and outp...
[ { "answer_id": 3012, "author": "Ecton", "author_id": 457, "author_profile": "https://Stackoverflow.com/users/457", "pm_score": 3, "selected": false, "text": "getaddrinfo host_name = Socket.gethostbyname(current_ip)\n host_name = Socket.getaddrinfo(current_ip, 0, Socket::AF_UNSPEC, Socket...
2008/08/06
[ "https://Stackoverflow.com/questions/2993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/155/" ]
3,017
<p>By "generate", I mean auto-generation of the code necessary for a particular selected (set of) variable(s).</p> <p>But any more explicit explication or comment on good practice is welcome.</p>
[ { "answer_id": 3023, "author": "Jon Limjap", "author_id": 372, "author_profile": "https://Stackoverflow.com/users/372", "pm_score": 5, "selected": false, "text": "public PropertyType PropertyName { get; set; }\n private PropertyType _property;\n\npublic PropertyType PropertyName\n{\n ...
2008/08/06
[ "https://Stackoverflow.com/questions/3017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/391/" ]
3,021
<p>One of the topics that seems to come up regularly on mailing lists and online discussions is the merits (or lack thereof) of doing a Computer Science Degree. An argument that seems to come up time and again for the negative party is that they have been coding for some number of years and they have never used recursi...
[ { "answer_id": 3025, "author": "Louis Brandy", "author_id": 2089740, "author_profile": "https://Stackoverflow.com/users/2089740", "pm_score": 3, "selected": false, "text": "int fact(int a) \n{\n if(a==1)\n return 1;\n\n return a*fact(a-1);\n}\n" }, { "answer_id": 3030, "...
2008/08/06
[ "https://Stackoverflow.com/questions/3021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/358/" ]
3,033
<p>If I have a Perl hash with a bunch of (key, value) pairs, what is the preferred method of iterating through all the keys? I have heard that using <code>each</code> may in some way have unintended side effects. So, is that true, and is one of the two following methods best, or is there a better way?</p> <pre><code...
[ { "answer_id": 3360, "author": "John Siracusa", "author_id": 164, "author_profile": "https://Stackoverflow.com/users/164", "pm_score": 9, "selected": true, "text": "foreach my $key (keys %hash) { ... }\n foreach my $val (values %hash) { ... }\n keys %hash; # reset the internal iterator s...
2008/08/06
[ "https://Stackoverflow.com/questions/3033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/219/" ]
3,058
<p>Inversion of Control (IoC) can be quite confusing when it is first encountered.</p> <ol> <li>What is it?</li> <li>Which problem does it solve?</li> <li>When is it appropriate to use and when not?</li> </ol>
[ { "answer_id": 3108, "author": "Mark Harrison", "author_id": 116, "author_profile": "https://Stackoverflow.com/users/116", "pm_score": 10, "selected": false, "text": "print \"enter your name\"\nread name\nprint \"enter your address\"\nread address\netc...\nstore in database\n when the us...
2008/08/06
[ "https://Stackoverflow.com/questions/3058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/358/" ]
3,061
<p>How do I call a function, using a string with the function's name? For example:</p> <pre><code>import foo func_name = &quot;bar&quot; call(foo, func_name) # calls foo.bar() </code></pre>
[ { "answer_id": 3071, "author": "Patrick Johnmeyer", "author_id": 363, "author_profile": "https://Stackoverflow.com/users/363", "pm_score": 12, "selected": true, "text": "foo bar import foo\nbar = getattr(foo, 'bar')\nresult = bar()\n getattr" }, { "answer_id": 4605, "author":...
2008/08/06
[ "https://Stackoverflow.com/questions/3061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/121/" ]
3,088
<p><strong>Original Question</strong></p> <p>I am currently engaged in teaching my brother to program. He is a total beginner, but very smart. (And he actually wants to learn). I've noticed that some of our sessions have gotten bogged down in minor details, and I don't feel I've been very organized. (<em>But the ans...
[ { "answer_id": 12928, "author": "Wing", "author_id": 958, "author_profile": "https://Stackoverflow.com/users/958", "pm_score": 1, "selected": false, "text": "if :\n if () \n{\n\n}\n If () Then\nBegin\n\nEnd\n" }, { "answer_id": 22042, "author": "pkchukiss", "author_id": ...
2008/08/06
[ "https://Stackoverflow.com/questions/3088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/92/" ]
3,106
<p>I'm developing some cross platform software targeting Mono under Visual Studio and would like to be able to build the installers for Windows and Linux (Ubuntu specifically) with a single button click. I figure I could do it by calling cygwin from a post-build event, but I was hoping for at best a Visual Studio plugi...
[ { "answer_id": 74257, "author": "apenwarr", "author_id": 42219, "author_profile": "https://Stackoverflow.com/users/42219", "pm_score": 3, "selected": false, "text": "$ ar xv asciidoc_8.2.1-2_all.deb \nx - debian-binary\nx - control.tar.gz\nx - data.tar.gz\n\n$ tar -tzf control.tar.gz \n....
2008/08/06
[ "https://Stackoverflow.com/questions/3106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/327/" ]
3,112
<p>I have a perl variable <code>$results</code> that gets returned from a service. The value is supposed to be an array, and <code>$results</code> should be an array reference. However, when the array has only one item in it, <code>$results</code> will be set to that value, and not a referenced array that contains th...
[ { "answer_id": 3126, "author": "svrist", "author_id": 86, "author_profile": "https://Stackoverflow.com/users/86", "pm_score": -1, "selected": false, "text": "#!/usr/bin/perl -w\nuse strict;\n\nsub testit {\n\n my @ret = ();\n if (shift){\n push @ret,1;\n push @ret,2;\n push @ret,3;...
2008/08/06
[ "https://Stackoverflow.com/questions/3112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/219/" ]
3,136
<p>How can I set up my crontab to execute X script at 11:59PM every day without emailing me or creating any logs?</p> <p>Right now my crontab looks something like this</p> <pre><code>@daily /path/to/script.sh </code></pre>
[ { "answer_id": 3139, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Stackoverflow.com/users/91", "pm_score": 4, "selected": true, "text": "59 23 * * * /usr/sbin/myscript > /dev/null\n" }, { "answer_id": 3145, "author": "svrist", "author_id": 86, ...
2008/08/06
[ "https://Stackoverflow.com/questions/3136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/87/" ]
3,143
<p>I'm compiling a NAnt project on linux with TeamCity Continuous Integration server. I have been able to generate a test report by running NAnt on mono thru a Command Line Runner but don't have the options of using the report like a NAnt Runner. I'm also using MBUnit for the testing framework.</p> <p>How can I merge ...
[ { "answer_id": 4144, "author": "Lance Fisher", "author_id": 571, "author_profile": "https://Stackoverflow.com/users/571", "pm_score": 2, "selected": false, "text": "##teamcity[testSuiteStarted name='Test1']\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<xsl:stylesheet version=\"1.0\" xml...
2008/08/06
[ "https://Stackoverflow.com/questions/3143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/253/" ]
3,147
<p>I have seen these being used every which way, and have been accused of using them the wrong way (though in that case, I was using them that way to demonstrate a <a href="http://blog.gadodia.net/extension-methods-in-vbnet-and-c/" rel="noreferrer">point</a>).</p> <p>So, what do you think are the best practices for em...
[ { "answer_id": 3155, "author": "tags2k", "author_id": 192, "author_profile": "https://Stackoverflow.com/users/192", "pm_score": 2, "selected": false, "text": "Core.Extensions.Base64Encode(str);\n" } ]
2008/08/06
[ "https://Stackoverflow.com/questions/3147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/380/" ]
3,150
<p>I'm having trouble figuring out how to get the testing framework set up and usable in <strong>Visual Studio 2008</strong> for <code>C++</code> presumably with the built-in unit testing suite.</p> <p>Any links or tutorials would be appreciated.</p>
[ { "answer_id": 16548, "author": "Lehane", "author_id": 142, "author_profile": "https://Stackoverflow.com/users/142", "pm_score": 1, "selected": false, "text": "#include <cppunit/extensions/HelperMacros.h>" }, { "answer_id": 1829212, "author": "aracntido", "author_id": 191...
2008/08/06
[ "https://Stackoverflow.com/questions/3150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/370/" ]
3,157
<p>In an application that heavily relies on <code>.htaccess</code> RewriteRules for its PrettyURLs (CakePHP in my case), how do I correctly set up directives to exclude certain directories from this rewriting? That is:</p> <pre><code>/appRoot/.htaccess app/ static/ </code></pre> <p>By default every ...
[ { "answer_id": 3159, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 1, "selected": false, "text": "RewriteBase /appRoot\n\nRewriteRule ^$ app/webroot/ &nbsp; &nbsp;\nRewriteRule (.*) app/webroot/$1\n" }, { "answer_id...
2008/08/06
[ "https://Stackoverflow.com/questions/3157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/476/" ]
3,163
<p>I have been trying to find a really fast way to parse yyyy-mm-dd [hh:mm:ss] into a Date object. Here are the 3 ways I have tried doing it and the times it takes each method to parse 50,000 date time strings.</p> <p>Does anyone know any faster ways of doing this or tips to speed up the methods?</p> <pre><code>castM...
[ { "answer_id": 3194, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 1, "selected": false, "text": "private function castMethod2(dateString:String):Date {\n if ( dateString == null ) {\n return null;\n }\n\n i...
2008/08/06
[ "https://Stackoverflow.com/questions/3163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22/" ]
3,164
<p>If I have managed to locate and verify the existence of a file using Server.MapPath and I now want to send the user directly to that file, what is the <strong>fastest</strong> way to convert that absolute path back into a relative web path?</p>
[ { "answer_id": 3218, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 7, "selected": true, "text": "String RelativePath = AbsolutePath.Replace(Request.ServerVariables[\"APPL_PHYSICAL_PATH\"], String.Empty);\n" }, { "an...
2008/08/06
[ "https://Stackoverflow.com/questions/3164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192/" ]
3,196
<p>If I have data like this:</p> <div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>Key</th> <th>Name</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>Dan</td> </tr> <tr> <td>2</td> <td>Tom</td> </tr> <tr> <td>3</td> <td>Jon</td> </tr> <tr> <td>4</td> <td>Tom</td> </tr> <tr> <td>5</td> <td>Sam</td>...
[ { "answer_id": 3197, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 6, "selected": true, "text": "Select Name, Count(Name) As Count \n From Table\n Group By Name\n Having Count(Name) > 1\n Order By Count(Name) De...
2008/08/06
[ "https://Stackoverflow.com/questions/3196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/230/" ]
3,213
<p>Is there an efficient method of converting an integer into the written numbers, for example:</p> <pre><code>string Written = IntegerToWritten(21); </code></pre> <p>would return "Twenty One".</p> <p>Is there any way of doing this that doesn't involve a massive look-up table?</p>
[ { "answer_id": 3215, "author": "lubos hasko", "author_id": 275, "author_profile": "https://Stackoverflow.com/users/275", "pm_score": 2, "selected": false, "text": "string GetWrittenInteger(int n)\n{\n string[] a = new string[] {\"One\", \"Two\", \"Three\", \"Four\", \"Five\", \"Six\", \...
2008/08/06
[ "https://Stackoverflow.com/questions/3213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
3,224
<p>CSS and Javascript files don't change very often, so I want them to be cached by the web browser. But I also want the web browser to see changes made to these files without requiring the user to clear their browser cache. Also want a solution that works well with a version control system such as Subversion.</p> <hr ...
[ { "answer_id": 3225, "author": "grom", "author_id": 486, "author_profile": "https://Stackoverflow.com/users/486", "pm_score": 6, "selected": true, "text": "function urlmtime($url) {\n $parsed_url = parse_url($url);\n $path = $parsed_url['path'];\n\n if ($path[0] == \"/\") {\n ...
2008/08/06
[ "https://Stackoverflow.com/questions/3224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/486/" ]
3,234
<p>How would one display any add content from a "dynamic" aspx page? Currently I am working on using the System.Web.HttpResponse "Page.Response" to write a file that is stored on a web server to a web request.</p> <p>This would allow people to hit a url to the type <a href="http://www.foo.com?Image=test.jpg" rel="nore...
[ { "answer_id": 3240, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 0, "selected": false, "text": "// Clear the response buffer incase there is anything already in it.\nResponse.Clear();\nResponse.Buffer = true;\n\n// Read t...
2008/08/06
[ "https://Stackoverflow.com/questions/3234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/231/" ]
3,255
<p>Most people with a degree in CS will certainly know what <a href="http://www.nist.gov/dads/HTML/bigOnotation.html" rel="noreferrer">Big O stands for</a>. It helps us to measure how well an algorithm scales. </p> <p>But I'm curious, how do <em>you</em> calculate or approximate the complexity of your algorithms?</p>
[ { "answer_id": 3368, "author": "DShook", "author_id": 370, "author_profile": "https://Stackoverflow.com/users/370", "pm_score": 8, "selected": false, "text": "int array[n];\n x = array[0];\n for(int i = 0; i < n; i++){\n if(array[i] == numToFind){ return i; }\n}\n for(int i = 0; i < n...
2008/08/06
[ "https://Stackoverflow.com/questions/3255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46/" ]
3,260
<p>We use a data acquisition card to take readings from a device that increases its signal to a peak and then falls back to near the original value. To find the peak value we currently search the array for the highest reading and use the index to determine the timing of the peak value which is used in our calculations....
[ { "answer_id": 24259, "author": "dmckee --- ex-moderator kitten", "author_id": 2509, "author_profile": "https://Stackoverflow.com/users/2509", "pm_score": 3, "selected": false, "text": "TSpectrum*" }, { "answer_id": 44357, "author": "Thomas Kammeyer", "author_id": 4410, ...
2008/08/06
[ "https://Stackoverflow.com/questions/3260", "https://Stackoverflow.com", "https://Stackoverflow.com/users/186/" ]
3,281
<p>I'm wondering if there's a way to do what I can do below with Python, in Ruby:</p> <pre><code>sum = reduce(lambda x, y: x + y, map(lambda x, y: x * y, weights, data)) </code></pre> <p>I have two arrays of equal sizes with the weights and data but I can't seem to find a function similar to map in Ruby, reduce I hav...
[ { "answer_id": 3314, "author": "Curt Hagenlocher", "author_id": 533, "author_profile": "https://Stackoverflow.com/users/533", "pm_score": 2, "selected": false, "text": "weights = [1, 2, 3]\ndata = [4, 5, 6]\nresult = Array.new\na.zip(b) { |x, y| result << x * y } # For just the one opera...
2008/08/06
[ "https://Stackoverflow.com/questions/3281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/484/" ]
3,284
<p>I've been working with <a href="http://msdn.microsoft.com/en-us/library/aa479030.aspx" rel="noreferrer">providers</a> a fair bit lately, and I came across an interesting situation where I wanted to have an abstract class that had an abstract static method. I read a few posts on the topic, and it sort of made sense, ...
[ { "answer_id": 3291, "author": "David Wengier", "author_id": 489, "author_profile": "https://Stackoverflow.com/users/489", "pm_score": 6, "selected": false, "text": "public static class Base\n{\n public static virtual int GetNumber() { return 5; }\n}\n\npublic static class Child1 : Ba...
2008/08/06
[ "https://Stackoverflow.com/questions/3284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/493/" ]
3,315
<p>I need to set the height of every textbox on my form, some of which are nested within other controls. I thought I could do something like this:</p> <pre><code>private static IEnumerator&lt;TextBox&gt; FindTextBoxes(Control rootControl) { foreach (Control control in rootControl.Controls) { if (contr...
[ { "answer_id": 3323, "author": "Yaakov Ellis", "author_id": 51, "author_profile": "https://Stackoverflow.com/users/51", "pm_score": 1, "selected": false, "text": "// Generic function that gets all child controls of a certain type, \n// returned in a List collection\nprivate static List<T...
2008/08/06
[ "https://Stackoverflow.com/questions/3315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/503/" ]
3,319
<p>How can I set the background color of an HTML element using css in JavaScript?</p>
[ { "answer_id": 3320, "author": "tags2k", "author_id": 192, "author_profile": "https://Stackoverflow.com/users/192", "pm_score": 5, "selected": false, "text": "var element = document.getElementById('element');\nelement.style.background = '#FF00AA';\n" }, { "answer_id": 3321, "...
2008/08/06
[ "https://Stackoverflow.com/questions/3319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
3,362
<p>I would like to be able to use the <kbd>Tab</kbd> key within a text box to tab over four spaces. The way it is now, the Tab key jumps my cursor to the next input.</p> <p>Is there some JavaScript that will capture the Tab key in the text box before it bubbles up to the UI?</p> <p>I understand some browsers (i.e. Fi...
[ { "answer_id": 3370, "author": "Tom", "author_id": 20, "author_profile": "https://Stackoverflow.com/users/20", "pm_score": 4, "selected": false, "text": "document.onkeydown = TabExample;\n\nfunction TabExample(evt) {\n var evt = (evt) ? evt : ((event) ? event : null);\n var tabKey = 9;...
2008/08/06
[ "https://Stackoverflow.com/questions/3362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/357/" ]
3,385
<p>I know that we can get the MAC address of a user via IE (ActiveX objects).</p> <p>Is there a way to obtain a user's MAC address using JavaScript?</p>
[ { "answer_id": 48112607, "author": "Ad Kahn", "author_id": 2855519, "author_profile": "https://Stackoverflow.com/users/2855519", "pm_score": 3, "selected": false, "text": "function showMacAddress() {\n var obj = new ActiveXObject(\"WbemScripting.SWbemLocator\");\n var s = obj.Conne...
2008/08/06
[ "https://Stackoverflow.com/questions/3385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/384/" ]
3,400
<p><strong>Note:</strong> I <em>am</em> using SQL's Full-text search capabilities, CONTAINS clauses and all - the * is the wildcard in full-text, % is for LIKE clauses only.</p> <p>I've read in several places now that "leading wildcard" searches (e.g. using "*overflow" to match "stackoverflow") is not supported in MS ...
[ { "answer_id": 3405, "author": "Kev", "author_id": 419, "author_profile": "https://Stackoverflow.com/users/419", "pm_score": 2, "selected": false, "text": "CONTAINS % % _" }, { "answer_id": 3521, "author": "Otto", "author_id": 519, "author_profile": "https://Stackover...
2008/08/06
[ "https://Stackoverflow.com/questions/3400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35/" ]
3,408
<p>What do you think is the best set-up for RoR in a Win Vista environment? I've tried the radrails eclipse plug-in, and it just seemed too bulky for me, I've also started to just use Textpad and the command line, but I'm used to having somewhat of an IDE to work with.</p>
[ { "answer_id": 8381, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 2, "selected": false, "text": "rubygems" } ]
2008/08/06
[ "https://Stackoverflow.com/questions/3408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/514/" ]
3,432
<p>I know that you can insert multiple rows at once, is there a way to update multiple rows at once (as in, in one query) in MySQL?</p> <p>Edit: For example I have the following</p> <pre><code>Name id Col1 Col2 Row1 1 6 1 Row2 2 2 3 Row3 3 9 5 Row4 4 16 8 </code></pre> <p>I wan...
[ { "answer_id": 3439, "author": "UnkwnTech", "author_id": 115, "author_profile": "https://Stackoverflow.com/users/115", "pm_score": 3, "selected": false, "text": "UPDATE table1, table2 SET table1.col1='value', table2.col1='value' WHERE table1.col3='567' AND table2.col6='567'\n" }, { ...
2008/08/06
[ "https://Stackoverflow.com/questions/3432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
3,437
<p>We recently discovered that the Google Maps API does not play nicely with SSL. Fair enough, but what are some options for overcoming this that others have used effectively?</p> <blockquote> <p><a href="http://code.google.com/support/bin/answer.py?answer=65301&amp;topic=10945" rel="noreferrer">Will the Maps API w...
[ { "answer_id": 20612, "author": "Gary", "author_id": 2330, "author_profile": "https://Stackoverflow.com/users/2330", "pm_score": 5, "selected": true, "text": "<script src=\"http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.1\" type=\"text/javascript\"></script>\n <script src=\"h...
2008/08/06
[ "https://Stackoverflow.com/questions/3437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/308/" ]
3,470
<p>I have a very simple problem which requires a very quick and simple solution in SQL Server 2005.</p> <p>I have a table with x Columns. I want to be able to select one row from the table and then transform the columns into rows.</p> <pre><code>TableA Column1, Column2, Column3 </code></pre> <p>SQL Statement to rutu...
[ { "answer_id": 3475, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Stackoverflow.com/users/91", "pm_score": 0, "selected": false, "text": "SELECT Column1 FROM table WHERE idColumn = 1\nUNION ALL\nSELECT Column2 FROM table WHERE idColumn = 1\nUNION ALL\nSELECT Colu...
2008/08/06
[ "https://Stackoverflow.com/questions/3470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
3,486
<p>I have control over the HttpServer but not over the ApplicationServer or the Java Applications sitting there but I need to block direct access to certain pages on those applications. Precisely, I don't want users automating access to forms issuing direct GET/POST HTTP requests to the appropriate servlet. </p> <p>So...
[ { "answer_id": 3827, "author": "jj33", "author_id": 430, "author_profile": "https://Stackoverflow.com/users/430", "pm_score": 3, "selected": true, "text": "RewriteCond %{HTTP_REFERER} !^http://(www.)?example.(com|org) [NC]\nRewriteCond %{QUERY_STRING} ^.+$\nRewriteRule ^(script1|script2)...
2008/08/06
[ "https://Stackoverflow.com/questions/3486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/527/" ]
3,510
<p>What is BODMAS and why is it useful in programming?</p>
[ { "answer_id": 3511, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Stackoverflow.com/users/91", "pm_score": 5, "selected": true, "text": "result = (((i + 4) - (a + b)) * MAGIC_NUMBER) - ANOTHER_MAGIC_NUMBER;\n result = (i + 4 - (a + b)) * MAGIC_NUMBER - ANOTHER_MA...
2008/08/06
[ "https://Stackoverflow.com/questions/3510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
3,512
<p>I'm using MSVE, and I have my own tiles I'm displaying in layers on top. Problem is, there's a ton of them, and they're on a network server. In certain directories, there are something on the order of 30,000+ files. Initially I called Directory.GetFiles, but once I started testing in a pseudo-real environment, it ti...
[ { "answer_id": 3583, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 1, "selected": false, "text": "DIR /s/b > Files.txt\n" } ]
2008/08/06
[ "https://Stackoverflow.com/questions/3512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/517/" ]
3,530
<p>I have a <code>Rakefile</code> with a Rake task that I would normally call from the command line:</p> <pre><code>rake blog:post Title </code></pre> <p>I'd like to write a Ruby script that calls that Rake task multiple times, but the only solution I see is shelling out using `` (backticks) or <code>system</code>.</...
[ { "answer_id": 3543, "author": "titanous", "author_id": 399, "author_profile": "https://Stackoverflow.com/users/399", "pm_score": 7, "selected": true, "text": "require 'rake'\n\ndef capture_stdout\n s = StringIO.new\n oldstdout = $stdout\n $stdout = s\n yield\n s.string\nensure\n $...
2008/08/06
[ "https://Stackoverflow.com/questions/3530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1388162/" ]
3,567
<p>In SQL Server how do you query a database to bring back all the tables that have a field of a specific name?</p>
[ { "answer_id": 3574, "author": "Stu", "author_id": 414, "author_profile": "https://Stackoverflow.com/users/414", "pm_score": 0, "selected": false, "text": "SELECT Table_Name\nFROM Information_Schema.Columns\nWHERE Column_Name = 'YourFieldName'\n" }, { "answer_id": 3575, "auth...
2008/08/06
[ "https://Stackoverflow.com/questions/3567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/230/" ]
3,585
<p>I want to create my Rails application with MySQL, because I like it so much. How can I do that in the latest version of Rails instead of the default SQLite?</p>
[ { "answer_id": 3586, "author": "Daniel Broekman", "author_id": 124, "author_profile": "https://Stackoverflow.com/users/124", "pm_score": 8, "selected": false, "text": "rails ProjectName\n rails new ProjectName -d mysql\n" }, { "answer_id": 3588, "author": "James Avery", "...
2008/08/06
[ "https://Stackoverflow.com/questions/3585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/124/" ]
3,589
<p>I need to create a backup of a SQL Server 2005 Database that's only the structure...no records, just the schema. Is there any way to do this?</p> <p>EDIT: I'm trying to create a backup file to use with old processes, so a script wouldn't work for my purposes, sorry</p>
[ { "answer_id": 73465453, "author": "Daniel Brink", "author_id": 141443, "author_profile": "https://Stackoverflow.com/users/141443", "pm_score": 0, "selected": false, "text": "dbcc clonedatabase(Demo, Demo_Clone) with verify_clonedb;\nalter database [Demo_Clone] set read_write;\nbackup da...
2008/08/06
[ "https://Stackoverflow.com/questions/3589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44/" ]
3,607
<p>I've got TotroiseSVN installed and have a majority of my repositories checking in and out from C:\subversion\ <em>and a couple checking in and out from a network share (I forgot about this when I originally posted this question)</em>.</p> <p>This means that I don't have a "subversion" server per-se.</p> <p>How do ...
[ { "answer_id": 370131, "author": "Andy Madge", "author_id": 46433, "author_profile": "https://Stackoverflow.com/users/46433", "pm_score": 5, "selected": true, "text": "svnlook.exe svnlook.exe bugtraq:label BugzID:\nbugtraq:message BugzID: %BUGID%\nbugtraq:number true\nbugtraq:url ...
2008/08/06
[ "https://Stackoverflow.com/questions/3607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58/" ]
3,611
<p>I'm trying to write some PHP to upload a file to a folder on my webserver. Here's what I have:</p> <pre><code>&lt;?php if ( !empty($_FILES['file']['tmp_name']) ) { move_uploaded_file($_FILES['file']['tmp_name'], './' . $_FILES['file']['name']); header('Location: http://www.mywebsite.com/dump/');...
[ { "answer_id": 3618, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Stackoverflow.com/users/91", "pm_score": 4, "selected": true, "text": "E:\\inetpub\\vhosts\\mywebsite.com\\httpdocs\\dump\\\nC:\\WINDOWS\\Temp\\\n" }, { "answer_id": 4618, "author": "Ke...
2008/08/06
[ "https://Stackoverflow.com/questions/3611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/402/" ]
3,625
<p>I can't seem to find Developer Express' version of the <code>LinkButton</code>. (The Windows Forms linkbutton, not the <code>ASP.NET</code> linkbutton.) <code>HyperLinkEdit</code> doesn't seem to be what I'm looking for since it looks like a TextEdit/TextBox.</p> <p>Anyone know what their version of it is? I'm u...
[ { "answer_id": 102129, "author": "Josh Kodroff", "author_id": 549, "author_profile": "https://Stackoverflow.com/users/549", "pm_score": 3, "selected": true, "text": " control.BorderStyle = BorderStyles.NoBorder;\n control.Properties.Appearance.BackColor = Color.Transparent;\n co...
2008/08/06
[ "https://Stackoverflow.com/questions/3625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/549/" ]
3,654
<p>When developing a new web based application which version of html should you aim for?</p> <p>EDIT:</p> <p>cool I was just attempting to get a feel from others I tend to use XHTML 1.0 Strict in my own work and Transitional when others are involved in the content creation.</p> <p>I marked the first XHTML 1.0 Transi...
[ { "answer_id": 20487, "author": "Chris", "author_id": 2134, "author_profile": "https://Stackoverflow.com/users/2134", "pm_score": 2, "selected": false, "text": "Content-type: application/xhtml+xml Content-type: text/html" }, { "answer_id": 194049, "author": "Kornel", "aut...
2008/08/06
[ "https://Stackoverflow.com/questions/3654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/269/" ]
3,682
<p>I have a MySQL table with approximately 3000 rows per user. One of the columns is a datetime field, which is mutable, so the rows aren't in chronological order.</p> <p>I'd like to visualize the time distribution in a chart, so I need a number of individual datapoints. 20 datapoints would be enough.</p> <p>I could ...
[ { "answer_id": 3691, "author": "Michal Sznajder", "author_id": 501, "author_profile": "https://Stackoverflow.com/users/501", "pm_score": 1, "selected": false, "text": "select @rownum:=@rownum+1 rownum, entries.* \nfrom (select @rownum:=0) r, entries \nwhere uid = ? and rownum % 150 = 0\n...
2008/08/06
[ "https://Stackoverflow.com/questions/3682", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136/" ]
3,713
<p>I'm writing a web page in ASP.NET. I have some JavaScript code, and I have a submit button with a click event.</p> <p>Is it possible to call a method I created in ASP with JavaScript's click event?</p>
[ { "answer_id": 3752, "author": "EndangeredMassa", "author_id": 106, "author_profile": "https://Stackoverflow.com/users/106", "pm_score": 4, "selected": false, "text": "Ajax.Utility.RegisterTypeForAjax(GetType(YOURPAGECLASSNAME))\n <Ajax.AjaxMethod()> _\nPublic Function Get5() AS Integer\...
2008/08/06
[ "https://Stackoverflow.com/questions/3713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/557/" ]
3,725
<p>I'm writing an application that is basically just a preferences dialog, much like the tree-view preferences dialog that Visual Studio itself uses. The function of the application is simply a pass-through for data from a serial device to a file. It performs many, many transformations on the data before writing it to ...
[ { "answer_id": 3776, "author": "xyz", "author_id": 82, "author_profile": "https://Stackoverflow.com/users/82", "pm_score": 5, "selected": true, "text": "this.TopLevel = false;\nthis.FormBorderStyle = FormBorderStyle.None;\nthis.Dock = DockStyle.Fill;\n SplitContainer TreeView Hide/Show B...
2008/08/06
[ "https://Stackoverflow.com/questions/3725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/551/" ]
3,739
<p>I have an unusual situation in which I need a SharePoint timer job to both have local administrator windows privileges and to have <code>SHAREPOINT\System</code> SharePoint privileges.</p> <p>I can get the windows privileges by simply configuring the timer service to use an account which is a member of local admini...
[ { "answer_id": 3741, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Stackoverflow.com/users/91", "pm_score": 1, "selected": false, "text": "SPUserToken sut = thisSite.RootWeb.AllUsers[\"SHAREPOINT\\SYSTEM\"].UserToken;\n\nusing (SPSite syssite = new SPSite(thisSite...
2008/08/06
[ "https://Stackoverflow.com/questions/3739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
3,793
<p>What's the best way to get the contents of the mixed <code>body</code> element in the code below? The element might contain either XHTML or text, but I just want its contents in string form. The <code>XmlElement</code> type has the <code>InnerXml</code> property which is exactly what I'm after.</p> <p>The code as...
[ { "answer_id": 3896, "author": "Mike Powell", "author_id": 205, "author_profile": "https://Stackoverflow.com/users/205", "pm_score": 3, "selected": false, "text": "Body = t.Element(\"body\").Nodes().Aggregate(\"\", (b, node) => b += node.ToString());\n" }, { "answer_id": 16882, ...
2008/08/06
[ "https://Stackoverflow.com/questions/3793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/205/" ]
3,798
<p>Currently I have two Linux servers running MySQL, one sitting on a rack right next to me under a 10 Mbit/s upload pipe (main server) and another some couple of miles away on a 3 Mbit/s upload pipe (mirror).</p> <p>I want to be able to replicate data on both servers continuously, but have run into several roadblocks...
[ { "answer_id": 2303995, "author": "serbaut", "author_id": 84760, "author_profile": "https://Stackoverflow.com/users/84760", "pm_score": 0, "selected": false, "text": " Network timeouts between the master and the slave could result\n in corruption of the relay log.\n" } ]
2008/08/06
[ "https://Stackoverflow.com/questions/3798", "https://Stackoverflow.com", "https://Stackoverflow.com/users/547/" ]
3,802
<p>What is the best way to typeset a function with arguments for readibility, brevity, and accuracy? I tend to put empty parentheses after the function name like <code>func()</code>, even if there are actually arguments for the function. I have trouble including the arguments and still feeling like the paragraph is re...
[ { "answer_id": 3874, "author": "MojoFilter", "author_id": 93, "author_profile": "https://Stackoverflow.com/users/93", "pm_score": 3, "selected": true, "text": "myFunction(...)" } ]
2008/08/06
[ "https://Stackoverflow.com/questions/3802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59/" ]
3,839
<p>I'm trying out the following query:</p> <pre><code>SELECT A,B,C FROM table WHERE field LIKE 'query%' UNION SELECT A,B,C FROM table WHERE field LIKE '%query' UNION SELECT A,B,C FROM table WHERE field LIKE '%query%' GROUP BY B ORDER BY B ASC LIMIT 5 </code></pre> <p>That's three queries stuck together, kinda sorta. ...
[ { "answer_id": 3852, "author": "Mark Harrison", "author_id": 116, "author_profile": "https://Stackoverflow.com/users/116", "pm_score": 2, "selected": false, "text": "SELECT * FROM (\n SELECT A,B,C FROM table WHERE field LIKE 'query%'\n UNION\n SELECT A,B,C FROM table WHERE field...
2008/08/06
[ "https://Stackoverflow.com/questions/3839", "https://Stackoverflow.com", "https://Stackoverflow.com/users/547/" ]
3,856
<p>I wrote a component that displays a filename, a thumbnail and has a button to load/play the file. The component is databound to a repeater. How can I make it so that the button event fires to the main application and tells it which file to play?</p>
[ { "answer_id": 3852, "author": "Mark Harrison", "author_id": 116, "author_profile": "https://Stackoverflow.com/users/116", "pm_score": 2, "selected": false, "text": "SELECT * FROM (\n SELECT A,B,C FROM table WHERE field LIKE 'query%'\n UNION\n SELECT A,B,C FROM table WHERE field...
2008/08/06
[ "https://Stackoverflow.com/questions/3856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26/" ]
3,868
<p>I'm downloading a web page (tag soup HTML) with XMLHttpRequest and I want to take the output and turn it into a DOM object that I can then run XPATH queries on. How do I convert from a string into DOM object?</p> <p>It appears that the general solution is to create a hidden iframe and throw the contents of the strin...
[ { "answer_id": 3871, "author": "Steve Willard", "author_id": 402, "author_profile": "https://Stackoverflow.com/users/402", "pm_score": 3, "selected": false, "text": "var request = new XMLHttpRequest();\n\nrequest.overrideMimeType( 'text/xml' );\nrequest.onreadystatechange = process;\nreq...
2008/08/06
[ "https://Stackoverflow.com/questions/3868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/163/" ]
3,881
<p>I have a simple setter method for a property and <code>null</code> is not appropriate for this particular property. I have always been torn in this situation: should I throw an <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/IllegalArgumentException.html" rel="noreferrer"><code>IllegalArgumentException</...
[ { "answer_id": 3886, "author": "Greg Hurlman", "author_id": 35, "author_profile": "https://Stackoverflow.com/users/35", "pm_score": 9, "selected": true, "text": "IllegalArgumentException null NullPointerException null" }, { "answer_id": 3890, "author": "Jeremy Privett", "...
2008/08/06
[ "https://Stackoverflow.com/questions/3881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122/" ]
3,894
<p>Given the constraint of only using T-Sql in Sql Server 2005, is there a better way to remove the decimal point from a money datatype than a conversion to a varchar (here implicitly) and then a replace of the decimal point?</p> <p>Here is what I have currently.</p> <pre><code>SELECT REPLACE(1.23, '.', ''), REPLACE(...
[ { "answer_id": 5944, "author": "SQLMenace", "author_id": 740, "author_profile": "https://Stackoverflow.com/users/740", "pm_score": 2, "selected": false, "text": "DECLARE\n@mon1 MONEY,\n@mon2 MONEY,\n@mon3 MONEY,\n@mon4 MONEY,\n@num1 DECIMAL(19,4),\n@num2 DECIMAL(19,4),\n@num3 DECIMAL(19,...
2008/08/06
[ "https://Stackoverflow.com/questions/3894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/76/" ]
3,927
<p>What profilers have you used when working with .net programs, and which would you particularly recommend?</p>
[ { "answer_id": 100490, "author": "Matt Howells", "author_id": 16881, "author_profile": "https://Stackoverflow.com/users/16881", "pm_score": 9, "selected": true, "text": "windbg.exe" } ]
2008/08/06
[ "https://Stackoverflow.com/questions/3927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/121/" ]
3,976
<p>I have a Prolite LED sign that I like to set up to show scrolling search queries from a apache logs and other fun statistics. The problem is, my G5 does not have a serial port, so I have to use a usb to serial dongle. It shows up as /dev/cu.usbserial and /dev/tty.usbserial . </p> <p>When i do this everything seems ...
[ { "answer_id": 4162, "author": "Lily Ballard", "author_id": 582, "author_profile": "https://Stackoverflow.com/users/582", "pm_score": 3, "selected": false, "text": "/dev/cu.xxxxx /dev/tty.xxxxx" } ]
2008/08/06
[ "https://Stackoverflow.com/questions/3976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/556/" ]
4,004
<p><strong>Most recent edits in bold</strong> I am using the .net <code>HttpListener</code> class, but I won't be running this application on IIS and am not using ASP.net. This <a href="http://www.leastprivilege.com/CommentView.aspx?guid=0c34094a-bdd4-4041-be6e-919f10fe1d31" rel="noreferrer">web site</a> describes wha...
[ { "answer_id": 727624, "author": "galets", "author_id": 14395, "author_profile": "https://Stackoverflow.com/users/14395", "pm_score": 3, "selected": false, "text": "makecert.exe -r -a sha1 -n CN=localhost -sky exchange -pe -b 01/01/2000 -e 01/01/2050 -ss my -sr localmachine\n HttpCfg.exe...
2008/08/06
[ "https://Stackoverflow.com/questions/4004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/525/" ]
4,034
<p>What is the best way to support multiple languages for the interface in an ASP.NET MVC application? I've seen people use resource files for other applications. Is this still the best way?</p>
[ { "answer_id": 4038, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 2, "selected": false, "text": "Site.resx\nSite.en.resx\nSite.en-US.resx\nSite.fr.resx\netc...\n" }, { "answer_id": 68081, "author": "user10479",...
2008/08/06
[ "https://Stackoverflow.com/questions/4034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/571/" ]
4,046
<p>I'm trying to convince my providers to use ANT instead of Rational Application Development so anyone can recompile, recheck, redeploy the solution anyplace, anytime, anyhow. :P</p> <p>I started a build.xml for a project that generates a JAR file but stopped there and I need real examples to compare notes. My good f...
[ { "answer_id": 4902, "author": "McDowell", "author_id": 304, "author_profile": "https://Stackoverflow.com/users/304", "pm_score": 5, "selected": true, "text": "<?xml version=\"1.0\"?>\n<project name=\"project\" default=\"wasListApps\" basedir=\".\">\n <description>\n Script for...
2008/08/06
[ "https://Stackoverflow.com/questions/4046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/527/" ]
4,051
<p>In <code>C</code> can I <strong>pass a multidimensional array</strong> to a function <strong>as a single argument</strong> when I don't know what the dimensions of the array are going to be?</p> <p>Besides, my multidimensional array may contain types other than strings.</p>
[ { "answer_id": 4192, "author": "andrewrk", "author_id": 432, "author_profile": "https://Stackoverflow.com/users/432", "pm_score": 6, "selected": true, "text": "typedef struct {\n int myint;\n char* mystring;\n} data;\n\ndata** array;\n //initialize\nint x,y,w,h;\nw = 10; //width of arr...
2008/08/06
[ "https://Stackoverflow.com/questions/4051", "https://Stackoverflow.com", "https://Stackoverflow.com/users/381/" ]
4,052
<p>I am trying to enable Full-text indexing in SQL Server 2005 Express. I am running this on my laptop with Vista Ultimate.</p> <p>I understand that the standard version of SQL Server Express does not have full-text indexing. I have already downloaded and installed "Microsoft SQL Server 2005 Express Edition with Advan...
[ { "answer_id": 4139, "author": "csmba", "author_id": 350, "author_profile": "https://Stackoverflow.com/users/350", "pm_score": 5, "selected": true, "text": "sp_fulltext_database 'enable'\n\nCREATE FULLTEXT CATALOG [myFullText]\nWITH ACCENT_SENSITIVITY = ON\n\nCREATE FULLTEXT INDEX ON [db...
2008/08/06
[ "https://Stackoverflow.com/questions/4052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/576/" ]
4,062
<p>Currently I know of only two ways to cache data (I use PHP but I assume that the same will apply to most languages).</p> <ol> <li>Save the cache to a file</li> <li>Save the cache to a large DB field</li> </ol> <p>Are there any other (perhaps better) ways of caching or is it really just this simple?</p>
[ { "answer_id": 67170, "author": "Erlend Halvorsen", "author_id": 1920, "author_profile": "https://Stackoverflow.com/users/1920", "pm_score": 0, "selected": false, "text": "RewriteEngine on\nRewriteCond %{QUERY_STRING} ^$ # let's not cache urls with queries\nRewriteCond %{REQUEST_METHOD} ...
2008/08/06
[ "https://Stackoverflow.com/questions/4062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
4,072
<p>I just did a merge using something like:</p> <pre><code>svn merge -r 67212:67213 https://my.svn.repository/trunk . </code></pre> <p>I only had 2 files, one of which is a simple <code>ChangeLog</code>. Rather than just merging my <code>ChangeLog</code> changes, it actually pulled mine plus some previous ones that ...
[ { "answer_id": 4104, "author": "Ecton", "author_id": 457, "author_profile": "https://Stackoverflow.com/users/457", "pm_score": 0, "selected": false, "text": "svn merge -r 67212:67213 https://my.svn.repository/trunk .\n svn log -r 67212\n" }, { "answer_id": 13738, "author": "C...
2008/08/06
[ "https://Stackoverflow.com/questions/4072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122/" ]
4,080
<p>What code analysis tools do you use on your Java projects?</p> <p>I am interested in all kinds</p> <ul> <li>static code analysis tools (FindBugs, PMD, and any others)</li> <li>code coverage tools (Cobertura, Emma, and any others)</li> <li>any other instrumentation-based tools </li> <li>anything else, if I'm missin...
[ { "answer_id": 79845, "author": "Greg Mattes", "author_id": 13940, "author_profile": "https://Stackoverflow.com/users/13940", "pm_score": 7, "selected": true, "text": "/absolute-path/filename:line-number:column-number: warning(tool-name): message /project/src/com/example/Foo.java:425:9: ...
2008/08/06
[ "https://Stackoverflow.com/questions/4080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/235/" ]
4,138
<p>What is the best SVN Ignore Pattern should TortoiseSVN have for a VB.NET solution?</p>
[ { "answer_id": 4140, "author": "Karl Seguin", "author_id": 34, "author_profile": "https://Stackoverflow.com/users/34", "pm_score": 5, "selected": true, "text": "build deploy */bin */bin/* obj *.dll *.pdb *.user *.suo _ReSharper* *.resharper* bin\n" } ]
2008/08/06
[ "https://Stackoverflow.com/questions/4138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
4,149
<p>I have an application that writes information to file. This information is used post-execution to determine pass/failure/correctness of the application. I'd like to be able to read the file as it is being written so that I can do these pass/failure/correctness checks in real time.</p> <p>I assume it is possible to ...
[ { "answer_id": 4498, "author": "Anthony Cramp", "author_id": 488, "author_profile": "https://Stackoverflow.com/users/488", "pm_score": 2, "selected": false, "text": "public class Writer extends Object\n{\n Writer () {\n\n }\n\n public static String[] strings = \n {\n ...
2008/08/06
[ "https://Stackoverflow.com/questions/4149", "https://Stackoverflow.com", "https://Stackoverflow.com/users/488/" ]
4,168
<p>I'm looking for a simple algorithm to 'serialize' a directed graph. In particular I've got a set of files with interdependencies on their execution order, and I want to find the correct order at compile time. I know it must be a fairly common thing to do - compilers do it all the time - but my google-fu has been wea...
[ { "answer_id": 4185, "author": "Kieron", "author_id": 588, "author_profile": "https://Stackoverflow.com/users/588", "pm_score": 1, "selected": false, "text": "Map<Object, List<Object>> source; // map of each object to its dependency list\nList<Object> dest; // destination list\n\nfunctio...
2008/08/07
[ "https://Stackoverflow.com/questions/4168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/588/" ]
4,170
<p>I need to learn ADO.NET to build applications based on MS Office. I have read a good deal about ADO.NET in the MSDN Library, but everything seems rather messy to me.</p> <p>What are the basics one must figure out when using ADO.NET? I think a few key words will suffice to let me organize my learning.</p>
[ { "answer_id": 4204, "author": "Karl Seguin", "author_id": 34, "author_profile": "https://Stackoverflow.com/users/34", "pm_score": 4, "selected": true, "text": "SQLConnection SqlCommand SqlDataReader Sql MySqlConnection OracleCommand using (SqlConnection connection = new SqlConnection(\"...
2008/08/07
[ "https://Stackoverflow.com/questions/4170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
4,208
<p>Is there a Windows equivalent of the Unix command, <em>nice</em>?</p> <p>I'm specifically looking for something I can use at the command line, and <strong>not</strong> the "Set Priority" menu from the task manager.</p> <p>My attempts at finding this on Google have been thwarted by those who can't come up with bett...
[ { "answer_id": 4302, "author": "Chris Miller", "author_id": 206, "author_profile": "https://Stackoverflow.com/users/206", "pm_score": 3, "selected": false, "text": "function set-ProcessPriority { \n param($processName = $(throw \"Enter process name\"), $priority = \"Normal\")\n\n g...
2008/08/07
[ "https://Stackoverflow.com/questions/4208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55/" ]
4,221
<p>I'd like to use a <code>LinqDataSource</code> control on a page and limit the amount of records returned. I know if I use code behind I could do something like this:</p> <pre><code>IEnumerable&lt;int&gt; values = Enumerable.Range(0, 10); IEnumerable&lt;int&gt; take3 = values.Take(3); </code></pre> <p>Does anyone ...
[ { "answer_id": 4231, "author": "lomaxx", "author_id": 493, "author_profile": "https://Stackoverflow.com/users/493", "pm_score": 2, "selected": false, "text": "SELECT TOP 3 FROM \n" }, { "answer_id": 27327, "author": "Portman", "author_id": 1690, "author_profile": "htt...
2008/08/07
[ "https://Stackoverflow.com/questions/4221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/519/" ]
4,227
<p>I'm using a <code>Dictionary&lt;string, int&gt;</code> where the <code>int</code> is a count of the key.</p> <p>Now, I need to access the last-inserted Key inside the Dictionary, but I do not know the name of it. The obvious attempt:</p> <pre><code>int LastCount = mydict[mydict.keys[mydict.keys.Count]]; </code></p...
[ { "answer_id": 4252, "author": "Patrick", "author_id": 429, "author_profile": "https://Stackoverflow.com/users/429", "pm_score": 3, "selected": false, "text": "string[] temp = new string[mydict.count];\nmydict.Keys.CopyTo(temp, 0)\nint LastCount = mydict[temp[mydict.count - 1]]\n" }, ...
2008/08/07
[ "https://Stackoverflow.com/questions/4227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
4,230
<p>I've been doing ASP.NET development for a little while now, and I've used both the GridView and the DataGrid controls before for various things, but I never could find a really good reason to use one or the other. I'd like to know:</p> <p>What is the difference between these 2 ASP.NET controls? What are the advanta...
[ { "answer_id": 21901381, "author": "Suhaib Janjua", "author_id": 3240038, "author_profile": "https://Stackoverflow.com/users/3240038", "pm_score": 4, "selected": false, "text": "GridView DataGrid DataGrid GridView DataGrid GridView DataSource DataGrid GridView WebControl DataGrid DataGri...
2008/08/07
[ "https://Stackoverflow.com/questions/4230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/392/" ]
4,242
<p>I want to convert a primitive to a string, and I tried:</p> <pre><code>myInt.toString(); </code></pre> <p>This fails with the error:</p> <pre><code>int cannot be dereferenced </code></pre> <p>Now, I get that primitives are not reference types (ie, not an Object) and so cannot have methods. However, Java 5 intro...
[ { "answer_id": 4247, "author": "Justin Standard", "author_id": 92, "author_profile": "https://Stackoverflow.com/users/92", "pm_score": 7, "selected": true, "text": "myInt Integer.toString(myInt);\n" }, { "answer_id": 4256, "author": "Patrick", "author_id": 429, "autho...
2008/08/07
[ "https://Stackoverflow.com/questions/4242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122/" ]
4,269
<p>What is the best way to programmatically send an SMS text message?</p> <p>Are there any free Web Service based SMS gateways?</p> <p>I know that if I happen to know the user's carrier (Sprint, AT&amp;T, etc), I can send an <a href="http://en.wikipedia.org/wiki/SMS_gateways" rel="noreferrer">SMS by emailing an addre...
[ { "answer_id": 429566, "author": "masfenix", "author_id": 50312, "author_profile": "https://Stackoverflow.com/users/50312", "pm_score": -1, "selected": false, "text": "[email protected]" } ]
2008/08/07
[ "https://Stackoverflow.com/questions/4269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/357/" ]
4,287
<p>I have a process in erlang that is supposed to do something immediately after spawn, then send the result back to the parent when it is finished. How do I figure out the PID of the process that spawned it?</p>
[ { "answer_id": 4304, "author": "Lily Ballard", "author_id": 582, "author_profile": "https://Stackoverflow.com/users/582", "pm_score": 5, "selected": true, "text": "spawn_link(?MODULE, child, [self()]).\n" }, { "answer_id": 1261457, "author": "rvirding", "author_id": 77617...
2008/08/07
[ "https://Stackoverflow.com/questions/4287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/121/" ]
4,306
<p>I am working on a project that requires the manipulation of enormous matrices, specifically pyramidal summation for a copula calculation. </p> <p>In short, I need to keep track of a relatively small number of values (usually a value of 1, and in rare cases more than 1) in a sea of zeros in the matrix (multidimensi...
[ { "answer_id": 4311, "author": "Mark Harrison", "author_id": 116, "author_profile": "https://Stackoverflow.com/users/116", "pm_score": 6, "selected": true, "text": "#include <stdio.h>\n#include <stdlib.h>\n#include <map>\n\nclass triple {\npublic:\n int x;\n int y;\n int z;\n ...
2008/08/07
[ "https://Stackoverflow.com/questions/4306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/522/" ]
4,369
<p>I have a directory structure like the following;</p> <blockquote> <p>script.php</p> <p>inc/include1.php<br/> inc/include2.php</p> <p>objects/object1.php<br/> objects/object2.php</p> <p>soap/soap.php</p> </blockquote> <p>Now, I use those objects in both <code>script.php</code> and <code>/soap/s...
[ { "answer_id": 4385, "author": "Peter Coulton", "author_id": 117, "author_profile": "https://Stackoverflow.com/users/117", "pm_score": 8, "selected": true, "text": "$root = realpath($_SERVER[\"DOCUMENT_ROOT\"]);\n\ninclude \"$root/inc/include1.php\";\n" }, { "answer_id": 4388, ...
2008/08/07
[ "https://Stackoverflow.com/questions/4369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/264/" ]
4,371
<p>I lost my MySQL username and password. How do I retrieve it?</p>
[ { "answer_id": 4376, "author": "Xenph Yan", "author_id": 264, "author_profile": "https://Stackoverflow.com/users/264", "pm_score": 9, "selected": true, "text": "SELECT * FROM mysql.user;\n UPDATE mysql.user SET Password=PASSWORD('[password]') WHERE User='[username]';\n" }, { "ans...
2008/08/07
[ "https://Stackoverflow.com/questions/4371", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131/" ]
4,393
<p>How can I drop all tables whose names begin with a given string? </p> <p>I think this can be done with some dynamic SQL and the <code>INFORMATION_SCHEMA</code> tables.</p>
[ { "answer_id": 4394, "author": "Xenph Yan", "author_id": 264, "author_profile": "https://Stackoverflow.com/users/264", "pm_score": 7, "selected": false, "text": "SELECT 'DROP TABLE \"' + TABLE_NAME + '\"' \nFROM INFORMATION_SCHEMA.TABLES \nWHERE TABLE_NAME LIKE '[prefix]%'\n SELECT 'IF O...
2008/08/07
[ "https://Stackoverflow.com/questions/4393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/369/" ]
4,416
<p>I am walking through the MS Press Windows Workflow Step-by-Step book and in chapter 8 it mentions a tool with the filename "wca.exe". This is supposed to be able to generate workflow communication helper classes based on an interface you provide it. I can't find that file. I thought it would be in the latest .NET...
[ { "answer_id": 4394, "author": "Xenph Yan", "author_id": 264, "author_profile": "https://Stackoverflow.com/users/264", "pm_score": 7, "selected": false, "text": "SELECT 'DROP TABLE \"' + TABLE_NAME + '\"' \nFROM INFORMATION_SCHEMA.TABLES \nWHERE TABLE_NAME LIKE '[prefix]%'\n SELECT 'IF O...
2008/08/07
[ "https://Stackoverflow.com/questions/4416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/404/" ]