<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>www.gregd.org</title>
	<atom:link href="http://www.gregd.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gregd.org</link>
	<description>0xE564D14E</description>
	<lastBuildDate>Wed, 25 Jan 2012 02:46:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Bottlenecks, Deer Hunting, and Software</title>
		<link>http://www.gregd.org/2012/01/bottlenecks-deer-hunting-and-software/</link>
		<comments>http://www.gregd.org/2012/01/bottlenecks-deer-hunting-and-software/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 18:23:53 +0000</pubDate>
		<dc:creator>gregd</dc:creator>
				<category><![CDATA[Favorites]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.gregd.org/?p=450</guid>
		<description><![CDATA[I see this a lot at work &#8211; someone puts code in a function. No, that part isn&#8217;t unusual The part that &#8220;bugs&#8221; *pun intended!) me is that the code really belongs in the function that they have overridden (in the case of OO languages), or in the functions that they call (in the case [...]]]></description>
			<content:encoded><![CDATA[<p>I see this a lot at work &#8211; someone puts code in a function. No, that part isn&#8217;t unusual <img src='http://www.gregd.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  The part that &#8220;bugs&#8221; *pun intended!) me is that the code really belongs in the function that they have overridden (in the case of OO languages), or in the functions that they call (in the case of procedural and/or OO languages).</p>
<p>It&#8217;s really a variation on the classic theme &#8211; don&#8217;t repeat your self; write as little code as possible; keep it simple; don&#8217;t make me think.</p>
<p>One of the best ways of accomplishing this is to approach creating software like deer hunting. The best hunters know that there are certain natural funnels  &#8211; places where deer tend to run. These are the best places to put up a tree stand. You wait for the deer to come to you. You don&#8217;t go running around trying to corral the deer. If there&#8217;s a river, you find a place that is narrow and shallow to hunt because it is a natural crossing. Over time you&#8217;ll see every deer in the surrounding area.</p>
<p>This technique also applies to software development. Find one place in the code to solve your problem. You have an additional advantage too &#8211; you can create the bottlenecks &#8211; the places where everyone crosses the river so to speak.</p>
<p>At work we have an OO based framework that all of our web apps use. The people who designed it didn&#8217;t take full advantage of the natural bottlenecks. Rather than adding code to our Page_Load base method to check if the application should redirect the user to a &#8220;sorry, but we&#8217;re down while the batch runs&#8221; page, they put code in EVERY page of EVERY application. Worse, they put a class in every application that is around 500 lines long. I did a diff between two of these classes. Less than 10 lines of difference. What does this mean? It means that 490 lines of code could be moved into a base class and the 10 lines of code could simply be overridden to provide the appropriate configuration values.</p>
<p>In short, the total amount of code in each application to support this feature could have been less than 10 lines of code instead of 500! In our current situation, if a bug is found in the duplicated code it would take us more than 100 hours of effort to update every application and deploy them. If this code had been put in a base class, we&#8217;d just have to update it in one place.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gregd.org/2012/01/bottlenecks-deer-hunting-and-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CPU Scaling and distributed.net</title>
		<link>http://www.gregd.org/2011/06/distributed-net-and-prime95/</link>
		<comments>http://www.gregd.org/2011/06/distributed-net-and-prime95/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 01:33:56 +0000</pubDate>
		<dc:creator>gregd</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Operating Systems]]></category>

		<guid isPermaLink="false">http://www.gregd.org/?p=414</guid>
		<description><![CDATA[Greg&#8217;s tip of the day! I like to run distributed.net on my computers. I want the CPU frequency to stay pinned at the lowest possible frequency while distributed.net is running. I also want my computer to boost it&#8217;s CPU speed if I&#8217;m using it for something else. Using Linux, this is easy to accomplish. First [...]]]></description>
			<content:encoded><![CDATA[<p>Greg&#8217;s tip of the day!</p>
<p>I like to run <a href="http://www.distributed.net">distributed.net</a> on my computers. I want the CPU frequency to stay pinned at the lowest possible frequency while distributed.net is running. I also want my computer to boost it&#8217;s CPU speed if I&#8217;m using it for something else. Using Linux, this is easy to accomplish. First you&#8217;ll want to make sure that distributed.net is running with a low &#8216;nice&#8217; priority level (it does this by default). Secondly, you&#8217;ll want to add this to your /etc/rc.local:</p>
<p><code>echo 1 &gt; /sys/devices/system/cpu/cpufreq/ondemand/ignore_nice_load</code></p>
<p>By doing this, you&#8217;re telling Linux to use the minimum CPU speed possible for programs with a &#8216;nice&#8217; (e.g. low) priority level while giving it permission to boost the CPU speed if necessary for other software running on computer. Lower CPU speeds require less electricity and this leads to cheaper electric bills &#8211; both a good thing <img src='http://www.gregd.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>One final caveat&#8230; after all that work, your computer will probably still use a few more watts than it would if it were completely idle at the lowest clock speed. This is because it is doing work that requires the CPU to use more circuits than it would in a normal idle loop. Caveat aside, you&#8217;ll still be using a lot less power than if your CPU were allowed to run at the top clock speed, and only a small amount more than it would normally idle!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gregd.org/2011/06/distributed-net-and-prime95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving Files Using netcat and tar</title>
		<link>http://www.gregd.org/2011/06/netcat-and-tar-to-the-rescue/</link>
		<comments>http://www.gregd.org/2011/06/netcat-and-tar-to-the-rescue/#comments</comments>
		<pubDate>Sat, 25 Jun 2011 16:42:08 +0000</pubDate>
		<dc:creator>gregd</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Open BSD]]></category>
		<category><![CDATA[Operating Systems]]></category>

		<guid isPermaLink="false">http://www.gregd.org/?p=387</guid>
		<description><![CDATA[Time for an upgrade. I&#8217;ve got this (really old) box running OpenBSD 4.9: real mem = 234561536 (223MB) avail mem = 226095104 (215MB) mainbus0 at root: SUNW,SPARCstation-5 cpu0 at mainbus0: MB86904 @ 85 MHz, on-chip FPU And a new one running Debian that is a lot faster&#8230; CPU0: Intel(R) Pentium(R) M processor 1.60GHz stepping 06 [...]]]></description>
			<content:encoded><![CDATA[<p>Time for an upgrade. I&#8217;ve got this (really old) box running OpenBSD 4.9:<br />
<code>real mem = 234561536 (223MB)<br />
avail mem = 226095104 (215MB)<br />
mainbus0 at root: SUNW,SPARCstation-5<br />
cpu0 at mainbus0: MB86904 @ 85 MHz, on-chip FPU</code></p>
<p>And a new one running Debian that is a lot faster&#8230;<br />
<code><br />
CPU0: Intel(R) Pentium(R) M processor 1.60GHz stepping 06<br />
503MB LOWMEM available.<br />
</code></p>
<p>I need to copy around 100GB of data from the SPARCstation to the new server. The SPARCstation is able to push around 300KB/sec tops unencrypted over the network. Normally I&#8217;d be using rsync over ssh, but in this case, it will actually slow things down. So slow that it would literally take over a week to copy this data! The fastest way I’ve found is to use netcat and tar together. By using this combination I&#8217;m freeing up the CPU on the SPARCstation to do more important things like read data off of the disks and push it over the network!</p>
<p>Notice that I&#8217;m not using compression with tar&#8230; once again, sparky just isn&#8217;t fast enough <img src='http://www.gregd.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><code><br />
#Sender (SPARCStation)<br />
tar cf - * | netcat receiver_host_name_or_ip 7000<br />
</code><br />
<code><br />
#Receiver (new computer)<br />
netcat -l -p 7000 | tar xv<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gregd.org/2011/06/netcat-and-tar-to-the-rescue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mailing Lists and Procmail</title>
		<link>http://www.gregd.org/2011/06/mailing-lists-and-procmail/</link>
		<comments>http://www.gregd.org/2011/06/mailing-lists-and-procmail/#comments</comments>
		<pubDate>Sat, 11 Jun 2011 14:40:13 +0000</pubDate>
		<dc:creator>gregd</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Open BSD]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://www.gregd.org/?p=376</guid>
		<description><![CDATA[I like having procmail sort my mail for me. In the case of mailing lists, the header of choice is the List-ID field. But there&#8217;s a problem&#8230; notice how each example below is slightly different. I want to pull the bold portion of the mailing list and use that as the folder name: List-ID: &#60;linux-kernel.vger.kernel.org&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>I like having procmail sort my mail for me. In the case of mailing lists, the header of choice is the List-ID field. But there&#8217;s a problem&#8230; notice how each example below is <em>slightly</em> different. I want to pull the <strong>bold</strong> portion of the mailing list and use that as the folder name:</p>
<blockquote><p>List-ID: &lt;<strong>linux-kernel</strong>.vger.kernel.org&gt;<br />
List-Id: Learn about the Linux kernel &lt;<strong>kernelnewbies</strong>.kernelnewbies.org&gt;<br />
List-Id: <strong>cocci</strong>.diku.dk</p></blockquote>
<p>To get started, let&#8217;s state in English what we want to find: Dear procmail; please find the word that immediately precedes the first period in a line that begins with &#8220;List-Id:&#8221;</p>
<p>Finding these headers is easy with a regular expression&#8230; IF&#8230; you&#8217;re allowed to use look ahead: ^List-Id:.*?( (?!.*&lt;)|&lt;)([^.]*)</p>
<p>BUT, procmail doesn&#8217;t do look ahead <img src='http://www.gregd.org/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>So let&#8217;s try with procmail&#8217;s regular expressions. Aside from look ahead/behind, there are two other major differences between procmail&#8217;s regular expressions and the rest of the world. First, procmail uses \/ to mark the portion of the expression that will be copied into $MATCH. Secondly, the part of the regular expression to the left of the \/ uses non-greedy matching. So when you write .* procmail treats it like .*? this is the feature that makes matching the three list headers I want to grab quite difficult.</p>
<p>With this in mind:<br />
<strong>Matches the linux-kernel list:</strong><br />
^List-Id: *&lt;\/[^.]*</p>
<p><strong> Matches linux-kernel and kernelnewbies:</strong><br />
^List-Id: .*&lt;\/<strong>[^&lt;]?</strong>[^.]*</p>
<p>Notice the extra [^&lt;]? which tells procmail that we want $MATCH to start after the &lt; character. This is what allows the rule to find kernelnewbies without pulling &lt; into $MATCH. This is necessary because procmail isn&#8217;t being greedy when it matches to the left side of \/.</p>
<p>Now, our remaining problem is the cocci mailing list. This one really makes life difficult. I decided that using a single regular expression just isn&#8217;t possible, so that means we&#8217;ll need two. One to grab the cocci mailing list and one to grab everything else. Here&#8217;s the completed procmail rule (note: I use Maildir and not mbox on my mailserver).</p>
<pre>:0
* ^List-Id: \/[^.]+
{
        #list with &lt;&gt;
        #e.g. List-Id: Learn about the Linux kernel &lt;kernelnewbies.kernelnewbies.org&gt;
        #e.g. List-Id: &lt;linux-kernel.vger.kernel.org&gt;
        :0
        * $MATCH ?? ^.*&lt;\/[^&lt;]+
        .MailingLists.$MATCH/

        #list without &lt;&gt;
        #e.g. List-Id: cocci.diku.dk
        :0
        .MailingLists.$MATCH/
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.gregd.org/2011/06/mailing-lists-and-procmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Youtube problems with DroidWall</title>
		<link>http://www.gregd.org/2011/05/youtube-problems-with-droidwall/</link>
		<comments>http://www.gregd.org/2011/05/youtube-problems-with-droidwall/#comments</comments>
		<pubDate>Tue, 24 May 2011 14:19:39 +0000</pubDate>
		<dc:creator>gregd</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[youtube droidwall]]></category>

		<guid isPermaLink="false">http://www.gregd.org/?p=355</guid>
		<description><![CDATA[Youtube isn&#8217;t working when DroidWall is enabled!? Here&#8217;s how to fix it: First, enable YouTube in DroidWall (yeah, obvious). This lets YouTube do searches and the like. But videos still won&#8217;t play. To get them working, check the boxes next to &#8220;Media server&#8221; in DroidWall&#8217;s list of apps. There, all better]]></description>
			<content:encoded><![CDATA[<p>Youtube isn&#8217;t working when DroidWall is enabled!? Here&#8217;s how to fix it:</p>
<p>First, enable YouTube in DroidWall (yeah, obvious). This lets YouTube do searches and the like. But videos still won&#8217;t play. To get them working, check the boxes next to &#8220;Media server&#8221; in DroidWall&#8217;s list of apps. There, all better <img src='http://www.gregd.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gregd.org/2011/05/youtube-problems-with-droidwall/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cyanogen Mod 7.0.3</title>
		<link>http://www.gregd.org/2011/05/cyanogen-mod-7-0-3/</link>
		<comments>http://www.gregd.org/2011/05/cyanogen-mod-7-0-3/#comments</comments>
		<pubDate>Sat, 21 May 2011 19:15:31 +0000</pubDate>
		<dc:creator>gregd</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://www.gregd.org/?p=309</guid>
		<description><![CDATA[The apps on my phone which has been rooted and is now running Cyanogen Mod v7.0.3!  I&#8217;ve marked the apps in bold that are definitely must haves Next up, how to get dropbear running on the phone Agenda Widget Barcode Scanner Bump Compass Connect Bot Dolphin Browser HD Droidwall Google Maps Google Street View Google [...]]]></description>
			<content:encoded><![CDATA[<p>The apps on my phone which has been rooted and is now running Cyanogen Mod v7.0.3!  I&#8217;ve marked the apps in <strong>bold</strong> that are definitely must haves <img src='http://www.gregd.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Next up, how to get dropbear running on the phone <img src='http://www.gregd.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<ul>
<li><strong>Agenda Widget</strong></li>
<li>Barcode Scanner</li>
<li>Bump</li>
<li>Compass</li>
<li>Connect Bot</li>
<li><strong>Dolphin Browser HD</strong></li>
<li><strong>Droidwall</strong></li>
<li><strong>Google Maps</strong></li>
<li>Google Street View</li>
<li>Google Sky Map</li>
<li><strong>Google Voice</strong></li>
<li><strong>K-9 Mail</strong></li>
<li>Listen</li>
<li>Netflix</li>
<li>Pandora</li>
<li>Ringdroid</li>
<li>Skype</li>
<li><strong>Swype</strong></li>
<li><strong>Voice Caller ID</strong></li>
<li><strong>The Weather Channel</strong></li>
<li><strong>Youtube</strong></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.gregd.org/2011/05/cyanogen-mod-7-0-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenBSD Package Path</title>
		<link>http://www.gregd.org/2011/05/openbsd-package-path/</link>
		<comments>http://www.gregd.org/2011/05/openbsd-package-path/#comments</comments>
		<pubDate>Sat, 14 May 2011 04:32:30 +0000</pubDate>
		<dc:creator>gregd</dc:creator>
				<category><![CDATA[Open BSD]]></category>
		<category><![CDATA[Operating Systems]]></category>

		<guid isPermaLink="false">http://www.gregd.org/?p=339</guid>
		<description><![CDATA[Add this to your ~/.profile (or something a lot like it) export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/`uname -r`/packages/sparc/ It makes upgrading and installing packages a breeze &#8211; once you log in, the package path is setup automatically based on the release you&#8217;re running. The next time you use pkg_add, there&#8217;ll be no thinking involved and that&#8217;s a good thing!]]></description>
			<content:encoded><![CDATA[<p>Add this to your ~/.profile (or something a lot like it)<br />
<code>export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/`uname -r`/packages/sparc/</code></p>
<p>It makes upgrading and installing packages a breeze &#8211; once you log in, the package path is setup automatically based on the release you&#8217;re running. The next time you use pkg_add, there&#8217;ll be no thinking involved and that&#8217;s a good thing!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gregd.org/2011/05/openbsd-package-path/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Virtual Box</title>
		<link>http://www.gregd.org/2011/05/virtual-box/</link>
		<comments>http://www.gregd.org/2011/05/virtual-box/#comments</comments>
		<pubDate>Thu, 12 May 2011 04:19:15 +0000</pubDate>
		<dc:creator>gregd</dc:creator>
				<category><![CDATA[Operating Systems]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.gregd.org/?p=3</guid>
		<description><![CDATA[I&#8217;ve been trying Virtual Box (currently 4.0.6) out for the past few weeks on Windows 7 x64. I&#8217;ve got to say it&#8217;s scary to use. Especially after I got some emails from the daily/weekly anacron runs last night which simply state &#8220;Segmentation fault&#8221; from a test VM that I setup and left running. Ouch! I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been trying <a title="Virtual Box" href="http://www.virtualbox.org/" target="_blank">Virtual Box</a> (currently 4.0.6) out for the past few weeks on Windows 7 x64. I&#8217;ve got to say it&#8217;s scary to use. Especially after I got some emails from the daily/weekly anacron runs last night which simply state &#8220;<em>Segmentation fault</em>&#8221; from a test VM that I setup and left running. Ouch! I&#8217;ve also observed other random virtual disk corruption&#8230;</p>
<p>The only problem here is that the killer feature that no one else &#8220;supports&#8221; is the raw disk access. I want to use this for my primary file server. Can I trust Virtual Box? Maybe&#8230; the file server is running <a title="Nexenta" href="http://www.nexenta.org/" target="_blank">Nexenta</a> with ZFS  over two 1TB disks in a Raid 1 configuration&#8230; or I could leave it on real hardware where it has a real chance of working without any problems <img src='http://www.gregd.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gregd.org/2011/05/virtual-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>kexec-tools</title>
		<link>http://www.gregd.org/2011/04/kexec-tools/</link>
		<comments>http://www.gregd.org/2011/04/kexec-tools/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 04:35:54 +0000</pubDate>
		<dc:creator>gregd</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Operating Systems]]></category>

		<guid isPermaLink="false">http://www.gregd.org/wpblog/?p=274</guid>
		<description><![CDATA[This has been around for awhile, but I only recently learned of it. If you&#8217;re running linux (and only linux on your computer) then you might want to try installing kexec-tools (Debian/Ubuntu). After you do this, your computer will be able to reboot without going through the BIOS POST tests. On my computer this speeds [...]]]></description>
			<content:encoded><![CDATA[<p>This has been around for awhile, but I only recently learned of it. If you&#8217;re running linux (and only linux on your computer) then you might want to try installing kexec-tools (Debian/Ubuntu).</p>
<p>After you do this, your computer will be able to reboot without going through the BIOS POST tests. On my computer this speeds up the boot time by around 12 seconds!</p>
<p>Very nice!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gregd.org/2011/04/kexec-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Sum of All Sums</title>
		<link>http://www.gregd.org/2010/10/the-sum-of-all-sums/</link>
		<comments>http://www.gregd.org/2010/10/the-sum-of-all-sums/#comments</comments>
		<pubDate>Mon, 04 Oct 2010 16:07:43 +0000</pubDate>
		<dc:creator>gregd</dc:creator>
				<category><![CDATA[Favorites]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[BadCode]]></category>

		<guid isPermaLink="false">http://gregd.org/wpblog/?p=3</guid>
		<description><![CDATA[Several years ago, we had a foreign contractor write some code for one of our applications. One piece involved create some javascript to sum numbers on a dynamically generated page. About a year ago, I rewrote it &#8211; you see he had coded 4 functions; Sum1, Sum2, Sum3, and Sum4. Sum1, Sum2, and Sum3 were [...]]]></description>
			<content:encoded><![CDATA[<p>Several years ago, we had a foreign contractor write some code for one of our applications. One piece involved create some javascript to sum numbers on a dynamically generated page.</p>
<p>About a year ago, I rewrote it &#8211; you see he had coded 4 functions; Sum1, Sum2, Sum3, and Sum4. Sum1, Sum2, and Sum3 were identical except that different bugs had been fixed in each piece of code over time by other developers, so they didn&#8217;t &#8220;look&#8221; identical at first blush. That was confusing. Not to mention it was a little intimidating and scary to fix up each function so that all of the bugs were corrected in a way that didn&#8217;t modify the behavior of the framework that depended on these functions. Who knows, maybe someone coded in a way that made Sum3 work correctly for them&#8230;</p>
<p>The real surprise though, was Sum4. It presented a completely different problem. One might have assumed that it was simply a fourth sum. Imagine my surprise when I realized that it was not a fourth sum at all! It was in fact, the sum of all sums (Sum1 &#8211; Sum3)! A grand total. Even worse, it didn&#8217;t use Sum1, Sum2, or Sum3 to do this. Instead, it was simply a (very poor) copy of the code original code for Sum1, Sum2, and Sum3! Of course, completely different bugs had been fixed inside this function when compared to the current versions of Sum1, Sum2, and Sum3. Woah.</p>
<p>Long story short I ended up rewriting the code. We now have a single Sum(x) function that can do the work of sum1, sum2, sum3, etc&#8230; and we have a TotalOfAllSums() function that is aware of the number of summations we have on a webpage, and it simply calls sum(x) to determine the total. Simple, and, now we can implement a fourth Sum in the future without having to resort to naming it &#8220;Sum5&#8243; and copying and pasting say&#8230; Sum3 to get us started.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gregd.org/2010/10/the-sum-of-all-sums/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

