qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
188,452
<p>Is it possible to read and write Word (2003 and 2007) files in PHP without using a COM object? I know that I can:</p> <pre><code>$file = fopen('c:\file.doc', 'w+'); fwrite($file, $text); fclose(); </code></pre> <p>but Word will read it as an HTML file not a native .doc file.</p>
[ { "answer_id": 265017, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": false, "text": "<?php\n\n\n\n/*****************************************************************\nThis approach uses detection of NUL (chr(00))...
2008/10/09
[ "https://Stackoverflow.com/questions/188452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115/" ]
188,461
<p>For as long as I can remember I have avoided using switch statement fall-through. Actually, I can't remember it ever entering my consciousness as a possible way to do things as it was drilled into my head early on that it was nothing more than a bug in the switch statement. However, today I ran across some code that uses it by design, which got me immediately wondering what everyone in the community thinks about switch statement fall-through.</p> <p>Is it something that a programming language should explicitly not allow (like C# does, though it supplies a workaround) or is it a feature of any language that is powerful enough to leave in the programmer's hands?</p> <p><strong>Edit:</strong> I wasn't specific enough to what I meant by fall-through. I use this type a lot:</p> <pre class="lang-js prettyprint-override"><code> switch(m_loadAnimSubCt){ case 0: case 1: // Do something break; case 2: case 3: case 4: // Do something break; } </code></pre> <p>However, I'm concerned about something like this.</p> <pre class="lang-js prettyprint-override"><code> switch(m_loadAnimSubCt){ case 0: case 1: // Do something, but fall through to the other cases // after doing it. case 2: case 3: case 4: // Do something else. break; } </code></pre> <p>This way whenever the case is 0, 1 it will do everything in the switch statement. I've seen this by design and I just don't know if I agree that switch statements should be used this way. I think the first code example is very useful and safe. The second seems kind of dangerous.</p>
[ { "answer_id": 188477, "author": "Lucas Oman", "author_id": 6726, "author_profile": "https://Stackoverflow.com/users/6726", "pm_score": 5, "selected": false, "text": "switch ($someoption) {\n case 'a':\n case 'b':\n case 'c':\n // Do something\n break;\n\n case 'd':\n case 'e'...
2008/10/09
[ "https://Stackoverflow.com/questions/188461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16524/" ]
188,473
<p>I have a C# object with a critical resource that needs to be flushed very specific points in time making it a bad candidate to leave around for the garbage collector to take care of whenever it gets around to it, how should I handle this? Is there something like C++'s delete operator that will let me manually kill the instance of this object when needed?</p>
[ { "answer_id": 188501, "author": "David", "author_id": 26144, "author_profile": "https://Stackoverflow.com/users/26144", "pm_score": 2, "selected": false, "text": "IDiposable" }, { "answer_id": 188575, "author": "Jeff Yates", "author_id": 23234, "author_profile": "htt...
2008/10/09
[ "https://Stackoverflow.com/questions/188473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
188,476
<p>Does anyone know of a simple way to compare two strings together to generate the "amount of difference" between the two? (in a numeric value) I have been crawling google with little luck on this. And after doing some coding it's not as simple as I had thought. Any clues?</p>
[ { "answer_id": 188499, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 0, "selected": false, "text": "strcmp()" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188476", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13688/" ]
188,488
<p>The problem is following: I want to automate the way my emacs starts. It has to be split in two buffers and the slime-repl has to be started in the smallest (bottom) buffer. Plus, I want my file to be opened in the bigger (upper) buffer. In my .emacs there are lines:</p> <pre><code>(slime) ... (split-window-vertically -6) (switch-to-buffer (other-buffer)) (find-file "g:/Private/pa/pa2.lsp") </code></pre> <p>SLIME opens o.k. in the bottom buffer, but the file is opened in one of the background buffers, while I want it to be in front.</p> <p>How to fix this?</p>
[ { "answer_id": 188641, "author": "EfForEffort", "author_id": 14113, "author_profile": "https://Stackoverflow.com/users/14113", "pm_score": 0, "selected": false, "text": "(other-window 1)\n(find-file \"g:/Private/pa/pa2.lsp\")\n" }, { "answer_id": 906559, "author": "viam0Zah",...
2008/10/09
[ "https://Stackoverflow.com/questions/188488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20514/" ]
188,503
<p>How do you detect the number of physical processors/cores in .net?</p>
[ { "answer_id": 188526, "author": "stephbu", "author_id": 12702, "author_profile": "https://Stackoverflow.com/users/12702", "pm_score": 6, "selected": true, "text": "System.Environment.ProcessorCount\n" }, { "answer_id": 189371, "author": "Jesse C. Slicer", "author_id": 33...
2008/10/09
[ "https://Stackoverflow.com/questions/188503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1952/" ]
188,510
<p>I have a string "1112224444' it is a telephone number. I want to format as 111-222-4444 before I store it in a file. It is on a datarecord and I would prefer to be able to do this without assigning a new variable.</p> <p>I was thinking:</p> <pre><code>String.Format("{0:###-###-####}", i["MyPhone"].ToString() ); </code></pre> <p>but that does not seem to do the trick.</p> <p>** UPDATE **</p> <p>Ok. I went with this solution</p> <pre><code>Convert.ToInt64(i["Customer Phone"]).ToString("###-###-#### ####") </code></pre> <p>Now its gets messed up when the extension is less than 4 digits. It will fill in the numbers from the right. so</p> <pre><code>1112224444 333 becomes 11-221-244 3334 </code></pre> <p>Any ideas?</p>
[ { "answer_id": 188543, "author": "mattruma", "author_id": 1768, "author_profile": "https://Stackoverflow.com/users/1768", "pm_score": 5, "selected": false, "text": "string.Format(\"({0}) {1}-{2}\",\n phoneNumber.Substring(0, 3),\n phoneNumber.Substring(3, 3),\n phoneNumber.Su...
2008/10/09
[ "https://Stackoverflow.com/questions/188510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208/" ]
188,532
<p>I want to make sure that a set of functions have the same signature in some C code. Ideally I would be able to define a new type that described the return value and arguments of a function and then declare my set of functions using this new type. </p> <p>Additionally, is there a way to specify default values for the arguments to this function typedef?</p>
[ { "answer_id": 188559, "author": "Michael Burr", "author_id": 12711, "author_profile": "https://Stackoverflow.com/users/12711", "pm_score": 5, "selected": true, "text": "/* define a typedef for function_t - functions that return void */\n/* and take an int and char parameter */\n\n...
2008/10/09
[ "https://Stackoverflow.com/questions/188532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26551/" ]
188,545
<p>I was looking for a way to remove text from and RTF string and I found the following regex:</p> <pre><code>({\\)(.+?)(})|(\\)(.+?)(\b) </code></pre> <p>However the resulting string has two right angle brackets "}"</p> <p><strong>Before:</strong> <code>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 MS Shell Dlg 2;}{\f1\fnil MS Shell Dlg 2;}} {\colortbl ;\red0\green0\blue0;} {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\tx720\cf1\f0\fs20 can u send me info for the call pls\f1\par }</code></p> <p><strong>After:</strong> <code>} can u send me info for the call pls }</code></p> <p>Any thoughts on how to improve the regex?</p> <p><strong>Edit:</strong> A more complicated string such as this one does not work: <code>{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 MS Shell Dlg 2;}} {\colortbl ;\red0\green0\blue0;} {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\tx720\cf1\f0\fs20 HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\test\\myapp\\Apps\\\{3423234-283B-43d2-BCE6-A324B84CC70E\}\par }</code></p>
[ { "answer_id": 188667, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 2, "selected": false, "text": "({\\\\)(.+?)(}+)|(\\\\)(.+?)(\\b)\n ^\n plus sign added here\n" }, { "answer_id": 188725, "auth...
2008/10/09
[ "https://Stackoverflow.com/questions/188545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/324/" ]
188,547
<p>Is it possible for Eclipse to read stdin from a file?</p>
[ { "answer_id": 188654, "author": "Michael Myers", "author_id": 13531, "author_profile": "https://Stackoverflow.com/users/13531", "pm_score": 6, "selected": false, "text": "System.setIn(new FileInputStream(filename));\n" }, { "answer_id": 6004393, "author": "lanoxx", "auth...
2008/10/09
[ "https://Stackoverflow.com/questions/188547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
188,569
<p>Just starting out in asp.net. Have just created a login.aspx page in my site and stuck on a asp login control - that's all I did. Now my Welcome.aspx page won't show as the start page of my site when I debug - even though it is set as this. Plus I have even edited my web.config - (see below) - and it still does the same thing. How do I make it work so I have my Welcome.aspx page start up as default?</p> <pre><code>&lt;authentication mode="Forms"&gt; &lt;forms defaultUrl="~/Welcome.aspx" loginUrl="~/login.aspx" timeout="1440" &gt;&lt;/forms&gt; &lt;/authentication&gt; </code></pre>
[ { "answer_id": 188614, "author": "stephenbayer", "author_id": 18893, "author_profile": "https://Stackoverflow.com/users/18893", "pm_score": 3, "selected": true, "text": "<authorization><allow users=\"?\" /></authorization>\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5175/" ]
188,584
<p>In c#, how can I check to see if a link button has been clicked in the page load method? </p> <p>I need to know if it was clicked before the click event is fired.</p>
[ { "answer_id": 188605, "author": "Jared", "author_id": 1980, "author_profile": "https://Stackoverflow.com/users/1980", "pm_score": 6, "selected": true, "text": "if( IsPostBack ) \n{\n // get the target of the post-back, will be the name of the control\n // that issued the post-back...
2008/10/09
[ "https://Stackoverflow.com/questions/188584", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13053/" ]
188,591
<p>Is there a fix or a workaround for the memory leak in getpwnam?</p>
[ { "answer_id": 266785, "author": "Nicola Bonelli", "author_id": 19630, "author_profile": "https://Stackoverflow.com/users/19630", "pm_score": 4, "selected": true, "text": "getpwnam()" }, { "answer_id": 11520218, "author": "Daniel", "author_id": 1531346, "author_profil...
2008/10/09
[ "https://Stackoverflow.com/questions/188591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26592/" ]
188,625
<p>I have an object of class F. I want to output the contents of the object using Console.WriteLine for quick and dirty status updates like this:</p> <p>Console.WriteLine(objectF);</p> <p>This prints out only the name of the class to the console:</p> <pre><code>F </code></pre> <p>I want to overload this somehow so that I can instead print out some useful information about the object and its properties.</p> <p>I have a workaround already: To overload the ToString method in my class and then call: Console.WriteLine(objectF.ToString());</p> <p>But I would rather have the simpler syntax. Any ideas?</p>
[ { "answer_id": 188630, "author": "driis", "author_id": 13627, "author_profile": "https://Stackoverflow.com/users/13627", "pm_score": 4, "selected": true, "text": "ToString" }, { "answer_id": 188633, "author": "Ben Hoffstein", "author_id": 4482, "author_profile": "http...
2008/10/09
[ "https://Stackoverflow.com/questions/188625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18542/" ]
188,631
<p>How can I tell if an assembly is in use by any process?</p>
[ { "answer_id": 1089035, "author": "Scott Weinstein", "author_id": 25201, "author_profile": "https://Stackoverflow.com/users/25201", "pm_score": 2, "selected": false, "text": "if ( Get-Process | ? { $_.Modules | ? {$_.ModuleName -eq \"AssemblyName.dll\" } })\n{\n \"in use\"\n}\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26553/" ]
188,636
<p>I'm trying to find a way to force Windows to reboot, and I am running into issues. I've tried </p> <p><pre><code><code>Set OpSysSet = GetObject("winmgmts:{authenticationlevel=Pkt," _ &amp; "(Shutdown)}").ExecQuery("select * from Win32_OperatingSystem where "_ &amp; "Primary=true") for each OpSys in OpSysSet retVal = OpSys.Reboot() next</code></pre></code></p> <p>I've also tried using the <code>shutdown -f -r</code> command, and in both cases I sometimes get no response, and if I try again I get an error saying "Action could not complete because the system is shutting down" even though no matter how long I leave it it doesn't shut down, it still allows me to start new programs, and doing a <code>shutdown -a</code> gives the same error. How can a script be used to force Windows to reboot?</p>
[ { "answer_id": 188796, "author": "Mike L", "author_id": 12085, "author_profile": "https://Stackoverflow.com/users/12085", "pm_score": 2, "selected": false, "text": "Dim oShell \nSet oShell = CreateObject(\"WScript.Shell\")\n\n'restart, wait 5 seconds, force running apps to close\noShell....
2008/10/09
[ "https://Stackoverflow.com/questions/188636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14092/" ]
188,639
<p>I normally don't work on Windows development, and am completely unfamiliar with the toolchain and build system. My embedded product includes some Windows DLLs from a third party in its filesystem (which are used by a Windows machine which mounts the filesystem).</p> <p>I have a problem: the most recent release of these DLLs have tripled in size compared to previous builds, and they no longer fit in the filesystem. There have not been many changes in the functionality of the DLLs, so I suspect the developers simply forgot to strip debug symbols in this drop. I will ask them, but getting an answer often takes days due to timezone and language differences.</p> <p>Could someone explain, using simple steps for someone unfamiliar with VisualC, how to determine if a DLL still contains debugging information and how to strip it out?</p>
[ { "answer_id": 188721, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": false, "text": "*.pdb" }, { "answer_id": 200379, "author": "Chris Becke", "author_id": 27491, "author_profile": "http...
2008/10/09
[ "https://Stackoverflow.com/questions/188639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4761/" ]
188,663
<p>I'm curious as to if there are any best practices relating to JQuery when constructing encapsulated code blocks.</p> <p>Generally, when I construct a page I like to encapsulate the functions used within that page inside an object. This allows me some encapsulation when building applications. There's nothing I hate more than seeing a JavaScript file with a bunch of this</p> <pre><code>function doSomethingOnlyRelevantOnThisPage() { // do some stuff } </code></pre> <p>I this makes for messy design, and doesn't really encapsulate functionality nicely.</p> <p>Commonly in many frameworks, there is a standard that is used to perform this encapsulation. </p> <p>In Mootools they favor the Object Literal Notation:</p> <pre><code>var Site = { // properties and methods } </code></pre> <p>In YUI they favor the Self Executing Function notation:</p> <pre><code>(function() { // properties and methods })() </code></pre> <p>The nice thing about the second example is that a closure is created, thus allowing you to define private properties and methods.</p> <p>My question is this: Do any JQuery aficionados have any best practices for creating these cleanly encapsulated structures? What is the rationale behind their use?</p>
[ { "answer_id": 188713, "author": "Tsvetomir Tsonev", "author_id": 25449, "author_profile": "https://Stackoverflow.com/users/25449", "pm_score": 1, "selected": false, "text": "MyFunction = function(param1, param2)\n{\n this.property1 = param1;\n // etc.\n}\n\nMyFunction.prototype =\n{...
2008/10/09
[ "https://Stackoverflow.com/questions/188663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/769/" ]
188,669
<p>I have a page being loaded with jQuery. The initial load includes 100 records with 6 icons per record. Needless to say, it takes a few seconds to load and I want to give the user a "loading" prompt/animation. </p> <p>Any ideas?</p>
[ { "answer_id": 26079543, "author": "Buturca Marius", "author_id": 2823942, "author_profile": "https://Stackoverflow.com/users/2823942", "pm_score": 0, "selected": false, "text": "<div class=\"pulse\"></div>\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26121/" ]
188,679
<p>I have found that my HTML is, to be honest, very clunky. Small, simple pages are OK. But there comes a point when between indenting and the kinds of tags I have, it's impossible to keep lines short. Is there a W3C (or otherwise "official" or well accepted) formatting guide for clean, maintainable HTML? If not, what suggestions can the community provide?</p>
[ { "answer_id": 188710, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": 2, "selected": false, "text": "<p>\n This is my <b>fancy</b> code block of text here. This will\n typically wrap forever and <div class=\"SarcasticStyle\"...
2008/10/09
[ "https://Stackoverflow.com/questions/188679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
188,680
<p>If a person is looking to batch convert a large number of raster images into vector graphics, are there any tools out there that do that well?</p> <p>For an example, think of just about any diagram that has standard shapes (ellipses, rectangles) and text.</p>
[ { "answer_id": 39953648, "author": "Andras", "author_id": 6947836, "author_profile": "https://Stackoverflow.com/users/6947836", "pm_score": 0, "selected": false, "text": "java -jar ImageTracer.jar smiley.png" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4066/" ]
188,687
<p>Is there a way to change the way asp.net generates elements in the WSDL generated from a .asmx file? Specifically, it seems to mark all elements minoccurs="0" and there are some elements that I want to be minoccurs="1" (aka required fields). </p> <p>One of these is an argument to the web service (e.g. foo(arg1, arg2) where I want arg2 to be generated in the WSDL as minoccurs="1") the other is a particular field in the class that corresponds to arg1. Do I have to forego auto WSDL generation and take a "contract first" approach?</p>
[ { "answer_id": 189160, "author": "Panos", "author_id": 8049, "author_profile": "https://Stackoverflow.com/users/8049", "pm_score": 3, "selected": false, "text": "XmlElement(IsNullable = true)" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7243/" ]
188,688
<p>I am looking at some code and it has this statement: </p> <pre><code>~ConnectionManager() { Dispose(false); } </code></pre> <p>The class implements the <code>IDisposable</code> interface, but I do not know if that is part of that the tilde(~) is used for.</p>
[ { "answer_id": 188712, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 6, "selected": false, "text": "IntPtr" }, { "answer_id": 188715, "author": "Patrick Desjardins", "author_id": 13913, "author_profil...
2008/10/09
[ "https://Stackoverflow.com/questions/188688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1048/" ]
188,691
<p>I want to write something that acts just like confirm() in javascript, but I want to write it myself so I can skin the dialog box. In having trouble thinking through how I would basically force the javascript thread to wait until the user responds and then return true or false.</p>
[ { "answer_id": 188708, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 4, "selected": true, "text": "function askUserYesOrNo() {\n var myDialog = $('<div class=\"mydialog\"><p>Yes or No?</p><input type=\"button\" id=\...
2008/10/09
[ "https://Stackoverflow.com/questions/188691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2484/" ]
188,692
<p>I recall reading, on multiple occasions and in multiple locations, that when firing the typical event:</p> <pre><code>protected virtual OnSomethingHappened() { this.SomethingHappened(this, EventArgs.Empty); } </code></pre> <p>e should be EventArgs.Empty if there are no interesting event args, not null.</p> <p>I've followed the guidance in my code, but I realized that I'm not clear on why that's the preferred technique. Why does the stated contract prefer EventArgs.Empty over null?</p>
[ { "answer_id": 188737, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 2, "selected": false, "text": "EventHandler" }, { "answer_id": 188743, "author": "ForCripeSake", "author_id": 14833, "author_profil...
2008/10/09
[ "https://Stackoverflow.com/questions/188692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6932/" ]
188,693
<p>Looking for an answer for C# and C++. (in C#, replace 'destructor' with 'finalizer')</p>
[ { "answer_id": 188722, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 6, "selected": false, "text": "using System;\n\nclass Test\n{\n Test()\n {\n throw new Exception();\n }\n\n ~Test()\n {\n ...
2008/10/09
[ "https://Stackoverflow.com/questions/188693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22820/" ]
188,719
<p>A friend and I are about to embark on creating a machine that performs some image comparison for sorting. I know about histogram comparison and am generally confident that a small grid of histograms per image precalculated and stored in columns in a database table will generally give us pretty good matches on the first pass because we are matching like things.</p> <p>The second comparison we want to perform is to use a <a href="http://tinyurl.com/4lo8nl" rel="nofollow noreferrer">color coherence vector</a> (CCV) of images which passed the histogram match test from our subject image to the candidate images. I know that this sort of comparison is more precise.</p> <p>My friend is confident that he can develop CCV in C# using the <a href="http://www.codeproject.com/KB/cs/Intel_OpenCV.aspx" rel="nofollow noreferrer">C# wrapper</a> to <a href="http://sourceforge.net/projects/opencvlibrary/" rel="nofollow noreferrer">OpenCV</a>. I am pretty sure he can too. However I would like to know:</p> <ol> <li>Has anyone already done this in C# and released the source code? Or a C# wrapper?</li> <li>Are we barking up the wrong tree? (Should we just use CCV and forgo histogram comparisons at the database level? Or is CCV too much?)</li> </ol>
[ { "answer_id": 188722, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 6, "selected": false, "text": "using System;\n\nclass Test\n{\n Test()\n {\n throw new Exception();\n }\n\n ~Test()\n {\n ...
2008/10/09
[ "https://Stackoverflow.com/questions/188719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5645/" ]
188,720
<p>Is there any way in the SQL language or in MySQL (or other DBMA) to transfer a value from one cell to another? For example, say there is a table called user_cars with the following structure:</p> <pre><code>|id| |user_name| |num_cars| </code></pre> <p>Bob has 5 cars, and John has 3 cars. Is there any way to in one query subtract 2 cars from Bob and add 2 to John? I know this can be done with two update queries, but I'd just like to know if there was a more efficient way.</p>
[ { "answer_id": 188756, "author": "Dave Costa", "author_id": 6568, "author_profile": "https://Stackoverflow.com/users/6568", "pm_score": 3, "selected": true, "text": " UPDATE user_cars\n SET num_cars = num_cars +\n CASE WHEN user_name='Bob' THEN -2\n ...
2008/10/09
[ "https://Stackoverflow.com/questions/188720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26603/" ]
188,738
<p>People keep giving me examples with carp instead of warn. Why? What makes carp better than warn?</p>
[ { "answer_id": 188763, "author": "derby", "author_id": 11790, "author_profile": "https://Stackoverflow.com/users/11790", "pm_score": 6, "selected": true, "text": "#!/usr/bin/perl\n\nuse Carp;\n\nfoo();\nbar();\nbaz();\n\nsub foo {\n warn \"foo\";\n}\n\nsub bar {\n carp \"bar\";\n}\n\ns...
2008/10/09
[ "https://Stackoverflow.com/questions/188738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448/" ]
188,769
<p>I'm trying to show someone a use for interfaces in a crazy situation they've created. They have several unrelated objects in lists, and need to perform an operation on two string properties in each object. I'm pointing out that if they define the properties as part of an interface, they can use the interface object as the type for a method parameter that acts on it; for example:</p> <pre><code>void PrintProperties(IEnumerable&lt;ISpecialProperties&gt; list) { foreach (var item in list) { Console.WriteLine("{0} {1}", item.Prop1, item.Prop2); } }</code></pre> <p>This seems like it's all good, but the lists that need to be worked on aren't (and shouldn't) be declared with the interface as the type parameter. However, it doesn't seem like you can cast to a different type parameter. For example, this fails and I can't understand why:</p> <pre><code>using System; using System.Collections.Generic; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { List&lt;Test&gt; myList = new List&lt;Test&gt;(); for (int i = 0; i &lt; 5; i++) { myList.Add(new Test()); } PrintList((IEnumerable&lt;IDoSomething&gt;)myList); } static void PrintList(IEnumerable&lt;IDoSomething&gt; list) { foreach (IDoSomething item in list) { item.DoSomething(); } } } interface IDoSomething { void DoSomething(); } public class Test : IDoSomething { public void DoSomething() { Console.WriteLine("Test did it!"); } } }</code></pre> <p>I <em>can</em> use the <code>Enumerable.Cast&lt;T&gt;</code> member to do this, but I was looking for a method that might work in .NET 2.0 as well. It seems like this should be possible; what am I missing? </p>
[ { "answer_id": 188797, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 4, "selected": true, "text": "void PrintProperties<SP>(IEnumerable<SP> list) where SP: ISpecialProperties\n{\n foreach (var item in list)\n {\...
2008/10/09
[ "https://Stackoverflow.com/questions/188769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2547/" ]
188,787
<p>I need to find occurrences of "(+)" in my sql scripts, (i.e., Oracle outer join expressions). Realizing that "+", "(", and ")" are all special regex characters, I tried:</p> <pre> grep "\(\+\)" * </pre> <p>Now this does return occurrences of "(+)", but other lines as well. (Seemingly anything with open and close parens on the same line.) Recalling that parens are only special for extended grep, I tried:</p> <pre> grep "(\+)" * grep "(\\+)" * </pre> <p>Both of these returned only lines that contain "()". So assuming that "+" can't be escaped, I tried an old trick:</p> <pre> grep "([+])" * </pre> <p>That works. I cross-checked the result with a non-regex tool.</p> <p><strong>Question</strong>: Can someone explain what exactly is going on with the "+" character? Is there a less kludgy way to match on "(+)"?</p> <p>(I am using the cygwin grep command.)</p> <p><strong>EDIT</strong>: Thanks for the solutions. -- And now I see that, per the GNU grep manual that Bruno referenced, "<code>\+</code>" when used in a <em>basic</em> expression gives "+" its <em>extended</em> meaning, and therefore matches one-or-more "("s followed by a ")". And in my files that's always "()".</p>
[ { "answer_id": 188795, "author": "KernelM", "author_id": 22328, "author_profile": "https://Stackoverflow.com/users/22328", "pm_score": 1, "selected": false, "text": "grep \"(+)\"" }, { "answer_id": 188837, "author": "Bruno De Fraine", "author_id": 6918, "author_profil...
2008/10/09
[ "https://Stackoverflow.com/questions/188787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14749/" ]
188,793
<p>What I'm trying to do is encode a gif file, to include in an XML document. This is what I have now, but it doesn't seem to work.</p> <pre><code>Function gifToBase64(strGifFilename) On Error Resume Next Dim strBase64 Set inputStream = WScript.CreateObject("ADODB.Stream") inputStream.LoadFromFile strGifFilename strBase64 = inputStream.Text Set inputStream = Nothing gifToBase64 = strBase64 End Function </code></pre>
[ { "answer_id": 189340, "author": "AnthonyWJones", "author_id": 17516, "author_profile": "https://Stackoverflow.com/users/17516", "pm_score": 1, "selected": false, "text": "Function Base64Encode(rabyt)\n\n Dim dom: Set dom = CreateObject(\"MSXML2.DOMDocument.3.0\")\n Dim elem: Set e...
2008/10/09
[ "https://Stackoverflow.com/questions/188793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
188,808
<p>I have a Winform application built with C# and .Net 2.0. I have a textbox set with the MultiLine property.</p> <p>The problem is when someone writes text with multiple lines (press few enters), presses the save button, and then closes and loads the form again, all the new lines disappear (the text is there at least).</p> <p>For example, if the textbox had this in it:</p> <pre><code>Line1 Line3 </code></pre> <p>It will look like this after I save and load:</p> <pre><code>Line1 Line3 </code></pre> <p>Any idea why?</p> <p><strong>Update</strong></p> <p>The database is PostGres and when I use PGAdmin I can see all the line AND the "enters". So the persistence seem to have save all the line... the problem seem to be when I put back the string in the Textbox.</p>
[ { "answer_id": 188838, "author": "Geoff", "author_id": 1097, "author_profile": "https://Stackoverflow.com/users/1097", "pm_score": 3, "selected": true, "text": "textBox1.Lines = foo.Split(new String[] {\"\\n\"},StringSplitOptions.RemoveEmptyEntries);\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
188,828
<p>I've just learned ( yesterday ) to use "exists" instead of "in".</p> <pre><code> BAD select * from table where nameid in ( select nameid from othertable where otherdesc = 'SomeDesc' ) GOOD select * from table t where exists ( select nameid from othertable o where t.nameid = o.nameid and otherdesc = 'SomeDesc' ) </code></pre> <p>And I have some questions about this:</p> <p>1) The explanation as I understood was: <em>"The reason why this is better is because only the matching values will be returned instead of building a massive list of possible results"</em>. Does that mean that while the first subquery might return 900 results the second will return only 1 ( yes or no )?</p> <p>2) In the past I have had the RDBMS complainin: "only the first 1000 rows might be retrieved", this second approach would solve that problem?</p> <p>3) What is the scope of the alias in the second subquery?... does the alias only lives in the parenthesis? </p> <p>for example </p> <pre><code> select * from table t where exists ( select nameid from othertable o where t.nameid = o.nameid and otherdesc = 'SomeDesc' ) AND select nameid from othertable o where t.nameid = o.nameid and otherdesc = 'SomeOtherDesc' ) </code></pre> <p>That is, if I use the same alias ( o for table othertable ) In the second "exist" will it present any problem with the first exists? or are they totally independent?</p> <p>Is this something Oracle only related or it is valid for most RDBMS?</p> <p>Thanks a lot</p>
[ { "answer_id": 188849, "author": "Milan Babuškov", "author_id": 14690, "author_profile": "https://Stackoverflow.com/users/14690", "pm_score": 3, "selected": true, "text": "select t.* \nfrom table t \njoin othertable o on t.nameid = o.nameid \n and o.otherdesc in ('SomeDesc','SomeOther...
2008/10/09
[ "https://Stackoverflow.com/questions/188828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
188,833
<p>Why am I getting a textbox that returns undefined list of variables?</p> <p>When I run this code:</p> <pre><code>var query = (from tisa in db.TA_Info_Step_Archives where tisa.ta_Serial.ToString().StartsWith(prefixText) select tisa.TA_Serial.ToString()).Distinct().Take(Convert.ToInt32(count)); return query.ToList&lt;string&gt;().ToArray(); </code></pre> <p>I get this XML file:</p> <pre><code>&lt;string&gt;200700160&lt;/string&gt; &lt;string&gt;200700161&lt;/string&gt; &lt;string&gt;200700162&lt;/string&gt; &lt;string&gt;200700163&lt;/string&gt; &lt;string&gt;200700164&lt;/string&gt; &lt;string&gt;200700170&lt;/string&gt; &lt;string&gt;200700171&lt;/string&gt; &lt;string&gt;200700172&lt;/string&gt; &lt;string&gt;200700173&lt;/string&gt; &lt;string&gt;200700174&lt;/string&gt; &lt;string&gt;200700175&lt;/string&gt; &lt;string&gt;200700176&lt;/string&gt; &lt;string&gt;200700177&lt;/string&gt; &lt;string&gt;200700178&lt;/string&gt; &lt;string&gt;200700179&lt;/string&gt; &lt;string&gt;200700180&lt;/string&gt; &lt;string&gt;200700181&lt;/string&gt; &lt;string&gt;200700182&lt;/string&gt; &lt;string&gt;200700183&lt;/string&gt; &lt;string&gt;200700184&lt;/string&gt; </code></pre> <p>BUT, the textbox returns a list of <code>undefined</code>....</p> <p>Help please?</p>
[ { "answer_id": 188907, "author": "ForCripeSake", "author_id": 14833, "author_profile": "https://Stackoverflow.com/users/14833", "pm_score": 0, "selected": false, "text": "<cc1:AutoCompleteExtender ID=\"Result\" runat=\"server\" TargetControlID=\"txtSearch\" ServiceMethod=\"YourMethodHere...
2008/10/09
[ "https://Stackoverflow.com/questions/188833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7644/" ]
188,834
<p>I need to dynamically construct an XPath query for an element attribute, where the attribute value is provided by the user. I'm unsure how to go about cleaning or sanitizing this value to prevent the XPath equivalent of a SQL injection attack. For example (in PHP):</p> <pre><code>&lt;?php function xPathQuery($attr) { $xml = simplexml_load_file('example.xml'); return $xml-&gt;xpath("//myElement[@content='{$attr}']"); } xPathQuery('This should work fine'); # //myElement[@content='This should work fine'] xPathQuery('As should "this"'); # //myElement[@content='As should "this"'] xPathQuery('This\'ll cause problems'); # //myElement[@content='This'll cause problems'] xPathQuery('\']/../privateElement[@content=\'private data'); # //myElement[@content='']/../privateElement[@content='private data'] </code></pre> <p>The last one in particular is reminiscent to the SQL injection attacks of yore.</p> <p>Now, I know for a fact there will be attributes containing single quotes and attributes containing double quotes. Since these are provided as an argument to a function, what would be the ideal way to sanitize the input for these?</p>
[ { "answer_id": 188858, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": -1, "selected": false, "text": "function xPathQuery($attr) {\n $xml = simplexml_load_file('example.xml');\n $to_encode = array('&', '\"');\n ...
2008/10/09
[ "https://Stackoverflow.com/questions/188834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
188,839
<p>I use a structure of function pointers to implement an interface for different backends. The signatures are very different, but the return values are almost all void, void * or int.</p> <pre><code> struct my_interface { void (*func_a)(int i); void *(*func_b)(const char *bla); ... int (*func_z)(char foo); }; </code></pre> <p>But it is not required that a backends supports functions for every interface function. So I have two possibilities, first option is to check before every call if the pointer is unequal NULL. I don't like that very much, because of the readability and because I fear the performance impacts (I haven't measured it, however). The other option is to have a dummy function, for the rare cases an interface function doesn't exist.</p> <p>Therefore I'd need a dummy function for every signature, I wonder if it is possible to have only one for the different return values. And cast it to the given signature.</p> <pre><code> #include &lt;stdio.h&gt; int nothing(void) {return 0;} typedef int (*cb_t)(int); int main(void) { cb_t func; int i; func = (cb_t) nothing; i = func(1); printf("%d\n", i); return 0; } </code></pre> <p>I tested this code with gcc and it works. But is it sane? Or can it corrupt the stack or can it cause other problems?</p> <p>EDIT: Thanks to all the answers, I learned now much about calling conventions, after a bit of further reading. And have now a much better understanding of what happens under the hood.</p>
[ { "answer_id": 188860, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 1, "selected": false, "text": "extern \"C\"" }, { "answer_id": 188905, "author": "Remo.D", "author_id": 16827, "author_profile": "ht...
2008/10/09
[ "https://Stackoverflow.com/questions/188839", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18687/" ]
188,844
<p>If I had a Canvas with n number of Visual objects of any shape or size, how would I highlight/outline a Visual object programmatically? </p> <p>Is there something built into WPF to help me? </p>
[ { "answer_id": 189061, "author": "Joel B Fant", "author_id": 22211, "author_profile": "https://Stackoverflow.com/users/22211", "pm_score": 4, "selected": true, "text": "BitmapEffects" }, { "answer_id": 189099, "author": "cplotts", "author_id": 22294, "author_profile":...
2008/10/09
[ "https://Stackoverflow.com/questions/188844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4580/" ]
188,850
<p>I would like a batch file to launch two separate programs then have the command line window close. Actually, to clarify, I am launching Internet Explorer with two different URLs.</p> <p>So far I have something like this:</p> <pre><code>start "~\iexplore.exe" "url1" start "~\iexplore.exe" "url2" </code></pre> <p>What I get is one instance of Internet Explorer with only the second URL loaded. Seems the second is replacing the second. I seem to remember a syntax where I would load a new command line window and pass the command to execute on load, but can't find the reference.</p> <p>As a second part of the question: what is a good reference URL to keep for the times you need to write a quick batch file?</p> <p>Edit: I have marked an answer, because it does work. I now have two windows open, one for each URL. (thanks!) The funny thing is that without the /d approach using my original syntax I get different results based on whether I have a pre-existing Internet Explorer instance open. </p> <ul> <li>If I do I get two new tabs added for my two URLs (sweet!) </li> <li>If not I get only one final tab for the second URL I passed in.</li> </ul>
[ { "answer_id": 188930, "author": "Rodger Cooley", "author_id": 5667, "author_profile": "https://Stackoverflow.com/users/5667", "pm_score": 6, "selected": true, "text": "@echo off\nstart /d \"C:\\Program Files\\Internet Explorer\" IEXPLORE.EXE www.google.com\nstart /d \"C:\\Program Files\...
2008/10/09
[ "https://Stackoverflow.com/questions/188850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10552/" ]
188,853
<p>IIS is literally sending <code>&lt;?php ... ?&gt;</code> code to the browser rather then executing it.</p> <p>But, only for the root <code>http://domain.com/index.php</code> file.</p> <p>All other .php files in that folder and index.php files in subfolders execute as expected.</p> <p>How can I get my root index.php code to execute?</p> <hr> <p>Update: "index.php" is a Default Document of my Web Site...</p> <p><a href="http://img412.imageshack.us/img412/4130/defaultdocumentmt9.gif" rel="nofollow noreferrer">alt text http://img412.imageshack.us/img412/4130/defaultdocumentmt9.gif</a></p>
[ { "answer_id": 188910, "author": "Eduardo Campañó", "author_id": 12091, "author_profile": "https://Stackoverflow.com/users/12091", "pm_score": 2, "selected": false, "text": "<? ... ?>" }, { "answer_id": 190877, "author": "alexandrul", "author_id": 19756, "author_profi...
2008/10/09
[ "https://Stackoverflow.com/questions/188853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
188,864
<p>So C# now allows you to use <code>default(Foo)</code> to get a recognized "not filled in yet"/empty instance of a class -- I'm not sure if it is exactly the same as <code>new Foo()</code> or not. Many library classes also implement a <code>Foo.Empty</code> property, which returns a similar instance. And of course any reference type can point to <code>null</code>. So really, what's the difference? When is one right or wrong? What's more consistent, or performs better? What tests should I use when checking if an object is conceptually "not ready for prime time"? Not everybody has <code>Foo.IsNullOrEmpty()</code>.</p>
[ { "answer_id": 188893, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 2, "selected": false, "text": "default(Foo)" }, { "answer_id": 188932, "author": "Dylan Beattie", "author_id": 5017, "author_prof...
2008/10/09
[ "https://Stackoverflow.com/questions/188864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26286/" ]
188,870
<p>Is there a library or acceptable method for sanitizing the input to an html page?</p> <p>In this case I have a form with just a name, phone number, and email address. </p> <p>Code must be C#.</p> <p>For example:</p> <p><code>"&lt;script src='bobs.js'&gt;John Doe&lt;/script&gt;"</code> should become <code>"John Doe"</code></p>
[ { "answer_id": 188984, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 3, "selected": false, "text": "string sql = \"UPDATE UserRecord SET FirstName='\" + txtFirstName.Text + \"' WHERE UserID=\" + UserID;\n" }, { ...
2008/10/09
[ "https://Stackoverflow.com/questions/188870", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2424/" ]
188,886
<p>After my <code>form.Form</code> validates the user input values I pass them to a separate (external) process for further processing. This external process can potentially find further errors in the values.</p> <p>Is there a way to inject these errors into the already validated form so they can be displayed via the usual form error display methods (or are there better alternative approaches)?</p> <p>One suggestions was to include the external processing in the form validation, which is not ideal because the external process does a lot more than merely validate.</p>
[ { "answer_id": 188904, "author": "Jonny Buchanan", "author_id": 6760, "author_profile": "https://Stackoverflow.com/users/6760", "pm_score": 4, "selected": false, "text": "_errors" }, { "answer_id": 188906, "author": "John Millikin", "author_id": 3560, "author_profile"...
2008/10/09
[ "https://Stackoverflow.com/questions/188886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13055/" ]
188,889
<p>how do I pass additional information to the service method returning the collection of items? I'll attempt to explain what I mean, I have 2 text boxes on a form, I need to fill out names, based of a specific account id in a database. so, I need to pass an integer to the getNamesForDropDown method. I couldn't figure out what to do, so I did the wrong thing, and used the CompletionSetCount to actually pass the information I needed:</p> <pre><code>[System.Web.Services.WebMethod] [System.Web.Script.Services.ScriptMethod] public string[] getNamesForDropDown(string prefixText, int count) { String sql = "Select fldName From idAccountReps Where idAccount = " + count.ToString(); //... rest of the method removed, this should be enough code to understand //... the evil wrongness I did. } </code></pre> <p>in my front side aspx file, i set the CompletionSetCount based off the Account id the user is currently viewing on that page. </p> <pre><code>&lt;ajaxtk:AutoCompleteExtender runat="server" ID="AC1" TargetControlID="txtAccName" ServiceMethod="getNamesForDropDown" ServicePath="AccountInfo.asmx" MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount='&lt;%# Eval("idAccount") %&gt;' /&gt; </code></pre> <p>So, that's definitely a wrong way... what would be the right way?</p>
[ { "answer_id": 188903, "author": "azamsharp", "author_id": 3797, "author_profile": "https://Stackoverflow.com/users/3797", "pm_score": 2, "selected": false, "text": "string[] arguments = prefixText.Split(':'); \nint id = Int32.Parse(arguments[0]);\nstring text = arguments[1]; \n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18893/" ]
188,892
<p>Is there a built-in mechanism in .NET to match patterns other than Regular Expressions? I'd like to match using UNIX style (glob) wildcards (* = any number of any character). </p> <p>I'd like to use this for a end-user facing control. I fear that permitting all RegEx capabilities will be very confusing.</p>
[ { "answer_id": 190297, "author": "Jonathan C Dickinson", "author_id": 24064, "author_profile": "https://Stackoverflow.com/users/24064", "pm_score": 6, "selected": true, "text": "Regex.Escape( wildcardExpression ).Replace( @\"\\*\", \".*\" ).Replace( @\"\\?\", \".\" );\n" }, { "an...
2008/10/09
[ "https://Stackoverflow.com/questions/188892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1807/" ]
188,894
<p>I have a .NET WinForms textbox for a phone number field. After allowing free-form text, I'd like to format the text as a "more readable" phone number after the user leaves the textbox. (Outlook has this feature for phone fields when you create/edit a contact)</p> <ul> <li>1234567 becomes 123-4567</li> <li>1234567890 becomes (123) 456-7890</li> <li>(123)456.7890 becomes (123) 456-7890</li> <li>123.4567x123 becomes 123-4567 x123</li> <li>etc</li> </ul>
[ { "answer_id": 188962, "author": "brock.holum", "author_id": 15860, "author_profile": "https://Stackoverflow.com/users/15860", "pm_score": 2, "selected": false, "text": "Regex regex = new Regex(@\"(?<areaCode>([\\d]{3}))?[\\s.-]?(?<leadingThree>([\\d]{3}))[\\s.-]?(?<lastFour>([\\d]{4}))[...
2008/10/09
[ "https://Stackoverflow.com/questions/188894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/247/" ]
188,896
<p>This has been driving me crazy. We have IIS (6) and windows 2008 and ActiveState Perl 5.10. For some reason whenever we do a warn or a carp it eventually corrupts the app pool. Of course, that's a pretty big deal since it means that our errors actually cause problems.</p> <p>This happened with the previous version of Perl (5.8) and Windows (2003) and IIS (5.) Anyway, basically I put in a <code>carp</code> or a <code>warn</code> and I get an error message and then some garbage text. Any thoughts?</p>
[ { "answer_id": 193496, "author": "tye", "author_id": 21496, "author_profile": "https://Stackoverflow.com/users/21496", "pm_score": 0, "selected": false, "text": "BEGIN {\n open STDERR, '>> c:/iisError.log'\n or die \"Can't write to c:/issError.log: $!\\n\";\n binmode STDERR...
2008/10/09
[ "https://Stackoverflow.com/questions/188896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448/" ]
188,913
<p>Is there a tool, method or setting in the standard VBA Editor to warn about variables that have been <code>Dim</code>'med, but aren't being used?</p>
[ { "answer_id": 43231349, "author": "Greedo", "author_id": 6609896, "author_profile": "https://Stackoverflow.com/users/6609896", "pm_score": 4, "selected": false, "text": "Option Explicit" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13295/" ]
188,940
<p>I have a project with a formidable data access layer using LinqtoSQL for just about anything touching our databases. I needed to build a helper class that bridges some common crud operations from CLSA objects to LinqToSql ones. Everything has been operating swimmingly until I needed to do a truncate on a table and all I had were “delete” methods.</p> <p>Uh-oh. A quick search reveals that some people are using YourContext.ExecuteCommand(), which is nice and all, but I am trying to go “t-sql-less” as much as possible these days.</p> <p>Is there a LINQ way to perform a <a href="http://msdn.microsoft.com/en-us/library/aa260621(SQL.80).aspx" rel="nofollow noreferrer">truncate on a table</a>? Or am I just <a href="http://en.wikipedia.org/wiki/Clueless_(film)" rel="nofollow noreferrer">clueless</a>?</p>
[ { "answer_id": 189023, "author": "Christian C. Salvadó", "author_id": 5445, "author_profile": "https://Stackoverflow.com/users/5445", "pm_score": 2, "selected": false, "text": "yourDataContext.ExecuteCommand(\"TRUNCATE TABLE YourTable\");\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2213/" ]
188,942
<p>I'm writing some cross-platform code between Windows and Mac.</p> <p>If list::end() "returns an iterator that addresses the location succeeding the last element in a list" and can be checked when traversing a list forward, what is the best way to traverse backwards?</p> <p>This code workson the Mac but not on Windows (can't decrement beyond first element):</p> <pre><code>list&lt;DVFGfxObj*&gt;::iterator iter = m_Objs.end(); for (iter--; iter!=m_Objs.end(); iter--)// By accident discovered that the iterator is circular ? { } </code></pre> <p>this works on Windows:</p> <pre><code>list&lt;DVFGfxObj*&gt;::iterator iter = m_Objs.end(); do{ iter--; } while (*iter != *m_Objs.begin()); </code></pre> <p>Is there another way to traverse backward that could be implemented in a for loop?</p>
[ { "answer_id": 188948, "author": "Ferruccio", "author_id": 4086, "author_profile": "https://Stackoverflow.com/users/4086", "pm_score": 7, "selected": true, "text": "reverse_iterator" }, { "answer_id": 188959, "author": "Anthony Cramp", "author_id": 488, "author_profil...
2008/10/09
[ "https://Stackoverflow.com/questions/188942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8761/" ]
188,963
<p>I find it odd that in Visual C# 2008 Express edition, when you use the database explorer, your options are:</p> <ol> <li>Microsoft Access</li> <li>SQL Server Compact 3.5, and </li> <li>SQL Server Database File. </li> </ol> <p>BUT if you use Visual Web Developer 2008 Express, you can connect to a regular SQL Server, Oracle, ODBC, etc.</p> <p>For people developing command-line or other C# apps that need to talk to a SQL Server database, do you really need to build your LINQ/Data Access code with one IDE (Visual Web Developer) and your program in another (Visual C#)? </p> <p>It's not a hard workaround, but it seems weird. If Microsoft wanted to force you to upgrade to Visual Studio to connect to SQL Server, why would they include that feature in one of their free IDEs but not the other? I feel like I might be missing something (like how to do it all in Visual C#).</p>
[ { "answer_id": 189058, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 5, "selected": true, "text": "system.data.SqlClient" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26624/" ]
188,967
<p>I want to do this in code, not with ALT+F1.</p>
[ { "answer_id": 188981, "author": "Patrick McElhaney", "author_id": 437, "author_profile": "https://Stackoverflow.com/users/437", "pm_score": 5, "selected": false, "text": "sp_help tablename \n" }, { "answer_id": 189025, "author": "Luke Bennett", "author_id": 17602, "a...
2008/10/09
[ "https://Stackoverflow.com/questions/188967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2484/" ]
188,968
<p>I would like a constraint on a SQL Server 2000 table column that is sort of a combination of a foreign key and a check constraint. The value of my column must exist in the other table, but I am only concerned with values in the other table where one of its columns equal a specified value. The simplified tables are:</p> <pre> import_table: part_number varchar(30) quantity int inventory_master: part_number varchar(30) type char(1) </pre> <p>So I want to ensure the <code>part_number</code> exists in <code>inventory_master</code>, but only if the type is 'C'. Is this possible? Thanks.</p>
[ { "answer_id": 188981, "author": "Patrick McElhaney", "author_id": 437, "author_profile": "https://Stackoverflow.com/users/437", "pm_score": 5, "selected": false, "text": "sp_help tablename \n" }, { "answer_id": 189025, "author": "Luke Bennett", "author_id": 17602, "a...
2008/10/09
[ "https://Stackoverflow.com/questions/188968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23976/" ]
189,031
<p>Is there any way to set the same icon to all my forms without having to change one by one? Something like when you setup <code>GlobalAssemblyInfo</code> for all your projects inside your solution.</p>
[ { "answer_id": 189050, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 6, "selected": true, "text": ": Form" }, { "answer_id": 189618, "author": "Nathan Baulch", "author_id": 8799, "author_profile": ...
2008/10/09
[ "https://Stackoverflow.com/questions/189031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4386/" ]
189,043
<p>Is there any way to change the background color of the Solution Explorer in Visual Studio using a Theme? - or any other way for that matter?</p> <p>I can change it by changing windows-wide color settings, but obviously that affects too much.</p>
[ { "answer_id": 9183568, "author": "user1195662", "author_id": 1195662, "author_profile": "https://Stackoverflow.com/users/1195662", "pm_score": 3, "selected": false, "text": "#include <windows.h>\n#include \"psapi.h\"\n#include \"shlwapi.h\"\n#include \"commctrl.h\"\n\n\nCOLORREF clr = R...
2008/10/09
[ "https://Stackoverflow.com/questions/189043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/410357/" ]
189,055
<p>Typically you will find STL code like this:</p> <pre><code>for (SomeClass::SomeContainer::iterator Iter = m_SomeMemberContainerVar.begin(); Iter != m_SomeMemberContainerVar.end(); ++Iter) { } </code></pre> <p>But we actually have the recommendation to write it like this:</p> <pre><code>SomeClass::SomeContainer::iterator Iter = m_SomeMemberContainerVar.begin(); SomeClass::SomeContainer::iterator IterEnd = m_SomeMemberContainerVar.end(); for (; Iter != IterEnd; ++Iter) { } </code></pre> <p>If you're worried about scoping, add enclosing braces:</p> <pre><code>{ SomeClass::SomeContainer::iterator Iter = m_SomeMemberContainerVar.begin(); SomeClass::SomeContainer::iterator IterEnd = m_SomeMemberContainerVar.end(); for (; Iter != IterEnd; ++Iter) { } } </code></pre> <p>This is supposed to give a speed and efficiency gain, especially if you are programming consoles, because the .end() function is not called on each iteration of the loop. I just take the performance improvement for granted, it sounds reasonable but i don't know how much and it certainly depends on the type of container and actual STL implementation in use. But having used this style for a couple months now i actually prefer it over the first anyway.</p> <p>The reason being readability: the for line is neat and tidy. With qualifiers and member variables in real production code it is quite easy to have <strong>really</strong> long for lines if you use the style in the first example. That's why i intentionally made it to have a horizontal scrollbar in this example, just so you see what i'm talking about. ;)</p> <p>On the other hand, you suddenly introduce the Iter variables to the outer scope of the for loop. But then, at least in the environment i work in, the Iter would have been accessible in the outer scope even in the first example.</p> <p>What is your take on this? Are there any pro's to the first style other than possibly limiting the scope of Iter?</p>
[ { "answer_id": 189060, "author": "Ferruccio", "author_id": 4086, "author_profile": "https://Stackoverflow.com/users/4086", "pm_score": 3, "selected": false, "text": "typedef SomeClass::SomeContainer::iterator MyIter;\n\nfor (MyIter Iter = m_SomeMemberContainerVar.begin(); Iter != m_SomeM...
2008/10/09
[ "https://Stackoverflow.com/questions/189055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15328/" ]
189,062
<p>When I navigate on a website utilizing MasterPages, does the application know what page I am on? If so, does it store it in an object I can access?</p> <p>The reason I am asking is so I can replace this:</p> <pre><code>//masterpage &lt;div id="nav_main"&gt; &lt;ul&gt;&lt;asp:ContentPlaceHolder ID="navigation" runat="server"&gt; &lt;/asp:ContentPlaceHolder&gt;&lt;/ul&gt; &lt;/div&gt; //content page(s) &lt;asp:Content ContentPlaceHolderID="navigation" ID="theNav" runat="server"&gt; &lt;li&gt;&lt;a href="default.aspx"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li id="current"&gt;&lt;a href="faq.aspx"&gt;FAQ&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="videos.aspx"&gt;Videos&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Button 4&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Button 5&lt;/a&gt;&lt;/li&gt; &lt;/asp:Content&gt; </code></pre> <p>With a more elegant solution for the navigation, which highlights the link to the page by having the list item's ID set to "current". Currently each page recreates the navigation with its respective link's ID set to current.</p>
[ { "answer_id": 189085, "author": "Jared", "author_id": 1980, "author_profile": "https://Stackoverflow.com/users/1980", "pm_score": 0, "selected": false, "text": "string type = this.Page.GetType().Name.ToString();\n" }, { "answer_id": 189179, "author": "Jared", "author_id"...
2008/10/09
[ "https://Stackoverflow.com/questions/189062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25515/" ]
189,079
<p>I'm having some minor problems with some animations I'm trying to set up. I have a couple divs stacked on top of each other kind of like this.</p> <pre><code>&lt;div id="div1"&gt; Stuff... &lt;/div&gt; &lt;div id="div2"&gt; More Stuff... &lt;/div&gt; </code></pre> <p>Each of these divs has a drop shadow applied to it via jQuery plugin (jquery.dropshadow.js).</p> <p>The problem occurs when I expand one of the divs using some kind of animation. The shadow does not update with the size of the div. I can redraw the shadow in the callback of the animation but still looks pretty joggy.</p> <p>Is there a way that I can update the status of my shadows periodically throughout the course of the animation or can anyone recommend a better drop shadow library that would fix the problem? It doesn't have to be jQuery plugin.</p>
[ { "answer_id": 189438, "author": "Till", "author_id": 2859, "author_profile": "https://Stackoverflow.com/users/2859", "pm_score": 0, "selected": false, "text": "$('#foo').slideToggle().ready(function(){\n $('#foo').dropShadow(options); \n});\n" }, { "answer_id": 190158, "aut...
2008/10/09
[ "https://Stackoverflow.com/questions/189079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17881/" ]
189,087
<p>If I'm making a simple grid based game, for example, I might have a few 2d lists. One might be for terrain, another might be for objects, etc. Unfortunately, when I need to iterate over the lists and have the contents of a square in one list affect part of another list, I have to do something like this.</p> <pre><code>for i in range(len(alist)): for j in range(len(alist[i])): if alist[i][j].isWhatever: blist[i][j].doSomething() </code></pre> <p>Is there a nicer way to do something like this?</p>
[ { "answer_id": 189096, "author": "Haoest", "author_id": 10088, "author_profile": "https://Stackoverflow.com/users/10088", "pm_score": -1, "selected": false, "text": "for d1 in alist\n for d2 in d1\n if d2 = \"whatever\"\n do_my_thing()\n" }, { "answer_id": 189111,...
2008/10/09
[ "https://Stackoverflow.com/questions/189087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25680/" ]
189,094
<p>How can I get list all the files within a folder recursively in Java? </p>
[ { "answer_id": 189108, "author": "OscarRyz", "author_id": 20654, "author_profile": "https://Stackoverflow.com/users/20654", "pm_score": 5, "selected": false, "text": "import java.io.File;\npublic class Test {\n public static void main( String [] args ) {\n File actual = new Fil...
2008/10/09
[ "https://Stackoverflow.com/questions/189094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8418/" ]
189,113
<p>I moved a <a href="http://en.wikipedia.org/wiki/WordPress" rel="noreferrer">WordPress</a> installation to a new folder on a Windows/<a href="http://en.wikipedia.org/wiki/Internet_Information_Services" rel="noreferrer">IIS</a> server. I'm setting up 301 redirects in PHP, but it doesn't seem to be working. My post URLs have the following format:</p> <pre class="lang-none prettyprint-override"><code>http:://www.example.com/OLD_FOLDER/index.php/post-title/ </code></pre> <p>I can't figure out how to grab the <code>/post-title/</code> part of the URL.</p> <p><code>$_SERVER["REQUEST_URI"]</code> - which everyone seems to recommend - is returning an empty string. <code>$_SERVER["PHP_SELF"]</code> is just returning <code>index.php</code>. Why is this, and how can I fix it?</p>
[ { "answer_id": 189123, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 4, "selected": false, "text": "$_SERVER['REQUEST_URI']" }, { "answer_id": 189125, "author": "Vinko Vrsalovic", "author_id": 5190, "autho...
2008/10/09
[ "https://Stackoverflow.com/questions/189113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19487/" ]
189,118
<p>There are so many little options and settings within Microsoft Visual Studio. Which adjustments do you recommend to others?</p>
[ { "answer_id": 189173, "author": "Kon", "author_id": 22303, "author_profile": "https://Stackoverflow.com/users/22303", "pm_score": 0, "selected": false, "text": "Edit.GoToDefinition" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/189118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
189,121
<p>using MVP, what is the normal order of construction and dependency injection.</p> <p>normally you create a presenter for each view and pass the view into the presenter on constructor. But what if you have:</p> <ol> <li>A Service that multiple views need to listen to events on.</li> <li>Multiple views all pointing to the same data model cache.</li> </ol> <p>can someone display a normal flow of info from a user click to data coming back in a service from a server.</p>
[ { "answer_id": 191182, "author": "Romain Verdier", "author_id": 4687, "author_profile": "https://Stackoverflow.com/users/4687", "pm_score": 5, "selected": true, "text": "public interface IView<TPresenter>\n{\n TPresenter Presenter { get; set; }\n}\n\npublic interface IPresenter<TView,...
2008/10/09
[ "https://Stackoverflow.com/questions/189121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
189,148
<p>(See related question: <a href="https://stackoverflow.com/questions/162917/how-do-i-report-an-error-midway-through-a-chunked-http-repsonse-without-closing">How do I report an error midway through a chunked http repsonse without closing the connection?</a>)</p> <p>In my case, the #1 desire is for the browser to display an error message. No matter how uninformative.</p> <p>Closing the ServletResponse outputStream obviously doesn't work. Neither does throwing an exception, even if I don't close first (tested on Tomcat 6.0.16). I think that what I want is either a RST packet, FIN in the middle of a chunk, or badly formed chunk headers.</p> <p>After that I can worry about how various browsers respond.</p> <p>Edited for clarification: This is for a file download, perhaps several gigabytes of binary data. I can't make certain that all of the data can be successfully read or decrypted before I have to start sending some of it.</p>
[ { "answer_id": 189285, "author": "davr", "author_id": 14569, "author_profile": "https://Stackoverflow.com/users/14569", "pm_score": 0, "selected": false, "text": "<script type=\"text/javascript\"> alert(\"Processing failed!\"); </script>\n" }, { "answer_id": 206207, "author":...
2008/10/09
[ "https://Stackoverflow.com/questions/189148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22704/" ]
189,156
<p>Running FxCop on my code, I get this warning:</p> <blockquote> <p>Microsoft.Maintainability : 'FooBar.ctor is coupled with 99 different types from 9 different namespaces. Rewrite or refactor the method to decrease its class coupling, or consider moving the method to one of the other types it is tightly coupled with. A class coupling above 40 indicates poor maintainability, a class coupling between 40 and 30 indicates moderate maintainability, and a class coupling below 30 indicates good maintainability.</p> </blockquote> <p>My class is a landing zone for all messages from the server. The server can send us messages of different EventArgs types:</p> <pre><code>public FooBar() { var messageHandlers = new Dictionary&lt;Type, Action&lt;EventArgs&gt;&gt;(); messageHandlers.Add(typeof(YouHaveBeenLoggedOutEventArgs), HandleSignOut); messageHandlers.Add(typeof(TestConnectionEventArgs), HandleConnectionTest); // ... etc for 90 other types } </code></pre> <p>The "HandleSignOut" and "HandleConnectionTest" methods have little code in them; they usually pass the work off to a function in another class.</p> <p>How can I make this class better with lower coupling?</p>
[ { "answer_id": 189199, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 3, "selected": false, "text": "using System;\nusing System.Collections.Generic;\nusing Spring.Context.Support;\n\nnamespace Example\n{\n interna...
2008/10/09
[ "https://Stackoverflow.com/questions/189156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/536/" ]
189,172
<p>I'm told that the template system in C++ is Turing-complete at compile time. This is mentioned in <a href="https://stackoverflow.com/questions/75538/hidden-features-of-c#75627">this post</a> and also on <a href="http://en.wikipedia.org/wiki/C%2B%2B" rel="noreferrer">wikipedia</a>.</p> <p>Can you provide a nontrivial example of a computation that exploits this property?</p> <p>Is this fact useful in practice?</p>
[ { "answer_id": 189204, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 4, "selected": false, "text": "template <int N> struct Factorial\n{\n enum { val = Factorial<N-1>::val * N };\n};\n\ntemplate <> struct Factorial...
2008/10/09
[ "https://Stackoverflow.com/questions/189172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18770/" ]
189,190
<p>It needs to be graphical. No sed, awk, grep, perl, whatever. I know how to use those and I do use them now, but I need to cherry-pick each replace in 300+ files.</p> <p>I want a tool where I can:</p> <ul> <li>type a search string</li> <li>type a replace string</li> <li>select a directory and file extension</li> </ul> <p>and it would recursively go into each file in that directory and its sub-directories, open it and scroll to the place where search string is and offer two options:</p> <ul> <li>replace (and find next)</li> <li>find next</li> </ul> <p>Nothing more. Reg.exp. support is a plus, but not required.</p> <p>SOLVED: Regexxer is exactly what I needed. In case someone needs it on Slackware, <a href="http://swoes.blogspot.com/2008/10/regexxer-on-slackware-121.html" rel="noreferrer">here's</a> what you need to download and how to compile it (choosing correct version of each dependency can be a PITA)</p>
[ { "answer_id": 189409, "author": "rmeador", "author_id": 10861, "author_profile": "https://Stackoverflow.com/users/10861", "pm_score": 2, "selected": false, "text": ":tabdo %s/foo/bar/gc\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/189190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14690/" ]
189,209
<p>For a long time ago, I have thought that, in java, reversing the domain you own for package naming is silly and awkward.</p> <p>Which do you use for package naming in your projects?</p>
[ { "answer_id": 193459, "author": "oxbow_lakes", "author_id": 16853, "author_profile": "https://Stackoverflow.com/users/16853", "pm_score": 2, "selected": false, "text": "[company].[project].[sub].xyz(.abc)\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/189209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18300/" ]
189,213
<p>Using the following query and results, I'm looking for the most recent entry where the ChargeId and ChargeType are unique.</p> <pre><code>select chargeId, chargeType, serviceMonth from invoice CHARGEID CHARGETYPE SERVICEMONTH 1 101 R 8/1/2008 2 161 N 2/1/2008 3 101 R 2/1/2008 4 101 R 3/1/2008 5 101 R 4/1/2008 6 101 R 5/1/2008 7 101 R 6/1/2008 8 101 R 7/1/2008 </code></pre> <p>Desired:</p> <pre><code> CHARGEID CHARGETYPE SERVICEMONTH 1 101 R 8/1/2008 2 161 N 2/1/2008 </code></pre>
[ { "answer_id": 189221, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 8, "selected": true, "text": "SELECT\n CHARGEID,\n CHARGETYPE,\n MAX(SERVICEMONTH) AS \"MostRecentServiceMonth\"\nFROM INVOICE\nGROUP BY CHARG...
2008/10/09
[ "https://Stackoverflow.com/questions/189213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16345/" ]
189,228
<p>When writing async method implementations using the BeginInvoke/EndInvoke pattern the code might look something like the following (and to save you guessing this is an async wrapper around a cache):</p> <pre><code>IAsyncResult BeginPut(string key, object value) { Action&lt;string, object&gt; put = this.cache.Put; return put.BeginInvoke(key, value, null, null); } void EndPut(IAsyncResult asyncResult) { var put = (Action&lt;string, object&gt;)((AsyncResult)asyncResult).AsyncDelegate; put.EndInvoke(asyncResult); } </code></pre> <p>This works perfectly well because it's known what the type of delegate is, so it can be cast. However it starts to get messy when you have two <code>Put</code> methods, because although the method returns void you seemingly have to cast it to a strongly typed delegate to end the invocation, e.g.</p> <pre><code>IAsyncResult BeginPut(string key, object value) { Action&lt;string, object&gt; put = this.cache.Put; return put.BeginInvoke(key, value, null, null); } IAsyncResult BeginPut(string region, string key, object value) { Action&lt;string, string, object&gt; put = this.cache.Put; return put.BeginInvoke(region, key, value, null, null); } void EndPut(IAsyncResult asyncResult) { var put = ((AsyncResult)asyncResult).AsyncDelegate; var put1 = put as Action&lt;string, object&gt;; if (put1 != null) { put1.EndInvoke(asyncResult); return; } var put2 = put as Action&lt;string, string, object&gt;; if (put2 != null) { put2.EndInvoke(asyncResult); return; } throw new ArgumentException("Invalid async result", "asyncResult"); } </code></pre> <p>I'm hoping there is a cleaner way to do this, because the only thing I care about the delegate is the return type (in this case void) and not the arguments that were supplied to it. But I've racked my brains and asked others in the office, and nobody can think of the answer.</p> <p>I know one solution is to write a custom <code>IAsyncResult</code>, but that's such a difficult task with the potential threading issues around things like lazy instantiation of the <code>WaitHandle</code> that I'd rather have this slightly hacky looking code than go down that route.</p> <p>Any ideas on how to end the invocation without a cascading set of <code>is</code> checks?</p>
[ { "answer_id": 189266, "author": "Mark Brackett", "author_id": 2199, "author_profile": "https://Stackoverflow.com/users/2199", "pm_score": 0, "selected": false, "text": "IAsyncResult BeginPut(string key, object value) {\n return this.BeginPut(null, key, value);\n}\n\nIAsyncResult Begin...
2008/10/09
[ "https://Stackoverflow.com/questions/189228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13552/" ]
189,280
<p>I use NHibernate for my dataacess, and for awhile not I've been using SQLite for local integration tests. I've been using a file, but I thought I would out the :memory: option. When I fire up any of the integration tests, the database seems to be created (NHibernate spits out the table creation sql) but interfacting with the database causes an error.</p> <p>Has anyone every gotten NHibernate working with an in memory database? Is it even possible? The connection string I'm using is this:</p> <pre><code>Data Source=:memory:;Version=3;New=True </code></pre>
[ { "answer_id": 196979, "author": "Stefan Steinegger", "author_id": 2658202, "author_profile": "https://Stackoverflow.com/users/2658202", "pm_score": 3, "selected": false, "text": "file::memory:?cache=shared" }, { "answer_id": 4501759, "author": "Julien Bérubé", "author_id...
2008/10/09
[ "https://Stackoverflow.com/questions/189280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5802/" ]
189,293
<p>I have a subroutine that takes a filehandle as an argument. How do I make a filehandle from a file path specified on the command line? I don't want to do any processing of this file myself, I just want to pass it off to this other subroutine, which returns an array of hashes with all the parsed data from the file.</p> <p>Here's what the command line input I'm using looks like:</p> <p><code>$ ./getfile.pl /path/to/some/file.csv</code></p> <p>Here's what the beginning of the subroutine I'm calling looks like:</p> <pre><code>sub parse { my $handle = shift; my @data = &lt;$handle&gt;; while (my $line = shift(@data)) { # do stuff } } </code></pre>
[ { "answer_id": 189314, "author": "bmdhacks", "author_id": 14032, "author_profile": "https://Stackoverflow.com/users/14032", "pm_score": -1, "selected": false, "text": "open($fh, \"<$ARGV[0]\") or die \"couldn't open $ARGV[0]: $!\";\ndo_something_with_fh($fh);\nclose($fh);\n" }, { ...
2008/10/09
[ "https://Stackoverflow.com/questions/189293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6406/" ]
189,308
<h2>Problem</h2> <p>Our web host provider is changing the IP address of one of the servers we are on. We have been given a time frame for when the switch will take place, but no exact details. Therefore, our current <em>poor man's</em> check requires a periodic page refresh on a browser to see if our website is still there.</p> <h2>Question</h2> <p>We are all programmers here and this is killing me that any manual checking is required. I would know how to do this in other languages, but want to know if there is a way to write a script in <strong>PowerShell</strong> to tackle this problem. Does anyone know how I might going about this?</p>
[ { "answer_id": 189653, "author": "aphoria", "author_id": 2441, "author_profile": "https://Stackoverflow.com/users/2441", "pm_score": 0, "selected": false, "text": "Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName . | Select-Object -Property IPAd...
2008/10/09
[ "https://Stackoverflow.com/questions/189308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4916/" ]
189,339
<p>I've just got a fresh Drupal 6 install. The CSS didn't work. Then I realized that a "?U" was appended, and Drupal couldn't find it. Does anyone know where to unset this? </p> <pre><code>&lt;link type="text/css" rel="stylesheet" media="all" href="/modules/node/node.css?U" /&gt; &lt;link type="text/css" rel="stylesheet" media="all" href="/modules/system/admin.css?U" /&gt; &lt;link type="text/css" rel="stylesheet" media="all" href="/modules/system/defaults.css?U" /&gt; &lt;link type="text/css" rel="stylesheet" media="all" href="/modules/system/system.css?U" /&gt; &lt;link type="text/css" rel="stylesheet" media="all" href="/modules/system/system-menus.css?U" /&gt; &lt;link type="text/css" rel="stylesheet" media="all" href="/modules/user/user.css?U" /&gt; &lt;link type="text/css" rel="stylesheet" media="all" href="/themes/bluemarine/style.css?U" /&gt; </code></pre>
[ { "answer_id": 189413, "author": "Nick Sergeant", "author_id": 22468, "author_profile": "https://Stackoverflow.com/users/22468", "pm_score": 0, "selected": false, "text": "http://domain.com/drupal\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/189339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11927/" ]
189,350
<p>Is there a way to find out what gcc flags a particular binary was compiled with?</p>
[ { "answer_id": 191875, "author": "Chris Matta", "author_id": 6356, "author_profile": "https://Stackoverflow.com/users/6356", "pm_score": 2, "selected": false, "text": "smb -b" }, { "answer_id": 340828, "author": "diciu", "author_id": 2811, "author_profile": "https://S...
2008/10/09
[ "https://Stackoverflow.com/questions/189350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2831/" ]
189,363
<p>How do I write a regular expression to find all lines containing 665 and not having .pdf</p> <p>I can't seem to find how to do not in regex. This is for Notepad++ syntax if it matters.</p> <p>Thanks</p>
[ { "answer_id": 189383, "author": "John Nilsson", "author_id": 24243, "author_profile": "https://Stackoverflow.com/users/24243", "pm_score": 2, "selected": false, "text": "665(?!.*\\.pdf)\n" }, { "answer_id": 190086, "author": "Dov Wasserman", "author_id": 26010, "auth...
2008/10/09
[ "https://Stackoverflow.com/questions/189363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13009/" ]
189,368
<p>Here's my situation - I want to create a resized jpeg image from a user uploaded image, and then send it to S3 for storage, but am looking to avoid writing the resized jpeg to the disk and then reloading it for the S3 request.</p> <p>Is there a way to do this completely in memory, with the image data JPEG formatted, saved in a variable?</p>
[ { "answer_id": 189410, "author": "ConroyP", "author_id": 2287, "author_profile": "https://Stackoverflow.com/users/2287", "pm_score": 3, "selected": false, "text": "// Manipulate image - assume ImageMagick, so $im is image object\n$im = new Imagick();\n// Get image source data\n$im->readi...
2008/10/09
[ "https://Stackoverflow.com/questions/189368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24694/" ]
189,375
<p>With a view to avoiding the construction of further barriers to migration whilst enhancing an existing vb6 program. Is there a way to achieve the same functionality as control arrays in vb6 without using them?</p>
[ { "answer_id": 191406, "author": "RS Conley", "author_id": 7890, "author_profile": "https://Stackoverflow.com/users/7890", "pm_score": 2, "selected": true, "text": "Private Sub MyButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click,Button2.Click\...
2008/10/09
[ "https://Stackoverflow.com/questions/189375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6164/" ]
189,391
<p>I am looking for a way to take a user uploaded image that is currently put in a temporary location ex: /tmp/jkhjkh78 and create a php image from it, autodetecting the format.</p> <p>Is there a more clever way to do this than a bunch of try/catching with imagefromjpeg, imagefrompng, etc?</p>
[ { "answer_id": 189400, "author": "kender", "author_id": 4172, "author_profile": "https://Stackoverflow.com/users/4172", "pm_score": 0, "selected": false, "text": "file" }, { "answer_id": 189412, "author": "aib", "author_id": 1088, "author_profile": "https://Stackoverf...
2008/10/09
[ "https://Stackoverflow.com/questions/189391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24694/" ]
189,392
<p>I'm trying to return a transparent GIF from an .aspx page for display within a web page. I am trying to get the image to have transparency, but I just keep getting Black being where the image should be Transparent.</p> <p>Does anyone know what I'm doing wrong?</p> <pre><code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles Me.Load '' Change the response headers to output a GIF image. Response.Clear() Response.ContentType = "image/gif" Dim width = 110 Dim height = width '' Create a new 32-bit bitmap image Dim b = New Bitmap(width, height) '' Create Grahpics object for drawing Dim g = Graphics.FromImage(b) Dim rect = New Rectangle(0, 0, width - 1, height - 1) '' Fill in with Transparent Dim tbrush = New System.Drawing.SolidBrush(Color.Transparent) g.FillRectangle(tbrush, rect) '' Draw Circle Border Dim bPen = Pens.Red g.DrawPie(bPen, rect, 0, 365) '' Fill in Circle Dim cbrush = New SolidBrush(Color.LightBlue) g.FillPie(cbrush, rect, 0, 365) '' Clean up g.Flush() g.Dispose() '' Make Transparent b.MakeTransparent() b.Save(Response.OutputStream, Imaging.ImageFormat.Gif) Response.Flush() Response.End() End Sub </code></pre>
[ { "answer_id": 189480, "author": "Chris Pietschmann", "author_id": 7831, "author_profile": "https://Stackoverflow.com/users/7831", "pm_score": 3, "selected": false, "text": "Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) _\n Handles Me.Load\n '' Change t...
2008/10/09
[ "https://Stackoverflow.com/questions/189392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7831/" ]
189,415
<p>I have the following string:</p> <p><code>$_='364*84252';</code></p> <p>The question is: how to replace <code>*</code> in the string with something else? I've tried <code>s/\*/$i/</code>, but there is an error: <code>Quantifier follows nothing in regex</code>. On the other hand <code>s/'*'/$i/</code> doesn't cause any errors, but it also doesn't seem to have any effect at all.</p>
[ { "answer_id": 189428, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 3, "selected": false, "text": "~> cat test.pl\n$a = \"234*343\";\n$i = \"FOO\";\n\n$a =~ s/\\*/$i/;\nprint $a;\n\n~> perl test.pl\n234FOO343\n" }...
2008/10/09
[ "https://Stackoverflow.com/questions/189415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
189,422
<p>I need to do a join across two different database servers (IPs 10.0.0.50 and 10.0.0.51). What's the best way?</p>
[ { "answer_id": 189431, "author": "Ben Hoffstein", "author_id": 4482, "author_profile": "https://Stackoverflow.com/users/4482", "pm_score": 5, "selected": true, "text": "sp_addlinkedserver [ @server= ] 'server' [ , [ @srvproduct= ] 'product_name' ] \n [ , [ @provider= ] 'provider_name' ]\...
2008/10/09
[ "https://Stackoverflow.com/questions/189422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/109/" ]
189,430
<p>How to detect the Internet connection is offline in JavaScript?</p>
[ { "answer_id": 189443, "author": "keparo", "author_id": 19468, "author_profile": "https://Stackoverflow.com/users/19468", "pm_score": 8, "selected": true, "text": "ping" }, { "answer_id": 189456, "author": "ConroyP", "author_id": 2287, "author_profile": "https://Stack...
2008/10/09
[ "https://Stackoverflow.com/questions/189430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1100/" ]
189,436
<p>When I try to test the AutoLotWCFService using "wcftestclient", I get the following error. What am I doing wrong? Any insight will help. This is a simple Web Service that has wshttpbinding with interface contract and the implementation in the service. Here is the long error message: The Web.Config file has 2 endpoints - one for Web Service itself and other for metaDataExchange. Its all pretty much default stuff. I can include the code if needed - it seems I cannot attach files here.</p> <hr> <pre><code>Error: Cannot obtain Metadata from http://localhost/AutoLotWCFService/Service.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455. WS-Metadata Exchange Error URI: http://localhost/AutoLotWCFService/Service.svc Metadata contains a reference that cannot be resolved: 'http://localhost/AutoLotWCFService/Service.svc'. The remote server returned an unexpected response: (405) Method not allowed. The remote server returned an error: (405) Method Not Allowed. HTTP GET Error URI: http://localhost/AutoLotWCFService/Service.svc The document at the url http://localhost/AutoLotWCFService/Service.svc was not recognized as a known document type.The error message from each known type may help you fix the problem: - Report from 'DISCO Document' is 'Name cannot begin with the '%' character, hexadecimal value 0x25. Line 1, position 2.'. - Report from 'WSDL Document' is 'There is an error in XML document (1, 2).' -Name cannot begin with the '%' character, hexadecimal value 0x25. Line 1, position 2. - Report from 'XML Schema' is 'Name cannot begin with the '%' character, hexadecimal value 0x25. Line 1, position 2.'. </code></pre> <hr>
[ { "answer_id": 189459, "author": "Craig Wilson", "author_id": 25333, "author_profile": "https://Stackoverflow.com/users/25333", "pm_score": 0, "selected": false, "text": "<serviceBehaviors>\n <behavior name=\"serviceBehavior\">\n <serviceMetadata httpGetEnabled=\"true\">\n </behavio...
2008/10/09
[ "https://Stackoverflow.com/questions/189436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
189,451
<p>My team is trying to setup an Apache reverse proxy from a customer's site into one of our web applications. </p> <p><a href="http://www.example.com/app1/some-path" rel="noreferrer">http://www.example.com/app1/some-path</a> maps to <a href="http://internal1.example.com/some-path" rel="noreferrer">http://internal1.example.com/some-path</a> </p> <p>Inside our application we use struts and have redirect = true set on certain actions in order to provide certain functionality. The 302 status messages from these re-directs cause the user to break out of the proxy resulting in an error page for the end user.</p> <p>HTTP/1.1 302 Found Location: <a href="http://internal.example.com/some-path/redirect" rel="noreferrer">http://internal.example.com/some-path/redirect</a></p> <p>Is there any way to setup the reverse proxy in apache so that the redirects work correctly?</p> <p><a href="http://www.example.com/app1/some-path/redirect" rel="noreferrer">http://www.example.com/app1/some-path/redirect</a></p>
[ { "answer_id": 1614672, "author": "Marcel Levy", "author_id": 676, "author_profile": "https://Stackoverflow.com/users/676", "pm_score": 2, "selected": false, "text": " <VirtualHost example>\n ServerName www.example.com\n\n ProxyPassReverse /app1/some-path/ http://internal1...
2008/10/09
[ "https://Stackoverflow.com/questions/189451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6021/" ]
189,468
<p>I've had nothing but good luck from SO, so why not try again?</p> <p>I have an application that needs to show a different image based on the season of the year (spring, summer, winter, fall). I have very specific start and end dates for these seasons.</p> <p>What I would like from you geniuses is a method called GetSeason that takes a date as input and returns a String value of Spring, Summer, Winter or Fall. Here are the date ranges and their associated seasons:<br></p> <p>Spring:3/1-4/30<br> Summer:5/1-8/31<br> Fall:9/1-10/31<br> Winter: 11/1-2/28</p> <p>Can someone provide a working method to return the proper season? Thanks everyone!</p>
[ { "answer_id": 189504, "author": "nsayer", "author_id": 13757, "author_profile": "https://Stackoverflow.com/users/13757", "pm_score": 1, "selected": false, "text": "String getSeason(int month) {\n switch(month) {\n case 11:\n case 12:\n case 1:\n ca...
2008/10/09
[ "https://Stackoverflow.com/questions/189468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/172/" ]
189,475
<p>I want to know how to set the height property for the HTML <code>&lt;select&gt;</code> in code.</p> <p>I tried setting <code>.Attribute.Add("Style","Height:120px")</code> just to see if I could get it to change but to no avail.</p>
[ { "answer_id": 189514, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stackoverflow.com/users/4435", "pm_score": 0, "selected": false, "text": "DropDownList myDropDown;\nmyDropDown.Style[\"height\"] = \"120px\";\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/189475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25642/" ]
189,490
<p>I tried looking for the .emacs file for my Windows installation for Emacs, but I could not find it. Does it have the same filename under Windows as in Unix?</p> <p>Do I have to create it myself? If so, under what specific directory does it go?</p>
[ { "answer_id": 189509, "author": "Node", "author_id": 7190, "author_profile": "https://Stackoverflow.com/users/7190", "pm_score": 8, "selected": true, "text": ".emacs" }, { "answer_id": 189519, "author": "Alexander Kojevnikov", "author_id": 712, "author_profile": "htt...
2008/10/09
[ "https://Stackoverflow.com/questions/189490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
189,493
<p>Every so often when I'm debugging, I get this message in nice brown text on an ASP.NET error page:</p> <blockquote> <p><em>Access to the path "c:\windows\microsoft.net\framework\(version)\Temporary ASP.NET Files\(blah)" is denied.</em></p> </blockquote> <p>I've never been able to figure out what causes it, what really fixes it, and why it happens.</p> <p>Often times the path after the "Temporary ASP.NET Files" portion (the "(blah)") does not exist, so I'm not sure why it's looking there.</p> <p>Sometimes an IISRESET fixes it, and sometimes it doesn't.</p> <p>Sometimes an aspnet_regiis fixes it, and sometimes it doesn't. </p> <p>Sometimes a reboot fixes it, and sometimes it doesn't.</p> <p>For what it's worth I ran into this today with some .NET 1.1 code (yes, still maintaining some - hoping to upgrade it soon) and I'm not sure if I've ever seen it with .NET 2.0 and above. </p> <p>Does anyone know what causes this and what should fix it? I assume it has multiple possible causes but I'm just curious if someone could shed some light on it.</p>
[ { "answer_id": 40347868, "author": "Eddie Fletcher", "author_id": 1413853, "author_profile": "https://Stackoverflow.com/users/1413853", "pm_score": 0, "selected": false, "text": "IIS_IUSRS" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/189493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2577/" ]
189,499
<p>According to the doucmentation for "Directory.Delete( "path", true )", it remove directories, subdirectories, and files in the path.</p> <p>What does Directory.Delete( "path", false ) do? According to the doucmentation it does "otherwise".</p> <p>I mean how can you delete a directory without removing the directory, subdirectories, and files?</p>
[ { "answer_id": 189528, "author": "Michael Burr", "author_id": 12711, "author_profile": "https://Stackoverflow.com/users/12711", "pm_score": 0, "selected": false, "text": "false" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/189499", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
189,516
<p>For ActionScript 2, I've used <a href="http://www.naturaldocs.org/" rel="noreferrer">NaturalDocs</a>. However it has pretty poor support for PHP. I've looked so far at <a href="http://www.doxygen.nl/" rel="noreferrer">doxygen</a> and <a href="http://www.phpdoc.org/" rel="noreferrer">phpDocumentor</a>, but their output is pretty ugly in my opinion. Does anyone have any experience with automatic documentation generation for PHP? I'd prefer to be able to use javadoc-style tags, they are short to write and easy to remember.</p>
[ { "answer_id": 1926510, "author": "Pascal MARTIN", "author_id": 138475, "author_profile": "https://Stackoverflow.com/users/138475", "pm_score": 4, "selected": false, "text": "@param type name description of the parameter" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/189516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14569/" ]
189,522
<p>any thoughts on this would be appreciated:</p> <pre><code>std::string s1 = "hello"; std::string s2 = std::string(s1); </code></pre> <p>I'd now expect these two strings to be independent, i.e. I could append ", world" to s2 and s1 would still read "hello". This is what I find on windows and linux but running the code on a HP_UX machine it seems that s2 and s1 are the same string, so modifying s2 changes s1.</p> <p>Does this sound absolutely crazy, anyone seen anything similar?</p>
[ { "answer_id": 189539, "author": "Michael Burr", "author_id": 12711, "author_profile": "https://Stackoverflow.com/users/12711", "pm_score": 1, "selected": false, "text": "#include <stdio.h>\n#include <string>\n\nint main () \n{\n std::string s1 = \"hello\"; \n std::string s2 = std:...
2008/10/09
[ "https://Stackoverflow.com/questions/189522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26665/" ]
189,523
<p>I have already extracted the tag from the source document using grep but, now I cant seem to figure out how to easily extract the properties from the string. Also I want to avoid having to use any programs that would not usually be present on a standard installation. </p> <pre><code>$tag='&lt;img src="http://imgs.xkcd.com/comics/barrel_cropped_(1).jpg" title="Don't we all." alt="Barrel - Part 1" /&gt;' </code></pre> <p>I need to end up with the following variables</p> <pre><code>$src="http://imgs.xkcd.com/comics/barrel_cropped_(1).jpg" $title="Don't we all." $alt="Barrel - Part 1" </code></pre>
[ { "answer_id": 189735, "author": "GameFreak", "author_id": 26659, "author_profile": "https://Stackoverflow.com/users/26659", "pm_score": 1, "selected": false, "text": "src=`echo $tag | sed 's/.*src=[\"]\\(.*\\)[\"] title=[\"]\\(.*\\)[\"] alt=[\"]\\(.*\\)[\"].*/\\1/'` \ntitle=`echo $ta...
2008/10/09
[ "https://Stackoverflow.com/questions/189523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26659/" ]
189,534
<p>I am current writing an application that will require multiple inserts, updates and deletes for my business entity. I am using the TransactionScope class to guarantee all the stored procedures can commit or roll back as a single unit of work.</p> <p>My question is, I am required to also use COMMIT TRAN and ROLLBACK TRAN is each of my stored procedures if I am using the TransactionScope class in my .NET class library?</p>
[ { "answer_id": 190332, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 3, "selected": false, "text": "Transaction Binding=Explicit Unbind;" }, { "answer_id": 3527397, "author": "Jared Moore", "author_id"...
2008/10/09
[ "https://Stackoverflow.com/questions/189534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26327/" ]
189,549
<p>Is it possible to embed a pre-existing DLL into a compiled C# executable (so that you only have one file to distribute)? If it is possible, how would one go about doing it?</p> <p>Normally, I'm cool with just leaving the DLLs outside and having the setup program handle everything, but there have been a couple of people at work who have asked me this and I honestly don't know.</p>
[ { "answer_id": 6362414, "author": "Lars Holm Jensen", "author_id": 348005, "author_profile": "https://Stackoverflow.com/users/348005", "pm_score": 7, "selected": false, "text": "public App()\n{\n AppDomain.CurrentDomain.AssemblyResolve +=new ResolveEventHandler(CurrentDomain_AssemblyR...
2008/10/09
[ "https://Stackoverflow.com/questions/189549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5133/" ]
189,552
<p>I'm trying to host a subdomain for my site with a different hosting company and I'm running into issues on how to set it up.</p> <p>Here are the specifics:</p> <ul> <li>Domain is registered with GoDaddy.</li> <li>Nameservers are pointing to DiscountASP.net where ASP.NET app has been happily running for couple of years.</li> <li>Would like <code>blog.mydomain.example</code> to point to my account with DreamHost.com to take advantage of their LAMP stack.</li> </ul> <p>I have added <code>blog.mydomain.example</code> to DreamHost (after adding <code>mydomain.example</code>) via their control panel. I thought I would be able to add a subdomain entry on GoDaddy to point to DreamHost, but all they allow is <code>blog.mydomain.example</code> = new URL.</p> <p>In theory I could just take our .biz or .net domain and host it on DreamHost but was hoping I could do it all with a subdomain.</p> <p>So, to summarize I'd like to know if what I want to do is feasible and if so, how do I go about it (given the constraints of GoDaddy, DiscountASP, &amp; DreamHost).</p>
[ { "answer_id": 189563, "author": "Saif Khan", "author_id": 23667, "author_profile": "https://Stackoverflow.com/users/23667", "pm_score": 8, "selected": true, "text": "mydomain.example" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/189552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3262/" ]
189,555
<p>I want to download and parse webpage using python, but to access it I need a couple of cookies set. Therefore I need to login over https to the webpage first. The login moment involves sending two POST params (username, password) to /login.php. During the login request I want to retrieve the cookies from the response header and store them so I can use them in the request to download the webpage /data.php.</p> <p>How would I do this in python (preferably 2.6)? If possible I only want to use builtin modules.</p>
[ { "answer_id": 189580, "author": "Harley Holcombe", "author_id": 1057, "author_profile": "https://Stackoverflow.com/users/1057", "pm_score": 8, "selected": true, "text": "import urllib, urllib2, cookielib\n\nusername = 'myuser'\npassword = 'mypassword'\n\ncj = cookielib.CookieJar()\nopen...
2008/10/09
[ "https://Stackoverflow.com/questions/189555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26668/" ]
189,557
<p>We're running a java/hibernate app going against ORACLE 10g in TESTING. Once in a while, we're seeing this error:</p> <blockquote> <p>ORA-00942: table or view does not exist</p> </blockquote> <p>Is there a way to find out which table/view(s) ORACLE is talking about ?</p> <p>I know that I can add extra levels of logging in hibernate which will show all the SQL that it executes on ORACLE and then run that SQL to figure out which TABLE/VIEW is missing or missing permission. But given that it is in TESTING/STAGING, that will slow down performance.</p> <p>Is there a simple way to narrow down on the Table/View Name ?</p> <h2>UPDATE :</h2> <p>Just so you know, I don't have control over the Oracle DB Server Environment. <br> I enabled Hibernate tracing/logging and found a VALID SQL. I even put Wireshark(which is a TCP packet filter) to see what hibernate actually sends and that was a valid SQL. So, why would Oracle complain about it once in a while and NOT always.</p>
[ { "answer_id": 190614, "author": "Matthew Watson", "author_id": 3839, "author_profile": "https://Stackoverflow.com/users/3839", "pm_score": 3, "selected": false, "text": "create table caught_errors (\n dt date, \n username varchar2( 30), -- value from ora_login_us...
2008/10/09
[ "https://Stackoverflow.com/questions/189557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11142/" ]
189,559
<p>Conditions: do not modify the original lists; JDK only, no external libraries. Bonus points for a one-liner or a JDK 1.3 version.</p> <p>Is there a simpler way than:</p> <pre class="lang-java prettyprint-override"><code>List&lt;String&gt; newList = new ArrayList&lt;String&gt;(); newList.addAll(listOne); newList.addAll(listTwo); </code></pre>
[ { "answer_id": 189568, "author": "Tim", "author_id": 5284, "author_profile": "https://Stackoverflow.com/users/5284", "pm_score": 5, "selected": false, "text": "List<String> newList = new ArrayList<String>(listOne);\nnewList.addAll(listTwo);\n" }, { "answer_id": 189569, "autho...
2008/10/09
[ "https://Stackoverflow.com/questions/189559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17294/" ]
189,562
<p>There are many ways of doing debugging, using a debugger is one, but the simple one for the humble, lazy, programmer is to just add a bunch of print statements to your code.</p> <p>i.e.</p> <pre><code> def foo(x): print 'Hey wow, we got to foo!', x ... print 'foo is returning:', bar return bar </code></pre> <p>Is there a proper name for this style of debugging?</p>
[ { "answer_id": 189570, "author": "Shog9", "author_id": 811, "author_profile": "https://Stackoverflow.com/users/811", "pm_score": 7, "selected": true, "text": "printf()" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/189562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14648/" ]