<?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>shazow.net &#187; code</title>
	<atom:link href="http://shazow.net/blog/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://shazow.net/blog</link>
	<description>The cake is a lie</description>
	<lastBuildDate>Sun, 23 May 2010 22:13:50 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Gentoo, Rockband, Code, and Music</title>
		<link>http://shazow.net/blog/2008/04/02/gentoo-rockband-code-and-music/</link>
		<comments>http://shazow.net/blog/2008/04/02/gentoo-rockband-code-and-music/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 03:32:24 +0000</pubDate>
		<dc:creator>shazow</dc:creator>
				<category><![CDATA[Art]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[School]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[rockband]]></category>
		<category><![CDATA[workerpool]]></category>

		<guid isPermaLink="false">http://shazow.net/blog/?p=120</guid>
		<description><![CDATA[

Today, you&#8217;ll get to hear about what I&#8217;ve been up to! This wont be on the exam.


After a year and a half stint with Ubuntu, I&#8217;m back to my true love Gentoo. That is, with a shiny matte new quad core beast of a machine.
Bought Rockband for my PS3 couple of weeks ago. Drums are [...]]]></description>
			<content:encoded><![CDATA[<div style="text-align: center"><img src="http://shazow.net/blog/wp-content/uploads/2008/04/rockband.png" alt="" title="rockbanding" style="border: 0;"/></div>
<p>
Today, you&#8217;ll get to hear about what I&#8217;ve been up to! This wont be on the exam.
</p>
<ul>
<li>After a year and a half stint with <a href="http://www.ubuntu.com/">Ubuntu</a>, I&#8217;m back to my true love <a href="http://www.gentoo.org">Gentoo</a>. That is, with a <s>shiny</s> matte new quad core beast of a machine.</li>
<li>Bought <a href="http://en.wikipedia.org/wiki/Rock_Band_(video_game)">Rockband</a> for my PS3 couple of weeks ago. Drums are ridiculously hard. Been rocking out. Good fun is being had by all those who dare rock. Can&#8217;t wait for <a href="http://www.ps3fanboy.com/2008/03/31/rock-band-john-coultons-still-alive-on-psn-april-17/"><em>Still Alive</em> to be released</a> for free. It shall be a triumph!</li>
<li>What started out as <a href="http://shazow.net/blog/2008/01/24/code-storytelling/">pretty code</a> is now a bonafide open source Python module: <a href="http://code.google.com/p/workerpool/">workerpool</a>. People are using it. No, really.</li>
<li><a href="http://muxtape.com/">muxtape.com</a>: A super simple music sharing web app launched last week. Its been enriching my life &mdash; doing what <a href="http://www.pandora.com">Pandora</a> once did. Here&#8217;s <a href="http://shazow.muxtape.com/">my muxtape</a>. Be right back, <span title="Who is it? What? I don't know any Arayaa...?" style="border-bottom: 1px dashed #ccc;">there&#8217;s someone at the door</span>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://shazow.net/blog/2008/04/02/gentoo-rockband-code-and-music/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Code storytelling</title>
		<link>http://shazow.net/blog/2008/01/24/code-storytelling/</link>
		<comments>http://shazow.net/blog/2008/01/24/code-storytelling/#comments</comments>
		<pubDate>Thu, 24 Jan 2008 05:49:01 +0000</pubDate>
		<dc:creator>shazow</dc:creator>
				<category><![CDATA[Rants]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[storytelling]]></category>

		<guid isPermaLink="false">http://shazow.net/blog/?p=116</guid>
		<description><![CDATA[It&#8217;s fun writing code that tells a story. Hopefully it&#8217;s also fun reading it.



class TerminationNotice&#40;Exception&#41;:
    &#34;Exception raised inside a thread when it's time for it to die.&#34;
    pass
&#160;
class SuicideJob&#40;QueryJob&#41;:
    &#34;A worker receiving this job will commit suicide.&#34;
    def run&#40;self&#41;:
     [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s fun writing code that tells a story. Hopefully it&#8217;s also fun reading it.</p>
<hr style="border: 1px dashed #ccc; margin: 1em;" />
<div style="font-size: 10px;">

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">class</span> TerminationNotice<span style="color: black;">&#40;</span><span style="color: #008000;">Exception</span><span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;Exception raised inside a thread when it's time for it to die.&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">pass</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> SuicideJob<span style="color: black;">&#40;</span>QueryJob<span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;A worker receiving this job will commit suicide.&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> run<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">raise</span> TerminationNotice<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> QueryWorker<span style="color: black;">&#40;</span>Thread<span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;Devoted worker who will pull jobs from the `jobs` queue and perform them.&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, jobs<span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: black;">jobs</span> = jobs
        Thread.<span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> run<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;Get jobs from the queue and perform them.&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #ff4500;">1</span>:
            job = <span style="color: #008000;">self</span>.<span style="color: black;">jobs</span>.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">isinstance</span><span style="color: black;">&#40;</span>job, QueryJob<span style="color: black;">&#41;</span>:
                debug.<span style="color: black;">error</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;%r ate a job that wasn't a edible: %r&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, job<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
                <span style="color: #ff7700;font-weight:bold;">continue</span>
            <span style="color: #ff7700;font-weight:bold;">try</span>:
                job.<span style="color: black;">run</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">except</span> TerminationNotice:
                <span style="color: #808080; font-style: italic;"># Nice knowing you :(</span>
                <span style="color: #ff7700;font-weight:bold;">break</span></pre></div></div>

</div>
]]></content:encoded>
			<wfw:commentRss>http://shazow.net/blog/2008/01/24/code-storytelling/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

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