<?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 &#187; Reference</title>
	<atom:link href="http://log.largevoid.com/cat/reference/feed/" rel="self" type="application/rss+xml" />
	<link>http://log.largevoid.com</link>
	<description>Getting it down on `paper`</description>
	<lastBuildDate>Mon, 06 Feb 2012 06:23:55 +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>Twitter Peeps in Finance</title>
		<link>http://log.largevoid.com/2011/12/twitter-peeps-in-finance/</link>
		<comments>http://log.largevoid.com/2011/12/twitter-peeps-in-finance/#comments</comments>
		<pubDate>Fri, 23 Dec 2011 03:35:52 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[ff]]></category>
		<category><![CDATA[follow]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=627</guid>
		<description><![CDATA[http://bmanmicrocaps.blogspot.com/p/twitter-ff.html]]></description>
			<content:encoded><![CDATA[<p><a href="http://bmanmicrocaps.blogspot.com/p/twitter-ff.html">http://bmanmicrocaps.blogspot.com/p/twitter-ff.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2011/12/twitter-peeps-in-finance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The 5 Fundamental Truths About Trading</title>
		<link>http://log.largevoid.com/2011/12/the-5-fundamental-truths-about-trading/</link>
		<comments>http://log.largevoid.com/2011/12/the-5-fundamental-truths-about-trading/#comments</comments>
		<pubDate>Sun, 04 Dec 2011 01:47:47 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Quotes]]></category>
		<category><![CDATA[Reference]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=596</guid>
		<description><![CDATA[Anything can happen. You don&#8217;t need to know what is going to happen next in order to make money. There is a random distribution between wins and losses for any given set of variables that define an edge. An edge is nothing more than an indication of a higher probability of one thing happening over [...]]]></description>
			<content:encoded><![CDATA[<ol>
<li>Anything can happen.</li>
<li>You don&#8217;t need to know what is going to happen next in order to make money.</li>
<li>There is a random distribution between wins and losses for any given set of variables that define an edge.</li>
<li>An edge is nothing more than an indication of a higher probability of one thing happening over another.</li>
<li>Every moment in the market is unique.</li>
</ol>
<p>Douglas, M. (2001). Trading in the Zone: Master the Market with Confidence, Discipline and a Winning Attitude. Prentice Hall Press</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2011/12/the-5-fundamental-truths-about-trading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The 7 Principles of Consistency</title>
		<link>http://log.largevoid.com/2011/12/the-7-principles-of-consistency/</link>
		<comments>http://log.largevoid.com/2011/12/the-7-principles-of-consistency/#comments</comments>
		<pubDate>Sun, 04 Dec 2011 01:45:23 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Quotes]]></category>
		<category><![CDATA[Reference]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=594</guid>
		<description><![CDATA[I objectively identify my edges. I predefine the risk of every trade. I completely accept risk or I am willing to let go of the trade. I act on my edges without reservation or hesitation. I pay myself as the market makes money available to me. I continually monitor my susceptibility for making errors. I [...]]]></description>
			<content:encoded><![CDATA[<ol>
<li>I objectively identify my edges.</li>
<li>I predefine the risk of every trade.</li>
<li>I completely accept risk or I am willing to let go of the trade.</li>
<li>I act on my edges without reservation or hesitation.</li>
<li>I pay myself as the market makes money available to me.</li>
<li>I continually monitor my susceptibility for making errors.</li>
<li>I understand the absolute necessity of these <em>principles</em> of consistent success and, therefore, I never violate them.</li>
</ol>
<p>Douglas, M. (2001). Trading in the Zone: Master the Market with Confidence, Discipline and a Winning Attitude. Prentice Hall Press</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2011/12/the-7-principles-of-consistency/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disable Annoying Camera and Video Sounds on Rooted Android</title>
		<link>http://log.largevoid.com/2011/08/disable-annoying-camera-and-video-sounds-on-rooted-android/</link>
		<comments>http://log.largevoid.com/2011/08/disable-annoying-camera-and-video-sounds-on-rooted-android/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 23:27:10 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Gotchas]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Scripts, Tricks and Hacks]]></category>
		<category><![CDATA[adb]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[CyanogenMod]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=582</guid>
		<description><![CDATA[Pre-req: Fastboot drivers installed. ROM: CyanogenMod 7.1 RC1 (YMMV). Phone: HTC Desire &#8211; BravoC DVT2 Enable USB debugging. Connect your phone to your computer. Bring up a command prompt. Change to android-sdk-windows directory. adb remount adb shell cd system/media/audio/ui mv camera_click.ogg camera_click.og_ mv VideoRecord.ogg VideoRecord.og_ Source: http://android.modaco.com/topic/319541-camera-shutter-sound/ Reference: http://theunlockr.com/2009/10/06/how-to-set-up-adb-usb-drivers-for-android-devices/]]></description>
			<content:encoded><![CDATA[<p>Pre-req: Fastboot drivers <a href="http://theunlockr.com/2011/08/02/how-to-gain-s-off-flash-a-custom-recovery-and-root-your-android-phone-using-the-revolutionary-method/">installed</a>.<br />
ROM: CyanogenMod 7.1 RC1 (YMMV).<br />
Phone: HTC Desire &#8211; BravoC DVT2</p>
<p>Enable USB debugging.<br />
Connect your phone to your computer.<br />
Bring up a command prompt.<br />
Change to android-sdk-windows directory.</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">adb remount
adb shell
<span style="color: #b1b100; font-weight: bold;">cd</span> system/media/audio/ui
mv camera_click.ogg camera_click.og_
mv VideoRecord.ogg VideoRecord.og_</pre></div></div>

<p>Source: <a href="http://android.modaco.com/topic/319541-camera-shutter-sound/">http://android.modaco.com/topic/319541-camera-shutter-sound/</a><br />
Reference: <a href="http://android.modaco.com/topic/319541-camera-shutter-sound/">http://theunlockr.com/2009/10/06/how-to-set-up-adb-usb-drivers-for-android-devices/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2011/08/disable-annoying-camera-and-video-sounds-on-rooted-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Root an HTC Desire to Get More Space for Apps</title>
		<link>http://log.largevoid.com/2011/08/root-an-htc-desire-to-get-more-space-for-apps/</link>
		<comments>http://log.largevoid.com/2011/08/root-an-htc-desire-to-get-more-space-for-apps/#comments</comments>
		<pubDate>Wed, 03 Aug 2011 10:42:12 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[Scripts, Tricks and Hacks]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[CDMA]]></category>
		<category><![CDATA[ClockworkMod]]></category>
		<category><![CDATA[CyanogenMod]]></category>
		<category><![CDATA[Gingerbread]]></category>
		<category><![CDATA[HTC Desire]]></category>
		<category><![CDATA[revolutionary]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=577</guid>
		<description><![CDATA[Rooted my android &#8212; HTC Desire (CDMA)! At time of rooting, the specs were: BravoC DVT2 Ship S-on HBOOT-1.06.0000 Microp-051e Touch Panel-Synt0101 Radio-2.15.00.2.17 Dec 22, 2010, 16:16:39 Abridged Instructions: Download/Install HTCDriver3.0.0.007 (AKA Fastboot drivers) Download/Apply revolutionary-0.3pre7 (Boot/Recovery loader) Download/Apply su-2.3.6.3-efgh-signed (root) &#8230; ClockworkMod backup!! (protect your original OEM install) ClockworkMod to wipe data/cache (now wipe [...]]]></description>
			<content:encoded><![CDATA[<p>Rooted my android &#8212; HTC Desire (CDMA)!</p>
<p>At time of rooting, the specs were:</p>
<pre>BravoC DVT2 Ship S-on
HBOOT-1.06.0000
Microp-051e
Touch Panel-Synt0101
Radio-2.15.00.2.17
Dec 22, 2010, 16:16:39</pre>
<p>Abridged Instructions:</p>
<ol>
<li>Download/Install HTCDriver3.0.0.007 (AKA Fastboot drivers)</li>
<li>Download/Apply revolutionary-0.3pre7 (Boot/Recovery loader)</li>
<li>Download/Apply su-2.3.6.3-efgh-signed (root)</li>
<li>&#8230; ClockworkMod backup!! (protect your original OEM install)</li>
<li>ClockworkMod to wipe data/cache (now wipe it clean)</li>
<li>ClockworkMod to create/format 512MB sd-ext partition (add partition for apps)</li>
<li>Download/Apply CyanogenMod 7 &#8211; update-cm-7.0.3-BravoC-signed (the ROM for your device)</li>
<li>Android Market &gt; S2E &gt; configure (check all) &gt; reboot (Use sd-ext thoroughly: more apps, long reboot)</li>
<li>Android Market madness! (download away!)</li>
<li>Software configuration madness&#8230; (configure before backup snapshot)</li>
<li>&#8230; ClockworkMod backup!!! (make backup of customized OS)</li>
<li>AWESOME (do dangerous things, knowing you have a backup!)</li>
</ol>
<p>Learning curve: 7 hours of pain + 2 hours of tinkering + 2 hours of diligent due process, 30 minutes of documentation.</p>
<p>Unlock device, install boot loader, root:<br />
<a href="http://theunlockr.com/2011/08/02/how-to-gain-s-off-flash-a-custom-recovery-and-root-your-android-phone-using-the-revolutionary-method/">http://theunlockr.com/2011/08/02/how-to-gain-<wbr>s-off-flash-a-custom-recovery-and-root-your-androi<wbr>d-phone-using-the-revolutionary-method/</wbr></wbr></a></p>
<p>Choose your mod (not very many for CDMA):<br />
<a href="http://forum.cyanogenmod.com/forum/118-htc-desire-cdma/">http://forum.cyanogenmod.com/forum/118-htc-d<wbr>esire-cdma/</wbr></a></p>
<p>Force use of newly created sd card ext partition (get lots of app space):<br />
<a href="https://market.android.com/details?id=ru.krikun.s2e">https://market.android.com/details?id=ru.kr<wbr>ikun.s2e</wbr></a></p>
<p>*Background info re. the apps data partition/A2SD conundrum:<br />
<a href="http://android.modaco.com/topic/331205-guide-how-to-get-more-free-space-for-your-apps/"> http://android.modaco.com/topic/331205-guide-how-to-get-more-free-space-for-your-apps/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2011/08/root-an-htc-desire-to-get-more-space-for-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parabolic SAR Calculation</title>
		<link>http://log.largevoid.com/2011/06/parabolic-sar-calculation/</link>
		<comments>http://log.largevoid.com/2011/06/parabolic-sar-calculation/#comments</comments>
		<pubDate>Sat, 04 Jun 2011 01:27:00 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[stocks]]></category>
		<category><![CDATA[technical analysis]]></category>
		<category><![CDATA[technical indicators]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=542</guid>
		<description><![CDATA[Below you will find demonstrative code that calculates the Parabolic SAR indicator. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 [...]]]></description>
			<content:encoded><![CDATA[<p>Below you will find demonstrative code that calculates the Parabolic SAR indicator.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Computes the Parabolic SAR, as originally developed by Welles Wilder.
 *
 * @param array $his Extreme Points: The highest high
 * @param array $los Extreme Points: The lowest low
 * @param float $afInc Acceleration Factor Increment, for each time point
 *   Lower increment = less sensitive (indicitive)
 * @param float $afMax Acceleration Factor Max, rno matter how long the trend
 *   Lower max step = less sensitive (reactive)
 * @param bool $withDir Indicates if trend direction should be returned.
 * @return array 
 *  If $withDir is true, result is tuple of length 2.
 *    Tuple contains ( array of SAR values, array of trend direction )
 *  Else if $withDir is false, result is simply an array of SAR values.
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> parabolicSAR<span style="color: #009900;">&#40;</span><span style="color: #000088;">$his</span><span style="color: #339933;">,</span><span style="color: #000088;">$los</span><span style="color: #339933;">,</span><span style="color: #000088;">$afInc</span><span style="color: #339933;">=</span><span style="color:#800080;">0.02</span><span style="color: #339933;">,</span><span style="color: #000088;">$afMax</span><span style="color: #339933;">=</span><span style="color:#800080;">0.20</span><span style="color: #339933;">,</span><span style="color: #000088;">$withDir</span><span style="color: #339933;">=</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$his</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$los</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #990000;">trigger_error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;First 2 parameters must be arrays: his, los&quot;</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">E_USER_WARNING</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;">$withDir</span><span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$his</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$los</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
   <span style="color: #990000;">trigger_error</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Arrays must be equal length.&quot;</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">E_USER_ERROR</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;">$withDir</span><span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
 <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$his</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
   <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$withDir</span><span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
&nbsp;
 <span style="color: #000088;">$keys</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_keys</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$his</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$his</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_values</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$his</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000088;">$los</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_values</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$los</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">// Initialize trend to whatever</span>
 <span style="color: #000088;">$trend</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$his</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&gt;=</span><span style="color: #000088;">$his</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$los</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">&lt;=</span><span style="color: #000088;">$los</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span> <span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">// Previous SAR: Use first data point&amp;#039;s extreme value, depending on trend</span>
 <span style="color: #000088;">$pSAR</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$trend</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$los</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$his</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">// Extreme point: Highest during uptrend || lowest during downtrend</span>
 <span style="color: #000088;">$EP</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$trend</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$his</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$los</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">// Acceleration factor</span>
 <span style="color: #000088;">$AF</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$afInc</span><span style="color: #339933;">;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">// Initialize results based on trend guess</span>
 <span style="color: #000088;">$r</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$keys</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$pSAR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>   <span style="color: #666666; font-style: italic;">// SAR Results</span>
 <span style="color: #000088;">$d</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$keys</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$trend</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  <span style="color: #666666; font-style: italic;">// Trend Directions</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">// Compute &quot;tomorrow&quot; SAR</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;">1</span><span style="color: #339933;">,</span><span style="color: #000088;">$n</span><span style="color: #339933;">=</span><span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$keys</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</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: #666666; font-style: italic;">// Do for uptrend</span>
   <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$trend</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
&nbsp;
     <span style="color: #666666; font-style: italic;">// Making higher highs: accelerate</span>
     <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$his</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$EP</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       <span style="color: #000088;">$EP</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$his</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
       <span style="color: #000088;">$AF</span> <span style="color: #339933;">=</span> <span style="color: #990000;">min</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$afMax</span><span style="color: #339933;">,</span><span style="color: #000088;">$AF</span><span style="color: #339933;">+</span><span style="color: #000088;">$afInc</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
&nbsp;
     <span style="color: #666666; font-style: italic;">// Tomorrow&amp;#039;s SAR based on today&amp;#039;s price action.</span>
     <span style="color: #000088;">$nSAR</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pSAR</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$AF</span> <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$EP</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$pSAR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #666666; font-style: italic;">// Rule: SAR can never be above prior period&amp;#039;s low or the current low.</span>
     <span style="color: #000088;">$nSAR</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">min</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$los</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$los</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$nSAR</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #990000;">min</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$los</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$nSAR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #666666; font-style: italic;">// Rule: If SAR crosses tomorrow&amp;#039;s price range, the trend switches.</span>
     <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$nSAR</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$los</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
       <span style="color: #000088;">$trend</span> <span style="color: #339933;">=</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
       <span style="color: #000088;">$nSAR</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$EP</span><span style="color: #339933;">;</span>      <span style="color: #666666; font-style: italic;">// set to the last EP recorded on the previous trend</span>
       <span style="color: #000088;">$EP</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$los</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// reset accordingly to this period&amp;#039;s maximum</span>
       <span style="color: #000088;">$AF</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$afInc</span><span style="color: #339933;">;</span>     <span style="color: #666666; font-style: italic;">// reset to its initial value of 0.02.</span>
     <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #666666; font-style: italic;">// Do for downtrend</span>
&nbsp;
     <span style="color: #666666; font-style: italic;">// Making lower lows: accelerate</span>
     <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$los</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$EP</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
       <span style="color: #000088;">$EP</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$los</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
       <span style="color: #000088;">$AF</span> <span style="color: #339933;">=</span> <span style="color: #990000;">min</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$afMax</span><span style="color: #339933;">,</span><span style="color: #000088;">$AF</span><span style="color: #339933;">+</span><span style="color: #000088;">$afInc</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
&nbsp;
     <span style="color: #666666; font-style: italic;">// Tomorrow&amp;#039;s SAR based on today&amp;#039;s price action.</span>
     <span style="color: #000088;">$nSAR</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$pSAR</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$AF</span> <span style="color: #339933;">*</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$EP</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$pSAR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #666666; font-style: italic;">// Rule: SAR can never be below prior period&amp;#039;s highs or the current high.</span>
     <span style="color: #000088;">$nSAR</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$his</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$his</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$nSAR</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #990000;">max</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$his</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$nSAR</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     <span style="color: #666666; font-style: italic;">// Rule: If SAR crosses tomorrow&amp;#039;s price range, the trend switches.</span>
     <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$nSAR</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$his</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       <span style="color: #000088;">$trend</span> <span style="color: #339933;">=</span> <span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
       <span style="color: #000088;">$nSAR</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$EP</span><span style="color: #339933;">;</span>      <span style="color: #666666; font-style: italic;">// set to the last EP recorded on the previous trend</span>
       <span style="color: #000088;">$EP</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$his</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// reset accordingly to this period&amp;#039;s maximum</span>
       <span style="color: #000088;">$AF</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$afInc</span><span style="color: #339933;">;</span>     <span style="color: #666666; font-style: italic;">// reset to its initial value of 0.02.</span>
     <span style="color: #009900;">&#125;</span>
&nbsp;
   <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// end: if uptrend else downtrend</span>
&nbsp;
   <span style="color: #000088;">$r</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$keys</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$nSAR</span><span style="color: #339933;">;</span>
   <span style="color: #000088;">$d</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$keys</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$trend</span><span style="color: #339933;">;</span>
   <span style="color: #000088;">$pSAR</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$nSAR</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// END: for(i..n)</span>
&nbsp;
 <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$withDir</span><span style="color: #009900;">&#41;</span> ? <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$r</span><span style="color: #339933;">,</span><span style="color: #000088;">$d</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$r</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// END: function parabolicSAR($his,$los,$afInc=0.02,$afMax=0.20)</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p><strong>Sources:</strong></p>
<ul>
<li><a href="http://stockcharts.com/help/doku.php?id=chart_school:technical_indicators:parabolic_sar">StockCharts.com: Chart School</a></li>
<li><a href="http://en.wikipedia.org/wiki/Parabolic_SAR">Wikipedia: Parabolic SAR</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2011/06/parabolic-sar-calculation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best Documents for Installing THREDDS Data Server</title>
		<link>http://log.largevoid.com/2011/05/best-documents-for-installing-thredds-data-server/</link>
		<comments>http://log.largevoid.com/2011/05/best-documents-for-installing-thredds-data-server/#comments</comments>
		<pubDate>Mon, 02 May 2011 17:50:13 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[checklist]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[TDS]]></category>
		<category><![CDATA[THREDDS]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=533</guid>
		<description><![CDATA[In order of utility&#8230; 1) Setup/Tutorial: http://www.unidata.ucar.edu/projects/THREDDS/tech/tds4.2/tutorial/ 2) Installation Checklist: http://www.unidata.ucar.edu/projects/THREDDS/tech/tds4.2/tutorial/Checklist.html 3) Download/Documents: http://www.unidata.ucar.edu/projects/THREDDS/tech/TDS.html &#160;]]></description>
			<content:encoded><![CDATA[<p>In order of utility&#8230;</p>
<p>1) Setup/Tutorial: <a title="Setup/Tutorial" href="http://www.unidata.ucar.edu/projects/THREDDS/tech/tds4.2/tutorial/">http://www.unidata.ucar.edu/projects/THREDDS/tech/tds4.2/tutorial/</a></p>
<p>2) Installation Checklist: <a title="Installation Checklist" href="http://www.unidata.ucar.edu/projects/THREDDS/tech/tds4.2/tutorial/Checklist.html">http://www.unidata.ucar.edu/projects/THREDDS/tech/tds4.2/tutorial/Checklist.html</a></p>
<p>3) Download/Documents: <a title="Download/Documents" href="http://www.unidata.ucar.edu/projects/THREDDS/tech/TDS.html">http://www.unidata.ucar.edu/projects/THREDDS/tech/TDS.html</a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2011/05/best-documents-for-installing-thredds-data-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ranking Colleges by Reading Level</title>
		<link>http://log.largevoid.com/2010/12/ranking-colleges-by-reading-level/</link>
		<comments>http://log.largevoid.com/2010/12/ranking-colleges-by-reading-level/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 12:15:07 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[Scripts, Tricks and Hacks]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[intelligence]]></category>
		<category><![CDATA[publications]]></category>
		<category><![CDATA[ranking]]></category>
		<category><![CDATA[reading level]]></category>
		<category><![CDATA[university]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=496</guid>
		<description><![CDATA[Google recently released a new feature that allows you to see the reading level for a given domain. I was curious what this meant for universities, and wondered which universities&#8217; websites had the most advanced reading level documents. Top 10 (excerpt): School Rank1 Advanced Intermediate Basic Num Results Cornell University 1 98 1 1 34300000 [...]]]></description>
			<content:encoded><![CDATA[<p>Google recently released a new feature that allows you to see the reading level for a given domain.  I was curious what this meant for universities, and wondered which universities&#8217; websites had the most advanced reading level documents.</p>
<p>Top 10 (excerpt):</p>
<table>
<thead>
<tr>
<td>School</td>
<td>Rank<sup>1</sup></td>
<td>Advanced</td>
<td>Intermediate</td>
<td>Basic</td>
<td>Num Results</td>
</tr>
</thead>
<tbody>
<tr>
<td><a href="http://www.cornell.edu/">Cornell University</a></td>
<td>1</td>
<td>98</td>
<td>1</td>
<td>1</td>
<td>34300000</td>
</tr>
<tr>
<td><a href="http://www.jhu.edu/">Johns Hopkins University</a></td>
<td>2</td>
<td>75</td>
<td>21</td>
<td>2</td>
<td>36600000</td>
</tr>
<tr>
<td><a href="http://www.stanford.edu/">Stanford University</a></td>
<td>3</td>
<td>66</td>
<td>28</td>
<td>4</td>
<td>28800000</td>
</tr>
<tr>
<td><a href="http://web.mit.edu/">Massachusetts Institute of Technology</a></td>
<td>4</td>
<td>60</td>
<td>29</td>
<td>10</td>
<td>21200000</td>
</tr>
<tr>
<td><a href="http://www.berkeley.edu/">University of California-Berkeley</a></td>
<td>5</td>
<td>52</td>
<td>38</td>
<td>8</td>
<td>14900000</td>
</tr>
<tr>
<td><a href="http://www.harvard.edu/">Harvard University</a></td>
<td>6</td>
<td>91</td>
<td>6</td>
<td>2</td>
<td>12400000</td>
</tr>
<tr>
<td><a href="http://www.psu.edu/">Pennsylvania State University</a>*</td>
<td>7</td>
<td>97</td>
<td>2</td>
<td>1</td>
<td>11300000</td>
</tr>
<tr>
<td><a href="http://www.umich.edu/">University of Michigan</a>*</td>
<td>8</td>
<td>65</td>
<td>29</td>
<td>5</td>
<td>12400000</td>
</tr>
<tr>
<td><a href="http://www.wsc.mass.edu/">Westfield State College</a></td>
<td>9</td>
<td>41</td>
<td>49</td>
<td>8</td>
<td>12100000</td>
</tr>
<tr>
<td><a href="http://oregonstate.edu/">Oregon State University</a></td>
<td>10</td>
<td>58</td>
<td>34</td>
<td>7</td>
<td>8780000</td>
</tr>
</tbody>
</table>
<p>The results can be found here: <a href="http://largevoid.com/out/university-ranking/">University Ranking</a>, <a href="http://largevoid.com/out/university-ranking/university-ranking.tar.gz">Source Code</a>.</p>
<p>My assumption is that the higher the reading level, the more intelligent the professors are at their respective universities.  With this premise, one can use the search results to rank the universities accordingly.</p>
<p>This assumption comes with several caveats.  One such example includes the situation where publications are not hosted under the university&#8217;s primary domain.  While I haven&#8217;t found this to be the case, I cannot prove otherwise.  The results are clearly biased in favor of universities with more publications online.  This is justified in that the prodigious universities will publish more papers than their less substantial counterparts. </p>
<p><strong>The ranking algorithm:</strong> <code>(3*advanced + 2*intermediate + 1*basic) * num_documents</code></p>
<p>The primary caveat is that Google returns the percentage of documents for one of 3 reading levels, as well as the number of search results.  By multiplying the result count by the percent, we calculate the number of documents at the advanced, intermediate and basic reading levels.  However, we can&#8217;t simply sort our results by raw numbers alone.  For example, a school that has 100 advanced level, 800 intermediate level, and 100 basic level documents should not be ranked lower than a school that has 101 advanced level, 100 intermediate level, and 800 basic level documents.  In fact, the basic level documents negatively weights on the second school.  For this to be the case, one must apply scaling factors to each of the reading levels.  Unfortunately, these scaling factors may be selected arbitrarily, and may also be subjective.</p>
<p>Final caveat: The comparison is done on reading level and documents available online.  For a school that emphasizes publishing papers, the results will be weighted in its favor.  For a school that emphasizes the arts, the advanced reading level metric becomes less important.</p>
<p>References:<br />
<a href="http://www.utexas.edu/world/univ/alpha/">List of American Universities</a><br />
<a href="http://www.google.com/search?q=site%3Alog.largevoid.com&#038;num=10&#038;lr=&#038;ft=i&#038;cr=&#038;safe=off&#038;tbs=rl%3A1">Google Search [site:log.largevoid.com]</a></p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/12/ranking-colleges-by-reading-level/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Securing Your Internet Traffic on a Public Network</title>
		<link>http://log.largevoid.com/2010/12/securing-your-internet-traffic-on-a-public-network/</link>
		<comments>http://log.largevoid.com/2010/12/securing-your-internet-traffic-on-a-public-network/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 00:06:53 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[Scripts, Tricks and Hacks]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[firesheep]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[putty]]></category>
		<category><![CDATA[socks5]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tunnel]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=491</guid>
		<description><![CDATA[I was on a public WiFi hotspot and was worried about someone sniffing my passwords with firesheep. I went in search of a howto that would teach allow me to tunnel browser traffic to my secure home network over SSH. What I found was How To Tunnel Traffic With SSH. It is the easiest and [...]]]></description>
			<content:encoded><![CDATA[<p>I was on a public WiFi hotspot and was worried about someone sniffing my passwords with firesheep.  I went in search of a howto that would teach allow me to tunnel browser traffic to my secure home network over SSH.  What I found was <a href="http://www.makeuseof.com/tag/how-to-tunnel-traffic-with-ssh/">How To Tunnel Traffic With SSH</a>.  It is the easiest and one of the more straight-forward tunneling approaches.  It requires Firefox, a secure remote server running ssh, and the putty client.</p>
<p>The long and short of it is to set up a local SOCKS5 proxy with putty.  Simply open up putty, go to Connection>SSH>Tunnels.  Add a new forwarded port (say 1080), make it dynamic, then hit add.  Now log in to your remote machine and you have a local SOCKS5 proxy running on port 1080.  You can then point your browser to use this proxy for all your web traffic.</p>
<p>The link also mentions how to make Firefox tunnel DNS requests for added security, but I won&#8217;t go into that.</p>
<p>Happy safe browsing!</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/12/securing-your-internet-traffic-on-a-public-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python Basics</title>
		<link>http://log.largevoid.com/2010/11/python-basics/</link>
		<comments>http://log.largevoid.com/2010/11/python-basics/#comments</comments>
		<pubDate>Sat, 13 Nov 2010 03:53:29 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[decorator]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[functools]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[iter]]></category>
		<category><![CDATA[itertools]]></category>
		<category><![CDATA[list comprehension]]></category>
		<category><![CDATA[map]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[range]]></category>
		<category><![CDATA[reduce]]></category>
		<category><![CDATA[strategy pattern]]></category>
		<category><![CDATA[xrange]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=467</guid>
		<description><![CDATA[These examples have been pulled from various sources. List comprehension: Create a list from a function and filter: S = &#91;2*x for x in range&#40;101&#41; if x**2 &#62; 3&#93; Generator Define a generator: from itertools import count &#160; def generate_primes&#40;stop_at=0&#41;: primes = &#91;&#93; for n in count&#40;2&#41;: if 0 &#60; stop_at &#60; n: return # [...]]]></description>
			<content:encoded><![CDATA[<p>These examples have been pulled from various sources.</p>
<p><a href="http://en.wikipedia.org/wiki/List_comprehension#Python">List comprehension</a>:</p>
<p>Create a list from a function and filter:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">S = <span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: #66cc66;">*</span>x <span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">101</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">if</span> x<span style="color: #66cc66;">**</span><span style="color: #ff4500;">2</span> <span style="color: #66cc66;">&gt;</span> <span style="color: #ff4500;">3</span><span style="color: black;">&#93;</span></pre></div></div>

<p><a href="http://en.wikipedia.org/wiki/Python_syntax_and_semantics#Generators">Generator</a></p>
<p>Define a generator:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">itertools</span> <span style="color: #ff7700;font-weight:bold;">import</span> count
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> generate_primes<span style="color: black;">&#40;</span>stop_at=<span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>:
    primes = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> n <span style="color: #ff7700;font-weight:bold;">in</span> count<span style="color: black;">&#40;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff4500;">0</span> <span style="color: #66cc66;">&lt;</span> stop_at <span style="color: #66cc66;">&lt;</span> n:
            <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #808080; font-style: italic;"># raises the StopIteration exception</span>
        composite = <span style="color: #008000;">False</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> p <span style="color: #ff7700;font-weight:bold;">in</span> primes:
            <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> n <span style="color: #66cc66;">%</span> p:
                composite = <span style="color: #008000;">True</span>
                <span style="color: #ff7700;font-weight:bold;">break</span>
            <span style="color: #ff7700;font-weight:bold;">elif</span> p<span style="color: #66cc66;">**</span><span style="color: #ff4500;">2</span> <span style="color: #66cc66;">&gt;</span> n:
                <span style="color: #ff7700;font-weight:bold;">break</span>
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> composite:
            primes.<span style="color: black;">append</span><span style="color: black;">&#40;</span>n<span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">yield</span> n</pre></div></div>

<p>Using a generator:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> generate_primes<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:  <span style="color: #808080; font-style: italic;"># iterate over ALL primes</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> i <span style="color: #66cc66;">&gt;</span> <span style="color: #ff4500;">100</span>:
        <span style="color: #ff7700;font-weight:bold;">break</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> i</pre></div></div>

<p><a href="http://docs.python.org/library/functions.html#map">map</a> (<a href="http://docs.python.org/tutorial/datastructures.html">source</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> cube<span style="color: black;">&#40;</span>x<span style="color: black;">&#41;</span>: <span style="color: #ff7700;font-weight:bold;">return</span> x<span style="color: #66cc66;">*</span>x<span style="color: #66cc66;">*</span>x
<span style="color: #008000;">map</span><span style="color: black;">&#40;</span>cube, <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">11</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>  <span style="color: #808080; font-style: italic;"># outputs [1, 8, 27, 64, 125, 216, 343, 512, 729, 1000]</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">seq = <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">8</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">def</span> add<span style="color: black;">&#40;</span>x, y<span style="color: black;">&#41;</span>: <span style="color: #ff7700;font-weight:bold;">return</span> x+y
<span style="color: #008000;">map</span><span style="color: black;">&#40;</span>add, seq, seq<span style="color: black;">&#41;</span>  <span style="color: #808080; font-style: italic;"># outputs [0, 2, 4, 6, 8, 10, 12, 14]</span></pre></div></div>

<p><a href="http://docs.python.org/library/functions.html#reduce">reduce</a> (<a href="http://docs.python.org/tutorial/datastructures.html">source</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> add<span style="color: black;">&#40;</span>x,y<span style="color: black;">&#41;</span>: <span style="color: #ff7700;font-weight:bold;">return</span> x+y
<span style="color: #008000;">reduce</span><span style="color: black;">&#40;</span>add, <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">11</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>  <span style="color: #808080; font-style: italic;"># outputs 55</span></pre></div></div>

<p><a href="http://docs.python.org/library/functions.html#filter">filter</a> (<a href="http://docs.python.org/tutorial/datastructures.html">source</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> f<span style="color: black;">&#40;</span>x<span style="color: black;">&#41;</span>: <span style="color: #ff7700;font-weight:bold;">return</span> x <span style="color: #66cc66;">%</span> <span style="color: #ff4500;">2</span> <span style="color: #66cc66;">!</span>= <span style="color: #ff4500;">0</span> <span style="color: #ff7700;font-weight:bold;">and</span> x <span style="color: #66cc66;">%</span> <span style="color: #ff4500;">3</span> <span style="color: #66cc66;">!</span>= <span style="color: #ff4500;">0</span>
<span style="color: #008000;">filter</span><span style="color: black;">&#40;</span>f, <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">2</span>, <span style="color: #ff4500;">25</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>  <span style="color: #808080; font-style: italic;"># outputs [5, 7, 11, 13, 17, 19, 23]</span></pre></div></div>

<p><a href="http://docs.python.org/library/functions.html#iter">iter</a> (<a href="http://docs.python.org/tutorial/datastructures.html">source</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">for</span> value <span style="color: #ff7700;font-weight:bold;">in</span> sequence:
    <span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span>value<span style="color: black;">&#41;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">for</span> key <span style="color: #ff7700;font-weight:bold;">in</span> dictionary:
    value = dictionary<span style="color: black;">&#91;</span>key<span style="color: black;">&#93;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span>key, value<span style="color: black;">&#41;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">for</span> key, value <span style="color: #ff7700;font-weight:bold;">in</span> dictionary.<span style="color: black;">items</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span>key, value<span style="color: black;">&#41;</span></pre></div></div>

<p><a href="http://docs.python.org/library/functions.html#range">range</a> (<a href="http://docs.python.org/tutorial/controlflow.html">source</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">a = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'Mary'</span>, <span style="color: #483d8b;">'had'</span>, <span style="color: #483d8b;">'a'</span>, <span style="color: #483d8b;">'little'</span>, <span style="color: #483d8b;">'lamb'</span><span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>a<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">print</span> i, a<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span></pre></div></div>

<p><a href="http://docs.python.org/library/functions.html#range">xrange</a> (<a href="http://en.wikipedia.org/wiki/One-liner_program#Examples">source</a>):</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">z = <span style="color: #ff7700;font-weight:bold;">lambda</span> x, h: <span style="color: black;">&#91;</span><span style="color: #008000;">sum</span><span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>x<span style="color: black;">&#91;</span>i - j<span style="color: black;">&#93;</span> <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span> <span style="color: #66cc66;">&lt;</span>= i - j <span style="color: #66cc66;">&lt;</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>x<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> <span style="color: #ff7700;font-weight:bold;">else</span> <span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span> <span style="color: #66cc66;">*</span> h<span style="color: black;">&#91;</span>j<span style="color: black;">&#93;</span> \
<span style="color: #ff7700;font-weight:bold;">for</span> j <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">xrange</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>h<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> \
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">xrange</span><span style="color: black;">&#40;</span><span style="color: #008000;">len</span><span style="color: black;">&#40;</span>x<span style="color: black;">&#41;</span> + <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>h<span style="color: black;">&#41;</span> - <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span></pre></div></div>

<p><a href="http://wiki.python.org/moin/PythonDecorators">Decorators:</a></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">class</span> C<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:
&nbsp;
    @<span style="color: #008000;">staticmethod</span>
    @funcattrs<span style="color: black;">&#40;</span>grammar=<span style="color: #483d8b;">&quot;'@' dotted_name [ '(' [arglist] ')' ]&quot;</span>,
               status=<span style="color: #483d8b;">&quot;experimental&quot;</span>, author=<span style="color: #483d8b;">&quot;BDFL&quot;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> longMethodNameForEffect<span style="color: black;">&#40;</span>longArgumentOne=<span style="color: #008000;">None</span>,
                                longArgumentTwo=<span style="color: #ff4500;">42</span><span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;&quot;This method blah, blah.
&nbsp;
        It supports the following arguments:
        - longArgumentOne -- a string giving ...
        - longArgumentTwo -- a number giving ...
&nbsp;
        blah, blah.
&nbsp;
        &quot;&quot;&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">raise</span> NotYetImplemented</pre></div></div>

<p><a href="http://en.wikipedia.org/wiki/Strategy_pattern#Python">Strategy Pattern:</a><br />
Example usage:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">class</span> Button:
    <span style="color: #483d8b;">&quot;&quot;&quot;A very basic button widget.&quot;&quot;&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, submit_func, label<span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: black;">on_submit</span> = submit_func   <span style="color: #808080; font-style: italic;"># Set the strategy function directly</span>
        <span style="color: #008000;">self</span>.<span style="color: black;">label</span> = label
&nbsp;
<span style="color: #808080; font-style: italic;"># Create two instances with different strategies</span>
button1 = Button<span style="color: black;">&#40;</span><span style="color: #008000;">sum</span>, <span style="color: #483d8b;">&quot;Add 'em&quot;</span><span style="color: black;">&#41;</span>
button2 = Button<span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> nums: <span style="color: #483d8b;">&quot; &quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: #008000;">map</span><span style="color: black;">&#40;</span><span style="color: #008000;">str</span>, nums<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>, <span style="color: #483d8b;">&quot;Join 'em&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Test each button</span>
numbers = <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">10</span><span style="color: black;">&#41;</span>   <span style="color: #808080; font-style: italic;"># A list of numbers 1 through 9</span>
<span style="color: #ff7700;font-weight:bold;">print</span> button1.<span style="color: black;">on_submit</span><span style="color: black;">&#40;</span>numbers<span style="color: black;">&#41;</span>   <span style="color: #808080; font-style: italic;"># displays &quot;45&quot;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> button2.<span style="color: black;">on_submit</span><span style="color: black;">&#40;</span>numbers<span style="color: black;">&#41;</span>   <span style="color: #808080; font-style: italic;"># displays &quot;1 2 3 4 5 6 7 8 9&quot;</span></pre></div></div>

<p>See documentation for:</p>
<ul>
<li><a href="http://docs.python.org/library/itertools.html">itertools</a></li>
<li> <a href="http://docs.python.org/library/functools.html">functools</a></li>
</ul>
<p>This post was inspired by an item on StackOverflow: <a href="http://stackoverflow.com/questions/2573135/python-progression-path-from-apprentice-to-guru/2576240#2576240">Python Progression Path from Apprentice to Guru</a></p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/11/python-basics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Discounted Cash Flow (notes)</title>
		<link>http://log.largevoid.com/2010/09/discounted-cash-flow-notes/</link>
		<comments>http://log.largevoid.com/2010/09/discounted-cash-flow-notes/#comments</comments>
		<pubDate>Thu, 23 Sep 2010 19:18:22 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[Lessons]]></category>
		<category><![CDATA[Reference]]></category>
		<category><![CDATA[discounted present value]]></category>
		<category><![CDATA[DPV]]></category>
		<category><![CDATA[future cash flow]]></category>
		<category><![CDATA[FV]]></category>
		<category><![CDATA[risk-free rate]]></category>

		<guid isPermaLink="false">http://log.largevoid.com/?p=444</guid>
		<description><![CDATA[The following is taken from Wikipedia. Background Using DCF analysis to compute the NPV takes as input cash flows and a discount rate and gives as output a price; the opposite process – taking cash flows and a price and inferring a discount rate, is called the yield. Definitions FV = DPV * (1+i)^n DPV [...]]]></description>
			<content:encoded><![CDATA[<p>The following is taken from <a href="http://en.wikipedia.org/wiki/Discounted_cash_flow">Wikipedia</a>.</p>
<p><strong>Background</strong><br />
Using DCF analysis to compute the NPV takes as input cash flows and a discount rate and gives as output a price; the opposite process – taking cash flows and a price and inferring a discount rate, is called the yield.</p>
<p><strong>Definitions</strong><br />
FV = DPV * (1+i)^n<br />
DPV = FV/(1+i)^n = FV * (1-d)^n</p>
<p>DPV: discounted present value<br />
FV: future cash flow; nominal value of cache flow in future<br />
i: interest rate<br />
d: discount rate { i/(1+i) } ; interest rate subtracted from BoY; rather than added at end of year<br />
n: time in years before future cash flow</p>
<p>Summing multiple cash flows:<br />
DPV = SUM{t=0..N} of { FV[t]/(1+i)^t }</p>
<p><strong>An Example</strong><br />
&#8220;John Doe buys a house for $100,000. Three years later, he expects to be able to sell this house for $150,000.&#8221;</p>
<p>&#8220;the 3-year US Treasury Note rate is 5% per annum.&#8221;</p>
<p>&#8220;Using the DPV formula (FV=$150,000, i=0.05, n=3), that means that the value of $150,000 received in three years actually has a present value of $129,576 (rounded off).&#8221;</p>
<p>&#8220;Subtracting the purchase price of the house ($100,000) from the present value results in the net present value [(NPV)] of the whole transaction, which would be $29,576&#8230;&#8221;</p>
<p>&#8220;Another way of looking at the deal as the excess return achieved (over the risk-free rate) is (14.5%-5.0%)/(100%+5%) or approximately 9.0% (still very respectable). (As a check, 1.050 x 1.090 = 1.145 approximately.)&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://log.largevoid.com/2010/09/discounted-cash-flow-notes/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>Paul</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 [...]]]></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>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>Paul</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 = val ^ &#40;tmp &#62;&#62; 24&#41;; val = val ^ tmp; &#125; &#125; ptr++; [...]]]></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>Paul</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; $periods = 12*$years; return $initial [...]]]></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>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>Paul</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>Paul</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>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>Paul</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>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  log.largevoid.com/cat/reference/feed/ ) in 1.77609 seconds, on Feb 8th, 2012 at 12:39 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 8th, 2012 at 1:39 pm UTC -->
