qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
1,042
<p>For instance, my query is like the following using SQL Server 2005:</p> <pre><code>SELECT * FROM Table WHERE FREETEXT(SearchField, 'c#') </code></pre> <p>I have a full text index defined to use the column SearchField which returns results when using:</p> <pre><code>SELECT * FROM Table WHERE SearchField LIKE '%c#%' </code></pre> <p>I believe # is a special letter, so how do I allow FREETEXT to work correctly for the query above?</p>
[ { "answer_id": 1047, "author": "Ishmaeel", "author_id": 227, "author_profile": "https://Stackoverflow.com/users/227", "pm_score": 1, "selected": false, "text": "MSSQL" } ]
2008/08/04
[ "https://Stackoverflow.com/questions/1042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2/" ]
1,053
<p>Most mathematicians agree that:</p> <blockquote> <p>e<sup>πi</sup> + 1 = 0</p> </blockquote> <p>However, most floating point implementations disagree. How well can we settle this dispute?</p> <p>I'm keen to hear about different languages and implementations, and various methods to make the result as close to zero as possible. Be creative!</p>
[ { "answer_id": 1054, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 3, "selected": false, "text": "(+ 1 (make-polar 1 (atan 0 -1)))" }, { "answer_id": 26026, "author": "dmckee --- ex-moderator kitten", "author...
2008/08/04
[ "https://Stackoverflow.com/questions/1053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13/" ]
1,064
<p>I'd like to display 100 floating cubes using <code>DirectX</code> or <code>OpenGL</code>.</p> <p>I'm looking for either some sample source code, or a description of the technique. I have trouble getting more one cube to display correctly.</p> <p>I've combed the net for a good series of tutorials and although they talk about how to do <code>3D</code> primitives, what I can't find is information on how to do large numbers of <code>3D</code> primitives - <code>cubes</code>, <code>spheres</code>, <code>pyramids</code>, and so forth.</p>
[ { "answer_id": 1096, "author": "Redbaron", "author_id": 41, "author_profile": "https://Stackoverflow.com/users/41", "pm_score": 4, "selected": true, "text": "void DrawCube()\n{\n //code to draw the cube\n}\n\nvoid DisplayCubes()\n{\n for(int i = 0; i < 10; ++i)\n { \n ...
2008/08/04
[ "https://Stackoverflow.com/questions/1064", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
1,069
<p>I'm working on a <strong>multithreaded</strong> C++ application that is corrupting the heap. The usual tools to locate this corruption seem to be inapplicable. Old builds (18 months old) of the source code exhibit the same behaviour as the most recent release, so this has been around for a long time and just wasn't noticed; on the downside, source deltas can't be used to identify when the bug was introduced - there are <em>a lot</em> of code changes in the repository.</p> <p>The prompt for crashing behaviuor is to generate throughput in this system - socket transfer of data which is munged into an internal representation. I have a set of test data that will periodically cause the app to exception (various places, various causes - including heap alloc failing, thus: heap corruption).</p> <p>The behaviour seems related to CPU power or memory bandwidth; the more of each the machine has, the easier it is to crash. Disabling a hyper-threading core or a dual-core core reduces the rate of (but does not eliminate) corruption. This suggests a timing related issue.</p> <p>Now here's the rub:<br> When it's run under a lightweight debug environment (say <code>Visual Studio 98 / AKA MSVC6</code>) the heap corruption is reasonably easy to reproduce - ten or fifteen minutes pass before something fails horrendously and exceptions, like an <code>alloc;</code> when running under a sophisticated debug environment (Rational Purify, <code>VS2008/MSVC9</code> or even Microsoft Application Verifier) the system becomes memory-speed bound and doesn't crash (Memory-bound: CPU is not getting above <code>50%</code>, disk light is not on, the program's going as fast it can, box consuming <code>1.3G</code> of 2G of RAM). So, <strong>I've got a choice between being able to reproduce the problem (but not identify the cause) or being able to idenify the cause or a problem I can't reproduce.</strong></p> <p>My current best guesses as to where to next is:</p> <ol> <li>Get an insanely grunty box (to replace the current dev box: 2Gb RAM in an <code>E6550 Core2 Duo</code>); this will make it possible to repro the crash causing mis-behaviour when running under a powerful debug environment; or</li> <li>Rewrite operators <code>new</code> and <code>delete</code> to use <code>VirtualAlloc</code> and <code>VirtualProtect</code> to mark memory as read-only as soon as it's done with. Run under <code>MSVC6</code> and have the OS catch the bad-guy who's writing to freed memory. Yes, this is a sign of desperation: who the hell rewrites <code>new</code> and <code>delete</code>?! I wonder if this is going to make it as slow as under Purify et al.</li> </ol> <p>And, no: Shipping with Purify instrumentation built in is not an option.</p> <p>A colleague just walked past and asked "Stack Overflow? Are we getting stack overflows now?!?"</p> <p>And now, the question: <strong>How do I locate the heap corruptor?</strong></p> <hr> <p>Update: balancing <code>new[]</code> and <code>delete[]</code> seems to have gotten a long way towards solving the problem. Instead of 15mins, the app now goes about two hours before crashing. Not there yet. Any further suggestions? The heap corruption persists.</p> <p>Update: a release build under Visual Studio 2008 seems dramatically better; current suspicion rests on the <code>STL</code> implementation that ships with <code>VS98</code>.</p> <hr> <blockquote> <ol start="3"> <li>Reproduce the problem. <code>Dr Watson</code> will produce a dump that might be helpful in further analysis. </li> </ol> </blockquote> <p>I'll take a note of that, but I'm concerned that Dr Watson will only be tripped up after the fact, not when the heap is getting stomped on.</p> <blockquote> <p>Another try might be using <code>WinDebug</code> as a debugging tool which is quite powerful being at the same time also lightweight.</p> </blockquote> <p>Got that going at the moment, again: not much help until something goes wrong. I want to catch the vandal in the act.</p> <blockquote> <p>Maybe these tools will allow you at least to narrow the problem to certain component.</p> </blockquote> <p>I don't hold much hope, but desperate times call for...</p> <blockquote> <p>And are you sure that all the components of the project have correct runtime library settings (<code>C/C++ tab</code>, Code Generation category in VS 6.0 project settings)?</p> </blockquote> <p>No I'm not, and I'll spend a couple of hours tomorrow going through the workspace (58 projects in it) and checking they're all compiling and linking with the appropriate flags. <hR> Update: This took 30 seconds. Select all projects in the <code>Settings</code> dialog, unselect until you find the project(s) that don't have the right settings (they all had the right settings).</p>
[ { "answer_id": 1073, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 6, "selected": true, "text": "low-level alloc API" }, { "answer_id": 3329, "author": "Michal Sznajder", "author_id": 501, "author_profile":...
2008/08/04
[ "https://Stackoverflow.com/questions/1069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/257/" ]
1,070
<p>What is the correct way to get the process size on <code>Solaris, HP-UX</code> and <code>AIX</code>? Should we use <code>top</code> or <code>ps -o vsz</code> or something else?</p>
[ { "answer_id": 1082, "author": "Mark Harrison", "author_id": 116, "author_profile": "https://Stackoverflow.com/users/116", "pm_score": 2, "selected": false, "text": "ps u" }, { "answer_id": 1773, "author": "John Siracusa", "author_id": 164, "author_profile": "https://...
2008/08/04
[ "https://Stackoverflow.com/questions/1070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/236/" ]
1,104
<p>Exceptions in C++ don't need to be caught (no compile time errors) by the calling function. So it's up to developer's judgment whether to catch them using try/catch (unlike in Java).</p> <p>Is there a way one can ensure that the exceptions thrown are always caught using try/catch by the calling function?</p>
[ { "answer_id": 1454, "author": "shsteimer", "author_id": 292, "author_profile": "https://Stackoverflow.com/users/292", "pm_score": 2, "selected": false, "text": "c[++]" }, { "answer_id": 126184, "author": "Scott Langham", "author_id": 11898, "author_profile": "https:/...
2008/08/04
[ "https://Stackoverflow.com/questions/1104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/236/" ]
1,108
<p>Given that indexing is so important as your data set increases in size, can someone explain how indexing works at a database-agnostic level?</p> <p>For information on queries to index a field, check out <a href="https://stackoverflow.com/questions/1156/">How do I index a database column</a>.</p>
[ { "answer_id": 1130, "author": "Xenph Yan", "author_id": 264, "author_profile": "https://Stackoverflow.com/users/264", "pm_score": 13, "selected": true, "text": "(N+1)/2" }, { "answer_id": 16302431, "author": "Der U", "author_id": 2331665, "author_profile": "https://S...
2008/08/04
[ "https://Stackoverflow.com/questions/1108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/264/" ]
1,145
<p>I've tried to write a string replace function in C, which works on a <code>char *</code>, which has been allocated using <code>malloc()</code>. It's a little different in that it will find and replace strings, rather than characters in the starting string.</p> <p>It's trivial to do if the search and replace strings are the same length (or the replace string is shorter than the search string), since I have enough space allocated. If I try to use <code>realloc()</code>, I get an error that tells me I am doing a double free - which I don't see how I am, since I am only using <code>realloc()</code>.</p> <p>Perhaps a little code will help:</p> <pre><code>void strrep(char *input, char *search, char *replace) { int searchLen = strlen(search); int replaceLen = strlen(replace); int delta = replaceLen - searchLen; char *find = input; while (find = strstr(find, search)) { if (delta &gt; 0) { realloc(input, strlen(input) + delta); find = strstr(input, search); } memmove(find + replaceLen, find + searchLen, strlen(input) - (find - input)); memmove(find, replace, replaceLen); } } </code></pre> <p>The program works, until I try to <code>realloc()</code> in an instance where the replaced string will be longer than the initial string. (It still kind of works, it just spits out errors as well as the result).</p> <p>If it helps, the calling code looks like:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; void strrep(char *input, char *search, char *replace); int main(void) { char *input = malloc(81); while ((fgets(input, 81, stdin)) != NULL) { strrep(input, "Noel", "Christmas"); } } </code></pre>
[ { "answer_id": 1149, "author": "John Downey", "author_id": 200, "author_profile": "https://Stackoverflow.com/users/200", "pm_score": 3, "selected": false, "text": "input = realloc(input, strlen(input) + delta);\n" }, { "answer_id": 1154, "author": "Vincent Robert", "autho...
2008/08/04
[ "https://Stackoverflow.com/questions/1145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/188/" ]
1,156
<p>Hopefully, I can get answers for each database server.</p> <p>For an outline of how indexing works check out: <a href="https://stackoverflow.com/questions/1108/how-does-database-indexing-work">How does database indexing work?</a></p>
[ { "answer_id": 1157, "author": "John Downey", "author_id": 200, "author_profile": "https://Stackoverflow.com/users/200", "pm_score": 7, "selected": true, "text": "CREATE INDEX [index name] ON [table name] ( [column name] )\n" }, { "answer_id": 9853, "author": "Eric Z Beard", ...
2008/08/04
[ "https://Stackoverflow.com/questions/1156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/264/" ]
1,160
<p>I am using CCNET on a sample project with SVN as my source control. CCNET is configured to create a build on every check in. CCNET uses MSBuild to build the source code.</p> <p>I would like to use the latest revision number to generate <code>AssemblyInfo.cs</code> while compiling. How can I retrieve the latest revision from subversion and use the value in CCNET?</p> <p>Edit: I'm not using NAnt - only MSBuild.</p>
[ { "answer_id": 1168, "author": "hitec", "author_id": 120, "author_profile": "https://Stackoverflow.com/users/120", "pm_score": 2, "selected": false, "text": "CCNET" }, { "answer_id": 1169, "author": "lubos hasko", "author_id": 275, "author_profile": "https://Stackover...
2008/08/04
[ "https://Stackoverflow.com/questions/1160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/120/" ]
1,171
<p>I need to be able to manipulate a large (10^7 nodes) graph in python. The data corresponding to each node/edge is minimal, say, a small number of strings. What is the most efficient, in terms of <strong><em>memory and speed</em></strong>, way of doing this? </p> <p>A dict of dicts is more flexible and simpler to implement, but I intuitively expect a list of lists to be faster. The list option would also require that I keep the data separate from the structure, while dicts would allow for something of the sort:</p> <pre><code>graph[I][J]["Property"]="value" </code></pre> <p>What would you suggest?</p> <hr> <p>Yes, I should have been a bit clearer on what I mean by efficiency. In this particular case I mean it in terms of random access retrieval.</p> <p>Loading the data in to memory isn't a huge problem. That's done once and for all. The time consuming part is visiting the nodes so I can extract the information and measure the metrics I'm interested in.</p> <p>I hadn't considered making each node a class (properties are the same for all nodes) but it seems like that would add an extra layer of overhead? I was hoping someone would have some direct experience with a similar case that they could share. After all, graphs are one of the most common abstractions in CS.</p>
[ { "answer_id": 28705, "author": "Ryan Cox", "author_id": 620, "author_profile": "https://Stackoverflow.com/users/620", "pm_score": 7, "selected": true, "text": "\n\"\"\"\nCreate an G{n,m} random graph with n nodes and m edges\nand report some properties.\n\nThis graph is sometimes called...
2008/08/04
[ "https://Stackoverflow.com/questions/1171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/280/" ]
1,180
<p>I am looking to allow users to control of subdomain of an app I am toying with, much like Basecamp where it is <code>customusername.seework.com</code>.</p> <p>What is required on the <code>DNS</code> end to allow these to be created dynamically and be available instantly. </p> <p>And how do you recommend dealing with this in the logic of the site? <code>Htaccess</code> rule to lookup the subdomain in the <code>DB</code>?</p>
[ { "answer_id": 1187, "author": "lubos hasko", "author_id": 275, "author_profile": "https://Stackoverflow.com/users/275", "pm_score": 3, "selected": false, "text": "*.YOURDOMAIN.COM A 123.123.123.123\n" }, { "answer_id": 1232, "author": "Mat", "author_id": 48, "author_...
2008/08/04
[ "https://Stackoverflow.com/questions/1180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/281/" ]
1,237
<p>I have a file in the following format:</p> <pre> Data Data Data [Start] Data I want [End] Data </pre> <p>I'd like to grab the <code>Data I want</code> from between the <code>[Start]</code> and <code>[End]</code> tags using a Regex. Can anyone show me how this might be done?</p>
[ { "answer_id": 1240, "author": "Karl Seguin", "author_id": 34, "author_profile": "https://Stackoverflow.com/users/34", "pm_score": 6, "selected": false, "text": "\\[start\\](.*?)\\[end\\]\n" }, { "answer_id": 1243, "author": "Xenph Yan", "author_id": 264, "author_prof...
2008/08/04
[ "https://Stackoverflow.com/questions/1237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/230/" ]
1,284
<p>I am looking for a tool that can detect malicious requests (such as obvious SQL injection gets or posts) and will immediately ban the IP address of the requester/add to a blacklist. I am aware that in an ideal world our code should be able to handle such requests and treat them accordingly, but there is a lot of value in such a tool even when the site is safe from these kinds of attacks, as it can lead to saving bandwidth, preventing bloat of analytics, etc.</p> <p>Ideally, I'm looking for a cross-platform (<code>LAMP/.NET</code>) solution that sits at a higher level than the technology stack; perhaps at the web-server or hardware level. I'm not sure if this exists, though.</p> <p>Either way, I'd like to hear the community's feedback so that I can see what my options might be with regard to implementation and approach.</p>
[ { "answer_id": 1317, "author": "Mat", "author_id": 48, "author_profile": "https://Stackoverflow.com/users/48", "pm_score": 3, "selected": false, "text": " DROP TABLE users;\n" } ]
2008/08/04
[ "https://Stackoverflow.com/questions/1284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
1,292
<p>I have a Queue&lt;T&gt; object that I have initialised to a capacity of 2, but obviously that is just the capacity and it keeps expanding as I add items. Is there already an object that automatically dequeues an item when the limit is reached, or is the best solution to create my own inherited class?</p>
[ { "answer_id": 1297, "author": "CodingWithoutComments", "author_id": 25, "author_profile": "https://Stackoverflow.com/users/25", "pm_score": 2, "selected": false, "text": "Queue<T>" }, { "answer_id": 1305, "author": "tags2k", "author_id": 192, "author_profile": "https...
2008/08/04
[ "https://Stackoverflow.com/questions/1292", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192/" ]
1,304
<p>Is there any way to check whether a file is locked without using a try/catch block? </p> <p>Right now, the only way I know of is to just open the file and catch any <code>System.IO.IOException</code>.</p>
[ { "answer_id": 1309, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 8, "selected": true, "text": "if not locked then\n open and update file\n" }, { "answer_id": 3202085, "author": "DixonD", "author_i...
2008/08/04
[ "https://Stackoverflow.com/questions/1304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/121/" ]
1,313
<p><a href="https://stackoverflow.com/questions/180/function-for-creating-color-wheels">Original Question</a></p> <p>I am looking for a function that attempts to quantify how "distant" (or distinct) two colors are. This question is really in two parts: </p> <ol> <li>What color space best represents human vision?</li> <li>What distance metric in that space best represents human vision (euclidean?)</li> </ol>
[ { "answer_id": 74033, "author": "DarenW", "author_id": 10468, "author_profile": "https://Stackoverflow.com/users/10468", "pm_score": 7, "selected": true, "text": "a" }, { "answer_id": 19416874, "author": "Community", "author_id": -1, "author_profile": "https://Stackov...
2008/08/04
[ "https://Stackoverflow.com/questions/1313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2089740/" ]
1,323
<p><a href="https://stackoverflow.com/questions/180/function-for-creating-color-wheels">Original Question</a></p> <p>If you are given N maximally distant colors (and some associated distance metric), can you come up with a way to sort those colors into some order such that the first M are also reasonably close to being a maximally distinct set?</p> <p>In other words, given a bunch of distinct colors, come up with an ordering so I can use as many colors as I need starting at the beginning and be reasonably assured that they are all distinct and that nearby colors are also very distinct (e.g., bluish red isn't next to reddish blue).</p> <p>Randomizing is OK but certainly not optimal.</p> <p><em>Clarification: Given some large and visually distinct set of colors (say 256, or 1024), I want to sort them such that when I use the first, say, 16 of them that I get a relatively visually distinct subset of colors. This is equivalent, roughly, to saying I want to sort this list of 1024 so that the closer individual colors are visually, the farther apart they are on the list.</em></p>
[ { "answer_id": 1342, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 1, "selected": false, "text": "XX XX XX\nRR GG BB\n\n00 00 00 = black\nff ff ff = white\nff 00 00 = red\n00 ff 00 = green\n00 00 ff = blue\n" }, { "...
2008/08/04
[ "https://Stackoverflow.com/questions/1323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2089740/" ]
1,329
<p>I need to copy hundreds of gigs of random files around on my computer and am pretty leery of using the vanilla file copy built into Windows.</p> <p>I don't want it to hang on a "Are you sure?", "Are you really sure?", "Even zip files?", "Surely not read-only files too!" loop as soon as I step away.</p> <p>I don't want it to work for hours and then stop unexpectedly: "Someone once opened this file and so I won't copy it!" and then cancel the whole copy or just quit with no indication of what was done and what work remains.</p> <p>What file management programs do you have experience with? Which do you recommend?</p> <p>This question is related to my other question: <a href="https://stackoverflow.com/questions/225/how-can-i-use-an-old-pata-hard-disk-drive-on-my-newer-sata-only-computer">How can I use an old PATA hard disk drive on my newer SATA-only computer?</a></p>
[ { "answer_id": 1331, "author": "huseyint", "author_id": 39, "author_profile": "https://Stackoverflow.com/users/39", "pm_score": 6, "selected": false, "text": "xcopy /?\n" }, { "answer_id": 1339, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Sta...
2008/08/04
[ "https://Stackoverflow.com/questions/1329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
1,376
<p>I need the name of the current logged in user in my <strong>Air/Flex</strong> application. The application will only be deployed on Windows machines. I think I could attain this by regexing the User directory, but am open to other ways.</p>
[ { "answer_id": 1380, "author": "Shawn", "author_id": 26, "author_profile": "https://Stackoverflow.com/users/26", "pm_score": 1, "selected": false, "text": "public static function GetCurrentOSUser():String{\n // XP & Vista only.\n var userDirectory:String = File.userDirectory.resolv...
2008/08/04
[ "https://Stackoverflow.com/questions/1376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26/" ]
1,383
<p>I saw many questions asking 'how' to unit test in a specific language, but no question asking 'what', 'why', and 'when'.</p> <ul> <li>What is it?</li> <li>What does it do for me?</li> <li>Why should I use it?</li> <li>When should I use it (also when not)?</li> <li>What are some common pitfalls and misconceptions</li> </ul>
[ { "answer_id": 2443027, "author": "AndiDog", "author_id": 245706, "author_profile": "https://Stackoverflow.com/users/245706", "pm_score": 2, "selected": false, "text": "Assert.AreEqual(expectedValue, actualValue, \"some description\")" } ]
2008/08/04
[ "https://Stackoverflow.com/questions/1383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/314/" ]
1,390
<p>I'm setting up a dedicated SQL Server 2005 box on Windows Server 2008 this week, and would like to pare it down to be as barebones as possible while still being fully functional.</p> <p>To that end, the "Server Core" option sounds appealing, but I'm not clear about whether or not I can run SQL Server on that SKU. Several services are addressed on the <a href="http://www.microsoft.com/windowsserver2008/en/us/compare-core-installation.aspx" rel="noreferrer">Microsoft website</a>, but I don't see any indication about SQL Server.</p> <p>Does anyone know definitively?</p>
[ { "answer_id": 15209, "author": "benjaminperdomo", "author_id": 295, "author_profile": "https://Stackoverflow.com/users/295", "pm_score": 2, "selected": false, "text": ".net" } ]
2008/08/04
[ "https://Stackoverflow.com/questions/1390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60/" ]
1,401
<p>I have a custom validation function in JavaScript in a user control on a .Net 2.0 web site which checks to see that the fee paid is not in excess of the fee amount due. </p> <p>I've placed the validator code in the <code>ascx</code> file, and I have also tried using <code>Page.ClientScript.RegisterClientScriptBlock()</code> and in both cases the validation fires, but cannot find the JavaScript function.</p> <p>The output in Firefox's error console is <code>"feeAmountCheck is not defined"</code>. Here is the function (this was taken directly from firefox->view source)</p> <pre><code>&lt;script type="text/javascript"&gt; function feeAmountCheck(source, arguments) { var amountDue = document.getElementById('ctl00_footerContentHolder_Fees1_FeeDue'); var amountPaid = document.getElementById('ctl00_footerContentHolder_Fees1_FeePaid'); if (amountDue.value &gt; 0 &amp;&amp; amountDue &gt;= amountPaid) { arguments.IsValid = true; } else { arguments.IsValid = false; } return arguments; } &lt;/script&gt; </code></pre> <p>Any ideas as to why the function isn't being found? How can I remedy this without having to add the function to my master page or consuming page?</p>
[ { "answer_id": 1405, "author": "brendan", "author_id": 225, "author_profile": "https://Stackoverflow.com/users/225", "pm_score": 3, "selected": false, "text": "ScriptManager.RegisterClientScriptBlock\n" }, { "answer_id": 1418, "author": "Greg Hurlman", "author_id": 35, ...
2008/08/04
[ "https://Stackoverflow.com/questions/1401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/149/" ]
1,408
<p>Is it possible to configure <a href="http://www.apachefriends.org/en/xampp.html" rel="noreferrer">xampp</a> to serve up a file outside of the <code>htdocs</code> directory?</p> <p>For instance, say I have a file located as follows:</p> <p><code>C:\projects\transitCalculator\trunk\TransitCalculator.php</code></p> <p>and my <a href="http://www.apachefriends.org/en/xampp.html" rel="noreferrer">xampp</a> files are normally served out from:</p> <p><code>C:\xampp\htdocs\</code></p> <p>(because that's the default configuration) Is there some way to make Apache recognize and serve up my <code>TransitCalculator.php</code> file without moving it under <code>htdocs</code>? Preferably I'd like Apache to serve up/have access to the entire contents of the projects directory, and I don't want to move the projects directory under <code>htdocs</code>.</p> <p>edit: edited to add Apache to the question title to make Q/A more "searchable"</p>
[ { "answer_id": 1421, "author": "cmcculloh", "author_id": 58, "author_profile": "https://Stackoverflow.com/users/58", "pm_score": 10, "selected": true, "text": "NameVirtualHost *:80" }, { "answer_id": 2471, "author": "pix0r", "author_id": 72, "author_profile": "https:/...
2008/08/04
[ "https://Stackoverflow.com/questions/1408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58/" ]
1,451
<p>I often encounter the following scenario where I need to offer many different types of permissions. I primarily use ASP.NET / VB.NET with SQL Server 2000.</p> <p><strong>Scenario</strong></p> <p>I want to offer a dynamic permission system that can work on different parameters. Let's say that I want to give either a department or just a specific person access to an application. And pretend that we have a number of applications that keeps growing.</p> <p>In the past, I have chosen one of the following two ways that I know to do this.</p> <ol> <li><p>Use a single permission table with special columns that are used for determining a how to apply the parameters. The special columns in this example are <code>TypeID</code> and <code>TypeAuxID</code>. The SQL would look something like this.</p> <pre><code>SELECT COUNT(PermissionID) FROM application_permissions WHERE (TypeID = 1 AND TypeAuxID = @UserID) OR (TypeID = 2 AND TypeAuxID = @DepartmentID) AND ApplicationID = 1 </code></pre> </li> <li><p>Use a mapping table for each type of permission, then joining them all together.</p> <pre><code>SELECT COUNT(perm.PermissionID) FROM application_permissions perm LEFT JOIN application_UserPermissions emp ON perm.ApplicationID = emp.ApplicationID LEFT JOIN application_DepartmentPermissions dept ON perm.ApplicationID = dept.ApplicationID WHERE q.SectionID=@SectionID AND (emp.UserID=@UserID OR dept.DeptID=@DeptID OR (emp.UserID IS NULL AND dept.DeptID IS NULL)) AND ApplicationID = 1 ORDER BY q.QID ASC </code></pre> </li> </ol> <p><strong>My Thoughts</strong></p> <p>I hope that the examples make sense. I cobbled them together.</p> <p>The first example requires less work, but neither of them feel like the best answer. Is there a better way to handle this?</p>
[ { "answer_id": 1466, "author": "tags2k", "author_id": 192, "author_profile": "https://Stackoverflow.com/users/192", "pm_score": 0, "selected": false, "text": "new PermissionToken()\n{\n Target = PermissionTokenTarget.Application,\n Action = PermissionTokenAction.View,\n Value = ...
2008/08/04
[ "https://Stackoverflow.com/questions/1451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/106/" ]
1,453
<p>I'm trying to do this (which produces an unexpected T_VARIABLE error):</p> <pre><code>public function createShipment($startZip, $endZip, $weight = $this-&gt;getDefaultWeight()){} </code></pre> <p>I don't want to put a magic number in there for weight since the object I am using has a <code>"defaultWeight"</code> parameter that all new shipments get if you don't specify a weight. I can't put the <code>defaultWeight</code> in the shipment itself, because it changes from shipment group to shipment group. Is there a better way to do it than the following?</p> <pre><code>public function createShipment($startZip, $endZip, weight = 0){ if($weight &lt;= 0){ $weight = $this-&gt;getDefaultWeight(); } } </code></pre>
[ { "answer_id": 1456, "author": "Kevin", "author_id": 40, "author_profile": "https://Stackoverflow.com/users/40", "pm_score": 5, "selected": true, "text": "public function createShipment($startZip, $endZip, $weight=null){\n $weight = !$weight ? $this->getDefaultWeight() : $weight;\n}\n...
2008/08/04
[ "https://Stackoverflow.com/questions/1453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58/" ]
1,457
<p>I'm writing an AJAX app, but as the user moves through the app, I'd like the URL in the address bar to update despite the lack of page reloads. Basically, I'd like for them to be able to bookmark at any point and thereby return to the current state. </p> <p>How are people handling maintaining RESTfulness in AJAX apps? </p>
[ { "answer_id": 1465, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": false, "text": "var encodedState = base64(json(state));\nvar newLocation = oldLocationWithoutFragment + \"#\" + encodedState;\n\ndocument.locati...
2008/08/04
[ "https://Stackoverflow.com/questions/1457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/331/" ]
1,476
<p>How do you express an integer as a binary number with Python literals?</p> <p>I was easily able to find the answer for hex:</p> <pre><code>&gt;&gt;&gt; 0x12AF 4783 &gt;&gt;&gt; 0x100 256 </code></pre> <p>and octal:</p> <pre><code>&gt;&gt;&gt; 01267 695 &gt;&gt;&gt; 0100 64 </code></pre> <p><strong>How do you use literals to express binary in Python?</strong></p> <hr> <p><strong><em>Summary of Answers</em></strong></p> <ul> <li>Python 2.5 and earlier: can express binary using <code>int('01010101111',2)</code> but not with a literal.</li> <li>Python 2.5 and earlier: there is <em>no way</em> to express binary literals.</li> <li>Python 2.6 beta: You can do like so: <code>0b1100111</code> or <code>0B1100111</code>.</li> <li>Python 2.6 beta: will also allow <code>0o27</code> or <code>0O27</code> (second character is the letter O) to represent an octal.</li> <li>Python 3.0 beta: Same as 2.6, but will no longer allow the older <code>027</code> syntax for octals.</li> </ul>
[ { "answer_id": 1484, "author": "Louis Brandy", "author_id": 2089740, "author_profile": "https://Stackoverflow.com/users/2089740", "pm_score": 6, "selected": false, "text": ">>> print int('01010101111',2)\n687\n>>> print int('11111111',2)\n255\n" }, { "answer_id": 13107, "auth...
2008/08/04
[ "https://Stackoverflow.com/questions/1476", "https://Stackoverflow.com", "https://Stackoverflow.com/users/92/" ]
1,496
<p>For those of us that like to use the graphical version of Vim or Emacs, instead of the console version, which version do you recommend?</p> <p>For Vim, there's <a href="http://sourceforge.net/projects/macosxvim/" rel="nofollow noreferrer">Mac OS X Vim</a>, <a href="http://code.google.com/p/macvim/" rel="nofollow noreferrer">MacVim</a>, <a href="http://code.google.com/p/vim-cocoa/" rel="nofollow noreferrer">Vim-Cocoa</a>.</p> <p>For Emacs, <a href="http://www.apple.com/downloads/macosx/unix_open_source/carbonemacspackage.html" rel="nofollow noreferrer">CarbonEmacs</a>, <a href="http://www.xemacs.org/" rel="nofollow noreferrer">XEmacs</a>, and <a href="http://aquamacs.org/" rel="nofollow noreferrer">Aquamacs</a>.</p> <p>Are there more? Which of these are ready for prime-time? If it's a tough call, what are the trade-offs? Are all of these still being maintained?</p> <p>No discussion of Vim versus Emacs, if you don't mind, or comparisons with other editors.</p>
[ { "answer_id": 29905, "author": "Alotor", "author_id": 2937, "author_profile": "https://Stackoverflow.com/users/2937", "pm_score": 1, "selected": false, "text": "sudo port install emacs\n" } ]
2008/08/04
[ "https://Stackoverflow.com/questions/1496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136/" ]
1,528
<p>I'm looking for some way to effectively hide inherited members. I have a library of classes which inherit from common base classes. Some of the more recent descendant classes inherit dependency properties which have become vestigial and can be a little confusing when using <em>IntelliSense</em> or using the classes in a visual designer.</p> <p>These classes are all controls that are written to be compiled for either WPF or Silverlight 2.0. I know about <code>ICustomTypeDescriptor</code> and <code>ICustomPropertyProvider</code>, but I'm pretty certain those can't be used in Silverlight. </p> <p>It's not as much a functional issue as a usability issue. What should I do?</p> <p><strong>Update</strong></p> <p>Some of the properties that I would really like to hide come from ancestors that are not my own and because of a specific tool I'm designing for, I can't do member hiding with the <code>new</code> operator. (I know, it's ridiculous)</p>
[ { "answer_id": 1533, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Stackoverflow.com/users/91", "pm_score": 4, "selected": false, "text": "Using System.ComponentModel;\n\n[EditorBrowsable(EditorBrowsableState.Never)]\nprivate string MyHiddenString = \"Muahahahahah...
2008/08/04
[ "https://Stackoverflow.com/questions/1528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/93/" ]
1,535
<p>I've never been completely happy with the way exception handling works, there's a lot exceptions and try/catch brings to the table (stack unwinding, etc.), but it seems to break a lot of the OO model in the process.</p> <p>Anyway, here's the problem:</p> <p>Let's say you have some class which wraps or includes networked file IO operations (e.g. reading and writing to some file at some particular UNC path somewhere). For various reasons you don't want those IO operations to fail, so if you detect that they fail you retry them and you keep retrying them until they succeed or you reach a timeout. I already have a convenient RetryTimer class which I can instantiate and use to sleep the current thread between retries and determine when the timeout period has elapsed, etc.</p> <p>The problem is that you have a bunch of IO operations in several methods of this class, and you need to wrap each of them in try-catch / retry logic.</p> <p>Here's an example code snippet:</p> <pre><code>RetryTimer fileIORetryTimer = new RetryTimer(TimeSpan.FromHours(10)); bool success = false; while (!success) { try { // do some file IO which may succeed or fail success = true; } catch (IOException e) { if (fileIORetryTimer.HasExceededRetryTimeout) { throw e; } fileIORetryTimer.SleepUntilNextRetry(); } } </code></pre> <p>So, how do you avoid duplicating most of this code for every file IO operation throughout the class? My solution was to use anonymous delegate blocks and a single method in the class which executed the delegate block passed to it. This allowed me to do things like this in other methods:</p> <pre><code>this.RetryFileIO( delegate() { // some code block } ); </code></pre> <p>I like this somewhat, but it leaves a lot to be desired. I'd like to hear how other people would solve this sort of problem.</p>
[ { "answer_id": 1554, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 2, "selected": false, "text": " public delegate void IoOperation(params string[] parameters);\n\n public void FileDeleteOperation(params string...
2008/08/04
[ "https://Stackoverflow.com/questions/1535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/332/" ]
1,598
<p>I'm not sure what the correct size should be.</p> <p>Many sites seem to repeat that the apple-touch-icon should be 57x57 pixels but cite a broken link as their source.</p> <p><a href="http://www.hanselman.com/blog/MakeYourWebsiteMobileAndIPhoneFriendlyAddHomeScreenIPhoneIconsAndAdjustTheViewPort.aspx" rel="noreferrer">Hanselman</a>'s and <a href="http://playgroundblues.com/posts/2008/jan/15/iphone-bookmark-iconage/" rel="noreferrer">playgroundblues</a>'s comments suggest different sizes including 163x163 and 60x60.</p> <p>Apple's own <a href="http://www.apple.com/apple-touch-icon.png" rel="noreferrer">apple.com icon</a> is 129x129!</p> <p>See my related question: <a href="https://stackoverflow.com/questions/1505/how-do-i-give-my-web-sites-an-icon-for-iphone">How do I give my web sites an icon for iPhone?</a></p>
[ { "answer_id": 19934092, "author": "felipep", "author_id": 2046846, "author_profile": "https://Stackoverflow.com/users/2046846", "pm_score": 0, "selected": false, "text": "<link rel=\"apple-touch-icon\" href=\"touch-icon-iphone.png\">\n<link rel=\"apple-touch-icon\" sizes=\"76x76\" href=...
2008/08/04
[ "https://Stackoverflow.com/questions/1598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
1,600
<p>When I want to make a copy of a database, I always create a new empty database, and then restore a backup of the existing database into it. However, I'm wondering if this is really the least error-prone, least complicated, and most efficient way to do this?</p>
[ { "answer_id": 1646, "author": "brendan", "author_id": 225, "author_profile": "https://Stackoverflow.com/users/225", "pm_score": 2, "selected": false, "text": "\nDeclare @OldDB varchar(100)\nDeclare @NewDB varchar(100)\nDeclare @vchBackupPath varchar(255)\nDeclare @query varchar(8000)\n\...
2008/08/04
[ "https://Stackoverflow.com/questions/1600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/230/" ]
1,607
<p>What are the best methods for tracking and/or automating DB schema changes? Our team uses Subversion for version control and we've been able to automate some of our tasks this way (pushing builds up to a staging server, deploying tested code to a production server) but we're still doing database updates manually. I would like to find or create a solution that allows us to work efficiently across servers with different environments while continuing to use Subversion as a backend through which code and DB updates are pushed around to various servers.</p> <p>Many popular software packages include auto-update scripts which detect DB version and apply the necessary changes. Is this the best way to do this even on a larger scale (across multiple projects and sometimes multiple environments and languages)? If so, is there any existing code out there that simplifies the process or is it best just to roll our own solution? Has anyone implemented something similar before and integrated it into Subversion post-commit hooks, or is this a bad idea?</p> <p>While a solution that supports multiple platforms would be preferable, we definitely need to support the Linux/Apache/MySQL/PHP stack as the majority of our work is on that platform.</p>
[ { "answer_id": 6226, "author": "Fabio Gomes", "author_id": 727, "author_profile": "https://Stackoverflow.com/users/727", "pm_score": 3, "selected": false, "text": "RegisterUpgrade(1, 'ALTER TABLE XX ADD XY CHAR(1) NOT NULL;');" }, { "answer_id": 22535, "author": "rix0rrr", ...
2008/08/04
[ "https://Stackoverflow.com/questions/1607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/72/" ]
1,610
<p>If I'm adding a column to a table in Microsoft SQL Server, can I control where the column is displayed logically in queries?</p> <p>I don't want to mess with the physical layout of columns on disk, but I would like to logically group columns together when possible so that tools like SQL Server Management Studio list the contents of the table in a convenient way.</p> <p>I know that I can do this through SQL Management Studio by going into their "design" mode for tables and dragging the order of columns around, but I'd like to be able to do it in raw SQL so that I can perform the ordering scripted from the command line.</p>
[ { "answer_id": 3571, "author": "Otto", "author_id": 519, "author_profile": "https://Stackoverflow.com/users/519", "pm_score": 3, "selected": false, "text": "SELECT * FROM TABLE" }, { "answer_id": 26786408, "author": "Steven", "author_id": 4224071, "author_profile": "h...
2008/08/04
[ "https://Stackoverflow.com/questions/1610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/328/" ]
1,615
<p>The <code>.XFDL</code> file extension identifies <code>XFDL</code> Formatted Document files. These belong to the XML-based document and template formatting standard. This format is exactly like the XML file format however, contains a level of encryption for use in secure communications.</p> <p>I know how to view XFDL files using a file viewer I found <a href="http://web.archive.org/web/20170903022252/http://www.e-publishing.af.mil:80/viewerdownload.asp" rel="nofollow noreferrer">here</a>. I can also modify and save these files by doing File:Save/Save As. I'd like, however, to modify these files on the fly. Any suggestions? Is this even possible?</p> <p>Update #1: I have now successfully decoded and unziped a <code>.xfdl</code> into an XML file which I can then edit. Now, I am looking for a way to re-encode the modified XML file back into base64-gzip (using Ruby or the command line)</p>
[ { "answer_id": 1628, "author": "saniul", "author_id": 52, "author_profile": "https://Stackoverflow.com/users/52", "pm_score": 4, "selected": true, "text": "application/vnd.xfdl;content-encoding=\"base64-gzip\"\n" }, { "answer_id": 3375, "author": "Federico Builes", "autho...
2008/08/04
[ "https://Stackoverflow.com/questions/1615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25/" ]
1,644
<p>Yes, Podcasts, those nice little Audiobooks I can listen to on the way to work. With the current amount of Podcasts, it's like searching a needle in a haystack, except that the haystack happens to be the Internet and is filled with too many of these &quot;Hot new Gadgets&quot; stuff :(</p> <p>Now, even though <strong>I</strong> am mainly a .NET developer nowadays, maybe anyone knows some good Podcasts from people regarding the whole software lifecycle? Unit Testing, Continous Integration, Documentation, Deployment...</p> <p>So - what are you guys and gals listening to?</p> <hr /> <p>Please note that the categorizations are somewhat subjective and may not be 100% accurate as many podcasts cover several areas. Categorization is made against what is considered the &quot;main&quot; area.</p> <h1>General Software Engineering / Productivity</h1> <ul> <li>[Stack Overflow ] <a href="https://blog.stackoverflow.com/category/podcasts/">1</a>(inactive, but still a good listen)</li> <li><a href="http://tekpub.com" rel="nofollow noreferrer">TekPub (Requires Paid Subscription)</a></li> <li><a href="http://www.se-radio.net/" rel="nofollow noreferrer">Software Engineering Radio</a></li> <li><a href="http://www.43folders.com/podcast" rel="nofollow noreferrer">43 Folders</a></li> <li><a href="http://perspectives.on10.net/" rel="nofollow noreferrer">Perspectives</a></li> <li><a href="http://www.drdobbs.com/tv/" rel="nofollow noreferrer">Dr. Dobb's</a> (now a video feed)</li> <li><a href="http://www.pragprog.com/podcasts" rel="nofollow noreferrer">The Pragmatic Podcast</a> (Inactive)</li> <li><a href="http://www.thoughtworks.com/what-we-say/podcasts.html" rel="nofollow noreferrer">IT Matters</a></li> <li><a href="http://agiletoolkit.libsyn.com/" rel="nofollow noreferrer">Agile Toolkit Podcast</a></li> <li><a href="http://thestacktrace.libsyn.com/" rel="nofollow noreferrer">The Stack Trace</a> (Inactive)</li> <li><a href="http://www.parleys.com/display/PARLEYS/Home#page=Home" rel="nofollow noreferrer">Parleys</a></li> <li><a href="http://techzinglive.com/" rel="nofollow noreferrer">Techzing</a></li> <li><a href="http://startuppodcast.wordpress.com/" rel="nofollow noreferrer">The Startup Success Podcast</a></li> <li><a href="http://webcast.berkeley.edu/course_feeds.php" rel="nofollow noreferrer">Berkeley CS class lectures</a></li> <li><a href="http://twit.tv/FLOSS" rel="nofollow noreferrer">FLOSS Weekly</a></li> <li><a href="http://www.thisdeveloperslife.com/" rel="nofollow noreferrer">This Developer's Life</a></li> </ul> <h1>.NET / Visual Studio / Microsoft</h1> <ul> <li><a href="http://herdingcode.com/" rel="nofollow noreferrer">Herding Code</a></li> <li><a href="http://www.hanselminutes.com/" rel="nofollow noreferrer">Hanselminutes</a></li> <li><a href="http://www.dotnetrocks.com/" rel="nofollow noreferrer">.NET Rocks!</a></li> <li><a href="http://deepfriedbytes.com/" rel="nofollow noreferrer">Deep Fried Bytes</a></li> <li><a href="http://altnetpodcast.com/" rel="nofollow noreferrer">Alt.Net Podcast</a> (inactive)</li> <li><a href="http://www.polymorphicpodcast.com/" rel="nofollow noreferrer">Polymorphic Podcast</a> (inconsistent)</li> <li><a href="http://www.sparklingclient.com/" rel="nofollow noreferrer">Sparkling Client (The Silverlight Podcast)</a></li> <li><a href="http://www.dnrtv.com/default.aspx" rel="nofollow noreferrer">dnrTV!</a></li> <li><a href="http://feeds.feedburner.com/SpaghettiCodePodcasts" rel="nofollow noreferrer">Spaghetti Code</a></li> <li><a href="http://aspnetpodcast.com/CS11/Default.aspx" rel="nofollow noreferrer">ASP.NET Podcast</a></li> <li><a href="http://channel9.msdn.com/Media/Podcasts/" rel="nofollow noreferrer">Channel 9</a></li> <li><a href="http://www.radiotfs.com/" rel="nofollow noreferrer">Radio TFS</a></li> <li><a href="http://feeds.feedburner.com/powerscripting" rel="nofollow noreferrer">PowerScripting Podcast</a></li> <li><a href="http://thirstydeveloper.com/" rel="nofollow noreferrer">The Thirsty Developer</a></li> <li><a href="http://elegantcode.com/elegantcode-cast/" rel="nofollow noreferrer">Elegant Code</a> (inactive)</li> <li><a href="http://www.connectedshow.com/" rel="nofollow noreferrer">ConnectedShow</a></li> <li><a href="http://craftycoders.com/?tag=/podcast" rel="nofollow noreferrer">Crafty Coders</a></li> <li><a href="http://codingqa.com" rel="nofollow noreferrer">Coding QA</a></li> </ul> <h1>jQuery</h1> <ul> <li><a href="http://yayquery.com/" rel="nofollow noreferrer">yayQuery</a></li> <li><a href="http://blog.jquery.com/2009/11/13/announcing-the-official-jquery-podcast/" rel="nofollow noreferrer">The official jQuery podcast</a></li> </ul> <h1>Java / Groovy</h1> <ul> <li><a href="http://javaposse.com/" rel="nofollow noreferrer">The Java Posse</a></li> <li><a href="http://www.grailspodcast.com/blog/list" rel="nofollow noreferrer">Grails Podcast</a></li> <li><a href="http://www.javaworld.com/podcasts/jtech/" rel="nofollow noreferrer">Java Technology Insider</a></li> <li><a href="http://basementcoders.com/" rel="nofollow noreferrer">Basement Coders</a></li> </ul> <h1>Ruby / Rails</h1> <ul> <li><a href="http://railscasts.com/" rel="nofollow noreferrer">Railscasts</a></li> <li><a href="http://railsenvy.com/podcast" rel="nofollow noreferrer">Rails Envy</a></li> <li><a href="http://podcast.rubyonrails.org/" rel="nofollow noreferrer">The Ruby on Rails Podcast</a></li> <li><a href="http://rubiverse.com/" rel="nofollow noreferrer">Rubiverse</a></li> <li><a href="http://ruby5.envylabs.com/" rel="nofollow noreferrer">Ruby5</a></li> </ul> <h1>Web Design / JavaScript / Ajax</h1> <ul> <li><a href="http://webdevradio.com/" rel="nofollow noreferrer">WebDevRadio</a></li> <li><a href="http://boagworld.com/" rel="nofollow noreferrer">Boagworld</a></li> <li><a href="http://therissingtonpodcast.co.uk/" rel="nofollow noreferrer">The Rissington podcast</a></li> <li><a href="http://ajaxian.com/by/category/podcasts" rel="nofollow noreferrer">Ajaxian</a></li> <li><a href="http://developer.yahoo.com/yui/theater/" rel="nofollow noreferrer">YUI Theater</a></li> </ul> <h1>Unix / Linux / Mac / iPhone</h1> <ul> <li><a href="http://www.mac-developer-network.com/" rel="nofollow noreferrer">Mac Developer Network</a></li> <li><a href="http://www.hackerpublicradio.org/" rel="nofollow noreferrer">Hacker Public Radio</a></li> <li><a href="http://www.linuxoutlaws.com/" rel="nofollow noreferrer">Linux Outlaws</a></li> <li><a href="http://macosken.com/" rel="nofollow noreferrer">Mac OS Ken</a></li> <li><a href="http://lugradio.org/" rel="nofollow noreferrer">LugRadio Linux radio show</a> (Inactive)</li> <li><a href="http://www.jupiterbroadcasting.com/?cat=4" rel="nofollow noreferrer">The Linux Action Show!</a></li> <li><a href="http://www.kernelpodcast.org/" rel="nofollow noreferrer">Linux Kernel Mailing List (LKML) Summary Podcast</a></li> <li><a href="http://itunes.stanford.edu/" rel="nofollow noreferrer">Stanford's iPhone programming class</a></li> <li><a href="http://www.sunsetlakesoftware.com/2010/06/03/advanced-iphone-development-course-now-itunes-u" rel="nofollow noreferrer">Advanced iPhone Development Course - Madison Area Technical College</a></li> <li><a href="http://developer.apple.com/videos/wwdc/2010/" rel="nofollow noreferrer">WWDC 2010 Session Videos (requires Apple Developer registration)</a></li> </ul> <h1>System Administration, Security or Infrastructure</h1> <ul> <li><a href="http://feeds.feedburner.com/RunasRadio" rel="nofollow noreferrer">RunAs Radio</a></li> <li><a href="http://www.grc.com/securitynow.htm" rel="nofollow noreferrer">Security Now!</a></li> <li><a href="http://crypto-gram.libsyn.com/" rel="nofollow noreferrer">Crypto-Gram Security Podcast</a></li> <li><a href="http://www.hak5.org/" rel="nofollow noreferrer">Hak5</a></li> <li><a href="http://blogs.vmware.com/vmtn/podcasts/index.html" rel="nofollow noreferrer">VMWare VMTN</a></li> <li><a href="http://twit.tv/ww" rel="nofollow noreferrer">Windows Weekly</a></li> <li><a href="http://pauldotcom.com/" rel="nofollow noreferrer">PaulDotCom Security</a></li> <li><a href="http://www.theregister.co.uk/hardware/semi_coherent/podcast.rss" rel="nofollow noreferrer">The Register - Semi-Coherent Computing</a></li> <li><a href="http://feathercast.org/" rel="nofollow noreferrer">FeatherCast</a></li> </ul> <h1>General Tech / Business</h1> <ul> <li><a href="http://revision3.com/tekzilla/" rel="nofollow noreferrer">Tekzilla</a></li> <li><a href="http://twit.tv/twit" rel="nofollow noreferrer">This Week in Tech</a></li> <li><a href="http://www.guardian.co.uk/technology/series/techweekly" rel="nofollow noreferrer">The Guardian Tech Weekly</a></li> <li><a href="http://www.pcmag.com/category2/0,2806,2007098,00.asp" rel="nofollow noreferrer">PCMag Radio Podcast</a> (Inactive)</li> <li><a href="http://ecorner.stanford.edu/" rel="nofollow noreferrer">Entrepreneurship Corner</a></li> <li><a href="http://www.manager-tools.com/" rel="nofollow noreferrer">Manager Tools</a></li> </ul> <h1>Other / Misc. / Podcast Networks</h1> <ul> <li><a href="http://itc.conversationsnetwork.org/" rel="nofollow noreferrer">IT Conversations</a></li> <li><a href="http://retrobits.libsyn.org/" rel="nofollow noreferrer">Retrobits Podcast</a></li> <li><a href="http://cagematch.dvorak.org/index.php/board,45.0.html" rel="nofollow noreferrer">No Agenda Netcast</a></li> <li><a href="http://www.crankygeeks.com/" rel="nofollow noreferrer">Cranky Geeks</a></li> <li><a href="http://thecommandline.net/" rel="nofollow noreferrer">The Command Line</a></li> <li><a href="http://www.freelanceswitch.com/podcasts/" rel="nofollow noreferrer">Freelance Radio</a></li> <li><a href="http://www.ibm.com/developerworks/podcast/" rel="nofollow noreferrer">IBM developerWorks</a></li> <li><a href="http://www.theregister.co.uk/software/open_season/podcast.rss" rel="nofollow noreferrer">The Register - Open Season</a></li> <li><a href="http://www.drunkandretired.com/thepodcast/" rel="nofollow noreferrer">Drunk and Retired</a></li> <li><a href="http://itc.conversationsnetwork.org/series/technometria.html" rel="nofollow noreferrer">Technometria</a></li> <li><a href="http://www.sodthis.com/podcast/" rel="nofollow noreferrer">Sod This</a></li> <li><a href="http://www.radio4nerds.com/" rel="nofollow noreferrer">Radio4Nerds</a></li> <li><a href="http://hackermedley.org" rel="nofollow noreferrer">Hacker Medley</a></li> </ul>
[ { "answer_id": 28336, "author": "Craig", "author_id": 2894, "author_profile": "https://Stackoverflow.com/users/2894", "pm_score": 0, "selected": false, "text": " .NET Rocks!\n RunAs Radio\n TWiT\n Stack Overflow (but then again, we wouldn't be in Beta if we didn't)\n Channel 9\n Ha...
2008/08/04
[ "https://Stackoverflow.com/questions/1644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
1,669
<p><em>Preferred languages</em>: C/C++, Java, and Ruby.</p> <p>I am looking for some helpful books/tutorials on how to write your own compiler simply for educational purposes. I am most familiar with C/C++, Java, and Ruby, so I prefer resources that involve one of those three, but any good resource is acceptable.</p>
[ { "answer_id": 6695987, "author": "timaschew", "author_id": 736518, "author_profile": "https://Stackoverflow.com/users/736518", "pm_score": 3, "selected": false, "text": "public String maxAsString(int a, int b) {\n if (a > b) {\n return Integer.valueOf(a).toString();\n } els...
2008/08/04
[ "https://Stackoverflow.com/questions/1669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340/" ]
1,709
<p>My dilemma is, basically, how to share an enumeration between two applications.</p> <p>The users upload documents through a front-end application that is on the web. This application calls a web service of the back-end application and passes the document to it. The back-end app saves the document and inserts a row in the <em>Document</em> table.</p> <p>The document type (7 possible document types: <em>Invoice</em>, <em>Contract</em> etc.) is passed as a parameter to the web service's <em>UploadDocument</em> method. The question is, what should the type (and possible values) of this parameter be?</p> <p>Since you need to hardcode these values in both applications, I think it is O.K. to use a descriptive string (<em>Invoice</em>, <em>Contract</em>, <em>WorkOrder</em>, <em>SignedWorkOrder</em>). </p> <p>Is it maybe a better approach to create a <em>DocumentTypes</em> enumeration in the first application, and to reproduce it also in the second application, and then pass the corresponding integer value to the web service between them?</p>
[ { "answer_id": 1733, "author": "lubos hasko", "author_id": 275, "author_profile": "https://Stackoverflow.com/users/275", "pm_score": 3, "selected": false, "text": "public enum DocumentType\n{\n Invoice,\n Contract,\n WorkOrder,\n SignedWorkOrder\n}\n\n[WebMethod]\npublic void UploadD...
2008/08/04
[ "https://Stackoverflow.com/questions/1709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/349/" ]
1,746
<p>I am trying to grab the capital letters of a couple of words and wrap them in span tags. I am using <a href="http://php.net/manual/en/function.preg-replace.php" rel="noreferrer">preg_replace</a> for extract and wrapping purposes, but it's not outputting anything.</p> <pre><code>preg_replace("/[A-Z]/", "&lt;span class=\"initial\"&gt;$1&lt;/span&gt;", $str) </code></pre>
[ { "answer_id": 1749, "author": "Polsonby", "author_id": 137, "author_profile": "https://Stackoverflow.com/users/137", "pm_score": 7, "selected": true, "text": "/([A-Z])/" }, { "answer_id": 31874, "author": "John Douthat", "author_id": 2774, "author_profile": "https://...
2008/08/05
[ "https://Stackoverflow.com/questions/1746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/137/" ]
1,762
<p>I am trying to set a flag to show or hide a page element, but it always displays even when the expression is false. </p> <pre><code>$canMerge = ($condition1 &amp;&amp; $condition2) ? 'true' : 'false'; ... &lt;?php if ($canMerge) { ?&gt;Stuff&lt;?php } ?&gt; </code></pre> <p>What's up?</p>
[ { "answer_id": 1764, "author": "Polsonby", "author_id": 137, "author_profile": "https://Stackoverflow.com/users/137", "pm_score": 1, "selected": false, "text": "$canMerge = ($condition1 && $condition2) ? true : false;\n" }, { "answer_id": 1771, "author": "Rudd Zwolinski", ...
2008/08/05
[ "https://Stackoverflow.com/questions/1762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/137/" ]
1,790
<p>Is it possible to create "federated" Subversion servers? As in one server at location A and another at location B that sync up their local versions of the repository automatically. That way when someone at either location interacts with the repository they are accessing their respective local server and therefore has faster response times.</p>
[ { "answer_id": 60893155, "author": "bahrep", "author_id": 761095, "author_profile": "https://Stackoverflow.com/users/761095", "pm_score": 0, "selected": false, "text": "SVK" } ]
2008/08/05
[ "https://Stackoverflow.com/questions/1790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/194/" ]
1,829
<p>I've got a menu in Python. That part was easy. I'm using <code>raw_input()</code> to get the selection from the user. </p> <p>The problem is that <code>raw_input</code> (and input) require the user to press <kbd>Enter</kbd> after they make a selection. Is there any way to make the program act immediately upon a keystroke? Here's what I've got so far:</p> <pre><code>import sys print """Menu 1) Say Foo 2) Say Bar""" answer = raw_input("Make a selection&gt; ") if "1" in answer: print "foo" elif "2" in answer: print "bar" </code></pre> <p>It would be great to have something like</p> <pre><code>print menu while lastKey = "": lastKey = check_for_recent_keystrokes() if "1" in lastKey: #do stuff... </code></pre>
[ { "answer_id": 1852, "author": "Mark Harrison", "author_id": 116, "author_profile": "https://Stackoverflow.com/users/116", "pm_score": 4, "selected": true, "text": "import msvcrt\nanswer=msvcrt.getch()\n" }, { "answer_id": 1870, "author": "Grant", "author_id": 30, "au...
2008/08/05
[ "https://Stackoverflow.com/questions/1829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30/" ]
1,836
<p>OK. This is a bit of a vanity app, but I had a situation today at work where I was in a training class and the machine was set to lock every 10 minutes. Well, if the trainers got excited about talking - as opposed to changing slides - the machine would lock up.</p> <p>I'd like to write a teeny app that has nothing but a taskbar icon that does nothing but move the mouse by 1 pixel every 4 minutes. </p> <p>I can do that in 3 ways with Delphi (my strong language) but I'm moving to C# for work and I'd like to know the path of least resistance there.</p>
[ { "answer_id": 1843, "author": "lubos hasko", "author_id": 275, "author_profile": "https://Stackoverflow.com/users/275", "pm_score": 6, "selected": true, "text": "using System;\nusing System.Drawing;\nusing System.Windows.Forms;\n\nstatic class Program\n{\n static void Main()\n {\n...
2008/08/05
[ "https://Stackoverflow.com/questions/1836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/172/" ]
1,854
<p>What do I need to look at to see whether I'm on Windows or Unix, etc?</p>
[ { "answer_id": 1857, "author": "Louis Brandy", "author_id": 2089740, "author_profile": "https://Stackoverflow.com/users/2089740", "pm_score": 11, "selected": true, "text": ">>> import os\n>>> os.name\n'posix'\n>>> import platform\n>>> platform.system()\n'Linux'\n>>> platform.release()\n'...
2008/08/05
[ "https://Stackoverflow.com/questions/1854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/116/" ]
1,873
<p>How do I delimit a Javascript data-bound string parameter in an anchor <code>OnClick</code> event?</p> <ul> <li>I have an anchor tag in an ASP.NET Repeater control.</li> <li>The <code>OnClick</code> event of the anchor contains a call to a Javascript function.</li> <li>The Javascript function takes a string for its input parameter.</li> <li>The string parameter is populated with a data-bound value from the Repeater.</li> </ul> <p>I need the &quot;double quotes&quot; for the <code>Container.DataItem</code>.<br /> I need the 'single quotes' for the <code>OnClick</code>.</p> <p>And I still need <em>one more delimiter</em> (triple quotes?) for the input string parameter of the Javascript function call.</p> <p>Since I can't use 'single quotes' again, how do I ensure the Javascript function knows the input parameter is a string and not an integer?</p> <p>Without the extra quotes around the input string parameter, the Javascript function thinks I'm passing in an integer.</p> <p>The anchor:</p> <pre><code>&lt;a id=&quot;aShowHide&quot; onclick='ToggleDisplay(&lt;%# DataBinder.Eval(Container.DataItem, &quot;JobCode&quot;) %&gt;);' &gt;Show/Hide&lt;/a&gt; </code></pre> <p>And there is my Javascript:</p> <pre><code>&lt;script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;&gt; /* Shows/Hides the Jobs Div */ function ToggleDisplay(jobCode) { /* Each div has its ID set dynamically ('d' plus the JobCode) */ var elem = document.getElementById('d' + jobCode); if (elem) { if (elem.style.display != 'block') { elem.style.display = 'block'; elem.style.visibility = 'visible'; } else { elem.style.display = 'none'; elem.style.visibility = 'hidden'; } } } &lt;/script&gt; </code></pre>
[ { "answer_id": 1875, "author": "Grant", "author_id": 30, "author_profile": "https://Stackoverflow.com/users/30", "pm_score": 2, "selected": false, "text": "value = value + \"\"\n" }, { "answer_id": 1881, "author": "Shawn", "author_id": 26, "author_profile": "https://S...
2008/08/05
[ "https://Stackoverflow.com/questions/1873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/242/" ]
1,898
<p>What's the best way to import a CSV file into a strongly-typed data structure?</p>
[ { "answer_id": 1912, "author": "Mike Stone", "author_id": 122, "author_profile": "https://Stackoverflow.com/users/122", "pm_score": 0, "selected": false, "text": "String[] values = myString.Split(',');\nmyObject.StringField = values[0];\nmyObject.IntField = Int32.Parse(values[1]);\n" }...
2008/08/05
[ "https://Stackoverflow.com/questions/1898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/81/" ]
1,908
<p>I have a bunch of latitude/longitude pairs that map to known x/y coordinates on a (geographically distorted) map.</p> <p>Then I have one more latitude/longitude pair. I want to plot it on the map as best is possible. How do I go about doing this?</p> <p>At first I decided to create a system of linear equations for the three nearest lat/long points and compute a transformation from these, but this doesn't work well at all. Since that's a linear system, I can't use more nearby points either.</p> <p>You can't assume North is up: all you have is the existing lat/long->x/y mappings.</p> <p>EDIT: it's not a Mercator projection, or anything like that. It's arbitrarily distorted for readability (think subway map). I want to use only the nearest 5 to 10 mappings so that distortion on other parts of the map doesn't affect the mapping I'm trying to compute.</p> <p>Further, the entire map is in a very small geographical area so there's no need to worry about the globe--flat-earth assumptions are good enough.</p>
[ { "answer_id": 1945, "author": "fastcall", "author_id": 328, "author_profile": "https://Stackoverflow.com/users/328", "pm_score": 4, "selected": true, "text": "estimate-latitude-longitude (x, y)\n\n numerator-latitude := 0\n numerator-longitude := 0\n denominator := 0\n\n for...
2008/08/05
[ "https://Stackoverflow.com/questions/1908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/79/" ]
1,936
<p>Using ASP.NET MVC there are situations (such as form submission) that may require a <code>RedirectToAction</code>. </p> <p>One such situation is when you encounter validation errors after a form submission and need to redirect back to the form, but would like the URL to reflect the URL of the form, not the action page it submits to.</p> <p>As I require the form to contain the originally <code>POST</code>ed data, for user convenience, as well as validation purposes, how can I pass the data through the <code>RedirectToAction()</code>? If I use the viewData parameter, my <code>POST</code> parameters will be changed to <code>GET</code> parameters.</p>
[ { "answer_id": 1940, "author": "Matt Mitchell", "author_id": 364, "author_profile": "https://Stackoverflow.com/users/364", "pm_score": 7, "selected": true, "text": "public ActionResult Send()\n{\n TempData[\"form\"] = Request.Form;\n return this.RedirectToAction(a => a.Form());\n}\...
2008/08/05
[ "https://Stackoverflow.com/questions/1936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/364/" ]
1,949
<p>In order to fully use LinqToSql in an ASP.net 3.5 application, it is necessary to create <a href="http://msdn.microsoft.com/en-us/library/system.data.linq.datacontext.aspx" rel="noreferrer">DataContext</a> <a href="http://dotnetslackers.com/articles/csharp/InsideTheLINQToSQLDataContextClass.aspx" rel="noreferrer">classes</a> (which is usually done using the designer in VS 2008). From the UI perspective, the DataContext is a design of the sections of your database that you would like to expose to through LinqToSql and is integral in setting up the ORM features of LinqToSql.</p> <p>My question is: I am setting up a project that uses a large database where all tables are interconnected in some way through Foreign Keys. My first inclination is to make one huge DataContext class that models the entire database. That way I could in theory (though I don't know if this would be needed in practice) use the Foreign Key connections that are generated through LinqToSql to easily go between related objects in my code, insert related objects, etc.</p> <p>However, after giving it some thought, I am now thinking that it may make more sense to create multiple DataContext classes, each one relating to a specific namespace or logical interrelated section within my database. My main concern is that instantiating and disposing one huge DataContext class all the time for individual operations that relate to specific areas of the Database would be impose an unnecessary imposition on application resources. Additionally, it is easier to create and manage smaller DataContext files than one big one. The thing that I would lose is that there would be some distant sections of the database that would not be navigable through LinqToSql (even though a chain of relationships connects them in the actual database). Additionally, there would be some table classes that would exist in more than one DataContext.</p> <p>Any thoughts or experience on whether multiple DataContexts (corresponding to DB namespaces) are appropriate in place of (or in addition to) one very large DataContext class (corresponding to the whole DB)?</p>
[ { "answer_id": 5310, "author": "Evan", "author_id": 667, "author_profile": "https://Stackoverflow.com/users/667", "pm_score": 6, "selected": true, "text": "Should be used very carefully after\nany SumbitChanges() operation.\n" } ]
2008/08/05
[ "https://Stackoverflow.com/questions/1949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51/" ]
1,983
<p>In many places, <code>(1,2,3)</code> (a tuple) and <code>[1,2,3]</code> (a list) can be used interchangeably.</p> <p>When should I use one or the other, and why?</p>
[ { "answer_id": 1987, "author": "sparkes", "author_id": 269, "author_profile": "https://Stackoverflow.com/users/269", "pm_score": 5, "selected": false, "text": "[1,2,3]" }, { "answer_id": 4595, "author": "HS.", "author_id": 618, "author_profile": "https://Stackoverflow...
2008/08/05
[ "https://Stackoverflow.com/questions/1983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/116/" ]
1,988
<p>I have read a lot that LISP can redefine syntax on the fly, presumably with macros. I am curious how far does this actually go? Can you redefine the language structure so much that it borderline becomes a compiler for another language? For example, could you change the functional nature of LISP into a more object oriented syntax and semantics, maybe say having syntax closer to something like Ruby?</p> <p>Especially, is it possible to get rid of the parenthesis hell using macros? I have learned enough (Emacs-)LISP to customize Emacs with my own micro-features, but I am very curious how far macros can go in customizing the language.</p>
[ { "answer_id": 63737, "author": "Eric Normand", "author_id": 7492, "author_profile": "https://Stackoverflow.com/users/7492", "pm_score": 6, "selected": true, "text": "(loop for x from 0 below 100\n when (even x)\n collect x)\n" }, { "answer_id": 74199, "author": "Je...
2008/08/05
[ "https://Stackoverflow.com/questions/1988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122/" ]
1,994
<p>When you data bind in C#, the thread that changes the data causes the control to change too. But if this thread is not the one on which the control was created, you'll get an Illegal Cross Thread Operation exception.</p> <p>Is there anyway to prevent this?</p>
[ { "answer_id": 1998, "author": "Mike Stone", "author_id": 122, "author_profile": "https://Stackoverflow.com/users/122", "pm_score": 3, "selected": false, "text": "if (control.InvokeRequired)\n{\n control.Invoke(delegateWithMyCode);\n}\nelse\n{\n delegateWithMyCode();\n}\n" }, {...
2008/08/05
[ "https://Stackoverflow.com/questions/1994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/195/" ]
1,995
<p>I have values stored as strings in a <code>DataTable</code> where each value could really represent an <code>int</code>, <code>double</code>, or <code>string</code> (they were all converted to strings during an import process from an external data source). I need to test and see what type each value really is.</p> <p>What is more efficient for the application (or is there no practical difference)?</p> <ol> <li>Try to convert to <code>int</code> (and then <code>double</code>). If conversion works, the return <code>true</code>. If an exception is thrown, return <code>false</code>.</li> <li>Regular expressions designed to match the pattern of an <code>int</code> or <code>double</code></li> <li>Some other method?</li> </ol>
[ { "answer_id": 7257, "author": "Keith", "author_id": 905, "author_profile": "https://Stackoverflow.com/users/905", "pm_score": 3, "selected": false, "text": "object o;\n\n//checking with is\no is int\n\n//check type\no.GetType() != typeof( int )\n\n//cast and catch exception\ntry{ int j ...
2008/08/05
[ "https://Stackoverflow.com/questions/1995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51/" ]
2,027
<p>When learning a new programming language, one of the possible roadblocks you might encounter is the question whether the language is, by default, <em>pass-by-value or pass-by-reference</em>.</p> <p>So here is my question to all of you, in your favorite language, <em>how</em> is it actually done? And what are the <em>possible pitfalls</em>?</p> <p>Your favorite language can, of course, be anything you have ever played with: <a href="http://www.ruby-lang.org/en/" rel="noreferrer">popular</a>, <a href="http://www.devtopics.com/a-obscure-programming-language-of-the-month/" rel="noreferrer">obscure</a>, <a href="http://en.wikipedia.org/wiki/Brainfuck" rel="noreferrer">esoteric</a>, <a href="http://www.nvidia.com/object/cuda_get.html" rel="noreferrer">new</a>, <a href="http://en.wikipedia.org/wiki/FORTRAN" rel="noreferrer">old</a>...</p>
[ { "answer_id": 2028, "author": "sven", "author_id": 46, "author_profile": "https://Stackoverflow.com/users/46", "pm_score": 5, "selected": false, "text": "public void swap(int x, int y)\n{\n int tmp = x;\n x = y;\n y = tmp;\n}\n" }, { "answer_id": 2554, "author": "sven", ...
2008/08/05
[ "https://Stackoverflow.com/questions/2027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46/" ]
2,034
<p>What do the result codes in SVN mean? I need a quick reference.</p>
[ { "answer_id": 13418, "author": "Matt Miller", "author_id": 763, "author_profile": "https://Stackoverflow.com/users/763", "pm_score": 7, "selected": false, "text": "U filename.1\n U filename.2 \nUU filename.3\n" }, { "answer_id": 6028405, "author": "Taryn East", "aut...
2008/08/05
[ "https://Stackoverflow.com/questions/2034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/137/" ]
2,041
<p>How do I create a branch in SVN?</p>
[ { "answer_id": 2042, "author": "sparkes", "author_id": 269, "author_profile": "https://Stackoverflow.com/users/269", "pm_score": 9, "selected": false, "text": "svn copy" }, { "answer_id": 2310, "author": "Ronnie", "author_id": 193, "author_profile": "https://Stackover...
2008/08/05
[ "https://Stackoverflow.com/questions/2041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/269/" ]
2,046
<p>As a novice in practicing test-driven development, I often end up in a quandary as to how to unit test persistence to a database.</p> <p>I know that technically this would be an integration test (not a unit test), but I want to find out the best strategies for the following:</p> <ol> <li>Testing queries. </li> <li>Testing inserts. How do I know that the insert that has gone wrong if it fails? I can test it by inserting and then querying, but how can I know that the query wasn't wrong? </li> <li>Testing updates and deletes -- same as testing inserts</li> </ol> <p>What are the best practices for doing these?</p> <hr> <p>Regarding testing SQL: I am aware that this could be done, but if I use an O/R Mapper like NHibernate, it attaches some naming warts in the aliases used for the output queries, and as that is somewhat unpredictable I'm not sure I could test for that.</p> <p>Should I just, abandon everything and simply trust NHibernate? I'm not sure that's prudent.</p>
[ { "answer_id": 2096, "author": "Rytmis", "author_id": 266, "author_profile": "https://Stackoverflow.com/users/266", "pm_score": 2, "selected": false, "text": "NHibernate" }, { "answer_id": 2099, "author": "Dan", "author_id": 230, "author_profile": "https://Stackoverfl...
2008/08/05
[ "https://Stackoverflow.com/questions/2046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/372/" ]
2,056
<p>When looking beyond the <a href="https://en.wikipedia.org/wiki/Rapid_application_development" rel="noreferrer">RAD</a> (drag-drop and configure) way of building user interfaces that many tools encourage you are likely to come across three design patterns called <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller" rel="noreferrer">Model-View-Controller</a>, <a href="http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93presenter" rel="noreferrer">Model-View-Presenter</a> and <a href="http://en.wikipedia.org/wiki/Model_View_ViewModel" rel="noreferrer">Model-View-ViewModel</a>. My question has three parts to it:</p> <ol> <li>What issues do these patterns address?</li> <li>How are they similar?</li> <li>How are they different?</li> </ol>
[ { "answer_id": 5712, "author": "Jonas Follesø", "author_id": 1199387, "author_profile": "https://Stackoverflow.com/users/1199387", "pm_score": 5, "selected": false, "text": "public class CustomerView : ICustomerView\n{\n public string Name\n { \n get { return txtName.Text; }...
2008/08/05
[ "https://Stackoverflow.com/questions/2056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/358/" ]
2,092
<p>Looking for books or other references that discuss actually <em>how</em> to write a code coverage tool in Java; some of the various techniques or tricks - source vs. byte code instrumentation. </p> <p>This is for a scripting language that generates Java byte code under the hood.</p>
[ { "answer_id": 7076, "author": "Dominic Cooney", "author_id": 878, "author_profile": "https://Stackoverflow.com/users/878", "pm_score": 3, "selected": false, "text": "class com.foo.Bar.class" } ]
2008/08/05
[ "https://Stackoverflow.com/questions/2092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
2,120
<p>I want to get the MD5 Hash of a string value in SQL Server 2005. I do this with the following command:</p> <pre><code>SELECT HashBytes('MD5', 'HelloWorld') </code></pre> <p>However, this returns a VarBinary instead of a VarChar value. If I attempt to convert <code>0x68E109F0F40CA72A15E05CC22786F8E6</code> into a VarChar I get <code>há ðô§*à\Â'†øæ</code> instead of <code>68E109F0F40CA72A15E05CC22786F8E6</code>.</p> <p>Is there any SQL-based solution?</p> <p><strong><a href="https://stackoverflow.com/questions/2120/#2382">Yes</a></strong></p>
[ { "answer_id": 2382, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 8, "selected": true, "text": "SELECT SUBSTRING(master.dbo.fn_varbintohexstr(HashBytes('MD5', 'HelloWorld')), 3, 32)\n" }, { "answer_id": 4585246, ...
2008/08/05
[ "https://Stackoverflow.com/questions/2120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
2,123
<p><code>Checkboxes</code> in <code>HTML</code> forms don't have implicit <em>labels</em> with them. Adding an explicit label (some text) next to it doesn't toggle the <code>checkbox</code>.</p> <p><strong>How do I make a checkbox toggle from clicking on the text label as well?</strong></p>
[ { "answer_id": 2133, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 6, "selected": false, "text": "<label for=\"surname\">Surname</label>\n<input type=\"checkbox\" name=\"surname\" id=\"surname\" />\n" }, { "answer_i...
2008/08/05
[ "https://Stackoverflow.com/questions/2123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/193/" ]
2,134
<p>I have come across a lot of optimization tips which say that you should mark your classes as sealed to get extra performance benefits.</p> <p>I ran some tests to check the performance differential and found none. Am I doing something wrong? Am I missing the case where sealed classes will give better results?</p> <p>Has anyone run tests and seen a difference?</p> <p>Help me learn :)</p>
[ { "answer_id": 390627, "author": "Cameron MacFarland", "author_id": 3820, "author_profile": "https://Stackoverflow.com/users/3820", "pm_score": 7, "selected": false, "text": "call" }, { "answer_id": 1769457, "author": "Jason Orendorff", "author_id": 94977, "author_pro...
2008/08/05
[ "https://Stackoverflow.com/questions/2134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/380/" ]
2,138
<p>Can a LINQ enabled app run on a machine that only has the .NET 2.0 runtime installed?</p> <p>In theory, LINQ is nothing more than syntactic sugar, and the resulting IL code should look the same as it would have in .NET 2.0.</p> <p>How can I write LINQ without using the .NET 3.5 libraries? Will it run on .NET 2.0?</p>
[ { "answer_id": 193090, "author": "Scott Wisniewski", "author_id": 1737192, "author_profile": "https://Stackoverflow.com/users/1737192", "pm_score": 3, "selected": false, "text": "dim q = from x in xs where x > 2 select x*4;\n" }, { "answer_id": 883745, "author": "Lucas", ...
2008/08/05
[ "https://Stackoverflow.com/questions/2138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/373/" ]
2,155
<p>The web applications I develop often require co-dependent configuration settings and there are also settings that have to change as we move between each of our environments.</p> <p>All our settings are currently simple key-value pairs but it would be useful to create custom config sections so that it is obvious when two values need to change together or when the settings need to change for an environment.</p> <p>What's the best way to create custom config sections and are there any special considerations to make when retrieving the values?</p>
[ { "answer_id": 2219, "author": "Ishmaeel", "author_id": 227, "author_profile": "https://Stackoverflow.com/users/227", "pm_score": 4, "selected": false, "text": "public class MyStuffSection : ConfigurationSection\n{\n ConfigurationProperty _MyStuffElement;\n\n public MyStuffSection(...
2008/08/05
[ "https://Stackoverflow.com/questions/2155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/371/" ]
2,158
<p>Is there a way to create a <code>JButton</code> with your own button graphic and not just with an image inside the button? </p> <p>If not, is there another way to create a custom <code>JButton</code> in java?</p>
[ { "answer_id": 2181, "author": "John Downey", "author_id": 200, "author_profile": "https://Stackoverflow.com/users/200", "pm_score": 3, "selected": false, "text": "javax.swing.AbstractButton" }, { "answer_id": 2210, "author": "rjohnston", "author_id": 246, "author_pro...
2008/08/05
[ "https://Stackoverflow.com/questions/2158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/340/" ]
2,209
<p>I specifically want to add the style of <code>background-color</code> to the <code>&lt;body&gt;</code> tag of a master page, from the code behind (C#) of a content page that uses that master page. </p> <p>I have different content pages that need to make the master page has different colors depending on which content page is loaded, so that the master page matches the content page's theme.</p> <p>I have a solution below:</p> <hr> <p>I'm looking for something more like:</p> <pre><code>Master.Attributes.Add("style", "background-color: 2e6095"); </code></pre> <p>Inside of the page load function of the content page. But I can't get the above line to work. I only need to change the <code>background-color</code> for the <code>&lt;body&gt;</code> tag of the page.</p>
[ { "answer_id": 2233, "author": "Adhip Gupta", "author_id": 384, "author_profile": "https://Stackoverflow.com/users/384", "pm_score": 4, "selected": true, "text": "<body runat=\"server\" id=\"masterpageBody\">\n" }, { "answer_id": 2291, "author": "Bryan Denny", "author_id"...
2008/08/05
[ "https://Stackoverflow.com/questions/2209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/396/" ]
2,222
<p>I'm currently working on an application with a frontend written in Adobe Flex 3. I'm aware of <a href="http://code.google.com/p/as3flexunitlib/" rel="noreferrer">FlexUnit</a> but what I'd really like is a unit test runner for Ant/NAnt and a runner that integrates with the Flex Builder IDE (AKA Eclipse). Does one exist? </p> <p>Also, are there any other resources on how to do Flex development "the right way" besides the <a href="http://labs.adobe.com/wiki/index.php/Cairngorm" rel="noreferrer">Cairngorm microarchitecture</a> example?</p>
[ { "answer_id": 8753, "author": "Theo", "author_id": 1109, "author_profile": "https://Stackoverflow.com/users/1109", "pm_score": 4, "selected": true, "text": "<target name=\"run-tests\" depends=\"compile-tests\">\n <flexunit swf=\"${build.home}/tests.swf\" failonerror=\"true\"/>\n</targe...
2008/08/05
[ "https://Stackoverflow.com/questions/2222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/266/" ]
2,232
<p>How do I call shell commands from inside of a Ruby program? How do I then get output from these commands back into Ruby?</p>
[ { "answer_id": 2280, "author": "Steve Willard", "author_id": 402, "author_profile": "https://Stackoverflow.com/users/402", "pm_score": 5, "selected": false, "text": "$ irb \nsystem \"echo Hi\"\nHi\n=> true\n" }, { "answer_id": 2334, "author": "Rufo Sanchez", "author_id": ...
2008/08/05
[ "https://Stackoverflow.com/questions/2232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25/" ]
2,256
<p>Is there a way of mapping data collected on a stream or array to a data structure or vice-versa? In C++ this would simply be a matter of casting a pointer to the stream as a data type I want to use (or vice-versa for the reverse) eg: in C++</p> <pre><code>Mystruct * pMyStrct = (Mystruct*)&amp;SomeDataStream; pMyStrct-&gt;Item1 = 25; int iReadData = pMyStrct-&gt;Item2; </code></pre> <p>obviously the C++ way is pretty unsafe unless you are sure of the quality of the stream data when reading incoming data, but for outgoing data is super quick and easy.</p>
[ { "answer_id": 2322, "author": "Antonio Haley", "author_id": 390, "author_profile": "https://Stackoverflow.com/users/390", "pm_score": 2, "selected": false, "text": "public virtual bool SetMessageBytes(byte[] message)\n {\n MemberInfo[] members = FormatterServices.GetSerializab...
2008/08/05
[ "https://Stackoverflow.com/questions/2256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/379/" ]
2,262
<p>How do I rewrite a URL in ASP.NET?</p> <p>I would like users to be able to go to</p> <pre><code>http://www.website.com/users/smith </code></pre> <p>instead of</p> <pre><code>http://www.website.com/?user=smith </code></pre>
[ { "answer_id": 2268, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 6, "selected": true, "text": "# clean up old rules and forward to new URL\nRewriteRule ^/?user=(.*) /users/$1 [NC,R=301]\n\n# rewrite the rule internally\n...
2008/08/05
[ "https://Stackoverflow.com/questions/2262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
2,267
<p>I am building a web page to show a customer what software they purchased and to give them a link to download said software. Unfortunately, the data on what was purchased and the download information are in separate databases so I can't just take care of it with joins in an SQL query.</p> <p>The common item is SKU. I'll be pulling a list of SKUs from the customer purchases database and on the download table is a comma delineated list of SKUs associated with that download. My intention, at the moment, is to create from this one datatable to populate a <code>GridView</code>.</p> <p>Any suggestions on how to do this efficiently would be appreciated. If it helps, I can pretty easily pull back the data as a <code>DataSet</code> or a <code>DataReader</code>, if either one would be better for this purpose.</p>
[ { "answer_id": 2324, "author": "Yaakov Ellis", "author_id": 51, "author_profile": "https://Stackoverflow.com/users/51", "pm_score": 2, "selected": false, "text": "select p.Date,\n p.Amount,\n d.SoftwareName,\n d.DownloadLink\nfrom PurchaseDB.dbo.Purchases as p\njoin ...
2008/08/05
[ "https://Stackoverflow.com/questions/2267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/111/" ]
2,300
<p>I want to be able to do:</p> <pre><code>For Each thing In things End For </code></pre> <p>CLASSIC ASP - NOT .NET!</p>
[ { "answer_id": 7725, "author": "svandragt", "author_id": 997, "author_profile": "https://Stackoverflow.com/users/997", "pm_score": 4, "selected": false, "text": "dim cars(2),x\ncars(0)=\"Volvo\"\ncars(1)=\"Saab\"\ncars(2)=\"BMW\"\n\nFor Each x in cars\n response.write(x & \"<br />\")\nN...
2008/08/05
[ "https://Stackoverflow.com/questions/2300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/193/" ]
2,308
<p>I see in the Stack Overflow footer that the SVN Revision number is displayed. Is this automated and if so, how does one implement it in ASP.NET?</p> <p><em>(Solutions in other languages are acceptable)</em></p>
[ { "answer_id": 2320, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Stackoverflow.com/users/91", "pm_score": 4, "selected": true, "text": "vn:keywords \"Rev Id\"" }, { "answer_id": 8159, "author": "David A Gibson", "author_id": 982, "author_prof...
2008/08/05
[ "https://Stackoverflow.com/questions/2308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
2,311
<p>I have created a PHP-script to update a web server that is live inside a local directory. I'm migrating the script into Python. It works fine for the most part, but after a PUT command, the size of the file appears to change. Thus, the size of the file is different from that of the file on the server. </p> <p>Once I download again the file from the FTP server, the only difference is the CR/LF mark. This annoys me because the same script is comparing the size of the files to update. Also, in case it means anything, the script works perfectly in PHP vía ftp_put.</p> <pre><code>from ftplib import FTP ftpserver = "myserver" ftpuser = "myuser" ftppass = "mypwd" locfile = "g:/test/style.css" ftpfile = "/temp/style.css" try: ftp = FTP(ftpserver, ftpuser, ftppass) except: exit ("Cannot connect") f = open (locfile, "r") try: ftp.delete (ftpfile) except: pass # ftp.sendcmd ("TYPE I") # ftp.storlines("STOR %s" % ftpfile, f) ftp.storbinary("STOR %s" % ftpfile, f) f.close() ftp.dir (ftpfile) ftp.quit() </code></pre> <p>Any suggestions?</p>
[ { "answer_id": 2316, "author": "David Sykes", "author_id": 259, "author_profile": "https://Stackoverflow.com/users/259", "pm_score": 5, "selected": true, "text": "rb" } ]
2008/08/05
[ "https://Stackoverflow.com/questions/2311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/394/" ]
2,328
<p>I have a problem with maintaining state in an ASP.NET AJAX page. Short version: I need some way to update the page ViewState after an async callback has been made, to reflect any state changes the server made during the async call. </p> <p>This seems to be a common problem, but I will describe my scenario to help explain:</p> <p>I have a grid-like control which has some JavaScript enhancements - namely, the ability to drag and drop columns and rows. When a column or row is dropped into a new position, an AJAX method is invoked to notify the control server-side and fire a corresponding server-side event ("OnColumnMoved" or "OnRowMoved").</p> <p>ASP.NET AJAX calls, by default, send the entire page as the request. That way the page goes through a complete lifecycle, viewstate is persisted and the state of the control is restored before the RaiseCallbackEvent method is invoked.</p> <p>However, since the AJAX call does not update the page, the ViewState reflects the <em>original</em> state of the control, even after the column or row has been moved. So the second time a client-side action occurs, the AJAX request goes to the server and the page &amp; control are built back up again to reflect the <em>first</em> state of the control, not the state after the first column or row was moved.</p> <p>This problem extends to many implications. For example if we have a client-side/AJAX action to add a new item to the grid, and then a row is dragged, the grid is built server-side with one less item than on the client-side.</p> <p>And finally &amp; most seriously for my specific example, the actual data source object we are acting upon is stored in the page ViewState. That was a design decision to allow keeping a stateful copy of the manipulated data which can either be committed to DB after many manipulations or discarded if the user backs out. That is very difficult to change.</p> <p>So, again, I need a way for the page ViewState to be updated on callback after the AJAX method is fired.</p>
[ { "answer_id": 5640, "author": "Rex M", "author_id": 67, "author_profile": "https://Stackoverflow.com/users/67", "pm_score": 0, "selected": false, "text": "RadAjaxManager" } ]
2008/08/05
[ "https://Stackoverflow.com/questions/2328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/67/" ]
2,348
<p>In the code below</p> <pre><code>For i = LBound(arr) To UBound(arr) </code></pre> <p>What is the point in asking using <code>LBound</code>? Surely that is always 0.</p>
[ { "answer_id": 2378, "author": "huseyint", "author_id": 39, "author_profile": "https://Stackoverflow.com/users/39", "pm_score": 2, "selected": false, "text": "Option Base 1\n" }, { "answer_id": 2393, "author": "Chris Farmer", "author_id": 404, "author_profile": "https...
2008/08/05
[ "https://Stackoverflow.com/questions/2348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/193/" ]
2,349
<p>In Windows, in any windows form or web browser, you can use the tab button to switch focus through all of the form fields. </p> <p>It will stop on textboxes, radiobuttons, checkboxes, dropdown menus, etc. </p> <p>However, in Mac OSX, tab skips dropdown menus. Is there anyway to change this behavior, or access the above items mentioned, without using a mouse?</p>
[ { "answer_id": 21210, "author": "James A. Rosen", "author_id": 1190, "author_profile": "https://Stackoverflow.com/users/1190", "pm_score": 1, "selected": false, "text": "accessibility.tabfocus" } ]
2008/08/05
[ "https://Stackoverflow.com/questions/2349", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26/" ]
2,384
<p>I'm trying to read binary data using C#. I have all the information about the layout of the data in the files I want to read. I'm able to read the data "chunk by chunk", i.e. getting the first 40 bytes of data converting it to a string, get the next 40 bytes.</p> <p>Since there are at least three slightly different version of the data, I would like to read the data directly into a struct. It just feels so much more right than by reading it "line by line".</p> <p><strong>I have tried the following approach but to no avail:</strong></p> <pre><code>StructType aStruct; int count = Marshal.SizeOf(typeof(StructType)); byte[] readBuffer = new byte[count]; BinaryReader reader = new BinaryReader(stream); readBuffer = reader.ReadBytes(count); GCHandle handle = GCHandle.Alloc(readBuffer, GCHandleType.Pinned); aStruct = (StructType) Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(StructType)); handle.Free(); </code></pre> <p>The stream is an opened FileStream from which I have began to read from. I get an <code>AccessViolationExceptio</code>n when using <code>Marshal.PtrToStructure</code>.</p> <p>The stream contains more information than I'm trying to read since I'm not interested in data at the end of the file.</p> <p><strong>The struct is defined like:</strong></p> <pre><code>[StructLayout(LayoutKind.Explicit)] struct StructType { [FieldOffset(0)] public string FileDate; [FieldOffset(8)] public string FileTime; [FieldOffset(16)] public int Id1; [FieldOffset(20)] public string Id2; } </code></pre> <p>The examples code is changed from original to make this question shorter.</p> <p>How would I read binary data from a file into a struct?</p>
[ { "answer_id": 2436, "author": "urini", "author_id": 373, "author_profile": "https://Stackoverflow.com/users/373", "pm_score": 0, "selected": false, "text": "using (FileStream stream = new FileStream(fileName, FileMode.Open))\n{\n BinaryFormatter formatter = new BinaryFormatter();\n ...
2008/08/05
[ "https://Stackoverflow.com/questions/2384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143/" ]
2,472
<p>What is the best way to record statistics on the number of visitors visiting my site that have set their browser to block ads?</p>
[ { "answer_id": 2478, "author": "Jonathan Works", "author_id": 309844, "author_profile": "https://Stackoverflow.com/users/309844", "pm_score": 3, "selected": false, "text": "<img src=\"./ads/viagra.jpg?{user.id}\"/>\n" }, { "answer_id": 4187, "author": "Michal Sznajder", "...
2008/08/05
[ "https://Stackoverflow.com/questions/2472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/116/" ]
2,481
<p>I've been able to find details on several self-balancing <code>BST</code>s through several sources, but I haven't found any good descriptions detailing which one is best to use in different situations (or if it really doesn't matter). </p> <p>I want a <code>BST</code> that is optimal for storing in excess of ten million nodes. The order of insertion of the nodes is basically random, and I will never need to delete nodes, so insertion time is the only thing that would need to be optimized. </p> <p>I intend to use it to store previously visited game states in a puzzle game, so that I can quickly check if a previous configuration has already been encountered.</p>
[ { "answer_id": 2498, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "BST" }, { "answer_id": 33692, "author": "jmbucknall", "author_id": 806, "author_profile": "https://Stackover...
2008/08/05
[ "https://Stackoverflow.com/questions/2481", "https://Stackoverflow.com", "https://Stackoverflow.com/users/152/" ]
2,483
<p>What is actually the difference between these two casts?</p> <pre><code>SomeClass sc = (SomeClass)SomeObject; SomeClass sc2 = SomeObject as SomeClass; </code></pre> <p>Normally, shouldn't they both be explicit casts to the specified type?</p>
[ { "answer_id": 2522, "author": "denny", "author_id": 27, "author_profile": "https://Stackoverflow.com/users/27", "pm_score": 5, "selected": false, "text": "double d = 5.34;\nint i = d as int;\n" }, { "answer_id": 2614, "author": "Nick Berardi", "author_id": 17, "autho...
2008/08/05
[ "https://Stackoverflow.com/questions/2483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
2,509
<p>Test Driven Development has been the rage in the .NET community for the last few years. Recently, I have heard grumblings in the ALT.NET community about BDD. What is it? What makes it different from TDD?</p>
[ { "answer_id": 2548, "author": "Christian Lescuyer", "author_id": 341, "author_profile": "https://Stackoverflow.com/users/341", "pm_score": 8, "selected": true, "text": "Story: User logging in\n As a user\n I want to login with my details\n So that I can get access to the site\n\nScen...
2008/08/05
[ "https://Stackoverflow.com/questions/2509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/303/" ]
2,518
<p>I have 2 SQLite databases, one downloaded from a server (<code>server.db</code>), and one used as storage on the client (<code>client.db</code>). I need to perform various sync queries on the client database, using data from the server database.</p> <p>For example, I want to delete all rows in the <code>client.db tRole</code> table, and repopulate with all rows in the <code>server.db tRole</code> table.</p> <p>Another example, I want to delete all rows in the <code>client.db tFile</code> table where the <code>fileID</code> is not in the <code>server.db tFile</code> table.</p> <p>In SQL Server you can just prefix the table with the name of the database. Is there anyway to do this in SQLite using Adobe Air?</p>
[ { "answer_id": 8783, "author": "Theo", "author_id": 1109, "author_profile": "https://Stackoverflow.com/users/1109", "pm_score": 2, "selected": false, "text": "ATTACH DATABASE path/to/other.db AS otherDb" }, { "answer_id": 10020, "author": "Theo", "author_id": 1109, "a...
2008/08/05
[ "https://Stackoverflow.com/questions/2518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26/" ]
2,524
<p>I get the following error pretty regularly when compiling in Visual Studio and running my web application:</p> <p>"Unable to start debugging on the web server. The web server did not respond in a timely manner. This may be because another debugger is already attached to the web server."</p> <p>Normally this is after having debug the application once already. From the command line I run "iisreset /restart" and it fixes the problem.</p> <p>How do I prevent this from happening in the first place?</p>
[ { "answer_id": 27973753, "author": "Alberto Montellano", "author_id": 2848629, "author_profile": "https://Stackoverflow.com/users/2848629", "pm_score": 5, "selected": false, "text": "iisreset /restart" }, { "answer_id": 34310844, "author": "Reg Edit", "author_id": 1657610...
2008/08/05
[ "https://Stackoverflow.com/questions/2524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/417/" ]
2,525
<p>My product has several components: ASP.NET, Windows Forms App and Windows Service. 95% or so of the code is written in VB.NET.</p> <p>For Intellectual Property reasons, I need to obfuscate the code, and until now I have been using a version of dotfuscator which is now over 5 years old. I'm thinking it is time to move to a new generation tool. What I'm looking for is a list of requirements which I should consider when searching for a new obfuscator.</p> <p>What I know I should look for so far:</p> <ul> <li><strong><em>Serialization/De-serialization</em></strong>. In my current solution, I simply tell the tool <strong>not</strong> to obfuscate any class data members because the pain of not being able to load data which was previously serialized is simply too big.</li> <li><strong><em>Integration with Build Process</em></strong></li> <li><strong><em>Working with ASP.NET</em></strong>. In the past, I have found this problematic due to changing .dll names (you often have one per page) - which not all tools handle well.</li> </ul>
[ { "answer_id": 8739, "author": "Keith", "author_id": 905, "author_profile": "https://Stackoverflow.com/users/905", "pm_score": 7, "selected": true, "text": "var" } ]
2008/08/05
[ "https://Stackoverflow.com/questions/2525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/350/" ]
2,527
<p>How can I find out which node in a tree list the context menu has been activated? For instance right-clicking a node and selecting an option from the menu. </p> <p>I can't use the TreeViews' <code>SelectedNode</code> property because the node is only been right-clicked and not selected.</p>
[ { "answer_id": 2546, "author": "Jonesinator", "author_id": 152, "author_profile": "https://Stackoverflow.com/users/152", "pm_score": 8, "selected": true, "text": "void treeView1MouseUp(object sender, MouseEventArgs e)\n{\n if(e.Button == MouseButtons.Right)\n {\n // Select t...
2008/08/05
[ "https://Stackoverflow.com/questions/2527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/428/" ]
2,530
<p>How do you disable autocomplete in the major browsers for a specific input (or form field)?</p>
[ { "answer_id": 2531, "author": "nlucaroni", "author_id": 157, "author_profile": "https://Stackoverflow.com/users/157", "pm_score": 12, "selected": true, "text": "autocomplete=\"off\"" }, { "answer_id": 2537, "author": "brendan", "author_id": 225, "author_profile": "ht...
2008/08/05
[ "https://Stackoverflow.com/questions/2530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/307/" ]
2,550
<p>A quick glance at the present-day internet would seem to indicate that Adobe Flash is the obvious choice for embedding video in a web page. Is this accurate, or are they other effective choices? Does the choice of ASP.NET as a platform influence this decision?</p>
[ { "answer_id": 922247, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<object width=\"660\" height=\"525\"><param name=\"movie\" value=\"http://www.youtube.com/v/WAQUskZuXhQ&hl=en&fs=1&color1=0x00...
2008/08/05
[ "https://Stackoverflow.com/questions/2550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/308/" ]
2,630
<p>I just found /n softwares free Powershell NetCmdlets, and after playing with them I love the functionality they bring to the command line. So it raises the question what are your favorite Cmdlets, and how do you use them?</p>
[ { "answer_id": 4692, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 2, "selected": false, "text": "cd" }, { "answer_id": 5498, "author": "Leon Bambrick", "author_id": 49, "author_profile": "https://Sta...
2008/08/05
[ "https://Stackoverflow.com/questions/2630", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17/" ]
2,647
<p>Using SQL Server, how do I split a string so I can access item x?</p> <p>Take a string "Hello John Smith". How can I split the string by space and access the item at index 1 which should return "John"?</p>
[ { "answer_id": 2657, "author": "Jonesinator", "author_id": 152, "author_profile": "https://Stackoverflow.com/users/152", "pm_score": 9, "selected": true, "text": "Declare @products varchar(200) = '1|20|3|343|44|6|8765'\nDeclare @individual varchar(20) = null\n\nWHILE LEN(@products) > 0\n...
2008/08/05
[ "https://Stackoverflow.com/questions/2647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
2,649
<p>When writing a T-SQL script that I plan on re-running, often times I use temporary tables to store temporary data. Since the temp table is created on the fly, I'd like to be able to drop that table only if it exists (before I create it).</p> <p>I'll post the method that I use, but I'd like to see if there is a better way.</p>
[ { "answer_id": 2652, "author": "Nathan Bedford", "author_id": 434, "author_profile": "https://Stackoverflow.com/users/434", "pm_score": 4, "selected": false, "text": "IF OBJECT_ID('tempdb..#t1', 'U') IS NOT NULL\n DROP TABLE #t1\n\nCREATE TABLE #t1\n(\n id INT IDENTITY(1,1),\n msg VAR...
2008/08/05
[ "https://Stackoverflow.com/questions/2649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/434/" ]
2,658
<p>I need to implement version control, even for just the developing I do at home. I have read about how great subversion is for the past couple of years and was about to dedicate myself to learning this on the side until I heard about Git being the up and coming version control system.</p> <p>Given the situation, should I hold off and see which one comes out on top? What are their relative advantages?</p> <p>One issue I noticed with Git is, there are not many full featured GUIs, which is important to many users on my team.</p> <p>Also, wouldn't mind suggestions on how to get started with one or the other. (tutorials, etc.)</p>
[ { "answer_id": 2668, "author": "Jonathan Works", "author_id": 309844, "author_profile": "https://Stackoverflow.com/users/309844", "pm_score": 7, "selected": true, "text": "cvs<->svn<->git<->hg\n" }, { "answer_id": 10774, "author": "Orion Edwards", "author_id": 234, "a...
2008/08/05
[ "https://Stackoverflow.com/questions/2658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/406/" ]
2,688
<p>When you execute a SQL query, you have to clean your strings or users can execute malicious SQL on your website.</p> <p>I usually just have a function escape_string(blah), which:</p> <ul> <li>Replaces escapes (<code>\</code>) with double escapes (<code>\\</code>).</li> <li>Replaces single quotes (<code>'</code>) with an escaped single quote (<code>\'</code>). </li> </ul> <p>Is this adequate? Is there a hole in my code? Is there a library which can do this quickly and reliably for me?</p> <p>I'd like to see graceful solutions in Perl, Java, and PHP.</p>
[ { "answer_id": 2691, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 2, "selected": false, "text": "--\n" }, { "answer_id": 2727, "author": "TiTi", "author_id": 435, "author_profile": "https://Stackoverflo...
2008/08/05
[ "https://Stackoverflow.com/questions/2688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/432/" ]
2,702
<p>I know I need to have (although I don't know why) a <code>GROUP BY</code> clause on the end of a SQL query that uses any aggregate functions like <code>count</code>, <code>sum</code>, <code>avg</code>, etc:</p> <pre><code>SELECT count(userID), userName FROM users GROUP BY userName </code></pre> <p>When else would <code>GROUP BY</code> be useful, and what are the performance ramifications?</p>
[ { "answer_id": 2704, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 2, "selected": false, "text": "SELECT TagName, Count(*)\nAS TimesUsed\nFROM Tags\nGROUP BY TagName ORDER TimesUsed\n" }, { "answer_id": 2736, "a...
2008/08/05
[ "https://Stackoverflow.com/questions/2702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/357/" ]
2,714
<p>I think most people know how to do this via the GUI (right click table, properties), but doing this in T-SQL totally rocks.</p>
[ { "answer_id": 2721, "author": "brendan", "author_id": 225, "author_profile": "https://Stackoverflow.com/users/225", "pm_score": 0, "selected": false, "text": "\nselect *\nfrom pubs.sys.database_files\n" } ]
2008/08/05
[ "https://Stackoverflow.com/questions/2714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/434/" ]
2,732
<p>Can anyone explain this behavior? Running:</p> <pre><code>#!/bin/sh echo "hello world" | read var1 var2 echo $var1 echo $var2 </code></pre> <p>results in nothing being ouput, while:</p> <pre><code>#!/bin/sh echo "hello world" &gt; test.file read var1 var2 &lt; test.file echo $var1 echo $var2 </code></pre> <p>produces the expected output:</p> <pre><code>hello world </code></pre> <p>Shouldn't the pipe do in one step what the redirection to test.file did in the second example? I tried the same code with both the dash and bash shells and got the same behavior from both of them.</p>
[ { "answer_id": 2764, "author": "Mark Harrison", "author_id": 116, "author_profile": "https://Stackoverflow.com/users/116", "pm_score": 3, "selected": false, "text": "$ echo $$;cat | read a\n10637\n" }, { "answer_id": 2777, "author": "num1", "author_id": 306, "author_p...
2008/08/05
[ "https://Stackoverflow.com/questions/2732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/75/" ]
2,742
<p>I'm interested in looking at Erlang and want to follow the path of least resistance in getting up and running.</p> <p>At present, I'm planning on installing <a href="http://www.erlang.org/download.html" rel="noreferrer">Erlang R12B-3</a> and <a href="http://erlide.sourceforge.net/" rel="noreferrer">Erlide</a> (<a href="http://www.eclipse.org/" rel="noreferrer">Eclipse</a> plugin). This is largely a Google-result-based decision. Initially this will be on a Windows XP system, though I am likely to reproduce the environment on Ubuntu shortly after.</p> <p>Is there a significantly better choice? Even if it is tied to one platform.</p> <p>Please share your experiences.</p>
[ { "answer_id": 380599, "author": "Juve", "author_id": 8986, "author_profile": "https://Stackoverflow.com/users/8986", "pm_score": 3, "selected": false, "text": "sudo aptitude install erlang" } ]
2008/08/05
[ "https://Stackoverflow.com/questions/2742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/304/" ]
2,750
<p>I'm wondering if it's a good idea to make <strong>verifications</strong> in <strong>getters</strong> and <strong>setters</strong>, or elsewhere in the code.</p> <p>This might surprise you be when it comes to <strong>optimizations</strong> and <strong>speeding</strong> up the code, I think you should not make verifications in getters and setters, but in the code where you're <strong>updating</strong> your files or database. Am I wrong?</p>
[ { "answer_id": 2757, "author": "Seibar", "author_id": 357, "author_profile": "https://Stackoverflow.com/users/357", "pm_score": 2, "selected": false, "text": "public string Name\n{\n get\n {\n return _name;\n }\n set\n {\n _name = value;\n }\n}\n" } ]
2008/08/05
[ "https://Stackoverflow.com/questions/2750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/435/" ]
2,770
<p>When working on ASP.NET 1.1 projects I always used the Global.asax to catch all errors. I'm looking for a similar way to catch all exceptions in a Windows Forms user control, which ends up being a hosted IE control. What is the proper way to go about doing something like this?</p>
[ { "answer_id": 2779, "author": "Chris Leon", "author_id": 289, "author_profile": "https://Stackoverflow.com/users/289", "pm_score": 6, "selected": true, "text": "System.Windows.Forms.Application.ThreadException" }, { "answer_id": 2817, "author": "Orion Edwards", "author_i...
2008/08/05
[ "https://Stackoverflow.com/questions/2770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/447/" ]