<?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>weblog.fred</title>
	<atom:link href="http://weblog.fredalger.net/feed" rel="self" type="application/rss+xml" />
	<link>http://weblog.fredalger.net</link>
	<description>missives from a man without letters</description>
	<lastBuildDate>Thu, 06 Oct 2011 18:31:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>&#8220;Remembering Steve,&#8221; or &#8220;20 years of the Happy Mac&#8221;</title>
		<link>http://weblog.fredalger.net/2011/10/remembering-steve.html</link>
		<comments>http://weblog.fredalger.net/2011/10/remembering-steve.html#comments</comments>
		<pubDate>Thu, 06 Oct 2011 18:28:30 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[blag]]></category>
		<category><![CDATA[thoughts]]></category>
		<category><![CDATA[words]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[death]]></category>
		<category><![CDATA[inspiration]]></category>
		<category><![CDATA[quotes]]></category>

		<guid isPermaLink="false">http://weblog.fredalger.net/?p=271</guid>
		<description><![CDATA[It started with something called an &#8220;Apple II&#8221; in a darkened room at my elementary school. Oregon Trail, Odell Lake, turtle graphics, writing our first stories and printing them out. HyperCard, hours making flipbooks and puzzling through scripting on my &#8230; <a href="http://weblog.fredalger.net/2011/10/remembering-steve.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It started with something called an &#8220;Apple II&#8221; in a darkened room at my elementary school.  Oregon Trail, Odell Lake, turtle graphics, writing our first stories and printing them out.</p>
<p>HyperCard, hours making flipbooks and puzzling through scripting on my salvaged Mac SE 30 (30 for 30 meg hard drive).  Happy times spent with my friend who is also gone building new worlds, bending the machine to our will, fueling our imagination.</p>
<p>It&#8217;s what I used to write my first newsletter, print and distribute it to my 4th grade class.  The first time I&#8217;d ever see a CD drive or play a multimedia game.</p>
<p>The first computer I seriously wanted: a Color Mac Classic.  The first time I started saving my money to buy some new hardware. (Only $600!)</p>
<p><span id="more-271"></span></p>
<p>BBEdit on a Performa: my first keystrokes of HTML which launched a life of work on and love for the Internet.  Hours fixing Macs and Mac printers.  Netscape Navigator.  Disabling extensions and freeing up memory to run Prince of Persia II.</p>
<p>The first computer I&#8217;d ever see without a floppy drive.</p>
<p>My first laptop and UNIX workstation, host to thousands of lines of code, my music collection, every word I&#8217;ve written.  A tool for exploring my world.</p>
<p>It&#8217;s what I use to earn a living.  How I chat and video conference with my team around the world.  How I tend my business when I&#8217;m away from my office.</p>
<p>It&#8217;s the first computer that my children used, our tool for playing with the world of sound, video, and pictures, for learning about the universe outside our door.</p>
<p>In my hand, it&#8217;s what I use take pictures and video of my kids and share them with family, recording these fleeting moments of their youth.  It&#8217;s how I learned that you died.</p>
<p>You led a cast of thousands whose work influenced, inspired, and touched millions of lives around the globe.  Even though we never met, I can sincerely say that my world was brighter for what you did, what you dreamed, the bits of future you brought to our present.  Is our world a little dimmer now that you&#8217;ve departed?  Yes and no.</p>
<p>Yes, you are missed, and we&#8217;re sorry at the passing of a great life.  But now the mantle has passed on: it&#8217;s time for us to dream a new dream, fire up the imaginations of a new generation.  Your passing leaves a big hole, but also an opportunity to hold up a mirror and ask, &#8220;what am I doing that&#8217;s so damned important?&#8221;  Our time is short and the world aches for the next big idea, ideas that will drag us out of darkness and into that bright future which seemed your home.  It&#8217;s time to take a moment and chase after those things that bring us and others happiness and freedom; those things that ease pain and suffering and allow us each to love each other just a little more.</p>
<p>If I&#8217;ve learned anything, it&#8217;s that maybe a business can do just that; maybe we&#8217;ve completely missed the point: maybe it&#8217;s ALL about making things that make people happy and more fulfilled in their lives.  The future is bright… if we make it so.  Let&#8217;s pick up where Steve left off and invent that bright future starting now.</p>
<blockquote><p>&#8220;Twenty years from now you will be more disappointed by the things you<br />
didn&#8217;t do than by the ones you did do. So throw off the bowlines. Sail<br />
away from the safe harbor. Catch the trade winds in your sails. Explore.<br />
Dream. Discover.&#8221;<br/><br />
— Mark Twain
</p></blockquote>
<p><strong>Think different.<br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.fredalger.net/2011/10/remembering-steve.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copy and Copy JSON: essential Listener hacks.</title>
		<link>http://weblog.fredalger.net/2011/05/copy-and-copy-json-essential-listener-hacks.html</link>
		<comments>http://weblog.fredalger.net/2011/05/copy-and-copy-json-essential-listener-hacks.html#comments</comments>
		<pubDate>Tue, 10 May 2011 02:33:28 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[factor]]></category>

		<guid isPermaLink="false">https://weblog.fredalger.net/?p=257</guid>
		<description><![CDATA[Something I&#8217;ve really wanted in the Listener for a while is the ability to right-click and copy a string to the clipboard. I&#8217;ve been working around that by having my own &#8220;&#62;clipboard&#8221; word that places a single string argument on &#8230; <a href="http://weblog.fredalger.net/2011/05/copy-and-copy-json-essential-listener-hacks.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Something I&#8217;ve really wanted in the Listener for a while is the ability to right-click and copy a string to the clipboard.  I&#8217;ve been working around that by having my own &#8220;&gt;clipboard&#8221; word that places a single string argument on the clipboard — extremely handy for debugging long <span class="caps">HTTP</span> responses which get truncated at the right-side of the window.</p>
<div class="highlight">
<pre><span class="k">:</span> <span class="nf">&gt;clipboard</span><span class="nb"> </span><span class="nf">(</span> <span class="nv">str</span> <span class="nf">&#8212;</span> <span class="nf">)</span><span class="nb"></span>
<span class="nb">    </span>clipboard<span class="nb"> get </span>set-clipboard-contents<span class="nb"> </span><span class="k">;</span>
</pre>
</div>
<p>This is from Factor&#8217;s useful <a href="http://docs.factorcode.org/content/vocab-ui.clipboards.html"><code>ui.clipboards</code> vocab</a>, which is the most concise and least ugly way I&#8217;ve seen to handle clipboards in a cross-platform <span class="caps">GUI</span>.  <code>clipboard</code> is a global reference to the current clipboard object whose methods are overridden to handle the dirty details of the current platform&#8217;s clipboard.</p>
<p>Along came <a href="http://re-factor.blogspot.com/2011/05/open-url-in-listener.html">this useful post</a> about adding an &#8216;open url&#8217; command for URLs in the listener, and I saw a path to my goal: <code>ui.operations</code> and the <code>define-operation</code> word.</p>
<p>Combined with <code>unparse</code> to get a string representation of an object, this adds a &#8220;Copy&#8221; command to the Listener&#8217;s context menu for <strong>all</strong> objects:</p>
<div class="highlight">
<pre><span class="k">:</span> <span class="nf">copy</span><span class="nb"> </span><span class="nf">(</span> <span class="nv">obj</span> <span class="nf">&#8212;</span> <span class="nf">)</span><span class="nb"></span>
<span class="nb">  </span>unparse<span class="nb"> </span>&gt;clipboard<span class="nb"> </span><span class="k">;</span>

[<span class="nb"> drop </span><span class="no">t </span>]<span class="nb"> \ copy </span>H{<span class="nb"> </span>}<span class="nb"> </span>define-operation<span class="nb"></span>
</pre>
</div>
<p>In this brave new Web 2.0 world, it&#8217;s dangerous to go alone!  Take this <span class="caps">JSON</span> with you*:</p>
<div class="highlight">
<pre><span class="k">:</span> <span class="nf">copy-json</span><span class="nb"> </span><span class="nf">(</span> <span class="nv">obj</span> <span class="nf">&#8212;</span> <span class="nf">)</span><span class="nb"></span>
<span class="nb">  </span>&gt;json<span class="nb"> </span>&gt;clipboard<span class="nb"> </span><span class="k">;</span>

[<span class="nb"> </span>string?<span class="nb"> not </span>]<span class="nb"> \ </span>copy-json<span class="nb"> </span>H{<span class="nb"> </span>}<span class="nb"> </span>define-operation<span class="nb"></span>
</pre>
</div>
<p>Load up the vocab (or paste those definitions in the Listener), and voilá — the <span class="caps">GUI</span> is instantly extended with new context menu options:</p>
<p><img src="http://weblog.fredalger.net/wp-content/uploads/2011/05/Listener.png" alt="" /></p>
<p>As usual, this is all <a href="https://github.com/phred/weblog/tree/master/clipping">available on GitHub</a></p>
<p>*(Sorry for the Zelda reference, just spent a happy weekend playing a big chunk of the awesome <a href="http://www.ludumdare.com/compo/ludum-dare-20/">LD20</a> 48-hour game compo entries)</p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.fredalger.net/2011/05/copy-and-copy-json-essential-listener-hacks.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Factoring the Luhn algorithm</title>
		<link>http://weblog.fredalger.net/2011/04/factoring-the-luhn-algorithm.html</link>
		<comments>http://weblog.fredalger.net/2011/04/factoring-the-luhn-algorithm.html#comments</comments>
		<pubDate>Fri, 22 Apr 2011 14:57:51 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[blag]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[factor]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[beard&suspenders]]></category>

		<guid isPermaLink="false">https://weblog.fredalger.net/?p=235</guid>
		<description><![CDATA[I work a lot in the field of e-commerce, and have written at least two shopping carts. Anyone who has implemented any kind of payment processing probably knows about the Luhn algorithm, which is a simple test that one can &#8230; <a href="http://weblog.fredalger.net/2011/04/factoring-the-luhn-algorithm.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I work a lot in the field of e-commerce, and have written at least two shopping carts.  Anyone who has implemented any kind of payment processing probably knows about the <a href="http://en.wikipedia.org/wiki/Luhn_algorithm">Luhn algorithm</a>, which is a simple test that one can apply to a credit card number to make sure that the customer entered it correctly.</p>
<p>Factor and, I believe, <a href="http://concatenative.org">concatenative languages</a> as a whole can be very expressive when it comes to describing and implementing an algorithm.  Let&#8217;s explore this.</p>
<h2>Meet the Luhn</h2>
<p>First, let&#8217;s look at an <a href="http://en.wikipedia.org/wiki/Luhn_algorithm#Informal_explanation">informal explanation of the algorithm</a></p>
<blockquote>
<p>The formula verifies a number against its included check digit, which is usually appended to a partial account number to generate the full account number. This account number must pass the following test:</p>
<ol>
<li>Counting from the check digit, which is the rightmost, and moving left, double the value of every second digit.</li>
<li>Sum the digits of the products (eg, <code>10 =&gt; (1 + 0) =&gt; 1</code>, <code>14 =&gt; (1 + 4) =&gt; 5</code>) together with the undoubled digits from the original number.</li>
<li>If the total modulo 10 is equal to 0 (if the total ends in zero) then the number is valid according to the Luhn formula; else it is not valid.
</p></blockquote>
</li>
</ol>
<h2>The first whack</h2>
<div class="highlight">
<pre><span class="k">:</span> <span class="nf">luhn-check</span><span class="nb"> </span><span class="nf">(</span> <span class="nv">number-seq</span> <span class="nf">&#8212;</span> <span class="nv">passes?</span> <span class="nf">)</span><span class="nb"></span>
<span class="nb">    reverse                </span><span class="c">#! Moving from right to left,</span><span class="nb"></span>
<span class="nb">    </span>double-every-other<span class="nb">     </span><span class="c">#! double every other digit.</span><span class="nb"></span>
<span class="nb">    </span>sum-digits<span class="nb">             </span><span class="c">#! Add the digits of the sequence, then</span><span class="nb"></span>
<span class="nb">    </span>multiple-of-ten?<span class="nb"> </span><span class="k">; </span><span class="nb">    </span><span class="c">#! test that the result is evenly divisible by 10.</span><span class="nb"></span>
</pre>
</div>
<p>The Factor description of the algorithm looks like a close approximation to the English description of the same.  Interestingly, if you enter that word definition into Factor&#8217;s listener (i.e. <span class="caps">REPL</span>), Factor will note that <code>double-every-other</code>, <code>sum-digits</code>, and <code>multiple-of-ten?</code> are unknown words, however, you can &#8220;defer&#8221; the definition of those words and Factor will accept the definition.  Pause for a moment here: Factor accepts without question words that it can&#8217;t actually evaluate or run which lets me start with this simple top-level definition and &#8220;fill in the blanks&#8221; as I go.</p>
<h2>Craft the parts.</h2>
<p>First, we need a word to double every other value in a sequence.  That is, given the sequence <code>{ 1 2 3 4 5 6 }</code>, we should get the result <code>{ 1 4 3 8 5 12 }</code>.</p>
<p>Well, Factor supports a number of Lisp-like sequence combinators so this should be simple:</p>
<div class="highlight">
<pre><span class="k">:</span> <span class="nf">double-every-other</span><span class="nb"> </span><span class="nf">(</span> <span class="nv">seq</span> <span class="nf">&#8212;</span> <span class="nv">seq-doubled</span> <span class="nf">)</span><span class="nb"></span>
<span class="nb">    </span>[<span class="nb"> </span>odd?<span class="nb"> </span>[<span class="nb"> </span><span class="mi">2 </span><span class="o">* </span>]<span class="nb"> when </span>]<span class="nb"> map-index </span><span class="k">;</span>
</pre>
</div>
<p>For those new to Factor, <code>[ … ]</code> or &#8220;quotation&#8221; is the equivalent of <code>(lambda … …)</code> or <code>function (…) {…}</code> in your language of choice; that is, it defines an anonymous function. (For those who care about such linguistic details, &#8220;scope&#8221; or lexical bindings are an optional feature in Factor, in the <a href="http://docs.factorcode.org/content/vocab-locals.html">locals vocab</a>).  Since Factor is concatenative, parameter passing is implicit and we don&#8217;t have to name or count the quotation&#8217;s arguments &#8212; Factor will infer them at compile time and warn if the program doesn&#8217;t add up.</p>
<p>Whereas <a href="http://docs.factorcode.org/content/word-map,sequences.html"><code>map</code></a> calls the quotation with each element of a sequence, <a href="http://docs.factorcode.org/content/word-map-index,sequences.html"><code>map-index</code></a> passes both the element and its index into the quotation: perfect for modifying every other index with the <code>odd?</code> predicate.</p>
<p>It&#8217;s almost readable as English: &#8220;Given a sequence, produce a new sequence, as so: if an element is at an odd index in the original sequence then double that element in the new sequence.&#8221;  Yes, it sounds a bit stilted when read aloud, but it concisely and accurately confers the idea to the listener.</p>
<p>A few quick tests in the listener shows that this word works as expected.</p>
<p>Next we need a word that sums the digits of a sequence.  That is, for the sequence <code>{ 1, 11, 5 }</code>, this word should produce the sum <code>(1 + (1 + 1) + 5) = 8</code>.</p>
<p>Well, the <code>sum</code> word in Factor adds the numbers in a sequence together, but we need to treat two-digit numbers specially.  Using integer arithmetic, the way to sum the digits of a two-digit number is to divide the number by 10 (<code>num / 10</code>) and add the remainder (<code>num mod 10</code>).  Handily, Factor provides a <code>/mod</code> (read &#8220;divmod&#8221;) word which does both in one step.  Let&#8217;s have a go at <code>sum-digits</code>:</p>
<div class="highlight">
<pre><span class="k">:</span> <span class="nf">sum-digits</span><span class="nb"> </span><span class="nf">(</span> <span class="nv">seq</span> <span class="nf">&#8212;</span> <span class="nv">sum</span> <span class="nf">)</span><span class="nb"></span>
<span class="nb">   </span>[<span class="nb"> </span><span class="mi">10 </span><span class="nb">/mod </span><span class="o">+ </span>]<span class="nb"> map sum </span><span class="k">;</span>
</pre>
</div>
<p>Nothing surprising there. &#8220;Produce a new sequence as so: for each element of the sequence, apply <code>/mod</code> word to get the quotient and remainder, then add them together, placing the result in the new sequence.  Sum the numbers in the new sequence.&#8221; Again, stilted, but readable.</p>
<p>On to the last word: <code>multiple-of-ten?</code>.  This is simple, test if a number is evenly divisible by 10 &#8212; that is, the remainder of dividing the number by 10 is 0, or more simply: <code>num mod 10 == 0</code>.</p>
<div class="highlight">
<pre><span class="k">:</span> <span class="nf">multiple-of-ten?</span><span class="nb"> </span><span class="nf">(</span> <span class="nv">n</span> <span class="nf">&#8212;</span> <span class="nv">?</span> <span class="nf">)</span><span class="nb"></span>
<span class="nb">    </span><span class="mi">10 </span><span class="nb">mod </span><span class="mi">0 </span><span class="o">= </span><span class="k">;</span>
</pre>
</div>
<p>Very small, and easy to visually inspect and test.</p>
<h2>Now we&#8217;re cooking with Luhn!</h2>
<p>Well, that&#8217;s actually all there is to write; we&#8217;ve implemented all the parts the Luhn algorithm.  The astounding thing is that we started with a simple definition and implemented the entire algorithm <i>without changing the original definition</i>!</p>
<h2>A thought experiment</h2>
<p>Imagine, as a Python or C++ programmer, if someone handed you a definition of a function and said &#8220;this definition can&#8217;t be changed, now implement all of the functions it calls.&#8221;  In order to meet their original syntactic definition, I&#8217;d be hard-pressed and restricted in the features that I could use to implement the solution.  If they used classes and OO-style code, I&#8217;d be stuck with the hierarchy they implied or I&#8217;d need to start hacking around them with templating, macros, monkey patching, or other such self abuse.  Even if they didn&#8217;t use those features of the language, I&#8217;d be bound by the function calls and parameter passing in the original definition, which might make my life very difficult as I wrangle the data flow to produce their intended result.</p>
<p>Whereas, in Factor or Forth, handing a well-crafted but fixed definition of a word to someone can lead to an elegant solution that not only <i>looks</i> correct but <i>runs</i> correctly.</p>
<h2>Don&#8217;t let me be misunderstood</h2>
<p>Truthfully, I re-factored the words in this example several times (see the my commit history) before coming to this tidy little definition. I think it has to be experienced to be understood &#8212; rearranging words and testing them in an interactive environment feels natural and simply right.  To paraphrase Chuck Moore, author of the Forth language, (speaking of implementing a Bluetooth stack), &#8220;first you have to figure out what they&#8217;re actually doing [in the algorithm], then you simplify the definition and fill in the parts.&#8221;</p>
<p>There is some ineffable &#8220;ah hah!&#8221; moment that comes when writing a well-factored program which makes me smile inside, some intangible correctness of having a readable definition that not only <i>looks</i> right but <b>is</b> right.</p>
<p>Look at <a href="http://en.wikipedia.org/wiki/Luhn_algorithm#Verification_of_the_check_digit">the examples</a> and tell me that a single one of those is more clear than this:</p>
<div class="highlight">
<pre><span class="k">:</span> <span class="nf">luhn-check</span><span class="nb"> </span><span class="nf">(</span> <span class="nv">number-seq</span> <span class="nf">&#8212;</span> <span class="nv">passes?</span> <span class="nf">)</span><span class="nb"></span>
<span class="nb">    reverse                </span><span class="c">#! Moving from right to left,</span><span class="nb"></span>
<span class="nb">    </span>double-every-other<span class="nb">     </span><span class="c">#! double every other digit.</span><span class="nb"></span>
<span class="nb">    </span>sum-digits<span class="nb">             </span><span class="c">#! Add the digits of the sequence, then</span><span class="nb"></span>
<span class="nb">    </span>multiple-of-ten?<span class="nb"> </span><span class="k">; </span><span class="nb">    </span><span class="c">#! test that the result is evenly divisible by 10.</span><span class="nb"></span>
</pre>
</div>
<p>Granted, those aren&#8217;t the most shining examples of implementations (hell, I&#8217;ve written stuff equally confusing), that this is a trivial algorithm, and maybe I&#8217;m getting old, but nowadays all of those just look like esoteric nonsense. (Really, look at the Java and Python implementations; way too clever for their own good).</p>
<p>Now if only I could grow a decent beard to go with these suspenders…</p>
<p>The source to this post is <a href="https://github.com/phred/weblog/tree/master/luhn">available on GitHub</a></p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.fredalger.net/2011/04/factoring-the-luhn-algorithm.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>This is your weblog on Dexy!</title>
		<link>http://weblog.fredalger.net/2011/03/this-is-your-weblog-on-dexy.html</link>
		<comments>http://weblog.fredalger.net/2011/03/this-is-your-weblog-on-dexy.html#comments</comments>
		<pubDate>Sun, 27 Mar 2011 09:37:08 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[factor]]></category>
		<category><![CDATA[dexy]]></category>
		<category><![CDATA[docs]]></category>
		<category><![CDATA[oembed]]></category>
		<category><![CDATA[pygments]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[weblog]]></category>

		<guid isPermaLink="false">https://weblog.fredalger.net/?p=204</guid>
		<description><![CDATA[Well, this last weekend, instead of writing code or blog posts, I fiddled with Dexy. And I&#8217;ve come to one simple conclusion: Dexy is freakin&#8217; awesome! Dexy is a documentation writer&#8217;s dream tool: it takes words about code, pictures, and &#8230; <a href="http://weblog.fredalger.net/2011/03/this-is-your-weblog-on-dexy.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Well, this last weekend, instead of writing code or blog posts, I fiddled with <a href="http://dexy.it">Dexy</a>.  And I&#8217;ve come to one simple conclusion:</p>
<h2>Dexy is freakin&#8217; awesome!</h2>
<p>Dexy is a documentation writer&#8217;s dream tool: it takes words about code, pictures, and original unchanged source code and generates absolutely gorgeous documentation.  In fact, Dexy generated the markup for this entire post from just a few small files and automatically posted it to my WordPress blog. Now <strong>that</strong> is utility!</p>
<p>Here is a Factor script:</p>
<div class="highlight">
<pre><span class="c">! Copyright &#169; 2011 Your name.</span><span class="nb"></span>
<span class="c">! See http://factorcode.org/license.txt for <span class="caps">BSD</span> license.</span><span class="nb"></span>
<span class="kn"><span class="caps">USING</span>:</span> <span class="nn">http.client</span> <span class="nn">json.reader</span> <span class="nn">kernel</span> <span class="nn">prettyprint</span> <span class="nn">strings</span> <span class="nn">multiline</span> <span class="k">;</span><span class="nb"></span>
<span class="kn">IN:</span> <span class="nn">weblog.dexyfied</span><span class="nb"></span>

<span class="c">#! @export section-1</span>
<span class="k">:</span> <span class="nf">test1.</span><span class="nb"> </span><span class="nf">(</span> <span class="nf">&#8212;</span> <span class="nf">)</span><span class="nb"></span>
<span class="nb">    </span><span class="s">&quot;http://oohembed.com/oohembed/?url=http%3A//www.flickr.com/photos/fuffer2005/2435339994/&quot;</span><span class="nb"></span>
<span class="nb">    </span>http-get<span class="nb"> nip &gt;string </span>json&gt;<span class="nb"> </span>.<span class="nb"> </span><span class="k">;</span>
</pre>
</div>
<p>See that funky @export comment in there?  That lets Dexy pull out just a small section of that script:</p>
<div class="highlight">
<pre><span class="k">:</span> <span class="nf">test1.</span><span class="nb"> </span><span class="nf">(</span> <span class="nf">&#8212;</span> <span class="nf">)</span><span class="nb"></span>
<span class="nb">    </span><span class="s">&quot;http://oohembed.com/oohembed/?url=http%3A//www.flickr.com/photos/fuffer2005/2435339994/&quot;</span><span class="nb"></span>
<span class="nb">    </span>http-get<span class="nb"> nip &gt;string </span>json&gt;<span class="nb"> </span>.<span class="nb"> </span><span class="k">;</span>
</pre>
</div>
<p>I even got simple interactive Factor sessions going:</p>
<div class="highlight">
<pre>( scratchpad ) <span class="caps">USE</span>: weblog.dexyfied
( scratchpad ) test1.
H{
    { &quot;version&quot; &quot;1.0&quot; }
    { &quot;provider_name&quot; &quot;Flickr&quot; }
    { &quot;width&quot; &quot;300&quot; }
    { &quot;height&quot; &quot;300&quot; }
    { &quot;author_name&quot; &quot;fuffer&quot; }
    { &quot;title&quot; &quot;echo 2&quot; }
    { &quot;cache_age&quot; 3600 }
    { &quot;type&quot; &quot;photo&quot; }
    {
        &quot;url&quot;
        &quot;http://farm4.static.flickr.com/3092/2435339994_4ab42c3c20.jpg&quot;
    }
    { &quot;provider_url&quot; &quot;http://www.flickr.com/&quot; }
    { &quot;author_url&quot; &quot;http://www.flickr.com/photos/fuffer2005/&quot; }
}
( scratchpad ) 
</pre>
</div>
<p>That&#8217;s the result of running this Factor program:</p>
<div class="highlight">
<pre><span class="kn"><span class="caps">USE</span>:</span> <span class="nn">weblog.dexyfied</span><span class="nb"></span>
test1.<span class="nb"></span>
</pre>
</div>
<p>It&#8217;s re-generated each time that the file changes: no bitrot, just exactly what happens when you type that code into the Factor listener, always in sync with the code on disk.  This is sort of like <a href="http://en.wikipedia.org/wiki/Literate_Programming">Literate Programming</a> but without doing weird things to the source code while retaining the ability to structure the documentation like, well, a document.</p>
<p>Still a bunch of bugs with the interactive handler, and the splitting of Factor &#8220;sections&#8221; is a hack, but I hope to improve these things as I go.  Already, this beats the old &#8220;copy-and-paste&#8221; approach by a factor of approximately 10 <a href="http://www.urbandictionary.com/define.php?term=A%20Jillion">jillion.</a>  Take a look at the <a href="http://github.com/phred/weblog/blob/master/dexyfied/">source to this post.</a></p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.fredalger.net/2011/03/this-is-your-weblog-on-dexy.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sorting in Factor</title>
		<link>http://weblog.fredalger.net/2011/02/sorting-in-factor.html</link>
		<comments>http://weblog.fredalger.net/2011/02/sorting-in-factor.html#comments</comments>
		<pubDate>Sat, 05 Feb 2011 09:10:15 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[blag]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[factor]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://weblog.fredalger.net/?p=195</guid>
		<description><![CDATA[So, mrjbq7&#8242;s post with words to find the maximum and minimum of a sequence of tuples got me thinking, and playing, and reading the Factor docs: all good things! I started with his test data: TUPLE: person name age ; &#8230; <a href="http://weblog.fredalger.net/2011/02/sorting-in-factor.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So, mrjbq7&#8242;s <a href="http://re-factor.blogspot.com/2011/02/maximumminimum.html">post</a> with words to find the maximum and minimum of a sequence of tuples got me thinking, and playing, and reading the Factor docs: all good things!  I started with his test data:</p>
<pre><code>    TUPLE: person name age ;
    CONSTANT: PEOPLE {
        T{ person f "Jim" 30 }
        T{ person f "Sally" 27 }
        T{ person f "Rebecca" 32 }
        T{ person f "James" 28 }
        T{ person f "Benjamin" 22 }
    }
</code></pre>
<p>So, the words from his vocab let me say:</p>
<pre><code>( scratchpad ) PEOPLE [ age&gt;&gt; ] maximum .
T{ person f "Rebecca" 32 }

( scratchpad ) PEOPLE [ name&gt;&gt; length ] minimum .
T{ person f "Jim" 30 }
</code></pre>
<p>My first idea was, &#8220;hey, couldn&#8217;t I represent this operation as a sequence?&#8221; since, if it was a kind of sequence then I could use sequence operations like <code>sum</code> and <code>map</code> on the result.  Looking back, that really wasn&#8217;t a good idea, for reasons I&#8217;ll discuss below, but I <a href="https://github.com/phred/weblog/blob/master/seq-by/seq-by.factor">made it work anyway</a>:</p>
<pre><code>    ( scratchpad ) PEOPLE [ name&gt;&gt; length ] seq-by
    T{ seq-by f ~array~ ~quotation~ }
    ( scratchpad ) infimum
    { 3 T{ person { name "Jim" } { age 30 } } }
</code></pre>
<p>This uses an underlying assumption about comparisons between sequences: they are compared by their first non-matching elements or, if all elements up to the length of the shortest sequence were equal, then they are compared by their lengths.  How do I know?  By looking at the help for <a href="http://docs.factorcode.org/content/word-__lt__%3D__gt__%2Cmath.order.html">generic word &lt;=&gt;</a> as implemented by the <code>sequence</code> class:</p>
<pre><code>    USING: kernel math.order sequences sequences.private ;
    M: sequence &lt;=&gt;
        [ mismatch ] 2keep pick
        [ 2nth-unsafe &lt;=&gt; ] [ [ length ] compare nip ] if ;
</code></pre>
<p><code>mismatch</code> does the first part, comparing the elements of the sequences, outputting the first non-matching index or <code>f</code> if the end of either sequence is reached.  The <code>if</code> is a little bit tricky, but if <code>mismatch</code> outputs a non-false value, then <code>2nth-unsafe</code> grabs the <code>nth</code> element from each sequence (without bounds checking, hence <code>-unsafe</code>) and then calls <code>&lt;=&gt;</code> on those elements.</p>
<p>This is the power of the Factor&#8217;s online help system and a glance at the underlying power of the language: the definitions of all words are not only known by the system, but available in a human-readable format, and the definitions are all <a href="http://en.wikipedia.org/wiki/Hyperlink">hyperlinked</a> to other definitions.  Nothing I&#8217;ve yet used can touch this.</p>
<p>Back to the topic at hand: we just made up a virtual sequence called <code>seq-by</code> that applies a quotation to each element of the underlying sequence when asked.  Here&#8217;s <code>seq-by</code>&#8216;s implementation of the <code>nth</code> generic word:</p>
<pre><code>TUPLE: seq-by seq quot ;
INSTANCE: seq-by sequence

M: seq-by nth ( n seq -- elt )
    [ seq&gt;&gt; nth ]
    [ seq&gt;&gt; nth ]
    [ nip quot&gt;&gt; ] 2tri
    call( elt -- elt' ) swap 2array ;
</code></pre>
<p><code>seq-by</code> wraps around another sequence, stored in the <code>seq</code> slot.  It also stores a quotation that should be applied to each element in the <code>quot</code> slot.  The <code>nth</code> word for <code>seq-by</code> says: grab the <code>nth</code> element of the underlying sequence, put it on the stack twice, then call <code>quot</code> on the top value of the stack, then store the whole result into a two-element array.</p>
<p>This is kind of cool, as the values in the sequence get re-calculated each time <code>nth</code> is called.  But really, what have I done here?  I&#8217;ve re-implemented <code>map</code> as an object that follows the <code>sequence</code> protocol which, while interesting for me, is probably not all that useful or clear.  When am I going to want to sum up the ages of everyone in the group?  Or when am I going to want to go person-by-person in order of age?  I conceivably might want to do one of those things, but then if I do, I think the next approach is a lot clearer.</p>
<p>In fact, there&#8217;s some built-in fun in Factor&#8217;s <code>sorting.slots</code> vocabulary that handles just what we&#8217;re trying to accomplish here: sorting our <code>person</code> objects by the values of their slots.</p>
<pre><code>    ( scratchpad ) PEOPLE { { age&gt;&gt; &lt;=&gt; } } sort-by
    --- Data stack:
    { ~person~ ~person~ ~person~ ~person~ ~person~ }
    ( scratchpad ) .
    {
        T{ person { name "Benjamin" } { age 22 } }
        T{ person { name "Sally" } { age 27 } }
        T{ person { name "James" } { age 28 } }
        T{ person { name "Jim" } { age 30 } }
        T{ person { name "Rebecca" } { age 32 } }
    }
</code></pre>
<p><code>sort-by</code> is cool in that it takes a sequence of { <code>slot-name</code> <code>comparator</code> } pairs, so you can have a cascading sort across multiple columns of the objects.  In the case above, I just want to sort by <code>age</code>, in natural order (1, 2, 3&#8230;).  After sorting, the first element is guaranteed to be the one with the lowest <code>age</code> and the last value is guaranteed to be the one with the highest.</p>
<p>Now, back to another example, how about finding person with the shortest or longest name?  First, we&#8217;re going to need a name comparator.</p>
<pre><code>    :: length&lt;=&gt; ( obj1 obj2 -- &lt;=&gt; ) obj1 length obj2 length &lt;=&gt; ;
</code></pre>
<p>I used the <code>locals</code> vocab just to make this a little more clear, and because I&#8217;m feeling lazy at the moment: get the length of the first thing, then the second thing, then call <code>&lt;=&gt;</code>.  If passed two strings, or two sequences, this will compare them based on their length alone instead the usual behavior of <code>&lt;=&gt;</code> for sequences mentioned above.</p>
<p>Now, to call <code>sort-by</code>:</p>
<pre><code>    ( scratchpad ) PEOPLE { { name&gt;&gt; length&lt;=&gt; } } sort-by
    --- Data stack:
    { ~person~ ~person~ ~person~ ~person~ ~person~ }
    ( scratchpad ) .
    {
        T{ person { name "Jim" } { age 30 } }
        T{ person { name "Sally" } { age 27 } }
        T{ person { name "James" } { age 28 } }
        T{ person { name "Rebecca" } { age 32 } }
        T{ person { name "Benjamin" } { age 22 } }
    }
</code></pre>
<p>Not bad!  Only one new word.  A brief discussion of efficiency: <code>sort</code> is a merge sort, meaning it&#8217;s O(N log N) at worst.  Finding the minimum or maximum of an unsorted sequence is O(N).  In practice, though, I don&#8217;t give a fig about order of complexity, nor about any performance penalties incurred by the underlying language or machine model.</p>
<p>What matters to me, then?  Well, in this case, a couple of things: using the tools that I already have in the standard library, and writing code that&#8217;s readable and meaningful — both now and when I have to maintain this sucker in a few weeks, months, or years.  Let&#8217;s say, extending the above example, that our program talks about the &#8216;oldest&#8217; of a group of people often, in that case it makes sense to make a new word:</p>
<pre><code>: oldest ( seq -- elt )
    #! ....
</code></pre>
<p>Then we can say things like, &#8220;get me the name of the oldest person:&#8221;</p>
<pre><code>PEOPLE oldest name&gt;&gt;
</code></pre>
<p>Or, in idiomatic English, &#8220;Of those people, who is the oldest one, and can you tell me their name?&#8221;</p>
<p>The beauty of Factor and other concatenative languages is that it doesn&#8217;t matter if <code>oldest</code> is implemented in terms of <code>maximum</code>, <code>minimum</code>, <code>sort-by</code>, or some other method. Instead, we have a single word that clearly expresses the intent of what we want to do: find the oldest person in a group.</p>
<p>This kind of thing is usually written as an expression or series of statements in imperative languages:</p>
<pre><code>    var oldest_persons_name = people.sort().pop().name; // Find the oldest person, get their name

    // OK, we wrote a helper method, this is a little better:
    var oldest_persons_name = this.oldest_person().name;
</code></pre>
<p>Already, the code is getting messy, and the intent is getting buried in so much useless noise and repetition. This kind of thinking also leads to rampant copy-and-pasting of common idioms, or elaborate preprocessor macros, or template programming and other bastard OOP paradigms replete with heinous dependency graphs.</p>
<p>What happens if I need to replace <code>PEOPLE</code> with a result cursor from a database?  Or if I now want to sort lists of <code>pets</code>?  In Factor, it&#8217;s all the same, <code>oldest</code> will work on either of those things, presuming they are sequences of objects.  In the languages of the day, any of those changes will require changing a lot of code, or maybe adjusting my class hierarchy, all things that are gonna derail me from the task at hand.  Not only that, but the code will likely get harder to read, and even end up less flexible than before.</p>
<p>Philosophical question for the night: why does this happen so much in programs?  Is it something about the programmers or something about the languages or something about the nature of programming itself?</p>
<p>I can&#8217;t produce a qualified answer to those questions, but I know this: once you go concatenative, you never go back. :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.fredalger.net/2011/02/sorting-in-factor.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>QR codes in Factor</title>
		<link>http://weblog.fredalger.net/2011/01/qr-codes-in-factor.html</link>
		<comments>http://weblog.fredalger.net/2011/01/qr-codes-in-factor.html#comments</comments>
		<pubDate>Mon, 31 Jan 2011 08:04:03 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[blag]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[factor]]></category>
		<category><![CDATA[gcharts]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[qrcode]]></category>

		<guid isPermaLink="false">http://weblog.fredalger.net/?p=187</guid>
		<description><![CDATA[Wow, so Factor is one of the most amazing programming languages that I’ve ever used. And I’ve used a bucketful of them in my checkered past, that’s for sure. But there’s something about using this odd little stack-based “concatenative” language &#8230; <a href="http://weblog.fredalger.net/2011/01/qr-codes-in-factor.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Wow, so <a href="http://factorcode.org">Factor</a> is one of the most amazing programming languages that I’ve ever used.  And I’ve used a bucketful of them in my checkered past, that’s for sure.  But there’s something about using this odd little stack-based “concatenative” language that’s really got me going on a creative high.</p>
<p>Perhaps it’s the interactivity, perhaps it’s how cleanly and concisely concepts can be expressed; I can’t quite define what it is that makes me so happy with this.  Not only that, the people in the community are amazing, helpful, friendly, and <em>really freaking smart!</em></p>
<p>Anyway, I was playing around and brainstorming, and somehow got on the topic of barcodes, and ran across the Zebra Crossing or <a href="http://zxing.appspot.com/">zxing demo page</a> which uses the Google Charts API to create all manner of useful <a href="http://en.wikipedia.org/wiki/QR_code">QR (“Quick Response”) Codes</a>.  They look like this:</p>
<p><img class="alignnone" src="http://chart.apis.google.com/chart?cht=qr&amp;chs=350x350&amp;chl=http://factorcode.org" alt="" width="210" height="210" /></p>
<p>That’s a 2-dimensional barcode representing the URL <a href="http://factorcode.org">http://factorcode.org</a>. If you have a mobile phone that groks these, you can take a picture with the phone’s camera and be automatically taken to that URL. I use <a href="http://itunes.apple.com/us/app/redlaser/id312720263?mt=8">RedLaser</a> on my iPhone, because it’s not built into the platform like with Android phones. (In fact the ZXing library is used in the Android software to parse these codes; pretty nifty, eh?)</p>
<p>Anyhow as you can see if you hit the <a href="http://zxing.appspot.com/">zxing demo page</a>, you can stick a URL, a calendar event, a contact, plain text, a “send sms to” command, and more on one of these codes.</p>
<p>I had just gotten a scrap of paper with my friend’s phone number on it and, programmer that I am, I decided that the best way to enter this into my phone was to write some software to generate a QR code that I could scan on my phone and then add to my contact book.  (Yep, all that instead of just taking 20 seconds to type it in.  I am broken.)</p>
<p>So, first stop was making a <code>qr-image</code> word that, given a string, would fetch the image of the QR code from the GCharts API. After all, these little symbols are just computer vision-friendly encodings of unicode characters.  Yep, just tested that, “Good morning” in Japanese scans perfectly.</p>
<p><img class="size-full wp-image-188 alignnone" title="&quot;おはよう&quot; qr-image image." src="http://weblog.fredalger.net/wp-content/uploads/2011/01/Screen-shot-2011-01-31-at-2.30.49-.png" alt="" width="245" height="294" /></p>
<p>To get the phone to recognize contact info, it’s got to be encoded using the <a href="http://www.nttdocomo.co.jp/english/service/imode/make/content/barcode/function/application/addressbook/index.html">MECARD</a> format, which is an abbreviated <a href="http://en.wikipedia.org/wiki/VCard">vCard</a>. (As noted <a href="http://code.google.com/p/zxing/wiki/BarcodeContents">here</a>, vCard is way too chatty for a tiny barcode).</p>
<p>The end result?  A <code>mecard</code> vocabulary to talk about contact information and generate the MECARD-formatted string to pass to <code>qr-image</code> and generate the QR image.</p>
<pre><code>T{ mecard { name "Fred Alger" } { email "fred@fredalger.net" } { nickname "@_phred" } } &gt;mecard
--&gt; "MECARD:N:Fred Alger;EMAIL:fred@fredalger.net;NICKNAME:@_phred;;"
qr-image image.
</code></pre>
<p><img src="http://chart.apis.google.com/chart?cht=qr&amp;chs=350x350&amp;chl=MECARD:N:Fred%20Alger%3BEMAIL:fred%40fredalger.net%3BNICKNAME:%40_phred%3B%3B" alt="" /></p>
<p>I’d be lying if I said that it worked the first time, but it took me less than an hour to implement.  Such is the power of Factor.</p>
<p>Remember that I said that the Factor community are all really smart?  While I was implementing my little amusement, <a href="http://re-factor.blogspot.com">mrjbq7</a> just happened to write a <a href="https://github.com/mrjbq7/re-factor/tree/master/google/charts">vocabulary for the Google Charts API</a>.  This is gonna be epic when it’s done, and it’s going to let me replace my <code>qr-image</code> word with just <code>&lt;qr-code&gt; chart</code>, as well as generate all manner of graphs from my Factor primitives.  So awesome.</p>
<p>OK, enough said.  <a href="https://github.com/phred/qr-codes/">Check it all out on GitHub</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.fredalger.net/2011/01/qr-codes-in-factor.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Pedal-powered machines</title>
		<link>http://weblog.fredalger.net/2010/10/pedal-powered-machines.html</link>
		<comments>http://weblog.fredalger.net/2010/10/pedal-powered-machines.html#comments</comments>
		<pubDate>Sun, 10 Oct 2010 17:00:42 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[thoughts]]></category>

		<guid isPermaLink="false">http://weblog.fredalger.net/?p=185</guid>
		<description><![CDATA[Check this out: http://www.processedworld.com/carlsson/nowtopian/technology/bike-stencils-bicimakinas-pedal-powered-tools-in-guadalajara Sketches and prototypes for bicycle powered machines — a blender, a food processor, a grain grinder, a lathe, even a washing machine!  As high-tech as my world is, there would be something deliciously satisfying about pedaling &#8230; <a href="http://weblog.fredalger.net/2010/10/pedal-powered-machines.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Check this out:</p>
<p>http://www.processedworld.com/carlsson/nowtopian/technology/bike-stencils-bicimakinas-pedal-powered-tools-in-guadalajara</p>
<p>Sketches and prototypes for bicycle powered machines — a blender, a food processor, a grain grinder, a lathe, even a washing machine!  As high-tech as my world is, there would be something deliciously satisfying about pedaling a bike to wash my clothes, then hanging them to dry.</p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.fredalger.net/2010/10/pedal-powered-machines.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>bzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzrt</title>
		<link>http://weblog.fredalger.net/2010/09/bzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzrt.html</link>
		<comments>http://weblog.fredalger.net/2010/09/bzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzrt.html#comments</comments>
		<pubDate>Sun, 05 Sep 2010 11:05:42 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[blips]]></category>

		<guid isPermaLink="false">http://weblog.fredalger.net/?p=182</guid>
		<description><![CDATA[Ahem. This has been a test of the emergency broadcasting system.  If this were a real emergency, you wouldn&#8217;t be checking this blog.  Thank you.  bzzzzzzzzzzzzzrrrrrrrrrrrrrrrrrrrrrrrt]]></description>
			<content:encoded><![CDATA[<p>Ahem.</p>
<p>This has been a test of the emergency broadcasting system.  If this were a real emergency, you wouldn&#8217;t be checking this blog.  Thank you.  bzzzzzzzzzzzzzrrrrrrrrrrrrrrrrrrrrrrrt</p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.fredalger.net/2010/09/bzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzrt.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reflections on one week out of the home office</title>
		<link>http://weblog.fredalger.net/2010/06/reflections-on-one-week-out-of-the-home-office.html</link>
		<comments>http://weblog.fredalger.net/2010/06/reflections-on-one-week-out-of-the-home-office.html#comments</comments>
		<pubDate>Fri, 25 Jun 2010 13:31:36 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[blag]]></category>
		<category><![CDATA[thoughts]]></category>
		<category><![CDATA[home office]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[waffles]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://weblog.fredalger.net/?p=161</guid>
		<description><![CDATA[In which I discuss the recent move out of my home office, and reflect upon the benefits of the change. <a href="http://weblog.fredalger.net/2010/06/reflections-on-one-week-out-of-the-home-office.html">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been almost two years that I&#8217;ve worked out of my house, and I&#8217;ve just recently moved back out into an office.  &#8221;Why?&#8221;, you may well ask.  Sites like <a href="http://zenhabits.net">Zen Habits</a> and <a href="http://lifehacker.com">Lifehacker </a>extol the virtues of telecommuting.  And, indeed, I am one of the rare and privileged few who can do my job entirely from home.</p>
<p>Why then, would I want to move out?  I have a few reasons, but the main thing is that it&#8217;s been a positive change to my daily routine.  I am not, by nature, an extremely disciplined person (still learning) and, with the main office on the West Coast and me three hours ahead on the East, it became far too easy to slip into a pattern of sleeping in until 10, working through the afternoon, taking a little time for dinner with the family, and then staying up late to finish the day&#8217;s work.  Kinda sloppy, in my opinion &#8212; I ignored the sage advice to set a schedule for my work, set definite office hours and stick to them.  For one thing, I have a hard thing getting up early if all I have to do is go across the hall and sit down at my computer to get to work.</p>
<p>I have been, and am growing out of, a habit of intense procrastination.  Procrastination served me well in high school, because I knew that no matter how much I slacked off, I could always get everything done at the last minute.  In college, this didn&#8217;t work so well, and in real life, it works not at all.  In fact, when working from home, the ease of going to work became another way to procrastinate: well, I can take a few more minutes for breakfast, do a couple more chores, then I&#8217;ll be really ready to sit down and work.  At least, that&#8217;s what I told myself.</p>
<p>Also, I have three small children and a wife at home, so there&#8217;s a whole cabin fever aspect going on when I  work at home every single day.</p>
<p>In any case, simply placing the tools that I need for my work 6 miles away has been a huge relief to my mind.  Last week, after setting up my computer at the office and going home, I felt a burden lift from my shoulders.  &#8221;Aha,&#8221; I said, &#8220;I&#8217;m <em>off work!</em>&#8221;  I can&#8217;t overstate the psychological benefits of this, especially as a system administrator who is frequently on call  and, as of late, frequently called by a miscreant server.</p>
<p>The second unexpected benefit I experienced was that I could suddenly get up early again.  Something about the way I&#8217;m wired makes it so that if I have to get up and travel somewhere, I can inevitably get up with plenty of time to get prepared and get there.  I&#8217;ve gotten up at 5 almost every day this week and been into work by 6.  The added hours to each day have done untold good for my mental health.  Five in the morning is quite early, I realize, but, as my primary mode of transportation is a sporty old road bike and the local heat hits 90 degrees and 90 percent humidity by about 10 AM this time of year, it&#8217;s best that I get my rear end out the door before too late in the morning.</p>
<p>I noticed, also, that I have a better sense of how much time that I spend working.  Having no set hours when I worked from home, I always had a sense of, &#8220;I could go work on that right now,&#8221; which, for some reason was enough for my brain to feel like it had accomplished something, when it really hadn&#8217;t.  I track my time on a timesheet, which gives me a numeric/analytical sense of the time I spent each week but, being out of the house, I really get a sense of how long I&#8217;ve been gone, and I&#8217;m eager to get home and spend time with my wife and kids.  I&#8217;m starting to re-realize the value of time with them, not just time when we&#8217;re physically proximal, but time where my mind is disengaged from work and I&#8217;m free to pay attention and express my love for them.</p>
<p>It struck me, at one point last week, where one of my co-workers said, during a server emergency, &#8220;sucks that you have to go into an office,&#8221; the real professional value of an office.  Not that professional people don&#8217;t work from home, and do an excellent job.  For me, there&#8217;s something intangible that gives my work more legitimacy.  Working in an office, away from the pressures of home life, says to me, &#8220;I&#8217;m serious about what I do for a living,&#8221; in a very stupid and physical way.  Staying up all night to finish the critical project that evening, and then driving home in the morning, I felt a supreme sense of accomplishment and, something I&#8217;ve missed for too long &#8212; a sense of coming home for which there is no substitute.</p>
<p>Meanwhile, having completed my work in four days, instead of five or six as has been my habit, I can sit at home on the couch and write an early morning blog post while my daughter sits next to me and plays with my iPhone.  In a minute I&#8217;ll be making us all waffles and bacon, then kicking back to enjoy them with a frosty glass of OJ and to bask in my new-found love of home.</p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.fredalger.net/2010/06/reflections-on-one-week-out-of-the-home-office.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>blip.June 10, 2010 12:16 pm</title>
		<link>http://weblog.fredalger.net/2010/06/blip-june-10-2010-1216-pm.html</link>
		<comments>http://weblog.fredalger.net/2010/06/blip-june-10-2010-1216-pm.html#comments</comments>
		<pubDate>Thu, 10 Jun 2010 16:16:59 +0000</pubDate>
		<dc:creator>Fred</dc:creator>
				<category><![CDATA[blips]]></category>

		<guid isPermaLink="false">http://weblog.fredalger.net/2010/06/blip-june-10-2010-1216-pm.html</guid>
		<description><![CDATA[Progammers Must All Learn Statistics or I Will Kill Them All&#8230; still GREAT after all these years http://ping.fm/rp1Cd]]></description>
			<content:encoded><![CDATA[<p>Progammers Must All Learn Statistics or I Will Kill Them All&#8230; still GREAT after all these years http://ping.fm/rp1Cd</p>
]]></content:encoded>
			<wfw:commentRss>http://weblog.fredalger.net/2010/06/blip-june-10-2010-1216-pm.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

