qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
151,303
<p>Using the <code>AddHandler</code> method, if I never use <code>RemoveHandler</code>, will that lead to memory leaks in some conditions and situations? I'm not so sure about the truth of this.</p> <p>And are there other causes to memory leaks that are solely available in VB as opposed to C#?</p>
[ { "answer_id": 151430, "author": "Gishu", "author_id": 1695, "author_profile": "https://Stackoverflow.com/users/1695", "pm_score": 4, "selected": false, "text": "button1.Click += new EventHandler(Form_Click_Handler);\n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8505/" ]
151,335
<p>Is there anyway to combine all resources into a single exe file such as app.config and associated DLL's?</p> <p>Some applications seem to do this such as eMule.</p> <p>I don't want my app.config sitting there waiting to be edited.</p> <p>Thanks</p>
[ { "answer_id": 151352, "author": "Mark Glorie", "author_id": 952, "author_profile": "https://Stackoverflow.com/users/952", "pm_score": 4, "selected": true, "text": "Solution Explorer" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17211/" ]
151,337
<p>I'm looking for a cross-browser method - I know IE has something (I've already forgotten what), and the way to do it in Mozilla may have to do with a focusNode thing I found, that seems related to getting text selections.</p> <p>Methods involving jQuery or another common JS library are fine by me.</p> <p>Thanks!</p>
[ { "answer_id": 151364, "author": "ironfroggy", "author_id": 19687, "author_profile": "https://Stackoverflow.com/users/19687", "pm_score": 1, "selected": false, "text": "var currentFocus = null; \n$(':input').focus( function() { \n currentFocus = this; \n}).blur( function() { \n\n c...
2008/09/30
[ "https://Stackoverflow.com/questions/151337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1507554/" ]
151,338
<p>How can I add an instance variable to a defined class at <b>runtime</b>, and later get and set its value from outside of the class?</p> <p>I'm looking for a metaprogramming solution that allows me to modify the class instance at runtime instead of modifying the source code that originally defined the class. A few of the solutions explain how to declare instance variables in the class definitions, but that is not what I am asking about. </p>
[ { "answer_id": 151354, "author": "Gordon Wilson", "author_id": 23071, "author_profile": "https://Stackoverflow.com/users/23071", "pm_score": 6, "selected": false, "text": "instance_variable_get" }, { "answer_id": 151359, "author": "Mike Stone", "author_id": 122, "auth...
2008/09/30
[ "https://Stackoverflow.com/questions/151338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
151,348
<p>Why is NodeList undefined in IE6/7?</p> <pre><code>&lt;form action="/" method="post" id="testform"&gt; &lt;input type="checkbox" name="foobar[]" value="1" id="" /&gt; &lt;input type="checkbox" name="foobar[]" value="2" id="" /&gt; &lt;input type="checkbox" name="foobar[]" value="3" id="" /&gt; &lt;/form&gt; &lt;script type="text/javascript" charset="utf-8"&gt; (function () { var el = document.getElementById('testform')['foobar[]'] if (el instanceof NodeList) { alert("I'm a NodeList"); } })(); &lt;/script&gt; </code></pre> <p>This works in FF3/Safari 3.1 but doesn't work in IE6/7. Anyone have any ideas how to check if el is an instance of NodeList across all browsers?</p>
[ { "answer_id": 151631, "author": "Adam Franco", "author_id": 15872, "author_profile": "https://Stackoverflow.com/users/15872", "pm_score": 4, "selected": false, "text": "...\n\nif (typeof el.length == 'number' \n && typeof el.item == 'function'\n && typeof el.nextNode == 'function'...
2008/09/30
[ "https://Stackoverflow.com/questions/151348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8369/" ]
151,350
<p>What are my options? I tried MonoDevelop over a year ago but it was extremely buggy. Is the latest version a stable development environment?</p>
[ { "answer_id": 171663, "author": "Sklivvz", "author_id": 7028, "author_profile": "https://Stackoverflow.com/users/7028", "pm_score": 3, "selected": false, "text": "make run" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9825/" ]
151,362
<p>For posting AJAX forms in a form with many parameters, I am using a solution of creating an <code>iframe</code>, posting the form to it by POST, and then accessing the <code>iframe</code>'s content. specifically, I am accessing the content like this:</p> <pre><code>$("some_iframe_id").get(0).contentWindow.document </code></pre> <p>I tested it and it worked. </p> <p>On some of the pages, I started getting an "Access is denied" error. As far as I know, this shouldn't happen if the iframe is served from the same domain. </p> <p>I'm pretty sure it was working before. Anybody have a clue? </p> <p>If I'm not being clear enough: I'm posting to the <em>same domain</em>. So this is not a cross-domain request. I am testing on IE only.</p> <p>P.S. I can't use simple ajax POST queries (don't ask...)</p>
[ { "answer_id": 151395, "author": "Ris Adams", "author_id": 15683, "author_profile": "https://Stackoverflow.com/users/15683", "pm_score": 0, "selected": false, "text": "document.domain = www.foo.com\n" }, { "answer_id": 151404, "author": "Ovesh", "author_id": 3751, "au...
2008/09/30
[ "https://Stackoverflow.com/questions/151362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3751/" ]
151,369
<p>Given an HTML page that has a complex table-based layout and many tags that are duplicated and wasteful, e.g.:</p> <pre><code>td align="left" class="tableformat" width="65%" style="border-bottom:1px solid #ff9600; border-right:1px solid #ff9600; background-color:#FDD69E" nowrap etc. </code></pre> <p>Are there tools to aide the task of refactoring the page into a more compact form? For instance, a tool that automatically generates CSS styles and selectors? That converts tables into div layouts? </p> <p>Just to give a sense of the order of the problem, the page I'm looking at is >8000 lines of HTML and JavaScript, which is 500Kb <em>not counting</em> images! </p> <hr> <p>Update: In re. "give up and start from scratch" comments. What does that mean, in the real world? Print out the page, scan it, set it as the background image in Dreamweaver, and start with that? Seriously? Would that really be more efficient than refactoring? </p> <hr> <p>Update: I'm not denigrating "trace it from scratch" nor did I mean to imply that Dreamweaver is by any means my tool of choice. I'm just very surprised that refactoring a layout is considered to be an intractable problem. </p>
[ { "answer_id": 151549, "author": "gregmac", "author_id": 7913, "author_profile": "https://Stackoverflow.com/users/7913", "pm_score": 1, "selected": false, "text": "<body>\n <div id=\"header\">\n <img id=\"logo\"/>\n <h1 id=\"title\">\n My Site\n </h1>\n <div id=\"subtit...
2008/09/30
[ "https://Stackoverflow.com/questions/151369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10116/" ]
151,392
<p>Does anyone know any good tool that I can use to perform stress tests on a video streaming server? I need to test how well my server handles 5,000+ connections. </p>
[ { "answer_id": 151650, "author": "Andrew Edgecombe", "author_id": 11694, "author_profile": "https://Stackoverflow.com/users/11694", "pm_score": 4, "selected": true, "text": "$i = 0;\n$myurl = \"udp://someurl\";\n@cmdline = (\"/usr/bin/vlc\", \"\");\nfor( $i = 1; $i <= 5000; $i++ )\n{\n ...
2008/09/30
[ "https://Stackoverflow.com/questions/151392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23637/" ]
151,403
<p>According to the answers to <a href="https://stackoverflow.com/questions/151250/how-do-i-embed-a-file-version-in-an-msi-file-with-visual-studio">this</a> question, I cannot embed a file version in my .msi file. </p> <p>The installer that I give the client needs to have a file version. </p> <p>So, what I want to do is create a self-extracting executable containing the msi file and the setup.exe generated by Visual Studio, and put the file version on this self-extracting executable instead.</p> <p>Therefore, I need a utility to create self-extracting executables which supports embedding a file version in its output. It also needs to support automatically running a file after extraction, so I can start the real installer automatically. It would be nice if it was scriptable.</p> <p>All I could find was <a href="http://www.gdgsoft.com/pb/customize-package.aspx" rel="nofollow noreferrer">this</a>, which looks great, but I would much prefer a free alternative.</p> <p>Does anyone have any suggestions?</p> <p><strong>Edit:</strong> To clarify, I'm not really looking to create an installer - I already have a VS setup project. I just want a self-extractor (like WinZip can create). So, the user mouses over Setup-Blorgbeard2008.exe, sees "Version: 1.0.0.0". User doubleclicks it, it silently extracts setup.exe and setup.msi to a temp folder, then runs setup.exe. User then sees normal installer screen and proceeds as normal.</p> <p><strong>Another Edit:</strong> Yay, I don't need a self-extractor anymore, since my other question has now been answered. That makes this whole question pretty much irrelevant. It <em>would</em> still be nice to be able to distribute only one file, rather than setup.exe and setup.msi.</p>
[ { "answer_id": 151423, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 1, "selected": false, "text": "VersionInfoVersion = 1.1.0.0\n" }, { "answer_id": 151833, "author": "Blorgbeard", "author_id": 369, ...
2008/09/30
[ "https://Stackoverflow.com/questions/151403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/369/" ]
151,407
<p>Under Linux, my C++ application is using fork() and execv() to launch multiple instances of OpenOffice so as to view some powerpoint slide shows. This part works.</p> <p>Next I want to be able to move the OpenOffice windows to specific locations on the display. I can do that with the XMoveResizeWindow() function but I need to find the Window for each instance.</p> <p>I have the process ID of each instance, how can I find the X11 Window from that ?</p> <hr> <p><strong>UPDATE</strong> - Thanks to Andy's suggestion, I have pulled this off. I'm posting the code here to share it with the Stack Overflow community.</p> <p>Unfortunately Open Office does not seem to set the _NET_WM_PID property so this doesn't ultimately solve my problem but it does answer the question.</p> <pre><code>// Attempt to identify a window by name or attribute. // by Adam Pierce &lt;adam@doctort.org&gt; #include &lt;X11/Xlib.h&gt; #include &lt;X11/Xatom.h&gt; #include &lt;iostream&gt; #include &lt;list&gt; using namespace std; class WindowsMatchingPid { public: WindowsMatchingPid(Display *display, Window wRoot, unsigned long pid) : _display(display) , _pid(pid) { // Get the PID property atom. _atomPID = XInternAtom(display, "_NET_WM_PID", True); if(_atomPID == None) { cout &lt;&lt; "No such atom" &lt;&lt; endl; return; } search(wRoot); } const list&lt;Window&gt; &amp;result() const { return _result; } private: unsigned long _pid; Atom _atomPID; Display *_display; list&lt;Window&gt; _result; void search(Window w) { // Get the PID for the current Window. Atom type; int format; unsigned long nItems; unsigned long bytesAfter; unsigned char *propPID = 0; if(Success == XGetWindowProperty(_display, w, _atomPID, 0, 1, False, XA_CARDINAL, &amp;type, &amp;format, &amp;nItems, &amp;bytesAfter, &amp;propPID)) { if(propPID != 0) { // If the PID matches, add this window to the result set. if(_pid == *((unsigned long *)propPID)) _result.push_back(w); XFree(propPID); } } // Recurse into child windows. Window wRoot; Window wParent; Window *wChild; unsigned nChildren; if(0 != XQueryTree(_display, w, &amp;wRoot, &amp;wParent, &amp;wChild, &amp;nChildren)) { for(unsigned i = 0; i &lt; nChildren; i++) search(wChild[i]); } } }; int main(int argc, char **argv) { if(argc &lt; 2) return 1; int pid = atoi(argv[1]); cout &lt;&lt; "Searching for windows associated with PID " &lt;&lt; pid &lt;&lt; endl; // Start with the root window. Display *display = XOpenDisplay(0); WindowsMatchingPid match(display, XDefaultRootWindow(display), pid); // Print the result. const list&lt;Window&gt; &amp;result = match.result(); for(list&lt;Window&gt;::const_iterator it = result.begin(); it != result.end(); it++) cout &lt;&lt; "Window #" &lt;&lt; (unsigned long)(*it) &lt;&lt; endl; return 0; } </code></pre>
[ { "answer_id": 27486173, "author": "Gauthier", "author_id": 108802, "author_profile": "https://Stackoverflow.com/users/108802", "pm_score": 3, "selected": false, "text": "xdotool" }, { "answer_id": 43566150, "author": "Shuman", "author_id": 2052889, "author_profile": ...
2008/09/30
[ "https://Stackoverflow.com/questions/151407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5324/" ]
151,414
<p>Here is the directory layout that was installed with Leopard. What is the "A" directory and why the "Current" directory in addition to the "CurrentJDK"?</p> <p>It seems like you can easily switch the current JDK by move the CurrentJDK link, but then the contents under Current and A will be out of sync.</p> <pre> lrwxr-xr-x 1 root wheel 5 Jun 14 15:49 1.3 -> 1.3.1 drwxr-xr-x 3 root wheel 102 Jan 14 2008 1.3.1 lrwxr-xr-x 1 root wheel 5 Feb 21 2008 1.4 -> 1.4.2 lrwxr-xr-x 1 root wheel 3 Jun 14 15:49 1.4.1 -> 1.4 drwxr-xr-x 8 root wheel 272 Feb 21 2008 1.4.2 lrwxr-xr-x 1 root wheel 5 Feb 21 2008 1.5 -> 1.5.0 drwxr-xr-x 8 root wheel 272 Feb 21 2008 1.5.0 lrwxr-xr-x 1 root wheel 5 Jun 14 15:49 1.6 -> 1.6.0 drwxr-xr-x 8 root wheel 272 Jun 14 15:49 1.6.0 drwxr-xr-x 8 root wheel 272 Jun 14 15:49 A lrwxr-xr-x 1 root wheel 1 Jun 14 15:49 Current -> A lrwxr-xr-x 1 root wheel 3 Jun 14 15:49 CurrentJDK -> 1.5 steve-mbp /System/Library/Frameworks/JavaVM.framework/Versions $ </pre> <p>and the contents of A</p> <pre> -rw-r--r-- 1 root wheel 1925 Feb 29 2008 CodeResources drwxr-xr-x 34 root wheel 1156 Jun 14 15:49 Commands drwxr-xr-x 3 root wheel 102 Mar 6 2008 Frameworks drwxr-xr-x 16 root wheel 544 Jun 14 15:49 Headers -rwxr-xr-x 1 root wheel 236080 Feb 29 2008 JavaVM drwxr-xr-x 29 root wheel 986 Jun 14 15:49 Resources steve-mbp /System/Library/Frameworks/JavaVM.framework/Versions/A $ </pre>
[ { "answer_id": 151463, "author": "Chris Hanson", "author_id": 714, "author_profile": "https://Stackoverflow.com/users/714", "pm_score": 4, "selected": true, "text": "A" }, { "answer_id": 151515, "author": "Joe Liversedge", "author_id": 4552, "author_profile": "https:/...
2008/09/30
[ "https://Stackoverflow.com/questions/151414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21176/" ]
151,418
<p>I have a function pointer defined by:</p> <pre><code>typedef void (*EventFunction)(int nEvent); </code></pre> <p>Is there a way to handle that function with a specific instance of a C++ object?</p> <pre><code>class A { private: EventFunction handler; public: void SetEvent(EventFunction func) { handler = func; } void EventOne() { handler(1); } }; class B { private: A a; public: B() { a.SetEvent(EventFromA); } // What do I do here? void EventFromA(int nEvent) { // do stuff } }; </code></pre> <p><strong>Edit:</strong> Orion pointed out the options that Boost offers such as:</p> <pre><code>boost::function&lt;int (int)&gt; f; X x; f = std::bind1st( std::mem_fun(&amp;X::foo), &amp;x); f(5); // Call x.foo(5) </code></pre> <p>Unfortunately Boost is not an option for me. Is there some sort of "currying" function that can be written in C++ that will do this kind of wrapping of a pointer to a member function in to a normal function pointer?</p>
[ { "answer_id": 151427, "author": "markets", "author_id": 4662, "author_profile": "https://Stackoverflow.com/users/4662", "pm_score": 1, "selected": false, "text": "typedef void (*B::EventFunction)(int nEvent);" }, { "answer_id": 151439, "author": "Orion Edwards", "author_...
2008/09/30
[ "https://Stackoverflow.com/questions/151418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4592/" ]
151,434
<p>I have a web service API. Some calls return objects containing text fields with information provided by the user. From both a design and a security standpoint, what are the downsides to returning null in those fields when no information has been provided? Is there a clear advantage to always returning an empty string instead, other then simplifying the API by not requiring the client code to check for nulls?</p>
[ { "answer_id": 151457, "author": "MusiGenesis", "author_id": 14606, "author_profile": "https://Stackoverflow.com/users/14606", "pm_score": 0, "selected": false, "text": "string.IsNullOrEmpty()\n" }, { "answer_id": 151685, "author": "Robert Paulson", "author_id": 14033, ...
2008/09/30
[ "https://Stackoverflow.com/questions/151434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14128/" ]
151,448
<p>Bearing in mind this is for <strong>classic asp</strong></p> <p>Which is better, all HTML contained within Response.Write Statements or inserting variables into HTML via &lt;%= %>.<br> Eg </p> <pre><code>Response.Write "&lt;table&gt;" &amp; vbCrlf Response.Write "&lt;tr&gt;" &amp;vbCrLf Response.Write "&lt;td class=""someClass""&gt;" &amp; someVariable &amp; "&lt;/td&gt;" &amp; vbCrLf Response.Write "&lt;/tr&gt;" &amp; vbCrLf Response.Write "&lt;/table&gt;" &amp; vbCrLf </code></pre> <p>VS</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td class="someClass"&gt;&lt;%= someVariable %&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>I am mainly asking from a performance point of view in which will have the least server impact when there multiple variables to insert?</p> <p>If there are no technical differences what are the arguments for one over the other?</p>
[ { "answer_id": 151455, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 1, "selected": false, "text": "<%= %>" }, { "answer_id": 151536, "author": "Russell Myers", "author_id": 18194, "author_profile": "...
2008/09/30
[ "https://Stackoverflow.com/questions/151448", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4665/" ]
151,472
<p>In .NET, what is the difference between <code>String.Empty</code> and <code>""</code>, and are they interchangable, or is there some underlying reference or Localization issues around equality that <code>String.Empty</code> will ensure are not a problem?</p>
[ { "answer_id": 151481, "author": "Brian R. Bondy", "author_id": 3153, "author_profile": "https://Stackoverflow.com/users/3153", "pm_score": 9, "selected": true, "text": "\"\"" }, { "answer_id": 156100, "author": "James Newton-King", "author_id": 11829, "author_profile...
2008/09/30
[ "https://Stackoverflow.com/questions/151472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5302/" ]
151,496
<p>I am converting an excel sheet formula to java but I can't understand how excel manages to take the following: 0.22 Applies a formula: =TEXT(R5/14, "h:mm") and somehow arrives at: 0.22</p> <p>Again if I provide: 2.8 it arrives at 4.48 Can someone please explain to me how it does this. I have read a little regarding decimal and I understand the conversion but this hasn't yet helped to explain the above.</p>
[ { "answer_id": 151535, "author": "stimms", "author_id": 361, "author_profile": "https://Stackoverflow.com/users/361", "pm_score": 0, "selected": false, "text": "int msInADay= 86400000;\nTime value = new Time(R5/14 * msInADay);\n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
151,505
<p>I came from Java, and now I am working more with Ruby. </p> <p>One language feature I am not familiar with is the <code>module</code>. I am wondering what exactly is a <code>module</code> and when do you use one, and why use a <code>module</code> over a <code>class</code>?</p>
[ { "answer_id": 151534, "author": "hurcane", "author_id": 21363, "author_profile": "https://Stackoverflow.com/users/21363", "pm_score": 5, "selected": false, "text": "http://www.rubycentral.com/pickaxe/classes.html" }, { "answer_id": 9778021, "author": "Sergii Shevchyk", "...
2008/09/30
[ "https://Stackoverflow.com/questions/151505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5004/" ]
151,520
<p>It is unclear to me from the <a href="http://msdn.microsoft.com/en-us/library/system.icloneable.aspx" rel="nofollow noreferrer">MSDN documentation</a> if I should provide a deep or a shallow clone when implementing ICloneable. What is the preferred option?</p>
[ { "answer_id": 20873097, "author": "supercat", "author_id": 363751, "author_profile": "https://Stackoverflow.com/users/363751", "pm_score": 1, "selected": false, "text": "Foo" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20164/" ]
151,521
<p>I'm a LINQ to XML newbie, and a KML newbie as well; so bear with me. </p> <p>My goal is to extract individual Placemarks from a KML file. My KML begins thusly:</p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Document xmlns="http://earth.google.com/kml/2.0"&gt; &lt;name&gt;Concessions&lt;/name&gt; &lt;visibility&gt;1&lt;/visibility&gt; &lt;Folder&gt; &lt;visibility&gt;1&lt;/visibility&gt; &lt;Placemark&gt; &lt;name&gt;IN920211&lt;/name&gt; &lt;Style&gt; &lt;PolyStyle&gt; &lt;color&gt;80000000&lt;/color&gt; &lt;/PolyStyle&gt; &lt;/Style&gt; &lt;Polygon&gt; &lt;altitudeMode&gt;relativeToGround&lt;/altitudeMode&gt; &lt;outerBoundaryIs&gt; &lt;LinearRing&gt; &lt;coordinates&gt;11.728374,1.976421,0 11.732967,1.965322,0 11.737225,1.953161,0 11.635858,1.940812,0 11.658102,1.976874,0 11.728374,1.976421,0 &lt;/coordinates&gt; &lt;/LinearRing&gt; &lt;/outerBoundaryIs&gt; &lt;/Polygon&gt; &lt;/Placemark&gt; &lt;Placemark&gt; ... </code></pre> <p>This is as far as I've gotten:</p> <pre class="lang-vb prettyprint-override"><code> Dim Kml As XDocument = XDocument.Load(Server.MapPath("../kmlimport/ga.kml")) Dim Placemarks = From Placemark In Kml.Descendants("Placemark") _ Select Name = Placemark.Element("Name").Value </code></pre> <p>So far no good - Kml.Descendants("Placemark") gives me an empty enumeration. The document is loaded properly - because KML.Descendants contains every node. For what it's worth these queries come up empty as well:</p> <pre><code>Dim foo = Kml.Descendants("Document") Dim foo = Kml.Descendants("Folder") </code></pre> <p>Can someone point me in the right direction? Bonus points for links to good Linq to XML tutorials - the ones I've found online stop at very simple scenarios. </p>
[ { "answer_id": 151561, "author": "Bruce Murdock", "author_id": 23650, "author_profile": "https://Stackoverflow.com/users/23650", "pm_score": 0, "selected": false, "text": "Dim ns as string = \"http://earth.google.com/kml/2.0\"\ndim foo = Kml.Descendants(ns + \"Document\") \n" }, { ...
2008/09/30
[ "https://Stackoverflow.com/questions/151521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/239663/" ]
151,528
<p>I have this big data-entry sort of page, a table kind of layout using divs. Each row has subrows which can be toggled open/closed. The toggling is triggered using css visibility settings. Each "cell" of the table has a little image in its corner, you click on the image, and a popup window opens that allows you to put notes on the entry.</p> <p>This popup window has a text area and a set of checkboxes, along with a button (input type=submit, I think). The popup is an iframe nested inside a hidden div. </p> <p>In IE7, once you've popped open this notes iframe and scrolled the page down, mousing over the popup's textarea makes it disappear and show the page content beneath it. The checkboxes also show the page below when you mouse over.</p> <p>So, I've tried a few different fixes. Z-index was what I was hoping could be used to fix this. no such luck. I might try replacing the text area with a plain input type=text but since the checkboxes also exhibit this bug, I suspect the one-line text input will also cause the bug.</p>
[ { "answer_id": 152633, "author": "user20916", "author_id": 20916, "author_profile": "https://Stackoverflow.com/users/20916", "pm_score": 3, "selected": false, "text": "hasLayout" }, { "answer_id": 801622, "author": "Community", "author_id": -1, "author_profile": "http...
2008/09/30
[ "https://Stackoverflow.com/questions/151528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13800/" ]
151,544
<p>I'm looking for a cross-browser method of detecting that a client web browser is scrolled all the way to the bottom (or top) of the screen.</p> <p>Really, the top is fairly easy, as<br> <code>scrY = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop</code><br> is zero if you're at the top. The problem is that scrY seems to return the top of the scroll bar, and not the bottom, so instead of getting something equivalent to the height of the document (in pixels) I what is presumably the height of the document less the size of the scroll bar.</p> <p>Is there an easy, cross-browser way to find out if the user has scrolled down to the bottom of the document/window? Most specifically, I understand general scroll bar manipulation (setting it, moving it, etc.) but how can I get the delta of the bottom of the scrollbar's position relative to the bottom of the window/document. </p>
[ { "answer_id": 1090683, "author": "yanchenko", "author_id": 15187, "author_profile": "https://Stackoverflow.com/users/15187", "pm_score": 2, "selected": false, "text": "function isTop() {\n return window.pageYOffset == 0;\n}\n\nfunction isBottom() {\n return window.pageYOffset >= w...
2008/09/30
[ "https://Stackoverflow.com/questions/151544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13623/" ]
151,545
<p>I need to get the fully expanded hostname of the host that my Ruby script is running on. In Perl I've used Sys::Hostname::Long with good results. Google seems to suggest I should use Socket.hostname in ruby, but that's returning just the nodename, not the full hostname.</p>
[ { "answer_id": 151570, "author": "dvorak", "author_id": 19235, "author_profile": "https://Stackoverflow.com/users/19235", "pm_score": 4, "selected": false, "text": "hostname = Socket.gethostbyname(Socket.gethostname).first \n" }, { "answer_id": 12046321, "author": "Alexis Lê-...
2008/09/30
[ "https://Stackoverflow.com/questions/151545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19235/" ]
151,555
<p>I'm creating a Firefox extension for demo purposes. I to call a specific JavaScript function in the document from the extension. I wrote this in my HTML document (not inside extension, but a page that is loaded by Firefox):</p> <pre><code>document.funcToBeCalled = function() { // function body }; </code></pre> <p>Then, the extension will run this on some event:</p> <pre><code>var document = Application.activeWindow.activeTab.document; document.funcToBeCalled(); </code></pre> <p>However it raises an error saying that <code>funcToBeCalled</code> is not defined.</p> <p>Note: I could get an element on the document by calling <code>document.getElementById(id);</code></p>
[ { "answer_id": 2525816, "author": "Carlos Rendon", "author_id": 43851, "author_profile": "https://Stackoverflow.com/users/43851", "pm_score": 3, "selected": false, "text": "document.wrappedJSObject.funcToBeCalled();\n" }, { "answer_id": 2896066, "author": "user307635", "a...
2008/09/30
[ "https://Stackoverflow.com/questions/151555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11238/" ]
151,587
<p>I'm a huge fan of bzr and I'm glad they're working on tortoise for it, but currently it's WAY too slow to be useful. The icons are almost always incorrect and when I load a directory in explorer with a lot of branches it locks up my entire system for anywhere from 10 seconds to 2 minutes. I look forward to trying it again in the future, but for now I'd like to disable it.</p> <p>Unfortunately I don't see it in add/remove programs and I can't find a way to disable it in the bazaar config directory. When I right click the icon in the task panel (by the clock) and choose "Exit Program" it just restarts moments later. I don't see it in the Services panel either. Is there any way to disable it?</p> <p>I'm running Windows XP on the system in question.</p>
[ { "answer_id": 151911, "author": "Jason Anderson", "author_id": 5142, "author_profile": "https://Stackoverflow.com/users/5142", "pm_score": 2, "selected": false, "text": "python tortoise-bzr.py --unregister\n" }, { "answer_id": 542445, "author": "PhiLho", "author_id": 154...
2008/09/30
[ "https://Stackoverflow.com/questions/151587", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14651/" ]
151,590
<p>How do you detect if <code>Socket#close()</code> has been called on a socket on the remote side?</p>
[ { "answer_id": 152116, "author": "WMR", "author_id": 2844, "author_profile": "https://Stackoverflow.com/users/2844", "pm_score": 7, "selected": true, "text": "isConnected" }, { "answer_id": 1647054, "author": "Sangamesh", "author_id": 199298, "author_profile": "https:...
2008/09/30
[ "https://Stackoverflow.com/questions/151590", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4792/" ]
151,594
<p>You can have different naming convention for class members, static objects, global objects, and structs. Some of the examples of them are as below.</p> <pre><code>_member m_member </code></pre> <p>or in Java case, the usage of <code>this.member</code>.</p> <p>But is there any good technique or naming convention for function variables scope that conveys when a single variable has complete function scope or a short lifespan scope?</p> <pre><code>void MyFunction() { int functionScopeVariable; if(true) { //no need for function variable scope naming convention } } </code></pre>
[ { "answer_id": 151693, "author": "KPexEA", "author_id": 13676, "author_profile": "https://Stackoverflow.com/users/13676", "pm_score": 0, "selected": false, "text": " m_varname - Class member variables\n g_varname - Global variables\n" }, { "answer_id": 3282684, "author": "Tio...
2008/09/30
[ "https://Stackoverflow.com/questions/151594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17382/" ]
151,595
<p>I'm looking to try out JRuby and JRuby on Rails. I'm having trouble finding information on what's difference between JRuby on Rails and Ruby on Rails. </p> <p>What's the differences I need to look out for?</p>
[ { "answer_id": 11258063, "author": "kares", "author_id": 454312, "author_profile": "https://Stackoverflow.com/users/454312", "pm_score": 6, "selected": false, "text": "config.threadsafe!" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16204/" ]
151,639
<p>I am trying to get the yasnippet and pabbrev packages working together with emacs, but I cannot seem to get any love. How can I get them to play nicely together?</p> <p>The crux of the problem is that pabbrev and yasnippet are binding to the tab keys. Both packages seem to do this fallback when a match isn't found, but they don't fall back properly.</p> <p>I am currently using Emacs W32 (the last emacs 22 release). yasnippet is byte compiled, but pabbrev is not.</p> <p>Edit: Thus far neither tabkey2 nor hippie expand work out of the box, which is why I have yet to mark either solution as a correct answer. I'm hacking away at tabkey2 to make it work though.</p>
[ { "answer_id": 152047, "author": "Justin Tanner", "author_id": 609, "author_profile": "https://Stackoverflow.com/users/609", "pm_score": 2, "selected": false, "text": "(require 'hippie-exp)\n\n(setq hippie-expand-try-functions-list\n '(yas/hippie-try-expand\n try-expand-dabbr...
2008/09/30
[ "https://Stackoverflow.com/questions/151639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11052/" ]
151,641
<p>Banging my head against the wall here. I don't want to reinvent the wheel.</p> <p>The default Flex 3 classs for PopupButton is a combination of two buttons. One is a normal button with label and/or icon, and the second is the arrow which opens the popup. </p> <p>My struggle here is that I just want a button with an icon that opens the popup directly, without having to write all the popup handling code all over again. The plan was to override the PopupButton class with, say, a new class called SimplePopupButton. This class would just hide the arrow, and point the button click handler to open the popup.</p> <p>Seems simple, but I don't see an easy way to do this. Suggestions? Alternatives?</p> <hr> <p>[<strong>Edit</strong>] I want a 16x16 icon button that opens a popup. PopupButton shipped with flex has two buttons: "It contains a main button and a secondary button, called the pop-up button, which pops up any UIComponent object when a user clicks the pop-up button." (<a href="http://livedocs.adobe.com/flex/3/langref/index.html" rel="nofollow noreferrer">source</a>). I want the main button to open the popup, and hide the popup-button. (or vice-versa) </p>
[ { "answer_id": 153567, "author": "Brandon", "author_id": 23133, "author_profile": "https://Stackoverflow.com/users/23133", "pm_score": 0, "selected": false, "text": "print(</mx:Script>\n <![CDATA[\n import mx.controls.Alert;\n public var myAlert:Alert = new Alert();\...
2008/09/30
[ "https://Stackoverflow.com/questions/151641", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11814/" ]
151,652
<p>This question might not seem programming related at first, but let me explain.</p> <p>I'm stuck with using a keyboard that doesn't have <kbd>home</kbd> <kbd>end</kbd> <kbd>page up</kbd> and <kbd>page down</kbd> buttons. I need those functions for programming.</p> <p>So the question is: what's a good/free utility to define system wide shortcuts and macros in vista? Mapping for example "<kbd>ctrl</kbd>/<kbd>left arrow</kbd> to <kbd>home</kbd>, <kbd>ctrl</kbd>/<kbd>right arrow</kbd> to <kbd>end</kbd> would solve my problem.</p>
[ { "answer_id": 153653, "author": "lajos", "author_id": 3740, "author_profile": "https://Stackoverflow.com/users/3740", "pm_score": 1, "selected": false, "text": "#Right::End\n#Left::Home \n#Up::PgUp\n#Down::PgDn\n#BS::Del\n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3740/" ]
151,660
<p>In PHP5, is the __destruct() method guaranteed to be called for each object instance? Can exceptions in the program prevent this from happening?</p>
[ { "answer_id": 8293937, "author": "Mikko Rantalainen", "author_id": 334451, "author_profile": "https://Stackoverflow.com/users/334451", "pm_score": 4, "selected": false, "text": "exit()" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4682/" ]
151,677
<p>I'm looking for a tool that will, in bulk, add a license header to some source files, some of which already have the header. Is there a tool out there that will insert a header, if it is not already present?</p> <p><em>Edit: I am intentionally not marking an answer to this question, since answers are basically all environment-specific and subjective</em> </p>
[ { "answer_id": 151684, "author": "Silver Dragon", "author_id": 9440, "author_profile": "https://Stackoverflow.com/users/9440", "pm_score": 4, "selected": false, "text": "excludedir" }, { "answer_id": 151690, "author": "Tim", "author_id": 23665, "author_profile": "http...
2008/09/30
[ "https://Stackoverflow.com/questions/151677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5897/" ]
151,682
<pre><code> &lt;my:DataGridTemplateColumn CanUserResize="False" Width="150" Header="{Binding MeetingName, Source={StaticResource LocStrings}}" SortMemberPath="MeetingName"&gt; &lt;/my:DataGridTemplateColumn&gt; </code></pre> <p>I have the above column in a Silverlight grid control. But it is giving me a XamlParser error because of how I am trying to set the Header property. Has anyone done this before? I want to do this for multiple languages.</p> <p>Also my syntax for the binding to a resouce is correct because I tried it in a lable outside of the grid.</p>
[ { "answer_id": 151879, "author": "Adam Kinney", "author_id": 1973, "author_profile": "https://Stackoverflow.com/users/1973", "pm_score": 6, "selected": true, "text": "xmlns:data=\"clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data\"\nxmlns:dataprimitives=\"clr-na...
2008/09/30
[ "https://Stackoverflow.com/questions/151682", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23663/" ]
151,686
<p><strong><em>Note</strong>: The code in this question is part of <a href="http://www.codeplex.com/desleeper" rel="noreferrer">deSleeper</a> if you want the full source.</em></p> <p>One of the things I wanted out of commands was a baked design for asynchronous operations. I wanted the button pressed to disable while the command was executing, and come back when complete. I wanted the actual work to be performed in a ThreadPool work item. And lastly, I wanted a way to handle any errors that occurred during the asynchronous processing.</p> <p>My solution was an AsyncCommand:</p> <pre><code>public abstract class AsyncCommand : ICommand { public event EventHandler CanExecuteChanged; public event EventHandler ExecutionStarting; public event EventHandler&lt;AsyncCommandCompleteEventArgs&gt; ExecutionComplete; public abstract string Text { get; } private bool _isExecuting; public bool IsExecuting { get { return _isExecuting; } private set { _isExecuting = value; if (CanExecuteChanged != null) CanExecuteChanged(this, EventArgs.Empty); } } protected abstract void OnExecute(object parameter); public void Execute(object parameter) { try { IsExecuting = true; if (ExecutionStarting != null) ExecutionStarting(this, EventArgs.Empty); var dispatcher = Dispatcher.CurrentDispatcher; ThreadPool.QueueUserWorkItem( obj =&gt; { try { OnExecute(parameter); if (ExecutionComplete != null) dispatcher.Invoke(DispatcherPriority.Normal, ExecutionComplete, this, new AsyncCommandCompleteEventArgs(null)); } catch (Exception ex) { if (ExecutionComplete != null) dispatcher.Invoke(DispatcherPriority.Normal, ExecutionComplete, this, new AsyncCommandCompleteEventArgs(ex)); } finally { dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =&gt; IsExecuting = false)); } }); } catch (Exception ex) { IsExecuting = false; if (ExecutionComplete != null) ExecutionComplete(this, new AsyncCommandCompleteEventArgs(ex)); } } public virtual bool CanExecute(object parameter) { return !IsExecuting; } } </code></pre> <p>so the question is: Is all this necessary? I've noticed built in asynchronous support for data-binding, so why not command execution? Perhaps it's related to the parameter question, which is my next question.</p>
[ { "answer_id": 228713, "author": "nedruod", "author_id": 5504, "author_profile": "https://Stackoverflow.com/users/5504", "pm_score": 3, "selected": true, "text": "public abstract class AsyncCommand : ICommand\n{\n public event EventHandler CanExecuteChanged;\n public event EventHan...
2008/09/30
[ "https://Stackoverflow.com/questions/151686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5504/" ]
151,687
<p>I'm developing an embedded system which currently boots linux with console output on serial port 1 (using the console boot param from the boot loader). However, eventually we will be using this serial port. What is the best solution for the kernel console output? /dev/null? Can it be put on a pty somehow so that we could potentially get access to it?</p>
[ { "answer_id": 228713, "author": "nedruod", "author_id": 5504, "author_profile": "https://Stackoverflow.com/users/5504", "pm_score": 3, "selected": true, "text": "public abstract class AsyncCommand : ICommand\n{\n public event EventHandler CanExecuteChanged;\n public event EventHan...
2008/09/30
[ "https://Stackoverflow.com/questions/151687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20889/" ]
151,701
<p>Our company runs a web site (oursite.com) with affiliate partners who send us traffic. In some cases, we set up our affiliates with their own subdomain (affiliate.oursite.com), and they display selected content from our site on their site (affiliate.com) using an iframe.</p> <p>Example of a page on their site:</p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;/head&gt; &lt;body&gt; &lt;iframe src="affiliate.example.com/example_page.html"&gt; ...content... [google analytics code for affiliate.oursite.com] &lt;/iframe&gt; [google analytics code for affiliate.com] &lt;/body&gt; &lt;/html&gt; </code></pre> <p>We would like to have Google Analytics tracking for affiliate.oursite.com. At present, it does not seem that Google is receiving any data from the affiliate when the page is loaded from the iframe.</p> <p>Now, there are security implications in that Javascript doesn't like accessing information about a page in a different domain, and IE doesn't like setting cookies for a different domain.</p> <p>Does anyone have a solution to this? Will we need to CNAME the affiliate.oursite.com to cname.oursite.com, or is there a cleaner solution?</p>
[ { "answer_id": 152389, "author": "Silver Dragon", "author_id": 9440, "author_profile": "https://Stackoverflow.com/users/9440", "pm_score": 5, "selected": true, "text": "example_page.html" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15088/" ]
151,731
<p>I've been trying to submit a form with the FormPanel using the Action class Ext defaults to. However, I'd like it to consider the response as a script, not JSON-encoded.</p> <p>Has anyone had any experience on this?</p>
[ { "answer_id": 152134, "author": "Dave Nolan", "author_id": 9474, "author_profile": "https://Stackoverflow.com/users/9474", "pm_score": 3, "selected": true, "text": "Ext.form.Action" }, { "answer_id": 1160562, "author": "Ballsacian1", "author_id": 100658, "author_prof...
2008/09/30
[ "https://Stackoverflow.com/questions/151731", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5646/" ]
151,752
<p>I've created some fairly simple XAML, and it works perfectly (at least in KAXML). The storyboards run perfectly when called from within the XAML, but when I try to access them from outside I get the error:</p> <pre><code>'buttonGlow' name cannot be found in the name scope of 'System.Windows.Controls.Button'. </code></pre> <p>I am loading the XAML with a stream reader, like this:</p> <pre><code>Button x = (Button)XamlReader.Load(stream); </code></pre> <p>And trying to run the Storyboard with: </p> <pre><code>Storyboard pressedButtonStoryboard = Storyboard)_xamlButton.Template.Resources["ButtonPressed"]; pressedButtonStoryboard.Begin(_xamlButton); </code></pre> <p>I think that the problem is that fields I am animating are in the template and that storyboard is accessing the button. </p> <p>Here is the XAML:</p> <pre><code>&lt;Button xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:customControls="clr-namespace:pk_rodoment.SkinningEngine;assembly=pk_rodoment" Width="150" Height="55"&gt; &lt;Button.Resources&gt; &lt;Style TargetType="Button"&gt; &lt;Setter Property="Control.Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="Button"&gt; &lt;Grid Background="#00FFFFFF"&gt; &lt;Grid.BitmapEffect&gt; &lt;BitmapEffectGroup&gt; &lt;OuterGlowBitmapEffect x:Name="buttonGlow" GlowColor="#A0FEDF00" GlowSize="0"/&gt; &lt;/BitmapEffectGroup&gt; &lt;/Grid.BitmapEffect&gt; &lt;Border x:Name="background" Margin="1,1,1,1" CornerRadius="15"&gt; &lt;Border.Background&gt; &lt;SolidColorBrush Color="#FF0062B6"/&gt; &lt;/Border.Background&gt; &lt;/Border&gt; &lt;ContentPresenter HorizontalAlignment="Center" Margin="{TemplateBinding Control.Padding}" VerticalAlignment="Center" Content="{TemplateBinding ContentControl.Content}" ContentTemplate="{TemplateBinding ContentControl.ContentTemplate}"/&gt; &lt;/Grid&gt; &lt;ControlTemplate.Resources&gt; &lt;Storyboard x:Key="ButtonPressed"&gt; &lt;Storyboard.Children&gt; &lt;DoubleAnimation Duration="0:0:0.4" FillBehavior="HoldEnd" Storyboard.TargetName="buttonGlow" Storyboard.TargetProperty="GlowSize" To="4"/&gt; &lt;ColorAnimation Duration="0:0:0.6" FillBehavior="HoldEnd" Storyboard.TargetName="background" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" To="#FF844800"/&gt; &lt;/Storyboard.Children&gt; &lt;/Storyboard&gt; &lt;Storyboard x:Key="ButtonReleased"&gt; &lt;Storyboard.Children&gt; &lt;DoubleAnimation Duration="0:0:0.2" FillBehavior="HoldEnd" Storyboard.TargetName="buttonGlow" Storyboard.TargetProperty="GlowSize" To="0"/&gt; &lt;ColorAnimation Duration="0:0:0.2" FillBehavior="Stop" Storyboard.TargetName="background" Storyboard.TargetProperty="(Panel.Background).(SolidColorBrush.Color)" To="#FF0062B6"/&gt; &lt;/Storyboard.Children&gt; &lt;/Storyboard&gt; &lt;/ControlTemplate.Resources&gt; &lt;ControlTemplate.Triggers&gt; &lt;Trigger Property="ButtonBase.IsPressed" Value="True"&gt; &lt;Trigger.EnterActions&gt; &lt;BeginStoryboard Storyboard="{StaticResource ButtonPressed}"/&gt; &lt;/Trigger.EnterActions&gt; &lt;Trigger.ExitActions&gt; &lt;BeginStoryboard Storyboard="{StaticResource ButtonReleased}"/&gt; &lt;/Trigger.ExitActions&gt; &lt;/Trigger&gt; &lt;/ControlTemplate.Triggers&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/Button.Resources&gt; &lt;DockPanel&gt; &lt;TextBlock x:Name="TextContent" FontSize="28" Foreground="White" &gt;Test&lt;/TextBlock&gt; &lt;/DockPanel&gt; &lt;/Button&gt; </code></pre> <p>Any suggestions from anyone who understands WPF and XAML a lot better than me?</p> <p>Here is the error stacktrace:</p> <pre><code>at System.Windows.Media.Animation.Storyboard.ResolveTargetName(String targetName, INameScope nameScope, DependencyObject element) at System.Windows.Media.Animation.Storyboard.ClockTreeWalkRecursive(Clock currentClock, DependencyObject containingObject, INameScope nameScope, DependencyObject parentObject, String parentObjectName, PropertyPath parentPropertyPath, HandoffBehavior handoffBehavior, HybridDictionary clockMappings, Int64 layer) at System.Windows.Media.Animation.Storyboard.ClockTreeWalkRecursive(Clock currentClock, DependencyObject containingObject, INameScope nameScope, DependencyObject parentObject, String parentObjectName, PropertyPath parentPropertyPath, HandoffBehavior handoffBehavior, HybridDictionary clockMappings, Int64 layer) at System.Windows.Media.Animation.Storyboard.BeginCommon(DependencyObject containingObject, INameScope nameScope, HandoffBehavior handoffBehavior, Boolean isControllable, Int64 layer) at System.Windows.Media.Animation.Storyboard.Begin(FrameworkElement containingObject) at pk_rodoment.SkinningEngine.ButtonControlWPF._button_MouseDown(Object sender, MouseButtonEventArgs e) at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget) at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target) at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs) at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised) at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args) at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted) at System.Windows.Input.InputManager.ProcessStagingArea() at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input) at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport) at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel) at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean&amp; handled) at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o) at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Boolean isSingleParameter) at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.WrappedInvoke(Delegate callback, Object args, Boolean isSingleParameter, Delegate catchHandler) at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Boolean isSingleParameter) at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg) at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam) at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG&amp; msg) at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at System.Windows.Threading.Dispatcher.Run() at System.Windows.Application.RunDispatcher(Object ignore) at System.Windows.Application.RunInternal(Window window) at System.Windows.Application.Run(Window window) at System.Windows.Application.Run() at ControlTestbed.App.Main() in C:\svnprojects\rodomont\ControlsTestbed\obj\Debug\App.g.cs:line 0 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() </code></pre>
[ { "answer_id": 154189, "author": "Kris Erickson", "author_id": 3798, "author_profile": "https://Stackoverflow.com/users/3798", "pm_score": 5, "selected": true, "text": "pressedButtonStoryboard.Begin(_xamlButton);\n" }, { "answer_id": 154203, "author": "Joel B Fant", "auth...
2008/09/30
[ "https://Stackoverflow.com/questions/151752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3798/" ]
151,756
<p>Is it possible for a web server to know which <em>type</em> of device request has been received from?</p> <p>For example, can a create a website which shows different contents if request came from a computer (Firefox) and something different if it came from iPhone?</p>
[ { "answer_id": 151759, "author": "Mitch Wheat", "author_id": 16076, "author_profile": "https://Stackoverflow.com/users/16076", "pm_score": 1, "selected": false, "text": "User-Agent" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23671/" ]
151,769
<p>Originally there was the DAL object which my BO's called for info and then passed to UI. Then I started noticing reduced code in UI and there were Controller classes. What's the decent recomendation.</p> <p>I currently structure mine</p> <pre><code>Public Class OrderDAL Private _id Integer Private _order as Order Public Function GetOrder(id as Integer) as Order ...return Order End Function End Class </code></pre> <p>then I have controller classes (recently implemented this style)</p> <pre><code>Public Class OrderController Private Shared _orderDAL as new OrderDAL Public Shared Function GetOrder(id) As Order Return _orderDAL.GetOrder(id) End Function End Class </code></pre> <p>Then in my application</p> <pre><code>My app Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click msgbox(OrderController.GetOrder(12345).Customer.Name) End Sub End app </code></pre> <p>I originally found that with the Shared Class I didn't have to keep creating a new instance of the DAL whenever I need to fetch data</p> <pre><code>Dim _orderDAL as New OrderDal _orderDAL.GetOrder(1234) ..... </code></pre> <p>What's your take?</p> <p>Thanks</p>
[ { "answer_id": 152228, "author": "Sklivvz", "author_id": 7028, "author_profile": "https://Stackoverflow.com/users/7028", "pm_score": 1, "selected": true, "text": "OrderControllerFactory.ConfiguredOrderController().GetOrder(42);\n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23667/" ]
151,777
<p>I've been working on the Android SDK platform, and it is a little unclear how to save an application's state. So given this minor re-tooling of the 'Hello, Android' example:</p> <pre class="lang-java prettyprint-override"><code>package com.android.hello; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity { private TextView mTextView = null; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mTextView = new TextView(this); if (savedInstanceState == null) { mTextView.setText(&quot;Welcome to HelloAndroid!&quot;); } else { mTextView.setText(&quot;Welcome back.&quot;); } setContentView(mTextView); } } </code></pre> <p>I thought it would be enough for the simplest case, but it always responds with the first message, no matter how I navigate away from the app.</p> <p>I'm sure the solution is as simple as overriding <code>onPause</code> or something like that, but I've been poking away in the documentation for 30 minutes or so and haven't found anything obvious.</p>
[ { "answer_id": 151822, "author": "Dave L.", "author_id": 3093, "author_profile": "https://Stackoverflow.com/users/3093", "pm_score": 9, "selected": false, "text": "savedInstanceState" }, { "answer_id": 151940, "author": "Reto Meier", "author_id": 822, "author_profile"...
2008/09/30
[ "https://Stackoverflow.com/questions/151777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61/" ]
151,778
<p>I'm making a mini ORM for a Java program I'm writing... there is a class for each table in my db, all inheriting from <code>ModelBase</code>.</p> <p><code>ModelBase</code> is abstract &amp; provides a bunch of static methods for finding &amp; binding objects from the db, for example:</p> <pre><code>public static ArrayList findAll(Class cast_to_class) { //build the sql query &amp; execute it } </code></pre> <p>So you can do things like <code>ModelBase.findAll(Albums.class)</code> to get a list of all persisted albums. My problem is that in this static context, I need to get the appropriate sql string from the concrete class Album. I can't have a static method like </p> <pre><code>public class Album extends ModelBase { public static String getSelectSQL() { return "select * from albums.....";} } </code></pre> <p>because there is no polymorphism for static methods in Java. But I don't want to make <code>getSelectSQL()</code> an instance method in <code>Album</code> because then I need to create an instance of it just to get a string that is really static in behavior.</p> <p>At the moment, <code>findAll()</code> uses reflection to get the appropriate sql for the class in question:</p> <pre><code>select_sql = (String)cast_to_class.getDeclaredMethod("getSelectSql", new Class[]{} ).invoke(null, null); </code></pre> <p>But that's pretty gross. </p> <p>So any ideas? It's a general problem I'm having time and time again - the inability to specify abstract static methods in classes or interfaces. I know <em>why</em> static method polymorphism doesn't and can't work, but that doesn't stop me from wanting to use it time again!</p> <p>Is there any pattern/construct that allows me to ensure that concrete subclasses X and Y implement a class method(or failing that, a class constant!)?</p>
[ { "answer_id": 152170, "author": "Bruno De Fraine", "author_id": 6918, "author_profile": "https://Stackoverflow.com/users/6918", "pm_score": 1, "selected": false, "text": "public abstract class BaseFactory<E> {\n public abstract String getSelectSQL();\n public List<E> findAll(Class...
2008/09/30
[ "https://Stackoverflow.com/questions/151778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16925/" ]
151,783
<p>just curious to know which CPU architectures support compare and swap atomic primitives? </p>
[ { "answer_id": 151802, "author": "mat_geek", "author_id": 11032, "author_profile": "https://Stackoverflow.com/users/11032", "pm_score": 3, "selected": false, "text": "bool_t My_CompareAndSwap(IN int *ptr, IN int old, IN int new)\n{\n unsigned char ret;\n\n /* Note that sete...
2008/09/30
[ "https://Stackoverflow.com/questions/151783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14069/" ]
151,794
<p>Any idea on how to unit test the views in ASP.NET MVC?</p> <p>I am sick of encountering the yellow screen of death when I launch my MVC project just because I forget to update the views when one of the <code>Action</code> methods of my controller changes name.</p>
[ { "answer_id": 1110422, "author": "Richard Ev", "author_id": 39709, "author_profile": "https://Stackoverflow.com/users/39709", "pm_score": 3, "selected": false, "text": "<MvcBuildViews>" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
151,800
<p>Given a database field named "widget_ids", containing data like "67/797/124/" or "45/", where the numbers are slash separated widget_ids... how would you make an update statement with SQL that would say: "if the widget_ids of the row with id X contains the text "somenumber/" do nothing, otherwise append "somenumber/" to it's current value"</p> <p>Can you do something like that with SQL, or more specifically, sqlite? Is that something that is better done in the program for some reason or is there support for "if-then" like syntax in SQL?</p>
[ { "answer_id": 151829, "author": "Logan", "author_id": 3518, "author_profile": "https://Stackoverflow.com/users/3518", "pm_score": 4, "selected": true, "text": "update <tablename>\n set widget_id = widget_id + \"somenumber/\"\n where row_id = X\n and widget_id not like \"%/somenumbe...
2008/09/30
[ "https://Stackoverflow.com/questions/151800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14278/" ]
151,804
<p>I want to watch a folder tree on a network server for changes. The files all have a specific extension. There are about 200 folders in the tree and about 1200 files with the extension I am watching.</p> <p>I can't write a service to run on the server (off-limits!) so the solution has to be local to the client. Timeliness is not particularly important. I can live with a minute or more delay in notifications. I am watching for Create, Delete, Rename and Changes.</p> <p>Would using the .NET System.IO.fileSystemWatcher create much of a load on the server? </p> <p>How about 10 separate watchers to cut down the number of folders/files being watched? (down to 200 from 700 folders, 1200 from 5500 files in total) More network traffic instead of less? My thoughts are a reshuffle on the server to put the watched files under 1 tree. I may not always have this option hence the team of watchers.</p> <p>I suppose the other solution is a periodic check if the FSW creates an undue load on the server, or if it doesn't work for a whole bunch of SysAdmin type reasons.</p> <p>Is there a better way to do this?</p>
[ { "answer_id": 37476692, "author": "trevorwong77", "author_id": 1089235, "author_profile": "https://Stackoverflow.com/users/1089235", "pm_score": 1, "selected": false, "text": "var fileNames = Directory.GetFiles(srcFolder);\nforeach (string fileName in fileNames)\n{\n string[] lines = ...
2008/09/30
[ "https://Stackoverflow.com/questions/151804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/492/" ]
151,841
<p>I'd like to document what high-level (i.e. C++ not inline assembler ) functions or macros are available for Compare And Swap (CAS) atomic primitives... </p> <p>E.g., WIN32 on x86 has a family of functions <code>_InterlockedCompareExchange</code> in the <code>&lt;_intrin.h&gt;</code> header.</p>
[ { "answer_id": 151847, "author": "Michael Burr", "author_id": 12711, "author_profile": "https://Stackoverflow.com/users/12711", "pm_score": 5, "selected": true, "text": "atomic_compare_exchange() \n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14069/" ]
151,844
<p>Since Unicode lacks a series of zero width sorting characters, I need to determine equivalent characters that will allow me to force a certain order on a list that is automatically sorted by character values. Unfortunately the list items are not in an alphabetical order, nor is it acceptable to prefix them with visible characters to ensure the result of the sort matches the wanted outcome.</p> <p>What Unicode characters can be thrown in front of regular Latin alphabet text, and will not appear, but still allow me to "spike" the sort in the way I require?</p> <p>(BTW this is being done with Drupal 5 with a user profile list field. Don't bother suggesting changing that to a vocabulary/category.)</p>
[ { "answer_id": 151918, "author": "JasonTrue", "author_id": 13433, "author_profile": "https://Stackoverflow.com/users/13433", "pm_score": 1, "selected": false, "text": "usort(array, comparisonFunction)" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5697/" ]
151,846
<p>This isn't as malicious as it sounds, I want to get the current size of their windows, not look at what is in them. The purpose is to figure out that if every other window is fullscreen then I should start up like that too. Or if all the other processes are only 800x600 despite there being a huge resolution then that is probably what the user wants. Why make them waste time and energy resizing my window to match all the others they have? I am primarily a Windows devoloper but it wouldn't upset me in the least if there was a cross platform way to do this.</p>
[ { "answer_id": 152094, "author": "Swaroop C H", "author_id": 4869, "author_profile": "https://Stackoverflow.com/users/4869", "pm_score": 2, "selected": false, "text": "win32gui" }, { "answer_id": 152454, "author": "DzinX", "author_id": 18745, "author_profile": "https:...
2008/09/30
[ "https://Stackoverflow.com/questions/151846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3176/" ]
151,850
<p>In many languages, assignments are legal in conditions. I never understood the reason behind this. Why would you write:</p> <pre><code>if (var1 = var2) { ... } </code></pre> <p>instead of:</p> <pre><code>var1 = var2; if (var1) { ... } </code></pre> <p>?</p>
[ { "answer_id": 151855, "author": "Michael Burr", "author_id": 12711, "author_profile": "https://Stackoverflow.com/users/12711", "pm_score": 5, "selected": false, "text": "while ((c = getchar()) != EOF) {\n // process the character\n}\n\n// end of file reached...\n" }, { "answe...
2008/09/30
[ "https://Stackoverflow.com/questions/151850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3740/" ]
151,872
<p>I have a form where i have used Infragistics windows grid control to display the data. In this, i have placed a button on one of the cell. I want to set its visibility either True or False based on the row condition. I have handled the <strong>InitializeRow</strong> event of <strong>UltraWinGrid</strong> control and able to disable the button. But i am unable to set the button's visible to False.</p>
[ { "answer_id": 152634, "author": "Christoffer Lette", "author_id": 11808, "author_profile": "https://Stackoverflow.com/users/11808", "pm_score": 2, "selected": false, "text": "UltraGridRow row = ...\n\nrow.Cells[buttonCellIndex].Hidden = true;\n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
151,874
<p>I am working with web Dynpro java.. I have created a stateless session bean wherein I have created business methods for inserting and retrieving records from my dictionary table. My table has two fields of <code>java.sql.Date</code> type The web service that i have created is working fine for <code>insertRecords()</code>, but for <code>showRecords()</code> I am not able to fetch the dates..</p> <p>This is the following code I have applied..</p> <pre><code>public WrapperClass[] showRecords() { ArrayList arr = new ArrayList(); WrapperClass model; WrapperClass[] modelArr = null; try { InitialContext ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup("jdbc/SAPSR3DB"); Connection conn = ds.getConnection(); PreparedStatement stmt = conn.prepareStatement("select * from TMP_DIC"); ResultSet rs = stmt.executeQuery(); while(rs.next()) { model = new WrapperClass(); model.setTitle(rs.getString("TITLE")); model.setStatus(rs.getString("STATUS")); model.setSt_date(rs.getDate("START_DATE")); model.setEnd_date(rs.getDate("END_DATE")); arr.add(model); //arr.add(rs.getString(2)); //arr.add(rs.getString(3)); } modelArr = new WrapperClass[arr.size()]; for(int j=0;j&lt;arr.size();j++) { model = (WrapperClass)arr.get(j); modelArr[j] = model; } stmt.close(); conn.close(); } catch (NamingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } arr.toArray(modelArr); return modelArr; } </code></pre> <p>Can anybody please help.. Thanks Ankita</p>
[ { "answer_id": 22613604, "author": "sharkbait", "author_id": 1353274, "author_profile": "https://Stackoverflow.com/users/1353274", "pm_score": 0, "selected": false, "text": "try {\n ctx = new InitialContext();\n\n Object o = ctx\n .lookup(\"sc.fia...
2008/09/30
[ "https://Stackoverflow.com/questions/151874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
151,905
<p>What's the best way of inserting information in table A and using the index from table A to relate to table B. </p> <p>The "solution" I tried is inserting the info in table A (which has a automatically generated ID), then, select the last index and insert it in table B. This may not be very useful, as the last index may change between the inserts because another user could generate a new index in table A</p> <p>I have had this problem with various DBMS postgreSQL, Informix, MySQL and MSSQL (thanks to lomaxx for the answer)</p>
[ { "answer_id": 151912, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 2, "selected": false, "text": "postgres=# create table foo(id serial primary key, text varchar);\nNOTICE: CREATE TABLE will create implicit sequen...
2008/09/30
[ "https://Stackoverflow.com/questions/151905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23146/" ]
151,917
<p>What is the best way to free resources (in this case unlock the ReadWriteLock) when leaving the scope ? How to cover all possible ways (return, break, exceptions etc)?</p>
[ { "answer_id": 151932, "author": "Michael Barker", "author_id": 6365, "author_profile": "https://Stackoverflow.com/users/6365", "pm_score": 5, "selected": true, "text": "Lock l = new Lock();\nl.lock(); // Call the lock before calling try.\ntry {\n // Do some processing.\n // All c...
2008/09/30
[ "https://Stackoverflow.com/questions/151917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18174/" ]
151,919
<p>Visual Studio includes support for __forceinline. The Microsoft Visual Studio 2005 documentation states:</p> <blockquote> <p>The __forceinline keyword overrides the cost/benefit analysis and relies on the judgment of the programmer instead.</p> </blockquote> <p>This raises the question: When is the compiler's cost/benefit analysis wrong? And, how am I supposed to know that it's wrong? </p> <p>In what scenario is it assumed that I know better than my compiler on this issue?</p>
[ { "answer_id": 161473, "author": "Johann Gerell", "author_id": 6345, "author_profile": "https://Stackoverflow.com/users/6345", "pm_score": 3, "selected": false, "text": "__forceinline" }, { "answer_id": 46281942, "author": "Cookie", "author_id": 698504, "author_profil...
2008/09/30
[ "https://Stackoverflow.com/questions/151919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22244/" ]
151,929
<p>I'm using the <code>mechanize</code> module to execute some web queries from Python. I want my program to be error-resilient and handle all kinds of errors (wrong URLs, 403/404 responsese) gracefully. However, I can't find in mechanize's documentation the errors / exceptions it throws for various errors.</p> <p>I just call it with:</p> <pre><code> self.browser = mechanize.Browser() self.browser.addheaders = [('User-agent', browser_header)] self.browser.open(query_url) self.result_page = self.browser.response().read() </code></pre> <p>How can I know what errors / exceptions can be thrown here and handle them ?</p>
[ { "answer_id": 155127, "author": "jfs", "author_id": 4279, "author_profile": "https://Stackoverflow.com/users/4279", "pm_score": 4, "selected": true, "text": "$ perl -0777 -ne'print qq($1) if /__all__ = \\[(.*?)\\]/s' __init__.py | grep Error \n\n'BrowserStateError',\n'ContentTooShortErr...
2008/09/30
[ "https://Stackoverflow.com/questions/151929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8206/" ]
151,936
<p>I have some code where I'm returning an array of objects.</p> <p>Here's a simplified example:</p> <pre><code>string[] GetTheStuff() { List&lt;string&gt; s = null; if( somePredicate() ) { s = new List&lt;string&gt;(); // imagine we load some data or something } return (s == null) ? new string[0] : s.ToArray(); } </code></pre> <p>The question is, how expensive is the <code>new string[0]</code> ?<br /> Should I just return null and make the caller accept null as a valid way of indicating &quot;nothing was found&quot;?</p> <p>NB: This is being called in a loop which gets run hundreds and hundreds of times, so it's one of the few cases where I think this kind of optimiziation is not actually 'premature'.</p> <p>PS: And even if it was premature, I'd still like to know how it works :-)</p> <h3>Update:</h3> <p>Initially when I asked if it used any space, I was thinking of things from the 'C/C++' point of view, kind of like how in C, writing <code>char a[5];</code> will allocate 5 bytes of space on the stack, and <code>char b[0];</code> will allocate 0 bytes.</p> <p>I realise this is not a good fit for the .NET world, but I was curious if this was something that the compiler or CLR would detect and optimize out, as a non-resizeable array of size zero really shouldn't (as far as I can see?) require any storage space.</p>
[ { "answer_id": 151947, "author": "Dr8k", "author_id": 6014, "author_profile": "https://Stackoverflow.com/users/6014", "pm_score": 0, "selected": false, "text": "List<string> GetTheStuff()\n{\n List<string> s = new List<string();\n if (somePredicarte())\n {\n // more code\n }...
2008/09/30
[ "https://Stackoverflow.com/questions/151936", "https://Stackoverflow.com", "https://Stackoverflow.com/users/234/" ]
151,945
<p>Emacs puts backup files named <code>foo~</code> everywhere and I don't like having to remember to delete them. Also, if I edit a file that has a hard link somewhere else in the file system, the hard link points to the backup when I'm done editing, and that's confusing and awful. How can I either eliminate these backup files, or have them go somewhere other than the same directory?</p>
[ { "answer_id": 151946, "author": "jfm3", "author_id": 11138, "author_profile": "https://Stackoverflow.com/users/11138", "pm_score": 10, "selected": true, "text": ".emacs" }, { "answer_id": 152192, "author": "David Webb", "author_id": 3171, "author_profile": "https://S...
2008/09/30
[ "https://Stackoverflow.com/questions/151945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11138/" ]
151,952
<p>The Project's Web section (under project properties in VS2008) has a list of debuggers: ASP.NET, Native Code, SQL Server. What is Native Code?</p>
[ { "answer_id": 16656663, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": " [ CPU ] ==================================== [ RAM ]\n ^^^^^\n | |\n\n LOAD _memoryAddress12, D1 ; te...
2008/09/30
[ "https://Stackoverflow.com/questions/151952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
151,959
<p>I have 2 fields in the database month (numeric) and year (numeric) and I want to combine them in a report that combines those 2 fields and format them with MMM-YYYY. e.g 7-2008 becomes Jul-2008. How do I do that?</p>
[ { "answer_id": 152114, "author": "Brannon", "author_id": 5745, "author_profile": "https://Stackoverflow.com/users/5745", "pm_score": 2, "selected": true, "text": "DateSerial" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/151959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20879/" ]
151,963
<p>Is it possible to get the route/virtual url associated with a controller action or on a view? I saw that Preview 4 added LinkBuilder.BuildUrlFromExpression helper, but it's not very useful if you want to use it on the master, since the controller type can be different. Any thoughts are appreciated.</p>
[ { "answer_id": 691985, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": false, "text": "<%= this.Url.RouteUrl(this.ViewContext.RouteData.Values) %>" }, { "answer_id": 1268335, "author": "Jim Geurts", ...
2008/09/30
[ "https://Stackoverflow.com/questions/151963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3085/" ]
151,966
<p>I want to use remote debugging. The program that I want to debug runs on machine b. Visual Studio runs on machine a. </p> <p>On machine b I have a folder with the following files:</p> <ul> <li>msvcr72.dll</li> <li>msvsmon.exe</li> <li>NatDbgDE.dll</li> <li>NatDbgDEUI.dll</li> <li>NatDbgEE.dll</li> <li>NatDbgEEUI.dll</li> </ul> <p>If you think some files are missing, could you also describe where they are usually located?</p> <p>In the next step I started the <code>msvsmon.exe</code> and my program on machine b. On machine a, I started Visual Studio 2008 and my solution in which the program was written. Then I choose "Debug - Attach to Process". I chose "Remote Transport (Native Only with no authentication)". I used the correct IP as a qualifier and took the right process (program.exe). After a while the following message occurred in a popup-window:</p> <blockquote> <p>Unhandled exception at 0x7c812a7b in program.exe: 0xE0434F4D: 0xe0434f4d</p> </blockquote> <p>I can continue or break; When continuing, the exception occurs again and again and again. So I pressed break and the following message occurred:</p> <blockquote> <p>No symbols are loaded for any call stack frame. The source code cannot be displayed.</p> </blockquote>
[ { "answer_id": 1144616, "author": "BrianR", "author_id": 140302, "author_profile": "https://Stackoverflow.com/users/140302", "pm_score": 4, "selected": false, "text": "_NT_SYMBOL_PATH" }, { "answer_id": 54309251, "author": "Joel", "author_id": 7392502, "author_profile...
2008/09/30
[ "https://Stackoverflow.com/questions/151966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23681/" ]
151,969
<p>In PHP 5, what is the difference between using <code>self</code> and <code>$this</code>?</p> <p>When is each appropriate?</p>
[ { "answer_id": 151975, "author": "cruizer", "author_id": 6441, "author_profile": "https://Stackoverflow.com/users/6441", "pm_score": 4, "selected": false, "text": "$self" }, { "answer_id": 151976, "author": "John Millikin", "author_id": 3560, "author_profile": "https:...
2008/09/30
[ "https://Stackoverflow.com/questions/151969", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4682/" ]
151,979
<p>Have a look at this very simple example WPF program:</p> <pre><code>&lt;Window x:Class="WpfApplication1.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="300"&gt; &lt;GroupBox&gt; &lt;GroupBox.Header&gt; &lt;CheckBox Content="Click Here"/&gt; &lt;/GroupBox.Header&gt; &lt;/GroupBox&gt; &lt;/Window&gt; </code></pre> <p>So I have a GroupBox whose header is a CheckBox. We've all done something like this - typically you bind the content of the GroupBox in such a way that it's disabled when the CheckBox is unchecked.</p> <p>However, when I run this application and click on the CheckBox, I've found that sometimes my mouse clicks are swallowed and the CheckBox's status doesn't change. If I'm right, it's when I click on the exact row of pixels that the GroupBox's top border sits on.</p> <p>Can someone duplicate this? Why would this occur, and is there a way around it?</p> <p>Edit: Setting the GroupBox's BorderThickness to 0 solves the problem, but obviously it removes the border, so it doesn't look like a GroupBox anymore.</p>
[ { "answer_id": 151999, "author": "rudigrobler", "author_id": 5147, "author_profile": "https://Stackoverflow.com/users/5147", "pm_score": 2, "selected": false, "text": "<GroupBox BorderBrush=\"{x:Null}\">\n" }, { "answer_id": 152562, "author": "Ian Oakes", "author_id": 216...
2008/09/30
[ "https://Stackoverflow.com/questions/151979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/615/" ]
152,003
<p>I need to scan uploaded files for viruses on a Linux server, but I'm not sure how to go about it.</p> <p>What are my options, if any? I'm also interested in how the scanners perform when multiple users send multiple files at the same time.</p>
[ { "answer_id": 152014, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 5, "selected": true, "text": "clamscan" }, { "answer_id": 165899, "author": "kari.patila", "author_id": 21716, "author_profile": "ht...
2008/09/30
[ "https://Stackoverflow.com/questions/152003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21716/" ]
152,005
<p>What is currying?</p> <p>How can currying be done in C++?</p> <p>Please Explain binders in STL container?</p>
[ { "answer_id": 152020, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 6, "selected": true, "text": "f(x, y)" }, { "answer_id": 152021, "author": "John Millikin", "author_id": 3560, "author_profile": "ht...
2008/09/30
[ "https://Stackoverflow.com/questions/152005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22076/" ]
152,006
<p>I've got a php script. Most of the time the script returns html, which is working fine, but on one occasion (parameter ?Format=XML) the script returns XML instead of HTML.</p> <p>Is there any way to change the returned mime type of the php output on the fly from text/html to text/xml or application/xml?</p>
[ { "answer_id": 152009, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 8, "selected": true, "text": "header('Content-type: application/xml');\n" }, { "answer_id": 152010, "author": "John Millikin", "author_id": 3...
2008/09/30
[ "https://Stackoverflow.com/questions/152006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7021/" ]
152,016
<p>What is the most reliable way to find out CPU architecture when compiling C or C++ code? As far as I can tell, different compilers have their own set of non-standard preprocessor definitions (<code>_M_X86</code> in MSVS, <code>__i386__</code>, <code>__arm__</code> in GCC, etc).</p> <p>Is there a <em>standard</em> way to detect the architecture I'm building for? If not, is there a source for a comprehensive list of such definitions for various compilers, such as a header with all the boilerplate <code>#ifdef</code>s?</p>
[ { "answer_id": 152034, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 4, "selected": false, "text": "#if MSVC\n#ifdef _M_X86\n#define ARCH_X86\n#endif\n#endif\n\n#if GCC\n#ifdef __i386__\n#define ARCH_X86\n#endif\n#endi...
2008/09/30
[ "https://Stackoverflow.com/questions/152016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23643/" ]
152,019
<p>.Net 3.5 doesn't support tuples. Too bad, But not sure whether the future version of .net will support tuples or not? </p>
[ { "answer_id": 152026, "author": "dimarzionist", "author_id": 10778, "author_profile": "https://Stackoverflow.com/users/10778", "pm_score": 6, "selected": false, "text": "#region tuples\n\n public class Tuple<T>\n {\n public Tuple(T first)\n {\n First = fir...
2008/09/30
[ "https://Stackoverflow.com/questions/152019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
152,024
<p>I have a submission table that is very simple: userId, submissionGuid</p> <p>I want to select the username (simple inner join to get it) of all the users who have more than 10 submissions in the table. </p> <p>I would do this with embedded queries and a group by to count submissions... but is there a better way of doing it (without embedded queries)?</p> <p>Thanks!</p>
[ { "answer_id": 152030, "author": "cagcowboy", "author_id": 19629, "author_profile": "https://Stackoverflow.com/users/19629", "pm_score": 1, "selected": false, "text": "select userId, count(*)\nfrom submissions\nhaving count(*) > 10\ngroup by userId\n" }, { "answer_id": 152037, ...
2008/09/30
[ "https://Stackoverflow.com/questions/152024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23695/" ]
152,028
<p>I want to be able to compare an image taken from a webcam to an image stored on my computer.</p> <p>The library doesn't need to be one hundred percent accurate as it won't be used in anything mission critical (e.g. police investigation), I just want something OK I can work with.</p> <p>I have tried a demonstration project for <a href="http://www.codeproject.com/KB/cs/BackPropagationNeuralNet.aspx" rel="noreferrer">Image Recognition from CodeProject</a>, and it only works with small images / doesn't work at all when I compare an exact same image 120x90 pixels (this is not classified as OK :P ).</p> <p>Has there been any success with image recognition before?</p> <p>If so, would you be able to provide a link to a library I could use in either C# or VB.NET?</p>
[ { "answer_id": 152059, "author": "mattlant", "author_id": 14642, "author_profile": "https://Stackoverflow.com/users/14642", "pm_score": 7, "selected": true, "text": "// The class also can be used to get similarity level between two image of the same size, which can be useful to get infor...
2008/09/30
[ "https://Stackoverflow.com/questions/152028", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20900/" ]
152,071
<p>I'm trying to display a boolean field in Report Designer in Visual Studio 2008. When I tried to run it, an error occurred:</p> <pre><code> "An error has occurred during report processing. String was not recognized as a valid Boolean." </code></pre> <p>I tried to convert it using CBool() but it didn't work. </p>
[ { "answer_id": 169691, "author": "roman m", "author_id": 3661, "author_profile": "https://Stackoverflow.com/users/3661", "pm_score": 2, "selected": false, "text": "=iif(Fields!YourBool.Value, \"True\", \"False\") \n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/152071", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20877/" ]
152,077
<p>I agree, that programming against interfaces is a good practice. In most cases in Java "interface" in this sense means the language construct interface, so that you write an interface and an implementation class and that you use the interface instead of the implementation class most of the time.</p> <p>I wonder if this is a good practice for writing domain models as well. So, for example if you've got a domain class Customer and each customer may have a list of Orders, would you <em>generally</em> also write interfaces ICustomer and IOrder. And also would Customer have a list of IOrders instead of Orders? Or would you use interfaces in the domain model, only if it is really driven by the domain, e.g. you've got at least two different types of Orders? In other words, would you use interfaces because of only technical needs in the domain model, or only when it is really appropriate with respect to the actual domain?</p>
[ { "answer_id": 1056141, "author": "Rogério", "author_id": 2326914, "author_profile": "https://Stackoverflow.com/users/2326914", "pm_score": 2, "selected": false, "text": "ArrayList" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/152077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18722/" ]
152,084
<p>I'm interested in actual examples of using fixed point combinators (such as the <a href="https://stackoverflow.com/questions/93526/what-is-a-y-combinator">y-combinator</a> in C++. Have you ever used a fixed point combinator with <a href="http://p-stade.sourceforge.net/boost/libs/egg/doc/html/boost_egg/function_adaptors.html#boost_egg.function_adaptors.fix" rel="noreferrer">egg</a> or <a href="http://www.boost.org/doc/libs/1_36_0/libs/bind/bind.html" rel="noreferrer">bind</a> in real live code?</p> <p>I found this example in egg a little dense:</p> <pre><code>void egg_example() { using bll::_1; using bll::_2; int r = fix2( bll::ret&lt;int&gt;( // \(f,a) -&gt; a == 0 ? 1 : a * f(a-1) bll::if_then_else_return( _2 == 0, 1, _2 * lazy(_1)(_2 - 1) ) ) ) (5); BOOST_CHECK(r == 5*4*3*2*1); } </code></pre> <p>Can you explain how this all works?</p> <p>Is there a nice simple example perhaps using bind with perhaps fewer dependancies than this one?</p>
[ { "answer_id": 154267, "author": "Ted", "author_id": 8965, "author_profile": "https://Stackoverflow.com/users/8965", "pm_score": 6, "selected": true, "text": "boost::bind" }, { "answer_id": 154514, "author": "DrPizza", "author_id": 2131, "author_profile": "https://Sta...
2008/09/30
[ "https://Stackoverflow.com/questions/152084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3146/" ]
152,099
<p>I have an ASP.NET page with a gridview control on it with a CommandButton column with delete and select commands active.</p> <p>Pressing the enter key causes the first command button in the gridview to fire, which deletes a row. I don't want this to happen. Can I change the gridview control in a way that it does not react anymore to pressing the enter key?</p> <p>There is a textbox and button on the screen as well. They don't need to be responsive to hitting enter, but you must be able to fill in the textbox. Currently we popup a confirmation dialog to prevent accidental deletes, but we need something better than this.</p> <p>This is the markup for the gridview, as you can see it's inside an asp.net updatepanel (i forgot to mention that, sorry): (I left out most columns and the formatting)</p> <pre><code>&lt;asp:UpdatePanel ID="upContent" runat="server" UpdateMode="Conditional"&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="btnFilter" /&gt; &lt;asp:AsyncPostBackTrigger ControlID="btnEdit" EventName="Click" /&gt; &lt;/Triggers&gt; &lt;ContentTemplate&gt; &lt;div id="CodeGrid" class="Grid"&gt; &lt;asp:GridView ID="dgCode" runat="server"&gt; &lt;Columns&gt; &lt;asp:CommandField SelectImageUrl="~/Images/Select.GIF" ShowSelectButton="True" ButtonType="Image" CancelText="" EditText="" InsertText="" NewText="" UpdateText="" DeleteImageUrl="~/Images/Delete.GIF" ShowDeleteButton="True" /&gt; &lt;asp:BoundField DataField="Id" HeaderText="ID" Visible="False" /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;/div&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre>
[ { "answer_id": 233011, "author": "Timothy Khouri", "author_id": 11917, "author_profile": "https://Stackoverflow.com/users/11917", "pm_score": 3, "selected": false, "text": "myGridView.Attributes.Add(\"onkeydown\", \"if(event.keyCode==13)return false;\");\n" }, { "answer_id": 2348...
2008/09/30
[ "https://Stackoverflow.com/questions/152099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23697/" ]
152,101
<p>I want to learn MVC "architecture pattern" but I don't want to jump into a framework like Rails or Django just yet. I want to understand the concept first and write some simple code in my currently familiar environment, which happens to be PHP/HTML/CSS/MySQL. I don't necessarily need a tutorial that is based on PHP, as I do understand a lot of different languages. And I don't want to have to install any frameworks or APIs or libraries. I just want to learn how to think in MVC and apply it to my projects. Any suggestions?</p>
[ { "answer_id": 599262, "author": "dbr", "author_id": 745, "author_profile": "https://Stackoverflow.com/users/745", "pm_score": 4, "selected": false, "text": "class Model:\n def get_post(self, id):\n # Would query database, perhaps\n return {\"title\": \"A test\", \"body\...
2008/09/30
[ "https://Stackoverflow.com/questions/152101", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23701/" ]
152,104
<p>I work on a Webproject using <a href="http://jquery.com/" rel="nofollow noreferrer">jQuery</a> and CakePHP. I use <a href="http://www.appelsiini.net/projects/jeditable" rel="nofollow noreferrer">jeditable</a> as an inplace edit plugin. For textareas I extend it using the <a href="http://www.appelsiini.net/2008/4/autogrow-textarea-for-jeditable" rel="nofollow noreferrer">autogrow plugin</a>.</p> <p>Well, I have two problems with this:</p> <ul> <li>First, autogrow does only work on Firefox, not on IE, Safari, Opera and Chrome.</li> <li>Second, I need a callback event for jeditable, when its finished showing the edit-component, to recalculate the <a href="http://kelvinluck.com/assets/jquery/jScrollPane/jScrollPane.html" rel="nofollow noreferrer">scrollbar</a></li> </ul> <p>Im not so familiar with Javascript, so i can't extend/correct this two libraries by my own. Has anyone used another js-library for inplace edit with auto growing textareas (no complete editors like TinyMCE, I need a solution for plain text)?</p> <p>I also found <a href="http://plugins.jquery.com/project/Growfield" rel="nofollow noreferrer">Growfield</a>, it would work for other browsers, but there's no jeditable integration...</p> <p><em>(sorry for my english)</em></p>
[ { "answer_id": 154377, "author": "Alexander Pendleton", "author_id": 21201, "author_profile": "https://Stackoverflow.com/users/21201", "pm_score": 3, "selected": true, "text": "<script type=\"text/javascript\">\n/* This is the growfield integration into jeditable\n You can use almost...
2008/09/30
[ "https://Stackoverflow.com/questions/152104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17981/" ]
152,115
<p>How can I set points on a 24h period spreaded by the Gaussian distributions? For example to have the peak at 10 o'clock?</p>
[ { "answer_id": 153016, "author": "Chris Johnson", "author_id": 23732, "author_profile": "https://Stackoverflow.com/users/23732", "pm_score": 4, "selected": true, "text": "$peak=10; // Peak at 10-o-clock\n$stdev=2; // Standard deviation of two hours\n$hoursOnClock=24; // 24-hour clock\n\n...
2008/09/30
[ "https://Stackoverflow.com/questions/152115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22470/" ]
152,127
<p>I am trying to use Lucene Java 2.3.2 to implement search on a catalog of products. Apart from the regular fields for a product, there is field called 'Category'. A product can fall in multiple categories. Currently, I use FilteredQuery to search for the same search term with every Category to get the number of results per category.</p> <p>This results in 20-30 internal search calls per query to display the results. This is slowing down the search considerably. Is there a faster way of achieving the same result using Lucene?</p>
[ { "answer_id": 152764, "author": "Matt Quail", "author_id": 15790, "author_profile": "https://Stackoverflow.com/users/15790", "pm_score": 2, "selected": false, "text": "public static void countDocumentsInCategories(IndexReader reader) throws IOException {\n TermEnum terms = null;\n ...
2008/09/30
[ "https://Stackoverflow.com/questions/152127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
152,137
<p>I don't need a Link but rather only the href= part of the ActionLink.</p> <p>But if I call Html.ActionLink(...) I get a back. Is there a way to just return the URL of the Action while not getting the ?</p>
[ { "answer_id": 152165, "author": "Casper", "author_id": 18729, "author_profile": "https://Stackoverflow.com/users/18729", "pm_score": 2, "selected": false, "text": "<% =Html.BuildUrlFromExpression<YourController>(c => c.YourAction(parameter)) %>\n" }, { "answer_id": 152898, "...
2008/09/30
[ "https://Stackoverflow.com/questions/152137", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21699/" ]
152,138
<p>I have a class proposing translations utilities. The translations themselves should be reloaded every 30 minutes. I use Spring Timer support for that. Basically, my class looks like :</p> <pre><code>public interface Translator { public void loadTranslations(); public String getTranslation(String key); } </code></pre> <p>loadTranslations() can be pretty long to run, so while it is running the old translations are still available. This is done by loading the translations in a local Map and just changing the reference when all translations are loaded.</p> <p>My problem is : how do I make sure that when a thread is already loading translations, is a second one also tries to run, it detects that and returns immediately, without starting a second update.</p> <p>A synchronized method will only queue the loads ... I'm still on Java 1.4, so no java.util.concurrent.</p> <p>Thanks for your help !</p>
[ { "answer_id": 152201, "author": "Ewan Makepeace", "author_id": 9731, "author_profile": "https://Stackoverflow.com/users/9731", "pm_score": 0, "selected": false, "text": "if (instance == null) {\n synchronized {\n if (instance == null) {\n instance = new SomeClass();\n }\n ...
2008/09/30
[ "https://Stackoverflow.com/questions/152138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23704/" ]
152,160
<p>Has anyone used the <a href="http://www.cs.tufts.edu/~nr/noweb/" rel="noreferrer">noweb</a> literate programming tool on a large Java project, where several source code files must be generated in different subdirectories? How did you manage this with noweb? Are there any resources and/or best practices out there?</p>
[ { "answer_id": 775062, "author": "Jason Catena", "author_id": 27685, "author_profile": "https://Stackoverflow.com/users/27685", "pm_score": 3, "selected": false, "text": "<</path/to/file.java>>=\n reallyImportantVariable += 1;\n@ %def reallyImportantVariable\n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/152160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1428/" ]
152,187
<p>What type of authentication would you suggest for the service that is:</p> <ul> <li>implemented as WCF and exposed via varios enpoints (including XML-RPC)</li> <li>has to be consumed easily by various cross-platform clients</li> </ul> <p>Why?</p> <p>Options that I'm aware of are:</p> <ul> <li>Forms-based authentication for IIS-hosted WCF (easy to implement, but has horrible cross-platform support, plus it is not REST)</li> <li>Sending plain-text username/pwd with every call (easy to use on any platform, but totally unsecure)</li> <li>Using ticket-based authentication, when username&amp;pwd are used to create a ticket that is valid for some time and is passed with every request (can be consumed by any client easily, but the API model is bound to this type of security)</li> </ul> <p>Thanks for your time!</p>
[ { "answer_id": 775062, "author": "Jason Catena", "author_id": 27685, "author_profile": "https://Stackoverflow.com/users/27685", "pm_score": 3, "selected": false, "text": "<</path/to/file.java>>=\n reallyImportantVariable += 1;\n@ %def reallyImportantVariable\n" } ]
2008/09/30
[ "https://Stackoverflow.com/questions/152187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47366/" ]
152,188
<p>I have read in some of the ClickOnce posts that ClickOnce does not allow you to create a desktop icon for you application. Is there any way around this?</p>
[ { "answer_id": 152194, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": 0, "selected": false, "text": ".application" }, { "answer_id": 152208, "author": "Timo", "author_id": 15415, "author_profile":...
2008/09/30
[ "https://Stackoverflow.com/questions/152188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18826/" ]
152,190
<p>I'm using StringBuffer in Java to concat strings together, like so:</p> <pre><code>StringBuffer str = new StringBuffer(); str.append("string value"); </code></pre> <p>I would like to know if there's a method (although I didn't find anything from a quick glance at the documentation) or some other way to add "padding".</p> <p>Let me explain; every time I append something to the string, I want to add a space in the end, like so:</p> <pre><code>String foo = "string value"; str.append(foo + " "); </code></pre> <p>and I have several calls to append.. and every time, I want to add a space. Is there a way to set the object so that it will add a space automatically after each append?</p> <p>EDIT --</p> <pre><code>String input StringBuffer query = new StringBuffer(); Scanner scanner = new Scanner(System.in); scanner.UseDelimiter("\n"); do { System.out.println("sql&gt; "); input = scanner.next(); if (!empty(input)) query.append(input); if (query.toString().trim().endsWith(";")) { //run query } } while (!input.equalsIgnoreCase("exit"); </code></pre> <p>I'll use StringBuilder though as grom suggested, but that's how the code looks right now</p>
[ { "answer_id": 152210, "author": "David Webb", "author_id": 3171, "author_profile": "https://Stackoverflow.com/users/3171", "pm_score": 2, "selected": false, "text": "StringBuffer" }, { "answer_id": 152270, "author": "Guvante", "author_id": 16800, "author_profile": "h...
2008/09/30
[ "https://Stackoverflow.com/questions/152190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6618/" ]
152,205
<p>I'm working on a Java library and would like to remove some functions from it. My reasons for this is public API and design cleanup. Some objects have setters, but should be immutable, some functionality has been implemented better/cleaner in different methods, etc.</p> <p>I have marked these methods 'deprecated', and would like to remove them eventually. At the moment I'm thinking about removing these after few sprints (two week development cycles).</p> <p>Are there any 'best practices' about removing redundant public code?</p> <p>/JaanusSiim </p>
[ { "answer_id": 152235, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 4, "selected": true, "text": "/**\n * @deprecated\n * This method will be removed after Halloween!\n * @see #newLocationForFunctionality\n */\n" ...
2008/09/30
[ "https://Stackoverflow.com/questions/152205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/706/" ]
152,216
<p>Boost range library (<a href="http://www.boost.org/doc/libs/1_35_0/libs/range/index.html" rel="noreferrer">http://www.boost.org/doc/libs/1_35_0/libs/range/index.html</a>) allows us to abstract a pair of iterators into a range. Now I want to combine two ranges into one, viz:</p> <p>given two ranges r1 and r2, define r which traverses [r1.begin(), r1.end()[ and then [r2.begin(), r2.end()[. Is there some way to define r as a range using r1 and r2?</p>
[ { "answer_id": 3308176, "author": "amit kumar", "author_id": 19501, "author_profile": "https://Stackoverflow.com/users/19501", "pm_score": 4, "selected": true, "text": "#include \"boost/range/join.hpp\"\n#include \"boost/foreach.hpp\"\n#include <iostream>\n\nint main() {\n int a[]...
2008/09/30
[ "https://Stackoverflow.com/questions/152216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19501/" ]
152,218
<p>Here's the problem:</p> <pre><code>split=re.compile('\\W*') </code></pre> <p>This regular expression works fine when dealing with regular words, but there are occasions where I need the expression to include words like <code>k&amp;amp;auml;ytt&amp;amp;auml;j&amp;aml;auml;</code>.</p> <p>What should I add to the regex to include the <code>&amp;</code> and <code>;</code> characters?</p>
[ { "answer_id": 152225, "author": "PierreBdR", "author_id": 7136, "author_profile": "https://Stackoverflow.com/users/7136", "pm_score": 4, "selected": true, "text": "[^ \\t\\n]*\n" }, { "answer_id": 152245, "author": "Steven Oxley", "author_id": 3831, "author_profile":...
2008/09/30
[ "https://Stackoverflow.com/questions/152218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21716/" ]
152,243
<p>I have a database scenario (I'm using Oracle) in which several processes make inserts into a table and a single process selects from it. The table is basically used as intermediate storage, to which multiple processes (in the following called the Writers) write log events, and from which a single process (in the following referred to as the Reader) reads the events for further processing. The Reader must read all events inserted into the table.</p> <p>Currently, this is done by each inserted record being assigned an id from an ascending sequence. The reader periodically selects a block of entries from the table where the id is larger than the largest id of the previously read block. E.g. something like:</p> <pre><code>SELECT * FROM TRANSACTION_LOG WHERE id &gt; ( SELECT last_id FROM READER_STATUS ); </code></pre> <p>The problem with this approach is that since writers operate concurrently, rows are not always inserted in order according to their assigned id, even though these are assigned in sequentially ascending order. That is, a row with id=100 is sometimes written after a record with id=110, because the process of writing the row with id=110 started after the processes writing the record id=100, but committed first. This can result in the Reader missing the row with id=100 if it has already read row with id=110.</p> <p>Forcing the Writers to an exclusive lock on the table would solve the problem as this would force them to insert sequentially and also for the Reader to wait for any outstanding commits. This, however, would probably not be very fast.</p> <p>It is my thinking, that it would suffice for the Reader to wait for any outstanding Writer commits before reading. That is, Writers may continue to operate concurrently as longs as the Reader does read until all writers have finished.</p> <p>My question is this:<br> How can I instruct my reader process to wait for any outstanding commits of my writer processes? Any alternative suggestions to the above problem are also welcome. </p>
[ { "answer_id": 152375, "author": "AJ.", "author_id": 7211, "author_profile": "https://Stackoverflow.com/users/7211", "pm_score": 1, "selected": false, "text": "SELECT *\nFROM TRANSACTION_LOG\nWHERE id > (SELECT last_id\n FROM READER_STATUS)\nOR id IN ( SELECT id from...
2008/09/30
[ "https://Stackoverflow.com/questions/152243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7742/" ]
152,248
<p>We have a website running on Apache, access to which has a number of static pages protected via HTTP Basic authentication.</p> <p>I've written a new part of the site with Django using Django's built in support for user management.</p> <p>The problem I have is that users have to log in once via the HTTP Basic authentication and then again using a Django login form. This both clumsy and very confusing for users.</p> <p>I was wondering if anyone had found a way to make Django log a user in using the HTTP Basic authentication information.</p> <p>I not expecting to pass a password to Django, but rather if a user <code>dave</code> has been authenticated by Apache then they should be automatically logged into Django as <code>dave</code> too.</p> <p>(One option would be to make Apache and Django share a user store to ensure common usernames and passwords but this would still involve two login prompts which is what I'm trying to avoid.)</p>
[ { "answer_id": 156593, "author": "akaihola", "author_id": 15770, "author_profile": "https://Stackoverflow.com/users/15770", "pm_score": 3, "selected": false, "text": "RemoteUserAuthMiddleware" }, { "answer_id": 156832, "author": "zgoda", "author_id": 12138, "author_pr...
2008/09/30
[ "https://Stackoverflow.com/questions/152248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3171/" ]
152,250
<p>I have my winform application gathering data using databinding. Everything looks fine except that I have to link the <strong>property</strong> with the <strong>textedit</strong> using a string:</p> <blockquote> <p>Me.TextEdit4.DataBindings.Add(New System.Windows.Forms.Binding("EditValue", Me.MyClassBindingSource, "MyClassProperty", True))</p> </blockquote> <p>This works fine but if I change the class' property name, the compiler obviously will not warn me . </p> <p>I would like to be able to get the property name by reflection but I don't know how to specify the name of the property I want (I only know how to iterate among all the properties of the class) </p> <p>Any idea?</p>
[ { "answer_id": 152279, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 4, "selected": true, "text": "[AttributeUsage(AttributeTargets.Property)]\nclass TextProperyAttribute: Attribute\n{}\n\nclass MyTextBox\n{\n [TextPropery]\n...
2008/09/30
[ "https://Stackoverflow.com/questions/152250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
152,259
<p>Say if I had a table of books in a MySQL database and I wanted to search the 'title' field for keywords (input by the user in a search field); what's the best way of doing this in PHP? Is the MySQL <code>LIKE</code> command the most efficient way to search?</p>
[ { "answer_id": 152320, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 3, "selected": false, "text": "$terms=explode(',', $_GET['keywords']);\n$clauses=array();\nforeach($terms as $term)\n{\n //remove any chars you don't...
2008/09/30
[ "https://Stackoverflow.com/questions/152259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21709/" ]
152,262
<p>I am in charge of a website at work and recently I have added ajaxy requests to make it faster and more responsive. But it has raised an issue.</p> <p>On my pages, there is an index table on the left, like a menu. Once you have clicked on it, it makes a request that fills the rest of the page. At anytime you can click on another item of the index to load a different page.</p> <p>Before adding javascript, it was possible to middle click (open new tabs) for each item of the index, which allowed to have other pages loading while I was dealing with one of them. But since I have changed all the links to be ajax requests, they now execute some javascript instead of being real links. So they are only opening empty tabs when I middle click on them.</p> <p>Is there a way to combine both functionalities: links firing javascript when left clicked or new tabs when middle clicked? Does it have to be some ugly javascript that catches every clicks and deal with them accordingly?</p> <p>Thanks.</p>
[ { "answer_id": 152273, "author": "Guvante", "author_id": 16800, "author_profile": "https://Stackoverflow.com/users/16800", "pm_score": 1, "selected": false, "text": "<a href=\"/Whatever/Wherever.htm\" onclick=\"handler(); return false;\" />\n" }, { "answer_id": 152274, "autho...
2008/09/30
[ "https://Stackoverflow.com/questions/152262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16070/" ]
152,276
<p>I have report on my asp page and every time I change a filter and click view report, I get this error:</p> <p>Microsoft JScript runtime error: 'this._postBackSettings.async' is null or not an object</p> <p>I tried change the EnablePartialRendering="true" to EnablePartialRendering="false" but then people can't login on the site</p>
[ { "answer_id": 1289646, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "event.cancelBubble = true;\nif (event.stopPropagation)\n event.stopPropagation();\n" }, { "answer_id": 3342506, ...
2008/09/30
[ "https://Stackoverflow.com/questions/152276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12311/" ]
152,288
<p>I've been pulling my hear out over this problem for a few hours yesterday:</p> <p>I've a database on MySQL 4.1.22 server with encoding set to "UTF-8 Unicode (utf8)" (as reported by phpMyAdmin). Tables in this database have default charset set to <b>latin2</b>. But, the web application (CMS Made Simple written in PHP) using it displays pages in <b>utf8</b>...</p> <p>However screwed up this may be, it actually works. The web app displays characters correctly (mostly Czech and Polish are used).</p> <p>I run: "mysqldump -u xxx -p -h yyy dbname > dump.sql". This gives me an SQL script which:</p> <ul> <li>looks perfect in any editor (like Notepad+) when displaying in <b>UTF-8</b> - all characters display properly</li> <li>all tables in the script have default charset set to <b>latin2</b></li> <li>it has "/*!40101 SET NAMES latin2 */;" line at the beginning (among other settings)</li> </ul> <p>Now, I want to export this database to another server running on MySQL 5.0.67, also with server encoding set to "UTF-8 Unicode (utf8)". I copied the whole CMS Made Simple installation over, copied the dump.sql script and ran "mysql -h ddd -u zzz -p dbname &lt; dump.sql". After that, all the characters are scrambled when displaying CMSMS web pages.</p> <p>I tried setting:<br> SET character_set_client = utf8;<br> SET character_set_connection = latin2;</p> <p>And all combinations (just to be safe, even if it doesn't make any sense to me): latin2/utf8, latin2/latin2, utf8/utf8, etc. - doesn't help. All characters still scrambled, however sometimes in a different way :).</p> <p>I also tried replacing all latin2 settings with utf8 in the script (set names and default charsets for tables). Nothing.</p> <p>Are there any MySQL experts here who could explain in just a few words (I'm sure it's simple after all) how this whole encoding stuff really works? I read <a href="http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html" rel="noreferrer">9.1.4. Connection Character Sets and Collations</a> but found nothing helpful there.</p> <p>Thanks, Matt</p>
[ { "answer_id": 152740, "author": "kolrie", "author_id": 14540, "author_profile": "https://Stackoverflow.com/users/14540", "pm_score": 5, "selected": false, "text": "mysql --default-character-set=utf8 -h ddd -u zzz -p dbname < dump.sql\n" }, { "answer_id": 21157493, "author": ...
2008/09/30
[ "https://Stackoverflow.com/questions/152288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23723/" ]
152,299
<p>I am about to set up a subversion server to be accessed via svn+ssh. I was wondering, where the <em>default</em> repository location is (on a unix box).</p> <p>Do you put it in</p> <pre><code>/opt/svn </code></pre> <p>or</p> <pre><code>/home/svn </code></pre> <p>or</p> <pre><code>/usr/subversion </code></pre> <p>or even</p> <pre><code>/svn </code></pre> <p>or somewhere else?</p> <p>I am looking for the place, most people put it. Is there a convention?</p> <p>EDIT:</p> <p>It is absolutely possible to "hide" the actual repository location from the user. For example (in my case) by wrapping the <code>svnserve</code> executable in a way that it is called like:</p> <pre><code>svnserve -r /var/svn/repos </code></pre>
[ { "answer_id": 152403, "author": "Mihai Limbășan", "author_id": 14444, "author_profile": "https://Stackoverflow.com/users/14444", "pm_score": 4, "selected": true, "text": "/var" }, { "answer_id": 152428, "author": "agnul", "author_id": 6069, "author_profile": "https:/...
2008/09/30
[ "https://Stackoverflow.com/questions/152299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1870/" ]
152,307
<p>I've got an ASP.NET 2.0 website with a custom 404 page. When content is not found the site serves the custom 404 page with a query string addition of aspxerrorpath=/mauro.aspx. The 404 page itself is served with an <a href="http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol" rel="nofollow noreferrer">HTTP</a> status of 200. To try to resolve this I've added</p> <pre><code> protected void Page_Load(object sender, EventArgs e) { Response.StatusCode = 404; } </code></pre> <p>I added the Google widget and have two issues with it. In <a href="http://en.wikipedia.org/wiki/Internet_Explorer_7" rel="nofollow noreferrer">Internet&nbsp;Explorer&nbsp;7</a> it does not display where it should. If I add it to the content, I get an "unknown error" on char 79 line 226 or thereabouts; if I add it to the head section the search boxes appear above the content. In Firefox it works fine.</p> <p>So my issues are:</p> <ol> <li>How do I make the widget appear inline?</li> <li>How do I make the error page render as a 404 with the original name and path of the file being requested so that when I request mauro.aspx I get the content for the 404 page, but with the URL of mauro.aspx? (I assume that I will have to do some <a href="http://en.wikipedia.org/wiki/Rewrite_engine" rel="nofollow noreferrer">URL rewriting</a> in the begin_request global.asax file, but would like this confirmed before I do anything silly.)</li> </ol>
[ { "answer_id": 152366, "author": "Mauro", "author_id": 2208, "author_profile": "https://Stackoverflow.com/users/2208", "pm_score": 2, "selected": true, "text": "protected void Application_BeginRequest(object sender, EventArgs e)\n{\n string url = Request.RawUrl;\n if ((url.Contains...
2008/09/30
[ "https://Stackoverflow.com/questions/152307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2208/" ]
152,313
<p>When should you use XML attributes and when should you use XML elements?</p> <p>e.g.</p> <pre><code>&lt;customData&gt; &lt;records&gt; &lt;record name="foo" description="bar" /&gt; &lt;/records&gt; &lt;/customData&gt; </code></pre> <p>or</p> <pre><code>&lt;customData&gt; &lt;records&gt; &lt;record&gt; &lt;name&gt;foo&lt;/name&gt; &lt;description&gt;bar&lt;/description&gt; &lt;/record&gt; &lt;/records&gt; &lt;/customData&gt; </code></pre>
[ { "answer_id": 152346, "author": "Rory Becker", "author_id": 11356, "author_profile": "https://Stackoverflow.com/users/11356", "pm_score": 3, "selected": false, "text": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<data>\n <people>\n <person name=\"Rory\" surname=\"Becker\" age...
2008/09/30
[ "https://Stackoverflow.com/questions/152313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23726/" ]
152,319
<p>I'm looking for a decent sort implementation for arrays in VBA. A Quicksort would be preferred. Or any other <a href="http://web.archive.org/web/20180224071555/http://www.cs.ubc.ca:80/~harrison/Java/sorting-demo.html" rel="noreferrer">sort algorithm</a> other than bubble or merge would suffice.</p> <p>Please note that this is to work with MS Project 2003, so should avoid any of the Excel native functions and anything .net related.</p>
[ { "answer_id": 152325, "author": "Jorge Ferreira", "author_id": 6508, "author_profile": "https://Stackoverflow.com/users/6508", "pm_score": 8, "selected": true, "text": "0" }, { "answer_id": 152333, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "htt...
2008/09/30
[ "https://Stackoverflow.com/questions/152319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4134/" ]