<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>thatmattbone.com &#187; software</title>
	<atom:link href="http://thatmattbone.com/tag/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://thatmattbone.com</link>
	<description>let's ride bikes...</description>
	<lastBuildDate>Mon, 19 Jul 2010 03:46:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>simple s-expression parser in python</title>
		<link>http://thatmattbone.com/2010/06/simple-s-expression-parser-in-python/</link>
		<comments>http://thatmattbone.com/2010/06/simple-s-expression-parser-in-python/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 02:43:27 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=272</guid>
		<description><![CDATA[A few weeks back, I boasted in a bar that anyone could write a simple s-expression parser from scratch (no flex, no yacc, no bison, no antler, etc).  Well, I could not boast without doing it myself, so I finally did.  My s-expression lexer/parser weighs in at about 170 lines without tests (450 lines with [...]]]></description>
			<content:encoded><![CDATA[<p>A few weeks back, I boasted in a bar that anyone could write a simple s-expression parser from scratch (no flex, no yacc, no bison, no antler, etc).  Well, I could not boast without doing it myself, so I finally did.  My <a href="http://bitbucket.org/thatmattbone/lisp-adventures/src/tip/in_py/parse_sexp.py">s-expression lexer/parser</a> weighs in at about 170 lines without tests (450 lines with them), and parsers integers and symbols.  I even created a little repl which takes this:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>+ <span style="color: #cc66cc;">1</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>And converts it into this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: black;">&#91;</span>Symbol<span style="color: black;">&#40;</span>+<span style="color: black;">&#41;</span>, Number<span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>, Number<span style="color: black;">&#40;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span></pre></div></div>

<p>A pretty-printed python list consisting of objects representing symbols and numbers. </p>
<p>I think the design is fairly readable if a bit unusual.  There are classes for each token (instances of which are used for fully and partially formed tokens) and we &#8220;add&#8221; these tokens together to form a larger token and ultimately invoke a next_token_exception allowing the lexer to yield the largest, greediest, most fully-formed token possible. </p>
<p>Here&#8217;s an example of the lexer in action:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #66cc66;">&gt;&gt;&gt;</span> symbol_token<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;h&quot;</span><span style="color: black;">&#41;</span>
<span style="color: #66cc66;">&lt;</span>parse_sexp.<span style="color: black;">symbol_token</span> <span style="color: #008000;">object</span> at 0x7fb9e2d253d0<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> _ + symbol_token<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;i&quot;</span><span style="color: black;">&#41;</span>
<span style="color: #66cc66;">&lt;</span>parse_sexp.<span style="color: black;">symbol_token</span> <span style="color: #008000;">object</span> at 0x7fb9e2d25710<span style="color: #66cc66;">&gt;</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> formed = _
<span style="color: #66cc66;">&gt;&gt;&gt;</span> formed + <span style="color: #483d8b;">&quot; &quot;</span>
Traceback <span style="color: black;">&#40;</span>most recent call last<span style="color: black;">&#41;</span>:
  File <span style="color: #483d8b;">&quot;&lt;stdin&gt;&quot;</span>, line <span style="color: #ff4500;">1</span>, <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #66cc66;">&lt;</span>module<span style="color: #66cc66;">&gt;</span>
  File <span style="color: #483d8b;">&quot;parse_sexp.py&quot;</span>, line <span style="color: #ff4500;">33</span>, <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #0000cd;">__add__</span>
    <span style="color: #ff7700;font-weight:bold;">raise</span> next_token_exception<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
parse_sexp.<span style="color: black;">next_token_exception</span>
<span style="color: #66cc66;">&gt;&gt;&gt;</span> formed.<span style="color: black;">value</span>
<span style="color: #483d8b;">'hi'</span></pre></div></div>

<p>After lexing, we&#8217;re left with a stream of fully-formed tokens; it&#8217;s a simple matter to filter out the whitespace tokens and start yielding instances of Symbol() and Number() classes with proper, pythonic types for the data.  </p>
<p>Although I used regexes (quite unnecessarily) and generators, this little thing could probably be ported to C.  It&#8217;d be the fastest, most useless parser/lexer around <img src='http://thatmattbone.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Happy Hacking!</p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2010/06/simple-s-expression-parser-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>things I have re-learned so far this week</title>
		<link>http://thatmattbone.com/2010/06/things-i-have-re-learned-so-far-this-week/</link>
		<comments>http://thatmattbone.com/2010/06/things-i-have-re-learned-so-far-this-week/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 03:43:32 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=243</guid>
		<description><![CDATA[close your files, flush your files, fsync() your files, sync() if you have to, just don&#8217;t be stupid. don&#8217;t use globals for mutable state. especially when you&#8217;re in a multi-threaded environment. or you&#8217;re interested in correct answers. there&#8217;s a good chance the ORM is writing shitty sql. coffee != sleep more tests!]]></description>
			<content:encoded><![CDATA[<ul>
<li>close your files, flush your files, fsync() your files, sync() if you have to, just don&#8217;t be stupid.</li>
<li>don&#8217;t use globals for mutable state. especially when you&#8217;re in a multi-threaded environment. or you&#8217;re interested in correct answers.</li>
<li>there&#8217;s a good chance the ORM is writing shitty sql.</li>
<li>coffee != sleep</li>
<li>more tests!</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2010/06/things-i-have-re-learned-so-far-this-week/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>plotting the racial makeup of Chicago&#8217;s public schools</title>
		<link>http://thatmattbone.com/2010/04/plotting-the-racial-makeup-of-chicagos-public-schools/</link>
		<comments>http://thatmattbone.com/2010/04/plotting-the-racial-makeup-of-chicagos-public-schools/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 12:24:24 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[transparency]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=201</guid>
		<description><![CDATA[I created this image using matplotlib and the data from my CPS Racial Data Warehouse project.  Circle size represents school population.  The axes are latitude and longitude (as a reference, the loop is the empty rectangle just below the left corner of the legend).  Also I should note the Native American population was excluded from [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-202" title="schools" src="http://thatmattbone.com/wp-content/uploads/2010/04/schools.png" alt="schools" width="500" /></p>
<p>I created this image using <a href="http://matplotlib.sourceforge.net/">matplotlib</a> and the data from my <a href="http://cpswarehouse.thatmattbone.com/">CPS Racial Data Warehouse</a> project.  Circle size represents school population.  The axes are latitude and longitude (as a reference, the loop is the empty rectangle just below the left corner of the legend).  Also I should note the Native American population was excluded from this image because of a technical issue.</p>
<p>Full size image <a href="http://thatmattbone.com/wp-content/uploads/2010/04/schools.png">here</a>, more on this project soon (in the meantime, <a href="http://code.google.com/p/cpswarehouse/">the code is here</a>).</p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2010/04/plotting-the-racial-makeup-of-chicagos-public-schools/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>software quality</title>
		<link>http://thatmattbone.com/2010/03/software-quality/</link>
		<comments>http://thatmattbone.com/2010/03/software-quality/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 14:49:02 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=194</guid>
		<description><![CDATA[I&#8217;ve been thinking a lot about software quality and testing. This is what I&#8217;ve come up with:]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been thinking a lot about software quality and testing.  This is what I&#8217;ve come up with:</p>
<p><img src="http://thatmattbone.com/wp-content/uploads/2010/03/softwarequality.jpg" alt="softwarequality" title="softwarequality" width="281" height="185" class="alignnone size-full wp-image-195" /></p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2010/03/software-quality/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>the stack!</title>
		<link>http://thatmattbone.com/2009/04/the-stack/</link>
		<comments>http://thatmattbone.com/2009/04/the-stack/#comments</comments>
		<pubDate>Fri, 01 May 2009 01:11:04 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=139</guid>
		<description><![CDATA[When I was teaching data structures, one of the things that commonly came up was the whole issue of &#8220;pass by value&#8221; versus &#8220;pass by reference.&#8221; This was a very difficult thing to teach;  somehow I&#8217;ve internalized the common C/Java style memory model, and these things are fairly second nature.  While lecturing, I was definitely [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-medium wp-image-146" title="img_0386" src="http://thatmattbone.com/wp-content/uploads/2009/04/img_0386-225x300.jpg" alt="img_0386" width="225" height="300" /></p>
<p>When I was teaching data structures, one of the things that commonly came up was the whole issue of &#8220;pass by value&#8221; versus &#8220;pass by reference.&#8221; This was a very difficult thing to teach;  somehow I&#8217;ve internalized the common C/Java style memory model, and these things are fairly second nature.  While lecturing, I was definitely guilty of resorting to mind-numbing aphorisms like &#8220;integers are passed by value while objects are passed by reference&#8221;.  These rules of thumb just don&#8217;t work (and make it incredibly difficult to get your head around the idea that object _references_ are passed by value). This <a href="http://blogs.msdn.com/ericlippert/archive/2009/04/27/the-stack-is-an-implementation-detail.aspx">(fabulous) article over at MSDN </a>has a really nice description of the stack as an implementation detail.  Perhaps the key to solving this problem is really to just make the first course in computer science programs a course in programing language implementation.  Then you can move on to harder things like control flow and datastructures (I&#8217;m kind of kidding here).</p>
<p>But in reality, the vagaries of &#8220;value types&#8221; versus heap-allocated objects are too pointy for a data structures course.  Their guts are easily exposed in something like C while being appropriately hidden in an everything-is-an-object language like Python.  The Java/C# mix of these memory allocation strategies is confusing for the beginner.  Expose the details or don&#8217;t.  Exceptions to the rules breed bugs and confusion.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2009/04/the-stack/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>earthquake!</title>
		<link>http://thatmattbone.com/2008/04/earthquake/</link>
		<comments>http://thatmattbone.com/2008/04/earthquake/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 20:48:00 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=32</guid>
		<description><![CDATA[I spent a significant portion of my undergraduate career fooling around with the outdated seismology lab in the Loyola Physics department. Though I did eventually connect the seismometers to a computer and was able to record activity, they usually are not running as there is currently no student interested in checking in daily. However, we [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a significant portion of my undergraduate career fooling around with the outdated seismology lab in the Loyola Physics department. Though I did eventually connect the seismometers to a computer and was able to record activity, they usually are not running as there is currently no student interested in checking in daily. However, we do turn them on every now and then for a lab that the physics students do. So, we hooked everything up yesterday, and BAM, the biggest earthquake in many years hit Chicago this morning. We captured the quake, and I am positively thrilled. Two traces are below. The times are way off (clock drift), but you can clearly see the quake on the 14:00 line. Also, apparently the after shock was centered in &#8220;Bone Gap, IL&#8221;! Ha! Amazing.</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_neCry2Kl16o/SAkKS-STMbI/AAAAAAAABEk/O9q-zNyAQjM/s1600-h/LUC_EWS_NI.png"><img src="http://bp1.blogger.com/_neCry2Kl16o/SAkKS-STMbI/AAAAAAAABEk/O9q-zNyAQjM/s320/LUC_EWS_NI.png" alt="" id="BLOGGER_PHOTO_ID_5190691366594884018" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://lh6.ggpht.com/thatmattbone/SAkKceSTMcI/AAAAAAAABEs/MkbTG8UJLs4/LUC_NSS_NI.png"><img style="cursor: pointer; width: 320px;" src="http://lh6.ggpht.com/thatmattbone/SAkKceSTMcI/AAAAAAAABEs/MkbTG8UJLs4/LUC_NSS_NI.png" alt="" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2008/04/earthquake/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>pipe test</title>
		<link>http://thatmattbone.com/2008/01/pipe-test/</link>
		<comments>http://thatmattbone.com/2008/01/pipe-test/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 22:07:00 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[etl.luc.edu]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=30</guid>
		<description><![CDATA[We&#8217;ve created an ETL Yahoo pipe that aggregates the content of members&#8217; blogs tagged with &#8216;etl.luc.edu&#8217;. What I&#8217;m wondering is how quickly the pipe gets updated, and where things get cached along the line&#8230;]]></description>
			<content:encoded><![CDATA[<p>We&#8217;ve created an <a href="http://pipes.yahoo.com/pipes/pipe.info?_id=iBYnef_J3BGBZMBOYEsBXw">ETL Yahoo pipe</a> that aggregates the content of members&#8217; blogs tagged with &#8216;etl.luc.edu&#8217;.  What I&#8217;m wondering is how quickly the pipe gets updated, and where things get cached along the line&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2008/01/pipe-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>s-expression/xml isomorphism</title>
		<link>http://thatmattbone.com/2007/09/s-expressionxml-isomorphism/</link>
		<comments>http://thatmattbone.com/2007/09/s-expressionxml-isomorphism/#comments</comments>
		<pubDate>Wed, 05 Sep 2007 16:29:00 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=27</guid>
		<description><![CDATA[After some discussions with Dr. George recently, I was interested in exploring the relationship between xml and s-expressions. This has certainly been done before, but I thought I would try my hand at it. In the end result, I&#8217;m able to convert an s-expression such as: (a :a1 "test" :a2 "test2" "mycdata" (b :a3 "c")) [...]]]></description>
			<content:encoded><![CDATA[<p>After some discussions with <a href="http://www.etl.luc.edu/gkt">Dr. George</a> recently, I was interested in exploring the relationship between xml and s-expressions.  This has certainly been done before, but I thought I would try my hand at it.  In the end result, I&#8217;m able to convert an s-expression such as:
<pre>(a :a1 "test" :a2 "test2" "mycdata" (b :a3 "c"))</pre>
<p>to xml:
<pre>&lt;a a1="test" a2="test2"&gt;mycdata&lt;b a3="c"&gt;&lt;/b&gt;&lt;/a&gt;</pre>
<p>I do so with a somewhat strange but more explicit intermediate format:
<pre>(:element-name "a" :attributes (("a1" . "test") ("a2" . "test2")) :cdata nil                   :children (:element-name "b" :attributes (("a3" . "c"))                                :cdata "My CDATA" :children nil))</pre>
<p>This shows pretty clearly how a single namespace xml document can be represented with an s-expression.  What I&#8217;m wondering now is if I can go from the intermediate representation to something like YAML or JSON.  George and I have been calling these &#8216;tree languages&#8217;; I wonder if some sort of overarching equivalence for these &#8216;tree languages&#8217; can be shown?  </p>
<p>I don&#8217;t think this has much practical use, but the code <a href="http://betterxml.googlecode.com/svn/trunk/better-xml-refactored/sexp_to_xml/">is here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2007/09/s-expressionxml-isomorphism/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>darcs is perfect for university</title>
		<link>http://thatmattbone.com/2007/08/darcs-is-perfect-for-university/</link>
		<comments>http://thatmattbone.com/2007/08/darcs-is-perfect-for-university/#comments</comments>
		<pubDate>Tue, 14 Aug 2007 11:48:00 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=24</guid>
		<description><![CDATA[(I&#8217;m guessing that a lot of what I say here applies to all distributed version control systems, but since I&#8217;ve only used darcs, that is what I&#8217;ll focus on.) One of the neatest things about darcs is the fact that every checked out copy is itself a repository. This is perfect for university courses! Students [...]]]></description>
			<content:encoded><![CDATA[<p>(I&#8217;m guessing that a lot of what I say here applies to all distributed version control systems, but since I&#8217;ve only used darcs, that is what I&#8217;ll focus on.)</p>
<p>One of the neatest things about <a href="http://darcs.net">darcs</a> is the fact that every checked out copy is itself a repository.  This is perfect for university courses!  Students can check out the professor&#8217;s code, make their own changes to the code (i.e. if the code is the starting point for some assignment&#8230;quite common), and commit their changes to their own repository without &#8216;disconnecting&#8217; it from the professor&#8217;s version.  All the student needs to do is pull changes from the professors server periodically and deal with any conflicts that may arise.  The student can even push their copy to a university server for backup.  It&#8217;s perfect!</p>
<p>If only Google code had darcs support, then I could force <a href="http://code.google.com/p/luc-cs271">my 271 students</a> to do this.  As it stands, I&#8217;m not so sure a data structures course is the ideal place to introduce version control, but I may end up doing this anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2007/08/darcs-is-perfect-for-university/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GNU &amp; Lisp</title>
		<link>http://thatmattbone.com/2007/08/gnu-lisp/</link>
		<comments>http://thatmattbone.com/2007/08/gnu-lisp/#comments</comments>
		<pubDate>Sat, 04 Aug 2007 17:54:00 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=23</guid>
		<description><![CDATA[I&#8217;m reading the GNU manifesto, and Stallman talks about adding: &#8220;We plan to have&#8230;perhaps eventually a Lisp-based window system through which several Lisp programs and ordinary Unix programs can share a screen. Both C and Lisp will be available as system programming languages.&#8221; &#8211;RMS What happened? Where did the Lisp programmers go?]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m reading the GNU manifesto, and Stallman talks about adding:</p>
<blockquote><p>&#8220;We plan to have&#8230;perhaps eventually a Lisp-based window system through which several Lisp programs and ordinary Unix programs can share a screen.  Both C and Lisp will be available as system programming languages.&#8221; &#8211;<a href="http://www.gnu.org/gnu/manifesto.html">RMS</a></p></blockquote>
<p><a href="http://www.gnu.org/gnu/manifesto.html"></a><br />What happened?  Where did the Lisp programmers go?</p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2007/08/gnu-lisp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.846 seconds -->
