<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><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:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Fractions Of A Penny</title>
	
	<link>http://www.fractionsofapenny.com</link>
	<description>Some mundane details...</description>
	<lastBuildDate>Fri, 25 Feb 2011 14:33:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.5</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/FractionsOfAPenny" /><feedburner:info uri="fractionsofapenny" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>FractionsOfAPenny</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Phusion Passenger Locale Issues</title>
		<link>http://feedproxy.google.com/~r/FractionsOfAPenny/~3/5bSWY5wW68w/phusion-passenger-locale-issues</link>
		<comments>http://www.fractionsofapenny.com/from-the-trenches/phusion-passenger-locale-issues#comments</comments>
		<pubDate>Fri, 25 Feb 2011 02:37:03 +0000</pubDate>
		<dc:creator>Brandon Hornseth</dc:creator>
				<category><![CDATA[From the Trenches]]></category>

		<guid isPermaLink="false">http://www.fractionsofapenny.com/?p=272</guid>
		<description><![CDATA[This blog post might help someone at some point, and it might not. Regardless, it seems rare to run into an obscure problem, find the solution, and actually not have it be something completely kludgy, so in the interest of celebrating a minor victory, here goes. Ruby 1.8.7 and *&#38;#!ing Curly Quotes. We have a [...]]]></description>
			<content:encoded><![CDATA[<p>This blog post might help someone at some point, and it might not. Regardless, it seems rare to run into an obscure problem, find the solution, and actually not have it be something completely kludgy, so in the interest of celebrating a minor victory, here goes.</p>
<p><span id="more-272"></span></p>
<h1>Ruby 1.8.7 and *&amp;#!ing Curly Quotes.</h1>
<p>We have a lot of user input in databases at work, and in several places, big paragraphs of text. Naturally people copy and paste word documents into these things all the time, which is fine in 99.9% of the cases. We&#8217;re working with a few new hoops at work, however, and in jumping through a few of them last week, these so-called &#8220;smart quotes&#8221; started causing me problems.</p>
<p><a href="http://www.fractionsofapenny.com/wp-content/uploads/2011/02/exception2.png"><img class="alignnone size-medium wp-image-290" title="YAJL exception" src="http://www.fractionsofapenny.com/wp-content/uploads/2011/02/exception2-300x122.png" alt="" width="300" height="122" /></a></p>
<p>It turned out that in Ruby 1.8.7&#8211;but only in some cases&#8211;the interpreter was mangling these non-ascii characters when they were serialized and sent in a JSON response body. I explained the problem to a couple of other devs. One of them couldn&#8217;t reproduce it by logging into the development server and running the problematic example on the console, the other could. So there was some disparity in what we were seeing.</p>
<h1>Gentoo Locale Settings</h1>
<p>Eventually I started thinking about Unicode support on my local box. I use Gentoo Linux as a desktop, which I&#8217;m usually extremely happy with, but I&#8217;ve never figured out my troubles with unicode in the browser.  The classic <a href="http://knowyourmeme.com/memes/%E0%B2%A0%E0%B2%A0-look-of-disapproval">Look of Disapproval</a> looks like a couple of empty boxes on that machine. After poking into the locale settings a bit, I discovered my local settings were POSIX. That didn&#8217;t seem right.</p>
<p><a href="http://www.fractionsofapenny.com/wp-content/uploads/2011/02/Picture-7.jpg"><img class="alignleft size-full wp-image-279" title="Locale settings" src="http://www.fractionsofapenny.com/wp-content/uploads/2011/02/Picture-7.jpg" alt="" width="258" height="241" /></a></p>
<p>Same thing when I logged into the dev box. Another developer who uses ubuntu locally saw that all his <code>LC_*</code> settings were <code>en_US.UTF-8</code>, and&#8211;surprise, surprise&#8211;he was unable to reproduce the issue on the console, whereas it presented to me. Finally onto something.</p>
<p>After some digging, I found that where several other Gentoo users have a <code>02locale</code> file in <code> /etc/env.d</code>, and I didn&#8217;t. After adding that file and logging out and back in, my locale settings matched up with the other developer, and boom: the problem no longer presented on the console for me.</p>
<h1>Apache and Phusion Passenger</h1>
<p>It turns out there&#8217;s an <a href="http://code.google.com/p/phusion-passenger/issues/detail?id=233">annoying bug in Passenger</a> where it doesn&#8217;t pick up environment variables from Apache in the way that it should.  For now, we&#8217;ve been able to work around the issue by adding a wrapper script to the ruby executable that Passenger uses, and set the necessary LANG variable in there. It&#8217;s not the greatest solution in the world but it&#8217;s clean, doesn&#8217;t require messing with the system-wide ruby binary, and should cause no speed issue.</p>
<p>If anyone else has run into this and found a cleaner solution, please drop me a comment or shoot me an email.</p>
<img src="http://feeds.feedburner.com/~r/FractionsOfAPenny/~4/5bSWY5wW68w" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.fractionsofapenny.com/from-the-trenches/phusion-passenger-locale-issues/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.fractionsofapenny.com/from-the-trenches/phusion-passenger-locale-issues</feedburner:origLink></item>
		<item>
		<title>Big numbers, little metal</title>
		<link>http://feedproxy.google.com/~r/FractionsOfAPenny/~3/wk3dof8h1A8/big-numbers-little-metal</link>
		<comments>http://www.fractionsofapenny.com/metrics/big-numbers-little-metal#comments</comments>
		<pubDate>Fri, 04 Feb 2011 00:30:03 +0000</pubDate>
		<dc:creator>Brandon Hornseth</dc:creator>
				<category><![CDATA[Metrics]]></category>

		<guid isPermaLink="false">http://www.fractionsofapenny.com/?p=257</guid>
		<description><![CDATA[I&#8217;m finally getting caught up with my RSS feeds again (without declaring bankruptcy this time) and I found a couple announcements regarding site-traffic that I thought were pretty cool. Stackoverflow Love or hate them, Team Attwod-Spolsky has turned the stackexchange platform into *the* Question+Answer platform. Perhaps somewhat surprisingly, they&#8217;ve had virtually no major scaling challenges that [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m finally getting caught up with my RSS feeds again (without declaring bankruptcy this time) and I found a couple announcements regarding site-traffic that I thought were pretty cool.</p>
<h2>Stackoverflow</h2>
<p>Love or hate them, Team Attwod-Spolsky has turned the stackexchange platform into *the* Question+Answer platform. Perhaps somewhat surprisingly, they&#8217;ve had virtually no major scaling challenges that I&#8217;ve heard of. The latest performance note from Attwood claimed that the site is &#8220;almost comically overprovisioned&#8221; with <a href="http://blog.serverfault.com/post/1432571770/">10 webservers</a>. <a href="http://twitter.com/spolsky/statuses/27244766467#">Last I heard</a> they were somewhere around the 200 million pageviews per month mark.</p>
<p>A disclaimer for that last link:  It&#8217;s clear that Digg made some serious engineering missteps with the latest revision of their platform, but they also have to deal with bursts of traffic that probably isn&#8217;t seen in the same magnitude on something like SOF. On the other hand, I could be way off the mark. Just my $0.02.</p>
<h2>Reddit hits 1b pageviews</h2>
<p>My favorite online free-time black hole, Reddit, <a href="http://blog.reddit.com/2011/02/reddit-billions-served.html">announced yesterday</a> that they&#8217;d surpassed the 1 billion pageviews per month mark. They&#8217;re peaking around 1250 requests per second on the app servers, or 2500+ on the cache nodes [<a href="http://news.ycombinator.com/item?id=2175550">link</a>]. It&#8217;s nothing short of amazing that they keep things running relatively smooth given those bursts.</p>
<p>Beyond all the <a href="http://www.reddit.com/r/fffffffuuuuuuuuuuuu">awkwardly funny</a> or <a href="http://www.reddit.com/r/AskReddit/comments/elal2/have_you_ever_picked_up_a_hitchhiker/c18z0z2">just plain compelling</a> content on the site, I&#8217;ve been fascinated by  Reddit ever since I first happened upon it for a couple of reasons:</p>
<ol>
<li>It was founded by two 22-year-old college grads and was picked for a round of funding from Y Combinator (you should be reading <a href="http://news.ycombinator.com/">Hacker News</a>)</li>
<li>They team running the site is tiny. Really tiny. Last I checked there were 6 people behind the site, and that includes development, hosting/ops, design, everything.</li>
<li>They essentially <a href="http://blog.reddit.com/2010/08/everything-went-better-than-expected.html">gobbled up most of Digg&#8217;s userbase</a>. I left Digg quite a while back, thought I no longer remember exactly why other than it had lost it&#8217;s tech focus that piqued my interest in the beginning.</li>
<li>They survived the Dreaded Rewrite. Reddit was originally written in Lisp but was rewritten to Python in 2005 and continues to run on <a href="http://pylonshq.com/">Pylons</a> to this day.</li>
</ol>
<p>I think what I find most fascinating about the site is that it&#8217;s completely run in the cloud. Reddit&#8217;s growth <a href="http://blog.reddit.com/2010/05/reddits-may-2010-state-of-servers.html">has come with it&#8217;s share of major engineering challenges</a>, but so far they&#8217;ve been able to overcome.  As of october, <a href="http://www.reddit.com/r/IAmA/comments/a2zte/i_run_reddits_servers_and_do_a_bunch_of_other/">they were running everything on 112 EC2 instances</a>.</p>
<p>The <a href="http://news.ycombinator.com/item?id=2171778">Hacker News post</a> is full of some other people sharing their numbers, and sites like HighScalability have more info on some bigger name sites. Read up and write ye some efficient code!</p>
<img src="http://feeds.feedburner.com/~r/FractionsOfAPenny/~4/wk3dof8h1A8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.fractionsofapenny.com/metrics/big-numbers-little-metal/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.fractionsofapenny.com/metrics/big-numbers-little-metal</feedburner:origLink></item>
		<item>
		<title>Gentoo Troubles with git-alias</title>
		<link>http://feedproxy.google.com/~r/FractionsOfAPenny/~3/_S_lUdXa-wY/gentoo-troubles-with-git-alias</link>
		<comments>http://www.fractionsofapenny.com/from-the-trenches/gentoo-troubles-with-git-alias#comments</comments>
		<pubDate>Wed, 22 Sep 2010 02:47:40 +0000</pubDate>
		<dc:creator>Brandon Hornseth</dc:creator>
				<category><![CDATA[From the Trenches]]></category>

		<guid isPermaLink="false">http://www.fractionsofapenny.com/?p=240</guid>
		<description><![CDATA[I ran into a weird problem on my development machine this week and decided to post this up since there wasn&#8217;t a decent answer within the first 5 pages of Google results. We&#8217;re just getting switched over to git from something horribly obscure (Surround SCM) at work and I&#8217;ve been picking up and cataloging random [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a weird problem on my development machine this week and decided to post this up since there wasn&#8217;t a decent answer within the first 5 pages of Google results.</p>
<p>We&#8217;re just getting switched over to <a title="Git SCM" href="http://git-scm.com/">git</a> from something horribly obscure (Surround SCM) at work and I&#8217;ve been picking up and <a title="My Delicous links tagged 'git'" href="http://www.delicious.com/bhornseth/git">cataloging random tips</a> as I come across them. Anyways, there&#8217;s a spiffy alias for a really verbose version of <code>`git log'</code> that I liked:<br />
<code><br />
[alias]<br />
	lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative<br />
	st = status</code></p>
<p>When I tried to run it, however, something had clearly gone wrong.<br />
<code><br />
hornsebr ~/working/railsdev $ git lg<br />
fatal: cannot exec 'git-lg': Permission denied</code></p>
<p>I didn&#8217;t even have a reasonable theory as to why I was seeing this error message. Some searching around suggested that I had a file somewhere in my <code>$PATH</code> that was named <code>`git-lg'</code>, which didn&#8217;t take long to rule out.</p>
<p>As it turned out, <code>/usr/games</code> was set to 700, and owned by <code>games.root</code>. Correcting the problematic permissions solved the issue.</p>
<img src="http://feeds.feedburner.com/~r/FractionsOfAPenny/~4/_S_lUdXa-wY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.fractionsofapenny.com/from-the-trenches/gentoo-troubles-with-git-alias/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.fractionsofapenny.com/from-the-trenches/gentoo-troubles-with-git-alias</feedburner:origLink></item>
		<item>
		<title>Python, DB2, and FOR BIT DATA Columns</title>
		<link>http://feedproxy.google.com/~r/FractionsOfAPenny/~3/zxIIm2ZCyMI/python-db2-and-for-bit-data-columns</link>
		<comments>http://www.fractionsofapenny.com/software-development/python-db2-and-for-bit-data-columns#comments</comments>
		<pubDate>Mon, 22 Mar 2010 02:17:30 +0000</pubDate>
		<dc:creator>Brandon Hornseth</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[DB2]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.fractionsofapenny.com/?p=232</guid>
		<description><![CDATA[I&#8217;ve been doing some research lately on how well various languages and web application frameworks integrate with IBM DB2 and happened across some less than ideal results. An errant strlen() call nearly killed the project before it ever got off the ground. As you&#8217;d expect, the DB2 drivers for Python and Ruby are written in [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing some research lately on how well various languages and web application frameworks integrate with IBM DB2 and happened across some less than ideal results. An errant <code>strlen()</code> call nearly killed the project before it ever got off the ground.</p>
<p>As you&#8217;d expect, the DB2 drivers for <a title="Google Code: ibm-db" href="http://code.google.com/p/ibm-db/">Python</a> and <a title="RubyForge: Rails Adapter/Driver for IBM DataServers" href="http://rubyforge.org/projects/rubyibm/">Ruby</a> are written in C and compiled to modules for their respective language targets. What you might not expect is that DB2 has a <code>CHAR/VARCHAR</code> type modifier that makes it difficult, if not impossible to work out of the box with nearly every mainstream framework. It&#8217;s called <em>CHAR FOR BIT DATA</em>. <a href="http://publib.boulder.ibm.com/infocenter/cscv/v10r1/index.jsp?topic=/com.ibm.cloudscape.doc/rrefsqlj57924.html">Here&#8217;s what IBM has to say about it</a>:</p>
<blockquote>
<div>A CHAR FOR BIT DATA type allows you to store byte strings of a specified length. It is useful for unstructured data where character strings are not appropriate.</div>
</blockquote>
<p>So, these basically take a string that looks like <code>'20100322014820681369000000'</code> and turns it into something like <code>' \x10\x03"\x01H h\x13i\x00\x00\x00'</code>. DB2 also includes a function called generate_unique() that, not surprisingly, generates IDs for these column types that are guaranteed unique across an entire database. Since the Python C API knows how to take a <a href="http://docs.python.org/c-api/string.html#PyString_FromString">byte array and turn them into a Python string</a>, everything should be good, right? Wrong.</p>
<p>What happens if you try to compress data for one of these columns, but it looks like <code>'20000000000000000000000000'</code> instead? You get this:</p>
<pre>&gt;&gt;&gt; from binascii import a2b_hex
&gt;&gt;&gt; a2b_hex('20000000000000000000000000')
' \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
</pre>
<p>That&#8217;s a lot of null bytes, but it&#8217;ll store in the database just fine. Retrieving that from the database, however, has some unexpected results: <strong>Python only gives you one of the 26 characters you stored</strong>.  Turns out the driver does <a href="http://code.google.com/p/ibm-db/source/browse/trunk/IBM_DB/ibm_db/ibm_db.c#6567">a strlen on the binary data</a> sent from the database engine, which sees a null byte and treats it as a string terminator, truncating your data.</p>
<p>The good news is <a href="http://code.google.com/p/ibm-db/issues/detail?id=46">the fix</a> was trivial once a convention was agreed upon. The group responsible for the Ruby driver also <a href="http://rubyforge.org/tracker/index.php?func=detail&amp;aid=27954&amp;group_id=2361&amp;atid=9175">picked up the fix</a> and will be releasing a comparable patch it in the near future. Big thanks to both groups for helping us get over a substantial hurdle.</p>
<p><strong>Update (3/31/2010): </strong>The devs for the Python ibm_db project have <a href="http://pypi.python.org/pypi/ibm_db/1.0.1">released a new version</a> that includes the fix mentioned above. I finally got around to testing the change, and it looks to have solved our problem. Hopefully the Ruby driver is corrected upstream as well shortly.</p>
<img src="http://feeds.feedburner.com/~r/FractionsOfAPenny/~4/zxIIm2ZCyMI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.fractionsofapenny.com/software-development/python-db2-and-for-bit-data-columns/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.fractionsofapenny.com/software-development/python-db2-and-for-bit-data-columns</feedburner:origLink></item>
		<item>
		<title>How easy is the process?</title>
		<link>http://feedproxy.google.com/~r/FractionsOfAPenny/~3/v7WTEjh0cYY/how-easy-is-the-process</link>
		<comments>http://www.fractionsofapenny.com/software-development/how-easy-is-the-process#comments</comments>
		<pubDate>Tue, 12 Jan 2010 03:09:45 +0000</pubDate>
		<dc:creator>Brandon Hornseth</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Quality]]></category>
		<category><![CDATA[web-development]]></category>

		<guid isPermaLink="false">http://www.fractionsofapenny.com/?p=213</guid>
		<description><![CDATA[I was doing a bit of catching up in my feed reader today, and one of the latest 37signals posts caught my attention. The post was simple enough, but it was this comment in response to a few other posters that really nailed it: Who cares about how you do it. That’s just techniques.No matter [...]]]></description>
			<content:encoded><![CDATA[<p>I was doing a bit of catching up in my feed reader today, and <a href="http://37signals.com/svn/posts/2097-you-dont-really-know-if-your-templates-and">one of the latest 37signals posts</a> caught my attention. The post was simple enough, but it was this comment in response to a few other posters that really nailed it:</p>
<blockquote>
<div>
<p>Who cares about how you do it. That’s just techniques.No matter how you devide[sic] it up into templates and scripts, if the site changes, you have to make those changes. How easy is that process?? That is the question.</p>
</div>
</blockquote>
<p>Apologies for taking that somewhat out of context to prove a point.</p>
<p>If your software maintenance is painful or <a href="http://www.fractionsofapenny.com/software-development/boredom-driven-development">leaves you feeling apprehensive</a>, you need to figure out why it&#8217;s that way and go after the core of the problem. It only gets worse the longer you ignore it.</p>
<img src="http://feeds.feedburner.com/~r/FractionsOfAPenny/~4/v7WTEjh0cYY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.fractionsofapenny.com/software-development/how-easy-is-the-process/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.fractionsofapenny.com/software-development/how-easy-is-the-process</feedburner:origLink></item>
	</channel>
</rss>

