<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>BeerRiot Blog</title>
	<atom:link href="http://blog.beerriot.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.beerriot.com</link>
	<description>The making of BeerRiot and other thoughts.</description>
	<lastBuildDate>Sat, 08 Jun 2013 11:20:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='blog.beerriot.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>BeerRiot Blog</title>
		<link>http://blog.beerriot.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://blog.beerriot.com/osd.xml" title="BeerRiot Blog" />
	<atom:link rel='hub' href='http://blog.beerriot.com/?pushpress=hub'/>
		<item>
		<title>I built a maple sleigh bed.</title>
		<link>http://blog.beerriot.com/2012/07/20/i-built-a-maple-sleigh-bed/</link>
		<comments>http://blog.beerriot.com/2012/07/20/i-built-a-maple-sleigh-bed/#comments</comments>
		<pubDate>Fri, 20 Jul 2012 19:13:51 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Woodworking]]></category>

		<guid isPermaLink="false">http://blog.beerriot.com/?p=311</guid>
		<description><![CDATA[Some of you know that beyond beer and coding, I'm also an active woodworker.  In this post, I'm excited to share the completion of my most recent project. Approximately 18 months after buying the first lumber, I'm now sleeping in in my hand-made hard maple sleigh bed.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=311&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Some of you know that beyond beer and coding, I&#8217;m also an active woodworker.  In this post, I&#8217;m excited to share the completion of my most recent project. Approximately 18 months after buying the first lumber, I&#8217;m now sleeping in in my hand-made hard maple sleigh bed.</p>
<table style="width:auto;">
<tr>
<td><a href="https://picasaweb.google.com/lh/photo/7U1DxkHDwp7vnc0hddRbTrfd45ERAKg_ZjNLGBFYapA?feat=embedwebsite"><img src="https://lh3.googleusercontent.com/-4wG795kW8yY/UAmkJ1fyQNI/AAAAAAAAAoQ/C1soe7t5J5I/s400/finished.JPG" height="300" width="400" alt="The finished bed" /></a></td>
</tr>
<tr>
<td style="font-family:arial, sans-serif;font-size:11px;text-align:right;">The finished bed</td>
</tr>
</table>
<p>It&#8217;s not my first piece of furniture, but it is, by far, the largest and most intricate to date. Despite some amateur imperfections (or are we calling those &#8220;artisanal qualities&#8221; these days?), I&#8217;m quite happy with how it turned out. It looks good, it sits straight, the matress fits, and it doesn&#8217;t squeak!</p>
<table style="width:auto;">
<tr>
<td><a href="https://picasaweb.google.com/lh/photo/WHKlydoVMU39htQR-gurD7fd45ERAKg_ZjNLGBFYapA?feat=embedwebsite"><img src="https://lh4.googleusercontent.com/-77NdihJasEk/UAmkJ7Wb0BI/AAAAAAAAAoQ/DyDmUoxYu9U/s400/slats.JPG" height="300" width="400" alt="Slats hold the mattress" /></a></td>
</tr>
<tr>
<td style="font-family:arial, sans-serif;font-size:11px;text-align:right;">Slats hold the mattress</td>
</tr>
</table>
<p>The matress is supported by fifteen poplar slats, each 4 inches wide by 3/4 inches thick, with an inch of space between them. That is to say, there&#8217;s no box spring. We bought the matress about a year ago, and we have used a futon frame (also a slatted frame), to support it since then. At &#8220;full&#8221; size, these slats seem to be fairly firm, but not hard. We like it.</p>
<table style="width:auto;">
<tr>
<td><a href="https://picasaweb.google.com/lh/photo/55lx9qoFrmuTbmcNa2Y1qbfd45ERAKg_ZjNLGBFYapA?feat=embedwebsite"><img src="https://lh5.googleusercontent.com/-LqJSWgHmsHo/UAmkJ2O0VBI/AAAAAAAAAoQ/1ShxVQ54X9Y/s400/wax.jpg" height="400" width="300" alt="Raw below, one coat of finish above" /></a></td>
</tr>
<tr>
<td style="font-family:arial, sans-serif;font-size:11px;text-align:right;">Raw below, one coat of finish above</td>
</tr>
</table>
<p>The finish is a mixture of one part mineral oil to 4-5 parts beeswax, by volume. It&#8217;s not a hard, take-a-beating kind of finish, and it will need to be reapplied from time to time, but we couldn&#8217;t resist the beautiful natural color of the maple, the sweet honey smell, and the smooth matte texture. We don&#8217;t expect it to need to withstand much more than our touch and the seasonal humidity change anyway. Rumor also has it that the finish and wood should change color with exposure to the sun as the years go by, which will add a great living element to a long-loved piece of furniture.</p>
<table style="width:auto;">
<tr>
<td><a href="https://picasaweb.google.com/lh/photo/9lOSXqdYll0MZJwBmWXkA7fd45ERAKg_ZjNLGBFYapA?feat=embedwebsite"><img src="https://lh5.googleusercontent.com/-Muo2x4q3jyE/UAmkJ-t8eqI/AAAAAAAAAoQ/gHXF6mzogWg/s400/tenon.jpg" height="400" width="365" alt="Tenons on the footboard" /></a></td>
</tr>
<tr>
<td style="font-family:arial, sans-serif;font-size:11px;text-align:right;">Tenons on the footboard</td>
</tr>
</table>
<p>You may notice that there is no metal hardware visible. The headboard and footboard are mortise-and-tenon boxes around a floating plywood panel. Glue and a good fit is all that&#8217;s holding them together.</p>
<table style="width:auto;">
<tr>
<td><a href="https://picasaweb.google.com/lh/photo/cqOFfVfpvBcs3V8CUREfsbfd45ERAKg_ZjNLGBFYapA?feat=embedwebsite"><img src="https://lh4.googleusercontent.com/-HATjmGT3Sgc/UAmkJ4ar-HI/AAAAAAAAAoQ/xaV8E-Dt9u8/s400/bolt.jpg" height="300" width="400" alt="Hidden bolt joinery" /></a></td>
</tr>
<tr>
<td style="font-family:arial, sans-serif;font-size:11px;text-align:right;">Hidden bolt joinery</td>
</tr>
</table>
<p>Fear not, though, for I am not crazy enough to glue up a piece of furniture that cannot later be removed from a room. The side rails are attached to the headboard and footboard via bolts, but in a sneaky way. The bolts are recessed into the side rail from the inside. They protrude from the end of the side rail, and then pierce the headboard and footboard through a hole on each inner face. A square nut is captured in the tenon of the lower cross rail, to secure the end of the bolt. Wood pins also protrude from the end of the side rail, and slot into holes in the headboard and footboard, to prevent the side rail from spinning around the bolt.</p>
<table style="width:auto;">
<tr>
<td><a href="https://picasaweb.google.com/lh/photo/sfxiGzX8dQT7QfS84KFhP7fd45ERAKg_ZjNLGBFYapA?feat=embedwebsite"><img src="https://lh6.googleusercontent.com/-_6Fmrpydpgc/UAmkJ8sdiQI/AAAAAAAAAoQ/nFcvdv03DYI/s400/cleat.JPG" height="282" width="400" alt="Cleats, glued and screwed" /></a></td>
</tr>
<tr>
<td style="font-family:arial, sans-serif;font-size:11px;text-align:right;">Cleats, glued and screwed</td>
</tr>
</table>
<p>Beyond connecting the headboard and footboard to each other, the side rail also holds the cleats, which support the slats for the matress. The cleats are attached with good, old-fashions glue-and-screws construction, to ensure they never pry themselves off.</p>
<table style="width:auto;">
<tr>
<td><a href="https://picasaweb.google.com/lh/photo/k_1ekzRgfD52rAWEBV4BTbfd45ERAKg_ZjNLGBFYapA?feat=embedwebsite"><img src="https://lh5.googleusercontent.com/-QIXXIIxj9fI/UAmkJyuQT7I/AAAAAAAAAoQ/qT_hdVQpcCI/s144/crest1.jpg" height="144" width="69" alt="Square" /></a></td>
<td><a href="https://picasaweb.google.com/lh/photo/c91oz-8i9G1epW4AB9gbfrfd45ERAKg_ZjNLGBFYapA?feat=embedwebsite"><img src="https://lh6.googleusercontent.com/-9pgTVkjAMUc/UAmkJ2HhjII/AAAAAAAAAoQ/QxWskv-5pwA/s144/crest2.jpg" height="144" width="86" alt="Octagonal" /></a></td>
<td><a href="https://picasaweb.google.com/lh/photo/RYCjPbH-DtiKJuKBkFcuTbfd45ERAKg_ZjNLGBFYapA?feat=embedwebsite"><img src="https://lh6.googleusercontent.com/-32evOcMJmEY/UAmkJyxN1DI/AAAAAAAAAoQ/JSbBW-vR1Ww/s144/crest3.jpg" height="144" width="89" alt="Sixteen sides" /></a></td>
<td><a href="https://picasaweb.google.com/lh/photo/FSvQnqGEyR81YMfVnrfwCbfd45ERAKg_ZjNLGBFYapA?feat=embedwebsite"><img src="https://lh5.googleusercontent.com/-DVHR3oOs9dw/UAmkJwR4NRI/AAAAAAAAAoQ/cHRIY0q2W5Y/s144/crest4.jpg" height="144" width="94" alt="Nearly round" /></a></td>
<td><a href="https://picasaweb.google.com/lh/photo/zoyNQUqp3KFZl6FKhcuQNLfd45ERAKg_ZjNLGBFYapA?feat=embedwebsite"><img src="https://lh4.googleusercontent.com/-sd6Yfhr5zhA/UAmkJziX0AI/AAAAAAAAAoQ/EuL-ZA68xWM/s144/crest5.jpg" height="144" width="94" alt="Polished" /></a></td>
</tr>
<tr>
<td style="font-family:arial, sans-serif;font-size:11px;text-align:right;" colspan="5">Progressively rounder</td>
</tr>
</table>
<p>The crest rails atop the headboard and footboard are defining features of the bed. The first question I&#8217;m always asked about them is, &#8220;Did you use a lathe?&#8221; While there was a point, early in the project, that I may have had access to a six-foot lathe, the answer is, no, I did not use a lathe. Instead, I used only my table saw, hand planes, and a pile of sandpaper.</p>
<p>After making mortises for the legs, and routing the groove for the face panel (much easier on a square surface), I simply cut the corners off to produce an octagonal prism. I then cut those corners off to produce a 16-sided prism. Using a plane, I shaved the tips of those sixteen corners, then progressed through several grits of sandpaper. Because I decided completion was better than perfection, the rails are not perfect cylinders, but they&#8217;re close enough to please the eye and hand.</p>
<table style="width:auto;">
<tr>
<td><a href="https://picasaweb.google.com/lh/photo/uXS50BN3YUXJekFSV1VbO7fd45ERAKg_ZjNLGBFYapA?feat=embedwebsite"><img src="https://lh6.googleusercontent.com/-xHamo4r0bj0/UAmkJ_d5qrI/AAAAAAAAAoQ/oU7YRbMUM9w/s400/bending1.jpg" height="400" width="300" alt="Homebrew serves multiple purposes" /></a></td>
</tr>
<tr>
<td style="font-family:arial, sans-serif;font-size:11px;text-align:right;">Homebrew serves multiple purposes</td>
</tr>
</table>
<table style="width:auto;">
<tr>
<td><a href="https://picasaweb.google.com/lh/photo/VyQwasPgfSOPbuPT5eZKQ7fd45ERAKg_ZjNLGBFYapA?feat=embedwebsite"><img src="https://lh4.googleusercontent.com/-T_g-51bov2o/UAmkJzTPG0I/AAAAAAAAAoQ/GFj56znh_cg/s400/bending2.JPG" height="300" width="400" alt="Gently adding a curve" /></a></td>
</tr>
<tr>
<td style="font-family:arial, sans-serif;font-size:11px;text-align:right;">Gently adding a curve</td>
</tr>
</table>
<p>I would be remiss if I didn&#8217;t also mention the extra hardware that consumed portions of the living room for several weeks. The face panels in the headboard and footboard are not flat, but instead have a gentle curve to match the profile of the leg. To force the panel to maintain this curve, instead of fighting against it, I built the panel from two sheets of 1/4-inch plywood, glued together and squeezed in a bending form.</p>
<p>I did nearly all of the work in my simple basement shop, except for the very first cuts. Most of the wood I bought for this project was surfaced on at most one side. The crest rails are actually two halves of one very thick beam. The early work of surfacing and major cutting, I did in the <a href="http://studentlife.mit.edu/hobbyshop">MIT Hobby Shop</a>. It&#8217;s a fantastic place that I never used as an undergrad, but I happily paid for a term of membership as an alumnus. Professional-grade jointer, planer, band saw, sander, etc. made the start of this project possible. It was also inspiring to see many undergrads taking advantage of what I had not, building everything from cabinetry to musical instruments.</p>
<p>I purchased the wood at <a href="http://www.wooderylumber.com/">The Woodery</a> in Lunenberg, Mass. Despite having agreed to help a friend move, the operator of the yard stuck around an extra hour to help me sort through their stock to find exactly what I needed. With a great price to boot, I&#8217;ll likely be headed back there for my next project.</p>
<p>This design is not entirely my own. Beyond the influence of many woodworkers, both past and present, much of my final design is based on <a href="http://www.furnituremaking.com/">Jeff Miller</a>&#8216;s Sleigh Bed from his book <a href="http://www.amazon.com/Beds-Jeff-Miller/dp/1561582549">Beds</a>. If you&#8217;re planning to build a bed of any type, I recommend Jeff&#8217;s book, as it covers all of the basics (joinery, mattress support, etc.) with examples in many different styles.</p>
<p>What that next project may be, is up in the air. The next few months will likely be spent mostly on small projects that filled the queue while this bed filled the workshop. There are also holiday gifts to plan. After all of that, I&#8217;ll begin to consider the next large items on my list.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beerriot.wordpress.com/311/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beerriot.wordpress.com/311/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=311&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.beerriot.com/2012/07/20/i-built-a-maple-sleigh-bed/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6fe3cd884c9c036f341631d6f837d98f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beerriot</media:title>
		</media:content>

		<media:content url="https://lh3.googleusercontent.com/-4wG795kW8yY/UAmkJ1fyQNI/AAAAAAAAAoQ/C1soe7t5J5I/s400/finished.JPG" medium="image">
			<media:title type="html">The finished bed</media:title>
		</media:content>

		<media:content url="https://lh4.googleusercontent.com/-77NdihJasEk/UAmkJ7Wb0BI/AAAAAAAAAoQ/DyDmUoxYu9U/s400/slats.JPG" medium="image">
			<media:title type="html">Slats hold the mattress</media:title>
		</media:content>

		<media:content url="https://lh5.googleusercontent.com/-LqJSWgHmsHo/UAmkJ2O0VBI/AAAAAAAAAoQ/1ShxVQ54X9Y/s400/wax.jpg" medium="image">
			<media:title type="html">Raw below, one coat of finish above</media:title>
		</media:content>

		<media:content url="https://lh5.googleusercontent.com/-Muo2x4q3jyE/UAmkJ-t8eqI/AAAAAAAAAoQ/gHXF6mzogWg/s400/tenon.jpg" medium="image">
			<media:title type="html">Tenons on the footboard</media:title>
		</media:content>

		<media:content url="https://lh4.googleusercontent.com/-HATjmGT3Sgc/UAmkJ4ar-HI/AAAAAAAAAoQ/xaV8E-Dt9u8/s400/bolt.jpg" medium="image">
			<media:title type="html">Hidden bolt joinery</media:title>
		</media:content>

		<media:content url="https://lh6.googleusercontent.com/-_6Fmrpydpgc/UAmkJ8sdiQI/AAAAAAAAAoQ/nFcvdv03DYI/s400/cleat.JPG" medium="image">
			<media:title type="html">Cleats, glued and screwed</media:title>
		</media:content>

		<media:content url="https://lh5.googleusercontent.com/-QIXXIIxj9fI/UAmkJyuQT7I/AAAAAAAAAoQ/qT_hdVQpcCI/s144/crest1.jpg" medium="image">
			<media:title type="html">Square</media:title>
		</media:content>

		<media:content url="https://lh6.googleusercontent.com/-9pgTVkjAMUc/UAmkJ2HhjII/AAAAAAAAAoQ/QxWskv-5pwA/s144/crest2.jpg" medium="image">
			<media:title type="html">Octagonal</media:title>
		</media:content>

		<media:content url="https://lh6.googleusercontent.com/-32evOcMJmEY/UAmkJyxN1DI/AAAAAAAAAoQ/JSbBW-vR1Ww/s144/crest3.jpg" medium="image">
			<media:title type="html">Sixteen sides</media:title>
		</media:content>

		<media:content url="https://lh5.googleusercontent.com/-DVHR3oOs9dw/UAmkJwR4NRI/AAAAAAAAAoQ/cHRIY0q2W5Y/s144/crest4.jpg" medium="image">
			<media:title type="html">Nearly round</media:title>
		</media:content>

		<media:content url="https://lh4.googleusercontent.com/-sd6Yfhr5zhA/UAmkJziX0AI/AAAAAAAAAoQ/EuL-ZA68xWM/s144/crest5.jpg" medium="image">
			<media:title type="html">Polished</media:title>
		</media:content>

		<media:content url="https://lh6.googleusercontent.com/-xHamo4r0bj0/UAmkJ_d5qrI/AAAAAAAAAoQ/oU7YRbMUM9w/s400/bending1.jpg" medium="image">
			<media:title type="html">Homebrew serves multiple purposes</media:title>
		</media:content>

		<media:content url="https://lh4.googleusercontent.com/-T_g-51bov2o/UAmkJzTPG0I/AAAAAAAAAoQ/GFj56znh_cg/s400/bending2.JPG" medium="image">
			<media:title type="html">Gently adding a curve</media:title>
		</media:content>
	</item>
		<item>
		<title>Roundtripping the HTTP Flowchart</title>
		<link>http://blog.beerriot.com/2011/10/01/roundtripping-the-http-flowchart/</link>
		<comments>http://blog.beerriot.com/2011/10/01/roundtripping-the-http-flowchart/#comments</comments>
		<pubDate>Sat, 01 Oct 2011 22:46:14 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Webmachine]]></category>

		<guid isPermaLink="false">http://blog.beerriot.com/?p=305</guid>
		<description><![CDATA[It has long bugged many of the Webmachine hackers that this relationship with Alan Dean's HTTP flowchart is one-way.  Webmachine was made from that graph, but that graph wasn't made from Webmachine.  I decided to change that in my evenings last week.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=305&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Webmachine hackers are familiar with a certain <a href="https://github.com/basho/webmachine/blob/master/docs/http-headers-status-v3.png">flowchart representing the decisions made during the processing of an HTTP request</a>.  Webmachine was designed as a <a href="http://www.infoq.com/presentations/Webmachine">practical executable form of that flowchart</a>.</p>
<p>It has long bugged many of the Webmachine hackers that this relationship is one-way, though.  Webmachine was made from the graph, but the graph wasn&#8217;t made from Webmachine.  I decided to change that in my evenings last week, while trying to take my mind off of <a href="http://blog.basho.com/2011/09/30/Riak-1-dot-0-is-Official/">Riak 1.0</a> testing.</p>
<p><a href="http://beerriot.files.wordpress.com/2011/10/wdc_graph.png"><img src="http://beerriot.files.wordpress.com/2011/10/wdc_graph-small.png?w=480" alt="" title="wdc_graph-small"   class="alignnone size-full wp-image-303" /></a></p>
<p>This is a version of the HTTP flowchart that only a Webmachine hacker could love.  It&#8217;s ugly and missing some information, but the important part is that <em>it&#8217;s generated by parsing <tt>webmachine_decision_core.erl</tt></em>.</p>
<p>I&#8217;ve shared the code for generating this image in the <a href="https://github.com/beerriot/webmachine/tree/gen-graph">gen-graph branch of my webmachine fork</a>.  Make sure you have <a href="http://www.graphviz.org/">Graphviz</a> installed, then checkout that branch and run <tt>make graph &amp;&amp; open docs/wdc_graph.png</tt>.</p>
<p>In addition to the PNG, you&#8217;ll also find a <tt>docs/wdc_graph.dot</tt> if you prefer to render to some other format.</p>
<p>If you&#8217;d really like to dig in, I suggest firing up an Erlang node and looking at the output of <tt>wdc_graph:parse("src/webmachine_decision_core.erl")</tt>:</p>
<pre>
[{v3b13, [ping],                     [v3b13b,503]},
 {v3b13b,[service_available],        [v3b12,503]},
 {v3b12, [known_methods],            [v3b11,501]},
 {v3b11, [uri_too_long],             [414,v3b10]},
 {v3b10, [allowed_methods,'RESPOND'],[v3b9,405]},
 {v3b9,  [malformed_request],        [400,v3b8]},
...
</pre>
<p>If you&#8217;ve looked through <tt>webmachine_decision_core</tt> at all, I think you&#8217;ll recognize what&#8217;s presented above: a list of tuples, each one representing the decision named by the first element, with the calls made to a resource module as the second element, and the possible outcomes as the third element.  Call <tt>wdc_graph:dot/2</tt> to convert those tuples to a DOT file.</p>
<p>There are a few holes in the generation.  Some response codes are reached by decisions spread across the graph, causing long arrows to cross confusingly.  The edges between decisions aren&#8217;t labeled with the criteria for following them.  Some resource calls are left out (like those made from <tt>webmachine_decision_core:respond/1</tt> and the response body producers and encoders).  It&#8217;s good to have a nice list for future tinkering.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beerriot.wordpress.com/305/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beerriot.wordpress.com/305/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=305&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.beerriot.com/2011/10/01/roundtripping-the-http-flowchart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6fe3cd884c9c036f341631d6f837d98f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beerriot</media:title>
		</media:content>

		<media:content url="http://beerriot.files.wordpress.com/2011/10/wdc_graph-small.png" medium="image">
			<media:title type="html">wdc_graph-small</media:title>
		</media:content>
	</item>
		<item>
		<title>NerdKit Gaming: Part 2</title>
		<link>http://blog.beerriot.com/2011/03/04/nerdkit-gaming-part-2/</link>
		<comments>http://blog.beerriot.com/2011/03/04/nerdkit-gaming-part-2/#comments</comments>
		<pubDate>Sat, 05 Mar 2011 02:48:35 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[NerdKits]]></category>

		<guid isPermaLink="false">http://blog.beerriot.com/?p=298</guid>
		<description><![CDATA[If you were interested in my last bit of alternative code-geekery, you may also be interested to hear that I&#8217;ve pushed that NerdKit Gaming code farther. If you browse the github repository now, you&#8217;ll find that the game also includes a highscore board, saved in EEPROM so it persists across reboot. It also features a [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=298&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>If you were interested in <a href="http://blog.beerriot.com/2011/02/14/nerdkit-gaming/">my last bit of alternative code-geekery</a>, you may also be interested to hear that I&#8217;ve pushed that NerdKit Gaming code farther.  If you browse <a href="http://github.com/beerriot/blockgame">the github repository</a> now, you&#8217;ll find that the game also includes a highscore board, saved in EEPROM so it persists across reboot.  It also features a power-saving mode that kicks in if you don&#8217;t touch any buttons for about a minute.  Key-repeat now also allows the player to hold a button down, instead of pressing it repeatedly, in order to move the cursor multiple spaces.</p>
<p>You may remember that I left of my last blog post noting that there wasn&#8217;t much left for the game until I could find a way to slim down the code to fit new things.  So what allowed these new features to fit?</p>
<p>Well, I did find ways to slim down the code: I was right about making the game state global.  But, I also re-learned a lesson that is at the core of hacking: check your base assumptions before fiddling with unknowns.  In this case, my base assumption was the Makefile I imported from an earlier NerdKits project.  While making the game state global saved a little better than 1k of space, changing the Makefile such that unused debugging utilities, such as uart, printf, scanf weren&#8217;t linked in saved about 6k.</p>
<p>In that learning, I also found that attempting to out-guess gcc&#8217;s &ldquo;space&rdquo; optimization is a losing game.  Making the game state global had a positive effect on space, but making the button state global had a negative effect.  Changing integer types would help in one place, but hurt in others.  I&#8217;m not intimately familiar with the rules of that optimizer, so it felt like spining a wheel of chance choosing which thing to prod next.</p>
<p>You may notice that I ultimately returned the game state to a local variable, passed in and out of each function that needed it.  The reason for this was testability.  It&#8217;s simply easier to test something that doesn&#8217;t depend on global state.  Once I had a bug that required running a few specific game states through these functions repeatedly, it just made sense to pay the price in program space in order to be able to write unit tests to cover some behaviors.</p>
<p>So <em>now</em> what&#8217;s next?  This time, it&#8217;s not much until I buy a new battery.  So much reloading and testing finally drained the original 9V.  Once power is restored, I&#8217;ll probably dig into some new peripheral &hellip; maybe something USB?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beerriot.wordpress.com/298/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beerriot.wordpress.com/298/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=298&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.beerriot.com/2011/03/04/nerdkit-gaming-part-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6fe3cd884c9c036f341631d6f837d98f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beerriot</media:title>
		</media:content>
	</item>
		<item>
		<title>Baseball + Riak Map/Reduce: the Movie</title>
		<link>http://blog.beerriot.com/2011/02/18/baseball-riak-mapreduce-the-movie/</link>
		<comments>http://blog.beerriot.com/2011/02/18/baseball-riak-mapreduce-the-movie/#comments</comments>
		<pubDate>Fri, 18 Feb 2011 13:09:19 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Riak]]></category>

		<guid isPermaLink="false">http://blog.beerriot.com/?p=296</guid>
		<description><![CDATA[If you have been following my posts about using Riak&#8217;s map/reduce system to compute baseball statistics via the luwak_mr library, or if they&#8217;re still sitting in your ‘read later’ pile, you may be interested in a presentation I gave yesterday on the same topic. Video of that presentation is available on Vimeo. It covers most [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=296&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>If you <a href="http://blog.beerriot.com/2011/01/16/mapreducing-luwak/">have</a> <a href="http://blog.beerriot.com/2011/01/20/baseball-riak-mapreduce/">been</a> <a href="http://blog.beerriot.com/2011/01/26/baseball-riak-mapreduce-round-2/">following</a> my posts about using Riak&#8217;s map/reduce system to compute <a href="http://github.com/beerriot/baseball/">baseball statistics</a> via the <a href="http://github.com/beerriot/luwak_mr">luwak_mr library</a>, or if they&#8217;re still sitting in your ‘read later’ pile, you may be interested in a presentation I gave yesterday on the same topic.</p>
<p><a href="http://vimeo.com/20074937">Video of that presentation</a> is available on Vimeo.  It covers most of the content in the blog posts, while also providing a little extra background about why luwak_mr was necessary for the work.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beerriot.wordpress.com/296/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beerriot.wordpress.com/296/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=296&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.beerriot.com/2011/02/18/baseball-riak-mapreduce-the-movie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6fe3cd884c9c036f341631d6f837d98f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beerriot</media:title>
		</media:content>
	</item>
		<item>
		<title>NerdKit Gaming</title>
		<link>http://blog.beerriot.com/2011/02/14/nerdkit-gaming/</link>
		<comments>http://blog.beerriot.com/2011/02/14/nerdkit-gaming/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 03:40:50 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[NerdKits]]></category>

		<guid isPermaLink="false">http://blog.beerriot.com/?p=290</guid>
		<description><![CDATA[Contrary to the evidence on this blog, not all of the code I write is in Erlang. It&#8217;s not even all web-based or dealing with distributed systems. In fact, this week I spent my evenings writing C for an embedded device. I&#8217;ve mentioned NerdKits here before (affiliate link). This week I finally dug into the [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=290&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Contrary to the evidence on this blog, not all of the code I write is in Erlang.  It&#8217;s not even all web-based or dealing with distributed systems.  In fact, this week I spent my evenings writing C for an embedded device.</p>
<p>I&#8217;ve mentioned <a href="http://www.nerdkits.com/?aff=hobbyist">NerdKits</a> here before (affiliate link).  This week I finally dug into the kit I ordered so long ago, and took it somewhere: gaming.</p>
<table style="width:auto;">
<td><a href="https://picasaweb.google.com/lh/photo/pRtOF7B7LuHUiqJ02Je-prAORiXII14n_6VUbaaIF4I?feat=embedwebsite"><img src="https://lh4.googleusercontent.com/_gFdf3yoUYNA/TVnegnGkwyI/AAAAAAAAARA/HJVS4i49QsM/s288/IMG_2104.jpg" height="271" width="288" /></a></td>
</table>
<p>The result is a clone of a simple tile-swap matching game.  I used very little interesting hardware outside the microcontroller and LCD &mdash; mostly just a pile of buttons.  The purpose of this experiment was to test the capabilities of the little ATmega168 (and my abilities to program it).</p>
<p>I&#8217;ve put the <a href="http://github.com/beerriot/blockgame">code on github</a>, if you&#8217;re interested in browsing.  If you don&#8217;t have a NerdKit of your own to load it up on, I&#8217;ve also made a short <a href="http://vimeo.com/19957450">demo video</a>, and snapped a few up-close <a href="https://picasaweb.google.com/bryan.fink/NerdKitsProjects?authkey=Gv1sRgCN75u7OM4prauwE&amp;feat=directlink">screenshots</a>.</p>
<p>What did I learn?  Mostly I remembered that writing a bunch of code to operate on a small amount of data can be just as fun as writing a bunch of code to operate on a large amount of data.  Lots of interaction with the same few bytes from different angles has a different feel than the same operation repeated time and time again on lots of different data.  I also learned that I&#8217;ve been spoiled by interactive consoles and fast compile/reload times.  When it takes a minute or more to restart (after power cycles and connector un-re-plugging) and I don&#8217;t have an effectively infinite buffer to dump logs in, I think a little longer about each experiment.</p>
<p>So what&#8217;s next?  Well, not much for this game, unless I slim down the code some more.  Right now it compiles to 14310 bytes.  Shortly before this, it was 38 bytes larger, and refused to load onto the microcontroller properly, since it plus the bootloader exceeds the 16K of flash memory available.  My first attack would probably be to simply move the game board to a global variable instead of passing it as a function argument.  The savings in stack-pushing should gain a little room.</p>
<p>If I were to make room for new operations, then a feature that saved a bit of state across power cycles would be a fun target.  What&#8217;s a game without a high-score board?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beerriot.wordpress.com/290/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beerriot.wordpress.com/290/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=290&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.beerriot.com/2011/02/14/nerdkit-gaming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6fe3cd884c9c036f341631d6f837d98f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beerriot</media:title>
		</media:content>

		<media:content url="https://lh4.googleusercontent.com/_gFdf3yoUYNA/TVnegnGkwyI/AAAAAAAAARA/HJVS4i49QsM/s288/IMG_2104.jpg" medium="image" />
	</item>
		<item>
		<title>Reading Code: Use Your Verbs</title>
		<link>http://blog.beerriot.com/2011/02/02/reading-code-use-your-verbs/</link>
		<comments>http://blog.beerriot.com/2011/02/02/reading-code-use-your-verbs/#comments</comments>
		<pubDate>Thu, 03 Feb 2011 03:36:24 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.beerriot.com/?p=283</guid>
		<description><![CDATA[I think I can be more specific about one component of readability that holds sway over the rest: naming.  Partially the quality of each name, but also the ratio of named to unnamed things.  But most important of all, the ratio of named to unnamed verbs.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=283&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been reflecting on code quality lately.  Partly that&#8217;s because I&#8217;ve been reading far more code than I&#8217;ve been writing.  Partly it&#8217;s because the most recent code I was writing was <a href="http://mitpress.mit.edu/sicp/full-text/book/book-Z-H-7.html">intended primarily for reading, and only incidentally for execution</a>, in the most literal way: it was instructional, not application-supporting.</p>
<p>And so it is that I&#8217;ve recently reaffirmed my conviction that code&#8217;s quality is primarily a function of its readability.  Readability is of primary importance because code must be able to be understood in order to be used, and the way to understand it best is to read it.</p>
<p>However, I think I can be more specific about one component of readability that holds sway over the rest: naming.  Partially the quality of each name, but also the ratio of named to unnamed things.  But most important of all, the ratio of named to unnamed <em>verbs</em>.</p>
<p>I first realized this several years ago, while hacking in the middle of a complex, distributed, Java-based system.  At one point, I had spent days diving through spaghetti, and finally found the core of the system &hellip; and it was <em>beautiful</em>.  Not just the best Java code I&#8217;d ever seen, but possibly the cleanest code, period.  Comparing it to the ugly code I had dug through, I found that its cleanliness derived from the fact that each interesting operation (or &ldquo;verb&rdquo;) was segregated into its own <em>named</em> function.  Some of those functions called others of those functions, but it was always just one operation described in each.</p>
<p>Later, coincidentally on the same project, I had reason to spend several weeks not in Java, a language I knew very well, but in Perl, Python, and Bash, languages with which I was less familiar.  I wrote and modified code very carefully in those languages, making sure that I could test each step as I went along.  As that bit of hacking finished, I returned to Java, and found that my style had changed.  I was now writing Java in a very careful, easily-testable manner.  When I stepped back, I realized that the easily-understood form of my new Java code shared something with that beautiful core I had found earlier: each function described exactly one operation.</p>
<p>I&#8217;ll demonstrate what I mean with a concrete example.  The code below is very similar to code I was hacking recently.  The labels have been changed to protect the innocent, even though I think the innocent is me.</p>
<p>The <tt>set_properties</tt> function expects a token and a collection of properties (keys with matching values) to store for the token.  New properties should overwrite old properties of matching keys, but old values for keys that are not specified should remain unchanged.  For example, if the token &ldquo;foo&rdquo; had the properties <tt>[{a,1},{b,1}]</tt>, and I called <tt>set_properties</tt> with the new properties <tt>[{a,2},{c,2}]</tt>, then after <tt>set_properties</tt> finishes, the token &ldquo;foo&rdquo; should have the properties <tt>[{a,2},{b,1},{c,2}]</tt> (the new values for <tt>a</tt> and <tt>c</tt> plus the old value for <tt>b</tt>).</p>
<dl>
<dt>
<pre>
set_properties(Token, NewProperties) -&gt;
   OldProperties = get_properties(Token),
   NewKeys = [ K || {K, _} &lt;- NewProperties ],
   FilteredProperties = [ P || P={K, _} &lt;- OldProperties,
                               not lists:member(K, NewKeys) ],
   set_properties_internal(Token, FilteredProperties ++ NewProperties).
    </pre>
</dt>
<dd>Fig. 1: The Beginning</dd>
</dl>
<p>The code in <a href="#fig1">Figure 1</a> is where I started.  This code is correct: it conforms to the spec given, passes all tests (indeed, has been in production, working, for over a year).  But, it is also bad code.  The hint why is the <tt>NewKeys</tt> variable.  It has little to do with setting new properties; it&#8217;s merely an artifact of cleaning up old properties.  It&#8217;s an indication that the two list comprehensions that reference it are really an unnamed verb separate from <tt>set_properties</tt>.</p>
<dl>
<dt>
<pre>
set_properties(Token, NewProperties) -&gt;
   OldProperties = get_properties(Token),
   MergedProperties = merge_properties(NewProperties, OldProperties).
   set_properties_internal(Token, MergedProperties).

merge_properties(Keep, Toss) -&gt;
   KeepKeys = [ K || {K, _} &lt;- Keep ],
   FilteredToss = [ P || P={K, _} &lt;- Toss,
                         not lists:member(K, KeepKeys) ],
   FilteredToss ++ Keep.
    </pre>
</dt>
<dd>Fig. 2: Naming the Verb</dd>
</dl>
<p>I propose that the code in <a href="#fig2">Figure 2</a> is an improvement upon the code in <a href="#fig1">Figure 1</a>.  The <tt>set_properties</tt> function now says just exactly what it&#8217;s going to do: lookup the old properties, merge them with the new properties, and store the result.  The details about how the merge is performed, the unnamed verb in Figure 1, have been relocated to a new function, named <tt>merge_properties</tt>.  The intermediate list of keys is still produced, but it&#8217;s now obvious that it&#8217;s just part of the merging process.</p>
<dl>
<dt>
<pre>
set_properties(Token, NewProperties) -&gt;
   OldProperties = get_properties(Token),
   MergedProperties = merge_properties(NewProperties, OldProperties),
   set_properties_internal(Token, MergedProperties).

merge_properties(Keep, Toss) -&gt;
   lists:ukeymerge(1, lists:ukeysort(1, Keep), lists:ukeysort(1, Toss)).
    </pre>
</dt>
<dd>Fig. 3: Using an Existing Name</dd>
</dl>
<p><a href="#fig3">Figure 3</a> is a demonstration of part of <a href="http://wingolog.org/archives/2009/03/24/international-lisp-conference-day-two">the reason that MIT changed the 6.001 curriculum</a>.  There was no need to write those list comprehensions.  Someone had already written the equivalent <em>and named it</em>.  It is far clearer to use that named operation than to reimplement.  The confusion about why <tt>NewKeys</tt> was created has been removed, and so has the need to decrypt the other list comprehension.</p>
<dl>
<dt>
<pre>
set_properties(Token, NewProperties) -&gt;
   OldProperties = get_properties(Token),
   MergedProperties = lists:ukeymerge(1,
                         lists:ukeysort(1, NewProperties),
                         lists:ukeysort(1, OldProperties)),
   set_properties_internal(Token, MergedProperties).   
    </pre>
</dt>
<dd>Fig. 4: Breaking Context</dd>
</dl>
<p>It&#8217;s a valid question to ask why I didn&#8217;t recommend jumping straight from <a href="#fig1">Figure 1</a> to <a href="#fig4">Figure 4</a>, instead of ending up at <a href="#fig3">Figure 3</a>.  It&#8217;s true that Figure 4 is a large improvement on Figure 1, but the answer is that even though <tt>lists:ukeymerge/3</tt> is a named verb, it&#8217;s a verb with less context than <tt>merge_properties</tt> in my module.  The context is richer than this snippet suggests, because there is at least one other function in this module that needs to perform the same operation.  Also, to reference 6.001 again, &ldquo;Abstraction barrier!&rdquo; Why does <tt>set_properties</tt> need to know the data structure I&#8217;m using?</p>
<dl>
<dt>
<pre>
set_properties(Token, NewProperties) -&gt;
   set_properties_internal(
      Token, merge_properties(NewProperties, get_properties(Token))).

merge_properties(Keep, Toss) -&gt;
   lists:ukeymerge(1, lists:ukeysort(1, Keep), lists:ukeysort(1, Toss)).
    </pre>
</dt>
<dd>Fig. 5: Anonymous Nouns</dd>
</dl>
<p>Another valid question is why I didn&#8217;t continue on to <a href="#fig5">Figure 5</a> after <a href="#fig3">Figure 3</a>.  In truth, I did consider it.  My eye sees less clutter, but having discussed this exact choice with many coworkers, I&#8217;ve learned that others don&#8217;t.  It also goes against the grain of what this post has been advocating: while I&#8217;ve worked to name my verbs, Figure 5 anonymized my nouns.  There&#8217;s a practical reason to keep names for nouns around: printf debugging.  Unless I have a very nice macro handy that I can wrap around one of the function calls in-place in Figure 5, I&#8217;m forced to copy one of those calls to some other place, and possibly even give it a name, before I can wrap my print statement around it.  In Figure 3, the names are already there; all I have to do is use them.</p>
<p>What else could be improved in <a href="#fig3">Figure 3</a>?  Plenty: &ldquo;merge&rdquo; is a bit generic and over-used; &ldquo;properties&rdquo; is long, noisy, and redundant in-context.  Is my omission of names for the sorted lists in <tt>merge_properties/2</tt> hypocritical?  Probably.  Readability is a subjective, human measure.  In multiple projects and languages, I&#8217;ve identified verb-naming as important in my judgement of a code&#8217;s readability.  Maybe writing that fact down will help me remember to think about it in new code I write.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beerriot.wordpress.com/283/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beerriot.wordpress.com/283/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=283&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.beerriot.com/2011/02/02/reading-code-use-your-verbs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6fe3cd884c9c036f341631d6f837d98f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beerriot</media:title>
		</media:content>
	</item>
		<item>
		<title>Baseball + Riak Map/Reduce, Round 2</title>
		<link>http://blog.beerriot.com/2011/01/26/baseball-riak-mapreduce-round-2/</link>
		<comments>http://blog.beerriot.com/2011/01/26/baseball-riak-mapreduce-round-2/#comments</comments>
		<pubDate>Wed, 26 Jan 2011 16:08:47 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Riak]]></category>

		<guid isPermaLink="false">http://blog.beerriot.com/?p=279</guid>
		<description><![CDATA[If you enjoyed my last post on the Basho Blog, about computing baseball stats using Riak&#8217;s map/reduce, you may also enjoy my followup post about dealing with (or avoiding) records that have been split across block boundaries.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=279&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>If you enjoyed my last post on the Basho Blog, about <a href="http://blog.basho.com/2011/01/20/baseball-batting-average,-using-riak-map/reduce/">computing baseball stats using Riak&#8217;s map/reduce</a>, you may also enjoy my followup post about <a href="http://blog.basho.com/2011/01/26/fixing-the-count/">dealing with (or avoiding) records that have been split across block boundaries</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beerriot.wordpress.com/279/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beerriot.wordpress.com/279/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=279&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.beerriot.com/2011/01/26/baseball-riak-mapreduce-round-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6fe3cd884c9c036f341631d6f837d98f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beerriot</media:title>
		</media:content>
	</item>
		<item>
		<title>Baseball + Riak Map/Reduce</title>
		<link>http://blog.beerriot.com/2011/01/20/baseball-riak-mapreduce/</link>
		<comments>http://blog.beerriot.com/2011/01/20/baseball-riak-mapreduce/#comments</comments>
		<pubDate>Thu, 20 Jan 2011 21:38:26 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Riak]]></category>

		<guid isPermaLink="false">http://blog.beerriot.com/?p=276</guid>
		<description><![CDATA[The luwak_mr tool I wrote about last weekend kept my imagination chugging this week. The result? I&#8217;ve learned a bit about baseball, and written code to compute batting average using luwak_mr (and Riak map/reduce, of course). Learn how it works on the Basho Blog.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=276&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>The <a href="http://contrib.basho.com/luwak_mr.html">luwak_mr</a> tool <a href="http://blog.beerriot.com/2011/01/16/mapreducing-luwak/">I wrote about last weekend</a> kept my imagination chugging this week.  The result?  I&#8217;ve learned a bit about baseball, and written <a href="http://github.com/beerriot/baseball">code to compute batting average</a> using luwak_mr (and Riak map/reduce, of course).</p>
<p><a href="http://blog.basho.com/2011/01/20/baseball-batting-average,-using-riak-map/reduce/">Learn how it works on the Basho Blog.</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beerriot.wordpress.com/276/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beerriot.wordpress.com/276/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=276&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.beerriot.com/2011/01/20/baseball-riak-mapreduce/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6fe3cd884c9c036f341631d6f837d98f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beerriot</media:title>
		</media:content>
	</item>
		<item>
		<title>Map/reducing Luwak</title>
		<link>http://blog.beerriot.com/2011/01/16/mapreducing-luwak/</link>
		<comments>http://blog.beerriot.com/2011/01/16/mapreducing-luwak/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 16:12:36 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Erlang]]></category>
		<category><![CDATA[Meta]]></category>
		<category><![CDATA[Riak]]></category>

		<guid isPermaLink="false">http://blog.beerriot.com/?p=270</guid>
		<description><![CDATA[I was inspired, this weekend, by off-list discussion of Luwak and by Guy Steele&#8217;s talk How to Think about Parallel Programming—Not!. The two seemed naturally attracted, and thus I created the luwak_mr module. The luwak_mr module exposes simple a function that knows how to walk a Luwak file tree, and send the keys for each [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=270&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I was inspired, this weekend, by off-list discussion of <a href="http://github.com/basho/luwak">Luwak</a> and by Guy Steele&#8217;s talk <a href="http://www.infoq.com/presentations/Thinking-Parallel-Programming">How to Think about Parallel Programming—Not!</a>.  The two seemed naturally attracted, and thus I created <a href="https://github.com/beerriot/luwak_mr">the luwak_mr module</a>.</p>
<p>The luwak_mr module exposes simple a function that knows how to walk a Luwak file tree, and send the keys for each of its leaf nodes off to a Riak map/reduce process.  This enables one to run a map function against each block in a luwak file.  For example, one might <a href="https://github.com/beerriot/luwak_mr/blob/master/src/luwak_mr_words.erl">split a large Latin-1 file into &#8220;words&#8221;</a> (the luwak_mr_words module in the project is an example implementation of the method that Guy Steele presented).</p>
<p>And, yes, this blog has been dormant for a while … I&#8217;ve been busy.  Lots of <a href="http://picasaweb.google.com/lh/photo/AnUXM5QkUUKRFj7xNIMr7w?feat=directlink">woodworking</a> and travel.  Making music has also begun to require more time, and yesterday I learned how to ski cross-country.  Always busy, the life of a <a href="http://twitter.com/hobbyist">hobbyist</a>.</p>
<p><strong>Update</strong>: luwak_mr <a href="http://contrib.basho.com/luwak_mr.html">has also been accepted</a> to the <a href="http://contrib.basho.com/">Riak function contrib</a>.  So if you&#8217;re in the habit of browsing there, fetch the latest.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beerriot.wordpress.com/270/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beerriot.wordpress.com/270/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=270&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.beerriot.com/2011/01/16/mapreducing-luwak/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6fe3cd884c9c036f341631d6f837d98f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beerriot</media:title>
		</media:content>
	</item>
		<item>
		<title>I&#8217;m Sorry (Maybe)</title>
		<link>http://blog.beerriot.com/2010/10/06/im-sorry-maybe/</link>
		<comments>http://blog.beerriot.com/2010/10/06/im-sorry-maybe/#comments</comments>
		<pubDate>Thu, 07 Oct 2010 01:48:33 +0000</pubDate>
		<dc:creator>Bryan</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://blog.beerriot.com/?p=263</guid>
		<description><![CDATA[But there lies the perfect storm: an app no one really <em>wanted</em> to write, with a problem no one <em>really</em> wanted to touch, no one with the time to fix it anyway, and a flaw just embarrassing enough for me to remember it years later.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=263&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Why is it that embarrassing code has a way of sticking around?  The specific variety of embarrassment doesn&#8217;t seem to matter (it could be hard to read, willfully inefficient, or just quirkily broken); all varieties live on equally well. Is it just that <em>all</em> code has a way of sticking around, and that we notice the embarrassing code more?  Or is it that the embarrassing code is more likely to be written in those tough little corners that no one wanted to touch anyway, and still don&#8217;t want to touch now?  I don&#8217;t know, but I do know every one of us has a few bits that we&#8217;d love to do over, if we could ever get the time to Do It Right.</p>
<p>I&#8217;m reminded of one of my most embarrassing bits every time I&#8217;m put on hold.  The music comes on, I hear about three words, and then <em>static</em>.  A couple of chords, more static.  On and on.</p>
<p>The story of my embarrassment begins over ten years ago.  The summer of 1999, I was interning at Lucent Technologies.  It was my third summer there, and I was finally hacking on a product, not academic research (or IT upgrades, as my first summer had entailed).</p>
<p>The product was called <em><a href="http://www.alcatel-lucent.com/wps/portal/!ut/p/kcxml/04_Sj9SPykssy0xPLMnMz0vM0Y_QjzKLd4w3MfQFSYGYRq6m-pEoYgbxjgiRIH1vfV-P_NxU_QD9gtzQiHJHR0UAAD_zXg!!/delta/base64xml/L0lJayEvUUd3QndJQSEvNElVRkNBISEvNl9BX0FLTC9lbl93dw!!?LMSG_CABINET=Bell_Labs&amp;LMSG_CONTENT_FILE=History/Timeline/Timeline_Innovation_000096.xml">Softswitch</a></em> &#8211; an amazing new product in the early days of commercial IP telephony.  The stack was some mix of C and Java, and there was a box humming somewhere with a connection to some corner of the phone system (at the very least the in-house ISDN).  Interacting with telephones, over the internet, with software running on any old random box &#8211; wow!<a href="#footnote1" name="footref1">[1]</a></p>
<p>My main task was helping to flesh out the add-on module system.  &#8220;Flesh out&#8221; may be the wrong term.  The goal of my work was more to experiment with the extension API they had created (known as the <em>Programmable Feature Server</em>), and to produce a demonstration of its capabilities, as well as to provide feedback about what was missing, rough, broken, etc.  In the Web 2.0 world, I&#8217;d probably have been labeled &#8220;beta tester&#8221;.</p>
<p>Like most betas, the documentation was scarce.  The rumor was that the lack of documentation was less intimidating for those that knew <a href="http://en.wikipedia.org/wiki/Signaling_System_7">SS7</a> inside and out, but there was no way I was going to swallow that heap, and also produce something useful in three months.<a href="#footnote2" name="footref2">[2]</a></p>
<p>By late summer, I had implemented a fairly involved demo, boringly named <em>ReminderCall</em>.  Dial in from any phone, navigate your way through Push-N-for-X menus, then eventually enter a time and record a message.  At the time you chose, ReminderCall would dial your phone and play your message back to you.  There was also a &#8220;web&#8221; frontend (either a Java servlet rendering HTML or a servlet talking to an applet; can&#8217;t remember which) for doing the same, as well as canceling or rescheduling pending reminders, if I recall correctly.</p>
<p>ReminderCall was a success.  They liked it so much, they used it to demo Softswitch&#8217;s extensibility to MCI.</p>
<p>But it&#8217;s not the success that I intended to talk about here.  The embarrassing code happened along the way to ReminderCall.</p>
<p>As a way to learn how to deal with audio streams, I first implemented another application with a somewhat smaller scope.  Much like beginning to learn any display-based system by printing, &#8220;Hello World,&#8221; I began to learn this audio-based system by playing, &#8220;hello.&#8221;  A few more hours of tinkering after that, and my application could also read key presses.</p>
<p>Polish things up a bit, and the first app I had ready was <em>MusicOnHold</em>.  Being 17 at the time, all geek and zero taste, my demonstration music was none other than <a href="http://en.wikipedia.org/wiki/Sabotage_(song)"><em>Sabotage</em> by the Beastie Boys</a> (light defense: it also happened to be one of the few songs I could find for download at the time, avoiding the lack of audio hardware in my workstation).</p>
<p>The nice thing about <em>Sabotage</em> is that it sounds like noise normally.  Piping it over 8-bit (or less?) mono mainly just seems to change the timbre of the noise.  It wasn&#8217;t until the boss asked me to find something more suitable for business-audience demonstration that it became apparent that the noise was part of the application.  <a href="http://en.wikipedia.org/wiki/In_the_Mood">Glenn Miller&#8217;s <em>In the Mood</em></a> sounded better on every warped vinyl it ever graced.  <em>Dee-da-da-dee-kxhxhxhxhxhxhxhx-dee-dee-khxhxhxhxh</em>.</p>
<p>There was worry, and hand wringing.  Email went back and forth between us and the core Softswitch developers.  Was it just Java unable to keep up (this was the 1.1 or 1.2 days, and I was still a n00b, after all)?  Was it the interface to the switch?  The network between the boxes?  It&#8217;s true that the human voice requires less bandwidth to encode than something wide-frequency, high-dynamic-range like Big Band music, but I nevertheless tried re-encoding that song every which way.  Things improved a bit, but still the static remained.</p>
<p>In the end, it was deemed more useful for me to press on and experiment with other features of the system, rather than muck about with this encoding trouble.</p>
<p>But there lies the perfect storm: an app no one really <em>wanted</em> to write, with a problem no one <em>really</em> wanted to touch, no one with the time to fix it anyway, and a flaw just embarrassing enough for me to remember it years later.</p>
<p>And now, every time I&#8217;m stuck on hold with static-filled music, I wonder whether someone just went ahead and packaged that MusicOnHold demo app with the Softswitch, and thereby forced my old, embarrasing code public.  If that&#8217;s the case, then, <a href="http://en.wikipedia.org/wiki/I%27m_Sorry_(Brenda_Lee_song)">I&#8217;m sorry, so <em>kxhxhxhxhxhxhxhx</em></a>.</p>
<p><a name="footnote1" href="#footref1">[1]</a> I used the department&#8217;s mail server for a time, to the chagrin of not only the admin, but another user trying to use that server to host their Netscape Navigator process.</p>
<p><a name="footnote2" href="#footref2">[2]</a> My mentor was also probing the reaches of the API, implementing the required wiretapping features, as I recall.  She also gets credit for being the first person to introduce me to Emacs and OOP (by way of Java), not to mention a host of other enlightenment.  Many thanks if you&#8217;re reading this by some chance!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beerriot.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beerriot.wordpress.com/263/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blog.beerriot.com&#038;blog=1135025&#038;post=263&#038;subd=beerriot&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://blog.beerriot.com/2010/10/06/im-sorry-maybe/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/6fe3cd884c9c036f341631d6f837d98f?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beerriot</media:title>
		</media:content>
	</item>
	</channel>
</rss>
