<?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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Code Coverage</title>
	<atom:link href="http://kylecrum.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://kylecrum.wordpress.com</link>
	<description>My Opinions about Software and Ruby on Rails</description>
	<lastBuildDate>Sun, 19 Jul 2009 02:50:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='kylecrum.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Code Coverage</title>
		<link>http://kylecrum.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://kylecrum.wordpress.com/osd.xml" title="Code Coverage" />
	<atom:link rel='hub' href='http://kylecrum.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Mock Cookies in Rails Tests the Easy Way</title>
		<link>http://kylecrum.wordpress.com/2009/07/19/mock-cookies-in-rails-tests-the-easy-way/</link>
		<comments>http://kylecrum.wordpress.com/2009/07/19/mock-cookies-in-rails-tests-the-easy-way/#comments</comments>
		<pubDate>Sun, 19 Jul 2009 02:30:16 +0000</pubDate>
		<dc:creator>kylecrum</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[cookies]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://kylecrum.wordpress.com/?p=71</guid>
		<description><![CDATA[I got really tired of mocking out cookies every single time I made a reference to cookies in my test. It looked like a bunch of spaghetti code that made me mock out every single cookie call that I could imagine. Don&#8217;t get me wrong, I think mocks are wonderful, but when you have to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=71&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I got really tired of mocking out cookies every single time I made a reference to cookies in my test.  It looked like a bunch of spaghetti code that made me mock out every single cookie call that I could imagine.  Don&#8217;t get me wrong, I think mocks are wonderful, but when you have to mock out every single call, I don&#8217;t think the pain is worth the gain.  I found it much easier to mock cookies like this as like this, which gives a pretty good approximation of rails cookies.  It won&#8217;t work for 100% of cookie testing cases, but for 99.9%, it works like a charm.</p>
<p>I use rspec to test, but you could easily port the Cookie class to any testing framework that you want.</p>
<p><pre class="brush: ruby;">
def stub_cookies
  stub!(:cookies).and_return(MockCookie.new)
end

class MockCookie &lt; Hash

  def [](name)
    super(name.to_s)
  end
 
  def []=(key, options)
    if options.is_a?(Hash)
      options.symbolize_keys!
    else
      options = { :value =&gt; options }
    end
    super(key.to_s, options[:value])
   end

  def delete(key,opts)
    super(key)
  end

end
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kylecrum.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kylecrum.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kylecrum.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kylecrum.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kylecrum.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kylecrum.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kylecrum.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kylecrum.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kylecrum.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kylecrum.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kylecrum.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kylecrum.wordpress.com/71/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kylecrum.wordpress.com/71/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kylecrum.wordpress.com/71/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=71&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kylecrum.wordpress.com/2009/07/19/mock-cookies-in-rails-tests-the-easy-way/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a92441beed3f23be474eaa35c9e8830d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kylecrum</media:title>
		</media:content>
	</item>
		<item>
		<title>DRY Views in Rails with Blocks</title>
		<link>http://kylecrum.wordpress.com/2009/07/08/dry-views-in-rails-with-blocks/</link>
		<comments>http://kylecrum.wordpress.com/2009/07/08/dry-views-in-rails-with-blocks/#comments</comments>
		<pubDate>Wed, 08 Jul 2009 07:11:08 +0000</pubDate>
		<dc:creator>kylecrum</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[DRY]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://kylecrum.wordpress.com/?p=65</guid>
		<description><![CDATA[I&#8217;m a fan of the DRY (Don&#8217;t Repeat Yourself) principal. I think that computers were invented for a reason and that reason was not so that I could do the same thing over and over. If it&#8217;s one thing that computers do well, it&#8217;s doing the exact same thing ad nauseum. So, I do as [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=65&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a fan of the DRY (Don&#8217;t Repeat Yourself) principal.  I think that computers were invented for a reason and that reason was not so that I could do the same thing over and over.  If it&#8217;s one thing that computers do well, it&#8217;s doing the <em>exact</em> same thing ad nauseum.  So, I do as much as I can in order not to repeat myself a lot when coding.</p>
<p>I have an case now where within the main portion where content is rendered sometimes there separate content on the right side, and sometimes there is not.  For example, with no content on the right side, it looks like so:</p>
<p><pre class="brush: xml;">
  &lt;div id=&quot;left&quot;&gt;
    I am left content
  &lt;/div&gt;
</pre>  </p>
<p>Simple enough, but when there is content on the right side, the left side has to get a little smaller, so there is a class added called &#8220;with_left&#8221; to the left div that makes the width less to accommodate the right content.</p>
<p><pre class="brush: xml;">
  &lt;div id=&quot;right&quot;&gt;
    I am right content
  &lt;/div&gt;
  &lt;div id=&quot;left&quot; class=&quot;with_right&quot;&gt;
    I am left content
  &lt;/div&gt;
</pre> </p>
<p>The problem comes in when the right content is different from page to page and I&#8217;m not exactly sure if there is going to be any right content to begin with, as it relies on some dynamic data.  Sure, I could do something like this for every page, but I would get annoying fast, and I&#8217;m sure there would be one instance where I would forget to do it the right way:</p>
<p><pre class="brush: xml;">
  &lt;% if right_content %&gt;
    &lt;div id=&quot;right&quot;&gt;
      &lt;%= right_content %&gt;
    &lt;/div&gt;
  &lt;% end %&gt;
  &lt;div id=&quot;left&quot; &lt;%= 'class=&quot;with_right&quot;' if right_content -%&gt;&gt;
    I am left content
  &lt;/div&gt;
</pre> </p>
<p>So, in comes Ruby to the rescue.  I heart blocks and I&#8217;m glad that ruby has them, because this is a great case where they come in handy.  Instead of doing the above logic over and over again, I can create a method called main_content that allows me to do this in a more generic way.</p>
<p><pre class="brush: ruby;">
  def main_content(params={},&amp;amp;block)
    right_content = params[:right_content]
    unless right_content.blank?
      right_div = &lt;&lt;-HTML
        &lt;div id=&quot;right&quot;&gt;
          #{right_content}
        &lt;/div&gt;
      HTML
      concat(right_div)
      concat('&lt;div id=&quot;left&quot; class=&quot;with_right&quot;&gt;')
    else
      concat('&lt;div id=&quot;left&quot;&gt;')
    end
    yield
    concat('&lt;/div&gt;')
  end
</pre></p>
<p>Now I can use this method like so:</p>
<p><pre class="brush: ruby;">

  &lt;% main_content(:right_content=&gt;render(:partial=&gt;'account_actions')) do %&gt;
    &lt;h3&gt;Edit Account&lt;/h3&gt;
  &lt;% end &gt;%
</pre></p>
<p>If the partial account_actions renders anything, I will get this:</p>
<p><pre class="brush: xml;">
  &lt;div id=&quot;right&quot;&gt;
    Output of account_actions partial
  &lt;/div&gt;
  &lt;div id=&quot;left&quot; class=&quot;with_right&quot;&gt;
    &lt;h3&gt;Edit Account&lt;/h3&gt;
  &lt;/div&gt;
</pre> </p>
<p>If the account_actions partial doesn&#8217;t end up rendering anything, then I get:</p>
<p><pre class="brush: xml;">
  &lt;div&gt;
    &lt;h3&gt;Edit Account&lt;/h3&gt;
  &lt;/div&gt;
</pre> </p>
<p>Nice!  Everything looks good, so I can start adding some tests to it.  Here&#8217;s how I tested it with rspec:</p>
<p><pre class="brush: ruby;">
  describe 'main content renderer' do
    
    before do
      @buffer = &quot;&quot;
      stub!(:output_buffer).and_return(@buffer)
    end
    
    it 'will render only the left div when there is no right content' do
      main_content{}
      output_buffer.should have_tag(&quot;div#left&quot;)
    end
    
    it 'will put the yielded content in the left div' do
      main_content{concat(&quot;Yielded content&quot;)}
      output_buffer.should have_tag(&quot;div#left&quot;,&quot;Yielded content&quot;)
    end
    
    it 'will display the right content in the right div if there is any' do
      main_content(:right_content=&amp;gt;'Right'){}
      output_buffer.should have_tag(&quot;div#right&quot;,&quot;Right&quot;)
    end
    
    it 'will add a class of &quot;with_right&quot; to the left div if there is right content' do
      main_content(:right_content=&amp;gt;'Right'){}
      output_buffer.should have_tag(&quot;div#left.with_right&quot;)
    end
    
  end
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kylecrum.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kylecrum.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kylecrum.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kylecrum.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kylecrum.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kylecrum.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kylecrum.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kylecrum.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kylecrum.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kylecrum.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kylecrum.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kylecrum.wordpress.com/65/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kylecrum.wordpress.com/65/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kylecrum.wordpress.com/65/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=65&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kylecrum.wordpress.com/2009/07/08/dry-views-in-rails-with-blocks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a92441beed3f23be474eaa35c9e8830d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kylecrum</media:title>
		</media:content>
	</item>
		<item>
		<title>Twitter as a non-profit?</title>
		<link>http://kylecrum.wordpress.com/2009/07/07/twitter-as-a-non-profit/</link>
		<comments>http://kylecrum.wordpress.com/2009/07/07/twitter-as-a-non-profit/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 13:07:51 +0000</pubDate>
		<dc:creator>kylecrum</dc:creator>
				<category><![CDATA[Opinion]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://kylecrum.wordpress.com/?p=60</guid>
		<description><![CDATA[Let me first say that I don&#8217;t use Twitter. I see why people like it and I see why it is popular. I&#8217;m not one of those curmudgeons who bemoans its use, I just have enough things to keep up with. Someday, I&#8217;ll hope on the proverbial bandwagon. Even though I don&#8217;t use it, it&#8217;s [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=60&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Let me first say that I don&#8217;t use Twitter.  I see why people like it and I see why it is popular.  I&#8217;m not one of those curmudgeons who bemoans its use, I just have enough things to keep up with.  Someday, I&#8217;ll hope on the proverbial bandwagon.</p>
<p>Even though I don&#8217;t use it, it&#8217;s hard to do much anymore without hearing about it.  Whenever there is a news event now, it seems like people are tweeting about it or the source came from a tweet (ala <a href="http://searchengineland.com/stephen-colbert-does-send-up-of-twitter-jeff-goldblum-death-rumor-21773">Jeff Goldblum&#8217;s non-death</a>).</p>
<p>So, yes, Twitter is popular.  And everyone has been speculating on how Twitter is going to make money, because as of now, they are surviving on VC dollars and the hope of making money down the road.  A <a href="http://www.google.com/search?q=twitter+revenue+model">quick search on google</a> will give you an idea as to how people have tried to make their own revenue model for Twitter.</p>
<p>Most of these models rely on some sort of ad delivery system, which is a pretty standard way to make dough.  However, given the large number of people who use Twitter indirectly via the API, most ads within the page will not be seen by the users.  That leaves you with putting ads in the tweets themselves, which will probably do nothing but make users feel as if their privacy has been invaded by a door-to-door salesman who just happened to show up in their Twitter feed.</p>
<p>So, I say let&#8217;s make Twitter a non-profit, much in the way that Wikipedia works.  Just like Wikipedia, Twitter has totally user generated content.  Also, they are both excellent data sources in their own way.  Wikipedia for more historical data, Twitter for more transient and current opinions. </p>
<p>I think with a large passionate user base like Twitter, raising funds to keep it going would not be too hard.  I also think it would allow them to keep developing a platform that is good for the community at large instead of business stakeholders who want a return on their money.  Twitter is a good platform and I&#8217;d hate to see them go down because of a lack of monetary plan or, even worse, because it alienates its users by pumping in ads where they are not wanted.</p>
<p>Let&#8217;s get those dollar signs out of your eyes and do something reasonable.  So, Twitter Foundation, anyone?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kylecrum.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kylecrum.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kylecrum.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kylecrum.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kylecrum.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kylecrum.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kylecrum.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kylecrum.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kylecrum.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kylecrum.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kylecrum.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kylecrum.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kylecrum.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kylecrum.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=60&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kylecrum.wordpress.com/2009/07/07/twitter-as-a-non-profit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a92441beed3f23be474eaa35c9e8830d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kylecrum</media:title>
		</media:content>
	</item>
		<item>
		<title>Super Easy Tabs in Rails</title>
		<link>http://kylecrum.wordpress.com/2009/06/17/super-easy-tabs-in-rails/</link>
		<comments>http://kylecrum.wordpress.com/2009/06/17/super-easy-tabs-in-rails/#comments</comments>
		<pubDate>Wed, 17 Jun 2009 04:34:53 +0000</pubDate>
		<dc:creator>kylecrum</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[tabs]]></category>

		<guid isPermaLink="false">http://kylecrum.wordpress.com/?p=51</guid>
		<description><![CDATA[All the cool kids these days seem to be doing navigation via tabs, and since I want to be cool, too, I figured I might as well do it to. Ya, sure, there are plenty of plugins out there that do this, but it always seems like these things have too much configuration and code [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=51&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>All the cool kids these days seem to be doing navigation via tabs, and since I want to be cool, too, I figured I might as well do it to.  Ya, sure, there are plenty of <a href="http://github.com/innetra/easy_navigation/tree/master" target="_blank">plugins</a> out there that do this, but it always seems like these things have too much configuration and code for its own good.</p>
<p>So, I went at it on my own and, really, if the tabs are simple, the solution is pretty simple.  My tabs are based on the controller name, which means the current tab maps to all the actions of a certain controller.  In other words, it&#8217;s kind of the way <a href="http://" target="_blank">Basecamp</a> does it.</p>
<p>First, let&#8217;s start with some code in the controller.  In my app, everything that uses tabs is inherited from a base controller called LoginProtectedController.  That&#8217;s where I put this code, but it would work just as well in the ApplicationController:</p>
<p><pre class="brush: ruby;">
  helper_method :current_tab

  def self.current_tab(tab_name)
    before_filter do |controller|
      controller.send(:current_tab=,tab_name)
    end
  end

  protected

  def current_tab=(tab_name)
    @current_tab = tab_name
  end

  def current_tab
    @current_tab || controller_name.titleize
  end
</pre></p>
<p>So, this is what I have in one of my controllers to mark that the tab is not the name of the controller, but called &#8216;Dashboard&#8217;</p>
<p><pre class="brush: ruby;">
  current_tab 'Dashboard'
</pre></p>
<p>Now for some helper code for displaying the tabs:</p>
<p><pre class="brush: ruby;">
  def tab_link(args={})
    html_options = {}
    html_options = {:class=&gt;'current'} if args[:tab] == current_tab
    link_to args[:tab], args[:path], html_options
  end
</pre></p>
<p>And here&#8217;s how you put it together in the view:</p>
<p><pre class="brush: xml;">
&lt;div id=&quot;navigation&quot;&gt;
  &lt;%= tab_link(&quot;Dashboard&quot;, :path=&gt;admin_path) %&gt;
  &lt;%= tab_link(&quot;Items&quot;, :path=&gt;admin_items_path) %&gt;
  &lt;%= tab_link(&quot;Users&quot;, :path=&gt;admin_users_path) %&gt;
  &lt;%= tab_link(&quot;Account&quot;, :path=&gt;edit_admin_account_path) %&gt;
&lt;/div&gt;
</pre></p>
<p>If you want to make it look all pretty, some CSS should spruce it up:</p>
<p><pre class="brush: css;">
#navigation {
  line-height: 100%;
  margin-left: 6px;
  float: left;
  font-size: 12px;
}

#navigation a {
  background-color: #CCCCCC;
  color: #000000;
  padding: 7px 15px;
  text-decoration: none;
  display: block;
  float: left;
  margin-left: 2px;
}

#navigation a:hover {
  background-color: #BBBBBB;
}

#navigation a.current, #navigation a.current:hover {
  background-color: #FFFFFF;
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kylecrum.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kylecrum.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kylecrum.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kylecrum.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kylecrum.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kylecrum.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kylecrum.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kylecrum.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kylecrum.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kylecrum.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kylecrum.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kylecrum.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kylecrum.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kylecrum.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=51&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kylecrum.wordpress.com/2009/06/17/super-easy-tabs-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a92441beed3f23be474eaa35c9e8830d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kylecrum</media:title>
		</media:content>
	</item>
		<item>
		<title>Proper DRM</title>
		<link>http://kylecrum.wordpress.com/2009/06/03/proper-drm/</link>
		<comments>http://kylecrum.wordpress.com/2009/06/03/proper-drm/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 04:18:38 +0000</pubDate>
		<dc:creator>kylecrum</dc:creator>
				<category><![CDATA[Opinion]]></category>
		<category><![CDATA[DRM]]></category>

		<guid isPermaLink="false">http://kylecrum.wordpress.com/?p=48</guid>
		<description><![CDATA[The wife and I are planning a summer vacation to the northern parts of Japan, so instead of buying the whole guidebook for Japan, which runs at 35 bucks, we decided to buy the one chapter that we will actually use. This is a new idea by Lonely Planet and I think a great one, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=48&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The wife and I are planning a summer vacation to the northern parts of Japan, so instead of buying the whole guidebook for Japan, which runs at 35 bucks, we decided to buy the one chapter that we will actually use.  This is a new idea by Lonely Planet and I think a great one, especially considering how much of the actual guide book people use when traveling.  So, we went to their website, chose the chapter, and downloaded the PDF we were looking for.  I almost assumed that there was some sort of DRM applied that would not let me print it or open it on another computer.  However, I was wrong in this case.  The text at the bottom of the PDF explains it all:</p>
<blockquote><p>To make it easier for you to use, access to this chapter is not digitally restricted. In return, we think it’s fair to ask you to use it for personal, non-commercial purposes only. In other words, please don’t upload this chapter to a peer-to-peer site, mass email it to everyone you know, or resell it. See the terms and conditions on our site for a longer way of saying the above &#8211; ‘Do the right thing with our content.’</p></blockquote>
<p>To which I say, good for them.  There are too many instances of companies being super guarded with their content that they attach some sort of restrictions to what one can do with the content.  And the reality is, if someone really wants to do something, they probably will.  There are ways to get around just about any DRM protected file if you want and by locking it down, you are basically insulting your customers and telling them &#8220;I don&#8217;t trust you&#8221;.</p>
<p>Instead of not trusting their users, they&#8217;ve basically said &#8220;Listen, we know you can take this and give it to anyone you want.  But, we trust that you won&#8217;t do that.  Thanks!&#8221;  And you know what?  I won&#8217;t.  I&#8217;ll keep it to myself and use it as if it were a real book.</p>
<p>I think it&#8217;s something to think about for all the software out there that has ridiculous pricing models based on the number of CPUs or users, etc or music download sites that restrict how the music you downloaded can be shared.    Make it easy for the customer and the customer will reward the company with loyalty and more revenue.  Bog the customer down with restrictions and force him to spend more money upfront will lose future loyalty.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kylecrum.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kylecrum.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kylecrum.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kylecrum.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kylecrum.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kylecrum.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kylecrum.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kylecrum.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kylecrum.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kylecrum.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kylecrum.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kylecrum.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kylecrum.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kylecrum.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=48&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kylecrum.wordpress.com/2009/06/03/proper-drm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a92441beed3f23be474eaa35c9e8830d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kylecrum</media:title>
		</media:content>
	</item>
		<item>
		<title>How Not to Code With Javascript</title>
		<link>http://kylecrum.wordpress.com/2009/05/28/how-not-to-code-with-javascript/</link>
		<comments>http://kylecrum.wordpress.com/2009/05/28/how-not-to-code-with-javascript/#comments</comments>
		<pubDate>Thu, 28 May 2009 13:45:02 +0000</pubDate>
		<dc:creator>kylecrum</dc:creator>
				<category><![CDATA[Opinion]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://kylecrum.wordpress.com/?p=34</guid>
		<description><![CDATA[I&#8217;ve had quite a frustrating day today trying to get my internet hooked up here in Korea.  To finalize the connection here, you must register your computer with the company via their website.  Or, at least, that&#8217;s what I&#8217;m assuming as the site is in Korean and the guy installing the internet didn&#8217;t speak much [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=34&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had quite a frustrating day today trying to get my internet hooked up here in Korea.  To finalize the connection here, you must register your computer with the company via their website.  Or, at least, that&#8217;s what I&#8217;m assuming as the site is in Korean and the guy installing the internet didn&#8217;t speak much English.</p>
<p>Anyway, the registration site wasn&#8217;t working because when the installer dude was clicking on the menu tabs, nothing was happening.  I pulled the same site up in Safari and FF3, but still, it didn&#8217;t work.  Being ultra annoyed at this point, I opened Firebug and started going through the code.  Here&#8217;s what the menu tab link looked like:</p>
<p><pre class="brush: xml;">
    &lt;a href=&quot;javascript:goMenu(1)&quot;&lt;/a&gt;
</pre></p>
<p>And the offending javascript:</p>
<p><pre class="brush: jscript;">
    function goMenu(menu)  {
        
        if(menu == 1)
            location.href = &quot;/sw5/order/wm/wm_install.jsp&quot;;
        else if(menu == 2)
            location.href = &quot;/sw5/order/wm/wm_repair.jsp&quot;;
        else if(menu == 3)
            location.href = &quot;/sw5/order/board/board/supportBoardList.jsp&quot;;
        else if(menu == 4)
            location.href = &quot;/sw5/order/board/bbsDown/supportFileList.jsp&quot;;
        else if(menu == 5)
            location.href = &quot;/sw5/order/board/bbsError/supportErrorList.jsp&quot;;
        }
</pre></p>
<p>Technically, there&#8217;s nothing wrong with the javascript.  It should work fine, but since there were some errors in some of the other javascript, the whole javascript file didn&#8217;t parse correctly, therefore, this particular function didn&#8217;t make its way to the javascript interpreter in the browser (unless your browser was IE7 for some reason).</p>
<p>The bigger question of course is why would you ever program like this?  Does the person who wrote this have no idea what an anchor tag does?  Why would he/she not choose to just put the URL into the href of the anchor tag?  I mean, this is pretty fundamental here.  If you ask anyone who&#8217;s even attempted to make a website for more than a day, I&#8217;m sure they could tell you how to make an anchor tag.  On top of that, a it would be better to at least explicitly use the window object and call window.location.href.  But I guess, if you don&#8217;t know how an anchor tag works, why bother with doing javascript correctly.</p>
<p>So, curious as to what else the programmers of this site could possibly do, I saw two methods defined that looked kind of funny that are probably the reason the javascript file wasn&#8217;t interpreted correctly.</p>
<p><pre class="brush: jscript;">
    function document.oncontextmenu() {....}
    function window.onload() {....}
</pre></p>
<p>So, the programmer isn&#8217;t trying to call the document.oncontextmenu or window.onload functions, the programmer is trying to <em>define</em> these functions.  I can&#8217;t really fathom why you would ever, ever want to do this.  Of course, most normal javascript parsers think that you are calling the function window.onload instead of defining a method called &#8216;window.onload()&#8217;, so the javascript bombs out.  I guess the IE parser is a little more lenient and probably silently ignores it.  But again, it just baffles my why anyone would write this and that code like this made it to the registration site of one of the largest internet providers in Korea, which happens to be the most wired country in the world.</p>
<p>How are we teaching people to make websites these days, anyway?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kylecrum.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kylecrum.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kylecrum.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kylecrum.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kylecrum.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kylecrum.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kylecrum.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kylecrum.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kylecrum.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kylecrum.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kylecrum.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kylecrum.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kylecrum.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kylecrum.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=34&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kylecrum.wordpress.com/2009/05/28/how-not-to-code-with-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a92441beed3f23be474eaa35c9e8830d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kylecrum</media:title>
		</media:content>
	</item>
		<item>
		<title>It&#8217;s a Poor Craftsman Who Blames His Tools</title>
		<link>http://kylecrum.wordpress.com/2009/05/27/its-a-poor-craftsman-who-blames-his-tools/</link>
		<comments>http://kylecrum.wordpress.com/2009/05/27/its-a-poor-craftsman-who-blames-his-tools/#comments</comments>
		<pubDate>Wed, 27 May 2009 01:02:32 +0000</pubDate>
		<dc:creator>kylecrum</dc:creator>
				<category><![CDATA[Opinion]]></category>

		<guid isPermaLink="false">http://kylecrum.wordpress.com/?p=26</guid>
		<description><![CDATA[I don&#8217;t understand a lot of the arguments that pit one framework or language against another.  Ok, I understand them in the technical sence, but I don&#8217;t understand why people seem to like to argue about them a lot.  Given the proliferation of blogs about how language X or framework Y is way better than [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=26&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t understand a lot of the arguments that pit one framework or language against another.  Ok, I understand them in the technical sence, but I don&#8217;t understand why people seem to like to argue about them a lot.  Given the proliferation of blogs about how language X or framework Y is way better than some other &#8220;competing&#8221; language/framework, either the writers are just using cheap ploys to get people to read their blog or there are more people out there like the Comic Book Guy from the Simpsons than I think.</p>
<p style="text-align:left;">
<div class="wp-caption aligncenter" style="width: 299px"><img title="Comic Book Guy" src="http://www.squishedfrog.com/images/comicbookguy.gif" alt="Worst.  Framework.  Ever." width="289" height="229" /><p class="wp-caption-text">Worst.  Framework.  Ever.</p></div>
<p style="text-align:left;">Case in point is this post: <a href="http://java.sys-con.com/node/965189" target="_blank">Java Kicks Ruby on Rails in the Butt</a>.  Not only is the article riddled with assumptions, it compares a framework (Ruby on Rails) with a language (Java).  Talk about an apples-to-oranges comparison.  Basically, it creates an application in Rails with the scaffolding and says &#8220;look, it&#8217;s not very cool looking&#8221;, then uses some Java open source tools to build the same application.  Clearly, the screen is prettier, so the Java one is much cooler and easier.  There&#8217;s no mention that, yes, you can actually have both and run Ruby on Rails in JRuby in your JVM, but let&#8217;s not mention that.</p>
<p style="text-align:left;">Another misguided post can be found here: <a href="http://blogs.law.harvard.edu/philg/2009/05/18/ruby-on-rails-and-the-importance-of-being-stupid/" target="_blank">Ruby on Rails and the Importance of Being Stupid</a>.  For the lazy, like me, let me summarize this one for you: site A was written in ASP.NET and runs super well but site B was written in Ruby on Rails and takes 5 minutes to load a page.  Despite the fact that site A and site B are completely different sites written by different people for different reasons, the author feels compelled to go ahead and compare the 2 anyway.  He is actually kind enough to to mention all of the design flaws with the RoR site, most of them having to do with a so-called &#8220;MIT Genius&#8221; who over-engineered a solution and who apparently doesn&#8217;t have the first incling of how RoR&#8217;s ActiveRecord works.  Overall, he seems to be making the point that this one &#8220;MIT Genius&#8221; fellow made a bad site with RoR and he is stupid, therefore Ruby and RoR is stupid.  He comes off as a bit of a curmudgeon, pissing on anything new, instead of just admitting that the &#8220;MIT Genius&#8221; guy made some mistakes.  Was it RoR or Ruby&#8217;s fault?  No, it was a case of someone who didn&#8217;t know how to use his tools well.</p>
<p style="text-align:left;">Which brings me to the point.  There is nothing inherantly wrong with Ruby, Java, PHP, Lisp, ASP.NET, or any other framework/language that you can think of.  They are all just a tool to get the job done.  If you use that tool like an idiot, then, well, who&#8217;s to blame: you or the tool?  There&#8217;s an old proverb that says:</p>
<blockquote>
<p style="text-align:left;">It&#8217;s a poor craftsman who blames his tools.</p>
</blockquote>
<p style="text-align:left;">Which is exactly the problem.  Listen, if your given a hammer and you use the handle end to try to put a nail into a piece of wood, it&#8217;s not the hammer&#8217;s fault.  It&#8217;s your fault.  You. I&#8217;ve seen whole houses in Central America being made with just machetes.  Seriously, people will use them to hammer, cut, turn screws, and just about anything else you can think of.  They have one tool, they know it well and they build pretty sturdy homesteads with this simple instrument.</p>
<p style="text-align:center;">
<div class="wp-caption aligncenter" style="width: 310px"><img title="Machete" src="http://www.gowanuslounge.com/wp-content/uploads/2008/07/machete.jpg" alt="Machete: More uses than a Swiss Army Knife" width="300" height="279" /><p class="wp-caption-text">Machete: More uses than a Swiss Army Knife</p></div>
<p style="text-align:left;">You can make a perfectly good website using Perl and SSI for all I care.  It gets the job done.  Or you can even go further and create static HTML files and FTP them to a web server.  Whatever suits you.  All the end user cares is that it works.</p>
<p style="text-align:left;">Personally, I like Ruby and Ruby on Rails.  It makes me happy to develop with it.  If you like something else, go ahead and use it, no sweat off my back.  Just quit complaining about the tools I use and learn how to use yours properly.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kylecrum.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kylecrum.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kylecrum.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kylecrum.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kylecrum.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kylecrum.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kylecrum.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kylecrum.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kylecrum.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kylecrum.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kylecrum.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kylecrum.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kylecrum.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kylecrum.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=26&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kylecrum.wordpress.com/2009/05/27/its-a-poor-craftsman-who-blames-his-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a92441beed3f23be474eaa35c9e8830d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kylecrum</media:title>
		</media:content>

		<media:content url="http://www.squishedfrog.com/images/comicbookguy.gif" medium="image">
			<media:title type="html">Comic Book Guy</media:title>
		</media:content>

		<media:content url="http://www.gowanuslounge.com/wp-content/uploads/2008/07/machete.jpg" medium="image">
			<media:title type="html">Machete</media:title>
		</media:content>
	</item>
		<item>
		<title>Time for Rails to Grow Up</title>
		<link>http://kylecrum.wordpress.com/2009/04/30/time-for-rails-to-grow-up/</link>
		<comments>http://kylecrum.wordpress.com/2009/04/30/time-for-rails-to-grow-up/#comments</comments>
		<pubDate>Thu, 30 Apr 2009 00:56:34 +0000</pubDate>
		<dc:creator>kylecrum</dc:creator>
				<category><![CDATA[Opinion]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://kylecrum.wordpress.com/?p=20</guid>
		<description><![CDATA[So, I&#8217;ve been particularly absent in my internet time as I&#8217;ve moved from Argentina, then the States, then Korea all in the past 3 months. In other words, it&#8217;s been a bit hectic lately. And what do I see when I come back? It&#8217;s an argument over a presentation that someone did at the Golden [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=20&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So, I&#8217;ve been particularly absent in my internet time as I&#8217;ve moved from <a href="http://www.onourownpath.com/country/argentina">Argentina</a>, then the States, then <a href="http://www.onourownpath.com/country/korea-republic-of">Korea</a> all in the past 3 months.  In other words, it&#8217;s been a bit hectic lately.</p>
<p>And what do I see when I come back?  It&#8217;s an argument over a presentation that someone did at the Golden Gate Ruby Conference called &#8220;CouchDB: Perform like a pr0n star&#8221;.  You can see the slides at the end of <a href="http://www.ultrasaurus.com/sarahblog/2009/04/gender-and-sex-at-gogaruco/">this blog</a>.  There has been much debate on it, as seen <a href="http://www.rubyrailways.com/rails-is-still-a-ghetto/">here</a>, <a href="http://www.quirkey.com/blog/2009/04/27/the-ghetto-of-the-mind/">here</a>, and <a href="http://dyepot-teapot.com/2009/04/25/dear-fellow-rubyists/">here</a> (and probably at many other sites, too).  During the whole thing some people say &#8220;so what&#8221; while others say it&#8217;s a disgrace while DHH and many of the core developers as I understand it have actually embraced it, theorizing that edgy is good.  This actually casued one of the ruby activists, <span class="entry-author-name">Mike Gunderloy, <a href="http://afreshcup.com/2009/04/28/a-painful-decision/">to quit spending his time as a Rails Activist</a>.</span></p>
<p><span class="entry-author-name">Great.  Listen, it&#8217;s one thing for there to be one member of the community to make a mistake and do an inappropriate speech.  That happens.  Especially when there is a large rails community.  The thing that baffles me is that basically the &#8220;leaders&#8221; of Rails basically said, &#8220;ya, it&#8217;s ok to have inappropriate pictures in your presentations.&#8221; </span></p>
<p><span class="entry-author-name">There was really no need to say that.  Instead, they could have easily said &#8220;That presentation does not represent the Rails community as a whole.   The speaker should take full responsibility of his actions.&#8221;  Done.  That&#8217;s it.  You don&#8217;t have to say you like it or not, just simply say that it is an opinion of the author not of the community.  Instead, the debate is perpetuated because the leadership simply can&#8217;t simply keep their non-tech opinions to themselves.  I like that Rails has some opinions on how websites should be written, but as far as your personal opinions on the use of questionable images in presentations, the Rails leadership needs to step away.<br />
</span></p>
<p><span class="entry-author-name">Sure, you can say &#8220;Accept me or beat it&#8221; all you want and it won&#8217;t bother me.  But, this is about Rails and its perception to the outside world.  After personally going through struggles to convice management that Rails wasn&#8217;t just one of the &#8220;cool kid&#8221; toys and it was a real framework, I would hate for anything like this to cloud anyone&#8217;s opinion that Rails is a solid, professional, and reliable framework. </span></p>
<p><span class="entry-author-name">Unfortunately, I think instances like these give the wrong perception of Rails and the Rails community.  I don&#8217;t have any ire for the original presenter, or any of the pro/con arguers.  But, to the Rails leadership, leave your personal opinions out of it and focus on making sure that the Rails community is the best it can be.<br />
</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kylecrum.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kylecrum.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kylecrum.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kylecrum.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kylecrum.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kylecrum.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kylecrum.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kylecrum.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kylecrum.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kylecrum.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kylecrum.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kylecrum.wordpress.com/20/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kylecrum.wordpress.com/20/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kylecrum.wordpress.com/20/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=20&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kylecrum.wordpress.com/2009/04/30/time-for-rails-to-grow-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a92441beed3f23be474eaa35c9e8830d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kylecrum</media:title>
		</media:content>
	</item>
		<item>
		<title>Doing an Include on Class in Ruby Just Confuses the Hell Out of People</title>
		<link>http://kylecrum.wordpress.com/2009/02/13/doing-an-include-on-class-in-ruby-just-confuses-the-hell-out-of-people/</link>
		<comments>http://kylecrum.wordpress.com/2009/02/13/doing-an-include-on-class-in-ruby-just-confuses-the-hell-out-of-people/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 13:05:23 +0000</pubDate>
		<dc:creator>kylecrum</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://kylecrum.wordpress.com/?p=16</guid>
		<description><![CDATA[So, I was updating someone else&#8217;s project at github and noticed that the author did this: Ok, that&#8217;s fine. Looking at that you would think that the methods in ModuleName would be added as instance methods to class, which is true, but that doesn&#8217;t mean it does what you think it does. When doing the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=16&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So, I was updating someone else&#8217;s project at github and noticed that the author did this:</p>
<p><pre class="brush: ruby;">

module ModuleName

  def foo
    &quot;I am foo!&quot;
  end

end

Class.send :include ModuleName

</pre></p>
<p>Ok, that&#8217;s fine.  Looking at that you would think that the methods in ModuleName would be added as instance methods to class, which is true, but that doesn&#8217;t mean it does what you think it does.</p>
<p>When doing the above, the module methods end up being class methods on any class that you have.  What?  Yes.  It is because in Ruby, everything is an object.  Even classes.  So, when you have a class in Ruby, it is actually a singleton object.  When you create instances of classes, it again is an object, but it&#8217;s not a singleton and it&#8217;s not designated as a class.</p>
<p>So, when this code runs, you are adding methods to the singleton objects of every class, which look like class methods to any object that you create.</p>
<p><pre class="brush: ruby;">

class SomeClass

  def instance_foo
    &quot;I am instance foo!&quot;
  end

end

SomeClass.foo  // will return &quot;I am foo&quot;
SomeClass.new.instance_foo // will return &quot;I am instance_foo

</pre></p>
<p>Ok, so the Class.include thing is totally legal and fine, it&#8217;s just confusing and would be more clear if it was done like so.</p>
<p><pre class="brush: ruby;">

module ModuleName

  def self.included(base)
      base.extend(ClassMethods)
    end

  module ClassMethods
  
    def foo
      &quot;I am foo!&quot;
    end

  end

end

Object.send :include ModuleName

</pre></p>
<p>Sure, it&#8217;s a semantic difference, but it&#8217;s just a little easier to read and understand what&#8217;s going on.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kylecrum.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kylecrum.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kylecrum.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kylecrum.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kylecrum.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kylecrum.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kylecrum.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kylecrum.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kylecrum.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kylecrum.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kylecrum.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kylecrum.wordpress.com/16/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kylecrum.wordpress.com/16/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kylecrum.wordpress.com/16/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=16&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kylecrum.wordpress.com/2009/02/13/doing-an-include-on-class-in-ruby-just-confuses-the-hell-out-of-people/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a92441beed3f23be474eaa35c9e8830d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kylecrum</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting The MySQL Ruby Gem to Work With Mac: Hit the Reset Button</title>
		<link>http://kylecrum.wordpress.com/2009/02/03/getting-the-mysql-ruby-gem-to-work-with-mac-hit-the-reset-button/</link>
		<comments>http://kylecrum.wordpress.com/2009/02/03/getting-the-mysql-ruby-gem-to-work-with-mac-hit-the-reset-button/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 19:41:44 +0000</pubDate>
		<dc:creator>kylecrum</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[macports]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://kylecrum.wordpress.com/?p=11</guid>
		<description><![CDATA[.If you do a search right now on google for &#8220;mysql gem mac&#8221; you will find 999 blogs about the solution to this (numero 1000 being this one), but unfortunately, NONE of these worked for me.  Thanks a lot, Google!  I thought you were smart! Ok, ok, to be fair it kind of worked. The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=11&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>.If you do a search right now on google for &#8220;mysql gem mac&#8221; you will find 999 blogs about the solution to this (numero 1000 being this one), but unfortunately, NONE of these worked for me.  Thanks a lot, Google!  I thought you were smart!</p>
<p>Ok, ok, to be fair it kind of worked.  The gem would install, but then I would get this error message when trying to start Rails:</p>
<p>Failed to lookup Init function /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle</p>
<p>Right.  That&#8217;s when I decided to just hit the reset button and re-install MySQL.</p>
<p>Basically, I had MySQL5 running on Mac OSX 10.4.11 with ruby and rails and the works.  Then I took off for a <a href="http://www.onourownpath.com" target="_blank">one-year-long sabbatical,</a> came back, and now the world of Rails has changed a bit.  Most glaringly in the beginning is that the MySQL libraries are no longer included in Rails since 2.2.  This is probably a good thing as the MySQL libraries that were included were notoriously slow and it was always recommended to use the gem instead.  I didn&#8217;t on my local machine before because since I am the only one using it, I could care less about performance.  However, I&#8217;m sure there was someone out there (or many) who used the default MySQL libraries shipped with Rails in production or for some kind of performance test, complained about it, until finally the Rails core team decided to just rip it out.  Anyway, good for Rails, bad for me.</p>
<p>To make a long story short, I spent hours trying all the tips out there to get the MySQL gem installed, including modifying the make file which I haven&#8217;t done since some absurd class I took in college.  So, I did what any reasonable person would do: uninstall mysql and re-installing it with mac ports.  For some history, MySQL before was installled from the binary package that can be downloaded from their site.</p>
<p>In any case, if you want to do this on your computer and keep any data in your database, you should use the mysqladmin tool to dump it out into a file for re-import later on.  If not, your choice.</p>
<p><code>mysqldump -u root -p --all-databases &gt; mysql-dump.sql</code></p>
<p>Anyway, to uninstall MySQL, I did the following in a terminal window (props to <a href="http://akrabat.com/2008/09/11/uninstalling-mysql-on-mac-os-x-leopard/" target="_blank">this post</a>):</p>
<p><code>sudo rm /usr/local/mysql<br />
sudo rm -rf /usr/local/mysql*<br />
sudo rm -rf /Library/StartupItems/MySQLCOM<br />
sudo rm -rf /Library/PreferencePanes/My*<br />
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-<br />
sudo rm -rf /Library/Receipts/mysql*<br />
sudo rm -rf /Library/Receipts/MySQL<br />
</code></p>
<p>Then I used macports to install MySQL5:</p>
<p><code>sudo port install mysql5 +server</code></p>
<p>That should take a little while.  After it&#8217;s done, I created the initial MySQL databases. Notice that the command is mysql_install_db5 instead of mysql_install_db.  This is a macports thing.  All of the executables that I can tell have 5 appended to them (i.e. mysql5 instead of mysql).  This shouldn&#8217;t be too much of a problem if you can remember it.</p>
<p><code>sudo -u mysql mysql_install_db5</code></p>
<p>If you want to start up the server now, you can and check that it&#8217;s running.</p>
<p><code>sudo /opt/local/lib/mysql5/bin/mysqld_safe &amp;<br />
ps aux | grep mysql</code></p>
<p>Or, if you&#8217;re lazy, like me, you can also have it start up when the computer starts:</p>
<p><code>sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist</code></p>
<p>Another lazy move is to symlink the socket file to where all programs look for it.  I didn&#8217;t want to specify this every time, so I just symlinked it to where most apps look for it:</p>
<p><code>sudo ln -s /opt/local/var/run/mysql5/mysqld.sock /tmp/mysql.sock</code></p>
<p>And if you want to right now, go ahead and set a password for the root MySQL user.</p>
<p><code>mysqladmin5 -u root password [your_password]</code></p>
<p>If you backed up your data, now is a good time to restore it:</p>
<p><code>mysql5 -u root -p &lt; mysql-dump.sql</code></p>
<p>Finally, installing the gem is a breeze:</p>
<p><code>sudo gem install mysql -- --with-mysql-config=/opt/local/bin/mysql_config5</code></p>
<p>Done!  Woohoo!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kylecrum.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kylecrum.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kylecrum.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kylecrum.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kylecrum.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kylecrum.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kylecrum.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kylecrum.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kylecrum.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kylecrum.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kylecrum.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kylecrum.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kylecrum.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kylecrum.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kylecrum.wordpress.com&amp;blog=6435886&amp;post=11&amp;subd=kylecrum&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kylecrum.wordpress.com/2009/02/03/getting-the-mysql-ruby-gem-to-work-with-mac-hit-the-reset-button/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/a92441beed3f23be474eaa35c9e8830d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">kylecrum</media:title>
		</media:content>
	</item>
	</channel>
</rss>
