qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
73,628
<p>If you have a JSF <code>&lt;h:commandLink&gt;</code> (which uses the <code>onclick</code> event of an <code>&lt;a&gt;</code> to submit the current form), how do you execute JavaScript (such as asking for delete confirmation) prior to the action being performed?</p>
[ { "answer_id": 73644, "author": "Grant Wagner", "author_id": 9254, "author_profile": "https://Stackoverflow.com/users/9254", "pm_score": 4, "selected": true, "text": "<h:commandLink id=\"myCommandLink\" action=\"#{myPageCode.doDelete}\">\n <h:outputText value=\"#{msgs.deleteText}\" />...
2008/09/16
[ "https://Stackoverflow.com/questions/73628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9254/" ]
73,629
<p>I have a string that is like below.</p> <pre><code>,liger, unicorn, snipe </code></pre> <p>in other languages I'm familiar with I can just do a string.trim(",") but how can I do that in c#?</p> <p>Thanks.</p> <hr> <p><em>There's been a lot of back and forth about the StartTrim function. As several have pointed out, the StartTrim doesn't affect the primary variable. However, given the construction of the data vs the question, I'm torn as to which answer to accept. True the question only wants the first character trimmed off not the last (if anny), however, there would never be a "," at the end of the data. So, with that said, I'm going to accept the first answer that that said to use StartTrim assigned to a new variable.</em></p>
[ { "answer_id": 73650, "author": "Bob King", "author_id": 6897, "author_profile": "https://Stackoverflow.com/users/6897", "pm_score": 0, "selected": false, "text": "if (s.StartsWith(\",\")) {\n s = s.Substring(1, s.Length - 1);\n}\n" }, { "answer_id": 73652, "author": "Deve...
2008/09/16
[ "https://Stackoverflow.com/questions/73629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/730/" ]
73,663
<p>How do I exit a script early, like the <code>die()</code> command in PHP?</p>
[ { "answer_id": 73673, "author": "pjz", "author_id": 8002, "author_profile": "https://Stackoverflow.com/users/8002", "pm_score": 12, "selected": true, "text": "import sys\nsys.exit()\n" }, { "answer_id": 73680, "author": "Vhaerun", "author_id": 11234, "author_profile":...
2008/09/16
[ "https://Stackoverflow.com/questions/73663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
73,667
<p>How can I start an interactive console for Perl, similar to the <code>irb</code> command for Ruby or <code>python</code> for Python?</p>
[ { "answer_id": 73685, "author": "Brian Phillips", "author_id": 7230, "author_profile": "https://Stackoverflow.com/users/7230", "pm_score": 3, "selected": false, "text": "perl -d" }, { "answer_id": 73689, "author": "Clinton Pierce", "author_id": 8173, "author_profile":...
2008/09/16
[ "https://Stackoverflow.com/questions/73667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5475/" ]
73,674
<p>I talked to a friend of mine and he told me that it's possible to create an image in an image editor (gimp/photoshop) and then use it as a button . He said that's the way applications that have great GUIs do it. </p> <p>He also said that there is a file describing which parts of the image make up the button.</p> <p>Is this possible , or is he "crazy"? :)</p>
[ { "answer_id": 73699, "author": "Joel Anair", "author_id": 7441, "author_profile": "https://Stackoverflow.com/users/7441", "pm_score": 1, "selected": false, "text": "<input type=\"button\" src=\"/path/to/image.png\" />\n" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/73674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11234/" ]
73,686
<pre><code>#include &lt;iostream&gt; using namespace std; int main() { double u = 0; double w = -u; cout &lt;&lt; w &lt;&lt; endl; return 0; } </code></pre> <p>Why does this great piece of code output <code>-0</code> and not <code>0</code>, as one would expect?</p>
[ { "answer_id": 73728, "author": "Doug T.", "author_id": 8123, "author_profile": "https://Stackoverflow.com/users/8123", "pm_score": 2, "selected": false, "text": "0" }, { "answer_id": 73740, "author": "Drealmer", "author_id": 12291, "author_profile": "https://Stackove...
2008/09/16
[ "https://Stackoverflow.com/questions/73686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6922/" ]
73,713
<p>The following will cause infinite recursion on the == operator overload method</p> <pre><code> Foo foo1 = null; Foo foo2 = new Foo(); Assert.IsFalse(foo1 == foo2); public static bool operator ==(Foo foo1, Foo foo2) { if (foo1 == null) return foo2 == null; return foo1.Equals(foo2); } </code></pre> <p>How do I check for nulls?</p>
[ { "answer_id": 73729, "author": "Andrew Jones", "author_id": 12767, "author_profile": "https://Stackoverflow.com/users/12767", "pm_score": 4, "selected": false, "text": "public static bool operator ==(Foo foo1, Foo foo2) {\n if ((object) foo1 == null) return (object) foo2 == null;\n ...
2008/09/16
[ "https://Stackoverflow.com/questions/73713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12767/" ]
73,736
<p>There are <a href="http://java-source.net/open-source/web-frameworks" rel="noreferrer">zillions</a> of Java web application frameworks.</p> <p>95% were designed before the modern era of AJAX/DHTML-based development, and that means these new methods are grafted on rather than designed in.</p> <p>Has any framework been built from the ground up with e.g. <a href="http://extjs.com/products/gxt/" rel="noreferrer">GWT + Extjs</a> in mind?</p> <p>If not, which framework has adapted best to the world of forms with dynamic numbers of fields and pages that morph client-side?</p>
[ { "answer_id": 46215447, "author": "Kushal Jain", "author_id": 2530851, "author_profile": "https://Stackoverflow.com/users/2530851", "pm_score": 0, "selected": false, "text": "GWT is used by many products at Google, including Google AdWords and Google\nWallet. It's open source, completel...
2008/09/16
[ "https://Stackoverflow.com/questions/73736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4926/" ]
73,748
<p>I have a dropdownlist with the autopostback set to true. I want the user to confirm if they really want to change the value, which on post back fires a server side event (selectedindexchanged).</p> <p>I have tried adding an onchange attribute "return confirm('Please click OK to change. Otherwise click CANCEL?';") but it will not postback regardless of the confirm result and the value in the list does not revert back if cancel selected. </p> <p>When I remove the onchange attribute from the DropdownList tag, the page does postback. It does not when the onchange attribute is added. Do I still need to wire the event handler (I'm on C# .Net 2.0 ).</p> <p>Any leads will be helpful.</p> <p>Thanks!</p>
[ { "answer_id": 73860, "author": "Brian Liang", "author_id": 5853, "author_profile": "https://Stackoverflow.com/users/5853", "pm_score": 0, "selected": false, "text": "dropDown.SelectedIndexChanged += new EventHandler(dropDown_SelectedIndexChanged);\n" }, { "answer_id": 74027, ...
2008/09/16
[ "https://Stackoverflow.com/questions/73748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/262613/" ]
73,751
<p>I've heard people referring to this table and was not sure what it was about.</p>
[ { "answer_id": 73772, "author": "Sean McMains", "author_id": 2041950, "author_profile": "https://Stackoverflow.com/users/2041950", "pm_score": 9, "selected": true, "text": "select sysdate from dual;" }, { "answer_id": 73787, "author": "Martin08", "author_id": 8203, "a...
2008/09/16
[ "https://Stackoverflow.com/questions/73751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208/" ]
73,781
<p>If I want to send mail not via SMTP, but rather via sendmail, is there a library for python that encapsulates this process?</p> <p>Better yet, is there a good library that abstracts the whole 'sendmail -versus- smtp' choice?</p> <p>I'll be running this script on a bunch of unix hosts, only some of which are listening on localhost:25; a few of these are part of embedded systems and can't be set up to accept SMTP.</p> <p>As part of Good Practice, I'd really like to have the library take care of header injection vulnerabilities itself -- so just dumping a string to <code>popen('/usr/bin/sendmail', 'w')</code> is a little closer to the metal than I'd like.</p> <p>If the answer is 'go write a library,' so be it ;-)</p>
[ { "answer_id": 73844, "author": "Pieter", "author_id": 5822, "author_profile": "https://Stackoverflow.com/users/5822", "pm_score": 5, "selected": false, "text": "def sendMail():\n sendmail_location = \"/usr/sbin/sendmail\" # sendmail location\n p = os.popen(\"%s -t\" % sendmail_loc...
2008/09/16
[ "https://Stackoverflow.com/questions/73781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12779/" ]
73,785
<p>I need to simply go through all the cells in a Excel Spreadsheet and check the values in the cells. The cells may contain text, numbers or be blank. I am not very familiar / comfortable working with the concept of 'Range'. Therefore, any sample codes would be greatly appreciated. (I did try to google it, but the code snippets I found didn't quite do what I needed)</p> <p>Thank you.</p>
[ { "answer_id": 73891, "author": "Martin08", "author_id": 8203, "author_profile": "https://Stackoverflow.com/users/8203", "pm_score": 0, "selected": false, "text": "Function getCellContent(Byref ws As Worksheet, ByVal rowindex As Integer, ByVal colindex As Integer) as String\n getCellC...
2008/09/16
[ "https://Stackoverflow.com/questions/73785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5899/" ]
73,797
<p>How do I tell Subversion (svn) to treat a file as a binary file?</p>
[ { "answer_id": 73820, "author": "Jan Krüger", "author_id": 12471, "author_profile": "https://Stackoverflow.com/users/12471", "pm_score": 3, "selected": false, "text": "svn propset svn:mime-type image/png foo.png\n" }, { "answer_id": 73834, "author": "KTamas", "author_id":...
2008/09/16
[ "https://Stackoverflow.com/questions/73797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5222/" ]
73,825
<p>This is about when a .NET remoting exception is thrown. If you take a look at MSDN, it will mention that a remoting exception is thrown when something goes wrong with remoting. If my server is not running, I get a socket exception which is fine.</p> <p>What I am trying to figure out is: does getting a remoting exception indicate for sure that my server is up and running? If yes, that would solve the problem. If not: Is there a way to figure out if the remoting exception originated on the client side or the server side?</p> <h3>Update:</h3> <p>The problem I am trying to solve is that the server is down initially and then client sends some message to the server. Now I get a socket exception saying &quot;No connection could be made...&quot; which is fine.</p> <p>There is a thread that is sending messages to the server at regular intervals to see if the server is available. Now, the server comes up, and at that point, you could get the response which is fine or you could get some exception and most probably it will be a remote exception. So, what I am trying to ask is that: in case I don't get a message and I get a remote exception is there a chance that the server is up and running and I am still getting this exception?</p> <p>All I am doing is just calling a method on the remote object that does nothing and returns. If there is no exception then I am good. Now, if there is a remoting exception and if I knew the remoting exception occurred on the server then I know in spite getting the exception, I am connected to the server.</p>
[ { "answer_id": 74382, "author": "icelava", "author_id": 2663, "author_profile": "https://Stackoverflow.com/users/2663", "pm_score": 0, "selected": false, "text": "HttpChannel channel = new HttpChannel();\nChannelServices.RegisterChannel(channel);\n\nIMyRemoteObject obj = (IMyRemoteObject...
2008/09/16
[ "https://Stackoverflow.com/questions/73825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
73,833
<p>I want to search for files containing DOS line endings with grep on Linux. Something like this:</p> <pre class="lang-sh prettyprint-override"><code>grep -IUr --color '\r\n' . </code></pre> <p>The above seems to match for literal <code>rn</code> which is not what is desired.</p> <p>The output of this will be piped through xargs into todos to convert crlf to lf like this</p> <pre><code>grep -IUrl --color '^M' . | xargs -ifile fromdos 'file' </code></pre>
[ { "answer_id": 73886, "author": "pjz", "author_id": 8002, "author_profile": "https://Stackoverflow.com/users/8002", "pm_score": 7, "selected": false, "text": "grep -IUr --color \"^M\"\n" }, { "answer_id": 73969, "author": "Thomee", "author_id": 12825, "author_profile"...
2008/09/16
[ "https://Stackoverflow.com/questions/73833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10245/" ]
73,879
<p>I have a small to medium project that is in C++/CLI. I really hate the syntax extensions of C++/CLI and I would prefer to work in C#. Is there a tool that does a decent job of translating one to the other?</p> <p><strong>EDIT:</strong> When I said Managed c++ before I apparently meant c++/CLI</p>
[ { "answer_id": 71609586, "author": "Shahin Dohan", "author_id": 1469494, "author_profile": "https://Stackoverflow.com/users/1469494", "pm_score": 1, "selected": false, "text": "git mv" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/73879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8508/" ]
73,881
<p>Currently, I am working on a new version control system as part of a final year project at University. The idea is to make it highly adaptable and pluggable.</p> <p>We're using the OSGi framework (Equinox implementation) to manage our plug ins. My problem is that I can't find a simple &amp; easy to use method for testing OSGi bundles.</p> <p>Currently, I have to build the bundle using Maven and then execute a test harness. I'm looking for something like the JUnit test runner for Eclipse, as it will save me a bunch of time.</p> <p>Is there a quick and easy way to test OSGi bundles?</p> <p>EDIT: I don't need something to test Eclipse plug ins or GUI components, just OSGi bundles.</p> <p>EDIT2: Is there some framework that supports JUnit4?</p>
[ { "answer_id": 8128727, "author": "rescdsk", "author_id": 88198, "author_profile": "https://Stackoverflow.com/users/88198", "pm_score": 3, "selected": false, "text": "getServiceReference()" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/73881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12828/" ]
73,883
<p>I understand the difference between <code>String</code> and <code>StringBuilder</code> (<code>StringBuilder</code> being mutable) but is there a large performance difference between the two? </p> <p>The program I’m working on has a lot of case driven string appends (500+). Is using <code>StringBuilder</code> a better choice?</p>
[ { "answer_id": 73929, "author": "Jay Bazuzi", "author_id": 5314, "author_profile": "https://Stackoverflow.com/users/5314", "pm_score": 9, "selected": true, "text": "StringBuilder" }, { "answer_id": 74028, "author": "Steve g", "author_id": 12092, "author_profile": "htt...
2008/09/16
[ "https://Stackoverflow.com/questions/73883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12623/" ]
73,889
<p>What's the best framework for writing modules -- <a href="http://search.cpan.org/perldoc/ExtUtils::MakeMaker" rel="noreferrer">ExtUtils::MakeMaker</a> (h2xs) or <a href="http://search.cpan.org/perldoc/Module::Build" rel="noreferrer">Module::Build</a>?</p>
[ { "answer_id": 214717, "author": "Schwern", "author_id": 14660, "author_profile": "https://Stackoverflow.com/users/14660", "pm_score": 7, "selected": true, "text": "configure_requires" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/73889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8233/" ]
73,892
<p>How can I <strong>pre pend</strong> (insert at beginning of file) a file to all files of a type in folder and sub-folders using <code>Powershell</code>?</p> <p>I need to add a standard header file to all <code>.cs</code> and was trying to use <code>Powershell</code> to do so, but while I was able to append it in a few lines of code I was stuck when trying to <strong>pre-pend</strong> it.</p>
[ { "answer_id": 74073, "author": "Mark Schill", "author_id": 9482, "author_profile": "https://Stackoverflow.com/users/9482", "pm_score": 4, "selected": true, "text": "$Content = \"This is your content`n\"\nGet-ChildItem *.cs | foreach-object { \n$FileContents = Get-Content -Path $_\nSet-C...
2008/09/16
[ "https://Stackoverflow.com/questions/73892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11673/" ]
73,927
<p>I'm looking into clustering points on a map (latitude/longitude). Are there any recommendations as to a suitable algorithm that is fast and scalable?</p> <p>More specifically, I have a series of latitude/longitude coordinates and a map viewport. I'm trying to cluster the points that are close together in order to remove clutter.</p> <p>I already have a solution to the problem (<a href="http://bouldr.net" rel="noreferrer">see here</a>), only I am wondering if there is any formal algorithm that solves the problem efficiently.</p>
[ { "answer_id": 18633159, "author": "user1530779", "author_id": 1530779, "author_profile": "https://Stackoverflow.com/users/1530779", "pm_score": 1, "selected": false, "text": "static int OFFSET = 268435456;\n static double RADIUS = 85445659.4471;\n static double pi = 3.1444;\n\npub...
2008/09/16
[ "https://Stackoverflow.com/questions/73927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12037/" ]
73,930
<p>What do I need to add to my <code>.spec</code> file to create the desktop shortcut and assign an icon to the shortcut during install of my <code>.rpm</code>? If a script is required, an example would be very helpful.</p>
[ { "answer_id": 74003, "author": "akdom", "author_id": 145, "author_profile": "https://Stackoverflow.com/users/145", "pm_score": 3, "selected": false, "text": "[Desktop Entry]\nEncoding=UTF-8\nGenericName=Generic Piece Of Software\nName=FooBar\nExec=/usr/bin/foo.sh\nIcon=foo.png\nTerminal...
2008/09/16
[ "https://Stackoverflow.com/questions/73930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
73,947
<p>I'm talking about an action game with no upper score limit and no way to verify the score on the server by replaying moves etc. </p> <p>What I really need is the strongest encryption possible in Flash/PHP, and a way to prevent people calling the PHP page other than through my Flash file. I have tried some simple methods in the past of making multiple calls for a single score and completing a checksum / fibonacci sequence etc, and also obfuscating the SWF with Amayeta SWF Encrypt, but they were all hacked eventually.</p> <p>Thanks to StackOverflow responses I have now found some more info from Adobe - <a href="http://www.adobe.com/devnet/flashplayer/articles/secure_swf_apps_12.html" rel="noreferrer">http://www.adobe.com/devnet/flashplayer/articles/secure_swf_apps_12.html</a> and <a href="https://github.com/mikechambers/as3corelib" rel="noreferrer">https://github.com/mikechambers/as3corelib</a> - which I think I can use for the encryption. Not sure this will get me around CheatEngine though.</p> <p>I need to know the best solutions for both AS2 and AS3, if they are different.</p> <p>The main problems seem to be things like TamperData and LiveHTTP headers, but I understand there are more advanced hacking tools as well - like CheatEngine (thanks Mark Webster)</p>
[ { "answer_id": 74841, "author": "tqbf", "author_id": 5674, "author_profile": "https://Stackoverflow.com/users/5674", "pm_score": 10, "selected": true, "text": "hex-encoding( AES(secret-key-stored-only-on-server, timestamp, user-id, random-number))\n" }, { "answer_id": 17994553, ...
2008/09/16
[ "https://Stackoverflow.com/questions/73947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11911/" ]
73,950
<p>How can I combine multiple PDFs into one PDF without a 3rd party component?</p>
[ { "answer_id": 22138935, "author": "Sajitha Rathnayake", "author_id": 2345900, "author_profile": "https://Stackoverflow.com/users/2345900", "pm_score": 2, "selected": false, "text": "string[] lstFiles=new string[3];\n lstFiles[0]=@\"C:/pdf/1.pdf\";\n lstFiles[1]=@\"C:/pdf/2.pdf\";\...
2008/09/16
[ "https://Stackoverflow.com/questions/73950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
73,958
<p>In a shellscript, I'd like to set the IP of my box, run a command, then move to the next IP. The IPs are an entire C block.</p> <p>The question is how do I set the IP of the box without editing a file? What command sets the IP on Slackware?</p> <p>Thanks</p>
[ { "answer_id": 74039, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "ifconfig eth0 192.168.0.42 up" }, { "answer_id": 74058, "author": "tialaramex", "author_id": 9654, "author_...
2008/09/16
[ "https://Stackoverflow.com/questions/73958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
73,960
<p>In IE, the dropdown-list takes the same width as the dropbox (I hope I am making sense) whereas in Firefox the dropdown-list's width varies according to the content. </p> <p>This basically means that I have to make sure that the dropbox is wide enough to display the longest selection possible. This makes my page look very ugly :(</p> <p>Is there any workaround for this problem? How can I use CSS to set different widths for dropbox and the dropdownlist?</p>
[ { "answer_id": 74062, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<select name=\"foo\" style=\"width: 200px\">" }, { "answer_id": 74550, "author": "Sleep Deprivation Ninja", "au...
2008/09/16
[ "https://Stackoverflow.com/questions/73960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/747/" ]
73,964
<p>I would like to turn the HTML generated by my CFM page into a PDF, and have the user prompted with the standard "Save As" prompt when navigating to my page.</p>
[ { "answer_id": 74374, "author": "Soldarnal", "author_id": 3420, "author_profile": "https://Stackoverflow.com/users/3420", "pm_score": 5, "selected": true, "text": "<cfdocument format=\"PDF\" filename=\"file.pdf\" overwrite=\"Yes\">\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitio...
2008/09/16
[ "https://Stackoverflow.com/questions/73964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2232/" ]
73,971
<p>In JavaScript, what is the best way to determine if a date provided falls within a valid range?</p> <p>An example of this might be checking to see if the user input <code>requestedDate</code> is part of the next valid work week. Note that this is not just checking to see if one date is larger than another as a valid date would be equal to or greater than the lower end of the range while less than or equal to the upper end of the range.</p>
[ { "answer_id": 74024, "author": "Jesper Blad Jensen", "author_id": 11559, "author_profile": "https://Stackoverflow.com/users/11559", "pm_score": 3, "selected": false, "text": "function ValidRange(date1,date2)\n{\n return date2.getTime() > date1.getTime();\n}\n" }, { "answer_id"...
2008/09/16
[ "https://Stackoverflow.com/questions/73971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1185/" ]
74,010
<p>I am a bit rusty on my cursor lingo in PL/SQL. Anyone know this?</p>
[ { "answer_id": 74105, "author": "Dave Costa", "author_id": 6568, "author_profile": "https://Stackoverflow.com/users/6568", "pm_score": 2, "selected": false, "text": "CURSOR my_cursor IS\n SELECT table_name FROM USER_TABLES\n" }, { "answer_id": 74135, "author": "stjohnroe", ...
2008/09/16
[ "https://Stackoverflow.com/questions/74010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208/" ]
74,019
<p>How can I specify the filename when dumping data into the response stream?</p> <p>Right now I'm doing the following:</p> <pre><code>byte[] data= GetFoo(); Response.Clear(); Response.Buffer = true; Response.ContentType = "application/pdf"; Response.BinaryWrite(data); Response.End(); </code></pre> <p>With the code above, I get "foo.aspx.pdf" as the filename to save. I seem to remember being able to add a header to the response to specify the filename to save.</p>
[ { "answer_id": 74044, "author": "Sklivvz", "author_id": 7028, "author_profile": "https://Stackoverflow.com/users/7028", "pm_score": 4, "selected": false, "text": "Response.AppendHeader(\"Content-Disposition\", \"attachment; filename=foo.pdf\");\n" }, { "answer_id": 74049, "au...
2008/09/16
[ "https://Stackoverflow.com/questions/74019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1672/" ]
74,032
<p>I'm looking for real world best practices, how other people might have implemented solutions with complex domains.</p>
[ { "answer_id": 74070, "author": "Eric Schoonover", "author_id": 3957, "author_profile": "https://Stackoverflow.com/users/3957", "pm_score": 2, "selected": false, "text": "IEqualityComparer" }, { "answer_id": 74110, "author": "Chris Marasti-Georg", "author_id": 96, "au...
2008/09/16
[ "https://Stackoverflow.com/questions/74032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5802/" ]
74,057
<p>Is there a way to use sql-server like analytic functions in Hibernate?</p> <p>Something like </p> <pre><code>select foo from Foo foo where f.x = max(f.x) over (partition by f.y) </code></pre>
[ { "answer_id": 75287, "author": "Jason Weathered", "author_id": 3736, "author_profile": "https://Stackoverflow.com/users/3736", "pm_score": 3, "selected": false, "text": "Query q = em.createNativeQuery(\"select foo.* from Foo foo \" +\n \"where f.x = max(f.x...
2008/09/16
[ "https://Stackoverflow.com/questions/74057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12905/" ]
74,083
<p>When using Business Objects' CrystalReportViewer control, how can you detect and manually print the report the user has currently drilled into? You can print this automatically using the Print() method of the CrystalReportViewer, but I want to be able to do a manual printing of this report.</p> <p>It is possible to print the main ReportSource of the CrystalReportViewer, but I need to know what report the user has drilled into and then do a manual printing of that particular drill down. Any ideas?</p>
[ { "answer_id": 75287, "author": "Jason Weathered", "author_id": 3736, "author_profile": "https://Stackoverflow.com/users/3736", "pm_score": 3, "selected": false, "text": "Query q = em.createNativeQuery(\"select foo.* from Foo foo \" +\n \"where f.x = max(f.x...
2008/09/16
[ "https://Stackoverflow.com/questions/74083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
74,092
<p>I have a function in Python which is iterating over the attributes returned from <code>dir(obj)</code>, and I want to check to see if any of the objects contained within is a function, method, built-in function, etc. Normally you could use <code>callable()</code> for this, but I don't want to include classes. The best I've come up with so far is:</p> <pre><code>isinstance(obj, (types.BuiltinFunctionType, types.FunctionType, types.MethodType)) </code></pre> <p>Is there a more future-proof way to do this check?</p> <p><strong>Edit:</strong> I misspoke before when I said: &quot;Normally you could use <code>callable()</code> for this, but I don't want to disqualify classes.&quot; I actually <em>do</em> want to disqualify classes. I want to match <em>only</em> functions, not classes.</p>
[ { "answer_id": 74138, "author": "Jim", "author_id": 8427, "author_profile": "https://Stackoverflow.com/users/8427", "pm_score": 2, "selected": false, "text": "if hasattr(obj, '__call__'): pass\n" }, { "answer_id": 74295, "author": "dF.", "author_id": 3002, "author_pro...
2008/09/16
[ "https://Stackoverflow.com/questions/74092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/156/" ]
74,108
<p>I wrote a script to export twitter friends as foaf rdf description. Now I'm looking for a tool to visualize the friend networks. I tried <a href="http://foafscape.berlios.de/" rel="nofollow noreferrer">http://foafscape.berlios.de/</a> but for 300+ Nodes it is really slow and does a bad job on auto formatting.</p> <p>Any hints for good graph visualization tools? It's ok if they do not support foaf directly, but they should be able to use images for graph nodes and be able to display large graphs. Linux support would be nice.</p> <p>Oh, and I'm searching for an interactive tool where I can move nodes by hand.</p> <p><strong>Update:</strong> Thanks for your input. I know graphviz and for static images it is really great. But for large datasets I need to be able to select nodes and highlight all neighbours. </p> <ul> <li><strong>Prefuse</strong> looks great: <a href="http://prefuse.org/gallery/graphview/" rel="nofollow noreferrer">http://prefuse.org/gallery/graphview/</a></li> <li>trough prefuse I found <strong>vizster</strong>, which is exactly what I search (just need to find some sourcecode) <a href="http://jheer.org/vizster/" rel="nofollow noreferrer">http://jheer.org/vizster/</a></li> </ul>
[ { "answer_id": 74395, "author": "wxs", "author_id": 12981, "author_profile": "https://Stackoverflow.com/users/12981", "pm_score": 2, "selected": false, "text": "graph G {\n \"George Formby\" [shape=custom, shapefile=\"file:formby.png\"];\n \"Michael Jackson\" [shape=custom, shapefi...
2008/09/16
[ "https://Stackoverflow.com/questions/74108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/720/" ]
74,113
<p>It seems obvious that some people have been able to figure out how to access the iPhone camera through the SDK (Spore Origins, for example). How can this be done?</p>
[ { "answer_id": 74255, "author": "wxs", "author_id": 12981, "author_profile": "https://Stackoverflow.com/users/12981", "pm_score": 7, "selected": true, "text": "UIImagePickerController" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/74113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5338/" ]
74,126
<p>I have a Windows XP SP2 virtual machine which can be accessed via VNC. It's also running Deep Freeze so there should be no problem in forcing it to reboot. I am looking for a way to force the operating system to reboot instead of shutting down or completely remove the ability to shut down the machine using software applications (such as the usual way from the start menu, the shutdown program or other custom programs).</p> <p>Thank you, Tom</p>
[ { "answer_id": 74143, "author": "Alex Fort", "author_id": 12624, "author_profile": "https://Stackoverflow.com/users/12624", "pm_score": 3, "selected": false, "text": "shutdown /r /t 1 /f" }, { "answer_id": 74156, "author": "Toby Mills", "author_id": 12377, "author_pro...
2008/09/16
[ "https://Stackoverflow.com/questions/74126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
74,148
<p>How do you convert between hexadecimal numbers and decimal numbers in C#?</p>
[ { "answer_id": 74183, "author": "Sklivvz", "author_id": 7028, "author_profile": "https://Stackoverflow.com/users/7028", "pm_score": 2, "selected": false, "text": "String stringrep = myintvar.ToString(\"X\");\n\nint num = int.Parse(\"FF\", System.Globalization.NumberStyles.HexNumber);\n" ...
2008/09/16
[ "https://Stackoverflow.com/questions/74148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3362/" ]
74,162
<p>I'm trying to write a query that extracts and transforms data from a table and then insert those data into another table. Yes, this is a data warehousing query and I'm doing it in MS Access. So basically I want some query like this:</p> <pre><code>INSERT INTO Table2(LongIntColumn2, CurrencyColumn2) VALUES (SELECT LongIntColumn1, Avg(CurrencyColumn) as CurrencyColumn1 FROM Table1 GROUP BY LongIntColumn1); </code></pre> <p>I tried but get a syntax error message.</p> <p>What would you do if you want to do this?</p>
[ { "answer_id": 74196, "author": "Forgotten Semicolon", "author_id": 1960, "author_profile": "https://Stackoverflow.com/users/1960", "pm_score": 3, "selected": false, "text": "VALUES" }, { "answer_id": 74204, "author": "pilsetnieks", "author_id": 6615, "author_profile"...
2008/09/16
[ "https://Stackoverflow.com/questions/74162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8203/" ]
74,171
<p>I maintain a Java Swing application.</p> <p>For backwards compatibility with java 5 (for Apple machines), we maintain two codebases, 1 using features from Java 6, another without those features.</p> <p>The code is largely the same, except for 3-4 classes that uses Java 6 features.</p> <p>I wish to just maintain 1 codebase. Is there a way during compilation, to get the Java 5 compiler to 'ignore' some parts of my code?</p> <p>I do not wish to simply comment/uncomment parts of my code, depending on the version of my java compiler.</p>
[ { "answer_id": 74319, "author": "Jesse Glick", "author_id": 12916, "author_profile": "https://Stackoverflow.com/users/12916", "pm_score": 2, "selected": false, "text": "---%<--- main/RandomClass.java\n// ...\nif (...is JDK 6+...) {\n try {\n JDK6Interface i = (JDK6Interface)\n ...
2008/09/16
[ "https://Stackoverflow.com/questions/74171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12944/" ]
74,188
<p>I've created a ListBox to display items in groups, where the groups are wrapped right to left when they can no longer fit within the height of the ListBox's panel. So, the groups would appear similar to this in the listbox, where each group's height is arbitrary (group 1, for instance, is twice as tall as group 2):</p> <pre><code>[ 1 ][ 3 ][ 5 ] [ ][ 4 ][ 6 ] [ 2 ][ ] </code></pre> <p>The following XAML works correctly in that it performs the wrapping, and allows the horizontal scroll bar to appear when the items run off the right side of the ListBox.</p> <pre><code>&lt;ListBox&gt; &lt;ListBox.ItemsPanel&gt; &lt;ItemsPanelTemplate&gt; &lt;StackPanel Orientation="Vertical"/&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ListBox.ItemsPanel&gt; &lt;ListBox.GroupStyle&gt; &lt;ItemsPanelTemplate&gt; &lt;WrapPanel Orientation="Vertical" Height="{Binding Path=ActualHeight, RelativeSource={RelativeSource FindAncestor, AncestorLevel=1, AncestorType={x:Type ScrollContentPresenter}}}"/&gt; &lt;/ItemsPanelTemplate&gt; &lt;/ListBox.GroupStyle&gt; &lt;/ListBox&gt; </code></pre> <p>The problem occurs when a group of items is longer than the height of the WrapPanel. Instead of allowing the vertical scroll bar to appear to view the cutoff item group, the items in that group are simply clipped. I'm assuming that this is a side effect of the Height binding in the WrapPanel - the scrollbar thinks it does not have to enabled.</p> <p>Is there any way to enable the scrollbar, or another way around this issue that I'm not seeing?</p>
[ { "answer_id": 74235, "author": "dcstraw", "author_id": 10391, "author_profile": "https://Stackoverflow.com/users/10391", "pm_score": 0, "selected": false, "text": "VerticalAlignment" }, { "answer_id": 74306, "author": "Community", "author_id": -1, "author_profile": "...
2008/09/16
[ "https://Stackoverflow.com/questions/74188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
74,206
<p>I have been playing with this for a while, but the closest I have gotten is a button that opens the <code>Paste Special</code> dialog box and requires another couple of mouse clicks to paste the contents of the clipboard as unformatted text. </p> <p>So often I am doing a <code>copy-paste</code> from a web site into a document where I don't want the additional baggage of the HTML formatting, it would be nice to be able to do this with a shortcut key or a toolbar button.</p>
[ { "answer_id": 74237, "author": "GSerg", "author_id": 11683, "author_profile": "https://Stackoverflow.com/users/11683", "pm_score": 4, "selected": true, "text": "public sub PasteSpecialUnformatted()\n selection.pastespecial datatype:=wdpastetext\nend sub\n" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/74206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30018/" ]
74,218
<p>Is there a way to restart the Rails app (e.g. when you've changed a plugin/config file) while Mongrel is running. Or alternatively quickly restart Mongrel. Mongrel gives these hints that you can but how do you do it?</p> <p>** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).</p> <p>** Rails signals registered. HUP => reload (without restart). It might not work well.</p>
[ { "answer_id": 74241, "author": "Jan Krüger", "author_id": 12471, "author_profile": "https://Stackoverflow.com/users/12471", "pm_score": 2, "selected": false, "text": "killall -USR2 mongrel_rails\n" }, { "answer_id": 74998, "author": "TonyLa", "author_id": 1295, "auth...
2008/09/16
[ "https://Stackoverflow.com/questions/74218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6432/" ]
74,248
<p>On a JSTL/JSP page, I have a java.util.Date object from my application. I need to find the day <em>after</em> the day specified by that object. I can use &lt;jsp:scriptlet&gt; to drop into Java and use java.util.Calendar to do the necessary calculations, but this feels clumsy and inelegant to me.</p> <p>Is there some way to use JSP or JSTL tags to achieve this end without having to switch into full-on Java, or is the latter the only way to accomplish this?</p>
[ { "answer_id": 74274, "author": "sirprize", "author_id": 12902, "author_profile": "https://Stackoverflow.com/users/12902", "pm_score": 2, "selected": false, "text": "// Date d given\nd.setTime(d.getTime()+86400000);\n" }, { "answer_id": 74582, "author": "jodonnell", "auth...
2008/09/16
[ "https://Stackoverflow.com/questions/74248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2041950/" ]
74,261
<p>Is there a general rule of thumb to follow when storing web application data to know what database backend should be used? Is the number of hits per day, number of rows of data, or other metrics that I should consider when choosing?</p> <p>My initial idea is that the order for this would look something like the following (but not necessarily, which is why I'm asking the question).</p> <ol> <li>Flat Files</li> <li>BDB</li> <li>SQLite</li> <li>MySQL</li> <li>PostgreSQL</li> <li>SQL Server</li> <li>Oracle</li> </ol>
[ { "answer_id": 74354, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 0, "selected": false, "text": "SQL Server Compact -> SQL Server Express -> SQL Server Enterprise (clustered). \n" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/74261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2581/" ]
74,266
<p>I have an ext combobox which uses a store to suggest values to a user as they type. </p> <p>An example of which can be found here: <a href="http://extjs.com/deploy/ext/examples/form/combos.html" rel="nofollow noreferrer">combobox example</a></p> <p>Is there a way of making it so the <strong>suggested text list</strong> is rendered to an element in the DOM. Please note I do not mean the "applyTo" config option, as this would render the whole control, including the textbox to the DOM element.</p>
[ { "answer_id": 75619, "author": "Thevs", "author_id": 8559, "author_profile": "https://Stackoverflow.com/users/8559", "pm_score": 2, "selected": true, "text": "var suggested_text_plugin = {\n\n init: function(o) {\n\n o.onTypeAhead = function() {\n // Original code f...
2008/09/16
[ "https://Stackoverflow.com/questions/74266", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3193/" ]
74,267
<p>I'm trying to script the shutdown of my VM Servers in a .bat. if one of the vmware-cmd commands fails (as the machine is already shutdown say), I'd like it to continue instead of bombing out.</p> <pre><code>c: cd "c:\Program Files\VMWare\VmWare Server" vmware-cmd C:\VMImages\TCVMDEVSQL01\TCVMDEVSQL01.vmx suspend soft -q vmware-cmd C:\VMImages\DevEnv\DevEnv\DevEnv.vmx suspend soft -q vmware-cmd C:\VMImages\DevEnv\TCVMDEV02\TCVMDEV02.vmx suspend soft =q robocopy c:\vmimages\ \\tcedilacie1tb\VMShare\DevEnvironmentBackups\ /mir /z /r:0 /w:0 vmware-cmd C:\VMImages\TCVMDEVSQL01\TCVMDEVSQL01.vmx start vmware-cmd C:\VMImages\DevEnv\DevEnv\DevEnv.vmx start vmware-cmd C:\VMImages\DevEnv\TCVMDEV02\TCVMDEV02.vmx start </code></pre>
[ { "answer_id": 74321, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 6, "selected": true, "text": "CMD /C" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/74267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11538/" ]
74,315
<p>I'm doing a website for a family member's wedding. A feature they requested was a photo section where all the guests could go after the wedding and upload their snaps. I said this was a stellar idea and I went off to build it.</p> <p>Well there's just the one problem: logistics. Upload speeds are slow and photos from modern cameras are huge (2-5+Megs). </p> <p>I will only need ~800px wide images and some of them might require rotating so ideally I'm looking about using a client-side editor to do three things:</p> <ol> <li>Let users pick multiple files</li> <li>Let them rotate some images so they're the right way up</li> <li>Resize them and then upload</li> </ol> <p>And in my dream world, it'd be free and open source. Any ideas?</p> <p>Just a reminder: this is something the guests have to use. Some of them will be pretty computer savvy but others will be almost completely illiterate. Installing desktop apps isn't really an option. And I assume 98% of them have Flash and Java installed.</p> <p>Edit: I'd prefer a Flash/Java option over SilverLight, not least because it has a smaller install rate at the moment, but also because I'm on Linux and I'd like to test it =)</p>
[ { "answer_id": 80200, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "// UploadServlet.java : Proof of Concept - Mike Smith March 2006\n// Accept a file from the client, assume it is an image, resc...
2008/09/16
[ "https://Stackoverflow.com/questions/74315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12870/" ]
74,326
<p>I am working on a large C++ project in Visual Studio 2008, and there are a lot of files with unnecessary <code>#include</code> directives. Sometimes the <code>#include</code>s are just artifacts and everything will compile fine with them removed, and in other cases classes could be forward declared and the #include could be moved to the <code>.cpp</code> file. Are there any good tools for detecting both of these cases?</p>
[ { "answer_id": 74491, "author": "Eclipse", "author_id": 8701, "author_profile": "https://Stackoverflow.com/users/8701", "pm_score": 7, "selected": true, "text": "/showIncludes" }, { "answer_id": 74547, "author": "Graeme Perrow", "author_id": 1821, "author_profile": "h...
2008/09/16
[ "https://Stackoverflow.com/questions/74326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13013/" ]
74,350
<p>I'm trying to implement some drag and drop functionality for a material system being developed at my work. Part of this system includes a 'Material Library' which acts as a repository, divided into groups, of saved materials on the user's hard drive.</p> <p>As part of some UI polish, I was hoping to implement a 'highlight' type feature. When dragging and dropping, windows that you can legally drop a material onto will very subtly change color to improve feedback to the user that this is a valid action.</p> <p>I am changing the bar with 'Basic Materials' (Just a CWnd with a CStatic) from having a medium gray background when unhighlighed to a blue background when hovered over. It all works well, the OnDragEnter and OnDragExit messages seem robust and set a flag indicating the highlight status. Then in OnCtrlColor I do this:</p> <pre><code> if (!m_bHighlighted) { pDC-&gt;FillSolidRect(0, 0, m_SizeX, kGroupHeaderHeight, kBackgroundColour); } else { pDC-&gt;FillSolidRect(0, 0, m_SizeX, kGroupHeaderHeight, kHighlightedBackgroundColour); } </code></pre> <p>However, as you can see in the screenshot, the painting 'glitches' below the dragged object, leaving the original gray in place. It looks really ugly and basically spoils the whole effect.</p> <p>Is there any way I can get around this?</p>
[ { "answer_id": 81662, "author": "Ali Parr", "author_id": 1169, "author_profile": "https://Stackoverflow.com/users/1169", "pm_score": 1, "selected": true, "text": "ImageList_DragShowNolock(FALSE);\nm_pDragDropTargetWnd->SendMessage(WM_USER_DRAG_DROP_OBJECT_DRAG_ENTER, (WPARAM)pDragDropObj...
2008/09/16
[ "https://Stackoverflow.com/questions/74350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1169/" ]
74,358
<p>How can I get <a href="http://search.cpan.org/perldoc?LWP" rel="noreferrer">LWP</a> to verify that the certificate of the server I'm connecting to is signed by a trusted authority and issued to the correct host? As far as I can tell, it doesn't even check that the certificate claims to be for the hostname I'm connecting to. That seems like a major security hole (especially with the recent DNS vulnerabilities).</p> <p><strong>Update:</strong> It turns out what I really wanted was <code>HTTPS_CA_DIR</code>, because I don't have a ca-bundle.crt. But <code>HTTPS_CA_DIR=/usr/share/ca-certificates/</code> did the trick. I'm marking the answer as accepted anyway, because it was close enough.</p> <p><strong>Update 2:</strong> It turns out that <code>HTTPS_CA_DIR</code> and <code>HTTPS_CA_FILE</code> only apply if you're using Net::SSL as the underlying SSL library. But LWP also works with IO::Socket::SSL, which will ignore those environment variables and happily talk to any server, no matter what certificate it presents. Is there a more general solution?</p> <p><strong>Update 3:</strong> Unfortunately, the solution still isn't complete. Neither Net::SSL nor IO::Socket::SSL is checking the host name against the certificate. This means that someone can get a legitimate certificate for some domain, and then impersonate any other domain without LWP complaining.</p> <p><strong>Update 4:</strong> <a href="http://search.cpan.org/dist/libwww-perl/" rel="noreferrer">LWP 6.00</a> finally solves the problem. See <a href="https://stackoverflow.com/questions/74358/how-can-i-get-lwp-to-validate-ssl-server-certificates#5329129">my answer</a> for details.</p>
[ { "answer_id": 74432, "author": "Brian Phillips", "author_id": 7230, "author_profile": "https://Stackoverflow.com/users/7230", "pm_score": 3, "selected": false, "text": "HTTPS_CA_FILE" }, { "answer_id": 612238, "author": "dave0", "author_id": 73886, "author_profile": ...
2008/09/16
[ "https://Stackoverflow.com/questions/74358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8355/" ]
74,372
<p>I am involved in the process of porting a system containing several hundreds of ksh scripts from AIX, Solaris and HPUX to Linux. I have come across the following difference in the way ksh behaves on the two systems:</p> <pre><code>#!/bin/ksh flag=false echo "a\nb" | while read x do flag=true done echo "flag = ${flag}" exit 0 </code></pre> <p>On AIX, Solaris and HPUX the output is "flag = true" on Linux the output is "flag = false".</p> <p>My questions are:</p> <ul> <li>Is there an environment variable that I can set to get Linux's ksh to behave like the other Os's'? Failing that:</li> <li>Is there an option on Linux's ksh to get the required behavior? Failing that:</li> <li>Is there a ksh implementation available for Linux with the desired behavior?</li> </ul> <p>Other notes:</p> <ul> <li>On AIX, Solaris and HPUX ksh is a variant of ksh88.</li> <li>On Linux, ksh is the public domain ksh (pdksh)</li> <li>On AIX, Solaris and HPUX dtksh and ksh93 (where I have them installed) are consistent with ksh</li> <li>The Windows NT systems I have access to: Cygwin and MKS NT, are consistent with Linux.</li> <li>On AIX, Solaris and Linux, bash is consistent, giving the incorrect (from my perspective) result of "flag = false".</li> </ul> <p>The following table summarizes the systems the problem:</p> <pre><code>uname -s uname -r which ksh ksh version flag = ======== ======== ========= =========== ====== Linux 2.6.9-55.0.0.0.2.ELsmp /bin/ksh PD KSH v5.2.14 99/07/13.2 false AIX 3 /bin/ksh Version M-11/16/88f true // AIX 5.3 /bin/ksh93 Version M-12/28/93e true SunOS 5.8, 5.9 and 5.10 /bin/ksh Version M-11/16/88i true /usr/dt/bin/dtksh Version M-12/28/93d true HP-UX B.11.11 and B.11.23 /bin/ksh Version 11/16/88 true /usr/dt/bin/dtksh Version M-12/28/93d true CYGWIN_NT-5.1 1.5.25(0.156/4/2) /bin/ksh PD KSH v5.2.14 99/07/13.2 false Windows_NT 5 .../mksnt/ksh.exe Version 8.7.0 build 1859... false // MKS </code></pre> <h1>Update</h1> <p>After some advice from people in my company we decided to make the following modification to the code. This gives us the same result whether using the "real" ksh's (ksh88, ksh93) or any of the ksh clones (pdksh, MSK ksh). This also works correctly with bash.</p> <pre><code>#!/bin/ksh echo "a\nb" &gt; junk flag=false while read x do flag=true done &lt; junk echo "flag = ${flag}" exit 0 </code></pre> <p>Thanks to jj33 for the previously accepted answer.</p>
[ { "answer_id": 74580, "author": "Alex M", "author_id": 9652, "author_profile": "https://Stackoverflow.com/users/9652", "pm_score": 0, "selected": false, "text": "zsh" }, { "answer_id": 74787, "author": "jtimberman", "author_id": 7672, "author_profile": "https://Stacko...
2008/09/16
[ "https://Stackoverflow.com/questions/74372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13029/" ]
74,385
<p>I need to convert a value which is in a <code>DateTime</code> variable into a <code>varchar</code> variable formatted as <code>yyyy-mm-dd</code> format (without time part).</p> <p>How do I do that?</p>
[ { "answer_id": 74394, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 8, "selected": false, "text": "CONVERT(varchar(10), [MyDateTimecolumn], 20)\n" }, { "answer_id": 74404, "author": "Per Hornshøj-Schierbeck...
2008/09/16
[ "https://Stackoverflow.com/questions/74385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7604/" ]
74,386
<p>Is it possible to call managed code, specifically IronRuby or IronPython from unamanaged code such as C++ or Delphi?</p> <p>For example, we have an application written in Delphi that is being moved to C#.NET We'd like to provide Ruby or Python scripting in our new application to replace VBSCRIPT. However, we would need to provide Ruby/Python scripting in the old Delphi application. Is it possible to use the managed dlls provided by IronRuby/IronPython from Delphi code?</p>
[ { "answer_id": 2351140, "author": "Lukas Cenovsky", "author_id": 138803, "author_profile": "https://Stackoverflow.com/users/138803", "pm_score": 2, "selected": false, "text": "Set8087CW($133F);" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/74386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12999/" ]
74,430
<p>I am trying to use the <code>import random</code> statement in python, but it doesn't appear to have any methods in it to use.</p> <p>Am I missing something?</p>
[ { "answer_id": 74459, "author": "Chris AtLee", "author_id": 4558, "author_profile": "https://Stackoverflow.com/users/4558", "pm_score": 0, "selected": false, "text": "import random\nprint random.randint(0,10)\n" }, { "answer_id": 74476, "author": "Vinko Vrsalovic", "autho...
2008/09/16
[ "https://Stackoverflow.com/questions/74430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13050/" ]
74,451
<p>Windows file system is case insensitive. How, given a file/folder name (e.g. "somefile"), I get the <em>actual</em> name of that file/folder (e.g. it should return "SomeFile" if Explorer displays it so)?</p> <p>Some ways I know, all of which seem quite backwards:</p> <ol> <li>Given the full path, search for each folder on the path (via FindFirstFile). This gives proper cased results of each folder. At the last step, search for the file itself.</li> <li>Get filename from handle (as in <a href="http://msdn.microsoft.com/en-us/library/aa366789(VS.85).aspx" rel="noreferrer">MSDN example</a>). This requires opening a file, creating file mapping, getting it's name, parsing device names etc. Pretty convoluted. And it does not work for folders or zero-size files.</li> </ol> <p>Am I missing some obvious WinAPI call? The simplest ones, like GetActualPathName() or GetFullPathName() return the name using casing that was passed in (e.g. returns "program files" if that was passed in, even if it should be "Program Files").</p> <p>I'm looking for a native solution (not .NET one).</p>
[ { "answer_id": 74563, "author": "bugmagnet", "author_id": 426, "author_profile": "https://Stackoverflow.com/users/426", "pm_score": 2, "selected": false, "text": "Dim fso\nSet fso = CreateObject(\"Scripting.FileSystemObject\")\nDim f\nSet f = fso.GetFile(\"C:\\testfile.dat\") 'actually n...
2008/09/16
[ "https://Stackoverflow.com/questions/74451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6799/" ]
74,461
<p>I'm currently playing with the Silverlight(Beta 2) Datagrid control. Before I wired up the SelectionChanged event, the grid would sort perfectly by clicking on the header. Now, when the grid is clicked, it will fire the SelectionChanged event when I click the header to sort. Is there any way around this?</p> <p>In a semi-related topic, I'd like to have the SelectionChanged event fire when I click on an already selected item (so that I can have a pop-up occur to allow the user to edit the selected value). Right now, you have to click on a different value and then back to the value you wanted in order for it to pop up. Is there another way? </p> <p>Included is my code. </p> <p>The Page:</p> <pre><code>&lt;UserControl x:Class="WebServicesApp.Page" xmlns="http://schemas.microsoft.com/client/2007" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" Width="1280" Height="1024" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"&gt; &lt;Grid x:Name="LayoutRoot" Background="White"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition /&gt; &lt;RowDefinition /&gt; &lt;/Grid.RowDefinitions&gt; &lt;StackPanel Grid.Row="0" x:Name="OurStack" Orientation="Vertical" Margin="5,5,5,5"&gt; &lt;ContentControl VerticalAlignment="Center" HorizontalAlignment="Center"&gt; &lt;StackPanel x:Name="SearchStackPanel" Orientation="Horizontal" Margin="5,5,5,5"&gt; &lt;TextBlock x:Name="SearchEmail" HorizontalAlignment="Stretch" VerticalAlignment="Center" Text="Email Address:" Margin="5,5,5,5" /&gt; &lt;TextBox x:Name="InputText" HorizontalAlignment="Stretch" VerticalAlignment="Center" Width="150" Height="Auto" Margin="5,5,5,5"/&gt; &lt;Button x:Name="SearchButton" Content="Search" Click="CallServiceButton_Click" HorizontalAlignment="Center" VerticalAlignment="Center" Width="75" Height="Auto" Background="#FFAFAFAF" Margin="5,5,5,5"/&gt; &lt;/StackPanel&gt; &lt;/ContentControl&gt; &lt;Grid x:Name="DisplayRoot" Background="White" ShowGridLines="True" HorizontalAlignment="Center" VerticalAlignment="Center" MaxHeight="300" MinHeight="100" MaxWidth="800" MinWidth="200" ScrollViewer.HorizontalScrollBarVisibility="Visible" ScrollViewer.VerticalScrollBarVisibility="Visible"&gt; &lt;data:DataGrid ItemsSource="{Binding ''}" CanUserReorderColumns="False" CanUserResizeColumns="False" AutoGenerateColumns="False" AlternatingRowBackground="#FFAFAFAF" SelectionMode="Single" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="5,5,5,5" x:Name="IncidentGrid" SelectionChanged="IncidentGrid_SelectionChanged"&gt; &lt;data:DataGrid.Columns&gt; &lt;data:DataGridTextColumn DisplayMemberBinding="{Binding Address}" Header="Email Address" IsReadOnly="True" /&gt; &lt;!--Width="150"--&gt; &lt;data:DataGridTextColumn DisplayMemberBinding="{Binding whereClause}" Header="Where Clause" IsReadOnly="True" /&gt; &lt;!--Width="500"--&gt; &lt;data:DataGridTextColumn DisplayMemberBinding="{Binding Enabled}" Header="Enabled" IsReadOnly="True" /&gt; &lt;/data:DataGrid.Columns&gt; &lt;/data:DataGrid&gt; &lt;/Grid&gt; &lt;/StackPanel&gt; &lt;Grid x:Name="EditPersonPopupGrid" Visibility="Collapsed"&gt; &lt;Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Opacity="0.765" Fill="#FF8A8A8A" /&gt; &lt;Border CornerRadius="30" Background="#FF2D1DCC" Width="700" Height="400" HorizontalAlignment="Center" VerticalAlignment="Center" BorderThickness="1,1,1,1" BorderBrush="#FF000000"&gt; &lt;StackPanel x:Name="EditPersonStackPanel" Orientation="Vertical" Background="White" HorizontalAlignment="Center" VerticalAlignment="Center" Width="650" &gt; &lt;ContentControl&gt; &lt;StackPanel x:Name="EmailEditStackPanel" Orientation="Horizontal"&gt; &lt;TextBlock Text="Email Address:" Width="200" Margin="5,0,5,0" /&gt; &lt;TextBox x:Name="EmailPopupTextBox" Width="200" /&gt; &lt;/StackPanel&gt; &lt;/ContentControl&gt; &lt;ContentControl&gt; &lt;StackPanel x:Name="AppliesToDropdownStackPanel" Orientation="Horizontal" Margin="2,2,2,0"&gt; &lt;TextBlock Text="Don't send when update was done by:" /&gt; &lt;StackPanel Orientation="Vertical" MaxHeight="275" MaxWidth="350" &gt; &lt;TextBlock x:Name="SelectedItemTextBlock" TextAlignment="Right" Width="200" Margin="5,0,5,0" /&gt; &lt;Grid x:Name="UserDropDownGrid" MaxHeight="75" MaxWidth="200" Visibility="Collapsed" ScrollViewer.VerticalScrollBarVisibility="Visible" ScrollViewer.HorizontalScrollBarVisibility="Hidden" &gt; &lt;Rectangle Fill="White" /&gt; &lt;Border Background="White"&gt; &lt;ListBox x:Name="UsersListBox" SelectionChanged="UsersListBox_SelectionChanged" ItemsSource="{Binding UserID}" /&gt; &lt;/Border&gt; &lt;/Grid&gt; &lt;/StackPanel&gt; &lt;Button x:Name="DropDownButton" Click="DropDownButton_Click" VerticalAlignment="Top" Width="25" Height="25"&gt; &lt;Path Height="10" Width="10" Fill="#FF000000" Stretch="Fill" Stroke="#FF000000" Data="M514.66669,354 L542.16669,354 L527.74988,368.41684 z" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="1,1,1,1"/&gt; &lt;/Button&gt; &lt;/StackPanel&gt; &lt;/ContentControl&gt; &lt;TextBlock Text="Where Clause Condition:" /&gt; &lt;TextBox x:Name="WhereClauseTextBox" Height="200" Width="800" AcceptsReturn="True" TextWrapping="Wrap" /&gt; &lt;ContentControl&gt; &lt;StackPanel Orientation="Vertical"&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;Button x:Name="TestConditionButton" Content="Test Condition" Margin="5,5,5,5" Click="TestConditionButton_Click" /&gt; &lt;Button x:Name="Save" Content="Save" HorizontalAlignment="Right" Margin="5,5,5,5" Click="Save_Click" /&gt; &lt;Button x:Name="Cancel" Content="Cancel" HorizontalAlignment="Right" Margin="5,5,5,5" Click="Cancel_Click" /&gt; &lt;/StackPanel&gt; &lt;TextBlock x:Name="TestContitionResults" Visibility="Collapsed" /&gt; &lt;/StackPanel&gt; &lt;/ContentControl&gt; &lt;/StackPanel&gt; &lt;/Border&gt; &lt;/Grid&gt; &lt;/Grid&gt; </code></pre> <p></p> <p>And the call that occurs when the grid's selection is changed:</p> <pre><code>Private Sub IncidentGrid_SelectionChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) If mFirstTime Then mFirstTime = False Else Dim data As SimpleASMX.EMailMonitor = CType(IncidentGrid.SelectedItem, SimpleASMX.EMailMonitor) Dim selectedGridItem As SimpleASMX.EMailMonitor = Nothing If IncidentGrid.SelectedItem IsNot Nothing Then selectedGridItem = CType(IncidentGrid.SelectedItem, SimpleASMX.EMailMonitor) EmailPopupTextBox.Text = selectedGridItem.Address SelectedItemTextBlock.Text = selectedGridItem.AppliesToUserID WhereClauseTextBox.Text = selectedGridItem.whereClause IncidentGrid.SelectedIndex = mEmailMonitorData.IndexOf(selectedGridItem) End If If IncidentGrid.SelectedIndex &gt; -1 Then EditPersonPopupGrid.Visibility = Windows.Visibility.Visible Else EditPersonPopupGrid.Visibility = Windows.Visibility.Collapsed End If End If End Sub </code></pre> <p>Sorry if my code is atrocious, I'm still learning Silverlight.</p>
[ { "answer_id": 74877, "author": "Senkwe", "author_id": 6419, "author_profile": "https://Stackoverflow.com/users/6419", "pm_score": 3, "selected": true, "text": "public partial class Page : UserControl\n{\n private Person _currentSelectedPerson;\n\n public Page()\n {\n Ini...
2008/09/16
[ "https://Stackoverflow.com/questions/74461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12413/" ]
74,466
<p>I have a .ico file that is embedded as a resource (build action set to resource). I am trying to create a NotifyIcon. How can I reference my icon?</p> <pre><code>notifyIcon = new NotifyIcon(); notifyIcon.Icon = ?? // my icon file is called MyIcon.ico and is embedded </code></pre>
[ { "answer_id": 74671, "author": "user13125", "author_id": 13125, "author_profile": "https://Stackoverflow.com/users/13125", "pm_score": 8, "selected": true, "text": "System.Windows.Forms.NotifyIcon icon = new System.Windows.Forms.NotifyIcon();\nStream iconStream = Application.GetResource...
2008/09/16
[ "https://Stackoverflow.com/questions/74466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3047/" ]
74,471
<p>I have a function that takes, amongst others, a parameter declared as <em>int privateCount</em>. When I want to call ToString() on this param, ReSharper greys it out and marks it as a redundant call. So, curious as I am, I remove the ToString(), and the code still builds!</p> <p>How can a C# compiler allow this, where <em>str</em> is a string?</p> <p><code>str += privateCount +</code> ...</p>
[ { "answer_id": 74495, "author": "Haacked", "author_id": 598, "author_profile": "https://Stackoverflow.com/users/598", "pm_score": 5, "selected": true, "text": "string x = \"123\" + 45;\n" }, { "answer_id": 74546, "author": "Stephen Deken", "author_id": 7154, "author_p...
2008/09/16
[ "https://Stackoverflow.com/questions/74471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8741/" ]
74,494
<p>I'm developing a website on an XP virtual machine and have an SMTP virtual server set up in IIS -- it delivers mail just fine. What I would <em>like</em> is to confirm that any emails the site sends are only going to a specific domain.</p> <p>The XP firewall seems to only involve incoming connections, I can't block outgoing TCP on port 25. And I haven't been able to configure the SMTP server to filter by delivery address.</p> <p>With this setup, is there any easy way to filter outgoing email by destination address?</p>
[ { "answer_id": 75434, "author": "Neil C. Obremski", "author_id": 9642, "author_profile": "https://Stackoverflow.com/users/9642", "pm_score": 2, "selected": true, "text": "Advanced Delivery" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/74494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13071/" ]
74,514
<p>Implementing Equals() for reference types is harder than it seems. My current canonical implementation goes like this:</p> <pre><code>public bool Equals( MyClass obj ) { // If both refer to the same reference they are equal. if( ReferenceEquals( obj, this ) ) return true; // If the other object is null they are not equal because in C# this cannot be null. if( ReferenceEquals( obj, null ) ) return false; // Compare data to evaluate equality return _data.Equals( obj._data ); } public override bool Equals( object obj ) { // If both refer to the same reference they are equal. if( ReferenceEquals( obj, this ) ) return true; // If the other object is null or is of a different types the objects are not equal. if( ReferenceEquals( obj, null ) || obj.GetType() != GetType() ) return false; // Use type-safe equality comparison return Equals( (MyClass)obj ); } public override int GetHashCode() { // Use data's hash code as our hashcode return _data.GetHashCode(); } </code></pre> <p>I think that this covers all corner (inheritance and such) cases but I may be wrong. What do you guys think?</p>
[ { "answer_id": 74559, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 0, "selected": false, "text": "GetType()" }, { "answer_id": 74704, "author": "Santiago Palladino", "author_id": 12791, "author_profile":...
2008/09/16
[ "https://Stackoverflow.com/questions/74514", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12851/" ]
74,519
<p>I would like to use the 7-Zip DLLs from Delphi but have not been able to find decent documentation or examples. Does anyone know how to use the 7-Zip DLLs from Delphi?</p>
[ { "answer_id": 1344656, "author": "jasonpenny", "author_id": 28445, "author_profile": "https://Stackoverflow.com/users/28445", "pm_score": 5, "selected": false, "text": "uses\n JclCompression;\n\nprocedure TfrmSevenZipTest.Button1Click(Sender: TObject);\nconst\n FILENAME = 'F:\\temp\...
2008/09/16
[ "https://Stackoverflow.com/questions/74519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13054/" ]
74,521
<p>Does anyone have details in setting up Qt4 in Visual Studio 2008? Links to other resources would be appreciated as well.</p> <p>I already know that the commercial version of Qt has applications to this end. I also realize that I'll probably need to compile from source as the installer for the open source does not support Visual Studio and installs Cygwin.</p>
[ { "answer_id": 1344656, "author": "jasonpenny", "author_id": 28445, "author_profile": "https://Stackoverflow.com/users/28445", "pm_score": 5, "selected": false, "text": "uses\n JclCompression;\n\nprocedure TfrmSevenZipTest.Button1Click(Sender: TObject);\nconst\n FILENAME = 'F:\\temp\...
2008/09/16
[ "https://Stackoverflow.com/questions/74521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11994/" ]
74,570
<p>I'm maintaining <a href="http://perl-begin.org/" rel="nofollow noreferrer">the Perl Beginners' Site</a> and used a modified template from Open Source Web Designs. Now, the problem is that I still have an undesired artifact: a gray line on the left side of the main frame, to the left of the navigation menu. Here's <a href="http://www.shlomifish.org/Files/files/images/Computer/Screenshots/perl-begin-bad-artif.png" rel="nofollow noreferrer">an image</a> highlighting the undesired effect.</p> <p>How can I fix the CSS to remedy this problem?</p>
[ { "answer_id": 74610, "author": "Shog9", "author_id": 811, "author_profile": "https://Stackoverflow.com/users/811", "pm_score": 4, "selected": true, "text": "background-image" }, { "answer_id": 74621, "author": "Jonathan Rupp", "author_id": 12502, "author_profile": "h...
2008/09/16
[ "https://Stackoverflow.com/questions/74570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7709/" ]
74,612
<p>I have a table inside a div. I want the table to occupy the entire width of the div tag.</p> <p>In the CSS, I've set the <code>width</code> of the table to <code>100%</code>. Unfortunately, when the div has some <code>margin</code> on it, the table ends up wider than the div it's in.</p> <p>I need to support IE6 and IE7 (as this is an internal app), although I'd obviously like a fully cross-browser solution if possible!</p> <p>I'm using the following DOCTYPE...</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> <hr> <p><strong>Edit</strong>: Unfortunately I can't hard-code the width as I'm dynamically generating the HTML and it includes nesting the divs recursively inside each other (with left margin on each div, this creates a nice 'nested' effect).</p>
[ { "answer_id": 74715, "author": "Nate", "author_id": 12779, "author_profile": "https://Stackoverflow.com/users/12779", "pm_score": 3, "selected": false, "text": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\...
2008/09/16
[ "https://Stackoverflow.com/questions/74612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/475/" ]
74,616
<p>example:</p> <pre><code>public static void DoSomething&lt;K,V&gt;(IDictionary&lt;K,V&gt; items) { items.Keys.Each(key =&gt; { if (items[key] **is IEnumerable&lt;?&gt;**) { /* do something */ } else { /* do something else */ } } </code></pre> <p>Can this be done without using reflection? How do I say IEnumerable in C#? Should I just use IEnumerable since IEnumerable&lt;> implements IEnumerable? </p>
[ { "answer_id": 74648, "author": "Jorge Ferreira", "author_id": 6508, "author_profile": "https://Stackoverflow.com/users/6508", "pm_score": 2, "selected": false, "text": "if (typeof(IEnumerable).IsAssignableFrom(typeof(V))) {\n" }, { "answer_id": 74772, "author": "Isak Savo", ...
2008/09/16
[ "https://Stackoverflow.com/questions/74616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12934/" ]
74,620
<p>Can't understand why the following takes place:</p> <pre><code>String date = "06-04-2007 07:05"; SimpleDateFormat fmt = new SimpleDateFormat("MM-dd-yyyy HH:mm"); Date myDate = fmt.parse(date); System.out.println(myDate); //Mon Jun 04 07:05:00 EDT 2007 long timestamp = myDate.getTime(); System.out.println(timestamp); //1180955100000 -- where are the milliseconds? // on the other hand... myDate = new Date(); System.out.println(myDate); //Tue Sep 16 13:02:44 EDT 2008 timestamp = myDate.getTime(); System.out.println(timestamp); //1221584564703 -- why, oh, why? </code></pre>
[ { "answer_id": 74652, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 5, "selected": true, "text": "String date = \"06-04-2007 07:05:00.999\";\nSimpleDateFormat fmt = new SimpleDateFormat(\"MM-dd-yyyy HH:mm:ss.S\");\nD...
2008/09/16
[ "https://Stackoverflow.com/questions/74620", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10675/" ]
74,625
<p>A good while ago, I read <a href="http://www.viemu.com/a-why-vi-vim.html" rel="noreferrer">an article by the creator of viemu</a>, clearing up a lot of the misconceptions about vi, as well as explaining why it's a good idea (and why it's been very popular for the last 30 years+). The same guy also has <a href="http://www.viemu.com/a_vi_vim_graphical_cheat_sheet_tutorial.html" rel="noreferrer">a great set of graphical cheat sheets</a> that teach the basics a few bits at a time.</p> <p>I'm convinced.</p> <p>I've been convinced for the past 2 years in fact. But I still really haven't gotten around to force myself to learn vi as my primary editor, the learning curve is just too high. When I get down to work, acceptable but immediate productivity (using my current editor) has so far won over tremendous productivity farther down the line (using vi).</p> <p>Does anybody have any good tips to help get past the learning curve? It can be straight out tips, some other tutorial or article, whatever.</p> <p>Edit: Note that I'm aware of the <a href="http://www.vim.org/" rel="noreferrer">vim/gVim</a>, <a href="http://cream.sourceforge.net/" rel="noreferrer">Cream</a> and <a href="http://code.google.com/p/macvim/" rel="noreferrer">MacVim</a> (etc.) variants of vi. I kept my question about vi to refer to the vi family as a whole. Thanks for all the great answers.</p> <h3>Update (April 2009)</h3> <p>I've been using Vim (more precisely, MacVim) in my day to day professional life since last December. I'm not going back :-)</p> <p>Good luck to everyone in their Vim mastery.</p>
[ { "answer_id": 74730, "author": "Jon Ericson", "author_id": 1438, "author_profile": "https://Stackoverflow.com/users/1438", "pm_score": 2, "selected": false, "text": "$ sudu rm /usr/local/bin/emacs\n" }, { "answer_id": 75151, "author": "Eduardo Marinho", "author_id": 1321...
2008/09/16
[ "https://Stackoverflow.com/questions/74625", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6349/" ]
74,626
<p>I have a CIFS share mounted on a Linux machine. The CIFS server is down, or the internet connection is down, and anything that touches the CIFS mount now takes several minutes to timeout, and is unkillable while you wait. I can't even run ls in my home directory because there is a symlink pointing inside the CIFS mount and ls tries to follow it to decide what color it should be. If I try to umount it (even with -fl), the umount process hangs just like ls does. Not even sudo kill -9 can kill it. How can I force the kernel to unmount?</p>
[ { "answer_id": 74695, "author": "Chris AtLee", "author_id": 4558, "author_profile": "https://Stackoverflow.com/users/4558", "pm_score": 2, "selected": false, "text": "umount -f /mnt/fileshare\n" }, { "answer_id": 96288, "author": "Kemal", "author_id": 7506, "author_pr...
2008/09/16
[ "https://Stackoverflow.com/questions/74626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10168/" ]
74,641
<p>I currently am tasked with updating an XML file (persistance.xml) within a jar at a customers site. I can of course unjar the file, update the xml, then rejar the file for redeployment. I would like to kind these command line operations in a Swing App so that the person doing it does not have to drop to the command line. Any thoughts on a way to do this programatically? </p>
[ { "answer_id": 74702, "author": "jodonnell", "author_id": 4223, "author_profile": "https://Stackoverflow.com/users/4223", "pm_score": 2, "selected": false, "text": "File tmp = new File (\"tmp\");\ntmp.mkdirs();\nProcess unjar = new ProcessBuilder (\"jar\", \"-xf\", \"myjar.jar\", tmp.get...
2008/09/16
[ "https://Stackoverflow.com/questions/74641", "https://Stackoverflow.com", "https://Stackoverflow.com/users/387361/" ]
74,674
<p>I need to check CPU and memory usage for the server in java, anyone know how it could be done?</p>
[ { "answer_id": 74742, "author": "Rich Adams", "author_id": 10018, "author_profile": "https://Stackoverflow.com/users/10018", "pm_score": 3, "selected": false, "text": "long total = Runtime.getRuntime().totalMemory();\nlong used = Runtime.getRuntime().totalMemory() - Runtime.getRuntime()...
2008/09/16
[ "https://Stackoverflow.com/questions/74674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13123/" ]
74,690
<p>I have a QMainWindow in a Qt application. When I close it I want it to store its current restore size (the size of the window when it is not maximized). This works well when I close the window in restore mode (that is, not maximized). But if I close the window if it is maximized, then next time i start the application and restore the application (because it starts in maximized mode), then it does not remember the size it should restore to. Is there a way to do this?</p>
[ { "answer_id": 74885, "author": "dF.", "author_id": 3002, "author_profile": "https://Stackoverflow.com/users/3002", "pm_score": 2, "selected": false, "text": "QWidget::isMaximized()" }, { "answer_id": 8736705, "author": "iforce2d", "author_id": 624593, "author_profile...
2008/09/16
[ "https://Stackoverflow.com/questions/74690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1585/" ]
74,723
<p>This problem has been afflicting me for quite a while and it's been really annoying.</p> <p>Every time I login after a reboot/power cycle the explorer takes some time to show up. I've taken the step of waiting for all the services to boot up and then I login, but it doesn't make any difference. The result is always the same: Some of the icons do not show up even if the applications have started.</p> <p>I've dug a bit on the code that makes one application "stick" an icon in there, but is there an API call that one can perform so explorer re-reads all that icon info? Like invalidate or redraw or something of the sort?</p> <hr> <p>Apparently, it looks like Jon was right and it's not possible to do it.</p> <p>I've followed Bob Dizzle and Mark Ransom code and build this (Delphi Code):</p> <pre><code>procedure Refresh; var hSysTray: THandle; begin hSysTray := GetSystrayHandle; SendMessage(hSysTray, WM_PAINT, 0, 0); end; function GetSystrayHandle: THandle; var hTray, hNotify, hSysPager: THandle; begin hTray := FindWindow('Shell_TrayWnd', ''); if hTray = 0 then begin Result := hTray; exit; end; hNotify := FindWindowEx(hTray, 0, 'TrayNotifyWnd', ''); if hNotify = 0 then begin Result := hNotify; exit; end; hSyspager := FindWindowEx(hNotify, 0, 'SysPager', ''); if hSyspager = 0 then begin Result := hSyspager; exit; end; Result := FindWindowEx(hSysPager, 0, 'ToolbarWindow32', 'Notification Area'); end;</code></pre> <p>But to no avail.</p> <p>I've even tried with <pre><code>InvalidateRect()</code></pre> and still no show.</p> <p>Any other suggestions?</p>
[ { "answer_id": 74781, "author": "Bob Dizzle", "author_id": 9581, "author_profile": "https://Stackoverflow.com/users/9581", "pm_score": 2, "selected": false, "text": "public const int WM_PAINT = 0xF;\n[DllImport(\"USER32.DLL\")]\npublic static extern int SendMessage(IntPtr hwnd, int msg, ...
2008/09/16
[ "https://Stackoverflow.com/questions/74723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8167/" ]
74,782
<p>What's the difference between eruby and erb? What considerations would drive me to choose one or the other?</p> <p>My application is generating config files for network devices (routers, load balancers, firewalls, etc.). My plan is to template the config files, using embedded ruby (via either eruby or erb) within the source files to do things like iteratively generate all the interface config blocks for a router (these blocks are all very similar, differing only in a label and an IP address). For example, I might have a config template file like this:</p> <pre><code>hostname sample-router &lt;%= r = String.new; [ ["GigabitEthernet1/1", "10.5.16.1"], ["GigabitEthernet1/2", "10.5.17.1"], ["GigabitEthernet1/3", "10.5.18.1"] ].each { |tuple| r &lt;&lt; "interface #{tuple[0]}\n" r &lt;&lt; " ip address #{tuple[1]} netmask 255.255.255.0\n" } r.chomp %&gt; logging 10.5.16.26 </code></pre> <p>which, when run through an embedded ruby interpreter (either erb or eruby), produces the following output:</p> <pre><code>hostname sample-router interface GigabitEthernet1/1 ip address 10.5.16.1 netmask 255.255.255.0 interface GigabitEthernet1/2 ip address 10.5.17.1 netmask 255.255.255.0 interface GigabitEthernet1/3 ip address 10.5.18.1 netmask 255.255.255.0 logging 10.5.16.26 </code></pre>
[ { "answer_id": 74823, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": 2, "selected": false, "text": ".rhtml" }, { "answer_id": 81574, "author": "Jon Wood", "author_id": 25258, "author_profile": "http...
2008/09/16
[ "https://Stackoverflow.com/questions/74782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13157/" ]
74,790
<p>Is it possible to listen for a certain hotkey (e.g:<kbd>Ctrl</kbd><kbd>-</kbd><kbd>I</kbd>) and then perform a specific action? My application is written in C, will only run on Linux, and it doesn't have a GUI. Are there any libraries that help with this kind of task?</p> <p>EDIT: as an example, amarok has global shortcuts, so for example if you map a combination of keys to an action (let's say <kbd>Ctrl</kbd><kbd>-</kbd><kbd>+</kbd>, <kbd>Ctrl</kbd> and <kbd>+</kbd>) you could execute that action when you press the keys. If I would map <kbd>Ctrl</kbd><kbd>-</kbd><kbd>+</kbd> to the volume increase action, each time I press <kbd>ctrl</kbd><kbd>-</kbd><kbd>+</kbd> the volume should increase by a certain amount.</p> <p>Thanks</p>
[ { "answer_id": 74989, "author": "Incident", "author_id": 11613, "author_profile": "https://Stackoverflow.com/users/11613", "pm_score": 0, "selected": false, "text": "man 5 terminfo\n" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/74790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11234/" ]
74,829
<p>What should I type on the Mac OS X terminal to run a script as root?</p>
[ { "answer_id": 74833, "author": "dF.", "author_id": 3002, "author_profile": "https://Stackoverflow.com/users/3002", "pm_score": 7, "selected": true, "text": "sudo" }, { "answer_id": 75016, "author": "jackrabbit", "author_id": 3707, "author_profile": "https://Stackover...
2008/09/16
[ "https://Stackoverflow.com/questions/74829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/877/" ]
74,844
<p>I am not new to *nix, however lately I have been spending a lot of time at the prompt. My question is what are the advantages of using KornShell (ksh) or Bash Shell? Where are the pitfalls of using one over the other? </p> <p>Looking to understand from the perspective of a user, rather than purely scripting.</p>
[ { "answer_id": 74936, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stackoverflow.com/users/4203", "pm_score": 2, "selected": false, "text": "sh" }, { "answer_id": 5525644, "author": "Henk Langeveld", "author_id": 667820, "author_profile": "https...
2008/09/16
[ "https://Stackoverflow.com/questions/74844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13158/" ]
74,847
<p>Typically I use <code>E_ALL</code> to see anything that PHP might say about my code to try and improve it.</p> <p>I just noticed a error constant <code>E_STRICT</code>, but have never used or heard about it, is this a good setting to use for development? The manual says:</p> <blockquote> <p>Run-time notices. Enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code. </p> </blockquote> <p>So I'm wondering if I'm using the best <code>error_reporting</code> level with <code>E_ALL</code> or would that along with <code>E_STRICT</code> be the best? Or is there any other combination I've yet to learn?</p>
[ { "answer_id": 74907, "author": "Daniel Papasian", "author_id": 7548, "author_profile": "https://Stackoverflow.com/users/7548", "pm_score": 3, "selected": false, "text": "syslog" }, { "answer_id": 74923, "author": "Jim", "author_id": 8427, "author_profile": "https://S...
2008/09/16
[ "https://Stackoverflow.com/questions/74847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5261/" ]
74,865
<p>I recently was working with a subversion project that checked out code not only from the repository I was working with, but also from a separate repository on a different server.</p> <p>How can I configure my repository to do this?</p> <p>I'm using the subversion client version 1.3.2 on Linux, and I also have access to TortoiseSVN version 1.4.8 (built on svn version 1.4.6) in Windows.</p>
[ { "answer_id": 74878, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stackoverflow.com/users/4203", "pm_score": 5, "selected": true, "text": "svn checkout" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/74865", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7154/" ]
74,879
<p>I am looking for a tool which will take an XML instance document and output a corresponding XSD schema.</p> <p>I certainly recognize that the generated XSD schema will be limited when compared to creating a schema by hand (it probably won't handle optional or repeating elements, or data constraints), but it could at least serve as a quick starting point.</p>
[ { "answer_id": 88683, "author": "Pat Hermens", "author_id": 1677, "author_profile": "https://Stackoverflow.com/users/1677", "pm_score": 4, "selected": false, "text": "C:\\Program Files\\Microsoft Visual Studio 8\\VC>xsd\nMicrosoft (R) Xml Schemas/DataTypes support utility\n[Microsoft (R)...
2008/09/16
[ "https://Stackoverflow.com/questions/74879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/863/" ]
74,880
<p>Conceptually, I would like to accomplish the following but have had trouble understand how to code it properly in C#:</p> <pre><code> SomeMethod { // Member of AClass{} DoSomething; Start WorkerMethod() from BClass in another thread; DoSomethingElse; } </code></pre> <p>Then, when WorkerMethod() is complete, run this:</p> <p><pre><code> void SomeOtherMethod() // Also member of AClass{} { ... } </pre></code></p> <p>Can anyone please give an example of that? </p>
[ { "answer_id": 74948, "author": "Isak Savo", "author_id": 8521, "author_profile": "https://Stackoverflow.com/users/8521", "pm_score": 5, "selected": true, "text": "BackgroundWorker worker = new BackgroundWorker();\nworker.DoWork += delegate { myBClass.DoHardWork(); }\nworker.RunWorkerCom...
2008/09/16
[ "https://Stackoverflow.com/questions/74880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10505/" ]
74,883
<p>I cannot seem to compile mod_dontdothat on Windows. Has anybody managed to achieve this?</p> <p>Edit:</p> <p>I've tried compiling the file according to the readme on the site and I've tried to add extra libs to reduce the link errors. Ive got the following installed:</p> <ol> <li>Apache 2.2.9</li> <li>Visual Studio 2008</li> <li>ActivePerl</li> <li>apxs-win32 from ApacheLounge</li> <li>Subversion libs and headers</li> </ol> <p>I run the following command line:</p> <pre> C:\Program Files\Apache Software Foundation\Apache2.2\bin>apxs -c -I ..\include\ svn_config.h -L ..\lib -L C:\Progra~1\Micros~1.0\VC\lib -l apr-1.lib -l aprutil- 1.lib -l svn_subr-1.lib -l libapr-1.lib -l libaprutil-1.lib -l libhttpd.lib -l l ibsvn_subr-1.lib -l mod_dav.lib mod_dontdothat.c </pre> <p>Then I get the following errors:</p> <pre> cl /nologo /MD /W3 /O2 /D WIN32 /D _WINDOWS /D NDEBUG -I"C:\PROGRA~1\APACHE~ 1\Apache2.2\include" /I"..\include\svn_config.h" /c /Fomod_dontdothat.lo mod_d ontdothat.c mod_dontdothat.c link kernel32.lib /nologo /subsystem:windows /dll /machine:I386 /libpath:"C:\PRO GRA~1\APACHE~1\Apache2.2\lib" /out:mod_dontdothat.so /libpath:"..\lib" /libpat h:"C:\Progra~1\Micros~1.0\VC\lib" apr-1.lib aprutil-1.lib svn_subr-1.lib libapr -1.lib libaprutil-1.lib libhttpd.lib libsvn_subr-1.lib mod_dav.lib mod_dontdot hat.lo Creating library mod_dontdothat.lib and object mod_dontdothat.exp mod_dontdothat.lo : error LNK2019: unresolved external symbol _dav_svn_split_uri @32 referenced in function _is_this_legal svn_subr-1.lib(io.obj) : error LNK2001: unresolved external symbol __imp__libint l_dgettext svn_subr-1.lib(subst.obj) : error LNK2001: unresolved external symbol __imp__lib intl_dgettext svn_subr-1.lib(config_auth.obj) : error LNK2001: unresolved external symbol __im p__libintl_dgettext svn_subr-1.lib(time.obj) : error LNK2001: unresolved external symbol __imp__libi ntl_dgettext svn_subr-1.lib(nls.obj) : error LNK2001: unresolved external symbol __imp__libin tl_dgettext svn_subr-1.lib(dso.obj) : error LNK2001: unresolved external symbol __imp__libin tl_dgettext svn_subr-1.lib(path.obj) : error LNK2001: unresolved external symbol __imp__libi ntl_dgettext svn_subr-1.lib(prompt.obj) : error LNK2001: unresolved external symbol __imp__li bintl_dgettext svn_subr-1.lib(error.obj) : error LNK2019: unresolved external symbol __imp__lib intl_dgettext referenced in function _print_error svn_subr-1.lib(config.obj) : error LNK2001: unresolved external symbol __imp__li bintl_dgettext svn_subr-1.lib(utf.obj) : error LNK2001: unresolved external symbol __imp__libin tl_dgettext svn_subr-1.lib(cmdline.obj) : error LNK2001: unresolved external symbol __imp__l ibintl_dgettext svn_subr-1.lib(utf.obj) : error LNK2019: unresolved external symbol __imp__libin tl_sprintf referenced in function _fuzzy_escape svn_subr-1.lib(path.obj) : error LNK2001: unresolved external symbol __imp__libi ntl_sprintf svn_subr-1.lib(cmdline.obj) : error LNK2019: unresolved external symbol __imp__l ibintl_fprintf referenced in function _svn_cmdline_init svn_subr-1.lib(config_win.obj) : error LNK2019: unresolved external symbol __imp __SHGetFolderPathA@20 referenced in function _svn_config__win_config_path svn_subr-1.lib(config_win.obj) : error LNK2019: unresolved external symbol __imp __SHGetFolderPathW@20 referenced in function _svn_config__win_config_path svn_subr-1.lib(config_win.obj) : error LNK2019: unresolved external symbol __imp __RegCloseKey@4 referenced in function _svn_config__parse_registry svn_subr-1.lib(config_win.obj) : error LNK2019: unresolved external symbol __imp __RegEnumKeyExA@32 referenced in function _svn_config__parse_registry svn_subr-1.lib(config_win.obj) : error LNK2019: unresolved external symbol __imp __RegOpenKeyExA@20 referenced in function _svn_config__parse_registry svn_subr-1.lib(config_win.obj) : error LNK2019: unresolved external symbol __imp __RegQueryValueExA@24 referenced in function _parse_section svn_subr-1.lib(config_win.obj) : error LNK2019: unresolved external symbol __imp __RegEnumValueA@32 referenced in function _parse_section svn_subr-1.lib(win32_xlate.obj) : error LNK2019: unresolved external symbol __im p__CoUninitialize@0 referenced in function _svn_subr__win32_xlate_open svn_subr-1.lib(win32_xlate.obj) : error LNK2019: unresolved external symbol __im p__CoInitializeEx@8 referenced in function _svn_subr__win32_xlate_open svn_subr-1.lib(win32_xlate.obj) : error LNK2019: unresolved external symbol __im p__CoCreateInstance@20 referenced in function _get_page_id_from_name svn_subr-1.lib(nls.obj) : error LNK2019: unresolved external symbol __imp__libin tl_bindtextdomain referenced in function _svn_nls_init svn_subr-1.lib(stream.obj) : error LNK2019: unresolved external symbol _inflate referenced in function _read_handler_gz svn_subr-1.lib(stream.obj) : error LNK2019: unresolved external symbol _inflateI nit_ referenced in function _read_handler_gz svn_subr-1.lib(stream.obj) : error LNK2019: unresolved external symbol _deflate referenced in function _write_handler_gz svn_subr-1.lib(stream.obj) : error LNK2019: unresolved external symbol _deflateI nit_ referenced in function _write_handler_gz svn_subr-1.lib(stream.obj) : error LNK2019: unresolved external symbol _deflateE nd referenced in function _close_handler_gz svn_subr-1.lib(stream.obj) : error LNK2019: unresolved external symbol _inflateE nd referenced in function _close_handler_gz mod_dontdothat.so : fatal error LNK1120: 21 unresolved externals apxs:Error: Command failed with rc=6291456 . </pre> <p>I'm not too much of a C guru, so any help in finding these unresolved external symbols will be much appreciated!</p>
[ { "answer_id": 482896, "author": "agnul", "author_id": 6069, "author_profile": "https://Stackoverflow.com/users/6069", "pm_score": 2, "selected": false, "text": "mod_dav_svn.lib" }, { "answer_id": 499837, "author": "Eduard Wirch", "author_id": 17428, "author_profile":...
2008/09/16
[ "https://Stackoverflow.com/questions/74883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2822/" ]
74,886
<p>I need to rearrange some content in various directories but it's a bit of a pain. In order to debug the application I'm working on (a ruby app) I need to move my gems into my gem folder one at a time (long story; nutshell: one is broken and I can't figure out which one).</p> <p>So I need to do something like:</p> <pre><code>sudo mv backup/gem/foo gem/ sudo mv backup/doc/foo doc/ sudo mv backup/specification/foo.gemspec specification/ </code></pre> <p>replacing "foo" each time. How can I author a simple shell script to let me do something like: gemMove("foo") and it fill in the blanks for me?</p>
[ { "answer_id": 74920, "author": "pjz", "author_id": 8002, "author_profile": "https://Stackoverflow.com/users/8002", "pm_score": 4, "selected": true, "text": "gemmove" }, { "answer_id": 74937, "author": "sirprize", "author_id": 12902, "author_profile": "https://Stackov...
2008/09/16
[ "https://Stackoverflow.com/questions/74886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10071/" ]
74,902
<p>I installed Mono on my iMac last night and I immidiately had a change of heart! I don't think Mono is ready for prime time. </p> <p>The Mono website says to run the following script to uninstall:</p> <pre><code>#!/bin/sh -x #This script removes Mono from an OS X System. It must be run as root rm -r /Library/Frameworks/Mono.framework rm -r /Library/Receipts/MonoFramework-SVN.pkg cd /usr/bin for i in `ls -al | grep Mono | awk '{print $9}'`; do rm ${i} done </code></pre> <p>Has anyone had to uninstall Mono? Was it as straight forward as running the above script or do I have to do more? How messy was it? Any pointers are appreciated.</p>
[ { "answer_id": 768240, "author": "joev", "author_id": 3449, "author_profile": "https://Stackoverflow.com/users/3449", "pm_score": 2, "selected": false, "text": "cd\ncp /Library/Receipts/MonoFramework-2.4_7.macos10.novell.universal.pkg/Contents/Resources/uninstallMono.sh .\nsudo ./uninsta...
2008/09/16
[ "https://Stackoverflow.com/questions/74902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/877/" ]
74,951
<p>Flex has built in drag-n-drop for list controls, and allows you to override this. But they don't cover this in examples. The built-in functionality automatically drags the list-item, if you want to override this you find the handlers are being set up on the list itself. What I specifically want to do, is my TileList shows small thumbnails of items I can drag onto a large Canvas. As I drag an item from the list, the drag proxy should be a different image.</p> <p><strong>So, I followed the technique suggested and it only works if I explicitly set the width/height on the proxy Image. Why?</strong></p>
[ { "answer_id": 75541, "author": "Theo", "author_id": 1109, "author_profile": "https://Stackoverflow.com/users/1109", "pm_score": 2, "selected": false, "text": "<List>\n <mouseDown>onListMouseDown(event)</mouseDown>\n</Tree>\n" }, { "answer_id": 2185111, "author": "Ola", ...
2008/09/16
[ "https://Stackoverflow.com/questions/74951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13220/" ]
74,957
<p>In PowerShell I'm reading in a text file. I'm then doing a Foreach-Object over the text file and am only interested in the lines that do NOT contain strings that are in <code>$arrayOfStringsNotInterestedIn</code>.</p> <p>What is the syntax for this?</p> <pre><code> Get-Content $filename | Foreach-Object {$_} </code></pre>
[ { "answer_id": 75034, "author": "Mark Schill", "author_id": 9482, "author_profile": "https://Stackoverflow.com/users/9482", "pm_score": 4, "selected": false, "text": " Get-Content $FileName | foreach-object { \n if ($_ -notmatch $arrayofStringsNotInterestedIn) { $) }\n" }, { ...
2008/09/16
[ "https://Stackoverflow.com/questions/74957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
74,960
<p>I'm looking at the SOAP output from a web service I'm developing, and I noticed something curious:</p> <pre><code>&lt;soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"&gt; &lt;soapenv:Body&gt; &lt;ns1:CreateEntityTypesResponse xmlns:ns1="http://somedomain.com/wsinterface"&gt; &lt;newKeys&gt; &lt;value&gt;1234&lt;/value&gt; &lt;/newKeys&gt; &lt;newKeys&gt; &lt;value&gt;2345&lt;/value&gt; &lt;/newKeys&gt; &lt;newKeys&gt; &lt;value&gt;3456&lt;/value&gt; &lt;/newKeys&gt; &lt;newKeys xsi:nil="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/&gt; &lt;newKeys xsi:nil="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/&gt; &lt;errors&gt;Error1&lt;/errors&gt; &lt;errors&gt;Error2&lt;/errors&gt; &lt;/ns1:CreateEntityTypesResponse&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre> <p>I have two newKeys elements that are nil, and both elements insert a namespace reference for xsi. I'd like to include that namespace in the soapenv:Envelope element so that the namespace reference is only sent once.</p> <p>I am using WSDL2Java to generate the service skeleton, so I don't directly have access to the Axis2 API.</p>
[ { "answer_id": 75128, "author": "Michael Sharek", "author_id": 1958, "author_profile": "https://Stackoverflow.com/users/1958", "pm_score": 3, "selected": false, "text": " // create SOAP envelope with that payload\n org.apache.axiom.soap.SOAPEnvelope env = null;\n env = toEnvelope(\...
2008/09/16
[ "https://Stackoverflow.com/questions/74960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13224/" ]
74,986
<p>I'm developing a .NET 3.5 XBAP application that runs perfectly fine in FF3 and IE6/7 etc. I'm just wondering if its possible to get these to run under other browsers, specifically (as its in the limelight at the moment) Google Chrome.</p>
[ { "answer_id": 7306745, "author": "Noora", "author_id": 928674, "author_profile": "https://Stackoverflow.com/users/928674", "pm_score": 2, "selected": false, "text": "aspnet_regiis.exe -iru" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/74986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5777/" ]
74,993
<p>When running any kind of server under load there are several resources that one would like to monitor to make sure that the server is healthy. This is specifically true when testing the system under load.</p> <p>Some examples for this would be CPU utilization, memory usage, and perhaps disk space. What other resource should I be monitoring, and what tools are available to do so?</p>
[ { "answer_id": 75020, "author": "GEOCHET", "author_id": 5640, "author_profile": "https://Stackoverflow.com/users/5640", "pm_score": -1, "selected": false, "text": "top" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/74993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9435/" ]
75,001
<p>As popular as Ruby and Rails are, it seems like this problem would already be solved. JRuby and mod_rails are all fine and dandy, but why isn't there an Apache mod for just straight Ruby?</p>
[ { "answer_id": 75217, "author": "mislav", "author_id": 11687, "author_profile": "https://Stackoverflow.com/users/11687", "pm_score": 5, "selected": false, "text": "call" }, { "answer_id": 75628, "author": "Nate", "author_id": 12779, "author_profile": "https://Stackove...
2008/09/16
[ "https://Stackoverflow.com/questions/75001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6726/" ]
75,011
<p>In a VB6 application, I have a <code>Dictionary</code> whose keys are <code>String</code>s and values are instances of a custom class. If I call <code>RemoveAll()</code> on the <code>Dictionary</code>, will it first free the custom objects? Or do I explicitly need to do this myself?</p> <pre><code>Dim d as Scripting.Dictionary d("a") = New clsCustom d("b") = New clsCustom ' Are these two lines necessary? Set d("a") = Nothing Set d("b") = Nothing d.RemoveAll </code></pre>
[ { "answer_id": 75066, "author": "Neil C. Obremski", "author_id": 9642, "author_profile": "https://Stackoverflow.com/users/9642", "pm_score": 3, "selected": true, "text": "Dictionary" }, { "answer_id": 75073, "author": "Chris Smith", "author_id": 9073, "author_profile"...
2008/09/16
[ "https://Stackoverflow.com/questions/75011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/863/" ]
75,014
<p>In a multi-threaded application I'm working on, we occasionally see <code>ConcurrentModificationExceptions</code> on our Lists (which are mostly <code>ArrayList</code>, sometimes Vectors). But there are other times when I think concurrent modifications are happening because iterating through the collection appears to be missing items, but no exceptions are thrown. I know that the docs for <code>ConcurrentModificationException</code> says you can't rely on it, but how would I go about making sure I'm not concurrently modifying a List? And is wrapping every access to the collection in a synchronized block the only way to prevent it?</p> <p><strong>Update:</strong> Yes, I know about <code>Collections.synchronizedCollection</code>, but it doesn't guard against somebody modifying the collection while you're iterating through it. I think at least some of my problem is happening when somebody adds something to a collection while I'm iterating through it.</p> <p><strong>Second Update</strong> If somebody wants to combine the mention of the synchronizedCollection and cloning like Jason did with a mention of the java.util.concurrent and the apache collections frameworks like jacekfoo and Javamann did, I can accept an answer.</p>
[ { "answer_id": 75043, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stackoverflow.com/users/4203", "pm_score": 1, "selected": false, "text": "List" }, { "answer_id": 75048, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://St...
2008/09/16
[ "https://Stackoverflow.com/questions/75014", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3333/" ]
75,052
<p>I have a flash player that has a set of songs loaded via an xml file.</p> <p>The files dont start getting stream until you pick one.</p> <p>If I quickly cycle through each of the 8 files, then flash starts trying to download each of the 8 files at the same time.</p> <p>I'm wondering if there is a way to clear the file that is being downloaded. So that bandwidth is not eaten up if someone decides to click on lots of track names.</p> <p>Something like mySound.clear would be great, or mySound.stopStreaming..</p> <p>Has anyone had this problem before?</p> <p>Regards,</p> <p>Chris</p>
[ { "answer_id": 259891, "author": "HanClinto", "author_id": 26933, "author_profile": "https://Stackoverflow.com/users/26933", "pm_score": 2, "selected": true, "text": "package {\n import flash.display.Sprite;\n import flash.net.URLRequest;\n import flash.media.Sound; \n imp...
2008/09/16
[ "https://Stackoverflow.com/questions/75052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6822/" ]
75,057
<p>What is the best way of ensuring that a user supplied password is a strong password in a registration or change password form?</p> <p>One idea I had (in python)</p> <pre><code>def validate_password(passwd): conditions_met = 0 conditions_total = 3 if len(passwd) &gt;= 6: if passwd.lower() != passwd: conditions_met += 1 if len([x for x in passwd if x.isdigit()]) &gt; 0: conditions_met += 1 if len([x for x in passwd if not x.isalnum()]) &gt; 0: conditions_met += 1 result = False print conditions_met if conditions_met &gt;= 2: result = True return result </code></pre>
[ { "answer_id": 75498, "author": "user9116", "author_id": 9116, "author_profile": "https://Stackoverflow.com/users/9116", "pm_score": 3, "selected": false, "text": "abstract class Rule {\n\n float weight;\n\n float calculateScore( string password );\n\n}\n" }, { "answer_id":...
2008/09/16
[ "https://Stackoverflow.com/questions/75057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13099/" ]
75,076
<p>I would like to be able to obtain all the parameter values from the stack frame in .NET. A bit like how you're able to see the values in the call stack when in the Visual Studio debugger. My approach has concentrated on using the <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.stackframe%28v=vs.71%29.aspx" rel="noreferrer">StackFrame class</a> and then to reflect over a <a href="http://msdn.microsoft.com/en-us/library/system.reflection.parameterinfo%28v=vs.71%29.aspx" rel="noreferrer">ParameterInfo</a> array. I've had success with reflection and properties, but this is proving a bit trickier.</p> <p>Is there an approach for achieving this?</p> <p>The code so far looks like this:</p> <pre><code>class Program { static void Main(string[] args) { A a = new A(); a.Go(1); } } public class A { internal void Go(int x) { B b = new B(); b.Go(4); } } public class B { internal void Go(int y) { Console.WriteLine(GetStackTrace()); } public static string GetStackTrace() { StringBuilder sb = new StringBuilder(); StackTrace st = new StackTrace(true); StackFrame[] frames = st.GetFrames(); foreach (StackFrame frame in frames) { MethodBase method = frame.GetMethod(); sb.AppendFormat("{0} - {1}",method.DeclaringType, method.Name); ParameterInfo[] paramaters = method.GetParameters(); foreach (ParameterInfo paramater in paramaters) { sb.AppendFormat("{0}: {1}", paramater.Name, paramater.ToString()); } sb.AppendLine(); } return sb.ToString(); } } </code></pre> <h2>The output looks like this:</h2> <pre><code>SfApp.B - GetStackTrace SfApp.B - Go y: Int32 y SfApp.A - Go x: Int32 x SfApp.Program - Main args: System.String[] args </code></pre> <h2>I'd like it to look more like this:</h2> <pre><code>SfApp.B - GetStackTrace SfApp.B - Go y: 4 SfApp.A - Go x: 1 SfApp.Program - Main </code></pre> <hr/> <p>Just for a bit of context, my plan was to try and use this when I throw my own exceptions. I'll look at your suggestions in more detail and see if I can see it fitting.</p>
[ { "answer_id": 70553027, "author": "Marco Luzzara", "author_id": 5587393, "author_profile": "https://Stackoverflow.com/users/5587393", "pm_score": 1, "selected": false, "text": "StackTrace" } ]
2008/09/16
[ "https://Stackoverflow.com/questions/75076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2422/" ]
75,105
<p>I need to store phone numbers in a table. Please suggest which datatype should I use? <strong>Wait. Please read on before you hit reply..</strong></p> <p>This field needs to be indexed heavily as Sales Reps can use this field for searching (including wild character search).</p> <p>As of now, we are expecting phone numbers to come in a number of formats (from an XML file). Do I have to write a parser to convert to a uniform format? There could be millions of data (with duplicates) and I dont want to tie up the server resources (in activities like preprocessing too much) every time some source data comes through..</p> <p>Any suggestions are welcome..</p> <p>Update: <strong>I have no control over source data. Just that the structure of xml file is standard. Would like to keep the xml parsing to a minimum. Once it is in database, retrieval should be quick. One crazy suggestion going on around here is that it should even work with Ajax AutoComplete feature (so Sales Reps can see the matching ones immediately). OMG!!</strong></p>
[ { "answer_id": 75125, "author": "user13270", "author_id": 13270, "author_profile": "https://Stackoverflow.com/users/13270", "pm_score": 1, "selected": false, "text": "varchar" }, { "answer_id": 42965499, "author": "Mr. Tripodi", "author_id": 4220094, "author_profile":...
2008/09/16
[ "https://Stackoverflow.com/questions/75105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13205/" ]
75,123
<p>I have a DataSet which I get a DataTable from that I am being passed back from a function call. It has 15-20 columns, however I only want 10 columns of the data.</p> <p>Is there a way to remove those columns that I don't want, copy the DataTable to another that has only the columns defined that I want or is it just better to iterate the collection and just use the columns I need.</p> <p>I need to write the values out to a fixed length data file.</p>
[ { "answer_id": 75178, "author": "Tom Ritter", "author_id": 8435, "author_profile": "https://Stackoverflow.com/users/8435", "pm_score": 9, "selected": true, "text": "DataTable t;\nt.Columns.Remove(\"columnName\");\nt.Columns.RemoveAt(columnIndex);\n" }, { "answer_id": 75558, "...
2008/09/16
[ "https://Stackoverflow.com/questions/75123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208/" ]
75,127
<p>I have a bulletin board (punBB based) that I was running out of the root directory for a couple of years. I foolishly decided to do a little gardening and in the process moved the punbb code into it's own subdirectory. The code works great; as long as you point the browser at the new subdirectory. The issue is that the users expect to see it at the root...</p> <p>I tried an index file in the root that had the following:</p> <pre><code>&lt;?php chdir('punbb'); include('index.php'); </code></pre> <p>But that didn't seem to do the trick. So, I tried using the "damn cool voodoo" of mod_rewrite in .htaccess but I can't seem to figure out the right combination of rules to make it work.</p> <p>Here is what I would like to make happen:</p> <p>User enters: </p> <pre><code> http://guardthe.net </code></pre> <p>Browser displays: </p> <pre><code> http://guardthe.net/punbb/ </code></pre> <p>or</p> <pre><code> http://punbb.guardthe.net/ </code></pre> <p>Is this possible, or should I just move the code base back into the root?</p>
[ { "answer_id": 75144, "author": "user13270", "author_id": 13270, "author_profile": "https://Stackoverflow.com/users/13270", "pm_score": 1, "selected": false, "text": "<?php\nHeader( \"HTTP/1.1 301 Moved Permanently\" );\nHeader( \"Location: http://guardthe.net/punbb/\" );\n?>\n" }, {...
2008/09/16
[ "https://Stackoverflow.com/questions/75127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
75,134
<p>How do I have two effects in jQuery run in <code>sequence</code>, not simultaneously? Take this piece of code for example:</p> <pre><code>$("#show-projects").click(function() { $(".page:visible").fadeOut("normal"); $("#projects").fadeIn("normal"); }); </code></pre> <p>The <code>fadeOut</code> and the <code>fadeIn</code> run simultaneously, how do I make them run one after the other?</p>
[ { "answer_id": 75259, "author": "Jim", "author_id": 8427, "author_profile": "https://Stackoverflow.com/users/8427", "pm_score": 6, "selected": true, "text": "$(\"#show-projects\").click(function() {\n $(\".page:visible\").fadeOut(\"normal\", function() {\n $(\"#projects\").fade...
2008/09/16
[ "https://Stackoverflow.com/questions/75134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6967/" ]
75,139
<p>Google custom search code is provided as a form tag. However, Asp.net only allows a single form tag on a page. What is the best way to implement their code so you can include it on an aspx page (say as part of a Masterpage or navigation element). </p>
[ { "answer_id": 75234, "author": "Chris Van Opstal", "author_id": 7264, "author_profile": "https://Stackoverflow.com/users/7264", "pm_score": 3, "selected": false, "text": "<body>\n<form action=\"http://www.google.com/cse\" id=\"cse-search-box\"> ... </form>\n<form runat=\"server\" id=\"a...
2008/09/16
[ "https://Stackoverflow.com/questions/75139", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]