qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
4
<p>I want to assign the decimal variable &quot;trans&quot; to the double variable &quot;this.Opacity&quot;.</p> <pre class="lang-cs prettyprint-override"><code>decimal trans = trackBar1.Value / 5000; this.Opacity = trans; </code></pre> <p>When I build the app it gives the following error:</p> <blockquote> <p>Cannot imp...
[ { "answer_id": 7, "author": "Kevin Dente", "author_id": 9, "author_profile": "https://Stackoverflow.com/users/9", "pm_score": 10, "selected": true, "text": "double double trans = (double) trackBar1.Value / 5000.0;\n 5000.0 5000d double trans = trackBar1.Value / 5000.0;\ndouble trans = tr...
2008/07/31
[ "https://Stackoverflow.com/questions/4", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8/" ]
6
<p>I have an absolutely positioned <code>div</code> containing several children, one of which is a relatively positioned <code>div</code>. When I use a <code>percentage-based width</code> on the child <code>div</code>, it collapses to <code>0 width</code> on IE7, but not on Firefox or Safari.</p> <p>If I use <code>pixe...
[ { "answer_id": 31, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 8, "selected": true, "text": "div width div width div" }, { "answer_id": 1948, "author": "Matt MacLean", "author_id": 22, "author_profile": "...
2008/07/31
[ "https://Stackoverflow.com/questions/6", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9/" ]
9
<p>Given a <code>DateTime</code> representing a person's birthday, how do I calculate their age in years?</p>
[ { "answer_id": 22, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 6, "selected": false, "text": "DateTime birthDate = new DateTime(2000,3,1);\nint age = (int)Math.Floor((DateTime.Now - birthDate).TotalDays / 365.25D);\n" }...
2008/07/31
[ "https://Stackoverflow.com/questions/9", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1/" ]
11
<p>Given a specific <code>DateTime</code> value, how do I display relative time, like:</p> <ul> <li><code>2 hours ago</code></li> <li><code>3 days ago</code></li> <li><code>a month ago</code></li> </ul>
[ { "answer_id": 12, "author": "Jeff Atwood", "author_id": 1, "author_profile": "https://Stackoverflow.com/users/1", "pm_score": 8, "selected": false, "text": "var ts = new TimeSpan(DateTime.UtcNow.Ticks - dt.Ticks);\ndouble delta = Math.Abs(ts.TotalSeconds);\n\nif (delta < 60)\n{\n retur...
2008/07/31
[ "https://Stackoverflow.com/questions/11", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1/" ]
13
<p>Is there a standard way for a web server to be able to determine a user's timezone within a web page? </p> <p>Perhaps from an HTTP header or part of the <code>user-agent</code> string?</p>
[ { "answer_id": 817, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 5, "selected": false, "text": "visitortime.getTimezoneOffset()\n maxmind" }, { "answer_id": 1809974, "author": "JD Isaacks", "author_id": ...
2008/08/01
[ "https://Stackoverflow.com/questions/13", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9/" ]
14
<p>What is the difference between <a href="http://msdn.microsoft.com/en-us/library/9a6a2sxy.aspx" rel="noreferrer"><code>Math.Floor()</code></a> and <a href="http://msdn.microsoft.com/en-us/library/system.math.truncate.aspx" rel="noreferrer"><code>Math.Truncate()</code></a> in .NET?</p>
[ { "answer_id": 33, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 9, "selected": false, "text": "Math.Floor Math.Ceiling Math.Truncate Math.Truncate Math.Floor Math.Ceiling Math.Round" }, { "answer_id": 2086, "aut...
2008/08/01
[ "https://Stackoverflow.com/questions/14", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11/" ]
16
<p>How do you expose a LINQ query as an ASMX web service? <br> Usually, from the business tier, I can return a typed <code>DataSet</code> or a <code>DataTable</code> which can be serialized for transport over ASMX.</p> <p>How can I do the same for a LINQ query? <br> Is there a way to populate a typed <code>DataSet</cod...
[ { "answer_id": 84, "author": "Dave Ward", "author_id": 60, "author_profile": "https://Stackoverflow.com/users/60", "pm_score": 4, "selected": false, "text": "IEnumerable" }, { "answer_id": 5830, "author": "Brian Childress", "author_id": 721, "author_profile": "https:/...
2008/08/01
[ "https://Stackoverflow.com/questions/16", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2/" ]
17
<p>How do I store binary data in <a href="http://en.wikipedia.org/wiki/MySQL" rel="noreferrer">MySQL</a>?</p>
[ { "answer_id": 18, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 6, "selected": false, "text": "CREATE TABLE binary_data (\n id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,\n description CHAR(50),\n bin_data LONGBLOB,\...
2008/08/01
[ "https://Stackoverflow.com/questions/17", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2/" ]
19
<p>I'm looking for the fastest way to obtain the value of π, as a personal challenge. More specifically, I'm using ways that don't involve using <code>#define</code> constants like <code>M_PI</code>, or hard-coding the number in.</p> <p>The program below tests the various ways I know of. The inline assembly version is...
[ { "answer_id": 531, "author": "nlucaroni", "author_id": 157, "author_profile": "https://Stackoverflow.com/users/157", "pm_score": 9, "selected": true, "text": "let pi_2 iters =\n let rec loop_ a b t p i =\n if i = 0 then a,b,t,p\n else\n let a_n = (a +. b) /. ...
2008/08/01
[ "https://Stackoverflow.com/questions/19", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13/" ]
24
<p>If I have a trigger before the update on a table, how can I throw an error that prevents the update on that table?</p>
[ { "answer_id": 7189396, "author": "RuiDC", "author_id": 521586, "author_profile": "https://Stackoverflow.com/users/521586", "pm_score": 7, "selected": false, "text": "SIGNAL signal sqlstate '45000' set message_text = 'My Error Message';\n delimiter //\nuse test//\ncreate table trigger_te...
2008/08/01
[ "https://Stackoverflow.com/questions/24", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22/" ]
25
<p>I'm having issues getting the C sockets API to work properly in C++ on z/OS.</p> <p>Although I am including <code>sys/socket.h</code>, I still get compile time errors telling me that <code>AF_INET</code> is not defined.</p> <p>Am I missing something obvious, or is this related to the fact that being on z/OS makes my...
[ { "answer_id": 30, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 5, "selected": false, "text": "#include <sys/socket.h>\n\nint\nmain()\n{\n return AF_INET;\n}\n" }, { "answer_id": 73, "author": "C. K. Young", ...
2008/08/01
[ "https://Stackoverflow.com/questions/25", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23/" ]
34
<p>How do I forcefully unload a <code>ByteArray</code> from memory using ActionScript 3?</p> <p>I have tried the following:</p> <pre><code>// First non-working solution byteArray.length = 0; byteArray = new ByteArray(); // Second non-working solution for ( var i:int=0; i &lt; byteArray.length; i++ ) { byteArray[...
[ { "answer_id": 52, "author": "Jax", "author_id": 23, "author_profile": "https://Stackoverflow.com/users/23", "pm_score": 4, "selected": false, "text": "private var gcCount:int;\nprivate function startGCCycle():void{\n gcCount = 0;\n addEventListener(Event.ENTER_FRAME, doGC);\n}\npr...
2008/08/01
[ "https://Stackoverflow.com/questions/34", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
36
<p>How can I monitor an SQL Server database for changes to a table without using triggers or modifying the structure of the database in any way? My preferred programming environment is <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="noreferrer">.NET</a> and C#.</p> <p>I'd like to be able to support any <a h...
[ { "answer_id": 82, "author": "Yaakov Ellis", "author_id": 51, "author_profile": "https://Stackoverflow.com/users/51", "pm_score": 4, "selected": false, "text": "select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'ABC'\n" }, { "answer_id": 352, "author": "Jon Galloway...
2008/08/01
[ "https://Stackoverflow.com/questions/36", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32/" ]
39
<p>I am aware that in <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="noreferrer">.NET</a> there are three timer types (see <em><a href="http://msdn.microsoft.com/en-us/magazine/cc164015.aspx" rel="noreferrer">Comparing the Timer Classes in the .NET Framework Class Library</a></em>). I have chosen a threaded...
[ { "answer_id": 44, "author": "Greg Hurlman", "author_id": 35, "author_profile": "https://Stackoverflow.com/users/35", "pm_score": 5, "selected": false, "text": "Reset()" }, { "answer_id": 45, "author": "huseyint", "author_id": 39, "author_profile": "https://Stackoverf...
2008/08/01
[ "https://Stackoverflow.com/questions/39", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33/" ]
42
<p>I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface. </p> <p>How does one go about writing 'hooks' into their code so that plugins can attach to specific events?</p>
[ { "answer_id": 77, "author": "Kevin", "author_id": 40, "author_profile": "https://Stackoverflow.com/users/40", "pm_score": 8, "selected": true, "text": "<?php\n\n/** Plugin system **/\n\n$listeners = array();\n\n/* Create an entry point for plugins */\nfunction hook() {\n global $list...
2008/08/01
[ "https://Stackoverflow.com/questions/42", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37/" ]
48
<p>Let's say you create a wizard in an HTML form. One button goes back, and one goes forward. Since the <em>back</em> button appears first in the markup when you press <kbd>Enter</kbd>, it will use that button to submit the form.</p> <p>Example:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-consol...
[ { "answer_id": 56, "author": "huseyint", "author_id": 39, "author_profile": "https://Stackoverflow.com/users/39", "pm_score": 6, "selected": false, "text": "<input type=\"submit\" name=\"submitButton\" value=\"Previous Page\" />\n<input type=\"submit\" name=\"submitButton\" value=\"Next ...
2008/08/01
[ "https://Stackoverflow.com/questions/48", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40/" ]
59
<p>I have a <code>DataTable</code> with a <code>Name</code> column. I want to generate a collection of the unique names ordered alphabetically. The following query ignores the <em>order by</em> clause.</p> <pre><code>var names = (from DataRow dr in dataTable.Rows orderby (string)dr["Name"] select (string)d...
[ { "answer_id": 62, "author": "Bob", "author_id": 45, "author_profile": "https://Stackoverflow.com/users/45", "pm_score": 6, "selected": false, "text": "var names = (from DataRow dr in dataTable.Rows\n select (string)dr[\"Name\"]).Distinct().OrderBy( name => name );\n" }, ...
2008/08/01
[ "https://Stackoverflow.com/questions/59", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45/" ]
66
<p>How do you page through a collection in LINQ given that you have a <code>startIndex</code> and a <code>count</code>?</p>
[ { "answer_id": 68, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 6, "selected": false, "text": "Skip Take var query = from i in ideas\n select i;\n\nvar paggedCollection = query.Skip(startIndex).Take(count);\n" ...
2008/08/01
[ "https://Stackoverflow.com/questions/66", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17/" ]
72
<p>I want to format my existing comments as 'RDoc comments' so they can be viewed using <code>ri</code>.</p> <p>What are some recommended resources for starting out using RDoc?</p>
[ { "answer_id": 23993, "author": "James A. Rosen", "author_id": 1190, "author_profile": "https://Stackoverflow.com/users/1190", "pm_score": 4, "selected": false, "text": ":main: --main :title: :section:" } ]
2008/08/01
[ "https://Stackoverflow.com/questions/72", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25/" ]
80
<p>I've written a database generation script in <a href="http://en.wikipedia.org/wiki/SQL" rel="noreferrer">SQL</a> and want to execute it in my <a href="http://en.wikipedia.org/wiki/Adobe_Integrated_Runtime" rel="noreferrer">Adobe AIR</a> application:</p> <pre><code>Create Table tRole ( roleID integer Primary Key...
[ { "answer_id": 124, "author": "Shawn", "author_id": 26, "author_profile": "https://Stackoverflow.com/users/26", "pm_score": 5, "selected": true, "text": "var strSql:String = stream.readUTFBytes(stream.bytesAvailable); \nvar i:Number = 0;\nvar strSqlSplit:Array = strSql.split(\";\");...
2008/08/01
[ "https://Stackoverflow.com/questions/80", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26/" ]
85
<p>What are the best practices around creating flat file database structures in PHP?</p> <p>A lot of more matured PHP flat file frameworks out there which I attempt to implement SQL-like query syntax which is over the top for my purposes in most cases. (I would just use a database at that point).</p> <p>Are there any...
[ { "answer_id": 87, "author": "saint_groceon", "author_id": 59, "author_profile": "https://Stackoverflow.com/users/59", "pm_score": 4, "selected": false, "text": "./content/YYYYMMDDHHMMSS/\n /tags \n/authors \n/comments \n glob() glob(\"content/*/tags/funny\"); \n" }, { "answe...
2008/08/01
[ "https://Stackoverflow.com/questions/85", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59/" ]
88
<p>I am porting a game, that was originally written for the Win32 API, to Linux (well, porting the OS X port of the Win32 port to Linux).</p> <p>I have implemented <code>QueryPerformanceCounter</code> by giving the uSeconds since the process start up: </p> <pre><code>BOOL QueryPerformanceCounter(LARGE_INTEGER* pe...
[ { "answer_id": 98, "author": "Louis Brandy", "author_id": 2089740, "author_profile": "https://Stackoverflow.com/users/2089740", "pm_score": 7, "selected": true, "text": "gettimeofday() gettimeofday() clock_gettime(CLOCK_MONOTONIC) clock_getres()" }, { "answer_id": 367, "autho...
2008/08/01
[ "https://Stackoverflow.com/questions/88", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61/" ]
104
<p>In .NET perspective:</p> <ul> <li>What is a <a href="https://en.wikipedia.org/wiki/Memory_leak" rel="noreferrer">memory leak</a>?</li> <li>How can you determine whether your application leaks? What are the effects?</li> <li>How can you prevent a memory leak?</li> <li>If your application has memory leak, does it go ...
[ { "answer_id": 2947, "author": "Seibar", "author_id": 357, "author_profile": "https://Stackoverflow.com/users/357", "pm_score": 3, "selected": false, "text": "StreamReader sr;\nusing(sr = new StreamReader(\"somefile.txt\"))\n{\n //do some stuff\n}\n" }, { "answer_id": 4702, ...
2008/08/01
[ "https://Stackoverflow.com/questions/104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39/" ]
109
<p>Recently our site has been deluged with the resurgence of the <a href="https://en.wikipedia.org/wiki/Asprox_botnet" rel="noreferrer">Asprox botnet</a> <a href="http://en.wikipedia.org/wiki/SQL_injection" rel="noreferrer">SQL injection</a> attack. Without going into details, the attack attempts to execute SQL code by...
[ { "answer_id": 304, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Stackoverflow.com/users/91", "pm_score": 3, "selected": false, "text": "0x Encoding.UTF8.GetString 44 00 = D\n\n45 00 = E\n\n6F 00 = o\n\n72 00 = r\n" }, { "answer_id": 2585, "author": "...
2008/08/01
[ "https://Stackoverflow.com/questions/109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/71/" ]
123
<p>Is there an existing application or library in <em>Java</em> which will allow me to convert a <code>CSV</code> data file to <code>XML</code> file? </p> <p>The <code>XML</code> tags would be provided through possibly the first row containing column headings.</p>
[ { "answer_id": 133, "author": "saint_groceon", "author_id": 59, "author_profile": "https://Stackoverflow.com/users/59", "pm_score": 2, "selected": false, "text": "String.split()" }, { "answer_id": 6726, "author": "Anthony Cramp", "author_id": 488, "author_profile": "h...
2008/08/01
[ "https://Stackoverflow.com/questions/123", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78/" ]
126
<p>What is the "purist" or "correct" way to access an object's properties from within an object method that is not a getter/setter method?</p> <p>I know that from outside of the object you should use a getter/setter, but from within would you just do:</p> <p>Java:</p> <pre><code>String property = this.property; </co...
[ { "answer_id": 139, "author": "pix0r", "author_id": 72, "author_profile": "https://Stackoverflow.com/users/72", "pm_score": 4, "selected": false, "text": "public function getName() {\n $this->incrementNameCalled();\n return $this->_getName();\n}\n\nprotected function _getName() {\n...
2008/08/01
[ "https://Stackoverflow.com/questions/126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58/" ]
145
<p>Does anyone know of a good way to compress or decompress files and folders in C# quickly? Handling large files might be necessary.</p>
[ { "answer_id": 2142, "author": "Dave Anderson", "author_id": 371, "author_profile": "https://Stackoverflow.com/users/371", "pm_score": 5, "selected": false, "text": "System.IO.Compression GZipStream DefaultStream public static byte[] Compress(byte[] data)\n{\n MemoryStream output = ne...
2008/08/01
[ "https://Stackoverflow.com/questions/145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/87/" ]
146
<p>I have a website that plays mp3s in a flash player. If a user clicks 'play' the flash player automatically downloads an mp3 and starts playing it. </p> <p>Is there an easy way to track how many times a particular song clip (or any binary file) has been downloaded?</p> <hr> <blockquote> <p>Is the play link a lin...
[ { "answer_id": 152, "author": "w-ll", "author_id": 146637, "author_profile": "https://Stackoverflow.com/users/146637", "pm_score": 6, "selected": true, "text": "$filename = base64_url_decode($_REQUEST['file']);\nheader(\"Cache-Control: public\");\nheader('Content-disposition: attachment;...
2008/08/01
[ "https://Stackoverflow.com/questions/146", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30/" ]
163
<p>Stack Overflow has a subversion version number at the bottom:</p> <blockquote> <p>svn revision: 679</p> </blockquote> <p>I want to use such automatic versioning with my <code>.NET Web Site/Application</code>, Windows Forms, WPD projects/solutions.</p> <p>How do I implement this?</p>
[ { "answer_id": 166, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 5, "selected": false, "text": "$Id:$\n <div id=\"svnrevision\">svn revision: $Id:$</div>\n" }, { "answer_id": 9391, "author": "James Pogran", ...
2008/08/01
[ "https://Stackoverflow.com/questions/163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
164
<p><strong>Edit:</strong> This question was written in 2008, which was like 3 internet ages ago. If this question is still relevant to your environment, please accept my condolences. Everyone else should convert into a format <a href="https://videojs.com/html5-video-support/" rel="noreferrer">supported by your browsers...
[ { "answer_id": 167, "author": "Grant", "author_id": 30, "author_profile": "https://Stackoverflow.com/users/30", "pm_score": 3, "selected": false, "text": "<![if !IE]>\n<p> Firefox only code</p>\n<![endif]>\n\n<!--[if IE]>\n<p>Internet Explorer only code</p>\n<![endif]-->\n" }, { ...
2008/08/01
[ "https://Stackoverflow.com/questions/164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
173
<p>I want to get my databases under version control.</p> <p>I'll always want to have at least <em>some</em> data in there (as <a href="https://stackoverflow.com/users/80/alumb">alumb</a> mentions: user types and administrators). I'll also often want a large collection of generated test data for performance measurements...
[ { "answer_id": 516, "author": "ESV", "author_id": 150, "author_profile": "https://Stackoverflow.com/users/150", "pm_score": 9, "selected": true, "text": "create table VersionHistory (\n Version int primary key,\n UpgradeStart datetime not null,\n UpgradeEnd datetime\n );\n" ...
2008/08/01
[ "https://Stackoverflow.com/questions/173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
174
<p>I want to print HTML from a C# web service. The web browser control is overkill, and does not function well in a service environment, nor does it function well on a system with very tight security constraints. Is there any sort of free <code>.NET</code> library that will support the printing of a basic HTML page? ...
[ { "answer_id": 768, "author": "ICR", "author_id": 214, "author_profile": "https://Stackoverflow.com/users/214", "pm_score": 5, "selected": false, "text": "using (Process printProcess = new Process())\n{\n string systemPath = Environment.GetFolderPath(Environment.SpecialFolder.System);...
2008/08/01
[ "https://Stackoverflow.com/questions/174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/96/" ]
175
<p>I want to be able to display a normal YouTube video with overlaid annotations, consisting of coloured rectangles for each frame. The only requirement is that this should be done programmatically. </p> <p>YouTube has annotations now, but require you to use their front end to create them by hand. I want to be able to...
[ { "answer_id": 7157, "author": "grapefrukt", "author_id": 914, "author_profile": "https://Stackoverflow.com/users/914", "pm_score": 3, "selected": false, "text": "annotation-thingamajig" }, { "answer_id": 65659, "author": "nerdabilly", "author_id": 8349, "author_profi...
2008/08/01
[ "https://Stackoverflow.com/questions/175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2089740/" ]
176
<p>On one Linux Server running Apache and PHP 5, we have multiple Virtual Hosts with separate log files. We cannot seem to separate the php <code>error_log</code> between virtual hosts.</p> <p>Overriding this setting in the <code>&lt;Location&gt;</code> of the <code>httpd.conf</code> does not seem to do anything.</p> ...
[ { "answer_id": 207, "author": "helloandre", "author_id": 50, "author_profile": "https://Stackoverflow.com/users/50", "pm_score": 7, "selected": true, "text": "<VirtualHost IP:Port>\n # Stuff,\n # More Stuff,\n ErrorLog /path/where/you/want/the/error.log\n</VirtualHost>\n" }, { ...
2008/08/01
[ "https://Stackoverflow.com/questions/176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
180
<p>This is something I've pseudo-solved many times and have never quite found a solution for.</p> <p>The problem is to come up with a way to generate <code>N</code> colors, that are as distinguishable as possible where <code>N</code> is a parameter.</p>
[ { "answer_id": 199, "author": "helloandre", "author_id": 50, "author_profile": "https://Stackoverflow.com/users/50", "pm_score": 2, "selected": false, "text": "//colors entered as 0-255 [R, G, B]\ncolors = []; //holds final colors to be used\nrand = new Random();\n\n//assumes n is less t...
2008/08/01
[ "https://Stackoverflow.com/questions/180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2089740/" ]
192
<p>One of the fun parts of multi-cultural programming is number formats.</p> <ul> <li>Americans use 10,000.50</li> <li>Germans use 10.000,50</li> <li>French use 10 000,50</li> </ul> <p>My first approach would be to take the string, parse it backwards until I encounter a separator and use this as my decimal separator....
[ { "answer_id": 210, "author": "huseyint", "author_id": 39, "author_profile": "https://Stackoverflow.com/users/39", "pm_score": 5, "selected": false, "text": "double d = double.Parse(\"100.20\", CultureInfo.CurrentCulture);\n// -- OR --\ndouble d = double.Parse(\"100.20\", CultureInfo.Cu...
2008/08/01
[ "https://Stackoverflow.com/questions/192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
227
<p>I have the following arrays:</p> <pre><code>$artist = array("the roots", "michael jackson", "billy idol", "more", "and more", "and_YET_MORE"); $count = array(5, 3, 9, 1, 1, 3); </code></pre> <p>I want to generate a tag cloud that will have artists with a higher number in <code>$count</code> enclosed in <code>h6</c...
[ { "answer_id": 253, "author": "Ryan Fox", "author_id": 55, "author_profile": "https://Stackoverflow.com/users/55", "pm_score": 5, "selected": false, "text": "$artist = array(\"the roots\",\"michael jackson\",\"billy idol\",\"more\",\"and more\",\"and_YET_MORE\");\n$count = array(5,3,9,1,...
2008/08/01
[ "https://Stackoverflow.com/questions/227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/146637/" ]
231
<p>How do I make it so <code>mailto:</code> links will be registered with my program?</p> <p>How would I then handle that event in my program?</p> <p>Most of the solutions I found from a quick Google search are how to do this manually, but I need to do this automatically for users of my program if they click a button, ...
[ { "answer_id": 233, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": 4, "selected": false, "text": "[HKEY_CLASSES_ROOT\\mailto\\shell\\open\\command] (Default) REG_SZ Mail program command-line Delphi 7" }, { "answer_id": 1...
2008/08/01
[ "https://Stackoverflow.com/questions/231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62/" ]
234
<p>MySQL has this incredibly useful yet proprietary <code>REPLACE INTO</code> SQL Command. </p> <p>Can this easily be emulated in SQL Server 2005?</p> <p>Starting a new Transaction, doing a <code>Select()</code> and then either <code>UPDATE</code> or <code>INSERT</code> and <code>COMMIT</code> is always a little bit ...
[ { "answer_id": 243, "author": "Dillie-O", "author_id": 71, "author_profile": "https://Stackoverflow.com/users/71", "pm_score": 4, "selected": false, "text": "IF EXISTS (SELECT * FROM [Table] WHERE Id = X)\n UPDATE [Table] SET...\nELSE\n INSERT INTO [Table]\n" }, { "answer_id"...
2008/08/01
[ "https://Stackoverflow.com/questions/234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
260
<p>I have a little game written in C#. It uses a database as back-end. It's a <a href="http://en.wikipedia.org/wiki/Collectible_card_game" rel="noreferrer">trading card game</a>, and I wanted to implement the function of the cards as a script.</p> <p>What I mean is that I essentially have an interface, <code>ICard</c...
[ { "answer_id": 7217, "author": "Keith", "author_id": 905, "author_profile": "https://Stackoverflow.com/users/905", "pm_score": 2, "selected": false, "text": "CodeDomProvider CodeDomProvider.CompileAssemblyFromSource" } ]
2008/08/01
[ "https://Stackoverflow.com/questions/260", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
263
<p>I have been trying to implement Win32's <code>MessageBox</code> using GTK. The app uses SDL/OpenGL, so this isn't a GTK app.</p> <p>I handle the initialization (<code>gtk_init</code>) sort of stuff inside the <code>MessageBox</code> function as follows:</p> <pre><code>int MessageBox(HWND hwnd, const char* text, cons...
[ { "answer_id": 537, "author": "Joe Shaw", "author_id": 156, "author_profile": "https://Stackoverflow.com/users/156", "pm_score": 3, "selected": false, "text": "window window = gtk_window_new(GTK_WINDOW_TOPLEVEL);\ng_signal_connect(G_OBJECT(window), \"delete_event\", G_CALLBACK(delete_eve...
2008/08/01
[ "https://Stackoverflow.com/questions/263", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61/" ]
265
<p>What are the best practices for checking in BIN directories in a collaborative development environment using SVN? Should project level references be excluded from checkin? Is it easier to just add all bin directories?</p> <p>I develop a lot of DotNetNuke sites and it seems that in a multi-developer environment, i...
[ { "answer_id": 266, "author": "Karl Seguin", "author_id": 34, "author_profile": "https://Stackoverflow.com/users/34", "pm_score": 5, "selected": true, "text": "-Project\n--Project.sln\n--References\n---StructureMap.dll\n---NUnit.dll\n---System.Web.Mvc.dll\n--Project.Web\n---Project.Web.P...
2008/08/01
[ "https://Stackoverflow.com/questions/265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/105/" ]
289
<p>I often have to sort a dictionary (consisting of keys &amp; values) by value. For example, I have a hash of words and respective frequencies that I want to order by frequency.</p> <p>There is a <code>SortedList</code> which is good for a single value (say frequency), that I want to map back to the word.</p> <p><a hr...
[ { "answer_id": 291, "author": "Kalid", "author_id": 109, "author_profile": "https://Stackoverflow.com/users/109", "pm_score": 7, "selected": false, "text": "foreach (KeyValuePair<string,int> item in keywordCounts.OrderBy(key=> key.Value))\n{ \n // do something with item.Key and item.V...
2008/08/02
[ "https://Stackoverflow.com/questions/289", "https://Stackoverflow.com", "https://Stackoverflow.com/users/109/" ]
308
<p>I often run into the following problem.</p> <p>I work on some changes to a project that require new tables or columns in the database. I make the database modifications and continue my work. Usually, I remember to write down the changes so that they can be replicated on the live system. However, I don't always reme...
[ { "answer_id": 38419, "author": "Mike Farmer", "author_id": 4082, "author_profile": "https://Stackoverflow.com/users/4082", "pm_score": 3, "selected": false, "text": "DBMS_METADATA.GET_DDL DBMS_METADATA.SET_TRANSFORM_PARAM DBMS_METADATA.GET_GRANTED_DDL" }, { "answer_id": 141765, ...
2008/08/02
[ "https://Stackoverflow.com/questions/308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/106/" ]
328
<p>What are some guidelines for maintaining responsible session security with PHP? There's information all over the web and it's about time it all landed in one place!</p>
[ { "answer_id": 331, "author": "cmcculloh", "author_id": 58, "author_profile": "https://Stackoverflow.com/users/58", "pm_score": 4, "selected": false, "text": "register_globals $_REQUEST $_GET $_POST $username = $_POST[\"username\"];\n $username = filter_input(INPUT_POST, 'username', FILT...
2008/08/02
[ "https://Stackoverflow.com/questions/328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59/" ]
336
<p>When is it appropriate to use an unsigned variable over a signed one? What about in a <code>for</code> loop?</p> <p>I hear a lot of opinions about this and I wanted to see if there was anything resembling a consensus. </p> <pre><code>for (unsigned int i = 0; i &lt; someThing.length(); i++) { SomeThing var = ...
[ { "answer_id": 347, "author": "helloandre", "author_id": 50, "author_profile": "https://Stackoverflow.com/users/50", "pm_score": 3, "selected": false, "text": "#declare BIT1 (unsigned int 1)\n#declare BIT32 (unsigned int reallybignumber)\n" }, { "answer_id": 354, "author": "M...
2008/08/02
[ "https://Stackoverflow.com/questions/336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/61/" ]
337
<p>I am about to build a piece of a project that will need to construct and post an XML document to a web service and I'd like to do it in Python, as a means to expand my skills in it. </p> <p>Unfortunately, whilst I know the XML model fairly well in .NET, I'm uncertain what the pros and cons are of the XML models in...
[ { "answer_id": 342, "author": "saint_groceon", "author_id": 59, "author_profile": "https://Stackoverflow.com/users/59", "pm_score": 6, "selected": true, "text": "for expandNode()" }, { "answer_id": 202259, "author": "giltay", "author_id": 21106, "author_profile": "htt...
2008/08/02
[ "https://Stackoverflow.com/questions/337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/111/" ]
361
<p>How would I go about generating a list of all possible permutations of a string between x and y characters in length, containing a variable list of characters.</p> <p>Any language would work, but it should be portable.</p>
[ { "answer_id": 362, "author": "alumb", "author_id": 80, "author_profile": "https://Stackoverflow.com/users/80", "pm_score": 7, "selected": true, "text": "list = originalString.split('')\nindex = (0,0)\nlist = [\"\"]\nfor iteration n in 1 to y:\n index = (index[1], len(list))\n for stri...
2008/08/02
[ "https://Stackoverflow.com/questions/361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115/" ]
371
<p>This is a tricky one and I've always relied on techniques, such as permission-based emails (i.e. only sending to people you have permission to send to) and not using blatantly <em>spamish</em> terminology.</p> <p>Of late, some of the emails I send out programmatically have started being shuffled into people's spam ...
[ { "answer_id": 396, "author": "Michiel de Mare", "author_id": 136, "author_profile": "https://Stackoverflow.com/users/136", "pm_score": 9, "selected": true, "text": "\"John Smith\" <[email protected]> [email protected] [email protected]" }, { "...
2008/08/02
[ "https://Stackoverflow.com/questions/371", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49/" ]
387
<p>In Lucene if you had multiple indexes that covered only one partition each. Why does the same search on different indexes return results with different scores? The results from different servers match exactly. </p> <p>i.e. if I searched for :</p> <ul> <li>Name - John Smith</li> <li>DOB - 11/11/1934</li> </ul> <p>...
[ { "answer_id": 551, "author": "Joe Shaw", "author_id": 156, "author_profile": "https://Stackoverflow.com/users/156", "pm_score": 3, "selected": false, "text": "explain() Explanation" } ]
2008/08/02
[ "https://Stackoverflow.com/questions/387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/134/" ]
402
<p>Please note that this question is from 2008 and now is of only historic interest.</p> <hr> <p>What's the best way to create an iPhone application that runs in landscape mode from the start, regardless of the position of the device?</p> <p>Both programmatically and using the Interface Builder.</p>
[ { "answer_id": 36884, "author": "Michael Pryor", "author_id": 245, "author_profile": "https://Stackoverflow.com/users/245", "pm_score": 5, "selected": false, "text": "<key>UIInterfaceOrientation</key>\n<string>UIInterfaceOrientationLandscapeRight</string>\n" }, { "answer_id": 368...
2008/08/02
[ "https://Stackoverflow.com/questions/402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136/" ]
427
<p>Is there any way to launch IE Mobile's "Favorites" screen directly by specifying any command line parameter?</p>
[ { "answer_id": 5019863, "author": "hellkrusher", "author_id": 620104, "author_profile": "https://Stackoverflow.com/users/620104", "pm_score": 2, "selected": false, "text": "26#\"\\Windows\\iexplore.exe\" -f" } ]
2008/08/02
[ "https://Stackoverflow.com/questions/427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/123/" ]
469
<p>I am using the Photoshop's javascript API to find the fonts in a given PSD.</p> <p>Given a font name returned by the API, I want to find the actual physical font file that font name corresponds to on the disc.</p> <p>This is all happening in a python program running on OSX so I guess I'm looking for one of:</p> <...
[ { "answer_id": 497, "author": "helloandre", "author_id": 50, "author_profile": "https://Stackoverflow.com/users/50", "pm_score": 3, "selected": false, "text": "locate InsertFontHere\n" }, { "answer_id": 518, "author": "jaredg", "author_id": 153, "author_profile": "htt...
2008/08/02
[ "https://Stackoverflow.com/questions/469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/147/" ]
482
<p>Assume you are doing something like the following</p> <pre><code>List&lt;string&gt; myitems = new List&lt;string&gt; { "Item 1", "Item 2", "Item 3" }; ComboBox box = new ComboBox(); box.DataSource = myitems; ComboBox box2 = new ComboBox(); box2.DataSource = myitems </code></pre> <p>So now we have 2 c...
[ { "answer_id": 509, "author": "Robert Höglund", "author_id": 143, "author_profile": "https://Stackoverflow.com/users/143", "pm_score": 6, "selected": true, "text": "BindingContext BindingContext DataSource ComboBox BindingContext ConcurrenyMangager ConcurrenyManager DataSource ComboBox B...
2008/08/02
[ "https://Stackoverflow.com/questions/482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/77/" ]
502
<p>I have a cross-platform (Python) application which needs to generate a JPEG preview of the first page of a PDF.</p> <p>On the Mac I am spawning <a href="http://web.archive.org/web/20090309234215/http://developer.apple.com:80/documentation/Darwin/Reference/ManPages/man1/sips.1.html" rel="noreferrer">sips</a>. Is th...
[ { "answer_id": 536, "author": "Federico Builes", "author_id": 161, "author_profile": "https://Stackoverflow.com/users/161", "pm_score": 4, "selected": false, "text": "Convert taxes.pdf taxes.jpg \n convert -size 120x120 taxes.jpg.0 -geometry 120x120 +profile '*' thumbnail.jpg\n convert -...
2008/08/02
[ "https://Stackoverflow.com/questions/502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/147/" ]
549
<blockquote> <h4>Moderator note:</h4> <p>This question is not a good fit for our question and answer format with the <a href="/help/on-topic">topicality rules</a> which currently apply for Stack Overflow. We normally use a &quot;historical lock&quot; for such questions where the content still has value. However, the an...
[ { "answer_id": 6984591, "author": "Charlie", "author_id": 139320, "author_profile": "https://Stackoverflow.com/users/139320", "pm_score": 7, "selected": false, "text": "@" }, { "answer_id": 10701801, "author": "Pieter888", "author_id": 192310, "author_profile": "https...
2008/08/02
[ "https://Stackoverflow.com/questions/549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136/" ]
561
<p>I would like to test a function with a tuple from a set of fringe cases and normal values. For example, while testing a function which returns <code>true</code> whenever given three lengths that form a valid triangle, I would have specific cases, negative / small / large numbers, values close-to being overflowed, et...
[ { "answer_id": 589, "author": "Mark Harrison", "author_id": 116, "author_profile": "https://Stackoverflow.com/users/116", "pm_score": 2, "selected": false, "text": "if f(1,2,3) returns true" }, { "answer_id": 794, "author": "nlucaroni", "author_id": 157, "author_profi...
2008/08/02
[ "https://Stackoverflow.com/questions/561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/157/" ]
564
<p>I was reading <em><a href="https://rads.stackoverflow.com/amzn/click/com/1430209879" rel="noreferrer" rel="nofollow noreferrer">More Joel on Software</a></em> when I came across <a href="http://en.wikipedia.org/wiki/Joel_Spolsky" rel="noreferrer">Joel Spolsky</a> saying something about a particular type of programme...
[ { "answer_id": 566, "author": "Matt", "author_id": 154, "author_profile": "https://Stackoverflow.com/users/154", "pm_score": 9, "selected": true, "text": "System.Int32" }, { "answer_id": 568, "author": "cmcculloh", "author_id": 58, "author_profile": "https://Stackover...
2008/08/02
[ "https://Stackoverflow.com/questions/564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25/" ]
588
<p>I'm writing a CMS application in PHP and one of the requirements is that it must be able to interface with the customer's Exchange server. I've written up this functionality a few times before and have always used <a href="http://en.wikipedia.org/wiki/WebDAV" rel="noreferrer">WebDAV</a> to do it, but now I'm leanin...
[ { "answer_id": 611, "author": "Justin Walgran", "author_id": 173, "author_profile": "https://Stackoverflow.com/users/173", "pm_score": 3, "selected": false, "text": "$outlook = COM(\"Outlook.Application\")\n" } ]
2008/08/03
[ "https://Stackoverflow.com/questions/588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/172/" ]
594
<p>There are several ways to iterate over a result set. What are the tradeoff of each?</p>
[ { "answer_id": 595, "author": "Mark Harrison", "author_id": 116, "author_profile": "https://Stackoverflow.com/users/116", "pm_score": 7, "selected": true, "text": "curs.execute('select * from people')\nfor row in curs:\n print row\n fetchall() for row in curs.fetchall():\n print ro...
2008/08/03
[ "https://Stackoverflow.com/questions/594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/116/" ]
601
<p>I'm looking for a performant, reasonably robust RNG using no special hardware. It can use mathematical methods (Mersenne Twister, etc), it can "collect entropy" from the machine, whatever. On Linux/etc we have a <code>drand48()</code> which generates 48 random bits. I'd like a similar function/class for C++ or C# wh...
[ { "answer_id": 602, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 6, "selected": true, "text": "nondet_random" }, { "answer_id": 9923618, "author": "Rohit Vipin Mathews", "author_id": 1155650, "author_pro...
2008/08/03
[ "https://Stackoverflow.com/questions/601", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
609
<p>An MFC application that I'm trying to migrate uses <code>afxext.h</code>, which causes <code>_AFXDLL</code> to get set, which causes this error if I set <code>/MT</code>:</p> <blockquote> <p>Please use the /MD switch for _AFXDLL builds</p> </blockquote> <p>My research to date indicates that it is impossible to b...
[ { "answer_id": 200955, "author": "MSalters", "author_id": 15416, "author_profile": "https://Stackoverflow.com/users/15416", "pm_score": 2, "selected": false, "text": "GetLongPathNameW GetLongPathNameW ret = 0;" } ]
2008/08/03
[ "https://Stackoverflow.com/questions/609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/179/" ]
622
<p>I want to print the first 10000 prime numbers. Can anyone give me the most efficient code for this? Clarifications:</p> <ol> <li>It does not matter if your code is inefficient for n >10000.</li> <li>The size of the code does not matter.</li> <li>You cannot just hard code the values in any manner.</li> </ol>
[ { "answer_id": 791, "author": "engtech", "author_id": 175, "author_profile": "https://Stackoverflow.com/users/175", "pm_score": 3, "selected": false, "text": "/^1?$|^(11+?)\\1+$/\n 1 1 1" }, { "answer_id": 2753, "author": "GateKiller", "author_id": 383, "author_profil...
2008/08/03
[ "https://Stackoverflow.com/questions/622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
626
<p>In Ruby 1.8, there are subtle differences between proc/lambda on the one hand, and <code>Proc.new</code> on the other. </p> <ul> <li>What are those differences?</li> <li>Can you give guidelines on how to decide which one to choose?</li> <li>In Ruby 1.9, proc and lambda are different. What's the deal?</li> </ul>
[ { "answer_id": 629, "author": "Mike Stone", "author_id": 122, "author_profile": "https://Stackoverflow.com/users/122", "pm_score": 5, "selected": false, "text": "Proc.new lambda Proc.new nil" }, { "answer_id": 723, "author": "Joey deVilla", "author_id": 216, "author_p...
2008/08/03
[ "https://Stackoverflow.com/questions/626", "https://Stackoverflow.com", "https://Stackoverflow.com/users/136/" ]
644
<p>I have a database table and one of the fields (not the primary key) is having a unique index on it. Now I want to swap values under this column for two rows. How could this be done? Two hacks I know are:</p> <ol> <li>Delete both rows and re-insert them.</li> <li>Update rows with some other value and swap and then u...
[ { "answer_id": 73258, "author": "Andy Irving", "author_id": 8553, "author_profile": "https://Stackoverflow.com/users/8553", "pm_score": 2, "selected": false, "text": "CREATE TABLE testing\n(\n cola int NOT NULL,\n colb CHAR(1) NOT NULL\n);\n\nCREATE UNIQUE INDEX UIX_testing_a ON te...
2008/08/03
[ "https://Stackoverflow.com/questions/644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191/" ]
650
<p>I would like the version property of my application to be incremented for each build but I'm not sure on how to enable this functionality in Visual Studio (2005/2008). I have tried to specify the AssemblyVersion as 1.0.* but it doesn't get me exactly what I want. </p> <p>I'm also using a settings file and in earlie...
[ { "answer_id": 655, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Stackoverflow.com/users/91", "pm_score": 8, "selected": true, "text": "Version v = Assembly.GetExecutingAssembly().GetName().Version;\nstring About = string.Format(CultureInfo.InvariantCulture, @\"Y...
2008/08/03
[ "https://Stackoverflow.com/questions/650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143/" ]
651
<p>I've been having trouble getting my ASP.NET application to automatically log users into the Intranet site I'm building. No matter the googling or the experimentation I applied, there is always a login box displayed by IE7.</p> <p>I've got Windows authentication mode set in the Web.config, disabled anonymous access...
[ { "answer_id": 90759, "author": "Dani", "author_id": 17330, "author_profile": "https://Stackoverflow.com/users/17330", "pm_score": 1, "selected": false, "text": "Active Directory Users and Computers computers TreeView" } ]
2008/08/03
[ "https://Stackoverflow.com/questions/651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192/" ]
657
<p>What is the fastest, yet secure way to encrypt passwords (in PHP preferably), and for whichever method you choose, is it portable?</p> <p>In other words, if I later migrate my website to a different server, will my passwords continue to work?</p> <p>The method I am using now, as I was told, is dependent on the exa...
[ { "answer_id": 85951, "author": "Ian Boyd", "author_id": 12597, "author_profile": "https://Stackoverflow.com/users/12597", "pm_score": 3, "selected": false, "text": "password1 PasswordSaltDesignedForThisQuestion String s = HashStringSHA256(\"password1PasswordSaltDesignedForThisQuestion\"...
2008/08/03
[ "https://Stackoverflow.com/questions/657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115/" ]
683
<p>I don't remember whether I was dreaming or not but I seem to recall there being a function which allowed something like,</p> <pre><code>foo in iter_attr(array of python objects, attribute name)</code></pre> <p>I've looked over the docs but this kind of thing doesn't fall under any obvious listed headers</p>
[ { "answer_id": 701, "author": "saalon", "author_id": 111, "author_profile": "https://Stackoverflow.com/users/111", "pm_score": 3, "selected": false, "text": " files = os.listdir(path) \n test = re.compile(\"test\\.py$\", re.IGNORECASE) \n f...
2008/08/03
[ "https://Stackoverflow.com/questions/683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/199/" ]
705
<p>I was (and still am) looking for an embedded database to be used in a .net (c#) application. The caveat: The Application (or at least the database) is stored on a Network drive, but only used by 1 user at a time.</p> <p>Now, my first idea was <a href="http://www.microsoft.com/sql/editions/compact/default.mspx" rel=...
[ { "answer_id": 737, "author": "Justin Walgran", "author_id": 173, "author_profile": "https://Stackoverflow.com/users/173", "pm_score": 3, "selected": false, "text": "Dim catalog as New ADOX.Catalog\nCatalog.Create(\"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\\\server\\path\\to\\db.md...
2008/08/03
[ "https://Stackoverflow.com/questions/705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
717
<p>I wrote a windows service using VB that read some legacy data from Visual Foxpro Databases to be inserted in SQL 2005. The problem is this use to run fine in Windows server 2003 32-Bits, but the client recently moved to Windows 2003 64-Bits and now the service won't work. I'm getting a message the the VFP .NET OLEdb...
[ { "answer_id": 799, "author": "Paul G", "author_id": 162, "author_profile": "https://Stackoverflow.com/users/162", "pm_score": 5, "selected": true, "text": "x86 \"Any CPU\" OLEDB" }, { "answer_id": 877, "author": "Chris Miller", "author_id": 206, "author_profile": "ht...
2008/08/03
[ "https://Stackoverflow.com/questions/717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
742
<p><a href="http://www.djangoproject.com/" rel="noreferrer">Django</a> view points to a function, which can be a problem if you want to change only a bit of functionality. Yes, I could have million keyword arguments and even more if statements in the function, but I was thinking more of an object oriented approach.</p>...
[ { "answer_id": 27792, "author": "dguaraglia", "author_id": 2384, "author_profile": "https://Stackoverflow.com/users/2384", "pm_score": 2, "selected": false, "text": "__call__" }, { "answer_id": 33957, "author": "Carl Meyer", "author_id": 3207, "author_profile": "https...
2008/08/03
[ "https://Stackoverflow.com/questions/742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/189/" ]
746
<p>How do I format a string to <a href="http://www.grammar-monster.com/lessons/capital_letters_title_case.htm" rel="noreferrer">title case</a>?</p>
[ { "answer_id": 747, "author": "tags2k", "author_id": 192, "author_profile": "https://Stackoverflow.com/users/192", "pm_score": 4, "selected": false, "text": "public static string ToTitleCaseInvariant(string targetString)\n{\n return System.Threading.Thread.CurrentThread.CurrentCulture...
2008/08/03
[ "https://Stackoverflow.com/questions/746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192/" ]
752
<p>One may not always know the <code>Type</code> of an object at compile-time, but may need to create an instance of the <code>Type</code>. </p> <p>How do you get a new object instance from a <code>Type</code>?</p>
[ { "answer_id": 755, "author": "Karl Seguin", "author_id": 34, "author_profile": "https://Stackoverflow.com/users/34", "pm_score": 11, "selected": true, "text": "Activator System ObjectType instance = (ObjectType)Activator.CreateInstance(objectType);\n\nObjectType instance = (ObjectType)A...
2008/08/03
[ "https://Stackoverflow.com/questions/752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192/" ]
761
<p>What is the best way to localise a date format descriptor?</p> <p>As anyone from a culture which does not use the mm/dd/yyyy format knows, it is annoying to have to enter dates in this format. The .NET framework provides some very good localisation support, so it's trivial to parse dates according to the users cult...
[ { "answer_id": 762, "author": "ICR", "author_id": 214, "author_profile": "https://Stackoverflow.com/users/214", "pm_score": 3, "selected": true, "text": "Regex singleMToDoubleRegex = new Regex(\"(?<!m)m(?!m)\");\nRegex singleDToDoubleRegex = new Regex(\"(?<!d)d(?!d)\");\nCultureInfo curr...
2008/08/03
[ "https://Stackoverflow.com/questions/761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/214/" ]
766
<p>I can get Python to work with Postgresql but I cannot get it to work with MySQL. The main problem is that on the shared hosting account I have I do not have the ability to install things such as Django or PySQL, I generally fail when installing them on my computer so maybe it's good I can't install on the host.</p> ...
[ { "answer_id": 777, "author": "ESV", "author_id": 150, "author_profile": "https://Stackoverflow.com/users/150", "pm_score": 3, "selected": false, "text": "#!/usr/bin/python\n\nmodule_name = 'MySQLdb'\nhead = '''Content-Type: text/html\n\n%s is ''' % module_name\n\ntry:\n __import__(mo...
2008/08/03
[ "https://Stackoverflow.com/questions/766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
769
<p>I need to programmatically solve a system of linear equations in C, Objective C, or (if needed) C++.</p> <p>Here's an example of the equations:</p> <pre><code>-44.3940 = a * 50.0 + b * 37.0 + tx -45.3049 = a * 43.0 + b * 39.0 + tx -44.9594 = a * 52.0 + b * 41.0 + tx </code></pre> <p>From this, I'd like to get the...
[ { "answer_id": 26637, "author": "Baltimark", "author_id": 1179, "author_profile": "https://Stackoverflow.com/users/1179", "pm_score": 2, "selected": false, "text": "void GetInverse(const Array2D<double>& A, Array2D<double>& invA)\n {\n QR<double> qr(A); \n invA = qr.solve(I); \n ...
2008/08/03
[ "https://Stackoverflow.com/questions/769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/79/" ]
773
<p>I haven't been able to find an understandable explanation of how to actually use Python's <code>itertools.groupby()</code> function. What I'm trying to do is this:</p> <ul> <li>Take a list - in this case, the children of an objectified <code>lxml</code> element</li> <li>Divide it into groups based on some criteria<...
[ { "answer_id": 783, "author": "Seb", "author_id": 189, "author_profile": "https://Stackoverflow.com/users/189", "pm_score": 6, "selected": false, "text": "groups = []\nuniquekeys = []\nfor k, g in groupby(data, keyfunc):\n groups.append(list(g)) # Store group iterator as a list\n...
2008/08/03
[ "https://Stackoverflow.com/questions/773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/207/" ]
810
<p>I'm trying to maintain a Setup Project in <code>Visual Studio 2003</code> (yes, it's a legacy application). The problem we have at the moment is that we need to write registry entries to <code>HKCU</code> for every user on the computer. They need to be in the <code>HKCU</code> rather than <code>HKLM</code> because t...
[ { "answer_id": 820, "author": "Michael Stum", "author_id": 91, "author_profile": "https://Stackoverflow.com/users/91", "pm_score": 4, "selected": true, "text": "const HKEY_USERS = &H80000003\nstrComputer = \".\"\nSet objReg=GetObject(\"winmgmts:{impersonationLevel=impersonate}!\\\\\" & s...
2008/08/03
[ "https://Stackoverflow.com/questions/810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/233/" ]
826
<p>You have an ascending list of numbers, what is the most efficient algorithm you can think of to get the ascending list of sums of every two numbers in that list. Duplicates in the resulting list are irrelevant, you can remove them or avoid them if you like.</p> <p>To be clear, I'm interested in the algorithm. Fee...
[ { "answer_id": 840, "author": "Peter Burns", "author_id": 101, "author_profile": "https://Stackoverflow.com/users/101", "pm_score": 1, "selected": false, "text": "matrixOfSums list = [[a+b | b <- list, b >= a] | a <- list]\n\nsortedSums = foldl merge [] matrixOfSums\n\n--A normal merge, ...
2008/08/03
[ "https://Stackoverflow.com/questions/826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/101/" ]
832
<p>SQL:</p> <pre><code>SELECT u.id, u.name, isnull(MAX(h.dateCol), '1900-01-01') dateColWithDefault FROM universe u LEFT JOIN history h ON u.id=h.id AND h.dateCol&lt;GETDATE()-1 GROUP BY u.Id, u.name </code></pre>
[ { "answer_id": 837, "author": "vzczc", "author_id": 224, "author_profile": "https://Stackoverflow.com/users/224", "pm_score": 4, "selected": true, "text": "var collection=\n from u in db.Universe\n select new\n {\n u.id,\n u.name,\n MaxDate =(DateTime?)\n ...
2008/08/03
[ "https://Stackoverflow.com/questions/832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/224/" ]
833
<p>I have designed database tables (normalised, on an MS SQL server) and created a standalone windows front end for an application that will be used by a handful of users to add and edit information. We will add a web interface to allow searching accross our production area at a later date.</p> <p>I am concerned that ...
[ { "answer_id": 1620, "author": "karlgrz", "author_id": 318, "author_profile": "https://Stackoverflow.com/users/318", "pm_score": 2, "selected": false, "text": "SELECT ... FOR UPDATE SELECT UPDLOCK" }, { "answer_id": 10437, "author": "Guy", "author_id": 993, "author_pr...
2008/08/03
[ "https://Stackoverflow.com/questions/833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/186/" ]
835
<p>I'm trying to setup CruiseControl.net at the moment. So far it works nice, but I have a Problem with the MSBuild Task.</p> <p>According to the <a href="http://confluence.public.thoughtworks.org/display/CCNET/MsBuild+Task" rel="noreferrer">Documentation</a>, it passes CCNetArtifactDirectory to MSBuild. But how do I ...
[ { "answer_id": 1023, "author": "FryHard", "author_id": 231, "author_profile": "https://Stackoverflow.com/users/231", "pm_score": 4, "selected": true, "text": "<executable>c:\\WINDOWS\\Microsoft.NET\\Framework\\v3.5\\MSBuild.exe</executable>\n<workingDirectory>C:\\data\\projects\\FooSolut...
2008/08/03
[ "https://Stackoverflow.com/questions/835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
845
<p>Suppose I have the following CSS rule in my page:</p> <pre class="lang-css prettyprint-override"><code>body { font-family: Calibri, Trebuchet MS, Helvetica, sans-serif; } </code></pre> <p>How could I detect which one of the defined fonts were used in the user's browser?</p> <p>For people wondering why I want to ...
[ { "answer_id": 27035, "author": "runeh", "author_id": 2906, "author_profile": "https://Stackoverflow.com/users/2906", "pm_score": 4, "selected": false, "text": "/**\n * Get the font used for a given element\n * @argument {HTMLElement} the element to check font for\n * @returns {string} T...
2008/08/03
[ "https://Stackoverflow.com/questions/845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/238/" ]
871
<p>I've been using <a href="http://en.wikipedia.org/wiki/Apache_Subversion" rel="nofollow noreferrer">Subversion</a> for a few years and after using <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_SourceSafe" rel="nofollow noreferrer">SourceSafe</a>, I just love Subversion. Combined with <a href="http://en.wiki...
[ { "answer_id": 162148, "author": "Andre Bossard", "author_id": 21027, "author_profile": "https://Stackoverflow.com/users/21027", "pm_score": 4, "selected": false, "text": "backup/public" }, { "answer_id": 531042, "author": "sebnow", "author_id": 64423, "author_profile...
2008/08/03
[ "https://Stackoverflow.com/questions/871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/203/" ]
879
<p>Are PHP variables passed by value or by reference?</p>
[ { "answer_id": 881, "author": "cmcculloh", "author_id": 58, "author_profile": "https://Stackoverflow.com/users/58", "pm_score": 5, "selected": false, "text": "$var1 = \"test\";\n$var2 = $var1;\n$var2 = \"new test\";\n$var3 = &$var2;\n$var3 = \"final test\";\n\nprint (\"var1: $var1, var2:...
2008/08/03
[ "https://Stackoverflow.com/questions/879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58/" ]
888
<p>How do you debug <strong>PHP</strong> scripts?</p> <p>I am aware of basic debugging such as using the Error Reporting. The breakpoint debugging in <strong>PHPEclipse</strong> is also quite useful.</p> <p>What is the <strong>best</strong> (in terms of fast and easy) way to debug in phpStorm or any other IDE?</p>
[ { "answer_id": 890, "author": "John Downey", "author_id": 200, "author_profile": "https://Stackoverflow.com/users/200", "pm_score": 8, "selected": true, "text": "var_dump() die()" }, { "answer_id": 1758, "author": "Polsonby", "author_id": 137, "author_profile": "https...
2008/08/03
[ "https://Stackoverflow.com/questions/888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/131/" ]
898
<p>How have you implemented Internationalization (i18n) in actual projects you've worked on?</p> <p>I took an interest in making software cross-cultural after I read the famous post by Joel, <a href="http://www.joelonsoftware.com/articles/Unicode.html" rel="noreferrer">The Absolute Minimum Every Software Developer Abs...
[ { "answer_id": 906, "author": "Mike Stone", "author_id": 122, "author_profile": "https://Stackoverflow.com/users/122", "pm_score": 3, "selected": false, "text": "String message = \"The \" + item + \" is on sale!\";\n String message = String.Format(\"The {0} is on sale!\", item);\n" } ]
2008/08/04
[ "https://Stackoverflow.com/questions/898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200/" ]
904
<p>Given a relatively simple CSS:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>div { width: 150px; }</code></pre> <pre class="snippet-code-html lang-html prettypri...
[ { "answer_id": 911, "author": "Ryan Fox", "author_id": 55, "author_profile": "https://Stackoverflow.com/users/55", "pm_score": 7, "selected": true, "text": "&shy;\n div {\n width: 150px;\n} <div>\n 12333&shy;2333&shy;233&shy;23339392&shy;332332323\n</div>" }, { "answer_id": 678...
2008/08/04
[ "https://Stackoverflow.com/questions/904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34/" ]
930
<p>What's the simplest way to connect and query a database for a set of records in C#?</p>
[ { "answer_id": 940, "author": "Goyuix", "author_id": 243, "author_profile": "https://Stackoverflow.com/users/243", "pm_score": 4, "selected": false, "text": "using (OleDBConnection conn = new OleDbConnection())\n{\n conn.ConnectionString = \"Whatever connection string\";\n\n using (Ole...
2008/08/04
[ "https://Stackoverflow.com/questions/930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/245/" ]
935
<p>Attempting to insert an escape character into a table results in a warning. </p> <p>For example:</p> <pre><code>create table EscapeTest (text varchar(50)); insert into EscapeTest (text) values ('This is the first part \n And this is the second'); </code></pre> <p>Produces the warning:</p> <pre><code>WARNING: n...
[ { "answer_id": 938, "author": "rjohnston", "author_id": 246, "author_profile": "https://Stackoverflow.com/users/246", "pm_score": 8, "selected": true, "text": "insert into EscapeTest (text) values (E'This is the first part \\n And this is the second');\n insert into EscapeTest (text) val...
2008/08/04
[ "https://Stackoverflow.com/questions/935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/246/" ]
944
<p>I'm maintaining a .NET 1.1 application and one of the things I've been tasked with is making sure the user doesn't see any unfriendly error notifications.</p> <p>I've added handlers to <code>Application.ThreadException</code> and <code>AppDomain.CurrentDomain.UnhandledException</code>, which do get called. My probl...
[ { "answer_id": 108550, "author": "HTTP 410", "author_id": 13118, "author_profile": "https://Stackoverflow.com/users/13118", "pm_score": 3, "selected": false, "text": "App.Config Application.ThreadException += new\nThreading.ThreadExceptionHandler(CatchFormsExceptions);\n AppDomain.Curren...
2008/08/04
[ "https://Stackoverflow.com/questions/944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/233/" ]
947
<p>I have imported the <code>kernel32</code> library. So, I have the <code>createMutex</code> function available but I am not quite sure of the various parameters and return values.</p> <p>This is classic Visual Basic, not Visual Basic.NET but I can probably work with either language in the form of an answer.</p>
[ { "answer_id": 1028, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": true, "text": "hMutex = CreateMutex(ByVal 0&, 1, ByVal 0&)\n SECURITY_ATTRIBUTES TRUE FALSE VB VB BSTR" }, { "answer_id": 82335, "au...
2008/08/04
[ "https://Stackoverflow.com/questions/947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/243/" ]
972
<p>I've read that it is possible to add a method to an existing object (i.e., not in the class definition) in Python. </p> <p>I understand that it's not always good to do so. But how might one do this?</p>
[ { "answer_id": 982, "author": "John Downey", "author_id": 200, "author_profile": "https://Stackoverflow.com/users/200", "pm_score": 5, "selected": false, "text": "from SomeOtherProduct.SomeModule import SomeClass\ndef speak(self):\n return \"ook ook eee eee eee!\"\nSomeClass.speak = sp...
2008/08/04
[ "https://Stackoverflow.com/questions/972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/145/" ]
1,005
<p>Often while editing config files, I'll open one with vi and then when I go to save it realize that I didn't type</p> <pre><code>sudo vi filename </code></pre> <p>Is there any way to give vi sudo privileges to save the file? I seem to recall seeing something about this while looking up some stuff about vi a while a...
[ { "answer_id": 1012, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 3, "selected": false, "text": "sudoedit :r :w!" }, { "answer_id": 1065, "author": "Mark Harrison", "author_id": 116, "author_profile": "h...
2008/08/04
[ "https://Stackoverflow.com/questions/1005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85/" ]
1,010
<p>I need to grab the <code>base64-encoded</code> representation of the <code>ViewState</code>. Obviously, this would not be available until fairly late in the request lifecycle, which is OK.</p> <p>For example, if the output of the page includes:</p> <pre><code>&lt;input type="hidden" name="__VIEWSTATE" id="__VIE...
[ { "answer_id": 2058, "author": "Dave Anderson", "author_id": 371, "author_profile": "https://Stackoverflow.com/users/371", "pm_score": 2, "selected": false, "text": "protected override void SavePageStateToPersistenceMedium(object viewState)\n" } ]
2008/08/04
[ "https://Stackoverflow.com/questions/1010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/67/" ]
1,024
<p>After upgrading a rails 1.2 website to 2.1, the <a href="http://agilewebdevelopment.com/plugins/exception_notifier" rel="noreferrer">ExceptionNotifier plugin</a> no longer works, complaining about this error:</p> <blockquote> <p>ActionView::TemplateFinder::InvalidViewPath: Unprocessed view path found: "/path...
[ { "answer_id": 1026, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 3, "selected": false, "text": "init.rb vendor/plugins/exception_notification ActionController::Base.class_eval do\n append_view_path File.dirname(__FILE...
2008/08/04
[ "https://Stackoverflow.com/questions/1024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/234/" ]
1,033
<p>Does anyone know any simple way to retrieve the country from a given IP Address, preferably in ISO_3166-1 format?</p>
[ { "answer_id": 2056874, "author": "Niklas Rosencrantz", "author_id": 108207, "author_profile": "https://Stackoverflow.com/users/108207", "pm_score": 2, "selected": false, "text": "latlng = new google.maps.LatLng(google.loader.ClientLocation.latitude, google.loader.ClientLocation.longitud...
2008/08/04
[ "https://Stackoverflow.com/questions/1033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/87/" ]
1,040
<p>I'm looking for a way to delete a file which is locked by another process using C#. I suspect the method must be able to find which process is locking the file (perhaps by tracking the handles, although I'm not sure how to do this in C#) then close that process before being able to complete the file delete using <co...
[ { "answer_id": 1043, "author": "Ryan Fox", "author_id": 55, "author_profile": "https://Stackoverflow.com/users/55", "pm_score": 3, "selected": false, "text": "REGEDT32 (W2K) REGEDIT (WXP) HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\n REG_MULTI_SZ PendingFileRe...
2008/08/04
[ "https://Stackoverflow.com/questions/1040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/254/" ]
1,041
<p>I'm looking for a robust, easy-to-use, regular expression evaluator for native C++, either platform-independent or Windows-specific.</p> <p>Requirements:</p> <ul> <li>Can't use Boost or ACE regex libraries (unfortunately)</li> <li>Can't use .NET Regex (or any managed code)</li> </ul> <p>The main requirement is th...
[ { "answer_id": 7564, "author": "martinsb", "author_id": 837, "author_profile": "https://Stackoverflow.com/users/837", "pm_score": 2, "selected": false, "text": "CAtlRegExp atlrx.h" }, { "answer_id": 37100978, "author": "Trevor Hickey", "author_id": 908939, "author_pro...
2008/08/04
[ "https://Stackoverflow.com/questions/1041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]