qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
54,579
<p>Does anyone know of a good example of how to expose a WCF service programatically without the use of a configuration file? I know the service object model is much richer now with WCF, so I know it's possible. I just have not seen an example of how to do so. Conversely, I would like to see how consuming without a configuration file is done as well.</p> <p>Before anyone asks, I have a very specific need to do this without configuration files. I would normally not recommend such a practice, but as I said, there is a very specific need in this case.</p>
[ { "answer_id": 292810, "author": "devios1", "author_id": 238948, "author_profile": "https://Stackoverflow.com/users/238948", "pm_score": 8, "selected": true, "text": "internal static MyServiceSoapClient CreateWebServiceInstance() {\n BasicHttpBinding binding = new BasicHttpBinding();\...
2008/09/10
[ "https://Stackoverflow.com/questions/54579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5469/" ]
54,585
<p>In what scenarios is it better to use a <code>struct</code> vs a <code>class</code> in C++?</p>
[ { "answer_id": 54596, "author": "Commodore Jaeger", "author_id": 4659, "author_profile": "https://Stackoverflow.com/users/4659", "pm_score": 11, "selected": true, "text": "class" }, { "answer_id": 54628, "author": "mbyrne215", "author_id": 5241, "author_profile": "htt...
2008/09/10
[ "https://Stackoverflow.com/questions/54585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5436/" ]
54,586
<p>I have a windows laptop (thinkpad) and somewhat recently rediscovered emacs and the benefit that all those wacky shortcuts can be when the arrow keys are located somewhere near you right armpit.</p> <p>I was discouraged after php-mode, css-mode, etc, under mmm-mode was inconsistent, buggy, and refused to properly interpret some of my files. (In all fairness, I'm most likely doin' it wrong) So I eventually found the nxhtml package which worked pretty well.</p> <p>However, nxhtml causes weird bugs and actually crashes on certain files (certain combinations of nested modes I supposed) under linux! (using Ubuntu 7.10 and Kubuntu 8.04)</p> <p>I'd like to be able to work on the laptop as well as the home linux pc without having to deal with inconsistent implementations of something that shouldn't be this hard. I've googled and looked around and there's a good chance I'm the only human on the planet having these problems... Anyone got some advice?</p> <p>(in lieu of an emacs solutions, a good enough cross-platform lightweight text editor with the dev features would also work I suppose...)</p>
[ { "answer_id": 64703, "author": "insipid", "author_id": 8649, "author_profile": "https://Stackoverflow.com/users/8649", "pm_score": 2, "selected": false, "text": "mumamo-mode" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2570347/" ]
54,612
<p>Is there a way to have Linux read ahead when cloning a disk? I use the program named "dd" to clone disks. The last time I did this it seemed as though the OS was reading then writing but never at the same time. Ideally, the destination disk would be constantly writing without waiting that's of course if the source disk can keep up.</p> <p>UPDATE: I normally choose a large block size when cloning (ex. 16M or 32MB).</p>
[ { "answer_id": 54631, "author": "Thomas Kammeyer", "author_id": 4410, "author_profile": "https://Stackoverflow.com/users/4410", "pm_score": 1, "selected": false, "text": "dd if=indevfile | dd of=outdevfile\n" }, { "answer_id": 54642, "author": "Commodore Jaeger", "author_...
2008/09/10
[ "https://Stackoverflow.com/questions/54612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4778/" ]
54,626
<p>This code is from <em>Prototype.js</em>. I've looked at probably 20 different tutorials, and I can't figure out why this is not working. The response I get is null.</p> <pre><code>new Ajax.Request(/path/to / xml / file.xml, { method: "get", contentType: "application/xml", onSuccess: function(transport) { alert(transport.responseXML); } }); </code></pre> <p>If I change the <code>responseXML</code> to <code>responseText</code>, then it alerts to me the XML file as a string. This is not a PHP page serving up XML, but an actual XML file, so I know it is not the response headers.</p>
[ { "answer_id": 12488558, "author": "riverX", "author_id": 1682030, "author_profile": "https://Stackoverflow.com/users/1682030", "pm_score": 1, "selected": false, "text": "application/xml xml xsl gpx\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
54,658
<p>The <a href="http://msdn.microsoft.com/en-us/library/kx145dw2.aspx" rel="noreferrer">ClientScriptManager.RegisterClientScriptInclude</a> method allows you to register a JavaScript reference with the Page object (checking for duplicates).</p> <p>Is there an equivalent of this method for CSS references?</p> <p>Similar questions apply for <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.clientscriptmanager.registerclientscriptblock.aspx" rel="noreferrer">ClientScriptManager.RegisterClientScriptBlock</a> and <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.clientscriptmanager.registerclientscriptresource.aspx" rel="noreferrer">ClientScriptManager.RegisterClientScriptResource</a></p>
[ { "answer_id": 112189, "author": "CMPalmer", "author_id": 14894, "author_profile": "https://Stackoverflow.com/users/14894", "pm_score": 3, "selected": false, "text": "HtmlLink link = new HtmlLink();\nlink.Href = \"Cases/EditStyles.css\";\nlink.Attributes.Add(\"type\", \"text/css\");\nlin...
2008/09/10
[ "https://Stackoverflow.com/questions/54658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/247/" ]
54,669
<p>The job at hand:</p> <p>I want to make sure that my website's users view a page before they start a download. If they have not looked at the page but try to hotlink to the files directly they should go to the webpage before the download is allowed.</p> <p>Any suggestions that are better than my idea to send out a cookie and - before the download starts - check if the cookie exists (via .htaccess)?</p> <p>The webpage and the download files will be located on different servers.</p> <p>Environment:</p> <ul> <li>Apache 2 on all machines</li> <li>PHP 5 on all machines</li> <li>MySQL 5 available on the "webpage" server (no access from the download servers)</li> </ul> <p>Nathan asked what the problem is that I try to solve, and in fact it is that I want to prevent hotlinks from - for example - forums. If people download from our server, using our bandwidth, I want to show them an page with an ad before the download starts. It doesn't need to be totally secure, but we need to make some money to finance the servers, right? :)</p>
[ { "answer_id": 54801, "author": "ceejayoz", "author_id": 1902010, "author_profile": "https://Stackoverflow.com/users/1902010", "pm_score": 2, "selected": false, "text": "RewriteEngine on\nRewriteCond %{HTTP_REFERER} !^http://www.example.com/page.html$\nRewriteRule file.exe http://www.exa...
2008/09/10
[ "https://Stackoverflow.com/questions/54669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/999/" ]
54,674
<p>i'm wondering if there is any nice and neat tool to replace the GNU Autotools or Make to build a very large C++ project, which are such a complicated thing to use. </p> <p>It is simple to generate all the files that de Autotools require if the project is small, but if the source code is divided in many directories, with multiple third party libraries and many dependencies, you fall into the "Autotools Hell"..</p> <p>thanks for any recommendations</p>
[ { "answer_id": 55525, "author": "wilhelmtell", "author_id": 456, "author_profile": "https://Stackoverflow.com/users/456", "pm_score": 4, "selected": false, "text": "~$ ./waf configure && ./waf && ./waf install\n" }, { "answer_id": 529562, "author": "Kristian", "author_id"...
2008/09/10
[ "https://Stackoverflow.com/questions/54674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1876/" ]
54,686
<p>Does any one know how do I get the current open windows or process of a local machine using Java? </p> <p>What I'm trying to do is: list the current open task, windows or process open, like in Windows Taskmanager, but using a multi-platform approach - using only Java if it's possible.</p>
[ { "answer_id": 54696, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 3, "selected": false, "text": "Process proc = Runtime.getRuntime().exec (\"tasklist.exe\");\nInputStream procOutput = proc.getInputStream ();\nif (0 == pr...
2008/09/10
[ "https://Stackoverflow.com/questions/54686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4358/" ]
54,708
<p>This is an ASP.Net 2.0 web app. The Item template looks like this, for reference:</p> <pre><code>&lt;ItemTemplate&gt; &lt;tr&gt; &lt;td class="class1" align=center&gt;&lt;a href='url'&gt;&lt;img src="img.gif"&gt;&lt;/a&gt;&lt;/td&gt; &lt;td class="class1"&gt;&lt;%# DataBinder.Eval(Container.DataItem,"field1") %&gt;&lt;/td&gt; &lt;td class="class1"&gt;&lt;%# DataBinder.Eval(Container.DataItem,"field2") %&gt;&lt;/td&gt; &lt;td class="class1"&gt;&lt;%# DataBinder.Eval(Container.DataItem,"field3") %&gt;&lt;/td&gt; &lt;td class="class1"&gt;&lt;%# DataBinder.Eval(Container.DataItem,"field4") %&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/ItemTemplate&gt; </code></pre> <p>Using this in codebehind:</p> <pre><code>foreach (RepeaterItem item in rptrFollowupSummary.Items) { string val = ((DataBoundLiteralControl)item.Controls[0]).Text; Trace.Write(val); } </code></pre> <p>I produce this:</p> <pre><code>&lt;tr&gt; &lt;td class="class1" align=center&gt;&lt;a href='url'&gt;&lt;img src="img.gif"&gt;&lt;/a&gt;&lt;/td&gt; &lt;td class="class1"&gt;23&lt;/td&gt; &lt;td class="class1"&gt;1/1/2000&lt;/td&gt; &lt;td class="class1"&gt;-2&lt;/td&gt; &lt;td class="class1"&gt;11&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>What I need is the data from Field1 and Field4</p> <p>I can't seem to get at the data the way I would in say a DataList or a GridView, and I can't seem to come up with anything else on Google or quickly leverage this one to do what I want. The only way I can see to get at the data is going to be using a regex to go and get it (Because a man takes what he wants. He takes it all. And I'm a man, aren't I? Aren't I?). </p> <p>Am I on the right track (not looking for the specific regex to do this; forging that might be a followup question ;) ), or am I missing something?</p> <hr> <p>The Repeater in this case is set in stone so I can't switch to something more elegant. Once upon a time I did something similar to what Alison Zhou suggested using DataLists, but it's been some time (2+ years) and I just completely forgot about doing it this way. Yeesh, talk about overlooking something obvious. . .</p> <p>So I did as Alison suggested and it works fine. I don't think the viewstate is an issue here, even though this repeater can get dozens of rows. I can't really speak to the question if doing it that way versus using the instead (but that seems like a fine solution to me otherwise). Obviously the latter is less of a viewstate footprint, but I'm not experienced enough to say when one approach might be preferrable to another without an extreme example in front of me. Alison, one question: why literals and not labels?</p> <p>Euro Micelli, I was trying to avoid a return trip to the database. Since I'm still a little green relative to the rest of the development world, I admit I don't necessarily have a good grasp of how many database trips is "just right". There wouldn't be a performance issue here (I know the app's load enough to know this), but I suppose I was trying to avoid it out of habit, since my boss tends to emphasize fewer trips where possible.</p>
[ { "answer_id": 54738, "author": "ern", "author_id": 5609, "author_profile": "https://Stackoverflow.com/users/5609", "pm_score": 2, "selected": false, "text": "runat=\"server\"" }, { "answer_id": 54745, "author": "NakedBrunch", "author_id": 3742, "author_profile": "htt...
2008/09/10
[ "https://Stackoverflow.com/questions/54708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1734/" ]
54,709
<p>Multiple approaches exist to write your unit tests when using Rhino Mocks:</p> <ul> <li>The Standard Syntax</li> <li>Record/Replay Syntax</li> <li>The Fluent Syntax</li> </ul> <p>What is the ideal and most frictionless way?</p>
[ { "answer_id": 54893, "author": "Judah Gabriel Himango", "author_id": 536, "author_profile": "https://Stackoverflow.com/users/536", "pm_score": 1, "selected": false, "text": "using(mocks.Record())\n{\n Expect.Call(foo.Bar());\n}\nusing(mocks.Playback())\n{\n MakeItAllHappen();\n}\n...
2008/09/10
[ "https://Stackoverflow.com/questions/54709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
54,725
<p>Sending a message from the Unix command line using <code>mail TO_ADDR</code> results in an email from <code>$USER@$HOSTNAME</code>. Is there a way to change the "From:" address inserted by <code>mail</code>?</p> <p>For the record, I'm using GNU Mailutils 1.1/1.2 on Ubuntu (but I've seen the same behavior with Fedora and RHEL).</p> <p>[EDIT]</p> <pre> $ mail -s Testing chris@example.org Cc: From: foo@bar.org Testing . </pre> <p>yields</p> <pre> Subject: Testing To: &lt;chris@example.org&gt; X-Mailer: mail (GNU Mailutils 1.1) Message-Id: &lt;E1KdTJj-00025z-RK@localhost&gt; From: &lt;chris@localhost&gt; Date: Wed, 10 Sep 2008 13:17:23 -0400 From: foo@bar.org Testing </pre> <p>The "From: foo@bar.org" line is part of the message body, not part of the header.</p>
[ { "answer_id": 380573, "author": "cms", "author_id": 28532, "author_profile": "https://Stackoverflow.com/users/28532", "pm_score": 8, "selected": true, "text": "export REPLYTO=cms-replies@example.com\nmail -aFrom:cms-sends@example.com -s 'Testing'\n" }, { "answer_id": 1353352, ...
2008/09/10
[ "https://Stackoverflow.com/questions/54725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1412/" ]
54,753
<p>I have a large legacy codebase with very complicated makefiles, with lots of variables. Sometimes I need to change them, and I find that it's very difficult to figure out why the change isn't working the way I expect. What I'd like to find is a tool that basically does step-through-debugging of the "make" process, where I would give it a directory, and I would be able to see the value of different variables at different points in the process. None of the debug flags to make seem to show me what I want, although it's possible that I'm missing something. Does anyone know of a way to do this?</p>
[ { "answer_id": 54767, "author": "Rob Wells", "author_id": 2974, "author_profile": "https://Stackoverflow.com/users/2974", "pm_score": 6, "selected": false, "text": "make -n" }, { "answer_id": 15522386, "author": "GuruM", "author_id": 452885, "author_profile": "https:/...
2008/09/10
[ "https://Stackoverflow.com/questions/54753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5241/" ]
54,754
<p>For example, I want to populate a gridview control in an ASP.NET web page with only the data necessary for the # of rows displayed. How can NHibernate support this?</p>
[ { "answer_id": 54773, "author": "NotMyself", "author_id": 303, "author_profile": "https://Stackoverflow.com/users/303", "pm_score": 5, "selected": false, "text": "(from c in nwnd.Customers select c.CustomerID)\n .Skip(10).Take(10).ToList(); \n" }, { "answer_id": 54777, ...
2008/09/10
[ "https://Stackoverflow.com/questions/54754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
54,760
<p>Is there a way to unfilter an NSPasteboard for what the source application specifically declared it would provide?</p> <p>I'm attempting to serialize pasteboard data in my application. When another application places an RTF file on a pasteboard and then I ask for the available types, I get eleven different flavors of said RTF, everything from the original RTF to plain strings to dyn.* values. </p> <p>Saving off all that data into a plist or raw data on disk isn't usually a problem as it's pretty small, but when an image of any considerable size is placed on the pasteboard, the resulting output can be tens of times larger than the source data (with multiple flavors of TIFF and PICT data being made available via filtering).</p> <p>I'd like to just be able to save off what the original app made available if possible.</p> <hr> <p>John, you are far more observant than myself or the gentleman I work with who's been doing Mac programming since dinosaurs roamed the earth. Neither of us ever noticed the text you highlighted... and I've not a clue why. Starting too long at the problem, apparently.</p> <p>And while I accepted your answer as the correct answer, it doesn't exactly answer my original question. What I was looking for was a way to identify flavors that can become other flavors simply by placing them on the pasteboard <strong>AND</strong> to know which of these types were originally offered by the provider. While walking the types list will get me the preferred order for the application that provided them, it won't tell me which ones I can safely ignore as they'll be recreated when I refill the pasteboard later.</p> <p>I've come to the conclusion that there isn't a "good" way to do this. <code>[NSPasteboard declaredTypesFromOwner]</code> would be fabulous, but it doesn't exist.</p>
[ { "answer_id": 57771, "author": "John Calsbeek", "author_id": 5696, "author_profile": "https://Stackoverflow.com/users/5696", "pm_score": 3, "selected": true, "text": "-[NSPasteboard types]" }, { "answer_id": 59715, "author": "John Calsbeek", "author_id": 5696, "autho...
2008/09/10
[ "https://Stackoverflow.com/questions/54760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4233/" ]
54,789
<p>I have an Asset object that has a property AssignedSoftware, which is a collection. </p> <p>I want to make sure that the same piece of Software is not assigned to an Asset more than once. In Add method I check to see if the Software already exist, and if it does, I want to throw an exception. </p> <p>Is there a standard .NET exception that I should be throwing? Or does best practices dictate I create my own custom exception?</p>
[ { "answer_id": 55852, "author": "Rob Cooper", "author_id": 832, "author_profile": "https://Stackoverflow.com/users/832", "pm_score": 4, "selected": false, "text": "InvalidOperationException" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1768/" ]
54,790
<p>Is it possible to build Visual Studio solutions without having to fire up MonoDevelop?</p>
[ { "answer_id": 56113, "author": "skolima", "author_id": 3205, "author_profile": "https://Stackoverflow.com/users/3205", "pm_score": 7, "selected": true, "text": "xbuild" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3798/" ]
54,851
<p>In a follow-up to a <a href="https://stackoverflow.com/questions/54789/what-is-the-correct-net-exception-to-throw-when-try-to-insert-a-duplicate-objec">previous question</a> regarding exceptions, what are best practices for creating a custom exception in .NET? </p> <p>More specifically should you inherit from System.Exception, System.ApplicationException or some other base exception?</p>
[ { "answer_id": 54856, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 5, "selected": true, "text": "System.Exception" }, { "answer_id": 54942, "author": "Jay Bazuzi", "author_id": 5314, "author_profile"...
2008/09/10
[ "https://Stackoverflow.com/questions/54851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1768/" ]
54,861
<p>I've been using the following code to open Office Documents, PDF, etc. on my windows machines using Java and it's working fine, except for some reason when a filename has embedded it within it multiple contiguous spaces like "File[SPACE][SPACE]Test.doc".</p> <p>How can I make this work? I'm not averse to canning the whole piece of code... but I'd rather not replace it with a third party library that calls JNI.</p> <pre><code>public static void openDocument(String path) throws IOException { // Make forward slashes backslashes (for windows) // Double quote any path segments with spaces in them path = path.replace("/", "\\").replaceAll( "\\\\([^\\\\\\\\\"]* [^\\\\\\\\\"]*)", "\\\\\\\"$1\""); String command = "C:\\Windows\\System32\\cmd.exe /c start " + path + ""; Runtime.getRuntime().exec(command); } </code></pre> <p><strong>EDIT:</strong> When I run it with the errant file windows complains about finding the file. But... when I run the command line directly from the command line it runs just fine.</p>
[ { "answer_id": 55018, "author": "Matt Cummings", "author_id": 828, "author_profile": "https://Stackoverflow.com/users/828", "pm_score": 0, "selected": false, "text": "List<String> command = new ArrayList<String>();\ncommand.add(someExecutable);\ncommand.add(someArguemnt0);\ncommand.add(s...
2008/09/10
[ "https://Stackoverflow.com/questions/54861", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
54,866
<p>I have string like this</p> <pre><code> /c SomeText\MoreText "Some Text\More Text\Lol" SomeText </code></pre> <p>I want to tokenize it, however I can't just split on the spaces. I've come up with somewhat ugly parser that works, but I'm wondering if anyone has a more elegant design.</p> <p>This is in C# btw.</p> <p><strong>EDIT:</strong> My ugly version, while ugly, is O(N) and may actually be faster than using a RegEx.</p> <pre><code>private string[] tokenize(string input) { string[] tokens = input.Split(' '); List&lt;String&gt; output = new List&lt;String&gt;(); for (int i = 0; i &lt; tokens.Length; i++) { if (tokens[i].StartsWith("\"")) { string temp = tokens[i]; int k = 0; for (k = i + 1; k &lt; tokens.Length; k++) { if (tokens[k].EndsWith("\"")) { temp += " " + tokens[k]; break; } else { temp += " " + tokens[k]; } } output.Add(temp); i = k + 1; } else { output.Add(tokens[i]); } } return output.ToArray(); } </code></pre>
[ { "answer_id": 54880, "author": "Craig", "author_id": 2894, "author_profile": "https://Stackoverflow.com/users/2894", "pm_score": 0, "selected": false, "text": "using System;\nusing System.Text.RegularExpressions;\n\npublic class Test\n{\n\n public static void Main ()\n {\n\n ...
2008/09/10
[ "https://Stackoverflow.com/questions/54866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
54,867
<p>What is the difference between old style and new style classes in Python? When should I use one or the other?</p>
[ { "answer_id": 54873, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 10, "selected": true, "text": "x" }, { "answer_id": 242700, "author": "Halo", "author_id": 5306, "author_profile": "https://Stackove...
2008/09/10
[ "https://Stackoverflow.com/questions/54867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
54,877
<p>I can't seem to figure out a good way to do this, but it seems like it should be simple. I have an element that I want to <code>append a div</code> to. Then I have another element that I want to clone and shove into that intermediate div. Here's what I was hoping to do:</p> <pre><code>$("#somediv &gt; ul").after("&lt;div id='xxx'&gt;&lt;/div&gt;").append($("#someotherdiv").clone()); </code></pre> <p>This seems to be close, but not quite there. The problem with this is that the "append" seems to be operating on the original <code>#somediv &gt; ul</code> selector. This sort of makes sense, but it's not what I wanted. How can I most efficiently select that intermediate div that I added with the <code>after</code> and put my <code>#someotherdiv</code> into it?</p>
[ { "answer_id": 54897, "author": "Pat", "author_id": 238, "author_profile": "https://Stackoverflow.com/users/238", "pm_score": 0, "selected": false, "text": "after()" }, { "answer_id": 54949, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stackoverflo...
2008/09/10
[ "https://Stackoverflow.com/questions/54877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/404/" ]
54,882
<p>What's the easiest way to print a stacktrace from a debugging printout? Often during testing you would like to know the callstack leading up to the situation provoking a debug message.</p>
[ { "answer_id": 54887, "author": "jjnguy", "author_id": 2598, "author_profile": "https://Stackoverflow.com/users/2598", "pm_score": 2, "selected": false, "text": "e.getStackTrace();\n" }, { "answer_id": 54892, "author": "Johan Lübcke", "author_id": 4220, "author_profil...
2008/09/10
[ "https://Stackoverflow.com/questions/54882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4220/" ]
54,886
<p>Alright it can be a lame question, but everybody uses these things differently. What's some of the best time savers out there for this IDE. <BR><BR>Tom</p>
[ { "answer_id": 59413, "author": "Antti Kissaniemi", "author_id": 2948, "author_profile": "https://Stackoverflow.com/users/2948", "pm_score": 4, "selected": false, "text": "JdbcTemplate createJdbcTemplate()" }, { "answer_id": 104569, "author": "Olaf Kock", "author_id": 134...
2008/09/10
[ "https://Stackoverflow.com/questions/54886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5659/" ]
54,909
<p>I have an <code>ArrayList&lt;String&gt;</code> that I'd like to return a copy of. <code>ArrayList</code> has a clone method which has the following signature:</p> <pre><code>public Object clone() </code></pre> <p>After I call this method, how do I cast the returned Object back to <code>ArrayList&lt;String&gt;</code>?</p>
[ { "answer_id": 54911, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 1, "selected": false, "text": "ArrayList first = new ArrayList ();\nArrayList copy = (ArrayList) first.clone ();\n" }, { "answer_id": 54912, "...
2008/09/10
[ "https://Stackoverflow.com/questions/54909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
54,926
<p>Is it possible, in Java, to make a <code>JPanel</code> skip drawing its background thus being transparent except for the components on it?</p>
[ { "answer_id": 54927, "author": "Allain Lalonde", "author_id": 2443, "author_profile": "https://Stackoverflow.com/users/2443", "pm_score": 6, "selected": true, "text": "setOpaque(false)" }, { "answer_id": 22712998, "author": "user9349193413", "author_id": 736999, "aut...
2008/09/10
[ "https://Stackoverflow.com/questions/54926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2598/" ]
54,929
<blockquote> <p>This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, <strong>so please do not use it as evidence that you can ask similar questions here.</strong></p> <p>More info: <a href="https://stackoverflow.com/faq">https://stackoverflow.com/faq</a></p> </blockquote> <hr> <p>There are always features that would be useful in fringe scenarios, but for that very reason most people don't know them. I am asking for features that are not typically taught by the text books.</p> <p>What are the ones that you know?</p>
[ { "answer_id": 55112, "author": "Radu094", "author_id": 3263, "author_profile": "https://Stackoverflow.com/users/3263", "pm_score": 6, "selected": false, "text": "#ifdef DEBUG \n if (Context.Request.QueryString[\"DoTrace\"] == \"true\")\n {\n Trace.IsE...
2008/09/10
[ "https://Stackoverflow.com/questions/54929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/380/" ]
54,952
<p>We try to use Java and UTF-8 on Windows. The application writes logs on the console, and we would like to use UTF-8 for the logs as our application has internationalized logs.</p> <p>It is possible to configure the JVM so it generates UTF-8, using <code>-Dfile.encoding=UTF-8</code> as arguments to the JVM. It works fine, but the output on a Windows console is garbled.</p> <p>Then, we can set the code page of the console to 65001 (<code>chcp 65001</code>), but in this case, the <code>.bat</code> files do not work. This means that when we try to launch our application through our script (named start.bat), absolutely nothing happens. The command simple returns:</p> <pre><code>C:\Application&gt; chcp 65001 Activated code page: 65001 C:\Application&gt; start.bat C:\Application&gt; </code></pre> <p>But without <code>chcp 65001</code>, there is no problem, and the application can be launched.</p> <p>Any hints about that?</p>
[ { "answer_id": 55307, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 4, "selected": true, "text": "chcp 65001 && start.bat" }, { "answer_id": 265734, "author": "Renato Soffiatto", "author_id": 30477, "aut...
2008/09/10
[ "https://Stackoverflow.com/questions/54952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1430323/" ]
54,957
<p>I have lots and lots of data in various structures. Are there any better platforms other than Excel charts which can help me. </p> <p>thanks</p>
[ { "answer_id": 9612148, "author": "mikera", "author_id": 214010, "author_profile": "https://Stackoverflow.com/users/214010", "pm_score": 0, "selected": false, "text": "(view (histogram (sample-normal 1000)))\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5663/" ]
54,963
<p>I've got a lot of ugly code that looks like this:</p> <pre><code>if (!string.IsNullOrEmpty(ddlFileName.SelectedItem.Text)) results = results.Where(x =&gt; x.FileName.Contains(ddlFileName.SelectedValue)); if (chkFileName.Checked) results = results.Where(x =&gt; x.FileName == null); if (!string.IsNullOrEmpty(ddlIPAddress.SelectedItem.Text)) results = results.Where(x =&gt; x.IpAddress.Contains(ddlIPAddress.SelectedValue)); if (chkIPAddress.Checked) results = results.Where(x =&gt; x.IpAddress == null); ...etc. </code></pre> <p><code>results</code> is an <code>IQueryable&lt;MyObject&gt;</code>.<br> The idea is that for each of these innumerable dropdowns and checkboxes, if the dropdown has something selected, the user wants to match that item. If the checkbox is checked, the user wants specifically those records where that field is null or an empty string. (The UI doesn't let both be selected at the same time.) This all adds to the LINQ Expression which gets executed at the end, after we've added all the conditions.</p> <p>It <em>seems</em> like there ought to be some way to pull out an <code>Expression&lt;Func&lt;MyObject, bool&gt;&gt;</code> or two so that I can put the repeated parts in a method and just pass in what changes. I've done this in other places, but this set of code has me stymied. (Also, I'd like to avoid "Dynamic LINQ", because I want to keep things type-safe if possible.) Any ideas?</p>
[ { "answer_id": 54981, "author": "bdukes", "author_id": 2688, "author_profile": "https://Stackoverflow.com/users/2688", "pm_score": 0, "selected": false, "text": "results = results.Where(x => \n (string.IsNullOrEmpty(ddlFileName.SelectedItem.Text) || x.FileName.Contains(ddlFileName.Sel...
2008/09/10
[ "https://Stackoverflow.com/questions/54963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5486/" ]
54,966
<p>How would I go about replacing Windows Explorer with a third party tool such as TotalCommander, explorer++, etc?</p> <p>I would like to have one of those load instead of win explorer when I type "C:\directoryName" into the run window. Is this possible?</p>
[ { "answer_id": 55021, "author": "Judah Gabriel Himango", "author_id": 536, "author_profile": "https://Stackoverflow.com/users/536", "pm_score": 3, "selected": true, "text": "[HKEY_CLASSES_ROOT\\Directory\\shell]\n@=\"open_x2\"\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/54966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1385358/" ]
54,978
<p>My team has a command parsing library for console apps. Each team around us has their own as well. There isn't anything in the BCL so I suppose this is natural.</p> <p>I've looked at the the module in Mono, which seems solid, and the one on CodePlex looks fine as well. There are probably others out there that will work (and I would love to hear your suggestions).</p> <p>The real question is: how do I get my team, and others around us, to commit to just using one? </p>
[ { "answer_id": 65210, "author": "damageboy", "author_id": 9172, "author_profile": "https://Stackoverflow.com/users/9172", "pm_score": 0, "selected": false, "text": "var p = new OptionSet () {\n { \"file=\", v => data = v },<br>\n { \"v|verbose\", v => { ++verbose } },<br>\n ...
2008/09/10
[ "https://Stackoverflow.com/questions/54978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4593/" ]
54,989
<p>Is it possible to change the hostname in Windows 2003 from the command line with out-of-the-box tools?</p>
[ { "answer_id": 55004, "author": "GEOCHET", "author_id": 5640, "author_profile": "https://Stackoverflow.com/users/5640", "pm_score": 1, "selected": false, "text": "sNewName = \"put new name here\" \n\nSet oShell = CreateObject (\"WSCript.shell\" ) \n\nsCCS = \"HKLM\\SYSTEM\\CurrentControl...
2008/09/10
[ "https://Stackoverflow.com/questions/54989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1807/" ]
54,991
<p>When a user on our site loses his password and heads off to the Lost Password page we need to give him a new temporary password. I don't really mind how random this is, or if it matches all the "needed" strong password rules, all I want to do is give them a password that they can change later.</p> <p>The application is a Web application written in C#. so I was thinking of being mean and going for the easy route of using part of a Guid. i.e.</p> <pre><code>Guid.NewGuid().ToString("d").Substring(1,8) </code></pre> <p>Suggesstions? thoughts?</p>
[ { "answer_id": 54994, "author": "GEOCHET", "author_id": 5640, "author_profile": "https://Stackoverflow.com/users/5640", "pm_score": 5, "selected": false, "text": "///////////////////////////////////////////////////////////////////////////////\n// SAMPLE: Generates random password, which ...
2008/09/10
[ "https://Stackoverflow.com/questions/54991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/231/" ]
55,010
<p>Supposing you have a form that collects and submits sensitive information and you want to ensure it is never accessed via insecure (non-HTTPS) means, how might you best go about enforcing that policy?</p>
[ { "answer_id": 55024, "author": "Justin Voss", "author_id": 5616, "author_profile": "https://Stackoverflow.com/users/5616", "pm_score": 3, "selected": false, "text": "RewriteRule" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/55010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4061/" ]
55,013
<p>Is there ever a circumstance in which I would not want to use the <a href="http://msdn.microsoft.com/en-us/library/cb8x3kfz.aspx" rel="noreferrer"><code>AndAlso</code></a> operator rather than the <a href="http://msdn.microsoft.com/en-us/library/sdbcfyzh.aspx" rel="noreferrer"><code>And</code></a> operator? &hellip;or in which I would not want to use the <a href="http://msdn.microsoft.com/en-us/library/ea1sssb2.aspx" rel="noreferrer"><code>OrElse</code></a> operator rather than the <a href="http://msdn.microsoft.com/en-us/library/06s37a7f.aspx" rel="noreferrer"><code>Or</code></a> operator?</p>
[ { "answer_id": 55025, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 4, "selected": false, "text": "AndAlso" }, { "answer_id": 69841478, "author": "Andrew", "author_id": 6794075, "author_profile": "h...
2008/09/10
[ "https://Stackoverflow.com/questions/55013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
55,042
<p>I want to build a bot that asks someone a few simple questions and branches based on the answer. I realize parsing meaning from the human responses will be challenging, but how do you setup the program to deal with the "state" of the conversation?</p> <p>It will be a one-to-one conversation between a human and the bot.</p>
[ { "answer_id": 55053, "author": "argv0", "author_id": 5595, "author_profile": "https://Stackoverflow.com/users/5595", "pm_score": 6, "selected": true, "text": "import random, sys\n\nNONWORD = \"\\n\"\nSTARTKEY = NONWORD, NONWORD\nMAXGEN=1000\n\nclass MarkovChainer(object):\n def __ini...
2008/09/10
[ "https://Stackoverflow.com/questions/55042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337/" ]
55,054
<p>What’s the best way to capitalize the first letter of each word in a string in SQL Server.</p>
[ { "answer_id": 55057, "author": "Espo", "author_id": 2257, "author_profile": "https://Stackoverflow.com/users/2257", "pm_score": 7, "selected": true, "text": "CREATE FUNCTION [dbo].[InitCap] ( @InputString varchar(4000) ) \nRETURNS VARCHAR(4000)\nAS\nBEGIN\n\nDECLARE @Index INT\...
2008/09/10
[ "https://Stackoverflow.com/questions/55054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5170/" ]
55,056
<p>I'm building a Django project that needs search functionality, and until there's a <code>django.contrib.search</code>, I have to choose a search app. So, which is the best? By "best" I mean...</p> <ul> <li>easy to install / set up</li> <li>has a Django- or at least Python-friendly API</li> <li>can perform reasonably complex searches</li> </ul> <p>Here are some apps I've heard of, please suggest others if you know of any:</p> <ul> <li><a href="http://code.google.com/p/djangosearch/" rel="noreferrer">djangosearch</a></li> <li><a href="http://code.google.com/p/django-sphinx/" rel="noreferrer">django-sphinx</a></li> </ul> <p>I'd also like to avoid using a third-party search engine (like Google SiteSearch), because some of the data I'd like to index is for site members only and should not be public.</p>
[ { "answer_id": 55924, "author": "Garth Kidd", "author_id": 5700, "author_profile": "https://Stackoverflow.com/users/5700", "pm_score": 4, "selected": false, "text": "django.contrib.search" }, { "answer_id": 56885, "author": "Justin Voss", "author_id": 5616, "author_pr...
2008/09/10
[ "https://Stackoverflow.com/questions/55056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5616/" ]
55,060
<p>I'm pretty sure the answer to this question is no, but in case there's some PHP guru</p> <p>is it possible to write a function in a way where invalid arguments or non existent variables can be passed in and php will not error without the use of <code>'@'</code></p> <p>Much like empty and isset do. You can pass in a variable you just made up and it won't error.</p> <pre><code>ex: empty($someBogusVar); // no error myHappyFunction($someBogusVar); // Php warning / notice </code></pre>
[ { "answer_id": 55065, "author": "Adam Wright", "author_id": 1200, "author_profile": "https://Stackoverflow.com/users/1200", "pm_score": 1, "selected": false, "text": "function safeLookup($array, $key)\n{\n if (isset($array, $key))\n return $array[$key];\n\n return 0;\n}\n" }, { ...
2008/09/10
[ "https://Stackoverflow.com/questions/55060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5261/" ]
55,083
<p>Any ideas how to display a PDF file in a WPF Windows Application? </p> <hr> <p>I am using the following code to run the browser but the <code>Browser.Navigate</code> method does not do anything!</p> <pre><code>WebBrowser browser = new WebBrowser(); browser.Navigate("http://www.google.com"); this.AddChild(browser); // this is the System.Windows.Window </code></pre>
[ { "answer_id": 55177, "author": "Gulzar Nazim", "author_id": 4337, "author_profile": "https://Stackoverflow.com/users/4337", "pm_score": 4, "selected": true, "text": "private AxAcroPDFLib.AxAcroPDF axAcroPDF1;\nthis.axAcroPDF1 = new AxAcroPDFLib.AxAcroPDF();\nthis.axAcroPDF1.Dock = Syste...
2008/09/10
[ "https://Stackoverflow.com/questions/55083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3797/" ]
55,093
<p>I have a class to parse a matrix that keeps the result in an array member:</p> <pre><code>class Parser { ... double matrix_[4][4]; }; </code></pre> <p>The user of this class needs to call an API function (as in, a function I have no control over, so I can't just change its interface to make things work more easily) that looks like this:</p> <pre><code>void api_func(const double matrix[4][4]); </code></pre> <p>The only way I have come up with for the caller to pass the array result to the function is by making the member public:</p> <pre><code>void myfunc() { Parser parser; ... api_func(parser.matrix_); } </code></pre> <p>Is this the only way to do things? I'm astounded by how inflexible multidimensional arrays declared like this are. I thought <code>matrix_</code> would essentially be the same as a <code>double**</code> and I could cast (safely) between the two. As it turns out, I can't even find an <em>unsafe</em> way to cast between the things. Say I add an accessor to the <code>Parser</code> class:</p> <pre><code>void* Parser::getMatrix() { return (void*)matrix_; } </code></pre> <p>This will compile, but I can't use it, because there doesn't seem to be a way to cast back to the weirdo array type:</p> <pre><code> // A smorgasbord of syntax errors... api_func((double[][])parser.getMatrix()); api_func((double[4][4])parser.getMatrix()); api_func((double**)parser.getMatrix()); // cast works but it's to the wrong type </code></pre> <p>The error is:</p> <blockquote> <p>error C2440: 'type cast' : cannot convert from 'void *' to 'const double [4][4]'</p> </blockquote> <p>...with an intriguing addendum:</p> <blockquote> <p>There are no conversions to array types, although there are conversions to references or pointers to arrays</p> </blockquote> <p>I can't determine how to cast to a reference or pointer to array either, albeit that it probably won't help me here.</p> <p>To be sure, at this point the matter is purely academic, as the <code>void*</code> casts are hardly cleaner than a single class member left public!</p>
[ { "answer_id": 55118, "author": "Serafina Brocious", "author_id": 4977, "author_profile": "https://Stackoverflow.com/users/4977", "pm_score": 2, "selected": false, "text": "union matrix {\n double dflat[16];\n double dmatr[4][4];\n};\n" }, { "answer_id": 55149, "author"...
2008/09/10
[ "https://Stackoverflow.com/questions/55093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4790/" ]
55,099
<p>We have an intranet site backed by SVN, such that the site is a checkout out copy of the repository (working folder used only by IIS). Something on the site has been causing problems today, and I want to know how to find out what was checked out to that working folder in the last 48 hours.</p> <p><strong>Update:</strong> If there's an option I need to turn on to enable this in the future, what is it?</p> <p>Also, as a corollary question, if I have to use the file creation time, how can I do that quickly in a recursive manner for a large folder?</p> <hr> <p>If I have to check creation times, then <a href="https://stackoverflow.com/questions/56682/how-to-see-if-a-subfile-of-a-directory-has-changed">this question</a> will be helpful to the solution as well.</p>
[ { "answer_id": 55309, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 3, "selected": true, "text": "svn info" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/55099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3043/" ]
55,101
<p>I have a Linq query that I want to call from multiple places:</p> <pre><code>var myData = from a in db.MyTable where a.MyValue == "A" select new { a.Key, a.MyValue }; </code></pre> <p>How can I create a method, put this code in it, and then call it?</p> <pre><code>public ??? GetSomeData() { // my Linq query } </code></pre>
[ { "answer_id": 55110, "author": "Ryan Lanciaux", "author_id": 1385358, "author_profile": "https://Stackoverflow.com/users/1385358", "pm_score": 3, "selected": false, "text": "IQueryable" }, { "answer_id": 55120, "author": "Gulzar Nazim", "author_id": 4337, "author_pro...
2008/09/10
[ "https://Stackoverflow.com/questions/55101", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3047/" ]
55,113
<p>Word 2007 saves its documents in .docx format which is really a zip file with a bunch of stuff in it including an xml file with the document.</p> <p>I want to be able to take a .docx file and drop it into a folder in my asp.net web app and have the code open the .docx file and render the (xml part of the) document as a web page.</p> <p>I've been searching the web for more information on this but so far haven't found much. My questions are:</p> <ol> <li>Would you (a) use XSLT to transform the XML to HTML, or (b) use xml manipulation libraries in .net (such as XDocument and XElement in 3.5) to convert to HTML or (c) other?</li> <li>Do you know of any open source libraries/projects that have done this that I could use as a starting point? </li> </ol> <p>Thanks!</p>
[ { "answer_id": 12257270, "author": "raghava", "author_id": 1645149, "author_profile": "https://Stackoverflow.com/users/1645149", "pm_score": 1, "selected": false, "text": ".docx" }, { "answer_id": 27985333, "author": "messed-up", "author_id": 4421126, "author_profile"...
2008/09/10
[ "https://Stackoverflow.com/questions/55113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
55,114
<p>Ok, so I'm an idiot. </p> <p>So I was working on a regex that took way to long to craft. After perfecting it, I upgraded my work machine with a blazing fast hard drive and realized that I never saved the regex anywhere and simply used RegexBuddy's autosave to store it. Dumb dumb dumb. </p> <p>I sent a copy of the regex to a coworker but now he can't find it (or the record of our communication). My best hope of finding the regex is to find it in RegexBuddy on the old hard drive. RegexBuddy automatically saves whatever you were working on each time you close it. I've done some preliminary searches to try to determine where it actually saves that working data but I'm having no success. </p> <p>This question is the result of my dumb behavior but I thought it was a good chance to finally ask a question here. </p>
[ { "answer_id": 55182, "author": "Mark Biek", "author_id": 305, "author_profile": "https://Stackoverflow.com/users/305", "pm_score": 4, "selected": true, "text": "HKEY_CURRENT_USER\\Software\\JGsoft\\RegexBuddy3\\History\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/55114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1116922/" ]
55,130
<p>This is a segment of code from an app I've inherited, a user got a Yellow screen of death:</p> <blockquote> <p>Object reference not set to an instance of an object</p> </blockquote> <p>on the line: </p> <pre><code>bool l_Success ... </code></pre> <p>Now I'm 95% sure the faulty argument is <code>ref l_Monitor</code> which is very weird considering the object is instantiated a few lines before. Anyone have a clue why it would happen? Note that I have seen the same issue pop up in other places in the code.</p> <pre><code>IDMS.Monitor l_Monitor = new IDMS.Monitor(); l_Monitor.LogFile.Product_ID = "SE_WEB_APP"; if (m_PermType_RadioButtonList.SelectedIndex == -1) { l_Monitor.LogFile.Log( Nortel.IS.IDMS.LogFile.MessageTypes.ERROR, "No permission type selected" ); return; } bool l_Success = SE.UI.Utilities.GetPermissionList( ref l_Monitor, ref m_CPermissions_ListBox, (int)this.ViewState["m_Account_Share_ID"], (m_PermFolders_DropDownList.Enabled) ? m_PermFolders_DropDownList.SelectedItem.Value : "-1", (SE.Types.PermissionType)m_PermType_RadioButtonList.SelectedIndex, (SE.Types.PermissionResource)m_PermResource_RadioButtonList.SelectedIndex); </code></pre>
[ { "answer_id": 84541, "author": "Beriadan", "author_id": 1983, "author_profile": "https://Stackoverflow.com/users/1983", "pm_score": 0, "selected": false, "text": "NullReferenceException" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/55130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1983/" ]
55,159
<p>In SQL Server 2005 I have an "id" field in a table that has the "Is Identity" property set to 'Yes'. So, when an Insert is executed on that table the "id" gets set automatically to the next incrementing integer. Is there an easy way when the Insert is executed to get what the "id" was set to without having to do a Select statement right after the Insert?</p> <blockquote> <p>duplicate of:<br> <a href="https://stackoverflow.com/questions/42648/best-way-to-get-identity-of-inserted-row">Best way to get identity of inserted row?</a></p> </blockquote>
[ { "answer_id": 55172, "author": "Josh Hinman", "author_id": 2527, "author_profile": "https://Stackoverflow.com/users/2527", "pm_score": 6, "selected": true, "text": "command.CommandText = \"INSERT INTO [Employee] (Name) VALUES (@Name); SELECT SCOPE_IDENTITY()\";\nint id = (int)command.Ex...
2008/09/10
[ "https://Stackoverflow.com/questions/55159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1096640/" ]
55,180
<p>Dictionaries unlike lists are not ordered (and do not have the 'sort' attribute). Therefore, you can not rely on getting the items in the same order when first added. </p> <p>What is the easiest way to loop through a dictionary containing strings as the key value and retrieving them in ascending order by key?</p> <p>For example, you had this:</p> <pre><code>d = {'b' : 'this is b', 'a': 'this is a' , 'c' : 'this is c'} </code></pre> <p>I want to print the associated values in the following sequence sorted by key:</p> <pre><code>this is a this is b this is c </code></pre>
[ { "answer_id": 55188, "author": "Serafina Brocious", "author_id": 4977, "author_profile": "https://Stackoverflow.com/users/4977", "pm_score": 2, "selected": false, "text": "keys = list(d.keys())\nkeys.sort()\nfor key in keys:\n print d[key]\n" }, { "answer_id": 55193, "aut...
2008/09/10
[ "https://Stackoverflow.com/questions/55180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
55,203
<p>I have an asp.net web page written in C#.<br> Using some javascript I popup another .aspx page which has a few controls that are filled in and from which I create a small snippet of text.<br> When the user clicks OK on that dialog box I want to insert that piece of text into a textbox on the page that initial "popped up" the dialog/popup page. </p> <p>I'm guessing that this will involve javascript which is not a strong point of mine.</p> <p>How do I do this?</p>
[ { "answer_id": 55242, "author": "GateKiller", "author_id": 383, "author_profile": "https://Stackoverflow.com/users/383", "pm_score": 4, "selected": true, "text": "parent.opener.document.getElemenyById('ParentTextBox').value = \"New Text\";\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/55203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
55,206
<p>What is the operator precedence order in Visual Basic 6.0 (VB6)?</p> <p>In particular, for the logical operators.</p>
[ { "answer_id": 55215, "author": "Jeremy", "author_id": 1114, "author_profile": "https://Stackoverflow.com/users/1114", "pm_score": 5, "selected": true, "text": "^" }, { "answer_id": 55260, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stacko...
2008/09/10
[ "https://Stackoverflow.com/questions/55206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5472/" ]
55,210
<p>What would be the best strategy to generate anagrams.</p> <blockquote> <pre><code>An anagram is a type of word play, the result of rearranging the letters of a word or phrase to produce a new word or phrase, using all the original letters exactly once; ex. </code></pre> <ul> <li><strong>Eleven plus two</strong> is anagram of <strong><em>Twelve plus one</em></strong> </li> <li><strong>A decimal point</strong> is anagram of <strong><em>I'm a dot in place</em></strong></li> <li><strong>Astronomers</strong> is anagram of <strong><em>Moon starers</em></strong></li> </ul> </blockquote> <p>At first it looks straightforwardly simple, just to jumble the letters and generate all possible combinations. But what would be the efficient approach to generate only the words in dictionary.</p> <p>I came across this page, <a href="http://lojic.com/blog/2007/10/22/solving-anagrams-in-ruby/" rel="noreferrer">Solving anagrams in Ruby</a>. </p> <p>But what are your ideas?</p>
[ { "answer_id": 55255, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stackoverflow.com/users/4435", "pm_score": 1, "selected": false, "text": "lettermap[set(a,e,d,f)] = { \"deaf\", \"fade\" }\n" }, { "answer_id": 55339, "author": "dbkk", "author_id": 838...
2008/09/10
[ "https://Stackoverflow.com/questions/55210", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123/" ]
55,218
<p>I looking for a way, specifically in PHP that I will be guaranteed to always get a unique key.</p> <p>I have done the following:</p> <pre><code>strtolower(substr(crypt(time()), 0, 7)); </code></pre> <p>But I have found that once in a while I end up with a duplicate key (rarely, but often enough).</p> <p>I have also thought of doing:</p> <pre><code>strtolower(substr(crypt(uniqid(rand(), true)), 0, 7)); </code></pre> <p>But according to the PHP website, uniqid() could, if uniqid() is called twice in the same microsecond, it could generate the same key. I'm thinking that the addition of rand() that it rarely would, but still possible.</p> <p>After the lines mentioned above I am also remove characters such as L and O so it's less confusing for the user. This maybe part of the cause for the duplicates, but still necessary.</p> <p>One option I have a thought of is creating a website that will generate the key, storing it in a database, ensuring it's completely unique.</p> <p>Any other thoughts? Are there any websites out there that already do this that have some kind of API or just return the key. I found <a href="http://userident.com" rel="noreferrer">http://userident.com</a> but I'm not sure if the keys will be completely unique.</p> <p>This needs to run in the background without any user input.</p>
[ { "answer_id": 55233, "author": "Mark Biek", "author_id": 305, "author_profile": "https://Stackoverflow.com/users/305", "pm_score": 0, "selected": false, "text": "$this->password = '';\n\nfor($i=0; $i<10; $i++)\n{\n if($i%2 == 0)\n $this->password .= chr(rand(65,90));\n if($...
2008/09/10
[ "https://Stackoverflow.com/questions/55218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441/" ]
55,270
<p>I have some code that modifies a value that several controls in other update panels are bound to. When this event handler fires, I'd like it to force the other update panels to refresh as well, so they can rebind.</p> <p>Is this possible?</p> <p>Edit: </p> <p>To clarify, I have an update panel in one user control, the other update panels are in other user controls, so they can't see each other unless I were to expose some custom properties and use findControl etc etc...</p> <p>Edit Again:</p> <p>Here is what I came up with:</p> <pre><code>public void Update() { recursiveUpdate(this); } private void recursiveUpdate(Control control) { foreach (Control c in control.Controls) { if (c is UpdatePanel) { ((UpdatePanel)c).Update(); } if (c.HasControls()) { recursiveUpdate(c); } } } </code></pre> <p>I had 3 main user controls that were full of update panels, these controls were visible to the main page, so I added an Update method there that called Update on those three.</p> <p>In my triggering control, I just cast this.Page into the currentpage and called Update.</p> <p>Edit:</p> <p>AARRGGGG!</p> <p>While the update panels refresh, it does not call Page_Load within the subcontrols in them...What do I do now!</p>
[ { "answer_id": 23698230, "author": "ravenx30", "author_id": 3515281, "author_profile": "https://Stackoverflow.com/users/3515281", "pm_score": 0, "selected": false, "text": "PresenterClass.AttachInterface(mIOrder);\nPresenterClass.DoSomeCalulation();\nPresenterClass.drawPanel(1);\nPresent...
2008/09/10
[ "https://Stackoverflow.com/questions/55270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
55,296
<p>I'm looking to implement httpOnly in my legacy ASP classic sites. Anyone knows how to do it?</p>
[ { "answer_id": 55389, "author": "Aaron Wagner", "author_id": 3909, "author_profile": "https://Stackoverflow.com/users/3909", "pm_score": 5, "selected": true, "text": "Response.AddHeader \"Set-Cookie\", \"mycookie=yo; HttpOnly\"\n" }, { "answer_id": 14818679, "author": "Brian ...
2008/09/10
[ "https://Stackoverflow.com/questions/55296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2385/" ]
55,297
<p>Currently I run an classic (old) ASP webpage with recordset object used directly in bad old spagethi code fasion.</p> <p>I'm thinking of implementing a data layer in asp.net as web serivce to improve manageability. This is also a first step towards upgrading the website to asp.net. The site itself remains ASP for the moment...</p> <p>Can anybody recommend a good way of replacing the recordset object type with a web service compatible type (like an array or something)? What do I replace below with?:</p> <pre><code>set objRS = oConn.execute(SQL) while not objRS.eof ... name = Cstr(objRS(1)) ... wend </code></pre> <p>and also mutliple recordsets can be replaced with? I'm talking :</p> <pre><code> set objRS = objRs.nextRecordset </code></pre> <p>Anybody went through this and can recommend?</p> <p><strong><em>@AdditionalInfo - you asked for it :-)</em></strong></p> <p>Let me start at the beginning. <strong>Existing Situation is</strong>: I have an old ASP website with classical hierachical content (header, section, subsection, content) pulled out of database via stored procedures and content pages are in database also (a link to html file).</p> <p>Now bad thing is, ASP code everywhere spread over many .asp files all doing their own database connections, reading, writing (u have to register for content). Recently we had problems with SQL injection attacks so I was called to fix it.</p> <p>I <em>could</em> go change all the .asp pages to prevent sql injection but that would be madness. So I thought build a data layer - all pages using this layer to access database. Once place to fix and update db access code.</p> <p>Coming to that decision I thought asp.net upgrade isn'f far away, why not start using asp.net for the data layer? This way it can be re-used when upgrading the site.</p> <p>That brings me to the questions above!</p>
[ { "answer_id": 55358, "author": "Euro Micelli", "author_id": 2230, "author_profile": "https://Stackoverflow.com/users/2230", "pm_score": 2, "selected": false, "text": "MyDataWebService ws = new MyDataWebService();\nforeach(DataItem item in myData)\n{\n ws.Insert(item);\n}\n" }, { ...
2008/09/10
[ "https://Stackoverflow.com/questions/55297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/925/" ]
55,313
<p>One thing I really miss about Java is the tool support. FindBugs, Checkstyle and PMD made for a holy trinity of code quality metrics and automatic bug checking. </p> <p>Is there anything that will check for simple bugs and / or style violations of Ruby code? Bonus points if I can adapt it for frameworks such as Rails so that Rails idioms are adhered to.</p>
[ { "answer_id": 55357, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 2, "selected": false, "text": "NamedLikeThis" }, { "answer_id": 16063567, "author": "Bozhidar Batsov", "author_id": 291550, "author_...
2008/09/10
[ "https://Stackoverflow.com/questions/55313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5266/" ]
55,317
<p>When objects from a CallList intersect the near plane I get a flicker..., what can I do?</p> <p>Im using OpenGL and SDL.</p> <p>Yes it is double buffered.</p>
[ { "answer_id": 55331, "author": "epatel", "author_id": 842, "author_profile": "https://Stackoverflow.com/users/842", "pm_score": 0, "selected": false, "text": " glPolygonOffset is useful for rendering hidden-line images,\n for applying decals to surfaces, and for rendering solids\n wi...
2008/09/10
[ "https://Stackoverflow.com/questions/55317", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44972/" ]
55,342
<p>I need to quickly (and forcibly) kill off all external sessions connecting to my oracle database without the supervision of and administrator.</p> <p>I don't want to just lock the database and let the users quit gracefully.</p> <p>How would I script this?</p>
[ { "answer_id": 55359, "author": "BIBD", "author_id": 685, "author_profile": "https://Stackoverflow.com/users/685", "pm_score": 7, "selected": true, "text": "ALTER SYSTEM ENABLE RESTRICTED SESSION;\n\nbegin \n for x in ( \n select Sid, Serial#, machine, program \n ...
2008/09/10
[ "https://Stackoverflow.com/questions/55342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/685/" ]
55,360
<p>The __doPostBack is not working in firefox 3 (have not checked 2). Everything is working great in IE 6&amp;7 and it even works in Chrome??</p> <p>It's a simple asp:LinkButton with an OnClick event</p> <pre><code>&lt;asp:LinkButton ID="DeleteAllPicturesLinkButton" Enabled="False" OnClientClick="javascript:return confirm('Are you sure you want to delete all pictures? \n This action cannot be undone.');" OnClick="DeletePictureLinkButton_Click" CommandName="DeleteAll" CssClass="button" runat="server"&gt; </code></pre> <p>The javascript confirm is firing so I know the javascript is working, it's specirically the __doPostBack event. There is a lot more going on on the page, just didn't know if it's work it to post the entire page.</p> <p>I enable the control on the page load event.</p> <p>Any ideas?</p> <hr> <p>I hope this is the correct way to do this, but I found the answer. I figured I'd put it up here rather then in a stackoverflow "answer"</p> <p>Seems it had something to do with nesting ajax toolkit UpdatePanel. When I removed the top level panel it was fixed.</p> <p>Hope this helps if anyone else has the same problem. I still don't know what specifically was causing the problem, but that was the solution for me.</p>
[ { "answer_id": 55367, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 1, "selected": false, "text": "if (!confirm(...)) { return false; } _doPostBack(...);\n" }, { "answer_id": 55379, "author": "Dan Williams", ...
2008/09/10
[ "https://Stackoverflow.com/questions/55360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4230/" ]
55,365
<p>I use Emacs primarily for coding Python but sometimes I use IDLE. Is there a way to change the key bindings easily in IDLE to match Emacs?</p>
[ { "answer_id": 55493, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "XKeymacs" }, { "answer_id": 85113, "author": "Ray", "author_id": 4872, "author_profile": "https://Stackover...
2008/09/10
[ "https://Stackoverflow.com/questions/55365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
55,375
<p>I know this rather goes against the idea of enums, but is it possible to extend enums in C#/Java? I mean "extend" in both the sense of adding new values to an enum, but also in the OO sense of inheriting from an existing enum. </p> <p>I assume it's not possible in Java, as it only got them fairly recently (Java 5?). C# seems more forgiving of people that want to do crazy things, though, so I thought it might be possible some way. Presumably it could be hacked up via reflection (not that you'd every actually use that method)?</p> <p>I'm not necessarily interested in implementing any given method, it just provoked my curiosity when it occurred to me :-)</p>
[ { "answer_id": 55390, "author": "McKenzieG1", "author_id": 3776, "author_profile": "https://Stackoverflow.com/users/3776", "pm_score": 2, "selected": false, "text": "Enum.GetNames()" }, { "answer_id": 55486, "author": "tsimon", "author_id": 1685, "author_profile": "ht...
2008/09/10
[ "https://Stackoverflow.com/questions/55375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5296/" ]
55,386
<p>I'm using Windows and I'm trying to get ANT to work.</p> <p>When I do an ant build from the command line, I get: <code>C:\dev\Projects\springapp\${%ANT_HOME%}\lib not found.</code></p> <p>I look into the <code>build.xml</code> file and I find: <code>appserver.home=${user.home}/apache-tomcat-6.0.14</code> (which I just copied and pasted straight from a tutorial)</p> <p>I changed it to:</p> <p><code>appserver.home="C:\Program Files\Apache Software Foundation\Tomcat 6.0"</code></p> <p>but now I get:</p> <p><code>C:\dev\Projects\springapp\"C:Program FilesApache Software FoundationTomcat 6.0"\lib not found.</code></p> <p>It seems like the white space in Program Files and Tomcat 6.0 are causing the build to fail. How do you deal with these in xml files without re-creating the directory with a path with no white space?</p>
[ { "answer_id": 55426, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 4, "selected": false, "text": "appserver.home=\"C:\\\\Program Files\\\\Apache Software Foundation\\\\Tomcat 6.0\"\n" }, { "answer_id": 56911...
2008/09/10
[ "https://Stackoverflow.com/questions/55386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
55,391
<p>I want to grab the value of a hidden input field in HTML.</p> <pre><code>&lt;input type="hidden" name="fooId" value="12-3456789-1111111111" /&gt; </code></pre> <p>I want to write a regular expression in Python that will return the value of <code>fooId</code>, given that I know the line in the HTML follows the format</p> <pre><code>&lt;input type="hidden" name="fooId" value="**[id is here]**" /&gt; </code></pre> <p>Can someone provide an example in Python to parse the HTML for the value?</p>
[ { "answer_id": 55399, "author": "Pat", "author_id": 238, "author_profile": "https://Stackoverflow.com/users/238", "pm_score": 0, "selected": false, "text": "/<input type=\"hidden\" name=\"fooId\" value=\"([\\d-]+)\" \\/>/\n" }, { "answer_id": 55404, "author": "Serafina Brocio...
2008/09/10
[ "https://Stackoverflow.com/questions/55391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5675/" ]
55,403
<p>I am interested to know whether anyone has written an application that takes advantage of a <a href="http://en.wikipedia.org/wiki/GPGPU" rel="nofollow noreferrer">GPGPU</a> by using, for example, <a href="http://www.nvidia.com/object/cuda_get.html" rel="nofollow noreferrer">nVidia CUDA</a>. If so, what issues did you find and what performance gains did you achieve compared with a standard CPU?</p>
[ { "answer_id": 853110, "author": "Edison Gustavo Muenz", "author_id": 61915, "author_profile": "https://Stackoverflow.com/users/61915", "pm_score": 0, "selected": false, "text": "if (false){}" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/55403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3305/" ]
55,411
<p>Running into a problem where on certain servers we get an error that the directory name is invalid when using Path.GetTempFileName. Further investigation shows that it is trying to write a file to c:\Documents and Setting\computername\aspnet\local settings\temp (found by using Path.GetTempPath). This folder exists so I'm assuming this must be a permissions issue with respect to the asp.net account. </p> <p>I've been told by some that Path.GetTempFileName should be pointing to C:\Windows\Microsoft.NET\Framework\v2.0.50727\temporaryasp.net files.</p> <p>I've also been told that this problem may be due to the order in which IIS and .NET where installed on the server. I've done the typical 'aspnet_regiis -i' and checked security on the folders etc. At this point I'm stuck.</p> <p>Can anyone shed some light on this?</p> <p>**Update:**Turns out that providing 'IUSR_ComputerName' access to the folder does the trick. Is that the correct procedure? I don't seem to recall doing that in the past, and obviously, want to follow best practices to maintain security. This is, after all, part of a file upload process.</p>
[ { "answer_id": 60353, "author": "Euro Micelli", "author_id": 2230, "author_profile": "https://Stackoverflow.com/users/2230", "pm_score": 5, "selected": true, "text": "<identity impersonate=\"true\" />\n" } ]
2008/09/10
[ "https://Stackoverflow.com/questions/55411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5678/" ]
55,434
<p>This question is the other side of the question asking, "<a href="https://stackoverflow.com/questions/11/how-do-i-calculate-relative-time">How do I calculate relative time?</a>".</p> <p>Given some human input for a relative time, how can you parse it? By default you would offset from <code>DateTime.Now()</code>, but could optionally offset from another <code>DateTime</code>.</p> <p>(Prefer answers in C#)</p> <p>Example input:</p> <ul> <li>"in 20 minutes"</li> <li>"5 hours ago"</li> <li>"3h 2m"</li> <li>"next week"</li> </ul> <p><strong>Edit:</strong> Let's suppose we can define some limits on the input. This sort of code would be a useful thing to have out on the web.</p>
[ { "answer_id": 55469, "author": "dF.", "author_id": 3002, "author_profile": "https://Stackoverflow.com/users/3002", "pm_score": 3, "selected": false, "text": "* Aug 25 5pm\n* 5pm August 25\n* next saturday\n...\n* tomorrow\n* next thursday at 4pm\n* at 4pm\n* eod\n* in 5 minutes\n* 5 min...
2008/09/10
[ "https://Stackoverflow.com/questions/55434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337/" ]
55,440
<p>I've a class which is a wrapper class(serves as a common interface) around another class implementing the functionality required. So my code looks like this.</p> <pre><code>template&lt;typename ImplemenationClass&gt; class WrapperClass { // the code goes here } </code></pre> <p>Now, how do I make sure that <code>ImplementationClass</code> can be derived from a set of classes only, similar to java's generics</p> <pre><code>&lt;? extends BaseClass&gt; </code></pre> <p>syntax?</p>
[ { "answer_id": 55446, "author": "Daniel James", "author_id": 2434, "author_profile": "https://Stackoverflow.com/users/2434", "pm_score": 4, "selected": true, "text": "#include <boost/utility/enable_if.hpp>\n#include <boost/type_traits/is_base_of.hpp>\n\nstruct base {};\n\ntemplate <typen...
2008/09/10
[ "https://Stackoverflow.com/questions/55440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/108465/" ]
55,449
<p>I sometimes use the feature 'Reconcile Offline Work...' found in Perforce's P4V IDE to sync up any files that I have been working on while disconnected from the P4 depot. It launches another window that performs a 'Folder Diff'.</p> <p>I have files I never want to check in to source control (like ones found in bin folder such as DLLs, code generated output, etc.) Is there a way to filter those files/folders out from appearing as "new" that might be added. They tend to clutter up the list of files that I am actually interested in. Does P4 have the equivalent of Subversion's 'ignore file' feature? </p>
[ { "answer_id": 55509, "author": "raven", "author_id": 4228, "author_profile": "https://Stackoverflow.com/users/4228", "pm_score": 7, "selected": true, "text": "P4IGNORE" }, { "answer_id": 56498, "author": "Mark", "author_id": 4405, "author_profile": "https://Stackover...
2008/09/10
[ "https://Stackoverflow.com/questions/55449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
55,482
<p>I'm able to successfully uninstall a third-party application via the command line and via a custom Inno Setup installer. </p> <p>Command line Execution:</p> <pre><code>MSIEXEC.exe /x {14D74337-01C2-4F8F-B44B-67FC613E5B1F} /qn </code></pre> <p>Inno Setup Command:</p> <pre><code>[Run] Filename: msiexec.exe; Flags: runhidden waituntilterminated; Parameters: "/x {{14D74337-01C2-4F8F-B44B-67FC613E5B1F} /qn"; StatusMsg: "Uninstalling Service..."; </code></pre> <p>I am also able to uninstall the application programmatically when executing the following C# code in debug mode.</p> <p>C# Code:</p> <pre><code>string fileName = "MSIEXEC.exe"; string arguments = "/x {14D74337-01C2-4F8F-B44B-67FC613E5B1F} /qn"; ProcessStartInfo psi = new ProcessStartInfo(fileName, arguments) { CreateNoWindow = true, UseShellExecute = false, RedirectStandardOutput = true }; Process process = Process.Start(psi); string errorMsg = process.StandardOutput.ReadToEnd(); process.WaitForExit(); </code></pre> <p>The same C# code, however, produces the following failure output when run as a compiled, deployed Windows Service: </p> <pre><code>"This action is only valid for products that are currently installed." </code></pre> <p>Additional Comments:</p> <ul> <li>The Windows Service which is issuing the uninstall command is running on the same machine as the code being tested in Debug Mode. The Windows Service is running/logged on as the Local system account. </li> <li>I have consulted my application logs and I have validated that the executed command arguments are thhe same in both debug and release mode.</li> <li>I have consulted the Event Viewer but it doesn't offer any clues.</li> </ul> <p>Thoughts? Any help would be greatly appreciated. Thanks.</p>
[ { "answer_id": 55496, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 2, "selected": false, "text": "c:\\windows\\temp" }, { "answer_id": 55571, "author": "saschabeaumont", "author_id": 592, "author_pro...
2008/09/10
[ "https://Stackoverflow.com/questions/55482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4115/" ]
55,502
<p>I have an object in a multi-threaded environment that maintains a collection of information, e.g.:</p> <pre><code>public IList&lt;string&gt; Data { get { return data; } } </code></pre> <p>I currently have <code>return data;</code> wrapped by a <code>ReaderWriterLockSlim</code> to protect the collection from sharing violations. However, to be doubly sure, I'd like to return the collection as read-only, so that the calling code is unable to make changes to the collection, only view what's already there. Is this at all possible? </p>
[ { "answer_id": 55661, "author": "nedruod", "author_id": 5504, "author_profile": "https://Stackoverflow.com/users/5504", "pm_score": 4, "selected": false, "text": "IEnumerable<string>" }, { "answer_id": 59545, "author": "Daniel Fortunov", "author_id": 5975, "author_pro...
2008/09/10
[ "https://Stackoverflow.com/questions/55502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5296/" ]
55,503
<p>I have a main asp.net app, which is written in asp.net 1.1. Runnning underneath the application are several 2.0 apps. To completely logout a user can I just logout of the 1.1 app with FormsAuthentication.SignOut or is it more complicated than that?</p>
[ { "answer_id": 55575, "author": "Dale Ragan", "author_id": 1117, "author_profile": "https://Stackoverflow.com/users/1117", "pm_score": 4, "selected": true, "text": "<authentication mode=\"Forms\">\n <forms name=\".cookiename\"\n loginUrl=\"~/Login.aspx\" \n timeout...
2008/09/10
[ "https://Stackoverflow.com/questions/55503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4888/" ]
55,506
<p>As part of my integration strategy, I have a few SQL scripts that run in order to update the database. The first thing all of these scripts do is check to see if they need to run, e.g.:</p> <pre><code>if @version &lt;&gt; @expects begin declare @error varchar(100); set @error = 'Invalid version. Your version is ' + convert(varchar, @version) + '. This script expects version ' + convert(varchar, @expects) + '.'; raiserror(@error, 10, 1); end else begin ...sql statements here... end </code></pre> <p>Works great! Except if I need to add a stored procedure. The "create proc" command must be the only command in a batch of sql commands. Putting a "create proc" in my IF statement causes this error:</p> <pre> 'CREATE/ALTER PROCEDURE' must be the first statement in a query batch. </pre> <p>Ouch! How do I put the CREATE PROC command in my script, and have it only execute if it needs to?</p>
[ { "answer_id": 55546, "author": "Josh Hinman", "author_id": 2527, "author_profile": "https://Stackoverflow.com/users/2527", "pm_score": 6, "selected": true, "text": "if @version <> @expects\n begin\n ...snip...\n end\nelse\n begin\n exec('CREATE PROC MyProc AS SELE...
2008/09/10
[ "https://Stackoverflow.com/questions/55506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2527/" ]
55,510
<p>I'm quite confident that globally declared variables get allocated (and initialized, if applicable) at program start time.</p> <pre><code>int globalgarbage; unsigned int anumber = 42; </code></pre> <p>But what about static ones defined within a function?</p> <pre><code>void doSomething() { static bool globalish = true; // ... } </code></pre> <p>When is the space for <code>globalish</code> allocated? I'm guessing when the program starts. But does it get initialized then too? Or is it initialized when <code>doSomething()</code> is first called?</p>
[ { "answer_id": 55548, "author": "Adam Pierce", "author_id": 5324, "author_profile": "https://Stackoverflow.com/users/5324", "pm_score": 8, "selected": true, "text": "include <iostream>\n#include <string>\n\nusing namespace std;\n\nclass test\n{\npublic:\n test(const char *name)\n ...
2008/09/10
[ "https://Stackoverflow.com/questions/55510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4790/" ]
55,517
<p>We are getting very slow compile times, which can take upwards of 20+ minutes on dual core 2GHz, 2G Ram machines.</p> <p>A lot of this is due to the size of our solution which has grown to 70+ projects, as well as VSS which is a bottle neck in itself when you have a lot of files. (swapping out VSS is not an option unfortunately, so I don't want this to descend into a VSS bash)</p> <p>We are looking at merging projects. We are also looking at having multiple solutions to achieve greater separation of concerns and quicker compile times for each element of the application. This I can see will become a DLL hell as we try to keep things in synch.</p> <p>I am interested to know how other teams have dealt with this scaling issue, what do you do when your code base reaches a critical mass that you are wasting half the day watching the status bar deliver compile messages.</p> <p><strong>UPDATE</strong> I neglected to mention this is a C# solution. Thanks for all the C++ suggestions, but it's been a few years since I've had to worry about headers.</p> <p><strong>EDIT:</strong></p> <p>Nice suggestions that have helped so far (not saying there aren't other nice suggestions below, just what has helped)</p> <ul> <li>New 3GHz laptop - the power of lost utilization works wonders when whinging to management <li>Disable Anti Virus during compile <li>'Disconnecting' from VSS (actually the network) during compile - I may get us to remove VS-VSS integration altogether and stick to using the VSS UI </ul> <p>Still not rip-snorting through a compile, but every bit helps.</p> <p>Orion did mention in a comment that generics may have a play also. From my tests there does appear to be a minimal performance hit, but not high enough to sure - compile times can be inconsistent due to disc activity. Due to time limitations, my tests didn't include as many Generics, or as much code, as would appear in live system, so that may accumulate. I wouldn't avoid using generics where they are supposed to be used, just for compile time performance</p> <p><strong>WORKAROUND</strong></p> <p>We are testing the practice of building new areas of the application in new solutions, importing in the latest dlls as required, them integrating them into the larger solution when we are happy with them.</p> <p>We may also do them same to existing code by creating temporary solutions that just encapsulate the areas we need to work on, and throwing them away after reintegrating the code. We need to weigh up the time it will take to reintegrate this code against the time we gain by not having Rip Van Winkle like experiences with rapid recompiling during development.</p>
[ { "answer_id": 55542, "author": "Daniel Auger", "author_id": 1644, "author_profile": "https://Stackoverflow.com/users/1644", "pm_score": 1, "selected": false, "text": "<compilation defaultLanguage=\"c#\" debug=\"true\" batch=\"true\" > \n" }, { "answer_id": 55625, "author": ...
2008/09/10
[ "https://Stackoverflow.com/questions/55517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5302/" ]
55,532
<p>This came up from <a href="https://stackoverflow.com/questions/55093/how-to-deal-with-arrays-declared-on-the-stack-in-c#55183">this answer to a previous question of mine</a>. Is it guaranteed for the compiler to treat <code>array[4][4]</code> the same as <code>array[16]</code>?</p> <p>For instance, would either of the below calls to <code>api_func()</code> be safe?</p> <pre><code>void api_func(const double matrix[4][4]); // ... { typedef double Matrix[4][4]; double* array1 = new double[16]; double array2[16]; // ... api_func(reinterpret_cast&lt;Matrix&amp;&gt;(array1)); api_func(reinterpret_cast&lt;Matrix&amp;&gt;(array2)); } </code></pre>
[ { "answer_id": 55660, "author": "Derek Park", "author_id": 872, "author_profile": "https://Stackoverflow.com/users/872", "pm_score": 3, "selected": true, "text": "sizeof" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/55532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4790/" ]
55,556
<p>I need to generate some passwords, I want to avoid characters that can be confused for each other. Is there a definitive list of characters I should avoid? my current list is</p> <p>il10o8B3Evu![]{}</p> <p>Are there any other pairs of characters that are easy to confuse? for special characters I was going to limit myself to those under the number keys, though I know that this differs depending on your keyboards nationality!</p> <p>As a rider question, I would like my passwords to be 'wordlike'do you have a favoured algorithm for that?</p> <p>Thanks :)</p>
[ { "answer_id": 55634, "author": "dF.", "author_id": 3002, "author_profile": "https://Stackoverflow.com/users/3002", "pm_score": 7, "selected": true, "text": "!#%+23456789:=?@ABCDEFGHJKLMNPRS\nTUVWXYZabcdefghijkmnopqrstuvwxyz\n" }, { "answer_id": 57452, "author": "James B", ...
2008/09/11
[ "https://Stackoverflow.com/questions/55556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5552/" ]
55,572
<p>I've only recently started working with asp.net and c#. Is there a standard practice set of web.config settings for a live final website? There seem to be a ton of options available and I'm looking to streamline performance, close possible security holes and other unnecessary options. </p>
[ { "answer_id": 55595, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 1, "selected": false, "text": "<" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/55572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5433/" ]
55,574
<p>As it stands now, I'm a Java and C# developer. The more and more I look at Ruby on Rails, the more I really want to learn it. </p> <p>What have you found to be the best route to learn RoR? Would it be easier to develop on Windows, or should I just run a virtual machine with Linux? </p> <p>Is there an IDE that can match the robustness of Visual Studio? Any programs to develop that give a good overhead of what to do? Any good books? </p> <p>Seriously, any tips/tricks/rants would be awesome.</p>
[ { "answer_id": 1268056, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "* Agile development with Rails (book)\n* Railscasts - very useful, always learn something new.\n* And of course the RoR API\n...
2008/09/11
[ "https://Stackoverflow.com/questions/55574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2066/" ]
55,577
<p>I want to test the web pages I create in all the modern versions of Internet Explorer (6, 7 and 8 beta) but I work mainly on a Mac and often don't have direct access to a PC.</p>
[ { "answer_id": 55578, "author": "georgebrock", "author_id": 5168, "author_profile": "https://Stackoverflow.com/users/5168", "pm_score": 7, "selected": true, "text": "/Applications/Q.app/Contents/MacOS/qemu-img convert -O raw -f vpc \"input.vhd\" temp.bin\nVBoxManage convertdd temp.bin \"...
2008/09/11
[ "https://Stackoverflow.com/questions/55577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5168/" ]
55,594
<p>When developing (works fine live) the pages for our website don't pick up the correct CSS until the user has authenticated (logged on).</p> <p>So the Logon and Logoff forms look bad, but once inside the site, the CSS works again.</p> <p>I'm guessing it's some kind of authentication issue? Haven't really looked into it too much because it's only when working on dev so not a huge issue, but would be nice to know how to fix it.</p>
[ { "answer_id": 417692, "author": "Jason", "author_id": 38398, "author_profile": "https://Stackoverflow.com/users/38398", "pm_score": 4, "selected": false, "text": "<configuration>\n <system.web>\n // system.web configuration settings.\n </system.web>\n <location path=\"App_The...
2008/09/11
[ "https://Stackoverflow.com/questions/55594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1075/" ]
55,607
<p>What is the best way to use multiple EVAL fields in a GridView ItemTemplate?</p> <p>Looking to have some control over formatting for appearance as well as setting up hyperlinks/javascript etc.</p>
[ { "answer_id": 55629, "author": "Dhaust", "author_id": 242, "author_profile": "https://Stackoverflow.com/users/242", "pm_score": 3, "selected": false, "text": "<%# Eval(\"Name1\", \"{0} - \")%> <%#Eval(\"Name2\")%>\n" }, { "answer_id": 55681, "author": "Forgotten Semicolon", ...
2008/09/11
[ "https://Stackoverflow.com/questions/55607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/242/" ]
55,611
<p>To make a JavaScript class with a public method I'd do something like:</p> <pre><code>function Restaurant() {} Restaurant.prototype.buy_food = function(){ // something here } Restaurant.prototype.use_restroom = function(){ // something here } </code></pre> <p>That way users of my class can:</p> <pre><code>var restaurant = new Restaurant(); restaurant.buy_food(); restaurant.use_restroom(); </code></pre> <p>How do I create a private method that can be called by the <code>buy_food</code> and <code>use_restroom</code> methods but not externally by users of the class?</p> <p>In other words, I want my method implementation to be able to do:</p> <pre><code>Restaurant.prototype.use_restroom = function() { this.private_stuff(); } </code></pre> <p>But this shouldn't work:</p> <pre><code>var r = new Restaurant(); r.private_stuff(); </code></pre> <p>How do I define <code>private_stuff</code> as a private method so both of these hold true?</p> <p>I've read <a href="http://javascript.crockford.com/private.html" rel="noreferrer">Doug Crockford's writeup</a> a few times but it doesn't seem like "private" methods can be called by public methods and "privileged" methods can be called externally.</p>
[ { "answer_id": 55637, "author": "17 of 26", "author_id": 2284, "author_profile": "https://Stackoverflow.com/users/2284", "pm_score": 10, "selected": true, "text": "function Restaurant() {\n var myPrivateVar;\n\n var private_stuff = function() { // Only visible inside Restaurant()\...
2008/09/11
[ "https://Stackoverflow.com/questions/55611", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3284/" ]
55,612
<p>This one has me kind of stumped. I want to make the first word of all the paragraphs in my #content div at 14pt instead of the default for the paragraphs (12pt). Is there a way to do this in straight CSS or am I left wrapping the first word in a span to accomplish this?</p>
[ { "answer_id": 55624, "author": "Robby Slaughter", "author_id": 1854, "author_profile": "https://Stackoverflow.com/users/1854", "pm_score": 8, "selected": true, "text": ":first-letter" }, { "answer_id": 55627, "author": "Dale Ragan", "author_id": 1117, "author_profile...
2008/09/11
[ "https://Stackoverflow.com/questions/55612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/204/" ]
55,633
<p>WebKit/Safari supports the console object, which is similar to what Firebug does. But what exactly is supported? There is a <a href="http://getfirebug.com/wiki/index.php/Console_API" rel="noreferrer">console documentation for Firebug</a>, but where can I find the console documentation for Safari/WebKit?</p>
[ { "answer_id": 55653, "author": "georgebrock", "author_id": 5168, "author_profile": "https://Stackoverflow.com/users/5168", "pm_score": 7, "selected": true, "text": "console.log()" }, { "answer_id": 4698391, "author": "Kerrick", "author_id": 126329, "author_profile": ...
2008/09/11
[ "https://Stackoverflow.com/questions/55633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5295/" ]
55,641
<p>What is the best practice of Unicode processing in C++?</p>
[ { "answer_id": 55650, "author": "hazzen", "author_id": 5066, "author_profile": "https://Stackoverflow.com/users/5066", "pm_score": 7, "selected": true, "text": "is_alpha" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/55641", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5694/" ]
55,677
<p>What's the simplest way to add a click event handler to a canvas element that will return the x and y coordinates of the click (relative to the canvas element)?</p> <p>No legacy browser compatibility required, Safari, Opera and Firefox will do.</p>
[ { "answer_id": 55723, "author": "Brian Gianforcaro", "author_id": 3415, "author_profile": "https://Stackoverflow.com/users/3415", "pm_score": -1, "selected": false, "text": " function onMouseClick(e) {\n var x = e.clientX;\n var y = e.clientY;\n }\n var canvas = dojo.byId(ca...
2008/09/11
[ "https://Stackoverflow.com/questions/55677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3715/" ]
55,692
<p>My background is primarily as a Java Developer, but lately I have been doing some work in .NET. So I have been trying to do some simple projects at home to get better at working with .NET. I have been able to transfer much of my Java experience into working with .NET (specifically C#), but the only thing that has really perplexed me is namespaces.</p> <p>I know namespaces are similar to Java packages, but as from what I can tell the main difference is that with Java packages they use actual file folders to show the seperation, while in .NET it does not and all the files reside in a single folder and the namespace is simply declared in each class.</p> <p>I find this odd, because I always saw packages as a way to organize and group related code, making it easier to navigate and comprehend. Since in .NET it does not work this work this way, overtime, the project appears more overcrowded and not as easy to navigate.</p> <p>Am I missing something here? I have to be. Should I be breaking things into separate projects within the solution? Or is there a better way to keep the classes and files organized within a project?</p> <p>Edit: As Blair pointed out this is pretty much the same question asked <a href="https://stackoverflow.com/questions/4664/should-the-folders-in-a-solution-match-the-namespace">here</a>.</p>
[ { "answer_id": 55708, "author": "John Calsbeek", "author_id": 5696, "author_profile": "https://Stackoverflow.com/users/5696", "pm_score": 1, "selected": false, "text": "mycompany_getcurrentdate" }, { "answer_id": 58265, "author": "Ryan Lundy", "author_id": 5486, "auth...
2008/09/11
[ "https://Stackoverflow.com/questions/55692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3340/" ]
55,709
<p>I am building a java server that needs to scale. One of the servlets will be serving images stored in Amazon S3.</p> <p>Recently under load, I ran out of memory in my VM and it was after I added the code to serve the images so I'm pretty sure that streaming larger servlet responses is causing my troubles.</p> <p>My question is : is there any best practice in how to code a java servlet to stream a large (>200k) response back to a browser when read from a database or other cloud storage?</p> <p>I've considered writing the file to a local temp drive and then spawning another thread to handle the streaming so that the tomcat servlet thread can be re-used. This seems like it would be io heavy.</p> <p>Any thoughts would be appreciated. Thanks.</p>
[ { "answer_id": 55788, "author": "John Vasileff", "author_id": 5076, "author_profile": "https://Stackoverflow.com/users/5076", "pm_score": 7, "selected": true, "text": "ServletOutputStream out = response.getOutputStream();\nInputStream in = [ code to get source input stream ];\nString mim...
2008/09/11
[ "https://Stackoverflow.com/questions/55709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4974/" ]
55,713
<p>In effect, if I have a <code>class c</code> and instances of <code>$c1</code> and <code>$c2</code> which might have different private variable amounts but all their public methods return the same values I would like to be able to check that <code>$c1 == $c2?</code></p> <p>Does anyone know an easy way to do this?</p>
[ { "answer_id": 55731, "author": "Rushi", "author_id": 3983, "author_profile": "https://Stackoverflow.com/users/3983", "pm_score": 1, "selected": false, "text": "class cat {\n private $name;\n public function __contruct($catname) {\n $this->name = $catname;\n }\n\n publ...
2008/09/11
[ "https://Stackoverflow.com/questions/55713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
55,720
<p>Here's my first question at SO.</p> <p>I have a internal application for my company which I've been recently ask to maintain. The applications is built in PHP and its fairly well coded (OO, DB Abstraction, Smarty) nothing WTF-ish. </p> <p>The problem is the applications is <strong>very slow</strong>.</p> <p>How do I go about finding out what's slowing the application down? I've optimized the code to make very few DB queries, so I know that it is the PHP code which is taking a while to execute. I need to get some tools which can help me with this and need to devise a strategy for checking my code.</p> <p>I can do the checking/strategy work myself, but I need more PHP tools to figure out where my app is crapping up. </p> <p>Thoughts?</p>
[ { "answer_id": 56754, "author": "Gary Richardson", "author_id": 2506, "author_profile": "https://Stackoverflow.com/users/2506", "pm_score": 0, "selected": false, "text": "$object->setMarker(\"name\");" }, { "answer_id": 15717173, "author": "Fedir RYKHTIK", "author_id": 63...
2008/09/11
[ "https://Stackoverflow.com/questions/55720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3983/" ]
55,729
<p>How often should you use git-gc? </p> <p>The <a href="http://www.kernel.org/pub/software/scm/git/docs/git-gc.html" rel="noreferrer">manual page</a> simply says:</p> <blockquote> <p>Users are encouraged to run this task on a regular basis within each repository to maintain good disk space utilization and good operating performance.</p> </blockquote> <p>Are there some commands to get some object counts to find out whether it's time to gc?</p>
[ { "answer_id": 18541285, "author": "cregox", "author_id": 274502, "author_profile": "https://Stackoverflow.com/users/274502", "pm_score": 4, "selected": false, "text": "This repository currently has approximately 1500 loose objects.\n" }, { "answer_id": 22358144, "author": "V...
2008/09/11
[ "https://Stackoverflow.com/questions/55729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
55,735
<p>I want to write a word addin that does some computations and updates some ui whenever the user types something or moves the current insertion point. From looking at the MSDN docs, I don't see any obvious way such as an TextTyped event on the document or application objects.</p> <p>Does anyone know if this is possible without polling the document?</p>
[ { "answer_id": 1033966, "author": "Sebastian Bender", "author_id": 96671, "author_profile": "https://Stackoverflow.com/users/96671", "pm_score": 2, "selected": false, "text": "public class AutoBrandSmartTag : SmartTag\n{\n Microsoft.Office.Interop.Word.Document cDoc;\n\n Microsoft....
2008/09/11
[ "https://Stackoverflow.com/questions/55735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2925/" ]
55,754
<p>What is the best way, using Bash, to rename files in the form:</p> <pre><code>(foo1, foo2, ..., foo1300, ..., fooN) </code></pre> <p>With zero-padded file names:</p> <pre><code>(foo00001, foo00002, ..., foo01300, ..., fooN) </code></pre>
[ { "answer_id": 55775, "author": "dF.", "author_id": 3002, "author_profile": "https://Stackoverflow.com/users/3002", "pm_score": 2, "selected": false, "text": "for ((i=1; i<=N; i++)) ; do mv foo$i `printf foo%05d $i` ; done\n" }, { "answer_id": 55778, "author": "amrox", "a...
2008/09/11
[ "https://Stackoverflow.com/questions/55754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3020/" ]
55,757
<p>I have <code>buy.php</code> with a <strong>form</strong> where you enter <em>items, quantity, shipping data, etc.</em> </p> <p>When you click the <strong>Submit button</strong>, it posts back to <code>buy.php</code> <code>($_SERVER['PHP_SELF'])</code> and does some data validation. </p> <p>If there are fields missing or errors, they are highlighted. If everything is correct, I save the <code>$_POST</code> data in <code>$_SESSION</code> variables, then do a <code>header('Location: check.php')</code>, where I display the data so the buyer can check the info one last time before actually buying.</p> <p>Now, if I'm in <code>check.php</code> and hit the Back button to <code>buy.php</code> so I can change stuff, the browser asks if I want to resend the POST data. I'm trying to avoid that. </p> <p><strong>Anyone have any good advice or good practices for PHP Multiform validation?</strong></p> <p><strong>Also, if I had n pages for the user to fill, <code>buy.php, buy2.php, ... buyn.php</code> before check.php would the same ideas still hold?</strong></p>
[ { "answer_id": 11230741, "author": "FstaRocka", "author_id": 1486271, "author_profile": "https://Stackoverflow.com/users/1486271", "pm_score": 1, "selected": false, "text": "redir" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/55757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2542/" ]
55,797
<p>A Visual Studio 2008 project in one solution needs to reference a WCF service in another VS 2008 solution on the same development machine. Does anybody have any suggestions on how best to accomplish this?</p>
[ { "answer_id": 11230741, "author": "FstaRocka", "author_id": 1486271, "author_profile": "https://Stackoverflow.com/users/1486271", "pm_score": 1, "selected": false, "text": "redir" } ]
2008/09/11
[ "https://Stackoverflow.com/questions/55797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
55,828
<p>Is there a simple method of parsing XML files in C#? If so, what?</p>
[ { "answer_id": 55831, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 3, "selected": false, "text": "XmlReader" }, { "answer_id": 55834, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https:...
2008/09/11
[ "https://Stackoverflow.com/questions/55828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4361/" ]
55,843
<p>I am currently using Linq to NHibernate (although that is not an issue with regards to this question) to execute queries against my database and I want to be able to test whether the current <code>IQueryable</code> result instance has been executed or not.</p> <p>The debugger knows that my <code>IQueryable</code> has not been <em>'invoked'</em> because it tells me that expanding the Results property will <em>'enumerate'</em> it. Is there a way for me to programmatically identify that as well.</p> <p>I hope that makes sense :)</p>
[ { "answer_id": 81740, "author": "Mark Pattison", "author_id": 15519, "author_profile": "https://Stackoverflow.com/users/15519", "pm_score": 0, "selected": false, "text": "DataContext.Log = Console.Out" }, { "answer_id": 85732, "author": "dcstraw", "author_id": 10391, ...
2008/09/11
[ "https://Stackoverflow.com/questions/55843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4884/" ]
55,855
<p>I am following the <a href="http://blogs.msdn.com/johngossman/archive/2005/10/08/478683.aspx" rel="noreferrer">M-V-VM</a> pattern for my WPF UI. I would like to hook up a command to the TextChanged event of a TextBox to a command that is in my ViewModel class. The only way I can conceive of completing this task is to inherit from the TextBox control, and implement ICommandSource. I can then instruct the command to be fired from the TextChanged event. This seems to be too much work for something which appears to be so simple.</p> <p>Is there an easier way (than subclassing the TextBox and implementing ICommandSource) to hook up the TextChanged event to my ViewModel class?</p>
[ { "answer_id": 56081, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 2, "selected": false, "text": "private void _textBox_TextChanged(object sender, EventArgs e)\n{\n MyCommand.Execute(null);\n}\n" }, { "answ...
2008/09/11
[ "https://Stackoverflow.com/questions/55855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/708/" ]
55,859
<p>In C++, I'm trying to catch all types of exceptions in one catch (like <code>catch(Exception)</code> in C#). How is it done? And what's more, how can one catch divide-by-zero exceptions?</p>
[ { "answer_id": 55863, "author": "Ash", "author_id": 5023, "author_profile": "https://Stackoverflow.com/users/5023", "pm_score": 6, "selected": true, "text": "catch (...)\n{\n // Handle exceptions not covered.\n}\n" }, { "answer_id": 55865, "author": "Adam Pierce", "auth...
2008/09/11
[ "https://Stackoverflow.com/questions/55859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/195/" ]