<?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>cat brain.log &#124; less</title>
	<atom:link href="http://log.largevoid.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://log.largevoid.com</link>
	<description>Getting it down on `paper`</description>
	<lastBuildDate>Tue, 24 Aug 2010 00:16:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Linux Mail Forwarding</title>
		<link>http://log.largevoid.com/2010/08/linux-mail-forwarding/</link>
		<comments>http://log.largevoid.com/2010/08/linux-mail-forwarding/#comments</comments>
		<pubDate>Mon, 23 Aug 2010 21:05:59 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[foward]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[sendmail]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=429</guid>
		<description><![CDATA[If you want to forward mail on a linux machine that you happen to have an account on, follow these simple steps.

touch ~/.forward
chmod 644 ~/.forward
vi ~/.forward

Contents of ~/.forward should be a comma or newline separated list of email addresses to forward mail to.  The following are correctly formatted: .forward files and a brief description of [...]]]></description>
			<content:encoded><![CDATA[<p>If you want to forward mail on a linux machine that you happen to have an account on, follow these simple steps.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">touch</span> ~<span style="color: #000000; font-weight: bold;">/</span>.forward
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">644</span> ~<span style="color: #000000; font-weight: bold;">/</span>.forward
<span style="color: #c20cb9; font-weight: bold;">vi</span> ~<span style="color: #000000; font-weight: bold;">/</span>.forward</pre></div></div>

<p>Contents of <code>~/.forward</code> should be a comma or newline separated list of email addresses to forward mail to.  The following are correctly formatted: <code>.forward</code> files and a brief description of each.</p>
<p>Forward all local email to <code>email@example.com</code>:</p>
<pre>email@example.com</pre>
<p>Forward all local email to both <code>email@example.com</code> and <code>alternate@domain.com</code>:</p>
<pre>email@example.com, alternate@domain.com</pre>
<p>Use the local mail spool, keep a copy in the user&#8217;s <code>~/archive/mail</code> file, <em>and</em> forward a copy to <code>email@example.com</code>:</p>
<pre>\user, "/home/user/archive/mail", email@example.com</pre>
<p>The <strong>permissions</strong> of the <code>.forward</code> file must be read-only for group and other.  Failure to secure your <code>.forward</code> file will cause sendmail to ignore its existence.</p>
<p>GOTCHA!</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/08/linux-mail-forwarding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>When a Domain is Blocked by Filtering Software</title>
		<link>http://log.largevoid.com/2010/08/when-a-domain-is-blocked-by-filter-software/</link>
		<comments>http://log.largevoid.com/2010/08/when-a-domain-is-blocked-by-filter-software/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 01:17:04 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[Scripts, Tricks and Hacks]]></category>
		<category><![CDATA[blocked]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[cmd.exe]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[domain]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[google dns]]></category>
		<category><![CDATA[internet]]></category>
		<category><![CDATA[windows 7]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=425</guid>
		<description><![CDATA[Can&#8217;t access your favorite websites because some stupid ISP or access point is using DNS-level filtering?
Set your DNS to use Google&#8217;s DNS:
8.8.8.8 and 8.8.4.4
Then flush the existing DNS cache and register the new DNS.
In Windows 7, you&#8217;ll need elevated privileges to changes to the DNS. Make sure you start cmd.exe as Administrator.

Press the window Key
Type [...]]]></description>
			<content:encoded><![CDATA[<p>Can&#8217;t access your favorite websites because some stupid ISP or access point is using DNS-level filtering?</p>
<p>Set your DNS to use Google&#8217;s DNS:<br />
<code>8.8.8.8</code> and <code>8.8.4.4</code></p>
<p>Then flush the existing DNS cache and register the new DNS.</p>
<p>In Windows 7, you&#8217;ll need elevated privileges to changes to the DNS. Make sure you start cmd.exe as Administrator.</p>
<ol>
<li>Press the window Key</li>
<li>Type &#8220;cmd&#8221;</li>
<li>Right click the cmd.exe that&#8217;s found.</li>
<li>Select &#8220;Run as administrator&#8221;</li>
<li>Type <code>ipconfig /flushdns</code></li>
<li>Then type <code>ipconfig /registerdns</code></li>
</ol>
<p>Now you&#8217;re free to roam the internet.</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/08/when-a-domain-is-blocked-by-filter-software/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>On Credit Worthiness and Dependability</title>
		<link>http://log.largevoid.com/2010/08/on-credit-worthiness-and-dependability/</link>
		<comments>http://log.largevoid.com/2010/08/on-credit-worthiness-and-dependability/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 01:41:39 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Quotes]]></category>
		<category><![CDATA[credit]]></category>
		<category><![CDATA[quote]]></category>
		<category><![CDATA[trust]]></category>
		<category><![CDATA[worth]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/2010/08/on-credit-worthiness-and-dependability/</guid>
		<description><![CDATA[Every banker knows that if he has to prove that he is worthy of credit, however good may be his arguments, in fact his credit is gone Walter Bagehot
]]></description>
			<content:encoded><![CDATA[<p><q>Every banker knows that if he has to prove that he is worthy of credit, however good may be his arguments, in fact his credit is gone</q> <cite>Walter Bagehot</cite></p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/08/on-credit-worthiness-and-dependability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Big MySQL Table? Watch the keyfile Length</title>
		<link>http://log.largevoid.com/2010/08/big-mysql-table-watch-the-keyfile-length/</link>
		<comments>http://log.largevoid.com/2010/08/big-mysql-table-watch-the-keyfile-length/#comments</comments>
		<pubDate>Tue, 03 Aug 2010 02:07:17 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[CHECK TABLE]]></category>
		<category><![CDATA[index]]></category>
		<category><![CDATA[MAX_ROWS]]></category>
		<category><![CDATA[myisamchk]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[REPAIR TABLE]]></category>
		<category><![CDATA[USE_FRM]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=417</guid>
		<description><![CDATA[I made some large tables (around 3-4 billion records each) and then tried to create indexes on one column in each of them. I found that MySQL stopped at a seemingly arbitrary maximum index file size (.MYI file) for both of them. When I tried to open either table, I received an error message &#8220;ERROR [...]]]></description>
			<content:encoded><![CDATA[<p>I made some large tables (around 3-4 billion records each) and then tried to create indexes on one column in each of them. I found that MySQL stopped at a seemingly arbitrary maximum index file size (.MYI file) for both of them. When I tried to open either table, I received an error message &#8220;ERROR 1016 (HY000): Can&#8217;t open file: &#8216;mytable.MYI&#8217; (errno: 144)&#8221; indicating that the index file was crashed.</p>
<p><code>CHECK TABLE mytable QUICK</code> reported &#8216;warning : Keyfile is almost full, 17179867136 of 17179867136 used&#8217; Then <code>myisamchk -dv mytable</code> reported similar information under &#8216;Max keyfile length,&#8221; and reported &#8220;Keyfile pointer (bytes): 3&#8242;</p>
<p>After a little digging around, I realized that a 3-byte keyfile pointer only allows the index file to hold 2^24 blocks (about 16 million blocks of 1024 bytes each). My index file was holding about 110 keys per block (e.g., each record needed 4 bytes for the key value, plus 4 bytes for the datafile pointer, and maybe one byte for null/housekeeping, and then each block kept a little more empty space). So the 3-byte keyfile pointer only allowed MySQL to index about 1.8 billion records. Then it gave up, leaving a corrupted index file.</p>
<p>I have found no documentation for how MySQL decides how big a keyfile pointer to use in the .MYI file. I had no trouble adding 3-4 billion records to the MYD file, so it didn&#8217;t occur to me that there would be a problem with the MAX_ROWS clause of the CREATE TABLE command (which I hadn&#8217;t specified). But that turned out to be the problem.</p>
<p>I recovered my data table without the index file, then issued <code>ALTER TABLE <mytable> MAX_ROWS=4000000000, ADD INDEX (mykey);</code> and now it looks like everything will be OK.</p>
<p>Here&#8217;s how I got my table back, without the index file (similar to what&#8217;s described above):</p>
<ol>
<li>make a backup of the data file (mytable.myd), just in case</li>
<li>create a new empty table with the same structure as the existing table, but no index keys.</li>
<li>copy the .FRM and .MYI files from the new (empty) table over the existing mytable.frm and mytable.myi files.</li>
<li>issue <code>REPAIR TABLE mytable USE_FRM;</code> It is very important to include the USE_FRM clause. That way, MySQL knows to make a new (empty) .MYI file that matches the .MYD file, rather than truncating the .MYD file to match the .MYI file. You will eventually get a message along the lines of &#8220;Number of rows changed from 0 to xxxx&#8221;.</li>
<li>Now you have a working table, with no indexes. Then you can set MAX_ROWS to something appropriate, and try again to make the indexes.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/08/big-mysql-table-watch-the-keyfile-length/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Files Ending in .php.html Unexpectedly Being Processed by the PHP Engine</title>
		<link>http://log.largevoid.com/2010/07/files-ending-in-php-html-unexpectedly-being-processed-by-the-php-engine/</link>
		<comments>http://log.largevoid.com/2010/07/files-ending-in-php-html-unexpectedly-being-processed-by-the-php-engine/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 18:14:29 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[httpd.conf]]></category>
		<category><![CDATA[mod_php]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php.conf]]></category>
		<category><![CDATA[phpDocumentor]]></category>
		<category><![CDATA[syntax error]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=413</guid>
		<description><![CDATA[Apache/2.2.3 (Red Hat), PHP 5.1.6 and phpDocumentor v1.4.3  weren&#8217;t getting along.  phpDocumentor was generating HTML with filenames of the form script.php.html. Apache&#8217;s mod_php wanted to interpret script.php.html as a PHP script and was throwing errors about improper formatting:
PHP Parse error:  syntax error, unexpected T_STRING in /var/www/default/docs/out/lib/lib/_php---obj---FFT.php.html on line 1, referer:...
I wanted script.php.html [...]]]></description>
			<content:encoded><![CDATA[<p>Apache/2.2.3 (Red Hat), PHP 5.1.6 and phpDocumentor v1.4.3  weren&#8217;t getting along.  phpDocumentor was generating HTML with filenames of the form <em>script.php.html</em>. Apache&#8217;s mod_php wanted to interpret script.php.html as a PHP script and was throwing errors about improper formatting:</p>
<p><code>PHP Parse error:  syntax error, unexpected T_STRING in /var/www/default/docs/out/lib/lib/_php---obj---FFT.php.html on line 1, referer:...</code></p>
<p>I wanted script<em>.php.html</em> to be treated as an HTML file and not be processed by the php engine.  This double-extension was causing me grief.  The docs claimed that only files <strong>ending </strong>in the extension will be handled by the AddHandler command.  I was incredulous of this claim, especially in light of Apache&#8217;s ability to do content negotiation with those <em>.var </em>language files.</p>
<p>Q: Why was this happening?  I first guessed it may have been due to mod_mime, but quickly ruled that out.   I then guessed it was the MultiView option&#8230; Maybe, this is one mechanism that governs content negotiation&#8230; The documentation claims:</p>
<pre># The index.html.var file (a type-map) is used to deliver content-
# negotiated documents.  The MultiViews Option can be used for the
# same purpose, but it is much slower.</pre>
<p>This statement lead me to suspect that my problem may actually be caused by an issue with the <em>AddHandler</em> option, since an AddHandler command must be executed to associate <code>type-map</code> with that <code>.var</code> extension.</p>
<p>Ah me, time is money, and in the end, I actually didn&#8217;t diagnose the problem, but I did discover (by trial and error) a <strong>workaround</strong>.</p>
<p>In file <em>/etc/httpd/conf.d/php.conf</em>, I surrounded</p>
<pre>AddHandler php5-script .php
AddType text/html .php
</pre>
<p>with</p>
<pre>&lt;Files ~ "\.php$"&gt;
  AddHandler php5-script .php
  AddType text/html .php
&lt;/Files&gt;</pre>
<p>Now, only files explicitly ending in &#8220;.php&#8221; will be treated as a php5-script.  Take that!</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/07/files-ending-in-php-html-unexpectedly-being-processed-by-the-php-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fast Hash Function for Strings</title>
		<link>http://log.largevoid.com/2010/07/fast-hash-function-for-strings/</link>
		<comments>http://log.largevoid.com/2010/07/fast-hash-function-for-strings/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 03:20:05 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[double-hashing]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[hash]]></category>
		<category><![CDATA[hash function]]></category>
		<category><![CDATA[hash table]]></category>
		<category><![CDATA[int]]></category>
		<category><![CDATA[key]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=410</guid>
		<description><![CDATA[Pre-condition: str is null terminated.

int hash&#40;const void * str&#41; &#123;
  int val = 0;
  const char *ptr;
  int tmp;
&#160;
  while &#40;*ptr != '\0'&#41; &#123;
    val = &#40;val &#60;&#60; 4&#41; + &#40;*ptr&#41;;
    if &#40;tmp = &#40;val &#38; 0xf0000000&#41;&#41; &#123;
      val = [...]]]></description>
			<content:encoded><![CDATA[<p>Pre-condition: str is null terminated.</p>

<div class="wp_syntax"><div class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">int</span> hash<span style="color: #009900;">&#40;</span><span style="color: #993333;">const</span> <span style="color: #993333;">void</span> <span style="color: #339933;">*</span> str<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #993333;">int</span> val <span style="color: #339933;">=</span> <span style="color: #0000dd;">0</span><span style="color: #339933;">;</span>
  <span style="color: #993333;">const</span> <span style="color: #993333;">char</span> <span style="color: #339933;">*</span>ptr<span style="color: #339933;">;</span>
  <span style="color: #993333;">int</span> tmp<span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>ptr <span style="color: #339933;">!=</span> <span style="color: #ff0000;">'<span style="color: #006699; font-weight: bold;">\0</span>'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    val <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>val <span style="color: #339933;">&lt;&lt;</span> <span style="color: #0000dd;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">*</span>ptr<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>tmp <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>val <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0xf0000000</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      val <span style="color: #339933;">=</span> val <span style="color: #339933;">^</span> <span style="color: #009900;">&#40;</span>tmp <span style="color: #339933;">&gt;&gt;</span> <span style="color: #0000dd;">24</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      val <span style="color: #339933;">=</span> val <span style="color: #339933;">^</span> tmp<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  ptr<span style="color: #339933;">++;</span>
  <span style="color: #b1b100;">return</span> val<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Or in PHP:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> <span style="color: #990000;">hash</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
  <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$val</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$n</span><span style="color: #339933;">=</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$n</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$val</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$val</span><span style="color: #339933;">&lt;&lt;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #990000;">ord</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$str</span><span style="color: #009900;">&#123;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$tmp</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$val</span> <span style="color: #339933;">&amp;</span> <span style="color: #208080;">0xf0000000</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
      <span style="color: #000088;">$val</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$val</span> ^ <span style="color: #009900;">&#40;</span><span style="color: #000088;">$tmp</span><span style="color: #339933;">&gt;&gt;</span><span style="color: #cc66cc;">24</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$val</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$val</span> ^ <span style="color: #000088;">$tmp</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$val</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now all you have to do is mod the returned value by the size of the hash table and you have the target address for the first pass of a hash table with double-hashing.</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/07/fast-hash-function-for-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Log Math, Compound Interest, and the Geometric Series</title>
		<link>http://log.largevoid.com/2010/06/log-math-compound-interest-geometic-series/</link>
		<comments>http://log.largevoid.com/2010/06/log-math-compound-interest-geometic-series/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 20:26:38 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[apr]]></category>
		<category><![CDATA[compound]]></category>
		<category><![CDATA[geometic series]]></category>
		<category><![CDATA[interest]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[pow]]></category>
		<category><![CDATA[rate of return]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=396</guid>
		<description><![CDATA[Compute the value of a $1000 deposit after 10 years, earning 1.5% APR, compounded monthly.
Naive:

function interest&#40;$initial=1000,$apr=0.015,$years=10&#41; &#123;
  $rate = $apr/12;
  $periods = 12*$years;
  $sum = $initial;
  for&#40;$i=0; $i&#60;$periods;$i++&#41; &#123;
    $sum = $sum + $sum * $rate;
  &#125;
  return $sum;
&#125;

Log style:

function interest&#40;$initial=1000,$apr=0.015,$years=10&#41; &#123;
  $rate = $apr/12;
 [...]]]></description>
			<content:encoded><![CDATA[<p>Compute the value of a $1000 deposit after 10 years, earning 1.5% APR, compounded monthly.</p>
<p>Naive:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> interest<span style="color: #009900;">&#40;</span><span style="color: #000088;">$initial</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">,</span><span style="color: #000088;">$apr</span><span style="color: #339933;">=</span><span style="color:#800080;">0.015</span><span style="color: #339933;">,</span><span style="color: #000088;">$years</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$rate</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$apr</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">12</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$periods</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">*</span><span style="color: #000088;">$years</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$sum</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$initial</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$periods</span><span style="color: #339933;">;</span><span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$sum</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$sum</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$sum</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$rate</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$sum</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Log style:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> interest<span style="color: #009900;">&#40;</span><span style="color: #000088;">$initial</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">,</span><span style="color: #000088;">$apr</span><span style="color: #339933;">=</span><span style="color:#800080;">0.015</span><span style="color: #339933;">,</span><span style="color: #000088;">$years</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$rate</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$apr</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">12</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$periods</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">*</span><span style="color: #000088;">$years</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$initial</span> <span style="color: #339933;">*</span> <span style="color: #990000;">pow</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$rate</span><span style="color: #339933;">,</span> <span style="color: #000088;">$periods</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Watch the boundary conditions.  The above assumes the compounding occurs 12 times.  Note that this log approach would not be appropriate if we were to add money to the fund after the compounding began.  If the amount added per compounding period were consistent, we could devise a new log scheme.</p>
<p>Naive with additions:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> interest<span style="color: #009900;">&#40;</span><span style="color: #000088;">$initial</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">,</span><span style="color: #000088;">$addition</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">100</span><span style="color: #339933;">,</span><span style="color: #000088;">$apr</span><span style="color: #339933;">=</span><span style="color:#800080;">0.015</span><span style="color: #339933;">,</span><span style="color: #000088;">$years</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$rate</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$apr</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">12</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$periods</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">12</span><span style="color: #339933;">*</span><span style="color: #000088;">$years</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$sum</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$initial</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$periods</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
    <span style="color: #666666; font-style: italic;">// Add interest earned in previous term.</span>
    <span style="color: #666666; font-style: italic;">// Add $addition in preparation for next compounding period.</span>
    <span style="color: #000088;">$sum</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$sum</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$sum</span><span style="color: #339933;">*</span><span style="color: #000088;">$rate</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$addition</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #666666; font-style: italic;">// Remove last $addition because there is no addition at the end-of-term.</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$sum</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$addition</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Log (via Geometric Series) with additions:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Compute the balance on an account after some period of time.
 * The account may receive an initial deposit and/or regular deposits
 * at the start of every compounding period, after the first.
 * The APR, duration, and number of compounding periods may be specified.
 *
 * @see http://en.wikipedia.org/wiki/Geometric_series
 * @param float $inital Initial deposit amount
 * @param float $addition Amount added at start of each compounding period
 * @param float $apr Annual percentage rate (percent/100) earned on balance
 * @param float $years Number of years ($years&gt;0) to compute interest for.
 * @param uint $ppyr Number of compounding periods per year.
 * @return float Balance after $years time accruing interest at $apr rate.
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> interest<span style="color: #009900;">&#40;</span><span style="color: #000088;">$initial</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">,</span><span style="color: #000088;">$addition</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">100</span><span style="color: #339933;">,</span><span style="color: #000088;">$apr</span><span style="color: #339933;">=</span><span style="color:#800080;">0.015</span><span style="color: #339933;">,</span><span style="color: #000088;">$years</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span><span style="color: #000088;">$ppyr</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">12</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #666666; font-style: italic;">// Use geometric series to calculate the cumulative rate of return</span>
  <span style="color: #666666; font-style: italic;">// with recurring, inter-period deposits (periods 0..N-1)</span>
  <span style="color: #666666; font-style: italic;">// $initial is initial deposit, interest accrues immediately.</span>
  <span style="color: #666666; font-style: italic;">// $rate is interest earned per period (percent/100).</span>
  <span style="color: #666666; font-style: italic;">// $addition is amount added at beginning of period after first period.</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Over time, interest accrues on the additional deposits:</span>
  <span style="color: #666666; font-style: italic;">// let R = (1 + rate)</span>
  <span style="color: #666666; font-style: italic;">// v0 = 0  -- we'll deal with the initial deposit elsewhere.</span>
  <span style="color: #666666; font-style: italic;">// v1 = v0 * R + additional</span>
  <span style="color: #666666; font-style: italic;">// v2 = (v1) * R + additional</span>
  <span style="color: #666666; font-style: italic;">// v2 = (v0 * R + add) * R + add</span>
  <span style="color: #666666; font-style: italic;">// v2 = 0 + add*R + add</span>
  <span style="color: #666666; font-style: italic;">// v2 = add*R + add</span>
  <span style="color: #666666; font-style: italic;">// v3 = v2 * R + add</span>
  <span style="color: #666666; font-style: italic;">// v3 = (add*R + add)*R + add</span>
  <span style="color: #666666; font-style: italic;">// v3 = add(R^2 + R + 1)</span>
  <span style="color: #666666; font-style: italic;">// v4 = v3 * R + add</span>
  <span style="color: #666666; font-style: italic;">// v4 = (add*R*R + add*R + add)*R + add</span>
  <span style="color: #666666; font-style: italic;">// v4 = add(R^3+R^2+R^1+R^0)</span>
  <span style="color: #666666; font-style: italic;">// v5 = v4 * R + add</span>
  <span style="color: #666666; font-style: italic;">// v5 = (v3 * R + add) * R + add</span>
  <span style="color: #666666; font-style: italic;">// v5 = ((v2 * R + add) * R + add) * R + add</span>
  <span style="color: #666666; font-style: italic;">// v5 = (((v1 * R + add) * R + add) * R + add) * R + add</span>
  <span style="color: #666666; font-style: italic;">// v5 = ((((v0 * R + add) * R + add) * R + add) * R + add) * R + add</span>
  <span style="color: #666666; font-style: italic;">// v5 = add * (R^4 + R^3 + R^2 + R^1 + R^0)</span>
  <span style="color: #666666; font-style: italic;">// ... using geometric series ... a = add, r = (1+rate)</span>
  <span style="color: #666666; font-style: italic;">// vN = a * (1 - pow(r,N)) / (1-r)</span>
&nbsp;
  <span style="color: #000088;">$rate</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$apr</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$ppyr</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$periods</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$years</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$ppyr</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Geometric series:</span>
  <span style="color: #666666; font-style: italic;">// a + ar + ar^2 + ar^3 + ... + ar^n </span>
  <span style="color: #666666; font-style: italic;">//   = sum(k=0..n)[ar^k]</span>
  <span style="color: #666666; font-style: italic;">//   = a * (1-r^(n+1)) / (1-r)</span>
  <span style="color: #666666; font-style: italic;">// Where:</span>
  <span style="color: #666666; font-style: italic;">//   a = $addition</span>
  <span style="color: #666666; font-style: italic;">//   r = 1 + $rate</span>
  <span style="color: #666666; font-style: italic;">//   n = $periods - 1</span>
  <span style="color: #666666; font-style: italic;">//   k = [0..n]</span>
  <span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$addition</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$r</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$rate</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">// Compute series from first period to last period</span>
  <span style="color: #000088;">$geom</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$a</span> <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">-</span> <span style="color: #990000;">pow</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$r</span><span style="color: #339933;">,</span><span style="color: #000088;">$periods</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">-</span><span style="color: #000088;">$r</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #666666; font-style: italic;">// Remove $add from last period because next period didn't begin yet.</span>
  <span style="color: #000088;">$additional</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$geom</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$addition</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Compute interest on initial deposit + additional interest from above.</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$initial</span> <span style="color: #339933;">*</span> <span style="color: #990000;">pow</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">+</span><span style="color: #000088;">$rate</span><span style="color: #339933;">,</span><span style="color: #000088;">$periods</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$additional</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Same as above, but without all those comments:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> interest<span style="color: #009900;">&#40;</span><span style="color: #000088;">$initial</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">,</span><span style="color: #000088;">$addition</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">100</span><span style="color: #339933;">,</span><span style="color: #000088;">$apr</span><span style="color: #339933;">=</span><span style="color:#800080;">0.015</span><span style="color: #339933;">,</span><span style="color: #000088;">$years</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span><span style="color: #000088;">$ppyr</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">12</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$R</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$apr</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$ppyr</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$pow</span> <span style="color: #339933;">=</span> <span style="color: #990000;">pow</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$R</span><span style="color: #339933;">,</span> <span style="color: #000088;">$years</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$ppyr</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$initial</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$pow</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$addition</span> <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$pow</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">/</span> <span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">-</span><span style="color: #000088;">$R</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$addition</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/06/log-math-compound-interest-geometic-series/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yellow Light Database</title>
		<link>http://log.largevoid.com/2010/06/yellow-light-database/</link>
		<comments>http://log.largevoid.com/2010/06/yellow-light-database/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 23:12:39 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Thought Fragments]]></category>
		<category><![CDATA[computer vision]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[opencv]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[stop lights]]></category>
		<category><![CDATA[stopping distance]]></category>
		<category><![CDATA[traction]]></category>
		<category><![CDATA[traffic]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=379</guid>
		<description><![CDATA[Here&#8217;s an idea for an Android/iPhone App, or some other in-dash car after-market add-on.
There is a camera attached to your car facing forward.  It has computer vision to detect stop-lights.  There is a GPS device on-board to geo-tag these stop-lights.  Associated with the stop-light location is its yellow-light duration.  Ideally, whenever [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an idea for an Android/iPhone App, or some other in-dash car after-market add-on.</p>
<p>There is a camera attached to your car facing forward.  It has computer vision to detect stop-lights.  There is a GPS device on-board to geo-tag these stop-lights.  Associated with the stop-light location is its yellow-light duration.  Ideally, whenever possible, the app would synchronize with other apps, sharing location and duration information as well.  Using this information and GPS data, an app would be able to calculate how long it will take the driver to reach the light.  If the light turns yellow, the driver will know whether he/she must stop or may continue through the yellow without running a red light.</p>
<p>An added feature would be a local database of start/stop acceleration data.  This data could be used to calculate how must faster or slower the driver would/could travel to still make the light before it turns red.</p>
<p>Finally, a moisture sensor would need to be present, or other traction-like sensor, to determine road conditions and stopping distance.  Correlation between historic acceleration data and moisture could be used to statistically compute stopping distance.</p>
<p>Future modifications might include a car detection system indicating how much space is needed between cars to stop in the event of a sudden incident.</p>
<p>Synchronization of traffic speed data is also achievable using this same architecture, thereby providing an alternative to in-ground traffic sensors.</p>
<p>Disclaimer: I know of at least one company using cell phone GPS data to measure traffic speed.</p>
<p><strong>Edit: </strong><a href="http://www.waze.com/homepage/">Waze &#8211; Real-time maps and traffic information based on the wisdom of the crowd</a><br />
<strong>Edit: </strong><a href="http://www.inrix.com/">INRIX</a></p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/06/yellow-light-database/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get the Directory Path of a Bash Script</title>
		<link>http://log.largevoid.com/2010/06/directory-path-of-bash-scrip/</link>
		<comments>http://log.largevoid.com/2010/06/directory-path-of-bash-scrip/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 23:42:27 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Scripts, Tricks and Hacks]]></category>
		<category><![CDATA[$0]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cwd]]></category>
		<category><![CDATA[directory]]></category>
		<category><![CDATA[dirname]]></category>
		<category><![CDATA[path]]></category>
		<category><![CDATA[pwd]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=375</guid>
		<description><![CDATA[So you have a bash script and you want to run it from crontab or some other context where the current working directory isn&#8217;t known.  Your script wants to use relative path information (from the script itself), perhaps to create a directory structure in the script&#8217;s base directory.
The question is: How do you get [...]]]></description>
			<content:encoded><![CDATA[<p>So you have a bash script and you want to run it from crontab or some other context where the current working directory isn&#8217;t known.  Your script wants to use relative path information (from the script itself), perhaps to create a directory structure in the script&#8217;s base directory.</p>
<p>The question is: How do you get the directory path of the script?  dirname?  Not reliably.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">ABSPATH</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$(cd &quot;${0%/*}&quot; 2&gt;/dev/null; echo &quot;$PWD&quot;/&quot;${0##*/}&quot;)</span>&quot;</span>
<span style="color: #007800;">CWD</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ABSPATH</span>&quot;</span><span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

<p>Nice!</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/06/directory-path-of-bash-scrip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MySQL config and iptables</title>
		<link>http://log.largevoid.com/2010/06/mysql-config-and-iptables/</link>
		<comments>http://log.largevoid.com/2010/06/mysql-config-and-iptables/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 23:00:19 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=348</guid>
		<description><![CDATA[This post is for reference.  
Of note, there is a good example of using iptables, and a description of how to bind your local mysql client to a remote mysql server.
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html
]]></description>
			<content:encoded><![CDATA[<p>This post is for reference.  </p>
<p>Of note, there is a good example of using iptables, and a description of how to bind your local mysql client to a remote mysql server.</p>
<p>http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/06/mysql-config-and-iptables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restore Close Button to Right in Ubuntu 10.04</title>
		<link>http://log.largevoid.com/2010/06/restore-close-button-to-right-in-ubuntu-10-04/</link>
		<comments>http://log.largevoid.com/2010/06/restore-close-button-to-right-in-ubuntu-10-04/#comments</comments>
		<pubDate>Sun, 13 Jun 2010 22:58:52 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[System Administration]]></category>
		<category><![CDATA[button_layout]]></category>
		<category><![CDATA[close button]]></category>
		<category><![CDATA[gconftool]]></category>
		<category><![CDATA[metacity]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=370</guid>
		<description><![CDATA[gconftool-2 --set "/apps/metacity/general/button_layout" --type string "menu:minimize,maximize,close"
Ref: LaunchPad &#187; Ubuntu &#187; Questions &#187; Question #108951
]]></description>
			<content:encoded><![CDATA[<p><code>gconftool-2 --set "/apps/metacity/general/button_layout" --type string "menu:minimize,maximize,close"</code></p>
<p>Ref: <a href="https://answers.launchpad.net/ubuntu/+question/108951">LaunchPad &raquo; Ubuntu &raquo; Questions &raquo; Question #108951</a></p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/06/restore-close-button-to-right-in-ubuntu-10-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quotations from Reddit</title>
		<link>http://log.largevoid.com/2010/06/quotations-from-reddit/</link>
		<comments>http://log.largevoid.com/2010/06/quotations-from-reddit/#comments</comments>
		<pubDate>Sat, 05 Jun 2010 05:58:57 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Quotes]]></category>
		<category><![CDATA[insipration]]></category>
		<category><![CDATA[reddit]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=366</guid>
		<description><![CDATA[If you are surprised by anything, question your underlying model, for it has led you to be surprised by the true state of affairs. Since the beginning, not one unusual thing has ever happened. Paraphrased from Eliezer Yudkowsky
The surest way to corrupt a youth is to teach him to hold in higher regard those who [...]]]></description>
			<content:encoded><![CDATA[<p><q>If you are surprised by anything, question your underlying model, for it has led you to be surprised by the true state of affairs. Since the beginning, not one unusual thing has ever happened.</q> <cite>Paraphrased from Eliezer Yudkowsky</cite></p>
<p><q>The surest way to corrupt a youth is to teach him to hold in higher regard those who think the same as him</q></p>
<p><q>If voting made any difference, they wouldn&#8217;t let us do it.</q> <cite>Mark Twain</cite></p>
<p><q>Yesterday is yesterday. If we try to recapture it we will only lose tomorrow.</q> <cite>Bill Clinton</cite></p>
<p><q>Lower your voice and strengthen your argument.</q> <cite>Lebanese proverb</cite></p>
<p><q>Time is a great teacher, but unfortunately it kills all its pupils.</q> <cite>Louis Hector Berlioz</cite></p>
<p><q>Most people are other people. Their thoughts are someone else&#8217;s opinions. Their lives a mimicry. Their passions a quotation.</q> <cite>Oscar Wilde</cite></p>
<p><q>I do not feel obliged to believe that the same God who has endowed us with sense, reason, and intellect has intended us to forgo their use.</q> <cite>Galileo Galilei</cite></p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/06/quotations-from-reddit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rent vs Buy &#8211; In Regards to Housing</title>
		<link>http://log.largevoid.com/2010/06/rent-vs-buy-in-regards-to-housing/</link>
		<comments>http://log.largevoid.com/2010/06/rent-vs-buy-in-regards-to-housing/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 18:08:56 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Quotes]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[buy]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[home]]></category>
		<category><![CDATA[rent]]></category>
		<category><![CDATA[rule of thumb]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=360</guid>
		<description><![CDATA[The cross-over point is about 15 times annual rent, [trulia] believes. In other words, as a rough rule of thumb, homes are probably fairly valued in a city when they cost about 15 times a year&#8217;s rent. So, for example, if you&#8217;re paying $10,000 a year to rent a place, think twice about buying a [...]]]></description>
			<content:encoded><![CDATA[<p><q>The cross-over point is about 15 times annual rent, [trulia] believes. In other words, as a rough rule of thumb, homes are probably fairly valued in a city when they cost about 15 times a year&#8217;s rent. So, for example, if you&#8217;re paying $10,000 a year to rent a place, think twice about buying a home that costs more than $150,000. Dean Baker, economist at the Washington, D.C. think-tank The Center for Economic and Policy Research, came to a similar conclusion in research on the subject in recent years. Fifteen times is the historic average, he said.</q> <cite><a href="http://online.wsj.com/article/SB10001424052748703561604575282910161870380.html?mod=WSJ_hp_editorsPicks">Brett Arends at the Wall Street Journal</a></cite></p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/06/rent-vs-buy-in-regards-to-housing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Periodic Tarballs: Find and Awk</title>
		<link>http://log.largevoid.com/2010/06/periodic-tarballs-find-and-awk/</link>
		<comments>http://log.largevoid.com/2010/06/periodic-tarballs-find-and-awk/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 08:43:04 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Scripts, Tricks and Hacks]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[cut]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[gzip]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pipe]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=355</guid>
		<description><![CDATA[I have a gang of directories.  There&#8217;s a new directory each day!  Each directory stores about 20k files.  Over time, the performance of the directory hierarchy degrades, and it&#8217;s best for me to tar up old stuff.
In linux-land, there&#8217;s always more than one way of doing things&#8230; even if it&#8217;s not the [...]]]></description>
			<content:encoded><![CDATA[<p>I have a gang of directories.  There&#8217;s a new directory each day!  Each directory stores about 20k files.  Over time, the performance of the directory hierarchy degrades, and it&#8217;s best for me to tar up old stuff.</p>
<p>In linux-land, there&#8217;s always more than one way of doing things&#8230; even if it&#8217;s not the right way.  Today, we&#8217;ll explore find piped to awk piped to the shell.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">find</span> . <span style="color: #660033;">-type</span> d <span style="color: #660033;">-maxdepth</span> <span style="color: #000000;">1</span> <span style="color: #660033;">-mtime</span> +<span style="color: #000000;">60</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #000000; font-weight: bold;">|</span> 
<span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span><span style="color: #ff0000;">&quot;/&quot;</span> <span style="color: #ff0000;">'{print &quot;tar czf &quot; $2 &quot;.tar.gz --remove-files ./&quot; $2 &quot;; rmdir &quot; $2 }'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sh</span></pre></div></div>

<p>Basically, find all sub-directories in the current directory &#8212; don&#8217;t go recursive.  Sort for sanity.  Extract the file name portion (lots of ways to do this).  Generate a shell command <code>tar czf {{dirname}}.tar.gz --remove-files ./{{dirname}}; rmdir {{dirname}}</code> to build the tarball and remove the empty directory when done.  Finally, we just tell <code>sh</code> to execute it all&#8230; one directory at a time. Bam!</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/06/periodic-tarballs-find-and-awk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remember that Name</title>
		<link>http://log.largevoid.com/2010/05/remember-that-name/</link>
		<comments>http://log.largevoid.com/2010/05/remember-that-name/#comments</comments>
		<pubDate>Mon, 24 May 2010 18:05:02 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[memory]]></category>
		<category><![CDATA[names]]></category>
		<category><![CDATA[person]]></category>
		<category><![CDATA[recall]]></category>
		<category><![CDATA[remember]]></category>
		<category><![CDATA[terrible]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=351</guid>
		<description><![CDATA[10 Simple Tricks To Remembering Names
Plenty of business deals (and romantic rendezvous) have been foiled because someone failed to recall the right name at the right time. There are tricks to remembering names. Benjamin Levy, author of Remember Every Name Every Time, advocates the FACE method: &#8220;focus, ask, comment and employ.&#8221; Focus: Lock in on [...]]]></description>
			<content:encoded><![CDATA[<p><strong>10 Simple Tricks To Remembering Names</strong></p>
<p>Plenty of business deals (and romantic rendezvous) have been foiled because someone failed to recall the right name at the right time. There are tricks to remembering names. Benjamin Levy, author of Remember Every Name Every Time, advocates the FACE method: &#8220;<strong>focus, ask, comment and employ</strong>.&#8221; Focus: Lock in on the person&#8217;s face. Ask: Inquire which version he prefers (&#8220;Is it Ted or Theodore?&#8221;). Comment: Say something about the name and cross-reference it in your head (&#8220;My college roommate&#8217;s name was Ted.&#8221;) Employ: Put the name to use&#8211;&#8221;Nice seeing you, Ted&#8221;&#8211;to drive it home. Here are nine more tricks.</p>
<p><br/></p>
<ol>
<li><strong>Repeat, Repeat, Repeat</strong><br />
The most surefire strategy is to repeat the person&#8217;s name&#8211;both in your head, and out loud&#8211;as soon as possible after you&#8217;ve been introduced. Occasionally use the person&#8217;s name in conversation. &#8220;Pleasure to meet you, Bob,&#8221; or &#8220;Bob, so good to see you.&#8221; Don&#8217;t overdo it, of course, but don&#8217;t worry that Bob will recoil, either. He&#8217;d rather you remember his name than not.
</li>
<li><strong>Picture This</strong><br />
Turn someone&#8217;s name into an image that you can remember. When you meet Shirley, think of a Shirley temple. Don&#8217;t laugh&#8211;it works.
</li>
<li><strong>Spell It Out</strong><br />
Another imagery-based tactic: Ask someone to spell out his or her name. If you can picture the letters in your mind, you&#8217;ll have a better chance of remembering the name. A derivation on that: Imagine the person&#8217;s name written across his forehead, like a billboard.
</li>
<li><strong>Connect</strong><br />
Try to associate names with things people tell you about themselves (careers, hobbies) that will trigger the sound or association of the name in your mind. Fred likes to fish, Margarita runs a bar, you get the idea.
</li>
<li><strong>Word Play</strong><br />
Let the words do the work for you. Mnemonic devices (Dale works in sales) work nicely, as does alliteration (Jim from Jersey).
</li>
<li><strong>Lead the Way</strong><br />
If you know that your name will be hard to remember or pronounce, do other people a favor and help them out. They&#8217;ll return the favor&#8211;or, if you&#8217;re chatting with a Mike or a Bob, maybe they&#8217;ll make some big production out of their own common name, making it stick in your mind.
</li>
<li><strong>Put Pen to Paper</strong><br />
It&#8217;s not enough to write down a person&#8217;s name as soon as possible after meeting them. Record the name in a &#8220;new contacts&#8221; file, and include when and where you met.
</li>
<li><strong>Speak Up</strong><br />
Embarrassing as it seems, don&#8217;t be afraid to ask someone to repeat his or her name. Start out with a compliment, such as &#8220;I&#8217;ve had so much fun talking with you, and I&#8217;ve completely forgotten your name.&#8221; If you realize you&#8217;ve blanked on a name a few seconds after introduction, just say &#8220;I&#8217;m sorry, I missed your name.&#8221;
</li>
<li><strong>Prime the Pump</strong><br />
You spy a person, whose name you&#8217;ve forgotten, making her way toward you. What to do? If you&#8217;re speaking with someone you know, introduce them right off the bat. The newcomer will probably introduce herself on her own. Problem solved.
</li>
<li>[...There is no 10... Maybe #0 is the intro]</li>
</ol>
<p><strong>Disclaimer:</strong><br />
This post is 100% copied from: http://www.forbes.com/2010/04/20/how-to-remember-names-entrepreneurs-human-resources-remember-names_slide.html<br />
This is a reference post, and since this blog is for reference purposes, I&#8217;ve posted it here in the name of fair use.</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/05/remember-that-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>1 Week of Python</title>
		<link>http://log.largevoid.com/2010/05/1-week-of-python/</link>
		<comments>http://log.largevoid.com/2010/05/1-week-of-python/#comments</comments>
		<pubDate>Mon, 03 May 2010 23:20:39 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Thought Fragments]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[interpreted]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[matlab]]></category>
		<category><![CDATA[numpy]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scipy]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=345</guid>
		<description><![CDATA[Aaaahghhhh!  I&#8217;m frustrated.  Why are all the Python books on Amazon rated as nearly 5 stars when, after reading or skimming them, they don&#8217;t deserve more than 3?  None of the books I&#8217;ve encountered are even half-decent for a professional programmer.  They gloss over the implementation details and get into niche [...]]]></description>
			<content:encoded><![CDATA[<p>Aaaahghhhh!  I&#8217;m frustrated.  Why are all the Python books on Amazon rated as nearly 5 stars when, after reading or skimming them, they don&#8217;t deserve more than 3?  None of the books I&#8217;ve encountered are even half-decent for a professional programmer.  They gloss over the implementation details and get into niche topics with poor programming form and typographic format.</p>
<p>[Humble edit] To the authors of these books (or any book for that matter), I realize there is a ton of effort that goes into writing any book, especially those of a technical nature, and I sincerely appreciate your efforts.  However, if you are the author of a book that simply copies the Python documentation and adds a few half-baked examples, then you are who I&#8217;m talking to.  I&#8217;m also talking to the authors of so-called &#8220;advanced&#8221; Python books who have very poor programming style.</p>
<p>Ok, end rant 1.</p>
<p>What&#8217;s with the syntax? Everything looks like a GOTO: statement.  Rule #1: No GOTO.  It&#8217;s ugly and feels dangerous. Let&#8217;s not forget to mention the (one_element_tuple<strong>,</strong>) language artifact.  I get it, but it&#8217;s ugly.  /rant2</p>
<p>NumPy: Excellent and essential tool for data arrays.  The strength of interpreted languages is rapid development.  NumPy saves Python from the greatest weakness of interpreted languages: numeric operations on large arrays.  This is the only reason to use Python IMO.</p>
<p>SciPy: I don&#8217;t know where this fits in yet, but I&#8217;m sure they&#8217;ve created highly specialized modules for various scientific fields, just like MatLab has created &#8230; whats the word&#8230; toolboxes? for various industrial sectors.</p>
<p>Python 2 or 3? 2.  Until NumPy supports v3, I wouldn&#8217;t even think about it.  Python is just too slow on its own&#8230; for dealing with arrays of numbers, that is.<br />
<strong>EDIT:</strong> <a href="http://www.mail-archive.com/numpy-discussion@scipy.org/msg26524.html">Yay! Python 3 support</a></p>
<p>Please, if there is one good Python book <em>for programmers</em> that involves numeric processing of millions to billions of data points, <strong>please</strong> speak up.</p>
<p>I with to retract my unbridled like for the language.  Please replace that an appreciation for NumPy and interpreted languages.</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/05/1-week-of-python/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Linux Commands for System Information</title>
		<link>http://log.largevoid.com/2010/04/linux-commands-for-system-informatio/</link>
		<comments>http://log.largevoid.com/2010/04/linux-commands-for-system-informatio/#comments</comments>
		<pubDate>Mon, 26 Apr 2010 19:44:51 +0000</pubDate>
		<dc:creator>Chief</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[biosdecode]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[dmidecode]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=343</guid>
		<description><![CDATA[Need to remotely troubleshoot a machine?  Don&#8217;t know what&#8217;s inside?  Want to know what&#8217;s enabled in BIOS?
Let&#8217;s keep it short and sweet (details from our reference):
man biosdecode
man dmidecode
Ref: Linux System Information Decoded, Hess, Ken. 2010-04-23.
]]></description>
			<content:encoded><![CDATA[<p>Need to remotely troubleshoot a machine?  Don&#8217;t know what&#8217;s inside?  Want to know what&#8217;s enabled in BIOS?</p>
<p>Let&#8217;s keep it short and sweet (details from our reference):<br />
<code>man biosdecode</code><br />
<code>man dmidecode</code></p>
<p>Ref: <a href="http://www.linux-mag.com/id/7768">Linux System Information Decoded</a>, Hess, Ken. 2010-04-23.</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/04/linux-commands-for-system-informatio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/


Served from: log.largevoid.com @ 2010-09-04 07:18:31 -->