qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
134,845
<p>The following are two methods of building a link that has the sole purpose of running JavaScript code. Which is better, in terms of functionality, page load speed, validation purposes, etc.?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function myJsFunc() { alert("myJsFunc"); }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;a href="#" onclick="myJsFunc();"&gt;Run JavaScript Code&lt;/a&gt;</code></pre> </div> </div> </p> <p>or</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>function myJsFunc() { alert("myJsFunc"); }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;a href="javascript:void(0)" onclick="myJsFunc();"&gt;Run JavaScript Code&lt;/a&gt;</code></pre> </div> </div> </p>
[ { "answer_id": 134853, "author": "Adam Tuttle", "author_id": 751, "author_profile": "https://Stackoverflow.com/users/751", "pm_score": 8, "selected": false, "text": "'#'" }, { "answer_id": 134865, "author": "Zach", "author_id": 9128, "author_profile": "https://Stackov...
2008/09/25
[ "https://Stackoverflow.com/questions/134845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8018/" ]
134,858
<p>I have some code I've written in PHP for consuming our simple webservice, which I'd also like to provide in Perl for users who may prefer that language. What's the simplest method of making a HTTP request to do that? In PHP I can do it in one line with <code>file_get_contents()</code>.</p> <p>Here's the entire code I want to port to Perl:</p> <pre class="lang-php prettyprint-override"><code>/** * Makes a remote call to the our API, and returns the response * @param cmd {string} - command string ID * @param argsArray {array} - associative array of argument names and argument values * @return {array} - array of responses */ function callAPI( $cmd, $argsArray=array() ) { $apikey="MY_API_KEY"; $secret="MY_SECRET"; $apiurl="https://foobar.com/api"; // timestamp this API was submitted (for security reasons) $epoch_time=time(); //--- assemble argument array into string $query = "cmd=" .$cmd; foreach ($argsArray as $argName =&gt; $argValue) { $query .= "&amp;" . $argName . "=" . urlencode($argValue); } $query .= "&amp;key=". $apikey . "&amp;time=" . $epoch_time; //--- make md5 hash of the query + secret string $md5 = md5($query . $secret); $url = $apiurl . "?" . $query . "&amp;md5=" . $md5; //--- make simple HTTP GET request, put the server response into $response $response = file_get_contents($url); //--- convert "|" (pipe) delimited string to array $responseArray = explode("|", $response); return $responseArray; } </code></pre>
[ { "answer_id": 134889, "author": "Kevin Crumley", "author_id": 1818, "author_profile": "https://Stackoverflow.com/users/1818", "pm_score": 7, "selected": true, "text": "use LWP::Simple;\n$contents = get(\"http://YOUR_URL_HERE\");\n" }, { "answer_id": 134911, "author": "Barry ...
2008/09/25
[ "https://Stackoverflow.com/questions/134858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14569/" ]
134,866
<p>I have a mindmp file from a target's application crash. Is it possible for me to rebuild the dll/pdb files for a version of software and have windbg load symbols correctly? </p> <p>My problem is that our pdb files are only kept for major releases (unfortunately). This is a daily build, which I can rebuild myself, but I'm getting tripped up on errors.</p> <p>With !sym noisy on: "image header does not match memory image header."</p> <pre><code>DBGENG: C:\...\XXX.dll image header does not match memory image header. DBGENG: XXX.dll - Partial symbol image load missing image info DBGHELP: Module is not fully loaded into memory. DBGHELP: Searching for symbols using debugger-provided data. DBGHELP: C:\...\XXX.pdb - mismatched pdb </code></pre> <p>Note I've build the pdb with the dll, they are from the same RELEASE directory (should I be building debug?)</p> <p>Theses are release builds (as release builds are installed on the target and crashing) should I be somehow using the debug build dlls to get more symbol information?</p>
[ { "answer_id": 160818, "author": "SteveMan", "author_id": 5994, "author_profile": "https://Stackoverflow.com/users/5994", "pm_score": 4, "selected": false, "text": "chkmatch -m OriginalExecutable.exe RebuiltPDB.pdb\n" }, { "answer_id": 21099781, "author": "Dan K", "author...
2008/09/25
[ "https://Stackoverflow.com/questions/134866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8123/" ]
134,882
<p>How do I easily undo a git rebase? A lengthy manual method is:</p> <ol> <li>checkout the commit parent to both of the branches</li> <li>create and checkout a temporary branch</li> <li>cherry-pick all commits by hand</li> <li>reset the faulty rebased branch to point to the temporary branch</li> </ol> <p>In my current situation, this works because I can easily spot commits from both branches (one was my stuff, the other was my colleague's stuff). However, my approach strikes me as suboptimal and error-prone (let's say I had just rebased with two of my own branches).</p> <p>Clarification: I am talking about a rebase during which <em>multiple</em> commits were replayed, not only one.</p>
[ { "answer_id": 135614, "author": "CB Bailey", "author_id": 19563, "author_profile": "https://Stackoverflow.com/users/19563", "pm_score": 13, "selected": true, "text": "git reflog\n" }, { "answer_id": 137363, "author": "Aristotle Pagaltzis", "author_id": 9410, "author_...
2008/09/25
[ "https://Stackoverflow.com/questions/134882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6349/" ]
134,885
<p>I'm looking to use a VBScript variable within a reference to a DOM element for a web-app I'm building. Here's a brief excerpt of the affected area of code:</p> <pre><code>dim num num = CInt(document.myform.i.value) dim x x = 0 dim orders(num) For x = 0 To num orders(x) = document.getElementById("order" &amp; x).value objFile.writeLine(orders(x)) Next </code></pre> <p>This is my first venture into VBScript, and I've not been able to find any methods of performing this type of action online. As you can see in the above code, I'm trying to create an array (orders). This array can have any number of values, but that number will be specified in <code>document.myform.i.value</code>. So the For loop cycles through all text inputs with an ID of order+x (ie, order0, order1, order2, order3, order4, etc. up to num)</p> <p>It seems to be a problem with my orders(x) line, I don't think it recognizes what I mean by <code>getElementById("order" &amp; x)</code>, and I'm not sure exactly how to do such a thing. Anyone have any suggestions? It would be much appreciated!</p>
[ { "answer_id": 134927, "author": "Dan Williams", "author_id": 4230, "author_profile": "https://Stackoverflow.com/users/4230", "pm_score": 0, "selected": false, "text": "orders(x) = document.getElementById(\"order\" & x).value\nobjFile.writeLine(orders(x))\n" }, { "answer_id": 136...
2008/09/25
[ "https://Stackoverflow.com/questions/134885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
134,887
<p>After making it through the major parts of an introductory Lisp book, I still couldn't understand what the special operator <code>(quote)</code> (or equivalent <code>'</code>) function does, yet this has been all over Lisp code that I've seen. </p> <p>What does it do?</p>
[ { "answer_id": 134908, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 6, "selected": false, "text": "(print '(+ 3 4))" }, { "answer_id": 134924, "author": "Kyle Burton", "author_id": 19784, "author...
2008/09/25
[ "https://Stackoverflow.com/questions/134887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1256/" ]
134,905
<p>What is the best way to return XML from a controller's action in ASP.NET MVC? There is a nice way to return JSON, but not for XML. Do I really need to route the XML through a View, or should I do the not-best-practice way of Response.Write-ing it?</p>
[ { "answer_id": 134982, "author": "Luke Smith", "author_id": 5556, "author_profile": "https://Stackoverflow.com/users/5556", "pm_score": 8, "selected": true, "text": "public class XmlResult : ActionResult\n{\n private object objectToSerialize;\n\n /// <summary>\n /// Initializes ...
2008/09/25
[ "https://Stackoverflow.com/questions/134905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22299/" ]
134,906
<p>Is there a command or an existing script that will let me view all of a *NIX system's scheduled cron jobs at once? I'd like it to include all of the user crontabs, as well as <code>/etc/crontab</code>, and whatever's in <code>/etc/cron.d</code>. It would also be nice to see the specific commands run by <code>run-parts</code> in <code>/etc/crontab</code>.</p> <p>Ideally, I'd like the output in a nice column form and ordered in some meaningful way.</p> <p>I could then merge these listings from multiple servers to view the overall "schedule of events."</p> <p>I was about to write such a script myself, but if someone's already gone to the trouble...</p>
[ { "answer_id": 134944, "author": "Kyle Burton", "author_id": 19784, "author_profile": "https://Stackoverflow.com/users/19784", "pm_score": 10, "selected": false, "text": "for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done\n" }, { "answer_id": 134947, "author...
2008/09/25
[ "https://Stackoverflow.com/questions/134906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/726/" ]
134,917
<p>We will need to call out to a 3rd party to retrieve a value using REST, however if we do not receive a response within 10ms, I want to use a default value and continue processing.</p> <p>I'm leaning towards using an asynchronous WebRequest do to this, but I was wondering if there was a trick to doing it using a synchronous request.</p> <p>Any advice?</p>
[ { "answer_id": 135004, "author": "Philip Rieck", "author_id": 12643, "author_profile": "https://Stackoverflow.com/users/12643", "pm_score": 2, "selected": false, "text": "WebRequest request = WebRequest.Create(\"http://something.somewhere/url\");\nWebResponse response = null;\nrequest.Ti...
2008/09/25
[ "https://Stackoverflow.com/questions/134917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
134,934
<p>How do I display a leading zero for all numbers with less than two digits?</p> <pre class="lang-none prettyprint-override"><code>1 → 01 10 → 10 100 → 100 </code></pre>
[ { "answer_id": 134942, "author": "nosklo", "author_id": 17160, "author_profile": "https://Stackoverflow.com/users/17160", "pm_score": 6, "selected": false, "text": "x = [1, 10, 100]\nfor i in x:\n print '%02d' % i\n" }, { "answer_id": 134951, "author": "Jack M.", "auth...
2008/09/25
[ "https://Stackoverflow.com/questions/134934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22306/" ]
134,956
<p>Is it even possible to perform address (physical, not e-mail) validation? It seems like the sheer number of address formats, even in the US alone, would make this a fairly difficult task. On the other hand it seems like a task that would be necessary for several business requirements.</p>
[ { "answer_id": 13351246, "author": "Xeoncross", "author_id": 99923, "author_profile": "https://Stackoverflow.com/users/99923", "pm_score": 1, "selected": false, "text": "$address = urlencode('1600 Pennsylvania Avenue, Washington, DC');\n$json = json_decode(file_get_contents(\"http://wher...
2008/09/25
[ "https://Stackoverflow.com/questions/134956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1574/" ]
134,958
<p>How would I be able to get N results for several groups in an oracle query.</p> <p>For example, given the following table:</p> <pre><code>|--------+------------+------------| | emp_id | name | occupation | |--------+------------+------------| | 1 | John Smith | Accountant | | 2 | Jane Doe | Engineer | | 3 | Jack Black | Funnyman | |--------+------------+------------| </code></pre> <p>There are many more rows with more occupations. I would like to get three employees (lets say) from each occupation.</p> <p>Is there a way to do this without using a subquery?</p>
[ { "answer_id": 135046, "author": "billjamesdev", "author_id": 13824, "author_profile": "https://Stackoverflow.com/users/13824", "pm_score": 1, "selected": false, "text": "select *\nfrom people p1\n join people p2\n on p1.occupation = p2.occupation\n join people p3\n o...
2008/09/25
[ "https://Stackoverflow.com/questions/134958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9435/" ]
134,962
<p>I've been trying this a couple of different ways, but it's not working for some reason. Is it even possible?</p>
[ { "answer_id": 39594411, "author": "Richard", "author_id": 269537, "author_profile": "https://Stackoverflow.com/users/269537", "pm_score": 0, "selected": false, "text": "GetVaryByCustomString(HttpContext context, string custom)" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/134962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5469/" ]
134,969
<p>In Ruby, is there the equivalent of the <code>__str__()</code> method that you can define on Python classes? </p>
[ { "answer_id": 134978, "author": "Kyle Burton", "author_id": 19784, "author_profile": "https://Stackoverflow.com/users/19784", "pm_score": 3, "selected": false, "text": "irb(main):001:0> puts \"array is: #{[1,2,3].inspect}\"\narray is: [1, 2, 3]\n=> nil\nirb(main):002:0> puts \"array is:...
2008/09/25
[ "https://Stackoverflow.com/questions/134969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
134,988
<ol> <li>Is it possible to secure only the Login.aspx page (and the postback) and not the whole site in IIS?</li> <li>We are looking to do this specifically with a SharePoint site running Forms Based Authentication against our Active Directory.</li> <li>Links to this will be helpful.</li> </ol> <p>This is what we have done so far:<br> 1. Setup SharePoint to use FBA against AD.<br> 2. Moved Login Page to Secure/Login.aspx<br> 3. Set the appropriate Login url in web.config as <code>https://..../Secure/Login.aspx</code></p> <p>This is not working and help is needed here. However even if this works, how do we get the user back to http from https?</p>
[ { "answer_id": 153918, "author": "Abs", "author_id": 1245, "author_profile": "https://Stackoverflow.com/users/1245", "pm_score": 0, "selected": false, "text": "/_layouts" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/134988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21586/" ]
135,000
<p>When generating XML from XmlDocument in .NET, a blank <code>xmlns</code> attribute appears the first time an element <em>without</em> an associated namespace is inserted; how can this be prevented?</p> <p>Example:</p> <pre><code>XmlDocument xml = new XmlDocument(); xml.AppendChild(xml.CreateElement("root", "whatever:name-space-1.0")); xml.DocumentElement.AppendChild(xml.CreateElement("loner")); Console.WriteLine(xml.OuterXml); </code></pre> <p>Output:</p> <pre><code>&lt;root xmlns="whatever:name-space-1.0"&gt;&lt;loner xmlns="" /&gt;&lt;/root&gt; </code></pre> <p><em>Desired</em> Output:</p> <pre><code>&lt;root xmlns="whatever:name-space-1.0"&gt;&lt;loner /&gt;&lt;/root&gt; </code></pre> <p>Is there a solution applicable to the <code>XmlDocument</code> code, not something that occurs <em>after</em> converting the document to a string with <code>OuterXml</code>?</p> <p>My reasoning for doing this is to see if I can match the standard XML of a particular protocol using XmlDocument-generated XML. The blank <code>xmlns</code> attribute <em>may</em> not break or confuse a parser, but it's also not present in any usage that I've seen of this protocol.</p>
[ { "answer_id": 135027, "author": "JeniT", "author_id": 6739, "author_profile": "https://Stackoverflow.com/users/6739", "pm_score": 4, "selected": false, "text": "<loner>" }, { "answer_id": 135066, "author": "jlew", "author_id": 7450, "author_profile": "https://Stackov...
2008/09/25
[ "https://Stackoverflow.com/questions/135000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9642/" ]
135,010
<p>I have a problem with stopping a service and starting it again and want to be notified when the process runs and let me know what the result is. </p> <p>Here's the scenario, I have a text file output of an "sc" command. I want to send that file but not as an attachment. Also, I want to see the initial status quickly in the subject of the email.</p> <p>Here's the 'servstop.txt' file contents:</p> <blockquote> <p>[SC] StartService FAILED 1058:</p> <p>The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.</p> </blockquote> <p>I want the subject of the email to be "Alert Service Start: [SC] StartService FAILED 1058" and the body to contain the entire error message above.</p> <p>I will put my current method in an answer below using a program called blat to send me the result.</p>
[ { "answer_id": 135027, "author": "JeniT", "author_id": 6739, "author_profile": "https://Stackoverflow.com/users/6739", "pm_score": 4, "selected": false, "text": "<loner>" }, { "answer_id": 135066, "author": "jlew", "author_id": 7450, "author_profile": "https://Stackov...
2008/09/25
[ "https://Stackoverflow.com/questions/135010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/730/" ]
135,020
<p>When creating a class that has internal private methods, usually to reduce code duplication, that don't require the use of any instance fields, are there performance or memory advantages to declaring the method as static?</p> <p>Example:</p> <pre><code>foreach (XmlElement element in xmlDoc.DocumentElement.SelectNodes("sample")) { string first = GetInnerXml(element, ".//first"); string second = GetInnerXml(element, ".//second"); string third = GetInnerXml(element, ".//third"); } </code></pre> <p>...</p> <pre><code>private static string GetInnerXml(XmlElement element, string nodeName) { return GetInnerXml(element, nodeName, null); } private static string GetInnerXml(XmlElement element, string nodeName, string defaultValue) { XmlNode node = element.SelectSingleNode(nodeName); return node == null ? defaultValue : node.InnerXml; } </code></pre> <p>Is there any advantage to declaring the GetInnerXml() methods as static? No opinion responses please, I have an opinion.</p>
[ { "answer_id": 135023, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 4, "selected": false, "text": "this" }, { "answer_id": 36888316, "author": "sara", "author_id": 2622234, "author_profile": "https...
2008/09/25
[ "https://Stackoverflow.com/questions/135020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6146/" ]
135,035
<p>In ruby the library path is provided in <code>$:</code>, in perl it's in <code>@INC</code> - how do you get the list of paths that Python searches for modules when you do an import?</p>
[ { "answer_id": 135050, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 3, "selected": false, "text": "import sys\nsys.path\n" }, { "answer_id": 135051, "author": "Jack M.", "author_id": 3421, "author_...
2008/09/25
[ "https://Stackoverflow.com/questions/135035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19784/" ]
135,041
<p>Why or why not?</p>
[ { "answer_id": 135070, "author": "Dan Udey", "author_id": 21450, "author_profile": "https://Stackoverflow.com/users/21450", "pm_score": 4, "selected": false, "text": "xrange()" }, { "answer_id": 135074, "author": "Thomas Wouters", "author_id": 17624, "author_profile":...
2008/09/25
[ "https://Stackoverflow.com/questions/135041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18446/" ]
135,057
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/574463">Running Internet Explorer 6, Internet Explorer 7, and Internet Explorer 8 on the same machine</a> </p> </blockquote> <p>Is there a way to have Internet Explorer 8 and Internet Explorer 6 side by side without virtualizing?</p> <p>I used <a href="http://tredosoft.com/Multiple_IE" rel="nofollow noreferrer" title="Multiple IEs">Multiple IEs</a> which works fine with Internet Explorer 7, but since I installed Internet Explorer 8 beta 2, Internet Explorer 6 started behaving oddly (that is, more than usual).</p>
[ { "answer_id": 179126, "author": "Carl Camera", "author_id": 12804, "author_profile": "https://Stackoverflow.com/users/12804", "pm_score": 4, "selected": false, "text": "mshtml.dll" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/135057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13275/" ]
135,069
<p>This may be a matter of style, but there's a bit of a divide in our dev team and I wondered if anyone else had any ideas on the matter...</p> <p>Basically, we have some debug print statements which we turn off during normal development. Personally I prefer to do the following:</p> <pre><code>//---- SomeSourceFile.cpp ---- #define DEBUG_ENABLED (0) ... SomeFunction() { int someVariable = 5; #if(DEBUG_ENABLED) printf("Debugging: someVariable == %d", someVariable); #endif } </code></pre> <p>Some of the team prefer the following though:</p> <pre><code>// #define DEBUG_ENABLED ... SomeFunction() { int someVariable = 5; #ifdef DEBUG_ENABLED printf("Debugging: someVariable == %d", someVariable); #endif } </code></pre> <p>...which of those methods sounds better to you and why? My feeling is that the first is safer because there is always something defined and there's no danger it could destroy other defines elsewhere.</p>
[ { "answer_id": 135077, "author": "Martin Beckett", "author_id": 10897, "author_profile": "https://Stackoverflow.com/users/10897", "pm_score": 3, "selected": false, "text": "#if" }, { "answer_id": 135089, "author": "Jim Buck", "author_id": 2666, "author_profile": "http...
2008/09/25
[ "https://Stackoverflow.com/questions/135069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15369/" ]
135,076
<p>I am <strong>losing hair</strong> on this one ... it seems that when I fix width an HTML SELECT control it renders its width differently depending on the browser. </p> <p>Any idea how to to standardize this without having to turn to multiple style sheets?</p> <p>Here is what I am working with:</p> <pre><code>.combo { padding: 2px; width: 200px; } .text { padding: 2px; width: 200px; } </code></pre> <p>This is my document type for the page:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; </code></pre>
[ { "answer_id": 135085, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 2, "selected": false, "text": "font-size" }, { "answer_id": 135764, "author": "mattruma", "author_id": 1768, "author_profile": "h...
2008/09/25
[ "https://Stackoverflow.com/questions/135076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1768/" ]
135,105
<p>We'd like to override DataGridView's default behavior when using a mouse wheel with this control. By default, the DataGridView scrolls a number of rows equal the SystemInformation.MouseWheelScrollLines setting. What we'd like to do is scroll just one item at a time. </p> <p>(We display images in the DataGridView, which are somewhat large. Because of this scroll three rows (a typical system setting) is too much, often causing the user to scroll to items they can't even see.)</p> <p>I've tried a couple things already and haven't had much success so far. Here are some issues I've run into:</p> <ol> <li><p>You can subscribe to MouseWheel events but there's no way to mark the event as handled and do my own thing.</p></li> <li><p>You can override OnMouseWheel but this never appears to be called.</p></li> <li><p>You might be able to correct this in the base scrolling code but it sounds like a messy job since other types of scrolling (e.g. using the keyboard) come through the same pipeline.</p></li> </ol> <p>Anyone have a good suggestion?</p> <p>Here's the final code, using the wonderful answer given:</p> <pre><code> /// &lt;summary&gt; /// Handle the mouse wheel manually due to the fact that we display /// images, which don't work well when you scroll by more than one /// item at a time. /// &lt;/summary&gt; /// /// &lt;param name="sender"&gt; /// sender /// &lt;/param&gt; /// &lt;param name="e"&gt; /// the mouse event /// &lt;/param&gt; private void mImageDataGrid_MouseWheel(object sender, MouseEventArgs e) { // Hack alert! Through reflection, we know that the passed // in event argument is actually a handled mouse event argument, // allowing us to handle this event ourselves. // See http://tinyurl.com/54o7lc for more info. HandledMouseEventArgs handledE = (HandledMouseEventArgs) e; handledE.Handled = true; // Do the scrolling manually. Move just one row at a time. int rowIndex = mImageDataGrid.FirstDisplayedScrollingRowIndex; mImageDataGrid.FirstDisplayedScrollingRowIndex = e.Delta &lt; 0 ? Math.Min(rowIndex + 1, mImageDataGrid.RowCount - 1): Math.Max(rowIndex - 1, 0); } </code></pre>
[ { "answer_id": 135516, "author": "ZeroBugBounce", "author_id": 11314, "author_profile": "https://Stackoverflow.com/users/11314", "pm_score": 1, "selected": false, "text": "public partial class MyDataGridView : DataGridView\n" }, { "answer_id": 135562, "author": "Joel B Fant",...
2008/09/25
[ "https://Stackoverflow.com/questions/135105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7357/" ]
135,121
<p>So in my documentation it says:</p> <blockquote> <p>public event TreeViewPlusNodeCheckedEventHandler NodeChecked()</p> <p>You can use this event to run cause a method to run whenever the check-box for a node is checked on the tree.</p> </blockquote> <p>So how do I add a method to my code behind file that will run when a node is checked? The method I want to run is:</p> <pre><code>protected void TOCNodeCheckedServer(object sender, TreeViewPlusNodeEventArgs args) { TreeViewPlusNode aNode = args.Node; if (!aNode.Checked) return; List&lt;string&gt; BaseLayers = new List&lt;string&gt;(); _arcTOCConfig.BaseDataLayers.CopyTo(BaseLayers); List&lt;MapResourceItem&gt; mapResources = new List&lt;MapResourceItem&gt;(); if (BaseLayers.Contains(aNode.Text)) { foreach (BaseDataLayerElement anEl in _arcTOCConfig.BaseDataLayers) { if (!aNode.Text.Equals(anEl.Name)) { if (aNode.TreeViewPlus.Nodes.FindByValue(anEl.Name).Checked) { aNode.TreeViewPlus.Nodes.FindByValue(anEl.Name).Checked = false; aNode.TreeViewPlus.Nodes.FindByValue(anEl.Name).Refresh(); MapResourceItem aMapResource = this.Map1.MapResourceManagerInstance.ResourceItems.Find(anEl.Name); aMapResource.DisplaySettings.Visible = false; this.Map1.RefreshResource(anEl.Name); mapResources.Add(aMapResource); this.Map1.MapResourceManagerInstance.ResourceItems.Remove(aMapResource); } else { MapResourceItem aMapResource = this.Map1.MapResourceManagerInstance.ResourceItems.Find(anEl.Name); mapResources.Add(aMapResource); this.Map1.MapResourceManagerInstance.ResourceItems.Remove(aMapResource); } } } foreach (MapResourceItem aMapResource in mapResources) { int count = this.Map1.MapResourceManagerInstance.ResourceItems.Count - 1; this.Map1.MapResourceManagerInstance.ResourceItems.Insert(count, aMapResource); this.Map1.MapResourceManagerInstance.CreateResource(aMapResource); } this.Map1.InitializeFunctionalities(); this.Map1.Refresh(); } } </code></pre> <p>vs 2008 c# .net 3.5</p>
[ { "answer_id": 135138, "author": "Max Schmeling", "author_id": 3226, "author_profile": "https://Stackoverflow.com/users/3226", "pm_score": 2, "selected": false, "text": "myTreeView.NodeChecked += new TreeViewPlusNodeCheckedEventHandler(TOCNodeCheckedServer);\n" }, { "answer_id": ...
2008/09/25
[ "https://Stackoverflow.com/questions/135121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5234/" ]
135,129
<p>I seem to be seeing more 'for' loops over iterators in questions &amp; answers here than I do for_each(), transform(), and the like. Scott Meyers suggests that <a href="http://www.ddj.com/cpp/184401446" rel="noreferrer">stl algorithms are preferred</a>, or at least he did in 2001. Of course, using them often means moving the loop body into a function or function object. Some may feel this is an unacceptable complication, while others may feel it better breaks down the problem.</p> <p>So... should STL algorithms be preferred over hand-rolled loops?</p>
[ { "answer_id": 135196, "author": "Maximilian", "author_id": 1733, "author_profile": "https://Stackoverflow.com/users/1733", "pm_score": 2, "selected": false, "text": "for (int i = 0; i < some_vector.size(); i++)\n if (some_vector[i] == NULL) some_other_vector[i]++;\n" }, { "an...
2008/09/25
[ "https://Stackoverflow.com/questions/135129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10077/" ]
135,132
<p>I'm really baffled by this - I know how to do this in VB, unmanaged C++ and C# but for some reason I can't accept a ref variable of a managed type in C++. I'm sure there's a simple answer, really - but here's the C# equivalent:</p> <pre><code>myClass.myFunction(ref variableChangedByfunction); </code></pre> <p>I've tried C++ pointers - no dice. I've tried ref keywords. No dice. I tried the <code>[out]</code> keyword. Didn't work.</p> <p>I can't find any documentation that clearly explains my problem, either.</p>
[ { "answer_id": 2280477, "author": "rotti2", "author_id": 207620, "author_profile": "https://Stackoverflow.com/users/207620", "pm_score": 1, "selected": false, "text": "^" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/135132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
135,149
<p>I'm trying to confirm a user a unplugged my embedded device from a network before performing some maintenance. I'm considering "ping"ing all IP address on my sub-net, but that sounds crude. Is there a broadcast/ARP method that might work better?</p>
[ { "answer_id": 135172, "author": "bmdhacks", "author_id": 14032, "author_profile": "https://Stackoverflow.com/users/14032", "pm_score": 2, "selected": false, "text": "ping -b 255.255.255.255\n" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/135149", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15797/" ]
135,151
<p>The .NET web system I'm working on allows the end user to input HTML formatted text in some situations. In some of those places, we want to leave all the tags, but strip off any trailing break tags (but leave any breaks inside the body of the text.)</p> <p>What's the best way to do this? (I can think of ways to do this, but I'm sure they're not the best.)</p>
[ { "answer_id": 135165, "author": "Max Schmeling", "author_id": 3226, "author_profile": "https://Stackoverflow.com/users/3226", "pm_score": 2, "selected": false, "text": "while (myHtmlString.EndsWith(\"<br>\"))\n{\n myHtmlString = myHtmlString.SubString(0, myHtmlString.Length - 4);\n}\...
2008/09/25
[ "https://Stackoverflow.com/questions/135151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19074/" ]
135,173
<p>I have a table that holds only two columns - a ListID and PersonID. When a person is merged with another in the system, I was to update all references from the "source" person to be references to the "destination" person.</p> <p>Ideally, I would like to call something simple like</p> <pre><code>UPDATE MailingListSubscription SET PersonID = @DestPerson WHERE PersonID = @SourcePerson </code></pre> <p>However, if the destination person already exists in this table with the same ListID as the source person, a duplicate entry will be made. How can I perform this action without creating duplicated entries? (ListID, PersonID is the primary key)</p> <p>EDIT: Multiple ListIDs are used. If SourcePerson is assigned to ListIDs 1, 2, and 3, and DestinationPerson is assigned to ListIDs 3 and 4, then the end result needs to have four rows - DestinationPerson assigned to ListID 1, 2, 3, and 4.</p>
[ { "answer_id": 135252, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 3, "selected": true, "text": "--out with the bad\nDELETE\nFROM MailingListSubscription\nWHERE PersonId = @SourcePerson\n and ListID in (SELECT ListID FROM M...
2008/09/25
[ "https://Stackoverflow.com/questions/135173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3259/" ]
135,186
<p>I have a project at work the requires me to be able to enter information into a web page, read the next page I get redirected to and then take further action. A simplified real-world example would be something like going to google.com, entering "Coding tricks" as search criteria, and reading the resulting page.</p> <p>Small coding examples like the ones linked to at <a href="http://www.csharp-station.com/HowTo/HttpWebFetch.aspx" rel="nofollow noreferrer">http://www.csharp-station.com/HowTo/HttpWebFetch.aspx</a> tell how to read a web page, but not how to interact with it by submitting information into a form and continuing on to the next page.</p> <p>For the record, I'm not building a malicious and/or spam related product.</p> <p>So how do I go read web pages that require a few steps of normal browsing to reach first?</p>
[ { "answer_id": 135460, "author": "Chris Lawlor", "author_id": 21245, "author_profile": "https://Stackoverflow.com/users/21245", "pm_score": 3, "selected": false, "text": " string uri = \"http://www.google.com/search\";\n HttpWebRequest request = (HttpWebRequest)WebRequest.Create(u...
2008/09/25
[ "https://Stackoverflow.com/questions/135186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
135,203
<p>I have always wondered WHaT tHE <em>HecK?!?</em> is the difference between JScript and JavaScript.</p>
[ { "answer_id": 35795222, "author": "Shiraz", "author_id": 422663, "author_profile": "https://Stackoverflow.com/users/422663", "pm_score": 2, "selected": false, "text": "\"string\".substr(-1)" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/135203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208/" ]
135,234
<p>What is the difference between <code>ref</code> and <code>out</code> parameters in .NET? What are the situations where one can be more useful than the other? What would be a code snippet where one can be used and another can't?</p>
[ { "answer_id": 135255, "author": "bdukes", "author_id": 2688, "author_profile": "https://Stackoverflow.com/users/2688", "pm_score": 1, "selected": false, "text": "out" }, { "answer_id": 135257, "author": "Khoth", "author_id": 20686, "author_profile": "https://Stackove...
2008/09/25
[ "https://Stackoverflow.com/questions/135234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1909/" ]
135,243
<p>Haven't done ASP.NET development since VS 2003, so I'd like to save some time and learn from other's mistakes.</p> <p>Writing a web services app, but not a WSDL/SOAP/etc. -- more like REST + XML. </p> <p>Which of the many "New Item" options (Web Form, Generic Handler, ASP.NET Handler, etc.) makes the most sense if I want to handle different HTTP verbs, through the same URI, separately. In a perfect world, I'd like the dispatching done declaratively in the code rather than via web.config -- but if I'm making life too hard that way, I'm open to change.</p>
[ { "answer_id": 135467, "author": "NerdFury", "author_id": 6146, "author_profile": "https://Stackoverflow.com/users/6146", "pm_score": 1, "selected": false, "text": "public enum HttpVerb\n{\n GET, POST, PUT, DELETE\n}\n" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/135243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
135,246
<p>I'm attempting to write a Python C extension that reads packed binary data (it is stored as structs of structs) and then parses it out into Python objects. Everything works as expected on a 32 bit machine (the binary files are always written on 32bit architecture), but not on a 64 bit box. Is there a "preferred" way of doing this?</p> <hr> <p>It would be a lot of code to post but as an example:</p> <pre><code>struct { WORD version; BOOL upgrade; time_t time1; time_t time2; } apparms; File *fp; fp = fopen(filePath, "r+b"); fread(&amp;apparms, sizeof(apparms), 1, fp); return Py_BuildValue("{s:i,s:l,s:l}", "sysVersion",apparms.version, "powerFailTime", apparms.time1, "normKitExpDate", apparms.time2 ); </code></pre> <p>Now on a 32 bit system this works great, but on a 64 bit my time_t sizes are different (32bit vs 64 bit longs).</p> <hr> <p>Damn, you people are fast. </p> <p>Patrick, I originally started using the struct package but found it just way to slow for my needs. Plus I was looking for an excuse to write a Python Extension.</p> <p>I know this is a stupid question but what types do I need to watch out for?</p> <p>Thanks.</p>
[ { "answer_id": 135267, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 1, "selected": false, "text": "int32_t" }, { "answer_id": 135311, "author": "Dan Udey", "author_id": 21450, "author_profile": "ht...
2008/09/25
[ "https://Stackoverflow.com/questions/135246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16363/" ]
135,262
<p>I'm programming in C for RAM limited embedded microcontroller with RTOS.</p> <p>I regularly break my code to short functions, but every function calling require to more stack memory. Every task needs his stack, and this is one of the significant memory consumers in the project.</p> <p>Is there an alternative to keep the code well organized and readable, still preserve the memory?</p>
[ { "answer_id": 135282, "author": "Derek Park", "author_id": 872, "author_profile": "https://Stackoverflow.com/users/872", "pm_score": 3, "selected": false, "text": "inline" }, { "answer_id": 135294, "author": "John Millikin", "author_id": 3560, "author_profile": "http...
2008/09/25
[ "https://Stackoverflow.com/questions/135262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22249/" ]
135,296
<p>I frequently come across Windows programs that bundle in MSVCRT (or their more current equivalents) with the program executables. On a typical PC, I would find many copies of the same .DLL's. My understanding is that MSVCRT is the C runtime library, somewhat analogous to glibc/libc.so under *nix.</p> <p>Why do Windows programs have to bring along their C libraries with them, instead of just sharing the system-wide libc?</p> <hr /> <p>Update: thanks to Shog9, I started to read about SxS, which has further opened up my eyes to the DLL linkage issues (DLL Hell) - <a href="https://web.archive.org/web/20160305220537/http://blogs.msdn.com/b/martynl/archive/2005/10/13/480880.aspx" rel="nofollow noreferrer">Link</a> is one useful intro to the issue...</p>
[ { "answer_id": 6442130, "author": "cHao", "author_id": 319403, "author_profile": "https://Stackoverflow.com/users/319403", "pm_score": 4, "selected": false, "text": "kernel32" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/135296", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22329/" ]
135,303
<p>In C# I could easily write the following:</p> <pre><code>string stringValue = string.IsNullOrEmpty( otherString ) ? defaultString : otherString; </code></pre> <p>Is there a quick way of doing the same thing in Python or am I stuck with an 'if' statement?</p>
[ { "answer_id": 135318, "author": "Thomas Wouters", "author_id": 17624, "author_profile": "https://Stackoverflow.com/users/17624", "pm_score": 6, "selected": true, "text": "A if C else B\n" }, { "answer_id": 135342, "author": "Dan Udey", "author_id": 21450, "author_pro...
2008/09/25
[ "https://Stackoverflow.com/questions/135303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20133/" ]
135,314
<p>What is the fastest list implementation (in java) in a scenario where the list will be created one element at a time then at a later point be read one element at a time? The reads will be done with an iterator and then the list will then be destroyed.<br> I know that the Big O notation for get is O(1) and add is O(1) for an ArrayList, while LinkedList is O(n) for get and O(1) for add. Does the iterator behave with the same Big O notation?</p>
[ { "answer_id": 135358, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": 3, "selected": false, "text": "LinkedList" }, { "answer_id": 135380, "author": "erickson", "author_id": 3474, "author_profile": ...
2008/09/25
[ "https://Stackoverflow.com/questions/135314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13491/" ]
135,317
<p>When running a CherryPy app it will send server name tag something like CherryPy/version. Is it possible to rename/overwrite that from the app without modifying CherryPy so it will show something else? </p> <p>Maybe something like MyAppName/version (CherryPy/version) </p>
[ { "answer_id": 135644, "author": "Jay", "author_id": 20840, "author_profile": "https://Stackoverflow.com/users/20840", "pm_score": 2, "selected": false, "text": "def __init__(self):\n self.status = None\n self.header_list = None\n self._body = []\n self.time = time.time()\n\n self.h...
2008/09/25
[ "https://Stackoverflow.com/questions/135317", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9789/" ]
135,330
<p>Does anybody know if there is a built-in function in Mathematica for getting the lhs of downvalue rules (without any holding)? I know how to write the code to do it, but it seems basic enough for a built-in</p> <p>For example:</p> <pre><code>a[1]=2; a[2]=3; </code></pre> <p><code>BuiltInIDoNotKnowOf[a]</code> returns <code>{1,2}</code></p>
[ { "answer_id": 138033, "author": "Will Robertson", "author_id": 4161, "author_profile": "https://Stackoverflow.com/users/4161", "pm_score": 4, "selected": true, "text": "a[1] = 2\na[2] = 3\na[3] = 5\na[6] = 8\nPart[DownValues[a], All, 1, 1, 1]\n" }, { "answer_id": 154704, "au...
2008/09/25
[ "https://Stackoverflow.com/questions/135330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279/" ]
135,339
<p>Within an n-tier app that makes use of a WCF service to interact with the database, what is the best practice way of making use of LinqToSql classes throughout the app?</p> <p>I've seen it done a couple of different ways but they seemed like they burned a lot of hours creating extra interfaces, message classes, and the like which reduces the benefit you get from not having to write your data access code.</p> <p>Is there a good way to do it currently? Are we stuck waiting for the Entity Framework?</p>
[ { "answer_id": 138033, "author": "Will Robertson", "author_id": 4161, "author_profile": "https://Stackoverflow.com/users/4161", "pm_score": 4, "selected": true, "text": "a[1] = 2\na[2] = 3\na[3] = 5\na[6] = 8\nPart[DownValues[a], All, 1, 1, 1]\n" }, { "answer_id": 154704, "au...
2008/09/25
[ "https://Stackoverflow.com/questions/135339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1860358/" ]
135,347
<p>When should you NOT use a singleton class although it might be very tempting to do so? It would be very nice if we had a list of most common instances of 'singletonitis' that we should take care to avoid.</p>
[ { "answer_id": 135389, "author": "Doug T.", "author_id": 8123, "author_profile": "https://Stackoverflow.com/users/8123", "pm_score": 0, "selected": false, "text": "// Its our database! We'll never need another\nclass Database\n{\n};\n" }, { "answer_id": 135465, "author": "JC....
2008/09/25
[ "https://Stackoverflow.com/questions/135347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1909/" ]
135,373
<p>I've always struggled with how to best include classes into my php code. Pathing is usually an issue but a few minutes ago i found <a href="https://stackoverflow.com/questions/4369/how-to-include-php-files-that-require-an-absolute-path">this question</a> which dramatically helps that. Now I'm reading about __autoload and thinking that it could make the process of developing my applications much easier. The problem is i like to maintain folder structure to separate areas of functionality as opposed to throwing everything into a general /lib folder. So if i override autoload to do a deep search of a class folder including all subfolders, what performance hits can i expect?</p> <p>Obviously this will depend on scale, depth of the folder structure and number of classes but generally I'm asking on a medium scale project will it cause problems. </p>
[ { "answer_id": 135867, "author": "Mez", "author_id": 20010, "author_profile": "https://Stackoverflow.com/users/20010", "pm_score": 1, "selected": false, "text": "function __autoload($classname)\n{\n try\n {\n if (class_exists($classname, false) OR interface_exists($classname...
2008/09/25
[ "https://Stackoverflow.com/questions/135373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7018/" ]
135,375
<p>I have a <code>ListBox</code> <code>DataTemplate</code> in WPF. I want one item to be tight against the left side of the <code>ListBox</code> and another item to be tight against the right side, but I can't figure out how to do this.</p> <p>So far I have a <code>Grid</code> with three columns, the left and right ones have content and the center is a placeholder with it's width set to "*". Where am I going wrong?</p> <p>Here is the code:</p> <pre><code>&lt;DataTemplate x:Key="SmallCustomerListItem"&gt; &lt;Grid HorizontalAlignment="Stretch"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition/&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition/&gt; &lt;ColumnDefinition Width="*"/&gt; &lt;ColumnDefinition/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;WrapPanel HorizontalAlignment="Stretch" Margin="0"&gt; &lt;!--Some content here--&gt; &lt;TextBlock Text="{Binding Path=LastName}" TextWrapping="Wrap" FontSize="24"/&gt; &lt;TextBlock Text=", " TextWrapping="Wrap" FontSize="24"/&gt; &lt;TextBlock Text="{Binding Path=FirstName}" TextWrapping="Wrap" FontSize="24"/&gt; &lt;/WrapPanel&gt; &lt;ListBox ItemsSource="{Binding Path=PhoneNumbers}" Grid.Column="2" d:DesignWidth="100" d:DesignHeight="50" Margin="8,0" Background="Transparent" BorderBrush="Transparent" IsHitTestVisible="False" HorizontalAlignment="Stretch"/&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; </code></pre>
[ { "answer_id": 135741, "author": "Joel B Fant", "author_id": 22211, "author_profile": "https://Stackoverflow.com/users/22211", "pm_score": 1, "selected": false, "text": "Grid" }, { "answer_id": 135750, "author": "17 of 26", "author_id": 2284, "author_profile": "https:...
2008/09/25
[ "https://Stackoverflow.com/questions/135375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/100/" ]
135,412
<p>I need to build a prototype for an intranet website, and I want to focus on usability (layout, navigability, etc) and leave the theme for later (I have very bad taste, so this will probably be done by someone else)</p> <p>I know about ASP.NET's capability of switching themes instantly, but how do I have to design the WebForms for it to be easy later? </p> <ul> <li>Should I create controls with a class attribute pointing to something that will exist in the future css? </li> <li>Or do I simply create the controls without worrying about this and it'll be handled easily when we create the theme?</li> </ul>
[ { "answer_id": 136239, "author": "Herb Caudill", "author_id": 239663, "author_profile": "https://Stackoverflow.com/users/239663", "pm_score": 2, "selected": false, "text": " <div class=\"ButtonContainer\">\n <asp:linkbutton runat=\"Server\" cssclass=\"Button Cancel\" command=\"...
2008/09/25
[ "https://Stackoverflow.com/questions/135412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1782/" ]
135,443
<p>There are a group of private methods in my class, and I need to call one dynamically based on an input value. Both the invoking code and the target methods are in the same instance. The code looks like this:</p> <pre><code>MethodInfo dynMethod = this.GetType().GetMethod("Draw_" + itemType); dynMethod.Invoke(this, new object[] { methodParams }); </code></pre> <p>In this case, <code>GetMethod()</code> will not return private methods. What <code>BindingFlags</code> do I need to supply to <code>GetMethod()</code> so that it can locate private methods?</p>
[ { "answer_id": 135455, "author": "Armin Ronacher", "author_id": 19990, "author_profile": "https://Stackoverflow.com/users/19990", "pm_score": 2, "selected": false, "text": "BindingFlags.NonPublic" }, { "answer_id": 135482, "author": "wprl", "author_id": 17847, "author...
2008/09/25
[ "https://Stackoverflow.com/questions/135443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8223/" ]
135,445
<p>I tried to use DriveInfo.IsReady, but it returns false if an unformatted floppy is in the drive.</p>
[ { "answer_id": 135763, "author": "Jonas Engström", "author_id": 7634, "author_profile": "https://Stackoverflow.com/users/7634", "pm_score": 3, "selected": true, "text": "SetLastError(0);\nHANDLE h = CreateFile(\"\\\\\\\\.\\\\A:\", ...);\nif (!ReadFile(h, buf, 512, &bytes_read, 0))\n{\n ...
2008/09/25
[ "https://Stackoverflow.com/questions/135445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
135,448
<p>How do I check if an object has a specific property in JavaScript?</p> <p>Consider:</p> <pre><code>x = {'key': 1}; if ( x.hasOwnProperty('key') ) { //Do this } </code></pre> <p>Is that the best way to do it?</p>
[ { "answer_id": 135466, "author": "Armin Ronacher", "author_id": 19990, "author_profile": "https://Stackoverflow.com/users/19990", "pm_score": 4, "selected": false, "text": "Object.prototype.hasOwnProperty.call(x, 'key')" }, { "answer_id": 135475, "author": "enobrev", "aut...
2008/09/25
[ "https://Stackoverflow.com/questions/135448", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4915/" ]
135,451
<p>I want to create a list of methods to execute. Each method has the same signature. I thought about putting delegates in a generic collection, but I keep getting this error:</p> <blockquote> <p>'method' is a 'variable' but is used like a 'method'</p> </blockquote> <p>In theory, here is what I would like to do:</p> <pre><code>List&lt;object&gt; methodsToExecute; int Add(int x, int y) { return x+y; } int Subtract(int x, int y) { return x-y; } delegate int BinaryOp(int x, int y); methodsToExecute.add(new BinaryOp(add)); methodsToExecute.add(new BinaryOp(subtract)); foreach(object method in methodsToExecute) { method(1,2); } </code></pre> <p>Any ideas on how to accomplish this? Thanks!</p>
[ { "answer_id": 135453, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 0, "selected": false, "text": "class Example\n{\n public delegate int AddDelegate(int x, int y);\n\n public List<AddDelegate> methods = new Lis...
2008/09/25
[ "https://Stackoverflow.com/questions/135451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8797/" ]
135,458
<p>Suppose I have the following code:</p> <pre><code>while(TRUE) { pthread_t *thread = (pthread_t *) malloc(sizeof(pthread_t)); pthread_create(thread, NULL, someFunction, someArgument); pthread_detach(*thread); sleep(10); } </code></pre> <p>Will the detached thread free the memory allocated by malloc, or is that something I now have to do?</p>
[ { "answer_id": 135922, "author": "Commodore Jaeger", "author_id": 4659, "author_profile": "https://Stackoverflow.com/users/4659", "pm_score": 4, "selected": true, "text": "pthread_t thread;\npthread_create(&thread, NULL, someFunction, someArgument);\n" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/135458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/542226/" ]
135,474
<p>For example:</p> <pre><code>char * myString = malloc(sizeof(char)*STRING_BUFFER_SIZE); free(myString); free(myString); </code></pre> <p>Are there any adverse side effects of doing this? </p>
[ { "answer_id": 135486, "author": "Khoth", "author_id": 20686, "author_profile": "https://Stackoverflow.com/users/20686", "pm_score": 2, "selected": false, "text": "free" }, { "answer_id": 135492, "author": "Armin Ronacher", "author_id": 19990, "author_profile": "https...
2008/09/25
[ "https://Stackoverflow.com/questions/135474", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2064/" ]
135,478
<p>I have an ASP.NET web service which does some heavy lifting, like say,some file operations, or generating Excel Sheets from a bunch of crystal reports. I don't want to be blocked by calling this web service, so i want to make the web service call asynchronous. Also, I want to call this web service from a web page, and want some mechanism which will allow me to keep polling the server so that i can i can show some indicator of progress on the screen, like say, the number of files that have been processed. Please note that i do not want a notification on completion of the web method call, rather, i want a live progress status. How do i go about it?</p>
[ { "answer_id": 135502, "author": "Dan Udey", "author_id": 21450, "author_profile": "https://Stackoverflow.com/users/21450", "pm_score": 3, "selected": true, "text": "http://yourserver.com/app/jobstatus/4133/" }, { "answer_id": 135592, "author": "Carra", "author_id": 21679...
2008/09/25
[ "https://Stackoverflow.com/questions/135478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1909/" ]
135,518
<p>In WPF, we are creating custom controls that inherit from button with completely drawn-from-scratch xaml graphics. We have a border around the entire button xaml and we'd like to use that as the location for updating the background when MouseOver=True in a trigger. What we need to know is how do we update the background of the border in this button with a gradient when the mouse hovers over it?</p>
[ { "answer_id": 135638, "author": "Joel B Fant", "author_id": 22211, "author_profile": "https://Stackoverflow.com/users/22211", "pm_score": 3, "selected": true, "text": "ControlTemplate" }, { "answer_id": 135796, "author": "Phobis", "author_id": 19854, "author_profile"...
2008/09/25
[ "https://Stackoverflow.com/questions/135518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21096/" ]
135,530
<p>I have an index on columns A, B, C, D of table T</p> <p>I have a query that pulls from T with A, B, C in the WHERE clause.</p> <p>Will the index be used or will a separate index be needed that only includes A, B, C?</p>
[ { "answer_id": 135570, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 3, "selected": false, "text": "WHERE A like '%x%'\n and B = 1\n and C = 1\n//\nWHERE A = 1\n OR B = 1\n OR C = 1\n//\nWHERE DateAdd(dd, 1, A) = '2008-01-...
2008/09/25
[ "https://Stackoverflow.com/questions/135530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11780/" ]
135,535
<p>I'm a PHPer, and am not writing object-oriented code.</p> <p>What are the advantages of OO over procedural code, and where can I learn how to apply these ideas to PHP?</p>
[ { "answer_id": 135656, "author": "Dan Udey", "author_id": 21450, "author_profile": "https://Stackoverflow.com/users/21450", "pm_score": 3, "selected": false, "text": "Poll::Display()" }, { "answer_id": 135805, "author": "moffdub", "author_id": 10759, "author_profile":...
2008/09/25
[ "https://Stackoverflow.com/questions/135535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16511/" ]
135,573
<p>I have a project containing at least one DLL along with the executable output. I have added a Deployment Project to this solution, which asked me for a name and working directory upon creation like all projects.</p> <p>I named this "MyProduc_Installer" and have been able to modify all aspects of the installation process except for changing the name of the installer itself. Throughout the install process, the user sees messages like "Welcome to the MyProduct_Installer Installer." Even in the Add/Remove Programs list, this is the application's ill conceived title.</p> <p>How do I change this setting? I have tried right click/properties, as well as all the View options. I couldn't find anything in the assembly information for the executable project, or solution properties.</p> <p>I have tried right-clicking on the project in the Explorer to change the properties, but here is what I see:</p> <p><img src="https://sites.google.com/site/sizerfx/Home/properties.png?attredirects=0" alt="alt text"></p> <p>There is no setting here to change the project title.</p>
[ { "answer_id": 5468352, "author": "CooPzZ", "author_id": 323806, "author_profile": "https://Stackoverflow.com/users/323806", "pm_score": 0, "selected": false, "text": "<ProductName>xyz wrong name</ProductName>" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/135573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/414107/" ]
135,591
<p>I've seen several products that will track the sales rank of an item on Amazon. Does Amazon have any web-services published that I can use to get the sales rank of a particular item? </p> <p>I've looked through the AWS and didn't see anything of that nature.</p>
[ { "answer_id": 135627, "author": "Adam Hughes", "author_id": 3863, "author_profile": "https://Stackoverflow.com/users/3863", "pm_score": 4, "selected": true, "text": "http://ecs.amazonaws.com/onca/xml?\nService=AWSECommerceService&\nAWSAccessKeyId=[AWS Access Key ID]&\nOperation=ItemLook...
2008/09/25
[ "https://Stackoverflow.com/questions/135591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4244/" ]
135,600
<p>When I download my program from my website to my windows 2003 machine, it has a block on it and you have to right click on the exe, then properties, then select the button "Unblock".</p> <p>I would like to add detection in my installer for when the file is blocked and hence doesn't have enough permissions. </p> <p>But I can't eaisly reproduce getting my exe in this state where it needs to be unblocked.</p> <p>How can I get the unblock to appear on my exe so I can test this functionality?</p>
[ { "answer_id": 135924, "author": "HitScan", "author_id": 9490, "author_profile": "https://Stackoverflow.com/users/9490", "pm_score": 5, "selected": true, "text": "[ZoneTransfer]\nZoneId=3\n" }, { "answer_id": 267495, "author": "Community", "author_id": -1, "author_pro...
2008/09/25
[ "https://Stackoverflow.com/questions/135600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
135,634
<p>In the (otherwise) excellent book <a href="http://www.gotw.ca/publications/c++cs.htm" rel="nofollow noreferrer">C++ Coding Standards</a>, Item 44, titled <strong>"Prefer writing nonmember nonfriend functions"</strong>, Sutter and Alexandrescu recommend that only functions that really need access to the members of a class be themselves members of that class. All other operations which can be written by using only member functions should not be part of the class. They should be nonmembers and nonfriends. The arguments are that:</p> <ul> <li>It promotes encapsulation, because there is less code that needs access to the internals of a class.</li> <li>It makes writing function templates easier, because you don't have to guess each time whether some function is a member or not.</li> <li>It keeps the class small, which in turn makes it easier to test and maintain.</li> </ul> <p>Although I see the value in these argument, I see a huge drawback: <strong>my IDE can't help me find these functions!</strong> Whenever I have an object of some kind, and I want to see what operations are available on it, I can't just type "<code>pMysteriousObject-&gt;</code>" and get a list of member functions anymore. </p> <p>Keeping a clean design is in the end about making your programming life easier. But this would actually make mine much harder.</p> <p>So I'm wondering if it's really worth the trouble. <strong>How do you deal with that?</strong></p>
[ { "answer_id": 135684, "author": "Derek Park", "author_id": 872, "author_profile": "https://Stackoverflow.com/users/872", "pm_score": 3, "selected": true, "text": "foo()" }, { "answer_id": 135712, "author": "Lou Franco", "author_id": 3937, "author_profile": "https://S...
2008/09/25
[ "https://Stackoverflow.com/questions/135634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2095/" ]
135,653
<p>I have some tables that I build as a part of my report rollup. I don't need them afterwards at all. Someone mentioned to truncate them as it would be faster. </p>
[ { "answer_id": 2591131, "author": "Sasikiran", "author_id": 310790, "author_profile": "https://Stackoverflow.com/users/310790", "pm_score": 1, "selected": false, "text": "DELETE" }, { "answer_id": 47667506, "author": "Optimizer", "author_id": 3608072, "author_profile"...
2008/09/25
[ "https://Stackoverflow.com/questions/135653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208/" ]
135,661
<p>Let's collect some tips for evaluating the appropriate use of global.asax.</p>
[ { "answer_id": 850158, "author": "Slim", "author_id": 29774, "author_profile": "https://Stackoverflow.com/users/29774", "pm_score": 0, "selected": false, "text": "Session_Start" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/135661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337/" ]
135,664
<p>For example, how much memory is required to store a list of one million (32-bit) integers?</p> <pre><code>alist = range(1000000) # or list(range(1000000)) in Python 3.0 </code></pre>
[ { "answer_id": 135718, "author": "Dan Lenski", "author_id": 20789, "author_profile": "https://Stackoverflow.com/users/20789", "pm_score": 5, "selected": false, "text": "array" }, { "answer_id": 136083, "author": "jfs", "author_id": 4279, "author_profile": "https://Sta...
2008/09/25
[ "https://Stackoverflow.com/questions/135664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4279/" ]
135,670
<p>This post is similar to <a href="https://stackoverflow.com/questions/16829/structure-of-projects-in-version-control">this previously asked question.</a> I really want to set up my SVN repository in TTB format, but when creating a project in Visual Studio 2008 (ASP.NET/VB.NET), the structure created tends to be incompatible when considering the solution file, project files, folders for projects, multiple projects within solutions, etc. Does anyone have a script or procedure to take a newly created ASP.NET project and move it to a TTB format as painlessly as possible?</p> <hr> <p>Let me be more specific. Suppose I have a project that I'm creating called StackOverflowIsAwesome. I can put that into my local folder structure (let's say that it's c:\working). When I create it, VS creates c:\working\StackOverflowIsAwesome and a whole bunch of subfolders (bin, app_data, etc.). But I want my repository structure to look like...</p> <pre> StackOverflowIsAwesome /trunk /bin /app_data /tags /branches </pre> <p>So, is there a clean way to do this consistently or do I need to resort to constantly moving/modifying files and folders to make this work?</p>
[ { "answer_id": 135806, "author": "RS Conley", "author_id": 7890, "author_profile": "https://Stackoverflow.com/users/7890", "pm_score": 0, "selected": false, "text": "/tag\n\n/core_library\n /branch\n /main\n\n/business_logic\n /branch\n /main\n\n/report_library\n /branch\n /main\...
2008/09/25
[ "https://Stackoverflow.com/questions/135670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18009/" ]
135,688
<p>What is the proper way to modify environment variables like PATH in OS&nbsp;X?</p> <p>I've looked on Google a little bit and found three different files to edit:</p> <ul> <li>/etc/paths</li> <li>~/.profile</li> <li>~/.tcshrc</li> </ul> <p>I don't even have some of these files, and I'm pretty sure that <em>.tcshrc</em> is wrong, since OS&nbsp;X uses bash now. Where are these variables, especially PATH, defined?</p> <p>I'm running <a href="http://en.wikipedia.org/wiki/Mac_OS_X_Leopard" rel="noreferrer">OS&nbsp;X&nbsp;v10.5</a> (Leopard).</p>
[ { "answer_id": 135697, "author": "tim_yates", "author_id": 6509, "author_profile": "https://Stackoverflow.com/users/6509", "pm_score": 7, "selected": false, "text": "~/.MacOSX/environment.plist\n" }, { "answer_id": 135702, "author": "John Millikin", "author_id": 3560, ...
2008/09/25
[ "https://Stackoverflow.com/questions/135688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85/" ]
135,730
<p>What are the different types of indexes, what are the benefits of each?</p> <p>I heard of covering and clustered indexes, are there more? Where would you use them?</p>
[ { "answer_id": 136272, "author": "dland", "author_id": 18625, "author_profile": "https://Stackoverflow.com/users/18625", "pm_score": 3, "selected": false, "text": "create index i on customers (id, name, whatever) where is_active is true;\n" }, { "answer_id": 142327, "author":...
2008/09/25
[ "https://Stackoverflow.com/questions/135730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208/" ]
135,734
<p>I am trying to learn Emacs and trying to find best keyboard layout for me. One thing is really annoying me. I have added following lines to .emacs</p> <pre class="lang-lisp prettyprint-override"><code>(global-set-key "\C-y" 'scroll-up) (global-set-key "\M-y" 'scroll-down) </code></pre> <p>When I hold <kbd>Control</kbd> and press <kbd>y</kbd> a few times, it will page down on every press of <kbd>y</kbd>.</p> <p><strong>However</strong>, when I hold the <kbd>Windows</kbd> key (mapped as <kbd>Meta</kbd>) and press <kbd>y</kbd> a few times it will only page up on the <strong>first</strong> press of <kbd>y</kbd> and all subsequent presses of <kbd>y</kbd> I get the ‘y’ character inserted in the buffer.</p> <p>Can the page up behave like page down? I want to hold <kbd>Meta</kbd> and keep pressing <kbd>y</kbd> to scroll multiple pages up.</p> <p>I am using GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600) of 2008-05-12 on LENNART-69DE564 (patched). It is Emacs with EmacsW32 patch. Is this problem with this Emacs? Problem with Meta key?</p> <p>I tried original GNU Emacs (not patched) and it works OK with <kbd>Alt</kbd>. But my problem is not that I want to scroll without releasing any key. I release key <kbd>y</kbd> and press it multiple times but don't want to have to release <kbd>Meta</kbd> key. Same problem is described here:</p> <p><a href="http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/f30f4b75a8b75b10" rel="nofollow noreferrer">http://groups.google.com/group/gnu.emacs.help/browse_thread/thread/f30f4b75a8b75b10</a></p> <p>Problem is not in that I have changed key mapping. It looks like it is a bug in EmacsW32 version. Here is another description of the problem: <a href="http://www.nabble.com/23.0.60--Unreleased-Meta-Win-modifier-td19213327.html" rel="nofollow noreferrer">Unreleased Meta/Win modifier</a></p>
[ { "answer_id": 293829, "author": "jfs", "author_id": 4279, "author_profile": "https://Stackoverflow.com/users/4279", "pm_score": 3, "selected": false, "text": "C-v" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/135734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/438025/" ]
135,745
<p>I have a simple web service, it takes 2 parameters one is a simple xml security token, the other is usually a long xml string. It works with short strings but longer strings give a 400 error message. maxMessageLength did nothing to allow for longer strings.</p>
[ { "answer_id": 135809, "author": "Yuval Peled", "author_id": 20257, "author_profile": "https://Stackoverflow.com/users/20257", "pm_score": 2, "selected": false, "text": " NetTcpBinding binding = new NetTcpBinding(SecurityMode.None, true);\n\n // Allow big arguments on messa...
2008/09/25
[ "https://Stackoverflow.com/questions/135745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22367/" ]
135,754
<p>It is typical to have something like this in your cshrc file for setting the path:</p> <pre><code>set path = ( . $otherpath $path ) </code></pre> <p>but, the path gets duplicated when you source your cshrc file multiple times, how do you prevent the duplication?</p> <p>EDIT: This is one unclean way of doing it:</p> <pre><code>set localpaths = ( . $otherpaths ) echo ${path} | egrep -i "$localpaths" &gt;&amp; /dev/null if ($status != 0) then set path = ( . $otherpaths $path ) endif </code></pre>
[ { "answer_id": 135783, "author": "Andrew Stein", "author_id": 13029, "author_profile": "https://Stackoverflow.com/users/13029", "pm_score": 0, "selected": false, "text": "set path = (. ~/bin /bin /usr/bin /usr/ucb /usr/bin/X11)\n" }, { "answer_id": 135831, "author": "ShoeLace...
2008/09/25
[ "https://Stackoverflow.com/questions/135754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18415/" ]
135,755
<p>How do you find the version of an installed Perl module?</p> <p>This is in an answer down at the bottom, but I figure it important enough to live up here. With these suggestions, I create a function in my <code>.bashrc</code></p> <pre><code>function perlmodver { perl -M$1 -e 'print "Version " . $ARGV[0]-&gt;VERSION . " of " . $ARGV[0] . \ " is installed.\n"' $1 } </code></pre>
[ { "answer_id": 135760, "author": "zigdon", "author_id": 4913, "author_profile": "https://Stackoverflow.com/users/4913", "pm_score": 6, "selected": false, "text": "perl -MSome::Module -le 'print $Some::Module::VERSION'\n" }, { "answer_id": 135773, "author": "Jon Ericson", ...
2008/09/25
[ "https://Stackoverflow.com/questions/135755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17339/" ]
135,759
<p>Why can't I create a <code>class</code> in <code>VB.NET</code> that <code>inherits</code> <code>System.IO.Directory</code>? According to Lutz Roeder, it is <em>not</em> declared as <code>NotInheritable</code>!</p> <p>I want to create a <code>utility class</code> that adds functionality to the <code>Directory class</code>. For instance, I want to add a <code>Directory.Move</code> function.</p> <p>Please advise and I will send you a six pack. OK nevermind I'm not sending you anything but if you come to the bar tonight I will hook you up and then beat you in pool.</p>
[ { "answer_id": 135772, "author": "David Basarab", "author_id": 2469, "author_profile": "https://Stackoverflow.com/users/2469", "pm_score": 5, "selected": true, "text": "namespace System.IO\n{\n // Summary:\n // Exposes static methods for creating, moving, and enumerating throug...
2008/09/25
[ "https://Stackoverflow.com/questions/135759", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54420/" ]
135,777
<h2>Seeking a method to:</h2> <h2>Take whitespace separated tokens in a String; return a suggested Word</h2> <p><br> <strong>ie:</strong><br> Google Search can take <em>"fonetic wrd nterpreterr"</em>,<br> and atop of the result page it shows <em>"Did you mean: phonetic word interpreter"</em></p> <p><em>A solution in any of the C* languages or Java would be preferred.</em></p> <p><br> <strong>Are there any existing Open Libraries which perform such functionality?</strong></p> <p><strong>Or is there a way to Utilise a Google API to request a suggested word?</strong></p>
[ { "answer_id": 707323, "author": "Jonathan C Dickinson", "author_id": 24064, "author_profile": "https://Stackoverflow.com/users/24064", "pm_score": 2, "selected": false, "text": "startup()\n{\n set the spelling engines word suggestion limit to 1\n}\n\noption 1()\n{\n int currentPosit...
2008/09/25
[ "https://Stackoverflow.com/questions/135777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4857/" ]
135,782
<p>A lot of my C# code follows this pattern:</p> <pre><code>void foo(string param1, string param2, string param3) { try { // do something... } catch(Exception ex) { LogError(String.Format("Error in foo(param1={0}, param2={1}, param3={2}), exception={3}", param1, param2, param3, ex.Message)); } } </code></pre> <p>Is there a way in .NET to get a Key/Value list of the parameters to a function so that I can call another function to construct my error logging string? OR Do you have a more generic / better way of doing this?</p>
[ { "answer_id": 135813, "author": "David Basarab", "author_id": 2469, "author_profile": "https://Stackoverflow.com/users/2469", "pm_score": 1, "selected": false, "text": "public class LogArgs\n{\n\n public string MethodName { get; set; }\n public string ClassName { get; set; }\n ...
2008/09/25
[ "https://Stackoverflow.com/questions/135782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
135,799
<p>I've been using the macro from <a href="http://weblogs.asp.net/koenv/archive/2008/02/14/quick-attach-and-detach-debugger.aspx" rel="nofollow noreferrer">this blog entry</a> for attaching the Visual Studio debugger to an already running instance of the Web Application I'm currently working on. However, if I have more than one instance of the Visual Studio web server running it's pot luck which one it'll attach to.</p> <p>Is there a way to determine what port is configured in the Web project so I can modify the macro to filter its choice of process to that one?</p> <hr> <p>Further Info</p> <p>I'm aware that you can set the port number to a static one - I've done just that from the get-go, what I'm trying to determine is how to <em>programatically</em> determine the defined port-number so I can modify the macro (in the linked blog entry) and ensure it connects to the right instance of the Visual Studio web server.</p> <p>The way I have things running is I have two (or more) instances of Visual Studio running, each of which contains a Solution, which contains a web project and one or more other projects - typically an Installer project), so when I trigger the macro from a given instance of Visual Studio, I want to find the Web Project within that instances loaded solution and determine the port it's running against.</p>
[ { "answer_id": 226484, "author": "Annagram", "author_id": 29324, "author_profile": "https://Stackoverflow.com/users/29324", "pm_score": 2, "selected": false, "text": "Sub GetWebProjectPorts()\n Dim ports As String\n\n For Each prj As Project In DTE.Solution.Projects\n For Ea...
2008/09/25
[ "https://Stackoverflow.com/questions/135799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7872/" ]
135,801
<p>I am using prototype and I can't find any built in extensions to set or retrieve cookies. After googling for a little bit, I see a few different ways to go about it. I was wondering what you think is the best approach for getting a cookie in JavaScript?</p>
[ { "answer_id": 135855, "author": "Diodeus - James MacFarlane", "author_id": 12579, "author_profile": "https://Stackoverflow.com/users/12579", "pm_score": -1, "selected": false, "text": "function getCookie(c_name) {\nif (document.cookie.length>0)\n {\n c_start=document.cookie.indexOf(c_...
2008/09/25
[ "https://Stackoverflow.com/questions/135801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6350/" ]
135,802
<p>I'm looking for the concept to <strong>spawn a process</strong> such that:</p> <ul> <li>it has only access to certain libraries/APIs</li> <li>it cannot acess the file system or only specific parts</li> <li>it can <strong>do least harm should malicious code run in it</strong></li> </ul> <p>This concept is known as sandbox or jail.</p> <p>It is required to do this <strong>for each major Operating system (Windows, MacOSX and Linux)</strong> and the question is conceptual (as in what to do, <strong>which APIs to use and and what to observe</strong>) rather then language specific.</p> <h2>answer requirements</h2> <p>I <strong>really</strong> want to accept an answer and give you 20 points for that. I cannot accept my own answer, and I don't have it yet anyway. So if you <strong>really</strong> want your answer to be accepted, please observe:</p> <ul> <li>The answer has to be specific and complete</li> <li>With specific I mean that it is more then a pointer to some resource on the internet. It has to summarize what the resource says about the topic at least.</li> <li>It may or may not contain example code, but if it does please write it in C</li> <li>I cannot accept an answer that is 2/3 complete even if the 2/3 that are there are perfect.</li> </ul> <h2>this question FAQ</h2> <ul> <li>Is this homework? No.</li> <li>Why do you ask this like a homework question? If you ask a specific question and you want to get a specific answer, and you know how that answer should look like, even though you don't know <em>the</em> answer, that's the style of question you get.</li> <li>If you know how it should look like, why do you ask? 1) because I don't know all the answer 2) because on the internet there's no single place that contains all the details to this question in one place. Please also read the stackoverflow FAQ</li> <li>Why is the main part of your question how to answer this question? Because nobody reads the FAQ.</li> </ul>
[ { "answer_id": 153111, "author": "Trance Diviner", "author_id": 7365, "author_profile": "https://Stackoverflow.com/users/7365", "pm_score": 4, "selected": false, "text": "(allow process-exec (regex #\"^/usr/sbin/portmap$\"))\n(allow file-read-data file-read-metadata (regex\n #\"^/etc\...
2008/09/25
[ "https://Stackoverflow.com/questions/135802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19435/" ]
135,803
<blockquote> <p>System.InvalidOperationException: DragDrop registration did not succeed. ---> System.Threading.ThreadStateException:</p> </blockquote> <p>What does this exception mean? I get it at this line trying to add a panel to a panel at runtime...</p> <pre><code>splitReport.Panel1.Controls.Add(ChartPanel); </code></pre> <p>Working in VS2008 C#</p>
[ { "answer_id": 160867, "author": "Charlie", "author_id": 18529, "author_profile": "https://Stackoverflow.com/users/18529", "pm_score": 5, "selected": false, "text": "[STAThread]" }, { "answer_id": 2205399, "author": "Graviton", "author_id": 3834, "author_profile": "ht...
2008/09/25
[ "https://Stackoverflow.com/questions/135803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
135,826
<p>I am looking for some stats on current browsers for how long it takes to render a table using plain HTML versus a hacked-up CSS puritan method that avoids using actual <code>TABLE</code>, <code>TR</code>, <code>TD</code> etc. tags.</p> <p><strong>I am not looking for what's proper, only for what's faster</strong>, particularly on Firefox 3, although I am also interested in the stats for other browsers. Of <em>course</em> TABLE tags are designed for tables. That's not the question.</p>
[ { "answer_id": 135860, "author": "Dan Udey", "author_id": 21450, "author_profile": "https://Stackoverflow.com/users/21450", "pm_score": 0, "selected": false, "text": "<thead>" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/135826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16777/" ]
135,834
<p>In python, under what circumstances is SWIG a better choice than ctypes for calling entry points in shared libraries? Let's assume you don't already have the SWIG interface file(s). <br><br>What are the performance metrics of the two?</p>
[ { "answer_id": 4892651, "author": "MajesticRa", "author_id": 548894, "author_profile": "https://Stackoverflow.com/users/548894", "pm_score": 7, "selected": false, "text": "CppCamelStyleFunctions()" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/135834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14028/" ]
135,835
<p>I am trying to load a small sample of records from a large database into a test database.</p> <p>How do you tell mysqldump to only give you n records out of 8 million?</p> <p>Thanks</p>
[ { "answer_id": 135900, "author": "Adam Bellaire", "author_id": 21632, "author_profile": "https://Stackoverflow.com/users/21632", "pm_score": 8, "selected": false, "text": "mysqldump --opt --where=\"1 limit 1000000\" database\n" }, { "answer_id": 19830993, "author": "Casper An...
2008/09/25
[ "https://Stackoverflow.com/questions/135835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
135,841
<p>As just stated in a recent <a href="https://stackoverflow.com/questions/135759/why-cant-i-inherit-iodirectory">question</a> and <a href="https://stackoverflow.com/questions/135759/why-cant-i-inherit-iodirectory#135772">answer</a>, you can't inherit from a static class. How does one enforce the rules that go along with static classes inside VB.NET? Since the framework is compatible between C# and VB it would make sense that there would be a way to mark a class static, but there doesn't seem to be a way.</p>
[ { "answer_id": 135852, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 8, "selected": true, "text": "NotInheritable" }, { "answer_id": 16497226, "author": "Mentor", "author_id": 1520418, "author_profi...
2008/09/25
[ "https://Stackoverflow.com/questions/135841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8505/" ]
135,845
<p>A colleague of mine states that <strong>booleans as method arguments are not acceptable</strong>. They shall be replaced by enumerations. At first I did not see any benefit, but he gave me an example.</p> <p>What's easier to understand?</p> <pre><code>file.writeData( data, true ); </code></pre> <p>Or</p> <pre><code>enum WriteMode { Append, Overwrite }; file.writeData( data, Append ); </code></pre> <p>Now I got it! ;-)<br> This is definitely an example where an enumeration as second parameter makes the code much more readable.</p> <p>So, what's your opinion on this topic?</p>
[ { "answer_id": 135882, "author": "Jesse C. Slicer", "author_id": 3312, "author_profile": "https://Stackoverflow.com/users/3312", "pm_score": 2, "selected": false, "text": "KeepWritingData (DataAvailable());\n" }, { "answer_id": 135891, "author": "Greg Beech", "author_id":...
2008/09/25
[ "https://Stackoverflow.com/questions/135845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2012356/" ]
135,849
<p>I'm trying to host a python script using an apache web server, but the server tries to run the script instead of just offering it for download.</p> <p>I do not have direct access to server, and adding the line</p> <pre><code>AddType text/plain .py </code></pre> <p>to .htaccess in the root folder does not appear to work, though I could be doing something wrong.</p> <p>How do I get the server to just send the file as text instead of trying to run it?</p> <p>-Edit</p> <p>Changing the name does not work. Script.py.safe still give a 500 Server error when you click it. </p> <p>I should also mention that the .htaccess file does work, but for some reason that one addType line is not working. Either because it's not overriding something, or the line is wrong.</p>
[ { "answer_id": 135890, "author": "Mez", "author_id": 20010, "author_profile": "https://Stackoverflow.com/users/20010", "pm_score": 0, "selected": false, "text": "<IfModule mime_module>\n <Files *.py>\n ForceType text/plain\n </Files>\n</IfModule>\n" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/135849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30/" ]
135,896
<p>Does anyone know of a web site where I can find a list of 32-bit MIPS instructions/opcodes, with the following features:</p> <ul> <li>Clearly distinguishes between real opcodes and assembly-language macros (pseudo-instructions)</li> <li>Describes the instruction behavior including differences depending on privilege level. <li>Indicates in which instruction set revision the instruction was introduced/revised (e.g. MIPS I, MIPS II, MIPS32, etc.)</li> <li>Includes privileged instructions such as syscall.</li> </ul> <p>I am aware of numerous web sites which document &quot;part of&quot; the instruction set, mostly for teaching purposes. They tend to leave out or only partially describe floating-point and privileged instructions.</p> <p>In case you're wondering, I'm looking at Verilog code for a MIPS processor subset, and trying to figure out exactly to what extent it complies with the instruction sets of any real MIPS processors!</p>
[ { "answer_id": 136240, "author": "Benoit", "author_id": 10703, "author_profile": "https://Stackoverflow.com/users/10703", "pm_score": 0, "selected": false, "text": "nor" }, { "answer_id": 47432637, "author": "Peter Cordes", "author_id": 224132, "author_profile": "http...
2008/09/25
[ "https://Stackoverflow.com/questions/135896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20789/" ]
135,909
<p>I run into this occasionally and always forget how to do it.</p> <p>One of those things that pop up ever so often.</p> <p>Also, what's the formula to convert angles expressed in radians to degrees and back again?</p>
[ { "answer_id": 135927, "author": "thesmallprint", "author_id": 12765, "author_profile": "https://Stackoverflow.com/users/12765", "pm_score": 3, "selected": false, "text": "function convert($type, $num) {\n if ($type == \"rads\") {\n $result = $num*180/pi();\n }\n\n ...
2008/09/25
[ "https://Stackoverflow.com/questions/135909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8683/" ]
135,919
<p>I haven't been able to find an adequate answer to what exactly the following error means:</p> <p><code>java.net.SocketException: Software caused connection abort: recv failed</code> </p> <p>Notes:</p> <ul> <li>This error is infrequent and unpredictable; although getting this error means that all future requests for URIs will also fail.</li> <li>The only solution that works (also, only occasionally) is to reboot Tomcat and/or the actual machine (Windows in this case).</li> <li>The URI is definitely available (as confirmed by asking the browser to do the fetch).</li> </ul> <p>Relevant code:</p> <pre><code>BufferedReader reader; try { URL url = new URL(URI); reader = new BufferedReader(new InputStreamReader(url.openStream()))); } catch( MalformedURLException e ) { throw new IOException("Expecting a well-formed URL: " + e); }//end try: Have a stream String buffer; StringBuilder result = new StringBuilder(); while( null != (buffer = reader.readLine()) ) { result.append(buffer); }//end while: Got the contents. reader.close(); </code></pre>
[ { "answer_id": 10246311, "author": "Michael J. Gray", "author_id": 468904, "author_profile": "https://Stackoverflow.com/users/468904", "pm_score": 1, "selected": false, "text": "shutdownInput" }, { "answer_id": 25479748, "author": "Sergio", "author_id": 3974252, "auth...
2008/09/25
[ "https://Stackoverflow.com/questions/135919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12815/" ]
135,929
<p>I'd like to just put in a comment in the block of my if-statement, but I get an error when I try. I want to be more like Steve McConnell.</p> <pre><code>declare @ConstraintName varchar(255) set @ConstraintName = 'PK_Whatever' IF LEFT(@ConstraintName, 2) = 'PK' BEGIN --can't drop primary keys END </code></pre> <p>The error I get is:</p> <pre><code>Incorrect syntax near 'END'. </code></pre> <p>If I add something after the comment, i.e. <code>PRINT @ConstraintName</code>, it works fine.</p>
[ { "answer_id": 135962, "author": "Dave Costa", "author_id": 6568, "author_profile": "https://Stackoverflow.com/users/6568", "pm_score": 2, "selected": false, "text": "BEGIN\n -- This is a comment\n NULL;\nEND\n" }, { "answer_id": 139140, "author": "Even Mien", "author_i...
2008/09/25
[ "https://Stackoverflow.com/questions/135929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/73794/" ]
135,934
<p>I need to show a camera capture dialog in a compact framework 3.7 application by pinvoking SHCameraCapture from the dll Aygshell.dll. I cannont use the managed object CameraCaptureDialog because of limitations with the technology I'm working with. Instead, I need to access it by Pinvoking it.</p> <p>See <a href="http://msdn.microsoft.com/en-us/library/aa454995.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa454995.aspx</a> for documentation on the function. The function takes in a struct that defines the parameters of the dialog. e.g. where to save the file, what resolution to use.</p> <p>I would imaging that I would have to define a copy of the struct in C# and decorate the sturct with the attribute StructLayout. I also imagine that the code would involve [DllImport("aygshell.dll")]. Any sample code of how to call this would be much appreciated.</p>
[ { "answer_id": 138398, "author": "Grokys", "author_id": 6448, "author_profile": "https://Stackoverflow.com/users/6448", "pm_score": 0, "selected": false, "text": "struct SHCAMERACAPTURE {\n public Int32 cbSize;\n public IntPtr hwndOwner;\n\n [MarshalAs(UnmanagedType.ByValTStr, SizeCon...
2008/09/25
[ "https://Stackoverflow.com/questions/135934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12497/" ]
135,938
<p>It's not a matter of life or death but I wonder if this could be possible:</p> <p>I got a couple of events from one type of custom event (FormEvent) now I got a FormListener that listens to all those events and handles them according to the event type. Instead of adding one eventListener at the time I wish to add all events at once.</p> <p>so now it looks like this:</p> <pre><code> private function addListeners():void { addEventListener(FormEvent.SHOW_FORM, formListener); addEventListener(FormEvent.SEND_FORM, formListener); addEventListener(FormEvent.CANCEL_FORM, formListener); } private function formListener(event:formEvent):void { switch(event.type){ case "show.form": // handle show form stuff break; case "send.form": // handle send form stuff break; case "cancel.form": // handle cancel form stuff break; } } </code></pre> <p>but instead of adding every event one at the time I would rather be doing something like</p> <pre><code> private function addListeners():void { addEventListener(FormEvent.*, formListener); } </code></pre> <p>I wonder if something like this is possible, i would love it. I work with loads of events :)</p>
[ { "answer_id": 136258, "author": "Matt Dillard", "author_id": 863, "author_profile": "https://Stackoverflow.com/users/863", "pm_score": 0, "selected": false, "text": "private function addMultipleEventListeners( evts:Array, callback:function ):void\n{\n for each( var evt:Event in evts ...
2008/09/25
[ "https://Stackoverflow.com/questions/135938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18671/" ]
135,944
<p>Stored procs in SQL Server sometimes finish with a return code, as opposed to a recordset of data. I've seen ASP code that's able to get this return code, but I can't figure out how to get this code with PHP's mssql driver.</p> <p>mssql_get_last_message() always returns nothing, and I'm thinking it's because it only returns the very last line that came from the server. When we run the proc in another application (outside PHP), there is blank line following the return code.</p> <p>Has anyone figured out how to get return codes from SQL stored procs using PHP's mssql driver?</p>
[ { "answer_id": 135963, "author": "Matt Rogish", "author_id": 2590, "author_profile": "https://Stackoverflow.com/users/2590", "pm_score": 3, "selected": true, "text": "DECLARE @return_code INT\nEXEC @return_code = your_stored_procedure 1123\nSELECT @return_code\n" }, { "answer_id"...
2008/09/25
[ "https://Stackoverflow.com/questions/135944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12308/" ]
135,971
<p>If you have two jars in your classpath that contain different versions of the same class, the classpath order becomes critical.</p> <p>I am looking for a tool that can detect and flag such potential conflicts in a given classpath or set of folders.</p> <p>Certainly a script that starts:</p> <pre><code>classes=`mktemp` for i in `find . -name "*.jar"` do echo "File: $i" &gt; $classes jar tf $i &gt; $classes ... done </code></pre> <p>with some clever sort/uniq/diff/grep/awk later on has potential, but I was wondering if anyone knows of any existing solutions.</p>
[ { "answer_id": 136292, "author": "OscarRyz", "author_id": 20654, "author_profile": "https://Stackoverflow.com/users/20654", "pm_score": 2, "selected": false, "text": "import java.io.*;\nimport java.util.zip.*;\n\n\npublic class ListZipContent{\n public static void main( String [] args...
2008/09/25
[ "https://Stackoverflow.com/questions/135971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5309/" ]
135,995
<p>So, I want to define a singleton method for an object, but I want to do it using a closure.</p> <p>For example,</p> <pre><code>def define_say(obj, msg) def obj.say puts msg end end o = Object.new define_say o, "hello world!" o.say </code></pre> <p>This doesn't work because defining a singleton method via "def" is not a closure, so I get an exception that "msg" is an undefined variable or method.</p> <p>What I would like to do is something like using the "define_method" method in the Module class, but as far as I can tell, this can only be used to define a method on a class... but I want a Singleton Method...</p> <p>So, I would love to write it something like this:</p> <pre><code>def define_say(obj, msg) obj.define_singleton_method(:say) { puts msg } end </code></pre> <p>Does anyone know how I can achieve this without having to create a method to store a Proc and then use the Proc within a singleton method? (basically, I want a clean, non-hacky way of doing this)</p>
[ { "answer_id": 136194, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 4, "selected": true, "text": "def define_say(obj, msg)\n # Get a handle to the singleton class of obj\n metaclass = class << obj; self; end \n\n # a...
2008/09/25
[ "https://Stackoverflow.com/questions/135995", "https://Stackoverflow.com", "https://Stackoverflow.com/users/122/" ]
136,033
<p>I despise the PHP language, and I'm quite certain that I'm not alone. But the great thing about PHP is the way that mod_php takes and hides the gory details of integrating with the apache runtime, and achieves CGI-like request isolation and decent performance.</p> <p>What's the shortest-distance approach to getting the same simplicity, speed and isolation as PHP's runtime environment, with Perl semantics? I feel like raw mod_perl gives me too much rope to hang myself with: cross-request globals, messy config, too many template engines to choose from. </p> <p>FastCGI? HTML::Mason? I'd like to do development largely in Perl, if only I had a framework that let me.</p>
[ { "answer_id": 137293, "author": "Zed", "author_id": 19202, "author_profile": "https://Stackoverflow.com/users/19202", "pm_score": 2, "selected": false, "text": "<html>" }, { "answer_id": 139363, "author": "David McLaughlin", "author_id": 3404, "author_profile": "http...
2008/09/25
[ "https://Stackoverflow.com/questions/136033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22369/" ]
136,034
<p>I've looked around for a good example of this, but I haven't run into one yet. I want to pass a custom string array from java to oracle and back, using the IBATIS framework. Does anyone have a good link to an example? I'm calling stored procs from IBATIS.</p> <p>Thanks</p>
[ { "answer_id": 137693, "author": "bsanders", "author_id": 22200, "author_profile": "https://Stackoverflow.com/users/22200", "pm_score": 2, "selected": false, "text": "TypeHandler" }, { "answer_id": 150572, "author": "Justin", "author_id": 22365, "author_profile": "htt...
2008/09/25
[ "https://Stackoverflow.com/questions/136034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22365/" ]
136,035
<p>It is discouraged to simply catch <code>System.Exception</code>. Instead, only the &quot;known&quot; exceptions should be caught.</p> <p>Now, this sometimes leads to unnecessary repetitive code, for example:</p> <pre><code>try { WebId = new Guid(queryString[&quot;web&quot;]); } catch (FormatException) { WebId = Guid.Empty; } catch (OverflowException) { WebId = Guid.Empty; } </code></pre> <p>I wonder: Is there a way to catch both exceptions and only call the <code>WebId = Guid.Empty</code> call once?</p> <p>The given example is rather simple, as it's only a <a href="http://en.wikipedia.org/wiki/Globally_unique_identifier" rel="noreferrer"><code>GUID</code></a>. But imagine code where you modify an object multiple times, and if one of the manipulations fails expectedly, you want to &quot;reset&quot; the <code>object</code>. However, if there is an unexpected exception, I still want to throw that higher.</p>
[ { "answer_id": 136038, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Stackoverflow.com/users/91", "pm_score": 3, "selected": false, "text": "catch (Exception ex)\n{\n switch (ex.GetType().Name)\n {\n case \"System.FormatException\":\n case \"Sy...
2008/09/25
[ "https://Stackoverflow.com/questions/136035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
136,050
<p>Is there a way to prevent VS2008 creating browse info file files for C++ projects.<br> I rarely use the class browser and it isn't worth the time it takes to recreate it after every build, especially since it runs even if the build failed.</p> <p>EDIT - it's also needed for go to declaration/definition</p>
[ { "answer_id": 1910905, "author": "Adisak", "author_id": 14904, "author_profile": "https://Stackoverflow.com/users/14904", "pm_score": 3, "selected": true, "text": "[HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\9.0\\Languages\\Language Services\\C/C++]" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/136050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10897/" ]
136,052
<p>I'm trying to send an email in Java but when I read the body of the email in Outlook, it's gotten rid of all my linebreaks. I'm putting \n at the ends of the lines but is there something special I need to do other than that? The receivers are always going to be using Outlook. </p> <p>I found a page on microsoft.com that says there's a 'Remove line breaks' "feature" in Outlook so does this mean there's no solution to get around that other than un-checking that setting?</p> <p>Thanks</p>
[ { "answer_id": 136061, "author": "EBGreen", "author_id": 1358, "author_profile": "https://Stackoverflow.com/users/1358", "pm_score": 0, "selected": false, "text": "\\r\\c" }, { "answer_id": 136095, "author": "Robert Wilkinson", "author_id": 2184, "author_profile": "ht...
2008/09/25
[ "https://Stackoverflow.com/questions/136052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3098/" ]
136,067
<p>I am working on a web app that uses Perl and I need to look into speeding up portions of the app. </p> <p>I thought I'd start profiling the particular calls for the portion I wish to investigate. I've done some searching on profiling Perl code, but unfortunately most of what I find says that I should run my perl code with <code>-d:DProf myapp</code> from the command line. That doesn't quite work for me since my code is within a web app. I did find a way to get the profiling to work with apache, but unfortunately, the "most used" modules that came back from the profiler were all CPAN modules -- Class::xyz, etc etc etc. Not terribly helpful.</p> <p>Does anyone know of a good way besides me injecting "timer" code into the methods I wish to profile to target just these methods? I've thought of writing a test script and profiling that but due to the nature of the code I'm working on that would require a bit more work than I'm hoping to have to do. </p>
[ { "answer_id": 136402, "author": "Sam Kington", "author_id": 6832, "author_profile": "https://Stackoverflow.com/users/6832", "pm_score": 3, "selected": false, "text": "\nhttp://example.com/scripts/example.pl?action=browse&search=grommet&restrict=blah\n" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/136067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22390/" ]
136,097
<p>What is the difference between a function decorated with <a href="http://docs.python.org/library/functions.html#staticmethod" rel="noreferrer"><code>@staticmethod</code></a> and one decorated with <a href="http://docs.python.org/library/functions.html#classmethod" rel="noreferrer"><code>@classmethod</code></a>?</p>
[ { "answer_id": 136138, "author": "Thomas Wouters", "author_id": 17624, "author_profile": "https://Stackoverflow.com/users/17624", "pm_score": 10, "selected": false, "text": "dict.fromkeys()" }, { "answer_id": 136149, "author": "Terence Simpson", "author_id": 22395, "a...
2008/09/25
[ "https://Stackoverflow.com/questions/136097", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4766/" ]
136,098
<p>Browsing to a dynamic web page built using Grails version 1.0.3 the console log shows the following errors for each page request:</p> <pre><code>[Fatal Error] :-1:-1: Premature end of file. </code></pre> <p>How do I stop this error from appearing for each request?</p>
[ { "answer_id": 158386, "author": "Josh", "author_id": 16175, "author_profile": "https://Stackoverflow.com/users/16175", "pm_score": 3, "selected": true, "text": "grails.mime.types = [ html: ['text/html','application/xhtml+xml'],\nxml: ['text/xml', 'application/xml'], ...\n" } ]
2008/09/25
[ "https://Stackoverflow.com/questions/136098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16175/" ]