Skip to content

Instantly share code, notes, and snippets.

@heathermiller
Created April 7, 2015 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save heathermiller/0f1c01806fb44f53a7a2 to your computer and use it in GitHub Desktop.
Save heathermiller/0f1c01806fb44f53a7a2 to your computer and use it in GitHub Desktop.
Excerpt of StackOverflow dump
<?xml version="1.0" encoding="UTF-8" ?>
<row Id="4" PostTypeId="1" AcceptedAnswerId="7" CreationDate="2008-07-31T21:42:52.667" Score="322" ViewCount="21888" Body="&lt;p&gt;I want to use a track-bar to change a form's opacity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is my code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;decimal trans = trackBar1.Value / 5000;&#xA;this.Opacity = trans;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When I try to build it, I get this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;Cannot implicitly convert type 'decimal' to 'double'.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I tried making &lt;code&gt;trans&lt;/code&gt; a &lt;code&gt;double&lt;/code&gt;, but then the control doesn't work. This code has worked fine for me in VB.NET in the past. &lt;/p&gt;&#xA;" OwnerUserId="8" LastEditorUserId="451518" LastEditorDisplayName="Rich B" LastEditDate="2014-07-28T10:02:50.557" LastActivityDate="2014-12-20T17:18:47.807" Title="When setting a form's opacity should I use a decimal or double?" Tags="&lt;c#&gt;&lt;winforms&gt;&lt;type-conversion&gt;&lt;opacity&gt;" AnswerCount="13" CommentCount="1" FavoriteCount="27" CommunityOwnedDate="2012-10-31T16:42:47.213" />
<row Id="6" PostTypeId="1" AcceptedAnswerId="31" CreationDate="2008-07-31T22:08:08.620" Score="140" ViewCount="10912" Body="&lt;p&gt;I have an absolutely positioned &lt;code&gt;div&lt;/code&gt; containing several children, one of which is a relatively positioned &lt;code&gt;div&lt;/code&gt;. When I use a &lt;strong&gt;percentage-based width&lt;/strong&gt; on the child &lt;code&gt;div&lt;/code&gt;, it collapses to &lt;code&gt;0&lt;/code&gt; width on IE7, but not on Firefox or Safari. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I use &lt;strong&gt;pixel width&lt;/strong&gt;, it works. If the parent is relatively positioned, the percentage width on the child works. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there something I'm missing here? &#xA;Is there an easy fix for this besides the &lt;em&gt;pixel-based width&lt;/em&gt; on the child? &#xA;Is there an area of the &lt;code&gt;CSS&lt;/code&gt; specification that covers this?&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="1350209" LastEditorDisplayName="Rich B" LastEditDate="2014-06-26T04:57:13.750" LastActivityDate="2014-10-10T05:55:36.033" Title="Why doesn't the percentage width child in absolutely positioned parent work?" Tags="&lt;html&gt;&lt;css&gt;&lt;css3&gt;&lt;internet-explorer-7&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="7" />
<row Id="7" PostTypeId="2" ParentId="4" CreationDate="2008-07-31T22:17:57.883" Score="242" Body="&lt;p&gt;An explicit cast to double isn't necessary.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double trans = (double)trackBar1.Value / 5000.0;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Identifying the constant as &lt;code&gt;5000.0&lt;/code&gt; (or as &lt;code&gt;5000d&lt;/code&gt;) is sufficient:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double trans = trackBar1.Value / 5000.0;&#xA;double trans = trackBar1.Value / 5000d;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="9" LastEditorUserId="967315" LastEditDate="2012-10-14T11:50:16.703" LastActivityDate="2012-10-14T11:50:16.703" CommentCount="0" />
<row Id="9" PostTypeId="1" AcceptedAnswerId="1404" CreationDate="2008-07-31T23:40:59.743" Score="862" ViewCount="223405" Body="&lt;p&gt;Given a &lt;code&gt;DateTime&lt;/code&gt; representing a person's birthday, how do I calculate their age? &lt;/p&gt;&#xA;" OwnerUserId="1" LastEditorUserId="1620220" LastEditorDisplayName="Rich B" LastEditDate="2015-01-15T21:43:12.603" LastActivityDate="2015-02-17T17:24:51.690" Title="How do I calculate someone's age in C#?" Tags="&lt;c#&gt;&lt;.net&gt;&lt;datetime&gt;" AnswerCount="48" CommentCount="5" FavoriteCount="256" CommunityOwnedDate="2011-08-16T19:40:43.080" />
<row Id="11" PostTypeId="1" AcceptedAnswerId="1248" CreationDate="2008-07-31T23:55:37.967" Score="817" ViewCount="89203" Body="&lt;p&gt;Given a specific &lt;code&gt;DateTime&lt;/code&gt; value, how do I display relative time, like:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;2 hours ago&lt;/li&gt;&#xA;&lt;li&gt;3 days ago&lt;/li&gt;&#xA;&lt;li&gt;a month ago&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="1" LastEditorUserId="2686013" LastEditorDisplayName="user2370523" LastEditDate="2015-02-08T22:05:05.300" LastActivityDate="2015-02-08T22:05:05.300" Title="How do I calculate relative time?" Tags="&lt;c#&gt;&lt;datediff&gt;" AnswerCount="31" CommentCount="11" FavoriteCount="453" CommunityOwnedDate="2009-09-04T13:15:59.820" />
<row Id="12" PostTypeId="2" ParentId="11" CreationDate="2008-07-31T23:56:41.303" Score="240" Body="&lt;p&gt;Well, here's how we do it on Stack Overflow.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-csharp prettyprint-override&quot;&gt;&lt;code&gt;var ts = new TimeSpan(DateTime.UtcNow.Ticks - dt.Ticks);&#xA;double delta = Math.Abs(ts.TotalSeconds);&#xA;&#xA;if (delta &amp;lt; 60)&#xA;{&#xA; return ts.Seconds == 1 ? &quot;one second ago&quot; : ts.Seconds + &quot; seconds ago&quot;;&#xA;}&#xA;if (delta &amp;lt; 120)&#xA;{&#xA; return &quot;a minute ago&quot;;&#xA;}&#xA;if (delta &amp;lt; 2700) // 45 * 60&#xA;{&#xA; return ts.Minutes + &quot; minutes ago&quot;;&#xA;}&#xA;if (delta &amp;lt; 5400) // 90 * 60&#xA;{&#xA; return &quot;an hour ago&quot;;&#xA;}&#xA;if (delta &amp;lt; 86400) // 24 * 60 * 60&#xA;{&#xA; return ts.Hours + &quot; hours ago&quot;;&#xA;}&#xA;if (delta &amp;lt; 172800) // 48 * 60 * 60&#xA;{&#xA; return &quot;yesterday&quot;;&#xA;}&#xA;if (delta &amp;lt; 2592000) // 30 * 24 * 60 * 60&#xA;{&#xA; return ts.Days + &quot; days ago&quot;;&#xA;}&#xA;if (delta &amp;lt; 31104000) // 12 * 30 * 24 * 60 * 60&#xA;{&#xA; int months = Convert.ToInt32(Math.Floor((double)ts.Days / 30));&#xA; return months &amp;lt;= 1 ? &quot;one month ago&quot; : months + &quot; months ago&quot;;&#xA;}&#xA;int years = Convert.ToInt32(Math.Floor((double)ts.Days / 365));&#xA;return years &amp;lt;= 1 ? &quot;one year ago&quot; : years + &quot; years ago&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Suggestions? Comments? Ways to improve this algorithm?&lt;/p&gt;&#xA;" OwnerUserId="1" LastEditorUserId="1420197" LastEditorDisplayName="GateKiller" LastEditDate="2014-02-18T14:19:35.770" LastActivityDate="2014-02-18T14:19:35.770" CommentCount="16" CommunityOwnedDate="2009-09-04T13:15:59.820" />
<row Id="13" PostTypeId="1" AcceptedAnswerId="357" CreationDate="2008-08-01T00:42:38.903" Score="319" ViewCount="89637" Body="&lt;p&gt;Is there a standard way for a Web Server to determine what time zone offset a user is in? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps from an &lt;code&gt;HTTP&lt;/code&gt; header? Or part of the user-agent description?&lt;/p&gt;&#xA;" OwnerUserId="9" LastEditorUserId="1851530" LastEditorDisplayName="Rich B" LastEditDate="2014-07-03T08:49:47.123" LastActivityDate="2015-02-03T17:38:49.917" Title="Determining a web user's time zone" Tags="&lt;html&gt;&lt;browser&gt;&lt;timezone&gt;&lt;timezoneoffset&gt;" AnswerCount="23" CommentCount="5" FavoriteCount="102" />
<row Id="14" PostTypeId="1" CreationDate="2008-08-01T00:59:11.177" Score="208" ViewCount="59368" Body="&lt;p&gt;What is the difference between &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/9a6a2sxy.aspx&quot;&gt;&lt;code&gt;Math.Floor()&lt;/code&gt;&lt;/a&gt; and &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.math.truncate.aspx&quot;&gt;&lt;code&gt;Math.Truncate()&lt;/code&gt;&lt;/a&gt; in .NET?&lt;/p&gt;&#xA;" OwnerUserId="11" OwnerDisplayName="Anonymous User" LastEditorUserId="23199" LastEditorDisplayName="Rich B" LastEditDate="2014-12-16T15:12:13.297" LastActivityDate="2015-02-04T07:09:26.240" Title="Difference between Math.Floor() and Math.Truncate()" Tags="&lt;.net&gt;" AnswerCount="8" CommentCount="1" FavoriteCount="33" />
<row Id="16" PostTypeId="1" AcceptedAnswerId="12446" CreationDate="2008-08-01T04:59:33.643" Score="42" ViewCount="56591" Body="&lt;p&gt;How do you expose a &lt;strong&gt;LINQ&lt;/strong&gt; query as an &lt;strong&gt;ASMX&lt;/strong&gt; web service? Usually, from the business tier, I can return a typed &lt;code&gt;DataSet&lt;/code&gt; or &lt;code&gt;DataTable&lt;/code&gt; which can be serialized for transport over &lt;strong&gt;ASMX&lt;/strong&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I do the same for a &lt;strong&gt;LINQ&lt;/strong&gt; query? Is there a way to populate a typed &lt;code&gt;DataSet&lt;/code&gt; or &lt;code&gt;DataTable&lt;/code&gt; via a &lt;strong&gt;LINQ&lt;/strong&gt; query?: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static MyDataTable CallMySproc() &#xA;{ &#xA; string conn = ...;&#xA;&#xA; MyDatabaseDataContext db = new MyDatabaseDataContext(conn); &#xA; MyDataTable dt = new MyDataTable();&#xA;&#xA; // execute a sproc via LINQ&#xA; var query = from dr in db.MySproc().AsEnumerable&#xA; select dr;&#xA;&#xA; // copy LINQ query resultset into a DataTable -this does not work ! &#xA; dt = query.CopyToDataTable();&#xA;&#xA; return dt;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I get the resultset of a &lt;strong&gt;LINQ&lt;/strong&gt; query into a &lt;code&gt;DataSet&lt;/code&gt; or &lt;code&gt;DataTable&lt;/code&gt;? Alternatively, is the &lt;strong&gt;LINQ&lt;/strong&gt; query serializeable so that I can expose it as an &lt;strong&gt;ASMX&lt;/strong&gt; web service?&lt;/p&gt;&#xA;" OwnerUserId="2" LastEditorUserId="1039608" LastEditorDisplayName="Chris Fournier" LastEditDate="2012-05-04T09:01:26.053" LastActivityDate="2014-10-10T06:02:15.453" Title="Filling a DataSet or DataTable from a LINQ query result set" Tags="&lt;c#&gt;&lt;linq&gt;&lt;web-services&gt;&lt;.net-3.5&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="8" />
<row Id="17" PostTypeId="1" AcceptedAnswerId="26" CreationDate="2008-08-01T05:09:55.993" Score="68" ViewCount="25923" Body="&lt;p&gt;How do I store binary data in &lt;a href=&quot;http://en.wikipedia.org/wiki/MySQL&quot;&gt;MySQL&lt;/a&gt;?&lt;/p&gt;&#xA;" OwnerUserId="2" LastEditorUserId="546051" LastEditDate="2011-10-21T21:29:17.160" LastActivityDate="2014-10-10T06:07:10.753" Title="Binary Data in MySQL" Tags="&lt;mysql&gt;&lt;database&gt;&lt;binary-data&gt;&lt;data-storage&gt;" AnswerCount="10" CommentCount="0" FavoriteCount="8" />
<row Id="18" PostTypeId="2" ParentId="17" CreationDate="2008-08-01T05:12:44.193" Score="22" Body="&lt;p&gt;For a table like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CREATE TABLE binary_data (&#xA; id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,&#xA; description CHAR(50),&#xA; bin_data LONGBLOB,&#xA; filename CHAR(50),&#xA; filesize CHAR(50),&#xA; filetype CHAR(50)&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here is a PHP example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA; // store.php3 - by Florian Dittmer &amp;lt;dittmer@gmx.net&amp;gt;&#xA; // Example php script to demonstrate the storing of binary files into&#xA; // an sql database. More information can be found at http://www.phpbuilder.com/&#xA;?&amp;gt;&#xA;&#xA;&amp;lt;html&amp;gt;&#xA; &amp;lt;head&amp;gt;&amp;lt;title&amp;gt;Store binary data into SQL Database&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;&#xA;&#xA; &amp;lt;body&amp;gt;&#xA; &amp;lt;?php&#xA; // Code that will be executed if the form has been submitted:&#xA;&#xA; if ($submit) {&#xA; // Connect to the database (you may have to adjust&#xA; // the hostname, username or password).&#xA;&#xA; MYSQL_CONNECT(&quot;localhost&quot;,&quot;root&quot;,&quot;password&quot;);&#xA; mysql_select_db(&quot;binary_data&quot;);&#xA;&#xA; $data = mysql_real_escape_string(fread(fopen($form_data, &quot;r&quot;), filesize($form_data)));&#xA;&#xA; $result=MYSQL_QUERY(&quot;INSERT INTO binary_data (description, bin_data, filename, filesize, filetype) &quot;.&#xA; &quot;VALUES ('$form_description', '$data', '$form_data_name', '$form_data_size', '$form_data_type')&quot;);&#xA;&#xA; $id= mysql_insert_id();&#xA; print &quot;&amp;lt;p&amp;gt;This file has the following Database ID: &amp;lt;b&amp;gt;$id&amp;lt;/b&amp;gt;&quot;;&#xA;&#xA; MYSQL_CLOSE();&#xA; }&#xA; else {&#xA;&#xA; // else show the form to submit new data:&#xA; ?&amp;gt;&#xA; &amp;lt;form method=&quot;post&quot; action=&quot;&amp;lt;?php echo $PHP_SELF; ?&amp;gt;&quot; enctype=&quot;multipart/form-data&quot;&amp;gt;&#xA; File Description:&amp;lt;br&amp;gt;&#xA; &amp;lt;input type=&quot;text&quot; name=&quot;form_description&quot; size=&quot;40&quot;&amp;gt;&#xA; &amp;lt;input type=&quot;hidden&quot; name=&quot;MAX_FILE_SIZE&quot; value=&quot;1000000&quot;&amp;gt;&#xA; &amp;lt;br&amp;gt;File to upload/store in database:&amp;lt;br&amp;gt;&#xA; &amp;lt;input type=&quot;file&quot; name=&quot;form_data&quot; size=&quot;40&quot;&amp;gt;&#xA; &amp;lt;p&amp;gt;&amp;lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;submit&quot;&amp;gt;&#xA; &amp;lt;/form&amp;gt;&#xA;&#xA; &amp;lt;?php&#xA; }&#xA; ?&amp;gt;&#xA; &amp;lt;/body&amp;gt;&#xA;&amp;lt;/html&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerDisplayName="phpguy" LastEditorUserId="63550" LastEditorDisplayName="Jeff Atwood" LastEditDate="2013-01-05T14:44:25.013" LastActivityDate="2013-01-05T14:44:25.013" CommentCount="2" />
<row Id="19" PostTypeId="1" AcceptedAnswerId="531" CreationDate="2008-08-01T05:21:22.257" Score="164" ViewCount="25934" Body="&lt;p&gt;Solutions are welcome in any language. :-) 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 &lt;code&gt;#define&lt;/code&gt;d constants like &lt;code&gt;M_PI&lt;/code&gt;, or hard-coding the number in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The program below tests the various ways I know of. The inline assembly version is, in theory, the fastest option, though clearly not portable; I've included it as a baseline to compare the other versions against. In my tests, with built-ins, the &lt;code&gt;4 * atan(1)&lt;/code&gt; version is fastest on GCC 4.2, because it auto-folds the &lt;code&gt;atan(1)&lt;/code&gt; into a constant. With &lt;code&gt;-fno-builtin&lt;/code&gt; specified, the &lt;code&gt;atan2(0, -1)&lt;/code&gt; version is fastest.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's the main testing program (&lt;code&gt;pitimes.c&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;math.h&amp;gt;&#xA;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;time.h&amp;gt;&#xA;&#xA;#define ITERS 10000000&#xA;#define TESTWITH(x) { \&#xA; diff = 0.0; \&#xA; time1 = clock(); \&#xA; for (i = 0; i &amp;lt; ITERS; ++i) \&#xA; diff += (x) - M_PI; \&#xA; time2 = clock(); \&#xA; printf(&quot;%s\t=&amp;gt; %e, time =&amp;gt; %f\n&quot;, #x, diff, diffclock(time2, time1)); \&#xA;}&#xA;&#xA;static inline double&#xA;diffclock(clock_t time1, clock_t time0)&#xA;{&#xA; return (double) (time1 - time0) / CLOCKS_PER_SEC;&#xA;}&#xA;&#xA;int&#xA;main()&#xA;{&#xA; int i;&#xA; clock_t time1, time2;&#xA; double diff;&#xA;&#xA; /* Warmup. The atan2 case catches GCC's atan folding (which would&#xA; * optimise the ``4 * atan(1) - M_PI'' to a no-op), if -fno-builtin&#xA; * is not used. */&#xA; TESTWITH(4 * atan(1))&#xA; TESTWITH(4 * atan2(1, 1))&#xA;&#xA;#if defined(__GNUC__) &amp;amp;&amp;amp; (defined(__i386__) || defined(__amd64__))&#xA; extern double fldpi();&#xA; TESTWITH(fldpi())&#xA;#endif&#xA;&#xA; /* Actual tests start here. */&#xA; TESTWITH(atan2(0, -1))&#xA; TESTWITH(acos(-1))&#xA; TESTWITH(2 * asin(1))&#xA; TESTWITH(4 * atan2(1, 1))&#xA; TESTWITH(4 * atan(1))&#xA;&#xA; return 0;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And the inline assembly stuff (&lt;code&gt;fldpi.c&lt;/code&gt;), noting that it will only work for x86 and x64 systems:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;double&#xA;fldpi()&#xA;{&#xA; double pi;&#xA; asm(&quot;fldpi&quot; : &quot;=t&quot; (pi));&#xA; return pi;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And a build script that builds all the configurations I'm testing (&lt;code&gt;build.sh&lt;/code&gt;):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#!/bin/sh&#xA;gcc -O3 -Wall -c -m32 -o fldpi-32.o fldpi.c&#xA;gcc -O3 -Wall -c -m64 -o fldpi-64.o fldpi.c&#xA;&#xA;gcc -O3 -Wall -ffast-math -m32 -o pitimes1-32 pitimes.c fldpi-32.o&#xA;gcc -O3 -Wall -m32 -o pitimes2-32 pitimes.c fldpi-32.o -lm&#xA;gcc -O3 -Wall -fno-builtin -m32 -o pitimes3-32 pitimes.c fldpi-32.o -lm&#xA;gcc -O3 -Wall -ffast-math -m64 -o pitimes1-64 pitimes.c fldpi-64.o -lm&#xA;gcc -O3 -Wall -m64 -o pitimes2-64 pitimes.c fldpi-64.o -lm&#xA;gcc -O3 -Wall -fno-builtin -m64 -o pitimes3-64 pitimes.c fldpi-64.o -lm&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Apart from testing between various compiler flags (I've compared 32-bit against 64-bit too, because the optimisations are different), I've also tried switching the order of the tests around. The &lt;code&gt;atan2(0, -1)&lt;/code&gt; version still comes out top every time, though.&lt;/p&gt;&#xA;" OwnerUserId="13" LastEditorUserId="13" LastEditorDisplayName="Chris Jester-Young" LastEditDate="2014-07-10T22:50:29.950" LastActivityDate="2014-12-15T17:52:11.423" Title="What is the fastest way to get the value of π?" Tags="&lt;performance&gt;&lt;algorithm&gt;&lt;language-agnostic&gt;&lt;unix&gt;&lt;pi&gt;" AnswerCount="23" CommentCount="16" FavoriteCount="58" CommunityOwnedDate="2009-02-26T19:22:22.320" />
<row Id="21" PostTypeId="2" ParentId="9" CreationDate="2008-08-01T08:57:27.280" Score="14" Body="&lt;p&gt;Many years ago, to provide an &lt;a href=&quot;http://cloud9.hedgee.com/age&quot;&gt;age calculator gimmick&lt;/a&gt; on my website, I wrote a function to calculate age to a fraction. This is a quick port of that function to C# (from &lt;a href=&quot;http://hedgee.svn.sourceforge.net/viewvc/hedgee/trunk/chris/ckwww/ckage.php3&quot;&gt;the PHP version&lt;/a&gt;). I'm afraid I haven't been able to test the C# version, but hope you enjoy all the same!&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;(Admittedly this is a bit gimmicky for the purposes of showing user profiles on Stack Overflow, but maybe readers will find some use for it. :-))&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;double AgeDiff(DateTime date1, DateTime date2) {&lt;br&gt; double years = date2.Year - date1.Year;&lt;br&gt;&lt;br&gt; /*&lt;br&gt; * If date2 and date1 + round(date2 - date1) are on different sides&lt;br&gt; * of 29 February, then our partial year is considered to have 366&lt;br&gt; * days total, otherwise it's 365. Note that 59 is the day number&lt;br&gt; * of 29 Feb.&lt;br&gt; */&lt;br&gt; double fraction = 365&lt;br&gt; + (DateTime.IsLeapYear(date2.Year) &amp;amp;&amp;amp; date2.DayOfYear &amp;gt;= 59&lt;br&gt; &amp;amp;&amp;amp; (date1.DayOfYear &amp;lt; 59 || date1.DayOfYear &amp;gt; date2.DayOfYear)&lt;br&gt; ? 1 : 0);&lt;br&gt;&lt;br&gt; /*&lt;br&gt; * The only really nontrivial case is if date1 is in a leap year,&lt;br&gt; * and date2 is not. So let's handle the others first.&lt;br&gt; */&lt;br&gt; if (DateTime.IsLeapYear(date2.Year) == DateTime.IsLeapYear(date1.Year))&lt;br&gt; return years + (date2.DayOfYear - date1.DayOfYear) / fraction;&lt;br&gt;&lt;br&gt; /*&lt;br&gt; * If date2 is in a leap year, but date1 is not and is March or&lt;br&gt; * beyond, shift up by a day.&lt;br&gt; */&lt;br&gt; if (DateTime.IsLeapYear(date2.Year)) {&lt;br&gt; return years + (date2.DayOfYear - date1.DayOfYear&lt;br&gt; - (date1.DayOfYear &amp;gt;= 59 ? 1 : 0)) / fraction;&lt;br&gt; }&lt;br&gt;&lt;br&gt; /*&lt;br&gt; * If date1 is not on 29 February, shift down date1 by a day if&lt;br&gt; * March or later. Proceed normally.&lt;br&gt; */&lt;br&gt; if (date1.DayOfYear != 59) {&lt;br&gt; return years + (date2.DayOfYear - date1.DayOfYear&lt;br&gt; + (date1.DayOfYear &amp;gt; 59 ? 1 : 0)) / fraction;&lt;br&gt; }&lt;br&gt;&lt;br&gt; /*&lt;br&gt; * Okay, here date1 is on 29 February, and date2 is not on a leap&lt;br&gt; * year. What to do now? On 28 Feb in date2's year, the ``age''&lt;br&gt; * should be just shy of a whole number, and on 1 Mar should be&lt;br&gt; * just over. Perhaps the easiest way is to a point halfway&lt;br&gt; * between those two: 58.5.&lt;br&gt; */&lt;br&gt; return years + (date2.DayOfYear - 58.5) / fraction;&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="13" LastEditorUserId="13" LastEditorDisplayName="Chris Jester-Young" LastEditDate="2008-08-01T12:35:11.707" LastActivityDate="2008-08-01T12:35:11.707" CommentCount="1" CommunityOwnedDate="2011-08-16T19:40:43.080" />
<row Id="22" PostTypeId="2" ParentId="9" CreationDate="2008-08-01T12:07:19.500" Score="7" Body="&lt;p&gt;The best way that I know of because of leap years and everything is:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;DateTime birthDate = new DateTime(2000,3,1);&lt;br&gt;int age = (int)Math.Floor((DateTime.Now - birthDate).TotalDays / 365.25D);&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;" OwnerUserId="17" LastEditorUserId="17" LastEditorDisplayName="Nick" LastEditDate="2008-08-01T15:26:37.087" LastActivityDate="2008-08-01T15:26:37.087" CommentCount="1" CommunityOwnedDate="2011-08-16T19:40:43.080" />
<row Id="24" PostTypeId="1" AcceptedAnswerId="49" CreationDate="2008-08-01T12:12:19.350" Score="55" ViewCount="24855" Body="&lt;p&gt;If I have a trigger &lt;strong&gt;before the update&lt;/strong&gt; on a table, how can I throw an error that prevents the update on that table?&lt;/p&gt;&#xA;" OwnerUserId="22" LastEditorUserId="63550" LastEditorDisplayName="Jim Anderson" LastEditDate="2012-05-25T20:50:23.130" LastActivityDate="2014-10-10T06:11:44.597" Title="Throw an error in a MySQL trigger" Tags="&lt;mysql&gt;&lt;database&gt;&lt;triggers&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="13" />
<row Id="25" PostTypeId="1" AcceptedAnswerId="1443907" CreationDate="2008-08-01T12:13:50.207" Score="55" ViewCount="5397" Body="&lt;p&gt;I've been having issues getting the C sockets API to work properly in C++. Specifically, although I am including &lt;code&gt;sys/socket.h&lt;/code&gt;, I still get compile time errors telling me that &lt;code&gt;AF_INET&lt;/code&gt; is not defined. Am I missing something obvious, or could this be related to the fact that I'm doing this coding on &lt;code&gt;z/OS&lt;/code&gt; and my problems are much more complicated? ;)&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Oh dear. Upon further investigation, I discovered that there is an #ifdef that I'm hitting. Apparently &lt;code&gt;z/OS&lt;/code&gt; isn't happy unless I define which type of sockets I'm using with a little&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#define _OE_SOCKETS&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;action.&#xA;Now, I personally have no idea what this OE &lt;code&gt;SOCKETS&lt;/code&gt; thingy is, and if any &lt;code&gt;z/OS&lt;/code&gt; sockets programmers are out there (all 3 of you), perhaps you could give me a rundown of how this all works?&lt;/p&gt;&#xA;" OwnerUserId="23" LastEditorUserId="4359899" LastEditDate="2014-12-23T17:14:08.280" LastActivityDate="2014-12-23T17:14:08.280" Title="How to use the C socket API in C++ on z/OS" Tags="&lt;c++&gt;&lt;c&gt;&lt;sockets&gt;&lt;mainframe&gt;&lt;zos&gt;" AnswerCount="10" CommentCount="1" FavoriteCount="2" />
<row Id="26" PostTypeId="2" ParentId="17" CreationDate="2008-08-01T12:16:22.167" Score="51" Body="&lt;p&gt;The answer by &lt;em&gt;phpguy&lt;/em&gt; is correct but I think there is a lot of confusing additional detail there. The basic answer is in a &lt;code&gt;BLOB column&lt;/code&gt;. &lt;strong&gt;BLOB&lt;/strong&gt; is short for Binary Large Object and that column type is specifically for handling binary data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/blob.html&quot;&gt;the relevant manual page&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="48" OwnerDisplayName="Mat Scales" LastEditorUserId="2354564" LastEditorDisplayName="Geoff Dalgas" LastEditDate="2014-07-11T14:50:36.290" LastActivityDate="2014-07-11T14:50:36.290" CommentCount="0" />
<row Id="27" PostTypeId="2" ParentId="11" CreationDate="2008-08-01T12:17:19.357" Score="16" Body="&lt;p&gt;@jeff&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;IMHO yours seems a little long. However it does seem a little more robust with support for &quot;yesterday&quot; and &quot;years&quot;. But in my experience when this is used the person is most likely to view the content in the first 30 days. It is only the really hardcore people that come after that. So that is why I usually elect to keep this short and simple.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;This is the method I am currently using on one of my websites. This only returns a relative day, hour, time. And then the user has to slap on &quot;ago&quot; in the output.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;public static string ToLongString(this TimeSpan time)&lt;br&gt;{&lt;br&gt; string output = String.Empty;&lt;br&gt;&lt;br&gt; if (time.Days &amp;gt; 0)&lt;br&gt; output += time.Days + &quot; days &quot;;&lt;br&gt;&lt;br&gt; if ((time.Days == 0 || time.Days == 1) &amp;amp;&amp;amp; time.Hours &amp;gt; 0)&lt;br&gt; output += time.Hours + &quot; hr &quot;;&lt;br&gt;&lt;br&gt; if (time.Days == 0 &amp;amp;&amp;amp; time.Minutes &amp;gt; 0)&lt;br&gt; output += time.Minutes + &quot; min &quot;;&lt;br&gt;&lt;br&gt; if (output.Length == 0)&lt;br&gt; output += time.Seconds + &quot; sec&quot;;&lt;br&gt;&lt;br&gt; return output.Trim();&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="17" LastEditorUserId="17" LastEditorDisplayName="Nick Berardi" LastEditDate="2008-08-01T13:16:49.127" LastActivityDate="2008-08-01T13:16:49.127" CommentCount="2" CommunityOwnedDate="2009-09-04T13:15:59.820" />
<row Id="29" PostTypeId="2" ParentId="13" CreationDate="2008-08-01T12:19:17.417" Score="24" Body="&lt;p&gt;There are no HTTP headers that will report the clients timezone so far although it has been suggested to include it in the HTTP specification.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If it was me, I would probably try to fetch the timezone using clientside JavaScript and then submit it to the server using Ajax or something.&lt;/p&gt;" OwnerUserId="19" LastActivityDate="2008-08-01T12:19:17.417" CommentCount="0" />
<row Id="30" PostTypeId="2" ParentId="25" CreationDate="2008-08-01T12:22:40.797" Score="10" Body="&lt;p&gt;I've had no trouble using the BSD sockets API in C++, in GNU/Linux. Here's the sample program I used:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;sys/socket.h&amp;gt;&lt;br&gt;&lt;br&gt;int&lt;br&gt;main()&lt;br&gt;{&lt;br&gt; return AF_INET;&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;So my take on this is that z/OS is probably the complicating factor here, however, because I've never used z/OS before, much less programmed in it, I can't say this definitively. :-P&lt;/p&gt;" OwnerUserId="13" LastActivityDate="2008-08-01T12:22:40.797" CommentCount="1" />
<row Id="31" PostTypeId="2" ParentId="6" CreationDate="2008-08-01T12:22:51.593" Score="67" Body="&lt;p&gt;Does the parent &lt;code&gt;div&lt;/code&gt; have a defined &lt;code&gt;width&lt;/code&gt; either pixel or percentage? Not 100% sure but I think in IE7, the parent &lt;code&gt;div&lt;/code&gt; needs a defined &lt;code&gt;width&lt;/code&gt; for child percentage &lt;code&gt;div&lt;/code&gt;s to work correctly.&lt;/p&gt;&#xA;" OwnerDisplayName="maclema" LastEditorUserId="842480" LastEditDate="2012-06-04T23:35:58.177" LastActivityDate="2012-06-04T23:35:58.177" CommentCount="0" />
<row Id="33" PostTypeId="2" ParentId="14" CreationDate="2008-08-01T12:26:39.773" Score="279" Body="&lt;p&gt;&lt;code&gt;Math.Floor&lt;/code&gt; rounds down, &lt;code&gt;Math.Ceiling&lt;/code&gt; rounds up, and &lt;code&gt;Math.Truncate&lt;/code&gt; rounds towards zero. Thus, &lt;code&gt;Math.Truncate&lt;/code&gt; is like &lt;code&gt;Math.Floor&lt;/code&gt; for positive numbers, and like &lt;code&gt;Math.Ceiling&lt;/code&gt; for negative numbers. Here's the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.math.truncate.aspx&quot;&gt;reference&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For completeness, &lt;code&gt;Math.Round&lt;/code&gt; rounds to the nearest integer. If the number is exactly midway between two integers, then it rounds towards the even one. &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.math.round.aspx&quot;&gt;Reference.&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See also: &lt;a href=&quot;http://stackoverflow.com/questions/14/whats-the-difference-between-math-floor-and-math-truncate-in-c/580252#580252&quot;&gt;Pax Diablo's answer&lt;/a&gt;. Highly recommended!&lt;/p&gt;&#xA;" OwnerUserId="13" LastEditorUserId="13" LastEditDate="2009-10-14T02:09:03.030" LastActivityDate="2009-10-14T02:09:03.030" CommentCount="5" />
<row Id="34" PostTypeId="1" CreationDate="2008-08-01T12:30:57.630" Score="29" ViewCount="6254" Body="&lt;p&gt;How do I forcefully unload a &lt;code&gt;ByteArray&lt;/code&gt; from memory in ActionScript 3?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have tried (without success):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;byteArray.length = 0;&#xA;byteArray = new ByteArray();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for ( var i:int=0; i &amp;lt; byteArray.length; i++ ) {&#xA; byteArray[i] = null;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What should I do?&lt;/p&gt;&#xA;" OwnerDisplayName="maclema" LastEditorUserId="414521" LastEditDate="2014-03-12T20:53:56.410" LastActivityDate="2014-10-10T06:16:41.377" Title="Unloading a ByteArray in Actionscript 3" Tags="&lt;actionscript-3&gt;&lt;flex&gt;&lt;bytearray&gt;" AnswerCount="8" CommentCount="0" FavoriteCount="1" />
<row Id="36" PostTypeId="1" AcceptedAnswerId="352" CreationDate="2008-08-01T12:35:56.917" Score="72" ViewCount="30218" Body="&lt;p&gt;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 &lt;a href=&quot;http://en.wikipedia.org/wiki/.NET_Framework&quot;&gt;.NET&lt;/a&gt; and C#.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like to be able to support any &lt;a href=&quot;http://en.wikipedia.org/wiki/Microsoft_SQL_Server#Genesis&quot;&gt;SQL&amp;nbsp;Server 2000&lt;/a&gt; SP4 or newer. My application is a bolt-on data visualization for another company's product. Our customer base is in the thousands, so I don't want to have to put in requirements that we modify the third-party vendor's table at every installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;By &quot;changes to a table&quot; I mean changes to table data, not changes to table structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ultimately, I would like the change to trigger an event in my application, instead of having to check for changes at an interval.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The best course of action given my requirements (no triggers or schema modification, SQL&amp;nbsp;Server 2000 and 2005) seems to be to use the BINARY_CHECKSUM function in &lt;a href=&quot;http://en.wikipedia.org/wiki/Transact-SQL&quot;&gt;T-SQL&lt;/a&gt;. The way I plan to implement is this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Every X seconds run the following query:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT CHECKSUM_AGG(BINARY_CHECKSUM(*)) FROM sample_table WITH (NOLOCK);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and compare that against the stored value. If the value has changed, go through the table row by row using the query&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;select row_id,BINARY_CHECKSUM(*) from sample_table WITH (NOLOCK);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and compare the returned checksums against stored values.&lt;/p&gt;&#xA;" OwnerUserId="32" LastEditorUserId="1471203" LastEditorDisplayName="Mark Harrison" LastEditDate="2013-01-09T05:48:30.817" LastActivityDate="2014-07-24T04:58:25.450" Title="Check for changes to an SQL Server table?" Tags="&lt;sql-server&gt;&lt;datatable&gt;&lt;rdbms&gt;" AnswerCount="8" CommentCount="1" FavoriteCount="17" />
<row Id="37" PostTypeId="2" ParentId="25" CreationDate="2008-08-01T12:36:00.957" Score="15" Body="&lt;p&gt;Sure I can post a test app.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;sys/socket.h&amp;gt;&lt;br&gt;&lt;br&gt;int main()&lt;br&gt;{&lt;br&gt; return AF_INET;&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Compile/Link Output:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;cxx -Wc,xplink -Wl,xplink -o inet_test inet.C&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&quot;./inet.C&quot;, line 5.16: CCN5274 (S) The name lookup for &quot;AF_INET&quot; did not find a declaration.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;CCN0797(I) Compilation failed for file ./inet.C. Object file not created.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;A check of sys/sockets.h does include the definition I need, and as far as I can tell, it is not being blocked by any #ifdef statements.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I have however noticed it contains a the following:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;#ifdef __cplusplus&lt;br&gt; extern &quot;C&quot; {&lt;br&gt;#endif&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;which encapsulates basically the whole file. Not sure if it matters.&lt;/p&gt;" OwnerUserId="23" LastEditorUserId="23" LastEditorDisplayName="Jax" LastEditDate="2008-08-01T12:42:32.113" LastActivityDate="2008-08-01T12:42:32.113" CommentCount="0" />
<row Id="39" PostTypeId="1" AcceptedAnswerId="45" CreationDate="2008-08-01T12:43:11.503" Score="35" ViewCount="3233" Body="&lt;p&gt;I am aware that in &lt;a href=&quot;http://en.wikipedia.org/wiki/.NET_Framework&quot;&gt;.NET&lt;/a&gt; there are three timer types (see &lt;em&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/cc164015.aspx&quot;&gt;Comparing the Timer Classes in the .NET Framework Class Library&lt;/a&gt;&lt;/em&gt;). I have chosen a threaded timer as the other types can drift if the main thread is busy, and I need this to be reliable.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The way this timer works in the control of the timer is put on another thread so it can always tick along with the work begin completed on the parent thread when it is not busy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The issue with this timer in a console application is that while the timer is ticking along on another thread the main thread is not doing anything so the application closes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried adding a &lt;code&gt;while true&lt;/code&gt; loop, but then the main thread is too busy when the timer does go off.&lt;/p&gt;&#xA;" OwnerUserId="33" LastEditorUserId="63550" LastEditorDisplayName="Jim Anderson" LastEditDate="2012-05-25T20:55:43.157" LastActivityDate="2014-01-17T09:33:10.450" Title="Reliable timer in a console application" Tags="&lt;c#&gt;&lt;.net&gt;&lt;vb.net&gt;&lt;timer&gt;" AnswerCount="2" CommentCount="0" FavoriteCount="2" />
<row Id="42" PostTypeId="1" AcceptedAnswerId="77" CreationDate="2008-08-01T12:50:18.587" Score="155" ViewCount="18665" Body="&lt;p&gt;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. How does one go about writing 'hooks' into their code so that plugins can attach to specific events?&lt;/p&gt;&#xA;" OwnerUserId="37" LastEditorUserId="1931622" LastEditorDisplayName="Vaibhav" LastEditDate="2013-05-16T13:29:05.523" LastActivityDate="2013-05-16T13:29:05.523" Title="Best way to allow plugins for a PHP application" Tags="&lt;php&gt;&lt;plugins&gt;&lt;architecture&gt;&lt;hook&gt;" AnswerCount="8" CommentCount="1" FavoriteCount="91" />
<row Id="44" PostTypeId="2" ParentId="39" CreationDate="2008-08-01T12:55:42.413" Score="6" Body="&lt;p&gt;Consider using a &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.threading.manualresetevent.aspx&quot; rel=&quot;nofollow&quot; title=&quot;MSDN Reference&quot;&gt;ManualResetEvent&lt;/a&gt; to block the main thread at the end of its processing, and call &lt;code&gt;Reset()&lt;/code&gt; on it once the timer's processing has finished. If this is something that needs to run constantly, consider moving this into a service process instead of a console app.&lt;/p&gt;&#xA;" OwnerUserId="35" LastEditorUserId="967315" LastEditDate="2012-10-14T12:20:15.140" LastActivityDate="2012-10-14T12:20:15.140" CommentCount="0" />
<row Id="45" PostTypeId="2" ParentId="39" CreationDate="2008-08-01T12:56:37.920" Score="23" Body="&lt;p&gt;You can use something like &lt;code&gt;Console.ReadLine()&lt;/code&gt; to block the main thread, so other background threads (like timer threads) will still work. You may also use an &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.threading.autoresetevent.aspx&quot;&gt;AutoResetEvent&lt;/a&gt; to block the execution, then (when you need to) you can call Set() method on that AutoResetEvent object to release the main thread. Also ensure that your reference to Timer object doesn't go out of scope and garbage collected.&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="967315" LastEditorDisplayName="huseyint" LastEditDate="2012-10-14T12:20:06.700" LastActivityDate="2012-10-14T12:20:06.700" CommentCount="2" />
<row Id="48" PostTypeId="1" AcceptedAnswerId="31910" CreationDate="2008-08-01T13:01:17.303" Score="131" ViewCount="120117" Body="&lt;p&gt;Let's say you create a Wizard in an HTML form. One button goes back and one goes forward. Since the &lt;em&gt;back&lt;/em&gt; button appears first in the markup, when you press Enter it will use that button to submit the form. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;form&amp;gt;&#xA; &amp;lt;input type=&quot;text&quot; name=&quot;field1&quot; /&amp;gt; &amp;lt;!-- put your cursor in this field and press Enter --&amp;gt;&#xA;&#xA; &amp;lt;input type=&quot;submit&quot; name=&quot;prev&quot; value=&quot;Previous Page&quot; /&amp;gt; &amp;lt;!-- This is the button that will submit --&amp;gt;&#xA; &amp;lt;input type=&quot;submit&quot; name=&quot;next&quot; value=&quot;Next Page&quot; /&amp;gt; &amp;lt;!-- But this is the button that I WANT to submit --&amp;gt;&#xA;&amp;lt;/form&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What I would like to do, is get to decide which button is used to submit the form when a user presses Enter. That way, when you press Enter the Wizard will move to the next page, not the previous. Do you have to use &lt;code&gt;tabindex&lt;/code&gt; to do this?&lt;/p&gt;&#xA;" OwnerUserId="40" LastEditorUserId="2354564" LastEditorDisplayName="kevin d" LastEditDate="2014-07-14T07:46:45.920" LastActivityDate="2015-02-22T07:33:54.820" Title="Multiple submit buttons in an HTML form" Tags="&lt;html&gt;&lt;form-submit&gt;&lt;html-form&gt;&lt;submit-button&gt;" AnswerCount="16" CommentCount="0" FavoriteCount="24" />
<row Id="49" PostTypeId="2" ParentId="24" CreationDate="2008-08-01T13:02:51.900" Score="20" Body="&lt;p&gt;&lt;a href=&quot;http://www.brokenbuild.com/blog/2006/08/15/mysql-triggers-how-do-you-abort-an-insert-update-or-delete-with-a-trigger/&quot;&gt;Here is one hack&lt;/a&gt; that may work. It isn't clean, but it looks like it might work:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, you just try to update a column that doesn't exist.&lt;/p&gt;&#xA;" OwnerUserId="43" LastEditorUserId="957909" LastEditDate="2012-12-24T21:24:41.017" LastActivityDate="2012-12-24T21:24:41.017" CommentCount="1" />
<row Id="51" PostTypeId="2" ParentId="36" CreationDate="2008-08-01T13:07:52.810" Score="13" Body="&lt;p&gt;Why don't you want to use triggers. They are a good thing if you use them correctly. If you use them as a way to enforce referential integrity that is when they go from good to bad. But if you use them for monitoring, they are not really considered taboo.&lt;/p&gt;" OwnerUserId="17" LastActivityDate="2008-08-01T13:07:52.810" CommentCount="0" />
<row Id="52" PostTypeId="2" ParentId="34" CreationDate="2008-08-01T13:08:59.127" Score="7" Body="&lt;p&gt;Have a look at this article&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.gskinner.com/blog/archives/2006/06/as3_resource_ma.html&quot;&gt;http://www.gskinner.com/blog/archives/2006/06/as3_resource_ma.html&lt;/a&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;IANA actionscript programmer, however the feeling I'm getting is that, because the garbage collector might not run when you want it to.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Hence&#xD;&#xA;&lt;a href=&quot;http://www.craftymind.com/2008/04/09/kick-starting-the-garbage-collector-in-actionscript-3-with-air/&quot;&gt;http://www.craftymind.com/2008/04/09/kick-starting-the-garbage-collector-in-actionscript-3-with-air/&lt;/a&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;So I'd recommend trying out their collection code and see if it helps&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;private var gcCount:int;&lt;br&gt;private function startGCCycle():void{&lt;br&gt; gcCount = 0;&lt;br&gt; addEventListener(Event.ENTER_FRAME, doGC);&lt;br&gt;}&lt;br&gt;private function doGC(evt:Event):void{&lt;br&gt; flash.system.System.gc();&lt;br&gt; if(++gcCount &amp;gt; 1){&lt;br&gt; removeEventListener(Event.ENTER_FRAME, doGC);&lt;br&gt; setTimeout(lastGC, 40);&lt;br&gt; }&lt;br&gt;}&lt;br&gt;private function lastGC():void{&lt;br&gt; flash.system.System.gc();&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="23" LastActivityDate="2008-08-01T13:08:59.127" CommentCount="0" />
<row Id="53" PostTypeId="2" ParentId="34" CreationDate="2008-08-01T13:08:59.487" Score="12" Body="&lt;p&gt;(I'm not positive about this, but...)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;AS3 uses a non-deterministic garbage collection. Which means that unreferenced memory will be freed up whenever the runtime feels like it (typically not unless there's a reason to run, since it's an expensive operation to execute). This is the same approach used by most modern garbage collected languages (like C# and Java as well).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assuming there are no other references to the memory pointed to by &lt;code&gt;byteArray&lt;/code&gt; or the items within the array itself, the memory will be freed at some point after you exit the scope where &lt;code&gt;byteArray&lt;/code&gt; is declared.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can force a garbage collection, though you really shouldn't. If you do, do it only for testing... if you do it in production, you'll hurt performance much more than help it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To force a GC, try (yes, twice):&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;flash.system.System.gc();&#xA;flash.system.System.gc();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.craftymind.com/2008/04/09/kick-starting-the-garbage-collector-in-actionscript-3-with-air/&quot; rel=&quot;nofollow&quot;&gt;You can read more here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="34" LastEditorUserId="1668244" LastEditDate="2014-07-10T21:03:46.907" LastActivityDate="2014-07-10T21:03:46.907" CommentCount="1" />
<row Id="56" PostTypeId="2" ParentId="48" CreationDate="2008-08-01T13:10:16.473" Score="29" Body="&lt;p&gt;Give your submit buttons same name like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;submit&quot; name=&quot;submitButton&quot; value=&quot;Previous Page&quot; /&amp;gt;&#xA;&amp;lt;input type=&quot;submit&quot; name=&quot;submitButton&quot; value=&quot;Next Page&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the user presses enter and the &lt;em&gt;Request&lt;/em&gt; goes to server, you can check the value for &lt;code&gt;submitButton&lt;/code&gt; on your server-side code which contains a collection of form &lt;code&gt;name/value&lt;/code&gt; pairs. For example in classic ASP:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-vb prettyprint-override&quot;&gt;&lt;code&gt;If Request.Form(&quot;submitButton&quot;) = &quot;Previous Page&quot; Then&#xA; ' Code for Previous Page&#xA;ElseIf Request.Form(&quot;submitButton&quot;) = &quot;Next Page&quot; Then&#xA; ' Code for Next Page&#xA;End If&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Reference: &lt;a href=&quot;http://www.chami.com/tips/internet/042599I.html&quot; rel=&quot;nofollow&quot;&gt;Using multiple submit buttons on a single form&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="2354564" LastEditDate="2014-07-14T07:55:42.730" LastActivityDate="2014-07-14T07:55:42.730" CommentCount="2" />
<row Id="58" PostTypeId="2" ParentId="48" CreationDate="2008-08-01T13:14:30.303" Score="34" Body="&lt;p&gt;Would it be possible for you to change the previous button type int a button like this: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;button&quot; name=&quot;prev&quot; value=&quot;Previous Page&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now the Next button would be the default, plus you could also add the &lt;code&gt;default&lt;/code&gt; attribute to it so that your browser will highlight it like so:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;submit&quot; name=&quot;next&quot; value=&quot;Next Page&quot; default /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Hope that helps.&lt;/p&gt;&#xA;" OwnerUserId="37" LastEditorUserId="20578" LastEditDate="2013-09-03T09:40:46.430" LastActivityDate="2013-09-03T09:40:46.430" CommentCount="6" />
<row Id="59" PostTypeId="1" AcceptedAnswerId="43110" CreationDate="2008-08-01T13:14:33.797" Score="37" ViewCount="17138" Body="&lt;p&gt;Let's say I have a &lt;code&gt;DataTable&lt;/code&gt; with a &lt;code&gt;Name&lt;/code&gt; column. I want to have a collection of the unique names ordered alphabetically. The following query ignores the order by clause.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var names =&#xA; (from DataRow dr in dataTable.Rows&#xA; orderby (string)dr[&quot;Name&quot;]&#xA; select (string)dr[&quot;Name&quot;]).Distinct();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Why does the &lt;code&gt;orderby&lt;/code&gt; not get enforced?&lt;/p&gt;&#xA;" OwnerUserId="45" LastEditorUserId="885318" LastEditorDisplayName="Keith" LastEditDate="2014-01-01T16:43:44.793" LastActivityDate="2014-08-19T23:17:56.597" Title="How do I get a distinct, ordered list of names from a DataTable using LINQ?" Tags="&lt;c#&gt;&lt;linq&gt;&lt;.net-3.5&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="2" />
<row Id="60" PostTypeId="2" ParentId="34" CreationDate="2008-08-01T13:14:40.007" Score="7" Body="&lt;p&gt;Unfortunately when it comes to memory management in &lt;em&gt;Flash/actionscript&lt;/em&gt; there isn't a whole lot you can do. ActionScript was designed to be easy to use (so they didn't want people to have to worry about memory management)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The following is a workaround, instead of creating a &lt;code&gt;ByteArray&lt;/code&gt; variable try this.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var byteObject:Object = new Object();&#xA;&#xA;byteObject.byteArray = new ByteArray();&#xA;&#xA;...&#xA;&#xA;//Then when you are finished delete the variable from byteObject&#xA;delete byteObject.byteArray;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Where &lt;code&gt;byteArray&lt;/code&gt; is a dynamic property of &lt;code&gt;byteObject&lt;/code&gt;, you can free the memory that was allocated for it.&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="2354564" LastEditDate="2014-07-11T14:58:07.480" LastActivityDate="2014-07-11T14:58:07.480" CommentCount="0" />
<row Id="61" PostTypeId="1" CreationDate="2008-08-01T13:17:20.640" Score="15" ViewCount="1947" Body="&lt;p&gt;Where can I find a list of the MIME types and identifying characters for Office 2007 files?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have an upload form that is restricting uploads based on extension and identifying characters, but I cannot seem to find the Office 2007 MIME types.&lt;/p&gt;&#xA;" OwnerDisplayName="maclema" LastEditorUserId="1454806" LastEditorDisplayName="Mark Biek" LastEditDate="2013-04-11T20:15:23.130" LastActivityDate="2014-10-22T02:58:12.963" Title="Office 2007 File Type, Mime Types and Identifying Characters" Tags="&lt;office-2007&gt;&lt;file-type&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" CommunityOwnedDate="2013-04-11T20:15:23.130" />
<row Id="62" PostTypeId="2" ParentId="59" CreationDate="2008-08-01T13:18:37.640" Score="33" Body="&lt;p&gt;&lt;strong&gt;The problem is that the Distinct&#xA; operator does not grant that it will&#xA; maintain the original order of&#xA; values.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So your query will need to work like this&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var names = (from DataRow dr in dataTable.Rows&#xA; select (string)dr[&quot;Name&quot;]).Distinct().OrderBy( name =&amp;gt; name );&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="45" LastEditorUserId="1248536" LastEditDate="2014-08-19T23:17:56.597" LastActivityDate="2014-08-19T23:17:56.597" CommentCount="0" />
<row Id="65" PostTypeId="2" ParentId="61" CreationDate="2008-08-01T13:20:44.283" Score="6" Body="&lt;p&gt;&lt;a href=&quot;http://www.bram.us/2007/05/25/office-2007-mime-types-for-iis/&quot; rel=&quot;nofollow&quot;&gt;Office 2007 MIME Types for IIS&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;.docm, application/vnd.ms-word.document.macroEnabled.12&lt;/li&gt;&#xA;&lt;li&gt;.docx, application/vnd.openxmlformats-officedocument.wordprocessingml.document&lt;/li&gt;&#xA;&lt;li&gt;.dotm, application/vnd.ms-word.template.macroEnabled.12&lt;/li&gt;&#xA;&lt;li&gt;.dotx, application/vnd.openxmlformats-officedocument.wordprocessingml.template&lt;/li&gt;&#xA;&lt;li&gt;.potm, application/vnd.ms-powerpoint.template.macroEnabled.12&lt;/li&gt;&#xA;&lt;li&gt;.potx, application/vnd.openxmlformats-officedocument.presentationml.template&lt;/li&gt;&#xA;&lt;li&gt;.ppam, application/vnd.ms-powerpoint.addin.macroEnabled.12&lt;/li&gt;&#xA;&lt;li&gt;.ppsm, application/vnd.ms-powerpoint.slideshow.macroEnabled.12&lt;/li&gt;&#xA;&lt;li&gt;.ppsx, application/vnd.openxmlformats-officedocument.presentationml.slideshow&lt;/li&gt;&#xA;&lt;li&gt;.pptm, application/vnd.ms-powerpoint.presentation.macroEnabled.12&lt;/li&gt;&#xA;&lt;li&gt;.pptx, application/vnd.openxmlformats-officedocument.presentationml.presentation&lt;/li&gt;&#xA;&lt;li&gt;.xlam, application/vnd.ms-excel.addin.macroEnabled.12&lt;/li&gt;&#xA;&lt;li&gt;.xlsb, application/vnd.ms-excel.sheet.binary.macroEnabled.12&lt;/li&gt;&#xA;&lt;li&gt;.xlsm, application/vnd.ms-excel.sheet.macroEnabled.12&lt;/li&gt;&#xA;&lt;li&gt;.xlsx, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&lt;/li&gt;&#xA;&lt;li&gt;.xltm, application/vnd.ms-excel.template.macroEnabled.12&lt;/li&gt;&#xA;&lt;li&gt;.xltx, application/vnd.openxmlformats-officedocument.spreadsheetml.template&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="35" LastEditorUserId="2354564" LastEditDate="2014-07-14T07:43:54.163" LastActivityDate="2014-07-14T07:43:54.163" CommentCount="0" />
<row Id="66" PostTypeId="1" AcceptedAnswerId="4521" CreationDate="2008-08-01T13:20:46.890" Score="39" ViewCount="3304" Body="&lt;p&gt;How do you page through a collection in LINQ given that you have a &lt;code&gt;startIndex&lt;/code&gt; and a &lt;code&gt;count&lt;/code&gt;?&lt;/p&gt;&#xA;" OwnerUserId="17" LastEditorUserId="1039608" LastEditorDisplayName="Keith" LastEditDate="2012-05-04T09:03:54.213" LastActivityDate="2015-02-13T20:55:57.677" Title="Paging a collection with LINQ" Tags="&lt;linq&gt;&lt;.net-3.5&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="4" />
<row Id="68" PostTypeId="2" ParentId="66" CreationDate="2008-08-01T13:22:04.483" Score="45" Body="&lt;p&gt;It is very simple with the &lt;code&gt;Skip&lt;/code&gt; and &lt;code&gt;Take&lt;/code&gt; extension methods.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var query = from i in ideas&#xA; select i;&#xA;&#xA;var paggedCollection = query.Skip(startIndex).Take(count);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="17" LastEditorUserId="1039608" LastEditDate="2012-05-04T09:04:26.523" LastActivityDate="2012-05-04T09:04:26.523" CommentCount="3" />
<row Id="71" PostTypeId="2" ParentId="19" CreationDate="2008-08-01T13:37:59.723" Score="43" Body="&lt;p&gt;Here's a general description of a technique for calculating pi that I learnt in high school.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I only share this because I think it is simple enough that anyone can remember it, indefinitely, plus it teaches you the concept of &quot;Monte-Carlo&quot; methods -- which are statistical methods of arriving at answers that don't immediately appear to be deducible through random processes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Draw a square, and inscribe a quadrant (one quarter of a semi-circle) inside that square (a quadrant with radius equal to the side of the square, so it fills as much of the square as possible)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now throw a dart at the square, and record where it lands -- that is, choose a random point anywhere inside the square. Of course, it landed inside the square, but is it inside the semi-circle? Record this fact.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Repeat this process many times -- and you will find there is a ratio of the number of points inside the semi-circle versus the total number thrown, call this ratio x.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since the area of the square is r times r, you can deduce that the area of the semi circle is x times r times r (that is, x times r squared). Hence x times 4 will give you pi. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is not a quick method to use. But it's a nice example of a Monte Carlo method. And if you look around, you may find that many problems otherwise outside your computational skills can be solved by such methods.&lt;/p&gt;&#xA;" OwnerUserId="49" OwnerDisplayName="Leon Bambrick" LastEditorUserId="63550" LastEditDate="2012-05-25T21:09:03.593" LastActivityDate="2012-05-25T21:09:03.593" CommentCount="1" CommunityOwnedDate="2009-02-26T19:22:22.320" />
<row Id="72" PostTypeId="1" CreationDate="2008-08-01T13:38:27.133" Score="16" ViewCount="925" Body="&lt;p&gt;I've got all these comments that I want to make into 'RDoc comments', so they can be formatted appropriately and viewed using &lt;code&gt;ri&lt;/code&gt;. Can anyone get me started on understanding how to use RDoc?&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="219883" LastEditorDisplayName="Gaius" LastEditDate="2013-05-05T00:24:51.110" LastActivityDate="2013-05-05T00:24:51.110" Title="How do I add existing comments to RDoc in Ruby?" Tags="&lt;ruby&gt;&lt;rdoc&gt;" AnswerCount="2" CommentCount="0" />
<row Id="73" PostTypeId="2" ParentId="25" CreationDate="2008-08-01T13:40:16.443" Score="5" Body="&lt;p&gt;@Jax: The &lt;code&gt;extern &quot;C&quot;&lt;/code&gt; thing matters, very very much. If a header file doesn't have one, then (unless it's a C++-only header file), you would have to enclose your &lt;code&gt;#include&lt;/code&gt; with it:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;extern &quot;C&quot; {&lt;br&gt;#include &amp;lt;sys/socket.h&amp;gt;&lt;br&gt;// include other similarly non-compliant header files&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Basically, anytime where a C++ program wants to link to C-based facilities, the &lt;code&gt;extern &quot;C&quot;&lt;/code&gt; is vital. In practical terms, it means that the names used in external references will not be mangled, like normal C++ names would. &lt;a href=&quot;http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html&quot;&gt;Reference.&lt;/a&gt;&lt;/p&gt;" OwnerUserId="13" LastEditorUserId="13" LastEditorDisplayName="Chris Jester-Young" LastEditDate="2008-08-01T13:54:25.510" LastActivityDate="2008-08-01T13:54:25.510" CommentCount="0" />
<row Id="76" PostTypeId="2" ParentId="42" CreationDate="2008-08-01T13:44:35.843" Score="3" Body="&lt;p&gt;I believe the easiest way would be to follow Jeff's own advice and have a look around existing code. Try looking at Wordpress, Drupal, Joomla and other well known PHP-based CMS's to see how their API hooks look and feel. This way you can even get ideas you may have not thought of previously to make things a little more rubust.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;A more direct answer would be to write general files that they would &quot;include_once&quot; into their file that would provide the usability they would need. This would be broken up into categories and NOT provided in one MASSIVE &quot;hooks.php&quot; file. Be careful though, because what ends up happening is that files that they include end up having more and more dependencies and functionality improves. Try to keep API dependencies low. I.E fewer files for them to include.&lt;/p&gt;" OwnerUserId="50" LastActivityDate="2008-08-01T13:44:35.843" CommentCount="1" />
<row Id="77" PostTypeId="2" ParentId="42" CreationDate="2008-08-01T13:46:00.097" Score="89" Body="&lt;p&gt;You could use an Observer pattern. A simple functional way to accomplish this:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&lt;br&gt;&lt;br&gt;/** Plugin system **/&lt;br&gt;&lt;br&gt;$listeners = array();&lt;br&gt;&lt;br&gt;/* Create an entry point for plugins */&lt;br&gt;function hook(){&lt;br&gt; global $listeners;&lt;br&gt;&lt;br&gt; $num_args = func_num_args();&lt;br&gt; $args = func_get_args();&lt;br&gt;&lt;br&gt; if($num_args &amp;lt; 2)&lt;br&gt; trigger_error(&quot;Insufficient arguments&quot;, E_USER_ERROR);&lt;br&gt;&lt;br&gt; // Hook name should always be first argument&lt;br&gt; $hook_name = array_shift($args);&lt;br&gt;&lt;br&gt; if(!isset($listeners[$hook_name]))&lt;br&gt; return; // No plugins have registered this hook&lt;br&gt;&lt;br&gt; foreach($listeners[$hook_name] as $func){&lt;br&gt; $args = $func($args); &lt;br&gt; }&lt;br&gt;&lt;br&gt; return $args;&lt;br&gt;}&lt;br&gt;&lt;br&gt;/* Attach a function to a hook */&lt;br&gt;function add_listener($hook, $function_name){&lt;br&gt; global $listeners;&lt;br&gt;&lt;br&gt; $listeners[$hook][] = $function_name;&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;br&gt;/////////////////////////&lt;br&gt;&lt;br&gt;/** Sample Plugin **/&lt;br&gt;add_listener('a_b', 'my_plugin_func1');&lt;br&gt;add_listener('str', 'my_plugin_func2');&lt;br&gt;&lt;br&gt;function my_plugin_func1($args){&lt;br&gt; return array(4, 5);&lt;br&gt;}&lt;br&gt;function my_plugin_func2($args){&lt;br&gt; return str_replace('sample', 'CRAZY', $args[0]);&lt;br&gt;}&lt;br&gt;&lt;br&gt;/////////////////////////&lt;br&gt;&lt;br&gt;/** Sample Application **/&lt;br&gt;&lt;br&gt;$a = 1;&lt;br&gt;$b = 2;&lt;br&gt;&lt;br&gt;list($a, $b) = hook('a_b', $a, $b);&lt;br&gt;&lt;br&gt;$str = &quot;This is my sample application\n&quot;;&lt;br&gt;$str .= &quot;$a + $b = &quot;.($a+$b).&quot;\n&quot;;&lt;br&gt;$str .= &quot;$a * $b = &quot;.($a*$b).&quot;\n&quot;;&lt;br&gt;&lt;br&gt;$str = hook('str', $str);&lt;br&gt;&lt;br&gt;echo $str;&lt;br&gt;&lt;br&gt;?&amp;gt;&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;This is my CRAZY application&lt;br&gt;4 + 5 = 9&lt;br&gt;4 * 5 = 20&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;strong&gt;Notes:&lt;/strong&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;For this example source code, you must declare all your plugins before the actual source code that you want to be extendable. I've included an example of how to handle single or multiple values being passed to the plugin. The hardest part of this is writing the actual documentation which lists what arguments get passed to each hook.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;This is just one method of accomplishing a plugin system in PHP. There are better alternatives, I suggest you check out the WordPress Documentation for more information.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;em&gt;Sorry, it appears underscore characters are replaced by HTML entities by Markdown? I can re-post this code when this bug gets fixed.&lt;/em&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;em&gt;Edit: Nevermind, it only appears that way when you are editing&lt;/em&gt;&lt;/p&gt;" OwnerUserId="40" LastActivityDate="2008-08-01T13:46:00.097" CommentCount="2" CommunityOwnedDate="2011-02-10T01:43:58.203" />
<row Id="78" PostTypeId="2" ParentId="4" CreationDate="2008-08-01T13:53:06.357" Score="27" Body="&lt;p&gt;It sounds like &lt;code&gt;this.Opacity&lt;/code&gt; is a double value, and the compiler doesn't like you trying to cram a decimal value into it.&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="967315" LastEditDate="2012-10-14T11:54:40.347" LastActivityDate="2012-10-14T11:54:40.347" CommentCount="0" />
<row Id="79" PostTypeId="1" AcceptedAnswerId="62853" CreationDate="2008-08-01T13:56:33.837" Score="17" ViewCount="10389" Body="&lt;p&gt;The version of Subclipse (1.2.4) currently available through Aptana's automagic Plugins Manager does not work with the newest version of Subversion.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I see on the Subclipse website however that they have 1.4.2 out for Eclipse. So I added a &lt;a href=&quot;http://subclipse.tigris.org/update_1.4.x&quot;&gt;new remote update site&lt;/a&gt; to my Update manager. When I tried to install it, it told me I needed Mylyn 3.0.0. So I after much searching I found Mylyn 3.0.0 and added &lt;a href=&quot;http://download.eclipse.org/tools/mylyn/update/e3.3&quot;&gt;another new remote update site&lt;/a&gt; to my update manager. Then when I tried to install that, it told me I needed org.eclipse.ui 3.3.0 or equivalent.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Looking at the configuration details for Aptana, it looks like it is built against eclipse 3.2.2.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anyone know if there is a way to upgrade the version of Eclipse Aptana is built against to 3.3.0? Or if there is some other way to get Subclipse to work with the very newest version of Subversion?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know this isn't necessarily a &quot;programming&quot; question, but I hope it's ok since it's highly relevant to the programming experience...&lt;/p&gt;&#xA;" OwnerUserId="58" OwnerDisplayName="Christopher McCulloh" LastEditorUserId="561309" LastEditorDisplayName="Gaius" LastEditDate="2011-08-24T06:53:11.577" LastActivityDate="2011-08-24T06:53:11.577" Title="How can you get Subclipse in Aptana to work with the newest release of Subversion?" Tags="&lt;eclipse&gt;&lt;svn&gt;&lt;aptana&gt;&lt;subclipse&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" />
<row Id="80" PostTypeId="1" AcceptedAnswerId="124" CreationDate="2008-08-01T13:57:07.033" Score="17" ViewCount="3991" Body="&lt;p&gt;I've written a database generation script in &lt;a href=&quot;http://en.wikipedia.org/wiki/SQL&quot;&gt;SQL&lt;/a&gt; and want to execute it in my &lt;a href=&quot;http://en.wikipedia.org/wiki/Adobe_Integrated_Runtime&quot;&gt;Adobe AIR&lt;/a&gt; application:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Create Table tRole (&#xA; roleID integer Primary Key&#xA; ,roleName varchar(40)&#xA;);&#xA;Create Table tFile (&#xA; fileID integer Primary Key&#xA; ,fileName varchar(50)&#xA; ,fileDescription varchar(500)&#xA; ,thumbnailID integer&#xA; ,fileFormatID integer&#xA; ,categoryID integer&#xA; ,isFavorite boolean&#xA; ,dateAdded date&#xA; ,globalAccessCount integer&#xA; ,lastAccessTime date&#xA; ,downloadComplete boolean&#xA; ,isNew boolean&#xA; ,isSpotlight boolean&#xA; ,duration varchar(30)&#xA;);&#xA;Create Table tCategory (&#xA; categoryID integer Primary Key&#xA; ,categoryName varchar(50)&#xA; ,parent_categoryID integer&#xA;);&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I execute this in Adobe AIR using the following methods:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static function RunSqlFromFile(fileName:String):void {&#xA; var file:File = File.applicationDirectory.resolvePath(fileName);&#xA; var stream:FileStream = new FileStream();&#xA; stream.open(file, FileMode.READ)&#xA; var strSql:String = stream.readUTFBytes(stream.bytesAvailable);&#xA; NonQuery(strSql);&#xA;}&#xA;&#xA;public static function NonQuery(strSQL:String):void&#xA;{&#xA; var sqlConnection:SQLConnection = new SQLConnection();&#xA; sqlConnection.open(File.applicationStorageDirectory.resolvePath(DBPATH);&#xA; var sqlStatement:SQLStatement = new SQLStatement();&#xA; sqlStatement.text = strSQL;&#xA; sqlStatement.sqlConnection = sqlConnection;&#xA; try&#xA; {&#xA; sqlStatement.execute();&#xA; }&#xA; catch (error:SQLError)&#xA; {&#xA; Alert.show(error.toString());&#xA; }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;No errors are generated, however only &lt;code&gt;tRole&lt;/code&gt; exists. It seems that it only looks at the first query (up to the semicolon- if I remove it, the query fails). Is there a way to call multiple queries in one statement?&lt;/p&gt;&#xA;" OwnerUserId="26" LastEditorUserId="243557" LastEditorDisplayName="modesty" LastEditDate="2013-10-04T01:18:16.957" LastActivityDate="2013-10-04T01:18:16.957" Title="SQLStatement.execute() - multiple queries in one statement" Tags="&lt;flex&gt;&lt;actionscript-3&gt;&lt;air&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" />
<row Id="81" PostTypeId="2" ParentId="34" CreationDate="2008-08-01T14:03:22.230" Score="7" Body="&lt;p&gt;I believe you have answered your own question...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;code&gt;System.totalMemory&lt;/code&gt; gives you the total amount of memory being &quot;used&quot;, not allocated. It is accurate that your application may only be using 20mb, but it has 5mb that is free for future allocations.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not sure if the Adobe docs would shed light on the way that it manages memory...&lt;/p&gt;&#xA;" OwnerUserId="41" LastEditorUserId="967315" LastEditDate="2012-10-14T12:18:19.590" LastActivityDate="2012-10-14T12:18:19.590" CommentCount="0" />
<row Id="82" PostTypeId="2" ParentId="36" CreationDate="2008-08-01T14:06:28.560" Score="7" Body="&lt;p&gt;Have a DTS job (or a job that is started by a windows service) that runs at a given interval. Each time it is run, it gets information about the given table by using the system &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms186778.aspx&quot;&gt;INFORMATION_SCHEMA&lt;/a&gt; tables, and records this data in the data repository. Compare the data returned regarding the structure of the table with the data returned the previous time. If it is different, then you know that the structure has changed.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Example query to return information regarding all of the columns in table ABC (ideally listing out just the columns from the INFORMATION_SCHEMA table that you want, instead of using &lt;em&gt;select *&lt;/em&gt; like I do here):&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;select * from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'ABC'&#xD;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You would monitor different columns and INFORMATION_SCHEMA views depending on how exactly you define &quot;changes to a table&quot;.&lt;/p&gt;" OwnerUserId="51" LastActivityDate="2008-08-01T14:06:28.560" CommentCount="1" />
<row Id="84" PostTypeId="2" ParentId="16" CreationDate="2008-08-01T14:10:55.757" Score="3" Body="&lt;p&gt;If you use a return type of &lt;code&gt;IEnumerable&lt;/code&gt;, you can return your &lt;strong&gt;query&lt;/strong&gt; variable directly.&lt;/p&gt;&#xA;" OwnerUserId="60" LastEditorUserId="5469" LastEditorDisplayName="Kilhoffer" LastEditDate="2008-10-18T18:26:59.070" LastActivityDate="2008-10-18T18:26:59.070" CommentCount="0" />
<row Id="85" PostTypeId="1" AcceptedAnswerId="154" CreationDate="2008-08-01T14:19:52.510" Score="56" ViewCount="19328" Body="&lt;p&gt;What are your best practices around creating flat file database structures in PHP? A lot of the more mature PHP flat file frameworks I see out there 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).&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Are there any elegant tricks out there to get good performance and features with the small code overhead one would want by taking on this problem in the first place?&lt;/p&gt;" OwnerUserId="59" LastEditorUserId="243557" LastEditorDisplayName="saint_groceon" LastEditDate="2013-10-04T01:17:44.297" LastActivityDate="2014-11-15T12:02:18.573" Title="Flat File Databases" Tags="&lt;php&gt;&lt;sql&gt;&lt;database&gt;&lt;flat-file&gt;" AnswerCount="15" CommentCount="0" FavoriteCount="10" />
<row Id="86" PostTypeId="2" ParentId="4" CreationDate="2008-08-01T14:23:28.087" Score="61" Body="&lt;p&gt;A more generic answer for the generic question &quot;Decimal vs Double?&quot;: &lt;strong&gt;Decimal&lt;/strong&gt; for monetary calculations to preserve the precision, &lt;strong&gt;Double&lt;/strong&gt; for scientific calculations that do not get affected by small differences. Since Double is a type which is native to the CPU (internal representation is stored in &lt;em&gt;base 2&lt;/em&gt;), calculations made with Double perform better then Decimal (which is represented in &lt;em&gt;base 10&lt;/em&gt; internally).&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="2354564" LastEditorDisplayName="huseyint" LastEditDate="2014-07-11T14:42:28.547" LastActivityDate="2014-07-11T14:42:28.547" CommentCount="0" />
<row Id="87" PostTypeId="2" ParentId="85" CreationDate="2008-08-01T14:26:22.793" Score="5" Body="&lt;P&gt;One framework I'm considering would be for a blogging platform. Since just about any possible view of data you would want would be sorted by date, I was thinking about this structure:&lt;/P&gt;&#xD;&#xA;&lt;P&gt;One directory per content node: ./content/YYYYMMDDHHMMSS/&lt;/P&gt;&#xD;&#xA;&lt;P&gt;Subdirectories of each node including &lt;BR&gt;/tags &lt;BR&gt;/authors &lt;BR&gt;/comments &lt;/P&gt;&#xD;&#xA;&lt;P&gt;as well as simple text files in the node directory for pre- and post-rendered content and the like.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;This would allow a simple PHP &lt;A href=&quot;http://us3.php.net/glob&quot;&gt;glob()&lt;/A&gt; call (and probably a reversal of the result array) to query on just about anything within the content structure:&lt;/P&gt;glob(&quot;content/*/tags/funny&quot;); &lt;BR&gt;&#xD;&#xA;&lt;P&gt;would return paths including all articles tagged &quot;funny&quot;.&lt;/P&gt;" OwnerUserId="59" LastActivityDate="2008-08-01T14:26:22.793" CommentCount="0" />
<row Id="88" PostTypeId="1" AcceptedAnswerId="98" CreationDate="2008-08-01T14:36:18.640" Score="53" ViewCount="28673" Body="&lt;p&gt;So I find myself 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). I have implemented &lt;code&gt;QueryPerformanceCounter&lt;/code&gt; by giving the uSeconds since the process start up: &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;BOOL QueryPerformanceCounter(LARGE_INTEGER* performanceCount)&#xA;{&#xA; gettimeofday(&amp;amp;currentTimeVal, NULL);&#xA; performanceCount-&amp;gt;QuadPart = (currentTimeVal.tv_sec - startTimeVal.tv_sec);&#xA; performanceCount-&amp;gt;QuadPart *= (1000 * 1000);&#xA; performanceCount-&amp;gt;QuadPart += (currentTimeVal.tv_usec - startTimeVal.tv_usec);&#xA;&#xA; return true;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This, coupled with &lt;code&gt;QueryPerformanceFrequency()&lt;/code&gt; giving a constant 1000000 as the frequency, works well &lt;b&gt;on my machine&lt;/b&gt;, giving me a 64 bit variable that contains &lt;code&gt;uSeconds&lt;/code&gt; since the program's start up. So &lt;em&gt;is this portable?&lt;/em&gt; I don't want to discover it works differently if the kernel was compiled in a certain way or anything like that. I am fine with it being non-portable to something other than Linux, however.&lt;/p&gt;&#xA;" OwnerUserId="61" LastEditorDisplayName="user1645055" LastEditDate="2012-11-27T07:20:52.437" LastActivityDate="2013-12-20T00:48:08.887" Title="Is gettimeofday() guaranteed to be of microsecond resolution?" Tags="&lt;linux&gt;&lt;winapi&gt;&lt;visual-c++&gt;&lt;unix&gt;&lt;timer&gt;" AnswerCount="10" CommentCount="0" FavoriteCount="14" />
<row Id="89" PostTypeId="2" ParentId="79" CreationDate="2008-08-01T14:41:01.110" Score="1" Body="&lt;p&gt;I've had problems with JavaHL in Eclipse Ganymede, when it worked fine in Eclipse Europa. I'm not sure how Aptana is different, but try either upgrading JavaHL or switching to the pure-java SVNKit implementation within the Subclipse config.&lt;/p&gt;" OwnerDisplayName="Ted Dziuba" LastActivityDate="2008-08-01T14:41:01.110" CommentCount="0" />
<row Id="90" PostTypeId="1" CreationDate="2008-08-01T14:41:24.277" Score="133" ViewCount="50994" Body="&lt;p&gt;Are there any really good tutorials explaining &lt;a href=&quot;http://svnbook.red-bean.com/en/1.7/svn.branchmerge.html&quot;&gt;branching and merging&lt;/a&gt; with Apache Subversion? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;All the better if it's specific to TortoiseSVN client.&lt;/p&gt;&#xA;" OwnerUserId="58" OwnerDisplayName="Christopher McCulloh" LastEditorUserId="761095" LastEditorDisplayName="Gaius" LastEditDate="2012-08-17T15:15:41.300" LastActivityDate="2012-08-17T15:15:41.300" Title="Good branching and merging tutorials for TortoiseSVN?" Tags="&lt;svn&gt;&lt;tortoisesvn&gt;&lt;branch&gt;&lt;branching-and-merging&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="91" ClosedDate="2012-12-26T03:45:49.847" />
<row Id="92" PostTypeId="2" ParentId="90" CreationDate="2008-08-01T14:45:37.403" Score="12" Body="&lt;p&gt;&lt;a href=&quot;http://svnbook.red-bean.com/&quot;&gt;Version Control with Subversion&lt;/a&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;A very good resource for source control in general. Not really TortoiseSVN specific, though.&lt;/p&gt;" OwnerUserId="61" LastActivityDate="2008-08-01T14:45:37.403" CommentCount="0" />
<row Id="93" PostTypeId="2" ParentId="88" CreationDate="2008-08-01T14:46:53.097" Score="1" Body="&lt;p&gt;From my experience, and from what I've read across the internet, the answer is &quot;No,&quot; it is not guaranteed. It depends on CPU speed, operating system, flavor of Linux, etc.&lt;/p&gt;" OwnerUserId="25" LastEditorUserId="25" LastEditorDisplayName="Chris Reath" LastEditDate="2008-08-01T15:01:13.003" LastActivityDate="2008-08-01T15:01:13.003" CommentCount="0" />
<row Id="97" PostTypeId="2" ParentId="85" CreationDate="2008-08-01T14:52:53.537" Score="16" Body="&lt;p&gt;One way to store flat-file content would be to save literal arrays to php files. For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$data = array();&#xA;&#xA;if( $_POST ) {&#xA; $data = $_POST;&#xA;&#xA; $content = &quot;&amp;lt;?php\n&quot;;&#xA; $content .= '$data=' . var_export($data, true) . &quot;\n&quot;;&#xA; $content .= &quot;?&amp;gt;&quot;;&#xA;&#xA; save_to_file($filename, $content);&#xA;}&#xA;&#xA;// echo form&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="40" LastEditorUserId="967315" LastEditorDisplayName="kevin d" LastEditDate="2012-10-14T12:26:49.687" LastActivityDate="2012-10-14T12:26:49.687" CommentCount="4" />
<row Id="98" PostTypeId="2" ParentId="88" CreationDate="2008-08-01T14:53:47.497" Score="40" Body="&lt;p&gt;Maybe. But you have bigger problems. &lt;code&gt;gettimeofday()&lt;/code&gt; can result in incorrect timings if there are processes on your system that change the timer (ie, ntpd). On a &quot;normal&quot; linux, though, I believe the resolution of &lt;code&gt;gettimeofday()&lt;/code&gt; is 10us. It can jump forward and backward and time, consequently, based on the processes running on your system. This effectively makes the answer to your question no.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You should look into &lt;code&gt;clock_gettime(CLOCK_MONOTONIC)&lt;/code&gt; for timing intervals. It suffers from several less issues due to things like multi-core systems and external clock settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, look into the &lt;code&gt;clock_getres()&lt;/code&gt; function.&lt;/p&gt;&#xA;" OwnerUserId="2089740" LastEditorUserId="967315" LastEditorDisplayName="lbrandy" LastEditDate="2012-10-14T12:28:51.043" LastActivityDate="2012-10-14T12:28:51.043" CommentCount="5" />
<row Id="99" PostTypeId="2" ParentId="88" CreationDate="2008-08-01T14:55:08.477" Score="4" Body="&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;The actual resolution of gettimeofday() depends on the hardware architecture. Intel processors as well as SPARC machines offer high resolution timers that measure microseconds. Other hardware architectures fall back to the system’s timer, which is typically set to 100 Hz. In such cases, the time resolution will be less accurate. &lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I obtained this answer from &lt;a href=&quot;http://www.informit.com/guides/content.aspx?g=cplusplus&amp;amp;seqNum=272&quot; rel=&quot;nofollow&quot;&gt;High Resolution Time Measurement and Timers, Part I&lt;/a&gt;&lt;/p&gt;" OwnerUserId="25" LastActivityDate="2008-08-01T14:55:08.477" CommentCount="0" />
<row Id="100" PostTypeId="2" ParentId="85" CreationDate="2008-08-01T14:58:15.430" Score="12" Body="&lt;p&gt;That's true. &lt;code&gt;serialize()&lt;/code&gt; can be pretty useful for that as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I think the trick to coming up with a viable system is finding some way to index the data nodes without killing yourself with complexity.&lt;/p&gt;&#xA;" OwnerUserId="59" LastEditorUserId="967315" LastEditDate="2012-10-14T12:28:29.997" LastActivityDate="2012-10-14T12:28:29.997" CommentCount="2" />
<row Id="103" PostTypeId="2" ParentId="13" CreationDate="2008-08-01T15:11:59.987" Score="29" Body="&lt;p&gt;Javascript is the easiest way to get the client's local time. I would suggest using an &lt;code&gt;XMLHttpRequest&lt;/code&gt; to send back the local time, and if that fails, fall back to the timezone detected based on their IP address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As far as geolocation, I've used &lt;a href=&quot;http://www.maxmind.com/app/ip-location&quot;&gt;MaxMind GeoIP&lt;/a&gt; on several projects and it works well, though I'm not sure if they provide timezone data. It's a service you pay for and they provide monthly updates to your database. They provide wrappers in several web languages.&lt;/p&gt;&#xA;" OwnerUserId="72" LastEditorUserId="1039608" LastEditDate="2012-05-04T08:59:38.580" LastActivityDate="2012-05-04T08:59:38.580" CommentCount="2" />
<row Id="104" PostTypeId="1" AcceptedAnswerId="112" CreationDate="2008-08-01T15:12:34.837" Score="110" ViewCount="8686" Body="&lt;p&gt;In .NET perspective:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What is a &lt;strong&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Memory_leak&quot;&gt;Memory Leak&lt;/a&gt;&lt;/strong&gt;?&lt;/li&gt;&#xA;&lt;li&gt;How can you determine whether your application leaks? What are the effects?&lt;/li&gt;&#xA;&lt;li&gt;How can you prevent a memory leak?&lt;/li&gt;&#xA;&lt;li&gt;If your application has memory leak, does it go away when the process exits or is killed? Or do memory leaks in your application affect other processes on the system even after process completion?&lt;/li&gt;&#xA;&lt;li&gt;And what about unmanaged code accessed via COM Interop and/or P/Invoke?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I have some answers for these questions myself, but they are incomplete. What do you think?&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorDisplayName="user1645055" LastEditDate="2012-11-27T07:26:29.273" LastActivityDate="2014-12-15T16:00:47.003" Title="Anatomy of a &quot;Memory Leak&quot;" Tags="&lt;.net&gt;&lt;performance&gt;&lt;memory-leaks&gt;&lt;com-interop&gt;" AnswerCount="15" CommentCount="0" FavoriteCount="57" />
<row Id="107" PostTypeId="2" ParentId="104" CreationDate="2008-08-01T15:19:25.900" Score="6" Body="&lt;p&gt;I guess in a managed environment, a leak would be you keeping an unnecessary reference to a large chunk of memory around. &lt;/p&gt;" OwnerUserId="61" LastActivityDate="2008-08-01T15:19:25.900" CommentCount="0" />
<row Id="108" PostTypeId="1" AcceptedAnswerId="111" CreationDate="2008-08-01T15:22:29.467" Score="28" ViewCount="13841" Body="&lt;p&gt;I've been using &lt;a href=&quot;http://tortoisesvn.tigris.org/&quot;&gt;TortoiseSVN &lt;/a&gt; in a Windows environment for quite some time. It seems very feature-complete and nicely integrated into the Windows shell, and more importantly, it's fairly painless to teach to colleagues with little or no experience with source control. &lt;strong&gt;However&lt;/strong&gt;, since we have moved to Windows Vista 64bit, Tortoise has been very buggy and has seemed to cause lots of explorer.exe abnormalities and crashes. This has happened both with older versions of the software and the latest version (1.5.1 build 13563).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was curious if anyone has suggestions for other Subversion clients that will run on Windows (specifically Vista 64bit). Developers here use a variety of text editors so using Visual Studio or Dreamweaver for SVN is not ideal.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I have heard great things about &lt;a href=&quot;http://www.zennaware.com/cornerstone/&quot;&gt;Cornerstone&lt;/a&gt;, and would love something similar for Windows if it exists.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;I'm correlating the Vista/explorer problems with Tortoise because they normally occur when I'm using the functionality in Tortoise. Sometimes bringing up the &quot;merge&quot; screen will cause the GUI to start acting very strange and eventually hang or crash.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I did not see 1.5.2 -- I'm installing now, maybe that will fix some of my issues.&lt;/p&gt;&#xA;" OwnerUserId="72" LastEditorUserId="1288" LastEditorDisplayName="Adam Mitz" LastEditDate="2011-11-20T13:46:24.733" LastActivityDate="2013-11-07T16:52:15.250" Title="Best Subversion clients for Windows Vista (64bit)" Tags="&lt;windows&gt;&lt;svn&gt;&lt;64bit&gt;" AnswerCount="9" CommentCount="0" FavoriteCount="2" ClosedDate="2012-08-15T19:45:13.350" />
<row Id="109" PostTypeId="1" AcceptedAnswerId="2585" CreationDate="2008-08-01T15:23:05.190" Score="20" ViewCount="3948" Body="&lt;p&gt;Recently our site has been deluged with the resurgence of the &lt;a href=&quot;https://en.wikipedia.org/wiki/Asprox_botnet&quot; rel=&quot;nofollow&quot;&gt;Asprox botnet&lt;/a&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/SQL_injection&quot; rel=&quot;nofollow&quot;&gt;SQL injection&lt;/a&gt; attack. Without going into details, the attack attempts to execute SQL code by encoding the &lt;a href=&quot;http://en.wikipedia.org/wiki/Transact-SQL&quot; rel=&quot;nofollow&quot;&gt;T-SQL&lt;/a&gt; commands in an ASCII encoded BINARY string. It looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;DECLARE%20@S%20NVARCHAR(4000);SET%20@S=CAST(0x44004500...06F007200%20AS%20NVARCHAR(4000));EXEC(@S);--&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I was able to decode this in SQL, but I was a little wary of doing this since I didn't know exactly what was happening at the time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried to write a simple decode tool, so I could decode this type of text without even touching &lt;a href=&quot;http://en.wikipedia.org/wiki/Microsoft_SQL_Server&quot; rel=&quot;nofollow&quot;&gt;SQL&amp;nbsp;Server&lt;/a&gt;. The main part I need decoded is:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;CAST(0x44004500...06F007200 AS&#xA;NVARCHAR(4000))&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I've tried all of the following commands with no luck:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;txtDecodedText.Text =&#xA; System.Web.HttpUtility.UrlDecode(txtURLText.Text);&#xA;txtDecodedText.Text =&#xA; Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(txtURLText.Text));&#xA;txtDecodedText.Text =&#xA; Encoding.Unicode.GetString(Encoding.Unicode.GetBytes(txtURLText.Text));&#xA;txtDecodedText.Text =&#xA; Encoding.ASCII.GetString(Encoding.Unicode.GetBytes(txtURLText.Text));&#xA;txtDecodedText.Text =&#xA; Encoding.Unicode.GetString(Convert.FromBase64String(txtURLText.Text));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What is the proper way to translate this encoding without using SQL Server? Is it possible? I'll take VB.NET code since I'm familiar with that too.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Okay, I'm sure I'm missing something here, so here's where I'm at.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since my input is a basic string, I started with just a snippet of the encoded portion - 4445434C41 (which translates to DECLA) - and the first attempt was to do this...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;txtDecodedText.Text = Encoding.UTF8.GetString(Encoding.UTF8.GetBytes(txtURL.Text));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;...and all it did was return the exact same thing that I put in, since it converted each character into is byte.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realized that I need to parse each two characters into a byte manually since I don't know of any methods yet that will do that, so now my little decoder looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;while (!boolIsDone)&#xA;{&#xA; bytURLChar = byte.Parse(txtURLText.Text.Substring(intParseIndex, 2));&#xA; bytURL[intURLIndex] = bytURLChar;&#xA; intParseIndex += 2;&#xA; intURLIndex++;&#xA;&#xA; if (txtURLText.Text.Length - intParseIndex &amp;lt; 2)&#xA; {&#xA; boolIsDone = true;&#xA; }&#xA;}&#xA;&#xA;txtDecodedText.Text = Encoding.UTF8.GetString(bytURL);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Things look good for the first couple of pairs, but then the loop balks when it gets to the &quot;4C&quot; pair and says that the string is in the incorrect format.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Interestingly enough, when I step through the debugger and to the GetString method on the byte array that I was able to parse up to that point, I get &quot;,-+&quot; as the result.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I figure out what I'm missing - do I need to do a &quot;direct cast&quot; for each byte instead of attempting to parse it?&lt;/p&gt;&#xA;" OwnerUserId="71" LastEditorUserId="63550" LastEditorDisplayName="Jeff Atwood" LastEditDate="2015-01-08T16:27:49.863" LastActivityDate="2015-01-08T17:02:44.503" Title="Decoding T-SQL CAST in C#/VB.NET" Tags="&lt;c#&gt;&lt;sql&gt;&lt;vb.net&gt;&lt;ascii&gt;&lt;hex&gt;" AnswerCount="2" CommentCount="4" />
<row Id="110" PostTypeId="2" ParentId="104" CreationDate="2008-08-01T15:23:33.817" Score="3" Body="&lt;p&gt;I will concur with Bernard as to in .net what a mem leak would be.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You could profile your application to see its memory use, and determine that if its managing a lot of memory when it should not be you could say it has a leak.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;In managed terms I will put my neck on the line to say it does go away once the process is killed/removed.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Unmanaged code is it's own beast and if a leak exists within it, it will follow a standard mem. leak definition.&lt;/p&gt;" OwnerUserId="36" LastActivityDate="2008-08-01T15:23:33.817" CommentCount="0" />
<row Id="111" PostTypeId="2" ParentId="108" CreationDate="2008-08-01T15:27:23.093" Score="33" Body="&lt;p&gt;I have been using the 64Bit version of TortoiseSVN for ages and I have never had issues with it on Windows 64Bit or Vista 64Bit. I am currently not aware of any other similiar SVN clients that do work on Vista. Is it possible the problem could lie within the configuration of TortoiseSVN or even the installation of Vista? Is the problem occurring on Vista native or SP 1?&lt;/p&gt;" OwnerUserId="146270" OwnerDisplayName="Diago" LastActivityDate="2008-08-01T15:27:23.093" CommentCount="2" />
<row Id="112" PostTypeId="2" ParentId="104" CreationDate="2008-08-01T15:28:12.543" Score="78" Body="&lt;p&gt;The best explanation I've seen is in Chapter 7 of the free &lt;a href=&quot;http://codebetter.com/files/folders/codebetter_downloads/entry179694.aspx&quot;&gt;Foundations of Programming ebook&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Basically, in .NET a memory leak occurs when referenced objects are rooted and thus cannot be garbage collected. This occurs accidentally when you hold on to references beyond the intended scope.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'll know that you have leaks when you start getting outofmemoryexceptions or your memory usage goes up beyond what you'd expect (perfmon has nice memory counters). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Understanding .NET's memory model is your best way of avoiding it. Specifically, understanding how the garbage collector works and how references work (again, I refer you to chapter 7 of the ebook). Also, be mindful of common pitfalls, probably the most common being events. If object A registered to an event on object B, then object A will stick around until object B disappears because B holds a reference to A. The solution is to unregister your events when you're done. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of course, a good memory profile will let you see your object graphs and explore the nesting/referencing of your objects to see where references are coming from and what root object is responsible (&lt;a href=&quot;http://www.red-gate.com/products/ants_memory_profiler/index.htm&quot;&gt;red-gate ants profile&lt;/a&gt;, JetBrains dotTrace, &lt;a href=&quot;http://memprofiler.com/&quot;&gt;memprofiler&lt;/a&gt; are really good choices, or you can use the text-only windbg and sos, but I'd strongly recommend a commercial/visual product unless you're a real guru).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I believe unmanaged code is subject to typical memory leaks of unamanged code, except that references shared between the two are managed by the garbage collector. Could be wrong about this last point.&lt;/p&gt;&#xA;" OwnerUserId="34" LastEditorUserId="25201" LastEditorDisplayName="GateKiller" LastEditDate="2010-09-07T23:13:13.807" LastActivityDate="2010-09-07T23:13:13.807" CommentCount="5" />
<row Id="113" PostTypeId="2" ParentId="108" CreationDate="2008-08-01T15:32:11.337" Score="4" Body="&lt;p&gt;I'll second Diago's answer. I use TortoiseSVN on Vista x64 pretty heavily.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I did upgrade directly from an older version to 1.5.2 though, and never used 1.5.1. Have you tried 1.5.2?&lt;/p&gt;" OwnerUserId="60" LastActivityDate="2008-08-01T15:32:11.337" CommentCount="0" />
<row Id="114" PostTypeId="2" ParentId="108" CreationDate="2008-08-01T15:32:42.473" Score="7" Body="&lt;p&gt;TortoiseSVN in combination with VisualSVN for Visual Studio.&lt;/p&gt;&#xA;" OwnerUserId="17" LastEditorUserId="761095" LastEditDate="2013-11-07T16:52:15.250" LastActivityDate="2013-11-07T16:52:15.250" CommentCount="0" />
<row Id="116" PostTypeId="2" ParentId="108" CreationDate="2008-08-01T15:34:43.873" Score="2" Body="&lt;p&gt;I too get explorer crashes in Vista (I'm not in the 64Bit version though). I'm using Vista Super Saijen (or whatever they are calling the most expensive version). I'm not having any bugs with Tortoise.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;My explorer does, however, crash about every other day (sometimes multiple times a day if it's having an &quot;off&quot; day). I'm not positive it's being caused by TortoiseSVN though. From what I hear, the explorer just crashes a lot in Vista...&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Have you tried uninstalling Tortoise and using Windows for a day or two and seeing if it still crashes? Do you restart your computer at least once a day (It seems the longer I go between restarts, the worse the crashes get)?&lt;/p&gt;" OwnerUserId="58" LastActivityDate="2008-08-01T15:34:43.873" CommentCount="0" />
<row Id="120" PostTypeId="1" CreationDate="2008-08-01T15:50:08.537" Score="15" ViewCount="974" Body="&lt;p&gt;Has anyone got experience creating SQL-based ASP.NET site-map providers?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got the default XML file &lt;em&gt;web.sitemap&lt;/em&gt; working properly with my Menu and SiteMapPath controls, but I'll need a way for the users of my site to create and modify pages dynamically.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I need to tie page viewing permissions into the standard ASP.NET membership system as well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'd like some advice on articles or videos&lt;/p&gt;&#xA;" OwnerUserId="83" OwnerDisplayName="Zack" LastEditorUserId="447356" LastEditorDisplayName="Leon Bambrick" LastEditDate="2014-12-15T14:19:37.767" LastActivityDate="2014-12-15T14:19:37.767" Title="ASP.NET Site Maps" Tags="&lt;sql&gt;&lt;asp.net&gt;&lt;sitemap&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="2" />
<row Id="123" PostTypeId="1" AcceptedAnswerId="183" CreationDate="2008-08-01T16:08:52.353" Score="48" ViewCount="44161" Body="&lt;p&gt;Is there an existing application or library in Java which will allow me to convert a CSV data file to XML file? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The XML tags would be provided through possibly the first row containing column headings.&lt;/p&gt;&#xA;" OwnerUserId="78" LastEditorUserId="759452" LastEditorDisplayName="Jeff Atwood" LastEditDate="2013-11-29T08:56:55.010" LastActivityDate="2014-08-18T11:14:48.783" Title="Java lib or app to convert CSV to XML file?" Tags="&lt;java&gt;&lt;xml&gt;&lt;csv&gt;&lt;data-conversion&gt;" AnswerCount="17" CommentCount="3" FavoriteCount="13" />
<row Id="124" PostTypeId="2" ParentId="80" CreationDate="2008-08-01T16:09:47.687" Score="7" Body="&lt;p&gt;I wound up using this. It is a kind of a hack, but it actually works pretty well. The only thing is you have to be very careful with your semicolons. : D&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var strSql:String = stream.readUTFBytes(stream.bytesAvailable); &#xA;var i:Number = 0;&#xA;var strSqlSplit:Array = strSql.split(&quot;;&quot;);&#xA;for (i = 0; i &amp;lt; strSqlSplit.length; i++){&#xA; NonQuery(strSqlSplit[i].toString());&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="26" LastEditorUserId="63550" LastEditDate="2013-08-09T17:23:42.920" LastActivityDate="2013-08-09T17:23:42.920" CommentCount="1" />
<row Id="126" PostTypeId="1" AcceptedAnswerId="127" CreationDate="2008-08-01T16:10:30.337" Score="33" ViewCount="6357" Body="&lt;p&gt;What is the &quot;purist&quot; or &quot;correct&quot; way to access an object's properties from within an object method that is not a getter/setter method?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that from outside of the object you should use a getter/setter, but from within would you just do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Java:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;String property = this.property;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;PHP:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$property = $this-&amp;gt;property;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or would you do:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Java:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;String property = this.getProperty();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;PHP:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$property = $this-&amp;gt;getProperty();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Forgive me if my Java is a little off, it's been a year since I programmed in Java...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;EDIT:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It seems people are assuming I am talking about private or protected variables/properties only. When I learned OO I was taught to use getters/setters for every single property even if it was public (and actually I was told never to make any variable/property public). So, I may be starting off from a false assumption from the get go. It appears that people answering this question are maybe saying that you should have public properties and that those don't need getters and setters, which goes against what I was taught, and what I was talking about, although maybe that needs to be discussed as well. That's probably a good topic for a different question though...&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="202431" LastEditorDisplayName="Gaius" LastEditDate="2010-01-20T08:27:13.130" LastActivityDate="2013-11-26T00:04:43.883" Title="How would you access Object properties from within an object method?" Tags="&lt;java&gt;&lt;php&gt;&lt;oop&gt;&lt;theory&gt;" AnswerCount="19" CommentCount="0" FavoriteCount="2" ClosedDate="2012-05-08T18:11:27.270" />
<row Id="127" PostTypeId="2" ParentId="126" CreationDate="2008-08-01T16:13:47.600" Score="37" Body="&lt;p&gt;This has religious war potential, but it seems to me that if you're using a getter/setter, you should use it internally as well - using both will lead to maintenance problems down the road (e.g. somebody adds code to a setter that &lt;em&gt;needs&lt;/em&gt; to run every time that property is set, and the property is being set internally w/o that setter being called).&lt;/p&gt;" OwnerUserId="35" LastEditorUserId="35" LastEditorDisplayName="Greg" LastEditDate="2008-08-01T16:32:17.110" LastActivityDate="2008-08-01T16:32:17.110" CommentCount="2" />
<row Id="128" PostTypeId="2" ParentId="126" CreationDate="2008-08-01T16:19:04.283" Score="7" Body="&lt;p&gt;It depends on how the property is used. For example, say you have a student object that has a name property. You could use your Get method to pull the name from the database, if it hasn't been retrieved already. This way you are reducing unnecessary calls to the database.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Now let's say you have a private integer counter in your object that counts the number of times the name has been called. You may want to not use the Get method from inside the object because it would produce an invalid count.&lt;/p&gt;" OwnerUserId="26" LastActivityDate="2008-08-01T16:19:04.283" CommentCount="2" />
<row Id="129" PostTypeId="1" CreationDate="2008-08-01T16:22:42.420" Score="51" ViewCount="82101" Body="&lt;p&gt;I've been banging my head against SQL Server 2005 trying to get a lot of data out. I've been given a database with nearly 300 tables in it and I need to turn this into a MySQL database. My first call was to use bcp but unfortunately it doesn't produce valid CSV - strings aren't encapsulated, so you can't deal with any row that has a string with a comma in it (or whatever you use as a delimiter) and I would still have to hand write all of the create table statements, as obviously CSV doesn't tell you anything about the data types.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What would be better is if there was some tool that could connect to both SQL Server and MySQL, then do a copy. You lose views, stored procedures, trigger, etc, but it isn't hard to copy a table that only uses base types from one DB to another... is it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does anybody know of such a tool? I don't mind how many assumptions it makes or what simplifications occur, as long as it supports integer, float, datetime and string. I have to do a lot of pruning, normalising, etc. anyway so I don't care about keeping keys, relationships or anything like that, but I need the initial set of data in fast!&lt;/p&gt;&#xA;" OwnerUserId="48" LastEditorUserId="2641576" LastEditorDisplayName="Mark Harrison" LastEditDate="2014-11-25T20:33:56.240" LastActivityDate="2014-11-25T20:33:56.240" Title="How to export data from SQL Server 2005 to MySQL" Tags="&lt;mysql&gt;&lt;sql-server&gt;&lt;csv&gt;&lt;sql-server-2005&gt;&lt;bcp&gt;" AnswerCount="5" CommentCount="6" FavoriteCount="21" ClosedDate="2012-07-03T14:30:16.880" />
<row Id="133" PostTypeId="2" ParentId="123" CreationDate="2008-08-01T16:31:43.430" Score="0" Body="&lt;p&gt;This may be too basic or limited of a solution, but couldn't you do a &lt;a href=&quot;http://java.sun.com/j2se/7/docs/api/java/lang/String.html#split%28java.lang.String%29&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;String.split()&lt;/code&gt;&lt;/a&gt; on each line of the file, remembering the result array of the first line to generate the XML, and just spit each line's array data out with the proper XML elements padding each iteration of a loop?&lt;/p&gt;&#xA;" OwnerUserId="59" LastEditorUserId="1102512" LastEditDate="2013-11-26T00:02:16.310" LastActivityDate="2013-11-26T00:02:16.310" CommentCount="1" />
<row Id="134" PostTypeId="1" AcceptedAnswerId="206" CreationDate="2008-08-01T16:33:38.183" Score="9" ViewCount="606" Body="&lt;p&gt;I have a pretty standard table setup in a current application using the &lt;a href=&quot;http://en.wikipedia.org/wiki/.NET_Framework&quot; rel=&quot;nofollow&quot;&gt;.NET&lt;/a&gt; &lt;a href=&quot;http://en.wikipedia.org/wiki/XML_Schema_%28W3C%29&quot; rel=&quot;nofollow&quot;&gt;XSD&lt;/a&gt; &lt;code&gt;DataSet&lt;/code&gt; and &lt;code&gt;TableAdapter&lt;/code&gt; features. My &lt;code&gt;contracts&lt;/code&gt; table consists of some standard contract information, with a column for the &lt;code&gt;primary department&lt;/code&gt;. This column is a &lt;a href=&quot;http://en.wikipedia.org/wiki/Foreign_key&quot; rel=&quot;nofollow&quot;&gt;foreign key&lt;/a&gt; to my &lt;code&gt;Departments&lt;/code&gt; table, where I store the basic &lt;code&gt;department name&lt;/code&gt;, &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;notes&lt;/code&gt;. This is all setup and functioning in my &lt;a href=&quot;http://en.wikipedia.org/wiki/Microsoft_SQL_Server&quot; rel=&quot;nofollow&quot;&gt;SQL Server&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I use the XSD tool, I can drag both tables in at once and it auto detects/creates the foreign key I have between these two tables. This works great when I'm on my main page and am viewing contract data.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, when I go to my administrative page to modify the department data. I typically do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Dim dtDepartment As New DepartmentDataTable()&#xA;Dim taDepartment As New DepartmentTableAdapter()&#xA;&#xA;taDepartment.Fill(dtDepartment)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, at this point an exception is thrown saying to the effect that there is a foreign key reference broken here, I'm guessing since I don't have the &lt;code&gt;Contract&lt;/code&gt; &lt;code&gt;DataTable&lt;/code&gt; filled. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How can I fix this problem? I know I can simply remove the foreign key from the XSD to make things work fine, but having the additional integrity check there and having the XSD schema match the SQL schema in the database is nice.&lt;/p&gt;&#xA;" OwnerUserId="71" LastEditorUserId="63550" LastEditorDisplayName="Jim Anderson" LastEditDate="2013-07-03T15:24:02.677" LastActivityDate="2013-07-03T15:24:02.677" Title="XSD DataSets and ignoring foreign keys" Tags="&lt;.net&gt;&lt;database&gt;&lt;xsd&gt;" AnswerCount="1" CommentCount="0" />
<row Id="135" PostTypeId="2" ParentId="129" CreationDate="2008-08-01T16:36:42.080" Score="3" Body="&lt;p&gt;Rolling your own PHP solution will certainly work though I'm not sure if there is a good way to automatically duplicate the schema from one DB to the other (maybe this was your question).&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you are just copying data, and/or you need custom code anyway to convert between modified schemas between the two DB's, I would recommend using PHP 5.2+ and the PDO libraries. You'll be able to connect using PDO ODBC (and use MSSQL drivers). I had a lot of problems getting large text fields and multi-byte characters from MSSQL into PHP using other libraries.&lt;/p&gt;" OwnerUserId="72" LastActivityDate="2008-08-01T16:36:42.080" CommentCount="0" />
<row Id="139" PostTypeId="2" ParentId="126" CreationDate="2008-08-01T16:43:30.880" Score="5" Body="&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;Am I just going overboard here?&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Perhaps ;)&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Another approach would be to utilize a private/protected method to actually do the getting (caching/db/etc), and a public wrapper for it that increments the count:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;PHP:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;public function getName() {&lt;br&gt; $this-&amp;gt;incrementNameCalled();&lt;br&gt; return $this-&amp;gt;_getName();&lt;br&gt;}&lt;br&gt;&lt;br&gt;protected function _getName() {&lt;br&gt; return $this-&amp;gt;name;&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;and then from within the object itself:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;PHP:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;$name = $this-&amp;gt;_getName();&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;This way you can still use that first argument for something else (like sending a flag for whether or not to used cached data here perhaps). &lt;/p&gt;" OwnerUserId="72" LastActivityDate="2008-08-01T16:43:30.880" CommentCount="0" />
<row Id="141" PostTypeId="2" ParentId="129" CreationDate="2008-08-01T16:47:54.927" Score="1" Body="&lt;p&gt;Another tool to try would be the SQLMaestro suite - http://www.sqlmaestro.com It is a little tricky nailing down the precise tool, but they have a variety of tools, both free and for purchase that handle a wide variety of tasks for multiple database platforms. I'd suggest trying the Data Wizard tool first for MySQL, since I believe that will have the proper &quot;import&quot; tool you need.&lt;/p&gt;" OwnerUserId="71" LastActivityDate="2008-08-01T16:47:54.927" CommentCount="0" />
<row Id="142" PostTypeId="2" ParentId="126" CreationDate="2008-08-01T16:56:55.830" Score="2" Body="&lt;P&gt;Well, it seems with C# 3.0 properties' default implementation, the decision is taken for you; you HAVE to set the property using the (possibly private) property setter.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;I personally only use the private member-behind when not doing so would cause the object to fall in an less than desirable state, such as when initializing or when caching/lazy loading is involved.&lt;/P&gt;" OwnerUserId="42" LastActivityDate="2008-08-01T16:56:55.830" CommentCount="0" />
<row Id="143" PostTypeId="2" ParentId="126" CreationDate="2008-08-01T17:01:27.240" Score="3" Body="&lt;p&gt;As stated in some of the comments: Sometimes you should, sometimes you shouldn't. The great part about private variables is that you are able to see all the places they are used when you change something. If your getter/setter does something you need, use it. If it doesn't matter you decide.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The opposite case could be made that if you use the getter/setter and somebody changes the getter/setter they have to analyze all the places the getter and setter is used internally to see if it messes something up. &lt;/p&gt;" OwnerUserId="86" LastActivityDate="2008-08-01T17:01:27.240" CommentCount="0" />
<row Id="145" PostTypeId="1" CreationDate="2008-08-01T17:13:08.933" Score="14" ViewCount="1580" Body="&lt;p&gt;Does anyone know of a good way to compress or decompress files and folders in C# quickly? Handling large files might be necessary.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;http://i.stack.imgur.com/O0LGd.png&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="87" LastEditorUserId="87" LastEditorDisplayName="kevin d" LastEditDate="2014-09-13T13:14:05.237" LastActivityDate="2014-12-15T09:02:35.023" Title="Compressing / Decompressing Folders &amp; Files" Tags="&lt;c#&gt;&lt;.net&gt;&lt;compression&gt;&lt;decompression&gt;" AnswerCount="8" CommentCount="0" FavoriteCount="1" CommunityOwnedDate="2014-04-04T13:02:49.830" />
<row Id="146" PostTypeId="1" AcceptedAnswerId="152" CreationDate="2008-08-01T17:14:58.337" Score="24" ViewCount="10446" Body="&lt;p&gt;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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there an easy way to track how many times a particular song clip (or any binary file) has been downloaded?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;Is the play link a link to the actual&#xA; mp3 file or to some javascript code&#xA; that pops up a player?&lt;/p&gt;&#xA; &#xA; &lt;p&gt;If the latter, you can easily add your&#xA; own logging code in there to track the&#xA; number of hits to it.&lt;/p&gt;&#xA; &#xA; &lt;p&gt;If the former, you'll need something&#xA; that can track the web server log&#xA; itself and make that distinction. My&#xA; hosting plan comes with webalizer,&#xA; which does this nicely.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;It's javascript code, so that answers that. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, it would be nice to know how to track downloads using the other method (without switching hosts).&lt;/p&gt;&#xA;" OwnerUserId="30" LastEditorUserId="243557" LastEditDate="2013-10-04T01:17:13.687" LastActivityDate="2013-10-04T01:17:13.687" Title="How do I track file downloads" Tags="&lt;php&gt;&lt;apache&gt;&lt;download&gt;&lt;analytics&gt;" AnswerCount="7" CommentCount="0" FavoriteCount="5" />
<row Id="147" PostTypeId="2" ParentId="42" CreationDate="2008-08-01T17:23:43.777" Score="13" Body="&lt;p&gt;The &lt;em&gt;hook&lt;/em&gt; and &lt;em&gt;listener&lt;/em&gt; method is the most commonly used, but there are other things you can do. Depending on the size of your app, and who your going to allow see the code (is this going to be a FOSS script, or something in house) will influence greatly how you want to allow plugins.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;kdeloach has a nice example, but his implementation and hook function is a little unsafe. I would ask for you to give more information of the nature of php app your writing, And how you see plugins fitting in. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;+1 to kdeloach from me.&lt;/p&gt;" OwnerUserId="146637" OwnerDisplayName="dubayou" LastActivityDate="2008-08-01T17:23:43.777" CommentCount="0" />
<row Id="148" PostTypeId="2" ParentId="146" CreationDate="2008-08-01T17:24:24.290" Score="0" Body="&lt;p&gt;Is the play link a link to the actual mp3 file or to some javascript code that pops up a player? &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If the latter, you can easily add your own logging code in there to track the number of hits to it.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If the former, you'll need something that can track the web server log itself and make that distinction. My hosting plan comes with webalizer, which does this nicely.&lt;/p&gt;" OwnerUserId="71" LastActivityDate="2008-08-01T17:24:24.290" CommentCount="0" />
<row Id="149" PostTypeId="2" ParentId="145" CreationDate="2008-08-01T17:28:24.253" Score="5" Body="&lt;p&gt;As of .Net 1.1 the only available method is reaching into the java libraries.&lt;br&gt;&#xD;&#xA;&lt;a href=&quot;http://msdn.microsoft.com/en-ca/magazine/cc164129.aspx&quot;&gt;Using the Zip Classes in the J# Class Libraries to Compress Files and Data with C#&lt;/a&gt;&lt;br&gt;&#xD;&#xA;Not sure if this has changed in recent versions.&lt;/p&gt;" OwnerUserId="80" LastActivityDate="2008-08-01T17:28:24.253" CommentCount="0" />
<row Id="151" PostTypeId="2" ParentId="145" CreationDate="2008-08-01T17:30:56.277" Score="12" Body="&lt;p&gt;I've always used the SharpZip Library.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://sharpdevelop.net/OpenSource/SharpZipLib/Download.aspx&quot; rel=&quot;nofollow&quot;&gt;Here's a link&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="44" LastEditorUserId="1525840" LastEditorDisplayName="Jeff Atwood" LastEditDate="2012-12-04T20:29:28.010" LastActivityDate="2012-12-04T20:29:28.010" CommentCount="1" />
<row Id="152" PostTypeId="2" ParentId="146" CreationDate="2008-08-01T17:33:58.750" Score="17" Body="&lt;p&gt;The funny thing is i wrote a php media gallery for all my music 2 days ago. I had a similar problem. Im using &lt;a href=&quot;http://musicplayer.sourceforge.net/&quot;&gt;http://musicplayer.sourceforge.net/&lt;/a&gt; for the player. and the playlis are built via php. all music request go there a script called xfer.php?file=WHATEVER&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$filename = base64_url_decode($_REQUEST['file']);&#xA;header(&quot;Cache-Control: public&quot;);&#xA;header(&quot;Content-Description: File Transfer&quot;);&#xA;header('Content-disposition: attachment; filename='.basename($filename));&#xA;header(&quot;Content-Transfer-Encoding: binary&quot;);&#xA;header('Content-Length: '. filesize($filename));&#xA;&#xA;// Put either file counting code here. either a db or static files&#xA;&#xA;//&#xA;&#xA;readfile($filename); //and spit the user the file&#xA;&#xA;&#xA;function base64_url_decode($input) {&#xA; return base64_decode(strtr($input, '-_,', '+/='));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;And when you call files use something like &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function base64_url_encode($input) {&#xA; return strtr(base64_encode($input), '+/=', '-_,');&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://us.php.net/manual/en/function.base64-encode.php&quot;&gt;http://us.php.net/manual/en/function.base64-encode.php&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you are using some javascript or a flash player (JW player for example) that requires the actual link to be an mp3 file or whatever, you can append the text &quot;&amp;amp;type=.mp3&quot; so the final linke becomes something like &quot;www.example.com/xfer.php?file=34842ffjfjxfh&amp;amp;type=.mp3&quot;. That way it looks like it ends with an mp3 extension without affecting the file link.&lt;/p&gt;&#xA;" OwnerUserId="146637" OwnerDisplayName="dubayou" LastEditorUserId="30" LastEditorDisplayName="Grant" LastEditDate="2008-08-10T12:16:40.330" LastActivityDate="2008-08-10T12:16:40.330" CommentCount="4" />
<row Id="153" PostTypeId="2" ParentId="146" CreationDate="2008-08-01T17:42:04.723" Score="4" Body="&lt;P&gt;You could even set up an Apache .htaccess directive that converts *.mp3 requests into the querystring dubayou is working with. It might be an elegant way to keep the direct request and still be able to slipstream log function into the response.&lt;/P&gt;" OwnerUserId="59" LastActivityDate="2008-08-01T17:42:04.723" CommentCount="0" />
<row Id="154" PostTypeId="2" ParentId="85" CreationDate="2008-08-01T17:45:06.513" Score="38" Body="&lt;p&gt;Well, what is the nature of the flat databases. Are they large or small. Is it simple arrays with arrays in them? if its something simple say userprofiles built as such:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$user = array(&quot;name&quot; =&amp;gt; &quot;dubayou&quot;, &#xA; &quot;age&quot; =&amp;gt; 20,&#xA; &quot;websites&quot; =&amp;gt; array(&quot;dubayou.com&quot;,&quot;willwharton.com&quot;,&quot;codecream.com&quot;),&#xA; &quot;and_one&quot; =&amp;gt; &quot;more&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and to save or update the &lt;em&gt;db record&lt;/em&gt; for that user.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$dir = &quot;../userdata/&quot;; //make sure to put it bellow what the server can reach.&#xA;file_put_contents($dir.$user['name'],serialize($user));&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;and to load the &lt;em&gt;record&lt;/em&gt; for the user&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function &amp;amp;get_user($name){&#xA; return unserialize(file_get_contents(&quot;../userdata/&quot;.$name));&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;but again this implementation will vary on the application and nature of the database you need.&lt;/p&gt;&#xA;" OwnerUserId="146637" OwnerDisplayName="dubayou" LastEditorUserId="967315" LastEditDate="2012-10-14T12:26:34.197" LastActivityDate="2012-10-14T12:26:34.197" CommentCount="0" />
<row Id="155" PostTypeId="2" ParentId="108" CreationDate="2008-08-01T17:47:54.727" Score="3" Body="&lt;p&gt;I used to have lots of Explorer crashes (on 32-bit) caused by Tortoise. They seem to have gone away since I used the Include/Exclude path settings in the &quot;Icon Overlays&quot; configuration of TSVN. Constraining icon overlays to specific directories where I keep my source made this much more stable.&lt;/p&gt;" OwnerUserId="9" LastActivityDate="2008-08-01T17:47:54.727" CommentCount="0" />
<row Id="158" PostTypeId="2" ParentId="146" CreationDate="2008-08-01T17:51:55.407" Score="16" Body="&lt;p&gt;Use your httpd log files. Install &lt;a href=&quot;http://awstats.sourceforge.net/&quot;&gt;http://awstats.sourceforge.net/&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="70" LastEditorDisplayName="user212218" LastEditDate="2012-05-07T01:43:59.980" LastActivityDate="2012-05-07T01:43:59.980" CommentCount="0" />
<row Id="159" PostTypeId="2" ParentId="104" CreationDate="2008-08-01T17:52:46.293" Score="20" Body="&lt;P&gt;Strictly speaking, a memory leak is consuming memory that is &quot;no longer used&quot; by the program.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;&quot;No longer used&quot; has more than one meaning, it could mean &quot;no more reference to it&quot;, that is, totally unrecoverable, or it could mean, referenced, recoverable, unused but the program keeps the references anyway. Only the later applies to .Net for &lt;STRONG&gt;perfectly managed objects&lt;/STRONG&gt;. However, not all classes are perfect and at some point an underlying unmanaged implementation could leak resources permanently for that process.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;In all cases, the application consumes more memory than strictly needed. The sides effects, depending on the ammount leaked, could go from none, to slowdown caused by excessive collection, to a series of memory exceptions and finally a fatal error followed by forced process termination.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;You know an application has a memory problem when monitoring shows that more and more memory is allocated to your process &lt;STRONG&gt;after each garbage collection cycle&lt;/STRONG&gt;. In such case, you are either keeping too much in memory, or some underlying unmanaged implementation is leaking.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;For most leaks, resources are recovered when the process is terminated, however some resources are not always recovered in some precise cases, GDI cursor handles are notorious for that. Of course, if you have an interprocess communication mechanism, memory allocated in the other process would not be freed until that process frees it or terminates.&lt;/P&gt;" OwnerUserId="42" LastActivityDate="2008-08-01T17:52:46.293" CommentCount="0" />
<row Id="160" PostTypeId="2" ParentId="129" CreationDate="2008-08-01T17:54:08.163" Score="48" Body="&lt;p&gt;The best way that I have found is the &lt;a href=&quot;http://www.mysql.com/products/tools/migration-toolkit/&quot;&gt;MySQL Migration Toolkit&lt;/a&gt; provided by MySQL. I have used it successfully for some large migration projects.&lt;/p&gt;" OwnerUserId="17" LastActivityDate="2008-08-01T17:54:08.163" CommentCount="5" />
<row Id="161" PostTypeId="2" ParentId="104" CreationDate="2008-08-01T17:57:14.117" Score="9" Body="&lt;p&gt;I would define memory leaks as an object not freeing up all the memory allocated after it has completed. I have found this can happen in your application if you are using Windows API and COM (i.e. unmanaged code that has a bug in it or is not being managed correctly), in the framework and in third party components. I have also found not tiding up after using certain objects like pens can cause the issue.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I personally have suffered Out of Memory Exceptions which can be caused but are not exclusive to memory leaks in dot net applications. (OOM can also come from pinning see &lt;a href=&quot;https://blogs.msdn.com/yunjin/archive/2004/01/27/63642.aspx&quot;&gt;Pinning Artical&lt;/a&gt;). If you are not getting OOM errors or need to confirm if it is a memory leak causing it then the only way is to profile your application.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I would also try and ensure the following:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;a) Everything that implements Idisposable is disposed either using a finally block or the using statement these include brushes, pens etc.(some people argue to set everything to nothing in addition) &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;b)Anything that has a close method is closed again using finally or the using statement (although I have found using does not always close depending if you declared the object outside the using statement)&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;c)If you are using unmanaged code/windows API's that these are dealt with correctly after. (some have clean up methods to release resources)&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Hope this helps.&lt;/p&gt;" OwnerUserId="33" LastActivityDate="2008-08-01T17:57:14.117" CommentCount="0" />
<row Id="163" PostTypeId="1" AcceptedAnswerId="170" CreationDate="2008-08-01T18:00:13.830" Score="61" ViewCount="6488" Body="&lt;p&gt;Stack Overflow has a subversion version number at the bottom:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;svn revision: 679&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I want to use such automatic versioning with my .NET Web Site/Application, Windows Forms, WPD projects/solutions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How do I implement this?&lt;/p&gt;&#xA;" OwnerUserId="83" LastEditorUserId="1039608" LastEditorDisplayName="ChanChan" LastEditDate="2012-05-04T09:16:24.763" LastActivityDate="2014-08-18T17:51:25.697" Title="How do I sync the SVN revision number with my ASP.NET web site?" Tags="&lt;.net&gt;&lt;asp.net&gt;&lt;svn&gt;&lt;versioning&gt;" AnswerCount="7" CommentCount="3" FavoriteCount="15" />
<row Id="164" PostTypeId="1" AcceptedAnswerId="699" CreationDate="2008-08-01T18:02:22.797" Score="30" ViewCount="124857" Body="&lt;p&gt;We are using &lt;a href=&quot;http://en.wikipedia.org/wiki/Windows_Media_Video&quot;&gt;WMV&lt;/a&gt; videos on an internal site, and we are embedding them into web sites. Now, this works quite well on Internet Explorer, but not on Firefox. I've found ways to make it work in Firefox, but then it stops working in Internet Explorer.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;We do not want to use Silverlight just yet, especially since we cannot be sure that all clients will be running Windows XP with Windows Media Player installed. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some sort of Universal Code that embeds WMP into both Internet Explorer and Firefox, or do we need to implement some user-agent-detection and deliver different HTML for different browsers?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="845306" LastEditorDisplayName="Adam Mitz" LastEditDate="2011-12-22T20:51:48.020" LastActivityDate="2014-01-16T20:24:41.080" Title="Embedding Windows Media Player for all browsers" Tags="&lt;windows&gt;&lt;embed&gt;&lt;media&gt;" AnswerCount="9" CommentCount="1" FavoriteCount="11" />
<row Id="165" PostTypeId="2" ParentId="145" CreationDate="2008-08-01T18:04:25.023" Score="1" Body="&lt;P&gt;You can use a &lt;A href=&quot;http://sharpdevelop.net/OpenSource/SharpZipLib/&quot; rel=&quot;nofollow&quot;&gt;3rd-party library such as SharpZip&lt;/A&gt; as Tom pointed out.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;Another way (without going 3rd-party) is to use the Windows Shell API. You'll need to set a reference to the Microsoft Shell Controls and Automation COM library in your C# project. Gerald Gibson has an example at:&lt;/P&gt;&#xD;&#xA;&lt;P&gt;&lt;A href=&quot;http://geraldgibson.net/dnn/Home/CZipFileCompression/tabid/148/Default.aspx&quot; rel=&quot;nofollow&quot;&gt;http://geraldgibson.net/dnn/Home/CZipFileCompression/tabid/148/Default.aspx&lt;/A&gt;&lt;/P&gt;" OwnerDisplayName="user2189331" LastActivityDate="2008-08-01T18:04:25.023" CommentCount="0" />
<row Id="166" PostTypeId="2" ParentId="163" CreationDate="2008-08-01T18:08:16.590" Score="20" Body="&lt;p&gt;You can do it by adding the following anywhere in your code &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;$Id:$&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;So for example Jeff did:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;svnrevision&quot;&amp;gt;svn revision: $Id:$&amp;lt;/div&amp;gt;&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;and when checked in the server replaced $Id:$ with the current revision number. I also &lt;a href=&quot;http://www.compuphase.com/svnrev.htm&quot;&gt;found this reference&lt;/a&gt;.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;There is also &lt;strong&gt;$Date:$&lt;/strong&gt;, &lt;strong&gt;$Rev:$&lt;/strong&gt;, &lt;strong&gt;$Revision:$&lt;/strong&gt;&lt;/p&gt;" OwnerUserId="17" LastActivityDate="2008-08-01T18:08:16.590" CommentCount="7" />
<row Id="167" PostTypeId="2" ParentId="164" CreationDate="2008-08-01T18:08:53.080" Score="1" Body="&lt;p&gt;You could use conditional comments to get IE and Firefox to do different things&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;![if !IE]&amp;gt;&lt;br&gt;&amp;lt;p&amp;gt; Firefox only code&amp;lt;/p&amp;gt;&lt;br&gt;&amp;lt;![endif]&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;!--[if IE]&amp;gt;&lt;br&gt;&amp;lt;p&amp;gt;Internet Explorer only code&amp;lt;/p&amp;gt;&lt;br&gt;&amp;lt;![endif]--&amp;gt;&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The browsers themselves will ignore code that isn't meant for them to read.&lt;/p&gt;" OwnerUserId="30" LastEditorUserId="30" LastEditorDisplayName="Grant" LastEditDate="2008-08-01T18:14:56.093" LastActivityDate="2008-08-01T18:14:56.093" CommentCount="0" />
<row Id="169" PostTypeId="2" ParentId="126" CreationDate="2008-08-01T18:23:59.040" Score="30" Body="&lt;p&gt;Personally, I feel like it's important to remain consistent. If you have getters and setters, use them. The only time I would access a field directly is when the accessor has a lot of overhead. It may feel like you're bloating your code unnecessarily, but it can certainly save a whole lot of headache in the future. The classic example:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Later on, you may desire to change the way that field works. Maybe it should be calculated on-the-fly or maybe you would like to use a different type for the backing store. If you are accessing properties directly, a change like that can break an awful lot of code in one swell foop.&lt;/p&gt;" OwnerUserId="93" LastActivityDate="2008-08-01T18:23:59.040" CommentCount="0" />
<row Id="170" PostTypeId="2" ParentId="163" CreationDate="2008-08-01T18:24:30.550" Score="21" Body="&lt;P&gt;Looks like Jeff is using &lt;A href=&quot;http://confluence.public.thoughtworks.org/display/CCNET/What+is+CruiseControl.NET&quot;&gt;CruiseControl.NET&lt;/A&gt; based on some leafing through the podcast transcripts. This seems to have automated deployment capabilities from source control to production. Might this be where the insertion is happening?&lt;/P&gt;" OwnerUserId="59" LastActivityDate="2008-08-01T18:24:30.550" CommentCount="2" />
<row Id="173" PostTypeId="1" AcceptedAnswerId="516" CreationDate="2008-08-01T18:33:08.333" Score="198" ViewCount="47930" Body="&lt;p&gt;I've been wanting to get my databases under version control. Does anyone have any advice or recommended articles to get me started?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'll always want to have at least &lt;em&gt;some&lt;/em&gt; data in there (as &lt;a href=&quot;http://stackoverflow.com/users/80/alumb&quot;&gt;alumb&lt;/a&gt; mentions: user types and administrators). I'll also often want a large collection of generated test data for performance measurement.&lt;/p&gt;&#xA;" OwnerUserId="83" LastEditorUserId="243557" LastEditorDisplayName="Mark Brady" LastEditDate="2013-10-04T01:16:54.950" LastActivityDate="2014-06-09T07:57:16.500" Title="How do I version my SQL Server database" Tags="&lt;sql-server&gt;&lt;database&gt;&lt;svn&gt;&lt;version-control&gt;" AnswerCount="26" CommentCount="5" FavoriteCount="167" />
<row Id="174" PostTypeId="1" CreationDate="2008-08-01T18:33:48.287" Score="38" ViewCount="9615" Body="&lt;p&gt;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 .NET library that will support the printing of a basic HTML page? Here is the code I have so far, which does not run properly.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public void PrintThing(string document)&#xA;{&#xA; if (Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)&#xA; {&#xA; Thread thread =&#xA; new Thread((ThreadStart) delegate { PrintDocument(document); });&#xA; thread.SetApartmentState(ApartmentState.STA);&#xA; thread.Start();&#xA; }&#xA; else&#xA; {&#xA; PrintDocument(document);&#xA; }&#xA;}&#xA;&#xA;protected void PrintDocument(string document)&#xA;{&#xA; WebBrowser browser = new WebBrowser();&#xA; browser.DocumentText = document;&#xA; while (browser.ReadyState != WebBrowserReadyState.Complete)&#xA; {&#xA; Application.DoEvents();&#xA; }&#xA; browser.Print();&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This works fine when called from UI-type threads, but nothing happens when called from a service-type thread. Changing &lt;code&gt;Print()&lt;/code&gt; to &lt;code&gt;ShowPrintPreviewDialog()&lt;/code&gt; yields the following IE script error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;Error: 'dialogArguments.___IE_PrintType' is null or not an object&lt;br /&gt;&#xA; URL: res://ieframe.dll/preview.dlg&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;And a small empty print preview dialog appears.&lt;/p&gt;&#xA;" OwnerUserId="96" OwnerDisplayName="Chris" LastEditorUserId="707111" LastEditorDisplayName="Chris Marasti-Georg" LastEditDate="2012-01-06T21:25:44.727" LastActivityDate="2013-11-17T16:04:14.930" Title="How do I print an HTML document from a web service?" Tags="&lt;c#&gt;&lt;html&gt;&lt;web-services&gt;&lt;printing&gt;" AnswerCount="6" CommentCount="0" FavoriteCount="6" />
<row Id="175" PostTypeId="1" CreationDate="2008-08-01T18:36:14.070" Score="21" ViewCount="5679" Body="&lt;p&gt;I want to be able to display a normal YouTube video with overlaid annotations, consisting of colored rectangles for each frame. The only requirement is that this be done programatically. YouTube has annotations now, but require you to use their front end to create them by hand. I want to be able to generate them. What's the best way of doing this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some ideas:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Build your own Flash player (ew?)&lt;/li&gt;&#xA;&lt;li&gt;Somehow draw over the YouTube Flash player. Will this work?&lt;/li&gt;&#xA;&lt;li&gt;Reverse engineer &amp;amp; hijack YouTube's annotation system. Either messing with the local files or redirecting its attempt to download the annotations. (using Greasemonkey? Firefox plugin?)&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Idea that doesn't count: download the video&lt;/p&gt;&#xA;" OwnerUserId="2089740" LastEditorUserId="3301112" LastEditDate="2014-03-11T17:39:58.503" LastActivityDate="2014-03-11T17:39:58.503" Title="Annotating YouTube videos programmatically" Tags="&lt;annotations&gt;&lt;youtube&gt;&lt;reverse-engineering&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" />
<row Id="176" PostTypeId="1" AcceptedAnswerId="207" CreationDate="2008-08-01T18:37:40.150" Score="54" ViewCount="53200" Body="&lt;p&gt;On one Linux Server running Apache and PHP 5, we got multiple Virtual Hosts with separate logfiles and everything. The only thing we cannot seem to separate between virtual hosts is the php &lt;code&gt;error_log&lt;/code&gt;. Overriding this setting in the &lt;code&gt;&amp;amp;lt;Location&amp;amp;gt;&lt;/code&gt; of the &lt;code&gt;httpd.conf&lt;/code&gt; does not seem to do anything.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Did I overlook something? Is there a way to have separate php &lt;code&gt;error_logs&lt;/code&gt; for each Virtual Host?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="243557" LastEditDate="2013-10-04T01:16:41.183" LastActivityDate="2014-01-23T15:44:35.000" Title="error_log per Virtual Host?" Tags="&lt;php&gt;&lt;apache&gt;&lt;virtualhost&gt;" AnswerCount="10" CommentCount="0" FavoriteCount="15" />
<row Id="180" PostTypeId="1" AcceptedAnswerId="539" CreationDate="2008-08-01T18:42:19.343" Score="39" ViewCount="8898" Body="&lt;p&gt;This is something I've pseudo-solved many times and never quite found a solution that's stuck with me. The problem is to come up with a way to generate N colors, that are as distinguishable as possible where N is a parameter.&lt;/p&gt;&#xA;" OwnerUserId="2089740" LastEditorUserId="1039608" LastEditDate="2012-05-04T09:26:03.813" LastActivityDate="2014-02-07T17:43:13.243" Title="Function for creating color wheels" Tags="&lt;algorithm&gt;&lt;language-agnostic&gt;&lt;colors&gt;&lt;color-space&gt;" AnswerCount="9" CommentCount="0" FavoriteCount="17" />
<row Id="183" PostTypeId="2" ParentId="123" CreationDate="2008-08-01T18:51:12.090" Score="35" Body="&lt;p&gt;Maybe this might help: &lt;a href=&quot;http://jsefa.sourceforge.net/quick-tutorial.html&quot;&gt;JSefa&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You can read CSV file with this tool and serialize it to XML.&lt;/p&gt;&#xA;" OwnerUserId="86" LastEditorUserId="395659" LastEditDate="2013-02-07T10:36:04.283" LastActivityDate="2013-02-07T10:36:04.283" CommentCount="0" />
<row Id="186" PostTypeId="2" ParentId="126" CreationDate="2008-08-01T19:07:59.480" Score="2" Body="&lt;p&gt;I rarely feel the need for getters/setters when programming, it really depends what you are doing...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will sometimes use getters/setters if the member variable is far away.&lt;br&gt;&#xA;Ex. Instead of &lt;code&gt;Player.Position.X&lt;/code&gt; I'd use &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Player.getX()&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Side note:&lt;/strong&gt; Private member variables take longer to access than public&lt;/p&gt;&#xA;" OwnerUserId="40" LastEditorUserId="867789" LastEditDate="2013-07-26T11:05:19.060" LastActivityDate="2013-07-26T11:05:19.060" CommentCount="0" />
<row Id="190" PostTypeId="2" ParentId="123" CreationDate="2008-08-01T19:21:57.517" Score="4" Body="&lt;p&gt;I don't understand why you would want to do this. It sounds almost like cargo cult coding.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Converting a CSV file to XML doesn't add any value. Your program is already reading the CSV file, so arguing that you need XML doesn't work.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;On the other hand, reading the CSV file, doing &lt;em&gt;something&lt;/em&gt; with the values, and then serializing to XML does make sense (well, as much as using XML can make sense... ;)) but you would supposedly already have a means of serializing to XML.&lt;/p&gt;" OwnerUserId="55" LastActivityDate="2008-08-01T19:21:57.517" CommentCount="0" />
<row Id="192" PostTypeId="1" AcceptedAnswerId="258" CreationDate="2008-08-01T19:23:13.117" Score="29" ViewCount="2019" Body="&lt;p&gt;One of the fun parts of multi-cultural programming is number formats.&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Americans use 10,000.50&lt;/li&gt;&#xA;&lt;li&gt;Germans use 10.000,50&lt;/li&gt;&#xA;&lt;li&gt;French use 10 000,50&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;My first approach would be to take the string, parse it backwards, until I encounter a separator and use this as my decimal separator. There is an obvious flaw with that: 10.000 would be interpreted as 10.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Another approach: if the string contains 2 different non-numeric characters, use the last one as the decimal separator and discard the others. If I only have one, check if it occurs more than once and discard it if it does. If it only appears once, check if it has 3 digits after it. If yes, discard it, otherwise use it as decimal separator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The obvious &quot;best solution&quot; would be to detect the User's culture or Browser, but that does not work if you have a Frenchman using an en-US Windows/Browser.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Does the .net Framework contain some mythical black magic floating point parser that is better than &lt;code&gt;Double.(Try)Parse()&lt;/code&gt; in trying to auto-detect the number format?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="1039608" LastEditorDisplayName="Michael Stum" LastEditDate="2012-05-04T09:26:51.287" LastActivityDate="2012-05-04T09:26:51.287" Title="Floating Point Number parsing: Is there a Catch All algorithm?" Tags="&lt;c#&gt;&lt;.net&gt;&lt;asp.net&gt;&lt;internationalization&gt;&lt;globalization&gt;" AnswerCount="4" CommentCount="0" />
<row Id="194" PostTypeId="1" AcceptedAnswerId="197" CreationDate="2008-08-01T19:26:37.883" Score="14" ViewCount="2555" Body="&lt;p&gt;Yes, I know. The existence of a running copy of &lt;code&gt;SQL Server 6.5&lt;/code&gt; in 2008 is absurd.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That stipulated, what is the best way to migrate from &lt;code&gt;6.5&lt;/code&gt; to &lt;code&gt;2005&lt;/code&gt;? Is there any direct path? Most of the documentation I've found deals with upgrading &lt;code&gt;6.5&lt;/code&gt; to &lt;code&gt;7&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Should I forget about the native &lt;code&gt;SQL Server&lt;/code&gt; upgrade utilities, script out all of the objects and data, and try to recreate from scratch?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I was going to attempt the upgrade this weekend, but server issues pushed it back till next. So, any ideas would be welcomed during the course of the week.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Update. This is how I ended up doing it:&lt;/em&gt;&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Back up the database in question and Master on &lt;code&gt;6.5&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Execute &lt;code&gt;SQL Server 2000&lt;/code&gt;'s &lt;code&gt;instcat.sql&lt;/code&gt; against &lt;code&gt;6.5&lt;/code&gt;'s Master. This allows &lt;code&gt;SQL Server 2000&lt;/code&gt;'s OLEDB provider to connect to &lt;code&gt;6.5&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Use &lt;code&gt;SQL Server 2000&lt;/code&gt;'s standalone &lt;code&gt;&quot;Import and Export Data&quot;&lt;/code&gt; to create a DTS package, using &lt;code&gt;OLEDB&lt;/code&gt; to connect to 6.5. This successfully copied all &lt;code&gt;6.5&lt;/code&gt;'s tables to a new &lt;code&gt;2005&lt;/code&gt; database (also using &lt;code&gt;OLEDB&lt;/code&gt;).&lt;/li&gt;&#xA;&lt;li&gt;Use &lt;code&gt;6.5&lt;/code&gt;'s Enterprise Manager to script out all of the database's indexes and triggers to a .sql file.&lt;/li&gt;&#xA;&lt;li&gt;Execute that .sql file against the new copy of the database, in 2005's Management Studio.&lt;/li&gt;&#xA;&lt;li&gt;Use 6.5's Enterprise Manager to script out all of the stored procedures.&lt;/li&gt;&#xA;&lt;li&gt;Execute that &lt;code&gt;.sql&lt;/code&gt; file against the &lt;code&gt;2005&lt;/code&gt; database. Several dozen sprocs had issues making them incompatible with &lt;code&gt;2005&lt;/code&gt;. Mainly &lt;code&gt;non-ANSI joins&lt;/code&gt; and &lt;code&gt;quoted identifier issues&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;Corrected all of those issues and re-executed the &lt;code&gt;.sql&lt;/code&gt; file.&lt;/li&gt;&#xA;&lt;li&gt;Recreated the &lt;code&gt;6.5&lt;/code&gt;'s logins in &lt;code&gt;2005&lt;/code&gt; and gave them appropriate permissions.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;There was a bit of rinse/repeat when correcting the stored procedures (there were hundreds of them to correct), but the upgrade went great otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Being able to use Management Studio instead of &lt;code&gt;Query Analyzer&lt;/code&gt; and &lt;code&gt;Enterprise Manager 6.5&lt;/code&gt; is such an amazing difference. A few report queries that took 20-30 seconds on the &lt;code&gt;6.5 database&lt;/code&gt; are now running in 1-2 seconds, without any modification, new indexes, or anything. I didn't expect that kind of immediate improvement.&lt;/p&gt;&#xA;" OwnerUserId="60" LastEditorUserId="165216" LastEditorDisplayName="Nigel Campbell" LastEditDate="2012-06-12T05:35:46.927" LastActivityDate="2012-06-12T05:35:46.927" Title="Upgrading SQL Server 6.5" Tags="&lt;sql-server&gt;&lt;migration&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="1" />
<row Id="195" PostTypeId="2" ParentId="173" CreationDate="2008-08-01T19:28:25.447" Score="25" Body="&lt;p&gt;This is one of the &quot;hard problems&quot; surrounding development. As far as I know there are no perfect solutions. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you only need to store the database structure and not the data you can export the database as SQL queries. (in Enterprise Manager: Right click on database -&amp;gt; Generate SQL script. I recommend setting the &quot;create one file per object&quot; on the options tab) You can then commit these text files to svn and make use of svn's diff and logging functions. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I have this tied together with a Batch script that takes a couple parameters and sets up the database. I also added some additional queries that enter default data like user types and the admin user. (If you want more info on this, post something and I can put the script somewhere accessible)&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you need to keep all of the data as well, I recommend keeping a back up of the database and using Redgate (http://www.red-gate.com/) products to do the comparisons. They don't come cheap, but they are worth every penny. &lt;/p&gt;" OwnerUserId="80" LastActivityDate="2008-08-01T19:28:25.447" CommentCount="2" />
<row Id="197" PostTypeId="2" ParentId="194" CreationDate="2008-08-01T19:34:49.067" Score="4" Body="&lt;p&gt;Hey, I'm still stuck in that camp too. The third party application we have to support is FINALLY going to 2K5, so we're almost out of the wood. But I feel your pain 8^D&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;That said, from everything I heard from our DBA, the key is to convert the database to 8.0 format first, and then go to 2005. I believe they used the built in migration/upgrade tools for this. There are some big steps between 6.5 and 8.0 that are better solved there than going from 6.5 to 2005 directly.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Your BIGGEST pain, if you didn't know already, is that DTS is gone in favor of SSIS. There is a shell type module that will run your existing DTS packages, but you're going to want to manually recreate them all in SSIS. Ease of this will depend on the complexity of the packages themselves, but I've done a few at work so far and they've been pretty smooth.&lt;/p&gt;" OwnerUserId="71" LastActivityDate="2008-08-01T19:34:49.067" CommentCount="0" />
<row Id="199" PostTypeId="2" ParentId="180" CreationDate="2008-08-01T19:36:46.067" Score="0" Body="&lt;p&gt;I've read somewhere the human eye can't distinguish between less than 4 values apart. so This is something to keep in mind. The following algorithm does not compensate for this.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I'm not sure this is exactly what you want, but this is one way to randomly generate non-repeating color values:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;(beware, inconsistent pseudo-code ahead)&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;//colors entered as 0-255 [R, G, B]&lt;br&gt;colors = []; //holds final colors to be used&lt;br&gt;rand = new Random();&lt;br&gt;&lt;br&gt;//assumes n is less than 16,777,216&lt;br&gt;randomGen(int n){&lt;br&gt; while (len(colors) &amp;lt; n){&lt;br&gt; //generate a random number between 0,255 for each color&lt;br&gt; newRed = rand.next(256);&lt;br&gt; newGreen = rand.next(256);&lt;br&gt; newBlue = rand.next(256);&lt;br&gt; temp = [newRed, newGreen, newBlue];&lt;br&gt; //only adds new colors to the array&lt;br&gt; if temp not in colors {&lt;br&gt; colors.append(temp);&lt;br&gt; }&lt;br&gt; }&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;One way you could optimize this for better visibility would be to compare the distance between each new color and all the colors in the array:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;for item in color{&lt;br&gt; itemSq = (item[0]^2 + item[1]^2 + item[2]^2])^(.5);&lt;br&gt; tempSq = (temp[0]^2 + temp[1]^2 + temp[2]^2])^(.5);&lt;br&gt; dist = itemSq - tempSq;&lt;br&gt; dist = abs(dist);&lt;br&gt;}&lt;br&gt;//NUMBER can be your chosen distance apart.&lt;br&gt;if dist &amp;lt; NUMBER and temp not in colors {&lt;br&gt; colors.append(temp);&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;But this approach would significantly slow down your algorithm.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Another way would be to scrap the randomness and systematically go through every 4 values and add a color to an array in the above example.&lt;/p&gt;" OwnerUserId="50" LastActivityDate="2008-08-01T19:36:46.067" CommentCount="0" />
<row Id="206" PostTypeId="2" ParentId="134" CreationDate="2008-08-01T19:52:14.227" Score="6" Body="&lt;p&gt;You can try turning CheckConstraints off on the DataSet (it's in its properties), or altering the properties of that relationship, and change the key to a simple reference - up to you.&lt;/p&gt;" OwnerUserId="35" LastActivityDate="2008-08-01T19:52:14.227" CommentCount="0" />
<row Id="207" PostTypeId="2" ParentId="176" CreationDate="2008-08-01T19:58:45.837" Score="56" Body="&lt;p&gt;To set the &lt;em&gt;Apache&lt;/em&gt; (&lt;em&gt;not the PHP&lt;/em&gt;) log, the easiest way to do this would be to do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;VirtualHost IP:Port&amp;gt;&#xA; # Stuff,&#xA; # More Stuff,&#xA; ErrorLog /path/where/you/want/the/error.log&#xA;&amp;lt;/VirtualHost&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If there is no leading &quot;/&quot; it is assumed to be relative.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://httpd.apache.org/docs/1.3/mod/core.html#errorlog&quot;&gt;Apache Error Log Page&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="50" LastEditorUserId="177002" LastEditDate="2011-03-31T09:31:50.077" LastActivityDate="2011-03-31T09:31:50.077" CommentCount="3" />
<row Id="210" PostTypeId="2" ParentId="192" CreationDate="2008-08-01T20:02:08.357" Score="21" Body="&lt;p&gt;I don't know the ASP.NET side of the problem but .NET has a pretty powerful class: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.aspx&quot;&gt;System.Globalization.CultureInfo&lt;/a&gt;. You can use the following code to parse a string containing a double value:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;double d = double.Parse(&quot;100.20&quot;, CultureInfo.CurrentCulture);&lt;br&gt;// -- OR --&lt;br&gt;double d = double.Parse(&quot;100.20&quot;, CultureInfo.CurrentUICulture);&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If ASP.NET somehow (i.e. using HTTP Request headers) passes current user's CultureInfo to either CultureInfo.CurrentCulture or CultureInfo.CurrentUICulture, these will work fine.&lt;/p&gt;" OwnerUserId="39" LastActivityDate="2008-08-01T20:02:08.357" CommentCount="0" />
<row Id="212" PostTypeId="2" ParentId="192" CreationDate="2008-08-01T20:05:12.750" Score="6" Body="&lt;p&gt;You can't please everyone. If I enter ten as 10.000, and someone enters ten thousand as 10.000, you cannot handle that without some knowledge of the culture of the input. Detect the culture somehow (browser, system setting - what is the use case? ASP? Internal app, or open to the world?), or provide an example of the expected formatting, and use the most lenient parser you can. Probably something like:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;double d = Double.Parse(&quot;5,000.00&quot;, NumberStyles.Any, CultureInfo.InvariantCulture);&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="96" OwnerDisplayName="Chris Marasti-Georg" LastActivityDate="2008-08-01T20:05:12.750" CommentCount="0" />
<row Id="227" PostTypeId="1" AcceptedAnswerId="2943318" CreationDate="2008-08-01T21:40:55.833" Score="31" ViewCount="2945" Body="&lt;p&gt;I have the following arrays:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$artist = array(&quot;the roots&quot;, &quot;michael jackson&quot;, &quot;billy idol&quot;, &quot;more&quot;, &quot;and more&quot;, &quot;and_YET_MORE&quot;);&#xA;$count = array(5, 3, 9, 1, 1, 3);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I want to generate a tag cloud that will have artists with a higher number in &lt;code&gt;$count&lt;/code&gt; enclosed in &lt;code&gt;h6&lt;/code&gt; tags and the lowest enclosed &lt;code&gt;h1&lt;/code&gt; tags.&lt;/p&gt;&#xA;" OwnerUserId="146637" OwnerDisplayName="dubayou" LastEditorUserId="500729" LastEditorDisplayName="Adam Bellaire" LastEditDate="2012-06-28T08:11:23.453" LastActivityDate="2012-10-24T14:39:31.093" Title="What's the best way to generate a tag cloud from an array using h1 through h6 for sizing?" Tags="&lt;php&gt;&lt;arrays&gt;&lt;cloud&gt;&lt;tag-cloud&gt;" AnswerCount="10" CommentCount="0" FavoriteCount="9" />
<row Id="229" PostTypeId="2" ParentId="9" CreationDate="2008-08-01T21:46:12.313" Score="18" Body="&lt;p&gt;Another function, not my me but found on the web and a bit refined:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;public static int GetAge(DateTime birthDate)&#xA;{&#xA; DateTime n = DateTime.Now; // To avoid a race condition around midnight&#xA; int age = n.Year - birthDate.Year;&#xA;&#xA; if (n.Month &amp;lt; birthDate.Month || (n.Month == birthDate.Month &amp;amp;&amp;amp; n.Day &amp;lt; birthDate.Day))&#xA; age--;&#xA;&#xA; return age;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Just two things that come into my mind: What about people from countries that do not use the gregorian calendar? DateTime.Now is in the server-specific culture i think. I have absolutely 0 knowledge about actually working with Asian calendars and I do not know if there is an easy way to convert dates between calendars, but just in case you're wondering about those chinese guys from the year 4660 :-)&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditorDisplayName="Michael Stum" LastEditDate="2013-06-05T15:40:37.270" LastActivityDate="2013-06-05T15:40:37.270" CommentCount="2" CommunityOwnedDate="2011-08-16T19:40:43.080" />
<row Id="231" PostTypeId="1" AcceptedAnswerId="1812" CreationDate="2008-08-01T22:08:14.453" Score="15" ViewCount="15263" Body="&lt;p&gt;How do I make it so &lt;code&gt;mailto:&lt;/code&gt; links will be registered with my program?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;How would I then handle that event in my program?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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, such as &quot;set as default email client&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: Removed reference to Delphi, because the answer is independent of your language.&lt;/p&gt;&#xA;" OwnerUserId="62" LastEditorUserId="1039608" LastEditorDisplayName="Adam Mitz" LastEditDate="2012-05-04T09:28:48.887" LastActivityDate="2013-12-16T12:02:18.317" Title="Register Windows program with the mailto protocol programmatically" Tags="&lt;windows&gt;&lt;mailto&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="4" />
<row Id="233" PostTypeId="2" ParentId="231" CreationDate="2008-08-01T22:12:30.170" Score="9" Body="&lt;p&gt;From what I've seen, there are a few registry keys that set the default mail client. One of them being:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;System Key: &lt;code&gt;[HKEY_CLASSES_ROOT\mailto\shell\open\command]&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Value Name: &lt;code&gt;(Default)&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Data Type: &lt;code&gt;REG_SZ&lt;/code&gt; (String Value)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Value Data: &lt;code&gt;Mail program command-line&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not familar with &lt;code&gt;Delphi 7&lt;/code&gt;, but I'm sure there are some &lt;em&gt;registry editing libraries&lt;/em&gt; in there that you could use to modify this value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some places list more than this &lt;em&gt;key&lt;/em&gt;, others just this key, so you may need to test a little bit to find the proper one(s).&lt;/p&gt;&#xA;" OwnerUserId="71" LastEditorUserId="1018966" LastEditDate="2013-12-16T12:02:18.317" LastActivityDate="2013-12-16T12:02:18.317" CommentCount="0" />
<row Id="234" PostTypeId="1" AcceptedAnswerId="12202" CreationDate="2008-08-01T22:13:34.100" Score="35" ViewCount="21977" Body="&lt;p&gt;MySQL has this incredibly useful yet properitary &lt;code&gt;REPLACE INTO&lt;/code&gt; SQL Command. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder: Can this easily be emulated in SQL Server 2005?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Starting a new Transaction, doing a &lt;code&gt;Select()&lt;/code&gt; and then either &lt;code&gt;UPDATE&lt;/code&gt; or &lt;code&gt;INSERT&lt;/code&gt; and &lt;code&gt;COMMIT&lt;/code&gt; is always a little bit of a pain, especially when doing it in the application and therefore always keeping 2 versions of the statement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I wonder if there is an easy and &lt;strong&gt;universal&lt;/strong&gt; way to implement such a function into SQL Server 2005?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="2641576" LastEditorDisplayName="user1873471" LastEditDate="2014-11-25T20:58:58.163" LastActivityDate="2014-11-25T20:58:58.163" Title="SQL Server 2005 implementation of MySQL REPLACE INTO?" Tags="&lt;mysql&gt;&lt;sql-server&gt;&lt;sql-server-2005&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="11" />
<row Id="235" PostTypeId="2" ParentId="231" CreationDate="2008-08-01T22:18:21.623" Score="2" Body="&lt;p&gt;Here is the official Microsoft Solution to programmatically change the default mail client. It's Visual Basic, but I hope the concept is clear from this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://support.microsoft.com/kb/299853&quot; rel=&quot;nofollow&quot;&gt;http://support.microsoft.com/kb/299853&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="-1" LastEditDate="2013-06-14T14:22:37.283" LastActivityDate="2013-06-14T14:22:37.283" CommentCount="1" />
<row Id="236" PostTypeId="2" ParentId="176" CreationDate="2008-08-01T22:20:05.117" Score="4" Body="&lt;p&gt;The default behaviour is for error_log() to output to the Apache error log. If this isn't happening check your php.ini settings for the error_log directive - leave it unset to use the Apache log file for the current vhost.&lt;/p&gt;" OwnerUserId="48" LastActivityDate="2008-08-01T22:20:05.117" CommentCount="1" />
<row Id="238" PostTypeId="2" ParentId="234" CreationDate="2008-08-01T22:22:37.823" Score="12" Body="&lt;p&gt;The functionality you're looking for is traditionally called an UPSERT. Atleast knowing what it's called might help you find what you're looking for.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I don't think SQL Server 2005 has any great ways of doing this. 2008 introduces the MERGE statement that can be used to accomplish this as shown in: &lt;a href=&quot;http://www.databasejournal.com/features/mssql/article.php/3739131&quot;&gt;http://www.databasejournal.com/features/mssql/article.php/3739131&lt;/a&gt; or &lt;a href=&quot;http://blogs.conchango.com/davidportas/archive/2007/11/14/SQL-Server-2008-MERGE.aspx&quot;&gt;http://blogs.conchango.com/davidportas/archive/2007/11/14/SQL-Server-2008-MERGE.aspx&lt;/a&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Merge was available in the beta of 2005, but they removed it out in the final release.&lt;/p&gt;" OwnerUserId="34" LastActivityDate="2008-08-01T22:22:37.823" CommentCount="0" />
<row Id="243" PostTypeId="2" ParentId="234" CreationDate="2008-08-01T22:31:36.137" Score="10" Body="&lt;p&gt;What the upsert/merge is doing is something to the effect of...&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;IF EXISTS (SELECT * FROM [Table] WHERE Id = X)&#xD;&#xA; UPDATE [Table] SET...&#xD;&#xA;ELSE&#xD;&#xA; INSERT INTO [Table]&#xD;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;So hopefully the combination of those articles and this pseudo code can get things moving.&lt;/p&gt;" OwnerUserId="71" LastActivityDate="2008-08-01T22:31:36.137" CommentCount="0" />
<row Id="246" PostTypeId="1" AcceptedAnswerId="176741" CreationDate="2008-08-01T22:34:42.853" Score="11" ViewCount="1364" Body="&lt;p&gt;Does anybody know if there is a way to create a SQLite database based on an XSD &lt;code&gt;DataSet&lt;/code&gt;? In the past I've just used a basic SQLite manager, but want to fuse things a bit more with my .NET development if possible.&lt;/p&gt;&#xA;" OwnerUserId="71" LastEditorUserId="1039608" LastEditDate="2012-05-04T09:31:27.140" LastActivityDate="2012-05-04T09:31:27.140" Title="Create a SQLite database based on an XSD Data Set" Tags="&lt;.net&gt;&lt;database&gt;&lt;sqlite&gt;" AnswerCount="3" CommentCount="0" />
<row Id="253" PostTypeId="2" ParentId="227" CreationDate="2008-08-01T23:10:56.510" Score="21" Body="&lt;p&gt;Off the top of my head...&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;$artist = array(&quot;the roots&quot;,&quot;michael jackson&quot;,&quot;billy idol&quot;,&quot;more&quot;,&quot;and more&quot;,&quot;and_YET_MORE&quot;);&lt;br&gt;$count = array(5,3,9,1,1,3);&lt;br&gt;$highest = max($count);&lt;br&gt;for (int $x = 0; x &amp;lt; count($artist); $x++)&lt;br&gt;{&lt;br&gt; $normalized = $count[$x] / $highest;&lt;br&gt; $heading = ceil($normalized * 6); // 6 heading types&lt;br&gt; echo &quot;&amp;lt;h&quot;.$heading.&quot;&amp;gt;&quot;.$artist[$x].&quot;&amp;lt;/h&quot;.$heading.&quot;&amp;gt;&quot;;&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="55" LastActivityDate="2008-08-01T23:10:56.510" CommentCount="0" />
<row Id="258" PostTypeId="2" ParentId="192" CreationDate="2008-08-01T23:17:53.657" Score="13" Body="&lt;p&gt;I think the best you can do in this case is to take their input and then show them what you think they meant. If they disagree, show them the format you're expecting and get them to enter it again.&lt;/p&gt;" OwnerUserId="55" LastActivityDate="2008-08-01T23:17:53.657" CommentCount="0" />
<row Id="260" PostTypeId="1" AcceptedAnswerId="307" CreationDate="2008-08-01T23:22:08.983" Score="36" ViewCount="9234" Body="&lt;p&gt;I have a little game written in C#. It uses a database as back-end. It's &#xA;a &lt;a href=&quot;http://en.wikipedia.org/wiki/Collectible_card_game&quot;&gt;trading card game&lt;/a&gt;, and I wanted to implement the function of the cards as a script.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I mean is that I essentially have an interface, &lt;code&gt;ICard&lt;/code&gt;, which a card class implements (&lt;code&gt;public class Card056 : ICard&lt;/code&gt;) and which contains function that are called by the game.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, to make the thing maintainable/moddable, I would like to have the class for each card as source code in the database and essentially compile it on first use. So when I have to add/change a card, I'll just add it to the database and tell my application to refresh, without needing any assembly deployment (especially since we would be talking about 1 assembly per card which means hundreds of assemblies).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is that possible? Register a class from a source file and then instantiate it, etc.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ICard Cards[current] = new MyGame.CardLibrary.Card056();&#xA;Cards[current].OnEnterPlay(ref currentGameState);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The language is C#, but extra bonus if it's possible to write the script in any .NET language.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="63550" LastEditorDisplayName="eed3si9n" LastEditDate="2010-11-26T15:10:35.897" LastActivityDate="2014-01-02T14:33:21.153" Title="Adding scripting functionality to .NET applications" Tags="&lt;c#&gt;&lt;.net&gt;&lt;scripting&gt;&lt;compiler-construction&gt;" AnswerCount="9" CommentCount="3" FavoriteCount="15" />
<row Id="263" PostTypeId="1" AcceptedAnswerId="607" CreationDate="2008-08-01T23:27:24.993" Score="13" ViewCount="5363" Body="&lt;p&gt;I have been trying to implement Win32's &lt;code&gt;MessageBox&lt;/code&gt; using GTK. The app using SDL/OpenGL, so this isn't a GTK app. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I handle the initialisation (&lt;code&gt;gtk_init&lt;/code&gt;) sort of stuff inside the &lt;code&gt;MessageBox&lt;/code&gt; function as follows:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int MessageBox(HWND hwnd, const char* text, const char* caption, UINT type)&#xA;{&#xA; GtkWidget *window = NULL;&#xA; GtkWidget *dialog = NULL;&#xA;&#xA; gtk_init(&amp;amp;gtkArgc, &amp;amp;gtkArgv);&#xA; window = gtk_window_new(GTK_WINDOW_TOPLEVEL);&#xA; g_signal_connect(G_OBJECT(window), &quot;delete_event&quot;, G_CALLBACK(delete_event), NULL);&#xA; g_signal_connect(G_OBJECT(window), &quot;destroy&quot;, G_CALLBACK(destroy), NULL);&#xA; // gcallback calls gtk_main_quit()&#xA; gtk_init_add((GtkFunction)gcallback, NULL);&#xA;&#xA; if (type &amp;amp; MB_YESNO) {&#xA; dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, text);&#xA; } else {&#xA; dialog = gtk_message_dialog_new(GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_INFO, GTK_BUTTONS_OK, text);&#xA; }&#xA;&#xA; gtk_window_set_title(GTK_WINDOW(dialog), caption);&#xA; gint result = gtk_dialog_run(GTK_DIALOG(dialog));&#xA;&#xA; gtk_main();&#xA;&#xA; gtk_widget_destroy(dialog);&#xA;&#xA; if (type &amp;amp; MB_YESNO) {&#xA; switch (result) {&#xA; default:&#xA; case GTK_RESPONSE_DELETE_EVENT:&#xA; case GTK_RESPONSE_NO:&#xA; return IDNO;&#xA; break;&#xA; case GTK_RESPONSE_YES:&#xA; return IDYES;&#xA; break;&#xA; }&#xA; }&#xA;&#xA; return IDOK;&#xA;} &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Now, I am by no means an experienced GTK programmer, and I realise that I'm probably doing something(s) horribly wrong.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, my problem is that the last dialog popped up with this function stays around until the process exits. Any ideas?&lt;/p&gt;&#xA;" OwnerUserId="61" LastEditorUserId="1039608" LastEditorDisplayName="Bernard" LastEditDate="2012-05-04T09:35:11.603" LastActivityDate="2012-05-04T09:35:11.603" Title="GTK implementation of MessageBox" Tags="&lt;c++&gt;&lt;c&gt;&lt;linux&gt;&lt;gtk&gt;&lt;x11&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="2" />
<row Id="264" PostTypeId="1" CreationDate="2008-08-01T23:28:51.577" Score="13" ViewCount="1709" Body="&lt;ul&gt;&#xA;&lt;li&gt;What's the optimal level of concurrency that the C++ implementation of BerkeleyDB can reasonably support?&lt;/li&gt;&#xA;&lt;li&gt;How many threads can I have hammering away at the DB before throughput starts to suffer because of resource contention?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've read the manual and know how to set the number of locks, lockers, database page size, etc., but I'd just like some advice from someone who has real-world experience with BDB concurrency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My application is pretty simple, I'll be doing gets and puts of records that are about 1KB each. No cursors, no deleting.&lt;/p&gt;&#xA;" OwnerUserId="104" LastEditorUserId="2405641" LastEditorDisplayName="Michał Piaskowski" LastEditDate="2013-05-30T02:11:52.237" LastActivityDate="2013-11-25T13:52:15.357" Title="BerkeleyDB Concurrency" Tags="&lt;c++&gt;&lt;berkeley-db&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="1" />
<row Id="265" PostTypeId="1" AcceptedAnswerId="266" CreationDate="2008-08-01T23:29:32.853" Score="14" ViewCount="2254" Body="&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I develop a lot of DotNetNuke sites and it seems that in a multi-developer environment, it's always a huge task to get the environment setup correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The ultimate goal (of course) is to have a new developer checkout the trunk from SVN, restore the DNN database and have it all just 'work'...&lt;/p&gt;&#xA;" OwnerUserId="105" LastEditorUserId="4337" LastEditorDisplayName="Gulzar" LastEditDate="2008-11-08T15:41:49.323" LastActivityDate="2008-11-08T15:41:49.307" Title="Best Practice: Collaborative Environment, Bin Directory, SVN" Tags="&lt;svn&gt;&lt;collaboration&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="3" />
<row Id="266" PostTypeId="2" ParentId="265" CreationDate="2008-08-01T23:40:28.463" Score="15" Body="&lt;p&gt;Any assemblies that are expected to be in the GAC should stay in the GAC. This includes System.web.dll or any other 3rd party dll that you'll deploy to the GAC in production. This means a new developer would have to install these assemblies.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;All other 3rd party assemblies should be references through a relative path. My typical structure is:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;-Project&lt;br&gt;--Project.sln&lt;br&gt;--References&lt;br&gt;---StructureMap.dll&lt;br&gt;---NUnit.dll&lt;br&gt;---System.Web.Mvc.dll&lt;br&gt;--Project.Web&lt;br&gt;---Project.Web.Proj&lt;br&gt;---Project.Web.Proj files&lt;br&gt;--Project&lt;br&gt;---Project.Proj&lt;br&gt;---Project.Proj files&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Project.Web and Project reference the assemblies in the root/References folder relatively. These .dlls are checked into subversion.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Aside from that, */bin */bin/* obj should be in your global ignore path.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;With this setup, all references to assemblies are either through the GAC (so should work across all computers), or relative to each project within your solution.&lt;/p&gt;" OwnerUserId="34" LastActivityDate="2008-08-01T23:40:28.463" CommentCount="0" />
<row Id="268" PostTypeId="2" ParentId="265" CreationDate="2008-08-01T23:44:05.883" Score="1" Body="&lt;p&gt;Is this a .Net specific question?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Generally the best practice is to not check in anything which is built automatically from files that are already in SCM. All of that is ideally created as part of your automatic build process.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If the &lt;code&gt;bin&lt;/code&gt; directory you're referring to contains third-party binaries, rather than a build of your project, ignore (downvote?) this advice.&lt;/p&gt;" OwnerUserId="101" LastActivityDate="2008-08-01T23:44:05.883" CommentCount="0" />
<row Id="269" PostTypeId="2" ParentId="260" CreationDate="2008-08-01T23:49:57.103" Score="2" Body="&lt;p&gt;Yes, I thought about that, but I soon figured out that another Domain-Specific-Language (DSL) would be a bit too much.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially, they need to interact with my gamestate in possibly unpredictable ways. For example, a card could have a rule &quot;When this cards enter play, all your undead minions gain +3 attack against flying enemies, except when the enemy is blessed&quot;. As trading card games are turn based, the GameState Manager will fire OnStageX events and let the cards modify other cards or the GameState in whatever way the card needs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If I try to create a DSL, I have to implement a rather large feature set and possibly constantly update it, which shifts the maintenance work to another part without actually removing it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That's why I wanted to stay with a &quot;real&quot; .NET language to essentially be able to just fire the event and let the card manipulate the gamestate in whatever way (within the limits of the code access security).&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="63550" LastEditDate="2010-11-26T15:39:08.390" LastActivityDate="2010-11-26T15:39:08.390" CommentCount="1" />
<row Id="274" PostTypeId="2" ParentId="227" CreationDate="2008-08-01T23:58:35.650" Score="3" Body="&lt;p&gt;@Ryan&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;That's correct but it actually makes the tags with the least number, larger. This code has been tested:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;$artist = array(&quot;the roots&quot;,&quot;michael jackson&quot;,&quot;billy idol&quot;,&quot;more&quot;,&quot;and more&quot;,&quot;and_YET_MORE&quot;);&lt;br&gt;$count = array(5,3,9,1,1,3);&lt;br&gt;$highest = max($count);&lt;br&gt;for ($x = 0; $x &amp;lt; count($artist); $x++) {&lt;br&gt; $normalized = ($highest - $count[$x]+1) / $highest;&lt;br&gt; $heading = ceil($normalized * 6); // 6 heading types&lt;br&gt; echo &quot;&amp;lt;h$heading&amp;gt;{$artist[$x]}&amp;lt;/h$heading&amp;gt;&quot;;&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="40" LastActivityDate="2008-08-01T23:58:35.650" CommentCount="0" />
<row Id="276" PostTypeId="2" ParentId="227" CreationDate="2008-08-02T00:03:33.033" Score="3" Body="&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;kevind wrote:&lt;/p&gt;&#xD;&#xA; &#xD;&#xA; &lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;@Ryan&lt;/p&gt;&#xD;&#xA; &#xD;&#xA; &lt;p&gt;That's correct but it actually makes the tags with the least number, larger. This code has been tested:&lt;/p&gt;&#xD;&#xA; &lt;/blockquote&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I actually meant to mention this in my answer- the original poster specified higher frequencies in higher-number tags, but HTML uses lower numbers for more significant headings.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I wrote my code to spec. ;P&lt;/p&gt;" OwnerUserId="55" LastActivityDate="2008-08-02T00:03:33.033" CommentCount="2" />
<row Id="283" PostTypeId="2" ParentId="227" CreationDate="2008-08-02T00:20:59.927" Score="0" Body="&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;I actually meant to mention this in my&#xD;&#xA; answer- the original poster specified&#xD;&#xA; higher frequencies in higher-number&#xD;&#xA; tags, but HTML uses lower numbers for&#xD;&#xA; more significant headings.&lt;/p&gt;&#xD;&#xA; &#xD;&#xA; &lt;p&gt;I wrote my code to spec. ;P&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;AH I see now, it seemed counter-intuitive to me that the higher the count the smaller the tag?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;My mistake.&lt;/p&gt;" OwnerUserId="40" LastActivityDate="2008-08-02T00:20:59.927" CommentCount="3" />
<row Id="289" PostTypeId="1" AcceptedAnswerId="298" CreationDate="2008-08-02T00:40:58.200" Score="402" ViewCount="279737" Body="&lt;p&gt;I often have a dictionary of keys &amp;amp; values and need to sort it by value. For example, I have a hash of words and their frequencies, and want to order them by frequency.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There's &lt;code&gt;SortedList&lt;/code&gt; which is good for a single value (frequency), but I want to map it back to the word.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/f7fta44c.aspx&quot;&gt;SortedDictionary&lt;/a&gt; orders by key, not value. Some resort to a &lt;a href=&quot;http://www.codeproject.com/KB/recipes/lookupcollection.aspx&quot;&gt;custom class&lt;/a&gt;, but what's the cleanest way?&lt;/p&gt;&#xA;" OwnerUserId="109" LastEditorUserId="661933" LastEditorDisplayName="kurious" LastEditDate="2013-11-05T06:03:34.863" LastActivityDate="2015-02-02T11:21:58.740" Title="How do you sort a dictionary by value?" Tags="&lt;c#&gt;&lt;sorting&gt;&lt;dictionary&gt;" AnswerCount="17" CommentCount="0" FavoriteCount="107" />
<row Id="290" PostTypeId="2" ParentId="174" CreationDate="2008-08-02T00:42:35.310" Score="0" Body="&lt;p&gt;I know that Visual Studio itself (at least in 2003 version) references the IE dll directly to render the &quot;Design View&quot;.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;It may be worth looking into that.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Otherwise, I can't think of anything beyond the Web Browser control.&lt;/p&gt;" OwnerUserId="106" OwnerDisplayName="Sean" LastActivityDate="2008-08-02T00:42:35.310" CommentCount="0" />
<row Id="291" PostTypeId="2" ParentId="289" CreationDate="2008-08-02T00:43:38.837" Score="101" Body="&lt;p&gt;Looking around, and using some C# 3.0 features we can do this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;foreach (KeyValuePair&amp;lt;string,int&amp;gt; item in keywordCounts.OrderBy(key=&amp;gt; key.Value))&#xA;{ &#xA; // do something with item.Key and item.Value&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This is the cleanest way I've seen and is similar to the Ruby way of handling hashes.&lt;/p&gt;&#xA;" OwnerUserId="109" LastEditorUserId="1796930" LastEditDate="2013-01-29T17:11:28.363" LastActivityDate="2013-01-29T17:11:28.363" CommentCount="5" />
<row Id="292" PostTypeId="2" ParentId="289" CreationDate="2008-08-02T00:47:48.797" Score="39" Body="&lt;p&gt;On a high level, you have no other choice then to walk through the whole Dictionary and look at each value.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe this helps:&#xA;&lt;a href=&quot;http://bytes.com/forum/thread563638.html&quot;&gt;http://bytes.com/forum/thread563638.html&lt;/a&gt;&#xA;Copy/Pasting from John Timney:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Dictionary&amp;lt;string, string&amp;gt; s = new Dictionary&amp;lt;string, string&amp;gt;();&#xA;s.Add(&quot;1&quot;, &quot;a Item&quot;);&#xA;s.Add(&quot;2&quot;, &quot;c Item&quot;);&#xA;s.Add(&quot;3&quot;, &quot;b Item&quot;);&#xA;&#xA;List&amp;lt;KeyValuePair&amp;lt;string, string&amp;gt;&amp;gt; myList = new List&amp;lt;KeyValuePair&amp;lt;string, string&amp;gt;&amp;gt;(s);&#xA;myList.Sort(&#xA; delegate(KeyValuePair&amp;lt;string, string&amp;gt; firstPair,&#xA; KeyValuePair&amp;lt;string, string&amp;gt; nextPair)&#xA; {&#xA; return firstPair.Value.CompareTo(nextPair.Value);&#xA; }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="91" LastEditorUserId="-1" LastEditDate="2012-01-05T11:50:33.263" LastActivityDate="2012-01-05T11:50:33.263" CommentCount="2" />
<row Id="297" PostTypeId="2" ParentId="176" CreationDate="2008-08-02T01:10:41.027" Score="7" Body="&lt;p&gt;I usually just specify this in an .htaccess file &lt;em&gt;or&lt;/em&gt; the vhost.conf on the domain I'm working on:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;php_admin_value error_log &quot;/var/www/vhosts/example.com/error_log&quot;&lt;/p&gt;" OwnerUserId="40" LastActivityDate="2008-08-02T01:10:41.027" CommentCount="2" />
<row Id="298" PostTypeId="2" ParentId="289" CreationDate="2008-08-02T01:15:42.123" Score="282" Body="&lt;pre&gt;&lt;code&gt;List&amp;lt;KeyValuePair&amp;lt;string, string&amp;gt;&amp;gt; myList = aDictionary.ToList();&#xA;&#xA;myList.Sort(&#xA; delegate(KeyValuePair&amp;lt;string, string&amp;gt; firstPair,&#xA; KeyValuePair&amp;lt;string, string&amp;gt; nextPair)&#xA; {&#xA; return firstPair.Value.CompareTo(nextPair.Value);&#xA; }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Since you're targeting .net 2.0 or above, you can simplify this into lambda syntax -- it's equivalent but shorter. If you're targeting .net 2.0 you can only use this syntax if you're using the compiler from vs2008 (or above).&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;List&amp;lt;KeyValuePair&amp;lt;string, string&amp;gt;&amp;gt; myList = aDictionary.ToList();&#xA;&#xA;myList.Sort((firstPair,nextPair) =&amp;gt;&#xA; {&#xA; return firstPair.Value.CompareTo(nextPair.Value);&#xA; }&#xA;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="49" LastEditorUserId="1803682" LastEditDate="2013-02-14T21:35:51.997" LastActivityDate="2013-02-14T21:35:51.997" CommentCount="9" />
<row Id="304" PostTypeId="2" ParentId="109" CreationDate="2008-08-02T01:38:14.077" Score="1" Body="&lt;p&gt;Try removing the &lt;code&gt;0x&lt;/code&gt; first and then call &lt;code&gt;Encoding.UTF8.GetString&lt;/code&gt;. I think that may work.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Essentially: 0x44004500&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Remove the 0x, and then always two bytes are one character:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;44 00 = D&#xA;&#xA;45 00 = E&#xA;&#xA;6F 00 = o&#xA;&#xA;72 00 = r&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So it's definitely a Unicode/UTF format with two bytes/character.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="63550" LastEditorDisplayName="Michael Stum" LastEditDate="2015-01-08T17:01:20.193" LastActivityDate="2015-01-08T17:01:20.193" CommentCount="0" />
<row Id="307" PostTypeId="2" ParentId="260" CreationDate="2008-08-02T01:49:46.220" Score="20" Body="&lt;p&gt;&lt;a href=&quot;http://www.codeproject.com/Articles/8656/C-Script-The-Missing-Puzzle-Piece&quot;&gt;Oleg Shilo's C# Script solution (at The Code Project&lt;/a&gt;) really is a great introduction to providing script abilities in your application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A different approach would be to consider a language that is specifically built for scripting, such as &lt;a href=&quot;http://en.wikipedia.org/wiki/IronRuby&quot;&gt;IronRuby&lt;/a&gt;, &lt;a href=&quot;http://en.wikipedia.org/wiki/IronPython&quot;&gt;IronPython&lt;/a&gt;, or &lt;a href=&quot;http://en.wikipedia.org/wiki/Lua_%28programming_language%29&quot;&gt;Lua&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;IronPython and IronRuby are both available today.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For a guide to embedding IronPython read&#xA;&lt;a href=&quot;http://blogs.msdn.com/b/jmstall/archive/2005/09/01/howto-embed-ironpython.aspx&quot;&gt;How to embed IronPython script support in your existing app in 10 easy steps&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Lua is a scripting language commonly used in games. There is a Lua compiler for .NET, available from CodePlex -- &lt;a href=&quot;http://www.codeplex.com/Nua&quot;&gt;http://www.codeplex.com/Nua&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That codebase is a great read if you want to learn about building a compiler in .NET.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A different angle altogether is to try &lt;a href=&quot;http://en.wikipedia.org/wiki/Windows_PowerShell&quot;&gt;PowerShell&lt;/a&gt;. There are numerous examples of embedding PowerShell into an application -- here's a thorough project on the topic: &#xA;&lt;a href=&quot;http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20Reference&quot;&gt;Powershell Tunnel&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="49" LastEditorUserId="2385" LastEditDate="2012-08-16T21:47:03.843" LastActivityDate="2012-08-16T21:47:03.843" CommentCount="3" />
<row Id="308" PostTypeId="1" AcceptedAnswerId="360" CreationDate="2008-08-02T01:52:54.653" Score="73" ViewCount="16171" Body="&lt;p&gt;I often run into the following problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 remember what I've changed and I don't always remember to write it down.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, I make a push to the live system and get a big, obvious error that there is no &lt;code&gt;NewColumnX&lt;/code&gt;, ugh.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Regardless of the fact that this may not be the best practice for this situation, is there a version control system for databases? I don't care about the specific database technology. I just want to know if one exists. If it happens to work with MS SQL Server, then great.&lt;/p&gt;&#xA;" OwnerUserId="106" OwnerDisplayName="Sean" LastEditorUserId="1039608" LastEditorDisplayName="Ryan Fox" LastEditDate="2012-05-04T09:38:02.360" LastActivityDate="2014-12-22T11:58:25.810" Title="Is there a version control system for database structure changes?" Tags="&lt;sql&gt;&lt;database&gt;&lt;version-control&gt;" AnswerCount="26" CommentCount="1" FavoriteCount="37" />
<row Id="310" PostTypeId="2" ParentId="308" CreationDate="2008-08-02T01:56:51.573" Score="6" Body="&lt;p&gt;Most database engines should support dumping your database into a file. I know MySQL does, anyway. This will just be a text file, so you could submit that to Subversion, or whatever you use. It'd be easy to run a diff on the files too.&lt;/p&gt;" OwnerUserId="55" LastActivityDate="2008-08-02T01:56:51.573" CommentCount="1" />
<row Id="328" PostTypeId="1" AcceptedAnswerId="7488" CreationDate="2008-08-02T02:41:34.493" Score="126" ViewCount="53232" Body="&lt;p&gt;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!&lt;/p&gt;&#xA;" OwnerUserId="59" LastEditorUserId="1039608" LastEditDate="2012-05-04T09:39:26.510" LastActivityDate="2012-07-18T17:21:23.430" Title="PHP Session Security" Tags="&lt;security&gt;&lt;php&gt;" AnswerCount="13" CommentCount="0" FavoriteCount="166" />
<row Id="329" PostTypeId="2" ParentId="328" CreationDate="2008-08-02T02:43:42.790" Score="15" Body="&lt;p&gt;One guideline is to call &lt;a href=&quot;http://www.php.net/session_regenerate_id&quot; rel=&quot;nofollow&quot;&gt;session_regenerate_id&lt;/a&gt; every time a session's security level changes. This helps prevent session hijacking.&lt;/p&gt;" OwnerUserId="59" LastActivityDate="2008-08-02T02:43:42.790" CommentCount="0" />
<row Id="330" PostTypeId="1" AcceptedAnswerId="332" CreationDate="2008-08-02T02:51:36.470" Score="18" ViewCount="3305" Body="&lt;p&gt;I am working on a collection of classes used for video playback and recording. I have one main class which acts like the public interface, with methods like &lt;code&gt;play()&lt;/code&gt;, &lt;code&gt;stop()&lt;/code&gt;, &lt;code&gt;pause()&lt;/code&gt;, &lt;code&gt;record()&lt;/code&gt; etc... Then I have workhorse classes which do the video decoding and video encoding. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I just learned about the existence of nested classes in C++, and I'm curious to know what programmers think about using them. I am a little wary and not really sure what the benefits/drawbacks are, but they seem (according to the book I'm reading) to be used in cases such as mine.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The book suggests that in a scenario like mine, a good solution would be to nest the workhorse classes inside the interface class, so there are no separate files for classes the client is not meant to use, and to avoid any possible naming conflicts? I don't know about these justifications. Nested classes are a new concept to me. Just want to see what programmers think about the issue.&lt;/p&gt;&#xA;" OwnerUserId="63" LastEditorUserId="204623" LastEditorDisplayName="Jason Etheridge" LastEditDate="2012-09-03T08:53:51.277" LastActivityDate="2013-03-27T20:24:09.153" Title="Should I use nested classes in this case?" Tags="&lt;c++&gt;&lt;oop&gt;&lt;class&gt;&lt;nested-class&gt;" AnswerCount="10" CommentCount="0" />
<row Id="331" PostTypeId="2" ParentId="328" CreationDate="2008-08-02T02:55:07.743" Score="11" Body="&lt;p&gt;I think one of the major problems (which is being addressed in PHP 6) is register_globals. Right now one of the standard methods used to avoid &lt;code&gt;register_globals&lt;/code&gt; is to use the &lt;code&gt;$_REQUEST&lt;/code&gt;, &lt;code&gt;$_GET&lt;/code&gt; or &lt;code&gt;$_POST&lt;/code&gt; arrays.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &quot;correct&quot; way to do it (as of 5.2, although it's a little buggy there, but stable as of 6, which is coming soon) is through &lt;a href=&quot;http://us.php.net/filter&quot; rel=&quot;nofollow&quot;&gt;filters&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So instead of:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$username = $_POST[&quot;username&quot;];&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you would do:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;or even just:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$username = filter_input(INPUT_POST, 'username');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="58" LastEditorUserId="1039608" LastEditDate="2012-05-04T09:41:40.143" LastActivityDate="2012-05-04T09:41:40.143" CommentCount="4" />
<row Id="332" PostTypeId="2" ParentId="330" CreationDate="2008-08-02T03:00:24.613" Score="12" Body="&lt;p&gt;I would be a bit reluctant to use nested classes here. What if you created an abstract base class for a &quot;multimedia driver&quot; to handle the back-end stuff (workhorse), and a separate class for the front-end work? The front-end class could take a pointer/reference to an implemented driver class (for the appropriate media type and situation) and perform the abstract operations on the workhorse structure.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My philosophy would be to go ahead and make both structures accessible to the client in a polished way, just under the assumption they would be used in tandem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would reference something like a &lt;a href=&quot;http://qt-project.org/doc/qt-4.8/qtextdocument.html&quot; rel=&quot;nofollow&quot;&gt;QTextDocument&lt;/a&gt; in Qt. You provide a direct interface to the bare metal data handling, but pass the authority along to an object like a QTextEdit to do the manipulation.&lt;/p&gt;&#xA;" OwnerUserId="59" LastEditorUserId="560441" LastEditDate="2013-02-17T00:10:18.417" LastActivityDate="2013-02-17T00:10:18.417" CommentCount="0" />
<row Id="335" PostTypeId="2" ParentId="328" CreationDate="2008-08-02T03:16:19.480" Score="3" Body="&lt;p&gt;This is pretty trivial and obvious, but be sure to &lt;a href=&quot;http://www.php.net/session_destroy&quot; rel=&quot;nofollow&quot;&gt;session_destroy&lt;/a&gt; after every use. This can be difficult to implement if the user does not log out explicitly, so a timer can be set to do this.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Here is a good &lt;a href=&quot;http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/&quot; rel=&quot;nofollow&quot;&gt;tutorial&lt;/a&gt; on setTimer() and clearTimer().&lt;/p&gt;" OwnerUserId="50" LastEditorUserId="50" LastEditorDisplayName="contagious" LastEditDate="2008-08-02T03:24:12.787" LastActivityDate="2008-08-02T03:24:12.787" CommentCount="0" />
<row Id="336" PostTypeId="1" AcceptedAnswerId="339" CreationDate="2008-08-02T03:34:44.763" Score="27" ViewCount="7606" Body="&lt;p&gt;When is it appropriate to use an unsigned variable over a signed one? What about in a &lt;code&gt;for&lt;/code&gt; loop?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hear a lot of opinions about this and I wanted to see if there was anything resembling a consensus. &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;for (unsigned int i = 0; i &amp;lt; someThing.length(); i++) { &#xA; SomeThing var = someThing.at(i); &#xA; // You get the idea. &#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I know Java doesn't have unsigned values, and that must have been a concious decision on &lt;a href=&quot;https://en.wikipedia.org/wiki/Sun_Microsystems&quot;&gt;Sun Microsystems&lt;/a&gt;' part. &lt;/p&gt;&#xA;" OwnerUserId="61" LastEditorUserId="63550" LastEditorDisplayName="Jim Anderson" LastEditDate="2013-07-07T15:23:23.477" LastActivityDate="2014-10-06T15:23:36.773" Title="When to use unsigned values over signed ones?" Tags="&lt;language-agnostic&gt;&lt;types&gt;" AnswerCount="6" CommentCount="2" FavoriteCount="3" />
<row Id="337" PostTypeId="1" AcceptedAnswerId="342" CreationDate="2008-08-02T03:35:55.697" Score="40" ViewCount="5179" Body="&lt;p&gt;I'm 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. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;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 Python. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone have experience doing XML processing in Python? Where would you suggest I start? The XML files I'll be building will be fairly simple.&lt;/p&gt;&#xA;" OwnerUserId="111" LastEditorUserId="1039608" LastEditDate="2012-05-04T09:45:16.460" LastActivityDate="2014-10-08T05:58:37.820" Title="XML Processing in Python" Tags="&lt;python&gt;&lt;xml&gt;" AnswerCount="17" CommentCount="1" FavoriteCount="6" />
<row Id="338" PostTypeId="2" ParentId="337" CreationDate="2008-08-02T03:43:33.620" Score="2" Body="&lt;p&gt;&lt;a href=&quot;http://diveintopython.net/xml_processing/&quot; rel=&quot;nofollow&quot;&gt;Dive Into Python&lt;/a&gt; has a chapter. Can't vouch for how good it would be though.&lt;/p&gt;&#xA;" OwnerUserId="61" LastEditorUserId="1288" LastEditDate="2012-08-03T14:04:47.807" LastActivityDate="2012-08-03T14:04:47.807" CommentCount="0" />
<row Id="339" PostTypeId="2" ParentId="336" CreationDate="2008-08-02T03:49:21.987" Score="29" Body="&lt;p&gt;I was glad to find &lt;a href=&quot;http://coding.derkeiler.com/Archive/C_CPP/comp.lang.c/2004-02/1382.html&quot;&gt;a good conversation&lt;/a&gt; on this subject, as I hadn't really given it much thought before.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;In summary, signed is a good general choice - even when you're dead sure all the numbers are positive - if you're going to do arithmetic on the variable (like in a typical for loop case). &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you're going to do bitwise things like masks, unsigned starts to make more sense. Or, if you're desperate to get that extra positive range by taking advantage of the sign bit.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Personally, I like signed because I don't trust myself to stay consistent and avoid mixing the two types (like the article warns against).&lt;/p&gt;" OwnerUserId="59" LastActivityDate="2008-08-02T03:49:21.987" CommentCount="1" />
<row Id="342" PostTypeId="2" ParentId="337" CreationDate="2008-08-02T04:01:34.600" Score="12" Body="&lt;p&gt;Personally, I've played with several of the built-in options on an XML-heavy project and have settled on &lt;a href=&quot;http://docs.python.org/lib/module-xml.dom.pulldom.html&quot;&gt;pulldom&lt;/a&gt; as the best choice for less complex documents.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Especially for small simple stuff, I like the event-driven theory of parsing rather than setting up a whole slew of callbacks for a relatively simple structure. &lt;a href=&quot;http://www.prescod.net/python/pulldom.html&quot;&gt;Here is a good quick discussion of how to use the API&lt;/a&gt;.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;What I like: you can handle the parsing in a &lt;code&gt;for&lt;/code&gt; loop rather than using callbacks. You also delay full parsing (the &quot;pull&quot; part) and only get additional detail when you call &lt;code&gt;expandNode()&lt;/code&gt;. This satisfies my general requirement for &quot;responsible&quot; efficiency without sacrificing ease of use and simplicity.&lt;/p&gt;" OwnerUserId="59" LastActivityDate="2008-08-02T04:01:34.600" CommentCount="1" />
<row Id="344" PostTypeId="2" ParentId="260" CreationDate="2008-08-02T04:18:15.517" Score="3" Body="&lt;p&gt;You might be able to use IronRuby for that. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Otherwise I'd suggest you have a directory where you place precompiled assemblies. Then you could have a reference in the DB to the assembly and class, and use reflection to load the proper assemblies at runtime.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you really want to compile at run-time you could use the CodeDOM, then you could use reflection to load the dynamic assembly. &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/microsoft.csharp.csharpcodeprovider.aspx&quot; rel=&quot;nofollow&quot;&gt;MSDN article which might help&lt;/a&gt;.&lt;/p&gt;" OwnerUserId="100" LastEditorUserId="100" LastEditorDisplayName="EHaskins" LastEditDate="2008-08-02T04:23:02.043" LastActivityDate="2008-08-02T04:23:02.043" CommentCount="0" />
<row Id="347" PostTypeId="2" ParentId="336" CreationDate="2008-08-02T04:31:54.803" Score="2" Body="&lt;p&gt;In your example above, when 'i' will always be positive and a higher range would be beneficial, unsigned would be useful. Like if you're using 'declare' statements, such as: &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;#declare BIT1 (unsigned int 1)&lt;br&gt;#declare BIT32 (unsigned int reallybignumber)&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Especially when these values will never change.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;However, if you're doing an accounting program where the people are irresponsible with their money and are constantly in the red, you will most definitely want to use 'signed'.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I do agree with saint though that a good rule of thumb is to use signed, which C actually defaults to, so you're covered.&lt;/p&gt;" OwnerUserId="50" LastActivityDate="2008-08-02T04:31:54.803" CommentCount="0" />
<row Id="352" PostTypeId="2" ParentId="36" CreationDate="2008-08-02T05:20:22.397" Score="49" Body="&lt;p&gt;Take a look at the CHECKSUM command:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT CHECKSUM_AGG(BINARY_CHECKSUM(*)) FROM sample_table WITH (NOLOCK);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;That will return the same number each time it's run as long as the table contents haven't changed. See my post on this for more information:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa258245%28SQL.80%29.aspx&quot;&gt;CHECKSUM&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's how I used it to rebuild cache dependencies when tables changed:&lt;br&gt;&#xA;&lt;a href=&quot;http://weblogs.asp.net/jgalloway/archive/2005/05/07/406056.aspx&quot;&gt;ASP.NET 1.1 database cache dependency (without triggers)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="5" LastEditorDisplayName="user1873471" LastEditDate="2013-01-28T03:44:42.550" LastActivityDate="2013-01-28T03:44:42.550" CommentCount="1" />
<row Id="354" PostTypeId="2" ParentId="336" CreationDate="2008-08-02T05:51:57.247" Score="0" Body="&lt;p&gt;&lt;code&gt;size_t&lt;/code&gt; is often a good choice for this, or &lt;code&gt;size_type&lt;/code&gt; if you're using an STL class.&lt;/p&gt;&#xA;" OwnerUserId="116" LastEditorUserId="148195" LastEditDate="2012-08-23T17:27:58.057" LastActivityDate="2012-08-23T17:27:58.057" CommentCount="1" />
<row Id="356" PostTypeId="2" ParentId="308" CreationDate="2008-08-02T06:05:04.770" Score="3" Body="&lt;p&gt;For Oracle, I use &lt;a href=&quot;http://www.toadsoft.com/&quot; rel=&quot;nofollow&quot;&gt;Toad&lt;/a&gt;, which can dump a schema to a number of discrete files (e.g., one file per table). I have some scripts that manage this collection in Perforce, but I think it should be easily doable in just about any revision control system.&lt;/p&gt;&#xA;" OwnerUserId="116" LastEditorUserId="106" LastEditorDisplayName="EndangeredMassa" LastEditDate="2009-01-21T16:07:11.617" LastActivityDate="2009-01-21T16:07:11.617" CommentCount="0" />
<row Id="357" PostTypeId="2" ParentId="13" CreationDate="2008-08-02T06:06:50.337" Score="-10" Body="&lt;h1&gt;timezone.js:&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;function ajaxpage() {&#xA; var url = &quot;timezone.php&quot;;&#xA; var visitortime = new Date();&#xA; var time = visitortime.getTimezoneOffset()/60;&#xA; var page_request = false;&#xA;&#xA; if (window.XMLHttpRequest) {&#xA; page_request = new XMLHttpRequest();&#xA; }&#xA; else if (window.ActiveXObject) { &#xA; try {&#xA; page_request = new ActiveXObject(&quot;Msxml2.XMLHTTP&quot;);&#xA; }&#xA; catch (e) {&#xA; try{&#xA; page_request = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);&#xA; } &#xA; catch (e) {&#xA; }&#xA; }&#xA; }&#xA; else {&#xA; return false;&#xA; }&#xA;&#xA; page_request.onreadystatechange = function() {&#xA; loadpage(page_request, containerid);&#xA; }&#xA;&#xA; if (bustcachevar) {&#xA; bustcacheparameter=(url.indexOf(&quot;?&quot;)!=-1) ? &quot;&amp;amp;&quot;+new Date().getTime() : &quot;?&quot;+new Date().getTime();&#xA; }&#xA;&#xA; page_request.open('GET', url+bustcacheparameter+&quot;&amp;amp;time=&quot;+time, true);&#xA; page_request.send(null);&#xA;}&#xA;&#xA;function loadpage(page_request, containerid) {&#xA; if (page_request.readyState == 4 &amp;amp;&amp;amp; (page_request.status==200 || window.location.href.indexOf(&quot;http&quot;)==-1)) {&#xA; document.write('&amp;lt;meta http-equiv=&quot;refresh&quot; content=&quot;0;url=http://example.com/&quot;/&amp;gt;');&#xA; }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;h1&gt;timezone.php:&lt;/h1&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA;session_start();&#xA;$_SESSION['time'] = $_GET['time'];&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;When you want to use it add &lt;code&gt;onLoad=&quot;ajaxpage();&lt;/code&gt; to the body tag and it should cause the timezone to be stored in the PHP session variable &lt;code&gt;$_SESSION['time']&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit: P.S. This is untested.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="2824961" LastEditorDisplayName="Unkwntech" LastEditDate="2013-12-17T14:44:39.520" LastActivityDate="2013-12-17T14:44:39.520" CommentCount="10" CommunityOwnedDate="2013-12-17T14:44:39.520" />
<row Id="359" PostTypeId="2" ParentId="260" CreationDate="2008-08-02T06:16:23.967" Score="3" Body="&lt;P&gt;You could use any of the DLR languages, which provide a way to really easily host your own scripting platform. However, you don't have to use a scripting language for this. You could use C# and compile it with the C# code provider. As long as you load it in its own AppDomain, you can load and unload it to your heart's content.&lt;/P&gt;" OwnerUserId="119" OwnerDisplayName="Jesse Ezell" LastActivityDate="2008-08-02T06:16:23.967" CommentCount="0" />
<row Id="360" PostTypeId="2" ParentId="308" CreationDate="2008-08-02T06:23:33.737" Score="36" Body="&lt;p&gt;In Ruby on Rails, there's a concept of a &lt;a href=&quot;http://wiki.rubyonrails.org/rails/pages/UnderstandingMigrations&quot;&gt;migration&lt;/a&gt; -- a quick script to change the database.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You generate a migration file, which has rules to increase the db version (such as adding a column) and rules to downgrade the version (such as removing a column). Each migration is numbered, and a table keeps track of your current db version.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;To _migrate up_, you run a command called &quot;db:migrate&quot; which looks at your version and applies the needed scripts. You can migrate down in a similar way.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The migration scripts themselves are kept in a version control system -- whenever you change the database you check in a new script, and any developer can apply it to bring their local db to the latest version.&lt;/p&gt;" OwnerUserId="109" LastEditorUserId="109" LastEditorDisplayName="kurious" LastEditDate="2008-08-03T04:44:07.057" LastActivityDate="2008-08-03T04:44:07.057" CommentCount="1" />
<row Id="361" PostTypeId="1" AcceptedAnswerId="362" CreationDate="2008-08-02T06:57:57.957" Score="90" ViewCount="124204" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any language would work, but it should be portable.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="321731" LastEditorDisplayName="chills42" LastEditDate="2013-12-17T22:36:29.047" LastActivityDate="2015-02-17T03:21:23.410" Title="Generate list of all possible permutations of a string" Tags="&lt;string&gt;&lt;language-agnostic&gt;&lt;cross-platform&gt;" AnswerCount="32" CommentCount="0" FavoriteCount="70" CommunityOwnedDate="2014-01-23T03:28:19.943" />
<row Id="362" PostTypeId="2" ParentId="361" CreationDate="2008-08-02T07:48:07.607" Score="35" Body="&lt;p&gt;There are several ways to do this. Common methods use recursion, memoization, or dynamic programming. The basic idea is that you produce a list of all strings of length 1, then in each iteration, for all strings produced in the last iteration, add that string concatenated with each character in the string individually. (the variable index in the code below keeps track of the start of the last and the next iteration)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Some pseudocode:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;list = originalString.split('')&#xA;index = (0,0)&#xA;list = [&quot;&quot;]&#xA;for iteration n in 1 to y:&#xA; index = (index[1], len(list))&#xA; for string s in list.subset(index[0] to end):&#xA; for character c in originalString:&#xA; list.add(s + c)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;you'd then need to remove all strings less than x in length, they'll be the first (x-1) * len(originalString) entries in the list.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;Mike Stone wrote:&lt;/p&gt;&#xA; &#xA; &lt;blockquote&gt;&#xA; &lt;p&gt;FYI, alumb's pseudocode has a bug... &lt;/p&gt;&#xA; &lt;/blockquote&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Good call Mike. I have amended my solution to fix this issue and an initialization bug.&lt;/p&gt;&#xA;" OwnerUserId="80" LastEditorUserId="417685" LastEditorDisplayName="alumb" LastEditDate="2013-03-08T22:46:33.120" LastActivityDate="2013-03-08T22:46:33.120" CommentCount="3" CommunityOwnedDate="2014-01-23T03:28:19.943" />
<row Id="363" PostTypeId="2" ParentId="308" CreationDate="2008-08-02T07:48:56.107" Score="2" Body="&lt;p&gt;There's a PHP5 &quot;database migration framework&quot; called Ruckusing. I haven't used it, but the &lt;a href=&quot;http://code.google.com/p/ruckusing/wiki/CompleteExamples&quot; rel=&quot;nofollow&quot;&gt;examples&lt;/a&gt; show the idea, if you use the language to create the database as and when needed, you only have to track source files.&lt;/p&gt;" OwnerUserId="117" LastActivityDate="2008-08-02T07:48:56.107" CommentCount="0" />
<row Id="364" PostTypeId="2" ParentId="361" CreationDate="2008-08-02T07:56:07.933" Score="4" Body="&lt;p&gt;I just whipped this up quick in Ruby:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;def perms(x, y, possible_characters)&lt;br&gt; all = [&quot;&quot;]&lt;br&gt; current_array = all.clone&lt;br&gt; 1.upto(y) { |iteration|&lt;br&gt; next_array = []&lt;br&gt; current_array.each { |string|&lt;br&gt; possible_characters.each { |c|&lt;br&gt; value = string + c&lt;br&gt; next_array.insert next_array.length, value&lt;br&gt; all.insert all.length, value&lt;br&gt; }&lt;br&gt; }&lt;br&gt; current_array = next_array&lt;br&gt; }&lt;br&gt; all.delete_if { |string| string.length &amp;lt; x }&lt;br&gt;end&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You might look into language API for built in permutation type functions, and you might be able to write more optimized code, but if the numbers are all that high, I'm not sure there is much of a way around having a lot of results.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Anyways, the idea behind the code is start with string of length 0, then keep track of all the strings of length Z where Z is the current size in the iteration. Then, go through each string and append each character onto each string. Finally at the end, remove any that were below the x threshold and return the result.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I didn't test it with potentially meaningless input (null character list, weird values of x and y, etc).&lt;/p&gt;" OwnerUserId="122" OwnerDisplayName="Mike Stone" LastActivityDate="2008-08-02T07:56:07.933" CommentCount="1" CommunityOwnedDate="2014-01-23T03:28:19.943" />
<row Id="367" PostTypeId="2" ParentId="88" CreationDate="2008-08-02T08:08:22.230" Score="32" Body="&lt;p&gt;&lt;strong&gt;High Resolution, Low Overhead Timing for Intel Processors&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you're on Intel hardware, here's how to read the CPU real-time instruction counter. It will tell you the number of CPU cycles executed since the processor was booted. This is probably the finest-grained counter you can get for performance measurement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Note that this is the number of CPU cycles. On linux you can get the CPU speed from /proc/cpuinfo and divide to get the number of seconds. Converting this to a double is quite handy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When I run this on my box, I get&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;11867927879484732&#xA;11867927879692217&#xA;it took this long to call printf: 207485&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Here's the &lt;a href=&quot;http://cs.smu.ca/~jamuir/rdtscpm1.pdf&quot;&gt;Intel developer's guide&lt;/a&gt; that gives tons of detail.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;stdint.h&amp;gt;&#xA;&#xA;inline uint64_t rdtsc() {&#xA; uint32_t lo, hi;&#xA; __asm__ __volatile__ (&#xA; &quot;xorl %%eax, %%eax\n&quot;&#xA; &quot;cpuid\n&quot;&#xA; &quot;rdtsc\n&quot;&#xA; : &quot;=a&quot; (lo), &quot;=d&quot; (hi)&#xA; :&#xA; : &quot;%ebx&quot;, &quot;%ecx&quot;);&#xA; return (uint64_t)hi &amp;lt;&amp;lt; 32 | lo;&#xA;}&#xA;&#xA;main()&#xA;{&#xA; unsigned long long x;&#xA; unsigned long long y;&#xA; x = rdtsc();&#xA; printf(&quot;%lld\n&quot;,x);&#xA; y = rdtsc();&#xA; printf(&quot;%lld\n&quot;,y);&#xA; printf(&quot;it took this long to call printf: %lld\n&quot;,y-x);&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="116" LastEditorUserId="13430" LastEditorDisplayName="Mark Harrison" LastEditDate="2010-08-23T16:53:06.797" LastActivityDate="2010-08-23T16:53:06.797" CommentCount="4" />
<row Id="368" PostTypeId="2" ParentId="227" CreationDate="2008-08-02T08:08:25.113" Score="3" Body="&lt;p&gt;Personally I would do something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&#xA; $data = array($rating[0] =&amp;gt; array('word0', 'word1', 'word2'), $rating[1] =&amp;gt; array('word3', 'word4', 'word8',...));&#xA; //assums that $rating is an array with the weight of each word so the more popular words would have a higher value in rating&#xA; usort($data); //sort the $data variable, this should give us the most popular words first&#xA; $size = '1';&#xA; foreach($data as $rank)&#xA; {&#xA; $i=0;&#xA; while($i&amp;lt;$count($rank))&#xA; {&#xA; echo &quot;&amp;lt;h&quot; . $size . &quot;&amp;gt;&quot; . $rank[$i] . &quot;&amp;lt;/h&quot; . $size . &quot;&amp;gt;&quot;;&#xA; $i++;&#xA; }&#xA;&#xA; $size++;&#xA; }&#xA;?&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Assuming I'm not a complete idiot this should work. But it is untested.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="902217" LastEditDate="2012-10-24T14:39:31.093" LastActivityDate="2012-10-24T14:39:31.093" CommentCount="1" />
<row Id="371" PostTypeId="1" AcceptedAnswerId="396" CreationDate="2008-08-02T08:19:18.260" Score="306" ViewCount="61936" Body="&lt;p&gt;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 &lt;em&gt;spamish&lt;/em&gt; terminology.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Of late, some of the emails I send out programmatically have started being shuffled into people's spam folder automatically and I'm wondering what I can do about it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is despite the fact that these particular emails are not ones that humans would mark as spam, specifically, they are emails that contain license keys that people have paid good money for, so I don't think they're going to consider them spam&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I figure this is a big topic in which I am essentially an ignorant simpleton.&lt;/p&gt;&#xA;" OwnerUserId="49" LastEditorUserId="1039608" LastEditorDisplayName="dbr" LastEditDate="2012-05-04T09:47:31.763" LastActivityDate="2012-12-04T09:52:38.120" Title="How do you make sure email you send programmatically is not automatically marked as spam?" Tags="&lt;email&gt;&lt;email-spam&gt;" AnswerCount="18" CommentCount="0" FavoriteCount="259" />
<row Id="375" PostTypeId="2" ParentId="371" CreationDate="2008-08-02T08:32:04.287" Score="16" Body="&lt;p&gt;You can tell your users to add your From address to their contacts when they complete their order, which, if they do so, will help a lot.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Otherwise, I would try to get a log from some of your users. Sometimes they have details about why it was flagged as spam in the headers of the message, which you could use to tweak the text.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Other things you can try:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ul&gt;&#xD;&#xA;&lt;li&gt;Put your site name or address in the subject&lt;/li&gt;&#xD;&#xA;&lt;li&gt;Keep all links in the message pointing to your domain (and not email.com)&lt;/li&gt;&#xD;&#xA;&lt;li&gt;Put an address or other contact information in the email&lt;/li&gt;&#xD;&#xA;&lt;/ul&gt;" OwnerUserId="124" LastActivityDate="2008-08-02T08:32:04.287" CommentCount="0" />
<row Id="382" PostTypeId="1" AcceptedAnswerId="384" CreationDate="2008-08-02T08:58:27.540" Score="28" ViewCount="6827" Body="&lt;p&gt;What is the meaning of the Java warning?&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;Type safety: The cast from Object to List is actually checking against the erased type List&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I get this warning when I try to cast an Object to a type with generic information, such as in the following code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Object object = getMyList();&#xA;List&amp;lt;Integer&amp;gt; list = (List&amp;lt;Integer&amp;gt;) object;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="122" OwnerDisplayName="Mike Stone" LastEditorUserId="1563422" LastEditDate="2013-04-21T05:20:42.633" LastActivityDate="2013-07-20T18:38:35.693" Title="What is the meaning of the type safety warning in certain Java generics casts?" Tags="&lt;java&gt;&lt;generics&gt;&lt;warnings&gt;&lt;casting&gt;&lt;type-safety&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="4" />
<row Id="384" PostTypeId="2" ParentId="382" CreationDate="2008-08-02T08:58:48.430" Score="31" Body="&lt;p&gt;This warning is there because Java is not actually storing type information at run-time in an object that uses generics. Thus, if &lt;code&gt;object&lt;/code&gt; is actually a &lt;code&gt;List&amp;lt;String&amp;gt;&lt;/code&gt;, there will be no &lt;code&gt;ClassCastException&lt;/code&gt; at run-time except until an item is accessed from the list that doesn't match the generic type defined in the variable. This can cause further complications if items are added to the list, with this incorrect generic type information. Any code still holding a reference to the list but with the correct generic type information will now have an inconsistent list. To remove the warning, try:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;List&amp;lt;?&amp;gt; list = (List&amp;lt;?&amp;gt;) object;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;However, note that you will not be able to use certain methods such as add because the compiler doesn't know if you are trying to add an object of incorrect type. The above will work in a lot of situations, but if you have to use add, or some similarly restricted method, you will just have to suffer the yellow underline in Eclipse (or a &lt;code&gt;SuppressWarning&lt;/code&gt; annotation).&lt;/p&gt;&#xA;" OwnerUserId="122" OwnerDisplayName="Mike Stone" LastEditorUserId="697449" LastEditDate="2012-11-27T01:12:52.100" LastActivityDate="2012-11-27T01:12:52.100" CommentCount="0" />
<row Id="387" PostTypeId="1" CreationDate="2008-08-02T09:28:17.683" Score="21" ViewCount="2993" Body="&lt;p&gt;In Lucene if you had an multiple indexes that covered only one partition each. Why does the same search on different indexes return results with different scores? The results from the different servers match exactly. i.e If I searched for:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Name - John Smith&lt;/li&gt;&#xA;&lt;li&gt;DOB - 11/11/1934&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Partition 0 would return a score of 0.345&#xA;Partition 1 would return a score of 0.337&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both matched exactly on the name and dob.&lt;/p&gt;&#xA;" OwnerUserId="134" LastEditorUserId="48387" LastEditorDisplayName="Stephen Hendry" LastEditDate="2010-02-28T22:32:32.120" LastActivityDate="2012-12-13T23:38:14.167" Title="Lucene Score results" Tags="&lt;search&gt;&lt;lucene&gt;" AnswerCount="3" CommentCount="0" />
<row Id="388" PostTypeId="2" ParentId="361" CreationDate="2008-08-02T09:40:54.693" Score="2" Body="&lt;p&gt;I'm not sure why you would want to do this in the first place. The resulting set for any moderately large values of x and y will be huge, and will grow exponentially as x and/or y get bigger. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Lets say your set of possible characters is the 26 lowercase letters of the alphabet, and you ask your application to generate all permutations where length = 5. Assuming you don't run out of memory you'll get 11,881,376 (i.e. 26 to the power of 5) strings back. Bump that length up to 6, and you'll get 308,915,776 strings back. These numbers get painfully large, very quickly.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Here's a solution I put together in Java. You'll need to provide two runtime arguments (corresponding to x and y). Have fun.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;public class GeneratePermutations {&lt;br&gt; public static void main(String[] args) {&lt;br&gt; int lower = Integer.parseInt(args[0]);&lt;br&gt; int upper = Integer.parseInt(args[1]);&lt;br&gt;&lt;br&gt; if (upper &amp;lt; lower || upper == 0 || lower == 0) {&lt;br&gt; System.exit(0);&lt;br&gt; }&lt;br&gt;&lt;br&gt; for (int length = lower; length &amp;lt;= upper; length++) {&lt;br&gt; generate(length, &quot;&quot;);&lt;br&gt; }&lt;br&gt; }&lt;br&gt;&lt;br&gt; private static void generate(int length, String partial) {&lt;br&gt; if (length &amp;lt;= 0) {&lt;br&gt; System.out.println(partial);&lt;br&gt; } else {&lt;br&gt; for (char c = 'a'; c &amp;lt;= 'z'; c++) {&lt;br&gt; generate(length - 1, partial + c);&lt;br&gt; }&lt;br&gt; }&lt;br&gt; }&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="118" LastActivityDate="2008-08-02T09:40:54.693" CommentCount="1" CommunityOwnedDate="2014-01-23T03:28:19.943" />
<row Id="391" PostTypeId="2" ParentId="387" CreationDate="2008-08-02T09:51:00.883" Score="12" Body="&lt;p&gt;The &lt;a href=&quot;http://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/search/Similarity.html&quot; rel=&quot;nofollow&quot;&gt;scoring&lt;/a&gt; contains the Inverse Document Frequency(IDF). If the term &quot;John Smith&quot; is in one partition, 0, 100 times and in partition 1, once. The score for searching for John Smith would be higher search in partition 1 as the term is more scarce.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get round this you would wither have to have your index being over all partitions, or you would need to override the IDF.&lt;/p&gt;&#xA;" OwnerUserId="134" LastEditorUserId="1628375" LastEditDate="2012-12-13T23:38:14.167" LastActivityDate="2012-12-13T23:38:14.167" CommentCount="1" />
<row Id="392" PostTypeId="2" ParentId="387" CreationDate="2008-08-02T09:52:36.870" Score="5" Body="&lt;p&gt;Because the score is determined on the Index if I am not completely mistaken. If you have different indexes (more/less or different data that was indexed), the score will differ:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://lucene.apache.org/core/3_6_0/scoring.html&quot; rel=&quot;nofollow&quot;&gt;http://lucene.apache.org/core/3_6_0/scoring.html&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(Warning: Contains Math :-))&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="43452" LastEditDate="2012-12-13T23:38:06.660" LastActivityDate="2012-12-13T23:38:06.660" CommentCount="2" />
<row Id="396" PostTypeId="2" ParentId="371" CreationDate="2008-08-02T10:21:54.300" Score="241" Body="&lt;p&gt;Use email authentication methods, such as &lt;a href=&quot;http://en.wikipedia.org/wiki/Sender_Policy_Framework&quot;&gt;SPF&lt;/a&gt;, and &lt;a href=&quot;https://help.ubuntu.com/community/Postfix/DKIM&quot;&gt;DKIM&lt;/a&gt; to prove that your emails and your domain name belong together, and to prevent spoofing of your domain name. The SPF website includes a wizard to generate the DNS information for your site.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://remote.12dt.com/&quot;&gt;Check&lt;/a&gt; your &lt;a href=&quot;http://en.wikipedia.org/wiki/Reverse_DNS_lookup&quot;&gt;reverse DNS&lt;/a&gt; to make sure the IP address of your mail server points to the domain name that you use for sending mail.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure that the IP-address that you're using is &lt;a href=&quot;http://www.spamhaus.org/lookup.lasso&quot;&gt;not on a blacklist&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Make sure that the reply-to address is a valid, existing address.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Use the full, real name of the addressee in the To field, not just the email-address (e.g. &lt;code&gt;&quot;John Smith&quot; &amp;lt;john@blacksmiths-international.com&amp;gt;&lt;/code&gt; ).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Monitor your abuse accounts, such as abuse@yourdomain.com and postmaster@yourdomain.com. That means - make sure that these accounts exist, read what's sent to them, and act on complaints.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, make it &lt;strong&gt;really&lt;/strong&gt; easy to unsubscribe. Otherwise, your users will unsubscribe by pressing the &lt;strong&gt;spam&lt;/strong&gt; button, and that will affect your reputation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That said, getting Hotmail to accept your emails remains a black art.&lt;/p&gt;&#xA;" OwnerUserId="136" LastEditorUserId="238886" LastEditorDisplayName="Paul Tomblin" LastEditDate="2012-01-05T23:58:49.517" LastActivityDate="2012-01-05T23:58:49.517" CommentCount="6" />
<row Id="397" PostTypeId="2" ParentId="72" CreationDate="2008-08-02T10:22:41.567" Score="1" Body="&lt;p&gt;RDoc uses SimpleMarkup so it's fairly simple to create lists, etc. using *, - or a number. It also treats lines that are indented at the same column number as part of the same paragraph until there is an empty line which signifies a new paragraph. Do you have a few examples of comments you want RDoc'ed so we could show you how to do them and then you could extrapolate that for the rest of your comments?&lt;/p&gt;" OwnerUserId="135" LastActivityDate="2008-08-02T10:22:41.567" CommentCount="0" />
<row Id="402" PostTypeId="1" AcceptedAnswerId="2530953" CreationDate="2008-08-02T10:47:08.460" Score="67" ViewCount="66013" Body="&lt;p&gt;Note: this question is from 2008 and now is of only historic interest.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;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?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Both programmatically and using the Interface Builder.&lt;/p&gt;&#xA;" OwnerUserId="136" LastEditorUserId="294884" LastEditDate="2014-06-15T09:11:04.993" LastActivityDate="2014-06-15T09:11:04.993" Title="iPhone app in landscape mode, 2008 systems" Tags="&lt;iphone&gt;&lt;objective-c&gt;" AnswerCount="9" CommentCount="2" FavoriteCount="33" />
<row Id="407" PostTypeId="2" ParentId="164" CreationDate="2008-08-02T11:05:55.460" Score="2" Body="&lt;p&gt;&lt;s&gt;The best way to deploy video on the web is using Flash - it's much easier to embed cleanly into a web page and will play on more or less any browser and platform combination. The only reason to use Windows Media Player is if you're streaming content and you need extraordinarily strong digital rights management, and even then providers are now starting to use Flash even for these. See BBC's iPlayer for a superb example.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would suggest that you switch to Flash even for internal use. You never know who is going to need to access it in the future, and this will give you the best possible future compatibility.&lt;/s&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;EDIT - March 20 2013. &#xA;Interesting how these old questions resurface from time to time! How different the world is today and how dated this all seems. I would not recommend a Flash only route today by any means - best practice these days would probably be to use HTML 5 to embed H264 encoded video, with a Flash fallback as described here: &lt;a href=&quot;http://diveintohtml5.info/video.html&quot; rel=&quot;nofollow&quot;&gt;http://diveintohtml5.info/video.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="137" LastEditorUserId="137" LastEditDate="2013-03-20T17:59:17.450" LastActivityDate="2013-03-20T17:59:17.450" CommentCount="4" />
<row Id="411" PostTypeId="2" ParentId="48" CreationDate="2008-08-02T11:24:57.417" Score="14" Body="&lt;p&gt;If the fact that the first button is used by default is consistent across browsers, why not put them the right way round in the source code, then use CSS to switch their apparent positions? &lt;code&gt;float&lt;/code&gt; them left and right to switch them around visually, for example.&lt;/p&gt;&#xA;" OwnerUserId="137" LastEditorUserId="967315" LastEditDate="2012-10-14T12:21:12.660" LastActivityDate="2012-10-14T12:21:12.660" CommentCount="0" />
<row Id="412" PostTypeId="2" ParentId="108" CreationDate="2008-08-02T11:30:47.920" Score="1" Body="&lt;p&gt;Tortoise SVN with Ankhsvn for VS 2005&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;http://i.stack.imgur.com/7pzo0.jpg&quot; alt=&quot;&quot;&gt;&lt;/p&gt;&#xA;" OwnerUserId="123" LastEditorUserId="1114" LastEditorDisplayName="Prakash" LastEditDate="2012-04-04T00:55:18.347" LastActivityDate="2012-04-04T00:55:18.347" CommentCount="0" />
<row Id="419" PostTypeId="1" AcceptedAnswerId="17396" CreationDate="2008-08-02T11:52:01.543" Score="16" ViewCount="1825" Body="&lt;p&gt;Part of my everyday work is maintaining and extending legacy VB6 applications. A common engine is written in C/C++ and VB6 uses these functions in order to improve performance. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When it comes to asynchronous programming, a C interface is not enough and we rely on COM controls to fire events to VB6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My problem is that when I register the control in VB6, VB loads this control in memory and does not unload it until I quit the VB6 IDE. As the control is loaded the whole time, I am unable to recompile it in VC6, because the DLL file is locked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A solution I found is not to enable the control in VB but use the CreateObject() with the full name of my control. The problem then is that I must declare my control as an Object because VB6 knows nothing of the interface I am using and I do not have access to IntelliSense, which is a pain.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any idea how I can tell VB6 to unload controls after quitting the application? Or directly in the IDE?&lt;/p&gt;&#xA;" OwnerUserId="268" OwnerDisplayName="Vincent Robert" LastEditorUserId="73488" LastEditorDisplayName="Joel Spolsky" LastEditDate="2010-10-12T02:21:47.090" LastActivityDate="2010-10-12T02:21:47.090" Title="Unload a COM control when working in VB6 IDE" Tags="&lt;com&gt;&lt;vb6&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" />
<row Id="427" PostTypeId="1" CreationDate="2008-08-02T12:12:02.363" Score="10" ViewCount="722" Body="&lt;p&gt;Is there any way to launch IEMobile's Favorites screen directly by&#xA;specifying any command line parameter?&lt;/p&gt;&#xA;" OwnerUserId="123" LastEditorUserId="3204551" LastEditorDisplayName="Chris" LastEditDate="2015-01-22T18:22:31.620" LastActivityDate="2015-01-22T18:22:31.620" Title="Programmatically Launch IE Mobile Favorites screen" Tags="&lt;internet-explorer&gt;&lt;windows-mobile&gt;&lt;pocketpc&gt;" AnswerCount="3" CommentCount="0" />
<row Id="430" PostTypeId="2" ParentId="192" CreationDate="2008-08-02T12:28:12.517" Score="6" Body="&lt;p&gt;The difference between 12.345 in French and English is a factor of 1000. If you supply an expected range where max &amp;lt; 1000*min, you can easily guess. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Take for example the height of a person (including babies and children) in mm.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;By using a range of 200-3000, an input of 1.800 or 1,800 can unambiguously be interpreted as 1 meter and 80 centimeters, whereas an input of 912.300 or 912,300 can unambiguously be interpreted as 91 centimeters and 2.3 millimeters.&lt;/p&gt;" OwnerUserId="136" LastActivityDate="2008-08-02T12:28:12.517" CommentCount="0" />
<row Id="438" PostTypeId="1" AcceptedAnswerId="77397" CreationDate="2008-08-02T12:56:58.590" Score="28" ViewCount="8278" Body="&lt;p&gt;My Rails-app has a sign in box with a &quot;remember me&quot; checkbox. Users who check that box should remain logged in even after closing their browser. I'm keeping track of whether users are logged in by storing their id in the user's session. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;But sessions are implemented in Rails as session cookies, which are not persistent. I can &lt;em&gt;make&lt;/em&gt; them persistent:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;&lt;br&gt; class ApplicationController &amp;lt; ActionController::Base&lt;br&gt; before_filter :update_session_expiration_date&lt;br&gt;&lt;br&gt; private&lt;br&gt;&lt;br&gt; def update_session_expiration_date&lt;br&gt; options = ActionController::Base.session_options&lt;br&gt; unless options[:session_expires]&lt;br&gt; options[:session_expires] = 1.year.from_now&lt;br&gt; end&lt;br&gt; end&lt;br&gt; end&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;But that seems like a hack, which is surprising for such common functionality. Is there a better way?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Gareth's answer is pretty good, but I would still like an answer from someone familiar with Rails 2 (because of its unique CookieSessionStore).&lt;/p&gt;" OwnerUserId="136" LastEditorUserId="2961" LastEditorDisplayName="Stu Thompson" LastEditDate="2008-09-17T08:02:13.893" LastActivityDate="2013-01-27T11:36:27.497" Title="Implementation of &quot;Remember me&quot; in a Rails application" Tags="&lt;ruby-on-rails&gt;&lt;ruby&gt;&lt;http&gt;" AnswerCount="8" CommentCount="0" FavoriteCount="10" />
<row Id="451" PostTypeId="2" ParentId="371" CreationDate="2008-08-02T13:45:57.197" Score="6" Body="&lt;p&gt;Yahoo uses a method called Sender ID, which can be configured at &lt;a href=&quot;http://old.openspf.org/wizard.html?mydomain=stackoverflow.com&quot;&gt;The SPF Setup Wizard&lt;/a&gt; and entered in to your DNS. Also one of the important ones for Exchange, Hotmail, AOL, Yahoo, and others is to have a Reverse DNS for your domain. Those will knock out most of the issues. However you can never prevent a person intentionally blocking your or custom rules.&lt;/p&gt;" OwnerUserId="17" LastActivityDate="2008-08-02T13:45:57.197" CommentCount="2" />
<row Id="467" PostTypeId="2" ParentId="17" CreationDate="2008-08-02T14:57:13.043" Score="8" Body="&lt;p&gt;While you haven't said what you're storing, and you may have a great reason for doing so, often the answer is 'as a filesystem reference' and the actual data is on the filesystem somewhere.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.onlamp.com/pub/a/onlamp/2002/07/11/MySQLtips.html&quot;&gt;http://www.onlamp.com/pub/a/onlamp/2002/07/11/MySQLtips.html&lt;/a&gt;&lt;/p&gt;" OwnerUserId="144" LastActivityDate="2008-08-02T14:57:13.043" CommentCount="0" />
<row Id="469" PostTypeId="1" AcceptedAnswerId="3040" CreationDate="2008-08-02T15:11:16.430" Score="8" ViewCount="1602" Body="&lt;p&gt;I am using the Photoshop's javascript API to find the fonts in a given PSD.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given a font name returned by the API, I want to find the actual physical font file that that font name corresponds to on the disc.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is all happening in a python program running on OSX so I guess I'm looking for one of:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Some Photoshop javascript&lt;/li&gt;&#xA;&lt;li&gt;A Python function&lt;/li&gt;&#xA;&lt;li&gt;An OSX API that I can call from python&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="147" LastEditorUserId="683218" LastEditorDisplayName="Ash" LastEditDate="2014-12-15T23:58:38.667" LastActivityDate="2014-12-15T23:58:38.667" Title="How can I find the full path to a font from its display name on a Mac?" Tags="&lt;python&gt;&lt;osx&gt;&lt;fonts&gt;&lt;photoshop&gt;" AnswerCount="4" CommentCount="0" />
<row Id="470" PostTypeId="1" AcceptedAnswerId="473" CreationDate="2008-08-02T15:11:47.523" Score="8" ViewCount="289" Body="&lt;p&gt;I've been writing a few web services for a .net app, now I'm ready to consume them. I've seen numerous examples where there is homegrown code for consuming the service as opposed to using the auto generated methods Visual Studio creates when adding the web reference. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is there some advantage to this?&lt;/p&gt;&#xA;" OwnerUserId="71" LastEditorDisplayName="user1873471" LastEditDate="2013-01-27T11:47:47.253" LastActivityDate="2013-01-27T11:47:47.253" Title="Homegrown consumption of web services" Tags="&lt;.net&gt;&lt;web-services&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" />
<row Id="471" PostTypeId="2" ParentId="337" CreationDate="2008-08-02T15:21:03.587" Score="24" Body="&lt;p&gt;&lt;a href=&quot;http://effbot.org/zone/element-index.htm&quot;&gt;ElementTree&lt;/a&gt; has a nice pythony API. I think it's even shipped as part of python 2.5&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;It's in pure python and as I say, pretty nice, but if you wind up needing more performance, then &lt;a href=&quot;http://codespeak.net/lxml/&quot;&gt;lxml&lt;/a&gt; exposes the same API and uses libxml2 under the hood. You can theoretically just swap it in when you discover you need it.&lt;/p&gt;" OwnerUserId="147" LastActivityDate="2008-08-02T15:21:03.587" CommentCount="2" />
<row Id="473" PostTypeId="2" ParentId="470" CreationDate="2008-08-02T15:33:13.390" Score="5" Body="&lt;p&gt;No, what you're doing is fine. Don't let those people confuse you.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you've written the web services with .net then the reference proxies generated by .net are going to be quite suitable. The situation you describe (where you are both producer and consumer) is the ideal situation.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you need to connect to a web services that is &lt;em&gt;unknown&lt;/em&gt; at compile time, then you would want a more dynamic approach, where you deduce the 'shape' of the web service. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;But start by using the auto generated proxy class, and don't worry about it until you hit a limitation. And when you do -- come back to stack overflow ;-)&lt;/p&gt;" OwnerUserId="49" LastActivityDate="2008-08-02T15:33:13.390" CommentCount="1" />
<row Id="482" PostTypeId="1" AcceptedAnswerId="509" CreationDate="2008-08-02T16:09:56.780" Score="22" ViewCount="15238" Body="&lt;p&gt;Ok, I'm a web developer, but I find myself dabbling in windows forms projects every now and then. One thing that confounds me to this day is the following.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assume you are doing something like the following&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;List&amp;lt;string&amp;gt; myitems = new List&amp;lt;string&amp;gt;&#xA;{&#xA; &quot;Item 1&quot;,&#xA; &quot;Item 2&quot;,&#xA; &quot;Item 3&quot;&#xA;};&#xA;&#xA;ComboBox box = new ComboBox();&#xA;box.DataSource = myitems;&#xA;&#xA;ComboBox box2 = new ComboBox();&#xA;box2.DataSource = myitems&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So now we have 2 combo boxes bound to that array, and everything works fine. But when you change the value of one combo box, it changes BOTH combo boxes to the one you just selected.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, I know that Arrays are always passed by reference (learned that when i learned C :D), but why on earth would the combo boxes change together? I don't believe the combo box control is modifying the collection at all. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;As a work around, don't this would achieve the funcionality that is expected / desired&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ComboBox box = new ComboBox();&#xA;box.DataSource = myitems.ToArray();&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="77" LastEditorUserId="451518" LastEditorDisplayName="Darren Kopp" LastEditDate="2014-07-28T10:04:53.613" LastActivityDate="2014-07-28T10:04:53.613" Title="WinForms ComboBox data binding gotcha" Tags="&lt;c#&gt;&lt;winforms&gt;&lt;data-binding&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="3" />
<row Id="483" PostTypeId="2" ParentId="438" CreationDate="2008-08-02T16:10:42.817" Score="20" Body="&lt;p&gt;You should almost certainly not be extending the session cookie to be long lived.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Although not dealing specifically with rails &lt;a href=&quot;http://fishbowl.pastiche.org/2004/01/19/persistent_login_cookie_best_practice&quot;&gt;this article&lt;/a&gt; goes to some length to explain 'remember me' best practices.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;In summary though you should:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ul&gt;&#xD;&#xA;&lt;li&gt;Add an extra column to the user table to accept a large random value&lt;/li&gt;&#xD;&#xA;&lt;li&gt;Set a long lived cookie on the client which combines the user id and the random value&lt;/li&gt;&#xD;&#xA;&lt;li&gt;When a new session starts, check for the existence of the id/value cookie and authenticate the new user if they match.&lt;/li&gt;&#xD;&#xA;&lt;/ul&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The author also recommends invalidating the random value and resetting the cookie at every login. Personally I don't like that as you then can't stay logged into a site on two computers. I would tend to make sure my password changing function also reset the random value thus locking out sessions on other machines. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;As a final note, the advice he gives on making certain functions (password change/email change etc) unavailable to auto authenticated sessions is well worth following but rarely seen in the real world.&lt;/p&gt;" OwnerUserId="147" LastActivityDate="2008-08-02T16:10:42.817" CommentCount="3" />
<row Id="497" PostTypeId="2" ParentId="469" CreationDate="2008-08-02T16:56:53.893" Score="1" Body="&lt;p&gt;open up a terminal (Applications-&amp;gt;Utilities-&amp;gt;Terminal) and type this in:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;locate InsertFontHere&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;This will spit out every file that has the name you want.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Warning: there may be alot to wade through.&lt;/p&gt;" OwnerUserId="50" LastActivityDate="2008-08-02T16:56:53.893" CommentCount="0" />
<row Id="502" PostTypeId="1" AcceptedAnswerId="7090" CreationDate="2008-08-02T17:01:58.500" Score="17" ViewCount="7583" Body="&lt;p&gt;I have a cross-platform (Python) application which needs to generate a JPEG preview of the first page of a PDF.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the Mac I am spawning &lt;a href=&quot;http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/sips.1.html&quot;&gt;sips&lt;/a&gt;. Is there something similarly simple I can do on Windows?&lt;/p&gt;&#xA;" OwnerUserId="147" LastEditorUserId="63550" LastEditorDisplayName="Adam Mitz" LastEditDate="2011-04-08T11:42:03.807" LastActivityDate="2011-04-08T11:43:18.457" Title="Get a preview JPEG of a PDF on Windows?" Tags="&lt;python&gt;&lt;windows&gt;&lt;image&gt;&lt;pdf&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="11" />
<row Id="509" PostTypeId="2" ParentId="482" CreationDate="2008-08-02T17:18:12.680" Score="22" Body="&lt;p&gt;This has to do with how data bindings are set up in the dotnet framework, especially the &lt;code&gt;BindingContext&lt;/code&gt;. On a high level it means that if you haven't specified otherwise each form and all the controls of the form share the same &lt;code&gt;BindingContext&lt;/code&gt;. When you are setting the &lt;code&gt;DataSource&lt;/code&gt; property the &lt;code&gt;ComboBox&lt;/code&gt; will use the &lt;code&gt;BindingContext&lt;/code&gt; to get a &lt;code&gt;ConcurrenyMangager&lt;/code&gt; that wraps the list. The &lt;code&gt;ConcurrenyManager&lt;/code&gt; keeps track of such things as the current selected position in the list. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you set the &lt;code&gt;DataSource&lt;/code&gt; of the second &lt;code&gt;ComboBox&lt;/code&gt; it will use the same &lt;code&gt;BindingContext&lt;/code&gt; (the forms) which will yield a reference to the same &lt;code&gt;ConcurrencyManager&lt;/code&gt; as above used to set up the data bindings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To get a more detailed explanation see &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.windows.forms.bindingcontext.aspx&quot;&gt;BindingContext&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="143" LastEditorUserId="967315" LastEditDate="2012-10-14T12:35:03.233" LastActivityDate="2012-10-14T12:35:03.233" CommentCount="0" />
<row Id="514" PostTypeId="1" AcceptedAnswerId="519" CreationDate="2008-08-02T17:26:39.793" Score="10" ViewCount="1309" Body="&lt;p&gt;I have a Ruby on Rails Website that makes HTTP calls to an external Web Service.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;About once a day I get a SystemExit (stacktrace below) error email where a call to the service has failed. If I then try the exact same query on my site moments later it works fine.&#xA;It's been happening since the site went live and I've had no luck tracking down what causes it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Ruby is version 1.8.6 and rails is version 1.2.6.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone else have this problem?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is the error and stacktrace.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;A SystemExit occurred&#xA;/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/fcgi_handler.rb:116:in `exit'&#xA;/usr/local/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/fcgi_handler.rb:116:in `exit_now_handler'&#xA;/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/inflector.rb:250:in `to_proc'&#xA;/usr/local/lib/ruby/1.8/net/protocol.rb:133:in `call'&#xA;/usr/local/lib/ruby/1.8/net/protocol.rb:133:in `sysread'&#xA;/usr/local/lib/ruby/1.8/net/protocol.rb:133:in `rbuf_fill'&#xA;/usr/local/lib/ruby/1.8/timeout.rb:56:in `timeout'&#xA;/usr/local/lib/ruby/1.8/timeout.rb:76:in `timeout'&#xA;/usr/local/lib/ruby/1.8/net/protocol.rb:132:in `rbuf_fill'&#xA;/usr/local/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'&#xA;/usr/local/lib/ruby/1.8/net/protocol.rb:126:in `readline'&#xA;/usr/local/lib/ruby/1.8/net/http.rb:2017:in `read_status_line'&#xA;/usr/local/lib/ruby/1.8/net/http.rb:2006:in `read_new'&#xA;/usr/local/lib/ruby/1.8/net/http.rb:1047:in `request'&#xA;/usr/local/lib/ruby/1.8/net/http.rb:945:in `request_get'&#xA;/usr/local/lib/ruby/1.8/net/http.rb:380:in `get_response'&#xA;/usr/local/lib/ruby/1.8/net/http.rb:543:in `start'&#xA;/usr/local/lib/ruby/1.8/net/http.rb:379:in `get_response'&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="151" LastEditorUserId="1" LastEditorDisplayName="Jeff Atwood" LastEditDate="2008-08-13T12:22:57.990" LastActivityDate="2013-01-09T05:48:04.717" Title="Frequent SystemExit in Ruby when making HTTP calls" Tags="&lt;ruby-on-rails&gt;&lt;ruby&gt;&lt;crash&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="1" />
<row Id="516" PostTypeId="2" ParentId="173" CreationDate="2008-08-02T17:33:54.927" Score="125" Body="&lt;p&gt;Martin Fowler wrote my favorite article on the subject, &lt;a href=&quot;http://martinfowler.com/articles/evodb.html&quot;&gt;http://martinfowler.com/articles/evodb.html&lt;/a&gt;. I choose not to put schema dumps in under version control as &lt;em&gt;alumb&lt;/em&gt; and others suggest because I want an easy way to upgrade my production database.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;For a web application where I'll have a single production database instance, I use two techniques:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;h1&gt;Database Upgrade Scripts&lt;/h1&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;A sequence database upgrade scripts that contain the DDL necessary to move the schema from version N to N+1. (These go in your version control system.) A &lt;em&gt;version_history&lt;/em&gt; table, something like&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;create table VersionHistory (&lt;br&gt; Version int primary key,&lt;br&gt; UpgradeStart datetime not null,&lt;br&gt; UpgradeEnd datetime&lt;br&gt; );&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;gets a new entry every time an upgrade script runs which corresponds to the new version.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;This ensures that it's easy to see what version of the database schema exists and that database upgrade scripts are run only once. Again, these are &lt;strong&gt;not&lt;/strong&gt; database dumps. Rather, each script represents the &lt;strong&gt;changes&lt;/strong&gt; necessary to move from one version to the next. They're the script that you apply to your production database to &quot;upgrade&quot; it.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;h1&gt;Developer Sandbox Synchronization&lt;/h1&gt;&#xD;&#xA;&#xD;&#xA;&lt;ol&gt;&#xD;&#xA;&lt;li&gt;A script to backup, sanitize, and shrink a production database. Run this after each upgrade to the production DB.&lt;/li&gt;&#xD;&#xA;&lt;li&gt;A script to restore (and tweak, if necessary) the backup on a developer's workstation. Each developer runs this script after each upgrade to the production DB.&lt;/li&gt;&#xD;&#xA;&lt;/ol&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;em&gt;A caveat: My automated tests run against a schema-correct but empty database, so this advice will not perfectly suit your needs.&lt;/em&gt;&lt;/p&gt;" OwnerUserId="150" LastActivityDate="2008-08-02T17:33:54.927" CommentCount="5" />
<row Id="518" PostTypeId="2" ParentId="469" CreationDate="2008-08-02T17:42:28.607" Score="0" Body="&lt;p&gt;I haven't been able to find anything that does this directly. I think you'll have to iterate through the various font folders on the system: &lt;code&gt;/System/Library/Fonts&lt;/code&gt;, &lt;code&gt;/Library/Fonts&lt;/code&gt;, and there can probably be a user-level directory as well &lt;code&gt;~/Library/Fonts&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="153" LastEditorUserId="725306" LastEditDate="2013-03-22T09:27:54.323" LastActivityDate="2013-03-22T09:27:54.323" CommentCount="0" />
<row Id="519" PostTypeId="2" ParentId="514" CreationDate="2008-08-02T17:50:34.987" Score="3" Body="&lt;p&gt;Using fcgi with Ruby is known to be very buggy. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Practically everybody has moved to &lt;a href=&quot;http://mongrel.rubyforge.org/&quot; rel=&quot;nofollow&quot;&gt;Mongrel&lt;/a&gt; for this reason, and I recommend you do the same.&lt;/p&gt;" OwnerUserId="136" LastActivityDate="2008-08-02T17:50:34.987" CommentCount="0" />
<row Id="521" PostTypeId="2" ParentId="173" CreationDate="2008-08-02T17:54:50.687" Score="3" Body="&lt;p&gt;You didn't mention any specifics about your target environment or constraints, so this may not be entirely applicable... but if you're looking for a way to effectively track an evolving DB schema and aren't adverse to the idea of using Ruby, ActiveRecord's migrations are right up your alley.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Migrations programatically define database transformations using a Ruby DSL; each transformation can be applied or (usually) rolled back, allowing you to jump to a different version of your DB schema at any given point in time. The file defining these transformations can be checked into version control like any other piece of source code.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Because migrations are a part of &lt;a href=&quot;http://ar.rubyonrails.com/&quot; rel=&quot;nofollow&quot;&gt;ActiveRecord&lt;/a&gt;, they typically find use in full-stack Rails apps; however, you can use ActiveRecord independent of Rails with minimal effort. See &lt;a href=&quot;http://rails.aizatto.com/2007/05/27/activerecord-migrations-without-rails/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for a more detailed treatment of using AR's migrations outside of Rails.&lt;/p&gt;" OwnerUserId="154" LastEditorUserId="154" LastEditorDisplayName="Matt" LastEditDate="2008-08-02T19:22:50.497" LastActivityDate="2008-08-02T19:22:50.497" CommentCount="0" />
<row Id="522" PostTypeId="2" ParentId="88" CreationDate="2008-08-02T17:57:06.033" Score="5" Body="&lt;blockquote&gt;&#xA; &lt;p&gt;So it says microseconds explicitly, but says the resolution of the system clock is unspecified. I suppose resolution in this context means how the smallest amount it will ever be incremented?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;The data structure is defined as having microseconds as a unit of measurement, but that doesn't mean that the clock or operating system is actually capable of measuring that finely.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Like other people have suggested, &lt;code&gt;gettimeofday()&lt;/code&gt; is bad because setting the time can cause clock skew and throw off your calculation. &lt;code&gt;clock_gettime(CLOCK_MONOTONIC)&lt;/code&gt; is what you want, and &lt;code&gt;clock_getres()&lt;/code&gt; will tell you the precision of your clock.&lt;/p&gt;&#xA;" OwnerUserId="156" LastEditorUserId="471164" LastEditorDisplayName="Joe Shaw" LastEditDate="2013-12-19T04:39:01.137" LastActivityDate="2013-12-19T04:39:01.137" CommentCount="3" />
<row Id="525" PostTypeId="2" ParentId="337" CreationDate="2008-08-02T18:04:10.543" Score="1" Body="&lt;p&gt;Since you mentioned that you'll be building &quot;fairly simple&quot; XML, the &lt;a href=&quot;http://www.python.org/doc/current/lib/module-xml.dom.minidom.html&quot; rel=&quot;nofollow&quot;&gt;minidom module&lt;/a&gt; (part of the Python Standard Library) will likely suit your needs. If you have any experience with the DOM representation of XML, you should find the API quite straight forward.&lt;/p&gt;" OwnerUserId="154" LastActivityDate="2008-08-02T18:04:10.543" CommentCount="0" />
<row Id="529" PostTypeId="2" ParentId="180" CreationDate="2008-08-02T18:16:07.867" Score="2" Body="&lt;p&gt;Isn't it also a factor which order you set up the colors?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Like if you use Dillie-Os idea you need to mix the colors as much as possible. &#xD;&#xA;0 64 128 256 is from one to the next. but 0 256 64 128 in a wheel would be more &quot;apart&quot;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Does this make sense?&lt;/p&gt;" OwnerUserId="86" LastActivityDate="2008-08-02T18:16:07.867" CommentCount="0" />
<row Id="530" PostTypeId="2" ParentId="264" CreationDate="2008-08-02T18:21:21.993" Score="0" Body="&lt;p&gt;Doesn't this depend on the hardware as well as number of threads and stuff?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I would make a simple test and run it with increasing amounts of threads hammering and see what seems best.&lt;/p&gt;" OwnerUserId="86" LastActivityDate="2008-08-02T18:21:21.993" CommentCount="0" />
<row Id="531" PostTypeId="2" ParentId="19" CreationDate="2008-08-02T18:22:52.690" Score="110" Body="&lt;p&gt;The &lt;a href=&quot;http://en.wikipedia.org/wiki/Monte_Carlo_method&quot;&gt;Monte Carlo method&lt;/a&gt;, as mentioned, applies some great concepts but it is, clearly, not the fastest --not by a long shot, not by any reasonable usefulness. Also, it all depends on what kind of accuracy you are looking for. The fastest pi I know of is the digits hard coded. Looking at &lt;a href=&quot;http://functions.wolfram.com/Constants/Pi/&quot;&gt;Pi&lt;/a&gt; and &lt;a href=&quot;http://functions.wolfram.com/PDF/Pi.pdf&quot;&gt;Pi[PDF]&lt;/a&gt;, there are a lot of formulas.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here is a method that converges quickly (~14digits per iteration). The current fastest application, &lt;a href=&quot;http://numbers.computation.free.fr/Constants/PiProgram/pifast.html&quot;&gt;PiFast&lt;/a&gt;, uses this formula with the &lt;a href=&quot;http://www.ele.uri.edu/~hansenj/projects/ele436/fft.pdf&quot;&gt;FFT&lt;/a&gt;. I'll just write the formula, since the code is straight forward. This formula was almost found by &lt;a href=&quot;http://numbers.computation.free.fr/Constants/Pi/piramanujan.html&quot;&gt;Ramanujan and discovered by Chudnovsky&lt;/a&gt;. It is actually how he calculated several billion digits of the number --so it isn't a method to disregard. The formula will overflow quickly since we are dividing factorials, it would be advantageous then to delay such calculating to remove terms.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;http://i.stack.imgur.com/aQMkk.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;http://i.stack.imgur.com/2y2l9.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;where,&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;img src=&quot;http://i.stack.imgur.com/QqVnB.gif&quot; alt=&quot;enter image description here&quot;&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Below is the &lt;a href=&quot;http://mathworld.wolfram.com/Brent-SalaminFormula.html&quot;&gt;Brent–Salamin algorithm&lt;/a&gt;. Wikipedia mentions that when a and b are 'close enough' then (a+b)^2/4t will be an approximation of pi. I'm not sure what 'close enough' means, but from my tests, one iteration got 2digits, two got 7, and three had 15, of course this is with doubles, so it might have error based on it's representation and the 'true' calculation could be more accurate.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;let pi_2 iters =&#xA; let rec loop_ a b t p i =&#xA; if i = 0 then a,b,t,p&#xA; else&#xA; let a_n = (a +. b) /. 2.0 &#xA; and b_n = sqrt (a*.b)&#xA; and p_n = 2.0 *. p in&#xA; let t_n = t -. (p *. (a -. a_n) *. (a -. a_n)) in&#xA; loop_ a_n b_n t_n p_n (i - 1)&#xA; in &#xA; let a,b,t,p = loop_ (1.0) (1.0 /. (sqrt 2.0)) (1.0/.4.0) (1.0) iters in&#xA; (a +. b) *. (a +. b) /. (4.0 *. t)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Lastly, how about some pi golf (800 digits)? 160 characters!&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int a=10000,b,c=2800,d,e,f[2801],g;main(){for(;b-c;)f[b++]=a/5;for(;d=0,g=c*2;c-=14,printf(&quot;%.4d&quot;,e+d/a),e=d%a)for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b);}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="157" LastEditorUserId="701092" LastEditorDisplayName="nlucaroni" LastEditDate="2012-11-06T12:26:19.250" LastActivityDate="2012-11-06T12:26:19.250" CommentCount="7" CommunityOwnedDate="2008-09-20T04:48:49.130" />
<row Id="532" PostTypeId="2" ParentId="265" CreationDate="2008-08-02T18:30:34.673" Score="0" Body="&lt;p&gt;Maven helps quite a lot with this problem when I'm coding java. We commit the pom.xml to the scs and the maven repository contains all our dependencies.&#xD;&#xA;For me that seems like a nice way to do it.&lt;/p&gt;" OwnerUserId="86" LastActivityDate="2008-08-02T18:30:34.673" CommentCount="0" />
<row Id="535" PostTypeId="1" AcceptedAnswerId="541" CreationDate="2008-08-02T18:43:54.787" Score="30" ViewCount="8118" Body="&lt;p&gt;I'm starting work on a hobby project with a python codebase and would like to set up some form of continuous integration (i.e. running a battery of test-cases each time a check-in is made and sending nag e-mails to responsible persons when the tests fail) similar to CruiseControl or TeamCity.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I realize I could do this with hooks in most VCSes, but that requires that the tests run on the same machine as the version control server, which isn't as elegant as I would like. Does anyone have any suggestions for a small, user-friendly, open-source continuous integration system suitable for a Python codebase?&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="352841" LastEditorDisplayName="Robert Gamble" LastEditDate="2012-05-02T17:42:47.627" LastActivityDate="2014-01-08T06:50:21.857" Title="Continuous Integration System for a Python Codebase" Tags="&lt;python&gt;&lt;continuous-integration&gt;&lt;extreme-programming&gt;" AnswerCount="8" CommentCount="0" FavoriteCount="13" />
<row Id="536" PostTypeId="2" ParentId="502" CreationDate="2008-08-02T18:49:07.740" Score="6" Body="&lt;p&gt;You can use ImageMagick's convert utility for this, see some examples in &lt;a href=&quot;http://studio.imagemagick.org/pipermail/magick-users/2002-May/002636.html&quot; rel=&quot;nofollow&quot;&gt;http://studio.imagemagick.org/pipermail/magick-users/2002-May/002636.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="161" OwnerDisplayName="Federico " LastEditorUserId="1" LastEditorDisplayName="Jeff Atwood" LastEditDate="2008-08-10T07:36:02.690" LastActivityDate="2008-08-10T07:36:02.673" CommentCount="1" />
<row Id="537" PostTypeId="2" ParentId="263" CreationDate="2008-08-02T18:49:30.390" Score="2" Body="&lt;p&gt;A few things:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You are creating (and not using) an unnecessary toplevel window, named &lt;code&gt;window&lt;/code&gt;. You can just delete these lines:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;window = gtk_window_new(GTK_WINDOW_TOPLEVEL);&lt;br&gt;g_signal_connect(G_OBJECT(window), &quot;delete_event&quot;, G_CALLBACK(delete_event), NULL);&lt;br&gt;g_signal_connect(G_OBJECT(window), &quot;destroy&quot;, G_CALLBACK(destroy), NULL);&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Also, the flow doesn't seem quite right. &lt;code&gt;gtk_main()&lt;/code&gt; starts the GTK main loop, which blocks until something exits it. &lt;code&gt;gtk_dialog_run()&lt;/code&gt; also starts a main loop, but it exits as soon as one of the buttons is clicked.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I think it might be enough for you to remove the &lt;code&gt;gtk_init_add()&lt;/code&gt; and &lt;code&gt;gtk_main()&lt;/code&gt; calls, and simply deal with the return value. Also the &lt;code&gt;gtk_widget_destroy()&lt;/code&gt; call is unnecessary, as the dialog window is automatically destroyed when gtk_dialog_run() returns.&lt;/p&gt;" OwnerUserId="156" LastEditorUserId="156" LastEditorDisplayName="Joe Shaw" LastEditDate="2008-08-02T19:50:01.017" LastActivityDate="2008-08-02T19:50:01.017" CommentCount="0" />
<row Id="538" PostTypeId="2" ParentId="535" CreationDate="2008-08-02T18:56:56.460" Score="21" Body="&lt;p&gt;One possibility is Hudson. It's written in Java, but there's integration with Python projects:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;&lt;a href=&quot;http://redsolo.blogspot.com/2007/11/hudson-embraces-python.html&quot; rel=&quot;nofollow&quot;&gt;Hudson embraces Python&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I've never tried it myself, however.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(&lt;strong&gt;Update&lt;/strong&gt;, Sept. 2011: After a trademark dispute Hudson has been renamed to &lt;a href=&quot;http://jenkins-ci.org/&quot; rel=&quot;nofollow&quot;&gt;Jenkins&lt;/a&gt;.)&lt;/p&gt;&#xA;" OwnerUserId="156" LastEditorDisplayName="user1873471" LastEditDate="2013-01-28T03:54:17.217" LastActivityDate="2013-01-28T03:54:17.217" CommentCount="4" />
<row Id="539" PostTypeId="2" ParentId="180" CreationDate="2008-08-02T19:03:52.170" Score="14" Body="&lt;p&gt;My first thought on this is &quot;how generate N vectors in a space that maximize distance from each other.&quot; You can see that the RGB (or any other scale you use that forms a basis in color space) are just vectors. Take a look at &lt;a href=&quot;http://mathworld.wolfram.com/topics/RandomPointPicking.html&quot;&gt;Random Point Picking&lt;/a&gt;. Hope this is a good start for you! Once you have a set of vectors that are maximized a part, you can save them in a hash table or something for later, and just perform random rotations on them to get all the colors you desire that are maximally apart from each other!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; Thinking about this problem more, it would be better to map the colors in a linear manor, possibly (0,0,0) --&gt; (255,255,255) lexicographically, and then distribute them evenly. I really don't know how well this will work, but it should since, lets say:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;n = 10&#xA;we know we have 16777216 colors (256^3). We can use &lt;a href=&quot;http://stackoverflow.com/questions/561/using-combinations-of-sets-as-test-data#794&quot;&gt;buckles algorithm 515&lt;/a&gt; to find the lexicographically indexed color.&lt;img src=&quot;http://i.stack.imgur.com/gEuCs.gif&quot; alt=&quot;\frac {\binom {256^3} {3}} {n} * i&quot;&gt;. You'll probably have to edit the algorithm to avoid overflow and probably add some minor speed improvements.&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorUserId="1219121" LastEditorDisplayName="nlucaroni" LastEditDate="2012-03-28T17:26:50.197" LastActivityDate="2012-03-28T17:26:50.197" CommentCount="1" />
<row Id="540" PostTypeId="2" ParentId="123" CreationDate="2008-08-02T19:06:38.717" Score="1" Body="&lt;p&gt;AFAIK, there's no ready-made library to do this for you, but producing a tool capable of translating from CSV to XML should only require you to write a crude CSV parser and hook up JDOM (or your XML Java library of choice) with some glue code.&lt;/p&gt;" OwnerUserId="154" LastActivityDate="2008-08-02T19:06:38.717" CommentCount="0" />
<row Id="541" PostTypeId="2" ParentId="535" CreationDate="2008-08-02T19:06:40.667" Score="15" Body="&lt;p&gt;We run &lt;a href=&quot;http://buildbot.net/trac&quot; rel=&quot;nofollow&quot;&gt;Buildbot - Trac&lt;/a&gt; at work, I haven't used it too much since my code base isn't part of the release cycle yet. But we run the tests on different environments (OSX/Linux/Win) and it sends emails --and it's written in python.&lt;/p&gt;" OwnerUserId="157" LastActivityDate="2008-08-02T19:06:40.667" CommentCount="0" />
<row Id="549" PostTypeId="1" AcceptedAnswerId="477578" CreationDate="2008-08-02T19:51:50.250" Score="3049" ViewCount="326418" Body="&lt;h2&gt;Form based authentication for websites&lt;/h2&gt;&#xA;&#xA;&lt;p&gt;We believe that Stack&amp;nbsp;Overflow should not just be a resource for very specific technical questions, but also for general guidelines on how to solve variations on common problems. &quot;Form based authentication for websites&quot; should be a fine topic for such an experiment. &lt;/p&gt;&#xA;&#xA;&lt;h3&gt;It should include topics such as:&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;How to log in&lt;/li&gt;&#xA;&lt;li&gt;How to remain logged in&lt;/li&gt;&#xA;&lt;li&gt;How to store passwords&lt;/li&gt;&#xA;&lt;li&gt;Using secret questions&lt;/li&gt;&#xA;&lt;li&gt;Forgotten username/password functionality&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://openid.net/&quot;&gt;OpenID&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&quot;Remember me&quot; checkbox&lt;/li&gt;&#xA;&lt;li&gt;Browser autocompletion of usernames and passwords&lt;/li&gt;&#xA;&lt;li&gt;Secret URLs (public &lt;a href=&quot;http://en.wikipedia.org/wiki/Form-based_authentication&quot;&gt;URLs&lt;/a&gt; protected by digest)&lt;/li&gt;&#xA;&lt;li&gt;Checking password strength&lt;/li&gt;&#xA;&lt;li&gt;E-mail validation&lt;/li&gt;&#xA;&lt;li&gt;and much more about &lt;a href=&quot;http://en.wikipedia.org/wiki/Form-based_authentication&quot;&gt;form based authentication&lt;/a&gt; ...&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h3&gt;It should not include things like:&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;roles and authorization&lt;/li&gt;&#xA;&lt;li&gt;HTTP basic authentication&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;h3&gt;Please help us by&lt;/h3&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Suggesting subtopics&lt;/li&gt;&#xA;&lt;li&gt;Submitting good articles about this subject&lt;/li&gt;&#xA;&lt;li&gt;Editing the official answer&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;" OwnerUserId="136" LastEditorUserId="1665673" LastEditorDisplayName="Michiel de Mare" LastEditDate="2013-12-25T23:48:19.467" LastActivityDate="2015-03-02T14:31:51.157" Title="The definitive guide to form based website authentication" Tags="&lt;http&gt;&lt;authentication&gt;&lt;language-agnostic&gt;&lt;article&gt;" AnswerCount="12" CommentCount="10" FavoriteCount="4281" CommunityOwnedDate="2008-10-01T00:39:14.900" />
<row Id="551" PostTypeId="2" ParentId="387" CreationDate="2008-08-02T20:03:06.483" Score="3" Body="&lt;p&gt;You may also be interested in the output of the explain() method, which will give you an idea of how things are scored the way they are:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;&lt;a href=&quot;http://lucene.apache.org/java/2_2_0/api/org/apache/lucene/search/Searcher.html#explain&quot; rel=&quot;nofollow&quot; title=&quot;org.apache.lucene.search.Query,%20int&quot;&gt;http://lucene.apache.org/java/2_2_0/api/org/apache/lucene/search/Searcher.html#explain(org.apache.lucene.search.Query,%20int)&lt;/a&gt;&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;and the Explanation object:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;&lt;a href=&quot;http://lucene.apache.org/java/2_2_0/api/org/apache/lucene/search/Explanation.html&quot; rel=&quot;nofollow&quot;&gt;http://lucene.apache.org/java/2_2_0/api/org/apache/lucene/search/Explanation.html&lt;/a&gt;&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;(Ick, scary URLs.)&lt;/p&gt;" OwnerUserId="156" LastActivityDate="2008-08-02T20:03:06.483" CommentCount="0" />
<row Id="555" PostTypeId="2" ParentId="549" CreationDate="2008-08-02T20:40:45.533" Score="241" Body="&lt;h1&gt;Definitive Article&lt;/h1&gt;&#xA;&#xA;&lt;h3&gt;Sending credentials&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;The only practical way to send credentials 100% securely is by using &lt;a href=&quot;http://en.wikipedia.org/wiki/SSL&quot; rel=&quot;nofollow&quot;&gt;SSL&lt;/a&gt;. Using JavaScript to hash the password is not safe. (TODO citation required). There's another secure method called &lt;strong&gt;SRP&lt;/strong&gt;, but it's patented (although it is &lt;a href=&quot;http://srp.stanford.edu/license.txt&quot; rel=&quot;nofollow&quot;&gt;freely licensed&lt;/a&gt;) and there are few good implementations available.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Storing passwords&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Don't ever store passwords as plaintext in the database. Not even if you don't care about the security of your own site. Assume that some of your users will reuse the password of their online bank account. So, store the hashed password, and throw away the original. And make sure the password doesn't show up in access logs or application logs. The best hashing function seems to be &lt;strong&gt;bcrypt&lt;/strong&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Hashes by themselves are also insecure. For instance, identical passwords mean identical hashes--this makes hash lookup tables an effective way of cracking lots of passwords at once. Instead, store the &lt;strong&gt;salted&lt;/strong&gt; hash. A salt is a string appended to the password prior to hashing - use a different (random) salt per user. The salt is a public value, so you can store them with the hash in the database. See &lt;a href=&quot;http://www.codeproject.com/Articles/704865/Salted-Password-Hashing-Doing-it-Right&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; for more on this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This means that you can't send the user their forgotten passwords (because you only have the hash). Don't reset the user's password unless you have authenticated the user (users must prove that they are able to read emails sent to the stored (and validated) email address.)&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Security questions&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Security questions are insecure - avoid using them. Why? Read &lt;strong&gt;&lt;em&gt;PART III: Using Secret Questions&lt;/em&gt;&lt;/strong&gt; in &lt;a href=&quot;http://srp.stanford.edu/license.txt&quot; rel=&quot;nofollow&quot;&gt;@Jens Roland answer&lt;/a&gt; here in this wiki.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Session cookies&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;After the user logs in, the server sends the user a session cookie. The server can retrieve the username or id from the cookie, but nobody else can generate such a cookie (TODO explain mechanisms). Cookies can be hijacked (TODO really? how?), so don't send persistent cookies. If you want to autologin your users, you can set a persistent cookie, but you should set a flag that the user has auto-logged in, and needs to login for real for sensitive operations (TODO is this correct? I think this is what Amazon does.)&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;List of external resources&lt;/h3&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://pdos.csail.mit.edu/papers/webauth:sec10.pdf&quot; rel=&quot;nofollow&quot;&gt;Dos and Don'ts of Client Authentication on the Web (PDF)&lt;/a&gt;&lt;br&gt;&#xA;21 page academic article with many great tips. &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://news.ycombinator.com/item?id=205572&quot; rel=&quot;nofollow&quot;&gt;Ask YC: Best Practices for User Authentication&lt;/a&gt;&lt;br&gt;&#xA;Forum discussion on the subject &lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.codinghorror.com/blog/archives/000953.html&quot; rel=&quot;nofollow&quot;&gt;You're Probably Storing Passwords Incorrectly&lt;/a&gt;&lt;br&gt;&#xA;Introductory article about storing passwords&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://news.ycombinator.com/item?id=55660&quot; rel=&quot;nofollow&quot;&gt;Discussion: Coding Horror: You're Probably Storing Passwords Incorrectly&lt;/a&gt;&lt;br&gt;&#xA;Forum discussion about a Coding Horror article.&lt;/li&gt;&#xA;&lt;li&gt;Never store passwords in a database!&lt;br&gt;&#xA;Another warning about storing passwords in the database.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Password_cracking&quot; rel=&quot;nofollow&quot;&gt;Password cracking&lt;/a&gt;&lt;br&gt;&#xA;Wikipedia article on weaknesses of several password hashing schemes.&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.securityfocus.com/blogs/262&quot; rel=&quot;nofollow&quot;&gt;Enough With The Rainbow Tables: What You Need To Know About Secure Password Schemes&lt;/a&gt;&lt;br&gt;&#xA;Discussion about rainbow tables and how to defend against them, and against other threads. Includes extensive discussion.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="136" LastEditorUserId="2784939" LastEditorDisplayName="hasen j" LastEditDate="2015-03-02T14:31:51.157" LastActivityDate="2015-03-02T14:31:51.157" CommentCount="4" CommunityOwnedDate="2008-10-01T00:39:41.137" />
<row Id="561" PostTypeId="1" AcceptedAnswerId="794" CreationDate="2008-08-02T21:34:24.223" Score="10" ViewCount="4904" Body="&lt;p&gt;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 &lt;code&gt;true&lt;/code&gt; whenever given three lengths that form a valid triangle, I would have specific cases, negative / small / large numbers, values close-to being overflowed, etc.; what is more, main aim is to generate combinations of these values, &lt;em&gt;with&lt;/em&gt; or &lt;em&gt;without&lt;/em&gt; repetition, in order to get a set of test data.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;(inf,0,-1), (5,10,1000), (10,5,5), (0,-1,5), (1000,inf,inf),&#xA;...&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;As a note: I actually know the answer to this, but it might be helpful for others, and a challenge for people here! --will post my answer later on.&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="157" LastEditorDisplayName="user319824" LastEditDate="2014-08-04T18:12:11.370" LastActivityDate="2014-08-04T18:12:11.370" Title="How to use combinations of sets as test data" Tags="&lt;unit-testing&gt;&lt;language-agnostic&gt;&lt;testing&gt;" AnswerCount="5" CommentCount="1" FavoriteCount="5" />
<row Id="562" PostTypeId="1" CreationDate="2008-08-02T21:39:11.733" Score="19" ViewCount="2829" Body="&lt;p&gt;Uploading my first decently sized web app to my shared host provided me with a fresh set of challenges, by which I mean, sleepless nights. The issue was that I had most certainly not developed my application for medium trust (or had any clue what that was.) &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I mitigated all of the issues, save one. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I had written an installer for the admin to be able to specify their connectionstring and other preferences, but I cannot find a way to write to a web.config in medium trust. Does anyone have a solution, or should I just be putting preferences in another file?&lt;/p&gt;&#xA;" OwnerDisplayName="Aaron" LastEditorUserId="4337" LastEditorDisplayName="Gulzar" LastEditDate="2008-11-08T15:45:43.340" LastActivityDate="2010-10-29T08:17:13.370" Title="How to write to Web.Config in Medium Trust?" Tags="&lt;c#&gt;&lt;asp.net&gt;&lt;medium-trust&gt;" AnswerCount="1" CommentCount="1" FavoriteCount="1" />
<row Id="564" PostTypeId="1" AcceptedAnswerId="566" CreationDate="2008-08-02T21:47:34.820" Score="101" ViewCount="84452" Body="&lt;p&gt;I was just sitting at my local &lt;a href=&quot;http://en.wikipedia.org/wiki/Borders_%28UK%29&quot;&gt;Borders&lt;/a&gt; sipping coffee and reading &lt;em&gt;&lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/1430209879&quot;&gt;More Joel on Software&lt;/a&gt;&lt;/em&gt; (for free) when I came across &lt;a href=&quot;http://en.wikipedia.org/wiki/Joel_Spolsky&quot;&gt;Joel Spolsky&lt;/a&gt; saying something about a particular type of programmer knowing the difference between an int and an Integer in Java/C# (Object Oriented Programming Languages).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;After a quick 'brain check,' I realized, to my dismay, that I didn't know the answer.&lt;/p&gt;&#xA;" OwnerUserId="25" LastEditorUserId="63550" LastEditorDisplayName="Chris Reath" LastEditDate="2013-06-10T19:10:33.710" LastActivityDate="2014-08-07T10:50:29.320" Title="What is the difference between an int and an Integer in Java and C#?" Tags="&lt;c#&gt;&lt;java&gt;&lt;integer&gt;&lt;int&gt;" AnswerCount="15" CommentCount="2" FavoriteCount="35" />
<row Id="566" PostTypeId="2" ParentId="564" CreationDate="2008-08-02T21:55:45.477" Score="102" Body="&lt;p&gt;&lt;strong&gt;In Java,&lt;/strong&gt; the 'int' type is a primitive , whereas the 'Integer' type is an object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;In C#,&lt;/strong&gt; the 'int' type is the same as &lt;code&gt;System.Int32&lt;/code&gt; and is &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/s1ax56ch.aspx&quot;&gt;a value type&lt;/a&gt; (ie more like the java 'int'). An integer (just like any other value types) can be &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/yz2be5wk.aspx&quot;&gt;boxed&lt;/a&gt; (&quot;wrapped&quot;) into an object. &lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;The differences between objects and primitives are somewhat beyond the scope of this question, but to summarize: &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Objects&lt;/strong&gt; provide facilities for polymorphism, are passed by reference (or more accurately have references passed by value), and are allocated from the &lt;a href=&quot;http://en.wikipedia.org/wiki/Dynamic_memory_allocation&quot;&gt;heap&lt;/a&gt;. Conversely, &lt;strong&gt;primitives&lt;/strong&gt; are immutable types that are passed by value and are often allocated from the &lt;a href=&quot;http://en.wikipedia.org/wiki/Stack-based_memory_allocation&quot;&gt;stack&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="8521" LastEditorDisplayName="Matt" LastEditDate="2013-09-24T09:16:45.727" LastActivityDate="2013-09-24T09:16:45.727" CommentCount="8" />
<row Id="568" PostTypeId="2" ParentId="564" CreationDate="2008-08-02T22:05:08.093" Score="75" Body="&lt;p&gt;Well, in Java an int is a primitive while an Integer is an Object. Meaning, if you made a new Integer:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Integer i = new Integer(6);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You could call some method on i:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;String s = i.toString();//sets s the string representation of i&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Whereas with an int:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;int i = 6;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;You cannot call any methods on it, because it is simply a primitive. So:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;String s = i.toString();//will not work!!!&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;would produce an error, because int is not an object.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;int is one of the few primitives in Java (along with char and some others). I'm not 100% sure, but I'm thinking that the Integer object more or less just has an int property and a whole bunch of methods to interact with that property (like the toString() method for example). So Integer is a fancy way to work with an int (Just as perhaps String is a fancy way to work with a group of chars).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know that Java isn't C, but since I've never programmed in C this is the closest I could come to the answer. Hope this helps!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html&quot;&gt;Integer object javadoc&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://mindprod.com/jgloss/intvsinteger.html&quot;&gt;Integer Ojbect vs. int primitive comparison&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="1102512" LastEditDate="2013-11-26T00:10:45.857" LastActivityDate="2013-11-26T00:10:45.857" CommentCount="2" />
<row Id="576" PostTypeId="2" ParentId="371" CreationDate="2008-08-02T23:00:53.237" Score="20" Body="&lt;p&gt;Sign up for an account on as many major email providers as possible (gmail/yahoo/hotmail/aol/etc). If you make changes to your emails, either major rewording, changes to the code that sends the emails, changes to your email servers, etc, make sure to send test messages to all your accounts and verify that they are not being marked as spam.&lt;/p&gt;" OwnerUserId="163" LastActivityDate="2008-08-02T23:00:53.237" CommentCount="0" />
<row Id="580" PostTypeId="1" AcceptedAnswerId="586" CreationDate="2008-08-02T23:30:59.090" Score="16" ViewCount="4722" Body="&lt;p&gt;I wonder how you guys manage deployment of a database between 2 SQL Servers, specifically SQL Server 2005.&#xA;Now, there is a development and a live one. As this should be part of a buildscript (standard windows batch, even do with current complexity of those scripts, i might switch to PowerShell or so later), Enterprise Manager/Management Studio Express do not count.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Would you just copy the .mdf File and attach it? I am always a bit careful when working with binary data, as this seems to be a compatiblity issue (even though development and live should run the same version of the server at all time).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Or - given the lack of &quot;EXPLAIN CREATE TABLE&quot; in T-SQL - do you do something that exports an existing database into SQL-Scripts which you can run on the target server? If yes, is there a tool that can automatically dump a given Database into SQL Queries and that runs off the command line? (Again, Enterprise Manager/Management Studio Express do not count).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And lastly - given the fact that the live database already contains data, the deployment may not involve creating all tables but rather checking the difference in structure and ALTER TABLE the live ones instead, which may also need data verification/conversion when existing fields change.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, i hear a lot of great stuff about the &lt;a href=&quot;http://www.red-gate.com/products/index.htm&quot;&gt;Red Gate&lt;/a&gt; products, but for hobby projects, the price is a bit steep.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, what are you using to automatically deploy SQL Server Databases from Test to Live?&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="2641576" LastEditorDisplayName="Mark Harrison" LastEditDate="2014-11-25T20:58:47.550" LastActivityDate="2014-11-25T20:58:47.550" Title="Deploying SQL Server Databases from Test to Live" Tags="&lt;sql-server&gt;&lt;sql-server-2005&gt;&lt;deployment&gt;&lt;release-management&gt;" AnswerCount="14" CommentCount="0" FavoriteCount="4" />
<row Id="582" PostTypeId="2" ParentId="562" CreationDate="2008-08-02T23:33:30.740" Score="11" Body="&lt;p&gt;That actually sounds like IIS's &quot;Low&quot; level. If it is, then you won't be able to write to any file, not just the web.config.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are the levels from IIS's help file:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&#xA;Full (internal) - Specifies unrestricted permissions. Grants the ASP.NET application permissions to access any resource that is subject to operating system security. All privileged operations are supported.&#xA;&lt;/li&gt;&#xA;&#xA;&lt;li&gt;High (web_hightrust.config) - Specifies a high level of code access security, which means that the application cannot do any one of the following things by default:&#xA;&lt;ul&gt;&#xA; &lt;li&gt;Call unmanaged code.&lt;/li&gt;&#xA; &lt;li&gt;Call serviced components.&lt;/li&gt;&#xA; &lt;li&gt;Write to the event log.&lt;/li&gt;&#xA; &lt;li&gt;Access Message Queuing service queues.&lt;/li&gt;&#xA; &lt;li&gt;Access ODBC, OleDb, or Oracle data sources.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Medium (web_mediumtrust.config) - Specifies a medium level of code access security, which means that, in addition to High Trust Level restrictions, the ASP.NET application cannot do any of the following things by default:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Access files outside the application directory.&lt;/li&gt;&#xA;&lt;li&gt;Access the registry.&lt;/li&gt;&#xA;&lt;li&gt;Make network or Web service calls.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Low (web_lowtrust.config) - Specifies a low level of code access security, which means that, in addition to Medium Trust Level restrictions, the application cannot do any of the following things by default:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Write to the file system.&lt;/li&gt;&#xA;&lt;li&gt;Call the Assert method.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/li&gt;&#xA;&lt;li&gt;Minimal (web_minimaltrust.config) - Specifies a minimal level of code access security, which means that the application has only execute permissions.&#xA;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I would suggest that if you are dead set on having an installer, have it create a web.config in memory that the user can save locally and FTP up afterward.&lt;/p&gt;&#xA;" OwnerUserId="149" LastEditorUserId="4337" LastEditorDisplayName="Gulzar" LastEditDate="2008-11-08T15:46:20.983" LastActivityDate="2008-11-08T15:46:20.983" CommentCount="1" />
<row Id="583" PostTypeId="2" ParentId="564" CreationDate="2008-08-02T23:37:10.077" Score="4" Body="&lt;p&gt;In C#, int is just an &lt;strong&gt;&lt;em&gt;alias&lt;/em&gt;&lt;/strong&gt; for &lt;code&gt;System.Int32&lt;/code&gt;, string for &lt;code&gt;System.String&lt;/code&gt;, double for &lt;code&gt;System.Double&lt;/code&gt; etc...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Personally I prefer int, string, double, etc. because they don't require a &lt;code&gt;using System;&lt;/code&gt; statement :) A silly reason, I know...&lt;/p&gt;&#xA;" OwnerUserId="39" LastEditorUserId="2935678" LastEditorDisplayName="huseyint" LastEditDate="2014-06-05T10:12:06.170" LastActivityDate="2014-06-05T10:12:06.170" CommentCount="1" />
<row Id="585" PostTypeId="2" ParentId="580" CreationDate="2008-08-02T23:40:04.733" Score="10" Body="&lt;p&gt;For my projects I alternate between SQL Compare from REd Gate and the Database Publishing Wizard from Microsoft which you can download free&#xD;&#xA;&lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?familyid=56E5B1C5-BF17-42E0-A410-371A838E570A&amp;amp;displaylang=en&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The Wizard isn't as slick as SQL Compare or SQL Data Compare but it does the trick. One issue is that the scripts it generates may need some rearranging and/or editing to flow in one shot.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;On the up side, it can move your schema and data which isn't bad for a free tool.&lt;/p&gt;" OwnerUserId="149" LastActivityDate="2008-08-02T23:40:04.733" CommentCount="0" />
<row Id="586" PostTypeId="2" ParentId="580" CreationDate="2008-08-02T23:51:09.410" Score="14" Body="&lt;p&gt;I've taken to hand-coding all of my DDL (creates/alter/delete) statements, adding them to my .sln as text files, and using normal versioning (using subversion, but any revision control should work). This way, I not only get the benefit of versioning, but updating live from dev/stage is the same process for code and database - tags, branches and so on work all the same.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Otherwise, I agree redgate is expensive if you don't have a company buying it for you. If you can get a company to buy it for you though, it really is worth it!&lt;/p&gt;" OwnerUserId="34" LastEditorUserId="34" LastEditorDisplayName="Karl Seguin" LastEditDate="2008-08-03T00:58:16.573" LastActivityDate="2008-08-03T00:58:16.573" CommentCount="1" />
<row Id="588" PostTypeId="1" AcceptedAnswerId="633" CreationDate="2008-08-03T00:03:58.510" Score="29" ViewCount="34422" Body="&lt;p&gt;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 &lt;a href=&quot;http://en.wikipedia.org/wiki/WebDAV&quot;&gt;WebDAV&lt;/a&gt; to do it, but now I'm leaning away from that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I will be running the site on IIS OR Apache (no preference) on Windows server 2008. A few things I would need to do include adding contacts to a given user's address book, sending emails as a given user and running reports on contacts for a user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;All of this is pretty easy to do with WebDAV, but if there is a better way that doesn't require any functionality that is likely to be deprecated any time soon.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any ideas?&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Update:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Justin, I love the idea of using com objects, I just worry about maintaining a 3rd product to make everything work...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;John, I can write a web service in C# to interface with for these functions and access it with my PHP app, but it's also a little bit out of the way.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So far, I'm not 100% convinced that either of these is better than WebDAV... Can anyone show me where I'm being silly?&lt;/p&gt;&#xA;" OwnerUserId="172" LastEditorUserId="299509" LastEditorDisplayName="Gulzar" LastEditDate="2012-11-26T13:12:51.590" LastActivityDate="2015-01-23T08:14:08.853" Title="Best way to access Exchange using PHP?" Tags="&lt;php&gt;&lt;windows&gt;&lt;exchange-server&gt;&lt;webdav&gt;&lt;mapi&gt;" AnswerCount="8" CommentCount="2" FavoriteCount="14" />
<row Id="589" PostTypeId="2" ParentId="561" CreationDate="2008-08-03T00:04:59.023" Score="0" Body="&lt;p&gt;Interesting question!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would do this by picking combinations, something like the following in python. The hardest part is probably first pass verification, i.e. &lt;code&gt;if f(1,2,3) returns true&lt;/code&gt;, is that a correct result? Once you have verified that, then this is a good basis for regression testing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Probably it's a good idea to make a set of test cases that you know will be all true (e.g. 3,4,5 for this triangle case), and a set of test cases that you know will be all false (e.g. 0,1,inf). Then you can more easily verify the tests are correct.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;# xpermutations from http://code.activestate.com/recipes/190465&#xA;from xpermutations import *&#xA;&#xA;lengths=[-1,0,1,5,10,0,1000,'inf']&#xA;for c in xselections(lengths,3): # or xuniqueselections&#xA; print c&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;pre&gt;&#xA;(-1,-1,-1);&#xA;(-1,-1,0);&#xA;(-1,-1,1);&#xA;(-1,-1,5);&#xA;(-1,-1,10);&#xA;(-1,-1,0);&#xA;(-1,-1,1000);&#xA;(-1,-1,inf);&#xA;(-1,0,-1);&#xA;(-1,0,0);&#xA;...&#xA;&lt;/pre&gt;&#xA;" OwnerUserId="116" LastEditorUserId="231716" LastEditorDisplayName="Mark Harrison" LastEditDate="2011-09-29T15:14:05.817" LastActivityDate="2011-09-29T15:14:05.817" CommentCount="0" />
<row Id="590" PostTypeId="2" ParentId="580" CreationDate="2008-08-03T00:22:03.997" Score="1" Body="&lt;p&gt;If you have a company buying it, Toad from Quest Software has this kind of management functionality built in. It's basically a two-click operation to compare two schemas and generate a sync script from one to the other.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;They have editions for most of the popular databases, including of course Sql Server.&lt;/p&gt;" OwnerUserId="116" LastActivityDate="2008-08-03T00:22:03.997" CommentCount="0" />
<row Id="591" PostTypeId="2" ParentId="580" CreationDate="2008-08-03T00:37:03.903" Score="2" Body="&lt;p&gt;I work the same way Karl does, by keeping all of my SQL scripts for creating and altering tables in a text file that I keep in source control. In fact, to avoid the problem of having to have a script examine the live database to determine what ALTERs to run, I usually work like this:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ul&gt;&#xD;&#xA;&lt;li&gt;On the first version, I place everything during testing into one SQL script, and treat all tables as a CREATE. This means I end up dropping and readding tables a lot during testing, but that's not a big deal early into the project (since I'm usually hacking the data I'm using at that point anyway).&lt;/li&gt;&#xD;&#xA;&lt;li&gt;On all subsequent versions, I do two things: I make a new text file to hold the upgrade SQL scripts, that contain just the ALTERs for that version. And I make the changes to the original, create a fresh database script as well. This way an upgrade just runs the upgrade script, but if we have to recreate the DB we don't need to run 100 scripts to get there.&lt;/li&gt;&#xD;&#xA;&lt;li&gt;Depending on how I'm deploying the DB changes, I'll also usually put a version table in the DB that holds the version of the DB. Then, rather than make any human decisions about which scripts to run, whatever code I have running the create/upgrade scripts uses the version to determine what to run.&lt;/li&gt;&#xD;&#xA;&lt;/ul&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The one thing this will not do is help if part of what you're moving from test to production is data, but if you want to manage structure and not pay for a nice, but expensive DB management package, is really not very difficult. I've also found it's a pretty good way of keeping mental track of your DB.&lt;/p&gt;" OwnerUserId="111" LastActivityDate="2008-08-03T00:37:03.903" CommentCount="0" />
<row Id="594" PostTypeId="1" AcceptedAnswerId="595" CreationDate="2008-08-03T01:15:08.507" Score="11" ViewCount="13967" Body="&lt;p&gt;There are several ways to iterate over a result set, which way is the best?&lt;/p&gt;&#xA;" OwnerUserId="116" LastEditorUserId="1399491" LastEditorDisplayName="Mark Harrison" LastEditDate="2012-07-02T15:23:39.457" LastActivityDate="2012-07-02T15:23:39.457" Title="cx_Oracle - what is the best way to iterate over a result set?" Tags="&lt;python&gt;&lt;sql&gt;&lt;database&gt;&lt;oracle&gt;&lt;cx-oracle&gt;" AnswerCount="3" CommentCount="1" FavoriteCount="3" />
<row Id="595" PostTypeId="2" ParentId="594" CreationDate="2008-08-03T01:17:36.393" Score="14" Body="&lt;p&gt;There are three ways to iterate over a result set. The best way in terms of both&#xD;&#xA;readability and performance is usually to use the built-in cursor iterator.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;curs.execute('select * from people')&#xD;&#xA;for row in curs:&#xD;&#xA; print row&#xD;&#xA;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You can fetch all the rows into a list, but this can have some bad&#xD;&#xA;side effects if the result set is large.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ul&gt;&#xD;&#xA;&lt;li&gt;&lt;p&gt;You have to wait for the entire result set to be returned to&#xD;&#xA;your client process.&lt;/p&gt;&lt;/li&gt;&#xD;&#xA;&lt;li&gt;&lt;p&gt;You may eat up a lot of memory in your client to hold&#xD;&#xA;the built-up list.&lt;/p&gt;&lt;/li&gt;&#xD;&#xA;&lt;li&gt;&lt;p&gt;It may take a while for Python to construct and deconstruct the&#xD;&#xA;list which you are going to immediately discard anyways.&lt;/p&gt;&lt;/li&gt;&#xD;&#xA;&lt;/ul&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;for row in curs.fetchall():&#xD;&#xA; print row&#xD;&#xA;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Finally, you can loop over the result set fetching one row at &#xD;&#xA;a time. In general, there's no particular advantage in doing this over&#xD;&#xA;using the iterator. If there is something in your programming logic&#xD;&#xA;that seems to indicate there is an advantage in doing this, perhaps&#xD;&#xA;you should reconsider your programming logic.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;/p&gt;&lt;pre&gt;row = curs.fetchone()&#xD;&#xA;while row:&#xD;&#xA; print row&#xD;&#xA; row = curs.fetchone()&lt;pre&gt;&lt;/pre&gt;&lt;/pre&gt;" OwnerUserId="116" LastActivityDate="2008-08-03T01:17:36.393" CommentCount="2" />
<row Id="597" PostTypeId="2" ParentId="580" CreationDate="2008-08-03T01:38:02.640" Score="1" Body="&lt;p&gt;I agree that scripting everything is the best way to go and is what I advocate at work. You should script everything from DB and object creation to populating your lookup tables.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Anything you do in UI only won't translate (especially for changes... not so much for first deployments) and will end up requiring a tools like what Redgate offers.&lt;/p&gt;" OwnerUserId="76" LastActivityDate="2008-08-03T01:38:02.640" CommentCount="0" />
<row Id="598" PostTypeId="2" ParentId="371" CreationDate="2008-08-03T01:39:56.117" Score="14" Body="&lt;p&gt;Confirm that you have the correct email address before sending out emails. If someone gives the wrong email address on sign-up, beat them over the head about it ASAP.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Always include clear &quot;how to unsubscribe&quot; information in EVERY email. Do not require the user to login to unsubscribe, it should be a unique url for 1-click unsubscribe.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;This will prevent people from marking your mails as spam because &quot;unsubscribing&quot; is too hard.&lt;/p&gt;" OwnerUserId="175" OwnerDisplayName="engtech" LastActivityDate="2008-08-03T01:39:56.117" CommentCount="1" />
<row Id="599" PostTypeId="2" ParentId="173" CreationDate="2008-08-03T01:49:58.983" Score="1" Body="&lt;p&gt;The typical solution is to dump the database as necessary and backup those files.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Depending on your development platform, there may be opensource plugins available. Rolling your own code to do it is usually fairly trivial.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Note: You may want to backup the database dump instead of putting it into version control. The files can get huge fast in version control, and cause your entire source control system to become slow (I'm recalling a CVS horror story at the moment).&lt;/p&gt;" OwnerUserId="175" OwnerDisplayName="engtech" LastActivityDate="2008-08-03T01:49:58.983" CommentCount="0" />
<row Id="600" PostTypeId="2" ParentId="438" CreationDate="2008-08-03T01:53:49.707" Score="1" Body="&lt;p&gt;This is a pretty good write-up of one guys experience of creating 30-day persistent sessions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;WARNING: blog post is from 2006&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://grahamglass.blogs.com/main/2006/05/rails%5Fsessionsr.html&quot; rel=&quot;nofollow&quot;&gt;http://grahamglass.blogs.com/main/2006/05/rails_sessionsr.html&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="175" OwnerDisplayName="engtech" LastEditorUserId="8047" LastEditDate="2009-07-02T00:57:54.833" LastActivityDate="2009-07-02T00:57:54.833" CommentCount="0" />
<row Id="601" PostTypeId="1" AcceptedAnswerId="602" CreationDate="2008-08-03T02:05:59.620" Score="19" ViewCount="869" Body="&lt;p&gt;I'm looking for a performant, reasonably robust RNG using no special hardware. It can use mathematical methods (Mersenne Twister, etc), it can &quot;collect entropy&quot; from the machine, whatever. On Linux/etc we have a drand48() which generates 48 random bits. I'd like a similar function/class for C++ or C# which can generate more than 32 bits of randomness and which low-order bits are equally as random as high-order bits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It doesn't have to be cryptographically secure but it must not use or be based on the C-language rand() or .NET System.Random.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any source code, links to source, etc. would be appreciated! Failing that, what TYPE of RNG should I be looking for?&lt;/p&gt;&#xA;" OwnerDisplayName="user2189331" LastEditorUserId="1270384" LastEditDate="2012-09-11T00:02:34.993" LastActivityDate="2014-08-20T22:19:23.343" Title="Robust Random Number Generation" Tags="&lt;c#&gt;&lt;c++&gt;&lt;random&gt;" AnswerCount="5" CommentCount="3" FavoriteCount="2" ClosedDate="2012-09-11T00:41:28.240" />
<row Id="602" PostTypeId="2" ParentId="601" CreationDate="2008-08-03T02:18:57.987" Score="18" Body="&lt;p&gt;For C++, &lt;a href=&quot;http://www.boost.org/libs/random/&quot;&gt;Boost.Random&lt;/a&gt; is probably what you're looking for. It has support for MT (among many other algorithms), and can collect entropy via the &lt;code&gt;nondet_random&lt;/code&gt; class. Check it out! :-)&lt;/p&gt;" OwnerUserId="13" LastActivityDate="2008-09-20T07:27:11.447" CommentCount="0" />
<row Id="605" PostTypeId="2" ParentId="601" CreationDate="2008-08-03T02:26:33.213" Score="7" Body="&lt;p&gt;&lt;a href=&quot;http://www.gnu.org/software/gsl&quot;&gt;The Gnu Scientific Library&lt;/a&gt; (GSL) has a pretty extensive set of RN generators, test harness, etc. If you're on linux, it's probably already available on your system.&lt;/p&gt;" OwnerUserId="116" LastEditorUserId="116" LastEditorDisplayName="Mark Harrison" LastEditDate="2008-08-03T02:38:04.783" LastActivityDate="2008-09-20T07:27:11.447" CommentCount="0" />
<row Id="607" PostTypeId="2" ParentId="263" CreationDate="2008-08-03T02:30:05.907" Score="9" Body="&lt;p&gt;Hmm, ok. I'd suggest code like this, then:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;typedef struct {&lt;br&gt; int type;&lt;br&gt; int result;&lt;br&gt;} DialogData;&lt;br&gt;&lt;br&gt;static gboolean&lt;br&gt;display_dialog(gpointer user_data)&lt;br&gt;{&lt;br&gt; DialogData *dialog_data = user_data;&lt;br&gt; GtkWidget *dialog;&lt;br&gt;&lt;br&gt; if (dialog_data-&amp;gt;type &amp;amp; MB_YESNO)&lt;br&gt; dialog = gtk_message_dialog_new(...);&lt;br&gt; else&lt;br&gt; dialog = gtk_message_dialog_new(...);&lt;br&gt;&lt;br&gt; // Set title, etc.&lt;br&gt;&lt;br&gt; dialog_data-&amp;gt;result = gtk_dialog_run(...);&lt;br&gt;&lt;br&gt; gtk_main_quit(); // Quits the main loop run in MessageBox()&lt;br&gt;&lt;br&gt; return FALSE;&lt;br&gt;}&lt;br&gt;&lt;br&gt;int MessageBox(...)&lt;br&gt;{&lt;br&gt; DialogData dialog_data;&lt;br&gt;&lt;br&gt; dialog_data.type = type;&lt;br&gt;&lt;br&gt; gtk_idle_add(display_dialog, &amp;amp;dialog_data);&lt;br&gt;&lt;br&gt; gtk_main();&lt;br&gt;&lt;br&gt; // Do stuff based on dialog_data.result&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The struct is because you need to pass around a couple pieces of data. The &lt;code&gt;gtk_idle_add()&lt;/code&gt; call adds a method to be run when the main loop is running and idle, and the &lt;code&gt;FALSE&lt;/code&gt; return value from the &lt;code&gt;display_dialog()&lt;/code&gt; call means that it's only run once. After we get the result from the dialog, we quit the main loop. That'll cause the &lt;code&gt;gtk_main()&lt;/code&gt; in your main &lt;code&gt;MessageBox()&lt;/code&gt; method to return, and you'll be able to access the result from there.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;" OwnerUserId="156" LastActivityDate="2008-08-03T02:30:05.907" CommentCount="0" />
<row Id="608" PostTypeId="2" ParentId="564" CreationDate="2008-08-03T02:32:50.690" Score="16" Body="&lt;p&gt;I'll add to the excellent answers given above, and talk about boxing and unboxing, and how this applies to Java (although C# has it too). I'll use just Java terminology, because I am more &lt;em&gt;au fait&lt;/em&gt; with that.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;As the answers mentioned, &lt;code&gt;int&lt;/code&gt; is just a number (called the &lt;em&gt;unboxed&lt;/em&gt; type), whereas &lt;code&gt;Integer&lt;/code&gt; is an object (which contains the number, hence a &lt;em&gt;boxed&lt;/em&gt; type). In Java terms, that means (apart from not being able to call methods on &lt;code&gt;int&lt;/code&gt;), you cannot store &lt;code&gt;int&lt;/code&gt; or other non-object types in collections (&lt;code&gt;List&lt;/code&gt;, &lt;code&gt;Map&lt;/code&gt;, etc.). In order to store them, you must first box them up in its corresponding boxed type.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Java 5 onwards have something called &lt;em&gt;auto-boxing&lt;/em&gt; and &lt;em&gt;auto-unboxing&lt;/em&gt; which allow the boxing/unboxing to be done behind the scenes. Compare and contrast: Java 5 version:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;Deque&amp;lt;Integer&amp;gt; queue;&lt;br&gt;&lt;br&gt;void add(int n) {&lt;br&gt; queue.add(n);&lt;br&gt;}&lt;br&gt;&lt;br&gt;int remove() {&lt;br&gt; return queue.remove();&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Java 1.4 or earlier (no generics either):&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;Deque queue;&lt;br&gt;&lt;br&gt;void add(int n) {&lt;br&gt; queue.add(Integer.valueOf(n));&lt;br&gt;}&lt;br&gt;&lt;br&gt;int remove() {&lt;br&gt; return ((Integer) queue.remove()).intValue();&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;It must be noted that despite the brevity in the Java 5 version, both versions generate identical bytecode. Thus, although auto-boxing and auto-unboxing is very convenient because you write less code, these operations &lt;em&gt;do&lt;/em&gt; happen behind the scenes, with the same runtime costs, so you still have to be aware of their existence.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Hope this helps!&lt;/p&gt;" OwnerUserId="13" LastEditorUserId="13" LastEditorDisplayName="Chris Jester-Young" LastEditDate="2008-08-03T05:10:24.710" LastActivityDate="2008-08-03T05:10:24.710" CommentCount="1" />
<row Id="609" PostTypeId="1" CreationDate="2008-08-03T02:48:43.497" Score="9" ViewCount="2061" Body="&lt;p&gt;An MFC application that I'm trying to migrate uses &lt;code&gt;afxext.h&lt;/code&gt;, which causes &lt;code&gt;_AFXDLL&lt;/code&gt; to get set, which causes this error if I set &lt;code&gt;/MT&lt;/code&gt;:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;Please use the /MD switch for _AFXDLL builds&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;My research to date indicates that it is impossible to build an application for execution on Windows NT 4.0 using Visual Studio (C++, in this case) 2005.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Is this really true? Are there any workaround available?&lt;/p&gt;&#xA;" OwnerUserId="179" LastEditorUserId="7116" LastEditorDisplayName="ΤΖΩΤΖΙΟΥ" LastEditDate="2012-05-01T17:33:22.013" LastActivityDate="2015-02-04T09:58:11.880" Title="Build for Windows NT 4.0 using Visual Studio 2005?" Tags="&lt;c++&gt;&lt;visual-studio&gt;&lt;compatibility&gt;&lt;windows-nt&gt;" AnswerCount="5" CommentCount="1" FavoriteCount="1" />
<row Id="611" PostTypeId="2" ParentId="588" CreationDate="2008-08-03T03:07:30.150" Score="3" Body="&lt;p&gt;I'm not a PHP dev but Google says that PHP 5+ can instantiate COM components. If you can install Outlook on a box you could write a PHP web service around the COM component to handle the requests you need. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;$outlook = COM(&quot;Outlook.Application&quot;)&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa193231.aspx&quot; rel=&quot;nofollow&quot;&gt;Outlook API referance&lt;/a&gt;&lt;/p&gt;" OwnerUserId="173" LastActivityDate="2008-08-03T03:07:30.150" CommentCount="0" />
<row Id="619" PostTypeId="2" ParentId="514" CreationDate="2008-08-03T05:22:20.457" Score="4" Body="&lt;p&gt;It's been awhile since I used FCGI but I think a FCGI process could throw a SystemExit if the thread was taking too long. This could be the web service not responding or even a slow DNS query. Some google results show a similar error with Python and FCGI so moving to mongrel would be a good idea. &lt;a href=&quot;http://blog.codahale.com/2006/06/19/time-for-a-grown-up-server-rails-mongrel-apache-capistrano-and-you/&quot; rel=&quot;nofollow&quot;&gt;This post&lt;/a&gt; is my reference I used to setup mongrel and I still refer back to it.&lt;/p&gt;&#xA;" OwnerUserId="183" LastEditorUserId="1471203" LastEditDate="2013-01-09T05:47:56.510" LastActivityDate="2013-01-09T05:47:56.510" CommentCount="0" />
<row Id="622" PostTypeId="1" AcceptedAnswerId="623" CreationDate="2008-08-03T05:45:21.423" Score="31" ViewCount="28478" Body="&lt;p&gt;I want to print the first 10000 prime numbers.&#xD;&#xA;Can anyone give me the most efficient code for this?&#xD;&#xA;Clarifications:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ol&gt;&#xD;&#xA;&lt;li&gt;It does not matter if your code is inefficient for n &amp;gt;10000.&lt;/li&gt;&#xD;&#xA;&lt;li&gt;The size of the code does not matter.&lt;/li&gt;&#xD;&#xA;&lt;li&gt;You cannot just hard code the values in any manner.&lt;/li&gt;&#xD;&#xA;&lt;/ol&gt;" OwnerUserId="184" OwnerDisplayName="Niyaz" LastEditorUserId="1261166" LastEditDate="2012-08-07T09:41:33.377" LastActivityDate="2014-09-09T00:40:33.737" Title="Most efficient code for the first 10000 prime numbers?" Tags="&lt;performance&gt;&lt;algorithm&gt;&lt;primes&gt;" AnswerCount="20" CommentCount="3" FavoriteCount="19" />
<row Id="623" PostTypeId="2" ParentId="622" CreationDate="2008-08-03T06:03:35.973" Score="32" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Sieve_of_Atkin&quot;&gt;The Sieve of Atkin&lt;/a&gt; is probably what you're looking for, its upper bound running time is O(N/log log N).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you only run the numbers 1 more and 1 less than the multiples of 6, it could be even faster, as all prime numbers above 3 are 1 away from some multiple of six. &#xA;&lt;a href=&quot;http://primes.utm.edu/notes/faq/six.html&quot;&gt;Resource for my statement&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="154" LastEditorUserId="718379" LastEditDate="2013-03-01T06:44:35.933" LastActivityDate="2013-03-01T06:44:35.933" CommentCount="4" />
<row Id="626" PostTypeId="1" AcceptedAnswerId="723" CreationDate="2008-08-03T06:40:54.120" Score="234" ViewCount="50885" Body="&lt;p&gt;In Ruby 1.8, there are subtle differences between proc/lambda on the one hand, and &lt;code&gt;Proc.new&lt;/code&gt; on the other. &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;What are those differences?&lt;/li&gt;&#xA;&lt;li&gt;Can you give guidelines on how to decide which one to choose?&lt;/li&gt;&#xA;&lt;li&gt;In Ruby 1.9, proc and lambda are different. What's the deal?&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="136" LastEditorUserId="211563" LastEditorDisplayName="Michiel de Mare" LastEditDate="2012-05-18T06:25:18.533" LastActivityDate="2014-12-03T19:32:14.303" Title="When to use lambda, when to use Proc.new?" Tags="&lt;ruby&gt;&lt;lambda&gt;&lt;proc&gt;" AnswerCount="13" CommentCount="2" FavoriteCount="119" />
<row Id="629" PostTypeId="2" ParentId="626" CreationDate="2008-08-03T07:28:54.070" Score="33" Body="&lt;p&gt;I found &lt;a href=&quot;http://raulparolari.com/Ruby2/lambda_Proc&quot;&gt;this page&lt;/a&gt; which shows what the difference between Proc.new and lambda are. According to the page, the only difference is that a lambda is strict about the number of arguments it accepts, whereas Proc.new converts missing arguments to nil. Here is an example IRB session illustrating the difference:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;irb(main):001:0&gt; l = lambda { |x, y| x + y }&#xA;=&gt; #&amp;lt;Proc:0x00007fc605ec0748@(irb):1&amp;gt;&#xA;irb(main):002:0&gt; p = Proc.new { |x, y| x + y }&#xA;=&gt; #&amp;lt;Proc:0x00007fc605ea8698@(irb):2&amp;gt;&#xA;irb(main):003:0&gt; l.call &quot;hello&quot;, &quot;world&quot;&#xA;=&gt; &quot;helloworld&quot;&#xA;irb(main):004:0&gt; p.call &quot;hello&quot;, &quot;world&quot;&#xA;=&gt; &quot;helloworld&quot;&#xA;irb(main):005:0&gt; l.call &quot;hello&quot;&#xA;ArgumentError: wrong number of arguments (1 for 2)&#xA; from (irb):1&#xA; from (irb):5:in `call'&#xA; from (irb):5&#xA; from :0&#xA;irb(main):006:0&gt; p.call &quot;hello&quot;&#xA;TypeError: can't convert nil into String&#xA; from (irb):2:in `+'&#xA; from (irb):2&#xA; from (irb):6:in `call'&#xA; from (irb):6&#xA; from :0&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The page also recommends using lambda unless you specifically want the error tolerant behavior. I agree with this sentiment. Using a lambda seems a tad more concise, and with such an insignificant difference, it seems the better choice in the average situation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for Ruby 1.9, sorry, I haven't looked into 1.9 yet, but I don't imagine they would change it all that much (don't take my word for it though, it seems you have heard of some changes, so I am probably wrong there).&lt;/p&gt;&#xA;" OwnerUserId="122" OwnerDisplayName="Mike Stone" LastEditorUserId="122" LastEditDate="2010-09-08T19:21:00.093" LastActivityDate="2010-09-08T19:21:00.093" CommentCount="3" />
<row Id="633" PostTypeId="2" ParentId="588" CreationDate="2008-08-03T07:50:37.617" Score="12" Body="&lt;p&gt;I have not used PHP to do this but have experience in using C# to achieve the same thing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The Outlook API is a way of automating Outlook rather than connecting to Exchange directly. I have previously taken this approach in a C# application and it does work although can be buggy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you wish to connect directly to the Exchange server you will need to research extended MAPI.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In the past I used this wrapper &lt;a href=&quot;http://www.codeproject.com/KB/IP/CMapiEx.aspx&quot; rel=&quot;nofollow&quot;&gt;MAPIEx: Extended MAPI Wrapper&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It is a C# project but I believe you can use some .NET code on a PHP5 Windows server. Alternatively it has a C++ core DLL that you may be a able to use. I have found it to be very good and there are some good example applications.&lt;/p&gt;&#xA;&#xA;&lt;h3&gt;Update:&lt;/h3&gt;&#xA;&#xA;&lt;p&gt;Sorry for the delay no current way to keep track of posts yet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I do agree adding more layer on to your application and relying on 3rd party code can be scary (and rightfully so.)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Today I read another &lt;a href=&quot;http://stackoverflow.com/questions/4508/mapi-and-managed-code-experiences&quot;&gt;interesting post&lt;/a&gt; tagged up as MAPI that is on a different subject. The key thing here though is that it has linked to &lt;a href=&quot;http://blogs.msdn.com/mstehle/archive/2007/10/03/fyi-why-are-mapi-and-cdo-1-21-not-supported-in-managed-net-code.aspx&quot; rel=&quot;nofollow&quot;&gt;this important MS article&lt;/a&gt;. I have been unaware of the issues until now on using managed code to interface to MAPI although the C++ code in the component should be unaffected by this error as it is unmanaged. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;This blog entry also suggests other ways to connect to MAPI/Exchange server. In this case due to these new facts &lt;a href=&quot;http://us3.php.net/imap&quot; rel=&quot;nofollow&quot;&gt;http://us3.php.net/imap&lt;/a&gt; may be the answer as suggested by the other user.&lt;/p&gt;&#xA;" OwnerUserId="33" LastEditorDisplayName="user1873471" LastEditDate="2013-01-27T11:35:54.863" LastActivityDate="2013-01-27T11:35:54.863" CommentCount="0" />
<row Id="635" PostTypeId="2" ParentId="337" CreationDate="2008-08-03T08:34:57.103" Score="2" Body="&lt;p&gt;I write a SOAP server that receives XML requests, and creates XML responses. (Unfortunately, it's not my project, so it's closed source, but that's another problem).&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;It turned out for me that creating (SOAP) XML documents is fairly simple, if you have a data structure that &quot;fits&quot; the schema.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I keep the envelope, since the response envelope is (almost) the same as the request envelope. Then, since my data structure is a (possibly nested) dictionary, I create a string that turns this dictionary into &amp;lt;key&gt;value&amp;lt;/key&gt; items. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;This is a task that recursion makes simple, and I end up with the right structure. This is all done in python code, and is currently fast enough for production use.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You can also (relatively) easily build lists as well, although depending upon your client, you may hit problems unless you give length hints.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;For me, this was much simpler, since a dictionary is a much easier way of working than some custom class. For the books, generating XML is much easier than parsing!&lt;/p&gt;" OwnerUserId="188" LastActivityDate="2008-08-03T08:34:57.103" CommentCount="0" />
<row Id="644" PostTypeId="1" AcceptedAnswerId="665" CreationDate="2008-08-03T09:55:26.257" Score="24" ViewCount="4726" Body="&lt;p&gt;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:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Delete both rows and re-insert them&lt;/li&gt;&#xA;&lt;li&gt;Update rows with some other value&#xA;and swap and then update to actual value.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;But I don't want to go for these as they do not seem to be the appropriate solution to the problem.&#xA;Could anyone help me out?&lt;/p&gt;&#xA;" OwnerUserId="191" OwnerDisplayName="Ramesh Soni" LastEditorUserId="1332690" LastEditDate="2012-04-25T04:46:28.387" LastActivityDate="2012-09-15T12:38:09.643" Title="Swap unique indexed column values in database" Tags="&lt;sql&gt;&lt;database&gt;" AnswerCount="9" CommentCount="0" FavoriteCount="3" />
<row Id="645" PostTypeId="2" ParentId="514" CreationDate="2008-08-03T09:56:21.607" Score="0" Body="&lt;p&gt;Yeah, I remember now - I worked out that it was a system timeout.&#xA;But the timeout should have been caught by my exception handling code - but it never was.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;That Mongrel post looks pretty useful.&lt;/p&gt;&#xA;" OwnerUserId="151" LastEditorUserId="1471203" LastEditDate="2013-01-09T05:48:04.717" LastActivityDate="2013-01-09T05:48:04.717" CommentCount="0" />
<row Id="650" PostTypeId="1" AcceptedAnswerId="655" CreationDate="2008-08-03T11:12:52.463" Score="61" ViewCount="32937" Body="&lt;p&gt;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. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I'm also using a settings file and in earlier attempts when the assembly version changed my settings got reset to the default since the application looked for the settings file in another directory. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I would like to be able to display a version number in the form of 1.1.38 so when a user finds a problem I can log the version they are using as well as tell them to upgrade if they have an old release.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;A short explanation of how the versioning works would also be appreciated. When does the build and revision number get incremented?&lt;/p&gt;" OwnerUserId="143" LastEditorUserId="868546" LastEditorDisplayName="Robert Höglund" LastEditDate="2012-08-01T21:03:09.177" LastActivityDate="2013-03-04T21:07:55.040" Title="Automatically update version number" Tags="&lt;c#&gt;&lt;visual-studio&gt;&lt;versioning&gt;" AnswerCount="6" CommentCount="1" FavoriteCount="29" />
<row Id="651" PostTypeId="1" AcceptedAnswerId="725" CreationDate="2008-08-03T11:21:54.520" Score="14" ViewCount="5955" Body="&lt;p&gt;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.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've got Windows authentication mode set in the Web.config, disabled anonymous access and configured the correct default domain in IIS, but it's still asking the user to log in and, more annoyingly, the user is required to provide the domain too (&lt;em&gt;DOMAIN\auser&lt;/em&gt;), which is causing problems with non-technical visitors. Thank Zeus for password remembering functionality.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not the network administrator so it's possible that something about Active Directory is set up incorrectly, or it could just be me missing something very simple. Please note that I don't want to impersonate the user, I just need to know that the IPrincipal.Name property matches that of a valid record in my user database, hence authenticating the user to my application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To this end, it would be very useful to have a checklist of all configuration requirements for AD, ASP.NET and IIS to work together in this manner as a reference for debugging and hopefully reducing some user friction.&lt;/p&gt;&#xA;" OwnerUserId="192" LastEditorUserId="5640" LastEditorDisplayName="Rich B" LastEditDate="2009-03-10T03:47:54.460" LastActivityDate="2009-03-10T03:47:54.460" Title="Checklist for IIS 6/ASP.NET Windows Authentication?" Tags="&lt;asp.net&gt;&lt;iis&gt;&lt;authentication&gt;&lt;active-directory&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" />
<row Id="655" PostTypeId="2" ParentId="650" CreationDate="2008-08-03T11:41:38.490" Score="57" Body="&lt;p&gt;With the &quot;Built in&quot; stuff, you can't, as using 1.0.* or 1.0.0.* will replace the revision and build numbers with a coded date/timestamp, which is usually also a good way. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For more info, see the &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/c405shex%28vs.80%29.aspx&quot;&gt;Assembly Linker&lt;/a&gt; Documentation in the /v tag.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As for automatically incrementing numbers, use the AssemblyInfo Task:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://code.msdn.microsoft.com/AssemblyInfoTaskvers&quot;&gt;AssemblyInfo Task&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This can be configured to automatically increment the build number.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are 2 Gotchas:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Each of the 4 numbers in the Version string is limited to 65535. This is a Windows Limitation and unlikely to get fixed.&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://blogs.msdn.com/msbuild/archive/2007/01/03/why-are-build-numbers-limited-to-65535.aspx&quot;&gt;Why are build numbers limited to 65535?&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Using with with Subversion requires a small change:&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.andrewconnell.com/blog/archive/2006/08/29/4078.aspx&quot;&gt;Using MSBuild to generate assembly version info at build time (including SubVersion fix)&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;Retrieving the Version number is then quite easy:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Version v = Assembly.GetExecutingAssembly().GetName().Version;&#xA;string About = string.Format(CultureInfo.InvariantCulture, @&quot;YourApp Version {0}.{1}.{2} (r{3})&quot;, v.Major, v.Minor, v.Build, v.Revision);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;And, to clarify: In .net or at least in C#, the build is actually the THIRD number, not the fourth one as some people (for example Delphi Developers who are used to Major.Minor.Release.Build) might expect.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In .net, it's Major.Minor.Build.Revision.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorDisplayName="user1873471" LastEditDate="2013-01-28T04:10:16.497" LastActivityDate="2013-01-28T04:10:16.497" CommentCount="2" />
<row Id="657" PostTypeId="1" AcceptedAnswerId="669" CreationDate="2008-08-03T11:50:33.137" Score="12" ViewCount="3247" Body="&lt;p&gt;What is the fastest, yet secure way to encrypt passwords in (PHP Prefered), and for which ever method you choose is it portable?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In other words if I later migrate my website to a different server will my passwords continue to work?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The method I am using now as I was told is dependent on the exact versions of the libraries installed on the server.&lt;/p&gt;&#xA;" OwnerUserId="115" LastEditorUserId="683218" LastEditorDisplayName="Unkwntech" LastEditDate="2014-12-16T00:02:50.807" LastActivityDate="2014-12-16T00:02:50.807" Title="Encrypting Passwords" Tags="&lt;encryption&gt;&lt;passwords&gt;" AnswerCount="6" CommentCount="0" FavoriteCount="4" />
<row Id="660" PostTypeId="2" ParentId="535" CreationDate="2008-08-03T12:09:18.357" Score="13" Body="&lt;p&gt;Second the Buildbot - Trac integration. You can find more information about the integration on the &lt;a href=&quot;http://buildbot.net/trac/wiki/BuildbotAndTrac&quot;&gt;Buildbot website&lt;/a&gt;. At my previous job, we wrote and used the plugin they mention (tracbb).&#xD;&#xA;What the plugin does is rewriting all of the Buildbot urls so you can use Buildbot from within Trac. (http://example.com/tracbb).&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The really nice thing about Buildbot is that the configuration is written in Python. You can integrate your own Python code directly to the configuration. It's also very easy to write your own BuildSteps to execute specific tasks.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;We used BuildSteps to get the source from SVN, pull the dependencies, publish test results to WebDAV, etcetera.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I wrote an X10 interface so we could send signals with build results. When the build failed, we switched on a red lava lamp. When the build succeeded, a green lava lamp switched on. Good times :-)&lt;/p&gt;" OwnerUserId="197" LastActivityDate="2008-08-03T12:09:18.357" CommentCount="0" />
<row Id="665" PostTypeId="2" ParentId="644" CreationDate="2008-08-03T12:26:35.843" Score="3" Body="&lt;p&gt;I think you should go for solution 2. There is no 'swap' function in any SQL variant I know of.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you need to do this regularly, I suggest solution 1, depending on how other parts of the software are using this data. You can have locking issues if you're not careful.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;But in short: there is no other solution than the ones you provided.&lt;/p&gt;" OwnerUserId="197" LastActivityDate="2008-08-03T12:26:35.843" CommentCount="0" />
<row Id="667" PostTypeId="2" ParentId="264" CreationDate="2008-08-03T12:34:36.060" Score="6" Body="&lt;p&gt;It depends on what kind of application you are building. Create a representative test scenario, and start hammering away. Then you will know the definitive answer.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Besides your use case, it also depends on CPU, memory, front-side bus, operating system, cache settings, etcetera.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Seriously, just test your own scenario.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you need some numbers (that actually may mean nothing in your scenario):&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ul&gt;&#xD;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.oracle.com/technology/products/berkeley-db/pdf/berkeley-db-perf.pdf&quot;&gt;Oracle Berkeley DB: &#xD;&#xA;Performance Metrics and &#xD;&#xA;Benchmarks&lt;/a&gt;&lt;/li&gt;&#xD;&#xA;&lt;li&gt;&lt;a href=&quot;http://staff.rcost.unisannio.it/visaggio/berkleyDB.pdf&quot;&gt;Performance Metrics &#xD;&#xA;&amp;amp; Benchmarks: &lt;br&gt;&#xD;&#xA;Berkeley DB&lt;/a&gt;&lt;/li&gt;&#xD;&#xA;&lt;/ul&gt;" OwnerUserId="197" LastActivityDate="2008-08-03T12:34:36.060" CommentCount="2" />
<row Id="669" PostTypeId="2" ParentId="657" CreationDate="2008-08-03T12:48:36.657" Score="16" Body="&lt;p&gt;If you are choosing an encryption method for your login system then speed is not your friend, Jeff had a to-and-frow with Thomas Ptacek about passwords and the &lt;a href=&quot;http://chargen.matasano.com/chargen/2007/9/7/enough-with-the-rainbow-tables-what-you-need-to-know-about-s.html&quot; rel=&quot;nofollow&quot;&gt;conclusion&lt;/a&gt; was that you should use the slowest, most secure encryption method you can afford to. &lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;From Thomas Ptacek's blog:&lt;br&gt;&#xA; Speed is exactly what you don’t want in a password hash function.&lt;/p&gt;&#xA; &#xA; &lt;p&gt;Modern password schemes are attacked with incremental password crackers.&lt;/p&gt;&#xA; &#xA; &lt;p&gt;Incremental crackers don’t precalculate all possible cracked passwords. They consider each password hash individually, and they feed their dictionary through the password hash function the same way your PHP login page would. Rainbow table crackers like Ophcrack use space to attack passwords; incremental crackers like John the Ripper, Crack, and LC5 work with time: statistics and compute.&lt;/p&gt;&#xA; &#xA; &lt;p&gt;The password attack game is scored in time taken to crack password X. With rainbow tables, that time depends on how big your table needs to be and how fast you can search it. With incremental crackers, the time depends on how fast you can make the password hash function run.&lt;/p&gt;&#xA; &#xA; &lt;p&gt;The better you can optimize your password hash function, the faster your password hash function gets, the weaker your scheme is. MD5 and SHA1, even conventional block ciphers like DES, are designed to be fast. MD5, SHA1, and DES are weak password hashes. On modern CPUs, raw crypto building blocks like DES and MD5 can be bitsliced, vectorized, and parallelized to make password searches lightning fast. Game-over FPGA implementations cost only hundreds of dollars. &lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;" OwnerUserId="117" LastEditorUserId="17174" LastEditorDisplayName="Peter Coulton" LastEditDate="2012-05-16T01:48:22.800" LastActivityDate="2012-05-16T01:48:22.800" CommentCount="0" />
<row Id="676" PostTypeId="2" ParentId="227" CreationDate="2008-08-03T13:01:24.243" Score="16" Body="&lt;p&gt;Perhaps this is a little academic and OT but hX tags are probably not the best choice for a tag cloud for reasons of document structure and all that sort of thing ...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Maybe spans or an ol with appropriate class attributes (plus some css)?&lt;/p&gt;&#xA;" OwnerUserId="199" LastEditorUserId="199" LastEditorDisplayName="Brendan" LastEditDate="2009-02-23T19:20:59.587" LastActivityDate="2009-02-23T19:20:59.587" CommentCount="0" />
<row Id="679" PostTypeId="2" ParentId="48" CreationDate="2008-08-03T13:12:21.007" Score="4" Body="&lt;p&gt;I would use Javascript to submit the form. The function would be triggered by the OnKeyPress event of the form element, and would detect whether the Enter key was selected. If this is the case, it will submit the form.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Here are two pages that give techniques on how to do this: &lt;a href=&quot;http://www.htmlcodetutorial.com/forms/index_famsupp_157.html&quot; rel=&quot;nofollow&quot;&gt;1&lt;/a&gt;, &lt;a href=&quot;http://www.java2s.com/Code/JavaScript/Form-Control/SubmitaformViaEnter.htm&quot; rel=&quot;nofollow&quot;&gt;2&lt;/a&gt;. Based on these, here is an example of usage (based on &lt;a href=&quot;http://www.htmlcodetutorial.com/forms/index_famsupp_157.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;SCRIPT TYPE=&quot;text/javascript&quot;&amp;gt;&amp;lt;!--&lt;br&gt;function submitenter(myfield,e) {&lt;br&gt; var keycode;&lt;br&gt; if (window.event) {&lt;br&gt; keycode = window.event.keyCode;&lt;br&gt; } else if (e) { &lt;br&gt; keycode = e.which;&lt;br&gt; } else {&lt;br&gt; return true;&lt;br&gt; }&lt;br&gt;&lt;br&gt; if (keycode == 13) {&lt;br&gt; myfield.form.submit();&lt;br&gt; return false;&lt;br&gt; } else {&lt;br&gt; return true;&lt;br&gt; }&lt;br&gt;}&lt;br&gt;//--&amp;gt;&amp;lt;/SCRIPT&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;INPUT NAME=&quot;MyText&quot; TYPE=&quot;Text&quot; onKeyPress=&quot;return submitenter(this,event)&quot; /&amp;gt;&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="51" LastActivityDate="2008-11-03T18:10:21.897" CommentCount="3" />
<row Id="681" PostTypeId="2" ParentId="328" CreationDate="2008-08-03T13:14:48.600" Score="3" Body="&lt;p&gt;The main problem with PHP sessions and security (besides session hijacking) comes with what environment you are in. By default PHP stores the session data in a file in the OS's temp directory. Without any special thought or planning this is a world readable directory so all of your session information is public to anyone with access to the server.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;As for maintaining sessions over multiple servers. At that point it would be better to switch PHP to user handled sessions where it calls your provided functions to CRUD (create, read, update, delete) the session data. At that point you could store the session information in a database or memcache like solution so that all application servers have access to the data.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Storing your own sessions may also be advantageous if you are on a shared server because it will let you store it in the database which you often times have more control over then the filesystem.&lt;/p&gt;" OwnerUserId="200" LastActivityDate="2008-08-03T13:14:48.600" CommentCount="0" />
<row Id="683" PostTypeId="1" AcceptedAnswerId="57833" CreationDate="2008-08-03T13:19:16.983" Score="16" ViewCount="5842" Body="&lt;p&gt;I don't remember whether I was dreaming or not but I seem to recall there being a function which allowed something like,&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;foo in iter_attr(array of python objects, attribute name)&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I've looked over the docs but this kind of thing doesn't fall under any obvious listed headers&lt;/p&gt;" OwnerUserId="199" LastEditorUserId="1190" LastEditorDisplayName="Gaius" LastEditDate="2008-08-23T16:11:59.307" LastActivityDate="2011-11-24T09:57:27.813" Title="Using 'in' to match an attribute of Python objects in an array" Tags="&lt;python&gt;&lt;arrays&gt;&lt;iteration&gt;" AnswerCount="8" CommentCount="0" />
<row Id="684" PostTypeId="2" ParentId="644" CreationDate="2008-08-03T13:22:25.340" Score="1" Body="&lt;p&gt;I also think that #2 is the best bet, though I would be sure to wrap it in a transaction in case something goes wrong mid-update.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;An alternative (since you asked) to updating the Unique Index values with different values would be to update all of the other values in the rows to that of the other row. Doing this means that you could leave the Unique Index values alone, and in the end, you end up with the data that you want. Be careful though, in case some other table references this table in a Foreign Key relationship, that all of the relationships in the DB remain intact.&lt;/p&gt;" OwnerUserId="51" LastActivityDate="2008-08-03T13:22:25.340" CommentCount="0" />
<row Id="691" PostTypeId="2" ParentId="657" CreationDate="2008-08-03T13:48:25.367" Score="9" Body="&lt;p&gt;I'm with Peter. Developer don't seem to understand passwords. We all pick (and I'm guilty of this too) MD5 or SHA1 because they are fast. Thinking about it ('cuz someone recently pointed it out to me) that doesn't make any sense. We should be picking a hashing algorithm that's stupid slow. I mean, on the scale of things, a busy site will hash passwords what? every 1/2 minute? Who cares if it take 0.8 seconds vs 0.03 seconds server wise? But that extra slowness is huge to prevent all types of common brute-forcish attacks.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;From my reading, bcrypt is specifically designed for secure password hashing. It's based on blowfish, and there are many implementation.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;For PHP, check out PHPPass &lt;a href=&quot;http://www.openwall.com/phpass/&quot;&gt;http://www.openwall.com/phpass/&lt;/a&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;For anyone doing .NET, check out BCrypt.NET &lt;a href=&quot;http://derekslager.com/blog/posts/2007/10/bcrypt-dotnet-strong-password-hashing-for-dotnet-and-mono.ashx&quot;&gt;http://derekslager.com/blog/posts/2007/10/bcrypt-dotnet-strong-password-hashing-for-dotnet-and-mono.ashx&lt;/a&gt;&lt;/p&gt;" OwnerUserId="34" LastActivityDate="2008-08-03T13:48:25.367" CommentCount="0" />
<row Id="693" PostTypeId="2" ParentId="371" CreationDate="2008-08-03T13:57:01.633" Score="5" Body="&lt;p&gt;I've found that using the recipients real first and last name in the body is a sure fire way of getting through a spam filter.&lt;/p&gt;" OwnerUserId="209" LastActivityDate="2008-08-03T13:57:01.633" CommentCount="0" />
<row Id="695" PostTypeId="2" ParentId="36" CreationDate="2008-08-03T13:59:24.063" Score="9" Body="&lt;p&gt;How often do you need to check for changes and how large (in terms of row size) are the tables in the database? If you use the &lt;code&gt;CHECKSUM_AGG(BINARY_CHECKSUM(*))&lt;/code&gt; method suggested by John, it will scan every row of the specified table. The &lt;code&gt;NOLOCK&lt;/code&gt; hint helps, but on a large database, you are still hitting every row. You will also need to store the checksum for every row so that you tell one has changed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Have you considered going at this from a different angle? If you do not want to modify the schema to add triggers, (which makes a sense, it's not your database), have you considered working with the application vendor that does make the database? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;They could implement an API that provides a mechanism for notifying accessory apps that data has changed. It could be as simple as writing to a notification table that lists what table and which row were modified. That could be implemented through triggers or application code. From your side, ti wouldn't matter, your only concern would be scanning the notification table on a periodic basis. The performance hit on the database would be far less than scanning every row for changes.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The hard part would be convincing the application vendor to implement this feature. Since this can be handles entirely through SQL via triggers, you could do the bulk of the work for them by writing and testing the triggers and then bringing the code to the application vendor. By having the vendor support the triggers, it prevent the situation where your adding a trigger inadvertently replaces a trigger supplied by the vendor.&lt;/p&gt;&#xA;" OwnerUserId="206" LastEditorUserId="967315" LastEditorDisplayName="Chris Miller" LastEditDate="2012-10-14T12:19:25.500" LastActivityDate="2012-10-14T12:19:25.500" CommentCount="1" />
<row Id="696" PostTypeId="1" AcceptedAnswerId="704" CreationDate="2008-08-03T14:03:28.830" Score="14" ViewCount="6264" Body="&lt;p&gt;I've got an upcoming project wherein I will need to connect our website (PHP5/Apache 1.3/OpenBSD 4.1) to our back-end system running on a iSeries with OS400 V5R3 so that I can access some tables stored there. I've done some checking around but am running into some roadblocks.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;From what I've seen the DB2 extensions and DB2 software from IBM only run under Linux. I've tried compiling the extensions with all the software from IBM and even tried their precompiled ibm_db2 extension with no luck. IBM only supports Linux so I turned on the Linux emulation in the kernel but that didn't seem to help anything.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If anyone has run across getting everything to run natively under OpenBSD that would be great, but what I think I may have to do is setting up a second server running CentOS with DB2 installed (most likely via ZendCore for IBM since it seems to do all this for me) and the driver so that I can set up a small transaction server that I can post against and get a JSON representation of the DB2 data that I need.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Does the second option seem overkill or does anyone else have any better ideas?&lt;/p&gt;" OwnerUserId="204" LastEditorUserId="168868" LastEditorDisplayName="Vaibhav" LastEditDate="2011-03-30T18:08:08.770" LastActivityDate="2013-01-09T05:46:43.607" Title="Connect PHP to an AS/400" Tags="&lt;php&gt;&lt;database&gt;&lt;odbc&gt;&lt;db2&gt;&lt;ibm-midrange&gt;" AnswerCount="8" CommentCount="0" FavoriteCount="3" />
<row Id="699" PostTypeId="2" ParentId="164" CreationDate="2008-08-03T14:27:20.967" Score="29" Body="&lt;p&gt;The following works for me in Firefox and Internet Explorer:&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-html prettyprint-override&quot;&gt;&lt;code&gt;&amp;lt;object id=&quot;mediaplayer&quot; classid=&quot;clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95&quot; codebase=&quot;http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#version=5,1,52,701&quot; standby=&quot;loading microsoft windows media player components...&quot; type=&quot;application/x-oleobject&quot; width=&quot;320&quot; height=&quot;310&quot;&amp;gt;&#xA;&amp;lt;param name=&quot;filename&quot; value=&quot;./test.wmv&quot;&amp;gt;&#xA; &amp;lt;param name=&quot;animationatstart&quot; value=&quot;true&quot;&amp;gt;&#xA; &amp;lt;param name=&quot;transparentatstart&quot; value=&quot;true&quot;&amp;gt;&#xA; &amp;lt;param name=&quot;autostart&quot; value=&quot;true&quot;&amp;gt;&#xA; &amp;lt;param name=&quot;showcontrols&quot; value=&quot;true&quot;&amp;gt;&#xA; &amp;lt;param name=&quot;ShowStatusBar&quot; value=&quot;true&quot;&amp;gt;&#xA; &amp;lt;param name=&quot;windowlessvideo&quot; value=&quot;true&quot;&amp;gt;&#xA; &amp;lt;embed src=&quot;./test.wmv&quot; autostart=&quot;true&quot; showcontrols=&quot;true&quot; showstatusbar=&quot;1&quot; bgcolor=&quot;white&quot; width=&quot;320&quot; height=&quot;310&quot;&amp;gt;&#xA;&amp;lt;/object&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="30" LastEditorUserId="868014" LastEditDate="2013-07-14T11:45:15.310" LastActivityDate="2013-07-14T11:45:15.310" CommentCount="4" />
<row Id="701" PostTypeId="2" ParentId="683" CreationDate="2008-08-03T14:30:50.850" Score="2" Body="&lt;p&gt;No, you were not dreaming. Python has a pretty excellent list comprehension system that lets you manipulate lists pretty elegantly, and depending on exactly what you want to accomplish, this can be done a couple of ways. In essence, what you're doing is saying &quot;For item in list if criteria.matches&quot;, and from that you can just iterate through the results or dump the results into a new list.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm going to crib an example from &lt;a href=&quot;http://diveintopython.net/functional_programming/filtering_lists.html&quot; rel=&quot;nofollow&quot;&gt;Dive Into Python&lt;/a&gt; here, because it's pretty elegant and they're smarter than I am. Here they're getting a list of files in a directory, then filtering the list for all files that match a regular expression criteria.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA;&lt;pre&gt;&lt;code&gt; files = os.listdir(path) &#xA; test = re.compile(&quot;test\.py$&quot;, re.IGNORECASE) &#xA; files = [f for f in files if test.search(f)]&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;You could do this without regular expressions, for your example, for anything where your expression at the end returns true for a match. There are other options like using the filter() function, but if I were going to choose, I'd go with this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Eric Sipple&lt;/p&gt;&#xA;" OwnerUserId="111" LastEditorUserId="447356" LastEditDate="2011-11-24T09:57:27.813" LastActivityDate="2011-11-24T09:57:27.813" CommentCount="0" />
<row Id="704" PostTypeId="2" ParentId="696" CreationDate="2008-08-03T14:39:09.710" Score="8" Body="&lt;p&gt;Have you looked at connecting to the server using &lt;a href=&quot;http://www.unixodbc.org/&quot;&gt;unixODBC&lt;/a&gt;? If I remember correctly it has support for IBM DB2 and compiles on OpenBSD. Check out &lt;a href=&quot;http://www.php.net/odbc&quot;&gt;http://www.php.net/odbc&lt;/a&gt; for more information regarding the PHP side.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you can't get that to work the option to setup a web service on a Linux server may be all you can do.&lt;/p&gt;" OwnerUserId="200" LastActivityDate="2008-08-03T14:39:09.710" CommentCount="0" />
<row Id="705" PostTypeId="1" AcceptedAnswerId="707" CreationDate="2008-08-03T14:41:43.103" Score="17" ViewCount="5345" Body="&lt;p&gt;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.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Now, my first idea was &lt;a href=&quot;http://www.microsoft.com/sql/editions/compact/default.mspx&quot;&gt;SQL Server Compact edition&lt;/a&gt;. That is really nicely integreated, but it can not run off a network.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.firebirdsql.org/dotnetfirebird/&quot;&gt;Firebird&lt;/a&gt; seems to have the same issue, but the .net Integration seems to be not really first-class and is largely undocumented.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.codegear.com/products/blackfish&quot;&gt;Blackfish SQL&lt;/a&gt; looks interesting, but there is no trial of the .net Version. Pricing is also OK.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Any other suggestions of something that works well with .net &lt;strong&gt;and&lt;/strong&gt; runs off a network without the need of actually installing a server software?&lt;/p&gt;" OwnerUserId="91" LastEditorUserId="49246" LastEditDate="2009-06-19T20:40:24.767" LastActivityDate="2013-01-28T04:20:50.873" Title="Embedded Database for .net that can run off a network" Tags="&lt;.net&gt;&lt;database&gt;&lt;embedded-database&gt;" AnswerCount="10" CommentCount="1" FavoriteCount="5" />
<row Id="707" PostTypeId="2" ParentId="705" CreationDate="2008-08-03T14:48:52.497" Score="17" Body="&lt;p&gt;&lt;a href=&quot;http://www.sqlite.org/&quot; rel=&quot;nofollow&quot;&gt;SQLite&lt;/a&gt; came to my mind while reading your question, and I'm quite sure that it's possible to access it from a network drive &lt;em&gt;if&lt;/em&gt; you keep yourself to the constraint of 1 user at a time.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://web.archive.org/web/20100208133236/www.mikeduncan.com/sqlite-on-dotnet-in-3-mins/&quot; rel=&quot;nofollow&quot;&gt;SQLite on .NET - Get up and running in 3 minutes&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="46" LastEditorDisplayName="user1873471" LastEditDate="2013-01-28T04:20:50.873" LastActivityDate="2013-01-28T04:20:50.873" CommentCount="3" />
<row Id="709" PostTypeId="1" AcceptedAnswerId="713" CreationDate="2008-08-03T14:53:53.550" Score="28" ViewCount="5577" Body="&lt;p&gt;I'm looking to introduce a unit testing framework into the mix at my job. We're using Visual Studio 2005 (though we may be moving to 2008 within the next 6 months) and work primarily in C#. If the framework has some kind of IDE integration that would be best, but I'm open to frameworks that don't have integration but are still relatively simple to get set up. I'm going to get resistance to it one way or another, so if I can make sure what I'm pushing isn't a pain in the neck, that would help my case.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The obvious choice from the research I've done so far points to nUnit, but I'd like to get the impressions of someone who's actually used it before recommending it to my team.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Has anyone out there used nUnit? If so, are there any pitfalls or limitations of which I should be aware? Are there other good options out there? If so, if you've used both nUnit at that, I'd greatly appreciate an idea of the strengths and weaknesses of them.&lt;/p&gt;&#xA;" OwnerUserId="111" LastEditorUserId="866022" LastEditorDisplayName="Chris Fournier" LastEditDate="2012-05-20T15:50:14.897" LastActivityDate="2013-02-07T11:12:59.390" Title=".NET Testing Framework Advice" Tags="&lt;c#&gt;&lt;.net&gt;&lt;visual-studio&gt;&lt;unit-testing&gt;" AnswerCount="10" CommentCount="1" FavoriteCount="4" />
<row Id="710" PostTypeId="2" ParentId="705" CreationDate="2008-08-03T14:57:18.907" Score="4" Body="&lt;p&gt;Check out &lt;a href=&quot;http://www.vistadb.net&quot; rel=&quot;nofollow&quot;&gt;VistaDB&lt;/a&gt;. They have a very good product, the server version (3.4) is in Beta and is very close to release.&lt;/p&gt;" OwnerUserId="51" LastActivityDate="2008-08-03T14:57:18.907" CommentCount="0" />
<row Id="712" PostTypeId="2" ParentId="709" CreationDate="2008-08-03T14:57:44.600" Score="14" Body="&lt;p&gt;Scott Hanselman had a good Podcast about this, entitled:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;&quot;The Past, Present and Future of .NET Unit Testing Frameworks&quot;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.hanselminutes.com/default.aspx?showID=130&quot; rel=&quot;nofollow&quot;&gt;Hanselminutes #112&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="395659" LastEditDate="2013-02-07T11:07:13.370" LastActivityDate="2013-02-07T11:07:13.370" CommentCount="2" />
<row Id="713" PostTypeId="2" ParentId="709" CreationDate="2008-08-03T14:59:20.993" Score="32" Body="&lt;p&gt;I think &lt;code&gt;NUnit&lt;/code&gt; &lt;strong&gt;is&lt;/strong&gt; your best bet. With &lt;code&gt;TestDriven.NET&lt;/code&gt;, you get great integration within &lt;code&gt;VS.NET&lt;/code&gt;. (Resharper also has a unit test runner if you're using it). &lt;code&gt;NUnit&lt;/code&gt; it simple to use and follows an established paradigm. You'll also find plenty of projects/tutorials/guides using it which always helps.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Your other main choice is probably MBUnit, which is more and more position itself as the &lt;code&gt;BDD&lt;/code&gt; framework of choice (in conjunction with Gallio &lt;a href=&quot;http://www.gallio.org&quot; rel=&quot;nofollow&quot;&gt;http://www.gallio.org&lt;/a&gt;).&lt;/p&gt;&#xA;" OwnerUserId="34" LastEditorUserId="395659" LastEditDate="2013-02-07T11:06:17.800" LastActivityDate="2013-02-07T11:06:17.800" CommentCount="0" />
<row Id="717" PostTypeId="1" AcceptedAnswerId="799" CreationDate="2008-08-03T15:07:10.073" Score="11" ViewCount="7400" Body="&lt;p&gt;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 provider is not found. I researched and everything seems to point out that there is no solution. Any Help, please...&lt;/p&gt;" OwnerDisplayName="Nelson Marmol" LastEditorUserId="2641576" LastEditDate="2014-11-25T20:41:05.157" LastActivityDate="2014-11-25T20:41:05.157" Title="Why doesn't VFP .NET OLEdb provider work in 64 bit Windows?" Tags="&lt;.net&gt;&lt;sql-server-2005&gt;&lt;oledb&gt;&lt;legacy&gt;&lt;vfp&gt;" AnswerCount="3" CommentCount="0" />
<row Id="718" PostTypeId="2" ParentId="709" CreationDate="2008-08-03T15:07:20.213" Score="5" Body="&lt;p&gt;&lt;code&gt;Visual Studio 2008&lt;/code&gt; has a built in test project type that works in a similar way to NUnit, but obviously has much tighter integration with &lt;code&gt;Visual Studio&lt;/code&gt; (can run on every build and shows the results in a similar way to the conversion results page when upgrading solution files), but it is obviously not as mature as NUnit as it's pretty new and I'm not sure about how it handles mocking.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But it would be worth looking into when your team moves to &lt;code&gt;VS2008&lt;/code&gt;&lt;/p&gt;&#xA;" OwnerUserId="27" LastEditorUserId="395659" LastEditDate="2013-02-07T11:09:30.123" LastActivityDate="2013-02-07T11:09:30.123" CommentCount="0" />
<row Id="723" PostTypeId="2" ParentId="626" CreationDate="2008-08-03T15:21:52.760" Score="280" Body="&lt;p&gt;Another important but subtle difference is in the way procs created with &lt;code&gt;lambda&lt;/code&gt; and procs created with &lt;code&gt;Proc.new&lt;/code&gt; handle the &lt;code&gt;return&lt;/code&gt; statement:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ul&gt;&#xD;&#xA;&lt;li&gt;In a &lt;code&gt;lambda&lt;/code&gt;-created proc, the &lt;code&gt;return&lt;/code&gt; statement returns only from the proc itself&lt;/li&gt;&#xD;&#xA;&lt;li&gt;In a &lt;code&gt;Proc.new&lt;/code&gt;-created proc, the &lt;code&gt;return&lt;/code&gt; statement is a little more surprising: it returns control not just from the proc, &lt;strong&gt;but also from the method enclosing the proc!&lt;/strong&gt;&lt;/li&gt;&#xD;&#xA;&lt;/ul&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Here's &lt;code&gt;lambda&lt;/code&gt;-created proc's &lt;code&gt;return&lt;/code&gt; in action. It behaves in a way that you probably expect:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;def whowouldwin&lt;br&gt;&lt;br&gt; mylambda = lambda {return &quot;Freddy&quot;}&lt;br&gt; mylambda.call&lt;br&gt;&lt;br&gt; # mylambda gets called and returns &quot;Freddy&quot;, and execution&lt;br&gt; # continues on the next line&lt;br&gt;&lt;br&gt; return &quot;Jason&quot;&lt;br&gt;&lt;br&gt;end&lt;br&gt;&lt;br&gt;&lt;br&gt;whowouldwin&lt;br&gt;=&amp;gt; &quot;Jason&quot;&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Now here's a &lt;code&gt;Proc.new&lt;/code&gt;-created proc's &lt;code&gt;return&lt;/code&gt; doing the same thing. You're about to see one of those cases where Ruby breaks the much-vaunted Principle of Least Surprise:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;def whowouldwin2&lt;br&gt;&lt;br&gt; myproc = Proc.new {return &quot;Freddy&quot;}&lt;br&gt; myproc.call&lt;br&gt;&lt;br&gt; # myproc gets called and returns &quot;Freddy&quot;, &lt;br&gt; # but also returns control from whowhouldwin2!&lt;br&gt; # The line below *never* gets executed.&lt;br&gt;&lt;br&gt; return &quot;Jason&quot;&lt;br&gt;&lt;br&gt;end&lt;br&gt;&lt;br&gt;&lt;br&gt;whowouldwin2 &lt;br&gt;=&amp;gt; &quot;Freddy&quot;&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Thanks to this surprising behaviour (as well as less typing), I tend to favour using &lt;code&gt;lambda&lt;/code&gt; over &lt;code&gt;Proc.new&lt;/code&gt; when making procs. &lt;/p&gt;" OwnerUserId="216" OwnerDisplayName="Joey deVilla" LastActivityDate="2008-08-03T15:21:52.760" CommentCount="7" />
<row Id="725" PostTypeId="2" ParentId="651" CreationDate="2008-08-03T15:24:38.290" Score="12" Body="&lt;P&gt;It sounds like you've covered all the server-side bases--maybe it's a client issue? I assume your users have integrated authentication enabled in IE7? (Tools -&amp;gt; Internet Options -&amp;gt; Advanced -&amp;gt; Security). This is enabled by default.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;Also, is your site correctly recognized by IE7 as being in the Local Intranet zone? The IE7 default is to allow automatic logon only in that zone, so users would be prompted if IE thinks your site is on the internet. I believe using a hostname with a dot in it causes IE to place the site into the Internet zone.&lt;/P&gt;" OwnerUserId="205" LastActivityDate="2008-08-03T15:24:38.290" CommentCount="2" />
<row Id="730" PostTypeId="2" ParentId="705" CreationDate="2008-08-03T15:34:17.523" Score="3" Body="&lt;p&gt;Why not use &lt;a href=&quot;http://www.microsoft.com/sql/editions/express/default.mspx&quot; rel=&quot;nofollow&quot;&gt;SQL Server 2005 Express edition&lt;/a&gt;? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;It really depends on what you mean by &quot;embedded&quot; - but you can redistribute SQLServer2005E with your applications and the user never has to know it's there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms165660.aspx&quot; rel=&quot;nofollow&quot;&gt;Embedding SQL Server Express in Applications&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/bb264562.aspx&quot; rel=&quot;nofollow&quot;&gt;Embedding SQL Server Express into Custom Applications&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerDisplayName="user2189331" LastEditorDisplayName="user1873471" LastEditDate="2013-01-28T04:20:26.910" LastActivityDate="2013-01-28T04:20:26.910" CommentCount="1" />
<row Id="735" PostTypeId="2" ParentId="683" CreationDate="2008-08-03T15:47:22.100" Score="-2" Body="&lt;p&gt;I think:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;#!/bin/python&lt;br&gt;bar in dict(Foo)&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Is what you are thinking of. When trying to see if a certain key exists within a dictionary in python (python's version of a hash table) there are two ways to check. First is the &lt;strong&gt;&lt;code&gt;has_key()&lt;/code&gt;&lt;/strong&gt; method attached to the dictionary and second is the example given above. It will return a boolean value.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;That should answer your question.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;And now a little off topic to tie this in to the &lt;em&gt;list comprehension&lt;/em&gt; answer previously given (for a bit more clarity). &lt;em&gt;List Comprehensions&lt;/em&gt; construct a list from a basic &lt;em&gt;for loop&lt;/em&gt; with modifiers. As an example (to clarify slightly), a way to use the &lt;code&gt;in dict&lt;/code&gt; language construct in a _list comprehension_:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Say you have a two dimensional dictionary &lt;strong&gt;&lt;code&gt;foo&lt;/code&gt;&lt;/strong&gt; and you only want the second dimension dictionaries which contain the key &lt;strong&gt;&lt;code&gt;bar&lt;/code&gt;&lt;/strong&gt;. A relatively straightforward way to do so would be to use a &lt;em&gt;list comprehension&lt;/em&gt; with a conditional as follows:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;#!/bin/python&lt;br&gt;baz = dict([(key, value) for key, value in foo if bar in value])&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Note the &lt;strong&gt;&lt;code&gt;if bar in value&lt;/code&gt;&lt;/strong&gt; at the end of the statement&lt;strong&gt;, this is a modifying clause which tells the &lt;em&gt;list comprehension&lt;/em&gt; to only keep those key-value pairs which meet the conditional.&lt;/strong&gt; In this case &lt;strong&gt;&lt;code&gt;baz&lt;/code&gt;&lt;/strong&gt; is a new dictionary which contains only the dictionaries from foo which contain bar (Hopefully I didn't miss anything in that code example... you may have to take a look at the list comprehension documentation found in &lt;a href=&quot;http://docs.python.org/tut/node7.html#SECTION007140000000000000000&quot; rel=&quot;nofollow&quot;&gt;docs.python.org tutorials&lt;/a&gt; and at &lt;a href=&quot;http://www.secnetix.de/olli/Python/list_comprehensions.hawk&quot; rel=&quot;nofollow&quot;&gt;secnetix.de&lt;/a&gt;, both sites are good references if you have questions in the future.).&lt;/p&gt;" OwnerUserId="145" LastActivityDate="2008-08-03T15:47:22.100" CommentCount="0" />
<row Id="737" PostTypeId="2" ParentId="705" CreationDate="2008-08-03T15:48:43.657" Score="6" Body="&lt;p&gt;It sounds like ADO/Access is perfect for your needs. It's baked into the MS stack, well seasoned, and multi-user.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You can programatically create a DB like so:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;Dim catalog as New ADOX.Catalog&lt;br&gt;Catalog.Create(&quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\server\path\to\db.mdb&quot;)&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You can then use standard ADO.NET methods to interact with the database.&lt;/p&gt;" OwnerUserId="173" LastEditorUserId="173" LastEditorDisplayName="Justin Walgran" LastEditDate="2008-08-04T13:56:01.917" LastActivityDate="2008-08-04T13:56:01.917" CommentCount="0" />
<row Id="742" PostTypeId="1" AcceptedAnswerId="33957" CreationDate="2008-08-03T15:55:28.633" Score="22" ViewCount="11735" Body="&lt;p&gt;&lt;a href=&quot;http://www.djangoproject.com/&quot;&gt;Django&lt;/a&gt; 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.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;For example, I have a page that displays a user. This page is very similar to page that displays a group, but it's still not so similar to just use another data model. Group also has members etc...&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;One way would be to point views to class methods and then extend that class. Has anyone tried this approach or has any other idea? &lt;/p&gt;" OwnerUserId="189" LastEditorUserId="-1" LastEditDate="2008-09-11T20:14:02.330" LastActivityDate="2014-10-08T05:53:09.677" Title="Class views in Django" Tags="&lt;python&gt;&lt;django&gt;&lt;views&gt;&lt;oop&gt;" AnswerCount="9" CommentCount="0" FavoriteCount="9" />
<row Id="745" PostTypeId="2" ParentId="683" CreationDate="2008-08-03T15:59:19.797" Score="8" Body="&lt;p&gt;Are you looking to get a list of objects that have a certain attribute? If so, a &lt;a href=&quot;http://docs.python.org/tut/node7.html#SECTION007140000000000000000&quot;&gt;list comprehension&lt;/a&gt; is the right way to do this.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;result = [obj for obj in listOfObjs if hasattr(obj, 'attributeName')]&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="154" LastActivityDate="2008-08-03T15:59:19.797" CommentCount="0" />
<row Id="746" PostTypeId="1" CreationDate="2008-08-03T16:03:48.290" Score="13" ViewCount="7512" Body="&lt;p&gt;How do I format a string to title case?&lt;/p&gt;" OwnerUserId="192" LastActivityDate="2013-10-08T16:13:50.937" Title="Format string to title case" Tags="&lt;string&gt;&lt;language-agnostic&gt;&lt;format&gt;&lt;title-case&gt;" AnswerCount="16" CommentCount="0" FavoriteCount="1" />
<row Id="747" PostTypeId="2" ParentId="746" CreationDate="2008-08-03T16:05:57.537" Score="14" Body="&lt;p&gt;Here is a simple static method to do this in C#:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;public static string ToTitleCaseInvariant(string targetString)&lt;br&gt;{&lt;br&gt; return System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(targetString);&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="192" LastActivityDate="2008-08-03T16:05:57.537" CommentCount="5" />
<row Id="749" PostTypeId="2" ParentId="746" CreationDate="2008-08-03T16:12:43.747" Score="3" Body="&lt;p&gt;In what language?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In PHP it is:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://php.net/manual/en/function.ucwords.php&quot; rel=&quot;nofollow&quot;&gt;ucwords()&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$HelloWorld = ucwords('hello world');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="58" LastEditorDisplayName="user212218" LastEditDate="2011-12-26T17:11:26.727" LastActivityDate="2011-12-26T17:11:26.727" CommentCount="0" />
<row Id="750" PostTypeId="2" ParentId="683" CreationDate="2008-08-03T16:13:29.363" Score="2" Body="&lt;p&gt;What I was thinking of can be achieved using list comprehensions, but I thought that there was a function that did this in a slightly neater way.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;i.e. 'bar' is a list of objects, all of which have the attribute 'id'&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The mythical functional way:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;foo = 12&lt;br&gt;foo in iter_attr(bar, 'id')&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The list comprehension way:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;foo = 12&lt;br&gt;foo in [obj.id for obj in bar]&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;In retrospect the list comprehension way is pretty neat anyway.&lt;/p&gt;" OwnerUserId="199" LastActivityDate="2008-08-03T16:13:29.363" CommentCount="0" />
<row Id="751" PostTypeId="2" ParentId="746" CreationDate="2008-08-03T16:25:07.700" Score="-1" Body="&lt;p&gt;Without using a ready-made function, a super-simple low-level algorithm to convert a string to title case:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;code&gt;convert first character to uppercase.&lt;br&gt;for each character in string,&lt;br&gt;    if the previous character is whitespace,&lt;br&gt;        convert character to uppercase.&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&lt;code&gt;&lt;/code&gt;&lt;p&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;This asssumes the &quot;convert character to uppercase&quot; will do that correctly regardless of whether or not the character is case-sensitive (e.g., '+').&lt;/p&gt;" OwnerUserId="219" OwnerDisplayName="Rudd" LastActivityDate="2008-08-03T16:25:07.700" CommentCount="1" />
<row Id="752" PostTypeId="1" AcceptedAnswerId="755" CreationDate="2008-08-03T16:29:03.607" Score="263" ViewCount="147610" Body="&lt;p&gt;One may not always know the Type of an object at compile-time, but may need to create an instance of the Type. How do you get a new object instance from a Type?&lt;/p&gt;" OwnerUserId="192" LastEditorUserId="912495" LastEditDate="2012-10-15T17:26:32.863" LastActivityDate="2015-02-19T15:08:56.430" Title="Get a new object instance from a Type" Tags="&lt;c#&gt;&lt;.net&gt;&lt;reflection&gt;" AnswerCount="8" CommentCount="0" FavoriteCount="58" />
<row Id="753" PostTypeId="2" ParentId="752" CreationDate="2008-08-03T16:31:22.260" Score="26" Body="&lt;p&gt;One implementation of this problem is to attempt to call the parameter-less constructor of the Type:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt; public static object GetNewObject(Type t)&lt;br&gt; {&lt;br&gt; try&lt;br&gt; {&lt;br&gt; return t.GetConstructor(new Type[] { }).Invoke(new object[] { });&lt;br&gt; }&lt;br&gt; catch&lt;br&gt; {&lt;br&gt; return null;&lt;br&gt; }&lt;br&gt; }&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Here is the same approach, contained in a generic method:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt; public static T GetNewObject&amp;lt;T&amp;gt;()&lt;br&gt; {&lt;br&gt; try&lt;br&gt; {&lt;br&gt; return (T)typeof(T).GetConstructor(new Type[] { }).Invoke(new object[] { });&lt;br&gt; }&lt;br&gt; catch&lt;br&gt; {&lt;br&gt; return default(T);&lt;br&gt; }&lt;br&gt; }&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="192" LastActivityDate="2008-08-03T16:31:22.260" CommentCount="1" />
<row Id="754" PostTypeId="2" ParentId="746" CreationDate="2008-08-03T16:33:51.193" Score="3" Body="&lt;p&gt;If the language you are using has a supported method/function then just use that (as in the C# &lt;code&gt;ToTitleCase&lt;/code&gt; method)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it does not, then you will want to do something like the following: &lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Read in the string &lt;/li&gt;&#xA;&lt;li&gt;Take the first word &lt;/li&gt;&#xA;&lt;li&gt;Capitalize the first letter of that word &lt;sup&gt;1&lt;/sup&gt;&lt;/li&gt;&#xA;&lt;li&gt;Go forward and find the next word &lt;/li&gt;&#xA;&lt;li&gt;Go to 3 if not at the end of the string, otherwise exit &lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;&lt;sup&gt;1&lt;/sup&gt; To capitalize it in, say, C - use the &lt;a href=&quot;http://www.asciitable.com&quot; rel=&quot;nofollow&quot;&gt;ascii codes&lt;/a&gt; to find the integer value of the char and subtract 32 from it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There would need to be much more error checking in the code (ensuring valid letters etc.), and the &quot;Capitalize&quot; function will need to impose some sort of &quot;title-case scheme&quot; on the letters to check for words that do not need to be capatilised ('and', 'but' etc. &lt;a href=&quot;http://answers.google.com/answers/threadview?id=349913&quot; rel=&quot;nofollow&quot;&gt;Here&lt;/a&gt; is a good scheme)&lt;/p&gt;&#xA;" OwnerUserId="142" LastEditorUserId="309308" LastEditDate="2011-02-09T23:29:05.593" LastActivityDate="2011-02-09T23:29:05.593" CommentCount="1" />
<row Id="755" PostTypeId="2" ParentId="752" CreationDate="2008-08-03T16:35:34.233" Score="358" Body="&lt;p&gt;The Activator class within the root System namespace is pretty powerful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There are a lot of overloads for passing parameters to the constructor and such. Check out the documentation at: &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here are some simple examples:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ObjectType instance = (ObjectType)Activator.CreateInstance(objectType);&#xA;&#xA;ObjectType instance = (ObjectType)Activator.CreateInstance(&quot;MyNamespace.ObjectType, MyAssembly&quot;);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="34" LastEditorUserId="679449" LastEditDate="2013-03-29T15:23:04.097" LastActivityDate="2013-03-29T15:23:04.097" CommentCount="2" />
<row Id="759" PostTypeId="2" ParentId="609" CreationDate="2008-08-03T16:54:12.277" Score="6" Body="&lt;P&gt;No, there are many applications built with VS2005 that have to support Windows XP, 2000, NT, the whole stack. The issue is that (by default) VS2005 wants to use libraries/exports not present on NT.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;See &lt;A href=&quot;http://www.mombu.com/microsoft/windows-programmer-win32/t-vs2005-and-nt4-392831.html&quot;&gt;this thread&lt;/A&gt; for some background.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;Then start limiting your dependencies via preprocessor macros, and avoiding APIs which aren't supported on NT.&lt;/P&gt;" OwnerDisplayName="user2189331" LastActivityDate="2008-08-03T16:54:12.277" CommentCount="1" />
<row Id="761" PostTypeId="1" AcceptedAnswerId="762" CreationDate="2008-08-03T17:30:20.473" Score="6" ViewCount="529" Body="&lt;p&gt;What is the best way to localise a date format descriptor?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;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 culture, but you often want to also display a helpful hint as to the format required (especially to distinguish between yy and yyyy which is interchangeable in most cultures).&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;What is the best way to do this with results that make sense to most users (i.e. dd/M/yyy is confusing because of the change in case and the switching between two and one letters).&lt;/p&gt;" OwnerUserId="214" LastEditorUserId="1" LastEditorDisplayName="Jeff Atwood" LastEditDate="2008-08-04T08:26:37.183" LastActivityDate="2014-07-10T22:04:25.780" Title="Localising date format descriptors" Tags="&lt;.net&gt;&lt;internationalization&gt;&lt;date&gt;&lt;globalization&gt;" AnswerCount="7" CommentCount="0" />
<row Id="762" PostTypeId="2" ParentId="761" CreationDate="2008-08-03T17:31:31.313" Score="1" Body="&lt;p&gt;Here is my current method. Any suggestions?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;Regex singleMToDoubleRegex = new Regex(&quot;(?&amp;lt;!m)m(?!m)&quot;);&lt;br&gt;Regex singleDToDoubleRegex = new Regex(&quot;(?&amp;lt;!d)d(?!d)&quot;);&lt;br&gt;CultureInfo currentCulture = CultureInfo.CurrentUICulture;&lt;br&gt;&lt;br&gt;// If the culture is netural there is no date pattern to use, so use the default.&lt;br&gt;if (currentCulture.IsNeutralCulture)&lt;br&gt;{&lt;br&gt; currentCulture = CultureInfo.InvariantCulture;&lt;br&gt;}&lt;br&gt;&lt;br&gt;// Massage the format into a more general user friendly form.&lt;br&gt;string shortDatePattern = CultureInfo.CurrentUICulture.DateTimeFormat.ShortDatePattern.ToLower();&lt;br&gt;shortDatePattern = singleMToDoubleRegex.Replace(shortDatePattern, &quot;mm&quot;);&lt;br&gt;shortDatePattern = singleDToDoubleRegex.Replace(shortDatePattern, &quot;dd&quot;);&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="214" LastActivityDate="2008-08-03T17:31:31.313" CommentCount="0" />
<row Id="763" PostTypeId="2" ParentId="761" CreationDate="2008-08-03T17:37:43.063" Score="0" Body="&lt;p&gt;How about giving the format (mm/dd/yyyy or dd/mm/yyyy) followed by a printout of today's date in the user's culture. MSDN has an article on &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/5hh873ya%28VS.71%29.aspx&quot; rel=&quot;nofollow&quot;&gt;formatting a DateTime for the person's culture&lt;/a&gt;, using the CultureInfo object that might be helpful in doing this. A combination of the format (which most people are familiar with) combined with the current date represented in that format should be enough of a clue to the person on how they should enter the date. (Also include a calendar control for those who still cant figure it out).&lt;/p&gt;" OwnerUserId="51" LastActivityDate="2008-08-03T17:37:43.063" CommentCount="0" />
<row Id="764" PostTypeId="2" ParentId="742" CreationDate="2008-08-03T17:40:25.553" Score="0" Body="&lt;p&gt;Sounds to me like you're trying to combine things that shouldn't be combined. If you need to do different processing in your view depending on if it's a User or Group object you're trying to look at then you should use two different view functions.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;On the other hand there can be common idioms you'd want to extract out of your object_detail type views... perhaps you could use a decorator or just helper functions?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;-Dan&lt;/p&gt;" OwnerDisplayName="Dan" LastActivityDate="2008-08-03T17:40:25.553" CommentCount="0" />
<row Id="766" PostTypeId="1" AcceptedAnswerId="1619" CreationDate="2008-08-03T17:44:07.450" Score="9" ViewCount="1864" Body="&lt;p&gt;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.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I found &lt;a href=&quot;http://barryp.org/software/bpgsql/&quot;&gt;bpgsql&lt;/a&gt; really good because it does not require an install, it's a single file that I can look at, read and then call the functions of. Does anybody know of something like this for MySQL?&lt;/p&gt;" OwnerUserId="1384652" LastEditorUserId="487855" LastEditDate="2012-05-31T16:57:58.230" LastActivityDate="2012-05-31T16:57:58.230" Title="Python and MySQL" Tags="&lt;python&gt;&lt;mysql&gt;&lt;postgresql&gt;&lt;bpgsql&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="1" />
<row Id="768" PostTypeId="2" ParentId="174" CreationDate="2008-08-03T18:06:30.913" Score="20" Body="&lt;p&gt;You can print from the command line using the following:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;rundll32.exe&#xD;&#xA; %WINDIR%\System32\mshtml.dll,PrintHTML&#xD;&#xA; &quot;%1&quot;&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Where %1 is the file path of the html file to be printed.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you don't need to print from memory (or can afford to write to the disk in a temp file) you can use:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;using (Process printProcess = new Process())&lt;br&gt;{&lt;br&gt; string systemPath = Environment.GetFolderPath(Environment.SpecialFolder.System);&lt;br&gt; printProcess.StartInfo.FileName = systemPath + @&quot;\rundll32.exe&quot;;&lt;br&gt; printProcess.StartInfo.Arguments = systemPath + @&quot;\mshtml.dll,PrintHTML &quot;&quot;&quot; + fileToPrint + @&quot;&quot;&quot;&quot;;&lt;br&gt; printProcess.Start();&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;N.B. This only works on Windows 2000 and above I think.&lt;/p&gt;" OwnerUserId="214" LastActivityDate="2008-08-03T18:06:30.913" CommentCount="1" />
<row Id="769" PostTypeId="1" AcceptedAnswerId="781" CreationDate="2008-08-03T18:14:24.267" Score="20" ViewCount="12484" Body="&lt;p&gt;I need to programmatically solve a system of linear equations in C, Objective C, or (if needed) C++.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Here's an example of the equations:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;-44.3940 = a * 50.0 + b * 37.0 + tx&lt;br&gt;-45.3049 = a * 43.0 + b * 39.0 + tx&lt;br&gt;-44.9594 = a * 52.0 + b * 41.0 + tx&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;From this, I'd like to get the best approximation for a, b, and tx.&lt;/p&gt;" OwnerUserId="79" LastEditorUserId="35881" LastEditorDisplayName="Prakash" LastEditDate="2009-09-10T16:07:20.533" LastActivityDate="2014-12-30T15:24:38.107" Title="Solving a linear equation" Tags="&lt;math&gt;&lt;linear-algebra&gt;&lt;system&gt;&lt;linear-equation&gt;" AnswerCount="11" CommentCount="0" FavoriteCount="3" />
<row Id="770" PostTypeId="2" ParentId="761" CreationDate="2008-08-03T18:18:54.400" Score="4" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/ISO_8601&quot; rel=&quot;nofollow&quot;&gt;Just use ISO-8601&lt;/a&gt;. It's an international standard.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;Date and time (current at page generation) expressed according to ISO 8601:&#xA;Date: 2014-07-05&#xA;Combined date and time in UTC: 2014-07-05T04:00:25+00:00&#xA; 2014-07-05T04:00:25Z&#xA;Week: 2014-W27&#xA;Date with week number: 2014-W27-6&#xA;Ordinal date: 2014-186&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="175" LastEditorUserId="1668244" LastEditDate="2014-07-10T22:04:25.780" LastActivityDate="2014-07-10T22:04:25.780" CommentCount="0" />
<row Id="771" PostTypeId="2" ParentId="746" CreationDate="2008-08-03T18:22:47.213" Score="8" Body="&lt;p&gt;Here's a Perl solution &lt;a href=&quot;http://daringfireball.net/2008/05/title_case&quot;&gt;http://daringfireball.net/2008/05/title_case&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a Ruby solution &lt;a href=&quot;http://frankschmitt.org/projects/title-case&quot;&gt;http://frankschmitt.org/projects/title-case&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's a Ruby one-liner solution: &lt;a href=&quot;http://snippets.dzone.com/posts/show/4702&quot;&gt;http://snippets.dzone.com/posts/show/4702&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;'some string here'.gsub(/\b\w/){$&amp;amp;.upcase}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What the one-liner is doing is using a regular expression substitution of the first character of each word with the uppercase version of it.&lt;/p&gt;&#xA;" OwnerUserId="175" LastEditorUserId="2766176" LastEditorDisplayName="brian d foy" LastEditDate="2008-10-12T12:20:29.097" LastActivityDate="2008-10-12T12:20:29.097" CommentCount="0" />
<row Id="773" PostTypeId="1" AcceptedAnswerId="7286" CreationDate="2008-08-03T18:27:09.687" Score="148" ViewCount="56415" Body="&lt;p&gt;I haven't been able to find an understandable explanation of how to actually use Python's &lt;code&gt;itertools.groupby()&lt;/code&gt; function. What I'm trying to do is this:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Take a list - in this case, the children of an objectified &lt;code&gt;lxml&lt;/code&gt; element&lt;/li&gt;&#xA;&lt;li&gt;Divide it into groups based on some criteria&lt;/li&gt;&#xA;&lt;li&gt;Then later iterate over each of these groups separately.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;I've reviewed &lt;a href=&quot;https://docs.python.org/2/library/itertools.html&quot;&gt;the documentation&lt;/a&gt;, and &lt;a href=&quot;https://docs.python.org/2/library/itertools.html#itertools.groupby&quot;&gt;the examples&lt;/a&gt;, but I've had trouble trying to apply them beyond a simple list of numbers. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;So, how do I use of &lt;code&gt;itertools.groupby()&lt;/code&gt;? Is there another technique I should be using? Pointers to good &quot;prerequisite&quot; reading would also be appreciated.&lt;/p&gt;&#xA;" OwnerUserId="207" LastEditorUserId="2026508" LastEditDate="2014-08-06T21:34:45.097" LastActivityDate="2014-12-28T19:26:52.480" Title="How do I use Python's itertools.groupby()?" Tags="&lt;python&gt;&lt;iteration&gt;" AnswerCount="7" CommentCount="0" FavoriteCount="73" />
<row Id="774" PostTypeId="2" ParentId="769" CreationDate="2008-08-03T18:27:13.180" Score="2" Body="&lt;p&gt;Are you looking for a software package that'll do the work or actually doing the matrix operations and such and do each step?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The the first, a coworker of mine just used &lt;a href=&quot;http://ocaml-glpk.sourceforge.net/&quot; rel=&quot;nofollow&quot; title=&quot;Ocaml GLPK&quot;&gt;Ocaml GLPK&lt;/a&gt;. It is just a wrapper for the &lt;a href=&quot;http://www.gnu.org/software/glpk/&quot; rel=&quot;nofollow&quot; title=&quot;GNU Linear Programming Kit&quot;&gt;GLPK&lt;/a&gt;, but it removes a lot of the steps of setting things up. It looks like you're going to have to stick with the GLPK, in C, though. For the latter, thanks to delicious for saving an old article I used to learn LP awhile back, &lt;a href=&quot;http://www.math.ucla.edu/%7Etom/LP.pdf&quot; rel=&quot;nofollow&quot; title=&quot;Linear Programming&quot;&gt;PDF&lt;/a&gt;. If you need specific help setting up further, let us know and I'm sure, me or someone will wander back in and help, but, I think it's fairly straight forward from here. Good Luck! &lt;/p&gt;" OwnerUserId="157" LastActivityDate="2008-08-03T18:27:13.180" CommentCount="0" />
<row Id="777" PostTypeId="2" ParentId="766" CreationDate="2008-08-03T18:32:27.693" Score="5" Body="&lt;p&gt;I don't have any experience with &lt;a href=&quot;http://www.SiteGround.com&quot; rel=&quot;nofollow&quot;&gt;http://www.SiteGround.com&lt;/a&gt; as a web host personally. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;This is just a guess, but it's common for a shared host to support Python and MySQL with the MySQLdb module (e.g., GoDaddy does this). Try the following CGI script to see if MySQLdb is installed.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;#!/usr/bin/python&lt;br&gt;&lt;br&gt;module_name = 'MySQLdb'&lt;br&gt;head = '''Content-Type: text/html&lt;br&gt;&lt;br&gt;%s is ''' % module_name&lt;br&gt;&lt;br&gt;try:&lt;br&gt; __import__(module_name)&lt;br&gt; print head + 'installed'&lt;br&gt;except ImportError:&lt;br&gt; print head + 'not installed'&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="150" LastEditorUserId="150" LastEditorDisplayName="ESV" LastEditDate="2008-08-03T22:56:27.863" LastActivityDate="2008-08-03T22:56:27.863" CommentCount="0" />
<row Id="781" PostTypeId="2" ParentId="769" CreationDate="2008-08-03T18:37:24.003" Score="14" Body="&lt;p&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Cramers_rule&quot;&gt;Cramer's Rule&lt;/a&gt;&#xD;&#xA;and&#xD;&#xA;&lt;a href=&quot;http://en.wikipedia.org/wiki/Gaussian_elimination&quot;&gt;Gaussian Elimination&lt;/a&gt;&#xD;&#xA;are two good, general-purpose algorithms (also see &lt;a href=&quot;http://en.wikipedia.org/wiki/Simultaneous_linear_equations&quot;&gt;Simultaneous Linear Equations&lt;/a&gt;). If you're looking for code, check out &lt;a href=&quot;http://en.wikipedia.org/wiki/GiNaC&quot;&gt;GiNaC&lt;/a&gt;, &lt;a href=&quot;http://maxima.sourceforge.net/&quot;&gt;Maxima&lt;/a&gt;, and &lt;a href=&quot;http://issc.uj.ac.za/symbolic/symbolic.html&quot;&gt;SymbolicC++&lt;/a&gt; (depending on your licensing requirements, of course).&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;EDIT: I know you're working in C land, but I also have to put in a good word for &lt;a href=&quot;http://code.google.com/p/sympy/&quot;&gt;SymPy&lt;/a&gt; (a computer algebra system in Python). You can learn a lot from its algorithms (if you can read a bit of python). Also, it's under the new BSD license, while most of the free math packages are GPL.&lt;/p&gt;" OwnerUserId="229" LastEditorUserId="229" LastEditDate="2008-08-03T18:42:54.820" LastActivityDate="2008-08-03T18:42:54.820" CommentCount="1" />
<row Id="783" PostTypeId="2" ParentId="773" CreationDate="2008-08-03T18:40:09.053" Score="41" Body="&lt;p&gt;Can you show us your code? &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The example on the Python docs is quite straight forward:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;groups = []&lt;br&gt;uniquekeys = []&lt;br&gt;for k, g in groupby(data, keyfunc):&lt;br&gt;    groups.append(list(g))      # Store group iterator as a list&lt;br&gt;    uniquekeys.append(k)&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;So in your case, data is a list of nodes, keyfunc is where the logic of your criteria function goes and then groupby() groups the data. You must be careful to &lt;strong&gt;sort the data&lt;/strong&gt; by the criteria before you call groupby or it won't work. groupby method actually just iterates through a list and whenever the key changes it creates a new group. &lt;/p&gt;" OwnerUserId="189" LastActivityDate="2008-08-03T18:40:09.053" CommentCount="1" />
<row Id="787" PostTypeId="2" ParentId="650" CreationDate="2008-08-03T18:46:33.517" Score="3" Body="&lt;p&gt;What source control system are you using? &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Almost all of them have some form of $ Id $ tag that gets expanded when the file is checked in.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I usually use some form of hackery to display this as the version number.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The other alternative is use to use the date as the build number: 080803-1448&lt;/p&gt;" OwnerUserId="175" LastActivityDate="2008-08-03T18:46:33.517" CommentCount="1" />
<row Id="791" PostTypeId="2" ParentId="622" CreationDate="2008-08-03T18:52:17.093" Score="1" Body="&lt;p&gt;Not efficient at all, but you can use a regular expression to test for prime numbers.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;/^1?$|^(11+?)\1+$/&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This tests if, for a string consisting of &lt;em&gt;k&lt;/em&gt; “&lt;code&gt;1&lt;/code&gt;”s, &lt;em&gt;k&lt;/em&gt; is &lt;em&gt;not prime&lt;/em&gt; (i.e. whether the string consists of one “&lt;code&gt;1&lt;/code&gt;” or any number of “&lt;code&gt;1&lt;/code&gt;”s that can be expressed as an &lt;em&gt;n&lt;/em&gt;-ary product).&lt;/p&gt;&#xA;" OwnerUserId="175" LastEditorUserId="1968" LastEditDate="2010-02-02T13:57:30.347" LastActivityDate="2010-02-02T13:57:30.347" CommentCount="0" />
<row Id="794" PostTypeId="2" ParentId="561" CreationDate="2008-08-03T19:06:00.327" Score="9" Body="&lt;p&gt;Absolutely, especially dealing with lots of these permutations/combinations I can definitely see that the first pass would be an issue.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Interesting implementation in python, though I wrote a nice one in C and Ocaml based on &quot;Algorithm 515&quot; (see below). He wrote his in Fortran as it was common back then for all the &quot;Algorithm XX&quot; papers, well, that assembly or c. I had to re-write it and make some small improvements to work with arrays not ranges of numbers. This one does random access, I'm still working on getting some nice implementations of the ones mentioned in Knuth 4th volume fascicle 2. I'll an explanation of how this works to the reader. Though if someone is curious, I wouldn't object to writing something up.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;/** [combination c n p x]&lt;br&gt; * get the [x]th lexicographically ordered set of [p] elements in [n]&lt;br&gt; * output is in [c], and should be sizeof(int)*[p] */&lt;br&gt;void combination(int* c,int n,int p, int x){&lt;br&gt; int i,r,k = 0;&lt;br&gt; for(i=0;i&amp;lt;p-1;i++){&lt;br&gt; c[i] = (i != 0) ? c[i-1] : 0;&lt;br&gt; do {&lt;br&gt; c[i]++;&lt;br&gt; r = choose(n-c[i],p-(i+1));&lt;br&gt; k = k + r;&lt;br&gt; } while(k &amp;lt; x);&lt;br&gt; k = k - r;&lt;br&gt; }&lt;br&gt; c[p-1] = c[p-2] + x - k;&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;~&quot;Algorithm 515: Generation of a Vector from the Lexicographical Index&quot;; Buckles, B. P., and Lybanon, M. ACM Transactions on Mathematical Software, Vol. 3, No. 2, June 1977.&lt;/p&gt;" OwnerUserId="157" LastActivityDate="2008-08-03T19:06:00.327" CommentCount="2" />
<row Id="795" PostTypeId="2" ParentId="746" CreationDate="2008-08-03T19:10:58.723" Score="9" Body="&lt;p&gt;I would be wary of automatically upcasing all whitespace-preceded-words in scenarios where I would run the risk of attracting the fury of nitpickers.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I would at least consider implementing a dictionary for exception cases like articles and conjunctions. Behold: &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;&quot;Beauty and the Beast&quot;&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;And when it comes to proper nouns, the thing gets much uglier.&lt;/p&gt;" OwnerUserId="227" LastEditorUserId="227" LastEditorDisplayName="Ishmaeel" LastEditDate="2008-08-03T19:14:31.993" LastActivityDate="2008-08-03T19:14:31.993" CommentCount="0" />
<row Id="797" PostTypeId="2" ParentId="13" CreationDate="2008-08-03T19:30:55.720" Score="125" Body="&lt;p&gt;The most popular (==standard?) way of determining the time zone I've seen around is simply &lt;em&gt;asking the users themselves.&lt;/em&gt; If your website requires subscription, this could be saved in the users' profile data. For anon users, the dates could be displayed as UTC or GMT or some such.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm not trying to be a smart aleck. It's just that sometimes some problems have finer solutions outside of any programming context.&lt;/p&gt;&#xA;" OwnerUserId="227" LastEditorUserId="227" LastEditDate="2013-09-10T11:42:53.333" LastActivityDate="2013-09-10T11:42:53.333" CommentCount="8" />
<row Id="798" PostTypeId="2" ParentId="709" CreationDate="2008-08-03T19:36:48.470" Score="3" Body="&lt;p&gt;&lt;code&gt;mbUnit&lt;/code&gt; is worth alook, it has a set of features comparable to &lt;code&gt;NUnit&lt;/code&gt;, it has its own GUI, or can be integrated into &lt;code&gt;VS&lt;/code&gt; if you have &lt;code&gt;Resharper&lt;/code&gt;. I would also recommend &lt;code&gt;Rhino Mocks&lt;/code&gt; if you are doing any sort of &lt;code&gt;TDD&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="230" LastEditorUserId="395659" LastEditDate="2013-02-07T11:12:59.390" LastActivityDate="2013-02-07T11:12:59.390" CommentCount="0" />
<row Id="799" PostTypeId="2" ParentId="717" CreationDate="2008-08-03T19:42:03.687" Score="13" Body="&lt;p&gt;Have you tried changing the target CPU to &lt;code&gt;x86&lt;/code&gt; instead of &lt;code&gt;&quot;Any CPU&quot;&lt;/code&gt; in the advanced compiler options? I know that this solves some problems with other &lt;code&gt;OLEDB&lt;/code&gt; providers by forcing the use of the 32-bit version.&lt;/p&gt;&#xA;" OwnerUserId="162" LastEditorUserId="395659" LastEditDate="2013-02-07T11:14:46.003" LastActivityDate="2013-02-07T11:14:46.003" CommentCount="3" />
<row Id="802" PostTypeId="2" ParentId="766" CreationDate="2008-08-03T20:07:05.290" Score="3" Body="&lt;p&gt;I uploaded it and got an internal error&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;Premature end of script headers&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;After much playing around, I found that if I had&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;import cgi&lt;br&gt;import cgitb; cgitb.enable()&lt;br&gt;import MySQLdb&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;It would give me a much more useful answer and say that it was not installed, you can see it yourself -&gt; &lt;a href=&quot;http://woarl.com/db.py&quot; rel=&quot;nofollow&quot;&gt;http://woarl.com/db.py&lt;/a&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Oddly enough, this would produce an error&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;import MySQLdb&lt;br&gt;import cgi&lt;br&gt;import cgitb; cgitb.enable()&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I looked at some of the other files I had up there and it seems that library was one of the ones I had already tried.&lt;/p&gt;" OwnerUserId="1384652" LastEditorUserId="1384652" LastEditorDisplayName="Teifion" LastEditDate="2008-08-04T21:46:00.797" LastActivityDate="2008-08-04T21:46:00.797" CommentCount="0" />
<row Id="805" PostTypeId="1" AcceptedAnswerId="894" CreationDate="2008-08-03T20:11:26.043" Score="5" ViewCount="1280" Body="&lt;p&gt;This is ASP classic, not .Net. We have to get a way to SFTP into a server to upload and download a couple of files, kicked off by a user.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What have other people used to do SFTP in ASP classic? Not necessarily opposed to purchasing a control.&lt;/p&gt;&#xA;" OwnerUserId="232" LastEditorUserId="3043" LastEditorDisplayName="Matt Dawdy" LastEditDate="2011-11-21T03:51:00.390" LastActivityDate="2011-11-21T03:51:00.390" Title="ASP, need to use SFTP" Tags="&lt;asp-classic&gt;&lt;sftp&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="1" />
<row Id="810" PostTypeId="1" AcceptedAnswerId="820" CreationDate="2008-08-03T20:35:01.987" Score="7" ViewCount="5335" Body="&lt;p&gt;I'm trying to maintain a Setup Project in &lt;code&gt;Visual Studio 2003&lt;/code&gt; (yes, it's a legacy application). The problem we have at the moment is that we need to write registry entries to &lt;code&gt;HKCU&lt;/code&gt; for every user on the computer. They need to be in the &lt;code&gt;HKCU&lt;/code&gt; rather than &lt;code&gt;HKLM&lt;/code&gt; because they are the default user settings, and they do change per user. My feeling is that&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;This isn't possible&lt;/li&gt;&#xA;&lt;li&gt;This isn't something the installer should be doing, but something the application should be doing (after all what happens when a user profile is created after the install?).&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;With that in mind, I still want to change as little as possible in the application, so my question is, &lt;strong&gt;is it possible to add registry entries for every user in a &lt;code&gt;Visual Studio 2003&lt;/code&gt; setup project?&lt;/strong&gt; &lt;/p&gt;&#xA;&#xA;&lt;p&gt;And, at the moment the project lists five registry root keys (&lt;code&gt;HKEY_CLASSES_ROOT, HKEY_CURRENT_USER&lt;/code&gt;, &lt;code&gt;HKEY_LOCAL_MACHINE&lt;/code&gt;, &lt;code&gt;HKEY_USERS&lt;/code&gt;, and User/Machine Hive). I don't really know anything about the Users root key, and haven't seen User/Machine Hive. Can anyone enlighten me on what they are? Perhaps they could solve my problem above.&lt;/p&gt;&#xA;" OwnerUserId="233" LastEditorUserId="902217" LastEditDate="2012-10-08T21:33:14.307" LastActivityDate="2013-01-28T04:20:06.247" Title="Visual Studio Setup Project - Per User Registry Settings" Tags="&lt;windows&gt;&lt;visual-studio&gt;&lt;registry&gt;&lt;installation&gt;" AnswerCount="4" CommentCount="1" FavoriteCount="1" />
<row Id="817" PostTypeId="2" ParentId="13" CreationDate="2008-08-03T20:40:33.707" Score="7" Body="&lt;p&gt;The magic all seems to be in &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;visitortime.getTimezoneOffset()&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;That's cool, I didn't know about that. Does it work in IE, etc?&#xD;&#xA;From there you should be able to use JS to ajax, set cookies, whatever. I'd probably go the cookie route myself.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You'll need to allow the user to change it though. We tried to use geolocation (via maxmind) to do this a while ago, and it was wrong reasonably often - enough to make it not worth doing, so we just let the user set it in their profile, and show a notice to users who haven't set theirs yet.&lt;/p&gt;" OwnerUserId="234" LastActivityDate="2008-08-03T20:40:33.707" CommentCount="0" />
<row Id="818" PostTypeId="2" ParentId="810" CreationDate="2008-08-03T20:45:27.350" Score="0" Body="&lt;p&gt;I'm partway to my solution with this entry on MSDN (don't know how I couldn't find it before).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;User/Machine Hive&lt;br&gt;&#xA;Subkeys and values entered under this hive will be installed under the HKEY_CURRENT_USER hive when a user chooses &quot;Just Me&quot; or the HKEY_USERS hive or when a user chooses &quot;Everyone&quot; during installation.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/x6kd89c5%28VS.80%29.aspx&quot; rel=&quot;nofollow&quot;&gt;Registry Editor&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="233" LastEditorDisplayName="user1873471" LastEditDate="2013-01-28T04:20:06.247" LastActivityDate="2013-01-28T04:20:06.247" CommentCount="0" />
<row Id="820" PostTypeId="2" ParentId="810" CreationDate="2008-08-03T20:48:47.263" Score="3" Body="&lt;p&gt;First: Yes, this is something that belongs in the Application for the exact reson you specified: What happens after new user profiles are created? Sure, if you're using a domain it's possible to have some stuff put in the registry on creation, but this is not really a use case. The Application should check if there are seetings and use the default settings if not.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;That being said, it IS possible to change other users Keys through the HKEY_USERS Hive.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I have no experience with the Visual Studio 2003 Setup Project, so here is a bit of (totally unrelated) VBScript code that might just give you an idea where to look:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;const HKEY_USERS = &amp;amp;H80000003&lt;br&gt;strComputer = &quot;.&quot;&lt;br&gt;Set objReg=GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\&quot; &amp;amp; strComputer &amp;amp; &quot;\root\default:StdRegProv&quot;)&lt;br&gt;strKeyPath = &quot;&quot;&lt;br&gt;objReg.EnumKey HKEY_USERS, strKeyPath, arrSubKeys&lt;br&gt;strKeyPath = &quot;\Software\Microsoft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing&quot;&lt;br&gt;For Each subkey In arrSubKeys&lt;br&gt; objReg.SetDWORDValue HKEY_USERS, subkey &amp;amp; strKeyPath, &quot;State&quot;, 146944&lt;br&gt;Next&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;(Code Courtesy of &lt;a href=&quot;http://jritmeijer.spaces.live.com/blog/cns%218A48A27460FB898A%21965.entry&quot; rel=&quot;nofollow&quot;&gt;Jeroen Ritmeijer&lt;/a&gt;)&lt;/p&gt;" OwnerUserId="91" LastActivityDate="2008-08-03T20:48:47.263" CommentCount="0" />
<row Id="826" PostTypeId="1" AcceptedAnswerId="97294" CreationDate="2008-08-03T21:08:54.977" Score="8" ViewCount="1431" Body="&lt;p&gt;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.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;To be clear, I'm interested in the algorithm. Feel free to post code in any language and paradigm that you like.&lt;/p&gt;" OwnerUserId="101" LastEditorUserId="101" LastEditorDisplayName="rictic" LastEditDate="2008-08-03T21:38:52.623" LastActivityDate="2013-07-23T14:41:11.770" Title="Efficiently get sorted sums of a sorted list" Tags="&lt;algorithm&gt;&lt;language-agnostic&gt;" AnswerCount="8" CommentCount="1" FavoriteCount="2" />
<row Id="829" PostTypeId="2" ParentId="810" CreationDate="2008-08-03T21:17:33.557" Score="4" Body="&lt;p&gt;I'm guessing that because you want to set it for all users, that you're on some kind of shared computer, which is probably running under a domain?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;strong&gt;HERE BE DRAGONS&lt;/strong&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Let's say Joe and Jane regularly log onto the computer, then they will each have 'registries'.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You'll then install your app, and the installer will employ giant hacks and disgusting things to set items under HKCU for them.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;THEN, bob will come along and log on (he, and 500 other people have accounts in the domain and so can do this). He's never used this computer before, so he has no registry. The first time he logs in, windows creates him one, but he won't have your setting. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Your app then falls over or behaves incorrectly, and bob complains loudly about those crappy products from raynixon incorporated.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The correct answer is to just have some default settings in your app, which can write them to the registry if it doesn't find them. It's general good practice that your app should never depend on the registry, and should create things as needed, for any registry entry, not just HKCU, anyway&lt;/p&gt;" OwnerUserId="234" LastEditorUserId="234" LastEditorDisplayName="borland" LastEditDate="2008-08-03T21:37:53.577" LastActivityDate="2008-08-03T21:37:53.577" CommentCount="0" />
<row Id="832" PostTypeId="1" AcceptedAnswerId="837" CreationDate="2008-08-03T21:22:52.717" Score="6" ViewCount="1378" Body="&lt;p&gt;SQL:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT&#xA; u.id,&#xA; u.name,&#xA; isnull(MAX(h.dateCol), '1900-01-01') dateColWithDefault&#xA;FROM universe u&#xA;LEFT JOIN history h &#xA; ON u.id=h.id &#xA; AND h.dateCol&amp;lt;GETDATE()-1&#xA;GROUP BY u.Id, u.name&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="224" LastEditorDisplayName="user1873471" LastEditDate="2013-01-28T04:20:57.850" LastActivityDate="2014-07-10T21:52:02.283" Title="How do I most elegantly express left join with aggregate SQL as LINQ query" Tags="&lt;c#&gt;&lt;linq&gt;" AnswerCount="3" CommentCount="0" />
<row Id="833" PostTypeId="1" AcceptedAnswerId="838" CreationDate="2008-08-03T21:23:41.077" Score="9" ViewCount="5767" Body="&lt;P&gt;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.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;I am concerned that if two users start editing the same record then the last to commit the update would be the 'winner' and important information may be lost. A number of solutions come to mind but I'm not sure if I am going to create a bigger headache.&lt;/P&gt;&#xD;&#xA;&lt;OL&gt;&#xD;&#xA;&lt;LI&gt;Do nothing and hope that two users are never going to be editing the same record at the same time. &lt;EM&gt;- Might never happed but what if it does?&lt;/EM&gt;&lt;/LI&gt;&#xD;&#xA;&lt;LI&gt;Editing routine could store a copy of the original data as well as the updates and then compare when the user has finished editing. If they differ show user and comfirm update &lt;EM&gt;- Would require two copies of data to be stored.&lt;/EM&gt;&lt;/LI&gt;&#xD;&#xA;&lt;LI&gt;Add last updated DATETIME column and check it matches when we update, if not then show differences. &lt;EM&gt;- requires new column in each of the relevant tables.&lt;/EM&gt;&lt;/LI&gt;&#xD;&#xA;&lt;LI&gt;Create an editing table that registers when users start editing a record that will be checked and prevent other users from editing same record. &lt;EM&gt;- would require carful thought of program flow to prevent deadlocks and records becoming locked if a user crashes out of the program.&lt;/EM&gt;&lt;/LI&gt;&lt;/OL&gt;&#xD;&#xA;&lt;P&gt;Are there any better solutions or should I go for one of these?&lt;/P&gt;" OwnerUserId="186" LastEditorUserId="15401" LastEditorDisplayName="Nigel Campbell" LastEditDate="2008-10-08T22:49:01.773" LastActivityDate="2013-01-28T04:20:13.590" Title="Editing database records by multiple users" Tags="&lt;sql-server&gt;&lt;database&gt;" AnswerCount="7" CommentCount="0" FavoriteCount="3" />
<row Id="834" PostTypeId="2" ParentId="826" CreationDate="2008-08-03T21:24:56.160" Score="-4" Body="&lt;p&gt;If you are looking for a truly language agnostic solution then you will be sorely disappointed in my opinion because you'll be stuck with a for loop and some conditionals. However if you opened it up to functional languages or functional language features (I'm looking at you LINQ) then my colleagues here can fill this page with elegant examples in Ruby, Lisp, Erlang, and others.&lt;/p&gt;" OwnerUserId="200" LastActivityDate="2008-08-03T21:24:56.160" CommentCount="0" />
<row Id="835" PostTypeId="1" AcceptedAnswerId="1023" CreationDate="2008-08-03T21:25:09.763" Score="5" ViewCount="5745" Body="&lt;p&gt;I'm trying to setup CruiseControl.net at the moment. So far it works nice, but I have a Problem with the MSBuild Task.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;According to the &lt;a href=&quot;http://confluence.public.thoughtworks.org/display/CCNET/MsBuild+Task&quot; rel=&quot;nofollow&quot;&gt;Documentation&lt;/a&gt;, it passes CCNetArtifactDirectory to MSBuild. But how do I use it?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I tried this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;buildArgs&amp;gt;&#xA; /noconsolelogger /p:OutputPath=$(CCNetArtifactDirectory)\test&#xA;&amp;lt;/buildArgs&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;But that does not work. In fact, it kills the service with this error:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;ThoughtWorks.CruiseControl.Core.Config.Preprocessor.EvaluationException: Reference to unknown symbol CCNetArtifactDirectory&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Documentation is rather sparse, and google und mainly offers modifying the .sln Project file, which is what I want to avoid in order to be able to manually build this project later - I would really prefer &lt;code&gt;/p:OutputPath&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="395659" LastEditorDisplayName="Michael Stum" LastEditDate="2013-02-07T11:24:54.143" LastActivityDate="2013-02-08T21:59:55.120" Title="CruiseControl.net, msbuild, /p:OutputPath and CCNetArtifactDirectory" Tags="&lt;msbuild&gt;&lt;cruisecontrol.net&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" />
<row Id="836" PostTypeId="2" ParentId="696" CreationDate="2008-08-03T21:31:14.353" Score="1" Body="&lt;p&gt;Looks like a web service is going to be the answer for me. On a production box I'd rather not have to go through compiling and maintaining my own special installation of PHP since ODBC support needs to be compiled in, according to the PHP documentation.&lt;/p&gt;&#xA;" OwnerUserId="204" LastEditorUserId="1471203" LastEditDate="2013-01-09T05:46:43.607" LastActivityDate="2013-01-09T05:46:43.607" CommentCount="0" />
<row Id="837" PostTypeId="2" ParentId="832" CreationDate="2008-08-03T21:31:17.863" Score="3" Body="&lt;p&gt;A solution, albeit one that defers handling of the null value to the code, could be:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;DateTime yesterday = DateTime.Now.Date.AddDays(-1);&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;var collection=&#xA; from u in db.Universe&#xA; select new&#xA; {&#xA; u.id,&#xA; u.name,&#xA; MaxDate =(DateTime?)&#xA; (&#xA; from h in db.History&#xA; where u.Id == h.Id&#xA; &amp;amp;&amp;amp; h.dateCol &amp;lt; yesterday&#xA; select h.dateCol &#xA; ).Max()&#xA; };&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This does not produce exactly the same SQL, but does provide the same logical result. Translating &quot;complex&quot; SQL queries to LINQ is not always straightforward.&lt;/p&gt;&#xA;" OwnerUserId="224" LastEditorUserId="1668244" LastEditorDisplayName="Jeff Atwood" LastEditDate="2014-07-10T21:52:02.283" LastActivityDate="2014-07-10T21:52:02.283" CommentCount="0" />
<row Id="838" PostTypeId="2" ParentId="833" CreationDate="2008-08-03T21:31:40.187" Score="5" Body="&lt;p&gt;If you expect infrequent collisions, &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa0416cz.aspx&quot; rel=&quot;nofollow&quot;&gt;Optimistic Concurrency&lt;/a&gt; is probably your best bet.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Scott Mitchell wrote a comprehensive tutorial on implementing that pattern:&lt;br&gt;&#xA;&lt;a href=&quot;http://www.asp.net/Learn/data-access/tutorial-21-cs.aspx&quot; rel=&quot;nofollow&quot;&gt;Implementing Optimistic Concurrency&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="60" LastEditorDisplayName="user1873471" LastEditDate="2013-01-28T04:20:13.590" LastActivityDate="2013-01-28T04:20:13.590" CommentCount="0" />
<row Id="840" PostTypeId="2" ParentId="826" CreationDate="2008-08-03T21:36:25.890" Score="0" Body="&lt;p&gt;The best I could come up with is to produce a matrix of sums of each pair, and then merge the rows together, a-la merge sort. I feel like I'm missing some simple insight that will reveal a much more efficient solution.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;My algorithm, in Haskell:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;matrixOfSums list = [[a+b | b &amp;lt;- list, b &amp;gt;= a] | a &amp;lt;- list]&lt;br&gt;&lt;br&gt;sortedSums = foldl merge [] matrixOfSums&lt;br&gt;&lt;br&gt;--A normal merge, save that we remove duplicates&lt;br&gt;merge xs [] = xs&lt;br&gt;merge [] ys = ys&lt;br&gt;merge (x:xs) (y:ys) = case compare x y of&lt;br&gt; LT -&amp;gt; x:(merge xs (y:ys))&lt;br&gt; EQ -&amp;gt; x:(merge xs (dropWhile (==x) ys))&lt;br&gt; GT -&amp;gt; y:(merge (x:xs) ys)&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I found a minor improvement, one that's more amenable to lazy stream-based coding. Instead of merging the columns pair-wise, merge all of them at once. The advantage being that you start getting elements of the list immediately.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;-- wide-merge does a standard merge (ala merge-sort) across an arbitrary number of lists&lt;br&gt;-- wideNubMerge does this while eliminating duplicates&lt;br&gt;wideNubMerge :: Ord a =&amp;gt; [[a]] -&amp;gt; [a]&lt;br&gt;wideNubMerge ls = wideNubMerge1 $ filter (/= []) ls&lt;br&gt;wideNubMerge1 [] = []&lt;br&gt;wideNubMerge1 ls = mini:(wideNubMerge rest)&lt;br&gt; where mini = minimum $ map head ls&lt;br&gt; rest = map (dropWhile (== mini)) ls&lt;br&gt;&lt;br&gt;betterSortedSums = wideNubMerge matrixOfSums&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;However, if you know you're going to use all of the sums, and there's no advantage to getting some of them earlier, go with '&lt;code&gt;foldl merge []&lt;/code&gt;', as it's faster.&lt;/p&gt;" OwnerUserId="101" LastEditorUserId="101" LastEditorDisplayName="Peter Burns" LastEditDate="2008-08-06T18:56:00.657" LastActivityDate="2008-08-06T18:56:00.657" CommentCount="1" />
<row Id="845" PostTypeId="1" AcceptedAnswerId="849" CreationDate="2008-08-03T21:42:37.903" Score="57" ViewCount="21706" Body="&lt;p&gt;Suppose I have the following CSS rule in my HTML.&lt;/p&gt;&#xA;&#xA;&lt;pre class=&quot;lang-css prettyprint-override&quot;&gt;&lt;code&gt;body {&#xA; font-family: Calibri, Trebuchet MS, Helvetica, sans-serif;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How can I detect which one of the defined fonts was used in the user's browser?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Edit for people wondering why I want to do this: The font I am detecting contains glyphs not available in other fonts and when the user does not have it I want to display a link asking the user to download that font so they can use my web application.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Currently I am displaying the download font link for all users, now I can only display it for people who do not have the correct font installed.&lt;/p&gt;&#xA;" OwnerUserId="238" OwnerDisplayName="Pat" LastEditorUserId="771578" LastEditorDisplayName="Peter Hoffmann" LastEditDate="2013-07-04T01:24:40.357" LastActivityDate="2015-01-27T09:34:41.023" Title="How can I detect which font was used in a web page?" Tags="&lt;javascript&gt;&lt;html&gt;&lt;css&gt;&lt;fonts&gt;" AnswerCount="9" CommentCount="2" FavoriteCount="10" />
<row Id="849" PostTypeId="2" ParentId="845" CreationDate="2008-08-03T21:51:44.360" Score="34" Body="&lt;p&gt;I've seen it done in a kind of iffy, but pretty reliable way. Basically, an element is set to use a specific font and a string is set to that element. If the font set for the element does not exist, it takes the font of the parent element. So, what they do is measure the width of the rendered string. If it matches what they expected for the desired font as opposed to the derived font, it's present.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Here's where it came from:&#xA;&lt;a href=&quot;http://ajaxian.com/archives/javascriptcss-font-detector&quot;&gt;Javascript/CSS Font Detector (ajaxian.com; 12 Mar 2007)&lt;/a&gt;&lt;/p&gt;&#xA;" OwnerUserId="93" LastEditorUserId="367456" LastEditDate="2012-01-26T11:01:45.887" LastActivityDate="2012-01-26T11:01:45.887" CommentCount="2" />
<row Id="850" PostTypeId="2" ParentId="845" CreationDate="2008-08-03T21:55:30.233" Score="5" Body="&lt;p&gt;I ran across this:&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.lalit.org/lab/javascript-css-font-detect&quot; rel=&quot;nofollow&quot;&gt;Javascript/CSS Font Detector&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;which lets you detect what fonts are available based on the size of fonts. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;From here you can tell what font was loaded onto the page by using the same technique. &lt;/p&gt;&#xA;" OwnerUserId="204" LastEditorUserId="395659" LastEditDate="2013-02-07T11:23:34.063" LastActivityDate="2013-02-07T11:23:34.063" CommentCount="0" />
<row Id="855" PostTypeId="1" AcceptedAnswerId="858" CreationDate="2008-08-03T22:03:37.567" Score="7" ViewCount="2623" Body="&lt;p&gt;Is there an easy way to produce MSDN-style documentation from the Visual Studio XML output?&lt;br&gt;&#xA;I'm not patient enough to set up a good xslt for it because I know I'm not the first person to cross this bridge. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, I tried setting up sandcastle recently, but it really made my eyes cross. Either I was missing something important in the process or it is just way too involved.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I know somebody out there has a really nice dead-simple solution.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm reiterating here because I think my formatting made that paragraph non-inviting to read:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;I gave sandcastle a try but had a really hard time getting it set up.&#xA; What I really have in mind is something much simpler.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That is, unless I just don't understand the sandcastle process. It seemed like an awful lot of extra baggage to me just to produce something nice for the testers to work with.&lt;/p&gt;&#xA;" OwnerUserId="93" LastEditorUserId="2778810" LastEditorDisplayName="Scott Dorman" LastEditDate="2014-06-25T19:54:59.043" LastActivityDate="2014-06-25T19:54:59.043" Title=".Net XML comment into API Documentation" Tags="&lt;visual-studio&gt;&lt;xslt&gt;&lt;documentation&gt;&lt;sandcastle&gt;&lt;xml-comments&gt;" AnswerCount="6" CommentCount="0" FavoriteCount="3" />
<row Id="858" PostTypeId="2" ParentId="855" CreationDate="2008-08-03T22:12:52.820" Score="7" Body="&lt;p&gt;You're looking for Sandcastle&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Project Page: &lt;a href=&quot;http://www.codeplex.com/Sandcastle/Release/ProjectReleases.aspx&quot; rel=&quot;nofollow&quot;&gt;Sandcastle Releases&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Blog: &lt;a href=&quot;http://blogs.msdn.com/sandcastle/default.aspx&quot; rel=&quot;nofollow&quot;&gt;Sandcastle Blog&lt;/a&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://ndoc.sourceforge.net&quot; rel=&quot;nofollow&quot;&gt;NDoc Code Documentation Generator for .NET&lt;/a&gt; used to be the tool of choice, but support has all but stopped.&lt;/p&gt;&#xA;" OwnerUserId="34" LastEditorDisplayName="user1873471" LastEditDate="2013-01-28T03:56:05.070" LastActivityDate="2013-01-28T03:56:05.070" CommentCount="1" />
<row Id="859" PostTypeId="2" ParentId="855" CreationDate="2008-08-03T22:14:55.453" Score="4" Body="&lt;p&gt;Have a look at &lt;a href=&quot;http://blogs.msdn.com/sandcastle/&quot; rel=&quot;nofollow&quot;&gt;Sandcastle&lt;/a&gt;, which does exactly that. It's also one of the more simpler solutions out there, and it's more or less the tool of choice, so in the long run, maybe we could help you to set up Sandcastle if you specify what issues you encountered during setup?&lt;/p&gt;" OwnerUserId="91" LastEditorUserId="91" LastEditorDisplayName="Michael Stum" LastEditDate="2008-08-03T22:24:57.820" LastActivityDate="2008-08-03T22:24:57.820" CommentCount="1" />
<row Id="870" PostTypeId="2" ParentId="810" CreationDate="2008-08-03T22:34:06.380" Score="0" Body="&lt;p&gt;Despite what the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/x6kd89c5%28VS.80%29.aspx&quot; rel=&quot;nofollow&quot;&gt;MSDN article&lt;/a&gt; says about User/Machine Hive, it doesn't write to HKEY_USERS. Rather it writes to HKCU if you select Just Me and HKLM if you select Everyone.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;So my solution is going to be to use the User/Machine Hive, and then in the application it checks if the registry entries are in HKCU and if not, copies them from HKLM. I know this probably isn't the most ideal way of doing it, but it has the least amount of changes.&lt;/p&gt;" OwnerUserId="233" LastActivityDate="2008-08-03T22:34:06.380" CommentCount="0" />
<row Id="871" PostTypeId="1" AcceptedAnswerId="875" CreationDate="2008-08-03T22:38:29.040" Score="394" ViewCount="328400" Body="&lt;p&gt;I've been using &lt;a href=&quot;http://en.wikipedia.org/wiki/Apache_Subversion&quot; rel=&quot;nofollow&quot;&gt;Subversion&lt;/a&gt; for a few years and after using &lt;a href=&quot;http://en.wikipedia.org/wiki/Microsoft_Visual_SourceSafe&quot; rel=&quot;nofollow&quot;&gt;SourceSafe&lt;/a&gt;, I just love Subversion. Combined with &lt;a href=&quot;http://en.wikipedia.org/wiki/TortoiseSVN&quot; rel=&quot;nofollow&quot;&gt;TortoiseSVN&lt;/a&gt;, I can't really imagine how it could be any better. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Yet there's a growing number of developers claiming that Subversion has problems and that we should be moving to the new breed of distributed version control systems, such as &lt;a href=&quot;http://git.or.cz/&quot; rel=&quot;nofollow&quot; title=&quot;Git Distributed Version Control System&quot;&gt;Git&lt;/a&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;How does Git improve upon Subversion?&lt;/p&gt;&#xA;" OwnerUserId="203" LastEditorUserId="63550" LastEditorDisplayName="Jon Limjap" LastEditDate="2010-07-23T10:24:35.053" LastActivityDate="2011-10-25T06:30:09.073" Title="Why is Git better than Subversion?" Tags="&lt;svn&gt;&lt;git&gt;" AnswerCount="30" CommentCount="12" FavoriteCount="597" CommunityOwnedDate="2011-05-18T15:58:09.637" />
<row Id="873" PostTypeId="2" ParentId="871" CreationDate="2008-08-03T22:44:26.203" Score="55" Body="&lt;p&gt;Google Tech Talk: Linus Torvalds on git&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=4XpnKHJAok8&quot; rel=&quot;nofollow&quot;&gt;http://www.youtube.com/watch?v=4XpnKHJAok8&lt;/a&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;The Git Wiki's comparison page&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;a href=&quot;http://git.or.cz/gitwiki/GitSvnComparsion&quot; rel=&quot;nofollow&quot;&gt;http://git.or.cz/gitwiki/GitSvnComparsion&lt;/a&gt;&lt;/p&gt;" OwnerUserId="150" LastActivityDate="2008-08-03T22:44:26.203" CommentCount="4" CommunityOwnedDate="2011-05-18T15:58:09.637" />
<row Id="875" PostTypeId="2" ParentId="871" CreationDate="2008-08-03T22:45:44.533" Score="550" Body="&lt;p&gt;Git is not better than Subversion. But is also not worse. It's different.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The key difference is that it is decentralized. Imagine you are a developer on the road, you develop on your laptop and you want to have source control so that you can go back 3 hours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Subversion, you have a Problem: The SVN Repository may be in a location you can't reach (in your company, and you don't have internet at the moment), you cannot commit. If you want to make a copy of your code, you have to literally copy/paste it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With Git, you do not have this problem. Your local copy is a repository, and you can commit to it and get all benefits of source control. When you regain connectivity to the main repository, you can commit against it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This looks good at first, but just keep in mind the added complexity to this approach.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Git seems to be the &quot;new, shiny, cool&quot; thing. It's by no means bad (there is a reason Linus wrote it for the Linux Kernel development after all), but I feel that many people jump on the &quot;Distributed Source Control&quot; train just because it's new and is written by Linus Torvalds, without actually knowing why/if it's better.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Subversion has Problems, but so does Git, Mercurial, CVS, TFS or whatever.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit:&lt;/strong&gt; So this answer is now a year old and still generates many upvotes, so I thought I'll add some more explanations. In the last year since writing this, Git has gained a lot of momentum and support, particularly since sites like GitHub really took off. I'm using both Git and Subversion nowadays and I'd like to share some personal insight.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;First of all, Git can be really confusing at first when working decentralized. What is a remote? and How to properly set up the initial repository? are two questions that come up at the beginning, especially compared to SVN's simple &quot;svnadmin create&quot;, Git's &quot;git init&quot; can take the parameters --bare and --shared which seems to be the &quot;proper&quot; way to set up a centralized repository. There are reasons for this, but it adds complexity. The documentation of the &quot;checkout&quot; command is very confusing to people changing over - the &quot;proper&quot; way seems to be &quot;git clone&quot;, while &quot;git checkout&quot; seems to switch branches.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Git REALLY shines when you are decentralized. I have a server at home and a Laptop on the road, and SVN simply doesn't work well here. With SVN, I can't have local source control if I'm not connected to the repository (Yes, I know about SVK or about ways to copy the repo). With Git, that's the default mode anyway. It's an extra command though (git commit commits locally, whereas git push origin master pushes the master branch to the remote named &quot;origin&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As said above: Git adds complexity. Two modes of creating repositories, checkout vs. clone, commit vs. push... You have to know which commands work locally and which work with &quot;the server&quot; (I'm assuming most people still like a central &quot;master-repository&quot;).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also, the tooling is still insufficient, at least on Windows. Yes, there is a Visual Studio AddIn, but I still use git bash with msysgit.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;SVN has the advantage that it's MUCH simpler to learn: There is your repository, all changes to towards it, if you know how to create, commit and checkout and you're ready to go and can pickup stuff like branching, update etc. later on.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Git has the advantage that it's MUCH better suited if some developers are not always connected to the master repository. Also, it's much faster than SVN. And from what I hear, branching and merging support is a lot better (which is to be expected, as these are the core reasons it was written).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This also explains why it gains so much buzz on the Internet, as Git is perfectly suited for Open Source projects: Just Fork it, commit your changes to your own Fork, and then ask the original project maintainer to pull your changes. With Git, this just works. Really, try it on Github, it's magic.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What I also see are Git-SVN Bridges: The central repository is a Subversion repo, but developers locally work with Git and the bridge then pushes their changes to SVN.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;But even with this lengthy addition, I still stand by my core message: Git is not better or worse, it's just different. If you have the need for &quot;Offline Source Control&quot; and the willingness to spend some extra time learning it, it's fantastic. But if you have a strictly centralized Source Control and/or are struggling to introduce Source Control in the first place because your co-workers are not interested, then the simplicity and excellent tooling (at least on Windows) of SVN shine.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="91" LastEditDate="2009-12-28T04:45:25.160" LastActivityDate="2009-12-28T04:45:25.160" CommentCount="33" CommunityOwnedDate="2011-05-18T15:58:09.637" />
<row Id="876" PostTypeId="2" ParentId="871" CreationDate="2008-08-03T22:47:42.703" Score="26" Body="&lt;p&gt;Well, it's distributed. Benchmarks indicate that it's considerably faster (given its distributed nature, operations like diffs and logs are all local so of course it's blazingly faster in this case), and working folders are smaller (which still blows my mind).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you're working on subversion, or any other client/server revision control system, you essentially create working copies on your machine by &lt;em&gt;checking-out&lt;/em&gt; revisions. This represents a snapshot in time of what the repository looks like. You update your working copy via updates, and you update the repository via commits.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;With a distributed version control, you don't have a snapshot, but rather the entire codebase. Wanna do a diff with a 3 month old version? No problem, the 3 month old version is still on your computer. This doesn't only mean things are way faster, but if you're disconnected from your central server, you can still do many of the operations you're used to. In other words, you don't just have a snapshot of a given revision, but the entire codebase.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;You'd think that Git would take up a bunch of space on your harddrive, but from a couple benchmarks I've seen, it actually takes less. Don't ask me how. I mean, it was built by Linus, he knows a thing or two about filesystems I guess.&lt;/p&gt;&#xA;" OwnerUserId="34" LastEditorUserId="3002" LastEditorDisplayName="dF" LastEditDate="2008-10-13T19:13:34.300" LastActivityDate="2008-10-13T19:13:34.283" CommentCount="2" CommunityOwnedDate="2011-05-18T15:58:09.637" />
<row Id="877" PostTypeId="2" ParentId="717" CreationDate="2008-08-03T22:48:47.490" Score="8" Body="&lt;p&gt;You'll need to compile with the target &lt;code&gt;CPU&lt;/code&gt; set to &lt;code&gt;x86&lt;/code&gt; to force your code to use the &lt;code&gt;32 bit&lt;/code&gt; version of the &lt;code&gt;VFP OLE Db provider&lt;/code&gt;. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/vfoxpro/bb190293.aspx&quot; rel=&quot;nofollow&quot;&gt;Microsoft has stated&lt;/a&gt; that there are no plans on releasing a &lt;code&gt;64-bit&lt;/code&gt; edition of the Visual FoxPro OLE Db provider. For what's worth, Microsoft has &lt;a href=&quot;http://msdn.microsoft.com/en-us/vfoxpro/bb308952.aspx&quot; rel=&quot;nofollow&quot;&gt;also stated&lt;/a&gt; that VFP 9 is the final version of &lt;code&gt;Visual FoxPro&lt;/code&gt; and support will end in &lt;code&gt;2015&lt;/code&gt;. If you need the &lt;code&gt;OLE DB&lt;/code&gt; provider for &lt;code&gt;VFP 9&lt;/code&gt;, you can get it &lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?FamilyId=E1A87D8F-2D58-491F-A0FA-95A3289C5FD4&amp;amp;displaylang=en&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&#xA;" OwnerUserId="206" LastEditorUserId="395659" LastEditDate="2013-02-07T11:20:02.040" LastActivityDate="2013-02-07T11:20:02.040" CommentCount="0" />
<row Id="879" PostTypeId="1" AcceptedAnswerId="885" CreationDate="2008-08-03T22:51:41.447" Score="75" ViewCount="50614" Body="&lt;p&gt;Are PHP variables passed by value or by reference?&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="2581872" LastEditorDisplayName="Mark Biek" LastEditDate="2014-05-25T01:52:44.717" LastActivityDate="2014-12-21T10:21:07.833" Title="Are PHP Variables passed by value or by reference?" Tags="&lt;php&gt;&lt;variables&gt;&lt;pass-by-reference&gt;&lt;pass-by-value&gt;" AnswerCount="12" CommentCount="0" FavoriteCount="34" />
<row Id="880" PostTypeId="2" ParentId="879" CreationDate="2008-08-03T22:52:11.930" Score="-4" Body="&lt;P&gt;Depends on the version, 4 is by value, 5 is by reference.&lt;/P&gt;" OwnerUserId="34" LastActivityDate="2008-08-03T22:52:11.930" CommentCount="1" />
<row Id="881" PostTypeId="2" ParentId="879" CreationDate="2008-08-03T22:52:17.593" Score="8" Body="&lt;p&gt;PHP variables are assigned by value, passed to functions by value, and when containing/representing objects are passed by reference. You can force variables to pass by reference using an &amp;amp;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Assigned by value/reference example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$var1 = &quot;test&quot;;&#xA;$var2 = $var1;&#xA;$var2 = &quot;new test&quot;;&#xA;$var3 = &amp;amp;$var2;&#xA;$var3 = &quot;final test&quot;;&#xA;&#xA;print (&quot;var1: $var1, var2: $var2, var3: $var3);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;would output &quot;var1: test, var2: final test, var3: final test&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Passed by value/reference exampe:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$var1 = &quot;foo&quot;;&#xA;$var2 = &quot;bar&quot;;&#xA;&#xA;changeThem($var1, $var2);&#xA;&#xA;print &quot;var1: $var1, var2: $var2&quot;;&#xA;&#xA;function changeThem($var1, &amp;amp;$var2){&#xA; $var1 = &quot;FOO&quot;;&#xA; $var2 = &quot;BAR&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;would output: &quot;var1: foo, var2 BAR&quot;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Object variables passed by reference exampe:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;class Foo{&#xA; public $var1;&#xA;&#xA; function __construct(){&#xA; $this-&amp;gt;var1 = &quot;foo&quot;;&#xA; }&#xA;&#xA; public function printFoo(){&#xA; print $this-&amp;gt;var1;&#xA; }&#xA;}&#xA;&#xA;&#xA;$foo = new Foo();&#xA;&#xA;changeFoo($foo);&#xA;&#xA;$foo-&amp;gt;printFoo();&#xA;&#xA;function changeFoo($foo){&#xA; $foo-&amp;gt;var1 = &quot;FOO&quot;;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Would output: &quot;FOO&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;(that last example could be better probably...)&lt;/p&gt;&#xA;" OwnerUserId="58" LastEditorUserId="-1" LastEditorDisplayName="cmcculloh" LastEditDate="2013-09-27T12:45:50.493" LastActivityDate="2013-09-27T12:45:50.493" CommentCount="1" />
<row Id="884" PostTypeId="2" ParentId="826" CreationDate="2008-08-03T23:06:15.443" Score="3" Body="&lt;p&gt;Rather than coding this out, I figure I'll pseudo-code it in steps and explain my logic, so that better programmers can poke holes in my logic if necessary. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;On the first step we start out with a list of numbers length n. For each number we need to create a list of length n-1 becuase we aren't adding a number to itself. By the end we have a list of about n sorted lists that was generated in O(n^2) time.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;step1(startinglist) &#xA;for each number num1 in startinglist&#xA; for each number num2 in startinglist&#xA; add num1 plus num2 into templist&#xA; add templist to sumlist&#xA;return sumlist &#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;In step 2 because the lists were sorted by design (add a number to each element in a sorted list and the list will still be sorted) we can simply do a mergesort by merging each list together rather than mergesorting the whole lot. In the end this should take O(n^2) time.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;step2(sumlist) &#xA;create an empty list mergedlist&#xA;for each list templist in sumlist&#xA; set mergelist equal to: merge(mergedlist,templist)&#xA;return mergedlist&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The merge method would be then the normal merge step with a check to make sure that there are no duplicate sums. I won't write this out because anyone can look up mergesort.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So there's my solution. The entire algorithm is O(n^2) time. Feel free to point out any mistakes or improvements.&lt;/p&gt;&#xA;" OwnerUserId="159" LastEditorUserId="96780" LastEditorDisplayName="Derek Park" LastEditDate="2013-07-23T14:41:11.770" LastActivityDate="2013-07-23T14:41:11.770" CommentCount="1" />
<row Id="885" PostTypeId="2" ParentId="879" CreationDate="2008-08-03T23:06:56.423" Score="108" Body="&lt;p&gt;It's by value according to the &lt;a href=&quot;http://fr3.php.net/manual/en/functions.arguments.php&quot;&gt;PHP Documentation&lt;/a&gt;.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;By default, function arguments are passed by value (so that if the value of the argument within the function is changed, it does not get changed outside of the function). To allow a function to modify its arguments, they must be passed by reference.&lt;/p&gt;&#xD;&#xA; &#xD;&#xA; &lt;p&gt;To have an argument to a function always passed by reference, prepend an ampersand (&amp;amp;) to the argument name in the function definition.&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;?php&lt;br&gt;function add_some_extra(&amp;amp;$string)&lt;br&gt;{&lt;br&gt; $string .= 'and something extra.';&lt;br&gt;}&lt;br&gt;$str = 'This is a string, ';&lt;br&gt;add_some_extra($str);&lt;br&gt;echo $str; // outputs 'This is a string, and something extra.'&lt;br&gt;?&amp;gt;&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="91" LastActivityDate="2008-08-03T23:06:56.423" CommentCount="2" />
<row Id="886" PostTypeId="2" ParentId="871" CreationDate="2008-08-03T23:08:23.580" Score="5" Body="&lt;p&gt;Git and DVCS in general is great for developers doing a lot of coding independently of each other because everyone has their own branch. If you need a change from someone else, though, she has to commit to her local repo and then she must push that changeset to you or you must pull it from her.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;My own reasoning also makes me think DVCS makes things harder for QA and release management if you do things like centralized releases. Someone has to be responsible for doing that push/pull from everyone else's repository, resolving any conflicts that would have been resolved at initial commit time before, then doing the build, and then having all the other developers re-sync their repos.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;All of this can be addressed with human processes, of course; DVCS just broke something that was fixed by centralized version control in order to provide some new conveniences.&lt;/p&gt;" OwnerUserId="153" LastActivityDate="2008-08-03T23:08:23.580" CommentCount="1" CommunityOwnedDate="2011-05-18T15:58:09.637" />
<row Id="887" PostTypeId="2" ParentId="879" CreationDate="2008-08-03T23:08:26.263" Score="21" Body="&lt;p&gt;@Karl&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In PHP5 variables are by default passed by value and objects are by default passed by reference.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Either can be optionally passed by reference using the &lt;strong&gt;&amp;amp;&lt;/strong&gt; operator.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;However, most older PHP functions will not alter a primitive even if you pass a reference...&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;$str = &quot;hello world&quot;;&#xA;&#xA;echo $str; // hello world&#xA;echo strrev($str); // dlrow olleh&#xA;&#xA;strrev( &amp;amp;$str ); // ! Warning is issued&#xA;echo $str; // hello world&#xA;&#xA;$str = strrev($str);&#xA;echo $str; // dlrow olleh&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;If you do try to pass a value as a reference it will throw a warning. It is up to the function to decide to work on the value or reference.&lt;/p&gt;&#xA;" OwnerUserId="40" LastEditorUserId="237838" LastEditDate="2013-02-07T17:31:33.853" LastActivityDate="2013-02-07T17:31:33.853" CommentCount="10" />
<row Id="888" PostTypeId="1" AcceptedAnswerId="890" CreationDate="2008-08-03T23:18:21.627" Score="299" ViewCount="207441" Body="&lt;p&gt;How do you debug your &lt;strong&gt;PHP&lt;/strong&gt; scripts?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I am aware of basic debugging such as using the Error Reporting. The breakpoint debugging in &lt;strong&gt;PHPEclipse&lt;/strong&gt; is also quite useful.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Any other good/better techniques out there?&lt;/p&gt;&#xA;" OwnerUserId="131" LastEditorUserId="1332690" LastEditDate="2012-04-25T03:11:39.057" LastActivityDate="2014-12-15T15:04:21.110" Title="How do you debug PHP scripts?" Tags="&lt;php&gt;&lt;debugging&gt;" AnswerCount="28" CommentCount="11" FavoriteCount="119" ClosedDate="2012-08-08T17:26:15.550" CommunityOwnedDate="2011-03-09T11:34:12.603" />
<row Id="889" PostTypeId="2" ParentId="888" CreationDate="2008-08-03T23:20:48.347" Score="13" Body="&lt;p&gt;I've used the &lt;a href=&quot;http://www.zend.com/products/studio/&quot;&gt;Zend Studio (5.5)&lt;/a&gt;, together with &lt;a href=&quot;http://www.zend.com/en/products/platform/&quot;&gt;Zend Platform&lt;/a&gt;. That gives proper debugging, breakpoints/stepping over the code etc., although at a price.&lt;/p&gt;" OwnerUserId="91" LastActivityDate="2008-08-03T23:20:48.347" CommentCount="0" CommunityOwnedDate="2011-03-09T11:34:12.603" />
<row Id="890" PostTypeId="2" ParentId="888" CreationDate="2008-08-03T23:28:39.890" Score="110" Body="&lt;p&gt;I follow &lt;a href=&quot;http://dev.piwik.org/trac/wiki/HowToSetupDevelopmentEnvironmentWindows&quot;&gt;this article&lt;/a&gt; to setup an Eclipse environment that has debugging features like you mentioned. The ability to step into the code is a much better way to debug then the old method of var_dump and print at various points to see where your flow goes wrong. When all else fails though and all I have is SSH and vim I still &lt;code&gt;var_dump()&lt;/code&gt;/&lt;code&gt;die()&lt;/code&gt; to find where the code goes south.&lt;/p&gt;&#xA;" OwnerUserId="200" LastEditorUserId="798818" LastEditDate="2011-10-29T16:57:19.243" LastActivityDate="2011-10-29T16:57:19.243" CommentCount="8" CommunityOwnedDate="2011-03-09T11:34:12.603" />
<row Id="891" PostTypeId="2" ParentId="888" CreationDate="2008-08-03T23:32:13.020" Score="0" Body="&lt;pre&gt;&lt;code&gt;print_r( debug_backtrace() );&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;or something like that :-)&lt;/p&gt;" OwnerUserId="234" LastActivityDate="2008-08-03T23:32:13.020" CommentCount="1" CommunityOwnedDate="2011-03-09T11:34:12.603" />
<row Id="893" PostTypeId="2" ParentId="871" CreationDate="2008-08-03T23:38:05.113" Score="6" Body="&lt;p&gt;It's all about the ease of use/steps required to do something.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If I'm developing a single project on my PC/laptop, git is better, because it is far easier to set up and use. &#xD;&#xA;You don't need a server, and you don't need to keep typing repository URL's in when you do merges.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If it were just 2 people, I'd say git is also easier, because you can just push and pull from eachother.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Once you get beyond that though, I'd go for subversion, because at that point you need to set up a 'dedicated' server or location. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You can do this just as well with git as with SVN, but the benefits of git get outweighed by the need to do additional steps to synch with a central server. In SVN you just commit. In git you have to git commit, then git push. The additional step gets annoying simply because you end up doing it so much.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;SVN also has the benefit of better GUI tools, however the git ecosystem seems to be catching up quickly, so I wouldn't worry about this in the long term.&lt;/p&gt;" OwnerUserId="234" LastActivityDate="2008-08-03T23:38:05.113" CommentCount="4" CommunityOwnedDate="2011-05-18T15:58:09.637" />
<row Id="894" PostTypeId="2" ParentId="805" CreationDate="2008-08-03T23:52:47.360" Score="6" Body="&lt;p&gt;If you have the ability to use WScript.Shell then you can just execute pscp.exe from the &lt;a href=&quot;http://www.chiark.greenend.org.uk/%7Esgtatham/putty/&quot;&gt;Putty&lt;/a&gt; package. Obviously this is less then ideal but it will get the job done and let you use SCP/SFTP in classic ASP.&lt;/p&gt;" OwnerUserId="200" LastActivityDate="2008-08-03T23:52:47.360" CommentCount="1" />
<row Id="895" PostTypeId="2" ParentId="194" CreationDate="2008-08-03T23:56:54.077" Score="1" Body="&lt;p&gt;I am by no means authoritative, but I believe the only supported path is from 6.5 to 7. Certainly that would be the most sane route, then I believe you can migrate from 7 directly to 2005 pretty painlessly.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;As for scripting out all the objects - I would advise against it as you will inevitably miss something (unless you database is truly trivial).&lt;/p&gt;" OwnerUserId="243" LastActivityDate="2008-08-03T23:56:54.077" CommentCount="0" />
<row Id="896" PostTypeId="2" ParentId="879" CreationDate="2008-08-03T23:57:46.820" Score="17" Body="&lt;P&gt;&lt;A href=&quot;http://www.php.net/manual/en/migration5.oop.php&quot;&gt;http://www.php.net/manual/en/migration5.oop.php&lt;/A&gt;&lt;/P&gt;&#xD;&#xA;&lt;BLOCKQUOTE&gt;&#xD;&#xA;&lt;P&gt;In PHP 5 there is a new Object Model. PHP's handling of objects has been completely rewritten, allowing for better performance and more features. In previous versions of PHP, objects were handled like primitive types (for instance integers and strings). The drawback of this method was that semantically the whole object was copied when a variable was assigned, or passed as a parameter to a method. In the new approach, objects are referenced by handle, and not by value (one can think of a handle as an object's identifier). &lt;/P&gt;&lt;/BLOCKQUOTE&gt;" OwnerUserId="34" LastActivityDate="2008-08-03T23:57:46.820" CommentCount="0" />
<row Id="897" PostTypeId="2" ParentId="879" CreationDate="2008-08-04T00:05:05.790" Score="3" Body="&lt;p&gt;Variables containing primitive types are passed by value in PHP5. Variables containing objects are passed by reference. There's quite an interesting article from Linux Journal from 2006 which mentions this and other OO differences between 4 and 5.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.linuxjournal.com/article/9170&quot; rel=&quot;nofollow&quot;&gt;http://www.linuxjournal.com/article/9170&lt;/a&gt; &lt;/p&gt;" OwnerUserId="137" LastActivityDate="2008-08-04T00:05:05.790" CommentCount="1" />
<row Id="898" PostTypeId="1" CreationDate="2008-08-04T00:08:51.010" Score="38" ViewCount="3709" Body="&lt;p&gt;How have you implemented Internationalization (i18n) in actual projects you've worked on?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I took an interest in making software cross-cultural after I read the famous post by Joel, &lt;a href=&quot;http://www.joelonsoftware.com/articles/Unicode.html&quot; rel=&quot;nofollow&quot;&gt;The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)&lt;/a&gt;. However, I have yet to able to take advantage of this in a real project, besides making sure I used Unicode strings where possible. But making all your strings Unicode and ensuring you understand what encoding everything you work with is in is just the tip of the i18n iceberg.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Everything I have worked on to date has been for use by a controlled set of US English speaking people, or i18n just wasn't something we had time to work on before pushing the project live. So I am looking for any tips or war stories people have about making software more localized in real world projects.&lt;/p&gt;&#xA;" OwnerUserId="200" LastEditorUserId="1668244" LastEditorDisplayName="Jim Anderson" LastEditDate="2014-07-10T21:39:23.003" LastActivityDate="2014-07-10T21:39:23.003" Title="Internationalization in your projects" Tags="&lt;language-agnostic&gt;&lt;unicode&gt;&lt;localization&gt;&lt;internationalization&gt;" AnswerCount="11" CommentCount="0" FavoriteCount="36" />
<row Id="904" PostTypeId="1" AcceptedAnswerId="911" CreationDate="2008-08-04T00:17:34.690" Score="37" ViewCount="11397" Body="&lt;p&gt;Given a relatively simple CSS:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;div style=&quot;width:150px;&quot;&amp;gt;&#xA; 12333-2333-233-23339392-332332323&#xA;&amp;lt;/div&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;How do I make it so that the string stays constrained to the width of 150, and simply wraps to a newline on the hyphen?&lt;/p&gt;&#xA;" OwnerUserId="34" LastEditorUserId="214668" LastEditorDisplayName="Jeff Atwood" LastEditDate="2012-04-25T04:33:27.570" LastActivityDate="2014-07-10T21:33:00.213" Title="In HTML, how to word-break on a dash?" Tags="&lt;html&gt;&lt;css&gt;&lt;text&gt;" AnswerCount="7" CommentCount="3" FavoriteCount="7" />
<row Id="905" PostTypeId="1" AcceptedAnswerId="942" CreationDate="2008-08-04T00:17:55.767" Score="4" ViewCount="456" Body="&lt;p&gt;We're upgrading an existing program from &lt;code&gt;Win2k/SQL Server 2k&lt;/code&gt; to &lt;code&gt;Windows 2003 and SQL Server 2005&lt;/code&gt; as well as purchasing a new program that also uses &lt;code&gt;2k3/2k5&lt;/code&gt;. The vendor says that for us to host both databases we need to get the Enterprise version because the softwares clients use different collation for the connections and only Enterprise supports this.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I cannot find anything on MS's site to support this and, honestly, don't want to pay the extra for Enterprise if the Standard edition works. Am I missing some not talked about feature of SQL Server or is this, as I suspect, a vendor trying to upsell me?&lt;/p&gt;&#xA;" OwnerUserId="204" LastEditorUserId="2641576" LastEditorDisplayName="Nigel Campbell" LastEditDate="2014-11-25T20:47:15.133" LastActivityDate="2014-11-25T20:47:15.133" Title="Client collation and SQL Server 2005" Tags="&lt;sql-server&gt;&lt;sql-server-2005&gt;&lt;windows-server-2003&gt;" AnswerCount="1" CommentCount="0" FavoriteCount="1" />
<row Id="906" PostTypeId="2" ParentId="898" CreationDate="2008-08-04T00:23:00.123" Score="7" Body="&lt;p&gt;I worked on a project for my previous employer that used .NET, and there was a built in .resx format we used. We basically had a file that had all translations in the .resx file, and then multiple files with different translations. The consequence of this is that you have to be very diligent about ensuring that all strings visible in the application are stored in the .resx, and anytime one is changed you have to update all languages you support.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If you get lazy and don't notify the people in charge of translations, or you embed strings without going through your localization system, it will be a nightmare to try and fix it later. Similarly, if localization is an afterthought, it will be very difficult to put in place. Bottom line, if you don't have all visible strings stored externally in a standard place, it will be very difficult to find all that need to be localized.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;One other note, very strictly avoid concatenating visible strings directly, such as&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;String message = &quot;The &quot; + item + &quot; is on sale!&quot;;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Instead, you must use something like&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;String message = String.Format(&quot;The {0} is on sale!&quot;, item);&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The reason for this is that different languages often order the words differently, and concatenating strings directly will need a new build to fix, but if you used some kind of string replacement mechanism like above, you can modify your .resx file (or whatever localization files you use) for the specific language that needs to reorder the words.&lt;/p&gt;&#xA;" OwnerUserId="122" LastEditorUserId="237838" LastEditDate="2013-02-07T17:33:54.490" LastActivityDate="2013-02-07T17:33:54.490" CommentCount="1" />
<row Id="908" PostTypeId="2" ParentId="194" CreationDate="2008-08-04T00:23:55.690" Score="1" Body="&lt;p&gt;If you can find a professional or some other super-enterprise version of Visual Studio 6.0 - it came with a copy of &lt;a href=&quot;http://en.wikipedia.org/wiki/MSDE&quot; rel=&quot;nofollow&quot;&gt;MSDE&lt;/a&gt; (Basically the predecessor to SQL Express). I believe MSDE 2000 is still available as a free download from Microsoft, but I don't know if you can migrate directly from 6.5 to 2000.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I think in concept, you won't likely face any danger. Years of practice however tell me that you will always miss some object, permission, or other database item that won't manifest itself immediately. If you can script out the entire dump, the better as you will be less likely to miss something - and if you do miss something, it can be easily added to the script and fixed. I would avoid any manual steps (other than hitting the enter key once) like the plague.&lt;/p&gt;" OwnerUserId="243" LastActivityDate="2008-08-04T00:23:55.690" CommentCount="0" />
<row Id="910" PostTypeId="2" ParentId="871" CreationDate="2008-08-04T00:24:15.940" Score="145" Body="&lt;p&gt;With Git, you can do practically anything offline, because everybody has their own repository.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Making branches and merging between branches is really easy.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Even if you don't have commit rights for a project, you can still have your own repository online, and publish &quot;push requests&quot; for your patches. Everybody who likes your patches can pull them into their project, including the official maintainers.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's trivial to fork a project, modify it, and still keep merging in the bugfixes from the HEAD branch. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Git works for the Linux kernel developers. That means it is really fast (it has to be), and scales to thousands of contributors. Git also uses less space (up to 30 times less space for the Mozilla repository).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Git is very flexible, very TIMTOWTDI (There is more than one way to do it). You can use whatever workflow you want, and Git will support it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Finally, there's &lt;a href=&quot;http://en.wikipedia.org/wiki/GitHub&quot; rel=&quot;nofollow&quot;&gt;GitHub&lt;/a&gt;, a great site for hosting your Git repositories.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Drawbacks of Git: &lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;it's much harder to learn, because Git has more concepts and more commands.&lt;/li&gt;&#xA;&lt;li&gt;revisions don't have version numbers like in subversion&lt;/li&gt;&#xA;&lt;li&gt;many Git commands are cryptic, and error messages are very user-unfriendly&lt;/li&gt;&#xA;&lt;li&gt;it lacks a good GUI (such as the great &lt;a href=&quot;http://en.wikipedia.org/wiki/TortoiseSVN&quot; rel=&quot;nofollow&quot;&gt;TortoiseSVN&lt;/a&gt;)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="136" LastEditorUserId="63550" LastEditDate="2010-07-27T08:43:52.467" LastActivityDate="2010-07-27T08:43:52.467" CommentCount="9" CommunityOwnedDate="2011-05-18T15:58:09.637" />
<row Id="911" PostTypeId="2" ParentId="904" CreationDate="2008-08-04T00:25:11.227" Score="41" Body="&lt;p&gt;Replace your hyphens with this:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;&amp;amp;shy;&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;It's called a &quot;soft&quot; hyphen.&lt;/p&gt;" OwnerUserId="55" LastActivityDate="2008-08-04T00:25:11.227" CommentCount="2" />
<row Id="912" PostTypeId="2" ParentId="904" CreationDate="2008-08-04T00:25:28.403" Score="12" Body="&lt;p&gt;As part of CSS3, it is not yet fully supported, &lt;a href=&quot;http://www.css3.info/preview/word-wrap/&quot; rel=&quot;nofollow&quot;&gt;but you can find information on word-wrapping here&lt;/a&gt;. Another option is the &lt;a href=&quot;http://www.quirksmode.org/oddsandends/wbr.html&quot; rel=&quot;nofollow&quot;&gt;wbr tag, &amp;amp;shy;, and &amp;amp;#8203;&lt;/a&gt; none of which are fully supported either.&lt;/p&gt;&#xA;" OwnerUserId="200" LastEditorUserId="1668244" LastEditorDisplayName="John Downey" LastEditDate="2014-07-10T21:33:00.213" LastActivityDate="2014-07-10T21:33:00.213" CommentCount="1" />
<row Id="918" PostTypeId="1" AcceptedAnswerId="1203" CreationDate="2008-08-04T00:33:54.640" Score="87" ViewCount="92398" Body="&lt;p&gt;I have been dabbling in &lt;code&gt;Python&lt;/code&gt; for a couple months now, read the online docs/tutorial and started playing with &lt;code&gt;Django&lt;/code&gt; a bit as well... and I feel like I am starting to leave my formative toddler years and ready for some more serious code. Most everything I see is generally encapsulated in a single script or so large and unwieldy I don't know where to start. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;I would really like to see an excellent example of some proper Python code, style, organization etc. and ideally a WHY associated with some of those decisions. Any ideas for where I should look next? I would prefer a simple console app with at most just a few extra .py files (maybe one package for good measure)...&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh, and one more thing: The reason this is coming up is I have quite a bit of experience in Java and .NET where it is generally preferred to have one class definition per source file. That rarely seems to be the case in the python world (at least in my very limited exposure) and it just doesn't smell right to me. So maybe this is more Enterprise Python that hobbyist python or something.&lt;/p&gt;&#xA;" OwnerUserId="243" LastEditorUserId="1645769" LastEditorDisplayName="Luke" LastEditDate="2013-06-29T20:18:18.207" LastActivityDate="2013-06-29T20:18:18.207" Title="How to learn Python: Good Example Code?" Tags="&lt;python&gt;" AnswerCount="16" CommentCount="1" FavoriteCount="130" ClosedDate="2012-05-14T17:06:07.407" />
<row Id="921" PostTypeId="2" ParentId="898" CreationDate="2008-08-04T00:35:14.110" Score="14" Body="&lt;p&gt;Some fun things:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ol&gt;&#xD;&#xA;&lt;li&gt;&lt;p&gt;Having a PHP and MySQL Application that works well with German and French, but now needs to support Russian and Chinese. I think I move this over to .net, as PHP's Unicode support is - in my opinion - not really good. Sure, juggling around with utf8_de/encode or the mbstring-functions is fun. Almost as fun as having Freddy Krüger visit you at night...&lt;/p&gt;&lt;/li&gt;&#xD;&#xA;&lt;li&gt;&lt;p&gt;Realizing that some languages are a LOT more Verbose than others. German is a LOT more verbose than English usually, and seeing how the German Version destroys the User Interface because too little space was allocated was not fun. Some products gained some fame for their creative ways to work around that, with Oblivion's &quot;Schw.Tr.d.Le.En.W.&quot; being memorable :-)&lt;/p&gt;&lt;/li&gt;&#xD;&#xA;&lt;li&gt;&lt;p&gt;Playing around with date formats, woohoo! Yes, there ARE actually people in the world who use date formats where the day goes in the middle. Sooooo much fun trying to find out what 07/02/2008 is supposed to mean, just because some users might believe it could be July 2... But then again, you guys over the pond may believe the same about users who put the month in the middle :-P, especially because in English, July 2 sounds a lot better than 2nd of July, something that does not neccessarily apply to other languages (i.e. in German, you would never say Juli 2 but always Zweiter Juli). I use 2008-02-07 whenever possible. It's clear that it means February 7 and it sorts properly, but dd/mm vs. mm/dd can be a really tricky problem.&lt;/p&gt;&lt;/li&gt;&#xD;&#xA;&lt;li&gt;&lt;p&gt;Anoter fun thing, &lt;a href=&quot;http://stackoverflow.com/questions/192/floating-point-number-parsing-is-there-a-catch-all-algorithm&quot; rel=&quot;nofollow&quot;&gt;Number formats&lt;/a&gt;! 10.000,50 vs 10,000.50 vs. 10 000,50 vs. 10'000,50... This is my biggest nightmare right now, having to support a multi-cultural environent but not having any way to reliably know what number format the user will use.&lt;/p&gt;&lt;/li&gt;&#xD;&#xA;&lt;li&gt;&lt;p&gt;Formal or Informal. In some language, there are two ways to address people, a formal way and a more informal way. In English, you just say &quot;You&quot;, but in German you have to decide between the formal &quot;Sie&quot; and the informal &quot;Du&quot;, same for French Tu/Vous. It's usually a safe bet to choose the formal way, but this is easily overlooked.&lt;/p&gt;&lt;/li&gt;&#xD;&#xA;&lt;li&gt;&lt;p&gt;Calendars. In Europe, the first day of the Week is Monday, whereas in the US it's Sunday. Calendar Widgets are nice. Showing a Calendar with Sunday on the left and Saturday on the right to a European user is not so nice, it confuses them.&lt;/p&gt;&lt;/li&gt;&#xD;&#xA;&lt;/ol&gt;" OwnerUserId="91" LastEditorUserId="91" LastEditorDisplayName="Michael Stum" LastEditDate="2008-08-04T00:41:52.583" LastActivityDate="2008-08-04T00:41:52.583" CommentCount="1" />
<row Id="922" PostTypeId="2" ParentId="918" CreationDate="2008-08-04T00:36:01.643" Score="27" Body="&lt;p&gt;Try &lt;a href=&quot;http://diveintopython.net/&quot; rel=&quot;nofollow&quot;&gt;Dive into Python&lt;/a&gt;, which is available to read online for free.&lt;/p&gt;&#xA;" OwnerUserId="118" LastEditorUserId="118" LastEditDate="2012-01-10T22:06:04.403" LastActivityDate="2012-01-10T22:06:04.403" CommentCount="5" />
<row Id="930" PostTypeId="1" AcceptedAnswerId="951" CreationDate="2008-08-04T00:47:25.143" Score="25" ViewCount="14937" Body="&lt;p&gt;What's the simplest way to connect and query a database for a set of records in C#?&lt;/p&gt;&#xA;" OwnerUserId="245" LastEditorUserId="2509901" LastEditorDisplayName="michaelpryor" LastEditDate="2013-12-07T23:45:54.333" LastActivityDate="2013-12-07T23:45:54.333" Title="How do I connect to a database and loop over a recordset in C#?" Tags="&lt;c#&gt;&lt;database&gt;&lt;loops&gt;&lt;connection&gt;" AnswerCount="7" CommentCount="0" FavoriteCount="1" />
<row Id="931" PostTypeId="2" ParentId="88" CreationDate="2008-08-04T00:51:52.843" Score="12" Body="&lt;p&gt;@Bernard:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;I have to admit, most of your example went straight over my head. It does compile, and seems to work, though. Is this safe for SMP systems or SpeedStep?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;That's a good question... I think the code's ok.&#xA;From a practical standpoint, we use it in my company every day,&#xA;and we run on a pretty wide array of boxes, everything from 2-8 cores.&#xA;Of course, YMMV, etc, but it seems to be a reliable and low-overhead&#xA;(because it doesn't make a context switch into system-space) method&#xA;of timing.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Generally how it works is:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;declare the block of code to be assembler (and volatile, so the&#xA;optimizer will leave it alone).&lt;/li&gt;&#xA;&lt;li&gt;execute the CPUID instruction. In addition to getting some CPU information&#xA;(which we don't do anything with) it synchronizes the CPU's execution buffer&#xA;so that the timings aren't affected by out-of-order execution.&lt;/li&gt;&#xA;&lt;li&gt;execute the rdtsc (read timestamp) execution. This fetches the number of&#xA;machine cycles executed since the processor was reset. This is a 64-bit&#xA;value, so with current CPU speeds it will wrap around every 194 years or so.&#xA;Interestingly, in the original Pentium reference, they note it wraps around every&#xA;5800 years or so.&lt;/li&gt;&#xA;&lt;li&gt;the last couple of lines store the values from the registers into&#xA;the variables hi and lo, and put that into the 64-bit return value.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Specific notes:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;p&gt;out-of-order execution can cause incorrect results, so we execute the&#xA;&quot;cpuid&quot; instruction which in addition to giving you some information&#xA;about the cpu also synchronizes any out-of-order instruction execution.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;Most OS's synchronize the counters on the CPUs when they start, so&#xA;the answer is good to within a couple of nano-seconds.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;The hibernating comment is probably true, but in practice you&#xA;probably don't care about timings across hibernation boundaries.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;regarding speedstep: Newer Intel CPUs compensate for the speed&#xA;changes and returns an adjusted count. I did a quick scan over&#xA;some of the boxes on our network and found only one box that&#xA;didn't have it: a Pentium 3 running some old database server.&#xA;(these are linux boxes, so I checked with: grep constant_tsc /proc/cpuinfo)&lt;/p&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;p&gt;I'm not sure about the AMD CPUs, we're primarily an Intel shop,&#xA;although I know some of our low-level systems gurus did an&#xA;AMD evaluation.&lt;/p&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;Hope this satisfies your curiosity, it's an interesting and (IMHO)&#xA;under-studied area of programming. You know when Jeff and Joel were&#xA;talking about whether or not a programmer should know C? I was&#xA;shouting at them, &quot;hey forget that high-level C stuff... assembler&#xA;is what you should learn if you want to know what the computer is&#xA;doing!&quot;&lt;/p&gt;&#xA;" OwnerUserId="116" LastEditorUserId="410767" LastEditDate="2011-06-15T06:44:06.390" LastActivityDate="2011-06-15T06:44:06.390" CommentCount="2" />
<row Id="935" PostTypeId="1" AcceptedAnswerId="938" CreationDate="2008-08-04T01:00:24.837" Score="55" ViewCount="111158" Body="&lt;p&gt;Attempting to insert an escape character into a table results in a warning. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;create table EscapeTest (text varchar(50));&#xA;&#xA;insert into EscapeTest (text) values ('This is the first part \n And this is the second');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;Produces the warning:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;WARNING: nonstandard use of escape in a string literal&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;(&lt;em&gt;Using PSQL 8.2&lt;/em&gt;)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Anyone know how to get around this?&lt;/p&gt;&#xA;" OwnerUserId="246" LastEditorUserId="3576214" LastEditDate="2015-01-02T22:34:17.840" LastActivityDate="2015-01-02T22:34:17.840" Title="String literals and escape characters in postgresql" Tags="&lt;string&gt;&lt;postgresql&gt;&lt;escaping&gt;" AnswerCount="6" CommentCount="0" FavoriteCount="8" />
<row Id="936" PostTypeId="2" ParentId="935" CreationDate="2008-08-04T01:03:20.947" Score="8" Body="&lt;p&gt;Does doubling the \ work?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;insert into EscapeTest (text) values ('This will be inserted \\n This will not be');&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="91" LastActivityDate="2008-08-04T01:03:20.947" CommentCount="0" />
<row Id="938" PostTypeId="2" ParentId="935" CreationDate="2008-08-04T01:07:03.233" Score="61" Body="&lt;p&gt;Partially. The text is inserted, but the warning is still generated.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I found a discussion that indicated the text needed to be preceded with 'E', as such:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;insert into EscapeTest (text) values (E'This is the first part \n And this is the second');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This suppressed the warning, but the text was still not being returned correctly. When I added the additional slash as Michael suggested, it worked.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;As such:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;insert into EscapeTest (text) values (E'This is the first part \\n And this is the second');&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="246" LastEditorUserId="246" LastEditDate="2010-03-04T23:08:11.817" LastActivityDate="2010-03-04T23:08:11.817" CommentCount="2" />
<row Id="939" PostTypeId="2" ParentId="123" CreationDate="2008-08-04T01:07:07.633" Score="1" Body="&lt;p&gt;There is nothing I know of that can do this without you at least writing a little bit of code... You will need 2 separate library:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;A CSV Parser Framework &lt;/li&gt;&#xA;&lt;li&gt;An XML Serialization Framework&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The CSV parser I would recommend (unless you want to have a little bit of fun to write your own CSV Parser) is OpenCSV (A SourceForge Project for parsing CSV Data)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The XML Serialization Framework should be something that can scale in case you want to transform large (or huge) CSV file to XML: My recommendation is the Sun Java Streaming XML Parser Framework (See &lt;a href=&quot;https://sjsxp.java.net/&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;) which allows pull-parsing AND serialization.&lt;/p&gt;&#xA;" OwnerUserId="244" LastEditorUserId="1102512" LastEditDate="2013-11-26T00:02:54.033" LastActivityDate="2013-11-26T00:02:54.033" CommentCount="0" />
<row Id="940" PostTypeId="2" ParentId="930" CreationDate="2008-08-04T01:07:14.760" Score="14" Body="&lt;p&gt;Very roughly and from memory since I don't have code on this laptop:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using (OleDBConnection conn = new OleDbConnection())&#xA;{&#xA; conn.ConnectionString = &quot;Whatever connection string&quot;;&#xA; using (OleDbCommand cmd = new OleDbCommand())&#xA; {&#xA; cmd.Connection = conn;&#xA; cmd.CommandText = &quot;Select * from CoolTable&quot;;&#xA; using (OleDbDataReader dr = cmd.ExecuteReader())&#xA; {&#xA; while (dr.Read())&#xA; {&#xA; // do something like Console.WriteLine(dr[&quot;column name&quot;] as String);&#xA; }&#xA; }&#xA; }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="243" LastEditorUserId="7495" LastEditDate="2013-07-22T14:34:06.073" LastActivityDate="2013-07-22T14:34:06.073" CommentCount="0" />
<row Id="942" PostTypeId="2" ParentId="905" CreationDate="2008-08-04T01:13:06.247" Score="4" Body="&lt;p&gt;All editions of &lt;code&gt;SQL Server 2000/2005/2008&lt;/code&gt; support having multiple databases, each using their own collation sequence. You don't need the Enterprise version. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;When you have a database that uses a collation sequence that is different from default collation for the database server, you will need to take some extra precautions if you use temporary tables and/or table variables. Temp tables/variables live in the tempdb database, which uses the collation seqyuence used by by the master databases. Just remember to use &quot;&lt;code&gt;COLLATE database_default&lt;/code&gt;&quot; when defining character fields in the temp tables/variables. I &lt;a href=&quot;http://anotherlab.rajapet.net/2008/07/handling-collation-sequences-with.html&quot; rel=&quot;nofollow&quot;&gt;blogged about that&lt;/a&gt; not too long ago, if you want some more details.&lt;/p&gt;&#xA;" OwnerUserId="206" LastEditorUserId="395659" LastEditDate="2013-02-07T13:51:27.207" LastActivityDate="2013-02-07T13:51:27.207" CommentCount="1" />
<row Id="943" PostTypeId="2" ParentId="935" CreationDate="2008-08-04T01:14:57.367" Score="16" Body="&lt;p&gt;Cool.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I also found the documentation regarding the E:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.postgresql.org/docs/8.3/interactive/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS&quot;&gt;http://www.postgresql.org/docs/8.3/interactive/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS&lt;/a&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;PostgreSQL also accepts &quot;escape&quot; string constants, which are an extension to the SQL standard. An escape string constant is specified by writing the letter E (upper or lower case) just before the opening single quote, e.g. E'foo'. (When continuing an escape string constant across lines, write E only before the first opening quote.) Within an escape string, a backslash character (\) begins a C-like backslash escape sequence, in which the combination of backslash and following character(s) represents a special byte value. \b is a backspace, \f is a form feed, \n is a newline, \r is a carriage return, \t is a tab. Also supported are \digits, where digits represents an octal byte value, and \xhexdigits, where hexdigits represents a hexadecimal byte value. (It is your responsibility that the byte sequences you create are valid characters in the server character set encoding.) Any other character following a backslash is taken literally. Thus, to include a backslash character, write two backslashes (\\). Also, a single quote can be included in an escape string by writing \', in addition to the normal way of ''.&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;" OwnerUserId="91" LastActivityDate="2008-08-04T01:14:57.367" CommentCount="0" />
<row Id="944" PostTypeId="1" AcceptedAnswerId="1016" CreationDate="2008-08-04T01:15:38.067" Score="11" ViewCount="3645" Body="&lt;p&gt;I'm maintaining a &lt;code&gt;.NET 1.1&lt;/code&gt; application, and one of the things I've been tasked with is making sure the user doesn't see any unfriendly error notifications.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've added handlers to &lt;code&gt;Application.ThreadException&lt;/code&gt; and &lt;code&gt;AppDomain.CurrentDomain.UnhandledException&lt;/code&gt;, which do get called. My problem is that the standard &lt;code&gt;CLR&lt;/code&gt; error dialog is still displayed (before the exception handler is called).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Jeff talks about this problem on his blog &lt;a href=&quot;http://www.codinghorror.com/blog/archives/000201.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://www.codinghorror.com/blog/archives/000216.html&quot; rel=&quot;nofollow&quot;&gt;here&lt;/a&gt;. But there's no solution. So what is the standard way in &lt;code&gt;.NET 1.1&lt;/code&gt; to handle uncaught exceptions and display a friendly dialog box?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Edit&lt;/strong&gt;: Jeff's response was marked as the correct answer, because the link he provided has the most complete information on how to do what's required.&lt;/p&gt;&#xA;" OwnerUserId="233" LastEditorUserId="395659" LastEditorDisplayName="Ray" LastEditDate="2013-02-07T13:39:29.647" LastActivityDate="2013-02-07T13:39:29.647" Title="Unhandled Exception Handler in .NET 1.1" Tags="&lt;c#&gt;&lt;.net&gt;&lt;exception&gt;&lt;exception-handling&gt;" AnswerCount="5" CommentCount="0" />
<row Id="945" PostTypeId="2" ParentId="918" CreationDate="2008-08-04T01:17:20.450" Score="1" Body="&lt;p&gt;Well, I breezed through the PDF and a few of the sample source files - and like most Python code I encountered, almost all the class definitions and program execution were all lumped into one single .py script. Not quite what I was looking for. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I am completely willing to accept that this is the way most (all?) python code is commonly written, and in my own experience have enjoyed either insanely packed scripts with everything including the kitchen sink or countless import statements at the top of the file to locally scope class/methods. It just seems like I am going about this wrong or perhaps Python isn't really designed with the large app in mind and there will be pain.&lt;/p&gt;" OwnerUserId="243" LastActivityDate="2008-08-04T01:17:20.450" CommentCount="0" />
<row Id="947" PostTypeId="1" AcceptedAnswerId="1028" CreationDate="2008-08-04T01:22:49.830" Score="9" ViewCount="5369" Body="&lt;p&gt;I have imported the kernel32 library so I have the &lt;code&gt;createMutex&lt;/code&gt; function available but I am not quite sure of the various parameters and return values.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;This is classic Visual Basic, not Visual Basic.NET but I can probably work with either language in the form of an answer.&lt;/p&gt;&#xA;" OwnerUserId="243" LastEditorUserId="298281" LastEditorDisplayName="Keith" LastEditDate="2012-05-02T17:40:24.570" LastActivityDate="2014-12-15T11:38:40.307" Title="How to use a mutex in Visual Basic" Tags="&lt;vb6&gt;" AnswerCount="3" CommentCount="0" FavoriteCount="1" />
<row Id="950" PostTypeId="2" ParentId="194" CreationDate="2008-08-04T01:29:18.307" Score="2" Body="&lt;p&gt;You can upgrade 6.5 to SQL Server 2000. You may have an easier time getting a hold of SQL Server or the 2000 version of the MSDE. Microsoft has a page on &lt;a href=&quot;http://www.microsoft.com/technet/prodtechnol/sql/2000/deploy/sqlugrd.mspx#EQFAC&quot; rel=&quot;nofollow&quot;&gt;going from 6.5 to 2000&lt;/a&gt;. Once you have the database in 2000 format, SQL Server 2005 will have no trouble upgrading it to the 2005 format. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you don't have SQL Server 2000, you can &lt;a href=&quot;http://www.microsoft.com/downloads/details.aspx?familyid=413744D1-A0BC-479F-BAFA-E4B278EB9147&amp;amp;displaylang=en&quot; rel=&quot;nofollow&quot;&gt;download the MSDE 2000&lt;/a&gt; version directly from Microsoft.&lt;/p&gt;" OwnerUserId="206" LastActivityDate="2008-08-04T01:29:18.307" CommentCount="0" />
<row Id="951" PostTypeId="2" ParentId="930" CreationDate="2008-08-04T01:31:31.157" Score="23" Body="&lt;p&gt;@Goyuix -- that's excellent for something written from memory.&#xD;&#xA;tested it here -- found the connection wasn't opened. Otherwise very nice.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;using System.Data.OleDb;&lt;br&gt;...&lt;br&gt;&lt;br&gt;using (OleDbConnection conn = new OleDbConnection())&lt;br&gt;{&lt;br&gt; conn.ConnectionString = &quot;Provider=sqloledb;Data Source=yourServername\\yourInstance;Initial Catalog=databaseName;Integrated Security=SSPI;&quot;;&lt;br&gt; using (OleDbCommand cmd = new OleDbCommand())&lt;br&gt; {&lt;br&gt; conn.Open();&lt;br&gt; cmd.Connection = conn;&lt;br&gt; cmd.CommandText = &quot;Select * from yourTable&quot;;&lt;br&gt; using (OleDbDataReader dr = cmd.ExecuteReader())&lt;br&gt; {&lt;br&gt; while (dr.Read())&lt;br&gt; {&lt;br&gt; Console.WriteLine(dr[&quot;columnName&quot;]);&lt;br&gt; }&lt;br&gt; }&lt;br&gt; }&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="49" OwnerDisplayName="Leon Bambrick" LastActivityDate="2008-08-04T01:31:31.157" CommentCount="0" />
<row Id="952" PostTypeId="2" ParentId="918" CreationDate="2008-08-04T01:39:45.490" Score="10" Body="&lt;p&gt;There are plenty of large Python apps, you mention one in your question: Django. Why not browse &lt;a href=&quot;http://code.djangoproject.com/browser/django/trunk/&quot;&gt;the Django source&lt;/a&gt; to see one way of laying out a larger project.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;For laying out classes and modules, one pattern I've seen repeated in bigger Python projects is to put several related classes into a single file, then several related files into a single directory. Put an __init__.py file in that directory and import all of the code in that directory into a single namespace.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;An example of this, in the Django source: &lt;a href=&quot;http://code.djangoproject.com/browser/django/trunk/django/forms&quot;&gt;/trunk/django/forms/&lt;/a&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Then, if you wanted to use, say, the CharField class in another file, you could just use&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;import forms&lt;br&gt;field = forms.CharField()&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="101" LastActivityDate="2008-08-04T01:39:45.490" CommentCount="0" />
<row Id="964" PostTypeId="2" ParentId="918" CreationDate="2008-08-04T02:03:03.103" Score="4" Body="&lt;p&gt;I've been really impressed with the &lt;a href=&quot;http://rads.stackoverflow.com/amzn/click/0672328623&quot;&gt;Python Essential Reference&lt;/a&gt; so far. It's one of those great reference books that allows an experienced programmer to quickly learn a new language. The first 120 odd pages are a (fairly) quick rundown of the syntax of the language. The rest of the book is just a reference of the Python Standard Library.&lt;/p&gt;" OwnerUserId="203" LastActivityDate="2008-08-04T02:03:03.103" CommentCount="0" />
<row Id="971" PostTypeId="2" ParentId="164" CreationDate="2008-08-04T02:14:59.477" Score="1" Body="&lt;p&gt;Encoding flash video is actually very easy with ffmpeg. You can use one command to convert from just about any video format, ffmpeg is smart enough to figure the rest out, and it'll use every processor on your machine. Invoking it is easy:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;ffmpeg -i input.avi output.flv&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;ffmpeg will guess at the bitrate you want, but if you'd like to specify one, you can use the -b option, so &lt;code&gt;-b 500000&lt;/code&gt; is 500kbps for example. There's a ton of options of course, but I generally get good results without much tinkering. This is a good place to start if you're looking for more options: &lt;a href=&quot;http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html#SEC9&quot; rel=&quot;nofollow&quot;&gt;video options&lt;/a&gt;.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You don't need a special web server to show flash video. I've done just fine by simply pushing .flv files up to a standard web server, and linking to them with a good swf player, like &lt;a href=&quot;http://flowplayer.org/&quot; rel=&quot;nofollow&quot;&gt;flowplayer&lt;/a&gt;.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;WMVs are fine if you can be sure that all of your users will always use [a recent, up to date version of] Windows only, but even then, Flash is often a better fit for the web. The player is even extremely skinnable and can be controlled with javascript.&lt;/p&gt;" OwnerUserId="101" LastActivityDate="2008-08-04T02:14:59.477" CommentCount="0" />
<row Id="972" PostTypeId="1" AcceptedAnswerId="2982" CreationDate="2008-08-04T02:17:51.780" Score="242" ViewCount="61170" Body="&lt;p&gt;I've read that it is possible to add a method to an existing object (e.g. not in the class definition) in &lt;strong&gt;python&lt;/strong&gt;, I think this is called Monkey Patching (or in some cases Duck Punching). I understand that it's not always a good decision to do so. But, how might one do this?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;UPDATE 8/04/2008 00:21:01 EST:&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;a href=&quot;http://stackoverflow.com/a/982&quot;&gt;That&lt;/a&gt; looks like a good answer John Downey, I tried it but it appears that it ends up being not a &lt;em&gt;true&lt;/em&gt; method. Your example defines the new patch function with an argument of &lt;strong&gt;self&lt;/strong&gt;, but if you write actual code that way, the now patched class method asks for an argument named self (it doesn't automagically recognize it as the object to which it is supposed to bind, which is what would happen if defined within the class definition), meaning you have to call &lt;strong&gt;class.patch(obj)&lt;/strong&gt; instead of just &lt;strong&gt;class.patch()&lt;/strong&gt; if you want the same functionality as a &lt;em&gt;true&lt;/em&gt; method. &lt;strong&gt;It looks like python isn't really treating it as a method, but more just as a variable which happens to be a function&lt;/strong&gt; (and as such is callable). Is there any way to attach an actual method to a class?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh, and Ryan, &lt;a href=&quot;http://pypi.python.org/pypi/monkey&quot;&gt;that&lt;/a&gt; isn't exactly what I was looking for (it isn't builtin functionality), but it is quite cool nonetheless.&lt;/p&gt;&#xA;" OwnerUserId="145" LastEditorUserId="541136" LastEditorDisplayName="eyelidlessness" LastEditDate="2015-01-21T05:06:48.827" LastActivityDate="2015-01-21T05:31:23.257" Title="Adding a Method to an Existing Object" Tags="&lt;python&gt;&lt;oop&gt;&lt;monkeypatching&gt;" AnswerCount="14" CommentCount="2" FavoriteCount="157" />
<row Id="981" PostTypeId="2" ParentId="833" CreationDate="2008-08-04T02:30:09.227" Score="0" Body="&lt;p&gt;The database will do this for you. Look at &quot;select ... for update&quot;, which is designed just for this kind of thing. It will give you a write lock on the selected rows, which you can then commit or roll back.&lt;/p&gt;" OwnerUserId="116" LastActivityDate="2008-08-04T02:30:09.227" CommentCount="0" />
<row Id="982" PostTypeId="2" ParentId="972" CreationDate="2008-08-04T02:31:13.250" Score="8" Body="&lt;p&gt;In Python monkey patching generally works by overwriting a class or functions signature with your own. Below is an example from the &lt;a href=&quot;http://wiki.zope.org/zope2/MonkeyPatch&quot;&gt;Zope Wiki&lt;/a&gt;:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;from SomeOtherProduct.SomeModule import SomeClass&lt;br&gt;def speak(self):&lt;br&gt; return &quot;ook ook eee eee eee!&quot;&lt;br&gt;SomeClass.speak = speak&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;That code will overwrite/create a method called speak on the class. In Jeff Atwood's &lt;a href=&quot;http://www.codinghorror.com/blog/archives/001151.html&quot;&gt;recent post on monkey patching&lt;/a&gt;. He shows an example in C# 3.0 which is the current language I use for work.&lt;/p&gt;" OwnerUserId="200" LastActivityDate="2008-08-04T02:31:13.250" CommentCount="3" />
<row Id="984" PostTypeId="2" ParentId="972" CreationDate="2008-08-04T02:36:40.323" Score="0" Body="&lt;p&gt;I don't know Python syntax, but I know Ruby can do it, and it is rather trivial. Let's say you want to add a method to Array that prints the length to standard out:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;class Array&lt;br&gt; def print_length&lt;br&gt; puts length&lt;br&gt; end&lt;br&gt;end&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you don't want to modify the whole class, you can just add the method to a single instance of the array, and no other arrays will have the method:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;array = [1, 2, 3]&lt;br&gt;def array.print_length&lt;br&gt; puts length&lt;br&gt;end&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Just be aware of the issues involved in using this feature. Jeff Atwood actually &lt;a href=&quot;http://www.codinghorror.com/blog/archives/001151.html&quot; rel=&quot;nofollow&quot;&gt;wrote about it&lt;/a&gt; not too long ago.&lt;/p&gt;" OwnerUserId="122" LastActivityDate="2008-08-04T02:36:40.323" CommentCount="0" />
<row Id="986" PostTypeId="2" ParentId="944" CreationDate="2008-08-04T02:45:07.717" Score="2" Body="&lt;p&gt;is this a console app or a winforms app? If it's a .NET 1.1 console app this is, sadly, by design -- it's confirmed by a MSFT dev in the &lt;a href=&quot;http://www.codinghorror.com/blog/archives/000216.html&quot; rel=&quot;nofollow&quot;&gt;second blog post you referenced&lt;/a&gt;:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;BTW, on my 1.1 machine the example from MSDN does have the expected output; it's just that the second line doesn't show up until after you've attached a debugger (or not). In v2 we've flipped things around so that the UnhandledException event fires before the debugger attaches, which seems to be what most people expect.&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Sounds like .NET 2.0 does this better (thank goodness), but honestly, I never had time to go back and check.&lt;/p&gt;" OwnerUserId="1" LastActivityDate="2008-08-04T02:45:07.717" CommentCount="0" />
<row Id="990" PostTypeId="2" ParentId="944" CreationDate="2008-08-04T02:54:15.683" Score="0" Body="&lt;p&gt;It's a WinForms app. The exceptions that are caught by Application.ThreadException work fine, and I don't get the ugly .NET exception box (OK to terminate, cancel to debug? who came up with that??).&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I was getting some exceptions that weren't being caught by that and ended up going to the AppDomain.UnhandledException event that were causing problems. I think I've caught most of those exceptions and I am displaying them in our nice error box now.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;So I'll just have to hope there are not some other circumstances that would cause exceptions to not be caught by the Application.ThreadException handler.&lt;/p&gt;" OwnerUserId="233" LastActivityDate="2008-08-04T02:54:15.683" CommentCount="0" />
<row Id="1001" PostTypeId="2" ParentId="918" CreationDate="2008-08-04T03:17:40.893" Score="4" Body="&lt;p&gt;It seems that what you are looking for is a something mildly challenging and somewhat useful to do with python? Try some of these things:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Level 1:&lt;br&gt;&#xD;&#xA;Have you tried putting a GUI on top of a simple console program? There are several packages that allow you to do this with minimal effort. &lt;a href=&quot;http://www.metaslash.com/python10/&quot;&gt;Metaslash&lt;/a&gt; Covers most all of them.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Level 2:&lt;br&gt;&#xD;&#xA;&lt;a href=&quot;http://code.google.com/codejam/contest&quot;&gt;Google Code Jam&lt;/a&gt;. The Competition itself is long underway, but you can still try the qualification round questions. Try doing them in python. They can be done with any amount of complexity you want, one, two, three files. Its a good way to learn to build algorithms in python. &lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Level 3:&lt;br&gt;&#xD;&#xA;Write your own extension for something in python. I would try maybe a small scaling plugin for GIMP. Documentation can be found &lt;a href=&quot;http://www.gimp.org/docs/python/index.html&quot;&gt;here&lt;/a&gt;. This will be pretty challenging, and provide you good experience to contributing to open source!&lt;/p&gt;" OwnerUserId="50" LastActivityDate="2008-08-04T03:17:40.893" CommentCount="1" />
<row Id="1005" PostTypeId="1" AcceptedAnswerId="37042" CreationDate="2008-08-04T03:34:02.860" Score="156" ViewCount="31471" Body="&lt;p&gt;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&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;sudo vi filename&#xD;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;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 ago, but now I can't find it.&lt;/p&gt;" OwnerUserId="85" LastEditorUserId="85" LastEditDate="2009-04-20T04:26:31.417" LastActivityDate="2012-10-13T06:54:18.770" Title="Getting root permissions on a file inside of vi?" Tags="&lt;linux&gt;&lt;unix&gt;&lt;vi&gt;" AnswerCount="11" CommentCount="1" FavoriteCount="80" />
<row Id="1006" PostTypeId="2" ParentId="1005" CreationDate="2008-08-04T03:39:31.163" Score="0" Body="&lt;p&gt;A quick Google seems to give this advice:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ol&gt;&#xD;&#xA;&lt;li&gt;Don't try to edit if it's read-only.&lt;/li&gt;&#xD;&#xA;&lt;li&gt;You might be able to change the permissions on the file. (Whether or not it will let you save is up to experimentation.)&lt;/li&gt;&#xD;&#xA;&lt;li&gt;If you still edited anyway, save to a temporary file and then move it.&lt;/li&gt;&#xD;&#xA;&lt;/ol&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;a href=&quot;http://ubuntuforums.org/showthread.php?t=782136&quot; rel=&quot;nofollow&quot;&gt;http://ubuntuforums.org/showthread.php?t=782136&lt;/a&gt;&lt;/p&gt;" OwnerUserId="55" LastActivityDate="2008-08-04T03:39:31.163" CommentCount="0" />
<row Id="1010" PostTypeId="1" AcceptedAnswerId="1074" CreationDate="2008-08-04T03:59:42.557" Score="8" ViewCount="1386" Body="&lt;p&gt;I need to grab the base64-encoded representation of the ViewState. Obviously this would not be available until fairly late in the request lifecycle, which is OK.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;For example, if the output of the page includes:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;__VIEWSTATE&quot; &#xA; id=&quot;__VIEWSTATE&quot; value=&quot;/wEPDwUJODU0Njc5MD...==&quot; /&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I need a way on the server side to get the value &lt;code&gt;&quot;/wEPDwUJODU0Njc5MD...==&quot;&lt;/code&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To clarify, I need this value when the page is being rendered, not on PostBack. e.g. I need to know the ViewState value that is being &lt;em&gt;sent&lt;/em&gt; to the client, not the ViewState I'm getting back from them.&lt;/p&gt;&#xA;" OwnerUserId="67" LastEditorUserId="395659" LastEditDate="2013-02-07T13:19:41.717" LastActivityDate="2013-02-07T13:19:41.717" Title="How to get the value of built, encoded ViewState?" Tags="&lt;c#&gt;&lt;asp.net&gt;" AnswerCount="3" CommentCount="0" />
<row Id="1012" PostTypeId="2" ParentId="1005" CreationDate="2008-08-04T04:04:52.110" Score="6" Body="&lt;p&gt;Ryan's advice is generally good, however, if following step 3, don't move the temporary file; it'll have the wrong ownership and permissions. Instead, &lt;code&gt;sudoedit&lt;/code&gt; the correct file and read in the contents (using &lt;code&gt;:r&lt;/code&gt; or the like) of the temporary file.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If following step 2, use &lt;code&gt;:w!&lt;/code&gt; to force the file to be written.&lt;/p&gt;" OwnerUserId="13" LastActivityDate="2008-08-04T04:04:52.110" CommentCount="0" />
<row Id="1016" PostTypeId="2" ParentId="944" CreationDate="2008-08-04T04:31:02.557" Score="8" Body="&lt;p&gt;Oh, in WinForms you definitely should be able to get it to work. The only thing you have to watch out for is things happening on different threads.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I have an old CodeProject article here which should help:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;a href=&quot;http://www.codeproject.com/KB/exception/ExceptionHandling.aspx&quot;&gt;http://www.codeproject.com/KB/exception/ExceptionHandling.aspx&lt;/a&gt;&lt;/p&gt;" OwnerUserId="1" LastActivityDate="2008-08-04T04:31:02.557" CommentCount="0" />
<row Id="1022" PostTypeId="2" ParentId="930" CreationDate="2008-08-04T04:45:05.367" Score="8" Body="&lt;p&gt;That's definitely a good way to do it. But you if you happen to be using a database that supports LINQ to SQL, it can be a lot more fun. It can look something like this:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;MyDB db = new MyDB(&quot;Data Source=...&quot;);&lt;br&gt;var q = from db.MyTable&lt;br&gt; select c;&lt;br&gt;foreach (var c in q)&lt;br&gt; Console.WriteLine(c.MyField.ToString());&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="93" LastActivityDate="2008-08-04T04:45:05.367" CommentCount="0" />
<row Id="1023" PostTypeId="2" ParentId="835" CreationDate="2008-08-04T04:45:12.497" Score="4" Body="&lt;p&gt;The CCNetArtifactDirectory is passed to the MSBuild by default, so you dont need to worry about it. MSBuild will place the build output in the &quot;bin location&quot; relevant to the working directory that you have specified.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;executable&amp;gt;c:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe&amp;lt;/executable&amp;gt;&#xA;&amp;lt;workingDirectory&amp;gt;C:\data\projects\FooSolution\&amp;lt;/workingDirectory&amp;gt;&#xA;&amp;lt;projectFile&amp;gt;FooSolution.sln&amp;lt;/projectFile&amp;gt;&#xA;&amp;lt;buildArgs&amp;gt;/noconsolelogger /p:Configuration=Debug &amp;lt;/buildArgs&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;So in the above example your build output will be put in C:\data\projects\FooSolution[ProjectName]\bin\Debug. Should you want to output to a different location you may want to look at of the tag in CCNET.&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;&amp;lt;publishers&amp;gt;&#xA; &amp;lt;xmllogger /&amp;gt;&#xA; &amp;lt;buildpublisher&amp;gt;&#xA; &amp;lt;sourceDir&amp;gt;C:\data\projects\FooSolution\FooProject\bin\Debug&amp;lt;/sourceDir&amp;gt;&#xA; &amp;lt;publishDir&amp;gt;C:\published\FooSolution\&amp;lt;/publishDir&amp;gt;&#xA; &amp;lt;useLabelSubDirectory&amp;gt;false&amp;lt;/useLabelSubDirectory&amp;gt;&#xA; &amp;lt;/buildpublisher&amp;gt;&#xA;&amp;lt;/publishers&amp;gt;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This will allow you to publish your output to a different location.&lt;/p&gt;&#xA;" OwnerUserId="231" LastEditorUserId="1741868" LastEditDate="2012-11-09T07:41:11.077" LastActivityDate="2012-11-09T07:41:11.077" CommentCount="0" />
<row Id="1024" PostTypeId="1" AcceptedAnswerId="171170" CreationDate="2008-08-04T04:48:38.013" Score="9" ViewCount="775" Body="&lt;p&gt;After upgrading a rails 1.2 website to 2.1, the &lt;a href=&quot;http://agilewebdevelopment.com/plugins/exception_notifier&quot;&gt;ExceptionNotifier plugin&lt;/a&gt; no longer works, complaining about this error:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ActionView::TemplateFinder::InvalidViewPath: &#xA;Unprocessed view path found: &quot;/path/to/appname/vendor/plugins/exception_notification/lib/../views&quot;. Set your view paths with #append_view_path, #prepend_view_path, or #view_paths=.&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What causes it and how do I fix it?&lt;/p&gt;&#xA;" OwnerUserId="234" LastEditorUserId="234" LastEditorDisplayName="Orion Edwards" LastEditDate="2008-10-02T05:47:52.370" LastActivityDate="2008-10-07T20:15:02.867" Title="How do I fix 'Unprocessed view path found' error with ExceptionNotifier plugin in rails 2.1?" Tags="&lt;ruby-on-rails&gt;&lt;ruby&gt;&lt;exception&gt;&lt;plugins&gt;" AnswerCount="2" CommentCount="0" CommunityOwnedDate="2008-10-02T05:47:52.340" />
<row Id="1025" PostTypeId="2" ParentId="947" CreationDate="2008-08-04T04:48:40.697" Score="0" Body="&lt;p&gt;Well, based on the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms682411(VS.85).aspx&quot; rel=&quot;nofollow&quot;&gt;documentation&lt;/a&gt; it looks like:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Security attributes (can pass null)&lt;/li&gt;&#xA;&lt;li&gt;Whether it's initially owned (can pass false)&lt;/li&gt;&#xA;&lt;li&gt;The name of it&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;HTH&lt;/p&gt;&#xA;" OwnerUserId="77" LastEditorUserId="4095830" LastEditDate="2014-12-15T11:38:40.307" LastActivityDate="2014-12-15T11:38:40.307" CommentCount="0" />
<row Id="1026" PostTypeId="2" ParentId="1024" CreationDate="2008-08-04T04:50:44.437" Score="7" Body="&lt;p&gt;This was caused by a change in rails 2.1 which prevents rails from loading views from any arbitrary path for security reasons.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;There is now an updated version of the plugin on github, so the solution is to use that.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;hr /&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The old solution here for posterity&lt;/p&gt;&#xA;&#xA;&lt;p&gt;To work around it, edit &lt;code&gt;init.rb&lt;/code&gt; under your &lt;code&gt;vendor/plugins/exception_notification&lt;/code&gt; directory, and add the following code to the end&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;ActionController::Base.class_eval do&#xA; append_view_path File.dirname(__FILE__) + '/lib/../views'&#xA;end&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;This adds the ExceptionNotifier plugins' views folder to the list, so it is allowed to load them.&lt;/p&gt;&#xA;" OwnerUserId="234" LastEditorUserId="234" LastEditorDisplayName="Orion Edwards" LastEditDate="2008-10-07T20:15:02.867" LastActivityDate="2008-10-07T20:15:02.867" CommentCount="1" />
<row Id="1028" PostTypeId="2" ParentId="947" CreationDate="2008-08-04T04:58:40.300" Score="5" Body="&lt;p&gt;The VB code looks something like this:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;hMutex = CreateMutex(ByVal 0&amp;amp;, 1, ByVal 0&amp;amp;)&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The first parameter is a pointer to an &lt;code&gt;SECURITY_ATTRIBUTES&lt;/code&gt; structure. If you don't know what it is, you don't need it. Pass NULL (0).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The second parameter is &lt;code&gt;TRUE&lt;/code&gt; (non-zero, or 1) if the calling thread should take ownership of the mutex. &lt;code&gt;FALSE&lt;/code&gt; otherwise.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The third parameter is the mutex name and may be NULL (0), as shown. If you need a named mutex, pass the name (anything unique) in. Not sure whether the &lt;code&gt;VB&lt;/code&gt; wrapper marshals the length-prefixed &lt;code&gt;VB&lt;/code&gt; string type (&lt;code&gt;BSTR&lt;/code&gt;) over to a null-terminated Ascii/Unicode string if not, you'll need to do that and numerous examples are out there.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Good luck!&lt;/p&gt;&#xA;" OwnerDisplayName="user2189331" LastEditorUserId="395659" LastEditDate="2013-02-07T13:22:14.680" LastActivityDate="2013-02-07T13:22:14.680" CommentCount="0" />
<row Id="1033" PostTypeId="1" AcceptedAnswerId="1056" CreationDate="2008-08-04T05:15:35.773" Score="44" ViewCount="11956" Body="&lt;p&gt;Does anyone know of a simple way to retrieve the country for a given IP Address? Preferably in &lt;code&gt;ISO_3166-1&lt;/code&gt; format?&lt;/p&gt;&#xA;" OwnerUserId="87" LastEditorUserId="395659" LastEditDate="2013-02-07T13:18:07.160" LastActivityDate="2015-01-16T16:49:09.727" Title="How to get the Country according to a certain IP?" Tags="&lt;ip&gt;&lt;lookup&gt;&lt;country&gt;" AnswerCount="12" CommentCount="2" FavoriteCount="33" />
<row Id="1034" PostTypeId="2" ParentId="1033" CreationDate="2008-08-04T05:21:59.660" Score="8" Body="&lt;p&gt;Here's a nice free service with a public API:&#xD;&#xA;&lt;a href=&quot;http://www.hostip.info/use.html&quot;&gt;http://www.hostip.info/use.html&lt;/a&gt;&lt;/p&gt;" OwnerUserId="116" LastActivityDate="2008-08-04T05:21:59.660" CommentCount="0" />
<row Id="1037" PostTypeId="1" AcceptedAnswerId="1039" CreationDate="2008-08-04T05:35:52.240" Score="17" ViewCount="30828" Body="&lt;p&gt;What is the best way to display &lt;code&gt;Flash&lt;/code&gt; content in a &lt;strong&gt;C#&lt;/strong&gt; WinForms application? I would like to create a user control (similar to the current &lt;code&gt;PictureBox&lt;/code&gt;) that will be able to display images and flash content.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It would be great to be able to load the flash content from a &lt;strong&gt;stream&lt;/strong&gt; of sorts rather than a file on disk.&lt;/p&gt;&#xA;" OwnerUserId="231" LastEditorUserId="725306" LastEditorDisplayName="FryHard" LastEditDate="2013-03-22T09:28:21.557" LastActivityDate="2013-03-22T09:28:21.557" Title="Displaying Flash content in a C# WinForms application" Tags="&lt;c#&gt;&lt;winforms&gt;&lt;flash&gt;&lt;adobe&gt;&lt;macromedia&gt;" AnswerCount="2" CommentCount="1" FavoriteCount="10" />
<row Id="1039" PostTypeId="2" ParentId="1037" CreationDate="2008-08-04T05:44:45.887" Score="22" Body="&lt;p&gt;While I haven't used a flash object inside a windows form application myself, I do know that it's possible.&#xD;&#xA;In Visual studio on your toolbox, choose to add a new component.&#xD;&#xA;Then in the new window that appears choose the &lt;strong&gt;&quot;COM Components&quot;&lt;/strong&gt; tab to get a list in which you can find the &lt;strong&gt;&quot;Shockwave Flash Object&quot;&lt;/strong&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Once added to the toolbox, simply use the control as you would use any other &quot;standard&quot; control from visual studio.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;three simple commands are available to interact with the control:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ul&gt;&#xD;&#xA;&lt;li&gt;AxShockwaveFlash1.Stop()&lt;/li&gt;&#xD;&#xA;&lt;li&gt;AxShockwaveFlash1.Movie = FilePath &amp;amp;&#xD;&#xA;&quot;\FileName.swf&quot;&lt;/li&gt;&#xD;&#xA;&lt;li&gt;AxShockwaveFlash1.Play()&lt;/li&gt;&#xD;&#xA;&lt;/ul&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;which, I think, are all self explanatory.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;It would be great to be able to load&#xD;&#xA; the flash content from a stream of&#xD;&#xA; sorts rather than a file on disk.&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I just saw you are also looking for a means to load the content from a stream,&#xD;&#xA;and because I'm not really sure that is possible with the shockwave flash object I will give you another option (two actually).&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;the first is the one I would advise you to use only when necessary, as it uses the full blown &lt;strong&gt;&quot;webbrowser component&quot;&lt;/strong&gt; (also available as an extra toolbox item), which is like trying to shoot a fly with a bazooka.&#xD;&#xA;of course it will work, as the control will act as &lt;a href=&quot;http://visualbasic.about.com/library/courses/blecvbsbs2202.htm&quot;&gt;a real browser window&lt;/a&gt; (actually the internet explorer browser), but its not really meant to be used in the way you need it.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;the second option is to use something I just discovered while looking for more information about playing flash content inside a windows form. &lt;a href=&quot;http://www.f-in-box.com/dotnet/#feature_flv_playing&quot;&gt;F-IN-BOX&lt;/a&gt; is a commercial solution that will also play content from a given website URL. (The link provided will direct you to the .NET code you have to use).&lt;/p&gt;" OwnerUserId="46" LastEditorUserId="46" LastEditorDisplayName="Sven" LastEditDate="2008-08-04T06:59:42.397" LastActivityDate="2008-08-04T06:59:42.397" CommentCount="1" />
<row Id="1040" PostTypeId="1" AcceptedAnswerId="1044" CreationDate="2008-08-04T05:45:22.080" Score="37" ViewCount="32728" Body="&lt;p&gt;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 &lt;code&gt;File.Delete()&lt;/code&gt;.&lt;/p&gt;&#xA;" OwnerUserId="254" LastEditorUserId="140328" LastEditorDisplayName="Prakash" LastEditDate="2011-08-20T23:34:44.577" LastActivityDate="2013-01-15T14:25:53.577" Title="How do I delete a file which is locked by another process in C#?" Tags="&lt;c#&gt;&lt;file-locking&gt;" AnswerCount="7" CommentCount="0" FavoriteCount="12" />
<row Id="1041" PostTypeId="1" AcceptedAnswerId="17198991" CreationDate="2008-08-04T05:50:00.337" Score="10" ViewCount="773" Body="&lt;p&gt;I'm looking for a robust, easy-to-use, regular expression evaluator for native C++, either platform-independent or Windows-specific.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Requirements:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Can't use Boost or ACE regex libraries (unfortunately)&lt;/li&gt;&#xA;&lt;li&gt;Can't use .NET Regex (or any managed code)&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&#xA;&lt;p&gt;The main requirement is that it should be standalone and open.&lt;/p&gt;&#xA;" OwnerDisplayName="user2189331" LastEditorUserId="396458" LastEditorDisplayName="Mark Biek" LastEditDate="2011-12-02T18:01:27.820" LastActivityDate="2013-06-19T18:47:47.330" Title="Easy-to-Use Regular Expression Support in C++?" Tags="&lt;c++&gt;&lt;regex&gt;" AnswerCount="9" CommentCount="5" FavoriteCount="1" />
<row Id="1042" PostTypeId="1" AcceptedAnswerId="1061" CreationDate="2008-08-04T05:51:56.683" Score="7" ViewCount="5908" Body="&lt;p&gt;For instance, my query is like the following using SQL Server 2005:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT * FROM Table WHERE FREETEXT(SearchField, 'c#')&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I have a full text index defined to use the column SearchField which returns results when using:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;SELECT * FROM Table WHERE SearchField LIKE '%c#%'&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;I believe # is a special letter, so how do I allow FREETEXT to work correctly for the query above?&lt;/p&gt;&#xA;" OwnerUserId="2" LastEditorUserId="2641576" LastEditorDisplayName="Chris Fournier" LastEditDate="2014-11-25T20:40:10.517" LastActivityDate="2014-11-25T20:40:10.517" Title="Why doesn't SQL Full Text Indexing return results for words containing #?" Tags="&lt;sql&gt;&lt;sql-server&gt;&lt;sql-server-2005&gt;&lt;indexing&gt;&lt;full-text-search&gt;" AnswerCount="2" CommentCount="1" />
<row Id="1043" PostTypeId="2" ParentId="1040" CreationDate="2008-08-04T05:59:53.000" Score="2" Body="&lt;p&gt;You can use this program, &lt;a href=&quot;http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx&quot; rel=&quot;nofollow&quot;&gt;Handle&lt;/a&gt;, to find which process has the lock on your file. It's a command-line tool, so I guess you use the output from that... I'm not sure about finding it programmatically.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If deleting the file can wait, you could specify it for deletion when your computer next starts up:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;1.&#xD;&#xA;Start REGEDT32 (W2K) or REGEDIT (WXP) and navigate to:&#xD;&#xA;HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;2.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ul&gt;&#xD;&#xA;&lt;li&gt;&lt;p&gt;W2K: Edit, Add Value..., Data Type: REG_MULTI_SZ, Value Name:&#xD;&#xA;PendingFileRenameOperations, OK&lt;/p&gt;&lt;/li&gt;&#xD;&#xA;&lt;li&gt;&lt;p&gt;WXP: Edit, New, Multi-String Value, [enter]&#xD;&#xA;PendingFileRenameOperations&lt;/p&gt;&lt;/li&gt;&#xD;&#xA;&lt;/ul&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;3.&#xD;&#xA;In the Data area, enter &quot;\??\&quot; + filename to be deleted. LFNs may&#xD;&#xA;be entered without being embedded in quotes. To delete &quot;C:\Long&#xD;&#xA;Directory Name\Long File Name.exe&quot;, enter the following data:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;\??\C:\Long Directory Name\Long File Name.exe&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Then press OK.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;4.&#xD;&#xA;The &quot;destination file name&quot; is a null (zero) string. It is entered&#xD;&#xA;as follows:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ul&gt;&#xD;&#xA;&lt;li&gt;&lt;p&gt;W2K: Edit, Binary, select Data Format: Hex, click at the end of the&#xD;&#xA;hex string, enter 0000 (four zeros), OK.&lt;/p&gt;&lt;/li&gt;&#xD;&#xA;&lt;li&gt;&lt;p&gt;WXP: Right-click the value, choose &quot;Modify Binary Data&quot;, click at the&#xD;&#xA;end of the hex string, enter 0000 (four zeros), OK.&lt;/p&gt;&lt;/li&gt;&#xD;&#xA;&lt;/ul&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;5.&#xD;&#xA;Close REGEDT32/REGEDIT and reboot to delete the file.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;(Shamelessly stolen from &lt;a href=&quot;http://www.pcreview.co.uk/forums/thread-1581158.php&quot; rel=&quot;nofollow&quot;&gt;some random forum&lt;/a&gt;, for posterity's sake.)&lt;/p&gt;" OwnerUserId="55" LastActivityDate="2008-08-04T05:59:53.000" CommentCount="0" />
<row Id="1044" PostTypeId="2" ParentId="1040" CreationDate="2008-08-04T06:01:52.873" Score="28" Body="&lt;p&gt;Killing other processes is not a healthy thing to do. If your scenario involves something like uninstallation, you could use the &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa365240%28VS.85%29.aspx&quot;&gt;&lt;strong&gt;&lt;code&gt;MoveFileEx&lt;/code&gt;&lt;/strong&gt; API function&lt;/a&gt; to mark the file for deletion upon next reboot.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it appears that you really need to delete a file in use by another process, I'd recommend re-considering the actual problem before considering any solutions.&lt;/p&gt;&#xA;" OwnerUserId="227" LastEditorUserId="107625" LastEditDate="2012-08-22T07:15:09.167" LastActivityDate="2012-08-22T07:15:09.167" CommentCount="1" />
<row Id="1047" PostTypeId="2" ParentId="1042" CreationDate="2008-08-04T06:10:16.600" Score="0" Body="&lt;p&gt;Quoting a much-replicated help page about Indexing Service query language:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;To use specially treated characters such as &amp;amp;, |, ^, #, @, $, (, ), in a query, enclose your query in quotation marks (“).&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;As far as I know, full text search in &lt;code&gt;MSSQL&lt;/code&gt; is also done by the Indexing Service, so this might help.&lt;/p&gt;&#xA;" OwnerUserId="227" LastEditorUserId="395659" LastEditDate="2013-02-07T13:16:49.563" LastActivityDate="2013-02-07T13:16:49.563" CommentCount="0" />
<row Id="1049" PostTypeId="2" ParentId="1040" CreationDate="2008-08-04T06:12:11.447" Score="4" Body="&lt;p&gt;If you want to do it programatically. I'm not sure... and I'd really recommend against it.&#xD;&#xA;If you're just troubleshooting stuff on your own machine, &lt;a href=&quot;http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx&quot; rel=&quot;nofollow&quot;&gt;SysInternals Process Explorer&lt;/a&gt; can help you&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Run it, use the Find Handle command (I think it's either in the find or handle menu), and search for the name of your file. Once the handle(s) is found, you can forcibly close them.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;You can then delete the file and so on.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&lt;strong&gt;Beware&lt;/strong&gt;, doing this may cause the program which owns the handles to behave strangely, as you've just pulled the proverbial rug out from under it, but it works well when you are debugging your own errant code, or when visual studio / windows explorer is being crap and not releasing file handles even though you told them to close the file ages ago... sigh :-)&lt;/p&gt;" OwnerUserId="234" LastActivityDate="2008-08-04T06:12:11.447" CommentCount="0" />
<row Id="1050" PostTypeId="2" ParentId="1040" CreationDate="2008-08-04T06:14:42.690" Score="1" Body="&lt;p&gt;Oh, one big hack I employed years ago, is that Windows won't let you &lt;em&gt;delete&lt;/em&gt; files, but it does let you &lt;em&gt;move&lt;/em&gt; them.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Pseudo-sort-of-code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;mv %WINDIR%\System32\mfc42.dll %WINDIR\System32\mfc42.dll.old&#xA;Install new mfc42.dll&#xA;Tell user to save work and restart applications&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;When the applications restarted (note we didn't need to reboot the machine), they loaded the new &lt;code&gt;mfc42.dll&lt;/code&gt;, and all was well. That, coupled with &lt;code&gt;PendingFileOperations&lt;/code&gt; to delete the old one the next time the whole system restarted, worked pretty well.&lt;/p&gt;&#xA;" OwnerUserId="234" LastEditorUserId="234" LastEditDate="2010-09-20T20:52:11.073" LastActivityDate="2010-09-20T20:52:11.073" CommentCount="0" />
<row Id="1051" PostTypeId="2" ParentId="1040" CreationDate="2008-08-04T06:15:30.363" Score="10" Body="&lt;P&gt;The typical method is as follows. You've said you want to do this in C# so here goes...&lt;/P&gt;&#xD;&#xA;&lt;OL&gt;&#xD;&#xA;&lt;LI&gt;If you don't know which process has the file locked, you'll need to examine each process's handle list, and query each handle to determine if it identifies the locked file. Doing this in C# will likely require P/Invoke or an intermediary C++/CLI to call the native APIs you'll need.&lt;/LI&gt;&#xD;&#xA;&lt;LI&gt;Once you've figured out which process(es) have the file locked, you'll need to safely inject a small native DLL into the process (you can also inject a managed DLL, but this is messier, as you then have to start or attach to the .NET runtime).&lt;/LI&gt;&#xD;&#xA;&lt;LI&gt;That bootstrap DLL then closes the handle using CloseHandle etc.&lt;/LI&gt;&lt;/OL&gt;&#xD;&#xA;&lt;P&gt;Essentially: the way to unlock a &quot;locked&quot; file is to inject a DLL into the offending process's address space and close it yourself. You can do this using native or managed code. No matter what, you're going to need a small amount of native code or at least P/Invoke into the same.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;Helpful links:&lt;/P&gt;&#xD;&#xA;&lt;UL&gt;&#xD;&#xA;&lt;LI&gt;&lt;A href=&quot;http://www.codeproject.com/KB/threads/winspy.aspx&quot;&gt;http://www.codeproject.com/KB/threads/winspy.aspx&lt;/A&gt;&lt;/LI&gt;&#xD;&#xA;&lt;LI&gt;&lt;A href=&quot;http://damianblog.com/2008/07/02/net-code-injection/&quot;&gt;http://damianblog.com/2008/07/02/net-code-injection/&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;&#xD;&#xA;&lt;P&gt;Good luck!&lt;/P&gt;" OwnerDisplayName="user2189331" LastEditorDisplayName="user2189331" LastEditDate="2008-08-04T06:26:43.900" LastActivityDate="2008-08-04T06:26:43.900" CommentCount="0" />
<row Id="1053" PostTypeId="1" AcceptedAnswerId="394225" CreationDate="2008-08-04T06:21:38.293" Score="7" ViewCount="1358" Body="&lt;p&gt;Most mathematicians agree that:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;e&lt;sup&gt;πi&lt;/sup&gt; + 1 = 0&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;However, most floating point implementations disagree. How well can we settle this dispute?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm keen to hear about different languages and implementations, and various methods to make the result as close to zero as possible. Be creative!&lt;/p&gt;&#xA;" OwnerUserId="13" LastEditorUserId="395659" LastEditorDisplayName="Chris Jester-Young" LastEditDate="2013-02-07T13:16:17.757" LastActivityDate="2013-02-07T13:16:17.757" Title="A little diversion into floating point (im)precision, part 1" Tags="&lt;math&gt;&lt;language-agnostic&gt;&lt;floating-point&gt;" AnswerCount="9" CommentCount="6" FavoriteCount="2" />
<row Id="1054" PostTypeId="2" ParentId="1053" CreationDate="2008-08-04T06:22:18.713" Score="5" Body="&lt;p&gt;Here's a short list of implementations and languages I've tried. It's sorted by closeness to zero:&lt;/p&gt;&#xA;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Scheme: &lt;code&gt;(+ 1 (make-polar 1 (atan 0 -1)))&lt;/code&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;⇒ &lt;code&gt;0.0+1.2246063538223773e-16i&lt;/code&gt; (Chez Scheme, MIT Scheme)&lt;/li&gt;&#xA;&lt;li&gt;⇒ &lt;code&gt;0.0+1.22460635382238e-16i&lt;/code&gt; (Guile)&lt;/li&gt;&#xA;&lt;li&gt;⇒ &lt;code&gt;0.0+1.22464679914735e-16i&lt;/code&gt; (Chicken with &lt;code&gt;numbers&lt;/code&gt; egg)&lt;/li&gt;&#xA;&lt;li&gt;⇒ &lt;code&gt;0.0+1.2246467991473532e-16i&lt;/code&gt; (MzScheme, SISC, Gauche, Gambit)&lt;/li&gt;&#xA;&lt;li&gt;⇒ &lt;code&gt;0.0+1.2246467991473533e-16i&lt;/code&gt; (SCM)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Common Lisp: &lt;code&gt;(1+ (exp (complex 0 pi)))&lt;/code&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;⇒ &lt;code&gt;#C(0.0L0 -5.0165576136843360246L-20)&lt;/code&gt; (CLISP)&lt;/li&gt;&#xA;&lt;li&gt;⇒ &lt;code&gt;#C(0.0d0 1.2246063538223773d-16)&lt;/code&gt; (CMUCL)&lt;/li&gt;&#xA;&lt;li&gt;⇒ &lt;code&gt;#C(0.0d0 1.2246467991473532d-16)&lt;/code&gt; (SBCL)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Perl: &lt;code&gt;use Math::Complex; Math::Complex-&amp;gt;emake(1, pi) + 1&lt;/code&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;⇒ &lt;code&gt;1.22464679914735e-16i&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Python: &lt;code&gt;from cmath import exp, pi; exp(complex(0, pi)) + 1&lt;/code&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;⇒ &lt;code&gt;1.2246467991473532e-16j&lt;/code&gt; (CPython)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;Ruby: &lt;code&gt;require 'complex'; Complex::polar(1, Math::PI) + 1&lt;/code&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;⇒ &lt;code&gt;Complex(0.0, 1.22464679914735e-16)&lt;/code&gt; (MRI)&lt;/li&gt;&#xA;&lt;li&gt;⇒ &lt;code&gt;Complex(0.0, 1.2246467991473532e-16)&lt;/code&gt; (JRuby)&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;li&gt;R: &lt;code&gt;complex(argument = pi) + 1&lt;/code&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;⇒ &lt;code&gt;0+1.224606353822377e-16i&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;" OwnerUserId="13" LastEditorUserId="13" LastEditorDisplayName="Chris Jester-Young" LastEditDate="2008-08-25T00:36:45.890" LastActivityDate="2008-08-25T00:36:45.890" CommentCount="1" />
<row Id="1055" PostTypeId="2" ParentId="1041" CreationDate="2008-08-04T06:23:51.847" Score="5" Body="&lt;p&gt;try &lt;a href=&quot;http://www.pcre.org/&quot;&gt;libpcre&lt;/a&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you're stuck on windows they have a windows port which should work. I know &lt;a href=&quot;http://e-texteditor.com&quot;&gt;e-texteditor&lt;/a&gt; uses it, so at least that's proof it works :-)&lt;/p&gt;" OwnerUserId="234" LastActivityDate="2008-09-20T07:27:23.973" CommentCount="0" />
<row Id="1056" PostTypeId="2" ParentId="1033" CreationDate="2008-08-04T06:26:22.370" Score="33" Body="&lt;p&gt;A lot of people (including my company) seem to use MaxMind GeoIP.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;They have a free version &lt;a href=&quot;http://dev.maxmind.com/geoip/geoip2/geolite2/&quot; rel=&quot;nofollow&quot;&gt;GeoLite&lt;/a&gt; which is not as accurate as the paid version, but if you're just after something simple, it may be good enough.&lt;/p&gt;&#xA;" OwnerUserId="234" LastEditorUserId="234" LastEditDate="2014-10-08T00:17:40.193" LastActivityDate="2014-10-08T00:17:40.193" CommentCount="3" />
<row Id="1057" PostTypeId="2" ParentId="1053" CreationDate="2008-08-04T06:29:03.910" Score="3" Body="&lt;p&gt;Is it possible to settle this dispute?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My first thought is to look to a symbolic language, like &lt;a href=&quot;http://en.wikipedia.org/wiki/Maple_%28software%29&quot; rel=&quot;nofollow&quot;&gt;Maple&lt;/a&gt;. I don't think that counts as floating point though.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;In fact, how does one represent &lt;em&gt;i&lt;/em&gt; (or &lt;em&gt;j&lt;/em&gt; for the engineers) in a conventional programming language?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps a better example is sin(π) = 0? (Or have I missed the point again?)&lt;/p&gt;&#xA;" OwnerUserId="55" LastEditorUserId="13" LastEditDate="2010-01-05T14:00:22.227" LastActivityDate="2010-01-05T14:00:22.227" CommentCount="2" />
<row Id="1061" PostTypeId="2" ParentId="1042" CreationDate="2008-08-04T06:39:40.003" Score="7" Body="&lt;p&gt;The # char is indexed as punctuation and therefore ignored, so it looks like we'll remove the letter C from our word indexing ignore lists.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Tested it locally after doing that and rebuilding the indexes and I get results!&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Looking at using a different word breaker language on the indexed column, so that those special characters aren't ignored.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;EDIT: I also found &lt;a href=&quot;http://www.simple-talk.com/sql/learn-sql-server/sql-server-full-text-search-language-features/&quot;&gt;this information&lt;/a&gt;:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;c# is indexed as c (if c is not in your noise word list, see more on noise word lists later), but C# is indexed as C# (in SQL 2005 and SQL 2000 running on Win2003 regardless if C or c is in your noise word list). It is not only C# that is stored as C#, but any capital letter followed by #. Conversely, c++ ( and any other lower-cased letter followed by a ++) is indexed as c (regardless of whether c is in your noise word list).&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;" OwnerUserId="3" LastEditorUserId="1" LastEditorDisplayName="Jeff Atwood" LastEditDate="2008-08-04T07:06:45.393" LastActivityDate="2008-08-04T07:06:45.380" CommentCount="1" />
<row Id="1062" PostTypeId="2" ParentId="1041" CreationDate="2008-08-04T06:41:29.547" Score="1" Body="&lt;p&gt;The GNU C Library supports &lt;a href=&quot;http://www.gnu.org/software/libtool/manual/libc/Regular-Expressions.html&quot; rel=&quot;nofollow&quot;&gt;regular expressions&lt;/a&gt;. It's open, and the RE code seems to be easily extractable.&lt;/p&gt;" OwnerUserId="116" LastActivityDate="2008-09-20T07:27:23.973" CommentCount="0" />
<row Id="1064" PostTypeId="1" AcceptedAnswerId="1096" CreationDate="2008-08-04T06:51:20.323" Score="5" ViewCount="815" Body="&lt;p&gt;I'd like to display ~100 floating cubes using &lt;code&gt;DirectX&lt;/code&gt; or &lt;code&gt;OpenGL&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I'm looking for either some sample source code, or a description of the technique. I know this kind of thing is easy for you accomplished '3D' gurus out there but I have enough trouble getting even one cube to display correctly.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I've combed the net for a good series of tutorials and although they talk about how to do &lt;code&gt;3D&lt;/code&gt; primitives, what I can't find is information on how to do large numbers of &lt;code&gt;3D&lt;/code&gt; primitives - &lt;code&gt;cubes&lt;/code&gt;, &lt;code&gt;spheres&lt;/code&gt;, &lt;code&gt;pyramids&lt;/code&gt;, and so forth.&lt;/p&gt;&#xA;" OwnerDisplayName="user2189331" LastEditorDisplayName="user2189331" LastEditDate="2014-02-12T09:17:32.707" LastActivityDate="2014-02-12T09:17:32.707" Title="How To Display 100 Floating Cubes Using DirectX OR OpenGL?" Tags="&lt;language-agnostic&gt;&lt;opengl&gt;&lt;3d&gt;&lt;directx&gt;" AnswerCount="3" CommentCount="0" />
<row Id="1065" PostTypeId="2" ParentId="1005" CreationDate="2008-08-04T06:52:32.270" Score="22" Body="&lt;p&gt;In general, you can't change the effective user id of the vi process, but you can do this:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;:w !sudo tee myfile&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="116" LastActivityDate="2008-08-04T06:52:32.270" CommentCount="3" />
<row Id="1066" PostTypeId="2" ParentId="1037" CreationDate="2008-08-04T07:12:57.237" Score="3" Body="&lt;p&gt;&lt;a href=&quot;http://stackoverflow.com/users/46/sven&quot;&gt;Sven&lt;/a&gt;, you reached the same conclusion as I did: I found the Shockwave Flash Object, all be it from a slightly different route, but was stumped on how to load the files from somewhere other than file on disk/URL. The F-IN-BOX, although just a wrapper of the Shockwave Flash Object seems to provide much more functionality, which may just help me!&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Shooting flys with bazookas may be fun, but an embeded web brower is not the path that I am looking for. :)&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;There was a link on Adobe's site that talked about &quot;Embedding and Communicating with the Macromedia Flash Player in C# Windows Applications&quot; but they seem to have removed it :(&lt;/em&gt;&lt;/p&gt;&#xA;" OwnerUserId="231" LastEditorUserId="231" LastEditorDisplayName="FryHard" LastEditDate="2013-01-09T05:36:31.627" LastActivityDate="2013-01-09T05:36:31.627" CommentCount="2" />
<row Id="1069" PostTypeId="1" AcceptedAnswerId="1073" CreationDate="2008-08-04T07:30:01.727" Score="36" ViewCount="28794" Body="&lt;p&gt;I'm working on a &lt;strong&gt;multithreaded&lt;/strong&gt; C++ application that is corrupting the heap. The usual tools to locate this corruption seem to be inapplicable. Old builds (18 months old) of the source code exhibit the same behaviour as the most recent release, so this has been around for a long time and just wasn't noticed; on the downside, source deltas can't be used to identify when the bug was introduced - there are &lt;em&gt;a lot&lt;/em&gt; of code changes in the repository.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The prompt for crashing behaviuor is to generate throughput in this system - socket transfer of data which is munged into an internal representation. I have a set of test data that will periodically cause the app to exception (various places, various causes - including heap alloc failing, thus: heap corruption).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The behaviour seems related to CPU power or memory bandwidth; the more of each the machine has, the easier it is to crash. Disabling a hyper-threading core or a dual-core core reduces the rate of (but does not eliminate) corruption. This suggests a timing related issue.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now here's the rub:&lt;br&gt;&#xA;When it's run under a lightweight debug environment (say &lt;code&gt;Visual Studio 98 / AKA MSVC6&lt;/code&gt;) the heap corruption is reasonably easy to reproduce - ten or fifteen minutes pass before something fails horrendously and exceptions, like an &lt;code&gt;alloc;&lt;/code&gt; when running under a sophisticated debug environment (Rational Purify, &lt;code&gt;VS2008/MSVC9&lt;/code&gt; or even Microsoft Application Verifier) the system becomes memory-speed bound and doesn't crash (Memory-bound: CPU is not getting above &lt;code&gt;50%&lt;/code&gt;, disk light is not on, the program's going as fast it can, box consuming &lt;code&gt;1.3G&lt;/code&gt; of 2G of RAM). So, &lt;strong&gt;I've got a choice between being able to reproduce the problem (but not identify the cause) or being able to idenify the cause or a problem I can't reproduce.&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;My current best guesses as to where to next is:&lt;/p&gt;&#xA;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;Get an insanely grunty box (to replace the current dev box: 2Gb RAM in an &lt;code&gt;E6550 Core2 Duo&lt;/code&gt;); this will make it possible to repro the crash causing mis-behaviour when running under a powerful debug environment; or&lt;/li&gt;&#xA;&lt;li&gt;Rewrite operators &lt;code&gt;new&lt;/code&gt; and &lt;code&gt;delete&lt;/code&gt; to use &lt;code&gt;VirtualAlloc&lt;/code&gt; and &lt;code&gt;VirtualProtect&lt;/code&gt; to mark memory as read-only as soon as it's done with. Run under &lt;code&gt;MSVC6&lt;/code&gt; and have the OS catch the bad-guy who's writing to freed memory. Yes, this is a sign of desperation: who the hell rewrites &lt;code&gt;new&lt;/code&gt; and &lt;code&gt;delete&lt;/code&gt;?! I wonder if this is going to make it as slow as under Purify et al.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;p&gt;And, no: Shipping with Purify instrumentation built in is not an option.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;A colleague just walked past and asked &quot;Stack Overflow? Are we getting stack overflows now?!?&quot;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;And now, the question: &lt;strong&gt;How do I locate the heap corruptor?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Update: balancing &lt;code&gt;new[]&lt;/code&gt; and &lt;code&gt;delete[]&lt;/code&gt; seems to have gotten a long way towards solving the problem. Instead of 15mins, the app now goes about two hours before crashing. Not there yet. Any further suggestions? The heap corruption persists.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Update: a release build under Visual Studio 2008 seems dramatically better; current suspicion rests on the &lt;code&gt;STL&lt;/code&gt; implementation that ships with &lt;code&gt;VS98&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;ol&gt;&#xA; &lt;li&gt;Reproduce the problem. &lt;code&gt;Dr Watson&lt;/code&gt; will produce a dump that might be helpful in further analysis. &lt;/li&gt;&#xA; &lt;/ol&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I'll take a note of that, but I'm concerned that Dr Watson will only be tripped up after the fact, not when the heap is getting stomped on.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;Another try might be using &lt;code&gt;WinDebug&lt;/code&gt; as a debugging tool which is quite powerful being at the same time also lightweight.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;Got that going at the moment, again: not much help until something goes wrong. I want to catch the vandal in the act.&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;Maybe these tools will allow you at least to narrow the problem to certain component.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I don't hold much hope, but desperate times call for...&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;And are you sure that all the components of the project have correct runtime library settings (&lt;code&gt;C/C++ tab&lt;/code&gt;, Code Generation category in VS 6.0 project settings)?&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;No I'm not, and I'll spend a couple of hours tomorrow going through the workspace (58 projects in it) and checking they're all compiling and linking with the appropriate flags.&#xA;&lt;hR&gt;&#xA;Update: This took 30 seconds. Select all projects in the &lt;code&gt;Settings&lt;/code&gt; dialog, unselect until you find the project(s) that don't have the right settings (they all had the right settings).&lt;/p&gt;&#xA;" OwnerUserId="257" LastEditorUserId="1561378" LastEditorDisplayName="Alex Miller" LastEditDate="2012-09-16T10:09:41.643" LastActivityDate="2014-08-21T20:52:29.730" Title="Heap corruption under Win32; how to locate?" Tags="&lt;c++&gt;&lt;windows&gt;&lt;multithreading&gt;&lt;debugging&gt;&lt;memory&gt;" AnswerCount="15" CommentCount="5" FavoriteCount="26" CommunityOwnedDate="2008-09-02T03:03:53.863" />
<row Id="1070" PostTypeId="1" AcceptedAnswerId="1773" CreationDate="2008-08-04T07:34:44.137" Score="11" ViewCount="18598" Body="&lt;p&gt;What is the correct way to get the process size on &lt;code&gt;Solaris, HP-UX&lt;/code&gt; and &lt;code&gt;AIX&lt;/code&gt;? Should we use &lt;code&gt;top&lt;/code&gt; or &lt;code&gt;ps -o vsz&lt;/code&gt; or something else?&lt;/p&gt;&#xA;" OwnerUserId="236" LastEditorUserId="395659" LastEditDate="2013-02-07T13:11:32.953" LastActivityDate="2014-03-20T14:59:09.273" Title="Process size on UNIX" Tags="&lt;unix&gt;&lt;size&gt;" AnswerCount="4" CommentCount="0" FavoriteCount="2" />
<row Id="1071" PostTypeId="2" ParentId="264" CreationDate="2008-08-04T07:45:38.717" Score="0" Body="&lt;p&gt;What I did when working against a database of unknown performance was to measure turnaround time on my queries. I kept upping the thread count until turn-around time dropped, and dropping the thread count until turn-around time improved (well, it was processes in my environment, but whatever). &lt;/p&gt;&#xA;&#xA;&lt;p&gt;There were moving averages and all sorts of metrics involved, but the take-away lesson was: just adapt to how things are working at the moment. You never know when the DBAs will improve performance or hardware will be upgraded, or perhaps another process will come along to load down the system while you're running. So adapt.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Oh, and another thing: avoid process switches if you can - batch things up.&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Oh, I should make this clear: this all happened at run time, not during development.&lt;/p&gt;&#xA;" OwnerUserId="257" LastEditorUserId="213550" LastEditorDisplayName="Josh" LastEditDate="2011-09-09T09:53:02.267" LastActivityDate="2011-09-09T09:53:02.267" CommentCount="0" />
<row Id="1072" PostTypeId="2" ParentId="1069" CreationDate="2008-08-04T07:48:51.440" Score="0" Body="&lt;p&gt;You tried old builds, but is there a reason you can't keep going further back in the repository history and seeing exactly when the bug was introduced?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Otherwise, I would suggest adding simple logging of some kind to help track down the problem, though I am at a loss of what specifically you might want to log.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If you can find out what exactly CAN cause this problem, via google and documentation of the exceptions you are getting, maybe that will give further insight on what to look for in the code.&lt;/p&gt;" OwnerUserId="122" LastActivityDate="2008-08-04T07:48:51.440" CommentCount="0" />
<row Id="1073" PostTypeId="2" ParentId="1069" CreationDate="2008-08-04T07:51:02.997" Score="17" Body="&lt;p&gt;My first choice would be a dedicated heap tool such as &lt;a href=&quot;http://support.microsoft.com/default.aspx?scid=kb;en-us;286470&quot; rel=&quot;nofollow&quot;&gt;pageheap.exe&lt;/a&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Rewriting new and delete might be useful, but that doesn't catch the allocs committed by lower-level code. If this is what you want, better to Detour the &lt;code&gt;low-level alloc API&lt;/code&gt;s using Microsoft Detours.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also sanity checks such as: verify your run-time libraries match (release vs. debug, multi-threaded vs. single-threaded, dll vs. static lib), look for bad deletes (eg, delete where delete [] should have been used), make sure you're not mixing and matching your allocs.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also try selectively turning off threads and see when/if the problem goes away.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;What does the call stack etc look like at the time of the first exception?&lt;/p&gt;&#xA;" OwnerDisplayName="user2189331" LastEditorUserId="395659" LastEditDate="2013-02-07T12:30:21.270" LastActivityDate="2013-02-07T12:30:21.270" CommentCount="0" />
<row Id="1074" PostTypeId="2" ParentId="1010" CreationDate="2008-08-04T08:04:41.737" Score="5" Body="&lt;p&gt;Rex, I suspect a good place to start looking is solutions that &lt;strong&gt;compress the ViewState&lt;/strong&gt; -- they're grabbing ViewState on the server before it's sent down to the client and gzipping it. That's exactly where you want to be.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ul&gt;&#xD;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.hanselman.com/blog/CommentView,guid,febce059-7e7c-439e-af3d-c53d250b3e9c.aspx&quot;&gt;Scott Hanselman on ViewState Compression&lt;/a&gt; (2005)&lt;/li&gt;&#xD;&#xA;&lt;li&gt;&lt;a href=&quot;http://www.bloggingdeveloper.com/post/How-To-Compress-ViewState-in-ASPNET-20-ViewState-Compression-with-SystemIOCompression.aspx&quot;&gt;ViewState Compression with System.IO.Compression&lt;/a&gt; (2007)&lt;/li&gt;&#xD;&#xA;&lt;/ul&gt;" OwnerUserId="1" LastActivityDate="2008-08-04T08:04:41.737" CommentCount="0" />
<row Id="1077" PostTypeId="2" ParentId="761" CreationDate="2008-08-04T08:14:56.973" Score="0" Body="&lt;p&gt;The trouble with international standards is that pretty much noone uses them. I try where I can, but I am forced to use dd/mm/yyyy almost everywhere in real life, which means I am so used to it it's always a conscious process to use ISO-8601. For the majority of people who don't even try to use ISO-8601 it's even worse. If you can internationalize where you can, I think it's a great advantage.&lt;/p&gt;" OwnerUserId="214" LastActivityDate="2008-08-04T08:14:56.973" CommentCount="0" />
<row Id="1082" PostTypeId="2" ParentId="1070" CreationDate="2008-08-04T08:21:07.570" Score="1" Body="&lt;p&gt;Yes, you are right to lock at the VSZ.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;&quot;ps u&quot; will give you the VSZ and RSS, which are the virtual memory size and resident set size. The RSS is how much physical memory has been allocated to the process, and the VSZ is the virtual memory size of the process. If you have several copies of a program running, a lot of the memory in the VSZ will be shared between those processes.&lt;/p&gt;" OwnerUserId="116" LastActivityDate="2008-08-04T08:21:07.570" CommentCount="1" />
<row Id="1083" PostTypeId="1" AcceptedAnswerId="42406" CreationDate="2008-08-04T08:21:42.043" Score="15" ViewCount="2734" Body="&lt;P&gt;I was wondering if there is any good and clean oo implementation of bayesian filtering for spam and text classification? For learning purposes.&lt;/P&gt;" OwnerUserId="260" LastEditorUserId="164901" LastEditorDisplayName="Kevin" LastEditDate="2010-05-22T22:03:07.480" LastActivityDate="2013-02-07T13:10:37.743" Title="Bayesian filtering for spam" Tags="&lt;artificial-intelligence&gt;&lt;email-spam&gt;&lt;bayesian&gt;" AnswerCount="7" CommentCount="0" FavoriteCount="7" />
<row Id="1086" PostTypeId="2" ParentId="1069" CreationDate="2008-08-04T08:26:55.967" Score="0" Body="&lt;P&gt;My first action would be as follows:&lt;/P&gt;&#xD;&#xA;&lt;OL&gt;&#xD;&#xA;&lt;LI&gt;Build the binaries in &quot;Release&quot; version but creating debug info file (you will find this possibility in project settings).&lt;/LI&gt;&#xD;&#xA;&lt;LI&gt;Use Dr Watson as a defualt debugger (DrWtsn32 -I) on a machine on which you want to reproduce the problem.&lt;/LI&gt;&#xD;&#xA;&lt;LI&gt;Repdroduce the problem. Dr Watson will produce a dump that might be helpful in further analysis. &lt;/LI&gt;&lt;/OL&gt;&#xD;&#xA;&lt;P&gt;Another try might be using WinDebug as a debugging tool which is quite powerful being at the same time also lightweight. &lt;/P&gt;&#xD;&#xA;&lt;P&gt;Maybe these tools will allow you at least to narrow the problem to certain component.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;And are you sure that all the components of the project have correct runtime library settings (C/C++ tab, Code Generation category in VS 6.0 project settings)?&lt;/P&gt;" OwnerUserId="2090742" LastActivityDate="2008-08-04T08:26:55.967" CommentCount="0" />
<row Id="1090" PostTypeId="2" ParentId="1083" CreationDate="2008-08-04T08:54:16.393" Score="3" Body="&lt;p&gt;Maybe &lt;a href=&quot;https://ci-bayes.dev.java.net/&quot; rel=&quot;nofollow&quot;&gt;https://ci-bayes.dev.java.net/&lt;/a&gt; or &lt;a href=&quot;http://www.cs.cmu.edu/~javabayes/Home/node2.html&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.cmu.edu/~javabayes/Home/node2.html&lt;/a&gt;?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I never played with it either.&lt;/p&gt;&#xA;" OwnerUserId="86" LastEditorUserId="395659" LastEditDate="2013-02-07T13:10:37.743" LastActivityDate="2013-02-07T13:10:37.743" CommentCount="0" />
<row Id="1092" PostTypeId="2" ParentId="1064" CreationDate="2008-08-04T09:04:01.867" Score="4" Body="&lt;p&gt;Just use glTranslatef (or the DirectX equivalent) to draw a cube using the same code, but moving the relative point where you draw it. Maybe there's a better way to do it though, I'm fairly new to OpenGL. Be sure to set your viewpoint so you can see them all.&lt;/p&gt;" OwnerUserId="61" LastActivityDate="2008-09-20T07:28:52.020" CommentCount="0" />
<row Id="1093" PostTypeId="2" ParentId="1010" CreationDate="2008-08-04T09:04:17.997" Score="2" Body="&lt;p&gt;See this &lt;a href=&quot;http://aspguy.wordpress.com/2008/07/09/reducing-the-page-size-by-storing-viewstate-on-server/&quot; rel=&quot;nofollow&quot;&gt;blog post&lt;/a&gt; where the author describes a method for overriding the default behavior for generating the ViewState and instead shows how to save it on the server Session object.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;In ASP.NET 2.0, ViewState is saved by&#xD;&#xA; a descendant of PageStatePersister&#xD;&#xA; class. This class is an abstract class&#xD;&#xA; for saving and loading ViewsState and&#xD;&#xA; there are two implemented descendants&#xD;&#xA; of this class in .Net Framework, named&#xD;&#xA; HiddenFieldPageStatePersister and&#xD;&#xA; SessionPageStatePersister. By default&#xD;&#xA; HiddenFieldPageStatePersister is used&#xD;&#xA; to save/load ViewState information,&#xD;&#xA; but we can easily get the&#xD;&#xA; SessionPageStatePersister to work and&#xD;&#xA; save ViewState in Session object.&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Although I did not test his code, it seems to show exactly what you want: a way to gain access to ViewState code while still on the server, before postback. &lt;/p&gt;" OwnerUserId="51" LastActivityDate="2008-08-04T09:04:17.997" CommentCount="0" />
<row Id="1095" PostTypeId="2" ParentId="1083" CreationDate="2008-08-04T09:08:32.217" Score="1" Body="&lt;p&gt;Here is an implementation of Bayesian filtering in C#: &lt;a href=&quot;http://www.codeproject.com/KB/recipes/BayesianCS.aspx&quot; rel=&quot;nofollow&quot;&gt;A Naive Bayesian Spam Filter for C#&lt;/a&gt; (hosted on CodeProject).&lt;/p&gt;" OwnerUserId="51" LastActivityDate="2008-08-04T09:08:32.217" CommentCount="0" />
<row Id="1096" PostTypeId="2" ParentId="1064" CreationDate="2008-08-04T09:12:37.543" Score="5" Body="&lt;p&gt;You say you have enough trouble getting one cube to display... so I am not sure if you have got one to display or not.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Basically... put your code for writing a cube in one function, then just call that function 100 times.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;void DrawCube()&lt;br&gt;{&lt;br&gt; //code to draw the cube&lt;br&gt;}&lt;br&gt;&lt;br&gt;void DisplayCubes()&lt;br&gt;{&lt;br&gt; for(int i = 0; i &amp;lt; 10; ++i)&lt;br&gt; { &lt;br&gt; for(int j = 0; j &amp;lt; 10; ++j)&lt;br&gt; {&lt;br&gt; glPushMatrix();&lt;br&gt; //alter these values depending on the size of your cubes.&lt;br&gt; //This call makes sure that your cubes aren't drawn overtop of each other&lt;br&gt; glTranslatef(i*5.0, j*5.0, 0);&lt;br&gt; DrawCube();&lt;br&gt; glPopMatrix();&lt;br&gt; }&lt;br&gt; } &lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;That is the basic outline for how you could go about doing this. If you want something more efficient take a look into Display Lists sometime once you have the basics figured out :)&lt;/p&gt;" OwnerUserId="41" LastEditorUserId="41" LastEditorDisplayName="Devin" LastEditDate="2008-08-05T11:54:57.573" LastActivityDate="2008-09-20T07:28:52.020" CommentCount="0" />
<row Id="1104" PostTypeId="1" AcceptedAnswerId="1109" CreationDate="2008-08-04T10:01:37.927" Score="12" ViewCount="1686" Body="&lt;p&gt;Exceptions in C++ don't need to be caught (no compile time errors) by the calling function. So it's up to developer's judgment whether to catch it using try/catch (unlike in Java). &lt;/p&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;p&gt;Is there a way one can ensure that the exceptions thrown are always caught using try/catch by the calling function?&lt;/p&gt;&#xA;" OwnerUserId="236" LastEditorUserId="1561378" LastEditDate="2012-11-11T07:55:08.293" LastActivityDate="2013-02-07T13:08:40.303" Title="Ensuring that Exceptions are always Caught" Tags="&lt;c++&gt;&lt;exception&gt;&lt;try-catch&gt;" AnswerCount="6" CommentCount="1" />
<row Id="1108" PostTypeId="1" AcceptedAnswerId="1130" CreationDate="2008-08-04T10:07:12.673" Score="696" ViewCount="262071" Body="&lt;p&gt;Given that indexing is so important as your dataset increases in size, can someone explain how indexing works at a database agnostic level?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;For information on queries to index a field, check out &lt;a href=&quot;http://stackoverflow.com/questions/1156/how-do-i-index-a-database-field&quot; rel=&quot;nofollow&quot;&gt;http://stackoverflow.com/questions/1156/how-do-i-index-a-database-field&lt;/a&gt;&lt;/p&gt;" OwnerUserId="264" LastEditorUserId="264" LastEditDate="2008-10-07T01:02:24.253" LastActivityDate="2015-01-14T06:44:51.540" Title="How does database indexing work?" Tags="&lt;database&gt;&lt;indexing&gt;&lt;article&gt;" AnswerCount="5" CommentCount="0" FavoriteCount="564" />
<row Id="1109" PostTypeId="2" ParentId="1104" CreationDate="2008-08-04T10:10:15.727" Score="19" Body="&lt;p&gt;No.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;See &lt;a href=&quot;http://www.gotw.ca/publications/mill22.htm&quot; rel=&quot;nofollow&quot;&gt;A Pragmatic Look at Exception Specifications&lt;/a&gt; for reasons why not. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;The only way you can &quot;help&quot; this is to document the exceptions your function can throw, say as a comment in the header file declaring it. This is not enforced by the compiler or anything. Use code reviews for that purpose.&lt;/p&gt;&#xA;" OwnerUserId="13" LastEditorUserId="395659" LastEditDate="2013-02-07T13:07:37.790" LastActivityDate="2013-02-07T13:07:37.790" CommentCount="0" />
<row Id="1114" PostTypeId="2" ParentId="944" CreationDate="2008-08-04T10:20:01.260" Score="3" Body="&lt;p&gt;&lt;strong&gt;AppDomain.UnhandledException&lt;/strong&gt; is an &lt;strong&gt;event&lt;/strong&gt;, not a global exception handler. This means, by the time it is raised, your application is already on its way down the drain, and there is nothing you can do about it, except for doing cleanup and error logging.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;What happened behind the scenes is this: The framework detected the exception, walked up the call stack to the very top, found no handlers that would recover from the error, so was unable to determine if it was safe to continue execution. So, it started the shutdown sequence, and fired up this event as a courtesy to you so you can pay your respects to your already-doomed process. This happens when an exception is left unhandled in the main thread.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;There is no single-point solution to this kind of error. You need to put a real exception handler (a catch block) upstream of all places where this error occurs and forward it to (for example) a global handler method/class that will determine if it is safe to simply report and continue, based on exception type and/or content.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Edit: It is possible to disable (=hack) the error-reporting mechanism built into Windows so the mandatory &quot;crash and burn&quot; dialog does not get displayed when your app goes down. However, this becomes effective for &lt;em&gt;all&lt;/em&gt; the applications in the system, not just your own.&lt;/p&gt;" OwnerUserId="227" LastActivityDate="2008-08-04T10:20:01.260" CommentCount="0" />
<row Id="1120" PostTypeId="2" ParentId="855" CreationDate="2008-08-04T10:27:05.270" Score="2" Body="&lt;p&gt;I've just set up Sandcastle again. Try installing it (the May 2008 release) and search for SandcastleGui.exe or something similar (it's in the examples folder or so).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Click Add Assembly and add your Assembly or Assemblies, add any .xml Documentation files (the ones generated by the compiler if you enabled that option) and then Build.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It will take some time, but the result &lt;strong&gt;will&lt;/strong&gt; be worth the effort. It will actually look up stuff from MSDN, so your resulting documentation will also have the Class Inheritance all the way down to System.Object with links to MSDN and stuff.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Sandcastle seems a bit complicated at first, especially when you want to use it in an automated build, but I am absolutely sure it will be worth the effort.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Also have a look at &lt;a href=&quot;http://www.codeplex.com/SHFB&quot; rel=&quot;nofollow&quot;&gt;Sandcastle Help File Builder&lt;/a&gt;, this is a somewhat more advanced GUI for it.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="237838" LastEditDate="2013-02-07T17:31:19.500" LastActivityDate="2013-02-07T17:31:19.500" CommentCount="0" />
<row Id="1121" PostTypeId="2" ParentId="918" CreationDate="2008-08-04T10:28:54.533" Score="2" Body="&lt;p&gt;Python is such a simple language (once you learn the basics) that generally you don't need to read reams of code to work out how to do things.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I second &lt;a href=&quot;http://stackoverflow.com/questions/918/#922&quot; rel=&quot;nofollow&quot;&gt;Brian&lt;/a&gt;'s suggestion of Dive into Python (and upmodded it to represent my support) to learn the syntax and the pythonic way of doing things and would like to add a link to &lt;a href=&quot;http://docs.python.org/lib/lib.html&quot; rel=&quot;nofollow&quot;&gt;The Python Library Reference&lt;/a&gt; to learn what's available under python.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Keeping things simple works best in the early days and large open source projects rarely serve as simple examples and much simpler stuff isn't as easy to find.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Hang around long enough and I'm sure Stack Overflow will be the resource you want :)&lt;/p&gt;" OwnerUserId="269" LastActivityDate="2008-08-04T10:28:54.533" CommentCount="0" />
<row Id="1123" PostTypeId="2" ParentId="855" CreationDate="2008-08-04T10:31:33.220" Score="2" Body="&lt;p&gt;Follow &lt;a href=&quot;http://saftsack.fs.uni-bayreuth.de/%7Edun3/archives/integrate-xml-code-comments-into-visual-studio-20052008-using-sandcastle-and-html-help-20/150.html&quot; rel=&quot;nofollow&quot;&gt;this simple 5 step article&lt;/a&gt; and you are pretty much done. As a bonus you can use &lt;a href=&quot;http://www.helpware.net/mshelp2/h2viewer.htm&quot; rel=&quot;nofollow&quot;&gt;H2Viewer&lt;/a&gt; to view Html Help 2.x files.&lt;/p&gt;" OwnerUserId="39" LastActivityDate="2008-08-04T10:31:33.220" CommentCount="1" />
<row Id="1130" PostTypeId="2" ParentId="1108" CreationDate="2008-08-04T10:41:04.620" Score="1349" Body="&lt;p&gt;&lt;strong&gt;Why is it needed?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;When data is stored on disk based storage devices, it is stored as blocks of data. These blocks are accessed in their entirety, making them the atomic disk access operation. Disk blocks are structured in much the same way as linked lists; both contain a section for data, a pointer to the location of the next node (or block), and both need not be stored contiguously.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Due to the fact that a number of records can only be sorted on one field, we can state that searching on a field that isn’t sorted requires a Linear Search which requires &lt;code&gt;N/2&lt;/code&gt; block accesses (on average), where &lt;code&gt;N&lt;/code&gt; is the number of blocks that the table spans. If that field is a non-key field (i.e. doesn’t contain unique entries) then the entire table space must be searched at &lt;code&gt;N&lt;/code&gt; block accesses.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Whereas with a sorted field, a Binary Search may be used, this has &lt;code&gt;log2 N&lt;/code&gt; block accesses. Also since the data is sorted given a non-key field, the rest of the table doesn’t need to be searched for duplicate values, once a higher value is found. Thus the performance increase is substantial.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;What is indexing?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Indexing is a way of sorting a number of records on multiple fields. Creating an index on a field in a table creates another data structure which holds the field value, and pointer to the record it relates to. This index structure is then sorted, allowing Binary Searches to be performed on it.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The downside to indexing is that these indexes require additional space on the disk, since the indexes are stored together in a table using the MyISAM engine, this file can quickly reach the size limits of the underlying file system if many fields within the same table are indexed.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;How does it work?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Firstly, let’s outline a sample database table schema; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;Field name Data type Size on disk&#xA;id (Primary key) Unsigned INT 4 bytes&#xA;firstName Char(50) 50 bytes&#xA;lastName Char(50) 50 bytes&#xA;emailAddress Char(100) 100 bytes&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: char was used in place of varchar to allow for an accurate size on disk value. &#xA;This sample database contains five million rows, and is unindexed. The performance of several queries will now be analyzed. These are a query using the &lt;em&gt;id&lt;/em&gt; (a sorted key field) and one using the &lt;em&gt;firstName&lt;/em&gt; (a non-key unsorted field).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Example 1&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given our sample database of &lt;code&gt;r = 5,000,000&lt;/code&gt; records of a fixed size giving a record length of &lt;code&gt;R = 204&lt;/code&gt; bytes and they are stored in a table using the MyISAM engine which is using the default block size &lt;code&gt;B = 1,024&lt;/code&gt; bytes. The blocking factor of the table would be &lt;code&gt;bfr = (B/R) = 1024/204 = 5&lt;/code&gt; records per disk block. The total number of blocks required to hold the table is &lt;code&gt;N = (r/bfr) = 5000000/5 = 1,000,000&lt;/code&gt; blocks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A linear search on the id field would require an average of &lt;code&gt;N/2 = 500,000&lt;/code&gt; block accesses to find a value given that the id field is a key field. But since the id field is also sorted a binary search can be conducted requiring an average of &lt;code&gt;log2 1000000 = 19.93 = 20&lt;/code&gt; block accesses. Instantly we can see this is a drastic improvement.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now the &lt;em&gt;firstName&lt;/em&gt; field is neither sorted, so a binary search is impossible, nor are the values unique, and thus the table will require searching to the end for an exact &lt;code&gt;N = 1,000,000&lt;/code&gt; block accesses. It is this situation that indexing aims to correct.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that an index record contains only the indexed field and a pointer to the original record, it stands to reason that it will be smaller than the multi-field record that it points to. So the index itself requires fewer disk blocks that the original table, which therefore requires fewer block accesses to iterate through. The schema for an index on the &lt;em&gt;firstName&lt;/em&gt; field is outlined below; &lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&#xA;Field name Data type Size on disk&#xA;firstName Char(50) 50 bytes&#xA;(record pointer) Special 4 bytes&#xA;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Pointers in MySQL are 2, 3, 4 or 5 bytes in length depending on the size of the table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;&lt;strong&gt;Example 2&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given our sample database of &lt;code&gt;r = 5,000,000&lt;/code&gt; records with an index record length of &lt;code&gt;R = 54&lt;/code&gt; bytes and using the default block size &lt;code&gt;B = 1,024&lt;/code&gt; bytes. The blocking factor of the index would be &lt;code&gt;bfr = (B/R) = 1024/54 = 18&lt;/code&gt; records per disk block. The total number of blocks required to hold the table is &lt;code&gt;N = (r/bfr) = 5000000/18 = 277,778&lt;/code&gt; blocks. &lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now a search using the &lt;em&gt;firstName&lt;/em&gt; field can utilise the index to increase performance. This allows for a binary search of the index with an average of &lt;code&gt;log2 277778 = 18.08 = 19&lt;/code&gt; block accesses. To find the address of the actual record, which requires a further block access to read, bringing the total to &lt;code&gt;19 + 1 = 20&lt;/code&gt; block accesses, a far cry from the 277,778 block accesses required by the non-indexed table.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;When should it be used?&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Given that creating an index requires additional disk space (277,778 blocks extra from the above example), and that too many indexes can cause issues arising from the file systems size limits, careful thought must be used to select the correct fields to index.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Since indexes are only used to speed up the searching for a matching field within the records, it stands to reason that indexing fields used only for output would be simply a waste of disk space and processing time when doing an insert or delete operation, and thus should be avoided. Also given the nature of a binary search, the cardinality or uniqueness of the data is important. Indexing on a field with a cardinality of 2 would split the data in half, whereas a cardinality of 1,000 would return approximately 1,000 records. With such a low cardinality the effectiveness is reduced to a linear sort, and the query optimizer will avoid using the index if the cardinality is less than 30% of the record number, effectively making the index a waste of space.&lt;/p&gt;&#xA;" OwnerUserId="264" LastEditorUserId="1244353" LastEditDate="2014-04-01T12:45:54.977" LastActivityDate="2014-04-01T12:45:54.977" CommentCount="21" />
<row Id="1131" PostTypeId="1" AcceptedAnswerId="1135" CreationDate="2008-08-04T10:43:05.707" Score="24" ViewCount="2735" Body="&lt;p&gt;Back in the old days, Help was not trivial but possible: generate some funky .rtf file with special tags, run it through a compiler, and you got a WinHelp file (.hlp) that actually works really well.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Then, Microsoft decided that WinHelp was not hip and cool anymore and switched to CHM, up to the point they actually axed WinHelp from Vista.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now, CHM maybe nice, but everyone that tried to open a .chm file on the Network will know the nice &quot;Navigation to the webpage was canceled&quot; screen that is caused by security restrictions.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;While there are ways to make CHM work off the network, this is hardly a good choice, because when a user presses the Help Button he wants help and not have to make some funky settings.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Bottom Line: I find CHM absolutely unusable. But with WinHelp not being an option anymore either, I wonder what the alternatives are, especially when it comes to integrate with my Application (i.e. for WinHelp and CHM there are functions that allow you to directly jump to a topic)?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;PDF has the disadvantage of requiring the Adobe Reader (or one of the more lightweight ones that not many people use). I could live with that seeing as this is kind of standard nowadays, but can you tell it reliably to jump to a given page/anchor?&lt;/p&gt;&#xA;&#xA;&lt;p&gt;HTML files seem to be the best choice, you then just have to deal with different browsers (CSS and stuff).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;em&gt;Edit:&lt;/em&gt; I am looking to create my own Help Files. As I am a fan of the &quot;No Setup, Just Extract and Run&quot; Philosophy, i had that problem many times in the past because many of my users will run it off the network, which causes exactly this problem.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;So i am looking for a more robust and future-proof way to provide help to my users without having to code a different help system for each application i make.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;CHM is a really nice format, but that Security Stuff makes it unusable, as a Help system is supposed to provide help to the user, not to generate even more problems.&lt;/p&gt;&#xA;" OwnerUserId="91" LastEditorUserId="1471203" LastEditorDisplayName="Adam Mitz" LastEditDate="2013-01-09T05:45:27.583" LastActivityDate="2014-01-16T17:01:50.547" Title="Windows Help files - what are the options?" Tags="&lt;windows&gt;&lt;language-agnostic&gt;&lt;chm&gt;&lt;winhelp&gt;" AnswerCount="10" CommentCount="0" FavoriteCount="4" />
<row Id="1132" PostTypeId="2" ParentId="918" CreationDate="2008-08-04T10:43:23.287" Score="3" Body="&lt;p&gt;I never really learn to use a language until I try to use it properly for something. It is all well and good going through thesetutorials, but the examples are always written to demonstrate a function of the language when in reality you really want to try to make the language solve your problem. In essence, the best way is to find a problem you need solving and dive right in.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Good luck&lt;/p&gt;" OwnerUserId="274" LastActivityDate="2008-08-04T10:43:23.287" CommentCount="0" />
<row Id="1135" PostTypeId="2" ParentId="1131" CreationDate="2008-08-04T10:51:39.560" Score="10" Body="&lt;p&gt;HTML would be the next best choice, ONLY IF you would serve them from a public web server. If you tried to bundle it with your app, all the files (and images (and stylesheets (and ...) ) ) would make CHM look like a gift from gods.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;That said, when actually bundled in the installation package, (instead of being served over the network), I found the CHM files to work nicely.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;OTOH, another pitfall about CHM files: Even if you try to open a CHM file on a &lt;strong&gt;local&lt;/strong&gt; disk, you may bump into the security block if you initially downloaded it from somewhere, because the file could be marked as &quot;came from external source&quot; when it was obtained.&lt;/p&gt;" OwnerUserId="227" LastActivityDate="2008-08-04T10:51:39.560" CommentCount="3" />
<row Id="1136" PostTypeId="2" ParentId="1131" CreationDate="2008-08-04T10:52:26.173" Score="0" Body="&lt;p&gt;Is the question how to generate your own help files, or what is the best help file format?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Personally, I find CHM to be excellent. One of the first things I do when setting up a machine is to download the PHP Manual in CHM format (&lt;a href=&quot;http://www.php.net/download-docs.php&quot; rel=&quot;nofollow&quot;&gt;http://www.php.net/download-docs.php&lt;/a&gt;) and add a hotkey to it in &lt;a href=&quot;http://crimsoneditor.com/&quot; rel=&quot;nofollow&quot;&gt;Crimson Editor&lt;/a&gt;. So when I press F1 it loads the CHM and performs a search for the word my cursor is on (great for quick function reference). &lt;/p&gt;" OwnerUserId="40" LastActivityDate="2008-12-25T01:16:43.563" CommentCount="0" />
<row Id="1141" PostTypeId="2" ParentId="1131" CreationDate="2008-08-04T11:02:12.097" Score="2" Body="&lt;p&gt;Our software is both distributed locally to the clients and served from a network share. We opted for generating both a CHM file and a set of HTML files for serving from the network. Users starting the program locally use the CHM file, and users getting their program served from a network share has to use the HTML files.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;We use &lt;a href=&quot;http://www.helpandmanual.com/&quot; rel=&quot;nofollow&quot;&gt;Help and Manual&lt;/a&gt; and can thus easily produce both types of output from the same source project. The HTML files also contain searching capabilities and doesn't require a web server, so though it isn't an optimal solution, works fine.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;So far all the single-file types for Windows seems broken in one way or another:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;ul&gt;&#xD;&#xA;&lt;li&gt;WinHelp - obsoleted&lt;/li&gt;&#xD;&#xA;&lt;li&gt;HtmlHelp (CHM) - obsoleted on Vista, doesn't work from network share, other than that works really nice&lt;/li&gt;&#xD;&#xA;&lt;li&gt;Microsoft Help 2 (HXS) - this seems to work right up until the point when it doesn't, corrupted indexes or similar, this is used by Visual Studio 2005 and above, as an example&lt;/li&gt;&#xD;&#xA;&lt;/ul&gt;" OwnerUserId="267" LastEditorUserId="267" LastEditorDisplayName="lassevk" LastEditDate="2008-08-04T11:07:08.153" LastActivityDate="2008-08-04T11:07:08.153" CommentCount="2" />
<row Id="1142" PostTypeId="2" ParentId="1083" CreationDate="2008-08-04T11:03:51.437" Score="0" Body="&lt;p&gt;In French, but you should be able to find the download link :)&#xD;&#xA;&lt;a href=&quot;http://xhtml.net/scripts/PHPNaiveBayesianFilter&quot; rel=&quot;nofollow&quot;&gt;PHP Naive Bayesian Filter&lt;/a&gt;&lt;/p&gt;" OwnerUserId="268" OwnerDisplayName="Vincent Robert" LastActivityDate="2008-08-04T11:03:51.437" CommentCount="0" />
<row Id="1145" PostTypeId="1" AcceptedAnswerId="1154" CreationDate="2008-08-04T11:06:00.560" Score="3" ViewCount="5049" Body="&lt;p&gt;I've tried to write a string replace function in C, which works on a &lt;code&gt;char *&lt;/code&gt;, which has been allocated using &lt;code&gt;malloc()&lt;/code&gt;. It's a little different in that it will find and replace strings, rather than characters in the starting string.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;It's trivial to do if the search and replace strings are the same length (or the replace string is shorter than the search string), since I have enough space allocated. If I try to use &lt;code&gt;realloc()&lt;/code&gt;, I get an error that tells me I am doing a double free - which I don't see how I am, since I am only using &lt;code&gt;realloc()&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Perhaps a little code will help:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;void strrep(char *input, char *search, char *replace) {&#xA; int searchLen = strlen(search);&#xA; int replaceLen = strlen(replace);&#xA; int delta = replaceLen - searchLen;&#xA; char *find = input;&#xA; while (find = strstr(find, search)) {&#xA; if (delta &amp;gt; 0) {&#xA; realloc(input, strlen(input) + delta);&#xA; find = strstr(input, search); &#xA; }&#xA; memmove(find + replaceLen, find + searchLen, strlen(input) - (find - input));&#xA; memmove(find, replace, replaceLen);&#xA; }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;The program works, until I try to &lt;code&gt;realloc()&lt;/code&gt; in an instance where the replaced string will be longer than the initial string. (It still kind of works, it just spits out errors as well as the result).&lt;/p&gt;&#xA;&#xA;&lt;p&gt;If it helps, the calling code looks like:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdio.h&amp;gt;&#xA;#include &amp;lt;string.h&amp;gt;&#xA;#include &amp;lt;stdlib.h&amp;gt;&#xA;&#xA;void strrep(char *input, char *search, char *replace);&#xA;&#xA;int main(void) {&#xA; char *input = malloc(81);&#xA; while ((fgets(input, 81, stdin)) != NULL) {&#xA; strrep(input, &quot;Noel&quot;, &quot;Christmas&quot;);&#xA; }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="188" LastEditorUserId="188" LastEditorDisplayName="Matthew Schinckel" LastEditDate="2014-07-15T07:40:42.967" LastActivityDate="2014-07-15T07:40:42.967" Title="Why am I getting a malloc: double free error with realloc()?" Tags="&lt;c&gt;&lt;malloc&gt;" AnswerCount="9" CommentCount="0" FavoriteCount="1" />
<row Id="1147" PostTypeId="2" ParentId="502" CreationDate="2008-08-04T11:09:05.950" Score="1" Body="&lt;p&gt;John Resig did &lt;a href=&quot;http://ejohn.org/blog/easy-pdf-sharing/&quot; rel=&quot;nofollow&quot;&gt;a script to extract images from a PDF as PNG files using ImageMagick&lt;/a&gt;.&lt;/p&gt;" OwnerUserId="268" OwnerDisplayName="Vincent Robert" LastActivityDate="2008-08-04T11:09:05.950" CommentCount="0" />
<row Id="1148" PostTypeId="2" ParentId="13" CreationDate="2008-08-04T11:11:14.230" Score="9" Body="&lt;blockquote&gt;&#xD;&#xA; &lt;p&gt;Anyone know of any services that will&#xD;&#xA; match IP to geographic location&lt;/p&gt;&#xD;&#xA;&lt;/blockquote&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Well, lucky for you that answer can be found on our very own stackoverflow website:&#xD;&#xA;&lt;a href=&quot;http://stackoverflow.com/questions/1033/ip-to-country&quot;&gt;http://stackoverflow.com/questions/1033/ip-to-country&lt;/a&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;spoiler: &lt;a href=&quot;http://www.hostip.info/use.html&quot;&gt;http://www.hostip.info/use.html&lt;/a&gt;&lt;/p&gt;" OwnerUserId="46" LastActivityDate="2008-08-04T11:11:14.230" CommentCount="5" />
<row Id="1149" PostTypeId="2" ParentId="1145" CreationDate="2008-08-04T11:14:48.827" Score="4" Body="&lt;p&gt;Just a shot in the dark because I haven't tried it yet but when you realloc it returns the pointer much like malloc. Because realloc can move the pointer if needed you are most likely operating on an invalid pointer if you don't do the following:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;input = realloc(input, strlen(input) + delta);&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="200" LastActivityDate="2008-08-04T11:14:48.827" CommentCount="1" />
<row Id="1153" PostTypeId="2" ParentId="1145" CreationDate="2008-08-04T11:17:32.330" Score="2" Body="&lt;p&gt;&lt;strong&gt;Note, try to edit your code to get rid of the html escape codes.&lt;/strong&gt;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Well, though it has been a while since I used C/C++, realloc that grows only reuses the memory pointer value if there is room in memory after your original block.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;For instance, consider this:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;(xxxxxxxxxx..........)&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;If your pointer points to the first x, and . means free memory location, and you grow the memory size pointed to by your variable by 5 bytes, it'll succeed. This is of course a simplified example as blocks are rounded up to a certain size for alignment, but anyway.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;However, if you subsequently try to grow it by another 10 bytes, and there is only 5 available, it will need to move the block in memory and update your pointer.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;However, in your example you are passing the function a pointer to the character, not a pointer to your variable, and thus while the strrep function internally might be able to adjust the variable in use, it is a local variable to the strrep function and your calling code will be left with the original pointer variable value.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;This pointer value, however, has been freed.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;In your case, input is the culprit.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;However, I would make another suggestion. In your case it looks like the &lt;em&gt;input&lt;/em&gt; variable is indeed input, and if it is, it shouldn't be modified, at all.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I would thus try to find another way to do what you want to do, without changing &lt;em&gt;input&lt;/em&gt;, as side-effects like this can be hard to track down.&lt;/p&gt;" OwnerUserId="267" LastActivityDate="2008-08-04T11:17:32.330" CommentCount="0" />
<row Id="1154" PostTypeId="2" ParentId="1145" CreationDate="2008-08-04T11:19:54.447" Score="6" Body="&lt;p&gt;As a general rule, you should &lt;strong&gt;never&lt;/strong&gt; do a free or realloc on a user provided buffer. You don't know where the user allocated the space (in your module, in another DLL) so you cannot use any of the allocation functions on a user buffer.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Provided that you now cannot do any reallocation within your function, you should change a little its behavior like doing only one replacement, so the user will be able to compute the resulting string max length and provide you with a buffer long enough for this one replacement to occur.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Then you could create another function to do the multiple replacements, but you will have to allocate the whole space for the resulting string and copy the user input string. Then you must provide a way to delete the string you allocated.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Resulting in:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;void strrep(char *input, char *search, char *replace);&lt;br&gt;char* strrepm(char *input, char *search, char *replace);&lt;br&gt;void strrepmfree(char *input);&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="268" OwnerDisplayName="Vincent Robert" LastActivityDate="2008-08-04T11:19:54.447" CommentCount="0" />
<row Id="1155" PostTypeId="2" ParentId="1145" CreationDate="2008-08-04T11:20:58.657" Score="1" Body="&lt;P&gt;My quick hints.&lt;/P&gt;&#xD;&#xA;&lt;P&gt;Instead of: &lt;BR&gt;&lt;CODE&gt;void strrep(char *input, char *search, char *replace)&lt;/CODE&gt; &lt;BR&gt;try: &lt;BR&gt;&lt;CODE&gt;void strrep(char *&amp;amp;input, char *search, char *replace)&lt;/CODE&gt;&lt;/P&gt;&#xD;&#xA;&lt;P&gt;and than in the body: &lt;BR&gt;&lt;CODE&gt;input = realloc(input, strlen(input) + delta);&lt;/CODE&gt;&lt;/P&gt;&#xD;&#xA;&lt;P&gt;Generally read about passing function arguments as values/reference and realloc() description :).&lt;/P&gt;" OwnerUserId="2090742" LastActivityDate="2008-08-04T11:20:58.657" CommentCount="0" />
<row Id="1156" PostTypeId="1" AcceptedAnswerId="1157" CreationDate="2008-08-04T11:21:26.567" Score="26" ViewCount="18983" Body="&lt;p&gt;Hopefully, I can get answers for each database server.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;For an outline of how indexing works check out: &lt;a href=&quot;http://stackoverflow.com/questions/1108/how-does-database-indexing-work&quot; rel=&quot;nofollow&quot;&gt;http://stackoverflow.com/questions/1108/how-does-database-indexing-work&lt;/a&gt;&lt;/p&gt;" OwnerUserId="264" LastEditorUserId="13302" LastEditDate="2012-02-15T06:34:52.020" LastActivityDate="2012-06-15T18:01:12.187" Title="How do I index a database column" Tags="&lt;sql&gt;&lt;database&gt;&lt;indexing&gt;" AnswerCount="4" CommentCount="3" FavoriteCount="11" />
<row Id="1157" PostTypeId="2" ParentId="1156" CreationDate="2008-08-04T11:25:14.017" Score="37" Body="&lt;p&gt;The following is SQL92 standard so should be supported by the majority of RDMBS that use SQL:&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;CREATE INDEX [index name] ON [table name] ( [column name] )&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;" OwnerUserId="200" LastEditorUserId="200" LastEditorDisplayName="John Downey" LastEditDate="2008-08-04T12:34:51.723" LastActivityDate="2008-08-04T12:34:51.723" CommentCount="1" />
<row Id="1159" PostTypeId="2" ParentId="1145" CreationDate="2008-08-04T11:35:33.463" Score="0" Body="&lt;p&gt;I've tried using input = realloc(...), but that appears to just case some other problems, which, considering this is a slightly &quot;non-recommended&quot; practice of altering strings that I don't know where they've come from, I will take lassevk's advice of doing it another way...&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;...Since this isn't really production code (it's for learning, only), and the specification said &quot;you can limit input to 80 characters&quot;, and the only increasing replace is &quot;Noel&quot; -&gt; &quot;Christmas&quot;, I can just initially allocate 161 characters, and leave it be.&lt;/p&gt;" OwnerUserId="188" LastEditorUserId="188" LastEditorDisplayName="Matthew Schinckel" LastEditDate="2008-08-04T11:39:55.157" LastActivityDate="2008-08-04T11:39:55.157" CommentCount="0" />
<row Id="1160" PostTypeId="1" AcceptedAnswerId="975299" CreationDate="2008-08-04T11:37:24.863" Score="31" ViewCount="16437" Body="&lt;p&gt;I am using CCNET on a sample project with SVN as my source control. CCNET is configured to create a build on every check in. CCNET uses MSBuild to build the source code.&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;I would like to use the latest revision number to generate AssemblyInfo.cs while compiling.&#xD;&#xA;How can I retrieve the latest revision from subversion and use the value in CCNET?&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Edit: I'm not using NAnt - only MSBuild.&lt;/p&gt;" OwnerUserId="120" LastEditorUserId="120" LastEditorDisplayName="hitec" LastEditDate="2008-08-05T05:45:45.167" LastActivityDate="2013-04-29T13:54:01.600" Title="Use SVN Revision to label build in CCNET" Tags="&lt;svn&gt;&lt;msbuild&gt;&lt;cruisecontrol.net&gt;" AnswerCount="12" CommentCount="0" FavoriteCount="27" />
<row Id="1163" PostTypeId="2" ParentId="1145" CreationDate="2008-08-04T11:39:47.853" Score="2" Body="&lt;p&gt;This seems to work;&lt;/p&gt;&#xD;&#xA;&#xD;&#xA;&lt;pre&gt;&lt;code&gt;char *strrep(char *string, const char *search, const char *replace) {&lt;br&gt; char *p = strstr(string, search);&lt;br&gt;&lt;br&gt; if (p) {&lt;br&gt; int occurrence = p - string;&lt;br&gt; int stringlength = strlen(string);&lt;br&gt; int searchlength = strlen(search);&lt;br&gt; int replacelength = strlen(replace);&lt;br&gt;&lt;br&gt; if (replacelength &amp;gt; searchlength) {&lt;br&gt; string = (char *) realloc(string, strlen(string) &lt;br&gt; + replacelength - searchlength + 1);&lt;br&gt; }&lt;br&gt;&lt;br&gt; if (replacelength != searchlength) {&lt;br&gt; memmove(string + occurrence + replacelength, &lt;br&gt; string + occurrence + searchlength, &lt;br&gt; stringlength - occurrence - searchlength + 1);&lt;br&gt; }&lt;br&gt;&lt;br&gt; strncpy(string + occurrence, replace, replacelength);&lt;br&gt; }&lt;br&gt;&lt;br&gt; return string;&lt;br&gt;}&lt;br&gt;&lt;/code&gt;&lt;/pre&gt;&#xD;&#xA;&#xD;&#xA;&lt;p&gt;Sigh, is there anyway to post code without it sucking?&lt;/p&gt;" OwnerUserId="263" LastEditorUserId="263" LastEditorDisplayName="Mark" LastEditDate="2008-08-04T11:45:15.457" LastActivityDate="2008-08-04T11:45:15.457" CommentCount="0" />
<row Id="1164" PostTypeId="2" ParentId="1160" CreationDate="2008-08-04T11:41:37.133" Score="2" Body="&lt;p&gt;I am currently &quot;manually&quot; doing it through a prebuild-exec Task, using my &lt;a href=&quot;http://www.stum.de/various-tools/cmdtools/&quot; rel=&quot;nofollow&quot;&gt;cmdnetsvnrev&lt;/a&gt; tool, but if someone knows a better ccnet-integrated way of doing it, i'd be happy to hear :-)&lt;/p&gt;" OwnerUserId="91" LastActivityDate="2008-08-04T11:41:37.133" CommentCount="0" />
<row Id="1168" PostTypeId="2" ParentId="1160" CreationDate="2008-08-04T11:51:59.297" Score="3" Body="&lt;p&gt;I found &lt;a href=&quot;http://code.google.com/p/svnrevisionlabeller&quot; rel=&quot;nofollow&quot;&gt;this&lt;/a&gt; project on google code. This is &lt;code&gt;CCNET&lt;/code&gt; plugin to generate the label in &lt;code&gt;CCNET&lt;/code&gt;.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;The &lt;code&gt;DLL&lt;/code&gt; is tested with &lt;code&gt;CCNET 1.3&lt;/code&gt; but it works with &lt;code&gt;CCNET 1.4&lt;/code&gt; for me. I'm successfully using this plugin to label my build.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Now onto passing it to &lt;code&gt;MSBuild&lt;/code&gt;...&lt;/p&gt;&#xA;" OwnerUserId="120" LastEditorUserId="960778" LastEditorDisplayName="hitec" LastEditDate="2013-04-25T12:49:09.833" LastActivityDate="2013-04-25T12:49:09.833" CommentCount="0" />
<row Id="1169" PostTypeId="2" ParentId="1160" CreationDate="2008-08-04T11:56:42.533" Score="13" Body="&lt;p&gt;You have basically two options. Either you write a simple script that will start and parse output from&lt;/p&gt;&#xA;&#xA;&lt;p&gt;&lt;strong&gt;svn.exe info --revision HEAD&lt;/strong&gt;&lt;/p&gt;&#xA;&#xA;&lt;p&gt;to obtain revision number (then generating AssemblyInfo.cs is pretty much straight forward) or just use plugin for CCNET. Here it is:&lt;/p&gt;&#xA;&#xA;&lt;blockquote&gt;&#xA; &lt;p&gt;&lt;strong&gt;SVN Revision Labeller&lt;/strong&gt; is a plugin for&#xA; CruiseControl.NET that allows you to&#xA; generate CruiseControl labels for your&#xA; builds, based upon the revision number&#xA; of your Subversion working copy. This&#xA; can be customised with a prefix and/or&#xA; major/minor version numbers.&lt;/p&gt;&#xA; &#xA; &lt;p&gt;&lt;a href=&quot;http://code.google.com/p/svnrevisionlabeller/&quot;&gt;http://code.google.com/p/svnrevisionlabeller/&lt;/a&gt;&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&#xA;&lt;p&gt;I prefer the first option because it's only roughly 20 lines of code:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;using System;&#xA;using System.Diagnostics;&#xA;&#xA;namespace SvnRevisionNumberParserSample&#xA;{&#xA; class Program&#xA; {&#xA; static void Main()&#xA; {&#xA; Process p = Process.Start(new ProcessStartInfo()&#xA; {&#xA; FileName = @&quot;C:\Program Files\SlikSvn\bin\svn.exe&quot;, // path to your svn.exe&#xA; UseShellExecute = false,&#xA; RedirectStandardOutput = true,&#xA; Arguments = &quot;info --revision HEAD&quot;,&#xA; WorkingDirectory = @&quot;C:\MyProject&quot; // path to your svn working copy&#xA; });&#xA; // command &quot;svn.exe info --revision HEAD&quot; will produce a few lines of output&#xA; p.WaitForExit();&#xA;&#xA; // our line starts with &quot;Revision: &quot;&#xA; while (!p.StandardOutput.EndOfStream)&#xA; {&#xA; string line = p.StandardOutput.ReadLine();&#xA; if (line.StartsWith(&quot;Revision: &quot;))&#xA; {&#xA; string revision = line.Substring(&quot;Revision: &quot;.Length);&#xA; Console.WriteLine(revision); // show revision number on screen &#xA; break;&#xA; }&#xA; }&#xA; Console.Read();&#xA; }&#xA; }&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;" OwnerUserId="275" LastEditorUserId="275" LastEditorDisplayName="lubos hasko" LastEditDate="2009-02-03T04:20:22.597" LastActivityDate="2009-02-03T04:20:22.597" CommentCount="1" />
<row Id="1171" PostTypeId="1" AcceptedAnswerId="28705" CreationDate="2008-08-04T12:00:57.297" Score="34" ViewCount="13564" Body="&lt;p&gt;I need to be able to manipulate a large (10^7 nodes) graph in python. The data corresponding to each node/edge is minimal, say, a small number of strings. What is the most efficient, in terms of &lt;strong&gt;&lt;em&gt;memory and speed&lt;/em&gt;&lt;/strong&gt;, way of doing this? &lt;/p&gt;&#xA;&#xA;&lt;p&gt;A dict of dicts is more flexible and simpler to implement, but I intuitively expect a list of lists to be faster. The list option would also require that I keep the data separate from the structure, while dicts would allow for something of the sort:&lt;/p&gt;&#xA;&#xA;&lt;pre&gt;&lt;code&gt;graph[I][J][&quot;Property&quot;]=&quot;value&quot;&#xA;&lt;/code&gt;&lt;/pre&gt;&#xA;&#xA;&lt;p&gt;What would you suggest?&lt;/p&gt;&#xA;&#xA;&lt;hr&gt;&#xA;&#xA;&lt;p&gt;Yes, I should have been a bit clearer on what I mean by efficiency. In this particular case I mean it in terms of random access retrieval.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;Loading the data in to memory isn't a huge problem. That's done once and for all. The time consuming part is visiting the nodes so I can extract the information and measure the metrics I'm interested in.&lt;/p&gt;&#xA;&#xA;&lt;p&gt;I hadn't considered making each node a class (properties are the same for all nodes) but it seems like that would add an extra layer of overhead? I was hoping someone would have some direct experience with a similar case that they could share. After all, graphs are one of the most common abstractions in CS.&lt;/p&gt;&#xA;" OwnerUserId="280" LastEditorUserId="983912" LastEditDate="2014-12-15T15:03:02.017" LastActivityDate="2014-12-15T15:03:02.017" Title="What is the most efficient graph data structure in Python?" Tags="&lt;python&gt;&lt;data-structures&gt;&lt;performance&gt;&lt;graph&gt;" AnswerCount="6" CommentCount="0" FavoriteCount="33" />
<row Id="1172" PostTypeId="2" ParentId="1160" CreationDate="2008-08-04T12:03:03.487" Score="3" Body="&lt;p&gt;If you prefer doing it on the &lt;code&gt;MSBuild&lt;/code&gt; side over the &lt;code&gt;CCNet&lt;/code&gt; config, looks like the &lt;code&gt;MSBuild&lt;/code&gt; Community Tasks extension's &lt;a href=&quot;http://msbuildtasks.tigris.org/&quot; rel=&quot;nofollow&quot;&gt;&lt;code&gt;SvnVersion&lt;/code&gt;&lt;/a&gt; task might do the trick.&lt;/p&gt;&#xA;" OwnerUserId="266" LastEditorUserId="960778" LastEditDate="2013-04-25T13:00:54.587" LastActivityDate="2013-04-25T13:00:54.587" CommentCount="0" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment