<?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/"
	xmlns:series="http://unfoldingneurons.com/"
	>

<channel>
	<title>MettaProgramming &#187; rails</title>
	<atom:link href="http://mettadore.com/tag/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://mettadore.com</link>
	<description>Thoughts on Software and Technology</description>
	<lastBuildDate>Mon, 09 Apr 2012 19:11:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Rails: SQL Injection over Configuration</title>
		<link>http://mettadore.com/analysis/rails-sql-injection-over-configuration/</link>
		<comments>http://mettadore.com/analysis/rails-sql-injection-over-configuration/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 17:59:50 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Miscellany]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[convention]]></category>
		<category><![CDATA[Github]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[SQL injection]]></category>

		<guid isPermaLink="false">http://mettadore.com/?p=991</guid>
		<description><![CDATA[It was an interesting weekend for the Github team, the Rails core team, and lots of Rails users who worked at all through the weekend. There are a lot of details about the weekend to discuss, but my main discussion point is one of philosophy and intention of the Rails project. We&#8217;ll get to that [...]]]></description>
			<content:encoded><![CDATA[<p>It was an interesting weekend for the Github team, the Rails core team, and lots of Rails users who worked at all through the weekend. There are a lot of details about the weekend to discuss, but my main discussion point is one of philosophy and intention of the Rails project. We&#8217;ll get to that towards the end. First, a bit of background.</p>
<h3>Hacking Github</h3>
<p>This weekend, a Github user named <a href="https://github.com/homakov">Egor Homakov</a> hacked Github in such a way that allowed him to <a href="https://github.com/rails/rails/commit/b83965785db1eec019edf1fc272b1aa393e6dc57">commit directly to the Rails core</a> project. Since Homakov is not a Rails team member, this is a really big deal.</p>
<p>Since this happened, there&#8217;s been a lot of talk about the Rails core being fundamentally insecure. In fact, <a href="https://github.com/rails/rails/issues/5239">Homakov has been harping on this for at least 1000 years</a>. A few days ago he filed an issue about a <a href="https://github.com/rails/rails/issues/5228">mass assignment vulnerability</a> in the Rails core, and later he illustrated this vulnerability by filing an <a href="https://github.com/rails/rails/issues/5239">issue report from the future</a>. He was illustrating that you can inject attributes into a Rails model with an HTTP request.</p>
<p>So, when no-one took him seriously, he took the next step. He created HTTP PUT requests adding his SSH key to a Rails core user id, then <a href="https://github.com/rails/rails/commit/b83965785db1eec019edf1fc272b1aa393e6dc57">pushed a commit directly to Rails core</a>.</p>
<h3>How to Hack Rails</h3>
<p>It turns out that Rails apps, by default, are easy to hack. Peter Nixey wrote a very detailed post about <a href="https://gist.github.com/1978249">how Homakov hacked Github and the one line of code that could have prevented it</a>, so if you want the full details, read there. The summary is much shorter.</p>
<p>Let&#8217;s create a simple User model which has two attributes, <code>name</code> and <code>role</code>. By default, every attribute of every model can be modified by using <code>update_attributes</code>. We all know this, and we&#8217;ve known it for a while. What it means is that any User, even if they don&#8217;t have permission, can update their own role. Imagine if I log in to our example app and submit a PUT request to the UsersController with the package <code>{'params': {'id': 23, 'role': 'superadmin'} }</code>. By default, the app will accept this and update the user with the new role.</p>
<p>This is exactly what Homakov did. He sent an HTTP request to Github and used update_attributes to change the Github database. All of this could, he argued, be prevented by adding attr_accessor to the User model.</p>
<h3>Rails: Convention over <del>Configuration</del> Security</h3>
<p>Now, the philosophical point I want to make about this is that the Rails core team seems to be ignoring their own mantra. All of us know that Rails adheres strongly to the <a href="http://en.wikipedia.org/wiki/Convention_over_configuration">Convention over Configuration</a> design pattern. It&#8217;s a pattern that Rails users are taught from day one. In fact, it&#8217;s embedded in the framework&#8217;s <em>name</em>.<sup><a href="http://mettadore.com/analysis/rails-sql-injection-over-configuration/#footnote_0_991" id="identifier_0_991" class="footnote-link footnote-identifier-link" title="Look, just stay on these rails and you&amp;#8217;ll move fast. We&amp;#8217;re not responsible for what happens if you go over there">1</a></sup></p>
<p>One of the outcomes of Convention over Configuration is that sensible defaults should be, well, sensible. The Rails core team feel strongly that attr_accessor should not be a default<sup><a href="http://mettadore.com/analysis/rails-sql-injection-over-configuration/#footnote_1_991" id="identifier_1_991" class="footnote-link footnote-identifier-link" title="Incidentally, I don&amp;#8217;t either, but you can set this as the default by using ActiveRecord::Base.send(:attr_accessible, nil), but this causes all sorts of problems">2</a></sup> and that security is the responsibility of the app developer. I agree that security is our responsibility, but disagree that the dominant Rails design-pattern-come-mantra supports this.</p>
<p>It&#8217;s almost as if no-one wants to say &#8220;Yeah, we should really take care of this.&#8221; Everyone is saying &#8220;You know, <em>you</em> should really take care of this.&#8221;</p>
<h3>Stop the world! We&#8217;ve found a SQL injection</h3>
<p>There&#8217;s a term that makes all software developers give pause: &#8220;SQL Injection.&#8221; It&#8217;s a phrase that keeps us lying awake at night, and gives us nightmares when we finally fall asleep. The idea that someone, using nothing more than a web browser, can change our database willy nilly. It&#8217;s a terrifying thought.</p>
<p>I can&#8217;t help but take an initial read of all the hubbub and think that we&#8217;re not giving it the importance that it&#8217;s due. Everyone sees a headline saying Rails has a &#8216;mass assignment vulnerability&#8217; and says to themselves &#8216;I should probably look into that at some point.&#8217; It&#8217;s too vague, to uncertain. To unemotional.<sup><a href="http://mettadore.com/analysis/rails-sql-injection-over-configuration/#footnote_2_991" id="identifier_2_991" class="footnote-link footnote-identifier-link" title="In fact, to be honest, that&amp;#8217;s how I was reading it.">3</a></sup></p>
<p>I have to assume that everyone would be treating this differently if we called it what it is. Imagine your thoughts (and actions) if you read a different headline, something like &#8220;Rails apps prone to SQL injection by default&#8221;</p>
<p>Don&#8217;t you think you&#8217;d get something done? You should, because that&#8217;s what we&#8217;re talking about. This is a path to SQL injection, full stop.</p>
<h3>Who owns this issue</h3>
<p>I love Ruby on Rails. Like Python, Scala, Node.js, and a host of other technologies that we have at our disposal, Ruby&#8217;s web framework makes being a developer both powerful and fun. There&#8217;s so much we can do– and so much we can do <em>very quickly</em>. But there&#8217;s a cost to pay. Convention over Configuration is a good thing, but we can&#8217;t expect people to learn fast, develop fast– create fast– if we don&#8217;t respect the logical outcome of that philosophy.</p>
<p>That outcome is this: We, Rails developers, understand that we are responsible for our security; however, we also <em>believe</em> in you, the Rails core team. We trust you. We believe it when you tell us to follow &#8220;Convention over Configuration,&#8221; and so we naturally believe that the defaults you give us will be a safe, or at least not horribly, dangerously wrong. We, all of us– developers and Rails core team both– can&#8217;t have it both ways. We are telling ourselves to follow Convention over Configuration, but we&#8217;re also telling ourselves that SQL Injection is <em>a viable convention</em>, thus, that we have <em>security as a configuration</em>.</p>
<p>Now, personally, I don&#8217;t believe that attr_accessor belongs in the model– or at least that security from view-based actions belongs in the model. Rails is an MVC framework, and therefore I don&#8217;t like forcing myself to define my <em>model</em> based on actions in the <em>view</em>. I don&#8217;t want my view owning control of my model that way. I think the controller should manage these permissions and there are <a href="http://jonathanleighton.com/articles/2011/mass-assignment-security-shouldnt-happen-in-the-model/">others who feel the same</a>. In fact <a href="https://gist.github.com/1974187">Yehuda Katz argues this as well</a>.</p>
<p>Still, the overall question remains: How can we reconcile the mantra of Convention over Configuration if we support the standard of dangerous insecurity by convention?</p>
<ol class="footnotes"><li id="footnote_0_991" class="footnote">Look, just stay on these rails and you&#8217;ll move fast. We&#8217;re not responsible for what happens if you go over there</li><li id="footnote_1_991" class="footnote">Incidentally, I don&#8217;t either, but you can set this as the default by using <code>ActiveRecord::Base.send(:attr_accessible, nil)</code>, but this causes all sorts of problems</li><li id="footnote_2_991" class="footnote">In fact, to be honest, that&#8217;s how I was reading it.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://mettadore.com/analysis/rails-sql-injection-over-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Github as a Small-Scale CDN (w/Rails)</title>
		<link>http://mettadore.com/ruby/using-github-as-a-small-scale-cdn-wrails/</link>
		<comments>http://mettadore.com/ruby/using-github-as-a-small-scale-cdn-wrails/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 01:11:32 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[CDN]]></category>
		<category><![CDATA[Github]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://mettadore.com/?p=524</guid>
		<description><![CDATA[I love Github. Like tomato sandwiches, Celtic music, beer, and programming- Github is something that, try as I might, I just can&#8217;t make myself sick of.1 Recently, I took the Git survey, and it contained an interesting question along the lines of &#8220;What do you use Git for?&#8221; The answers were things like &#8220;configuration files&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://mettadore.com/files/2010/09/github-logo.png"><img class="alignleft size-full wp-image-525" src="http://mettadore.com/files/2010/09/github-logo.png" alt="" width="210" height="210" /></a>I love Github.</p>
<p>Like tomato sandwiches, Celtic music, beer, and programming- Github is something that, try as I might, I just can&#8217;t make myself sick of.<sup><a href="http://mettadore.com/ruby/using-github-as-a-small-scale-cdn-wrails/#footnote_0_524" id="identifier_0_524" class="footnote-link footnote-identifier-link" title="I&amp;#8217;ve tried for the past two summers to make myself sick of eating tomato sandwiches. I just can&amp;#8217;t.">1</a></sup></p>
<p>Recently, I took the Git survey, and it contained an interesting question along the lines of &#8220;What do you use Git for?&#8221; The answers were things like &#8220;configuration files&#8221; and &#8220;large binary files.&#8221;</p>
<p>I use Git and Github for a lot- configuration files are one use (I love the &#8220;raw&#8221; path), but it was only a small percentage of what that list suggested, so I started wondering how else I could use it.</p>
<p>Today, I thought of an interesting way: Github as a CDN.<sup><a href="http://mettadore.com/ruby/using-github-as-a-small-scale-cdn-wrails/#footnote_1_524" id="identifier_1_524" class="footnote-link footnote-identifier-link" title="The title is with Rails because that&amp;#8217;s what I used, but it would take 2.4 minutes to make this a &amp;#8220;With Django&amp;#8221; or &amp;#8220;With Lift&amp;#8221; example">2</a></sup></p>
<p>If you know what a <a href="http://en.wikipedia.org/wiki/Content_delivery_network">Content Delivery Network (CDN)</a> is, you don&#8217;t want me to explain. If you don&#8217;t, then it&#8217;s good enough to say that it&#8217;s a way to server up pictures or other content from another server. It&#8217;s often used to, say, serve the main portion of an html page from a webserver, but serve the images, CSS files, etc. from something like Amazon to speed things up.</p>
<p><img class="alignright" src="http://johnmetta.com/brand/logo.png" alt="" width="300" />I recently finished work on <a href="http://positivelyglorious.com/software-media/john-metta-an-intentional-brand/">The Great John Metta Branding Project</a> and, like with so many projects, stored the images in Dropbox. Then, deciding I might want to version them, I stored them in Github. Then, just as I was starting to begin the rather annoying process of copying all these logos and textmarks to my various sites throughout the web and updating all the image tags, I thought to myself &#8220;Hey, if these are already in Github, and I can access the raw files, why don&#8217;t I just use that as the image source?&#8221; But I don&#8217;t want to have to remember the URL each time. What if it was somewhat dynamically generated?</p>
<h2>A RESTful CDN system for a logo</h2>
<p>This is exactly why I made <a href="http://johnmetta.com">johnmetta.com</a> a Rails project, to play with stuff like this and then have a place to have it be live if I wanted to use it.</p>
<p>I&#8217;ve got a lot of different styles that my logo can take. Stacked, Icon only, textmark only, icon one-color grey, textmark one-color blue, etc. Ideally, I wouldn&#8217;t have to remember the path to each, I could type something like http://johnmetta.com/brand/icon/blue/transparent/logo.png<sup><a href="http://mettadore.com/ruby/using-github-as-a-small-scale-cdn-wrails/#footnote_2_524" id="identifier_2_524" class="footnote-link footnote-identifier-link" title="Actually having &amp;#8220;logo.png&amp;#8221; is unnecessary, however, sometimes the software using the URL will depend on that, so I just made it convention so that I don&amp;#8217;t have to think about when sometimes is.">3</a></sup> and have the app return the image that is strictly the icon (no words) with blue coloring and transparency inside the logo (instead of the normal white).</p>
<p>Since none of these actual images is created on the fly, I created a sensible directory structure and embedded all <img class="alignright" src="http://johnmetta.com/brand/icon/logo.png" alt="" width="100" />the files in this structure, naming them all <span style="font-family: courier new,courier">logo.png</span> and putting the default logo in the top level. So the above image would be {base}/full/logo.png, while a version with the icon on top would be {base}/full/stacked/logo.png. A one-color version of only the icon might be {base}/icon/blue/logo.png</p>
<p><img class="alignleft" src="http://johnmetta.com/brand/stacked/blue/logo.png" alt="" width="200" />So I created a <a href="http://github.com/johnmetta/brander">Brander</a> class which would turn arguments into an appropriate path and added some new routes such as &#8220;brand/:type/:color/logo.png&#8221; and created a call to brander in the controller&#8217;s &#8220;brand&#8221; action that ends with a redirect to the returned URL.</p>
<p>It&#8217;s all really simple, but it allows me to have a url like http://johnmetta.com/brand/icon/logo.png and supply my logo, and http://johnmetta.com/brand/stacked/blue/logo.png for a one-color blue stacked logo. Then, if I update the colors (move the files, whatever) they update automatically. At a maximum, I just check in the changes and make minimal changes to the routes- but don&#8217;t have to copy files to servers.</p>
<h2>A Good Illustration</h2>
<p>Right now, the Brander class is pretty dumb- little more than a way to translate a route into the correct external URL. It was built up not as an illustration of how to accomplish &#8220;Github as a CDN,&#8221; but merely as a toy to test one way that it might be done on a small scale. It might be better done as a class where instance attributes make more sense, and I&#8217;ll clean it up a bit, but not much more than that.</p>
<p>Also, it&#8217;s cool to know that stuff like this can be set up so easily, and for my uses- where bandwith might reach a whopping few requests per day, it&#8217;s useful while being low impact. But for a real CDN, you&#8217;d still want to use something like AWS- or at least talk to the Github guys before swamping their webservers.</p>
<ol class="footnotes"><li id="footnote_0_524" class="footnote">I&#8217;ve tried for the past two summers to make myself sick of eating tomato sandwiches. I just can&#8217;t.</li><li id="footnote_1_524" class="footnote">The title is with Rails because that&#8217;s what I used, but it would take 2.4 minutes to make this a &#8220;With Django&#8221; or &#8220;With Lift&#8221; example</li><li id="footnote_2_524" class="footnote">Actually having &#8220;logo.png&#8221; is unnecessary, however, sometimes the software using the URL will depend on that, so I just made it convention so that I don&#8217;t have to think about when sometimes is.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://mettadore.com/ruby/using-github-as-a-small-scale-cdn-wrails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>So you want to hire a ninja, do you?</title>
		<link>http://mettadore.com/analysis/so-you-want-to-hire-a-ninja-do-you/</link>
		<comments>http://mettadore.com/analysis/so-you-want-to-hire-a-ninja-do-you/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 22:36:33 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Miscellany]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[jobs]]></category>
		<category><![CDATA[ninja]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rockstar]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[zombie]]></category>

		<guid isPermaLink="false">http://mettadore.com/?p=437</guid>
		<description><![CDATA[I took a trip to Portland recently to traipse through OSCON. I was mostly in the exhibition hall with all the great schwag and company booths&#8211; many which had posted job announcements. While there, I was once again frustrated by a trend I keep seeing. The trend can be described as an &#8220;arms race of [...]]]></description>
			<content:encoded><![CDATA[<p>I took a trip to Portland recently to traipse through OSCON. I was mostly in the exhibition hall with all the great schwag and company booths&#8211; many which had posted job announcements. While there, I was once again frustrated by a trend I keep seeing. The trend can be described as an &#8220;arms race of job announcements,&#8221; and has gotten to the point where it&#8217;s difficult to find a development job listed by a company that is not seeking a &#8220;ninja,&#8221; or a &#8220;rockstar,&#8221; or some similarly absurdly described candidate.</p>
<h3>Smart and Gets Things Done</h3>
<p>As best I can tell, this trend really took off&#8211; even if it didn&#8217;t start&#8211; with Joel Spolsky&#8217;s blog article titled &#8220;<a href="http://www.joelonsoftware.com/articles/fog0000000073.html">The Guerrilla Guide to Interviewing</a>.&#8221; In that article, he stated that there was one primary requirement for working at Fog Creek Software: &#8220;Smart, and gets things done.&#8221;</p>
<p><a href="http://mettadore.com/files/2010/07/dwight.jpg"><img class="size-medium wp-image-441 alignright" src="http://mettadore.com/files/2010/07/dwight-218x300.jpg" alt="" width="218" height="300" /></a></p>
<p>His basic argument, with which I tend to agree, is that it doesn&#8217;t really matter what your past qualifications are as much as it matters that you can do to things: 1) Learn shit, and 2) Actually do shit.</p>
<p>His point? If you can&#8217;t learn, you&#8217;ll be stuck trying to write software in Visual Basic and someone will eventually shove you off of a roof out of frustration. Furthermore, if you don&#8217;t actually DO anything, but rather just talk about it, or think about it, or tell others why you could do it better&#8211; then you won&#8217;t even write software in Visual Basic. You won&#8217;t write any software at all, and someone will eventually shove you off of a roof out of frustration.</p>
<p>But if you can learn, it doesn&#8217;t matter what you come into the job knowing, because that&#8217;s merely a starting point. It&#8217;s how your knowledge and skills translate over time that&#8217;s important. You can learn &lt;insert whatever you need to do your job here&gt; quickly. I say quickly because you are a DOER, and doers always learn new stuff, so they can DO more stuff.</p>
<p>The most important thing here: The job will probably change, and when it changes, it&#8217;s the people who can LEARN, ADAPT and DO that will help the company succeed. The person who came to the job with one incredible skill but can&#8217;t learn probably has that one incredible skill in a stupid technology like Visual Basic, and someone will eventually shove&#8211;</p>
<p>well, you get the idea.</p>
<h3>The problem with catchy words</h3>
<p>So, herein lies a bit of the problem. Joel also talks about hiring the best people, treating them like &#8220;rockstars,&#8221; etc. Again, I think he has a point, but that there are a great deal of people who are stupidly picking up the hot new terms like &#8220;rockstar&#8221; and &#8220;ninja&#8221; and using the words, basically, without using their brains.</p>
<p>I see them a lot. Those posting that sound all hip and cool: &#8220;Are you a Python Guru?&#8221; or &#8220;We&#8217;re looking for a Ruby Rockstar for-&#8221; or &#8220;We want a PHP ninja to-&#8221; Everytime I see one of them I want to slap them in the head with the nearest O&#8217;Reilly book and then vomit.</p>
<p>This type of job posting proves one thing to the very people that you want hire: That they don&#8217;t want to work for you.</p>
<p>Why?</p>
<p>Because the very people you want to hire are the ones who describe themselves as &#8220;hard working&#8221; or &#8220;with a lot to learn&#8221; or even &#8220;not as good as many, but loyal, friendly and likes to learn new things.&#8221;</p>
<h3>Do you really want to hire a ninja?</h3>
<p>What&#8217;s a ninja?</p>
<p>It&#8217;s such a stupid, overused buzzword! Do you even know  what it means? It&#8217;s either an assassin or a stupid 14 year old jumping  out of a dumpster brandishing a medieval sword.</p>
<p>You don&#8217;t want either  of those things!</p>
<div id="attachment_438" class="wp-caption alignleft" style="width: 310px"><a href="http://mettadore.com/files/2010/07/GirlNinjas.jpg"><img class="size-medium wp-image-438" src="http://mettadore.com/files/2010/07/GirlNinjas-300x240.jpg" alt="" width="300" height="240" /></a><p class="wp-caption-text">Ninja: It&#039;s a word that&#039;s THIS overused</p></div>
<p>Yes, there&#8217;s some evidence that a well trained ninja was, if absolutely nothing else, a competent assassin (though the Samurai made fun of them). A ninja is basically a person who does one single thing really well, they kill people, and the rest of life- including the whole &#8220;getting along with people&#8221; part- they could give a rat&#8217;s ass about.</p>
<p>Human interaction to a ninja is &#8220;kill them!&#8221;</p>
<p>Conflict resolution to a ninja: &#8220;Kill them!&#8221;</p>
<p>For those who miss my subtly: A ninja programmer&#8217;s response to pretty much anything is going to be this: &#8220;Do it my way and no-one gets stabbed in the face with my medieval sword.&#8221;<sup><a href="http://mettadore.com/analysis/so-you-want-to-hire-a-ninja-do-you/#footnote_0_437" id="identifier_0_437" class="footnote-link footnote-identifier-link" title="No, don&amp;#8217;t ask your ninja programmer why they have a European weapon, you&amp;#8217;ll get stabbed in the face.">1</a></sup></p>
<p>Think about it. Do you really want to hire someone who does <em>one single thing</em> really well? To the exclusion of things like &#8220;showering&#8221; and, say &#8220;talking to other human beings?&#8221;</p>
<h3>Ninjas are Zombies!</h3>
<p>Here&#8217;s a neat trick: think of another stupid, overused buzzword: Zombie. What if I told you that ninjas are just zombies with black bags over their heads?</p>
<p>They do one thing really well: kill people (eating their brains- mostly the brains of your team if you hire them), and they could give a rat&#8217;s ass about things like &#8220;human interaction&#8221; and &#8220;conflict resolution.&#8221; What&#8217;s their solution to everything? &#8220;Kill them! (and, since we&#8217;re here, we could maybe snack on their brains too&#8230;)&#8221;</p>
<p>Ninjas are zombies! They&#8217;re mindless idiots going around trying to do one thing.</p>
<p>That&#8217;s it.</p>
<p>When you say &#8220;I want a ninja&#8221; you&#8217;re saying &#8220;you can be a complete asshole, refuse to learn anything new, refuse to respond to other human needs or the needs of the business, and also be a social trainwreck. Oh, and you don&#8217;t really need to know, or care, about 90% of programming or computer work, but if you can sit in your hole and &lt;do that one thing well&gt; and not talk to anyone, you&#8217;re the guy for us!&#8221;</p>
<p>You want a ninja-zombie as your lead developer, don&#8217;t you? Admit it.</p>
<h3>Rockstars: They go to 11</h3>
<p>Alright, I think you get my point, but let me touch upon rockstars for a moment. Here&#8217;s another place where I think Joel&#8217;s point was completely missed by a lot of people. Joel says &#8220;hire the best people you can find and treat them like rockstars&#8221; and in pure politician-like &#8220;I don&#8217;t really want to put any actual cognitive thought into this process, so I&#8217;ll just pull a buzzword&#8221;-style, job announcements start popping up for undefinable qualities such as &#8220;Ruby Rockstar.&#8221;</p>
<div id="attachment_440" class="wp-caption alignright" style="width: 310px"><a href="http://mettadore.com/files/2010/07/spinal-tap.jpg"><img class="size-medium wp-image-440" src="http://mettadore.com/files/2010/07/spinal-tap-300x201.jpg" alt="" width="300" height="201" /></a><p class="wp-caption-text">You want these guys in your company?</p></div>
<p>The mistake here is that all the corporate bozos think &#8220;Hey, &#8216;Rockstar&#8217; is the current buzzword, so I&#8217;ll use that too!&#8221; without stopping to think about one thing: &#8220;Rockstars don&#8217;t usually make the best employee material.&#8221;</p>
<p>Think of the words &#8220;punctual&#8221; and &#8220;hardworking.&#8221; Okay, now, keep those words in your head, and think of the word &#8220;rockstar.&#8221;</p>
<p>Yeah, your neck hurts doesn&#8217;t it?</p>
<p>See what happens when you take things out of context? Joel&#8217;s statement was &#8220;<em>treat</em> them like rockstars.&#8221; In otherwords, treat them like they mean something, like they matter, like the company depends on their happiness… so they will be happy… and do really good work… and make you more money.</p>
<p>The line was emphatically NOT &#8220;Make them <em>into</em> rockstars.&#8221;</p>
<p>Seriously! Think about your average caricature of a rockstar.<sup><a href="http://mettadore.com/analysis/so-you-want-to-hire-a-ninja-do-you/#footnote_1_437" id="identifier_1_437" class="footnote-link footnote-identifier-link" title="which is all we&amp;#8217;re really talking about in either case- neither Joel or you are talking about Dar Williams, here.">2</a></sup> They show up late, drunk, stoned, with a 16 year old&#8217;s bra stuck to their belt, and give you a loud, shitty performance of something they don&#8217;t feel like playing before hopping back into the bus for more sex, booze, and food.</p>
<p>Okay people, repeat this after me:</p>
<p><strong>&#8220;I don&#8217;t want to hire a Rockstar!&#8221;</strong></p>
<p>A rockstar is probably worse than a ninja, because at least a ninja- or a zombie, for that matter- can do <em>one</em> freakin&#8217; thing well. The only thing the rockstar can do is pray to god that the sound team can mix together the shit they call a studio performance, and that the stage crew can hit blow the fireworks early to cover the guitarist tripping and falling because they&#8217;re too freakin stoned to remember that there&#8217;s a drumset behind them.</p>
<p>They think of themselves as the best thing that&#8217;s ever happened to you, and if you tell them otherwise, they&#8217;ll freak out.</p>
<p>Rockstars <em>look</em> good. Full stop.</p>
<p>You know who the rockstar is? It&#8217;s the young programmer I met at the <a href="http://opensourcebridge.org">Open Source Bridge conference</a> who immediately berated me for using a different database strategy than him&#8211; without ever stopping to listen to the problem I was solving, to hear about my application&#8217;s design, or to learn <em>why</em> I would choose one over the other.</p>
<p>I was wrong, they were right, and I should really just stop being stupid and do it their way.</p>
<p>Yeah, that&#8217;s who I want on <em>my</em> team.</p>
<p>Fucking rockstars.</p>
<h3>Are you an incompetent programmer with an overblown sense of self-worth?</h3>
<p>Here&#8217;s the part that bugs me the most: The people posting these job announcements are actively selecting for people with a tendency to overstate their abilities while understating their faults.<br />
<a href="http://mettadore.com/files/2010/07/cat.jpg"><img class="alignleft size-medium wp-image-444" src="http://mettadore.com/files/2010/07/cat-265x300.jpg" alt="" width="265" height="300" /></a><br />
It&#8217;s called the <a href="http://en.wikipedia.org/wiki/Dunning-Kruger_effect">Dunning-Kruger effect</a> and it&#8217;s well documented in both the scientific literature and<a href="http://en.wikipedia.org/wiki/Dunning-Kruger_effect">popular journalism</a>.</p>
<p>The basic Gist is this: Incompetent people tend to overstate their abilities and think they are amazing, while highly competent people tend to downplay their skills and think that they are less than amazing.</p>
<p>And you know it&#8217;s true.</p>
<p>Go pick the first male rockstar-ninja-zombie programmer you can find and I&#8217;ll pick the first quiet, understated female programmer I can find. Then we&#8217;ll see which one can actually shut the hell up about how great they are and get something done.</p>
<p>The best people for the job are not the ones who are going to feel comfortable applying for the &#8220;Amazing Rockstar!!1!&#8221; position for the very reason that <em>they are the ones that you want to hire</em>: because they are too busy being amazed at all the stuff they <em>don&#8217;t</em> know to be rockstars who tell you everything that they <em>do</em> know.</p>
<p>They don&#8217;t think they know everything. In fact, with everything there is out there, they realize that they know basically <em>nothing</em>. Most importantly: They know that there&#8217;s a lot to learn, and they are trying to learn it.</p>
<p>The rockstars? The ninjas? They already know it, and they&#8217;ll tell you.</p>
<p>In fact, They&#8217;re more than happy to tell you <em>how much</em> they know.</p>
<p>Every single time you interact with them.</p>
<h3>Folk Developer: Will learn and be nice for food</h3>
<p>I don&#8217;t apply to any of these positions because, while there are a lot of things that I <em>am</em> and <em>can</em> do, there are certain things that I am emphatically <em>not</em>. A partial list of the things that I&#8217;m not is:</p>
<ul>
<li>Rockstar</li>
<li>Ninja</li>
<li>Zombie</li>
<li>Best person in the world at &lt;fill in whatever you want here&gt;</li>
</ul>
<p>Me, I&#8217;m not any of that. And that makes me think, from the majority of jobs I see lately, that I won&#8217;t be good enough to make the cut. And let&#8217;s face it, if they&#8217;re advertising for a rockstar, then I am probably not, because I do a lot of things competently, not one thing <em>better than everyone else including you</em>.</p>
<p><a href="http://mettadore.com/files/2010/07/ad-tiger.gif"><img class="alignleft size-full wp-image-465" src="http://mettadore.com/files/2010/07/ad-tiger.gif" alt="" width="251" height="243" /></a>See here&#8217;s the thing: I&#8217;ve been programming for 25+ years, I&#8217;m competent in at least 10 different languages, and really good in at least 4.<sup><a href="http://mettadore.com/analysis/so-you-want-to-hire-a-ninja-do-you/#footnote_2_437" id="identifier_2_437" class="footnote-link footnote-identifier-link" title="5 if we count Ruby, which I&amp;#8217;m learning more about every day">3</a></sup> I&#8217;ve built everything from robotic control systems to mathematical models, from spatial applications to social web applications. I&#8217;ve <em>taught</em> programming, and am about to do so again, and I do other things like start a <a href="http://rubygorge.org">Ruby users group</a>.</p>
<p>By many-if-not-all accounts, I&#8217;d be one hell of a developer to have on a team; yet many teams are seeking rockstars.</p>
<p>I am not a rockstar.</p>
<p>I&#8217;m not the guy on stage with lights and explosions and a screaming electric guitar.</p>
<p>I&#8217;m the guy who goes to a party and sits on the couch singing a song on a guitar. A really fun song, with really good guitar work, but not anything that needs lights and explosions. I may also pick up a banjo or back someone up on a number of other instruments, but mostly I just stay at the party and hang out with people.</p>
<p>No lights. No explosions.</p>
<p>I&#8217;m a folk developer.</p>
<p>I&#8217;m a seeker, I&#8217;m a learner. I&#8217;m a hard worker who will spend his free time coming up to speed on a technology for curiosity as well as success. I&#8217;m loyal, I&#8217;m friendly, I&#8217;ve got a sense of humor and would much rather laugh at myself than at anyone else. I spend my off time programming, like lots of people who love programming, but I also spend my off time playing the Irish flute and banjo, cycling, brewing cider and mead, working in community theater, and lots of other social pursuits.</p>
<p>Despite this (or, rather, because of it) I see myself as little more than &#8220;a decent programmer who&#8217;s probably not as good as most, but might be better than some.&#8221; In fact, I don&#8217;t have enough fingers to count the number of jobs I&#8217;ve actually <em>turned down</em> because I thought that I was probably not good enough&#8211; only to find that someone else was hired whom I actually know that I can outperform.</p>
<p>I am not going to apply for a job as a Python ninja or a Ruby Rockstar, because I&#8217;m not a ninja or a rockstar. I&#8217;m a person who knows a heck of a lot less about Ruby than many other Ruby programmers.</p>
<p>I&#8217;m a person with a lot to learn.</p>
<p>Exactly zero of my qualities describe a rockstar.</p>
<h3>Are you an incompetent company with an overblown sense of  self-worth?</h3>
<p>And I know that&#8217;s also true of many of my developer friends and colleagues. Companies select for people who are not them.</p>
<p>Here&#8217;s the clincher. Most of those companies who are hiring ninjas and rockstars are probably doing so because they see themselves as ninja and rockstar companies.</p>
<p>They are the companies that say things like &#8220;do you want to work in our cool-ass company where everything is better than any other company you&#8217;ve ever worked for, where we have foosball all day and are all awesome and badass about everything we do?&#8221;</p>
<p>Sound familiar? I&#8217;ll bet it does.</p>
<p>It sounds like a rockstar of a company.</p>
<ol class="footnotes"><li id="footnote_0_437" class="footnote">No, don&#8217;t ask your ninja programmer why they have a European weapon, you&#8217;ll get stabbed in the face.</li><li id="footnote_1_437" class="footnote">which is all we&#8217;re really talking about in either case- neither Joel or you are talking about Dar Williams, here.</li><li id="footnote_2_437" class="footnote">5 if we count Ruby, which I&#8217;m learning more about every day</li></ol>]]></content:encoded>
			<wfw:commentRss>http://mettadore.com/analysis/so-you-want-to-hire-a-ninja-do-you/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Stop being stupid about belongs_to!</title>
		<link>http://mettadore.com/ruby/stop-being-stupid-about-belongs_to/</link>
		<comments>http://mettadore.com/ruby/stop-being-stupid-about-belongs_to/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 20:38:19 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[belongs_to]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[screwhead]]></category>

		<guid isPermaLink="false">http://mettadore.com/?p=429</guid>
		<description><![CDATA[This is just a post that may help me stop being stupid. Writing it may help carve it into the permanent portion of my memory instead of the &#8220;forget about it and then periodically have to think twice and remember that you did something stupid&#8221; portion. It&#8217;s a small thing, more of an annoyance than [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a post that may help me stop being stupid. Writing it may help carve it into the permanent portion of my memory instead of the &#8220;forget about it and then periodically have to think twice and remember that you did something stupid&#8221; portion.</p>
<p>It&#8217;s a small thing, more of an annoyance than a real problem. Something like my tendency to forget &#8220;end&#8221; after blocks (a Python holdover) and to assume that zero equals false (a sort of &#8220;everything else&#8221; holdover).</p>
<p>It boils down to this:</p>
<p><span style="font-size: large">belongs_to is singular,  you stupid dipshit! Stop being a mindless screwhead and remember that for a change, John!</span></p>
<p>Honestly, it only takes me a second once I get the ever familiar error, but it&#8217;s just better to not get the error at all, right? Efficiency and correctness.</p>
<p>If anyone reads this and runs into me later, I wouldn&#8217;t mind if you repeat that statement to me.</p>
<p>More reminders couldn&#8217;t hurt.</p>
]]></content:encoded>
			<wfw:commentRss>http://mettadore.com/ruby/stop-being-stupid-about-belongs_to/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>4th, 4, and 5: Why I Don&#8217;t Start At The Front</title>
		<link>http://mettadore.com/analysis/4th-4-and-5-why-i-dont-start-at-the-front/</link>
		<comments>http://mettadore.com/analysis/4th-4-and-5-why-i-dont-start-at-the-front/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 22:53:22 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Miscellany]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://mettadore.com/?p=395</guid>
		<description><![CDATA[This post is mostly a whiny diatribe on how I&#8217;m a stupid idiot. Mostly, when I code, I focus on logic: algorithms, object models and other back-end stuff. All the stuff that&#8217;s hard and doesn&#8217;t give any sort of gratification to the front-end developers or users because, well, it&#8217;s not on the front-end. The stuff [...]]]></description>
			<content:encoded><![CDATA[<p>This post is mostly a whiny diatribe on how I&#8217;m a stupid idiot.</p>
<p>Mostly, when I code, I focus on logic: algorithms, object models and other back-end stuff. All the stuff that&#8217;s hard and doesn&#8217;t give any sort of gratification to the front-end developers or users because, well, it&#8217;s not on the front-end. The stuff I like to code are the elegant binary-keyed dictionary structures that route water in multiple simultaneous directions in a hydrologic model. It&#8217;s the stuff no-one sees.</p>
<p>Consequently, because I hate the design side,<sup><a href="http://mettadore.com/analysis/4th-4-and-5-why-i-dont-start-at-the-front/#footnote_0_395" id="identifier_0_395" class="footnote-link footnote-identifier-link" title="I don&amp;#8217;t actually hate it. I just take 7 hours playing around with 2 px changes in CSS files and then finally give up">1</a></sup> my apps generally look extremely rough, almost unusable, but <em>damn</em> do they do some cool shit. If it&#8217;s something that needs a front-end, I either do that last, or get the back-end working and then ship it out.</p>
<p>Recently, I took on a project for a fellow who&#8217;d been working for months with a developer. I pretty much thought I was going to &#8220;parachute in&#8221; and take this developer&#8217;s code and bring it to launch. Well, it turned out that the previous developer didn&#8217;t actually write <em>any</em> code. None. Zip. Instead, what they did was create long &#8220;what we should do&#8221; lists and emails.</p>
<p>And, they got a design.</p>
<p>So, the &#8220;code&#8221; I was given was not code at all. Rather, it was a really nice design from a third-party designer. Thus, rather than build the back-end to the site, I had a design that I just had to plug into. I decided to break up that design into views and plug them into my new Rails app directory before I started build models.</p>
<p>This, as it turns out, was a very serious mistake.</p>
<p>Because it seems that I have a certain workflow, and that workflow is to develop an object model based on the logic that is needed, and that logic is based on the function that the application is to perform. That&#8217;s why I work so well on the backend without a design. The bare scaffolding allows me to think about the <em>object</em> and not the <em>layout</em>.</p>
<p>In this case, I made the mistake of applying this design before creating even my first model. That was bad. Very bad.</p>
<p>The thing is, designs have all kinds of embedded assumptions. Usually, when the design is based on the logic, the assumption is &#8220;it has to provide an interface for this logic.&#8221; However, when the design is created in absence of the logic, then the assumption is something more along the lines of &#8220;well, hell, I guess it might need one of these.&#8221;</p>
<p>I didn&#8217;t ever realize it until very recently, but I now know that what I was doing was some weird, disconnected hybrid of design reasoning. It was something between &#8220;This is the most robust-yet-simple object model that I can start with and build from&#8221; and &#8220;well, the design says it has an X button, so I guess I&#8217;d better build an X model.&#8221;</p>
<p>Yeah, I know it&#8217;s stupid. The thing was, it all happened so subtly that I didn&#8217;t even realize it! I guess that, in other projects, by time the design is applied, the object model is solidified. Thus, if there&#8217;s a button, you can be damn sure it needs to be hooked up. In this case, there are buttons that pretty much everyone sees and thinks &#8220;Yeah, I don&#8217;t know why that&#8217;s there.&#8221;</p>
<p>So, today I was trying to work around 7 polymorphic models and at the same time I was thinking &#8220;this would be easier if I didn&#8217;t have to scroll past all the glitzy site images to see this whenever I look at it.&#8221;</p>
<p>That was when it hit me. I don&#8217;t. And more than that, the 7 polymorphic models I have are really only there because there&#8217;s this navigation bar, immediately above the glitzy site images, that says they should be.</p>
<p>So, believe it or not, I did the crazy thing. New repository, new Rails scaffold. Start over.</p>
<p>So now, it&#8217;s 4th down in the 4th quarter, there&#8217;s like 5 minutes to play until this prototype is due, and I&#8217;m dropping back to punt with a new Rails app that doesn&#8217;t have a design applied.</p>
<p>And I&#8217;m hopeful, because it&#8217;s actually a fairly simple app, just with a complicated design. But as a simple app, I know it&#8217;ll be simple for me to whip out, now that I have a clean understanding of the object model, and no design cluttering my thoughts.</p>
<p>Damn, it&#8217;s late in the game to come to this play, but at least I know better now.</p>
<ol class="footnotes"><li id="footnote_0_395" class="footnote">I don&#8217;t actually hate it. I just take 7 hours playing around with 2 px changes in CSS files and then finally give up</li></ol>]]></content:encoded>
			<wfw:commentRss>http://mettadore.com/analysis/4th-4-and-5-why-i-dont-start-at-the-front/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ruby Can&#8217;t Scale!</title>
		<link>http://mettadore.com/ruby/ruby-cant-scale/</link>
		<comments>http://mettadore.com/ruby/ruby-cant-scale/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 17:44:53 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Github]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[scale]]></category>

		<guid isPermaLink="false">http://mettadore.com/?p=374</guid>
		<description><![CDATA[This weekend, during my wife&#8217;s birthday celebrations, I talked with someone about my recent programming exploits, including how much fun I&#8217;m having programming web applications in Ruby on Rails. The response: &#8220;Sure, Ruby&#8217;s fun, but it&#8217;s not really useful. It&#8217;s a cute scripting language, but it can&#8217;t scale.&#8221; Until recently, this was an opinion that [...]]]></description>
			<content:encoded><![CDATA[<p>This weekend, during my wife&#8217;s birthday celebrations, I talked with someone about my recent programming exploits, including how much fun I&#8217;m having programming web applications in Ruby on Rails. The response:</p>
<blockquote><p>&#8220;Sure, Ruby&#8217;s fun, but it&#8217;s not really useful. It&#8217;s a cute scripting language, but it can&#8217;t scale.&#8221;</p></blockquote>
<p>Until recently, this was an opinion that I agreed with. Hell, it was actually something I told <em>other people</em>.</p>
<p>One day, I realized <em>why</em> I agreed with it.</p>
<p>Now it&#8217;s just an opinion that makes me want to smack someone.<span id="more-374"></span></p>
<h3>Geeks are Dumb</h3>
<p>I don&#8217;t really know where the whole &#8220;Ruby can&#8217;t scale&#8221; argument comes from, but I have my suspicions.</p>
<p>The main suspicion is that, as a general rule, programmers are geeks, and geeks spend a great deal of their childhood development getting beaten up by non-geeks.<sup><a href="http://mettadore.com/ruby/ruby-cant-scale/#footnote_0_374" id="identifier_0_374" class="footnote-link footnote-identifier-link" title="That was pretty much my childhood, anyway, so maybe I&amp;#8217;m projecting a bit.">1</a></sup> Thus, we child-geeks tended to focus our efforts on something we knew that we did better than the wrestlers and football players. That something was generally not wrestling or football. It was academics.</p>
<p>We geeks are smart.</p>
<p>Think about the football player who spends his entire school day like a stupid monkey, proving that he&#8217;s tougher and plays football better than the other stupid football playing monkeys.</p>
<p>Geeks aren&#8217;t stupid monkeys. Geeks have a brain.</p>
<p>And we use that brain to spend our entire school day like a stupid monkey, proving that we&#8217;re smarter and use our brain better than the other stupid brain-using monkeys.</p>
<p>Oop. There it is.</p>
<h3>Truth Hurts</h3>
<p>Oh stop being dramatic! You <em>know</em> it&#8217;s true! You&#8217;re just too busy being a stupid brain-using monkey to want to admit it!</p>
<p>You can&#8217;t name a single geek-dominated situation that wasn&#8217;t essentially a &#8220;I&#8217;ll take your obsure science fiction reference and raise you an obscure Dungeons and Dragons reference&#8221; chest-pounding war of the stupid monkey-brained geeks.</p>
<p>No, you can&#8217;t. Stop trying.</p>
<p>The point is, it&#8217;s all about being the übergeek. And the competition of übergeek is a constant struggle of</p>
<blockquote><p>&#8220;No, <em>I</em> was the smartest person in my class! So if you say something smart, I have to say something <em>smarter</em>!&#8221;</p></blockquote>
<p>And so when someone tells me that they are programming in some hot, trendy new language, I can&#8217;t say something like</p>
<blockquote><p>&#8220;Oh, it&#8217;s great that you&#8217;re moving forward and trying something new&#8230; I&#8217;ve been feeling a bit old lately, kind of in a rut, and was somewhat scared to learn that shiny new language.&#8221;</p></blockquote>
<p>Yeah, right.</p>
<p>Imagine a geek actually <em>admitting weakness</em>! HA!</p>
<p>No, when I hear someone say they&#8217;re programming in some hot, trendy new language, I say:</p>
<blockquote><p>&#8220;But hot and trendy are stupid, like that hot girl who wouldn&#8217;t date me in high school. And your new language is stupid too! And I think I overheard someone say that it has a defect, and so even though I don&#8217;t know <em>anything</em> about your new language, I&#8217;m going to spout out this defect to prove that I&#8217;m better than you for <em>not</em> using it. There! I win!&#8221;</p></blockquote>
<p>Fun fact: Geeks, as a general rule, are freakin&#8217; terrified of anything that carries the descriptor &#8220;trendy,&#8221; because if we knew what that word meant, we wouldn&#8217;t be geeks, we&#8217;d be popular.</p>
<h3>Datapoints</h3>
<p>This may seem harsh, but stop being all &#8220;must not admit weakness&#8221;-y and use that monkey brain to actually think about it.</p>
<p>Here&#8217;s a nice datapoint: Twitter.</p>
<p>(I already hear you, by the way)</p>
<blockquote><p>&#8220;But Twitter was down <em>all the time</em>! Because Ruby can&#8217;t scale! That&#8217;s why they moved to Scala!&#8221;</p></blockquote>
<p>Was it? Was it really? Is that smart monkey brain actually working? Saying Twitter was down all the time is like saying that the United States Postal Service is not a good choice to carry mail because it&#8217;s inefficient and looses a lot of mail.</p>
<p>But, but, they lost a letter of mine once!</p>
<p>Yeah, sure. And they deliver on the order of a billion freakin letters every day! Did your super smart übergeek brain never actually <em>grok</em> percentages?</p>
<p>Do you have any idea what kind of traffic Twitter had when they moved to Scala? Saying Ruby can&#8217;t scale because Twitter had a freakin&#8217; failwhale every once in a while is like saying that the space shuttle&#8217;s not a <em>real</em> spacecraft because it only goes into <em>near</em> space.</p>
<p>It goes <em>into freakin space</em>&#8230; and you don&#8217;t have jack shit that&#8217;s ever going to be any better.</p>
<p>Why are you even talking?</p>
<h3>Coffee Shop Critics</h3>
<p>The truth of the matter is that the people saying that Ruby can&#8217;t scale are not the developers from Twitter, or from 37 Signals, or from Github. They are not the developers from the companies that have built ridiculously freakin&#8217; big web applications in Ruby.</p>
<p>No, they are the developers who are sitting in coffee shops&#8211; secure in the knowledge that if someone just knew how smart they were, they wouldn&#8217;t have to sit in that coffee shop and talk about their amazing idea. If someone only knew their greatness, they could be a contender!</p>
<p>It&#8217;s simple. The people who are busy having the &#8220;my language is better than your language&#8221; battle in coffee shops are pretty much guaranteed to <em>not</em> be the same people who are <em>actually building large-scale applications</em>. Why?</p>
<p>Because <em>those</em> people are too busy <em>actually building large-scale applications</em> to get into stupid chest-pounding arguments with monkey-brained nitwits.<sup><a href="http://mettadore.com/ruby/ruby-cant-scale/#footnote_1_374" id="identifier_1_374" class="footnote-link footnote-identifier-link" title="Oh stop being dramatic! I don&amp;#8217;t have anything to show either. I&amp;#8217;m in a coffee shop writing a freakin&amp;#8217; blog post instead of actually accomplishing something.">2</a></sup></p>
<p>Look, none of us likes to admit weakness. Me worst of all. All I&#8217;m saying is that admitting weakness can make us stronger.</p>
<p>And saying something like &#8220;Ruby can&#8217;t scale&#8211;&#8221; especially when you&#8217;ve never programmed in Ruby and are just spouting stupid shit that you heard someone else say just so you can say <em>something</em>&#8211; is weak.</p>
<p>Unless you actually have something built&#8211; and that something is so freakin &#8220;oh my god we have more data than Twitter&#8221;-big that you actually know that it couldn&#8217;t be done in Ruby&#8211; then you&#8217;re full of shit, you know you&#8217;re full of shit, I know you&#8217;re full of shit, so you might as well just admit that you&#8217;re full of shit. Because if you don&#8217;t then you just look stupid.</p>
<p>And no true geek wants to look stupid.</p>
<p>Sometimes I think I may slap the next coffee shop critic that tells me Ruby can&#8217;t scale.</p>
<p>Me: &#8220;I&#8217;m learning Ruby&#8221;</p>
<p>Monkey: &#8220;But Ruby can&#8217;t scale&#8221;</p>
<p>Me: &#8220;Hrm. I guess you&#8217;re right. By the way, what do you use for Source Control&#8221;</p>
<p>Monkey: &#8220;Github.&#8221;</p>
<p>Me: &lt;SMACK!&gt;</p>
<p>See?</p>
<h3>Duck typing with Duct Tape</h3>
<p>I&#8217;m learning Ruby. I&#8217;m programming web applications in Ruby on Rails.</p>
<p>Moreso, I&#8217;m programming web applications that <em>absolutely must scale</em>.</p>
<blockquote><p>&#8220;But why are you using Ruby? Ruby can&#8217;t sc&#8211;&#8221;&lt;SMACK!&gt;</p></blockquote>
<p>Because let me tell you something: Having a &#8220;0.01% of users sometimes complain that it&#8217;s broken, can&#8217;t really scale because it worked for Twitter just fine&#8221; webapp is much better than having&#8230; oh, say <em>nothing</em>!</p>
<p>I&#8217;m not going to fool myself. Maybe Ruby can&#8217;t scale beyond a certain point. Who knows? I sure as hell don&#8217;t, because I&#8217;m not at that point. And the person telling me that Ruby can&#8217;t scale isn&#8217;t at that point either, I&#8217;ll bet.</p>
<p>We&#8217;re not at the point where we have 25 million users.</p>
<p>We&#8217;re not at the point where VC firms are dumping $15 million dollars in our laps.</p>
<p>We&#8217;re at the point where we are so busy <em>talking</em> that we&#8217;re not actually <em>doing</em> anything.</p>
<p>I&#8217;m in a freakin coffee shop, with a maybe good idea. And with a really fun language&#8230; one that&#8217;s powerful enough for Github and which scaled well enough to bring VC firms to Twitter <em>after</em> 25 million users came!</p>
<p>And with enough freakin&#8217; bravery to at least <em>want</em> to admit weakness&#8211; that I don&#8217;t know what the hell I&#8217;m talking about when someone mentions the next trendy language that I&#8217;m too scared of, or too lazy to learn, or simply not really interested in.</p>
<p>I&#8217;m in a coffee shop, and I&#8217;m ready to use duck typing, or freakin&#8217; <em>duct tape</em> if I have to, if that&#8217;s what it takes to actually stop spouting bullshit about scaling issues and actually <em>accomplish something</em>&#8230;</p>
<p>&#8230;and get the hell out of this damn coffee shop!</p>
<ol class="footnotes"><li id="footnote_0_374" class="footnote">That was pretty much my childhood, anyway, so maybe I&#8217;m projecting a bit.</li><li id="footnote_1_374" class="footnote">Oh stop being dramatic! I don&#8217;t have anything to show either. I&#8217;m in a coffee shop writing a freakin&#8217; blog post instead of actually accomplishing something.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://mettadore.com/ruby/ruby-cant-scale/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>RedGreen gem conflicts with Autotest when using RSpec</title>
		<link>http://mettadore.com/ruby/redgreen-gem-conflicts-with-autotest-when-using-rspec/</link>
		<comments>http://mettadore.com/ruby/redgreen-gem-conflicts-with-autotest-when-using-rspec/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 23:56:52 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[autotest]]></category>
		<category><![CDATA[growl]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[redgreen]]></category>
		<category><![CDATA[rspec]]></category>

		<guid isPermaLink="false">http://mettadore.com/?p=346</guid>
		<description><![CDATA[If you&#8217;re trying to use RSpec with Autotest in a Rails app, and get a strange error: Check whether you&#8217;re using the RedGreen colorizing gem. It seems that this conflicts somehow with the setup. The good thing is that I can turn that off and still work well since I have the autotest-growl plugin installed, [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re trying to use RSpec with Autotest in a Rails app, and get a strange error:</p>
<pre class="brush: bash; title: ; notranslate">

invalid option: --autospec
Test::Unit automatic runner.

Usage: -e [options] [-- untouched arguments]
</pre>
<p>Check whether you&#8217;re using the RedGreen colorizing gem. It seems that this conflicts somehow with the setup. The good thing is that I can turn that off and still work well since I have the autotest-growl plugin installed, so I see Growl notifications of my tests.</p>
<p>Hope this helps someone&#8217;s frustrated Google results.</p>
]]></content:encoded>
			<wfw:commentRss>http://mettadore.com/ruby/redgreen-gem-conflicts-with-autotest-when-using-rspec/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Populating City &amp; State Names in a Rails App</title>
		<link>http://mettadore.com/ruby/populating-city-state-names-in-a-rails-app/</link>
		<comments>http://mettadore.com/ruby/populating-city-state-names-in-a-rails-app/#comments</comments>
		<pubDate>Mon, 22 Feb 2010 02:35:06 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[cities]]></category>
		<category><![CDATA[dropdowns]]></category>
		<category><![CDATA[geographic information]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[states]]></category>

		<guid isPermaLink="false">http://mettadore.com/?p=344</guid>
		<description><![CDATA[Recently, I started working on a new project where people will need to enter city/state, as well as university details. The reasons are unimportant here except to say that entering this into a database using an input field is problematic if you need to use the database later in a programmatic fashion. It only takes [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I started working on a new project where people will need to enter city/state, as well as university details. The reasons are unimportant here except to say that entering this into a database using an input field is problematic if you need to use the database later in a programmatic fashion. It only takes one person accidentally entering their city as &#8220;New Yrok&#8221; for your database calls to start screwing up. The best thing you can do is give people a choice, and force them to use it.</p>
<p>I debated a while on how to do this, and even found <a href="http://stackoverflow.com/questions/1414244/rails-plugin-for-us-states-and-cities/1414287">other people looking for the same thing</a>. Following up on that, I downloaded the <a href="http://www.weather.gov/geodata/catalog/national/html/cities.htm">citynames GIS database</a> from the National Weather Service and started working. The result was a full suite of US city names&#8211; over 41,000 records!</p>
<h3>Rails Plugin</h3>
<p>I created my first Rails plugin to incorporate this data into an existing Rails application. The plugin is hosted on <a href="http://github.com/mettadore/geoinfo">Github as geoinfo</a>. This is as much an attempt to learn about creating plugins/gems as it is an attempt to provide a useful library for someone. Those of you who are looking to use it, check things out first.</p>
<h4>Innards: lib/db</h4>
<p>Basically, the important part is in lib/db. In that file are some YAML files holding the actual database of 41.5k cities and US states and outlying areas as well as Canadian provinces and territories. In lib/db/migrate are the migration files for geoinfo_cities and geoinfo_states database tables. I chose this naming convention to avoid clashes with other tables. Thus, if you want to use this data without the plugin, grabbing the lib/db folder is really all you need to do.</p>
<h3>Coda</h3>
<p>In the future, I hope to create custom methods for generating smart AJAXy dropdowns so that people can choose a state and have a city dropdown populated from that. I&#8217;d also like to include postal codes and more countries, because others may find that useful. We&#8217;ll see how much I can add&#8211; given that hunting down the data is the hard part.</p>
<p>Details, updates, changes, etc. will mostly be housed on <a href="http://github.com/mettadore/geoinfo">Github</a>. Feel free to fork and update/modify and send pull requests. If you have data to add (i.e. other countries or zipcode info), I&#8217;d love to collaborate.</p>
]]></content:encoded>
			<wfw:commentRss>http://mettadore.com/ruby/populating-city-state-names-in-a-rails-app/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby Gems and Snow Leopard</title>
		<link>http://mettadore.com/ruby/ruby-gems-and-snow-leopard/</link>
		<comments>http://mettadore.com/ruby/ruby-gems-and-snow-leopard/#comments</comments>
		<pubDate>Mon, 01 Feb 2010 19:29:42 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[gems]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://mettadore.com/?p=145</guid>
		<description><![CDATA[I&#8217;ve been getting really grumpy lately because strange things keep happening when I try to build Ruby apps&#8211; specifically on Rails. It turns out that some of my problems weren&#8217;t due to my horrible lack of competence, but instead to the fact that the Ruby installation on Snow Leopard (installed from Xtools) had some weird [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been getting really grumpy lately because strange things keep happening when I try to build Ruby apps&#8211; specifically on Rails. It turns out that some of my problems weren&#8217;t due to my horrible lack of competence, but instead to the fact that the Ruby installation on Snow Leopard (installed from Xtools) had some weird things going on with regards to Gems. I thought I&#8217;d throw it up here because I tend to have problems more than once, and my blogs are as much a <a href="http://harrypotter.wikia.com/wiki/Pensieve">pensieve</a> as they are anything.</p>
<p>So, the default installation of Ruby on Snow Leopard holds a set of default gems in</p>
<pre class="brush: bash; title: ; notranslate">

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
</pre>
<p>That&#8217;s nice, because the system comes set up for basically instant development. However, those gems are out of date, and I kept having problems installing newer versions and get gem collisions. The main source of the problem was that I couldn&#8217;t simply &#8220;<span style="font-family: terminal,monaco">gem uninstall [old-version]</span>&#8221; because the versions in the default directory stuck around. Similarly &#8220;<span style="font-family: terminal,monaco">gem clean</span>&#8221; wouldn&#8217;t really vacuum anything up.</p>
<p>My solution was simply to remove them.</p>
<pre class="brush: bash; title: ; notranslate">

sudo mv /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8.default

sudo mkdir /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
</pre>
<p>After this, I also removed all the user gems in /Library/Ruby/Gems/1.8, just to make sure nothing was around and cleaned things up until &#8220;<span style="font-family: terminal,monaco">gem list</span>&#8221; showed nothing. After that, I reinstalled all the gems I needed and ran &#8220;<span style="font-family: terminal,monaco">gem update &#8211;system</span>&#8221;</p>
<p>Now there won&#8217;t be any clash with the default gems that were installed with Snow Leopard, and I can still get to them if, for some strange reason, I need them.</p>
]]></content:encoded>
			<wfw:commentRss>http://mettadore.com/ruby/ruby-gems-and-snow-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails, Authlogic, and strange errors like &#8220;user_url&#8221;</title>
		<link>http://mettadore.com/ruby/rails-authlogic-and-strange-errors-like-user_url/</link>
		<comments>http://mettadore.com/ruby/rails-authlogic-and-strange-errors-like-user_url/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 06:52:15 +0000</pubDate>
		<dc:creator>john</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[authlogic]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[user_url]]></category>

		<guid isPermaLink="false">http://mettadore.com/?p=67</guid>
		<description><![CDATA[Alright, this may be obvious to you real rubologists, but I&#8217;ve only been programming in Ruby for about a week, and Rails is still a framework where I have to rebuild my projects frequently because I bork them so bad. My hope is that there&#8217;s someone else who&#8217;s as clueless as me. If that person [...]]]></description>
			<content:encoded><![CDATA[<p>Alright, this may be obvious to you real rubologists, but I&#8217;ve only been programming in Ruby for about a week, and Rails is still a framework where I have to rebuild my projects frequently because I bork them so bad.</p>
<p>My hope is that there&#8217;s someone else who&#8217;s as clueless as me. If that person is out there, and happens to get strange errors with Rails, maybe using Authlogic, maybe this will help.</p>
<h3>ActionController::RoutingError in   Users#show</h3>
<p>Alright, so you&#8217;re building a Rails app, and you have no damn clue what the hell you&#8217;re doing, and you <em>still</em> decided to get all complicated and have completely useless and meaningless things like &#8220;users&#8221; and &#8220;sessions&#8221; and &#8220;logins.&#8221;</p>
<p>Well, it&#8217;s your own damn fault when you get some strange error like<sup><a href="http://mettadore.com/ruby/rails-authlogic-and-strange-errors-like-user_url/#footnote_0_67" id="identifier_0_67" class="footnote-link footnote-identifier-link" title="a full traceback is here, for you meatheads who actually get such an error">1</a></sup></p>
<pre class="brush: bash; title: ; notranslate">
user_url failed to generate from {:action=&gt;&quot;show&quot;, :controller=&gt;&quot;users&quot;}
</pre>
<p>especially when you <strong><em>know damn well that the frackin&#8217; controller is there and the show method works because you just used it 2 minutes ago and everything worked just find thank you very much</em></strong>!!!</p>
<p>Look, I told you it&#8217;s your own damn fault for getting complicated.</p>
<h3>Sessions are like cactuses, they&#8217;re pointy and hurt, but pretty in Ansel Adams pictures</h3>
<p>Yes, by the way, I know that the plural is technically cacti, but I&#8217;m going for comedic effect.</p>
<p>So, the deal is, the authentication token hangs around, and you&#8217;ve probably done something stupid like</p>
<pre class="brush: ruby; title: ; notranslate">
rake db:drop &amp;&amp; rake db:create &amp;&amp; rake db:migrate &amp;&amp; rake db:seed
</pre>
<p>just so that you could test some random thing that you don&#8217;t understand. Well, if you do that, and you&#8217;re using authlogic, and you don&#8217;t bother to logout before hand, your session token will remain live in the browser cache and then you will be totally screwed when you suddenly refresh your browser and get strange incomprehensible errors on a webapp that <em><strong>was working fine just thirty $*#(@*! seconds ago</strong></em>!!!</p>
<p>So, kill the server, flush the browser cache, and <em>then</em> do your crazy &#8220;let&#8217;s delete the entire damn database and fill it with the exact same information that it had in the first place because it makes us feel better&#8221; routine.<sup><a href="http://mettadore.com/ruby/rails-authlogic-and-strange-errors-like-user_url/#footnote_1_67" id="identifier_1_67" class="footnote-link footnote-identifier-link" title="By the way, I know this only because I have an incredibly deep understanding of the subtleties of this language, not because I&amp;#8217;d be stupid enough to spend the last few hours fighting with something that&amp;#8217;s so blatantly simple&hellip; just so you know.">2</a></sup></p>
<p>Because, as it turns out, it&#8217;s not the exact same information.</p>
<p>Sessions are a bitch.</p>
<ol class="footnotes"><li id="footnote_0_67" class="footnote">a full traceback is <a href="http://sqrl.it/?nfjoo">here</a>, for you meatheads who actually <em>get</em> such an error</li><li id="footnote_1_67" class="footnote">By the way, I know this only because I have an incredibly deep understanding of the subtleties of this language, not because I&#8217;d be stupid enough to spend the last few hours fighting with something that&#8217;s so blatantly simple… just so you know.</li></ol>]]></content:encoded>
			<wfw:commentRss>http://mettadore.com/ruby/rails-authlogic-and-strange-errors-like-user_url/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

