<?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; Matt Bone</title>
	<atom:link href="http://thatmattbone.com/author/mbone/feed/" rel="self" type="application/rss+xml" />
	<link>http://thatmattbone.com</link>
	<description></description>
	<lastBuildDate>Sat, 07 Jan 2012 01:20:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>happy software development in business land</title>
		<link>http://thatmattbone.com/2011/10/happy-software-development-in-business-land/</link>
		<comments>http://thatmattbone.com/2011/10/happy-software-development-in-business-land/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 05:25:39 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=387</guid>
		<description><![CDATA[<a href="http://thatmattbone.com/2011/10/happy-software-development-in-business-land/" title="happy software development in business land"></a>Several years ago, nearing the end of my time at my first &#8220;real&#8221; job, an &#8220;agile consultancy&#8221; was brought in to evaluate the firms readiness to use agile techniques.  Things were bad at the time. Morale was low, many projects &#8230;<p class="read-more"><a href="http://thatmattbone.com/2011/10/happy-software-development-in-business-land/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://thatmattbone.com/2011/10/happy-software-development-in-business-land/" title="happy software development in business land"></a><p>Several years ago, nearing the end of my time at my first &#8220;real&#8221; job, an &#8220;agile consultancy&#8221; was brought in to evaluate the firms readiness to use agile techniques.  Things were bad at the time. Morale was low, many projects were perceived as failing, and nearly every meeting ended in frustration.  So when the agile consultants conducted their interviews and group sessions, these tended to devolve into an airing of grievances.</p>
<p>One of these sessions still sticks in my mind.  The consultants asked everyone in the group of about ten people to write one word on an index card describing what the firm could be doing better. We then posted the cards on the wall.  I knew exactly what to write, and within a few minutes my card, emblazoned with the world &#8220;TOOLS,&#8221; stood out in a field of other cards reading &#8220;process.&#8221;</p>
<p>At the time it was so painfully obvious to me that tools were the primary source of frustration, and I was disheartened to see my colleagues miss the mark so completely.  In my mind, process meant more meetings, more garbage, and more waste.  We had a tool problem! Most developers were using a shared development server which yielded combinations of code never represented in version control.  While we had individual development virtual machines,there was nothing close to a one click deploy, nothing to bootstrap a project out of version control.  Those of us actually running the projects on our development machines did it from scratch and administered our own boxes. Many of the developers were new to the LAMP stack, and didn&#8217;t have the skillset to accomplish these administrative tasks. Likewise, while some projects had functional and integration tests, there was little buy in and the continuous integration server sat dormant. So after the agile consultants asked me about my tool-related frustrations, the topic was gradually redirected to &#8220;process&#8221; and I zoned out. Process meant bullshit, and these guys were outsiders charging us an arm and a leg to feed us more of it.  And what did it matter? My foot was already halfway out the door, and I went home and sent off a few more resumes.</p>
<p>Unfortunately I was wrong.  Tools weren&#8217;t the issue.  We had plenty of tools, and while most were underutilized, this merely required an investment of time.  The problem was community.  Our community was dysfunctional, and fixing it would&#8217;ve subsumed all problems.</p>
<h2>moving on</h2>
<p>There are many ways to build quality software in a reasonable amount of time without wanting to scream, but no one solution is a fit for all situations.  In my current gig, I&#8217;m living in a bit of a utopia. I&#8217;ve been a lead on a project for an internal system replacing an older system (it sends email, but that&#8217;s not terribly important) for about nine months.  I have one extremely well-informed and expert internal client in the marketing department that is the key stakeholder in the project, and because this system is used by many other developers, my colleagues get to try out my APIs and offer feedback.  All told, we have the nicest piece of software I&#8217;ve ever written.  It&#8217;s internally successful, delivering results early and being improved incrementally, and a joy to work on.  We have tools: the system will bootstrap itself and start running locally with one call to a shell script, the unit tests run all the time, the build server builds the docs (we have docs!), and we&#8217;re able to contribute liberally to our shared internal library.  And we have just a bit of process, too: releases are often available in a staging environment, we deploy very rapidly,  feedback from the internal client is nearly instantaneous, progress is tracked in our ticket system, and we have zero standing meetings (instead preferring to do things with short, ad-hoc, high value interactions at the coffee machine).  But even in this same organization I&#8217;ve worked on projects that have left me profoundly unhappy, and obviously the approach for my current project won&#8217;t always work or scale to other systems.  So I&#8217;m left trying to identify the things that make development fun and make this project such a success.</p>
<p>This current project reminds me a lot of working in an academic setting.  In my pre-&#8221;real&#8221;-job days, the stakeholders were highly involved, highly informed, and wanted to be working on the same stuff that I wanted to be working on (because we were broke and doing it all for free).  But what&#8217;s going on now and what was going on then is that we&#8217;ve fostered a real sense of community.  Sure, we have some constituent elements that are required to build software in a professional setting (tools, process), and we&#8217;ve assembled these nuts and bolts in an orderly fashion. But much more importantly, we&#8217;ve fostered a sense of mutual respect.</p>
<p>My stakeholder in the marketing department functions as the closest thing to a project manager I have.  We plan things out and we repeatedly revise our estimates and expectations.  Together he knows that context switching between feature requests slows me down, but I&#8217;ve also come to realize that when he asks for something quickly, he&#8217;s already thought through the ramifications, and the overhead of the context switch is worthwhile for the business.  The key element here is that our relationship is not adversarial.  Quite the opposite.  I respect his insight into his area of expertise, and he respects mine.  I&#8217;ve seen so many project manager/developer relationships go south because both parties perceive the other as the adversary.  The PM thinks the developer is dragging his or her feet, and the developer is irrationally convinced the that fucking over developers was in the PM&#8217;s job description. This makes work suck. This makes software suck. Warring factions can&#8217;t collaborate to build something great; warring factions can only destroy.</p>
<p>I&#8217;m not sure how mutual levels of respect can be earned or fostered.  Of all things, the possibility of this might be the most innate thing in the organization&#8217;s human constituents (i.e. we have to presuppose that we&#8217;ve hired good people on all sides if this is ever to happen).  But, assuming that respect and trust <em>can</em> be built between the nerds and the stake holders over time, there are still some other factors that have to exist to make a happy project.  One important thing is continued learning on all sides.  Everyone has to be willing to learn new things.  Sometimes this means that business types have to learn new vocabulary.  The might have to know how a cookie works or what it means for the web to be stateless.  And the same holds for developers.  We may have to hold our nose at the imprecise language used in marketing meetings and learn some acronyms and business strategies.  If an unwillingness to learn exists, the project will fail.</p>
<p>Transparency is also key.  Developers need to know how things work.  They need to know the background story around the business decisions that went into a project.  Likewise, the stakeholders need to see that progress is being made.  If we&#8217;re building a web app, then the latest stable(ish) release should be available for the business types to tinker with.  The transparency helps both sides.  Sometimes the analytical nerd brain can raise legitimate business questions.  Other times, the stakeholders can stem a failure or misread specification much earlier if they&#8217;re interacting with the project on a continual basis.</p>
<p>Finally, fault tolerance and resilience is key to a pleasant project.  Both sides, programmers and stakeholders, have to understand that the other will occasionally make mistakes, misread a spec, or be unclear.  Again, this can&#8217;t be adversarial.   For a happy project, we programmers must realize there is no suit and tie cabal maliciously typing away unclear requirements documents.  No, just like we forget to add files to version control and fat finger Unix commands, things get misinterpreted and misread.  So everyone should be aware that mistakes will happen.  Some ideas might have to be delayed, and some 500 pages might be raised.  But, if we respond to these quickly, refuse to panic, and fix both types of problems, the project can will continue to be fun and happy.  And it will succeed.</p>
<h2>sum(it_up)</h2>
<p>For me, something like a Project Euler problem is the most satisfying computing exercise.  It&#8217;s well defined, there is a solution, and I know when I&#8217;ve found it.  But this is a mirage.  Very few computing problems are solved with such simple and clear algorithms. Everything is fuzzy and we rarely go it alone.  But if we respect each other along the way, keep and eye on how things are going, and respond to problems as they come we can get closer and closer to a clear solution and enjoy the journey along the way.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2011/10/happy-software-development-in-business-land/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>exec() yourself silly</title>
		<link>http://thatmattbone.com/2011/04/exec-yourself-silly/</link>
		<comments>http://thatmattbone.com/2011/04/exec-yourself-silly/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 02:44:35 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=325</guid>
		<description><![CDATA[<a href="http://thatmattbone.com/2011/04/exec-yourself-silly/" title="exec() yourself silly"></a>Now we all know exec() is cruise-control for awesome. Despising readability, sanity, and performance, I sprinkle my code liberally with this MSG and joyfully await the ensuing migraine. But sometimes I ask myself, is it enough? Correct Answers Considered Harmful &#8230;<p class="read-more"><a href="http://thatmattbone.com/2011/04/exec-yourself-silly/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://thatmattbone.com/2011/04/exec-yourself-silly/" title="exec() yourself silly"></a><p>Now we all know <code>exec()</code> is cruise-control for awesome. Despising readability, sanity, and performance, I sprinkle my code liberally with this MSG and joyfully await the ensuing migraine. But sometimes I ask myself, is it enough?<br />
<span id="more-325"></span></p>
<h3>Correct Answers Considered Harmful</h3>
<p>A wonderfully dynamic language like python lets us take <code>exec()</code> where no string literal has gone before by allowing us to pass in global and local environments that are used for variable lookup. The high-priests of python would have us use this functionality to constrain the side-effects of gratuitious <code>exec()ing</code>, but we can do so much better. A simple subclass of <code>dict()</code> that overrides <code>__getitem__</code> and only returns the item we&#8217;re looking for 50% of the time gives us some ammo:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">class</span> AreYouFeelingLuckyDict<span style="color: black;">&#40;</span><span style="color: #008000;">dict</span><span style="color: black;">&#41;</span>:
    <span style="color: #808080; font-style: italic;">#this is idealized. see complete source at end of post.</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__getitem__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, item<span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">random</span>.<span style="color: black;">choice</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #008000;">True</span>, <span style="color: #008000;">False</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>:
            <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">dict</span>.<span style="color: #0000cd;">__getitem__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, item<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            <span style="color: #ff7700;font-weight:bold;">raise</span> <span style="color: #008000;">KeyError</span><span style="color: black;">&#40;</span>item<span style="color: black;">&#41;</span></pre></div></div>

<p>With this dictionary implementation, we can move on to more interesting <code>exec()s</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">exec</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;&quot;a = 1; print a&quot;&quot;&quot;</span>,
     AreYouFeelingLuckyDict<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>, <span style="color: #808080; font-style: italic;">#globals</span>
     AreYouFeelingLuckyDict<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> <span style="color: #808080; font-style: italic;">#locals</span></pre></div></div>

<p>Because python is using instances of <code>AreYouFeelingLuckyDict</code> for global and local variable lookups inside our string of code, half the time the code will work properly. The other half of the time a <code>NameError</code> will be raised. Introducing another variable brings the odds of success to 1 in 4:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">exec</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;&quot;a = 1; b=2; print(a); print(b)&quot;&quot;&quot;</span>,
     AreYouFeelingLuckyDict<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>,
     AreYouFeelingLuckyDict<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Of course we can program a bit more defensively and ensure that we&#8217;ll get the output we&#8217;re looking for. If we encounter a <code>NameError</code> along the way, we simply try, try, and try again:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">    <span style="color: #ff7700;font-weight:bold;">exec</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;&quot;
a=1
b=2
while True:
  try:
    print(a)
    print(b)
    break
  except NameError:
    pass
&quot;&quot;&quot;</span>, AreYouFeelingLuckyDict<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>, AreYouFeelingLuckyDict<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Keep in mind that &#8220;1&#8243; will most likely be printed out several times as its lookup occurs first (and most persistently) and the exception handling is coarse-grained. The obvious solution is to pipe the output through <code>tail -n 2</code>.</p>
<h3>But Wait, There&#8217;s More</h3>
<p>Becaue of a debilitating gambling problem, <a href="http://www.hacker-dictionary.com/terms/bogo_sort">bogosort</a> is my favorite sorting algorithm. Bogosort is the equivalent of throwing an array of items onto the floor and seeing if they&#8217;ve come up in the proper order. Given a list of N unique items, the odds of getting the answer on the first go round of bogosort are 1 in N!. Running bogosort in production on your company&#8217;s machines is like playing roullette (with an enormous wheel and your career). Feel that rush.</p>
<p>But bogosort gets even more awesomer with our <code>exec()</code> trick:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">    myglobals = AreYouFeelingLuckyDict<span style="color: black;">&#40;</span><span style="color: #dc143c;">random</span>=<span style="color: #dc143c;">random</span><span style="color: black;">&#41;</span>
    mylocals = AreYouFeelingLuckyDict<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">exec</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;&quot;&quot;
def sorted(is_sorted):
    prev = is_sorted[0]
    for x in is_sorted:
        if prev &amp;gt; x:
            return False
        prev = x
    return True
&nbsp;
mylist = [4, 1, 9, 5]
runs = 1
while True:
    try:
        is_sorted = []
        while True:
            mutable_mylist = list(mylist)
&nbsp;
            for i in range(len(mutable_mylist)):
                index = random.randint(0, len(mutable_mylist)-1)
                is_sorted.append(mutable_mylist.pop(index))
&nbsp;
            if sorted(is_sorted):
                break
            else:
                runs+=1
                is_sorted=[]
        break
    except NameError:
        runs += 1
        pass
&quot;&quot;&quot;</span>, myglobals, mylocals<span style="color: black;">&#41;</span></pre></div></div>

<p>Because I&#8217;m a generous man, I&#8217;ve modified the <code>AreYouFeelingLuckyDict</code> to always return a result when the item being looked up is &#8220;runs&#8221;, &#8220;NameError&#8221;, &#8220;True&#8221;, &#8220;random&#8221;, &#8220;len&#8221;, &#8220;list&#8221;, &#8220;range&#8221;, or &#8220;sorted.&#8221; It&#8217;s also worth noting that as soon as we drop into <code>is_sorted()</code> we&#8217;re back to a plain-jane, well-behaved <code>locals()</code> with boringly reliable dict-like properties.</p>
<p>With this bogosort modification (err, improvement) and considering a list of length 4, I figure the odds of getting an answer the first time out is 1 in 3,145,824. Now we&#8217;re talking! Of course, the code above keeps going until it sorts our list. Running it a few times, I&#8217;ve seen the answer produced in as little as 700,000 tries. A paragon of efficiency.</p>
<h3>Wink</h3>
<p>I hope you&#8217;ve enjoyed this. I&#8217;ve been playing around with this post for a while and have had a great time. The source to this party can be found in this gist:<br />
<a href="https://gist.github.com/945666">https://gist.github.com/945666</a></p>
<p>Also, please check out <a href="http://lucumr.pocoo.org/2011/2/1/exec-in-python/">Be careful with exec and eval in Python</a> which inspired this post.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2011/04/exec-yourself-silly/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>default function parameter values in python</title>
		<link>http://thatmattbone.com/2011/03/default-function-parameter-values-in-python/</link>
		<comments>http://thatmattbone.com/2011/03/default-function-parameter-values-in-python/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 11:56:24 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=312</guid>
		<description><![CDATA[<a href="http://thatmattbone.com/2011/03/default-function-parameter-values-in-python/" title="default function parameter values in python"></a>Sure, we all know that &#8220;default parameter values are evaluated when the function definition is executed&#8221; in python. But what may not be clear is a fun way to introduce time-dependent bugs. See, this: def my_busted_record_keeper&#40;last_update=datetime.date.today&#40;&#41;&#41;: ... print&#40;&#34;last update was &#8230;<p class="read-more"><a href="http://thatmattbone.com/2011/03/default-function-parameter-values-in-python/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://thatmattbone.com/2011/03/default-function-parameter-values-in-python/" title="default function parameter values in python"></a><p>Sure, we all know that <a href="http://docs.python.org/reference/compound_stmts.html#function">&#8220;default parameter values are evaluated when the function definition is executed&#8221;</a> in python.  But what may not be clear is a fun way to introduce time-dependent bugs.<span id="more-312"></span>  See, this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> my_busted_record_keeper<span style="color: black;">&#40;</span>last_update=<span style="color: #dc143c;">datetime</span>.<span style="color: black;">date</span>.<span style="color: black;">today</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>:
    ...
    <span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;last update was %s&quot;</span> <span style="color: #66cc66;">%</span> last_update<span style="color: black;">&#41;</span></pre></div></div>

<p>Is totally broken.</p>
<p>If the code runs for more than a day, we aren&#8217;t going to get the results we expect since last_update will have been evaluated at definition time which is now yesterday.  Instead we should do something like:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> my_busted_record_keeper<span style="color: black;">&#40;</span>last_update=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">if</span> last_update <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #008000;">None</span>:
        last_update = <span style="color: #dc143c;">datetime</span>.<span style="color: black;">date</span>.<span style="color: black;">today</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    ...
    <span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;last update was %s&quot;</span> <span style="color: #66cc66;">%</span> last_update<span style="color: black;">&#41;</span></pre></div></div>

<p>Usually this isn&#8217;t a problem because my code crashes at least once a day <img src='http://thatmattbone.com/wp-includes/images/smilies/icon_rolleyes.gif' alt=':roll:' class='wp-smiley' /> , but I know I&#8217;ve made this mistake before and there&#8217;s a non-zero chance something like this running in production.  Quite embarrassing.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2011/03/default-function-parameter-values-in-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>y-combinator in javascript</title>
		<link>http://thatmattbone.com/2011/03/y-combinator-in-javascript/</link>
		<comments>http://thatmattbone.com/2011/03/y-combinator-in-javascript/#comments</comments>
		<pubDate>Thu, 10 Mar 2011 19:11:08 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=305</guid>
		<description><![CDATA[<a href="http://thatmattbone.com/2011/03/y-combinator-in-javascript/" title="y-combinator in javascript"></a>On Monday I was discussing the y combinator at Rossi&#8217;s.  The next morning I wrote an example in scheme to send to my friends, but they don&#8217;t speak scheme.  Sadly, this is tricky to write in python because of the &#8230;<p class="read-more"><a href="http://thatmattbone.com/2011/03/y-combinator-in-javascript/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://thatmattbone.com/2011/03/y-combinator-in-javascript/" title="y-combinator in javascript"></a><p>On Monday I was discussing the y combinator at Rossi&#8217;s.  The next morning I wrote an example in scheme to send to my friends, but they don&#8217;t speak scheme.  Sadly, this is tricky to write in python because of the lack of multi-line lambdas, but it&#8217;s damned easy in javascript:</p>
<p><span id="more-305"></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">,</span> thunk<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
 <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
   <span style="color: #000066; font-weight: bold;">return</span> x <span style="color: #339933;">+</span> thunk<span style="color: #009900;">&#40;</span>x<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> thunk<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">5</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">,</span> thunk<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>x<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #000066; font-weight: bold;">return</span> x <span style="color: #339933;">+</span> thunk<span style="color: #009900;">&#40;</span>x<span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #339933;">,</span> thunk<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>See, there&#8217;s something to love about every language.  And the beauty of this example is that you can probably type it write into the javascript console of you browser.  REPL included.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2011/03/y-combinator-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2011: Best Year Yet</title>
		<link>http://thatmattbone.com/2011/01/2011-best-year-yet/</link>
		<comments>http://thatmattbone.com/2011/01/2011-best-year-yet/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 00:46:48 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[random]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=296</guid>
		<description><![CDATA[<a href="http://thatmattbone.com/2011/01/2011-best-year-yet/" title="2011: Best Year Yet"></a>In the spirit of ChiPy meetings, I&#8217;m declaring 2011 to be the best year yet. I can only assume the best-ness of each passing year will increase monotonically until the year of my death, at which point, all bets are &#8230;<p class="read-more"><a href="http://thatmattbone.com/2011/01/2011-best-year-yet/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://thatmattbone.com/2011/01/2011-best-year-yet/" title="2011: Best Year Yet"></a><p><a rel="attachment wp-att-300" href="http://thatmattbone.com/2011/01/2011-best-year-yet/img_1217/"><img class="alignnone size-medium wp-image-300" title="img_1217" src="http://thatmattbone.com/wp-content/uploads/2011/01/img_1217-225x300.jpg" alt="Useless tram for moving drunks between casinos." width="225" height="300" /></a></p>
<p>In the spirit of <a href="http://chipy.org/">ChiPy</a> meetings, I&#8217;m declaring 2011 to be the best year yet.  I can only assume the best-ness of each passing year will increase monotonically until the year of my death, at which point, all bets are off. <span id="more-296"></span>Here are some reasons why 2010 was pretty great, too:</p>
<ul>
<li>I rode my bike to Saint Louis (without being eaten by possums).</li>
<li>I went to PyCon.</li>
<li>My friend Brian and I went to Las Vegas and did not lose large sums of money.</li>
<li>Erin and Dan took my old apartment and are tending to the compost pile with great fervor.</li>
<li>Camping with friends occurred more frequently.</li>
</ul>
<p>And here are some reasons why 2011 will also be great:</p>
<ul>
<li>I have no plans to land in the ER, break a bone, receive an IV, or be eaten by possums.</li>
<li>I will go to PyCon.</li>
<li>Camping with friends will occur more frequently.</li>
<li>I will read more books.</li>
<li>Rob Pike will release Plan10 for download in the iTunes App Store.</li>
<li>Bjarne Stroustrup will announce that this joke has gone on long enough.</li>
<li>Cable news channels will not mention the woes of a single teenage starlet, instead focusing on well-researched and thoughtful journalism that is neither sensationalist nor pandering to one side of the aisle or another.</li>
<li>Robots will stop attempting to submit spam comments to my blog.</li>
<li>We will meet back here and discuss all this next year.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2011/01/2011-best-year-yet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>stupid closure tricks in py3k</title>
		<link>http://thatmattbone.com/2010/07/stupid-closure-tricks-in-py3k/</link>
		<comments>http://thatmattbone.com/2010/07/stupid-closure-tricks-in-py3k/#comments</comments>
		<pubDate>Mon, 19 Jul 2010 03:46:03 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=288</guid>
		<description><![CDATA[<a href="http://thatmattbone.com/2010/07/stupid-closure-tricks-in-py3k/" title="stupid closure tricks in py3k"></a>This is kind of silly, but I like the nonlocal keyword in Python 3 (well, ok, I like let-bindings in Lisps much much better, but this will do) and how you can get a closure and then poke the insides &#8230;<p class="read-more"><a href="http://thatmattbone.com/2010/07/stupid-closure-tricks-in-py3k/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://thatmattbone.com/2010/07/stupid-closure-tricks-in-py3k/" title="stupid closure tricks in py3k"></a><p>This is kind of silly, but I like the nonlocal keyword in Python 3 (well, ok, I like let-bindings in Lisps much much better, but this will do) and how you can get a closure and then poke the insides of the closure to see what it&#8217;s up to.<span id="more-288"></span>  I&#8217;m sure this isn&#8217;t recommended, but it&#8217;s a fun trick:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> counter<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    a = <span style="color: #ff4500;">0</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> inc<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
        nonlocal a
        a+=<span style="color: #ff4500;">1</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> a
    <span style="color: #ff7700;font-weight:bold;">return</span> inc
&nbsp;
c = counter<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span>c<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span>c<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span>c<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span>c.__closure__<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">cell_contents</span><span style="color: black;">&#41;</span></pre></div></div>

<p>I&#8217;d guess the locations of cells in the closure tuple are determined at compile time (i.e. they won&#8217;t change between runs), but I haven&#8217;t investigated this.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2010/07/stupid-closure-tricks-in-py3k/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>relating to nosql</title>
		<link>http://thatmattbone.com/2010/07/relating-to-nosql/</link>
		<comments>http://thatmattbone.com/2010/07/relating-to-nosql/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 04:45:11 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[databases]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=284</guid>
		<description><![CDATA[<a href="http://thatmattbone.com/2010/07/relating-to-nosql/" title="relating to nosql"></a>About the time the nosql movement started to get legs, I started to get interested in relational databases.  They&#8217;re awesome beasts, and horizontal scalability issues aside, they handle a lot of the very hard problems in the web programming space (i.e. durability &#8230;<p class="read-more"><a href="http://thatmattbone.com/2010/07/relating-to-nosql/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://thatmattbone.com/2010/07/relating-to-nosql/" title="relating to nosql"></a><p>About the time the nosql movement started to get legs, I started to get interested in relational databases.  They&#8217;re awesome beasts, and horizontal scalability issues aside, they handle a lot of the very hard problems in the web programming space (i.e. durability and concurrency).  But when data gets large and you can&#8217;t find the 2 million quarters in your sofa for that oracle license (or the 2 million braincells for that oh-so-perfect sharding scheme),  the nosql databases start to show their appeal.<span id="more-284"></span></p>
<p>But maybe there&#8217;s another way.  <a href="http://it.toolbox.com/blogs/database-soup/runningwithscissorsdb-39879?rss=1">This article</a> is mostly focussed on relaxing the durability constraints of postgres but also mentions a possible mixing of relational and non-relational systems.  What a cool idea!  Use the somewhat batch-oriented, distributed, and non-relational system as a large backing store, and populate a traditional relational database (almost) on demand by transforming and moving (ETLing) the data there.  With the right transforms, we get all the ad-hoc queries of our beloved star schema data warehouses without the expense of a big-honkin&#8217; database server.  Certainly these &#8216;transforms&#8217; are the tricky part (and slicing the data out of the non-relational store along a particular dimension (probably time) will almost always be necessary), but the gains seems pretty great.  Maybe we&#8217;ll call this approach a &#8220;pattern&#8221; someday.</p>
<p>Isn&#8217;t big data exciting?</p>
]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2010/07/relating-to-nosql/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[<a href="http://thatmattbone.com/2010/06/things-i-have-re-learned-so-far-this-week/" title="things I have re-learned so far this week"></a>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 &#8230;<p class="read-more"><a href="http://thatmattbone.com/2010/06/things-i-have-re-learned-so-far-this-week/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://thatmattbone.com/2010/06/things-i-have-re-learned-so-far-this-week/" title="things I have re-learned so far this week"></a><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>1</slash:comments>
		</item>
		<item>
		<title>python thirty days ago</title>
		<link>http://thatmattbone.com/2010/04/python-thirty-days-ago/</link>
		<comments>http://thatmattbone.com/2010/04/python-thirty-days-ago/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 12:42:53 +0000</pubDate>
		<dc:creator>Matt Bone</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://thatmattbone.com/?p=214</guid>
		<description><![CDATA[<a href="http://thatmattbone.com/2010/04/python-thirty-days-ago/" title="python thirty days ago"></a>These tiny things make Python fun and useful: import datetime thirty_days = datetime.timedelta&#40;days=30&#41; thirty_days_ago = datetime.date.today&#40;&#41; - thirty_days]]></description>
			<content:encoded><![CDATA[<a href="http://thatmattbone.com/2010/04/python-thirty-days-ago/" title="python thirty days ago"></a><p>These tiny things make Python fun and useful:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">datetime</span>
thirty_days = <span style="color: #dc143c;">datetime</span>.<span style="color: black;">timedelta</span><span style="color: black;">&#40;</span>days=<span style="color: #ff4500;">30</span><span style="color: black;">&#41;</span>
thirty_days_ago = <span style="color: #dc143c;">datetime</span>.<span style="color: black;">date</span>.<span style="color: black;">today</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> - thirty_days</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://thatmattbone.com/2010/04/python-thirty-days-ago/feed/</wfw:commentRss>
		<slash:comments>0</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[<a href="http://thatmattbone.com/2010/04/plotting-the-racial-makeup-of-chicagos-public-schools/" title="plotting the racial makeup of Chicago&#039;s public schools"></a>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 &#8230;<p class="read-more"><a href="http://thatmattbone.com/2010/04/plotting-the-racial-makeup-of-chicagos-public-schools/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://thatmattbone.com/2010/04/plotting-the-racial-makeup-of-chicagos-public-schools/" title="plotting the racial makeup of Chicago&#039;s public schools"></a><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>0</slash:comments>
		</item>
	</channel>
</rss>

