qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
407,956
<p>I never touch <code>routes.rb</code> beyond calling <code>map.root</code> to set a default route. I've always been content to use URLs of the form...</p> <pre><code>/controller/action/perhaps_an_id </code></pre> <p>and it works fine.</p> <p>Does this make me a bad person? Am I missing out on something totally awe...
[ { "answer_id": 407993, "author": "allesklar", "author_id": 19893, "author_profile": "https://Stackoverflow.com/users/19893", "pm_score": 3, "selected": false, "text": "map.resources :posts\n" }, { "answer_id": 407996, "author": "Ronn", "author_id": 49684, "author_prof...
2009/01/02
[ "https://Stackoverflow.com/questions/407956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42595/" ]
407,964
<p>I need to play an MP3 in the background while generating animation. The audio drives the animation timeline so I have to track MS from the start of the file to keep things in sync. In VB6 I used the MMControl which raised an event at certain intervals and could count the frames from the beginning to always determi...
[ { "answer_id": 407993, "author": "allesklar", "author_id": 19893, "author_profile": "https://Stackoverflow.com/users/19893", "pm_score": 3, "selected": false, "text": "map.resources :posts\n" }, { "answer_id": 407996, "author": "Ronn", "author_id": 49684, "author_prof...
2009/01/02
[ "https://Stackoverflow.com/questions/407964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38349/" ]
407,970
<p>Years ago I learned the hard way about precision problems with floats so I quit using them. However, I still run into code using floats and it make me cringe because I know some of the calculations will be inaccurate.</p> <p>So, when is it appropriate to use a float?</p> <p><strong>EDIT:</strong> As info, I don't...
[ { "answer_id": 407981, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 3, "selected": false, "text": "float" } ]
2009/01/02
[ "https://Stackoverflow.com/questions/407970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47576/" ]
407,977
<p>If you have an elliptic curve in the form of:</p> <pre><code>y^2 = x^3 + a*x + b (mod p) </code></pre> <p>Is there a good program to calculate the number of points on this curve?</p> <p>I have read about Schoof's and Schoof-Elkies-Atkin (SEA) algorithm, but I'm looking for open source implementations. Does anyon...
[ { "answer_id": 408645, "author": "Bobby Moretti", "author_id": 51100, "author_profile": "https://Stackoverflow.com/users/51100", "pm_score": 2, "selected": false, "text": "sage: k = GF(next_prime(10^20))\nsage: E = EllipticCurve(k.random_element())\nsage: E.cardinality() ...
2009/01/02
[ "https://Stackoverflow.com/questions/407977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51011/" ]
407,980
<p>I'd like to implement database caching functionality in PHP based on reference counts. For example, code to access the record in table <code>foo</code> with an ID of 1 might look like:</p> <pre><code>$fooRecord = $fooTable-&gt;getRecord(1); </code></pre> <p>The first time this is called, <code>$fooTable</code> fe...
[ { "answer_id": 408004, "author": "Eran Galperin", "author_id": 10585, "author_profile": "https://Stackoverflow.com/users/10585", "pm_score": 1, "selected": false, "text": "public function getRecord($id) {\n $cache = $this -> getCache(); //Retrieves an instanced Zend_Cache object or c...
2009/01/02
[ "https://Stackoverflow.com/questions/407980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25213/" ]
407,983
<p>I am wondering why the C# 3.0 compiler is unable to infer the type of a method when it is passed as a parameter to a generic function when it can implicitly create a delegate for the same method.</p> <p>Here is an example:</p> <pre><code>class Test { static void foo(int x) { } static void bar&lt;T&gt;(Acti...
[ { "answer_id": 408008, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 5, "selected": true, "text": "public class SomeClass\n{\n static void foo(int x) { }\n static void foo(string s) { }\n static void bar<T>(Action<T> ...
2009/01/02
[ "https://Stackoverflow.com/questions/407983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34211/" ]
407,987
<p>I'm interested in implementing a Forth system, just so I can get some experience building a simple VM and runtime.</p> <p>When starting in Forth, one typically learns about the stack and its operators (DROP, DUP, SWAP, etc.) first, so it's natural to think of these as being among the primitive operators. But they'r...
[ { "answer_id": 408072, "author": "plinth", "author_id": 20481, "author_profile": "https://Stackoverflow.com/users/20481", "pm_score": 6, "selected": true, "text": "SetPixel" }, { "answer_id": 408285, "author": "Charlie Martin", "author_id": 35092, "author_profile": "h...
2009/01/02
[ "https://Stackoverflow.com/questions/407987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17312/" ]
407,989
<p>I grabbed a database of the zip codes and their langitudes/latitudes, etc from this <a href="http://www.populardata.com/downloads.html" rel="noreferrer">This page</a>. It has got the following fields:</p> <blockquote> <p>ZIP, LATITUDE, LONGITUDE, CITY, STATE, COUNTY, ZIP_CLASS</p> </blockquote> <p>The data was ...
[ { "answer_id": 408000, "author": "Mike Paterson", "author_id": 42933, "author_profile": "https://Stackoverflow.com/users/42933", "pm_score": 3, "selected": false, "text": "function calc_distance($point1, $point2)\n{\n $distance = (3958 * 3.1415926 * sqrt(\n ($point1['lat'] ...
2009/01/02
[ "https://Stackoverflow.com/questions/407989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49153/" ]
408,002
<p>Inside VS2005, our whole programming staff gets this error message <strong>sporadically</strong> and it is always on the <strong>BeneControls</strong> project. This error message happens multiple times a day and it occurs when going into DESIGN mode for a control. Normally rebuilding the <strong>BeneControls</strong...
[ { "answer_id": 408043, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 4, "selected": true, "text": "[assembly: AssemblyVersion(\"1.0.*.*\")]\n" } ]
2009/01/02
[ "https://Stackoverflow.com/questions/408002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4964/" ]
408,032
<p>I'm looking for a fast way to turn an associative array in to a string. Typical structure would be like a URL query string but with customizable separators so I can use '<code>&amp;amp;</code>' for xhtml links or '<code>&amp;</code>' otherwise.</p> <p>My first inclination is to use <code>foreach</code> but since my...
[ { "answer_id": 408040, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 9, "selected": true, "text": "http_build_query()" }, { "answer_id": 507195, "author": "Community", "author_id": -1, "author_profile": "h...
2009/01/02
[ "https://Stackoverflow.com/questions/408032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51021/" ]
408,042
<p>We use iText to generate PDFs from Java (based partly on recommendations on this site). However, embedding a copy of our logo in an image format like GIF results in it looking a bit strange as people zoom in and out.</p> <p>Ideally we'd like to embed the image in a vector format, such as EPS, SVG or just a PDF temp...
[ { "answer_id": 408098, "author": "David Koelle", "author_id": 2197, "author_profile": "https://Stackoverflow.com/users/2197", "pm_score": 3, "selected": false, "text": "Document document = new Document(PageSize.LETTER);\nPdfWriter writer = null;\ntry {\n writer = PdfWriter.getInstance...
2009/01/02
[ "https://Stackoverflow.com/questions/408042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1000/" ]
408,046
<p>I've been inspired by <a href="https://stackoverflow.com/questions/405724/modifying-microsoft-outlook-contacts-from-python">Modifying Microsoft Outlook contacts from Python</a> -- I'm looking to try scripting some of my more annoying Outlook uses with the <code>win32com</code> package. I'm a Linux user trapped in a ...
[ { "answer_id": 9816622, "author": "ebt", "author_id": 376763, "author_profile": "https://Stackoverflow.com/users/376763", "pm_score": 1, "selected": false, "text": "import win32com.client,os,re\nfrom utils.autoencode import autoencode \ngenerated='2D5E2D34-BED5-4B9F-9793-A31E26E6806Ex0x4...
2009/01/02
[ "https://Stackoverflow.com/questions/408046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3594/" ]
408,051
<p>So if my JPA query is like this: Select distinct p from Parent p left join fetch p.children order by p.someProperty</p> <p>I correctly get results back ordered by p.someProperty, and I correctly get my p.children collection eagerly fetched and populated. But I'd like to have my query be something like "order by p....
[ { "answer_id": 408522, "author": "Adeel Ansari", "author_id": 42769, "author_profile": "https://Stackoverflow.com/users/42769", "pm_score": 5, "selected": true, "text": "@javax.persistence.OrderBy(value = \"fieldName\")\n" }, { "answer_id": 67538776, "author": "Dilli Babu Kad...
2009/01/02
[ "https://Stackoverflow.com/questions/408051", "https://Stackoverflow.com", "https://Stackoverflow.com/users/409/" ]
408,055
<p>What would result from something like the following:</p> <pre><code>p(X,Y) :- q(X). p(X,Y) :- r(Y). q(a). r(b). </code></pre> <p>I don't have a Prolog compiler handy, so I can't test what would happen if you then asked <code>p(X,Y)</code>. Would the code even compile? Would <code>p</code> return two answers, eac...
[ { "answer_id": 408694, "author": "John Boker", "author_id": 2847, "author_profile": "https://Stackoverflow.com/users/2847", "pm_score": 1, "selected": false, "text": "p(X,Y) :- q(X).\np(X,Y) :- r(Y).\nq(a).\nr(b).\n" } ]
2009/01/02
[ "https://Stackoverflow.com/questions/408055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18160/" ]
408,059
<p>I thought I'd use Boost.Interprocess's <a href="http://www.boost.org/doc/libs/1_37_0/doc/html/interprocess/synchronization_mechanisms.html#interprocess.synchronization_mechanisms.message_queue" rel="noreferrer">Message Queue</a> in place of sockets for communication within one host. But after digging into it, it se...
[ { "answer_id": 13693844, "author": "zaufi", "author_id": 1655064, "author_profile": "https://Stackoverflow.com/users/1655064", "pm_score": 2, "selected": false, "text": "boost::asio" } ]
2009/01/02
[ "https://Stackoverflow.com/questions/408059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4323/" ]
408,079
<p>I want to do this: </p> <pre><code> findstr /s /c:some-symbol * </code></pre> <p>or the grep equivalent</p> <pre><code> grep -R some-symbol * </code></pre> <p>but I need the utility to autodetect files encoded in UTF-16 (and friends) and search them appropriately. My files even have the byte-ordering mark FFEE ...
[ { "answer_id": 408177, "author": "Mark A. Nicolosi", "author_id": 1103052, "author_profile": "https://Stackoverflow.com/users/1103052", "pm_score": 1, "selected": false, "text": "for f in `find . -type f | xargs -I {} file {} | grep UTF-16 | cut -f1 -d\\:`\n do iconv -f UTF-16 -t ...
2009/01/02
[ "https://Stackoverflow.com/questions/408079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51029/" ]
408,080
<p>Is there a foreach structure in MATLAB? If so, what happens if the underlying data changes (i.e. if objects are added to the set)?</p>
[ { "answer_id": 408092, "author": "Jason S", "author_id": 44330, "author_profile": "https://Stackoverflow.com/users/44330", "pm_score": 4, "selected": false, "text": ">> A = zeros(4); A(:) = 1:16\n\nA =\n\n 1 5 9 13\n 2 6 10 14\n 3 7 11 15\n ...
2009/01/02
[ "https://Stackoverflow.com/questions/408080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18511/" ]
408,101
<p>In VB.NET, which is faster to use for method arguments, <code>ByVal</code> or <code>ByRef</code>?</p> <p>Also, which consumes more resources at runtime (RAM)? </p> <hr> <p>I read through <a href="https://stackoverflow.com/questions/290189/best-practice-byref-or-byval-in-net">this question</a>, but the answers are...
[ { "answer_id": 408107, "author": "Paul", "author_id": 37865, "author_profile": "https://Stackoverflow.com/users/37865", "pm_score": 1, "selected": false, "text": "ByVal" }, { "answer_id": 408131, "author": "user50612", "author_id": 50612, "author_profile": "https://St...
2009/01/02
[ "https://Stackoverflow.com/questions/408101", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41021/" ]
408,116
<p>I'm looking for an easy way to track time I work on a project using the command line. I do</p> <pre><code>echo "$(date) : Start" &gt;&gt;worktime.txt </code></pre> <p>When I start working and</p> <pre><code>echo "$(date) : End" &gt;&gt;worktime.txt </code></pre> <p>When I stop working. The result is a file of th...
[ { "answer_id": 408132, "author": "wilhelmtell", "author_id": 456, "author_profile": "https://Stackoverflow.com/users/456", "pm_score": 3, "selected": false, "text": "date +%s" }, { "answer_id": 408161, "author": "Johannes Schaub - litb", "author_id": 34509, "author_pr...
2009/01/02
[ "https://Stackoverflow.com/questions/408116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
408,133
<p>I am wondering if someone can help me figure out the best approach to the following problem. I'm building a web application which uses Django templating to construct its web UI component. There are a number of common HTML elements such as the header / footer, HTML head, masthead etc. I'd like to code these once a...
[ { "answer_id": 408176, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 3, "selected": false, "text": "{% include %}" }, { "answer_id": 408181, "author": "kristina", "author_id": 4243, "author_profile": "ht...
2009/01/02
[ "https://Stackoverflow.com/questions/408133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26241/" ]
408,139
<p>Now I must be missing something here, as this seems a very basic issue that would be addressed in any "Getting started with Flex charting" tutorial. However, all that I could find was hints that the chart should update automatically whenever the dataProvider changes. Mind you, hints.</p> <p>This is my markup:</p> ...
[ { "answer_id": 408173, "author": "rmeador", "author_id": 10861, "author_profile": "https://Stackoverflow.com/users/10861", "pm_score": 4, "selected": true, "text": "Array" }, { "answer_id": 408182, "author": "Brandon", "author_id": 23133, "author_profile": "https://St...
2009/01/02
[ "https://Stackoverflow.com/questions/408139", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2077/" ]
408,167
<p>As a programmer who is new to .NET and C#, I find that using .NET Reflector is an incredible utility to use to see how the "professionals" write their code.</p> <p>Can anyone suggest good .NET based applications to use Reflector on for Desktop Applications - any application examples would be appreciated.</p>
[ { "answer_id": 408235, "author": "Dmitri Nesteruk", "author_id": 9476, "author_profile": "https://Stackoverflow.com/users/9476", "pm_score": 0, "selected": false, "text": "Parallel.Invoke" } ]
2009/01/02
[ "https://Stackoverflow.com/questions/408167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
408,170
<p>I have table with 50 entries (users with such details like Name Surname Location etc)</p> <p>I want to create a query that give me users from row 1 to row 10. Then another query that give me users from 11 to 20 and so on.</p> <p>Is there any way how to do that?</p> <p>Thanks</p>
[ { "answer_id": 408771, "author": "Ian Varley", "author_id": 37539, "author_profile": "https://Stackoverflow.com/users/37539", "pm_score": 1, "selected": false, "text": "\"ROW_NUMBER() OVER (...)\"" } ]
2009/01/02
[ "https://Stackoverflow.com/questions/408170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44973/" ]
408,192
<p>When trying to compile my class I get an error: </p> <blockquote> <p>The constant <code>'NamespaceName.ClassName.CONST_NAME'</code> cannot be marked static.</p> </blockquote> <p>at the line:</p> <pre><code>public static const string CONST_NAME = "blah"; </code></pre> <p>I could do this all of the time in Java...
[ { "answer_id": 408197, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 11, "selected": true, "text": "const" }, { "answer_id": 15513193, "author": "Meowmaritus", "author_id": 1890257, "author_profile"...
2009/01/02
[ "https://Stackoverflow.com/questions/408192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2598/" ]
408,207
<p>We have a ASP.NET application that uses the Exception Handling Application block to log our exception to a database (using logging block indirectly). This all working perfect. However, since it is using the exception handling block to log data, everytime we wanted to log, we'll have to new'd a System.Exception obj...
[ { "answer_id": 408343, "author": "Don", "author_id": 46074, "author_profile": "https://Stackoverflow.com/users/46074", "pm_score": 2, "selected": false, "text": "<categorySources> \n<add switchValue=\"All\" name=\"Database Events\">\n <listeners>\n <add name=\"Formatted E...
2009/01/02
[ "https://Stackoverflow.com/questions/408207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31206/" ]
408,211
<p>Whats the best way handle exception from a WCF service? How can you throw the exception from a WCF service? </p>
[ { "answer_id": 409485, "author": "Krzysztof Kozmic", "author_id": 13163, "author_profile": "https://Stackoverflow.com/users/13163", "pm_score": 2, "selected": false, "text": "FaultContract<ArgumentException>" } ]
2009/01/02
[ "https://Stackoverflow.com/questions/408211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43049/" ]
408,217
<p>After googling a bit there is no definite answer of whether Visual Studio 2008 uses svcutil.exe or not? Visual Studio 2005 did use it, but do the RTM versions of Visual Studio 2008 use svcutil? A few blogs say it doesn't (and make it seem surprising)</p> <ul> <li><a href="https://web.archive.org/web/20120103021621...
[ { "answer_id": 411696, "author": "Philippe", "author_id": 920, "author_profile": "https://Stackoverflow.com/users/920", "pm_score": -1, "selected": false, "text": "//------------------------------------------------------------------------------\n// <auto-generated>\n// This code was ...
2009/01/02
[ "https://Stackoverflow.com/questions/408217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49861/" ]
408,225
<p>On my page I have a drop-down select box, with a default value of (empty). When the user selects an entry, the appropriate form for that entry type is displayed.</p> <p>Couple of problems..</p> <ol> <li>The code is not DRY and seems more verbose than it needs to be, so not easily maintainable / extensible.</li> <l...
[ { "answer_id": 408231, "author": "Eran Galperin", "author_id": 10585, "author_profile": "https://Stackoverflow.com/users/10585", "pm_score": 4, "selected": true, "text": "$(document).ready(function(){\n var select = $('#select_type');\n $('#' + select.val()).toggle(); // Toggle t...
2009/01/02
[ "https://Stackoverflow.com/questions/408225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39539/" ]
408,255
<p>I need your help,</p> <p>For example I have a decimal type variable and I want to round up this way.</p> <p>Eg</p> <p>3.0 = 3</p> <p>3.1 = 4</p> <p>3.2 = 4</p> <p>3.3 = 4</p> <p>3.4 = 4</p> <p>3.5 = 4</p> <p>3.6 = 4</p> <p>3.7 = 4</p> <p>3.8 = 4</p> <p>3.9 = 4</p> <p>4.0 = 4</p> <p>4.1 = 5</p> <p>4.2 ...
[ { "answer_id": 408274, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 1, "selected": false, "text": "dim rounded as int = Math.Ceiling(4.1)\n" }, { "answer_id": 436606, "author": "Shiva", "author_id": ...
2009/01/02
[ "https://Stackoverflow.com/questions/408255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44973/" ]
408,265
<p>I have a form that is dynamically generated, and has dynamically generated id's (and potentially classes). The forms are the same but they have the related id tacked on to the end.</p> <p>How can I select each set of inputs and apply code to each one?</p> <p>I was experimenting with $('input[id^=@id_airline_for_]'...
[ { "answer_id": 408272, "author": "Sophie Alpert", "author_id": 49485, "author_profile": "https://Stackoverflow.com/users/49485", "pm_score": 2, "selected": false, "text": "$(\"input#id_airline_for\" + id)" }, { "answer_id": 408282, "author": "Beau Simensen", "author_id": ...
2009/01/02
[ "https://Stackoverflow.com/questions/408265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22306/" ]
408,269
<p>Is it possible to animate the change of a <code>UIProgressView</code> such that the display will move smoothly to the new value?</p> <p>Kinda like NSProgressIndicator does.</p>
[ { "answer_id": 409195, "author": "catlan", "author_id": 23028, "author_profile": "https://Stackoverflow.com/users/23028", "pm_score": 7, "selected": true, "text": "UIProgressView setProgress:(float)value animated:(BOOL)animated" }, { "answer_id": 31713472, "author": "pkamb", ...
2009/01/02
[ "https://Stackoverflow.com/questions/408269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49485/" ]
408,286
<p>I'm trying to do what I think is a simple thing under Linux. I have a bash script which runs various test programs, and I want to determine which files in the current directory were created by the test programs. So I am doing something like this:</p> <pre> touch timestamp-file run the test find -newer timestamp-fil...
[ { "answer_id": 408311, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 2, "selected": false, "text": "touch -t 200801010000.00 *\n" }, { "answer_id": 408448, "author": "Johannes Schaub - litb", "author_id":...
2009/01/02
[ "https://Stackoverflow.com/questions/408286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51048/" ]
408,310
<p>I've got some code that looks like this:</p> <pre><code>using (DBDataContext dc = new DBDataContext(ConnectionString)) { Main main = new Main { ClientTime = clientTime }; dc.Mains.InsertOnSubmit(main); dc.SubmitChanges(); return main.ID; } </code></pre> <p>If I return from inside a ...
[ { "answer_id": 408313, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 6, "selected": true, "text": "using" }, { "answer_id": 408317, "author": "Jon Skeet", "author_id": 22656, "author_profile": "htt...
2009/01/02
[ "https://Stackoverflow.com/questions/408310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
408,316
<p>Has anything useful come out of Intentional or "Language Oriented" Programming?</p> <p>This isn't a rhetorical question. I'm looking for people who've tried these tools (ie. representing programs in some "higher level" format than mere text and using different editors for different domain specific subsets) and have...
[ { "answer_id": 408371, "author": "OscarRyz", "author_id": 20654, "author_profile": "https://Stackoverflow.com/users/20654", "pm_score": 3, "selected": true, "text": "package a;\nimport static a.Help.*;\n\npublic class Test { \n\n public void test(){\n Object value = \"\";\n ...
2009/01/02
[ "https://Stackoverflow.com/questions/408316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8482/" ]
408,320
<p>I am adding items to a <code>ListBox</code> like so:</p> <pre><code>myListBox.Items.addRange(myObjectArray); </code></pre> <p>and I also want to select some of the items I add by the following:</p> <pre><code>foreach(MyObject m in otherListOfMyObjects) { int index = myListBox.Items.IndexOf(m); myListBox....
[ { "answer_id": 408327, "author": "Neil Barnwell", "author_id": 26414, "author_profile": "https://Stackoverflow.com/users/26414", "pm_score": 4, "selected": true, "text": "MyObject" }, { "answer_id": 408328, "author": "Kon", "author_id": 22303, "author_profile": "https...
2009/01/02
[ "https://Stackoverflow.com/questions/408320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2598/" ]
408,336
<p>I have the following use case , lot of code which was tightly coupled on a concrete type (say Concrete1). Later figured out the concrete type needs to be changed, so defined an interface . E.g</p> <pre><code>Class ABC { virtual int foo() = 0; virtual int getType() = 0; } class Concrete1 : public ABC { int...
[ { "answer_id": 408370, "author": "IAmCodeMonkey", "author_id": 27613, "author_profile": "https://Stackoverflow.com/users/27613", "pm_score": 4, "selected": true, "text": "void Main(string[] args)\n{\n Bird bird = BirdFactory.GetPigeon();\n if (bird.GetType().Equals(typeof(Duck)))\n ...
2009/01/02
[ "https://Stackoverflow.com/questions/408336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43756/" ]
408,342
<p>I'm creating a website for my church and I'm having problems making it display right in IE. It seems that my div "sidebox" is having its background position overridden by the "margin: 0 auto;" as the background displays centered rather than on the right, which is shifting the site to the right.</p> <p>Here's the c...
[ { "answer_id": 408368, "author": "Abram Simon", "author_id": 46204, "author_profile": "https://Stackoverflow.com/users/46204", "pm_score": 2, "selected": false, "text": ".header { width: 960px; height: 20px; background: url(top.jpg) no-repeat; }\n\n.footer { width: 960px; height: 20px; b...
2009/01/02
[ "https://Stackoverflow.com/questions/408342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16437/" ]
408,358
<p>I'm coding a game, and I'd like to be able to find the center of mass of an arbitrary shape on a black and white bitmap such as this:</p> <pre> 012345678 0.XX...... 1..XXX.... 2...XXX... 3..XXXXXXX 4...XXX... </pre> <p>All "cells" have the same weight. Diagonally adjacent cells are not considered to be connected,...
[ { "answer_id": 408376, "author": "Yuval Adam", "author_id": 24545, "author_profile": "https://Stackoverflow.com/users/24545", "pm_score": 5, "selected": true, "text": "xSum = 0\nySum = 0\npoints = 0\n\nfor point in matrix\n if point is marked\n xSum += pointX\n ySum += p...
2009/01/03
[ "https://Stackoverflow.com/questions/408358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/914/" ]
408,378
<p>I'm using the ASP net Ajax toolkit and have a <code>GridView</code> within the <code>UpdatePanel</code>, everything works fine.</p> <p>When I attempt to run some <code>JQuery</code> against the table that should be generated, there isn't any sign of the <code>GridView</code> (or table <code>HTML</code>) in the DOM ...
[ { "answer_id": 538608, "author": "Dave Baghdanov", "author_id": 45194, "author_profile": "https://Stackoverflow.com/users/45194", "pm_score": 0, "selected": false, "text": "protected void Page_Load(object sender, EventArgs e)\n{\n string js = \"$(document).ready(function(){$(\\\"#\" +...
2009/01/03
[ "https://Stackoverflow.com/questions/408378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16642/" ]
408,394
<p>Has anybody tried doing GSP design with Adobe Dreamweaver CS4? It has support for JSPs, but it doesn't recognize the gsp extension, and even if it did I think there would be problems regarding the gsp tags that it would not recognize. I found a little cookbook here (<a href="http://www.bitwalker.nl/blog/using-groovy...
[ { "answer_id": 4667847, "author": "igor", "author_id": 497648, "author_profile": "https://Stackoverflow.com/users/497648", "pm_score": 3, "selected": true, "text": "<documenttype id=\"GSP\" servermodel=\"JSP\" internaltype=\"Dynamic\" winfileextension=\"gsp\" macfileextension=\"gsp\" fil...
2009/01/03
[ "https://Stackoverflow.com/questions/408394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33752/" ]
408,405
<p>I'm teaching myself some basic scraping and I've found that sometimes the URL's that I feed into my code return 404, which gums up all the rest of my code.</p> <p>So I need a test at the top of the code to check if the URL returns 404 or not.</p> <p>This would seem like a pretty straightfoward task, but Google's n...
[ { "answer_id": 408414, "author": "Ross", "author_id": 29173, "author_profile": "https://Stackoverflow.com/users/29173", "pm_score": 3, "selected": false, "text": "if(($twitter_XML_raw=file_get_contents($timeline))==false){\n // Retrieve HTTP status code\n list($version,$status_code...
2009/01/03
[ "https://Stackoverflow.com/questions/408405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
408,415
<p>I recently implemented a class like:</p> <pre><code>class TestClass : IDisposable { RegistryKey m_key; public TestClass() { m_key = Registry.CurrentUser.OpenSubKey("Software", false); } public void Dispose() { // m_key.Dispose(); IDisposable disp = m_key; dis...
[ { "answer_id": 408424, "author": "Mark A. Nicolosi", "author_id": 1103052, "author_profile": "https://Stackoverflow.com/users/1103052", "pm_score": 5, "selected": true, "text": "public clas SomeClass : IEnumerable<SomeOtherClass>\n{\n public IEnumerator<SomeOtherClass> GetEnumerator (...
2009/01/03
[ "https://Stackoverflow.com/questions/408415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10558/" ]
408,444
<p>I have noticed that my geocoder is inconsistent in the code shown below because before the "getLatLng" method is called I show 10 valid locations, but after this line of code the number of points that actually show up is different each time I search (same search criteria - fyi) Between 5 and 10 at random .. very str...
[ { "answer_id": 429111, "author": "Toran Billups", "author_id": 2701, "author_profile": "https://Stackoverflow.com/users/2701", "pm_score": 1, "selected": true, "text": "function preGeoCodeLookup(_xaddr, _xid, _xindex, _xhtml, _xstatus) {\n addPreCount();\n\n //don't change ...
2009/01/03
[ "https://Stackoverflow.com/questions/408444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2701/" ]
408,452
<p>The code below is checking performance of three different ways to do same solution.</p> <pre><code> public static void Main(string[] args) { // for loop { Stopwatch sw = Stopwatch.StartNew(); int accumulator = 0; for (int i = 1; i &lt;= 100000000; ++i) ...
[ { "answer_id": 408494, "author": "yfeldblum", "author_id": 12349, "author_profile": "https://Stackoverflow.com/users/12349", "pm_score": 5, "selected": true, "text": "Enumerable.Range" }, { "answer_id": 408786, "author": "Jon Skeet", "author_id": 22656, "author_profil...
2009/01/03
[ "https://Stackoverflow.com/questions/408452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26349/" ]
408,456
<p>I'm using Hibernate's implementation of JPA and am seeing poor performance as multiple SQL queries are issued for each entity that is fetched. If I use a joined JPA query it generates just one SQL query but doesn't find rows will null relationship.</p> <p>Example, consider this simple schema. A person lives at an a...
[ { "answer_id": 408518, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": true, "text": "SELECT p FROM Person p LEFT JOIN p.address a LEFT JOIN p.employer e WHERE...\n" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/408456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24396/" ]
408,467
<p>The MySQL documentation isn't very clear on this. I want to add an index to an existing table. The table is a user table with the login id and password and I want to create an index for this to optimize logging in.</p> <p>This is how I thought I would try it: </p> <pre><code>mysql&gt; ALTER TABLE `users` ADD INDEX...
[ { "answer_id": 408479, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 4, "selected": true, "text": "name" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/408467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66475/" ]
408,480
<p>Ever since Microsoft has introduced the application blocks, I've been bumping into people who use the <a href="http://msdn.microsoft.com/en-us/library/dd203116.aspx" rel="noreferrer">Exception Handling Application Block</a>. I've recently had a closer look myself and would summarize the basic functionality as follow...
[ { "answer_id": 408506, "author": "yfeldblum", "author_id": 12349, "author_profile": "https://Stackoverflow.com/users/12349", "pm_score": 5, "selected": true, "text": "ArgumentException" }, { "answer_id": 2107843, "author": "Randy Levy", "author_id": 114664, "author_pr...
2009/01/03
[ "https://Stackoverflow.com/questions/408480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
408,482
<p>I'm stuck on a RegEx problem that's seemingly very simple and yet I can't get it working.</p> <p>Suppose I have input like this:</p> <pre><code>Some text %interestingbit% lots of random text lots and lots more %anotherinterestingbit% Some text %interestingbit% lots of random text OPTIONAL_THING lots and lots more ...
[ { "answer_id": 408524, "author": "strager", "author_id": 39992, "author_profile": "https://Stackoverflow.com/users/39992", "pm_score": 0, "selected": false, "text": "%interestingbit%.+?(?<OptionalCapture>OPTIONAL_THING)?.+?%anotherinterestingbit%\n" }, { "answer_id": 408964, ...
2009/01/03
[ "https://Stackoverflow.com/questions/408482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20336/" ]
408,501
<p>I need to do this.</p> <pre><code>public class MyClass{ private static IDictionary&lt;String, Type&gt; databaseAccessClasses = new Dictionary&lt;String, Type&gt;(); private static IDictionary&lt;String, Type&gt; DatabaseAccessClasses { get { return DataAccessFacto...
[ { "answer_id": 411001, "author": "mmmmmmmm", "author_id": 44086, "author_profile": "https://Stackoverflow.com/users/44086", "pm_score": 3, "selected": false, "text": "CSharpCodeProvider codeProvider = new CSharpCodeProvider();\nCodeCompileUnit compileUnit = new CodeCompileUnit();\nCodeNa...
2009/01/03
[ "https://Stackoverflow.com/questions/408501", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45481/" ]
408,530
<p>I'm trying to learn some C# over the weekend and am following the 15 exercises found here: <a href="http://www.jobsnake.com/seek/articles/index.cgi?openarticle&amp;8533" rel="nofollow noreferrer">http://www.jobsnake.com/seek/articles/index.cgi?openarticle&amp;8533</a></p> <p>Yesterday I asked a similar question for...
[ { "answer_id": 408540, "author": "Charles Bretana", "author_id": 32632, "author_profile": "https://Stackoverflow.com/users/32632", "pm_score": 2, "selected": false, "text": " static string Reynolds(int d, int v, int rho, int mu)\n { \n int number = (d*v*rho) / mu; \n ...
2009/01/03
[ "https://Stackoverflow.com/questions/408530", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37196/" ]
408,541
<p>Last couple of days we were discussing at <a href="https://stackoverflow.com/questions/401191/how-to-return-random-items-restfully">another question</a> the best to manage randomness in a RESTful way; today I went to play a little bit with some ideas in Django only to find that there is no easy standard way of retur...
[ { "answer_id": 408549, "author": "gak", "author_id": 11125, "author_profile": "https://Stackoverflow.com/users/11125", "pm_score": 6, "selected": true, "text": "class HttpResponseSeeOther(HttpResponseRedirect):\n status_code = 303\n\nreturn HttpResponseSeeOther('/other-url/')\n" }, ...
2009/01/03
[ "https://Stackoverflow.com/questions/408541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34479/" ]
408,556
<p>I have an application that imports information from a CSV file or from a database and exports it to XML. This XML is currently being persisted to a file. However due to project needs I have decided it may be better to persist this XML to a database.</p> <p>Currently I have CSV, XML and SQL repositories that deal wi...
[ { "answer_id": 408867, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 0, "selected": false, "text": "XmlSerializer" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/408556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34991/" ]
408,570
<p>I'm trying to parse an array of JSON objects into an array of strings in C#. I can extract the array from the JSON object, but I can't split the array string into an array of individual objects.</p> <p>What I have is this test string:</p> <pre><code>string json = "{items:[{id:0,name:\"Lorem Ipsum\"},{id:1,name" ...
[ { "answer_id": 408579, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 3, "selected": false, "text": "DataContractJsonSerializer" }, { "answer_id": 1318189, "author": "Community", "author_id": -1, "auth...
2009/01/03
[ "https://Stackoverflow.com/questions/408570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/392/" ]
408,582
<p>I have to call domain A.com (which sets the cookies with http) from domain B.com. All I do on domain B.com is (javascript): </p> <pre><code>var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.src = "A.com/setCookie?cache=1231213123"; head.appendChild(script); <...
[ { "answer_id": 408942, "author": "roenving", "author_id": 23142, "author_profile": "https://Stackoverflow.com/users/23142", "pm_score": -1, "selected": false, "text": "<script type=\"text/javascript\">\n var head = document.getElementsByTagName(\"head\")[0];\n var script = document.cre...
2009/01/03
[ "https://Stackoverflow.com/questions/408582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50394/" ]
408,592
<p>Is it possible to write a C function that does the following?</p> <ol> <li>Allocate a bunch of memory in the heap</li> <li>Writes machine code in it</li> <li>Executes those machines instructions</li> </ol> <p>Of course, I would have to restore the state of the stack to what it was prior to the execution of those m...
[ { "answer_id": 408599, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 2, "selected": false, "text": "mprotect" }, { "answer_id": 408638, "author": "Charlie Martin", "author_id": 35092, "au...
2009/01/03
[ "https://Stackoverflow.com/questions/408592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46571/" ]
408,618
<p>I would like to know that i have an excel file with 18 sheets and it should be opend with any other versions.</p> <p>for example if i right click on the file and select open with open office the same is being opened. i would like to lock this.</p>
[ { "answer_id": 408599, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 2, "selected": false, "text": "mprotect" }, { "answer_id": 408638, "author": "Charlie Martin", "author_id": 35092, "au...
2009/01/03
[ "https://Stackoverflow.com/questions/408618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
408,627
<p>I didn't give a lot of info in my last question.</p> <p>I've built llv8call from <a href="http://code.google.com/p/llv8call/" rel="nofollow noreferrer">http://code.google.com/p/llv8call/</a>, v0.4. I've gotten the known dependencies installed, being libxml-2.0 and libreadline. My dev system is Mac OS X 10.5. llv8ca...
[ { "answer_id": 408649, "author": "Paul", "author_id": 51102, "author_profile": "https://Stackoverflow.com/users/51102", "pm_score": 2, "selected": true, "text": "grep -r \"org.coderepos\" *|less\n" }, { "answer_id": 1533056, "author": "Community", "author_id": -1, "au...
2009/01/03
[ "https://Stackoverflow.com/questions/408627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/68788/" ]
408,646
<p>I have the following XAML code, which displays a <em>picture</em> (image inside borders) and a logo. Right now, the logo appears below the picture. This is expected, however <strong>my goal is to have the logo on top of the picture</strong> (precisely at the bottom-right corner). <strong>Does someone has an idea how...
[ { "answer_id": 408811, "author": "Steven Robbins", "author_id": 26507, "author_profile": "https://Stackoverflow.com/users/26507", "pm_score": 5, "selected": true, "text": "<WrapPanel>\n <Grid>\n <Border BorderBrush=\"Gray\" BorderThickness=\"1\" Margin=\"3\">\n <Bord...
2009/01/03
[ "https://Stackoverflow.com/questions/408646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42024/" ]
408,652
<p>In eclipse, when I want to document a function (in java or javascript source) I can just type /**, then hit enter, and I get a comment like this</p> <pre><code> /** * * Fluctuates all variables to more compatibly foo all the bars * * @PARAM {int} foo */ function flucvar (foo) { } </code></pre> <p>When hi...
[ { "answer_id": 408714, "author": "mipadi", "author_id": 28804, "author_profile": "https://Stackoverflow.com/users/28804", "pm_score": 1, "selected": false, "text": "Help -> TextMate Help" }, { "answer_id": 408940, "author": "Niko Nyman", "author_id": 36817, "author_pr...
2009/01/03
[ "https://Stackoverflow.com/questions/408652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51101/" ]
408,659
<pre><code>typeof(int).Name </code></pre> <p>Will return System.Int32 does anyone know of a way to return "int"</p>
[ { "answer_id": 48271526, "author": "Kody", "author_id": 1754995, "author_profile": "https://Stackoverflow.com/users/1754995", "pm_score": 2, "selected": false, "text": "CSharpCodeProvider" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/408659", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45909/" ]
408,661
<p>When the Java compiler autoboxes a primitive to the wrapper class, what code does it generate behind the scenes? I imagine it calls:</p> <ul> <li>The valueOf() method on the wrapper</li> <li>The wrapper's constructor</li> <li>Some other magic?</li> </ul>
[ { "answer_id": 408668, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 7, "selected": true, "text": "javap" }, { "answer_id": 410603, "author": "Craig P. Motlin", "author_id": 23572, "author_profile...
2009/01/03
[ "https://Stackoverflow.com/questions/408661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23572/" ]
408,670
<p>I've searched, but I've not understood very well these three concepts. When do I have to use dynamic allocation (in the heap) and what's its real advantage? What are the problems of static and stack? Could I write an entire application without allocating variables in the heap? </p> <p>I heard that others language...
[ { "answer_id": 408691, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 6, "selected": false, "text": "if(some condition) {\n int a[3]; // array a has automatic storage duration\n fill_it(a);\n print_i...
2009/01/03
[ "https://Stackoverflow.com/questions/408670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50754/" ]
408,675
<p>I have an ASP.net project I'm looking at and they want to use MySQL. I'm used to SQL server but using mySQL shouldn't be a problem.</p> <p>Normally the control would like a SqlDataSource to bind to but that's not available with MySQL (from other posts on this site).</p> <p>What's the best way to connect MySQL and...
[ { "answer_id": 419109, "author": "Jaydel Gluckie", "author_id": 2019606, "author_profile": "https://Stackoverflow.com/users/2019606", "pm_score": 1, "selected": false, "text": "protected void appointmentsDataSource_ObjectCreated(object sender, ObjectDataSourceEventArgs e)\n {\n ...
2009/01/03
[ "https://Stackoverflow.com/questions/408675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2019606/" ]
408,712
<p>Is anyone aware of a sane way to get tablet/stylus pressure information on Windows?</p> <p>It's possible to distinguish stylus from mouse with ::GetMessageExtraInfo, but you can't get any more information beyond that. I also found the WinTab API in a out of the way corner of the Wacom site, but that's not part of ...
[ { "answer_id": 43852005, "author": "kalbr", "author_id": 1761726, "author_profile": "https://Stackoverflow.com/users/1761726", "pm_score": 2, "selected": false, "text": "const WORD wid = GET_POINTERID_WPARAM(wParam);\nPOINTER_INFO piTemp = {NULL};\nGetPointerInfo(wid, &piTemp);\nif (piTe...
2009/01/03
[ "https://Stackoverflow.com/questions/408712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/784/" ]
408,734
<p>I need a very quick fix in a mod_rewrite expression for drupal we have</p> <pre><code> RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(.*)$ index.php?...
[ { "answer_id": 408737, "author": "gnud", "author_id": 27204, "author_profile": "https://Stackoverflow.com/users/27204", "pm_score": 0, "selected": false, "text": "'SERVER_NAME'\n The name of the server host under which the\n current script is executing. If the script\n is runnin...
2009/01/03
[ "https://Stackoverflow.com/questions/408734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47846/" ]
408,744
<p>F12 is a wonder for tracking down UI blocking operations, but I can't figure out how to make it work with VS 2008 and managed code.</p> <p>Help! Or not...</p> <p>Edit: turns out it doesn't work in VS 2005 either on Vista x64, so I guess that either widens or narrows it down, depending on your perspective :(</p> <...
[ { "answer_id": 446967, "author": "Milan Gardian", "author_id": 23843, "author_profile": "https://Stackoverflow.com/users/23843", "pm_score": 1, "selected": false, "text": "using System;\nusing System.Diagnostics;\nusing System.Drawing;\nusing System.Runtime.InteropServices;\nusing System...
2009/01/03
[ "https://Stackoverflow.com/questions/408744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6210/" ]
408,749
<p>Is it possible to enforce uniqueness across two tables in MySQL?</p> <p>I have two tables, both describing users. The users in these tables were for two different systems previously, however now we're merging our authentication systems and I need to make sure that there are unique usernames across these two tables....
[ { "answer_id": 408781, "author": "kmkaplan", "author_id": 50902, "author_profile": "https://Stackoverflow.com/users/50902", "pm_score": 2, "selected": false, "text": "create table users1 (\n user_id integer primary key,\n username varchar(8) not null unique\n);\ncreate table users2...
2009/01/03
[ "https://Stackoverflow.com/questions/408749", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
408,779
<p>I have 2 tables which in simplified form look like this:</p> <pre><code>Products( id: int, name: varchar ); ProductSpecs( product_id: int, spec_name: varchar, spec_value: int ); </code></pre> <p>Now I need to sort products (in linq to sql) by value of some specification item (eg. "price"). So I do ...
[ { "answer_id": 408861, "author": "Noah", "author_id": 47496, "author_profile": "https://Stackoverflow.com/users/47496", "pm_score": 4, "selected": true, "text": "select p.*\nfrom products p\nleft outer join productspecs ps on\n p.id = ps.product_id\n and ps.spec_name = 'Price'\nord...
2009/01/03
[ "https://Stackoverflow.com/questions/408779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19546/" ]
408,810
<p>I have a wxPython application that relies on an external config file. I want provide friendly message dialogs that show up if there are any config errors. I've tried to make this work by wrapping my app.MainLoop() call in a try/except statement.</p> <p>The code below works for the init code in my MainWindow frame...
[ { "answer_id": 409266, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "(type, value, traceback)" }, { "answer_id": 12109646, "author": "bitman", "author_id": 415075, "author_pro...
2009/01/03
[ "https://Stackoverflow.com/questions/408810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46914/" ]
408,820
<p>Can someone please explain me what's the difference between Swing and AWT?</p> <p>Are there any cases where AWT is more useful/advised to use than swing or vice-versa?</p>
[ { "answer_id": 16810355, "author": "Surendra Bharadwaj", "author_id": 2431861, "author_profile": "https://Stackoverflow.com/users/2431861", "pm_score": 3, "selected": false, "text": "JDialog" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/408820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29515/" ]
408,821
<p>I've seen this questions <a href="https://stackoverflow.com/questions/159366/is-there-a-best-coding-style-for-identations-same-line-next-line">here</a>. I'm wondering if there exists an official name for the following indent style:</p> <pre><code>void fooBar(String s) { while (true) { // ... do some...
[ { "answer_id": 408829, "author": "Eli Bendersky", "author_id": 8206, "author_profile": "https://Stackoverflow.com/users/8206", "pm_score": 2, "selected": false, "text": "ansi" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/408821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49786/" ]
408,825
<p>I have a column which has a datatype : datetime. But now i want to convert it to datatype varchar. Can i alter the datatype without droppping the column? If yes, then please explain how?</p>
[ { "answer_id": 408832, "author": "capotej", "author_id": 1263, "author_profile": "https://Stackoverflow.com/users/1263", "pm_score": 3, "selected": false, "text": "ALTER TABLE YourTableNameHere ALTER COLUMN YourColumnNameHere VARCHAR(20)\n" }, { "answer_id": 408833, "author":...
2009/01/03
[ "https://Stackoverflow.com/questions/408825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29515/" ]
408,834
<p>I have a form with checkboxes, each one has a value. When the registered user select any checkbox the value is incremented (the summation) and then then registred user save his</p> <p>selection of checkbox if he satisfied with the result of summation into database all this work fine ...i want to enable the regis...
[ { "answer_id": 408837, "author": "kmkaplan", "author_id": 50902, "author_profile": "https://Stackoverflow.com/users/50902", "pm_score": 1, "selected": false, "text": "UPDATE" }, { "answer_id": 408899, "author": "Ali", "author_id": 49153, "author_profile": "https://Sta...
2009/01/03
[ "https://Stackoverflow.com/questions/408834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
408,855
<p>I have a database populated with 1 million objects. Each object has a 'tags' field - set of integers.</p> <p>For example:</p> <pre><code>object1: tags(1,3,4) object2: tags(2) object3: tags(3,4) object4: tags(5) </code></pre> <p>and so on.</p> <p>Query parameter is a set on integers, lets try q(3,4,5)</p> <pre><...
[ { "answer_id": 408893, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 2, "selected": false, "text": ">>> a = set([1,2,3])\n>>> a\nset([1, 2, 3])\n>>> 1 in a\nTrue\n>>> set([1,2]) in a\nFalse\n>>> set([2,3]) & a\nset([...
2009/01/03
[ "https://Stackoverflow.com/questions/408855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21152/" ]
408,866
<p>I need to store Python structures made of lists / dictionaries, tuples into a human-readable format. The idea is like using something similar to <a href="http://docs.python.org/library/pickle.html" rel="nofollow noreferrer">pickle</a>, but pickle is not human-friendly. Other options that come to my mind are <a href=...
[ { "answer_id": 408889, "author": "PEZ", "author_id": 44639, "author_profile": "https://Stackoverflow.com/users/44639", "pm_score": 5, "selected": true, "text": ">>> d = {'age': 27,\n... 'name': 'Joe',\n... 'numbers': [1, \n... 2, \n... 3,\n... 4,\...
2009/01/03
[ "https://Stackoverflow.com/questions/408866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42636/" ]
408,868
<p>This is regarding SSRS engine. For my project we are not going to buy SQL server software. Instead of what I just want to know, is there any posibility to use only SSRS engine. So that I can have the ref. (DLL) And then I can use wherever I want.</p> <p>Please help on this.</p>
[ { "answer_id": 45571797, "author": "Ajay Kumar", "author_id": 6451051, "author_profile": "https://Stackoverflow.com/users/6451051", "pm_score": 0, "selected": false, "text": " using (Microsoft.Reporting.WebForms.LocalReport report = new LocalReport())\n {\n ...
2009/01/03
[ "https://Stackoverflow.com/questions/408868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
408,872
<p>New to both Ruby and Rails but I'm book educated by now (which apparently means nothing, haha).</p> <p>I've got two models, Event and User joined through a table EventUser</p> <pre><code>class User &lt; ActiveRecord::Base has_many :event_users has_many :events, :through =&gt; :event_users end class EventUser ...
[ { "answer_id": 408913, "author": "Milan Novota", "author_id": 26123, "author_profile": "https://Stackoverflow.com/users/26123", "pm_score": 8, "selected": true, "text": "has_many :active_events, :through => :event_users, \n :class_name => \"Event\", \n :source => :even...
2009/01/03
[ "https://Stackoverflow.com/questions/408872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13257/" ]
408,898
<p>intro: I am pretty sure this is my fault. But I just don't see it and before tearing my hair out, I thought I should ask here ;)</p> <p>I have a button which looks like this in my ASPX:</p> <pre><code>&lt;input onClick="ELB_ClearSelection('DropDownList___00178');" type="Button" value="Clear" /&gt; </code></pre> <...
[ { "answer_id": 408921, "author": "OJ.", "author_id": 611, "author_profile": "https://Stackoverflow.com/users/611", "pm_score": 2, "selected": true, "text": "onClick='ELB_ClearSelection(\"DropDownList___00178\")'\n" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/408898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51127/" ]
408,908
<p>Are there any preprocessor symbols which allow something like</p> <pre><code>#if CLR_AT_LEAST_3.5 // use ReaderWriterLockSlim #else // use ReaderWriterLock #endif </code></pre> <p>or some other way to do this?</p>
[ { "answer_id": 408918, "author": "Frederick The Fool", "author_id": 32688, "author_profile": "https://Stackoverflow.com/users/32688", "pm_score": 5, "selected": true, "text": "VERSION2" }, { "answer_id": 408937, "author": "Marc Gravell", "author_id": 23354, "author_pr...
2009/01/03
[ "https://Stackoverflow.com/questions/408908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9204/" ]
408,917
<p>I am creating an application in iPhone and I have several UIViews and layers in it. I am doing some animations using CAKeyframeAnimation class and since the animations have to be chained, I have overridden the animationDidStop method in UIView.</p> <p>I am getting the callbacks properly, however I just couldn't fig...
[ { "answer_id": 409734, "author": "Brad Larson", "author_id": 19679, "author_profile": "https://Stackoverflow.com/users/19679", "pm_score": 4, "selected": false, "text": "[UIView beginAnimations:nil context:NULL];\n[UIView setAnimationDuration:ANIMATIONDURATIONINSECONDS];\n[UIView setAnim...
2009/01/03
[ "https://Stackoverflow.com/questions/408917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51130/" ]
408,965
<p>I see console apps print colors and seen apps such as ffmpeg print text over itself instead of a new line. How do I print over an existing line? I want to display fps in my console app either at the very top or very bottom and have regular printfs go there and scroll normally.</p> <p>I need this for windows, but thi...
[ { "answer_id": 408968, "author": "kmkaplan", "author_id": 50902, "author_profile": "https://Stackoverflow.com/users/50902", "pm_score": 2, "selected": false, "text": "putchar(8);" }, { "answer_id": 408973, "author": "lImbus", "author_id": 32490, "author_profile": "htt...
2009/01/03
[ "https://Stackoverflow.com/questions/408965", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
408,975
<p>The following code gives </p> <blockquote> <p>[: -ge: unary operator expected</p> </blockquote> <p>when </p> <pre><code>i=0 if [ $i -ge 2 ] then #some code fi </code></pre> <p>why?</p>
[ { "answer_id": 605138, "author": "vladr", "author_id": 66516, "author_profile": "https://Stackoverflow.com/users/66516", "pm_score": 8, "selected": false, "text": "$i" }, { "answer_id": 14154695, "author": "Roman Newaza", "author_id": 705373, "author_profile": "https:...
2009/01/03
[ "https://Stackoverflow.com/questions/408975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39106/" ]
408,978
<p>I'm trying to find any JavaScript frameworks whose sole aim is to standardize the DOM and JavaScript across all browsers.</p> <p>What I'm not looking for is frameworks which create their own API to solve these common problems. I want something that will allow me to call for example myElement.dispatchEvent("click") ...
[ { "answer_id": 409081, "author": "Alcides", "author_id": 28516, "author_profile": "https://Stackoverflow.com/users/28516", "pm_score": 0, "selected": false, "text": "window.alert = function(i) {};" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/408978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37196/" ]
408,985
<p>when i run this code :</p> <pre><code>CONADefinitions.CONAPI_FOLDER_INFO2 FolderInfo; int iResult = 0; IntPtr Buffer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(CONADefinitions.CONAPI_FOLDER_INFO2))); iResult = CONAFileSystem.CONAFindNextFolder(hFindHandle, Buffer); while (iResult == PCCSErrors.CO...
[ { "answer_id": 409040, "author": "Leon Tayson", "author_id": 18413, "author_profile": "https://Stackoverflow.com/users/18413", "pm_score": 3, "selected": true, "text": " DriveInfo di = new DriveInfo(\"f\"); //Put your mobile drive name\n long totalBytes = di.TotalSize;\n ...
2009/01/03
[ "https://Stackoverflow.com/questions/408985", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42782/" ]
408,987
<p>Can anybody clarify if Microsoft has released a [draft] specification of C# 4.0 yet? If so, where can I find/download it?</p>
[ { "answer_id": 409043, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "dynamic" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/408987", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28413/" ]
408,989
<p>I want to build a dialog in Java with a List and a couple of buttons underneath it. The list ends up with the same height as the buttons (about one line) and the whole dialog is about two lines of height.</p> <p>However, I'd like the dialog to be taller (maybe 10 lines) and the JList to take up most of the space .....
[ { "answer_id": 412061, "author": "jfpoilpret", "author_id": 1440720, "author_profile": "https://Stackoverflow.com/users/1440720", "pm_score": 2, "selected": false, "text": "_myList.setVisibleRowCount(n)" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/408989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25320/" ]
408,998
<p>I'm playing around with MCE, I was wondering if there was the possibility of letting the user enter source code into a post, much like the 101010 button in this form.</p>
[ { "answer_id": 27865292, "author": "Midnightly Coder", "author_id": 1572717, "author_profile": "https://Stackoverflow.com/users/1572717", "pm_score": 5, "selected": false, "text": "tinymce.init({\n plugins: \"code\"\n});\n" }, { "answer_id": 48633699, "author": "Moji", ...
2009/01/03
[ "https://Stackoverflow.com/questions/408998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
409,012
<p>i want to add tracking to my website. I saw google analytics which seems to track what i need. </p> <p>So do i stick the google analytics snippet in each page, in a master page, just in my default page? what is the best practice here to get the best metrics.</p>
[ { "answer_id": 409015, "author": "M4N", "author_id": 19635, "author_profile": "https://Stackoverflow.com/users/19635", "pm_score": 4, "selected": true, "text": "<!-- #include file=\"file_containing_google_analytics_code.js\" -->\n" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/409012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
409,025
<p>I want to make a mini timeline with jquery and for this timeline to have a width more than 32767 px. When I change it with jquery <code>$(".timelinecontainer").width(32767);</code> in Opera does not change it, but in others browsers it works. </p> <p>Can you give me advice on getting it to work in Opera ? </p>
[ { "answer_id": 410075, "author": "Borgar", "author_id": 27388, "author_profile": "https://Stackoverflow.com/users/27388", "pm_score": 0, "selected": false, "text": "width:9999em" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/409025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51142/" ]
409,046
<p>We are using MySQL version 5.0 and most of the tables are InnoDB. We run replication to a slave server. We are thinking of backing up the MySQL log files on a daily basis.</p> <h1>Questions</h1> <ul> <li>Is there any other way of doing an incremental backup without using the log files?</li> <li>What are the best pra...
[ { "answer_id": 64774206, "author": "Ivan", "author_id": 9210727, "author_profile": "https://Stackoverflow.com/users/9210727", "pm_score": 2, "selected": false, "text": "xtrabackup --backup --target-dir=/data/backups/inc1 --incremental-basedir=/data/backups/base\n" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/409046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17560/" ]
409,049
<p>I have a controller action which I would like to call another controller action.</p> <p>Is this a valid thing to do. Is it possible?</p>
[ { "answer_id": 409051, "author": "yfeldblum", "author_id": 12349, "author_profile": "https://Stackoverflow.com/users/12349", "pm_score": 6, "selected": true, "text": "Controller.RedirectToAction" } ]
2009/01/03
[ "https://Stackoverflow.com/questions/409049", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46616/" ]
409,060
<p>(<em>Almost exact duplicate of <a href="https://stackoverflow.com/questions/408469/keeping-original-format-post-passing-through-awk">Keeping original format POST passing through AWK</a> submitted by same person.</em>)</p> <p>I have a simple question pertaining to <b>g</b>awk, illustrated below:</p> <pre><code> 1 ...
[ { "answer_id": 409090, "author": "Zsolt Botykai", "author_id": 11621, "author_profile": "https://Stackoverflow.com/users/11621", "pm_score": 2, "selected": false, "text": "awk '{sub(/^[ \\t]+/, \"\"); print}'\n" }, { "answer_id": 409317, "author": "Jonathan Leffler", "aut...
2009/01/03
[ "https://Stackoverflow.com/questions/409060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51078/" ]
409,069
<p>How do I get the size (free, total) of any drive on a Windows Mobile phone using C#?</p> <p>I need to do this with code running on the device (not on a connected PC).</p>
[ { "answer_id": 409143, "author": "ctacke", "author_id": 13154, "author_profile": "https://Stackoverflow.com/users/13154", "pm_score": 4, "selected": true, "text": "public class MyClass\n{\n [DllImport(\"coredll.dll\", SetLastError=true, CharSet=CharSet.Auto)]\n [return: MarshalAs(Unman...
2009/01/03
[ "https://Stackoverflow.com/questions/409069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42782/" ]
409,076
<p>I'm trying to create nested Organizational Units in Active Directory and I'm close to having this working. I have a problem line below that I need help with. I'm checking if an OU exists and if not I need to create it, strOUArray contains OU=Test OU=Test2 and OU=Test3. I need the code to create OU=Test first and the...
[ { "answer_id": 409278, "author": "ecoffey", "author_id": 37838, "author_profile": "https://Stackoverflow.com/users/37838", "pm_score": 1, "selected": false, "text": "//PROBLEM LINE" }, { "answer_id": 509192, "author": "marc_s", "author_id": 13302, "author_profile": "h...
2009/01/03
[ "https://Stackoverflow.com/questions/409076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
409,151
<p>I have a page where when some operation goes wrong i want to start the timer, wait 30 second, stop the timer and retry the operation. Every time the timer starts I need to inform the user about it by changing some label's text. </p> <p>How can I do it?</p>
[ { "answer_id": 409235, "author": "M4N", "author_id": 19635, "author_profile": "https://Stackoverflow.com/users/19635", "pm_score": 3, "selected": true, "text": " <script>\n function StartTimer()\n {\n setTimeout('DoPostBack()', 30000); // call DoPostBack in 30 seconds\n }\...
2009/01/03
[ "https://Stackoverflow.com/questions/409151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40872/" ]
409,153
<p>What is the best function to use in php when grabbing the contents of a file. Currently Im using fopen but when I try to get the headers it uses roughly 2-3 seconds to get the headers. Would HTTPRequest be a better option?</p>
[ { "answer_id": 409180, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 3, "selected": true, "text": "curl_setopt($myCurlResource, CURLOPT_HEADER, true)" }, { "answer_id": 409990, "author": "Community", "author_i...
2009/01/03
[ "https://Stackoverflow.com/questions/409153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4985/" ]
409,162
<p>When doing a simple performance measurement, I was astonished to see that calling <code>String.IndexOf(char)</code> was actually slower than doing it manually! Is this really true?! Here is my test code:</p> <pre><code>const string str = @"91023m lkajsdfl;jkasdf;piou-09324\\adf \asdf\45\ 65u\ 86\ 8\\\;"; static int...
[ { "answer_id": 409206, "author": "Greg Beech", "author_id": 13552, "author_profile": "https://Stackoverflow.com/users/13552", "pm_score": 3, "selected": false, "text": "IndexOf" }, { "answer_id": 409228, "author": "Bartek Szabat", "author_id": 23774, "author_profile":...
2009/01/03
[ "https://Stackoverflow.com/questions/409162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41283/" ]
409,173
<p>How do I import a CSV file using OpenOffice.org APIs? I want to do this using the same functionality that is also provided when I open the same file using "CVS text" filter.</p>
[ { "answer_id": 409206, "author": "Greg Beech", "author_id": 13552, "author_profile": "https://Stackoverflow.com/users/13552", "pm_score": 3, "selected": false, "text": "IndexOf" }, { "answer_id": 409228, "author": "Bartek Szabat", "author_id": 23774, "author_profile":...
2009/01/03
[ "https://Stackoverflow.com/questions/409173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51162/" ]
409,198
<p>I remember someone saying if you create a class through a lib you should destroy it through the library. So, does this mean I shouldn't call delete? I should call <code>myclass.deleteMe()</code> instead? Would overloading delete solve the problem?</p>
[ { "answer_id": 409205, "author": "ChrisW", "author_id": 49942, "author_profile": "https://Stackoverflow.com/users/49942", "pm_score": 3, "selected": true, "text": "delete this;" }, { "answer_id": 409215, "author": "Johannes Schaub - litb", "author_id": 34509, "author_...
2009/01/03
[ "https://Stackoverflow.com/questions/409198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
409,213
<p>I want to create a view that has different displays according to the role the user is in. </p> <p>Should I create a different view for different roles or should I check the roles on the Veiw page itself rather than in the actions?</p> <p>How would I check the role on the view page?</p>
[ { "answer_id": 409249, "author": "Wayne Molina", "author_id": 40667, "author_profile": "https://Stackoverflow.com/users/40667", "pm_score": 0, "selected": false, "text": "<% if @user.admin? # is the user an admin %>\n <h3>Admin Tools</h3>\n<% end %>\n<p>Regular site content</p>\n" }, ...
2009/01/03
[ "https://Stackoverflow.com/questions/409213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43838/" ]