qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
99,211
<p>I am trying to get Haml to work with my Ruby on Rails project. I am new to Ruby on Rails and I really like it. However, when I attempt to add an <code>aplication.html.haml</code> or <code>index.html.haml</code> for a view, I just receive errors.</p> <p>I am using NetBeans as my IDE.</p>
[ { "answer_id": 105542, "author": "Ryan McGeary", "author_id": 8985, "author_profile": "https://Stackoverflow.com/users/8985", "pm_score": 5, "selected": false, "text": "Gemfile" }, { "answer_id": 106547, "author": "Pete", "author_id": 13472, "author_profile": "https:/...
2008/09/19
[ "https://Stackoverflow.com/questions/99211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
99,242
<p>For RMI on server-side, do we need to start <code>rmiregistry</code> program, or just call <code>LocateRegistry.createRegistry</code>? If both are possible, what are the advantages and disadvantages?</p>
[ { "answer_id": 99286, "author": "user17250", "author_id": 17250, "author_profile": "https://Stackoverflow.com/users/17250", "pm_score": 4, "selected": true, "text": "rmiregistry" }, { "answer_id": 985871, "author": "William Wong", "author_id": 115872, "author_profile"...
2008/09/19
[ "https://Stackoverflow.com/questions/99242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11238/" ]
99,279
<p>I want to parse a web page in Groovy and extract all of the href links and the associated text with it.</p> <p>If the page contained these links:</p> <pre><code>&lt;a href="http://www.google.com"&gt;Google&lt;/a&gt;&lt;br /&gt; &lt;a href="http://www.apple.com"&gt;Apple&lt;/a&gt; </code></pre> <p>the output would be:</p> <pre><code>Google, http://www.google.com&lt;br /&gt; Apple, http://www.apple.com </code></pre> <p>I'm looking for a Groovy answer. AKA. The easy way!</p>
[ { "answer_id": 99362, "author": "J D OConal", "author_id": 17023, "author_profile": "https://Stackoverflow.com/users/17023", "pm_score": 0, "selected": false, "text": "(html =~ /<a.*href='(.*?)'.*>(.*?)<\\/a>/).each { url, text -> \n // do something with url and text\n}\n" }, { ...
2008/09/19
[ "https://Stackoverflow.com/questions/99279", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
99,297
<p>We all know what virtual functions are in C++, but how are they implemented at a deep level?</p> <p>Can the vtable be modified or even directly accessed at runtime?</p> <p>Does the vtable exist for all classes, or only those that have at least one virtual function? </p> <p>Do abstract classes simply have a NULL for the function pointer of at least one entry?</p> <p>Does having a single virtual function slow down the whole class? Or only the call to the function that is virtual? And does the speed get affected if the virtual function is actually overwritten or not, or does this have no effect so long as it is virtual.</p>
[ { "answer_id": 99739, "author": "Andrew Stein", "author_id": 13029, "author_profile": "https://Stackoverflow.com/users/13029", "pm_score": 0, "selected": false, "text": "class B { ~B() = 0; }; // Abstract Base class\nclass D : public B { ~D() {} }; // Concrete Derived class\n\nD* pD = ne...
2008/09/19
[ "https://Stackoverflow.com/questions/99297", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
99,299
<p>For example, referencing something as System.Data.Datagrid as opposed to just Datagrid. Please provide examples and explanation. Thanks.</p>
[ { "answer_id": 99329, "author": "Statement", "author_id": 2166173, "author_profile": "https://Stackoverflow.com/users/2166173", "pm_score": 2, "selected": false, "text": "using Datagrid = System.Data.Datagrid;\n" }, { "answer_id": 99335, "author": "Orion Adrian", "author_...
2008/09/19
[ "https://Stackoverflow.com/questions/99299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13578/" ]
99,302
<p>Would it be useful to include the class name and variable name in any NullPointerException message? I know that it might not always be possible because of changes made by a JIT but is seems like the info should be available often (class members, etc).</p> <p>From: <a href="http://jamesjava.blogspot.com/2005/04/what-was-null.html" rel="nofollow noreferrer">http://jamesjava.blogspot.com/2005/04/what-was-null.html</a></p>
[ { "answer_id": 99360, "author": "Soumitra", "author_id": 10844, "author_profile": "https://Stackoverflow.com/users/10844", "pm_score": -1, "selected": false, "text": "NullPointerException" }, { "answer_id": 99512, "author": "Roy Tang", "author_id": 18494, "author_prof...
2008/09/19
[ "https://Stackoverflow.com/questions/99302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6770/" ]
99,315
<p>What if a Java allow both static and dynamic types. That might allow the best of both worlds. i.e.:</p> <pre><code>String str = "Hello"; var temp = str; temp = 10; temp = temp * 5; </code></pre> <ol> <li>Would that be possible?</li> <li>Would that be beneficial?</li> <li>Do any languages currently support both and how well does it work out?</li> </ol> <p>Here is a better example (generics can't be used but the program does know the type):</p> <pre><code>var username = HttpServletRequest.getSession().getAttribute("username");//Returns a String if(username.length() == 0) { //Error } </code></pre>
[ { "answer_id": 99333, "author": "jon", "author_id": 12215, "author_profile": "https://Stackoverflow.com/users/12215", "pm_score": 1, "selected": false, "text": "String str = \"Hello\";\nObject temp = str;\ntemp = 10;\n" }, { "answer_id": 99376, "author": "Lou Franco", "au...
2008/09/19
[ "https://Stackoverflow.com/questions/99315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6770/" ]
99,318
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/1217088/what-does-mapname-mean-in-ruby">What does map(&amp;:name) mean in Ruby?</a> </p> </blockquote> <p>I was watching a railscast and saw this code.</p> <pre><code>[Category, Product].(&amp;:delete_all) </code></pre> <p>In regards to clearing a database.</p> <p>I asked about the line in IRC and was told </p> <pre><code>(&amp;:delete_all) </code></pre> <p>was a shortcut for </p> <pre><code>{|model| model.delete_all} </code></pre> <p>I tested this with the following</p> <pre><code>class ClassOne def class_method puts 1 end end class ClassTwo def class_method puts 2 end end [ClassOne, ClassTwo].each(&amp;:class_method) </code></pre> <p>I received an error saying</p> <pre><code>Wrong Argument type Symbol (expected Proc) </code></pre> <p>I also tried</p> <pre><code>one = ClassOne.new two = ClassTwo.new [one, two].each(&amp;:class_method) </code></pre> <p>But that still failed.</p> <p>If I modified it to read</p> <pre><code>[one, two].each{|model| model.class_method} </code></pre> <p>Everything worked as expected.</p> <p>So, what does <code>&amp;:delete_all</code> actually do? The docs say <code>delete_all</code> is a method, so I am confused as to what is going on here.</p>
[ { "answer_id": 99336, "author": "Alex M", "author_id": 9652, "author_profile": "https://Stackoverflow.com/users/9652", "pm_score": 5, "selected": true, "text": "class Symbol\n def to_proc\n proc { |obj, *args| obj.send(self, *args) }\n end\nend\n" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/99318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9450/" ]
99,350
<p>Is there an easy way to marshal a PHP associative array to and from XML? For example, I have the following array:</p> <pre><code>$items = array("1", "2", array( "item3.1" =&gt; "3.1", "item3.2" =&gt; "3.2" "isawesome" =&gt; true ) ); </code></pre> <p>How would I turn it into something similar to the following XML in as few lines as possible, then back again?</p> <pre><code>&lt;items&gt; &lt;item&gt;1&lt;/item&gt; &lt;item&gt;2&lt;/item&gt; &lt;item&gt; &lt;item3_1&gt;3.1&lt;/item3_1&gt; &lt;item3_2&gt;3.2&lt;/item3_2&gt; &lt;isawesome&gt;true&lt;/isawesome&gt; &lt;/item&gt; &lt;/items&gt; </code></pre> <p>I don't really care if I have to change the array structure a bit or if the XML that comes out is different to the above example. I've been trying to work with PHP's <a href="http://php.net/manual/en/book.xmlreader.php" rel="noreferrer">XMLReader</a> and <a href="http://php.net/manual/en/book.xmlwriter.php" rel="noreferrer">XMLWriter</a>, but the documentation is so poor and the code I've produced as a consequence looks nothing like what I feel it should look like:</p> <pre><code>$xml = SomeXMLWriter::writeArrayToXml($items); $array = SomeXMLWriter::writeXmlToArray($xml); </code></pre> <p>Does it really have to be any harder than that to get a basic, raw XML dump of a PHP array without writing my own custom class?</p> <p>I try to avoid PEAR. In addition to the configuration headaches I've had with it, I've never stuck with any of the packages I've ever used from it.</p>
[ { "answer_id": 100287, "author": "DreamWerx", "author_id": 15487, "author_profile": "https://Stackoverflow.com/users/15487", "pm_score": 2, "selected": false, "text": "<items>\n <item id=\"1\"/>\n <item id=\"2\"/>\n <item id=\"3\">\n <subitems> \n <item id=\"3.1\"/>\n <item...
2008/09/19
[ "https://Stackoverflow.com/questions/99350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15004/" ]
99,353
<p>How to test if a line segment intersects an axis-aligned rectange in 2D? The segment is defined with its two ends: p1, p2. The rectangle is defined with top-left and bottom-right points.</p>
[ { "answer_id": 99568, "author": "Gishu", "author_id": 1695, "author_profile": "https://Stackoverflow.com/users/1695", "pm_score": 0, "selected": false, "text": "y = (Point2.Y - Point1.Y) / (Point2.X - Point1.X)\n" }, { "answer_id": 100165, "author": "metamal", "author_id"...
2008/09/19
[ "https://Stackoverflow.com/questions/99353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14385/" ]
99,391
<p>When I commit I get this error from Subversion:</p> <pre><code>bash-2.05b$ svn commit -m "testing subversion, still" Adding baz svn: Commit failed (details follow): svn: MKCOL of '/viper/!svn/wrk/6b9bcd38-b2fe-0310-95ff-9d1a44098866/sandboxes/ohammersmith/trunk/baz': 405 Method Not Allowed (http://svn.example.com) </code></pre>
[ { "answer_id": 99413, "author": "Otto", "author_id": 9594, "author_profile": "https://Stackoverflow.com/users/9594", "pm_score": 8, "selected": true, "text": "svn up" }, { "answer_id": 37965567, "author": "Harshal Doshi Jain", "author_id": 1461781, "author_profile": ...
2008/09/19
[ "https://Stackoverflow.com/questions/99391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9594/" ]
99,395
<p>How to check if a folder (directory) exists in Cocoa using Objective-C?</p>
[ { "answer_id": 99438, "author": "Matt Dillard", "author_id": 863, "author_profile": "https://Stackoverflow.com/users/863", "pm_score": 7, "selected": true, "text": "NSFileManager" }, { "answer_id": 99465, "author": "lajos", "author_id": 3740, "author_profile": "https:...
2008/09/19
[ "https://Stackoverflow.com/questions/99395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3740/" ]
99,419
<p>An obvious answer is "an internal wiki". What are the pros and cons of a wiki used for software documentation? Any other suggestions? What are you using for your software documentation?</p> <p><a href="https://stackoverflow.com/users/6436/loren-segal">Loren Segal</a> - Unfortunately we don't have support for any doc tool to compile information from the source code comments but I agree it would be the best way to store technical documentation. My question was about every kind of documentation tho - from sysadmin type to user documentation. </p>
[ { "answer_id": 99462, "author": "Loren Segal", "author_id": 6436, "author_profile": "https://Stackoverflow.com/users/6436", "pm_score": 4, "selected": true, "text": "docs/" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/99419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8934/" ]
99,468
<p>I am retrieving multiple rows into a listview control from an ODBC source. For simple SELECTs it seems to work well with a statement attribute of SQL_SCROLLABLE. How do I do this with a UNION query (with two selects)?</p> <p>The most likely server will be MS SQL Server (probably 2005). The code is C for the Win32 API.</p> <p>This code sets (what I think is) a server side cursor which feeds data into the ODBC driver that roughly corresponds with the positional fetches of SQLFetchScroll, which is turn feeds the cache for the listview. (Sometimes using SQL_FETCH_FIRST or SQL_FETCH_LAST as well as):</p> <pre> SQLSetStmtAttr(hstmt1Fetch, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER)SQL_SCROLLABLE, SQL_IS_INTEGER); SQLSetStmtAttr(hstmt1Fetch, SQL_ATTR_CURSOR_SENSITIVITY, (SQLPOINTER)SQL_INSENSITIVE, SQL_IS_INTEGER); ... retcode = SQLGetStmtAttr(hstmt1Fetch, SQL_ATTR_ROW_NUMBER, &CurrentRowNumber, SQL_IS_UINTEGER, NULL); ... retcode = SQLFetchScroll(hstmt1Fetch, SQL_FETCH_ABSOLUTE, Position); </pre> <p>(The above is is a fragment from working code for a single SELECT).</p> <p>Is this the best way to do it? Given that I need to retrieve the last row to get the number of rows and populate the end buffer is there a better way of doing it? (Can I use forward only scrolling?)</p> <p>Assuming yes to the above, how do I achieve the same result with a UNION query?</p> <p>LATE EDIT: The problem with the union query being that effectively it forces forward only scrolling which breaks SQLFetchScroll(hstmt1Fetch, SQL_FETCH_ABSOLUTE, Position). The answer is I suspect: "you can't". And it really means redesigning the DB to included either a view or a single table to replace the UNION. But I'll leave the question open in case I have missed something.</p>
[ { "answer_id": 99628, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 1, "selected": false, "text": "select some_fields from table1\nunion\nselect same_fields from table2\n" }, { "answer_id": 146031, "author...
2008/09/19
[ "https://Stackoverflow.com/questions/99468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3137/" ]
99,479
<p>My C(++) program, written and compiled using Visual C(++)/Visual Studio, runs fine on my own machine, but refuses to run on another machine. The error message I get is "This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem."</p>
[ { "answer_id": 108198, "author": "Scott", "author_id": 12451, "author_profile": "https://Stackoverflow.com/users/12451", "pm_score": 1, "selected": false, "text": "\\Program Files\\Microsoft Visual Studio 8\\SDK\\v2.0\\BootStrapper\\Packages\\vcredist_x86\n" }, { "answer_id": 197...
2008/09/19
[ "https://Stackoverflow.com/questions/99479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14637/" ]
99,488
<p>If I'm writing an application that wants to communicate some information through the use of color, how can I change the background and foreground colors of a given widget? I would like to know how to do this in glade if it's possible, as well as programmatically (to a computed color).</p> <p>I want to know how to do this to a complex widget as well, for example, an <code>HBox</code> that contains a <code>VBox</code> that contains some <code>Labels</code>.</p> <p>Ideally this would also include a solution solution that allows me to <em>tint</em> the widget's existing colors, and identify the average colors of any images in use by the theme, so that I can programmatically compensate for any color choices which might make text unreadable or otherwise clashing - but I would be happy if I could just turn a button red.</p>
[ { "answer_id": 100266, "author": "Tometzky", "author_id": 15862, "author_profile": "https://Stackoverflow.com/users/15862", "pm_score": 4, "selected": true, "text": "#include <gtk/gtk.h>\n\nstatic void on_destroy(GtkWidget* widget, gpointer data)\n{\n gtk_main_quit ();\n}\n\nint m...
2008/09/19
[ "https://Stackoverflow.com/questions/99488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13564/" ]
99,497
<p>I'm not looking so much for language-specific answers, just general models for implementing a plugin system (if you want to know, I'm using Python). I have my own idea (register callbacks, and that's about it), but I know others exist. What's normally used, and what else is reasonable?</p> <blockquote> <p>What do you mean by a plugin system? Does Dependency Injection and IOC containers sounds like a good solution?</p> </blockquote> <p>I mean, uh, well, a way to insert functionality into the base program without altering it. I didn't intend to define it when I set out. Dependency Injection doesn't <em>look</em> particularly suitable for what I'm doing, but I don't know much about them.</p>
[ { "answer_id": 99534, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 1, "selected": false, "text": "setuptools" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/99497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18515/" ]
99,510
<p>Does having several levels of base classes slow down a class? A derives B derives C derives D derives F derives G, ...</p> <p>Does multiple inheritance slow down a class?</p>
[ { "answer_id": 99531, "author": "Statement", "author_id": 2166173, "author_profile": "https://Stackoverflow.com/users/2166173", "pm_score": 0, "selected": false, "text": "// F is-a E,\n// E is-a D and so on\n\nA* aObject = new F(); \naObject->CallAVirtual();\n" }, { "answer_id": ...
2008/09/19
[ "https://Stackoverflow.com/questions/99510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
99,535
<p>What tools do you use for Automated Builds / Automated Deployments? Why?</p> <p>What tools do you recommend?</p>
[ { "answer_id": 99601, "author": "BCS", "author_id": 1343, "author_profile": "https://Stackoverflow.com/users/1343", "pm_score": 2, "selected": false, "text": "make" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/99535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18475/" ]
99,542
<p>How do I correct for floating point error in the following physical simulation:</p> <ul> <li>Original point (x, y, z),</li> <li>Desired point (x', y', z') after forces are applied.</li> <li>Two triangles (A, B, C) and (B, C, D), who share edge BC</li> </ul> <p>I am using this method for collision detection:</p> <pre><code>For each Triangle If the original point is in front of the current triangle, and the desired point is behind the desired triangle: Calculate the intersection point of the ray (original-desired) and the plane (triangle's normal). If the intersection point is inside the triangle edges (!) Respond to the collision. End If End If Next Triangle </code></pre> <p>The problem I am having is that sometimes the point falls into the grey area of floating point math where it is so close to the line BC that it fails to collide with either triangle, even though technically it should always collide with one or the other since they share an edge. When this happens the point passes right between the two edge sharing triangles. I have marked one line of the code with <strong>(!)</strong> because I believe that's where I should be making a change.</p> <p>One idea that works in very limited situations is to skip the edge testing. Effectively turning the triangles into planes. This only works when my meshes are convex hulls, but I plan to create convex shapes.</p> <p>I am specifically using the dot product and triangle normals for all of my front-back testing.</p>
[ { "answer_id": 168377, "author": "user4891", "author_id": 4891, "author_profile": "https://Stackoverflow.com/users/4891", "pm_score": 0, "selected": false, "text": "double Distance(double x0, double y0, double x1, double y1)\n{\n double a, b, dx, dy;\n\n dx = abs(x1 - x0);\n dy = abs(...
2008/09/19
[ "https://Stackoverflow.com/questions/99542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2581/" ]
99,546
<p>I read this <a href="http://smartprogrammer.blogspot.com/2006/04/15-exercises-for-learning-new.html" rel="nofollow noreferrer">article</a> and try to do the exercise in D Programming Language, but encounter a problem in the first exercise.</p> <blockquote> <p>(1) Display series of numbers (1,2,3,4, 5....etc) in an infinite loop. The program should quit if someone hits a specific key (Say ESCAPE key).</p> </blockquote> <p>Of course the infinite loop is not a big problem, but the rest is. How could I grab a key hit in D/Tango? In tango FAQ it says use C function kbhit() or get(), but as I know, these are not in C standard library, and does not exist in glibc which come with my Linux machine which I use to programming.</p> <p>I know I can use some 3rd party library like <a href="http://www.gnu.org/software/ncurses/" rel="nofollow noreferrer">ncurses</a>, but it has same problem just like kbhit() or get(), it is not standard library in C or D and not pre-installed on Windows. What I hope is that I could done this exercise use just D/Tango and could run it on both Linux and Windows machine.</p> <p>How could I do it?</p>
[ { "answer_id": 100380, "author": "Brian Hsu", "author_id": 242644, "author_profile": "https://Stackoverflow.com/users/242644", "pm_score": 0, "selected": false, "text": "import tango.io.Stdout;\nimport tango.core.Thread;\n\n// Prototype for used ncurses library function.\nextern(C)\n{\n ...
2008/09/19
[ "https://Stackoverflow.com/questions/99546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/242644/" ]
99,552
<p>I sometimes notice programs that crash on my computer with the error: "pure virtual function call".</p> <p>How do these programs even compile when an object cannot be created of an abstract class?</p>
[ { "answer_id": 99575, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 8, "selected": true, "text": "class Base\n{\npublic:\n Base() { reallyDoIt(); }\n void reallyDoIt() { doIt(); } // DON'T DO THIS\n virtual ...
2008/09/19
[ "https://Stackoverflow.com/questions/99552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
99,560
<p>I am working on a Rails application that needs to handle dates and times in users' time zones. We have recently migrated it to Rails 2.1 and added time zone support, but there are numerous situations in which we use Time#utc and then compare against that time. Wouldn't that be the same as comparing against the original Time object?</p> <p>When is it appropriate to use Time#utc in Rails 2.1? When is it inappropriate?</p>
[ { "answer_id": 99942, "author": "nikz", "author_id": 3977, "author_profile": "https://Stackoverflow.com/users/3977", "pm_score": 4, "selected": true, "text": "config.time_zone = 'UTC'\n" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/99560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7717/" ]
99,623
<p>I'd like to be able to do some drawing to the right of the menu bar, in the nonclient area of a window. </p> <p>Is this possible, using C++ / MFC?</p>
[ { "answer_id": 99679, "author": "Charlie", "author_id": 18529, "author_profile": "https://Stackoverflow.com/users/18529", "pm_score": 2, "selected": false, "text": "case WM_NCPAINT:\n{\n HDC hdc;\n hdc = GetDCEx(hwnd, (HRGN)wParam, DCX_WINDOW|DCX_INTERSECTRGN);\n // Paint into this DC\n ...
2008/09/19
[ "https://Stackoverflow.com/questions/99623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
99,642
<p>I was curious if anyone had any problems creating unit tests around using the ResourceManager. I am using Visual Studio test edition and it appears that the satellite assemblies don't get loaded during the test. When I try to get a resource for another culture, the test always fails and the resource manager always falls back to the default culture. The exact same code runs fine within the normal application.</p>
[ { "answer_id": 62429661, "author": "jackomo", "author_id": 2393063, "author_profile": "https://Stackoverflow.com/users/2393063", "pm_score": 1, "selected": false, "text": "[DeploymentItem( @\"de-DE\\AssemblyName.resources.dll\", \"de-DE\")]\n" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/99642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10874/" ]
99,643
<p>After applying a CSS reset, I want to get back to 'normal' behavior for html elements like: p, h1..h6, strong, ul and li.</p> <p>Now when I say normal I mean e.g. the p element adds spacing or a carriage return like result when used, or the size of the font and boldness for a h1 tag, along with the spacing.</p> <p>I realize it is totally up to me how I want to set the style, but I want to get back to normal behavior for some of the more common elements (at least as a starting point that I can tweak later on).</p>
[ { "answer_id": 99646, "author": "da5id", "author_id": 14979, "author_profile": "https://Stackoverflow.com/users/14979", "pm_score": 3, "selected": false, "text": "* {\n padding: 0;\n margin: 0;\n}\n\nh1, h2, h3, h4, h5, h6, p, blockquote, form, label, ul, ol, dl, fieldset, address ...
2008/09/19
[ "https://Stackoverflow.com/questions/99643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1368/" ]
99,683
<p>My question is what do most developers prefer for error handling, Exceptions or Error Return Codes. Please be language(or language family) specific and why you prefer one over the other.</p> <p>I'm asking this out of curiosity. Personally I prefer Error Return Codes since they are less explosive and don't force user code to pay the exception performance penalty if they don't want to.</p> <p>update: thanks for all the answers! I must say that although I dislike the unpredictability of code flow with exceptions. The answer about return code (and their elder brother handles) do add lots of Noise to the code.</p>
[ { "answer_id": 99728, "author": "SCdF", "author_id": 1666, "author_profile": "https://Stackoverflow.com/users/1666", "pm_score": 1, "selected": false, "text": "doFoo()" }, { "answer_id": 99740, "author": "Robert Gould", "author_id": 15124, "author_profile": "https://S...
2008/09/19
[ "https://Stackoverflow.com/questions/99683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15124/" ]
99,684
<p>The most basic task in an object oriented environment is executing a method on an object. To do this, you have to have a reference to the object on which you are invoking the method. Is the proper way to establish this reference to pass the object as a parameter to the constructor (or initializer method) of the calling object?</p> <p>If object <code> foo </code> calls into object <code> bar</code>, is it correct to say (in pseudo-code):</p> <pre><code>bar = new barClass() foo = new fooClass(bar) </code></pre> <p>What happens if you need to pass messages back and forth? Do you need a method for registering the target object?</p> <pre><code>foo = new fooClass() bar = new barClass() foo.register(bar) bar.register(foo) </code></pre> <p>Is there a pattern that addresses this?</p>
[ { "answer_id": 99921, "author": "xanadont", "author_id": 1886, "author_profile": "https://Stackoverflow.com/users/1886", "pm_score": 0, "selected": false, "text": "foo = new Foo();\nbar = Foo.Poop();\n\nfunction Foo::Poop()\n{\n bar = new Bar(this);\n myChildren.Add(bar);\n retu...
2008/09/19
[ "https://Stackoverflow.com/questions/99684", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8092/" ]
99,686
<p>From <a href="http://en.wikipedia.org/wiki/Generic_programming" rel="noreferrer">Wikipedia</a>: </p> <blockquote> <p>Generic programming is a style of computer programming in which algorithms are written in terms of to-be-specified-later types that are then instantiated when needed for specific types provided as parameters and was pioneered by Ada which appeared in 1983. This approach permits writing common functions or types that differ only in the set of types on which they operate when used, thus reducing duplication.</p> </blockquote> <p>Generics provide the ability to define types that are specified later. You don't have to cast items to a type to use them because they are already typed.</p> <p>Why does C# and VB have Generics? What benefit do they provide? What benefits do you find using them?</p> <p>What other languages also have generics?</p>
[ { "answer_id": 99712, "author": "Francis B.", "author_id": 17067, "author_profile": "https://Stackoverflow.com/users/17067", "pm_score": 3, "selected": false, "text": "List<MyObject>" }, { "answer_id": 126278, "author": "Amy B", "author_id": 8155, "author_profile": "h...
2008/09/19
[ "https://Stackoverflow.com/questions/99686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18475/" ]
99,688
<p>One of the biggest advantages of object-oriented programming is encapsulation, and one of the "truths" we've (or, at least, I've) been taught is that members should always be made private and made available via accessor and mutator methods, thus ensuring the ability to verify and validate the changes.</p> <p>I'm curious, though, how important this really is in practice. In particular, if you've got a more complicated member (such as a collection), it can be very tempting to just make it public rather than make a bunch of methods to get the collection's keys, add/remove items from the collection, etc.</p> <p>Do you follow the rule in general? Does your answer change depending on whether it's code written for yourself vs. to be used by others? Are there more subtle reasons I'm missing for this obfuscation?</p>
[ { "answer_id": 99703, "author": "SCdF", "author_id": 1666, "author_profile": "https://Stackoverflow.com/users/1666", "pm_score": 0, "selected": false, "text": "private Foo foo;\npublic Foo getFoo() {}\npublic void setFoo(Foo foo) {}\n" }, { "answer_id": 99751, "author": "Mike...
2008/09/19
[ "https://Stackoverflow.com/questions/99688", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18210/" ]
99,732
<p>Using reflection in .Net, what is the differnce between:</p> <pre><code> if (foo.IsAssignableFrom(typeof(IBar))) </code></pre> <p>And</p> <pre><code> if (foo.GetInterface(typeof(IBar).FullName) != null) </code></pre> <p>Which is more appropriate, why?<br></p> <p>When could one or the other fail?</p>
[ { "answer_id": 45838091, "author": "Holf", "author_id": 169334, "author_profile": "https://Stackoverflow.com/users/169334", "pm_score": 1, "selected": false, "text": "public interface IFoo\n{\n} \n\ninternal class Foo: IFoo\n{\n}\n" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/99732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14484/" ]
99,755
<p>When working on a linx CShell u get the option to press the up / down arrows to select the last command/s typed or the Command Buffer. This even works on Windows.</p> <p>However this is not functional when working on Solaris, to which i recently switched. I am guessing that the shell is also a CShell. </p> <p>Please tell me what key combination is required to have this feature on Solaris ?</p>
[ { "answer_id": 100729, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stackoverflow.com/users/4203", "pm_score": 2, "selected": false, "text": "sh" }, { "answer_id": 34173265, "author": "Sami Onur Zaim", "author_id": 2765700, "author_profile": "ht...
2008/09/19
[ "https://Stackoverflow.com/questions/99755", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
99,781
<p>I have a client that is asking me to give them a listing of every file and folder in the source code (and then a brief explanation of the source tree). Is there an easy way to create some sort of decently formatted list like this from a subversion repository?</p>
[ { "answer_id": 99797, "author": "Thomas", "author_id": 14637, "author_profile": "https://Stackoverflow.com/users/14637", "pm_score": 1, "selected": false, "text": "cd" }, { "answer_id": 99810, "author": "Alan Storm", "author_id": 4668, "author_profile": "https://Stack...
2008/09/19
[ "https://Stackoverflow.com/questions/99781", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1486/" ]
99,807
<p>Macs are renowned (or bemoaned) for having an extensive number of shortcuts. However, OS X itself pales in comparison to the shortcut lists in <a href="http://macromates.com/" rel="noreferrer">TextMate</a> and its bundles.</p> <p>What are some useful keyboard shortcuts you use?</p>
[ { "answer_id": 100528, "author": "Matt", "author_id": 15368, "author_profile": "https://Stackoverflow.com/users/15368", "pm_score": 3, "selected": false, "text": "if⇥" }, { "answer_id": 2646864, "author": "Agos", "author_id": 107613, "author_profile": "https://Stackov...
2008/09/19
[ "https://Stackoverflow.com/questions/99807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1167846/" ]
99,827
<p>I'm interested in tracing database calls made by LINQ to SQL back to the .NET code that generated the call. For instance, a DBA might have a concern that a particular cached execution plan is doing poorly. If for example a DBA were to tell a developer to address the following code...</p> <pre><code>exec sp_executesql N'SELECT [t0].[CustomerID] FROM [dbo].[Customers] AS [t0] WHERE [t0].[ContactName] LIKE @p0 ORDER BY [t0].[CompanyName]', 'N'@p0 nvarchar(2)',@p0=N'c%' </code></pre> <p>...it's not immediately obvious which LINQ statement produced the call. Sure you could search through the "Customers" class in the auto-generated data context, but that'd just be a start. With a large application this could quickly become unmanageable.</p> <p>Is there a way to attach an ID or label to SQL code generated and executed by LINQ to SQL? Thinking out loud, here's an extension function called "TagWith" that illustrates conceptually what I'm interested in doing.</p> <pre><code>var customers = from c in context.Customers where c.CompanyName.StartsWith("c") orderby c.CompanyName select c.CustomerID; foreach (var CustomerID in customers.TagWith("CustomerList4")) { Console.WriteLine(CustomerID); } </code></pre> <p>If the "CustomerList4" ID/label ends up in the automatically-generated SQL, I'd be set. Thanks.</p>
[ { "answer_id": 100528, "author": "Matt", "author_id": 15368, "author_profile": "https://Stackoverflow.com/users/15368", "pm_score": 3, "selected": false, "text": "if⇥" }, { "answer_id": 2646864, "author": "Agos", "author_id": 107613, "author_profile": "https://Stackov...
2008/09/19
[ "https://Stackoverflow.com/questions/99827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1360388/" ]
99,866
<p>I'm at the beginning/middle of a project that we chose to implement using GWT. Has anyone encountered any major pitfalls in using GWT (and GWT-EXT) that were unable to be overcome? How about from a performance perspective?</p> <p>A couple things that we've seen/heard already include:</p> <ul> <li>Google not being able to index content</li> <li>CSS and styling in general seems to be a bit flaky</li> </ul> <p>Looking for any additional feedback on these items as well. Thanks!</p>
[ { "answer_id": 99977, "author": "rustyshelf", "author_id": 6044, "author_profile": "https://Stackoverflow.com/users/6044", "pm_score": 9, "selected": true, "text": "<set-property name=\"user.agent\" value=\"gecko1_8\" />\n" }, { "answer_id": 104641, "author": "jgindin", "...
2008/09/19
[ "https://Stackoverflow.com/questions/99866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18402/" ]
99,876
<p>I just wanted some opinions from people that have run Selenium (<a href="http://selenium.openqa.org" rel="nofollow noreferrer">http://selenium.openqa.org</a>) I have had a lot of experience with WaTiN and even wrote a recording suite for it. I had it producing some well-structured code but being only maintained by me it seems my company all but abandoned it. </p> <p>If you have run selenium have you had a lot of success? </p> <p>I will be using .NET 3.5, does Selenium work well with it? </p> <p>Is the code produced clean or simply a list of all the interaction? (<a href="http://blogs.conchango.com/richardgriffin/archive/2006/11/14/Testing-Design-Pattern-for-using-WATiR_2F00_N.aspx" rel="nofollow noreferrer">http://blogs.conchango.com/richardgriffin/archive/2006/11/14/Testing-Design-Pattern-for-using-WATiR_2F00_N.aspx</a>) </p> <p>How well does the distributed testing suite fair?</p> <p>Any other gripes or compliments on the system would be greatly appreciated!</p>
[ { "answer_id": 99965, "author": "marcospereira", "author_id": 4600, "author_profile": "https://Stackoverflow.com/users/4600", "pm_score": 6, "selected": true, "text": "public class GoogleTest {\n\n private Selenium selenium;\n\n @Before\n public void setUp() throws Exception {\n...
2008/09/19
[ "https://Stackoverflow.com/questions/99876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13688/" ]
99,880
<p>I need to write a function that generates an id that is unique for a given machine running a Windows OS.</p> <p>Currently, I'm using WMI to query various hardware parameters and concatenate them together and hash them to derive the unique id. My question is, what are the suggested parameters I should use? Currently, I'm using a combination of bios\cpu\disk data to generate the unique id. And am using the first result if multiple results are there for each metric.</p> <p>However, I ran into an issue where a machine that dual boots into 2 different Windows OS generates different site codes on each OS, which should ideally not happen.</p> <p>For reference, these are the metrics I'm currently using:</p> <pre><code>Win32_Processor:UniqueID,ProcessorID,Name,Manufacturer,MaxClockSpeed Win32_BIOS:Manufacturer Win32_BIOS:SMBIOSBIOSVersion,IdentificationCode,SerialNumber,ReleaseDate,Version Win32_DiskDrive:Model, Manufacturer, Signature, TotalHeads Win32_BaseBoard:Model, Manufacturer, Name, SerialNumber Win32_VideoController:DriverVersion, Name </code></pre>
[ { "answer_id": 114949, "author": "Jonas Engström", "author_id": 7634, "author_profile": "https://Stackoverflow.com/users/7634", "pm_score": 6, "selected": true, "text": "EnumSystemFirmwareEntries" }, { "answer_id": 289806, "author": "AngelBlaZe", "author_id": 24252, "...
2008/09/19
[ "https://Stackoverflow.com/questions/99880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/618/" ]
99,907
<ol> <li>In the application we have something about 30 types of objects that are created repeatedly. </li> <li>Some of them have long life (hours) some have short (milliseconds). </li> <li>Objects could be created in one thread and destroyed in another.</li> </ol> <p>Does anybody have any clue what could be good pooling technique in the sense of minimal creation/destruction latency, low lock contention and reasonable memory utilization?</p> <p>Append 1.</p> <p>1.1. Object pool/memory allocations for one type usually is not related to another type (see 1.3 for an exception)</p> <p>1.2. Memory allocation is performed for only one type (class) at time, usually for several objects at time. </p> <p>1.3. If a type aggregates another type using pointer (for some reason) these types allocated together in the one continuous piece of memory.</p> <p>Append 2.</p> <p>2.1. Using a collection with access serialization per type is known to be worse than new/delete.</p> <p>2.2. Application is used on different platforms/compilers and cannot use compiler/platform specific tricks.</p> <p>Append 3.</p> <p>It becomes obvious that the fastest (with lowest latency) implementation should organize object pooling as star-like factories network. Where the central factory is global for other thread specific factories. Regular object provision/recycling is more effective to do in a thread specific factory while the central factory could be used for object balancing between threads. </p> <p>3.1. What is the most effective way to organize communications between the central factory and thread specific factories? </p>
[ { "answer_id": 100204, "author": "Mladen Janković", "author_id": 6300, "author_profile": "https://Stackoverflow.com/users/6300", "pm_score": 0, "selected": false, "text": "Object* ObjectPool::AcquireObject()\n{\n Object* object = 0;\n lock( _stackLock );\n if( _stackIndex )\n ...
2008/09/19
[ "https://Stackoverflow.com/questions/99907", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18547/" ]
99,912
<p>I am trying to use directory services to add a directory entry to an openldap server. The examples I have seen look pretty simple, but I keep getting the error "There is an naming violation". What does this message mean? How do I resolve it?</p> <p>I have included the code, ldif file used to create the person container.</p> <pre><code>Public Function Ldap_Store_Manual_Registration(ByVal userName As String, ByVal firstMiddleName As String, ByVal lastName As String, ByVal password As String) Dim entry As DirectoryEntry = OpenLDAPconnection() 'OpenLDAPconnection() is DirectoryEntry(domainName, userId, password, AuthenticationTypes.SecureSocketsLayer) ) Dim newUser As DirectoryEntry newUser = entry.Children.Add("ou=alumni", "organizationalUnit") 'also try with newUser = entry.Children.Add("ou=alumni,o=xxxx", "organizationalUnit") , also not working SetADProperty(newUser, "objectClass", "organizationalPerson") SetADProperty(newUser, "objectClass", "person") SetADProperty(newUser, "cn", userName) SetADProperty(newUser, "sn", userName) newUser.CommitChanges() End Function Public Shared Sub SetADProperty(ByVal de As DirectoryEntry, _ ByVal pName As String, ByVal pValue As String) 'First make sure the property value isnt "nothing" If Not pValue Is Nothing Then 'Check to see if the DirectoryEntry contains this property already If de.Properties.Contains(pName) Then 'The DE contains this property 'Update the properties value de.Properties(pName)(0) = pValue Else 'Property doesnt exist 'Add the property and set it's value de.Properties(pName).Add(pValue) End If End If End Sub </code></pre> <p>The ldif file:</p> <pre><code>version: 1 dn: cn=test3,ou=alumni,o=unimelb objectClass: organizationalPerson objectClass: person objectClass: top cn: test3 sn: test3 </code></pre>
[ { "answer_id": 104942, "author": "Michael", "author_id": 13379, "author_profile": "https://Stackoverflow.com/users/13379", "pm_score": 1, "selected": false, "text": "SetADProperty(newUser, \"objectClass\", \"top\")\n" }, { "answer_id": 1195895, "author": "mellamokb", "aut...
2008/09/19
[ "https://Stackoverflow.com/questions/99912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
99,917
<p>So I was reading these Asp.Net <a href="http://www.hanselman.com/blog/ASPNETInterviewQuestions.aspx" rel="nofollow noreferrer">interview questions</a> at Scott Hanselman's blog and I came across this question. Can anyone shed some light of what he's talking about.</p>
[ { "answer_id": 100102, "author": "WebDude", "author_id": 15360, "author_profile": "https://Stackoverflow.com/users/15360", "pm_score": 0, "selected": false, "text": "ClientScript" }, { "answer_id": 100431, "author": "sontek", "author_id": 17176, "author_profile": "htt...
2008/09/19
[ "https://Stackoverflow.com/questions/99917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1688440/" ]
99,927
<p>Can someone provide an explanation of variable scope in JS as it applies to objects, functions and closures? </p>
[ { "answer_id": 101089, "author": "AnthonyWJones", "author_id": 17516, "author_profile": "https://Stackoverflow.com/users/17516", "pm_score": 6, "selected": true, "text": "var x = 1;\n" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/99927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56663/" ]
100,003
<p>What are metaclasses? What are they used for?</p>
[ { "answer_id": 100037, "author": "Jerub", "author_id": 14648, "author_profile": "https://Stackoverflow.com/users/14648", "pm_score": 9, "selected": false, "text": "class type(object)\n | type(object) -> the object's type\n | type(name, bases, dict) -> a new type\n" }, { "answ...
2008/09/19
[ "https://Stackoverflow.com/questions/100003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9951/" ]
100,007
<p>When logging with Log4Net it's very easy to put class that called the log into the log file. I've found in the past that this makes it very easy to trace through the code and see the flow through the classes. In Log4Net I use the %logger property in the conversion pattern like so: </p> <pre><code>&lt;conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" /&gt; </code></pre> <p>And this gives me the output I want: </p> <p><code>2008-09-19 15:40:26,906 [3132] ERROR &lt;b&gt;Log4NetTechDemo.Tester&lt;/b&gt; [(null)] - Failed method</code></p> <p>You can see from the output that the class that has called the log is Log4NetTechDemo.Tester, so I can trace the error back to that class quite easily.</p> <p>In the Logging Applicaton Block I cannot figure out how to do this with a simple log call. Does anyone know how it can be done? If so, an example or steps to do so would be very helpful.</p>
[ { "answer_id": 100075, "author": "Tom Carr", "author_id": 14954, "author_profile": "https://Stackoverflow.com/users/14954", "pm_score": 1, "selected": false, "text": " StackTrace trace = new StackTrace(ex, true);\n StackFrame frame = trace.GetFrame(0);\n" }, { "answer_id": 100961...
2008/09/19
[ "https://Stackoverflow.com/questions/100007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11908/" ]
100,038
<p>How can I make a Facebook RSS application that autoupdates from the provided RSS feeds. Of course doing this is trivial for canvas applications, but I need this for showing on the Facebook Page. All the RSS apps I've taken a look at either dont update or dont work on Facebook Pages. </p> <p>Especially now that infinite session keys are deprecated (and maybe even forbidden). </p>
[ { "answer_id": 100598, "author": "Josh", "author_id": 10902, "author_profile": "https://Stackoverflow.com/users/10902", "pm_score": 0, "selected": false, "text": "fb:ref" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/100038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18219/" ]
100,045
<p>What is a good regular expression that can validate a text string to make sure it is a valid Windows filename? (AKA not have <code>\/:*?"&lt;&gt;|</code> characters).</p> <p>I'd like to use it like the following:</p> <pre><code>// Return true if string is invalid. if (Regex.IsMatch(szFileName, "&lt;your regex string&gt;")) { // Tell user to reformat their filename. } </code></pre>
[ { "answer_id": 100066, "author": "Isak Savo", "author_id": 8521, "author_profile": "https://Stackoverflow.com/users/8521", "pm_score": 7, "selected": true, "text": "if (proposedFilename.IndexOfAny(System.IO.Path.GetInvalidFileNameChars()) != -1)\n{\n MessageBox.Show(\"The filename is in...
2008/09/19
[ "https://Stackoverflow.com/questions/100045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13115/" ]
100,048
<p>I have two unsorted lists and I need to produce another list which is sorted and where all the elements are unique.</p> <p>The elements can occur multiple times in both lists and they are originally unsorted.</p> <p>My function looks like this:</p> <pre><code>(defun merge-lists (list-a list-b sort-fn) "Merges two lists of (x, y) coordinates sorting them and removing dupes" (let ((prev nil)) (remove-if (lambda (point) (let ((ret-val (equal point prev))) (setf prev point) ret-val)) (sort (merge 'list list-a list-b sort-fn) ;' sort-fn)))) </code></pre> <p>Is there a better way to achieve the same?</p> <p>Sample call:</p> <pre><code>[CL]&gt; (merge-lists '(9 8 4 8 9 7 2) '(1 7 3 9 2 6) #'&gt;) ==&gt; (9 8 7 6 4 3 2 1) </code></pre>
[ { "answer_id": 100109, "author": "Antti Rasinen", "author_id": 8570, "author_profile": "https://Stackoverflow.com/users/8570", "pm_score": 5, "selected": true, "text": "(defun merge-lists (list-a list-b sort-fn test-fn)\n (sort (remove-duplicates (append list-a list-b) :test test-fn) ...
2008/09/19
[ "https://Stackoverflow.com/questions/100048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7780/" ]
100,068
<p>I'd like to know if there's an easier way to insert a record if it doesn't already exist in a table. I'm still trying to build my LINQ to SQL skills. </p> <p>Here's what I've got, but it seems like there should be an easier way.</p> <pre><code>public static TEntity InsertIfNotExists&lt;TEntity&gt; ( DataContext db, Table&lt;TEntity&gt; table, Func&lt;TEntity,bool&gt; where, TEntity record ) where TEntity : class { TEntity existing = table.SingleOrDefault&lt;TEntity&gt;(where); if (existing != null) { return existing; } else { table.InsertOnSubmit(record); // Can't use table.Context.SubmitChanges() // 'cause it's read-only db.SubmitChanges(); } return record; } </code></pre>
[ { "answer_id": 100496, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 5, "selected": true, "text": "public static void InsertIfNotExists<TEntity>\n (this Table<TEntity> table,\n TEnt...
2008/09/19
[ "https://Stackoverflow.com/questions/100068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11574/" ]
100,081
<p>I have the following C# singleton pattern, is there any way of improving it? </p> <pre><code> public class Singleton&lt;T&gt; where T : class, new() { private static object _syncobj = new object(); private static volatile T _instance = null; public static T Instance { get { if (_instance == null) { lock (_syncobj) { if (_instance == null) { _instance = new T(); } } } return _instance; } } public Singleton() { } } </code></pre> <p>Preferred usage example: </p> <pre><code>class Foo : Singleton&lt;Foo&gt; { } </code></pre> <p><strong>Related</strong>: </p> <p><a href="https://stackoverflow.com/questions/953259/an-obvious-singleton-implementation-for-net">An obvious singleton implementation for .NET?</a></p>
[ { "answer_id": 100093, "author": "EggyBach", "author_id": 15475, "author_profile": "https://Stackoverflow.com/users/15475", "pm_score": 3, "selected": false, "text": "// Singleton PatternJudith Bishop Nov 2007\n// Generic version\n\npublic class Singleton<T> where T : class, new()\n{\n...
2008/09/19
[ "https://Stackoverflow.com/questions/100081", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17174/" ]
100,104
<p>I've written a small hello world test app in Silverlight which i want to host on a Linux/Apache2 server. I want the data to come from MySQL (or some other linux compatible db) so that I can databind to things in the db.</p> <p>I've managed to get it working by using the <a href="http://www.mysql.com/products/connector/net/" rel="nofollow noreferrer">MySQL Connector/.NET</a>:</p> <pre><code>MySqlConnection conn = new MySqlConnection("Server=the.server.com;Database=theDb;User=myUser;Password=myPassword;"); conn.Open(); MySqlCommand command = new MySqlCommand("SELECT * FROM test;", conn); using (MySqlDataReader reader = command.ExecuteReader()) { StringBuilder sb = new StringBuilder(); while (reader.Read()) { sb.AppendLine(reader.GetString("myColumn")); } this.txtResults.Text = sb.ToString(); } </code></pre> <p>This works fine if I give the published ClickOnce app full trust (or at least SocketPermission) and <strong>run it locally</strong>. </p> <p>I want this to run on the server and I can't get it to work, always ending up with permission exception (SocketPermission is not allowed).</p> <p>The database is hosted on the same server as the silverlight app if that makes any difference.</p> <p><strong>EDIT</strong> Ok, I now understand why it's a bad idea to have db credentials in the client app (obviously). How do people do this then? How do you secure the proxy web service so that it relays data to and from the client/db in a secure way? Are there any examples out there on the web?</p> <p>Surely, I cannot be the first person who'd like to use a database to power a silverlight application?</p>
[ { "answer_id": 5463132, "author": "angularsen", "author_id": 134761, "author_profile": "https://Stackoverflow.com/users/134761", "pm_score": 2, "selected": false, "text": "<ListBox x:Name=\"TestList\" Width=\"100\" />\n" }, { "answer_id": 20823112, "author": "mjb", "autho...
2008/09/19
[ "https://Stackoverflow.com/questions/100104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8521/" ]
100,106
<pre><code>sub foo {[$#{$_[!$||$|]}*@{$_[!!$_^!$_]}?@{$_[!$..!!$.]}[$_[@--@+]% @{$_[$==~/(?=)//!$`]}..$#{$_[$??!!$?:!$?]},($)?!$):!!$))..$_[$--$-]%@{ $_[$]/$]]}-(!!$++!$+)]:@{$_[!!$^^^!$^^]}]} </code></pre> <p>update: I thought the word "puzzle" would imply this, but: <em>I</em> know what it does - I wrote it. If the puzzle doesn't interest you, please don't waste any time on it.</p>
[ { "answer_id": 100503, "author": "nohat", "author_id": 3101, "author_profile": "https://Stackoverflow.com/users/3101", "pm_score": 3, "selected": false, "text": "sub foo {\n my ($list1, $list2) = @_;\n my @output;\n if (@$list2 > 0) {\n my $split = $list1 % @$list2;\n ...
2008/09/19
[ "https://Stackoverflow.com/questions/100106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17389/" ]
100,107
<p>I'm investigating the following <code>java.lang.VerifyError</code></p> <pre><code>java.lang.VerifyError: (class: be/post/ehr/wfm/application/serviceorganization/report/DisplayReportServlet, method: getMonthData signature: (IILjava/util/Collection;Ljava/util/Collection;Ljava/util/HashMap;Ljava/util/Collection;Ljava/util/Locale;Lorg/apache/struts/util/MessageRe˜̴MtÌ´MÚw€mçw€mp:”MŒŒ at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357) at java.lang.Class.getConstructor0(Class.java:2671) </code></pre> <p>It occurs when the jboss server in which the servlet is deployed is started. It is compiled with jdk-1.5.0_11 and I tried to recompile it with jdk-1.5.0_15 without succes. That is the compilation runs fine but when deployed, the java.lang.VerifyError occurs.</p> <p>When I changed the method name and got the following error:</p> <pre><code>java.lang.VerifyError: (class: be/post/ehr/wfm/application/serviceorganization/report/DisplayReportServlet, method: getMD signature: (IILjava/util/Collection;Lj ava/util/Collection;Ljava/util/HashMap;Ljava/util/Collection;Ljava/util/Locale;Lorg/apache/struts/util/MessageResources┬á├ÿ├àN|├ÿ├àN├Üw┬Çm├ºw┬ÇmX#├ûM|X├öM at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357 at java.lang.Class.getConstructor0(Class.java:2671) at java.lang.Class.newInstance0(Class.java:321) at java.lang.Class.newInstance(Class.java:303) </code></pre> <p>You can see that more of the method signature is shown.</p> <p>The actual method signature is</p> <pre><code> private PgasePdfTable getMonthData(int month, int year, Collection dayTypes, Collection calendarDays, HashMap bcSpecialDays, Collection activityPeriods, Locale locale, MessageResources resources) throws Exception { </code></pre> <p>I already tried looking at it with <code>javap</code> and that gives the method signature as it should be.</p> <p>When my other colleagues check out the code, compile it and deploy it, they have the same problem. When the build server picks up the code and deploys it on development or testing environments (HPUX), the same error occurs. Also an automated testing machine running Ubuntu shows the same error during server startup.</p> <p>The rest of the application runs okay, only that one servlet is out of order. Any ideas where to look would be helpful.</p>
[ { "answer_id": 100134, "author": "p3t0r", "author_id": 16685, "author_profile": "https://Stackoverflow.com/users/16685", "pm_score": 5, "selected": false, "text": "java.lang.VerifyError" }, { "answer_id": 101364, "author": "Alex Miller", "author_id": 7671, "author_pro...
2008/09/19
[ "https://Stackoverflow.com/questions/100107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15490/" ]
100,123
<p>I would like to create an application wide keyboard shortcut for a Java Swing application. Looping over all components and adding the shortcut on each, has focus related side effects, and seems like a brute force solution.</p> <p>Anyone has a cleaner solution?</p>
[ { "answer_id": 100754, "author": "Tom Hawtin - tackline", "author_id": 4725, "author_profile": "https://Stackoverflow.com/users/4725", "pm_score": 5, "selected": false, "text": "JComponent.registerKeyboardAction" }, { "answer_id": 8485642, "author": "daniel kullmann", "au...
2008/09/19
[ "https://Stackoverflow.com/questions/100123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18591/" ]
100,161
<p>I was happily using Eclipse 3.2 (or as happy as one can be using Eclipse) when for a forgotten reason I decided to upgrade to 3.4. I'm primarily using PyDev, Aptana, and Subclipse, very little Java development.</p> <p>I've noticed 3.4 tends to really give my laptop a hernia compared to 3.2 (vista, core2duo, 2G). Is memory usage on 3.4 actually higher than on 3.2, and if so is there a way to reduce it?</p> <p>EDIT: I tried disabling plugins (I didn't have much enabled anyway) and used the jvm monitor; the latter was interesting but I couldn't figure out how to use the info in any practical way. I'm still not able to reduce its memory footprint. I've also noticed every once in a while Eclipse just hangs for ~30 seconds, then magically comes back.</p>
[ { "answer_id": 100180, "author": "Drejc", "author_id": 6482, "author_profile": "https://Stackoverflow.com/users/6482", "pm_score": 2, "selected": false, "text": "-vmargs -XX:MaxPermSize=1024M -Xms256M -Xmx1024M\n" }, { "answer_id": 101164, "author": "VonC", "author_id": 6...
2008/09/19
[ "https://Stackoverflow.com/questions/100161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13055/" ]
100,170
<p>I have a folder on my server to which I had a number of symbolic links pointing. I've since created a new folder and I want to change all those symbolic links to point to the new folder. I'd considered replacing the original folder with a symlink to the new folder, but it seems that if I continued with that practice it could get very messy very fast.</p> <p>What I've been doing is manually changing the symlinks to point to the new folder, but I may have missed a couple. </p> <p>Is there a way to check if there are any symlinks pointing to a particular folder?</p>
[ { "answer_id": 100200, "author": "skymt", "author_id": 18370, "author_profile": "https://Stackoverflow.com/users/18370", "pm_score": 7, "selected": true, "text": "find . -lname /particular/folder\n" }, { "answer_id": 100203, "author": "bfabry", "author_id": 924607, "a...
2008/09/19
[ "https://Stackoverflow.com/questions/100170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
100,196
<p>What is the difference between the <a href="https://msdn.microsoft.com/en-us/library/z883w3dc(v=vs.110).aspx" rel="noreferrer">AddRange</a> and <a href="https://msdn.microsoft.com/en-us/library/bb302894(v=vs.110).aspx" rel="noreferrer">Concat</a> functions on a generic List? Is one recommended over the other?</p>
[ { "answer_id": 100239, "author": "AnthonyWJones", "author_id": 17516, "author_profile": "https://Stackoverflow.com/users/17516", "pm_score": 6, "selected": false, "text": "AddRange" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/100196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5302/" ]
100,210
<p>Given a <code>datetime.time</code> value in Python, is there a standard way to add an integer number of seconds to it, so that <code>11:34:59</code> + 3 = <code>11:35:02</code>, for example?</p> <p>These obvious ideas don't work:</p> <pre><code>&gt;&gt;&gt; datetime.time(11, 34, 59) + 3 TypeError: unsupported operand type(s) for +: 'datetime.time' and 'int' &gt;&gt;&gt; datetime.time(11, 34, 59) + datetime.timedelta(0, 3) TypeError: unsupported operand type(s) for +: 'datetime.time' and 'datetime.timedelta' &gt;&gt;&gt; datetime.time(11, 34, 59) + datetime.time(0, 0, 3) TypeError: unsupported operand type(s) for +: 'datetime.time' and 'datetime.time' </code></pre> <p>In the end I have written functions like this:</p> <pre><code>def add_secs_to_time(timeval, secs_to_add): secs = timeval.hour * 3600 + timeval.minute * 60 + timeval.second secs += secs_to_add return datetime.time(secs // 3600, (secs % 3600) // 60, secs % 60) </code></pre> <p>I can't help thinking that I'm missing an easier way to do this though.</p> <h3>Related</h3> <ul> <li><a href="https://stackoverflow.com/questions/656297/python-time-timedelta-equivalent">python time + timedelta equivalent</a></li> </ul>
[ { "answer_id": 100250, "author": "Nick Johnson", "author_id": 12030, "author_profile": "https://Stackoverflow.com/users/12030", "pm_score": 0, "selected": false, "text": "datetime.datetime" }, { "answer_id": 100345, "author": "paxdiablo", "author_id": 14860, "author_p...
2008/09/19
[ "https://Stackoverflow.com/questions/100210", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5536/" ]
100,211
<p>I just installed Glassfish V2 on my local machine just to play around with it.</p> <p>I was wondering if there is a way to retrieve a param passed in by the GET HTTP method.</p> <p>For instance,</p> <pre><code>http://localhost:8080/HelloWorld/resources/helloWorld?name=ABC </code></pre> <p>How do I retrieve the "name" param in my Java code?</p>
[ { "answer_id": 100396, "author": "tgdavies", "author_id": 11002, "author_profile": "https://Stackoverflow.com/users/11002", "pm_score": 3, "selected": true, "text": "@Path(\"/helloWorld\")\n@Consumes({\"application/xml\", \"application/json\"})\n@Produces({\"application/xml\", \"applicat...
2008/09/19
[ "https://Stackoverflow.com/questions/100211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4004/" ]
100,216
<p>I'm trying to integrate running Fitnesse tests from MSBuild im my nightly build on TFS.</p> <p>In an attempt to make it self contained I would like to start the seleniumRC server only when it's needed from fitness.</p> <p>I've seen that there is a "Command Line Fixture" but it's written in java can I use that?</p>
[ { "answer_id": 100647, "author": "Martin Woodward", "author_id": 6438, "author_profile": "https://Stackoverflow.com/users/6438", "pm_score": 2, "selected": true, "text": "Process process = Process.GetProcessById(ProcessId);\nprocess.Kill();\n" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/100216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11434/" ]
100,221
<p>Whilst refactoring some old code I realised that a particular header file was full of function declarations for functions long since removed from the .cpp file. Does anyone know of a tool that could find (and strip) these automatically?</p>
[ { "answer_id": 647548, "author": "zhaorufei", "author_id": 64469, "author_profile": "https://Stackoverflow.com/users/64469", "pm_score": 2, "selected": false, "text": "void foo(int );\n\nint main()\n{\n return 0;\n}\n" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/100221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9236/" ]
100,228
<p>I'm trying to set up part of a schema that's like a "Sequence" where all child elements are optional, but at least one of the elements <strong>must</strong> be present, and there could be more than one of them.</p> <p>I tried doing the following, but XMLSpy complains that "The content model contains the elements &lt;element name="DateConstant"&gt; and &lt;element name="DateConstant"&gt; which cannot be uniquely determined.":</p> <pre><code> &lt;xs:choice&gt; &lt;xs:sequence&gt; &lt;xs:element name="DateConstant"/&gt; &lt;xs:element name="TimeConstant"/&gt; &lt;/xs:sequence&gt; &lt;xs:element name="DateConstant"/&gt; &lt;xs:element name="TimeConstant"/&gt; &lt;/xs:choice&gt; </code></pre> <p>Can this be done (and if so, how)?</p> <p>Some clarification: I only want to allow one of each element of the same name. There can be one "DateConstant" and/or one "TimeConstant", but not two of either. Gizmo's answer matches my requirements, but it's impractical for a larger number of elements. Hurst's answer allows two or more elements of the same name, which I don't want.</p>
[ { "answer_id": 100313, "author": "gizmo", "author_id": 9396, "author_profile": "https://Stackoverflow.com/users/9396", "pm_score": 6, "selected": true, "text": "<xs:choice>\n <xs:sequence>\n <xs:element name=\"Elem1\" />\n <xs:element name=\"Elem2\" minOccurs=\"0\" />\n <xs:ele...
2008/09/19
[ "https://Stackoverflow.com/questions/100228", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18603/" ]
100,235
<p>For an open source project I am looking for a good, simple implementation of a Dictionary that is backed by a file. Meaning, if an application crashes or restarts the dictionary will keep its state. I would like it to update the underlying file every time the dictionary is touched. (Add a value or remove a value). A FileWatcher is not required but it could be useful. </p> <pre><code>class PersistentDictionary&lt;T,V&gt; : IDictionary&lt;T,V&gt; { public PersistentDictionary(string filename) { } } </code></pre> <p>Requirements: </p> <ul> <li>Open Source, with no dependency on native code (no sqlite) </li> <li>Ideally a very short and simple implementation</li> <li>When setting or clearing a value it should not re-write the entire underlying file, instead it should seek to the position in the file and update the value.</li> </ul> <p><strong>Similar Questions</strong> </p> <ul> <li><a href="https://stackoverflow.com/questions/108435/persistent-binary-tree-hash-table-in-net">Persistent Binary Tree / Hash table in .Net</a></li> <li><a href="https://stackoverflow.com/questions/408401/disk-backed-dictionary-cache-for-c">Disk backed dictionary/cache for c#</a></li> <li><a href="http://izlooite.blogspot.com/2011/04/persistent-dictionary.html" rel="noreferrer"><code>PersistentDictionary&lt;Key,Value&gt;</code></a></li> </ul>
[ { "answer_id": 176561, "author": "Omer van Kloeten", "author_id": 4979, "author_profile": "https://Stackoverflow.com/users/4979", "pm_score": 0, "selected": false, "text": "BinaryWriter" }, { "answer_id": 482984, "author": "lubos hasko", "author_id": 275, "author_prof...
2008/09/19
[ "https://Stackoverflow.com/questions/100235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17174/" ]
100,236
<p>How can I insert ASCII special characters (e.g. with the ASCII value 0x01) into a string?</p> <p>I ask because I am using the following:</p> <pre><code>str.Replace( "&lt;TAG1&gt;", Convert.ToChar(0x01).ToString() ); </code></pre> <p>and I feel that there must be a better way than this. Any Ideas?</p> <p>Update:</p> <p>Also If I use this methodology, do I need to worry about unicode &amp; ASCII clashing?</p>
[ { "answer_id": 100244, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 4, "selected": true, "text": "\\uXXXX" }, { "answer_id": 1176383, "author": "bzlm", "author_id": 7724, "author_profile": "https://Stack...
2008/09/19
[ "https://Stackoverflow.com/questions/100236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1816/" ]
100,242
<p>You can use </p> <p>SelectFolder() to get a folder</p> <p>or </p> <p>GetOpenFolderitem(filter as string) to get files</p> <p>but can you select either a folder or file? ( or for that matter selecting multiple files )</p>
[ { "answer_id": 170102, "author": "Philip Regan", "author_id": 11976, "author_profile": "https://Stackoverflow.com/users/11976", "pm_score": 4, "selected": true, "text": "OpenDialogMBS.AllowFolderSelection as Boolean\nproperty, Navigation, MBS Util Plugin (OpenDialog), class OpenDialogMBS...
2008/09/19
[ "https://Stackoverflow.com/questions/100242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10472/" ]
100,247
<p>I'm using C# in .Net 2.0, and I want to read in a PNG image file and check for the first row and first column that has non-transparent pixels. </p> <p>What assembly and/or class should I use?</p>
[ { "answer_id": 100293, "author": "Pavel Chuchuva", "author_id": 14131, "author_profile": "https://Stackoverflow.com/users/14131", "pm_score": 6, "selected": true, "text": "Bitmap bitmap = new Bitmap(@\"C:\\image.png\");\nColor clr = bitmap.GetPixel(0, 0);\n" }, { "answer_id": 320...
2008/09/19
[ "https://Stackoverflow.com/questions/100247", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18494/" ]
100,248
<p>AFAIK one of the objectives of Stack Overflow is to make sure anyone can come here and find <b>good</b> answers to her Perl related questions. Certainly beginners would ask what is the <a href="https://stackoverflow.com/questions/70573/best-online-%0Asource-to-learn-perl">best online source to learn Perl</a> but others might just want to ask a question.</p> <p>Probably the friendliest place is the <a href="http://perlmonks.org/" rel="nofollow noreferrer">Monastery of Perl Monks</a>. It is a web site with a rating system similar to but more simple than Stack Overflow. You can find lots of good answers there and if you don't find an answer you can always ask.</p> <p>The other big resource would be the mailing list of your local <a href="http://www.pm.org/" rel="nofollow noreferrer">Perl Mongers</a> group.</p> <p>Where do <b>you</b> go when you are looking for an answer to a Perl related question?</p>
[ { "answer_id": 105094, "author": "Drew Stephens", "author_id": 17339, "author_profile": "https://Stackoverflow.com/users/17339", "pm_score": 3, "selected": false, "text": "pd" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/100248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11827/" ]
100,280
<p>Has any one done this before? It would seem to me that there should be a webservice but i can't find one. I am writing an application for personal use that would just show basic info from IMDB.</p>
[ { "answer_id": 109478, "author": "Nescio", "author_id": 14484, "author_profile": "https://Stackoverflow.com/users/14484", "pm_score": 3, "selected": false, "text": "private const string UglyMovieRegex = \"(?<=5>|3>)(Cast|Director:|Fun\\\\sStuff|Genre:|Plot:|Runtime:|Tagline:|Writers:)\"\...
2008/09/19
[ "https://Stackoverflow.com/questions/100280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5235/" ]
100,284
<p>I'm using the .NET TWAIN code from <a href="http://www.codeproject.com/KB/dotnet/twaindotnet.aspx?msg=1007385#xx1007385xx" rel="nofollow noreferrer">http://www.codeproject.com/KB/dotnet/twaindotnet.aspx?msg=1007385#xx1007385xx</a> in my application. When I try to scan an image when the scanner is not plugged in, the application freezes.</p> <p>How can I check if the device is plugged in, using the TWAIN driver?</p>
[ { "answer_id": 156690, "author": "Veldmuis", "author_id": 18826, "author_profile": "https://Stackoverflow.com/users/18826", "pm_score": 2, "selected": false, "text": "enum AcquireResult\n{\n OK = 0,\n InitFailed = 1,\n DeviceIDFailed = 2,\n CapabilityFailed = 3,\n UserInte...
2008/09/19
[ "https://Stackoverflow.com/questions/100284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17465/" ]
100,291
<p>Imagine I have an function which goes through one million/billion strings and checks smth in them.</p> <p>f.ex:</p> <pre><code>foreach (String item in ListOfStrings) { result.add(CalculateSmth(item)); } </code></pre> <p>it consumes lot's of time, because CalculateSmth is very time consuming function.</p> <p>I want to ask: how to integrate multithreading in this kinda process?</p> <p>f.ex: I want to fire-up 5 threads and each of them returns some results, and thats goes-on till the list has items.</p> <p>Maybe anyone can show some examples or articles.. </p> <p>Forgot to mention I need it in .NET 2.0</p>
[ { "answer_id": 100307, "author": "Tobi", "author_id": 5422, "author_profile": "https://Stackoverflow.com/users/5422", "pm_score": 5, "selected": true, "text": "Parallel.Foreach (ListOfStrings, (item) => \n result.add(CalculateSmth(item));\n);\n" }, { "answer_id": 100352, "...
2008/09/19
[ "https://Stackoverflow.com/questions/100291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5369/" ]
100,298
<p>I have a large source repository split across multiple projects. I would like to produce a report about the health of the source code, identifying problem areas that need to be addressed.</p> <p>Specifically, I'd like to call out routines with a high cyclomatic complexity, identify repetition, and perhaps run some lint-like static analysis to spot suspicious (and thus likely erroneous) constructs.</p> <p>How might I go about constructing such a report?</p>
[ { "answer_id": 14793812, "author": "Dave Halter", "author_id": 552671, "author_profile": "https://Stackoverflow.com/users/552671", "pm_score": 5, "selected": false, "text": "radon" }, { "answer_id": 39937878, "author": "Asclepius", "author_id": 832230, "author_profile...
2008/09/19
[ "https://Stackoverflow.com/questions/100298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14648/" ]
100,304
<p>I'm facing a problem on the Win32 API. I have a program that, when it handles <code>WM_PAINT</code> messages, it calls <code>BeginPaint</code> to clip the region and validate the update region, but the <code>BeginPaint</code> function is always generating a <code>WM_NCPAINT</code> message with the same update region, even if the touched part that needs repainting is only inside the client region. </p> <p>Do anyone has any clue why this is happening? It's on child windows with the <code>WS_CHILD</code> style.</p>
[ { "answer_id": 100340, "author": "prakash", "author_id": 123, "author_profile": "https://Stackoverflow.com/users/123", "pm_score": 0, "selected": false, "text": "WM_NCPAINT" }, { "answer_id": 100412, "author": "Edwin Jarvis", "author_id": 18623, "author_profile": "htt...
2008/09/19
[ "https://Stackoverflow.com/questions/100304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18623/" ]
100,332
<p>I'm trying to decide on the best way to store event times in a MySQL database. These should be as flexible as possible and be able to represent "single events" (starts at a certain time, does not necessarily need an end time), "all day" and "multi day" events, repeating events, repeating all day events, possibly "3rd Saturday of the month" type events etc.</p> <p>Please suggest some tried and proven database schemes.</p>
[ { "answer_id": 100453, "author": "boes", "author_id": 17746, "author_profile": "https://Stackoverflow.com/users/17746", "pm_score": 1, "selected": false, "text": "create table repeatevent (\nid int not null auto_increment, \ntype int, // 0: daily, 1:weekly, 2: monthly, ....\nstarttime da...
2008/09/19
[ "https://Stackoverflow.com/questions/100332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/476/" ]
100,333
<p>How can you programmatically measure per-process (or better, per-thread) CPU usage under windows 95, windows 98 and windows ME?</p> <p>If it requires the DDK, where can you obtain that?</p> <p>Please note the <strong>Win9x requirement</strong>. It's easy on NT.</p> <p>EDIT: I tried installing the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=98a4c5ba-337b-4e92-8c18-a63847760ea5&amp;displaylang=en" rel="nofollow noreferrer">Win95/98 version of WMI</a>, but <a href="http://msdn.microsoft.com/en-us/library/aa394372(VS.85).aspx" rel="nofollow noreferrer">Win32_Process</a>.<code>KernelModeTime</code> and <code>Win32_Process.UserModeTime</code> return <code>Null</code> (as do most <code>Win32_Process</code> properties under win9x).</p>
[ { "answer_id": 100453, "author": "boes", "author_id": 17746, "author_profile": "https://Stackoverflow.com/users/17746", "pm_score": 1, "selected": false, "text": "create table repeatevent (\nid int not null auto_increment, \ntype int, // 0: daily, 1:weekly, 2: monthly, ....\nstarttime da...
2008/09/19
[ "https://Stackoverflow.com/questions/100333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15069/" ]
100,365
<p>In cake 1.2 there is a feature that allows the developer to no have to create models, but rather have cake do the detective work at run time and create the model for you. This process happens each time and is neat but in my case very hazardous. I read about this somewhere and now I'm experiencing the bad side of this.</p> <p>I've created a plugin with all the files and everything appeared to be just great. That is until i tried to use some of the model's associations and functions. Then cake claims that this model i've created doesn't exist. <strong>I've narrowed it down to cake using this auto model feature instead of throwing and error</strong>! So i have no idea what's wrong!</p> <p>Does anybody know how to disable this auto model feature? It's a good thought, but I can't seem to find where i've gone wrong with my plugin and an error would be very helpful!</p>
[ { "answer_id": 100442, "author": "Mladen Mihajlovic", "author_id": 11421, "author_profile": "https://Stackoverflow.com/users/11421", "pm_score": 1, "selected": false, "text": "var $useTable = false;\n" }, { "answer_id": 106985, "author": "SeanDowney", "author_id": 5261, ...
2008/09/19
[ "https://Stackoverflow.com/questions/100365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5261/" ]
100,376
<p>Anyone know how to do picture overlay or appear on top of each other in HTML? The effect will be something like the marker/icon appear on Google Map where the user can specify the coordinate of the second picture appear on the first picture.</p> <p>Thanks.</p>
[ { "answer_id": 100417, "author": "Johannes Hädrich", "author_id": 18246, "author_profile": "https://Stackoverflow.com/users/18246", "pm_score": 6, "selected": true, "text": "<div>" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/100376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14790/" ]
100,411
<p>I have two webapplication, one is a simple authenticationsite which can authenticate the logged in user and <strong>redirects</strong> him then to another site.</p> <p>Therefore I have to pass ther userId (GUID) to the second application. Currently this is done via the URL but i would like to hide this id.</p> <p>Has anybody an idea how to do this properly?</p> <p>[EDIT]: I can't use the Session because of the ApplicationBoundaries (2 different Servers)</p>
[ { "answer_id": 144624, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 2, "selected": false, "text": "using System;\nusing System.Web;\nusing System.Web.Services;\nusing System.Web.Services.Protocols;\n\n[WebService(Namespace ...
2008/09/19
[ "https://Stackoverflow.com/questions/100411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17558/" ]
100,415
<p>I'm looking for an open source, cross platform (Windows &amp; Linux at least) command line tool to take some code (C++, but multiple languages would be sweet), and spit out valid a XHTML representation of that code, with syntax highlighting included.</p> <p>Ideally the XHTML should just wrap the code with <code>&lt;span&gt;</code> and <code>&lt;div&gt;</code> tags with different classes so I can supply the CSS code and change the colouration, but that's an optional extra.</p> <p>Does anyone know of such an application?</p>
[ { "answer_id": 900463, "author": "Martin Geisler", "author_id": 110204, "author_profile": "https://Stackoverflow.com/users/110204", "pm_score": 4, "selected": true, "text": "<span>" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/100415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1304/" ]
100,416
<p>In SQL Server 2000/2005,</p> <p>Is it possible to force the default value to be written to already existing rows when adding a new column to a table <strong>without</strong> using NOT NULL on the new column?</p>
[ { "answer_id": 100560, "author": "chrisb", "author_id": 8262, "author_profile": "https://Stackoverflow.com/users/8262", "pm_score": 1, "selected": false, "text": "UPDATE MyTable SET NullCol = N'some_value' WHERE NullCol IS NULL\nALTER TABLE MyTable ALTER COLUMN NullCOl NVARCHAR(20) NOT N...
2008/09/19
[ "https://Stackoverflow.com/questions/100416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7241/" ]
100,420
<p>Visual Studio is such a massively big product that even after years of working with it I sometimes stumble upon a new/better way to do things or things I didn't even know were possible.</p> <p>For instance-</p> <ul> <li><p><kbd>Crtl</kbd> + <kbd>R</kbd>, <kbd>Ctrl</kbd> + <kbd>W</kbd> to show white spaces. Essential for editing Python build scripts.</p></li> <li><p>Under <code>"HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor"</code> Create a String called <a href="https://stackoverflow.com/questions/84209/vertical-line-after-a-certain-amount-characters-in-visual-studio">Guides</a> with the value "RGB(255,0,0), 80" to have a red line at column 80 in the text editor.</p></li> </ul> <p>What other hidden features have you stumbled upon?</p>
[ { "answer_id": 100445, "author": "Mark Glorie", "author_id": 952, "author_profile": "https://Stackoverflow.com/users/952", "pm_score": 6, "selected": false, "text": "CTRL-K, CTRL-D\n" }, { "answer_id": 100457, "author": "Aaron Powell", "author_id": 11388, "author_prof...
2008/09/19
[ "https://Stackoverflow.com/questions/100420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9611/" ]
100,435
<p>I'm using a ASP.NET menu control. I'd like the menu to look like this, where link 1 through 10 are in one sitemap file and link 11 through 20 in another. </p> <pre><code>root --link 1 (...) --link 10 --link 11 (...) --link 20 </code></pre> <p>However, sitemap file MUST have a root which I cannot seem to suppress.</p> <p>Any thoughts?</p> <p>-Edoode</p>
[ { "answer_id": 849136, "author": "Tim Scarborough", "author_id": 432226, "author_profile": "https://Stackoverflow.com/users/432226", "pm_score": 2, "selected": false, "text": "SiteMapDataSource ds = new SiteMapDataSource();\nds.SiteMapProvider = \"providername\";\nds.ShowStartingNode = f...
2008/09/19
[ "https://Stackoverflow.com/questions/100435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6399/" ]
100,444
<p>I'm trying to automate a gdb session using the <code>--command</code> flag. I'm trying to set a breakpoint on a function in a shared library (the Unix equivalent of a DLL) . My cmds.gdb looks like this:</p> <pre><code>set args /home/shlomi/conf/bugs/kde/font-break.txt b IA__FcFontMatch r </code></pre> <p>However, I'm getting the following:</p> <pre> shlomi:~/progs/bugs-external/kde/font-breaking$ gdb --command=cmds.gdb... GNU gdb 6.8-2mdv2009.0 (Mandriva Linux release 2009.0) Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "i586-mandriva-linux-gnu"... (no debugging symbols found) Function "IA__FcFontMatch" not defined. Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal] </pre> <p>So it doesn't set the breakpoint after all. How can I make it default to answer "y" to set breakpoints on pending future shared library load?</p> <p>I recall that I was able to do something, but cannot recall what.</p>
[ { "answer_id": 100501, "author": "Shlomi Fish", "author_id": 7709, "author_profile": "https://Stackoverflow.com/users/7709", "pm_score": 8, "selected": true, "text": "cmds.gdb" }, { "answer_id": 1123235, "author": "RandomNickName42", "author_id": 67819, "author_profil...
2008/09/19
[ "https://Stackoverflow.com/questions/100444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7709/" ]
100,454
<p>Does anybody know the logic behind making DataSourceSelectArguments sealed?</p> <p>I've implemented a custom DataSource (and related classes) for some custom business objects and custom WebControls. When thinking in filters (like in a grid) I discovered that the DataSourceSelectArguments is sealed. Surely, I'm missing something. (Maybe the logic is related to the fact that is nonsense to ask the DB again, just for filtering?, just a guess.)</p>
[ { "answer_id": 148825, "author": "paudirac", "author_id": 15554, "author_profile": "https://Stackoverflow.com/users/15554", "pm_score": 1, "selected": false, "text": "ListView" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/100454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15554/" ]
100,480
<p>I am looking for different ways to pause and resume programmatically a particular process via its process ID under Windows XP.</p> <p><a href="http://www.codeproject.com/KB/threads/pausep.aspx" rel="noreferrer">Process suspend/resume tool</a> does it with <code>SuspendThread</code> / <code>ResumeThread</code> but warns about multi-threaded programs and deadlock problems.</p> <p><a href="http://technet.microsoft.com/en-us/sysinternals/bb897540.aspx" rel="noreferrer">PsSuspend</a> looks okay, but I wonder if it does anything special about deadlocks or uses another method?</p> <p>Prefered languages : C++ / Python</p>
[ { "answer_id": 102214, "author": "bk1e", "author_id": 8090, "author_profile": "https://Stackoverflow.com/users/8090", "pm_score": 3, "selected": false, "text": "logger.exe" }, { "answer_id": 14053933, "author": "Hanan N.", "author_id": 963318, "author_profile": "https...
2008/09/19
[ "https://Stackoverflow.com/questions/100480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18648/" ]
100,504
<p>Say I have a table called myTable. What is the SQL command to return all of the field names of this table? If the answer is database specific then I need SQL Server right now but would be interested in seeing the solution for other database systems as well.</p>
[ { "answer_id": 100513, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 7, "selected": true, "text": "desc tablename\n" }, { "answer_id": 100515, "author": "Matt Howells", "author_id": 16881, "author...
2008/09/19
[ "https://Stackoverflow.com/questions/100504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1856916/" ]
100,533
<p>Is it possible to do like this:</p> <pre><code>interface IDBBase { DataTable getDataTableSql(DataTable curTable,IDbCommand cmd); ... } class DBBase : IDBBase { public DataTable getDataTableSql(DataTable curTable, SqlCommand cmd) { ... } } </code></pre> <p>I want to use the interface to implement to d/t providers (MS-SQL,Oracle...); in it there are some signatures to be implemented in the corresponding classes that implement it. I also tried like this:</p> <pre><code>genClass&lt;typeOj&gt; { typeOj instOj; public genClass(typeOj o) { instOj=o; } public typeOj getType() { return instOj; } </code></pre> <p>...</p> <pre><code>interface IDBBase { DataTable getDataTableSql(DataTable curTable,genClass&lt;idcommand&gt; cmd); ... } class DBBase : IDBBase { public DataTable getDataTableSql(DataTable curTable, genClass&lt;SqlCommand&gt; cmd) { ... } } </code></pre>
[ { "answer_id": 100562, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 2, "selected": false, "text": "interface IDBClass<T> where T:IDbCommand\n{\n void Test(T cmd);\n}\n\nclass DBClass:IDBClass<SqlCommand>\n{\n public void ...
2008/09/19
[ "https://Stackoverflow.com/questions/100533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
100,543
<p>On a class library project, I set the "Start Action" on the Debug tab of the project properties to "Start external program" (<a href="http://en.wikipedia.org/wiki/NUnit" rel="noreferrer">NUnit</a> in this case). I want to set an environment variable in the environment this program is started in. How do I do that? (Is it even possible?)</p> <p>EDIT:</p> <p>It's an environment variable that influences all .NET applications (COMplus_Version, it sets the runtime version) so setting it system wide really isn't an option.</p> <p>As a workaround I just forced NUnit to start in right .NET version (2.0) by setting it in <code>nunit.exe.config</code>, though unfortunately this also means all my .NET 1.1 unit tests are now also run in .NET 2.0. I should probably just make a copy of the executable so it can have its own configuration file...</p> <p>(I am keeping the question open (not accepting an answer) in case someone does happen to find out how (it might be useful for other purposes too after all...))</p>
[ { "answer_id": 1140232, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "_putenv()" }, { "answer_id": 9204703, "author": "tymtam", "author_id": 581076, "author_profile": "https:/...
2008/09/19
[ "https://Stackoverflow.com/questions/100543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5422/" ]
100,624
<p>How to wait for multiple child processes in Python on Windows, without active wait (polling)? Something like this <em>almost</em> works for me:</p> <pre><code>proc1 = subprocess.Popen(['python','mytest.py']) proc2 = subprocess.Popen(['python','mytest.py']) proc1.wait() print "1 finished" proc2.wait() print "2 finished" </code></pre> <p>The problem is that when <code>proc2</code> finishes before <code>proc1</code>, the parent process will still wait for <code>proc1</code>. On Unix one would use <code>waitpid(0)</code> in a loop to get the child processes' return codes as they finish - how to achieve something like this in Python on Windows?</p>
[ { "answer_id": 100886, "author": "tzot", "author_id": 6899, "author_profile": "https://Stackoverflow.com/users/6899", "pm_score": 5, "selected": true, "text": "import Queue, thread, subprocess\n\nresults= Queue.Queue()\ndef process_waiter(popen, description, que):\n try: popen.wait()\...
2008/09/19
[ "https://Stackoverflow.com/questions/100624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12166/" ]
100,631
<p>After our Ruby on Rails application has run for a while, it starts throwing 500s with "MySQL server has gone away". Often this happens overnight. It's started doing this recently, with no obvious change in our server configuration.</p> <pre><code> Mysql::Error: MySQL server has gone away: SELECT * FROM `widgets` </code></pre> <p>Restarting the mongrels (not the MySQL server) fixes it.</p> <p>How can we fix this?</p>
[ { "answer_id": 100703, "author": "Z99", "author_id": 18307, "author_profile": "https://Stackoverflow.com/users/18307", "pm_score": 1, "selected": false, "text": "mysql> show status;\n" }, { "answer_id": 101250, "author": "Laurie Young", "author_id": 7473, "author_prof...
2008/09/19
[ "https://Stackoverflow.com/questions/100631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18666/" ]
100,633
<p>Why is it bad practice to declare variables on one line?</p> <p>e.g.</p> <pre><code>private String var1, var2, var3 </code></pre> <p>instead of: </p> <pre><code>private String var1; private String var2; private String var3; </code></pre>
[ { "answer_id": 100662, "author": "David Pierre", "author_id": 18296, "author_profile": "https://Stackoverflow.com/users/18296", "pm_score": 4, "selected": false, "text": "int * i, j;\n" }, { "answer_id": 100664, "author": "Vinko Vrsalovic", "author_id": 5190, "author_...
2008/09/19
[ "https://Stackoverflow.com/questions/100633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15352/" ]
100,645
<p>Are there any tools available for calculating Cyclomatic Complexity in Javascript? </p> <p>I've found it a very helpful metric in the past while working on server side code, and would like to be able to use it for the client side Javascript I write.</p>
[ { "answer_id": 13453464, "author": "Phil Booth", "author_id": 47348, "author_profile": "https://Stackoverflow.com/users/47348", "pm_score": 5, "selected": false, "text": "npm i -g complexity-report\n" }, { "answer_id": 15815677, "author": "SavoryBytes", "author_id": 13194...
2008/09/19
[ "https://Stackoverflow.com/questions/100645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2932/" ]
100,661
<p>Are there any tools available for calculating the <strong>average number of lines of code per method</strong>?</p> <p>I want to know the average size of each method, not just the total number of lines in the project. The per method count will allow me to measure how simple each method is.</p> <p>This will be calculated as part of the build process, and displayed on a dashboard. The idea being that we can see if the average size of each method is increasing. And this will flag the possibility that code complexity is increasing and we may need to think about refactoring.</p>
[ { "answer_id": 100866, "author": "Marius", "author_id": 1585, "author_profile": "https://Stackoverflow.com/users/1585", "pm_score": 1, "selected": false, "text": "function calculateMethodSize(obj){\n var fcount = 0;\n var fsize = 0;\n for(i in obj){\n if(obj[i] instanceof Function)...
2008/09/19
[ "https://Stackoverflow.com/questions/100661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2932/" ]
100,678
<pre><code>LRESULT result = ::SendMessage(hWnd, s_MaxGetTaskInterface, (WPARAM)&amp;pUnkReturn, 0); </code></pre> <p>The value of result after the call is 0</p> <p>I expect it to return with a valid value of pUnkReturn , but it returns with a NULL value .</p> <p>Necessary Information before this call :</p> <pre><code>const UINT CMotionUtils::s_MaxGetTaskInterface = RegisterWindowMessage(_T("NI:Max:GetTaskInterface")); </code></pre> <p>The value of <code>s_MaxGetTaskInterface</code> i get here is 49896 . </p> <p>The value of hWnd is also proper . I checked that with Spy++ ( Visual Studio tool ) .</p> <p>Microft Spy++ Messages window shows me the following for this window . </p> <pre><code>&lt;00001&gt; 009F067C S message:0xC2E8 [Registered:"NI:Max:GetTaskInterface"]wParam:0224C2D0 lParam:00000000 &lt;00002&gt; 009F067C S message:0xC2E8 [Registered:"NI:Max:GetTaskInterface"]lResult:00000000 </code></pre> <p>Please help me to get a valid address stored in pUnkReturn after the call . </p>
[ { "answer_id": 100692, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 0, "selected": false, "text": "NI:Max:GetTaskInterface" }, { "answer_id": 100979, "author": "Alan", "author_id": 2958, "author_profile"...
2008/09/19
[ "https://Stackoverflow.com/questions/100678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
100,689
<p>I have a problem that confuses my users, being that although an item is highlighted (by the hover style) when the user mouses over it, they have to mouse over the actual item text, sometimes quite small compared to the item. Is there a way to make the whole item clickable?</p>
[ { "answer_id": 100706, "author": "David Heggie", "author_id": 4309, "author_profile": "https://Stackoverflow.com/users/4309", "pm_score": 3, "selected": true, "text": "a {\n display: block;\n width: 100%;\n}\n" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/100689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8741/" ]
100,705
<p>I recently heard of WSDL.Exe, but I am not sure where to find this program. Does anyone know where I can find or download it?</p>
[ { "answer_id": 100787, "author": "David Bick", "author_id": 4914, "author_profile": "https://Stackoverflow.com/users/4914", "pm_score": 5, "selected": true, "text": "C:\\program files\\Microsoft Visual Studio 8\\SDK\\v2.0\\Bin" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/100705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
100,707
<p>I'm wondering, how expensive it is to have many threads in waiting state in java 1.6 x64.</p> <p>To be more specific, I'm writing application which runs across many computers and sends/receives data from one to another. I feel more comfortable to have separate thread for each connected machine and task, like 1) sending data, 2) receiving data, 3) reestablishing connection when it is dropped. So, given that there are N nodes in cluster, each machine is going to have 3 threads for each of N-1 neighbours. Typically there will be 12 machines, which comes to 33 communication threads.</p> <p>Most of those threads will be sleeping most of the time, so for optimization purposes I could reduce number of threads and give more job to each of them. Like, for example. reestablishing connection is responsibility of receiving thread. Or sending to all connected machines is done by single thread.</p> <p>So is there any significant perfomance impact on having many sleeping threads?</p>
[ { "answer_id": 100994, "author": "Bill Michell", "author_id": 7938, "author_profile": "https://Stackoverflow.com/users/7938", "pm_score": 1, "selected": false, "text": "ThreadPoolExecutor" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/100707", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5507/" ]
100,721
<p>I am using <code>DirectoryInfo.GetDirectories()</code> recursively to find the all the sub-directories under a given path. However, I want to exclude the System folders and there is no clear way for that. In FindFirstFile/FindNextFile things were clearer with the attributes.</p>
[ { "answer_id": 100822, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 4, "selected": true, "text": "static IEnumerable<string> GetNonSystemDirs(string path)\n{\n var dirs = from d in Directory.GetDirectories(path)\n ...
2008/09/19
[ "https://Stackoverflow.com/questions/100721", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
100,732
<p>I've seen several examples of code like this:</p> <pre><code>if not someobj: #do something </code></pre> <p>But I'm wondering why not doing:</p> <pre><code>if someobj == None: #do something </code></pre> <p>Is there any difference? Does one have an advantage over the other?</p>
[ { "answer_id": 100762, "author": "Sylvain Defresne", "author_id": 5353, "author_profile": "https://Stackoverflow.com/users/5353", "pm_score": 9, "selected": true, "text": "bool" }, { "answer_id": 100764, "author": "badp", "author_id": 13992, "author_profile": "https:/...
2008/09/19
[ "https://Stackoverflow.com/questions/100732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10708/" ]
100,774
<p>The following JavaScript supposes to read the popular tags from an XML file and applies the XSL Stylesheet and output to the browser as HTML.</p> <pre><code>function ShowPopularTags() { xml = XMLDocLoad("http://localhost/xml/tags/popular.xml?s=94987898"); xsl = XMLDocLoad("http://localhost/xml/xsl/popular-tags.xsl"); if (window.ActiveXObject) { // code for IE ex = xml.transformNode(xsl); ex = ex.replace(/\\/g, ""); document.getElementById("popularTags").innerHTML = ex; } else if (document.implementation &amp;&amp; document.implementation.createDocument) { // code for Mozilla, Firefox, Opera, etc. xsltProcessor = new XSLTProcessor(); xsltProcessor.importStylesheet(xsl); resultDocument = xsltProcessor.transformToFragment(xml, document); document.getElementById("popularTags").appendChild(resultDocument); var ihtml = document.getElementById("popularTags").innerHTML; ihtml = ihtml.replace(/\\/g, ""); document.getElementById("popularTags").innerHTML = ihtml; } } ShowPopularTags(); </code></pre> <p>The issue with this script is sometime it manages to output the resulting HTML code, sometime it doesn't. Anyone knows where is going wrong?</p>
[ { "answer_id": 101048, "author": "Twan", "author_id": 6702, "author_profile": "https://Stackoverflow.com/users/6702", "pm_score": 1, "selected": false, "text": "<BODY onLoad=\"ShowPopularTags();\">\n" }, { "answer_id": 110853, "author": "Twan", "author_id": 6702, "aut...
2008/09/19
[ "https://Stackoverflow.com/questions/100774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17074/" ]
100,808
<p>I want to receive the following <code>HTTP</code> request in <code>PHP:</code></p> <pre><code>Content-type: multipart/form-data;boundary=main_boundary --main_boundary Content-type: text/xml &lt;?xml version='1.0'?&gt; &lt;content&gt; Some content goes here &lt;/content&gt; --main_boundary Content-type: multipart/mixed;boundary=sub_boundary --sub_boundary Content-type: application/octet-stream File A contents --sub_boundary Content-type: application/octet-stream File B contents --sub_boundary --main_boundary-- </code></pre> <p>(Note: I have indented the sub-parts only to make it more readable for this post.)</p> <p>I'm not very fluent in PHP and would like to get some help/pointers to figure out how to receive this kind of multipart form request in PHP code. I have once written some code where I received a standard HTML form and then I could access the form elements by using their name as index key in the <code>$HTTP_GET_VARS</code> array, but in this case there are no form element names, and the form data parts are not linear (i.e. sub parts = multilevel array).</p> <p>Grateful for any help!</p> <p>/Robert</p>
[ { "answer_id": 100874, "author": "pilsetnieks", "author_id": 6615, "author_profile": "https://Stackoverflow.com/users/6615", "pm_score": 3, "selected": true, "text": "$HTTP_GET_VARS" } ]
2008/09/19
[ "https://Stackoverflow.com/questions/100808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7891/" ]
100,812
<p>Not for the first time, I've accidentally done "svn switch" from somewhere below the root of my project. This switches that subdirectory only, but how do I undo this?</p> <p>If I try switching the subdirectory back to the original branch I get:</p> <pre><code>"svn: Directory 'subdir\_svn' containing working copy admin area is missing" </code></pre> <p><strong>Update</strong>: I've got changes in the subdir, so I don't want to do a delete. </p> <p>In the short term I've fixed it by reapplying the changes, but I was after a way to get Subversion to re-switch back to where I came from... or is this a missing feature?</p>
[ { "answer_id": 100870, "author": "Dan", "author_id": 17121, "author_profile": "https://Stackoverflow.com/users/17121", "pm_score": -1, "selected": false, "text": "svn revert <dir>\n" }, { "answer_id": 101176, "author": "Palmin", "author_id": 5949, "author_profile": "h...
2008/09/19
[ "https://Stackoverflow.com/questions/100812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17641/" ]