<?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>Mike Pirnat &#187; horror</title>
	<atom:link href="http://pirnat.com/mike/tag/horror/feed/" rel="self" type="application/rss+xml" />
	<link>http://pirnat.com/mike</link>
	<description>a leaf on the wind</description>
	<lastBuildDate>Wed, 09 Jun 2010 04:11:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>The Zen of Doing It Wrong</title>
		<link>http://pirnat.com/mike/2009/05/06/the-zen-of-doing-it-wrong/</link>
		<comments>http://pirnat.com/mike/2009/05/06/the-zen-of-doing-it-wrong/#comments</comments>
		<pubDate>Wed, 06 May 2009 19:50:52 +0000</pubDate>
		<dc:creator>mpirnat</dc:creator>
				<category><![CDATA[geekery]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[wtf]]></category>
		<category><![CDATA[diaper pattern]]></category>
		<category><![CDATA[horror]]></category>

		<guid isPermaLink="false">http://www.pirnat.com/mike/?p=1132</guid>
		<description><![CDATA[A coworker unearthed this little treasure today&#8230; I think it&#8217;s a vestigial structure to assist Diaper (anti)Pattern treatment during testing or debugging, but it&#8217;s still gross to see it in real, live production code.  (Oddly enough, I couldn&#8217;t find a good &#8220;Diaper Pattern&#8221; link whilst Googling about&#8211;surely I&#8217;m not the only one who uses [...]]]></description>
			<content:encoded><![CDATA[<p>A coworker unearthed this little treasure today&#8230; I <em>think</em> it&#8217;s a vestigial structure to assist Diaper (anti)Pattern treatment during testing or debugging, but it&#8217;s still gross to see it in real, live production code.  (Oddly enough, I couldn&#8217;t find a good &#8220;Diaper Pattern&#8221; link whilst Googling about&#8211;surely I&#8217;m not the only one who uses this term?)  Anyway, without further ado:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">        <span style="color: #ff7700;font-weight:bold;">try</span>:
            <span style="color: #dc143c;">os</span>.<span style="color: black;">remove</span><span style="color: black;">&#40;</span>filename<span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span>:
            <span style="color: #ff7700;font-weight:bold;">raise</span>
            <span style="color: #ff7700;font-weight:bold;">pass</span>
        <span style="color: #ff7700;font-weight:bold;">try</span>:
            <span style="color: #dc143c;">os</span>.<span style="color: black;">remove</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>TMP,<span style="color: #483d8b;">'out-%s'</span> <span style="color: #66cc66;">%</span> base_filename<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span>:
            <span style="color: #ff7700;font-weight:bold;">raise</span>
            <span style="color: #ff7700;font-weight:bold;">pass</span>
        <span style="color: #ff7700;font-weight:bold;">try</span>:
            <span style="color: #dc143c;">os</span>.<span style="color: black;">remove</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>TMP,<span style="color: #483d8b;">'properties_%s.lock'</span> <span style="color: #66cc66;">%</span> brandid_human<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">except</span>:
            <span style="color: #ff7700;font-weight:bold;">raise</span>
            <span style="color: #ff7700;font-weight:bold;">pass</span></pre></div></div>

<p>If an exception is raised, raise an exception&#8230; It has a certain zenlike beauty to its awfulness.  The use of the Diaper Pattern is bad enough, but this guarantees blowouts!</p>
]]></content:encoded>
			<wfw:commentRss>http://pirnat.com/mike/2009/05/06/the-zen-of-doing-it-wrong/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Python: You&#8217;re Doing It Wrong</title>
		<link>http://pirnat.com/mike/2008/11/25/python-youre-doing-it-wrong/</link>
		<comments>http://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" 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><span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Weep for us.</p>
]]></content:encoded>
			<wfw:commentRss>http://pirnat.com/mike/2008/11/25/python-youre-doing-it-wrong/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>
