<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Phil Burrows, Ruby on Rails Web Developer</title>
    <link>http://blog.philburrows.com/rss/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Blog feed for blog.philburrows.com, written by Phil Burrows, Ruby on Rails Web Developer</description>
    
    
        <item>
          <title>Calling all Ruby on Rails developers in...Kansas?!</title>
          <description>
             &lt;p&gt;This is something that&amp;#8217;s been mulling around in my mind for a while now. Unfortunately, I&amp;#8217;ve been too busy and distracted with other things to give it any more than a passing thought. However, this is me [finally] taking action.&lt;/p&gt;


	&lt;p&gt;With the desire to get to meet &lt;em&gt;anybody&lt;/em&gt; around the area that&amp;#8217;s doing similar work, I&amp;#8217;m taking the initiative to officially begin the &lt;strong&gt;Wichita Ruby Users Group&lt;/strong&gt;. That&amp;#8217;s right, Wichita. As in Kansas. As in Wyatt Earp. As in the freaking Wizard of Oz (but with no association with either the musical &amp;#8220;Oz!&amp;#8221; or the hit &lt;span class=&quot;caps&quot;&gt;HBO&lt;/span&gt; prison drama &amp;#8220;Oz&amp;#8221;).&lt;/p&gt;


	&lt;p&gt;I realize there are [currently] very few people who read this blog of mine, but if you&amp;#8217;re in Kansas (or, heck, northern Oklahoma), get in touch with me. And hey, if you know anyone in the area, direct them my way. I&amp;#8217;d really appreciate any help I can get on spreading the word on this thing. So, even if you don&amp;#8217;t live anywhere near, twitter about it, call around, ping people, email them and just generally annoy everyone you know about this thing. Help me get the word out! If you can, try to convince your Ruby friends to move to Kansas so they can attend the meet-ups; I guarantee they will be the most entertaining programmer meet-ups around, even if it means I have to kick-off every meeting with a live performance by &lt;a href=&quot;http://philtheharmony.com/music&quot; title=&quot;Phil Burrows sings the blues&quot;&gt;the philharmonic&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;We&amp;#8217;ll take anyone working with / dabbling in / thinking about / looking at / lusting after / crying over &lt;em&gt;&lt;strong&gt;Ruby!&lt;/strong&gt;&lt;/em&gt; If I get desperate enough, we may even start to accept some Django-ers (blasphemy!), although highly doubtful.&lt;/p&gt;


	&lt;p&gt;And maybe, just maybe, one day Wichita will be home to a beautiful, thriving Ruby community.&lt;/p&gt;


	&lt;p&gt;To get in touch with me, you can&amp;hellip;&lt;br /&gt;
Email me: peburrows[at]gmail[dot]com&lt;br /&gt;
Call me: 501.278.6321&lt;br /&gt;
Twitter me: @peburrows&lt;/p&gt;
             
          </description>
          <pubDate>Sat, 31 May 2008 20:54:24 GMT</pubDate>
          <guid>http://blog.philburrows.com/articles/2008/05/31/calling-all-ruby-on-rails-developers-in-kansas/</guid>
          <link>http://blog.philburrows.com/articles/2008/05/31/calling-all-ruby-on-rails-developers-in-kansas/</link>
        </item>
    
        <item>
          <title>Daily Design</title>
          <description>
             &lt;p&gt;So I&amp;#8217;ve started something new. In the spirit of feeding that growling hunger in my stomach for creativity, in the spirit of some day bleeding a shade of photoshop blue, I&amp;#8217;ve starting forcing myself to do more design work &amp;mdash; forcing myself to try and be more creative&amp;hellip;on a daily basis.&lt;/p&gt;


	&lt;p&gt;Everyday (as time permits) I plan on doing a design journal entry documenting my day in some way. It&amp;#8217;ll be like my little diary, except I won&amp;#8217;t be writing about the girls I have a crush on &amp;mdash; that stuff&amp;#8217;s private.&lt;/p&gt;


	&lt;p&gt;Here are a few quick examples from the first few days of this experiment in forced creativity:&lt;/p&gt;


	&lt;h4&gt;monday may 26, 2008&lt;br /&gt;
&lt;a href=&quot;http://www.flickr.com/photos/peburrows/2534538429/&quot; title=&quot;2008-05-26 by peburrows, on Flickr&quot;&gt;&lt;img src=&quot;http://farm4.static.flickr.com/3193/2534538429_043e40388e_m.jpg&quot; width=&quot;109&quot; height=&quot;240&quot; alt=&quot;2008-05-26&quot; /&gt;&lt;/a&gt;&lt;/h4&gt;


	&lt;h4&gt;wednesday may 28, 2008&lt;br /&gt;
&lt;a href=&quot;http://www.flickr.com/photos/peburrows/2535351130/&quot; title=&quot;2008-05-28 by peburrows, on Flickr&quot;&gt;&lt;img src=&quot;http://farm3.static.flickr.com/2375/2535351130_ca9d0e2e3e_m.jpg&quot; width=&quot;240&quot; height=&quot;109&quot; alt=&quot;2008-05-28&quot; /&gt;&lt;/a&gt;&lt;/h4&gt;


	&lt;h4&gt;thursday may 29, 2008&lt;br /&gt;
&lt;a href=&quot;http://www.flickr.com/photos/peburrows/2535351148/&quot; title=&quot;2008-05-29 by peburrows, on Flickr&quot;&gt;&lt;img src=&quot;http://farm3.static.flickr.com/2017/2535351148_717fb8b2f4_m.jpg&quot; width=&quot;240&quot; height=&quot;109&quot; alt=&quot;2008-05-29&quot; /&gt;&lt;/a&gt;&lt;/h4&gt;


	&lt;p&gt;And, if you have the desire (for some odd reason) to keep up with my daily dose of &lt;span class=&quot;caps&quot;&gt;CS3&lt;/span&gt;, you can follow the progress on flickr &lt;a href=&quot;http://www.flickr.com/photos/peburrows/sets/72157605330571217/&quot; title=&quot;Phil Burrows daily design journal set on flickr&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
             
          </description>
          <pubDate>Thu, 29 May 2008 20:17:26 GMT</pubDate>
          <guid>http://blog.philburrows.com/articles/2008/05/29/daily-design/</guid>
          <link>http://blog.philburrows.com/articles/2008/05/29/daily-design/</link>
        </item>
    
        <item>
          <title>Porting Facebox from jQuery to Prototype</title>
          <description>
             &lt;div id=&quot;first_paragraph&quot;&gt;
If you haven&amp;#8217;t seen &lt;a href=&quot;http://errfree.com&quot;&gt;ErrFree&amp;#8217;s&lt;/a&gt; &lt;a href=&quot;http://famspam.com/facebox/&quot; title=&quot;facebox home page&quot;&gt;Facebox&lt;/a&gt; jQuery plugin, go check it out. It&amp;#8217;s a great little lightbox mod that works with the excellent, lightweight &lt;a href=&quot;http://jquery.com&quot;&gt;jQuery&lt;/a&gt; javascript library. It&amp;#8217;s based on the way Facebook often &amp;#8220;pops-open&amp;#8221; a new modal window on top of the currently loaded page. It&amp;#8217;s a handy little way of doing things, and the first time I saw &lt;a href=&quot;http://ozmm.org&quot;&gt;Chris Wanstrath&amp;#8217;s&lt;/a&gt; Facebox plugin, I thought, &amp;#8220;This could be perfect for a few different things I&amp;#8217;ve got coming up.&amp;#8221; 
&lt;/div&gt;

	&lt;p&gt;The only problem: it uses jQuery, where as pretty much &lt;em&gt;every&lt;/em&gt; project I work on uses Prototype. I like Prototype; it&amp;#8217;s intuitive and powerful. Yes, it&amp;#8217;s a bit bloated, but if you compress your javascript with something like the Rails &lt;a href=&quot;http://synthesis.sbecker.net/pages/asset_packager&quot;&gt;asset packager plugin&lt;/a&gt; (which you &lt;strong&gt;&lt;em&gt;should&lt;/em&gt;&lt;/strong&gt;), filesize becomes much less of an issue. That being said, jQuery is also a great JS library.&lt;/p&gt;


	&lt;p&gt;Anyway, the point is, I couldn&amp;#8217;t use Facebox without doing one of two things:&lt;/p&gt;


	&lt;p&gt;1) include both jQuery and Prototype so all my javascript would continue to work (BTW, jQuery plays really nice with other javascript libraries, but that&amp;#8217;s another post for another time)&lt;/p&gt;


	&lt;p&gt;2) rewrite all my current javascript to use jQuery instead of Prototype.&lt;/p&gt;


	&lt;p&gt;Neither one of these options really seemed like a good option. Not only that, if I wanted to use Facebox at all in any other project, I would be faced with the same choice with each project.&lt;/p&gt;


	&lt;p&gt;So, I decided that there was indeed, a third, better option: rewrite Facebox to work with &lt;em&gt;Prototype&lt;/em&gt;. Long story short, that&amp;#8217;s what I did, and I couldn&amp;#8217;t be happier. Here are the results (you&amp;#8217;ll have to be reading this on the site not in a feed-reader for these examples to work properly):&lt;/p&gt;


	&lt;p&gt;With Facebox, you can&amp;hellip;&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;/examples/facebox&quot; rel=&quot;facebox&quot;&gt;&amp;hellip;load a remote page&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;/uploaded_data/images/better_jpeg.jpg&quot; rel=&quot;facebox&quot;&gt;&amp;hellip;load an image&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;&lt;a href=&quot;#first_paragraph&quot; rel=&quot;facebox&quot;&gt;&amp;hellip;even load a certain section of the current page&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;By rewriting Facebox to use Prototype, using it in your rails project (or any other project using Prototype) becomes as easy as including the facebox.js file on your page and adding rel=&amp;#8221;facebox&amp;#8221; to any links you would like to add the functionality to.&lt;/p&gt;


	&lt;p&gt;Get Facebox for Prototype here:
&lt;a href=&quot;http://dev.philburrows.com/svn/javascript/facebox/&quot; title=&quot;Facebox for Prototype&quot;&gt;http://dev.philburrows.com/svn/javascript/facebox/&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;NOTE&lt;/span&gt;: at the time of this writing, in order for things to look just right, you&amp;#8217;ll need to go grab the required images and &lt;span class=&quot;caps&quot;&gt;CSS&lt;/span&gt; file from the official Facebox page(&amp;nbsp;&lt;a href=&quot;http://famspam.com/facebox/&quot;&gt;http://famspam.com/facebox/&lt;/a&gt;&amp;nbsp;).&lt;/p&gt;


&lt;hr /&gt;


	&lt;p&gt;&lt;span class=&quot;caps&quot;&gt;BTW&lt;/span&gt;, I really need to create some sort of commenting system for this blog of mine&amp;hellip;&lt;/p&gt;
             
          </description>
          <pubDate>Mon, 05 May 2008 02:09:02 GMT</pubDate>
          <guid>http://blog.philburrows.com/articles/2008/05/05/porting-facebox-from-jquery-to-prototype/</guid>
          <link>http://blog.philburrows.com/articles/2008/05/05/porting-facebox-from-jquery-to-prototype/</link>
        </item>
    
        <item>
          <title>Hacking attachment_fu to cut down on image size while keeping things pretty</title>
          <description>
             &lt;p&gt;You guys aren&amp;#8217;t gonna know what to do with yourselves if I keep up this trend of writing a blog post more often than once a month. If if makes you feel any better, I&amp;#8217;m not sure I&amp;#8217;ll manage either.&lt;/p&gt;


	&lt;p&gt;Anwyay, on to the substance.&lt;/p&gt;


	&lt;p&gt;So, like I mentioned in my last post, I&amp;#8217;m working on a site for a photographer friend. Obviously, the &lt;em&gt;main&lt;/em&gt; purpose of the site is to display pictures. That being the case, the obvious choice for a Rails app needing to upload files is Rick Olson&amp;#8217;s wonderful &lt;a href=&quot;http://svn.techno-weenie.net/projects/plugins/attachment_fu/&quot; title=&quot;attachment_fu subversion repository&quot;&gt;attachment_fu plugin&lt;/a&gt;. For the site, I&amp;#8217;m going to need quite a few different image sizes, and attachment_fu handles that wonderfully (If you&amp;#8217;ll notice, we&amp;#8217;re also using Amazon&amp;#8217;s S3 storage service&amp;#8212;there was some hacking done on the plugin for some tweaks to that as well; maybe another blog post coming soon?). Check it out:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
  has_attachment  :content_type =&amp;gt; :image,
                  :max_size     =&amp;gt; 5.megabytes,
                  :resize_to    =&amp;gt; '800x800&amp;gt;',
                  :storage      =&amp;gt; :s3,
                  :s3_access    =&amp;gt; :authenticated_read,
                  :thumbnails   =&amp;gt; {
                    :thumb      =&amp;gt; '100x100&amp;gt;',
                    :small      =&amp;gt; '168x168&amp;gt;',
                    :mid        =&amp;gt; '400x400&amp;gt;'
                  }
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;So, there are a couple things to note here. First, we&amp;#8217;re resizing the original image to fit within 800px x 800px; attachment_fu handles this just fine. Secondly, we&amp;#8217;re also creating four different thumbnails.&lt;/p&gt;


	&lt;p&gt;At this point, those of you familiar with the attachment_fu plugin are thinking, &amp;#8220;So what, I do this on every project.&amp;#8221; Yes, yes you do. But here&amp;#8217;s what you probably don&amp;#8217;t do: compress your images on resize. And, if you do compress your images, your thumbnails probably aren&amp;#8217;t very pretty&amp;#8212;they probably have visible artifacts from the multiple-JPEG-compression.&lt;/p&gt;


	&lt;p&gt;&amp;#8220;Multiple-JPEG-compression?&amp;#8221; I hear you ask. Yes, multiple-JPEG-compression. Maybe it&amp;#8217;s a phrase I&amp;#8217;ve just made up, but &amp;#8220;multiple-JPEG-compression&amp;#8221; is not a good thing. &lt;span class=&quot;caps&quot;&gt;JPEG&lt;/span&gt; is a lossy format, so every time you save a &lt;span class=&quot;caps&quot;&gt;JPEG&lt;/span&gt; image with any kind of compression, you lose a bit of the quality. Eventually, you&amp;#8217;ll start to notice. The issue with compressing images in attachment_fu is that 1) it doesn&amp;#8217;t do it unless you change some code, and 2) if you changed your code, you&amp;#8217;re probably compressing the original image and then creating compressed thumbnails from that compressed, resized original. And that, my friends, is what I would call multiple-JPEG-compression.&lt;/p&gt;


	&lt;p&gt;But first, let&amp;#8217;s back up for a bit&amp;#8230;&lt;/p&gt;


	&lt;p&gt;The reason I even started exploring this was only because of necessity. Originally I hadn&amp;#8217;t even thought of compressing the images; I guess assumed anything that needed to be done on the resize would be taken care of by the attachment_fu plugin. And, for the most part it is. By default, it drops any color-profile that could be included with the image (this behavior can, of course, be over-written; just specify :keep_profile =&amp;gt; true in the has_attachment options). This is a really good thing for a couple reasons: 1) color-profiles can really increase an image&amp;#8217;s filesize 2) color-profiles aren&amp;#8217;t really even taken into account by most browsers. But one thing the attachment_fu plugin doesn&amp;#8217;t do by default is compress images. So, after checking out the &lt;a href=&quot;http://www.imagemagick.org/RMagick/doc/&quot;&gt;RMagick documentation&lt;/a&gt;, I figured the solution would be an easy one; all I had to do was specify a quality in the Image#to_blob call, like so:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
# in attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick_processor.rb
def resize_image(img, size)
  # # ...code not relevant to us right now...
  # set
  self.temp_path = write_to_temp_file(img.to_blob {self.quality = 75})
end
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;And that did exactly what it should: it compressed all my images on resize. But the issue I was having was the multiple-JPEG-compression; my thumbnails were turning out ugly, which is not acceptable for a &lt;em&gt;photographer&amp;#8217;s&lt;/em&gt; website. Here&amp;#8217;s how they were turning out:&lt;/p&gt;


	&lt;p&gt;&lt;img src=&quot;http://blog.philburrows.com/uploaded_data/images/artifacts_jpeg.jpg&quot; /&gt;&lt;/p&gt;


	&lt;p&gt;As you can see, this wasn&amp;#8217;t gonna work. So, what could I do to fix it. Well, first I had to hunt down the root of the problem. After some digging, the issue was what I&amp;#8217;ve mentioned before, the original was getting resized and compressed, and then the thumbnails were being resized and compressed from that initial resize and compress. Multiple-JPEG-compression. So, my first thought was &amp;#8220;Oh, well I&amp;#8217;ll just pass in the original, full-resolution image to the resize method so each thumbnail can be created from a fresh copy and will only be compressed once.&amp;#8221;&lt;/p&gt;


	&lt;p&gt;Bad Idea. Ever heard anything about RMagick being a memory hog? Well, it&amp;#8217;s never a good idea to feed RMagick&amp;#8217;s addiction to hogged resources. And, having RMagick resize an image five time that could possibly be up to 5 megabytes in size is &lt;em&gt;not&lt;/em&gt; a good idea. Duh, Phil.&lt;/p&gt;


	&lt;p&gt;So, what was the solution to the problem. After thinking about it for a bit, I arrived on the solution I moved forward with, and it appears to be working quite well. Here&amp;#8217;s a run-through of the plan I formulated in my mind:&lt;/p&gt;


	&lt;p&gt;1) resize the original image, but without compression&lt;br /&gt;
2) send that resized, uncompressed image to the resize method for thumbnail creation&lt;br /&gt;
2b) make sure that the thumbnails are compressed (but maybe not as much as the original)&lt;br /&gt;
3) after all the thumbnails are created and compressed, compress the original image and save it as well&lt;/p&gt;


	&lt;p&gt;So, the next step was to figure out a way to implement my plan. Long story short, here are the re-written methods in the plugin (i&amp;#8217;m not a fan of monkey-patching):&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
# in attachment_fu/lib/technoweenie/attachment_fu.rb
def after_process_attachment
  if @saved_attachment
    if respond_to?(:process_attachment_with_processing) &amp;#38;&amp;#38;
       thumbnailable? &amp;#38;&amp;#38;
       !attachment_options[:thumbnails].blank? &amp;#38;&amp;#38;
       parent_id.nil?
      temp_file = temp_path || create_temp_file
      attachment_options[:thumbnails].each{|suffix, size|
        create_or_update_thumbnail(temp_file, suffix, *size)
      }
    end
    #############################
    # now compress the original #
    #############################
    with_image do |temp_file|
      resize_image_or_thumbnail!(temp_file, true)
    end
    save_to_storage
    @temp_paths.clear
    @saved_attachment = nil
    callback :after_attachment_saved
  end
end

#
#...
#

def resize_image_or_thumbnail!(img, compress=false)
  if (!respond_to?(:parent_id) || parent_id.nil?) &amp;#38;&amp;#38;
     attachment_options[:resize_to] # parent image
    resize_image(img, attachment_options[:resize_to], compress)
  elsif thumbnail_resize_options # thumbnail
    # we want to always compress the thumbnails
    resize_image(img, thumbnail_resize_options, true)
  end
end

# in attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick_processor.rb
# Performs the actual resizing operation for a thumbnail
def resize_image(img, size, compress=false)
  size = size.first if size.is_a?(Array) &amp;#38;&amp;#38; size.length == 1 &amp;#38;&amp;#38; !size.first.is_a?(Fixnum)
  if size.is_a?(Fixnum) || (size.is_a?(Array) &amp;#38;&amp;#38; size.first.is_a?(Fixnum))
    size = [size, size] if size.is_a?(Fixnum)
    img.thumbnail!(*size)
  else
    img.change_geometry(size.to_s) {|cols, rows, image|
      image.resize!(cols&amp;lt;1 ? 1 : cols, rows&amp;lt;1 ? 1 : rows)
    }
  end
  if compress &amp;#38;&amp;#38; !self.thumbnail
    self.temp_path = write_to_temp_file(img.to_blob {self.quality = 75})
  elsif self.thumbnail
    self.temp_path = write_to_temp_file(img.to_blob {self.quality = 90})
  else
    self.temp_path = write_to_temp_file(img.to_blob)
  end
end

&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;This uses a compression level of 75 for the original full-size image and 90 for the thumbnails, compressing each image only a single time. And, after those changes, here&amp;#8217;s the kind of thumbnails we get:&lt;/p&gt;


	&lt;p&gt;&lt;img src=&quot;http://blog.philburrows.com/uploaded_data/images/better_jpeg.jpg&quot; /&gt;&lt;/p&gt;


	&lt;p&gt;And now for a comparison:&lt;/p&gt;


	&lt;p&gt;&lt;img src=&quot;http://blog.philburrows.com/uploaded_data/images/artifacts_jpeg.jpg&quot; /&gt;&lt;img src=&quot;http://blog.philburrows.com/uploaded_data/images/better_jpeg.jpg&quot; /&gt;&lt;/p&gt;


	&lt;p&gt;Can you tell which is which? I sure can, and the difference in quality is well worth the time it took to figure out how to get things right.&lt;/p&gt;
             
          </description>
          <pubDate>Sat, 03 May 2008 23:25:39 GMT</pubDate>
          <guid>http://blog.philburrows.com/articles/2008/05/03/hacking-attachment_fu-to-cut-down-on-image-size-while-keeping-things-pretty/</guid>
          <link>http://blog.philburrows.com/articles/2008/05/03/hacking-attachment_fu-to-cut-down-on-image-size-while-keeping-things-pretty/</link>
        </item>
    
        <item>
          <title>Rails Namespaces Rock. Rails Namespaces Suck.</title>
          <description>
             &lt;p&gt;So this evening (can we still call it evening at 4:30am?) I encountered a frustrating issue. I&amp;#8217;m working on a rails site for a photographer friend and it&amp;#8217;s been coming along rather smoothly. However, tonight I ran into an annoyingly frustrating issue that turns out to have been caused some routes namespace gotchas.&lt;/p&gt;


	&lt;p&gt;Let me explain:&lt;/p&gt;


	&lt;p&gt;The site I&amp;#8217;m putting together has an admin section, a client section and (of course) a public section. It only seems logical to namespace the different sections of the site for pretty urls and easier controller management. With that in mind, I needed a few controllers to handle the three sections. So, for instance, I had &lt;code&gt;PicturesController&lt;/code&gt;, &lt;code&gt;Client::PicturesController&lt;/code&gt; and &lt;code&gt;Admin::PicturesController&lt;/code&gt;. And here&amp;#8217;s what I initially had in my &lt;code&gt;routes.rb&lt;/code&gt; file to handle the routing:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;
  map.namespace :client do |client|
    client.resources :pictures, :member =&amp;gt; { :approve =&amp;gt; :put, :reject =&amp;gt; :put }
    client.resources :albums, :has_many =&amp;gt; [:pictures]
  end

  map.namespace :admin do |admin|
    admin.resources :pictures, :collection =&amp;gt; {:bulk_edit =&amp;gt; :put, :bulk_update =&amp;gt; :post}
    admin.resources :albums
    admin.resources :clients, :has_many =&amp;gt; [:pictures, :albums]
  end

  # and of course the default
  map.connect ':controller/:action/:id'
&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;With those namespaces in place, I aught to have been able to navigate to the following urls with no problem:&lt;/p&gt;


&lt;pre&gt;&lt;/code&gt;
/admin/pictures/*
/client/pictures/*
/pictures/*
/admin/albums/*
/client/albums/*
&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;And, when running things locally, I could. Not only that, when the app was running in production mode on the server, I could navigate to those URLs without problem as well&amp;#8230;sometimes. But every once in a while (and it seemed to become more frequent the longer the mongrel process had been running), I would get a 404 error in the browser. You could usually get through to the actual page by refreshing a few times, but who wants to (or should have to) to that?! Frankly, it was pissing me off. On to the logs&amp;#8230;&lt;/p&gt;


	&lt;p&gt;Checking the &lt;code&gt;production.log&lt;/code&gt; was no help &amp;mdash; &lt;code&gt;ActionController::UnknownAction (No action responded to index)&lt;/code&gt; &amp;mdash; really?! really?! Because I&amp;#8217;m looking at the &lt;code&gt;index&lt;/code&gt; action right now. Don&amp;#8217;t try to tell me that it&amp;#8217;s not there!&lt;/p&gt;


	&lt;p&gt;So, since &lt;code&gt;production.log&lt;/code&gt; wasn&amp;#8217;t playing by my rules, I decided to peruse the mongrel log. And this is what I found:&lt;/p&gt;


	&lt;p&gt;&lt;code&gt;warning: toplevel constant PicturesController referenced by Admin::PicturesController&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;It was a warning I had never seen before. A little strange, but basically the toplevel PicturesController was stepping on the Admin::PicturesController&amp;#8217;s toes, stomping all up and down on its methods. It&amp;#8217;s a strange thing, but apparently there are issues with route namespaces in rails. To be honest though, I&amp;#8217;m not sure it&amp;#8217;s a flaw in Rails&amp;#8212;it may be the nature of Ruby and the fact that you can&amp;#8217;t have a class and a module of the same name. Either way, it was a frustrating thing to try and figure out. Eventually I found a bit of direction via a thread in the Ruby on Rails Google group (&lt;a href=&quot;http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/e4a1e5f532f53785/f9a982286459d74c?lnk=raot&quot;&gt;http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/e4a1e5f532f53785/f9a982286459d74c?lnk=raot&lt;/a&gt;).&lt;/p&gt;


	&lt;p&gt;All&amp;#8217;s well that ends well, but I have to say, this one was a doozy&amp;#8212;it&amp;#8217;s always a pain to track down a bug that can&amp;#8217;t be reproduced locally and also happens only intermittently. Hope this is helpful to someone.&lt;/p&gt;


	&lt;p&gt;&lt;em&gt;And I&amp;#8217;m still not tired&amp;#8230;&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&lt;span class=&quot;caps&quot;&gt;UPDATE&lt;/span&gt;:&lt;/strong&gt;
I just realized I didn&amp;#8217;t mention what the solution was to this problem. Basically, just rename your controllers so that they each have a unique name (this could be as simple as making one singular and the other plural). Kind of annoying, but it&amp;#8217;s a pretty easy solution to a very frustrating problem.&lt;/p&gt;
             
          </description>
          <pubDate>Fri, 02 May 2008 04:34:43 GMT</pubDate>
          <guid>http://blog.philburrows.com/articles/2008/05/02/rails-namespaces-rock-rails-namespaces-suck-/</guid>
          <link>http://blog.philburrows.com/articles/2008/05/02/rails-namespaces-rock-rails-namespaces-suck-/</link>
        </item>
    
        <item>
          <title>New Song From My Band</title>
          <description>
             My band ( &lt;a href=&quot;http://philtheharmony.com&quot; title=&quot;amazing solo project&quot;&gt;the philharmonic&lt;/a&gt; ) has a &lt;a href=&quot;http://philtheharmony.com/music/listen/10-an-evening-with-the-in-laws-demo-&quot; title=&quot;an evening with the in-laws&quot;&gt;new demo&lt;/a&gt; up on the site. Go check it out. Comment and tell me how much you hate it and how much you wish I would actually write something of substance in this blog...

.phil.
             
          </description>
          <pubDate>Thu, 01 May 2008 15:09:13 GMT</pubDate>
          <guid>http://blog.philburrows.com/articles/2008/05/01/new-song-from-my-band/</guid>
          <link>http://blog.philburrows.com/articles/2008/05/01/new-song-from-my-band/</link>
        </item>
    
        <item>
          <title>SXSW. Top Ten Lessons Learned in E-Commerce</title>
          <description>
             &lt;h3&gt;top 10 lessons learned in e-commerce&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;THE E-COMMERCE BUSINESS IS BUILT ON REPEAT CUSTOMERS.&lt;/li&gt;
&lt;li&gt;WORD OF MOUTH REALLY WORKS ONLINE.&lt;/li&gt;
&lt;li&gt;DON'T COMPETE ON PRICE.&lt;/li&gt;
&lt;li&gt;MAKE SURE YOUR WEBSITE INVENTORY IS 100% ACCURATE.&lt;/li&gt;
&lt;li&gt;CENTRALLY LOCATE YOUR DISTRIBUTION.&lt;/li&gt;
&lt;li&gt;CUSTOMER SERVICE IS AN INVESTMENT, NOT AN EXPENSE.&lt;/li&gt;
&lt;li&gt;START SMALL AND STAY FOCUSED.&lt;/li&gt;
&lt;li&gt;DON'T BE SECRETIVE. DON'T WORRY ABOUT COMPETITORS.&lt;/li&gt;
&lt;li&gt;YOU NEED TO ACTIVELY MANAGE YOUR COMPANY CULTURE.&lt;/li&gt;
&lt;li&gt;BE WARY OF SO-CALLED EXPERTS&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;CONCLUSIONS&lt;/h3&gt;
&lt;ul&gt;
   &lt;li&gt;Customer Service is of the utmost importance&lt;/li&gt;
&lt;/ul&gt;
             
          </description>
          <pubDate>Sat, 08 Mar 2008 12:10:28 GMT</pubDate>
          <guid>http://blog.philburrows.com/articles/2008/03/08/sxsw-top-ten-lessons-learned-in-e-commerce/</guid>
          <link>http://blog.philburrows.com/articles/2008/03/08/sxsw-top-ten-lessons-learned-in-e-commerce/</link>
        </item>
    
        <item>
          <title>SXSW. Design Is In The Details</title>
          <description>
             &lt;p&gt;I plan on posting my notes from the different sessions I attend here at &lt;acronym title=&quot;South By Southwest&quot;&gt;&lt;span class=&quot;caps&quot;&gt;SXSW&lt;/span&gt;&lt;/acronym&gt;. First up: Design is in the Details&amp;#8212;Naz Hamid.&lt;/p&gt;


	&lt;h2&gt;design checklist&lt;/h2&gt;


&lt;h3&gt;01 &lt;span class=&quot;caps&quot;&gt;EXPERIMENT&lt;/span&gt;&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;beautiful mistakes&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;02 &lt;span class=&quot;caps&quot;&gt;CHOICES&lt;/span&gt;&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;choose simplicity and what makes sense&lt;/li&gt;
&lt;li&gt;complexity may be a (bad) sign&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;03 &lt;span class=&quot;caps&quot;&gt;STAY CONSISTENT&lt;/span&gt;&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;especially important when working on internal pages&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;04 &lt;span class=&quot;caps&quot;&gt;COMPLETENESS&lt;/span&gt;&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;don&amp;#8217;t let the clients get hung up on the little details that should be completed&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;05 &lt;span class=&quot;caps&quot;&gt;STEP IN&lt;/span&gt;, STEP &lt;span class=&quot;caps&quot;&gt;OUT&lt;/span&gt;, STEP &lt;span class=&quot;caps&quot;&gt;BACK&lt;/span&gt;: BALANCE&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;taking breaks can help you be objective about your design&lt;/li&gt;
&lt;li&gt;do it, then forget it, then come back with fresh eyes&lt;/li&gt;
&lt;li&gt;take notes on what stood out when you looked at it the first time back&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;06 &lt;span class=&quot;caps&quot;&gt;BE YOUR OWN CRITIC&lt;/span&gt;&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;have sound explanations for your decisions&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;07 &lt;span class=&quot;caps&quot;&gt;COMPLEXITY IN SIMPLICITY&lt;/span&gt;: LESS &lt;span class=&quot;caps&quot;&gt;IS MORE&lt;/span&gt;&lt;/h3&gt;
&lt;ul&gt;&lt;li&gt;don&amp;#8217;t include what we don&amp;#8217;t need&lt;/li&gt;&lt;/ul&gt;
&lt;h3&gt;08 &lt;span class=&quot;caps&quot;&gt;OBSESSION IS HEALTHY&lt;/span&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;dedication to the design is essential
&lt;li&gt;take the time to focus on the little details
   &lt;/ul&gt;

&lt;h2&gt;&lt;span class=&quot;caps&quot;&gt;THOUGHTS&lt;/span&gt;, BREAKTHROUGHS &amp;#38; &lt;span class=&quot;caps&quot;&gt;REVELATIONS&lt;/span&gt;&lt;/h2&gt;
&lt;ul&gt;&lt;li&gt;make sure you&amp;#8217;re pleased with what you&amp;#8217;re presenting&lt;/li&gt;&lt;/ul&gt;
             
          </description>
          <pubDate>Sat, 08 Mar 2008 11:11:43 GMT</pubDate>
          <guid>http://blog.philburrows.com/articles/2008/03/08/sxsw-design-is-in-the-details/</guid>
          <link>http://blog.philburrows.com/articles/2008/03/08/sxsw-design-is-in-the-details/</link>
        </item>
    
        <item>
          <title>SXSW Rails Happy Hour</title>
          <description>
             &lt;p&gt;Just a quick mention of something that&amp;#8217;s going on at &lt;acronym title=&quot;South by Southwest&quot;&gt;&lt;span class=&quot;caps&quot;&gt;SXSW&lt;/span&gt;&lt;/acronym&gt;&amp;#8212;&lt;/p&gt;


	&lt;p&gt;We&amp;#8217;re having a &lt;a href=&quot;http://upcoming.yahoo.com/event/416846&quot;&gt;Rails Happy Hour&lt;/a&gt; sponsored by &lt;a href=&quot;http://www.fiveruns.com&quot;&gt;Five Runs&lt;/a&gt;. Come on over and enjoy free drinks, food and seasoned conversation if you&amp;#8217;re in Austin for &lt;span class=&quot;caps&quot;&gt;SXSW&lt;/span&gt; (or any other reason).&lt;/p&gt;
             
               <a href="http://blog.philburrows.com/articles/2008/03/07/sxsw-rails-happy-hour/">Read More&hellip;</a>
             
          </description>
          <pubDate>Fri, 07 Mar 2008 23:56:52 GMT</pubDate>
          <guid>http://blog.philburrows.com/articles/2008/03/07/sxsw-rails-happy-hour/</guid>
          <link>http://blog.philburrows.com/articles/2008/03/07/sxsw-rails-happy-hour/</link>
        </item>
    
        <item>
          <title>Snaptweet</title>
          <description>
             &lt;p&gt;So &lt;a href=&quot;http://damonclinkscales.com/&quot;&gt;Damon Clinkscales&lt;/a&gt; (a guy I work with) has put together this nifty little app called &lt;a href=&quot;http://snaptweet.com&quot;&gt;SnapTweet&lt;/a&gt; that integrates with &lt;a href=&quot;http://twitter.com&quot;&gt;Twitter&lt;/a&gt; and &lt;a href=&quot;http://flickr.com&quot;&gt;Flickr&lt;/a&gt;. Check it out, it&amp;#8217;s pretty neat-o.&lt;/p&gt;


&lt;aronym title=&quot;by the way&quot;&gt;&lt;span class=&quot;caps&quot;&gt;BTW&lt;/span&gt;&lt;/acronym&gt;:

	&lt;p&gt;&lt;a href=&quot;http://twitter.com/peburrows&quot;&gt;Me on twitter&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://flickr.com/photos/66343843@N00/&quot;&gt;Me on flickr&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://snaptweet.com/peburrows&quot;&gt;Me on snaptweet&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;
             
          </description>
          <pubDate>Tue, 26 Feb 2008 00:08:21 GMT</pubDate>
          <guid>http://blog.philburrows.com/articles/2008/02/26/snaptweet/</guid>
          <link>http://blog.philburrows.com/articles/2008/02/26/snaptweet/</link>
        </item>
    
        <item>
          <title>...and we're back</title>
          <description>
             &lt;p&gt;So posting to this thing has proven to be less frequent than I had hoped, but I&amp;#8217;m here to say that [hopefully] it should become more of a routine. I&amp;#8217;m going to &lt;em&gt;&lt;strong&gt;make&lt;/strong&gt;&lt;/em&gt; myself do it.&lt;/p&gt;


&lt;hr /&gt;

	&lt;p&gt;So there are a few things I&amp;#8217;ve been meaning to document. Like I said in my first post, I did a custom Radiant &lt;acronym title=&quot;Content Management System&quot;&gt;CMS&lt;/acronym&gt; for vitalsource.com:http://vitalsource.com/ although I didn&amp;#8217;t do the design on that site, I just ported over the content to the new &lt;acronym title=&quot;Content Management System&quot;&gt;CMS&lt;/acronym&gt;. Anyway, I put together a few custom extensions for the site. They may be useful for one of your project, and if so, feel free to use them as you wish. I&amp;#8217;d love to know if you find them useful and how you&amp;#8217;ve implemented them on your site. Now, on to an overview.&lt;/p&gt;


&lt;h3&gt;Translator&lt;/h3&gt;
&lt;a href=&quot;http://dev.philburrows.com/svn/radiant-extensions/translator/trunk/&quot;&gt;&lt;code&gt;&lt;pre&gt;http://dev.philburrows.com/svn/radiant-extensions/translator/trunk/&lt;/code&gt;&lt;/pre&gt;&lt;/a&gt;
&lt;small&gt;Yeah, I&amp;#8217;m still using subversion. Sorry I haven&amp;#8217;t jumped on the git train just yet for my personal stuff.&lt;/small&gt;

	&lt;p&gt;The Translator extension is for localization. It&amp;#8217;s not really an issue I&amp;#8217;ve ever had to deal with, so, initially, I figured the best thing to do was use something someone else had put together and a number of people had used with success. But I looked at all the other localization options for Radiant, and none of them seemed to do what I wanted a localization solution to do for me. Other localization options (i.e. &lt;a href=&quot;https://svn1.hosted-projects.com/medlar/language_redirect_extension&quot;&gt;Language Redirect&lt;/a&gt;) seemed to require way too much duplication of content. Not only that, but there wasn&amp;#8217;t a way to reliably fall back to default content (or a default language) if the content in the requested language did not exist. So, localization was an &amp;#8220;all or nothing&amp;#8221; option. Unfortunately, the &lt;a href=&quot;http://vitalsource.com&quot;&gt;VitalSource&lt;/a&gt; website only has certain, important pages translated. Using any of the available localization extensions, foreign language visitors would end up getting a &lt;span class=&quot;caps&quot;&gt;BUNCH&lt;/span&gt; of &lt;abbr title=&quot;Page Not Found&quot;&gt;404s&lt;abbr&gt;.&lt;/p&gt;


	&lt;p&gt;So, what could be done? We don&amp;#8217;t want to give a user a 404 just cuz we haven&amp;#8217;t had the chance (or ability) to translate a certain page into your language of choice. So here&amp;#8217;s what we&amp;#8217;re doing&amp;#8230;&lt;/p&gt;


	&lt;p&gt;In Radiant, every page can have any number of parts. So, the typical page will have something like a &amp;#8220;body&amp;#8221; part and maybe an &amp;#8220;extended&amp;#8221; or &amp;#8220;intro&amp;#8221; or &amp;#8220;sidebar&amp;#8221; part. So, instead of duplicating entire pages in different languages, why not just create a different page part for each language? And then, if the page part isn&amp;#8217;t available in the requested language, we can just fall back to rendering the default language.&lt;/p&gt;


	&lt;p&gt;Honestly, that was a terrible description. The concept is explained a bit better in the &lt;a href=&quot;http://dev.philburrows.com/svn/radiant-extensions/translator/trunk/README&quot;&gt;&lt;span class=&quot;caps&quot;&gt;README&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;


&lt;h3&gt;Regular Expression URLs&lt;/h3&gt;
&lt;a href=&quot;http://dev.philburrows.com/svn/radiant-extensions/reg_exp_urls/trunk/&quot;&gt;&lt;pre&gt;&lt;code&gt;http://dev.philburrows.com/svn/radiant-extensions/reg_exp_urls/trunk/&lt;/code&gt;&lt;/pre&gt;&lt;/a&gt;

	&lt;p&gt;With the handy &lt;a href=&quot;http://gravityblast.com/projects/radiant-copymove-extension/&quot;&gt;Copy and Move&lt;/a&gt; extension it becomes really easy to move your pages around and reorganize the hierarchical arrangement of your site. &lt;span class=&quot;caps&quot;&gt;BUT&lt;/span&gt;, by doing this kind of thing, it also becomes really easy to break links within your site. &amp;#8220;Regular Expression URLs&amp;#8221; to the rescue. Create links that look for a page that match a certain regular expression and output the proper &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;, instead of just blindly spitting out a &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; that may no longer be correct.&lt;/p&gt;


	&lt;p&gt;Again, check out the &lt;a href=&quot;http://dev.philburrows.com/svn/radiant-extensions/reg_exp_urls/trunk/README&quot;&gt;&lt;span class=&quot;caps&quot;&gt;README&lt;/span&gt;&lt;/a&gt; for syntax overview.&lt;/p&gt;
             
          </description>
          <pubDate>Thu, 21 Feb 2008 21:01:59 GMT</pubDate>
          <guid>http://blog.philburrows.com/articles/2008/02/21/and-were-back/</guid>
          <link>http://blog.philburrows.com/articles/2008/02/21/and-were-back/</link>
        </item>
    
        <item>
          <title>The First of [Hopefully] Many</title>
          <description>
             &lt;p&gt;So here it is&amp;#8212;this is the beginning of something good, I think. Today is the day (early as it is), that I finally get this blog online.&lt;/p&gt;
             
               <a href="http://blog.philburrows.com/articles/2008/02/13/the-first-of-hopefully-many/">Read More&hellip;</a>
             
          </description>
          <pubDate>Wed, 13 Feb 2008 02:44:17 GMT</pubDate>
          <guid>http://blog.philburrows.com/articles/2008/02/13/the-first-of-hopefully-many/</guid>
          <link>http://blog.philburrows.com/articles/2008/02/13/the-first-of-hopefully-many/</link>
        </item>
    
    
  </channel>
</rss>

