<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nobody Listens Anyway</title>
	<atom:link href="http://www.justinball.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.justinball.com</link>
	<description>Life is an optimization issue</description>
	<lastBuildDate>Mon, 01 Mar 2010 04:22:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9-rare</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Logitech Sucks Twice</title>
		<link>http://www.justinball.com/2010/02/28/logitech-sucks-twice/</link>
		<comments>http://www.justinball.com/2010/02/28/logitech-sucks-twice/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 04:22:11 +0000</pubDate>
		<dc:creator>Justin Ball</dc:creator>
				<category><![CDATA[Funny]]></category>
		<category><![CDATA[logitech]]></category>

		<guid isPermaLink="false">http://www.justinball.com/?p=1306</guid>
		<description><![CDATA[Last Christmas my wife bought me a Logitech Harmony remote.  Over the past few months I've noticed that it barely holds a charge and so if I don't leave it on the charger all the time it just dies.  Last night I went to use the remote and it burned my hand it [...]]]></description>
			<content:encoded><![CDATA[<p>Last Christmas my wife bought me a Logitech Harmony remote.  Over the past few months I've noticed that it barely holds a charge and so if I don't leave it on the charger all the time it just dies.  Last night I went to use the remote and it burned my hand it was so hot.  I figured I would check the battery and found that it had bulged out and deformed. I surfed around and found that a bunch of other people had the same problem. I called tech support. They told me that it was a problem and they I should safely dispose of the battery and buy a new one.  I told them I've had it for one year (it was two days out of warranty).  They told me tough luck.  I complained a lot and they finally relented and sent me a new battery.  However, now I'm scared to leave it on the charger.  I let it run most of the way down before charging it up again since most of the people on who wrote about the problem indicated that the remote will overcharge the battery causing it to get hot. If you have a Logitech remote check the battery occasionally in case the battery starts bulging. I think BestBuy can recycle them.</p>
<p> I also have an Logitech MX Revolution that I used to use. It was a good mouse until I changed my time machine backups to use a server instead of a USB Drive.  The change meant that the backups now happen over my Wifi connection.  Right after the change I noticed was that my mouse stopped working every time the backup kicked on.  The mouse uses the same 2.4Ghz spectrum as the 802.11 card and the flood of data from the backup would kill the mouse connection.  I called their tech support on this one too to see if there was a solution.  Their idea?  Get a different mouse and plug it in during the backup then plug the Logitech mouse back in.  (Every hour during the Time Machine backup).  I bought an Apple Magic mouse instead and then replaced my Logitech keyboard with one of the latest from Apple.</p>
<p>I'm done buying Logitech.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justinball.com/2010/02/28/logitech-sucks-twice/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Uses for banana</title>
		<link>http://www.justinball.com/2010/02/28/uses-for-banana/</link>
		<comments>http://www.justinball.com/2010/02/28/uses-for-banana/#comments</comments>
		<pubDate>Mon, 01 Mar 2010 03:20:01 +0000</pubDate>
		<dc:creator>Justin Ball</dc:creator>
				<category><![CDATA[Funny]]></category>
		<category><![CDATA[Devin]]></category>

		<guid isPermaLink="false">http://www.justinball.com/2010/02/28/uses-for-banana/</guid>
		<description><![CDATA[My two year old son has picked up an interesting habit of using 'banana' like the f-bomb.  "I hate that! Banana you!"  
]]></description>
			<content:encoded><![CDATA[<p>My two year old son has picked up an interesting habit of using 'banana' like the f-bomb.  "I hate that! Banana you!"  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.justinball.com/2010/02/28/uses-for-banana/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Theming Engine to Your Rails Application</title>
		<link>http://www.justinball.com/2010/01/23/add-theming-engine-to-your-rails-application/</link>
		<comments>http://www.justinball.com/2010/01/23/add-theming-engine-to-your-rails-application/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 21:21:37 +0000</pubDate>
		<dc:creator>Justin Ball</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[disguise]]></category>
		<category><![CDATA[templates]]></category>

		<guid isPermaLink="false">http://www.justinball.com/?p=1320</guid>
		<description><![CDATA[I've written about the disguise gem before, but I've made enough changes that it warrants a new blog post.  I noticed a few performance problems which have now been fixed and the configuration has been cleaned up a bit.
Disguise makes it simple to swap out the views used by your rails application either by [...]]]></description>
			<content:encoded><![CDATA[<p>I've written about the <a href="http://github.com/jbasdf/disguise">disguise gem</a> before, but I've made enough changes that it warrants a new blog post.  I noticed a few performance problems which have now been fixed and the configuration has been cleaned up a bit.</p>
<p>Disguise makes it simple to swap out the views used by your rails application either by selecting a theme using an admin UI or by changing out the theme based on the current url.  For most apps the feature is probably not relevant, but if you are building a piece of software like a blog or social network then letting your users customize the look of the site is crucial to adoption. </p>
<p>Find the install instructions on the <a href="http://github.com/jbasdf/disguise">project's github account</a>.</p>
<p>While setting a given theme works fine and doesn't incur much of a performance hit beyond method call, swapping out the theme based on the current domain can incur a performance hit since it reloads the localization strings.  Here's the bit of code that swaps the views:</p>
<pre class="ruby">&nbsp;
      <span style="color:#9966CC; font-weight:bold;">def</span> setup_theme
        <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#9966CC; font-weight:bold;">if</span> !<span style="color:#6666ff; font-weight:bold;">Disguise::Config</span>.<span style="color:#9900CC;">themes_enabled</span>
        <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#9966CC; font-weight:bold;">if</span> current_theme.<span style="color:#9900CC;">blank</span>? || current_theme.<span style="color:#9900CC;">name</span>.<span style="color:#9900CC;">blank</span>?
        theme_view_path = <span style="color:#CC00FF; font-weight:bold;">File</span>.<span style="color:#9900CC;">join</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#6666ff; font-weight:bold;">Disguise::Config</span>.<span style="color:#9900CC;">theme_full_base_path</span>, current_theme.<span style="color:#9900CC;">name</span>, <span style="color:#996600;">'views'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
        <span style="color:#9966CC; font-weight:bold;">if</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">view_paths</span>.<span style="color:#9900CC;">first</span> == theme_view_path
          <span style="color:#0000FF; font-weight:bold;">return</span>
        <span style="color:#9966CC; font-weight:bold;">else</span>
          <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#9966CC; font-weight:bold;">if</span> !theme_exists<span style="color:#006600; font-weight:bold;">&#40;</span>theme_view_path<span style="color:#006600; font-weight:bold;">&#41;</span>
          clean_theme_view_path
          <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">prepend_view_path</span><span style="color:#006600; font-weight:bold;">&#40;</span>theme_view_path<span style="color:#006600; font-weight:bold;">&#41;</span>
          clean_theme_locale
          set_theme_locale
          I18n.<span style="color:#9900CC;">reload</span>!
        <span style="color:#9966CC; font-weight:bold;">end</span>
      <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;</pre>
<p>I'm hoping to find a way to improve performance when changing themes, but for now be aware that changing themes based on domains is a work in progress and shouldn't be used in a production environment.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justinball.com/2010/01/23/add-theming-engine-to-your-rails-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>acts_as_taggable libraries and the big case problem.</title>
		<link>http://www.justinball.com/2010/01/21/acts_as_taggable-libraries-and-the-big-case-problem/</link>
		<comments>http://www.justinball.com/2010/01/21/acts_as_taggable-libraries-and-the-big-case-problem/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 21:54:33 +0000</pubDate>
		<dc:creator>Justin Ball</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[acts as taggable]]></category>
		<category><![CDATA[folksonomy]]></category>

		<guid isPermaLink="false">http://www.justinball.com/?p=1313</guid>
		<description><![CDATA[Over the years I've had a chance to use the three tagging libraries available for Ruby on Rails:

acts-as-taggable-on
acts_as_taggable_on_steroids
acts_as_taggable

I think the original acts as taggable is now defunct.  The other libraries are derivatives of that library.  In using tags on various sites the problem I always seem to run across is how to deal [...]]]></description>
			<content:encoded><![CDATA[<p>Over the years I've had a chance to use the three tagging libraries available for Ruby on Rails:</p>
<ul>
<li><a href="http://github.com/mbleigh/acts-as-taggable-on">acts-as-taggable-on</a></li>
<li><a href="http://github.com/jviney/acts_as_taggable_on_steroids">acts_as_taggable_on_steroids</a></li>
<li><a href="http://agilewebdevelopment.com/plugins/acts_as_taggable">acts_as_taggable</a></li>
</ul>
<p>I think the original acts as taggable is now defunct.  The other libraries are derivatives of that library.  In using tags on various sites the problem I always seem to run across is how to deal with tag case.  For example, to some blue is the same as Blue.  However, is god the same as God?  It depends on who you ask.  It seems that acts-as-taggable-on handles the case problem properly.  I noticed that if I add the tag 'blue' to an object I cannot add another tag called 'Blue'.  However, if I delete 'blue' and then add the tag 'Blue' it works as expected and the upper case tag becomes associated with the object.</p>
<p> acts_as_taggable_on_steroids doesn't handle the case problem especially well and I frequently run across this error:</p>
<pre>
  ActiveRecord::RecordInvalid (Validation failed: Tag has already been taken):
</pre>
<p>It turns out that that the key difference between the two libraries is in how they setup the tag relationship.</p>
<p>acts-as-taggable-on does this:</p>
<pre class="ruby">&nbsp;
<span style="color:#9966CC; font-weight:bold;">def</span> save_tags
          <span style="color:#006600; font-weight:bold;">&#40;</span>custom_contexts + <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9966CC; font-weight:bold;">class</span>.<span style="color:#9900CC;">tag_types</span>.<span style="color:#9900CC;">map</span><span style="color:#006600; font-weight:bold;">&#40;</span>&amp;:to_s<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> |tag_type|
            <span style="color:#9966CC; font-weight:bold;">next</span> <span style="color:#9966CC; font-weight:bold;">unless</span> instance_variable_get<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;@#{tag_type.singularize}_list&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
            owner = instance_variable_get<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;@#{tag_type.singularize}_list&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">owner</span>
            new_tag_names = instance_variable_get<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;@#{tag_type.singularize}_list&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span> - tags_on<span style="color:#006600; font-weight:bold;">&#40;</span>tag_type<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">map</span><span style="color:#006600; font-weight:bold;">&#40;</span>&amp;:name<span style="color:#006600; font-weight:bold;">&#41;</span>
            old_tags = tags_on<span style="color:#006600; font-weight:bold;">&#40;</span>tag_type, owner<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">reject</span> <span style="color:#006600; font-weight:bold;">&#123;</span> |tag| instance_variable_get<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;@#{tag_type.singularize}_list&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>tag.<span style="color:#9900CC;">name</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
            transaction <span style="color:#9966CC; font-weight:bold;">do</span>
              base_tags.<span style="color:#9900CC;">delete</span><span style="color:#006600; font-weight:bold;">&#40;</span>*old_tags<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#9966CC; font-weight:bold;">if</span> old_tags.<span style="color:#9900CC;">any</span>?
              new_tag_names.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> |new_tag_name|
                new_tag = Tag.<span style="color:#9900CC;">find_or_create_with_like_by_name</span><span style="color:#006600; font-weight:bold;">&#40;</span>new_tag_name<span style="color:#006600; font-weight:bold;">&#41;</span>
                Tagging.<span style="color:#9900CC;">create</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:tag_id</span> =&gt; new_tag.<span style="color:#9900CC;">id</span>, <span style="color:#ff3333; font-weight:bold;">:context</span> =&gt; tag_type,
                               <span style="color:#ff3333; font-weight:bold;">:taggable</span> =&gt; <span style="color:#0000FF; font-weight:bold;">self</span>, <span style="color:#ff3333; font-weight:bold;">:tagger</span> =&gt; owner<span style="color:#006600; font-weight:bold;">&#41;</span>
              <span style="color:#9966CC; font-weight:bold;">end</span>
            <span style="color:#9966CC; font-weight:bold;">end</span>
          <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
          <span style="color:#0000FF; font-weight:bold;">true</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;</pre>
<p>while acts_as_taggable_on_steroids does it this way:</p>
<pre class="ruby">&nbsp;
        <span style="color:#9966CC; font-weight:bold;">def</span> save_tags
          <span style="color:#0000FF; font-weight:bold;">return</span> <span style="color:#9966CC; font-weight:bold;">unless</span> <span style="color:#0066ff; font-weight:bold;">@tag_list</span>
&nbsp;
          new_tag_names = <span style="color:#0066ff; font-weight:bold;">@tag_list</span> - tags.<span style="color:#9900CC;">map</span><span style="color:#006600; font-weight:bold;">&#40;</span>&amp;:name<span style="color:#006600; font-weight:bold;">&#41;</span>
          old_tags = tags.<span style="color:#9900CC;">reject</span> <span style="color:#006600; font-weight:bold;">&#123;</span> |tag| <span style="color:#0066ff; font-weight:bold;">@tag_list</span>.<span style="color:#9966CC; font-weight:bold;">include</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>tag.<span style="color:#9900CC;">name</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
          <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9966CC; font-weight:bold;">class</span>.<span style="color:#9900CC;">transaction</span> <span style="color:#9966CC; font-weight:bold;">do</span>
            <span style="color:#9966CC; font-weight:bold;">if</span> old_tags.<span style="color:#9900CC;">any</span>?
              taggings.<span style="color:#9900CC;">find</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:all</span>, <span style="color:#ff3333; font-weight:bold;">:conditions</span> =&gt; <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;tag_id IN (?)&quot;</span>, old_tags.<span style="color:#9900CC;">map</span><span style="color:#006600; font-weight:bold;">&#40;</span>&amp;:id<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">each</span><span style="color:#006600; font-weight:bold;">&#40;</span>&amp;:destroy<span style="color:#006600; font-weight:bold;">&#41;</span>
              taggings.<span style="color:#9900CC;">reset</span>
            <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
            new_tag_names.<span style="color:#9900CC;">each</span> <span style="color:#9966CC; font-weight:bold;">do</span> |new_tag_name|
              tags &lt;&lt; Tag.<span style="color:#9900CC;">find_or_create_with_like_by_name</span><span style="color:#006600; font-weight:bold;">&#40;</span>new_tag_name<span style="color:#006600; font-weight:bold;">&#41;</span>
            <span style="color:#9966CC; font-weight:bold;">end</span>
          <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;
          <span style="color:#0000FF; font-weight:bold;">true</span>
        <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;</pre>
<p>The key difference is in this:</p>
<pre class="ruby">&nbsp;
Tagging.<span style="color:#9900CC;">create</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:tag_id</span> =&gt; new_tag.<span style="color:#9900CC;">id</span>, <span style="color:#ff3333; font-weight:bold;">:context</span> =&gt; tag_type,
                               <span style="color:#ff3333; font-weight:bold;">:taggable</span> =&gt; <span style="color:#0000FF; font-weight:bold;">self</span>, <span style="color:#ff3333; font-weight:bold;">:tagger</span> =&gt; owner<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;</pre>
<p>versus:</p>
<pre class="ruby">&nbsp;
tags &lt;&lt; Tag.<span style="color:#9900CC;">find_or_create_with_like_by_name</span><span style="color:#006600; font-weight:bold;">&#40;</span>new_tag_name<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;</pre>
<p>The first will return false and on go on it's way.  The second throws an exception.  Which is the right way of dealing with the problem?  I guess it depends.  I don't feel like either is a great solution.  Both libraries assume that 'blue' == 'Blue'.  If that assumption is correct then a different bit of code should change in each library.  Tag.rb should lower case the names in the comparison:</p>
<pre class="ruby">&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> ==<span style="color:#006600; font-weight:bold;">&#40;</span>object<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">super</span> || <span style="color:#006600; font-weight:bold;">&#40;</span>object.<span style="color:#9900CC;">is_a</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>Tag<span style="color:#006600; font-weight:bold;">&#41;</span> &amp;&amp; name == object.<span style="color:#9900CC;">name</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;</pre>
<p>changes to:</p>
<pre class="ruby">&nbsp;
  <span style="color:#9966CC; font-weight:bold;">def</span> ==<span style="color:#006600; font-weight:bold;">&#40;</span>object<span style="color:#006600; font-weight:bold;">&#41;</span>
    <span style="color:#9966CC; font-weight:bold;">super</span> || <span style="color:#006600; font-weight:bold;">&#40;</span>object.<span style="color:#9900CC;">is_a</span>?<span style="color:#006600; font-weight:bold;">&#40;</span>Tag<span style="color:#006600; font-weight:bold;">&#41;</span> &amp;&amp; name.<span style="color:#9900CC;">downcase</span> == object.<span style="color:#9900CC;">name</span>.<span style="color:#9900CC;">downcase</span><span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;</pre>
<p>However, if you want to leave each tag as the user specified rather than change the case then a different line needs to be changed in tag.rb</p>
<pre class="ruby">&nbsp;
  <span style="color:#008000; font-style:italic;"># LIKE is used for cross-database case-insensitivity</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">find_or_create_with_like_by_name</span><span style="color:#006600; font-weight:bold;">&#40;</span>name<span style="color:#006600; font-weight:bold;">&#41;</span>
    find<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:first</span>, <span style="color:#ff3333; font-weight:bold;">:conditions</span> =&gt; <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;name LIKE ?&quot;</span>, name<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> || create<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:name</span> =&gt; name<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;</pre>
<p>will need to change to</p>
<pre class="ruby">&nbsp;
  <span style="color:#008000; font-style:italic;"># = is used for to ensure tags are case sensitive</span>
  <span style="color:#9966CC; font-weight:bold;">def</span> <span style="color:#0000FF; font-weight:bold;">self</span>.<span style="color:#9900CC;">find_or_create_with_like_by_name</span><span style="color:#006600; font-weight:bold;">&#40;</span>name<span style="color:#006600; font-weight:bold;">&#41;</span>
    find<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:first</span>, <span style="color:#ff3333; font-weight:bold;">:conditions</span> =&gt; <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;name =&quot;</span>, name<span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#41;</span> || create<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:name</span> =&gt; name<span style="color:#006600; font-weight:bold;">&#41;</span>
  <span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;</pre>
<p>Of course the second change will result in the duplication of tags in your site - you will end up with tags 'Blue' and 'blue', but that is the intent.  Your searches might need to be adjusted accordingly.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justinball.com/2010/01/21/acts_as_taggable-libraries-and-the-big-case-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>undefined method `assert_no_difference&#8217; and `assert_difference&#8217;</title>
		<link>http://www.justinball.com/2010/01/01/undefined-method-assert_no_difference-and-assert_difference/</link>
		<comments>http://www.justinball.com/2010/01/01/undefined-method-assert_no_difference-and-assert_difference/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 19:46:08 +0000</pubDate>
		<dc:creator>Justin Ball</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[tests]]></category>

		<guid isPermaLink="false">http://www.justinball.com/?p=1308</guid>
		<description><![CDATA[I've been upgrading some old code and noticed that my unit tests started spitting out a lot of errors like this:

undefined method `assert_no_difference'

and 

undefined method `assert_difference'

It turns out that I needed to change my base classes from Test::Unit::TestCase to ActiveSupport::TestCase:
&#160;
class UserTest &#60; Test::Unit::TestCase
  # stuff
end
&#160;
changes to:
&#160;
class UserTest &#60; ActiveSupport::TestCase
  # stuff
end
&#160;
]]></description>
			<content:encoded><![CDATA[<p>I've been upgrading some old code and noticed that my unit tests started spitting out a lot of errors like this:</p>
<pre>
undefined method `assert_no_difference'
</pre>
<p>and </p>
<pre>
undefined method `assert_difference'
</pre>
<p>It turns out that I needed to change my base classes from <strong>Test::Unit::TestCase</strong> to <strong>ActiveSupport::TestCase</strong>:</p>
<pre class="ruby">&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> UserTest &lt; <span style="color:#6666ff; font-weight:bold;">Test::Unit::TestCase</span>
  <span style="color:#008000; font-style:italic;"># stuff</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;</pre>
<p>changes to:</p>
<pre class="ruby">&nbsp;
<span style="color:#9966CC; font-weight:bold;">class</span> UserTest &lt; <span style="color:#6666ff; font-weight:bold;">ActiveSupport::TestCase</span>
  <span style="color:#008000; font-style:italic;"># stuff</span>
<span style="color:#9966CC; font-weight:bold;">end</span>
&nbsp;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.justinball.com/2010/01/01/undefined-method-assert_no_difference-and-assert_difference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What I Got for Christmas This Year</title>
		<link>http://www.justinball.com/2009/12/28/what-i-got-for-christmas-this-year/</link>
		<comments>http://www.justinball.com/2009/12/28/what-i-got-for-christmas-this-year/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 06:54:10 +0000</pubDate>
		<dc:creator>Justin Ball</dc:creator>
				<category><![CDATA[friends]]></category>
		<category><![CDATA[Christmas]]></category>
		<category><![CDATA[Family]]></category>

		<guid isPermaLink="false">http://www.justinball.com/?p=1301</guid>
		<description><![CDATA[We're home from my parents which in a way marks the end of the Christmas celebration for us.  Although, I am pushing for a return of the Twelve days of Christmas which doesn't end until January 5.
Here's what I got for Christmas this year:
A chance to play Santa Claus with the most beautiful Misses [...]]]></description>
			<content:encoded><![CDATA[<p>We're home from my parents which in a way marks the end of the Christmas celebration for us.  Although, I am pushing for a return of the Twelve days of Christmas which doesn't end until January 5.</p>
<p>Here's what I got for Christmas this year:</p>
<p>A chance to play Santa Claus with the most beautiful Misses Claus in the world until 3 am.  I'm glad she wraps the presents and puts everything together while I eat the cookies.</p>
<p>A few (short) moments of watching my children excitedly rip through presents during the few years that they still feel the magic of Christmas.</p>
<p>A few days away from my computer and from code.  I love my job but sometimes I forget what it's like to be a normal human being.</p>
<p>One Lego train from a beautiful Misses Claus and an hour to put it together with my brother.  I'm getting old but it is nice to remember what Christmas was like when you were ten.</p>
<p>2 loaves of my grandmother's bread.</p>
<p>A couple of days with family.</p>
<p>A couple of days to go home and recover from family.</p>
<p>An awesome Christmas card from Zach Poulter.</p>
<p>A couple of hours with friends that I haven't seen in many years.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justinball.com/2009/12/28/what-i-got-for-christmas-this-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Merry Christmas</title>
		<link>http://www.justinball.com/2009/12/25/merry-christmas/</link>
		<comments>http://www.justinball.com/2009/12/25/merry-christmas/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 09:12:55 +0000</pubDate>
		<dc:creator>Justin Ball</dc:creator>
				<category><![CDATA[Funny]]></category>

		<guid isPermaLink="false">http://www.justinball.com/?p=1299</guid>
		<description><![CDATA[Santa's up a bit late this year (every year actually).  Merry Christmas to all and to all a good night!
]]></description>
			<content:encoded><![CDATA[<p>Santa's up a bit late this year (every year actually).  Merry Christmas to all and to all a good night!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justinball.com/2009/12/25/merry-christmas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using the OAuth and OAuth-Plugin gems</title>
		<link>http://www.justinball.com/2009/12/24/using-the-oauth-and-oauth-plugin-gems/</link>
		<comments>http://www.justinball.com/2009/12/24/using-the-oauth-and-oauth-plugin-gems/#comments</comments>
		<pubDate>Fri, 25 Dec 2009 04:22:16 +0000</pubDate>
		<dc:creator>Justin Ball</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[Oauth]]></category>
		<category><![CDATA[oauth-plugin]]></category>

		<guid isPermaLink="false">http://www.justinball.com/?p=1295</guid>
		<description><![CDATA[For quite a while I've been wanting to play with OAuth and now that I've been able to spend some time playing with it I have to say it is awesome.  Instead of asking for a user's username and password for a given service (like their GMail or LinkedIn account) you instead have the [...]]]></description>
			<content:encoded><![CDATA[<p>For quite a while I've been wanting to play with OAuth and now that I've been able to spend some time playing with it I have to say it is awesome.  Instead of asking for a user's username and password for a given service (like their GMail or LinkedIn account) you instead have the user log into their account and grant your application access.  The benefit is that your application doesn't have to figure out how to securely store a bunch of extra usernames/passwords and the user can turn off access anytime they feel like they need to reclaim their privacy.</p>
<p>In Rails the way to work with OAuth is the <a href="http://github.com/pelle/oauth">OAuth gem</a> and the <a href="http://github.com/pelle/oauth-plugin">OAuth-Plugin gem</a> which take almost all the pain out of implementing an OAuth solution.  A big thanks to <a href="http://stakeventures.com/">Pelle Braendgaard</a> for a great library.</p>
<p>I won't go into all the details on how to implement the gems in your project.  Instead checkout the README for each gem and the articles on Pelle's blog: <a href="http://stakeventures.com/articles/2008/02/23/developing-oauth-clients-in-ruby">Developing OAuth clients in Ruby</a>, <a href="http://stakeventures.com/articles/2009/07/21/major-update-to-ruby-on-rails-oauth-plugin">Major update to Ruby on Rails OAuth Plugin</a>, and <a href="http://stakeventures.com/articles/2009/07/21/consuming-oauth-intelligently-in-rails">Consuming OAuth intelligently in Rails</a>.</p>
<p>Once you have an OAuth solution in place the next step is to do something with the tokens.  I figured that it was my problem to figure out how to call the various service's apis using the OAuth token.  I spent a fair amount of time trying to figure out how to send the correct headers, sign the values, etc.  I turns out that the OAuth gem takes care of this for you so to save you hours of time, once you have your application setup and configured you can do stuff like this:</p>
<p>Google Contacts API:</p>
<pre class="ruby">&nbsp;
limit = <span style="color:#006666;">10000</span>
user.<span style="color:#9900CC;">google</span>.<span style="color:#9900CC;">get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;http://www.google.com/m8/feeds/contacts/default/full?max-results=#{limit}&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;</pre>
<p>The gem will handle signing the request and adding the needed values to the header.</p>
<p>Pretty cool.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justinball.com/2009/12/24/using-the-oauth-and-oauth-plugin-gems/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Callie Found This&#8230;</title>
		<link>http://www.justinball.com/2009/12/22/callie-found-this/</link>
		<comments>http://www.justinball.com/2009/12/22/callie-found-this/#comments</comments>
		<pubDate>Tue, 22 Dec 2009 23:09:27 +0000</pubDate>
		<dc:creator>Justin Ball</dc:creator>
				<category><![CDATA[Funny]]></category>

		<guid isPermaLink="false">http://www.justinball.com/?p=1293</guid>
		<description><![CDATA[We're using this to teach our kids Chinese. Kind of funny how a word in one language sounds so much like words in another language:

]]></description>
			<content:encoded><![CDATA[<p>We're using this to teach our kids Chinese. Kind of funny how a word in one language sounds so much like words in another language:<br />
<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/kB07xk9NZtQ&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/kB07xk9NZtQ&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.justinball.com/2009/12/22/callie-found-this/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails i18n with the Rails I18n Textmate bundle</title>
		<link>http://www.justinball.com/2009/12/19/ruby-on-rails-i18n-with-the-rails-i18n-textmate-bundle/</link>
		<comments>http://www.justinball.com/2009/12/19/ruby-on-rails-i18n-with-the-rails-i18n-textmate-bundle/#comments</comments>
		<pubDate>Sat, 19 Dec 2009 19:25:58 +0000</pubDate>
		<dc:creator>Justin Ball</dc:creator>
				<category><![CDATA[Ruby On Rails]]></category>
		<category><![CDATA[i18n]]></category>
		<category><![CDATA[Rails I18n Textmate bundle]]></category>
		<category><![CDATA[textmate]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[translations]]></category>

		<guid isPermaLink="false">http://www.justinball.com/?p=1279</guid>
		<description><![CDATA[For the longest time I've deal with internationalization in Ruby on Rails by hand. This is a tedious process that involves switching back and forth between the file containing the string and your localization yaml file. I was looking at Ruby Mine and found that it supports localization and appears to do many of the [...]]]></description>
			<content:encoded><![CDATA[<p>For the longest time I've deal with internationalization in Ruby on Rails by hand. This is a tedious process that involves switching back and forth between the file containing the string and your localization yaml file. I was looking at <a href="http://www.jetbrains.com/ruby/index.html">Ruby Mine</a> and found that it supports localization and appears to do many of the things that I like about <a href="http://macromates.com/">Textmate</a>. I've used <a href="http://www.jetbrains.com/resharper/">Resharper</a> with Visual Studio in the past and I admit that I can't live without it in the .Net world. I downloaded the Ruby Mine demo and tried it out on an existing project.  For some reason the popup that is supposed to say 'I18n string value' that they show in the demos never came up for me unless I changed my strings from </p>
<pre>
&lt;p&gt;Some String&lt;/p&gt;
</pre>
<p>to </p>
<pre>
&lt;%= 'Some String' %&gt;
</pre>
<p> I didn't really feel like having to change my string into that format was going to help my productivity so I abandoned Ruby Mine and instead started looking at the <a href="http://github.com/svenfuchs/rails-i18n">Rails I18n Textmate bundle from Sven Fuchs</a>.  Look inside the tools directory.</p>
<p>Alas, I couldn't get that tool to work either.  Instead each time I hit command+shift+e I and add the translation it would insert this into my file:</p>
<pre>
/Library/Ruby/Gems/1.8/gems/i18n-0.3.2/lib/i18n/backend/base.rb:238:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 2: syntax error: unexpected end of fileload_yml'
  from /Library/Ruby/Gems/1.8/gems/i18n-0.3.2/lib/i18n/backend/base.rb:225:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 2: syntax error: unexpected end of fileload_file'
  from /Library/Ruby/Gems/1.8/gems/i18n-0.3.2/lib/i18n/backend/base.rb:17:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 2: syntax error: unexpected end of fileeach'
  from /Library/Ruby/Gems/1.8/gems/i18n-0.3.2/lib/i18n/backend/base.rb:17:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 2: syntax error: unexpected end of fileinit_translations'
  from /Library/Ruby/Gems/1.8/gems/i18n-0.3.2/lib/i18n/backend/base.rb:107:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 2: syntax error: unexpected end of filetranslate'
  from /Library/Ruby/Gems/1.8/gems/i18n-0.3.2/lib/i18n.rb:208:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 2: syntax error: unexpected end of file[]'
  from /Users/jbasdf/Library/Application Support/TextMate/Pristine Copy/Bundles/Rails I18n.tmbundle/Support/lib/extensions.rb:121:in /bin/bash: -c: line 0: unexpected EOF while looking for matching `''
/bin/bash: -c: line 2: syntax error: unexpected end of fileadd_translation'
  from /tmp/temp_textmate.CUUYuC:4
</pre>
<p>That sucked until I realized that by default the bundle assumes the locale file is in 'config/locales/en.yml'. That is the default for most projects and so most of the time you're fine. However, in my gems I put the locales at the root. Since the bundle couldn't find the file it barfed. Lucky for me you can change this value by going to Bundles -> Rails I18n -> Edit Settings</p>
<p>I changed my settings to look like this so that I could easily change back and forth between locations.</p>
<pre>
CONFIG = {}
CONFIG[:locale] = :en

#CONFIG[:locale_file_path] = "#{ENV['TM_PROJECT_DIRECTORY']}/config/locales/en.yml"
CONFIG[:locale_file_path] = "#{ENV['TM_PROJECT_DIRECTORY']}/locales/en.yml"

CONFIG[:bundle_preferences_path] = "~/Library/Preferences/com.macromates.textmate.rails_i18n_translation_helper.pstore"
CONFIG[:project_directory] = ENV['TM_PROJECT_DIRECTORY']
CONFIG[:method_style] = :long   # :long => I18n.translate() and translate()
                                # :short => I18n.t() and t()
CONFIG[:log_changes] = false
#CONFIG[:log_file_path] = "#{ENV['TM_PROJECT_DIRECTORY']}/config/locales/en"
CONFIG[:log_file_path] = "#{ENV['TM_PROJECT_DIRECTORY']}/locales/en"
</pre>
<p>One other tip.  Be sure to install the i18n gem. I didn't see it in the readme, but I might have read over it.</p>
<pre>
 sudo gem install i18n
</pre>
<p>This is an awesome plugin.  It will save me quite a bit of time.  I do wish it would support multiple locale directories but I can live with it as is.</p>
<p>On a side note the <a href="http://github.com/svenfuchs/rails-i18n">rails-i18n project</a> is a great piece of code if you do any internationalization work.  Check out all the locale files for Rails.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.justinball.com/2009/12/19/ruby-on-rails-i18n-with-the-rails-i18n-textmate-bundle/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
