qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
315,340
<p>Nearly all programming languages used are <a href="http://en.wikipedia.org/wiki/Turing_Complete" rel="noreferrer">Turing Complete</a>, and while this affords the language to represent any <a href="http://en.wikipedia.org/wiki/Computability_theory_(computer_science)" rel="noreferrer">computable</a> algorithm, it also...
[ { "answer_id": 315401, "author": "hasen", "author_id": 35364, "author_profile": "https://Stackoverflow.com/users/35364", "pm_score": 4, "selected": false, "text": "function confusion()\n{\n if( halts( confusion ) )\n {\n while True:\n no-op\n }\n else\n ...
2008/11/24
[ "https://Stackoverflow.com/questions/315340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/658/" ]
315,358
<p>What is the correct syntax for this:</p> <pre><code>IList&lt;string&gt; names = "Tom,Scott,Bob".Split(',').ToList&lt;string&gt;().Reverse(); </code></pre> <p>What am I messing up? What does TSource mean?</p>
[ { "answer_id": 315365, "author": "Yona", "author_id": 40007, "author_profile": "https://Stackoverflow.com/users/40007", "pm_score": 2, "selected": false, "text": "List<string> names = new List<string>(\"Tom,Scott,Bob\".Split(','));\nnames.Reverse();\n" }, { "answer_id": 315369, ...
2008/11/24
[ "https://Stackoverflow.com/questions/315358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36590/" ]
315,362
<p>tldr: Can someone show me how to properly format this Python iMAP example so it works?</p> <p>from <a href="https://docs.python.org/2.4/lib/imap4-example.html" rel="nofollow noreferrer">https://docs.python.org/2.4/lib/imap4-example.html</a></p> <blockquote> <pre><code>import getpass, imaplib M = imaplib.IMAP4()...
[ { "answer_id": 315387, "author": "ayaz", "author_id": 23191, "author_profile": "https://Stackoverflow.com/users/23191", "pm_score": 2, "selected": false, "text": "M = imaplib.IMAP4_SSL( 'imap.gmail.com' )\n M = imaplib.IMAP4_SSL()\nM.open( 'imap.gmail.com' )\n" }, { "answer_id": ...
2008/11/24
[ "https://Stackoverflow.com/questions/315362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
315,363
<p>I have a nice and lovely Django site up and running, but have noticed that my <code>error.log</code> file was getting huge, over 150 MB after a couple of months of being live. Turns out a bunch of spambots are looking for well known URL vulnerabilities (or something) and hitting a bunch of sub-directories like <code...
[ { "answer_id": 315596, "author": "zgoda", "author_id": 12138, "author_profile": "https://Stackoverflow.com/users/12138", "pm_score": 2, "selected": false, "text": "DISALLOWED_USER_AGENT DISALLOWED_USER_AGENTS = (\n re.compile(r'Java'),\n re.compile(r'gigamega'),\n re.compile(r'l...
2008/11/24
[ "https://Stackoverflow.com/questions/315363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/736/" ]
315,378
<p>When coding, what is a good rule of thumb to keep in mind with respect to performance? There are endless ways to optimize for a specific platform and compiler, but I'm looking for answers that apply equally well (or almost) across compilers and platforms.</p>
[ { "answer_id": 315415, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 4, "selected": false, "text": "if switch void doit(int m) { switch(m) { case 1: f1(); break; case 2: f2(); break; } } void doit(void(*m)()...
2008/11/24
[ "https://Stackoverflow.com/questions/315378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13760/" ]
315,381
<p>I am having some difficulty writing a function that will search through a directory for a file that matches a specific regular expression (which I have compiled using 're.compile'). So my question is: How do I search through a directory (I plan to use os.walk) for a file that matches a specific regular expression? A...
[ { "answer_id": 315404, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 2, "selected": false, "text": "match fnmatch fnmatch re.match" }, { "answer_id": 315430, "author": "Vinko Vrsalovic", "author_id": 5190, ...
2008/11/24
[ "https://Stackoverflow.com/questions/315381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37804/" ]
315,393
<p>I have a KMainWindow:</p> <pre><code>//file.h class MainWindow: public KMainWindow { public: MainWindow(QWidget *parent = 0); ... ... ... private slots: void removeClick(); //file.cpp MainWindow::MainWindow(QWidget *parent) : KMainWindow(parent) {} void MainWindow::removeClick() { std::cout &lt;...
[ { "answer_id": 320769, "author": "mxcl", "author_id": 6444, "author_profile": "https://Stackoverflow.com/users/6444", "pm_score": 3, "selected": true, "text": "class MainWindow: public KMainWindow \n{\n Q_OBJECT\n\npublic:\n // [snip]\n}\n" } ]
2008/11/24
[ "https://Stackoverflow.com/questions/315393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39339/" ]
315,402
<p>The following exception is thrown:</p> <p>Error Message: Microsoft.SqlServer.Management.Smo.FailedOperationException: Drop failed for Database '4d982a46-58cb-4ddb-8999-28bd5bb900c7'. ---> Microsoft.SqlServer.Management.Common.ExecutionFailureException: An exception occurred while executing a Transact-SQL stateme...
[ { "answer_id": 315417, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 3, "selected": true, "text": "SqlConnection using" } ]
2008/11/24
[ "https://Stackoverflow.com/questions/315402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11135/" ]
315,403
<p>I am using windows authentication within an ASP.NET application. I am wondering how to best get the objectGuid from the currently logged in user?</p> <p>Regards, Egil.</p>
[ { "answer_id": 316721, "author": "PhilPursglove", "author_id": 1738, "author_profile": "https://Stackoverflow.com/users/1738", "pm_score": 3, "selected": true, "text": "Dim entry As DirectoryServices.DirectoryEntry\nDim mySearcher As System.DirectoryServices.DirectorySearcher\nDim result...
2008/11/24
[ "https://Stackoverflow.com/questions/315403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32809/" ]
315,435
<p>I am trying to write Reversi game in Python. Can anyone give me some basic ideas and strategy which are simple, good and easy to use?</p> <p>I would appreciate for any help because I've gone to a little far but is stucked between codes and it became more complex too. I think I overdid in some part that should be fa...
[ { "answer_id": 315454, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 2, "selected": false, "text": "gameBoard[10,10]\n enum tile\n{\n none,\n white,\n black\n}\n for (int i = 0; i < 10; i++)\n{\n for (int j = 0; ...
2008/11/24
[ "https://Stackoverflow.com/questions/315435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
315,437
<p>Is there some way to detect file handle leaks at program termination? </p> <p>In particular I would like to make sure that all of my handles that get created are being freed in code. </p> <p>For example, I may have a CreateFile() somewhere, and at program termination I want to detect and ensure that all of them a...
[ { "answer_id": 442695, "author": "Roger Lipscombe", "author_id": 8446, "author_profile": "https://Stackoverflow.com/users/8446", "pm_score": 2, "selected": false, "text": "CreateFile CloseHandle // StdAfx.h\n#include <windows.h>\n#undef CreateFile\n#if defined(UNICODE)\n #define CreateFi...
2008/11/24
[ "https://Stackoverflow.com/questions/315437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
315,459
<p>I will have around 200,000 images as part of my website. Each image will be stored 3 times: full size, thumbnail, larger thumbnail. Full size images are around 50Kb to 500Kb.</p> <p>Normal tech: Linux, Apache, MySQL, PHP on a VPS.</p> <p>What is the optimum way to store these for fast retrieval and display via a b...
[ { "answer_id": 315494, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 2, "selected": false, "text": "/images/I/M/G/8/IMG8993:\nIMG8993_full.jpg\nIMG8993_thumb.jpg\nIMG8993_smallthumb.jpg\n" }, { "answer_id": 3...
2008/11/24
[ "https://Stackoverflow.com/questions/315459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
315,464
<p>Consider the following dialog with the command-line interface to the kernel:</p> <pre><code>$ math Mathematica 6.0 for Linux x86 (32-bit) In[1]:= p = Plot[x^2, {x,-1,1}] Out[1]= -Graphics- In[2]:= Export["foo.png", p] Out[2]= foo.png </code></pre> <p>That works fine on a machine with <code>$Version = 6.0 for Lin...
[ { "answer_id": 1703375, "author": "trybik", "author_id": 207241, "author_profile": "https://Stackoverflow.com/users/207241", "pm_score": 4, "selected": true, "text": "UseFrontEnd[Export[filename,graphics]] export DISPLAY=machine_address:0.0 -display machine_address:0.0 Xvfb :display_nr &...
2008/11/24
[ "https://Stackoverflow.com/questions/315464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4234/" ]
315,475
<p>is there an easy way to solve the following problem.</p> <p>Let's say I fetch a IList with some books in my controller from my model. Now I want to enrich the output and fetch a preview from Amazon with another model from an outside framework and get another IList.</p> <p>Now I put both ILists into a property bag....
[ { "answer_id": 315594, "author": "Ris Adams", "author_id": 15683, "author_profile": "https://Stackoverflow.com/users/15683", "pm_score": 2, "selected": true, "text": "class BookList{\n MyBookObject a;\n AmazonBookObject b;\n}\n" }, { "answer_id": 349265, "auth...
2008/11/24
[ "https://Stackoverflow.com/questions/315475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25233/" ]
315,485
<p>Does Visual Studio .NET have a way to toggle word-wrap on and off?</p> <p>I am used to this feature in Eclipse which allows you to right click and toggle word wrap on and off so that when you have long lines that extend out to the right, you don't have to move the bottom scroll bar right and left to read your code/...
[ { "answer_id": 55887378, "author": "Judel5", "author_id": 1236141, "author_profile": "https://Stackoverflow.com/users/1236141", "pm_score": 2, "selected": false, "text": "Visual Studio 2017" } ]
2008/11/24
[ "https://Stackoverflow.com/questions/315485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
315,488
<p>I have an AVI file, which I want to re-encode to fit on a CD of size 650 MB. How can I encode such that file size does not exceed the given size? Which program can I use ?</p>
[ { "answer_id": 315702, "author": "Klathzazt", "author_id": 35223, "author_profile": "https://Stackoverflow.com/users/35223", "pm_score": 2, "selected": false, "text": "C:\\Program Files\\Microsoft SDKs\\Windows\\v6.1\\Samples\\Multimedia\\DirectShow\\BaseClasses\n C:\\Program Files\\Micr...
2008/11/24
[ "https://Stackoverflow.com/questions/315488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37603/" ]
315,495
<p>I am currently using SQL Server Management Studio (Ver 9.00.3042.00) and click the "New Query" and wrote the following code:</p> <pre><code>Select colA, colB, colC colD From table1 </code></pre> <p>When I click the parse (checkbox) button to validate the SQL statement, it says "Command(s) comp...
[ { "answer_id": 315510, "author": "Jeromy Irvine", "author_id": 8223, "author_profile": "https://Stackoverflow.com/users/8223", "pm_score": 5, "selected": true, "text": "colC as colD\n Select \n colA\n , colB\n , colC\n colD\nFrom\n table1\n" }, { "answer_id": 31557...
2008/11/24
[ "https://Stackoverflow.com/questions/315495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26327/" ]
315,496
<p>I have an object that implements <a href="http://www.php.net/~helly/php/ext/spl/interfaceArrayAccess.html" rel="nofollow noreferrer">ArrayAccess</a>, <a href="http://www.php.net/~helly/php/ext/spl/interfaceIterator.html" rel="nofollow noreferrer">Iterator</a> and <a href="http://www.php.net/~helly/php/ext/spl/interf...
[ { "answer_id": 315575, "author": "majelbstoat", "author_id": 38812, "author_profile": "https://Stackoverflow.com/users/38812", "pm_score": 2, "selected": false, "text": "class MyIterator implements Iterator {\n public function key() {\n //\n }\n\n public function rewind() {\n //...
2008/11/24
[ "https://Stackoverflow.com/questions/315496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2238/" ]
315,504
<p>Do you have any tricks for generating SQL statements, mainly INSERTs, in Excel for various data import scenarios?</p> <p>I'm really getting tired of writing formulas with like </p> <p><code>="INSERT INTO Table (ID, Name) VALUES (" &amp; C2 &amp; ", '" &amp; D2 &amp; "')"</code></p>
[ { "answer_id": 315535, "author": "Jason V", "author_id": 27912, "author_profile": "https://Stackoverflow.com/users/27912", "pm_score": 6, "selected": true, "text": "=CONCATENATE(\"insert into table (id, name) values (\",C2,\",' \",D2,\" ');\") =CONCATENATE(\"insert into table (id, date, ...
2008/11/24
[ "https://Stackoverflow.com/questions/315504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11063/" ]
315,507
<p>For some reason, I am having trouble thinking of a good way to rewrite this function so it uses constant stack space. Most online discussions of tree recursion cheat by using the Fibonacci function and exploiting the properties of that particular problem. Does anyone have any ideas for this "real-world" (well, more ...
[ { "answer_id": 315875, "author": "Chris Conway", "author_id": 1412, "author_profile": "https://Stackoverflow.com/users/1412", "pm_score": 2, "selected": false, "text": "(define (frob0 x k)\n (cond ((foo? x)\n (k x))\n ((bar? x)\n (frob0 (g x) \n (lambda ...
2008/11/24
[ "https://Stackoverflow.com/questions/315507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28604/" ]
315,513
<p>I want to be able to take still images with a web cam, via .NET 2.0 (or 3.5 if necessary). I know I can use DirectShow but that seems like a very large learning curve.</p> <p>Is there a simple to use OCX, or library that can work with most standard webcams?</p>
[ { "answer_id": 315875, "author": "Chris Conway", "author_id": 1412, "author_profile": "https://Stackoverflow.com/users/1412", "pm_score": 2, "selected": false, "text": "(define (frob0 x k)\n (cond ((foo? x)\n (k x))\n ((bar? x)\n (frob0 (g x) \n (lambda ...
2008/11/24
[ "https://Stackoverflow.com/questions/315513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16794/" ]
315,517
<p>Here is the code currently used.</p> <pre><code>public String getStringFromDoc(org.w3c.dom.Document doc) { try { DOMSource domSource = new DOMSource(doc); StringWriter writer = new StringWriter(); StreamResult result = new StreamResult(writer); Transfor...
[ { "answer_id": 315578, "author": "digitalsanctum", "author_id": 22436, "author_profile": "https://Stackoverflow.com/users/22436", "pm_score": 4, "selected": false, "text": "try {\n Transformer transformer = TransformerFactory.newInstance().newTransformer();\n StreamResult result = ...
2008/11/24
[ "https://Stackoverflow.com/questions/315517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/700/" ]
315,519
<p>Which is better in general in terms of the ordering? Do you put the fault condition at the top or bottom?</p> <pre><code>if (noProblems == true) { // do stuff } else { // deal with problem } </code></pre> <p>OR</p> <pre><code>if (noProblems == false) { // deal with problem } else { // do stuff } ...
[ { "answer_id": 315523, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 7, "selected": true, "text": "if (some error condition)\n{\n //handle it\n return;\n}\n//implicit else for happy path\n...\n" }, { "an...
2008/11/24
[ "https://Stackoverflow.com/questions/315519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337/" ]
315,527
<p>I am trying to use <a href="http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx" rel="nofollow noreferrer">ShellExecute</a> to open a file in Excel. I was reading about the function on MSDN forums, and I found the folowing information about the handle, which is the first parameter: </p> <p>"hwnd [in] A han...
[ { "answer_id": 315554, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 3, "selected": true, "text": "\" ' ... ' \" \"'C:\\\\Documents and Settings\\\\Lab1\\\\My Documents\\\\Test.xls'\"\n \" \"\" ... \"\" \" \"\"\"C:\\\\Documen...
2008/11/24
[ "https://Stackoverflow.com/questions/315527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23970/" ]
315,546
<p>I like the idea of having only one <code>return</code> statement per method.</p> <p>What do you do in this situation though?</p> <pre><code>public static string ChopText(string Text) { if (String.IsNullOrEmpty(Text)) { // return here ????? } } </code></pre> <p>The only alternative I can think of is...
[ { "answer_id": 315562, "author": "Paul Kapustin", "author_id": 38325, "author_profile": "https://Stackoverflow.com/users/38325", "pm_score": 3, "selected": false, "text": "public static string ChopText(string Text))\n{\n if(String.IsNullOrEmpty(Text)\n return Text;\n\n ...\n}\n"...
2008/11/24
[ "https://Stackoverflow.com/questions/315546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
315,552
<p>Working on big, high loaded project I got the problem that already described in billion of topics on forums and blog, but there is no solution that will help in my case. Here is the story.</p> <p>I have the HTML code of banner, I don't know what is the code. Sometimes it's plain HTML, but sometimes it's <code>&lt;s...
[ { "answer_id": 1975537, "author": "noah", "author_id": 12034, "author_profile": "https://Stackoverflow.com/users/12034", "pm_score": 2, "selected": false, "text": "document.write document.write $('#bannerPlaceHolder').writeCapture().html('<script type=\"text/javascript\" src=\"http://dou...
2008/11/24
[ "https://Stackoverflow.com/questions/315552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15752/" ]
315,585
<p>Anyone out there using Fogbugz and Scrum together?</p> <p>We use Fogbugz extensively, and I'm looking for ideas from anyone who may be using it as part of Scrum. I found these two items, but they are archived and unvailable for further discussion. I'm specifically interested in ideas for mapping Scrum concepts into...
[ { "answer_id": 328595, "author": "Stefan Rusek", "author_id": 19704, "author_profile": "https://Stackoverflow.com/users/19704", "pm_score": 2, "selected": false, "text": "priority:7 project:\"project name\"\n" } ]
2008/11/24
[ "https://Stackoverflow.com/questions/315585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5208/" ]
315,590
<p>I want to load 52 images (deck of cards) in gif format from my recourse folder into an Image[] in c#. Any ideas?</p> <p>Thanks, Jon</p>
[ { "answer_id": 315611, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 3, "selected": true, "text": " public static Bitmap GetBitmap( string filename )\n {\n Bitmap retBitmap = null;\n string path = String.Conca...
2008/11/24
[ "https://Stackoverflow.com/questions/315590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40399/" ]
315,591
<p>I am working on an object factory to keep track of a small collection of objects. The objects can be of different types, but they will all respond to <code>createInstance</code> and <code>reset</code>. The objects can not be derived from a common base class because some of them will have to derive from built-in coco...
[ { "answer_id": 315641, "author": "Michael Tsai", "author_id": 6311, "author_profile": "https://Stackoverflow.com/users/6311", "pm_score": 2, "selected": false, "text": "- (id)makeObjectOfClassNamed:(NSString *)className\n{\n Class klass = NSClassFromString(className);\n assert([kla...
2008/11/24
[ "https://Stackoverflow.com/questions/315591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33686/" ]
315,608
<p>I am building a graphic board like project where i am facing a design issue.</p> <p>Main Class is Board which is a canvas responsible for handling mouse events when drawing shapes. It also has context variables such as currentShape or snapFlag to activate grid magnetism.</p> <p>To handle the moving / resizing / ro...
[ { "answer_id": 315653, "author": "e.James", "author_id": 33686, "author_profile": "https://Stackoverflow.com/users/33686", "pm_score": 1, "selected": false, "text": "Board Shape Board Shape onMove" }, { "answer_id": 315769, "author": "coulix", "author_id": 32032, "aut...
2008/11/24
[ "https://Stackoverflow.com/questions/315608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32032/" ]
315,609
<p>The application that I'm designing will retrieve and store content from a variety of disparate sources on a schedule. In some cases, the content will be retrieved based on a time interval (think stock quotes), and in other cases the content will be retrieved based on a custom schedule (MWF @ 2pm). Many of the proc...
[ { "answer_id": 315653, "author": "e.James", "author_id": 33686, "author_profile": "https://Stackoverflow.com/users/33686", "pm_score": 1, "selected": false, "text": "Board Shape Board Shape onMove" }, { "answer_id": 315769, "author": "coulix", "author_id": 32032, "aut...
2008/11/24
[ "https://Stackoverflow.com/questions/315609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40396/" ]
315,618
<p>How do I extract a tar (or tar.gz, or tar.bz2) file in Java?</p>
[ { "answer_id": 315668, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 6, "selected": true, "text": "GZIPInputStream InputStream FileInputStream GZIPInputStream InputStream InputStream is = new GZIPInputStream(new FileInputSt...
2008/11/24
[ "https://Stackoverflow.com/questions/315618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18103/" ]
315,621
<p>I have a table with N rows, and I wanna select N-1 rows. </p> <p>Suggestions on how to do this in one query, if it's possible..?</p>
[ { "answer_id": 315631, "author": "Joshua Carmody", "author_id": 8409, "author_profile": "https://Stackoverflow.com/users/8409", "pm_score": 6, "selected": true, "text": "SELECT * FROM TABLE WHERE ID != (SELECT MAX(ID) FROM TABLE)\n" }, { "answer_id": 38857293, "author": "Redi...
2008/11/24
[ "https://Stackoverflow.com/questions/315621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33232/" ]
315,667
<p>I'm a non-computer science student doing a history thesis that involves determining the frequency of specific terms in a number of texts and then plotting these frequencies over time to determine changes and trends. While I have figured out how to determine word frequencies for a given text file, I am dealing with a...
[ { "answer_id": 315707, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 4, "selected": true, "text": "#!/usr/bin/perl\n\nuse strict;\nuse warnings;\n\nmy $word_list_file = shift;\nmy $process_file = shift;\n\nmy %word_c...
2008/11/24
[ "https://Stackoverflow.com/questions/315667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40414/" ]
315,672
<p>Does anyone know if there's a way to automatically expand a list in Python, separated by commas? I'm writing some Python code that uses the MySQLdb library, and I'm trying to dynamically update a list of rows in a MySQL database with certain key values.</p> <p>For instance, in the code below, I'd like to have the ...
[ { "answer_id": 315684, "author": "hasen", "author_id": 35364, "author_profile": "https://Stackoverflow.com/users/35364", "pm_score": 5, "selected": true, "text": "\",\".join( map(str, record_ids) )\n \",\".join( list_of_strings ) map( str, list )" }, { "answer_id": 315786, "a...
2008/11/24
[ "https://Stackoverflow.com/questions/315672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31319/" ]
315,678
<p>I have a web application that uses Ext-JS 2.2. In a certain component, we have an empty toolbar that we are trying to add a button to using </p> <pre><code>myPanel.getTopToolbar().insertButton(0, [...array of buttons...]); </code></pre> <p>However, in IE6/7 this fails because of lines 20241-20242 in ext-all-debug....
[ { "answer_id": 316155, "author": "cwhite", "author_id": 4923, "author_profile": "https://Stackoverflow.com/users/4923", "pm_score": 1, "selected": false, "text": " myPanel.getTopToolbar().add(buttons etc);\n myPanel.getTopToolbar().addButton(..);\n" }, { "answer_id": 482338, ...
2008/11/24
[ "https://Stackoverflow.com/questions/315678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25066/" ]
315,706
<p>When reading from a <a href="http://search.cpan.org/dist/IO" rel="nofollow noreferrer">IO::Socket::INET</a> filehandle it can not be assumed that there will always be data available on the stream. What techniques are available to either peek at the stream to check if data is available or when doing the read take no ...
[ { "answer_id": 315751, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 4, "selected": true, "text": "Blocking 0 $sock = IO::Socket::INET->new(Blocking => 0, ...);\n" } ]
2008/11/24
[ "https://Stackoverflow.com/questions/315706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12251/" ]
315,708
<p>Is there any good way to convert strings like "xlSum", "xlAverage", and "xlCount" into the value they have under Microsoft.Office.Interop.Excel.XlConsolidationFunction?</p> <p>I guess reflection would be slow (if its possible). There are about 10 of these constant values. I was trying to avoid a large switch statem...
[ { "answer_id": 315715, "author": "Dror Helper", "author_id": 11361, "author_profile": "https://Stackoverflow.com/users/11361", "pm_score": 0, "selected": false, "text": "Dictionary<string, ...>" }, { "answer_id": 315721, "author": "tvanfosson", "author_id": 12950, "au...
2008/11/24
[ "https://Stackoverflow.com/questions/315708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36590/" ]
315,712
<p>I have a three-step process that is entirely reliant upon JavaScript and Ajax to load data and animate the process from one step to the next. To further complicate matters, the transition (forward and backward) between steps is animated :-(. As user's progress through the process anchor's appear showing the current ...
[ { "answer_id": 315880, "author": "Benry", "author_id": 28408, "author_profile": "https://Stackoverflow.com/users/28408", "pm_score": 4, "selected": true, "text": "for (var i = 0; i < profile.current + 1; i++) {\n if ($('step_anchor_' + i).innerHTML.empty()) {\n var action = pro...
2008/11/24
[ "https://Stackoverflow.com/questions/315712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20178/" ]
315,716
<p>I am looking for a way to periodically send some data over all clients connected to a TCP port. I am looking at twisted python and I am aware of reactor.callLater. But how do I use it to send some data to all connected clients periodically ? The data sending logic is in Protocol class and it is instantiated by the r...
[ { "answer_id": 316559, "author": "Jerub", "author_id": 14648, "author_profile": "https://Stackoverflow.com/users/14648", "pm_score": 6, "selected": true, "text": "from twisted.internet import reactor, protocol, task\n\nclass MyProtocol(protocol.Protocol):\n def connectionMade(self):\n...
2008/11/24
[ "https://Stackoverflow.com/questions/315716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29120/" ]
315,719
<p>I'm trying to convert a character code to a character with chr(), but VBScript isn't giving me the value I expect. According to VBScript, character code 199 is:</p> <pre><code>� </code></pre> <p>However, when using something like Javascript's String.fromCharCode, 199 is:</p> <pre><code>Ç </code></pre> <p>The s...
[ { "answer_id": 315725, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stackoverflow.com/users/4435", "pm_score": 4, "selected": true, "text": "Chr(199) ChrW(199) Unicode ChrB(199)" }, { "answer_id": 315731, "author": "Daniel Kreiseder", "author_id": 3140...
2008/11/24
[ "https://Stackoverflow.com/questions/315719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31516/" ]
315,724
<p>I have an after_save filter which I dont want to trigger in a specific instance. Is there a way to do this similar to save_without_validation?</p> <p>Thanks,</p>
[ { "answer_id": 316162, "author": "Michael Sepcot", "author_id": 6033, "author_profile": "https://Stackoverflow.com/users/6033", "pm_score": 0, "selected": false, "text": "def self.skip_callback(callback, &block)\n method = instance_method(callback)\n remove_method(callback) if respond_...
2008/11/24
[ "https://Stackoverflow.com/questions/315724", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
315,729
<p>I am facing a problem. I would like to localize my action names in my project so french people can have clean urls with french names.</p> <p><a href="http://www.test.com/Home" rel="nofollow noreferrer">http://www.test.com/Home</a> should be <a href="http://www.test.com/Accueil" rel="nofollow noreferrer">http://www....
[ { "answer_id": 315737, "author": "Kyle West", "author_id": 34133, "author_profile": "https://Stackoverflow.com/users/34133", "pm_score": 3, "selected": true, "text": "routes.MapRoute(\"Catalog-Brands\", \"catalog/brand/\", new {controller = \"Brand\", action = \"Index\", isActive = true}...
2008/11/24
[ "https://Stackoverflow.com/questions/315729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1195872/" ]
315,736
<p>I have a WCF Service that should not enter the faulted state. If there's an exception, it should be logged and the service should continue uninterrupted. The service has a one-way operation contract and is reading messages from an MSMQ.</p> <p>My problems are twofold:</p> <ol> <li>The service appears to be swallow...
[ { "answer_id": 316560, "author": "David Vidmar", "author_id": 11063, "author_profile": "https://Stackoverflow.com/users/11063", "pm_score": 3, "selected": false, "text": "ServiceHelper<CodeListServiceClient, CodeListService.CodeListService>.Use(\n proxy => seasonCodeBindingSource.Data...
2008/11/24
[ "https://Stackoverflow.com/questions/315736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
315,738
<p>I have a very simple html. The red div is inside the blue div and has a 10 px top margin. On non-ie browsers, the blue box is 10 px apart from the top of viewport and the red div is at the very top of the blue div. What I expect is the ie behavior: red div must be 10 px apart from the top of the blue div. Why does n...
[ { "answer_id": 315772, "author": "Chris Lloyd", "author_id": 42413, "author_profile": "https://Stackoverflow.com/users/42413", "pm_score": 2, "selected": false, "text": "overflow: auto; <html>\n<head>\n<style>\nbody { margin:0; padding:0; }\n.outer\n{\n background-color: #00f;\n he...
2008/11/24
[ "https://Stackoverflow.com/questions/315738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31505/" ]
315,739
<p>I have a problem when assigning functions to the click event of a button in IE 7 with jQuery. Something like the following works fine in Opera but produces an infinite loop in IE:</p> <pre><code>function updateIndputFields(index, id) { $("#reloadBtn").click(function(){ updateIndputFields(index, id) }); } </code>...
[ { "answer_id": 315789, "author": "ringmaster", "author_id": 40413, "author_profile": "https://Stackoverflow.com/users/40413", "pm_score": 4, "selected": true, "text": "<script type=\"text/javascript\">\nfunction updateIndputFields(index, id) {\n$('#output').append('<p>' + index + ' : ' +...
2008/11/24
[ "https://Stackoverflow.com/questions/315739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4055/" ]
315,745
<p>I want to use this pure HTML/CSS template for my ASP.NET website:</p> <p><a href="http://sub3.tanguay.de" rel="nofollow noreferrer">http://sub3.tanguay.de</a></p> <p>I copy it inside my Default.aspx page, inside the FORM element, but the form messes up the layout:</p> <p><a href="http://sub2.tanguay.de" rel="nofo...
[ { "answer_id": 315774, "author": "devio", "author_id": 21336, "author_profile": "https://Stackoverflow.com/users/21336", "pm_score": 2, "selected": true, "text": "form {\n margin:10px; padding: 0;\n border: 1px solid #f2f2f2; \n background-color: #FAFAFA; /* remove this */\n}\n"...
2008/11/24
[ "https://Stackoverflow.com/questions/315745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
315,752
<p>I need to update a pair of old classic asp pages&mdash; a <code>search.asp</code> page that provides a simple form which is then posted to a <code>results.asp</code> page. One of the form options on the search page is a drop down list (<code>&lt;select</code>) for the "format". If the user chooses the excel format...
[ { "answer_id": 315861, "author": "Soldarnal", "author_id": 3420, "author_profile": "https://Stackoverflow.com/users/3420", "pm_score": 0, "selected": false, "text": "Response.AddHeader \"Content-Disposition\", \"attachment; filename=report.xls\"\n" } ]
2008/11/24
[ "https://Stackoverflow.com/questions/315752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043/" ]
315,760
<p>I've been using this function but I'd like to know what's the most efficient and accurate way to get it.</p> <pre><code>function daysInMonth(iMonth, iYear) { return 32 - new Date(iYear, iMonth, 32).getDate(); } </code></pre>
[ { "answer_id": 315767, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 9, "selected": true, "text": "function daysInMonth (month, year) { // Use 1 for January, 2 for February, etc.\n return new Date(year, month, 0).getDate();...
2008/11/24
[ "https://Stackoverflow.com/questions/315760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39203/" ]
315,778
<p>I just started using CCNet, and in the process of getting my build projects set up I racked up a lot of build history from trial and error. I really don't want to keep that old stuff around, but I can't seem to see where/how to get rid of it. I'm sure this is a silly question, and I apologize if I'm overlooking some...
[ { "answer_id": 26930555, "author": "Dan Malcolm", "author_id": 146280, "author_profile": "https://Stackoverflow.com/users/146280", "pm_score": 0, "selected": false, "text": "$limit = (Get-Date).AddDays(-60)\n\nget-childitem -Path D:\\Builds -filter MatchMyProjects.* | %{ \n $projectPa...
2008/11/24
[ "https://Stackoverflow.com/questions/315778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4296/" ]
315,780
<p>I have a small web application which uses themes. The themes work on host, so on preinit, if the host = a, load x theme, if the host = b, load y theme. </p> <p>In my code this looks like: </p> <p>If request.url.host.contains("a") Then Page.Theme = x Else request.url.host.contains("b") Then Page.Theme = y </p> ...
[ { "answer_id": 61499213, "author": "Imran Rafique", "author_id": 1600006, "author_profile": "https://Stackoverflow.com/users/1600006", "pm_score": 0, "selected": false, "text": "Internet Information Services --> World Wide Web Services --> Common HTTP Features " } ]
2008/11/24
[ "https://Stackoverflow.com/questions/315780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32484/" ]
315,787
<p>I' trying to use a Linq query to find and set the selected value in a drop down list control.</p> <pre><code> Dim qry = From i In ddlOutcome.Items _ Where i.Text.Contains(value) Dim selectedItem As ListItem = qry.First ddlOutcome.SelectedValue = selectedItem.Value </code></pre> <p>Even though the d...
[ { "answer_id": 315878, "author": "x0n", "author_id": 6920, "author_profile": "https://Stackoverflow.com/users/6920", "pm_score": 1, "selected": false, "text": "Dim qry = From DirectCast(i, ListItem) In ddlOutcome.Items ...\n" }, { "answer_id": 315916, "author": "netadictos", ...
2008/11/24
[ "https://Stackoverflow.com/questions/315787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25121/" ]
315,792
<p>How can I achieve the following? I have two models (blogs and readers) and a JOIN table that will allow me to have an N:M relationship between them:</p> <pre><code>class Blog &lt; ActiveRecord::Base has_many :blogs_readers, :dependent =&gt; :destroy has_many :readers, :through =&gt; :blogs_readers end class Re...
[ { "answer_id": 315821, "author": "Mike Breen", "author_id": 22346, "author_profile": "https://Stackoverflow.com/users/22346", "pm_score": 5, "selected": false, "text": "class BlogsReaders < ActiveRecord::Base\n belongs_to :blog\n belongs_to :reader\n\n validates_uniqueness_of :reader_...
2008/11/24
[ "https://Stackoverflow.com/questions/315792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29909/" ]
315,799
<p>I have some code that reads 10 registry keys, sometimes the values are not present sometimes the keys are not present, sometimes the value isn't boolean etc etc. How should I add error handling to this, currently it is placed in one big try{} catch{} but if the second value I read fails then the rest are not read as...
[ { "answer_id": 315807, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "SomeReturnType foo = HackyMethod(first path);\nSomeReturnType bar = HackyMethod(sedond path);\n\nSomeReturnType Hacky...
2008/11/24
[ "https://Stackoverflow.com/questions/315799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
315,803
<p>I get the following error while building OpenCV on OS X 10.5 (intel):</p> <pre><code>ld: warning in .libs/_cv_la-_cv.o, file is not of required architecture ld: warning in .libs/_cv_la-error.o, file is not of required architecture ld: warning in .libs/_cv_la-pyhelpers.o, file is not of required architecture ld: war...
[ { "answer_id": 321534, "author": "Pyetras", "author_id": 40431, "author_profile": "https://Stackoverflow.com/users/40431", "pm_score": 0, "selected": false, "text": "ld: warning in .libs/_cv_la-_cv.o, file is not of required architecture\nld: warning in .libs/_cv_la-error.o, file is not ...
2008/11/24
[ "https://Stackoverflow.com/questions/315803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40431/" ]
315,804
<p>In my JSF/Facelets app, here's a simplified version of part of my form:</p> <pre><code>&lt;h:form id="myform"&gt; &lt;h:inputSecret value="#{createNewPassword.newPassword1}" id="newPassword1" /&gt; &lt;h:message class="error" for="newPassword1" /&gt; &lt;h:inputSecret value="#{createNewPassword.newPassword2}"...
[ { "answer_id": 315865, "author": "Jan Zich", "author_id": 15716, "author_profile": "https://Stackoverflow.com/users/15716", "pm_score": 2, "selected": false, "text": "<h:outputText\n value=\"#{CreateNewPasswordBean.errorMessage}\"\n render=\"#{CreateNewPasswordBean.errorMessage != ...
2008/11/24
[ "https://Stackoverflow.com/questions/315804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27515/" ]
315,829
<p>Suppose you create a generic Object variable and assign it to a specific instance. If you do GetType(), will it get type Object or the type of the original class?</p>
[ { "answer_id": 315835, "author": "Alan", "author_id": 37843, "author_profile": "https://Stackoverflow.com/users/37843", "pm_score": 3, "selected": true, "text": "object c = new FooBar();\nif(c is FooBar)\n Console.WriteLine(\"FOOBAR!!!\");\n" }, { "answer_id": 315837, "au...
2008/11/24
[ "https://Stackoverflow.com/questions/315829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/109/" ]
315,845
<p>Is there any reason to avoid using <code>text-align: justify;</code>? </p> <p>Does it reduce readability or cause problems?</p>
[ { "answer_id": 315876, "author": "dylanfm", "author_id": 38795, "author_profile": "https://Stackoverflow.com/users/38795", "pm_score": 5, "selected": false, "text": "hyphens" }, { "answer_id": 657528, "author": "hlfcoding", "author_id": 65465, "author_profile": "https...
2008/11/24
[ "https://Stackoverflow.com/questions/315845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12689/" ]
315,846
<p>When and why would somebody do the following:</p> <pre><code>doSomething( (MyClass) null ); </code></pre> <p>Have you ever done this? Could you please share your experience?</p>
[ { "answer_id": 315853, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 8, "selected": true, "text": "doSomething MyClass public void doSomething(MyClass c) {\n // ...\n}\n\npublic void doSomething(MyOtherCl...
2008/11/24
[ "https://Stackoverflow.com/questions/315846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2644/" ]
315,850
<p>I want to create a Rails (2.1 and 2.2) model with ActiveRecord validations, but without a database table. What is the most widely used approach? I've found some plugins that claim to offer this functionality, but many of them don't appear to be widely used or maintained. What does the community recommend I do? R...
[ { "answer_id": 316090, "author": "tpinto", "author_id": 40467, "author_profile": "https://Stackoverflow.com/users/40467", "pm_score": 3, "selected": false, "text": "class Car\n # here goes all your model's stuff\nend\n class Car\n attr_accessor :wheels # this will create for you th...
2008/11/24
[ "https://Stackoverflow.com/questions/315850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19693/" ]
315,887
<p>How do I mask the address of another site using HTML?</p> <p>For example, I'd like:</p> <p><a href="http://www.example.com/source.html" rel="nofollow noreferrer">http://www.example.com/source.html</a></p> <p>To point to another page:</p> <p><a href="http://www.example.com/dest.html" rel="nofollow noreferrer">htt...
[ { "answer_id": 316424, "author": "Dar", "author_id": 428842, "author_profile": "https://Stackoverflow.com/users/428842", "pm_score": 0, "selected": false, "text": "<script>location.href = 'http://www.example.com/dest.htm'</script>\n" }, { "answer_id": 325242, "author": "ONODE...
2008/11/24
[ "https://Stackoverflow.com/questions/315887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40440/" ]
315,891
<p>Can the name and icon of an Eclipse view be programmatically changed? I am referring to the name and icon that appear in the tab for the view - which are specified as XML attributes "name" and "icon" in the &lt;view&gt; element in plugin.xml.</p>
[ { "answer_id": 316871, "author": "jamesh", "author_id": 4737, "author_profile": "https://Stackoverflow.com/users/4737", "pm_score": 3, "selected": false, "text": "setPartName(String) setTitleImage(Image) WorkbenchPart EditorPart ViewPart WorkbenchPart protected" } ]
2008/11/24
[ "https://Stackoverflow.com/questions/315891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
315,893
<p>Writing a ton of web applications leveraging JSON/AJAX, I find myself returning tons literal javascript objects (JSON). For example, I may be request all the Cats from GetCats.asp. It would return:</p> <pre> [ { 'id': 0, 'name': 'Persian' }, { 'id': 1, 'name': 'Calico' }, { 'id': 2, 'name': 'Tabby' } ] </pr...
[ { "answer_id": 315927, "author": "Benry", "author_id": 28408, "author_profile": "https://Stackoverflow.com/users/28408", "pm_score": 2, "selected": false, "text": "function Cat(c) {\n this.id = c.id;\n this.name = c.name;\n}\nCat.prototype.meow = function() {alert('meow');}\nCat.protot...
2008/11/24
[ "https://Stackoverflow.com/questions/315893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
315,911
<p>Ok, after seeing <a href="https://stackoverflow.com/questions/315911/git-for-beginners-the-definitive-practical-guide/2678236#2678236">this post by PJ Hyett</a>, I have decided to skip to the end and go with <a href="http://en.wikipedia.org/wiki/Git_(software)" rel="nofollow noreferrer">Git</a>.</p> <p>So what I ne...
[ { "answer_id": 316039, "author": "Piotr Lesnicki", "author_id": 38796, "author_profile": "https://Stackoverflow.com/users/38796", "pm_score": 3, "selected": false, "text": "git stash" }, { "answer_id": 316055, "author": "Adam Davis", "author_id": 2915, "author_profile...
2008/11/24
[ "https://Stackoverflow.com/questions/315911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2915/" ]
315,915
<p>I have a SUM array formula that has multiple nested IF statements, making it very inefficient. My formula spans over 500 rows, but here is a simple version of it:</p> <pre><code>{=SUM(IF(IF(A1:A5&gt;A7:A11,A1:A5,A7:A11)-A13:A17&gt;0, IF(A1:A5&gt;A7:A11,A1:A5,A7:A11)-A13:A17,0))} </code></pre> <p>As you can see, th...
[ { "answer_id": 316024, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stackoverflow.com/users/4435", "pm_score": 2, "selected": false, "text": "=MAX( MAX( sum(A1:A5), sum(A7:A11) ) - sum(A13:A17), 0)\n" }, { "answer_id": 318478, "author": "DJ.", "author_...
2008/11/24
[ "https://Stackoverflow.com/questions/315915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40432/" ]
315,946
<p>I have a table User which has an identity column <code>UserID</code>, now what is the correct Linq to Entity line of code that would return me the max <code>UserID</code>?</p> <p>I've tried:</p> <pre><code>using (MyDBEntities db = new MyDBEntities()) { var User = db.Users.Last(); // or var User = db.Us...
[ { "answer_id": 315950, "author": "Jonas Kongslund", "author_id": 37548, "author_profile": "https://Stackoverflow.com/users/37548", "pm_score": 8, "selected": true, "text": "db.Users.OrderByDescending(u => u.UserId).FirstOrDefault();\n" }, { "answer_id": 689887, "author": "Com...
2008/11/25
[ "https://Stackoverflow.com/questions/315946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32240/" ]
315,948
<p>Is there a c++ equivalent of Java's</p> <pre><code>try { ... } catch (Throwable t) { ... } </code></pre> <p>I am trying to debug Java/jni code that calls native windows functions and the virtual machine keeps crashing. The native code appears fine in unit testing and only seems to crash when called throug...
[ { "answer_id": 315957, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 6, "selected": false, "text": "try {\n // ...\n} catch (...) {\n // ...\n}\n ... catch Exception" }, { "answer_id": 315960, "author": "J...
2008/11/25
[ "https://Stackoverflow.com/questions/315948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23120/" ]
315,963
<p>I am currently working in C#, and I need to insert a new record into one table, get the new primary key value, and then use that as a foreign key reference in inserting several more records. The Database is MS SQL Server 2003. All help is appreciated!</p>
[ { "answer_id": 315974, "author": "Duncan", "author_id": 25035, "author_profile": "https://Stackoverflow.com/users/25035", "pm_score": 2, "selected": false, "text": "SqlCommand cmd = new SqlCommand(@\"\n INSERT INTO T (Name) VALUES(@Name)\n SELECT SCOPE_IDENTITY() As TheId\", conn);...
2008/11/25
[ "https://Stackoverflow.com/questions/315963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40459/" ]
315,964
<p>I'm relatively familiar with the concepts of DI/IOC containers having worked on projects previously where their use were already in place. However, for this new project, there is no existing framework and I'm having to pick one.</p> <p>Long story short, there are some scenarios where we'll be configuring several i...
[ { "answer_id": 316337, "author": "Jeremy Wiebe", "author_id": 11807, "author_profile": "https://Stackoverflow.com/users/11807", "pm_score": 3, "selected": true, "text": "IUnityContainer container = new UnityContainer();\ncontainer.RegisterType<IMyInterface, MyFirstClass>();\ncontainer.Re...
2008/11/25
[ "https://Stackoverflow.com/questions/315964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2228/" ]
315,965
<p>In have a many-to-many linking table and I'm trying to set up two foreign keys on it. I run these two statements:</p> <pre><code>ALTER TABLE address_list_memberships ADD CONSTRAINT fk_address_list_memberships_address_id FOREIGN KEY index_address_id (address_id) REFERENCES addresses (id); ALTER TABLE address_list_m...
[ { "answer_id": 316054, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 2, "selected": false, "text": "ALTER mysql> show create table address_list_memberships;\n\nCREATE TABLE `address_list_memberships` (\n `address_id` ...
2008/11/25
[ "https://Stackoverflow.com/questions/315965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
315,966
<p>I'm new to using LINQ to Entities (or Entity Framework whatever they're calling it) and I'm writing a lot of code like this:</p> <pre><code>var item = (from InventoryItem item in db.Inventory where item.ID == id select item).First&lt;InventoryItem&gt;(); </code></pre> <p>and then calling me...
[ { "answer_id": 315985, "author": "Robert Wagner", "author_id": 10784, "author_profile": "https://Stackoverflow.com/users/10784", "pm_score": 7, "selected": true, "text": "var item = from InventoryItem item in\n db.Inventory.Include(\"ItemTypeReference\").Include(\"OrderLineI...
2008/11/25
[ "https://Stackoverflow.com/questions/315966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4541/" ]
315,968
<p>I have a Gridview boundfield where i set ReadOnly to true because i don't want user to change its value. However on the objectdatasource control's update method that boundfield became null when i try to use it as parameter in update method. Is there a way to set that value during updating?</p>
[ { "answer_id": 316138, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": true, "text": "<asp:TemplateField>\n <InsertItemTemplate>\n <asp:TextBox runat=\"server\" ID=\"itemTextBox\" />\n </InsertIt...
2008/11/25
[ "https://Stackoverflow.com/questions/315968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28647/" ]
315,987
<p>There are a few things that I almost always do when I put a class together in C++.</p> <p>1) Virtual Destructor 2) Copy constructor and assignment operator (I either implement them in terms of a private function called Copy(), or declare them private and thus explicitly disallow the compiler to auto generate them)....
[ { "answer_id": 315999, "author": "Federico A. Ramponi", "author_id": 18770, "author_profile": "https://Stackoverflow.com/users/18770", "pm_score": 2, "selected": false, "text": "operator string () const;\n friend ostream& operator << (ostream&, const MyClass&);\n" }, { "answer_id...
2008/11/25
[ "https://Stackoverflow.com/questions/315987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3886/" ]
315,991
<p>I need a command to replace the hosts file on my machine. Seems pretty straight forward but I cannot get the command to work with xcopy. Any obvious flaws in the command?</p> <p>luaexec -w -f "XCOPY" "%ScriptPath%/ModifiedHosts/vista/hosts" "%windir%/system32/drivers/etc/hosts" /H</p> <p>The /R flag does not seem...
[ { "answer_id": 316004, "author": "FerranB", "author_id": 40441, "author_profile": "https://Stackoverflow.com/users/40441", "pm_score": 2, "selected": true, "text": "luaexec -w -f \"XCOPY %ScriptPath%/ModifiedHosts/vista/hosts %windir%/system32/drivers/etc/hosts\" /H\n" } ]
2008/11/25
[ "https://Stackoverflow.com/questions/315991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15059/" ]
316,007
<p>I'm wondering if there is a better/inbuilt way, other than using a byte buffer and looping, to read from one stream and write it to another (in .NET). Generally this is done to apply a transform to a stream and move it on.</p> <p>In this instance, what I am loading a file, putting it through a deflate stream and wr...
[ { "answer_id": 316031, "author": "Greg Beech", "author_id": 13552, "author_profile": "https://Stackoverflow.com/users/13552", "pm_score": 4, "selected": true, "text": "CopyTo public static void CopyTo(this Stream source, Stream destination)\n{\n var buffer = new byte[0x1000];\n int...
2008/11/25
[ "https://Stackoverflow.com/questions/316007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10784/" ]
316,008
<p>I'm trying to import some data from Excel to SQL Server, I have a TEXT column with some numbers in it, some of the numbers go over just fine, and some turn into scientific form.</p> <p>Column in Excel is "text" type, column in the target sql table is varchar(255)</p> <p>Here are some examples: </p> <p>Excel [text...
[ { "answer_id": 316031, "author": "Greg Beech", "author_id": 13552, "author_profile": "https://Stackoverflow.com/users/13552", "pm_score": 4, "selected": true, "text": "CopyTo public static void CopyTo(this Stream source, Stream destination)\n{\n var buffer = new byte[0x1000];\n int...
2008/11/25
[ "https://Stackoverflow.com/questions/316008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3661/" ]
316,009
<p>I'm working on something that requires traversing through the file system and for any given path, I need to know how 'deep' I am in the folder structure. Here's what I'm currently using:</p> <pre><code>int folderDepth = 0; string tmpPath = startPath; while (Directory.GetParent(tmpPath) != null) { folderDepth+...
[ { "answer_id": 316016, "author": "Paul Sonier", "author_id": 28053, "author_profile": "https://Stackoverflow.com/users/28053", "pm_score": 5, "selected": true, "text": "Directory.GetFullPath().Split(\"\\\\\").Length;\n" }, { "answer_id": 316330, "author": "Jeff Yates", "a...
2008/11/25
[ "https://Stackoverflow.com/questions/316009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1354/" ]
316,017
<p>Here's the code I have in the html file to "include" the file "vmenu.php"</p> <pre><code> &lt;div id="apDivVistaMenus"&gt; &lt;?php include 'vmenu.php'; ?&gt; &lt;!-- Begin Vista-Buttons.com --&gt; &lt;!-- End Vista-Buttons.com --&gt; &lt;/div&gt; </code></pre> <p>The menus used to be between the commen...
[ { "answer_id": 1738861, "author": "mattbasta", "author_id": 205229, "author_profile": "https://Stackoverflow.com/users/205229", "pm_score": 0, "selected": false, "text": "<div id=\"apDivVistaMenus\">\n<!-- Begin Vista-Buttons.com -->\n<?php include 'vmenu.php'; ?>\n<!-- End Vista-Buttons...
2008/11/25
[ "https://Stackoverflow.com/questions/316017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40091/" ]
316,057
<p><strong>Duplicate of:</strong> <a href="https://stackoverflow.com/questions/203113/use-javascript-to-inject-script-references-as-needed">Use javascript to inject script references as needed?</a></p> <p>Javascript doesn't have any directive to "include" or "import" another js file. This means that if <code>script1.j...
[ { "answer_id": 316077, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 1, "selected": false, "text": " var Scriptaculous = {\n Version: '1.8.2',\n require: function(libraryName) {\n // inserting via DOM fails in S...
2008/11/25
[ "https://Stackoverflow.com/questions/316057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35364/" ]
316,078
<p>I saw the following interesting usage of tar in a co-worker's Bash scripts:</p> <pre><code>`tar cf - * | (cd &lt;dest&gt; ; tar xf - )` </code></pre> <p>Apparently it works much like rsync -av does, but faster. The question arises, how?</p> <p>-m</p> <hr> <p><strong>EDIT</strong>: Can anyone explain <em>why</e...
[ { "answer_id": 316083, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 4, "selected": false, "text": "f" }, { "answer_id": 316085, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profil...
2008/11/25
[ "https://Stackoverflow.com/questions/316078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31295/" ]
316,099
<p>I have a site that connects using cURL (latest version) to a secure gateway for payment.</p> <p>The problem is cURL always returns 0 length content. I get headers only. And only when I set cURL to return headers. I have the following flags in place.</p> <pre><code>curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY); ...
[ { "answer_id": 316185, "author": "too much php", "author_id": 28835, "author_profile": "https://Stackoverflow.com/users/28835", "pm_score": -1, "selected": false, "text": "curl_setopt($ch, CURLOPT_POST, 1);\ncurl_setopt($ch, CURLOPT_POSTFIELDS, $data);\n" }, { "answer_id": 316732...
2008/11/25
[ "https://Stackoverflow.com/questions/316099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31671/" ]
316,131
<p>Given a linux kernel oops, how do you go about diagnosing the problem? In the output I can see a stack trace which seems to give some clues. Are there any tools that would help find the problem? What basic procedures do you follow to track it down?</p> <pre><code> Unable to handle kernel paging request for data ...
[ { "answer_id": 316504, "author": "ctuffli", "author_id": 26683, "author_profile": "https://Stackoverflow.com/users/26683", "pm_score": 5, "selected": true, "text": "do_IRQ ath_rx_poll ieee80211_input netif_receive_skb gdb /usr/src/linux/vmlinux\n mesh_packet_in() mesh_packet_in() (gdb) i...
2008/11/25
[ "https://Stackoverflow.com/questions/316131", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20889/" ]
316,147
<p>How do I hide the <strong>prev/today/next</strong> navigation in jQuery DatePicker?</p> <p>I'm happy with just the Month and Year drop down boxes.</p> <p>Also how do I disable the animations?</p> <p><a href="https://stackoverflow.com/questions/316147/how-do-i-hide-the-nexttodayprevious-navigation-in-jquery-datepi...
[ { "answer_id": 316153, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": false, "text": " $('#cal').datepicker( { hideIfNoPrevNext: true, duration: '' } );\n" }, { "answer_id": 1037741, "author":...
2008/11/25
[ "https://Stackoverflow.com/questions/316147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/419/" ]
316,157
<p>I have an nmake-based project which in turn calls the asp compiler, which can throw an error, which nmake seems to recognize:</p> <pre><code>NMAKE : fatal error U1077: 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe' : return code '0x1' </code></pre> <p>However, when I call nmake from within a b...
[ { "answer_id": 1327920, "author": "Jay", "author_id": 151152, "author_profile": "https://Stackoverflow.com/users/151152", "pm_score": 1, "selected": false, "text": "@echo off\nrem Args[x]: nmake arguments\necho.>> %~n0.log\necho %date% %time%>> %~n0.log\necho nmake /NOLOGO %*>> %~n0.log\...
2008/11/25
[ "https://Stackoverflow.com/questions/316157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26624/" ]
316,166
<p>VBScript doesn't appear to have a way to include a common file of functions.</p> <p>Is there a way to achieve this?</p>
[ { "answer_id": 316169, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 6, "selected": false, "text": "sub includeFile (fSpec)\n dim fileSys, file, fileData\n set fileSys = createObject (\"Scripting.FileSystemObject\"...
2008/11/25
[ "https://Stackoverflow.com/questions/316166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14860/" ]
316,172
<p>I'm trying to increase the timeout on all sessions. The site is hosted with Godaddy, and it is written in Flash (client side of course) and asp.net on the backend. I've added this to my web.config, </p> <pre><code>&lt;sessionState timeout="720"&gt; &lt;/sessionState&gt; </code></pre> <p>Is that really all that ...
[ { "answer_id": 316392, "author": "Steven Quick", "author_id": 37493, "author_profile": "https://Stackoverflow.com/users/37493", "pm_score": 3, "selected": false, "text": "<authentication mode=\"Forms\">\n <forms\n name=\".ASPXAUTH\"\n loginUrl=\"/Home/Default.aspx\"\n defaultUr...
2008/11/25
[ "https://Stackoverflow.com/questions/316172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/232/" ]
316,178
<p>Profiling LINQ queries and their execution plans is especially important due to the crazy SQL that can sometimes be created. </p> <p>I often find that I need to track a specific query and have a hard time finding in query analyzer. I often do this on a database which has a lot of running transactions (sometimes pro...
[ { "answer_id": 316207, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 1, "selected": false, "text": "using System.Diagnostics.Debugger;\n\nyourDataContext.Log = new DebuggerWriter();\n" }, { "answer_id": 316232, "...
2008/11/25
[ "https://Stackoverflow.com/questions/316178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16940/" ]
316,181
<p>Having recently introduced an overload of a method the application started to fail. Finally tracking it down, the new method is being called where I did not expect it to be.</p> <p>We had</p> <pre><code>setValue( const std::wstring&amp; name, const std::wstring&amp; value ); std::wstring avalue( func() ); setValu...
[ { "answer_id": 316202, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 5, "selected": true, "text": "[over.ics.rank]/2.1 4.12 std::wstring wchar_t const* [over.best.ics]" }, { "answer_id": 316224, ...
2008/11/25
[ "https://Stackoverflow.com/questions/316181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37558/" ]
316,193
<p>I have <strong>CustomForm</strong> inherited from <strong>Form</strong> which implements a boolean property named <strong>Prop</strong>. The forms I'll be using will inherit from <strong>CustomForm</strong>. This property will do some painting and changes (if it's enabled) to the form. However, this is not working a...
[ { "answer_id": 316428, "author": "BFree", "author_id": 15861, "author_profile": "https://Stackoverflow.com/users/15861", "pm_score": 2, "selected": false, "text": " [Description(\"Description of your property.\"), NotifyParentProperty(true),\n RefreshProperties(RefreshProperties.Repaint)...
2008/11/25
[ "https://Stackoverflow.com/questions/316193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40480/" ]
316,194
<p>I am trying to understand the process of declaration and assignment of a primitive type at the back stage.</p> <ol> <li><code>int i;</code></li> <li><code>i = 3;</code></li> </ol> <p>For 1), on the memory stack, it assigns a space for storing an int type value named i For 2), it assigns the value 3 to the space ...
[ { "answer_id": 316201, "author": "Kyle Cronin", "author_id": 658, "author_profile": "https://Stackoverflow.com/users/658", "pm_score": 1, "selected": false, "text": "int i = 3;\n\nint *k = &i; // k now is a pointer to i\n\n*k = 4; // assigns the value k points to (i) to 4, i is now 4\n" ...
2008/11/25
[ "https://Stackoverflow.com/questions/316194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36064/" ]
316,204
<p>There's an executable file generated from my program in MFC and I want to use it as the default program to open the <code>.jpg</code> files. That is to say, each time I double click a <code>.jpg</code> file, my program will run. </p> <p>I tried to add some registry entries linking <code>.jpg</code> files with my pr...
[ { "answer_id": 316279, "author": "Charlie", "author_id": 18529, "author_profile": "https://Stackoverflow.com/users/18529", "pm_score": 2, "selected": false, "text": "HKCR\\.jpg\n @default = MyApp.JpegImage\nHKCR\\MyApp.JpegImage\\shell\\open\\command\n @default = \"myApp.exe \"%1\"\"...
2008/11/25
[ "https://Stackoverflow.com/questions/316204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26404/" ]
316,210
<p>I'm kind of new to ASP.NET MVC and to the MVC pattern in general but I'm really digging the concept and the rapidity with which I can compose an app. One thing that I'm struggling with is how to expose more than one object to a view. I use a lot of strongly typed views, which works well but what if my view relies ...
[ { "answer_id": 316216, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": true, "text": " ViewData[\"ObjectA\"] = objectA;\n ViewData[\"ObjectB\"] = objectB;\n <%= ((ObjectA)ViewData[\"ObjectA\"]).PropertyA %...
2008/11/25
[ "https://Stackoverflow.com/questions/316210", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4541/" ]
316,211
<p>I have a query that selects all appropriate record in a table 'hotels' and then for each hotel looks for booked room of certain type in table 'booked_rooms' and all of that for certain period. So first I'm taking out all hotel_ids from 'hotel_table', based on the location provided from the search form, and for each...
[ { "answer_id": 316235, "author": "Codewerks", "author_id": 17729, "author_profile": "https://Stackoverflow.com/users/17729", "pm_score": 3, "selected": false, "text": "SELECT booked_rooms.*, hotels.* FROM 'hotels' \nJOIN 'booked_rooms' ON hotels.hotel_id = booked_rooms.hotel_id\nWHERE \n...
2008/11/25
[ "https://Stackoverflow.com/questions/316211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/432217/" ]
316,222
<p>How can I use a database and PHP sessions to store a user's shopping cart? I am using CodeIgniter, if that helps.</p> <p>Example code would also be nice.</p>
[ { "answer_id": 317357, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": true, "text": "function AddToBasket(){\n if(is_numeric($_GET[\"ID\"])){\n $ProductID=(int)$_GET[\"ID\"];\n $_SESSION[\"Basket...
2008/11/25
[ "https://Stackoverflow.com/questions/316222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,236
<p>I want to load some images into my application from the file system. There's 2 easy ways to do this:</p> <pre><code>[UIImage imageNamed:fullFileName] </code></pre> <p>or:</p> <pre><code>NSString *fileLocation = [[NSBundle mainBundle] pathForResource:fileName ofType:extension]; NSData *imageData = [NSData dataWith...
[ { "answer_id": 316258, "author": "Marc Charbonneau", "author_id": 35136, "author_profile": "https://Stackoverflow.com/users/35136", "pm_score": 8, "selected": true, "text": "imageNamed:" }, { "answer_id": 316266, "author": "Ben Gottlieb", "author_id": 6694, "author_pr...
2008/11/25
[ "https://Stackoverflow.com/questions/316236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6044/" ]
316,238
<p>Python Decimal doesn't support being constructed from float; it expects that you have to convert float to a string first.</p> <p>This is very inconvenient since standard string formatters for float require that you specify number of decimal places rather than significant places. So if you have a number that could h...
[ { "answer_id": 316248, "author": "Federico A. Ramponi", "author_id": 18770, "author_profile": "https://Stackoverflow.com/users/18770", "pm_score": 2, "selected": false, "text": ">>> repr(1.5)\n'1.5'\n>>> repr(12345.678901234567890123456789)\n'12345.678901234567'\n" }, { "answer_i...
2008/11/25
[ "https://Stackoverflow.com/questions/316238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52490/" ]
316,265
<p><strong>How can you make the experience with Eclipse faster?</strong> </p> <p>For instance: <em>I disable all the plugins I don't need (Mylyn, Subclipse, &hellip;).</em></p> <p>Instead of using a plugin for <a href="http://en.wikipedia.org/wiki/Mercurial" rel="noreferrer">Mercurial</a>, I configure <a href="https...
[ { "answer_id": 316270, "author": "Tim Howland", "author_id": 4276, "author_profile": "https://Stackoverflow.com/users/4276", "pm_score": 5, "selected": false, "text": "-Xmx" }, { "answer_id": 316435, "author": "chromakode", "author_id": 40508, "author_profile": "https...
2008/11/25
[ "https://Stackoverflow.com/questions/316265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1356709/" ]
316,267
<p>I'm storing a tree in a DB using nested sets. The table's fields are id, lft, rgt, and name. </p> <p>Given a node ID, I need to find all of its direct children(not grandchildren) that are themselves leaf nodes.</p>
[ { "answer_id": 316280, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 3, "selected": false, "text": "SELECT node.name, (COUNT(parent.name) - (sub_tree.depth + 1)) AS depth\nFROM nested_category AS node,\n nested_category AS ...
2008/11/25
[ "https://Stackoverflow.com/questions/316267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,278
<p>I am trying to have an element fade in, then in 5000 ms fade back out again. I know I can do something like:</p> <pre><code>setTimeout(function () { $(".notice").fadeOut(); }, 5000); </code></pre> <p>But that will only control the fade out, would I add the above on the callback?</p>
[ { "answer_id": 316281, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 5, "selected": false, "text": "$(\".notice\")\n .fadeIn( function() \n {\n setTimeout( function()\n {\n $(\".notice\").fadeOut(\"fast\"...
2008/11/25
[ "https://Stackoverflow.com/questions/316278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
316,294
<pre><code>class A def initialize @x = do_something end def do_something 42 end end </code></pre> <p>How can I stub <code>do_something</code> in rspec, before the original implementation is called (thus assigning 42 to <code>@x</code>)? And without changing the implementation, of course.</p>
[ { "answer_id": 316318, "author": "Dustin", "author_id": 39975, "author_profile": "https://Stackoverflow.com/users/39975", "pm_score": 4, "selected": false, "text": "# should probably be in spec/spec_helper.rb\nSpec::Runner.configure do |config|\n config.mock_with :mocha\nend\n\ndescribe...
2008/11/25
[ "https://Stackoverflow.com/questions/316294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16882/" ]