<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss 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" version="2.0">

<channel>
	<title>Vanderbrew</title>
	
	<link>http://vanderbrew.com/blog</link>
	<description>Beer, Food, Code, Writing, Creativity, Life</description>
	<pubDate>Thu, 16 Oct 2008 07:10:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/vanderbrew" type="application/rss+xml" /><item>
		<title>The Long Dark Coffee-Time of the Blog</title>
		<link>http://vanderbrew.com/blog/2008/10/15/the-long-dark-coffee-time-of-the-blog/</link>
		<comments>http://vanderbrew.com/blog/2008/10/15/the-long-dark-coffee-time-of-the-blog/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 07:10:45 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[Poetry]]></category>

		<guid isPermaLink="false">http://vanderbrew.com/blog/?p=251</guid>
		<description><![CDATA[Quiet has it been here for a few months.
Busy have I been.
Busy with the house
Busy with work.
Busy with life.
Why is it coffee-time? Because coffee is the drink of choice. It&#8217;s where the caffeine grows.
What does this all mean?
The quiet is broken. Some words are coming. May they disjointed though be.
Now, sleep.
]]></description>
			<content:encoded><![CDATA[<p>Quiet has it been here for a few months.<br />
Busy have I been.<br />
Busy with the <a href="http://vanderbrew.com/house/">house</a><br />
Busy with work.<br />
Busy with life.</p>
<p>Why is it coffee-time? Because coffee is the drink of choice. It&#8217;s where the caffeine grows.</p>
<p>What does this all mean?</p>
<p>The quiet is broken. Some words are coming. May they disjointed though be.</p>
<p>Now, sleep.</p>
]]></content:encoded>
			<wfw:commentRss>http://vanderbrew.com/blog/2008/10/15/the-long-dark-coffee-time-of-the-blog/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Walking in the Dark</title>
		<link>http://vanderbrew.com/blog/2008/05/08/walking-in-the-dark/</link>
		<comments>http://vanderbrew.com/blog/2008/05/08/walking-in-the-dark/#comments</comments>
		<pubDate>Fri, 09 May 2008 06:00:51 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[First Lines]]></category>

		<guid isPermaLink="false">http://vanderbrew.com/blog/?p=248</guid>
		<description><![CDATA[He stood in the shadows, watching, while cold rain dripped from the metal staircase to spot his scuffed leather jacket.
]]></description>
			<content:encoded><![CDATA[<p>He stood in the shadows, watching, while cold rain dripped from the metal staircase to spot his scuffed leather jacket.</p>
]]></content:encoded>
			<wfw:commentRss>http://vanderbrew.com/blog/2008/05/08/walking-in-the-dark/feed/</wfw:commentRss>
		</item>
		<item>
		<title>House Design</title>
		<link>http://vanderbrew.com/blog/2008/04/27/house-design/</link>
		<comments>http://vanderbrew.com/blog/2008/04/27/house-design/#comments</comments>
		<pubDate>Sun, 27 Apr 2008 16:45:35 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[House]]></category>

		<guid isPermaLink="false">http://vanderbrew.com/blog/?p=247</guid>
		<description><![CDATA[If you ever decide to design and build a house, think very carefully before deciding not to have a crawlspace or an attic and with minimal covered space between floors. Electrical and plumbing take a lot longer when you have to continually drill holes in studs.
]]></description>
			<content:encoded><![CDATA[<p>If you ever decide to design and build a house, think very carefully before deciding not to have a crawlspace or an attic and with minimal covered space between floors. Electrical and plumbing take a lot longer when you have to continually drill holes in studs.</p>
]]></content:encoded>
			<wfw:commentRss>http://vanderbrew.com/blog/2008/04/27/house-design/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Gregory and the Vanderpol Male Sleep Ability</title>
		<link>http://vanderbrew.com/blog/2008/02/19/gregory-and-the-vanderpol-male-sleep-ability/</link>
		<comments>http://vanderbrew.com/blog/2008/02/19/gregory-and-the-vanderpol-male-sleep-ability/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 02:52:10 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[Family]]></category>

		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://vanderbrew.com/blog/2008/02/19/gregory-and-the-vanderpol-male-sleep-ability/</guid>
		<description><![CDATA[Gregory is definitely his father&#8217;s son and his grandfather&#8217;s grandson. I&#8217;m sitting here on the bed with my laptop, doing a bit more work before dinner. Gregory climbed up next to me and sat down. At first he was talking to himself and making various noises - then I realized that it had gotten quiet [...]]]></description>
			<content:encoded><![CDATA[<p>Gregory is definitely his father&#8217;s son and his grandfather&#8217;s grandson. I&#8217;m sitting here on the bed with my laptop, doing a bit more work before dinner. Gregory climbed up next to me and sat down. At first he was talking to himself and making various noises - then I realized that it had gotten quiet all of a sudden.</p>
<p>I looked over and he was asleep where he sat - leaning back against our headboard.</p>
<p>See, we Vanderpol males have this innate ability to fall asleep at the drop of a hat, in any setting. It can be at a party, in the middle of a movie or even (if we&#8217;re really, really tired) at the table. If I lay in bed and it takes me more than ten minutes to fall asleep, it feels like it&#8217;s taking forever. (This used to annoy my wonderful wife, but she&#8217;s grown <del>resigned</del> accustomed to it.)</p>
<p>I&#8217;m glad you&#8217;re a part of our family, Gregory, and you&#8217;re keeping the torch alive (even if just in your dreams).</p>
]]></content:encoded>
			<wfw:commentRss>http://vanderbrew.com/blog/2008/02/19/gregory-and-the-vanderpol-male-sleep-ability/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Inventive Recreation</title>
		<link>http://vanderbrew.com/blog/2008/02/11/inventive-recreation/</link>
		<comments>http://vanderbrew.com/blog/2008/02/11/inventive-recreation/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 07:08:28 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[First Lines]]></category>

		<guid isPermaLink="false">http://vanderbrew.com/blog/2008/02/11/inventive-recreation/</guid>
		<description><![CDATA[&#8220;Whoa, dude, where&#8217;d you get the idea to make a bong out of that?&#8221;
]]></description>
			<content:encoded><![CDATA[<p>&#8220;Whoa, dude, where&#8217;d you get the idea to make a bong out of that?&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://vanderbrew.com/blog/2008/02/11/inventive-recreation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Right Tool</title>
		<link>http://vanderbrew.com/blog/2008/02/11/the-right-tool/</link>
		<comments>http://vanderbrew.com/blog/2008/02/11/the-right-tool/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 07:07:38 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[First Lines]]></category>

		<guid isPermaLink="false">http://vanderbrew.com/blog/2008/02/11/the-right-tool/</guid>
		<description><![CDATA[&#8220;Hey lummox, it ain&#8217;t done wit a knife!&#8221;
]]></description>
			<content:encoded><![CDATA[<p>&#8220;Hey lummox, it ain&#8217;t done wit a knife!&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://vanderbrew.com/blog/2008/02/11/the-right-tool/feed/</wfw:commentRss>
		</item>
		<item>
		<title>White Night</title>
		<link>http://vanderbrew.com/blog/2008/02/05/white-night/</link>
		<comments>http://vanderbrew.com/blog/2008/02/05/white-night/#comments</comments>
		<pubDate>Wed, 06 Feb 2008 06:38:50 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[First Lines]]></category>

		<guid isPermaLink="false">http://vanderbrew.com/blog/2008/02/05/white-night/</guid>
		<description><![CDATA[The old man stumbled across the moonlit snowfield, straining to hear any sounds of pursuit.
]]></description>
			<content:encoded><![CDATA[<p>The old man stumbled across the moonlit snowfield, straining to hear any sounds of pursuit.</p>
]]></content:encoded>
			<wfw:commentRss>http://vanderbrew.com/blog/2008/02/05/white-night/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Marking Duplicate Web Archive Items in Yojimbo</title>
		<link>http://vanderbrew.com/blog/2008/02/02/marking-duplicate-web-archive-items-in-yojimbo/</link>
		<comments>http://vanderbrew.com/blog/2008/02/02/marking-duplicate-web-archive-items-in-yojimbo/#comments</comments>
		<pubDate>Sat, 02 Feb 2008 22:15:50 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://vanderbrew.com/blog/2008/02/02/marking-duplicate-web-archive-items-in-yojimbo/</guid>
		<description><![CDATA[I saw Archive Flagged Items from NetNewsWire into Yojimbo (via) and found it a really neat tool. I've started using it to keep a more permanent record of interesting new articles.
I have lots of news articles flagged and I've had the import crash on me before for various reasons which has resulted in some duplicate [...]]]></description>
			<content:encoded><![CDATA[<p>I saw <a href="http://snippets.dzone.com/posts/show/5001">Archive Flagged Items from NetNewsWire into Yojimbo</a> (<a href="http://ranchero.com/?comments=1&#038;postid=1801">via</a>) and found it a really neat tool. I've started using it to keep a more permanent record of interesting new articles.</p>
<p>I have lots of news articles flagged and I've had the import crash on me before for various reasons which has resulted in some duplicate web archives being created. The reason for the duplicates is usually because there was a redirect to the actual article that Yojimbo followed, so the URL in NetNewsWire doesn't match the Yojimbo URL and checking for existing items on load doesn't work.</p>
<p>This was a great opportunity for me to explore <a href="http://rubyosa.rubyforge.org/" title="RubyOSA: Ruby/AppleEvent Bridge">RubyOSA</a> and continue learning <a href="http://www.ruby-lang.org/" title="Ruby Programming Language">Ruby</a> so I wrote a script to detect duplicate web archives based on name and mark them with a "Duplicate" label.</p>
<div class="igBar"><span id="lruby-2"><a href="#" onclick="javascript:showCodeTxt('ruby-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-2">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;">#!/usr/local/bin/ruby</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">require</span> 'rubygems'</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0066; font-weight:bold;">require</span> 'rbosa'</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">yojimbo = OSA.<span style="color:#9900CC;">app</span><span style="color:#006600; font-weight:bold;">&#40;</span>'Yojimbo'<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">seen = Hash.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF; font-weight:bold;">false</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Duplicate label details</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">duplicateLabelName = 'Duplicate'</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># An almost painful red</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">duplicateLabelColor = <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;color:#800000;">65535</span>, <span style="color:#006666;color:#800000;">1536</span>, <span style="color:#006666;color:#800000;">4628</span><span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">duplicateLabel = <span style="color:#0000FF; font-weight:bold;">nil</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># See if we already have a label named 'Duplicate' and save it</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">yojimbo.<span style="color:#9900CC;">labels</span>.<span style="color:#9900CC;">map</span>&nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span> |l| l.<span style="color:#9900CC;">name</span> == duplicateLabelName &amp;&amp; duplicateLabel = l <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;"># Make a label if we don't have it already</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>duplicateLabel.<span style="color:#0000FF; font-weight:bold;">nil</span>?<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; duplicateLabel = yojimbo.<span style="color:#9900CC;">make</span><span style="color:#006600; font-weight:bold;">&#40;</span>OSA::Yojimbo::Label,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">nil</span>,</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :color =&gt; duplicateLabelColor,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; :name =&gt; duplicateLabelName<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">yojimbo.<span style="color:#9900CC;">web_archive_items</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> |f|</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>seen.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>f.<span style="color:#9900CC;">name</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">"Found a duplicate: #{f.name}"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; f.<span style="color:#9900CC;">label</span>= duplicateLabel</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; seen<span style="color:#006600; font-weight:bold;">&#91;</span>f.<span style="color:#9900CC;">name</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">label</span>= duplicateLabel</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">else</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; seen<span style="color:#006600; font-weight:bold;">&#91;</span>f.<span style="color:#9900CC;">name</span><span style="color:#006600; font-weight:bold;">&#93;</span> = f</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://vanderbrew.com/blog/2008/02/02/marking-duplicate-web-archive-items-in-yojimbo/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Overheard</title>
		<link>http://vanderbrew.com/blog/2008/01/31/overheard/</link>
		<comments>http://vanderbrew.com/blog/2008/01/31/overheard/#comments</comments>
		<pubDate>Fri, 01 Feb 2008 01:20:35 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[Life]]></category>

		<category><![CDATA[Parenting]]></category>

		<guid isPermaLink="false">http://vanderbrew.com/blog/2008/01/31/overheard/</guid>
		<description><![CDATA[Emma came up and was further into her current Magic Treehouse book than expected.

Amber: You skipped chapter 1?
Emma (slightly exasperated): Chapter 1's are always the same!
Amber: What is chapter 1 like?
Emma: Being at home then going into the tree house.

]]></description>
			<content:encoded><![CDATA[<p>Emma came up and was further into her current Magic Treehouse book than expected.</p>
<blockquote><p>
Amber: You skipped chapter 1?<br />
Emma (slightly exasperated): Chapter 1's are always the same!<br />
Amber: What is chapter 1 like?<br />
Emma: Being at home then going into the tree house.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://vanderbrew.com/blog/2008/01/31/overheard/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Testing Syntax Highlighting</title>
		<link>http://vanderbrew.com/blog/2008/01/26/testing-syntax-highlighting/</link>
		<comments>http://vanderbrew.com/blog/2008/01/26/testing-syntax-highlighting/#comments</comments>
		<pubDate>Sat, 26 Jan 2008 14:31:24 +0000</pubDate>
		<dc:creator>matt</dc:creator>
		
		<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://vanderbrew.com/blog/2008/01/26/testing-syntax-highlighting/</guid>
		<description><![CDATA[I'd like to start posting code on my blog so I'm testing out a syntax highlighter plugin. This post will likely go through several iterations as I see what it can do and how to do it.
Here's some ruby:
PLAIN TEXT
RUBY:




def addPages&#40;urls&#41;


&#160; &#160; return false unless urls


&#160; &#160; urls.each&#123; &#124;u&#124; @queue &#60;&#60;PageFactory.newPage&#40;u&#41; &#125;


&#160; &#160; @queue.uniq! # [...]]]></description>
			<content:encoded><![CDATA[<p>I'd like to start posting code on my blog so I'm testing out a syntax highlighter plugin. This post will likely go through several iterations as I see what it can do and how to do it.</p>
<p>Here's some ruby:</p>
<div class="igBar"><span id="lruby-7"><a href="#" onclick="javascript:showCodeTxt('ruby-7'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">RUBY:</span>
<div id="ruby-7">
<div class="ruby">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">def</span> addPages<span style="color:#006600; font-weight:bold;">&#40;</span>urls<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#0000FF; font-weight:bold;">false</span> <span style="color:#9966CC; font-weight:bold;">unless</span> urls</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; urls.<span style="color:#9900CC;">each</span><span style="color:#006600; font-weight:bold;">&#123;</span> |u| @queue &lt;&lt;PageFactory.<span style="color:#9900CC;">newPage</span><span style="color:#006600; font-weight:bold;">&#40;</span>u<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; @queue.<span style="color:#9900CC;">uniq</span>! <span style="color:#008000; font-style:italic;"># Get rid of dupes.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#9966CC; font-weight:bold;">end</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Here's some Perl:</p>
<div class="igBar"><span id="lperl-8"><a href="#" onclick="javascript:showCodeTxt('perl-8'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PERL:</span>
<div id="perl-8">
<div class="perl">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@text</span> = <span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'here'</span>, <span style="color: #ff0000;">'are'</span>, <span style="color: #ff0000;">'some'</span>, <span style="color: #ff0000;">'words'</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$offset</span> = <span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.perldoc.com/perl5.6/pod/func/print.html"><span style="color: #000066;">print</span></a> <a href="http://www.perldoc.com/perl5.6/pod/func/join.html"><span style="color: #000066;">join</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">' '</span>, <a href="http://www.perldoc.com/perl5.6/pod/func/map.html"><span style="color: #000066;">map</span></a> <span style="color: #66cc66;">&#123;</span> choppedCase<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#125;</span> <span style="color: #0000ff;">@text</span> <span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #808080; font-style: italic;"># Convert a string to &quot;ChOpPeD cAsE&quot;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000; font-weight: bold;">sub</span> choppedCase</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$word</span> = <a href="http://www.perldoc.com/perl5.6/pod/func/shift.html"><span style="color: #000066;">shift</span></a>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">@chars</span> = <a href="http://www.perldoc.com/perl5.6/pod/func/split.html"><span style="color: #000066;">split</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">$word</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$char_count</span> = <a href="http://www.perldoc.com/perl5.6/pod/func/scalar.html"><span style="color: #000066;">scalar</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">@chars</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$i</span> = <span style="color: #0000ff;">$offset</span>; <span style="color: #0000ff;">$i</span> &lt;<span style="color: #0000ff;">$char_count</span>; <span style="color: #0000ff;">$i</span>+=<span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;<span style="color: #0000ff;">$chars</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$i</span><span style="color: #66cc66;">&#93;</span> = <a href="http://www.perldoc.com/perl5.6/pod/func/uc.html"><span style="color: #000066;">uc</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$chars</span><span style="color: #66cc66;">&#91;</span><span style="color: #0000ff;">$i</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #808080; font-style: italic;"># Track odd length words so we constantly alternate in a string</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$char_count</span> % <span style="color: #cc66cc;color:#800000;">2</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">$offset</span> = <span style="color: #0000ff;">$offset</span> == <span style="color: #cc66cc;color:#800000;">0</span> ? <span style="color: #cc66cc;color:#800000;">1</span> : <span style="color: #cc66cc;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.perldoc.com/perl5.6/pod/func/return.html"><span style="color: #000066;">return</span></a> <a href="http://www.perldoc.com/perl5.6/pod/func/join.html"><span style="color: #000066;">join</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">''</span>, <span style="color: #0000ff;">@chars</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Here's some PHP</p>
<div class="igBar"><span id="lphp-9"><a href="#" onclick="javascript:showCodeTxt('php-9'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-9">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Pattern to match the directory path that a file is in</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$dir_pattern</span> = <span style="color:#FF0000;">"@(/.*)/[^/]*$@"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// Take a path that's (possibly) relative to the directory that the script is executing in</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// and convert it to an absolute path.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> absolutize<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/global"><span style="color:#000066;">global</span></a> <span style="color:#0000FF;">$dir_pattern</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// Only operate on paths that are relative</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/substr"><span style="color:#000066;">substr</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path</span>, <span style="color:#CC66CC;color:#800000;">0</span>, <span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span> == <span style="color:#FF0000;">'.'</span> &amp;&amp; <a href="http://www.php.net/preg_match"><span style="color:#000066;">preg_match</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$dir_pattern</span>, <span style="color:#0000FF;">$_SERVER</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#FF0000;">'PHP_SELF'</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#0000FF;">$matches</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$path</span> = <a href="http://www.php.net/implode"><span style="color:#000066;">implode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">''</span>, <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$matches</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#FF0000;">'/'</span>, <span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$path_bits</span> = <a href="http://www.php.net/explode"><span style="color:#000066;">explode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'/'</span>, <span style="color:#0000FF;">$path</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#0000FF;">$elms</span> = <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">foreach</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$path_bits</span> <span style="color:#616100;">as</span> <span style="color:#0000FF;">$bit</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$bit</span> == <span style="color:#FF0000;">''</span> || <span style="color:#0000FF;">$bit</span> == <span style="color:#FF0000;">'.'</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">continue</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$bit</span> == <span style="color:#FF0000;">'..'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/array_pop"><span style="color:#000066;">array_pop</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$elms</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#616100;">continue</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000FF;">$elms</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span>= <span style="color:#0000FF;">$bit</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// Push an empty string on top so that we get a leading / when we implode</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <a href="http://www.php.net/array_unshift"><span style="color:#000066;">array_unshift</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$elms</span>, <span style="color:#FF0000;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#616100;">return</span> <a href="http://www.php.net/implode"><span style="color:#000066;">implode</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'/'</span>, <span style="color:#0000FF;">$elms</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>I just realized that I've coded in all three of these languages this week - plus JavaScript (can't find a good sample to post).</p>
<p><b>Update</b><br />
JavaScript</p>
<div class="igBar"><span id="ljavascript-10"><a href="#" onclick="javascript:showCodeTxt('javascript-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">JAVASCRIPT:</span>
<div id="javascript-10">
<div class="javascript">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// Add commas to a long number to make it more readable.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900; font-style: italic;">// Currently only supports whole numbers.</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #003366; font-weight: bold;">var</span> addCommas = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>aNumber<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900; font-style: italic;">// Convert our number to an array and reverse it so that</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900; font-style: italic;">// we can easily work from most significant digits down</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900; font-style: italic;">// to least significant</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #003366; font-weight: bold;">var</span> bitsR = <span style="color: #66cc66;">&#40;</span>aNumber.<span style="color: #006600;">toString</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">split</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">reverse</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i = bitsR.<span style="color: #006600;">length</span> - <span style="color: #CC0000;color:#800000;">1</span>; i&gt;<span style="color: #CC0000;color:#800000;">2</span>; i--<span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span>i % <span style="color: #CC0000;color:#800000;">3</span> == <span style="color: #CC0000;color:#800000;">0</span><span style="color: #66cc66;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; bitsR.<span style="color: #006600;">splice</span><span style="color: #66cc66;">&#40;</span>i, <span style="color: #CC0000;color:#800000;">0</span>, <span style="color: #3366CC;">','</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900; font-style: italic;">// Return our array with commas added back to the proper order</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900; font-style: italic;">// for display on the screen.</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #000066; font-weight: bold;">return</span> bitsR.<span style="color: #006600;">reverse</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">join</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">''</span><span style="color: #66cc66;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #66cc66;">&#125;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://vanderbrew.com/blog/2008/01/26/testing-syntax-highlighting/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
