<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="http://feeds.feedburner.com/~d/styles/itemcontent.css" type="text/css" media="screen"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Mike Pirnat » python</title>
	
	<link>http://www.pirnat.com/mike</link>
	<description>a leaf on the wind</description>
	<pubDate>Fri, 09 Jan 2009 04:59:59 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/PirnatPython" type="application/rss+xml" /><item>
		<title>Last Post</title>
		<link>http://feeds.feedburner.com/~r/PirnatPython/~3/499894669/</link>
		<comments>http://www.pirnat.com/mike/2008/12/31/last-post/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 02:23:52 +0000</pubDate>
		<dc:creator>mpirnat</dc:creator>
		
		<category><![CDATA[claire]]></category>

		<category><![CDATA[dojo]]></category>

		<category><![CDATA[life]]></category>

		<category><![CDATA[pycon]]></category>

		<category><![CDATA[python]]></category>

		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.pirnat.com/mike/?p=995</guid>
		<description><![CDATA[&#8230;of 2008.  (Not that I&#8217;m really blogging that much these days.)
Everyone else seems to be doing these big end-of-year posts, summarizing their years, their learning, achievements, setbacks, joys, and sorrows.  I&#8217;m not sure when it happened, but I&#8217;ve largely lost the patience to go on and on about my life (I guess Twitter [...]]]></description>
			<content:encoded><![CDATA[<p>&#8230;of 2008.  (Not that I&#8217;m really blogging that much these days.)</p>
<p>Everyone else seems to be doing these big end-of-year posts, summarizing their years, their learning, achievements, setbacks, joys, and sorrows.  I&#8217;m not sure when it happened, but I&#8217;ve largely lost the patience to go on and on about my life (I guess Twitter kind of takes care of that for me any more), so I&#8217;ll keep this short (if not sweet).</p>
<p>2008 was a year.  We had a miserable few months of illness and sleeplessness, followed by a good long stretch of absolute, utter joy with our daughter, Claire.  I read less than I like to, but greatly enjoyed what I did.  I wrote far less code for myself than I like to, but I was able to instigate a quantum leap in the level of Javascript written at work, as well as contributing a number of fixes back to the Dojo framework.  I played an awful, awful lot of Rock Band. I enjoyed PyCon and Velocity, in spite of their flaws, and I wish that work and family allowed me more time to contribute to the community.  I continued to grow as a photographer, though I was frustrated by several months of inaction and lack of inspiration from which I&#8217;m still trying to play catch-up.  And in these rocky economic times, I&#8217;m happy to remain in my position at American Greetings.</p>
<p>I&#8217;m overwhelmingly proud of my wife&#8217;s accomplishments, both academic and parental.  I&#8217;m ridiculously happy to be my daughter&#8217;s father&#8211;the role of Daddy suits me just fine; she amazes me daily and has truly transformed my emotional well-being.</p>
<p>I am immensely grateful for my friends, for my family, and my good fortune.  I hope for a better, more peaceful future in 2009, that we may all heal the hurts of these mad days and enjoy the fruits of the life we&#8217;re given.</p>
<p>To all who may read this, here&#8217;s a quick little toast to the passing of the old year and the dawning of the new.  Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pirnat.com/mike/2008/12/31/last-post/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.pirnat.com/mike/2008/12/31/last-post/</feedburner:origLink></item>
		<item>
		<title>Python: You’re Doing It Wrong</title>
		<link>http://feeds.feedburner.com/~r/PirnatPython/~3/465205661/</link>
		<comments>http://www.pirnat.com/mike/2008/11/25/python-youre-doing-it-wrong/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 16:33:33 +0000</pubDate>
		<dc:creator>mpirnat</dc:creator>
		
		<category><![CDATA[geekery]]></category>

		<category><![CDATA[python]]></category>

		<category><![CDATA[wtf]]></category>

		<category><![CDATA[horror]]></category>

		<guid isPermaLink="false">http://www.pirnat.com/mike/?p=950</guid>
		<description><![CDATA[A coworker just showed me this little gem&#8211;a maintenance script that&#8217;s got no author attribution and isn&#8217;t in source control, so whoever has perpetrated this crime against all that&#8217;s good and holy remains anonymous and (for the moment) safe from our wrath.  I&#8217;m so completely taken aback by this&#8211;I&#8230; I don&#8217;t know what to [...]]]></description>
			<content:encoded><![CDATA[<p>A coworker just showed me this little gem&#8211;a maintenance script that&#8217;s got no author attribution and isn&#8217;t in source control, so whoever has perpetrated this crime against all that&#8217;s good and holy remains anonymous and (for the moment) safe from our wrath.  I&#8217;m so completely taken aback by this&#8211;I&#8230; I don&#8217;t know what to say.  I just have to share.</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>,<span style="color: #dc143c;">sys</span>
C=<span style="color: #dc143c;">os</span>.<span style="color: black;">chdir</span>
S=<span style="color: #dc143c;">os</span>.<span style="color: black;">system</span>
M=<span style="color: #dc143c;">os</span>.<span style="color: black;">mkdir</span>
J=<span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span>
A=<span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">abspath</span>
D=<span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">dirname</span>
E=<span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span>
W=<span style="color: #dc143c;">sys</span>.<span style="color: black;">stdout</span>.<span style="color: black;">write</span>
V=<span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span>
X=<span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span>
ERR=<span style="color: #ff7700;font-weight:bold;">lambda</span> m:W<span style="color: black;">&#40;</span>m+<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
PRNT=<span style="color: #ff7700;font-weight:bold;">lambda</span> m:W<span style="color: black;">&#40;</span>m+<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">assert</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>V<span style="color: black;">&#41;</span>==<span style="color: #ff4500;">2</span>,<span style="color: #483d8b;">&quot;you must provide a sandbox name&quot;</span>
SB=V<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>
H=A<span style="color: black;">&#40;</span>D<span style="color: black;">&#40;</span>__file__<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
SBD=J<span style="color: black;">&#40;</span>D<span style="color: black;">&#40;</span>H<span style="color: black;">&#41;</span>,SB<span style="color: black;">&#41;</span>
C<span style="color: black;">&#40;</span>SBD<span style="color: black;">&#41;</span>
PST=J<span style="color: black;">&#40;</span>SBD,<span style="color: #483d8b;">'bin/paster'</span><span style="color: black;">&#41;</span>
VAR=J<span style="color: black;">&#40;</span>SBD,<span style="color: #483d8b;">'var'</span><span style="color: black;">&#41;</span>
ETC=J<span style="color: black;">&#40;</span>SBD,<span style="color: #483d8b;">'etc'</span><span style="color: black;">&#41;</span>
S<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;mkdir -p &quot;</span>+VAR<span style="color: black;">&#41;</span>
PRNT<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;restarting &quot;</span>+SB<span style="color: black;">&#41;</span>
CMD=<span style="color: #483d8b;">&quot;;&quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'source %s'</span><span style="color: #66cc66;">%</span>J<span style="color: black;">&#40;</span>SBD,<span style="color: #483d8b;">'bin/activate'</span><span style="color: black;">&#41;</span>,PST+<span style="color: #483d8b;">&quot; serve --daemon --pid-file=%s/sandbox.pid --log-file=%s/sandbox.log %s/sandbox.ini start&quot;</span><span style="color: #66cc66;">%</span><span style="color: black;">&#40;</span>VAR,VAR,ETC<span style="color: black;">&#41;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
PRNT<span style="color: black;">&#40;</span>CMD<span style="color: black;">&#41;</span>
S<span style="color: black;">&#40;</span>CMD<span style="color: black;">&#41;</span>
PRNT<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;All done!&quot;</span><span style="color: black;">&#41;</span>
X<span style="color: black;">&#40;</span>0<span style="color: black;">&#41;</span></pre></div></div>

<p>Weep for us.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pirnat.com/mike/2008/11/25/python-youre-doing-it-wrong/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.pirnat.com/mike/2008/11/25/python-youre-doing-it-wrong/</feedburner:origLink></item>
		<item>
		<title>A Unified Python Planet</title>
		<link>http://feeds.feedburner.com/~r/PirnatPython/~3/440039074/</link>
		<comments>http://www.pirnat.com/mike/2008/11/02/a-unified-python-planet/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 15:22:32 +0000</pubDate>
		<dc:creator>mpirnat</dc:creator>
		
		<category><![CDATA[geekery]]></category>

		<category><![CDATA[python]]></category>

		<category><![CDATA[rss]]></category>

		<category><![CDATA[feedburner]]></category>

		<category><![CDATA[pipes]]></category>

		<category><![CDATA[planet]]></category>

		<guid isPermaLink="false">http://www.pirnat.com/mike/?p=922</guid>
		<description><![CDATA[I subscribe to both the official and unofficial Python planet feeds because they&#8217;ve each got some content that&#8217;s unique to one or the other, but the overlap and duplication has really been bugging me lately.  So I suddenly remembered the joy that is Yahoo Pipes and glued both of them together with a unique-ifying [...]]]></description>
			<content:encoded><![CDATA[<p>I subscribe to both the <a href="http://planet.python.org/">official</a> and <a href="http://www.planetpython.org/">unofficial</a> Python planet feeds because they&#8217;ve each got some content that&#8217;s unique to one or the other, but the overlap and duplication has really been bugging me lately.  So I suddenly remembered the joy that is <a href="http://pipes.yahoo.com/pipes/">Yahoo Pipes</a> and glued both of them together with a unique-ifying filter to eliminate duplicates, and, feeling generous, I stuck a friendlier Feedburner URL around it&#8211;you can get it at <a href="http://feeds.feedburner.com/UnifiedPythonPlanet">http://feeds.feedburner.com/UnifiedPythonPlanet</a>.</p>
<p>It makes me pretty happy so far, except that somewhere in Pipes land I seem to be losing newlines in <code>pre</code> elements (which appears to be a bug in Pipes itself, argh), which is a little (very) annoying when trying to read people&#8217;s code samples.  I may end up replacing the Pipes side with a little bit of Python (a little Feedparser and PyRSS2Gen ought to do the trick) if I get the time later today.</p>
<p>Anyway. I figured I should share it, on the offchance it makes anyone else&#8217;s life better.  (Or if such a creature already exists, let me know and I&#8217;ll gladly use that instead.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pirnat.com/mike/2008/11/02/a-unified-python-planet/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.pirnat.com/mike/2008/11/02/a-unified-python-planet/</feedburner:origLink></item>
		<item>
		<title>Hopefully Minimizing Wheel Reinvention</title>
		<link>http://feeds.feedburner.com/~r/PirnatPython/~3/383708486/</link>
		<comments>http://www.pirnat.com/mike/2008/04/23/hopefully-minimizing-wheel-reinvention-2/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 23:43:09 +0000</pubDate>
		<dc:creator>mpirnat</dc:creator>
		
		<category><![CDATA[geekery]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.pirnat.com/2008/04/23/hopefully-minimizing-wheel-reinvention/</guid>
		<description><![CDATA[Dear Lazyweb:
I have a number of programming itches that I&#8217;d like to scratch that are just slightly large enough that I&#8217;d really love to just use something that already exists (if available).  I&#8217;d spend a while digging around, but, well&#8230; I&#8217;m lazy, and I&#8217;m busy.   So hopefully some of you have suggestions. [...]]]></description>
			<content:encoded><![CDATA[<p>Dear Lazyweb:</p>
<p>I have a number of programming itches that I&#8217;d like to scratch that are just slightly large enough that I&#8217;d really love to just use something that already exists (if available).  I&#8217;d spend a while digging around, but, well&#8230; I&#8217;m lazy, and I&#8217;m busy.   So hopefully some of you have suggestions.  I am looking for:</p>
<ul>
<li>an MSN Messenger client library (preferably in Python)</li>
<li>a Twitter client library (preferably in Python)</li>
<li>a solution for cross-posting between LiveJournal and Wordpress (either direction) that supports (or could be made to support with a minimum of pain) multiple LJ blogs on one end and multiple WP users on a shared blog (not that my wife really posts that much any more) on the other</li>
<li>a hosting provider that&#8217;s friendly to IM bots and is affordable (for some value of &#8220;affordable&#8221; that I have yet to precisely define, but which in all likelihood simply means that it won&#8217;t cause marital unrest)</li>
</ul>
<p>I may award bonus points if the MSN and Twitter suggestions are both written against Twisted.  I know Twisted&#8217;s got some MSN support, but I&#8217;ve not looked into it too closely and was a little disappointed by the state of the official docs and examples.</p>
<p>I currently host with <a href="http://www.webfaction.com/?affiliate=mpirnat">WebFaction</a> and though I&#8217;m normally entirely satisfied with them, I seem to recall that at one point they frowned on running IM bots on their shared hosting platforms, although I can&#8217;t immediately find anything expressly prohibiting it in their terms of service, AUP, knowledgebase, and support forums.</p>
<p>Thanks in advance!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pirnat.com/mike/2008/04/23/hopefully-minimizing-wheel-reinvention-2/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.pirnat.com/mike/2008/04/23/hopefully-minimizing-wheel-reinvention-2/</feedburner:origLink></item>
		<item>
		<title>Wait, How Old Is My Kid Again?</title>
		<link>http://feeds.feedburner.com/~r/PirnatPython/~3/383708487/</link>
		<comments>http://www.pirnat.com/mike/2008/04/22/wait-how-old-is-my-kid-again-2/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 03:19:22 +0000</pubDate>
		<dc:creator>mpirnat</dc:creator>
		
		<category><![CDATA[children]]></category>

		<category><![CDATA[claire]]></category>

		<category><![CDATA[geekery]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.pirnat.com/2008/04/22/wait-how-old-is-my-kid-again/</guid>
		<description><![CDATA[The thing about being a relatively new parent is that life very quickly becomes a complete blur, and after a certain point you&#8217;ve no sense of what day it is, let alone how many weeks old your little bundle of joy is.  This makes life tricky, since there are certain milestone weeks that are [...]]]></description>
			<content:encoded><![CDATA[<p>The thing about being a relatively new parent is that life very quickly becomes a complete blur, and after a certain point you&#8217;ve no sense of what day it is, let alone how many weeks old your little bundle of joy is.  This makes life tricky, since there are certain milestone weeks that are usually the harbingers of sudden shifts into higher levels of fussiness and sleep regression.</p>
<p>So what&#8217;s a frazzled dad to do?</p>
<p>Well, I do have Python, and I seem to have <a href="http://reader.google.com/">Google Reader</a> open an awful lot, and cron jobs are a lot better at remembering to do things than I am&#8230; So here&#8217;s my fifteen-minute solution that I whipped up the other week in between putting Claire down for her morning nap and getting ready for work.  (File names and URLs have been changed to protect the innocent.)</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">datetime</span>
<span style="color: #ff7700;font-weight:bold;">from</span> dateutil.<span style="color: black;">rrule</span> <span style="color: #ff7700;font-weight:bold;">import</span> rrule, DAILY, WEEKLY, MONTHLY
<span style="color: #ff7700;font-weight:bold;">import</span> PyRSS2Gen as RSS2
&nbsp;
<span style="color: #808080; font-style: italic;"># You'll want to change all of these values, obviously...</span>
KID_NAME = u<span style="color: #483d8b;">'Claire'</span>
BIRTHDAY = <span style="color: #dc143c;">datetime</span>.<span style="color: #dc143c;">datetime</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">2007</span>, <span style="color: #ff4500;">9</span>, <span style="color: #ff4500;">10</span>, <span style="color: #ff4500;">21</span>, <span style="color: #ff4500;">57</span><span style="color: black;">&#41;</span>
FEED_URL = <span style="color: #483d8b;">'http://yoursite/kids_age.xml'</span>
FILENAME = <span style="color: #483d8b;">'your_path/kids_age.xml'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> periods_between<span style="color: black;">&#40;</span>freq, start_date, end_date<span style="color: black;">&#41;</span>:
    rr = rrule<span style="color: black;">&#40;</span>freq, dtstart=start_date<span style="color: black;">&#41;</span>
    periods = <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>rr.<span style="color: black;">between</span><span style="color: black;">&#40;</span>start_date, end_date<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> periods
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> format_entry_body<span style="color: black;">&#40;</span>months, weeks, days<span style="color: black;">&#41;</span>:
    body = <span style="color: #483d8b;">&quot;&quot;&quot;&lt;h1&gt;Today, %(kid_name)s Is...&lt;/h1&gt;
    &lt;ul&gt;
        &lt;li&gt;%(months)s months&lt;/li&gt;
        &lt;li&gt;%(weeks)s weeks&lt;/li&gt;
        &lt;li&gt;%(days)s days&lt;/li&gt;;
    &lt;/ul&gt;
    &lt;p&gt;They grow up so fast!&lt;/p&gt;&quot;&quot;&quot;</span>
    kid_name = KID_NAME    <span style="color: #808080; font-style: italic;"># so we can cheat with locals()</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> body <span style="color: #66cc66;">%</span> <span style="color: #008000;">locals</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> make_rss<span style="color: black;">&#40;</span>body<span style="color: black;">&#41;</span>:
    now = <span style="color: #dc143c;">datetime</span>.<span style="color: #dc143c;">datetime</span>.<span style="color: black;">now</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #808080; font-style: italic;"># Add a hash component to the item link so that the RSS reader</span>
    <span style="color: #808080; font-style: italic;"># will recognize this as today's new entry...</span>
    item_url = FEED_URL+<span style="color: #483d8b;">'#'</span>+now.<span style="color: black;">strftime</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'%Y%m%d'</span><span style="color: black;">&#41;</span>
    rss = RSS2.<span style="color: black;">RSS2</span><span style="color: black;">&#40;</span>
        title=u<span style="color: #483d8b;">&quot;How Old Is %s?&quot;</span> <span style="color: #66cc66;">%</span> KID_NAME,
        link=FEED_URL,
        description=u<span style="color: #483d8b;">&quot;How old is %s in months, weeks, and days&quot;</span> \
            <span style="color: #66cc66;">%</span> KID_NAME,
        lastBuildDate=now,
&nbsp;
        items = <span style="color: black;">&#91;</span>
            RSS2.<span style="color: black;">RSSItem</span><span style="color: black;">&#40;</span>
                title=u<span style="color: #483d8b;">&quot;How old is %s today?&quot;</span> <span style="color: #66cc66;">%</span> KID_NAME,
                link=item_url,
                description=body,
                guid=RSS2.<span style="color: black;">Guid</span><span style="color: black;">&#40;</span>item_url<span style="color: black;">&#41;</span>,
                pubDate=now,
            <span style="color: black;">&#41;</span>
        <span style="color: black;">&#93;</span>
    <span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> rss
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> to_xml<span style="color: black;">&#40;</span>rss<span style="color: black;">&#41;</span>:
    <span style="color: #dc143c;">xml</span> = rss.<span style="color: black;">to_xml</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #808080; font-style: italic;"># Make our xml at least a tiny bit human-readable</span>
    <span style="color: #dc143c;">xml</span> = <span style="color: #dc143c;">xml</span>.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'&gt;&lt;'</span>, <span style="color: #483d8b;">'&gt;<span style="color: #000099; font-weight: bold;">\n</span>&lt;'</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #dc143c;">xml</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    now = <span style="color: #dc143c;">datetime</span>.<span style="color: #dc143c;">datetime</span>.<span style="color: black;">now</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    months = periods_between<span style="color: black;">&#40;</span>MONTHLY, BIRTHDAY, now<span style="color: black;">&#41;</span>
    weeks = periods_between<span style="color: black;">&#40;</span>WEEKLY, BIRTHDAY, now<span style="color: black;">&#41;</span>
    days = periods_between<span style="color: black;">&#40;</span>DAILY, BIRTHDAY, now<span style="color: black;">&#41;</span>
    body = format_entry_body<span style="color: black;">&#40;</span>months, weeks, days<span style="color: black;">&#41;</span>
    rss = make_rss<span style="color: black;">&#40;</span>body<span style="color: black;">&#41;</span>
    <span style="color: #dc143c;">xml</span> = to_xml<span style="color: black;">&#40;</span>rss<span style="color: black;">&#41;</span>
    f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>FILENAME, <span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span>
    f.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">xml</span><span style="color: black;">&#41;</span>
    f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    main<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p></p>
<p>You will, of course, have to install <a href="http://labix.org/python-dateutil">dateutil</a> (via easy_install) and <a href="http://www.dalkescientific.com/Python/PyRSS2Gen.html">PyRSS2Gen</a> (the old-school tarball way) so that they can do the heavy lifting for you.</p>
<p>Then all that&#8217;s left is to cron it to run daily, and point your favorite RSS reader at the feed.  Voila!  You&#8217;re on top of exactly how old your kid is, and quickly on your way to becoming Parent of the Year.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pirnat.com/mike/2008/04/22/wait-how-old-is-my-kid-again-2/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.pirnat.com/mike/2008/04/22/wait-how-old-is-my-kid-again-2/</feedburner:origLink></item>
		<item>
		<title>Google App Engine Set to Rock My Socks</title>
		<link>http://feeds.feedburner.com/~r/PirnatPython/~3/383708488/</link>
		<comments>http://www.pirnat.com/mike/2008/04/08/google-app-engine-set-to-rock-my-socks/#comments</comments>
		<pubDate>Tue, 08 Apr 2008 13:59:00 +0000</pubDate>
		<dc:creator>mpirnat</dc:creator>
		
		<category><![CDATA[geekery]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://exilejedi.livejournal.com/197306.html</guid>
		<description><![CDATA[Google App Engine seems pretty freaking sweet to me.  In short:

write apps in Python
deploy on Google&#8217;s infrastructure
access to existing Google goodness like BigTable, email, and authentication
free account can use up to 500MB of storage and serve ~5M page views/month
non-free accounts coming soon
can upload additional modules as long as they fit the sandbox rules

Unfortunately the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://code.google.com/appengine/docs/whatisgoogleappengine.html">Google App Engine</a> seems pretty freaking sweet to me.  In short:</p>
<ul>
<li>write apps in Python</li>
<li>deploy on Google&#8217;s infrastructure</li>
<li>access to existing Google goodness like BigTable, email, and authentication</li>
<li>free account can use up to 500MB of storage and serve ~5M page views/month</li>
<li>non-free accounts coming soon</li>
<li>can upload additional modules as long as they fit the sandbox rules</li>
</ul>
<p>Unfortunately the beta test pool filled up almost immediately, so I don&#8217;t get to play with this yet&#8230; But it&#8217;s definitely exciting that Python&#8217;s in such a spotlight lately.</p>
<p>And check out the <a href="http://qik.com/video/51365">video of Guido van Rossum</a> talking about App Engine&#8230;</p>
<div class="lj-currents">
<ul>
<li><span class="entryMetadata-label">Mood:</span><span class="entryMetadata-content">pythonic</span></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.pirnat.com/mike/2008/04/08/google-app-engine-set-to-rock-my-socks/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.pirnat.com/mike/2008/04/08/google-app-engine-set-to-rock-my-socks/</feedburner:origLink></item>
		<item>
		<title>PyCon 2010 in Cleveland?  Yes Please!</title>
		<link>http://feeds.feedburner.com/~r/PirnatPython/~3/383708489/</link>
		<comments>http://www.pirnat.com/mike/2008/03/30/pycon-2010-in-cleveland-yes-please/#comments</comments>
		<pubDate>Sun, 30 Mar 2008 04:05:00 +0000</pubDate>
		<dc:creator>mpirnat</dc:creator>
		
		<category><![CDATA[clepy]]></category>

		<category><![CDATA[cleveland]]></category>

		<category><![CDATA[pycon]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://exilejedi.livejournal.com/194705.html</guid>
		<description><![CDATA[There&#8217;s a lot of excitement on the ClePy mailing list about trying to bring PyCon to Cleveland in 2010.  David Stanek is leading the charge, getting folks talking, and planning, and motivated.
Clevelanders who want to help out bringing Python&#8217;s premier conference to our fair city should head on over to the bid page on [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a lot of excitement on the <a href="http://groups.google.com/group/clepy/">ClePy mailing list</a> about trying to bring PyCon to Cleveland in 2010.  <a href="http://www.traceback.org/2008/03/08/cleveland-bidding-for-pycon-2010/">David Stanek</a> is leading the charge, getting folks talking, and planning, and motivated.</p>
<p>Clevelanders who want to help out bringing Python&#8217;s premier conference to our fair city should head on over to <a href="http://wiki.python.org/moin/PyCon2010ClevelandBid">the bid page on the Python wiki</a> and lend their names and support.</p>
<p>Non-Clevelanders, have no fear!  Cleveland&#8217;s really quite misunderstood and under-appreciated.  We&#8217;ve got a great restaurant scene (we&#8217;re home to the <a href="http://money.cnn.com/2007/11/12/smbusiness/iron_chef_episode_6.fsb/index.htm?postversion=2007111218">newest Iron Chef</a>!), tons of attractions (like the <a href="http://www.glsc.org/">Science Center</a> and <a href="http://www.rockhall.com/">Rock Hall</a>), <a href="http://cleveland.about.com/od/museums/Cleveland_Museums.htm">world-class museums</a> and other cultural institutions (maybe a few of you have heard of the <a href="http://www.clevelandorchestra.com/html/index.asp">Cleveland Orchestra</a>, which is rated among the top 3-5 worldwide), the nation&#8217;s second largest <a href="http://www.playhousesquare.com/">performing arts center</a>, beautiful parks and lake views, and more&#8211;all within walking distance of either the likely conference site or available with a quick jaunt on the rapid transit system.  Plus the river hasn&#8217;t caught on fire for decades, but you can savor the legacy with <a href="http://www.greatlakesbrewing.com/beerProfile.php?beer_id=2">really good local beer</a>. <img src='http://www.pirnat.com/mike/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>In short, there&#8217;s plenty to love about bringing PyCon to Cleveland.  Let&#8217;s do it!</p>
<div class="lj-currents">
<ul>
<li><span class="entryMetadata-label">Mood:</span><span class="entryMetadata-content">pythonic</span></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.pirnat.com/mike/2008/03/30/pycon-2010-in-cleveland-yes-please/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.pirnat.com/mike/2008/03/30/pycon-2010-in-cleveland-yes-please/</feedburner:origLink></item>
		<item>
		<title>Processing PyCon 2008</title>
		<link>http://feeds.feedburner.com/~r/PirnatPython/~3/383708490/</link>
		<comments>http://www.pirnat.com/mike/2008/03/16/processing-pycon-2008-2/#comments</comments>
		<pubDate>Mon, 17 Mar 2008 04:07:04 +0000</pubDate>
		<dc:creator>mpirnat</dc:creator>
		
		<category><![CDATA[food]]></category>

		<category><![CDATA[geekery]]></category>

		<category><![CDATA[photos]]></category>

		<category><![CDATA[pycon]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.pirnat.com/2008/03/16/processing-pycon-2008/</guid>
		<description><![CDATA[   Stairway    Originally uploaded by mikepirnat.
The security line at O&#8217;Hare was almost non-existent, so now I&#8217;ve got a bit of time to kill and (since &#8220;free wireless network&#8221; doesn&#8217;t seem to want to give me any DNS) have the laptop open, it&#8217;s probably time to digest and process my PyCon [...]]]></description>
			<content:encoded><![CDATA[<div style="float: right; margin-left: 10px; margin-bottom: 10px;"><a href="http://www.flickr.com/photos/mikepirnat/2332655512/" title="Stairway by mikepirnat, on Flickr"><img src="http://farm4.static.flickr.com/3114/2332655512_7faa9ae593_m.jpg" width="240" height="160" alt="Stairway" /></a><br /> <span style="font-size: 0.9em; margin-top: 0px;">  <a href="http://www.flickr.com/photos/mikepirnat/2332655512/">Stairway</a>  <br />  Originally uploaded by <a href="http://www.flickr.com/people/mikepirnat/">mikepirnat</a>.</div>
<p>The security line at O&#8217;Hare was almost non-existent, so now I&#8217;ve got a bit of time to kill and (since &#8220;free wireless network&#8221; doesn&#8217;t seem to want to give me any DNS) have the laptop open, it&#8217;s probably time to digest and process my <a href="http://us.pycon.org/2008/">PyCon</a> experience.</p>
<p>Overall, I felt strangely disconnected this year.  I didn&#8217;t end up dining with any of the circles I&#8217;d overlapped with in years past, didn&#8217;t go to any parties, didn&#8217;t stay up late hacking on personal projects, didn&#8217;t hang out on the IRC channel (thanks a lot, wonky wi-fi), didn&#8217;t have a presentation to worry about, and didn&#8217;t end up being able to wake up in time to get my name on the list for Lightning Talks.  Heck, since I didn&#8217;t have the laptop out much, I barely even took notes this year.</p>
<p>What I did do was shoot a lot of photos, some of them acceptable, nearly filling my 2GB card over the course of the conference.  I&#8217;ve only had time to upload one as I just haven&#8217;t had the time, motivation, or energy to sort through everything at the hotel.  (And it&#8217;s not like uploading via the sippy-straw of the hotel&#8217;s in-room wireless would have been terribly practical either.)  I enjoyed briefly meeting <a href="http://www.sauria.com/blog/">Ted Leung</a> before the opening keynote, and was amazed (and somewhat intimidated) by the number and variety of fancy camera toys he&#8217;d brought with him as he performed his duties as official photo dude.  A number of folks stopped me and asked me questions about my camera and flash; I tried not to sound like too much of a moron when answering them.  The weird thing is that everyone assumes if you are toting a DSLR around that you can&#8217;t possibly take bad pictures with &#8220;a camera like that,&#8221; when in reality shooting with a DSLR is the fastest way to find out exactly how much you suck at photography.  I can get some good (and sometimes above-average) results, but I really have to work at it, so I try to stay humble.  Also it helps to never show anyone your bad shots. <img src='http://www.pirnat.com/mike/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>While I&#8217;m still on the camera talk, I learned that I need to bring extra batteries for the flash, recharge the camera battery while I sleep or bring a spare, and that I should probably buy a spare memory card so that I don&#8217;t feel any last-day storage pressures when I&#8217;ve been too lazy to dump things down to my laptop.  I&#8217;ve also learned to swallow my pride and kick the camera over to automatic metering when the lighting is tricky and I need to shoot quickly&#8211;I have some almost-good shots ruined by camera shake that could have been avoided if I hadn&#8217;t been trying to be all manly and shooting in full manual with no flash.  Finally, a happy discovery&#8211;the <a href="http://www.joby.com/products/gorillapod/slrzoom/">bad-ass heavy-grade Gorillapod</a> that my wife gave me for Christmas makes an excellent hybrid of monopod (albeit rather short) and grip/brace.  I found that I could keep the camera very steady by placing two of the legs against my body and supporting the camera with the third, making it easy to track and shoot moving subjects without too much wobble.</p>
<p>On the dining front, the huge posse of Cleveland folks managed to get out to some tasty meals.  On Wednesday night we lucked into an unheard of thirty-second wait for a table at <a href="http://pycon.bringthegoat.com/2008/03/13/dinner-at-frontera-grill/">Frontera Grill</a> and enjoyed a meal that simply cannot be described in words.  Friday night we (along with Bill Zingler, a compadre from the Turbogears sprint in &#8216;06) hoofed it down to <a href="http://www.theram.com/">Ram</a>, a grill and brewhouse, where the beer and food were pretty good.  We didn&#8217;t stay for too long though as we were greatly outnumbered by a vast sea of douchebaggery&#8211;drunken BMW-driving jerks in their sport jackets acting out a sad, strange re-enactment of their college (or more likely high school) days.  We rounded things out on Saturday with a visit to the local <a href="http://www.giordanos.com/">Giordano&#8217;s</a> for deep-dish pizza, a first for one of our number, where we proceeded to annihilate their supply of <a href="http://www.newbelgium.com/beers_ft.php">Fat Tire</a>.</p>
<p>Gosh, that&#8217;s an awful lot of text without really even talking about the conference&#8230; Which might in itself be a comment about the conference.</p>
<p>Everyone knows the wireless network was stinky, so I won&#8217;t spend too much time one that.  It wasn&#8217;t until this afternoon that I was able to even connect in any way approaching reliability.  By then, really, there wasn&#8217;t much point.</p>
<p>It seems like the consensus is that the <a href="http://groups.google.com/group/comp.lang.python/browse_thread/thread/2b6cb0e7245347be/363c0a5eb952a263%23363c0a5eb952a263">Lightning Talks really suffered this year</a> from the overwhelming dominance of the (lackluster) sponsor talks, to which I can only agree.  It was really disappointing to see so little time available to community speakers during what, to me, is really the heart and soul of PyCon.  There were a few gems on Friday and Saturday, but mostly&#8230; ho-hum.</p>
<p>And I was underwhelmed by a lot of the presentations too.  A lot of things that I thought would be really useful or deep ended up being too light, too dull, or just not well presented.   I seemed to have a knack for picking a lot of duds.  Even two thirds of the tutorials that I attended (Eggs and Testing) were letdowns, due to the lack of being able to do any of the exercise material thanks to the network (Eggs), and the repetition of material from last year&#8217;s PyCon (Testing).</p>
<p>The big wins for me were the Advanced SQLAlchemy tutorial (slide runner rocks! and if it&#8217;s possible to be in love with an ORM, I think I am!), <a href="http://www.blueskyonmars.com/">Kevin Dangoor</a>&#8217;s talk about TG2 and Dojo, and John Harrison&#8217;s <a href="http://www.kulturblog.com/2007/11/marshie-attacks-halloween-interactive-driveway-activity/">insanely cool Halloween</a> <a href="http://panela.blog-city.com/laser_guns_webcams_marshmellows_python_and_halloween.htm">laser-zapping extravaganza</a>, which was probably the most fun presentation I&#8217;ve been to in four years of attending PyCon.  The first two will have practical benefit for me in my daily existence, and the latter&#8211;complete with head-tracking, 3D VR goodness&#8211;was just frickin&#8217; awesome.  A note to future PyCon presenters when coming up with your proposals&#8211;lasers, lasers, LASERS!</p>
<p>I don&#8217;t mean to be so down on PyCon.  I had a good time, I was just exhausted from one end to the next.  Exhausted before I even left, exhausted while I was there, and (surprise surprise) exhausted now that I&#8217;m home.  I did really enjoy meeting folks, networking a bit, and soaking in the vibe&#8230; It just didn&#8217;t manage to leave me as energized as I&#8217;d gotten used to, spoiled as I&#8217;ve been by <a href="http://exilejedi.livejournal.com/tag/pycon">PyCons past</a>.  Though stumbling across the excellent performance of &#8220;Stairway to Heaven&#8221; in the atrium thoroughly lifted my spirits.  So few people seemed to even notice that it was almost like a private gift just for me.</p>
<p>I&#8217;ve got about seven hundred photos to wade through to find promising candidates to share; please bear with me as the lucky few take their time to escape into my <a href="http://www.flickr.com/photos/mikepirnat/sets/72157604123255562/">Flickr stream</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pirnat.com/mike/2008/03/16/processing-pycon-2008-2/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.pirnat.com/mike/2008/03/16/processing-pycon-2008-2/</feedburner:origLink></item>
		<item>
		<title>Google Chart API Released</title>
		<link>http://feeds.feedburner.com/~r/PirnatPython/~3/383708491/</link>
		<comments>http://www.pirnat.com/mike/2007/12/06/google-chart-api-released/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 02:35:00 +0000</pubDate>
		<dc:creator>mpirnat</dc:creator>
		
		<category><![CDATA[geekery]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://exilejedi.livejournal.com/189606.html</guid>
		<description><![CDATA[I&#8217;ve been looking for a decent chart or graph library lately for a soon-to-be-hatched personal project, and been largely disappointed by the state of what&#8217;s available for Python.  The freely available choices all felt a bit clunky to me, either in usage or in output (or in some cases, both), and the strongest contender [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been looking for a decent chart or graph library lately for a soon-to-be-hatched personal project, and been largely disappointed by the state of what&#8217;s available for Python.  The freely available choices all felt a bit clunky to me, either in usage or in output (or in some cases, both), and the strongest contender (ChartDirector) was disqualified because of the licensing cost.  I&#8217;d also looked at a few Javascript libraries, but really didn&#8217;t want to be stuck depending on client-side scripting for a variety of reasons (not the least of which is load on the client&#8211;it&#8217;s amazing what a couple of simple charts in a Google Spreadsheets document will do to the performance of even pretty studly machines).</p>
<p>So I was pretty happy today to see Google <a href="http://google-code-updates.blogspot.com/2007/12/embed-charts-in-webpages-with-one-of.html">announce today</a> that they are making their <a href="http://code.google.com/apis/chart/">Google Chart API</a> available for public use.  It&#8217;s a pretty straightforward, stateless HTTP service:  just fire off a properly-formatted GET and receive a PNG image in return.   They support line charts, bar charts, pie charts, Venn diagrams, and scatter plots, labels, legends, and a plethora of coloring and styling options.  And the output appears fairly pleasing to my eye.</p>
<p>There are a couple of caveats, though&#8230;</p>
<ul>
<li>You are limited to 50,000 queries per user per day, which may pose some scalability concerns if you plan to build something big on this.</li>
<li>You have to be careful about the number of data points you submit in your request as you can quickly exceed the allowable URL length, and furthermore you might end up with illegibly smooshed-together data points due to the scale of your output.</li>
<li>There&#8217;s always the &#8220;OMG Google will absorb all our data and become sentient, turn evil, and unleash an army of death robots on us all, run for your lives!&#8221; paranoia, but that&#8217;s really just silly talk.</li>
</ul>
<p>WIth those hazards in mind, this still seems like it will be very useful for me, at least in the short term.  I am of course open to other suggestions and opinions if people would like to share them; if you&#8217;ve had good experiences with some charting library that might fit my needs, please let me know!</p>
<div class="lj-currents">
<ul>
<li><span class="entryMetadata-label">Mood:</span><span class="entryMetadata-content">pleased</span></li>
</ul>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.pirnat.com/mike/2007/12/06/google-chart-api-released/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.pirnat.com/mike/2007/12/06/google-chart-api-released/</feedburner:origLink></item>
		<item>
		<title>ClePy Catch-Up: Asterisk and Pagoda and Web Tools, Oh My!</title>
		<link>http://feeds.feedburner.com/~r/PirnatPython/~3/383708492/</link>
		<comments>http://www.pirnat.com/mike/2007/10/03/clepy-catchup-asterisk-and-pagoda-and-web-tools-oh-my/#comments</comments>
		<pubDate>Thu, 04 Oct 2007 03:09:00 +0000</pubDate>
		<dc:creator>mpirnat</dc:creator>
		
		<category><![CDATA[clepy]]></category>

		<category><![CDATA[geekery]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://exilejedi.livejournal.com/187816.html</guid>
		<description><![CDATA[I missed the September ClePy meeting because I was too busy helping my wife fork a child process (there seems to be an awful lot of that going around the Python community lately, based on what I&#8217;ve seen on the Planet feeds&#8211;something in the water, perhaps?).  But I hear that Brian Beck put together [...]]]></description>
			<content:encoded><![CDATA[<p>I missed the September <a href="http://www.clepy.org">ClePy</a> meeting because I was too busy helping my wife fork <a href="http://www.flickr.com/photos/mikepirnat/sets/72157602022880867/">a child process</a> (there seems to be an awful lot of that going around the Python community lately, based on what I&#8217;ve seen on the <a href="http://planet.python.org">Planet</a> <a href="http://planetpython.org">feeds</a>&#8211;something in the water, perhaps?).  But I hear that <a href="http://www.brianbeck.com/">Brian Beck</a> put together <a href="http://exogen.case.edu/clepy_pagoda/">some nice slides</a> for his talk on his Pagoda CMS system, and Nick Barendt clued folks into how to run their own open-source <a href="http://en.wikipedia.org/wiki/Asterisk_PBX">PBX</a> with <a href="http://www.barendt.com/AsteriskAndAGI.pdf">Asterisk and AGI</a>.</p>
<p>Asterisk turned up again during open discussion at this Monday&#8217;s meeting; while getting caught up, I got the scoop on Asterisk (since I&#8217;d missed the talk and been too busy with baby and work to read Nick&#8217;s PDF) and we had a good time talking about crazy PBX tricks; the coolest idea was to use Asterisk to hook up your desk phone as a combination lock to trigger a secret door to your underground lair (awesome!).</p>
<p>The meeting proper was a short one due to the sudden absence of one of our speakers; Monday&#8217;s lone presenter was <a href="http://blog.extracheese.org/">Gary Bernhardt</a>, who put three great packages together&#8211;<a href="http://code.google.com/p/httplib2/">httplib2</a>, <a href="http://www.crummy.com/software/BeautifulSoup/">Beautiful Soup</a>, and <a href="http://feedparser.org">Feedparser</a>&#8211;for a discussion of &#8220;Talking to the Web with Python.&#8221;  In a particularly interesting example, Gary showed us how to combine Beautiful Soup with Feedparser to build a Technorati-ish blog link extractor in eight lines of code.  Note that combining these in a nice, sparse nested loop structure (or even in a super-l33t list comprehension) is a fabulous way to peg your CPU (you have been warned).</p>
<p>Our next meeting will be November 5&#8211;if chance finds you in the greater Cleveland  area, drop on by!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pirnat.com/mike/2007/10/03/clepy-catchup-asterisk-and-pagoda-and-web-tools-oh-my/feed/</wfw:commentRss>
		<feedburner:origLink>http://www.pirnat.com/mike/2007/10/03/clepy-catchup-asterisk-and-pagoda-and-web-tools-oh-my/</feedburner:origLink></item>
	</channel>
</rss>
