<?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>Michael Conigliaro &#187; Programming</title>
	<atom:link href="http://conigliaro.org/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://conigliaro.org</link>
	<description>cat /dev/brain &#124; grep technology &#62;&#62; blog</description>
	<lastBuildDate>Wed, 25 Aug 2010 23:46:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to ensure that only one instance of a script can run at a time</title>
		<link>http://conigliaro.org/2010/07/17/how-to-ensure-that-only-one-instance-of-a-script-can-run-at-a-time/</link>
		<comments>http://conigliaro.org/2010/07/17/how-to-ensure-that-only-one-instance-of-a-script-can-run-at-a-time/#comments</comments>
		<pubDate>Sat, 17 Jul 2010 21:55:05 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://conigliaro.org/?p=950</guid>
		<description><![CDATA[Whenever someone asks for a quick way to ensure that only one instance of a script can run at a time, I see a lot of people giving advice involving temporary lock/PID files (see here, here, and here). This is probably fine for most purposes, but I wonder why more people don&#8217;t just check the [...]]]></description>
			<content:encoded><![CDATA[<p>Whenever someone asks for a quick way to ensure that only one instance of a script can run at a time, I see a lot of people giving advice involving temporary lock/PID files (see <a href="http://stackoverflow.com/questions/185451/quick-and-dirty-way-to-ensure-only-one-instance-of-a-shell-script-is-running-at-a">here</a>, <a href="http://stackoverflow.com/questions/661684/how-to-ensure-only-one-instance-of-a-ruby-script-is-running-at-a-time">here</a>, and <a href="http://stackoverflow.com/questions/3080991/having-trouble-allowing-only-one-instance-of-a-php-script-at-a-time-using-cron">here</a>). This is probably fine for most purposes, but I wonder why more people don&#8217;t just check the process table:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">SCRIPT_NAME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> $<span style="color: #000000;">0</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">`</span>pgrep <span style="color: #660033;">-c</span> <span style="color: #800000;">${SCRIPT_NAME}</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #660033;">-gt</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Error: An instance of this script is already running!&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>This fragment uses <strong>pgrep</strong> to count the number of running processes with the same name as the currently running script. If the number of these processes is greater than one (the current script will always be counted), then we know that another instance is already running. </p>
<p>As far as I know (and I hope someone will correct me if I&#8217;m wrong), this technique avoids the race conditions associated with lock/PID files. It also avoids the possibility of orphaned lock/PID files in the event that your script doesn&#8217;t complete and is unable to clean up after itself.</p>
]]></content:encoded>
			<wfw:commentRss>http://conigliaro.org/2010/07/17/how-to-ensure-that-only-one-instance-of-a-script-can-run-at-a-time/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>dynect4r: A Ruby Library and Command Line Client for the Dynect REST API (Version 2)</title>
		<link>http://conigliaro.org/2010/07/09/dynect4r-a-ruby-library-and-command-line-client-for-the-dynect-rest-api-version-2/</link>
		<comments>http://conigliaro.org/2010/07/09/dynect4r-a-ruby-library-and-command-line-client-for-the-dynect-rest-api-version-2/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 16:39:54 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[DNS]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://conigliaro.org/?p=943</guid>
		<description><![CDATA[Well, I should have listened to everyone who warned me about UltraDNS&#8217;s obscene prices. But I figured it&#8217;s only DNS, so how much more could they be compared to their competition? $50 per month? Maybe $100? Boy was I surprised to find out that UltraDNS&#8217;s prices are literally 10-25 times more than everyone else&#8217;s! Hilarious&#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I should have listened to everyone who warned me about UltraDNS&#8217;s obscene prices. But I figured it&#8217;s only DNS, so how much more could they be compared to their competition? $50 per month? Maybe $100? Boy was I surprised to find out that UltraDNS&#8217;s prices are literally 10-25 times more than everyone else&#8217;s! Hilarious&#8230;</p>
<p>I&#8217;ve actually been a <a href="http://www.dyndns.com/">DynDNS</a> customer since the late nineties or so (I have free custom DNS service for life for making a donation to them back when they were a <em>much</em> smaller company), so I had looked at <a href="http://dyn.com/">Dyn.com</a>&#8216;s products before. I just must have gotten confused with all their different websites and DNS products, because I somehow got the impression that the DynDNS API wasn&#8217;t powerful enough to do what I wanted to do. I was absolutely wrong. After having written command line clients for both APIs (see <a href="/2010/05/15/ultradns4r-a-ruby-library-and-command-line-client-for-the-neustar-ultradns-soap-api/">ultradns4r</a>, and now <a href="http://github.com/mconigliaro/dynect4r">dynectr4</a>), I think I speak from authority when I say the Dynect API is every bit as powerful as UltraDNS&#8217;s. And at 1/10th &#8211; 1/25th the cost of UltraDNS, going with Dynect is a no-brainer. But I&#8217;ve digressed long enough.</p>
<p>I wrote dynect4r for the same reason I wrote ultradns4r; I wanted to be able to manage all my DNS records via the command line. And now that I&#8217;ve learned how to package Ruby projects as gems, you can simply&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem <span style="color: #c20cb9; font-weight: bold;">install</span> dynect4r</pre></div></div>

<p>and then do things like&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dynect4r-client <span style="color: #660033;">-n</span> test.example.org 1.1.1.1</pre></div></div>

<p>Since the key feature of this project is the command line client, the actual library behind it is a pretty simple wrapper around <a href="http://github.com/archiloque/rest-client">rest-client</a>. If you&#8217;re looking for something a bit more powerful to use in your own Ruby projects, you may be interested in <a href="http://github.com/adamhjk/dynect_rest">dynect_rest</a> by Adam Jacob from <a href="http://opscode.com/">Opscode</a>. We actually discovered each other&#8217;s projects last night in #chef, and realized that it would probably be a good idea to pool our efforts eventually.</p>
]]></content:encoded>
			<wfw:commentRss>http://conigliaro.org/2010/07/09/dynect4r-a-ruby-library-and-command-line-client-for-the-dynect-rest-api-version-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ultradns4r: A Ruby Library and Command Line Client for the Neustar UltraDNS SOAP API</title>
		<link>http://conigliaro.org/2010/05/15/ultradns4r-a-ruby-library-and-command-line-client-for-the-neustar-ultradns-soap-api/</link>
		<comments>http://conigliaro.org/2010/05/15/ultradns4r-a-ruby-library-and-command-line-client-for-the-neustar-ultradns-soap-api/#comments</comments>
		<pubDate>Sat, 15 May 2010 20:30:53 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[DNS]]></category>
		<category><![CDATA[EC2]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://conigliaro.org/?p=917</guid>
		<description><![CDATA[I just spent the last week or so learning more about SOAP than I ever wanted to know. ;-) Fortunately, the result of that hard work resulted in something that might benefit the EC2 community. I am pleased to announce ultradns4r; a Ruby library and command line client for the Neustar UltraDNS SOAP API. I [...]]]></description>
			<content:encoded><![CDATA[<p>I just spent the last week or so learning more about SOAP than I ever wanted to know. ;-) Fortunately, the result of that hard work resulted in something that might benefit the EC2 community.</p>
<p>I am pleased to announce <a href="http://github.com/mconigliaro/ultradns4r">ultradns4r</a>; a Ruby library and command line client for the <a href="http://www.ultradns.com/">Neustar UltraDNS</a> <a href="http://www.ultradns.net/api/NUS_API_XML_SOAP.pdf">SOAP API</a>. I created this tool to alleviate the pain in dealing with EC2&#8242;s dynamic hostnames and IP addresses. Since it allows editing of arbitrary DNS records via the command line, it can be used to make EC2 instances update their own DNS records.</p>
<h4>Lessons Learned</h4>
<ul>
<li>If you need to do SOAP in Ruby, just use <a href="http://savon.rubiii.com/">Savon</a>. Trust me on this.</li>
<li>WSSE authentication is a complete pain in the ass. I was unable to find any SOAP library (Ruby, Python, or Perl) that could authenticate with the UltraDNS API servers out of the box (Savon included). I ended up having to build the entire WSSE header manually in order to generate the exact XML needed.</li>
<li>Apparently, element order sometimes matters with SOAP! This is something I never expected, considering that (last I knew) the XML spec does not even allow you to enforce element or attribute order. This was also the cause of a lot of my WSSE problems. I found that for example, if the Password element came after the Nonce and Created elements (which is the case if you use Savon&#8217;s built-in WSSE authentication), then authentication would fail. Could this have been the result of having a buggy XML parser on the server side? In any case, this is one of those annoying issues to be aware of.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://conigliaro.org/2010/05/15/ultradns4r-a-ruby-library-and-command-line-client-for-the-neustar-ultradns-soap-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Better Disk Monitoring with Ganglia</title>
		<link>http://conigliaro.org/2010/05/10/better-disk-monitoring-with-ganglia/</link>
		<comments>http://conigliaro.org/2010/05/10/better-disk-monitoring-with-ganglia/#comments</comments>
		<pubDate>Mon, 10 May 2010 17:56:44 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Ganglia]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://conigliaro.org/?p=911</guid>
		<description><![CDATA[The default disk monitoring module for Ganglia (moddisk.so) is pretty stupid, since it simply sums up the free disk space on all of your disks and presents it in a single graph. Frankly, this just doesn&#8217;t tell you much, so I wrote a more useful replacement: moddisk.py moddisk.pyconf This module reads a list of mounted [...]]]></description>
			<content:encoded><![CDATA[<p>The default disk monitoring module for Ganglia (moddisk.so) is pretty stupid, since it simply sums up the free disk space on <strong>all</strong> of your disks and presents it in a single graph. Frankly, this just doesn&#8217;t tell you much, so I wrote a more useful replacement:</p>
<ul>
<li><a href="http://github.com/mconigliaro/Ganglia-Modules/blob/master/moddisk.py">moddisk.py</a></li>
<li><a href="http://github.com/mconigliaro/Ganglia-Modules/blob/master/moddisk.pyconf">moddisk.pyconf</a></li>
</ul>
<p>This module reads a list of mounted file systems from a file (probably <strong>/proc/mounts</strong>) and creates a metric for each one, allowing you to graph disk usage for each file system separately. Enjoy!</p>
<p><strong>Update:</strong> It appears that <a href="http://sourceforge.net/apps/trac/ganglia/browser/trunk/monitor-core/gmond/python_modules/disk/multidisk.py">multidisk.py</a> does the same thing, and is probably already included with your distribution. Oops! ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://conigliaro.org/2010/05/10/better-disk-monitoring-with-ganglia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tokyo Tyrant Monitoring with Ganglia</title>
		<link>http://conigliaro.org/2010/05/07/tokyo-tyrant-monitoring-with-ganglia/</link>
		<comments>http://conigliaro.org/2010/05/07/tokyo-tyrant-monitoring-with-ganglia/#comments</comments>
		<pubDate>Fri, 07 May 2010 16:49:58 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Ganglia]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tokyo Tyrant]]></category>

		<guid isPermaLink="false">http://conigliaro.org/?p=903</guid>
		<description><![CDATA[I&#8217;ve recently written a Python module to graph some interesting Tokyo Tyrant metrics with Ganglia. It basically just parses the output of tcrmgr inform -st localhost, so you&#8217;ll probably need to update the pyconf file with the correct location of the tcrmgr command. But this module also gives you some neat things that tcrmgr doesn&#8217;t, [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently written a Python module to graph some interesting Tokyo Tyrant metrics with Ganglia. It basically just parses the output of <strong>tcrmgr inform -st localhost</strong>, so you&#8217;ll probably need to update the pyconf file with the correct location of the tcrmgr command. But this module also gives you some neat things that tcrmgr doesn&#8217;t, like the current number of Get/Put/Out operations per second rather than just the total number of operations since the server was started.</p>
<ul>
<li><a href="http://github.com/mconigliaro/Ganglia-Modules/blob/master/modtokyotyrant.py">modtokyotyrant.py</a></li>
<li><a href="http://github.com/mconigliaro/Ganglia-Modules/blob/master/modtokyotyrant.pyconf">modtokyotyrant.pyconf</a></li>
</ul>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://conigliaro.org/2010/05/07/tokyo-tyrant-monitoring-with-ganglia/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XML-RPC over SSL with Ruby and &#8220;warning: peer certificate won&#8217;t be verified in this SSL session&#8221;</title>
		<link>http://conigliaro.org/2010/05/03/xml-rpc-over-ssl-with-ruby-and-warning-peer-certificate-wont-be-verified-in-this-ssl-session/</link>
		<comments>http://conigliaro.org/2010/05/03/xml-rpc-over-ssl-with-ruby-and-warning-peer-certificate-wont-be-verified-in-this-ssl-session/#comments</comments>
		<pubDate>Mon, 03 May 2010 21:06:56 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://conigliaro.org/?p=894</guid>
		<description><![CDATA[When using XML-RPC over SSL with Ruby, you may receive the following annoying warning: warning: peer certificate won't be verified in this SSL session There is a very simple (but very poorly documented) fix for this. After instantiating your XMLRPC::Client object&#8230; server = XMLRPC::Client.new3&#40; ... &#41; Add the following line: server.instance_variable_get&#40;:@http&#41;.instance_variable_get&#40;:@ssl_context&#41;.instance_variable_set&#40;:@verify_mode, OpenSSL::SSL::VERIFY_NONE&#41; Now do your [...]]]></description>
			<content:encoded><![CDATA[<p>When using XML-RPC over SSL with Ruby, you may receive the following annoying warning:</p>
<pre>
warning: peer certificate won't be verified in this SSL session
</pre>
<p>There is a very simple (but very poorly documented) fix for this. After instantiating your XMLRPC::Client object&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">server = <span style="color:#6666ff; font-weight:bold;">XMLRPC::Client</span>.<span style="color:#9900CC;">new3</span><span style="color:#006600; font-weight:bold;">&#40;</span> ... <span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Add the following line:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">server.<span style="color:#9900CC;">instance_variable_get</span><span style="color:#006600; font-weight:bold;">&#40;</span>:@http<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">instance_variable_get</span><span style="color:#006600; font-weight:bold;">&#40;</span>:@ssl_context<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">instance_variable_set</span><span style="color:#006600; font-weight:bold;">&#40;</span>:@verify_mode, <span style="color:#6666ff; font-weight:bold;">OpenSSL::SSL::VERIFY_NONE</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>Now do your XML-RPC calls as usual:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">result = server.<span style="color:#9900CC;">call</span><span style="color:#006600; font-weight:bold;">&#40;</span> ... <span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://conigliaro.org/2010/05/03/xml-rpc-over-ssl-with-ruby-and-warning-peer-certificate-wont-be-verified-in-this-ssl-session/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Am I one of the 10% of programmers who can write a binary search?</title>
		<link>http://conigliaro.org/2010/04/19/am-i-one-of-the-10-of-programmers-who-can-write-a-binary-search/</link>
		<comments>http://conigliaro.org/2010/04/19/am-i-one-of-the-10-of-programmers-who-can-write-a-binary-search/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 21:23:18 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://conigliaro.org/?p=871</guid>
		<description><![CDATA[I think I might be! After reading an article claiming that only 10% of programmers can write a binary search I decided to give it a shot. After about 20 minutes, I came up with this: def bsearch&#40;array, search, start_ix=0, end_ix=array.length&#41; mid_ix = start_ix + &#40;&#40;end_ix-start_ix&#41;/2&#41;.ceil if array&#91;mid_ix&#93; == search then puts &#34;%d found at [...]]]></description>
			<content:encoded><![CDATA[<p>I think I might be! After reading an article claiming that <a href="http://reprog.wordpress.com/2010/04/19/are-you-one-of-the-10-percent/">only 10% of programmers can write a binary search</a> I decided to give it a shot. After about 20 minutes, I came up with this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;"><span style="color:#9966CC; font-weight:bold;">def</span> bsearch<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">array</span>, search, start_ix=<span style="color:#006666;">0</span>, end_ix=<span style="color:#CC0066; font-weight:bold;">array</span>.<span style="color:#9900CC;">length</span><span style="color:#006600; font-weight:bold;">&#41;</span>
    mid_ix = start_ix <span style="color:#006600; font-weight:bold;">+</span> <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#40;</span>end_ix<span style="color:#006600; font-weight:bold;">-</span>start_ix<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">ceil</span>
    <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#CC0066; font-weight:bold;">array</span><span style="color:#006600; font-weight:bold;">&#91;</span>mid_ix<span style="color:#006600; font-weight:bold;">&#93;</span> == search <span style="color:#9966CC; font-weight:bold;">then</span>
        <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;%d found at position %d&quot;</span> <span style="color:#006600; font-weight:bold;">%</span> <span style="color:#006600; font-weight:bold;">&#91;</span> search, mid_ix<span style="color:#006600; font-weight:bold;">&#93;</span>
    <span style="color:#9966CC; font-weight:bold;">elsif</span> start_ix == mid_ix <span style="color:#9966CC; font-weight:bold;">then</span>
        <span style="color:#CC0066; font-weight:bold;">puts</span> <span style="color:#996600;">&quot;%d not found&quot;</span> <span style="color:#006600; font-weight:bold;">%</span> <span style="color:#006600; font-weight:bold;">&#91;</span> search <span style="color:#006600; font-weight:bold;">&#93;</span>
    <span style="color:#9966CC; font-weight:bold;">elsif</span> <span style="color:#CC0066; font-weight:bold;">array</span><span style="color:#006600; font-weight:bold;">&#91;</span>mid_ix<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&lt;</span> search
        bsearch<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">array</span>, search, mid_ix, end_ix<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">elsif</span> <span style="color:#CC0066; font-weight:bold;">array</span><span style="color:#006600; font-weight:bold;">&#91;</span>mid_ix<span style="color:#006600; font-weight:bold;">&#93;</span> <span style="color:#006600; font-weight:bold;">&gt;</span> search <span style="color:#9966CC; font-weight:bold;">then</span>
        bsearch<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0066; font-weight:bold;">array</span>, search, start_ix, mid_ix<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">end</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
bsearch<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">10</span>, <span style="color:#006666;">20</span>, <span style="color:#006666;">30</span>, <span style="color:#006666;">40</span>, <span style="color:#006666;">50</span>, <span style="color:#006666;">60</span>, <span style="color:#006666;">70</span>, <span style="color:#006666;">80</span>, <span style="color:#006666;">90</span><span style="color:#006600; font-weight:bold;">&#93;</span>, ARGV<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>.<span style="color:#9900CC;">to_i</span><span style="color:#006600; font-weight:bold;">&#41;</span></pre></div></div>

<p>It&#8217;s probably not by best work, and I&#8217;m pretty doubtful that I could have done it in the same amount of time under the stress of a job interview. But it works, and that&#8217;s good enough for me, considering that I haven&#8217;t been a full time programmer in quite some time and haven&#8217;t written anything like this since college. ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://conigliaro.org/2010/04/19/am-i-one-of-the-10-of-programmers-who-can-write-a-binary-search/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Finally, Someone Agrees with me About ORM</title>
		<link>http://conigliaro.org/2009/10/12/finally-someone-wagrees-with-me-about-orm/</link>
		<comments>http://conigliaro.org/2009/10/12/finally-someone-wagrees-with-me-about-orm/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 16:33:27 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://conigliaro.org/?p=767</guid>
		<description><![CDATA[Way back in 2006, I spent a week or so trying to use ORM in a project I was working on, only to discover that rather than making my life easier, it constantly prevented me from doing what I wanted to do. I spent an inordinate amount of time trying to convert SQL queries into [...]]]></description>
			<content:encoded><![CDATA[<p>Way back in 2006, I spent a week or so trying to use ORM in a project I was working on, only to discover that rather than making my life easier, it constantly prevented me from doing what I wanted to do. I spent an inordinate amount of time trying to convert SQL queries into ORM, but I kept ending up with slower, more complicated messes. And since this particular project required me to pull information out of very large databases very quickly, I was never completely comfortable trusting an abstraction layer to optimize SQL queries as well as I could.</p>
<p>It&#8217;s been a few years since I&#8217;ve developed software full-time, but since I still encounter articles about how great ORM is, I figured that either the situation has improved since then, or maybe I was just too stupid to harness the power of ORM. But then I found <a href="http://www.hatfulofhollow.com/posts/code/farewell-to-orms.html">someone who has come to the same conclusions I did way back in 2006</a>, and has written about them a lot more eloquently than I did in <a href="/2006/10/11/fuck-orm/">my original rant</a>. At least I&#8217;m not alone anymore!</p>
]]></content:encoded>
			<wfw:commentRss>http://conigliaro.org/2009/10/12/finally-someone-wagrees-with-me-about-orm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>xen-vm-autosnapshot.py 1.2</title>
		<link>http://conigliaro.org/2009/08/07/xen-vm-autosnapshot-py-1-2/</link>
		<comments>http://conigliaro.org/2009/08/07/xen-vm-autosnapshot-py-1-2/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 17:14:45 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Xen]]></category>

		<guid isPermaLink="false">http://conigliaro.org/?p=440</guid>
		<description><![CDATA[The xen-vm-autosnapshot.py script has been updated with an important new option: &#8211;snapshot-tag. I still can&#8217;t believe I made such a silly oversight, but previous versions of this script had no way of differentiating between snapshots created automatically and those that were created manually. So if you happened to have some old manual snapshots lying around, [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="/projects/wiki/Xen">xen-vm-autosnapshot.py</a> script has been updated with an important new option: &#8211;snapshot-tag. I still can&#8217;t believe I made such a silly oversight, but previous versions of this script had no way of differentiating between snapshots created automatically and those that were created manually. So if you happened to have some old manual snapshots lying around, the snapshot-rotate routine would have rotated them along with all the rest.</p>
<p>The &#8211;snapshot-tag option fixes this by allowing you to &#8220;tag&#8221; each snapshot as it&#8217;s created. Then the snapshot-rotate routine will only consider snapshots with the correct &#8220;tag.&#8221; This also allows for more advanced snapshot/rotation schedules.</p>
<p>Thanks to Adam Adamou at <a href="http://www.njedge.net/">NJEDge.Net</a> for his input.</p>
]]></content:encoded>
			<wfw:commentRss>http://conigliaro.org/2009/08/07/xen-vm-autosnapshot-py-1-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NagiosPluginsNT 0.4.2</title>
		<link>http://conigliaro.org/2009/07/30/nagiospluginsnt-0-4-2/</link>
		<comments>http://conigliaro.org/2009/07/30/nagiospluginsnt-0-4-2/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 17:50:27 +0000</pubDate>
		<dc:creator>Mike</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://conigliaro.org/?p=438</guid>
		<description><![CDATA[I&#8217;ve just updated NagiosPluginsNT for the first time in a long time. I don&#8217;t really get to spend much time on this project anymore, since my current employer has moved away from Nagios.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just updated <a href="http://conigliaro.org/projects/wiki/NagiosPluginsNT">NagiosPluginsNT</a> for the first time in a long time. I don&#8217;t really get to spend much time on this project anymore, since my current employer has moved away from Nagios.</p>
]]></content:encoded>
			<wfw:commentRss>http://conigliaro.org/2009/07/30/nagiospluginsnt-0-4-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
