<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Cowell Computer Consulting</title>
    <link>http://www.lukecowell.com</link>
    <language>en</language>
    <webMaster>luke@talesa.net (Luke Cowell)</webMaster>
    <copyright>Copyright 2007-2010</copyright>
    <ttl>60</ttl>
    <pubDate>Thu, 11 Feb 2010 02:54:00 GMT</pubDate>
    <description></description>
    <item>
      <title>Static Pages in Rails</title>
      <link>http://www.lukecowell.com/archives/2010/2/11/static_pages_in_rails/</link>
      <pubDate>Thu, 11 Feb 2010 02:22:00 GMT</pubDate>
      <guid>http://www.lukecowell.com/archives/2010/2/11/static_pages_in_rails/</guid>
      <author>luke@talesa.net (Luke Cowell)</author>
      <description>&lt;p&gt;I just read an &lt;a href="http://www.mendable.com/quick-and-easy-static-pages-in-rails/"&gt;interesting post&lt;/a&gt; on how to handle static pages in rails and I had a different approach that I wanted to share. There's lots of different ways to do this and each method has its own merit.&lt;/p&gt;

&lt;p&gt;When I say static page, I mean any page that doesn't fit into your other controllers. This might be an about us or a contact page or anything else that might not require a dedicated controller to handle.&lt;/p&gt;

&lt;p&gt;In routes.rb, I would set something like this up:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;map.static '/static/:id', :controller =&amp;gt; "static", :action =&amp;gt; "show"
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We can grab the name of the page from params[:id] in the controller. Feel free to change the name 'id' some something else if it gives you that wrong feeling to treat something as an id that isn't really an id.&lt;/p&gt;

&lt;p&gt;Next, I define a controller called static.&lt;/p&gt;

&lt;pre&gt;
&lt;code&gt;
class StaticController &lt; ApplicationController
  def show
     short_name = params[:id]
     begin
       render short_name
     rescue ActionView::MissingPageTemplate
       render :file =&gt; "#{RAILS_ROOT}/public/404.html", :status =&gt; 404
     end
   end
end
&lt;/code&gt;
&lt;/pre&gt;

&lt;p&gt;So, what's happening here? We know we have an params[:id] or the route wouldn't match.  We then call a begin block, so that we can rescue the exception. Which, in our case, is if someone passes an invalid filename through or the page hasn't yet been defined under app/views/static/pagename.html.erb. We just handle it as a 404.&lt;/p&gt;

&lt;p&gt;What about if we want our static pages to live in a namespace without /static at the beginning ? ie. /about instead of /static/about&lt;/p&gt;

&lt;p&gt;Define a regular expression that matches all the pages you want to support.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;STATIC_PAGES = %w(about contact fun_facts)
STATIC_REGEXP = %r{#{STATIC_PAGES.join("|")}}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then, in your routes file use the requirements parameter to match only these pages.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;map.static ':id', :controller =&amp;gt; "static", :action =&amp;gt; "show", :requirements =&amp;gt; {:id =&amp;gt; STATIC_REGEXP}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is just another approach and there are lots of ways to do this. I was inspired by Yehuda Katz to write this as he recently wrote a &lt;a href="http://yehudakatz.com/2010/02/09/the-blind-men-and-the-elephant-a-story-of-noobs/"&gt;post&lt;/a&gt; about giving back to the community. Also, be sure to check out his &lt;a href="http://www.engineyard.com/blog/2009/rails-and-merb-merge-the-anniversary-part-1-of-6/"&gt;posts&lt;/a&gt; about rails 3.&lt;/p&gt;</description>
      <category domain="http://www.lukecowell.com/archives/tags/RubyOnRails">RubyOnRails</category>
    </item>
    <item>
      <title>Fix for inDesign CS3 crashes</title>
      <link>http://www.lukecowell.com/archives/2009/10/1/fix_for_indesign_cs3_crashes/</link>
      <pubDate>Thu, 01 Oct 2009 05:17:00 GMT</pubDate>
      <guid>http://www.lukecowell.com/archives/2009/10/1/fix_for_indesign_cs3_crashes/</guid>
      <author>luke@talesa.net (Luke Cowell)</author>
      <description>&lt;p&gt;If inDesign is crashing when you quit it, launch it, when you activate fonts or at any other time, you should consider removing or replacing the following file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$HOME/Library/Preferences/Adobe\ InDesign/Version\ 5.0/InDesign\ Defaults
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It appears to contain font information among other things. You care about this because if you were to have activated a corrupt font, or a font with a duplicate postscript name, your problems may continue even after you resolve the font issue because that font will still be cached in here.&lt;/p&gt;

&lt;p&gt;eg.&lt;/p&gt;

&lt;pre&gt;
...
@Semibold
@MyriadPro-Semibold
@Myriad Pro Semibold
@Semibold
@Myriad Pro Semibold
8@Version 2.007;PS 002.000;Core 1.0.38;makeotf.lib1.7.9032
@Semibold Italic
@MyriadPro-SemiboldIt
@Myriad Pro Semibold Italic
@Semibold Italic
...
&lt;/pre&gt;</description>
      <category domain="http://www.lukecowell.com/archives/tags/OSX">OSX</category>
      <category domain="http://www.lukecowell.com/archives/tags/adobe">adobe</category>
    </item>
    <item>
      <title>iPhone recovery mode vs. DFU mode</title>
      <link>http://www.lukecowell.com/archives/2009/9/26/iphone_recovery_mode_vs_dfu/</link>
      <pubDate>Fri, 25 Sep 2009 23:46:00 GMT</pubDate>
      <guid>http://www.lukecowell.com/archives/2009/9/26/iphone_recovery_mode_vs_dfu/</guid>
      <author>luke@talesa.net (Luke Cowell)</author>
      <description>&lt;p&gt;DFU mode and recovery mode are different. Here's how to get tot either one.&lt;/p&gt;

&lt;p&gt;To put your phone in DFU mode:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Turn your iPhone off&lt;/li&gt;
&lt;li&gt;press and hold the home and sleep/wake button for 10 seconds&lt;/li&gt;
&lt;li&gt;release the sleep wake button and hold the home button for 10 more seconds&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To put your phone in recovery mode follow these steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Disconnect the USB cable from the iPhone&lt;/li&gt;
&lt;li&gt;Turn your iPhone off&lt;/li&gt;
&lt;li&gt;Press and hold the home button while connecting the USB cable to your device.&lt;/li&gt;
&lt;li&gt;iTunes should now display a message to indicate you are in recovery mode&lt;/li&gt;
&lt;/ul&gt;</description>
      <category domain="http://www.lukecowell.com/archives/tags/iPhone">iPhone</category>
    </item>
    <item>
      <title>Installing rmagick on OS X</title>
      <link>http://www.lukecowell.com/archives/2009/6/1/installing_rmagick_on_os_x/</link>
      <pubDate>Mon, 01 Jun 2009 14:59:00 GMT</pubDate>
      <guid>http://www.lukecowell.com/archives/2009/6/1/installing_rmagick_on_os_x/</guid>
      <author>luke@talesa.net (Luke Cowell)</author>
      <description>&lt;p&gt;For some reason the gem tries to build against a PPC library, which on my intel machine, doesn't not work. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo su -
ARCHFLAGS='-arch i386' gem install rmagick
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note: you might need to fix the quotes.&lt;/p&gt;</description>
      <category domain="http://www.lukecowell.com/archives/tags/OSX">OSX</category>
      <category domain="http://www.lukecowell.com/archives/tags/ruby">ruby</category>
    </item>
    <item>
      <title>Linotype FontExplorer Settings via command line</title>
      <link>http://www.lukecowell.com/archives/2009/5/25/linotype_settings/</link>
      <pubDate>Mon, 25 May 2009 13:31:00 GMT</pubDate>
      <guid>http://www.lukecowell.com/archives/2009/5/25/linotype_settings/</guid>
      <author>luke@talesa.net (Luke Cowell)</author>
      <description>&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;h3&gt;Finding setting keys for Linotype Font Explorer&lt;/h3&gt;

&lt;p&gt;There's lots more and they're easy to figure out.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;defaults read com.linotype.FontExplorerX &amp;gt; a
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now make your setting change in Font Explorer - it works best to quit at this point.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;defaults read com.linotype.FontExplorerX &amp;gt; a
diff a b
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The output of the diff will tell you what keys changed.&lt;/p&gt;

&lt;p&gt;This output from diff:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;fontRequestsAutoActivate = 1;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Becomes:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;defaults write com.linotype.FontExplorerX fontRequestsAutoActivate 1
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;A list of keys I've found useful&lt;/h3&gt;

&lt;p&gt;Here are a list of linotype keys that I've found useful in configuring workstations settings. &lt;/p&gt;

&lt;p&gt;If a font from a different path with the same name is imported, remove the old one and re-add&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;defaults write com.linotype.FontExplorerX sameFont_importingAdjustments 1
defaults write com.linotype.FontExplorerX sameFont_useGlobalImportingAdjustments 1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Remove and re-add a font if imported from the same path&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;defaults write com.linotype.FontExplorerX samePath_importingAdjustments
defaults write com.linotype.FontExplorerX samePath_useGlobalImportingAdjustments
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When a duplicate font is requested deactivate the current font and activate the requested font without warning&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;defaults write com.linotype.FontExplorerX hideActivationWarning  1
defaults write com.linotype.FontExplorerX hideActivationWarningOption  1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;When activating a font activate the entire suitcase&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;defaults write com.linotype.FontExplorerX alwaysActivateSuitcase 1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Deactivate Fonts when linotype quits&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;defaults write com.linotype.FontExplorerX deactivateFontsFromSessionOnQuit 1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Autoactivate fonts when possible&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;defaults write com.linotype.FontExplorerX fontRequestsAutoActivate 1
&lt;/code&gt;&lt;/pre&gt;</description>
    </item>
    <item>
      <title>Contributing to the Community</title>
      <link>http://www.lukecowell.com/archives/2009/4/23/contributing_to_the_community/</link>
      <pubDate>Thu, 23 Apr 2009 16:13:00 GMT</pubDate>
      <guid>http://www.lukecowell.com/archives/2009/4/23/contributing_to_the_community/</guid>
      <author>luke@talesa.net (Luke Cowell)</author>
      <description>&lt;p&gt;I'm proud to announce I made my first real contribution to the ruby / ROR community. I added a current quiz feature to the ruby quiz site and added an RSS feed to the site for all quizzes and solutions.&lt;/p&gt;

&lt;p&gt;Announcement
&lt;a href="http://www.ruby-forum.com/topic/183984#809279"&gt;http://www.ruby-forum.com/topic/183984#809279&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ruby Quiz RSS Feed:
&lt;a href="http://rubyquiz.strd6.com/quizzes.rss"&gt;http://rubyquiz.strd6.com/quizzes.rs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ruby Quiz Site:
&lt;a href="http://rubyquiz.strd6.com/"&gt;http://rubyquiz.strd6.com/&lt;/a&gt;&lt;/p&gt;</description>
      <category domain="http://www.lukecowell.com/archives/tags/RubyOnRails">RubyOnRails</category>
      <category domain="http://www.lukecowell.com/archives/tags/ruby">ruby</category>
    </item>
    <item>
      <title>The Lie</title>
      <link>http://www.lukecowell.com/archives/2009/4/16/the_lie/</link>
      <pubDate>Thu, 16 Apr 2009 15:23:00 GMT</pubDate>
      <guid>http://www.lukecowell.com/archives/2009/4/16/the_lie/</guid>
      <author>luke@talesa.net (Luke Cowell)</author>
      <description>&lt;p&gt;Fixtures Suck:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://techno-weenie.net/2009/2/9/the-lie"&gt;http://techno-weenie.net/2009/2/9/the-lie&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Machinist Doesn't:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://github.com/notahat/machinist/tree/master"&gt;http://github.com/notahat/machinist/tree/master&lt;/a&gt;&lt;/p&gt;</description>
      <category domain="http://www.lukecowell.com/archives/tags/RubyOnRails">RubyOnRails</category>
    </item>
    <item>
      <title>Blueprint CSS</title>
      <link>http://www.lukecowell.com/archives/2009/4/16/blueprint_css/</link>
      <pubDate>Thu, 16 Apr 2009 15:14:00 GMT</pubDate>
      <guid>http://www.lukecowell.com/archives/2009/4/16/blueprint_css/</guid>
      <author>luke@talesa.net (Luke Cowell)</author>
      <description>&lt;p&gt;Blueprint &lt;span class="caps"&gt;CSS&lt;/span&gt; does a bunch of different things, but this is what really interests me: &amp;#8220;A &lt;span class="caps"&gt;CSS&lt;/span&gt; reset that eliminates the discrepancies across browsers.&amp;#8221;&lt;/p&gt;&lt;p&gt;This means that many of those annoying quirks (ie your layout is broken in Firefox or more likely IE) may be a thing of the past.&lt;/p&gt;&lt;p&gt;Hooray!&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.blueprintcss.org"&gt;http://www.blueprintcss.org&lt;/a&gt;&lt;/p&gt;</description>
    </item>
    <item>
      <title>Well that's Iterating</title>
      <link>http://www.lukecowell.com/archives/2009/3/20/well_thats_iterating/</link>
      <pubDate>Fri, 20 Mar 2009 08:43:00 GMT</pubDate>
      <guid>http://www.lukecowell.com/archives/2009/3/20/well_thats_iterating/</guid>
      <author>luke@talesa.net (Luke Cowell)</author>
      <description>&lt;p&gt;A great page explaining different iterators available in ruby.&lt;/p&gt;

&lt;p&gt;Read about it &lt;a href="http://matthewcarriere.com/2008/6/23/using-select-reject-collect-inject-and-detect/"&gt;here&lt;/a&gt;.&lt;/p&gt;</description>
      <category domain="http://www.lukecowell.com/archives/tags/ruby">ruby</category>
    </item>
    <item>
      <title>Compromising Window Positions</title>
      <link>http://www.lukecowell.com/archives/2009/2/25/20090225090249176321/</link>
      <pubDate>Wed, 25 Feb 2009 02:52:00 GMT</pubDate>
      <guid>http://www.lukecowell.com/archives/2009/2/25/20090225090249176321/</guid>
      <author>luke@talesa.net (Luke Cowell)</author>
      <description>&lt;p&gt;I recently had a reader write in about a problem with their Mail program. Here's what they had to say:&lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;Dear Luke Cowell,&lt;/p&gt;
    
    &lt;p&gt;I am a big fan of your blog, where you explain how to make beautiful christmas trees out of incomprehensible code that outputs a hilarious parody version of "The Twelve Days of Christmas" that I don't really get.&lt;/p&gt;
    
    &lt;p&gt;Perhaps you can do a blog about why my Mac Mail program doesn't save my window size settings. When I close the program, and re-open it later, the window is small, and the "preview" pane, which I like to have hidden, takes up half the window.&lt;/p&gt;
    
    &lt;p&gt;Sincerely,&lt;/p&gt;
    
    &lt;p&gt;Murray Inkster&lt;br&gt;
    Vancouver, BC&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;Dear Murray, &lt;/p&gt;

&lt;p&gt;Thank you for writing in. Apple mail stores most of its preferences in a file called com.apple.mail.plist. This is located in your home directory, under Library/Preferences. Make a backup of this file.&lt;/p&gt;

&lt;p&gt;Quit Mail and open terminal and paste the following lines in:
defaults delete com.apple.mail ActiveViewers
defaults delete com.apple.mail ActiveSingleViewers&lt;/p&gt;

&lt;p&gt;These will delete any information Mail.app has about window position and will hopefully allow you to put your windows in all sorts of compromising positions again.&lt;/p&gt;

&lt;p&gt;If that doesn't work you could also try deleting the com.apple.mail.plist file I mentioned above. Be warned that you'll need to set up your mail rules and accounts all over again. &lt;/p&gt;

&lt;p&gt;Hope this helps,&lt;/p&gt;

&lt;p&gt;Luke Cowell&lt;br&gt;
www.lukecowell.com&lt;/p&gt;</description>
      <category domain="http://www.lukecowell.com/archives/tags/OSX">OSX</category>
      <category domain="http://www.lukecowell.com/archives/tags/Software">Software</category>
    </item>
  </channel>
</rss>
