<?xml version='1.0' encoding='utf-8' ?>
<!--  If you are running a bot please visit this policy page outlining rules you must respect. http://www.livejournal.com/bots/  -->
<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:media='http://search.yahoo.com/mrss/' xmlns:atom10='http://www.w3.org/2005/Atom'>
<channel>
  <title>Lonnon Foster</title>
  <link>http://lonnon.livejournal.com/</link>
  <description>Lonnon Foster - LiveJournal.com</description>
  <lastBuildDate>Fri, 24 Apr 2009 02:52:45 GMT</lastBuildDate>
  <generator>LiveJournal / LiveJournal.com</generator>
  <lj:journal>lonnon</lj:journal>
  <lj:journalid>15403381</lj:journalid>
  <lj:journaltype>personal</lj:journaltype>
  <atom10:link rel='hub' href='http://pubsubhubbub.appspot.com/' />
  <image>
    <url>http://l-userpic.livejournal.com/73834352/15403381</url>
    <title>Lonnon Foster</title>
    <link>http://lonnon.livejournal.com/</link>
    <width>100</width>
    <height>100</height>
  </image>

<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/42176.html</guid>
  <pubDate>Fri, 24 Apr 2009 02:52:45 GMT</pubDate>
  <title>Fixing git pre-commit hook woes</title>
  <link>http://lonnon.livejournal.com/42176.html</link>
  <description>&lt;p&gt;I&amp;#8217;ve had something strange occur when attempting to commit changes to a Git repository located on a flash drive. A pre-commit hook, which is a script Git runs before the &lt;code&gt;git commit&lt;/code&gt; command does its thing, prevents me from committing files until I&amp;#8217;ve removed whitespace characters from the ends of all the lines in the files. Cleaning out such whitespace is good practice if you&amp;#8217;re working on a project and you submit your changes as patches; the patch mechanism has a tendency to barf on lines that contain trailing whitespace.&lt;/p&gt;

&lt;p&gt;My problem is that not only am I not working on a project where I submit patches, some of the Rails generators create files that contain trailing whitespace (I&amp;#8217;m looking at you, RSpec). When I found that the &lt;code&gt;rake db:migrate&lt;/code&gt; task adds trailing whitespace to the &lt;code&gt;schema.rb&lt;/code&gt; file, I nearly went ballistic. I&amp;#8217;d be okay with keeping the whitespace out of my own code, because I&amp;#8217;m just &lt;span class=&quot;caps&quot;&gt;OCD &lt;/span&gt;enough to enjoy the exercise, but having to fix code generated by automation tools just pisses me off. &lt;/p&gt;&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;&lt;p&gt;To add to the aggravation, the pre-commit hook didn&amp;#8217;t seem to run when I was committing to Git repositories on the hard drive of my Mac. I ran afoul of the hook only when committing to a repository on the flash drive or on my Windows laptop.&lt;/p&gt;

&lt;p&gt;I got fed up with it enough today to do a bit of digging into the guts of Git. The &lt;code&gt;pre-commit&lt;/code&gt; script is created when &lt;code&gt;git init&lt;/code&gt; sets up a new repository, and the script is located in a project&amp;#8217;s working directory under &lt;code&gt;.git/hooks&lt;/code&gt;. The &lt;code&gt;pre-commit&lt;/code&gt; script&amp;#8217;s comments indicate that it&amp;#8217;s designed to prevent trailing whitespace from getting into files destined for patches. The comments also mention the following:&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;To enable this hook, make this file executable.&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;Aha! Now we&amp;#8217;re getting somewhere. I checked the file permissions, and sure enough, the file is executable in a repository created on the flash drive. However, it isn&amp;#8217;t executable in a repository created on the Mac&amp;#8217;s hard drive. Digging a bit deeper, I found that the original copy of &lt;code&gt;pre-commit&lt;/code&gt; comes from &lt;code&gt;/usr/local/share/git-core/templates/hooks&lt;/code&gt;, where the file is also not executable.&lt;/p&gt;

&lt;p&gt;It looks like &lt;code&gt;git init&lt;/code&gt; loses the file permissions when it copies everything from the Git templates directory over to the flash drive, thereby resulting in files that have full permissions enabled. This makes sense, given that the flash drive is &lt;span class=&quot;caps&quot;&gt;FAT32&lt;/span&gt;-formatted; the filesystem doesn&amp;#8217;t support Unix-style execution permissions. My Windows laptop has the same problem.&lt;/p&gt;

&lt;p&gt;Finally knowing what causes the problem, I defused it by renaming &lt;code&gt;pre-commit&lt;/code&gt; in the templates directory to &lt;code&gt;pre-commit.patching&lt;/code&gt;. Now if it&amp;#8217;s copied with full permissions, it won&amp;#8217;t matter, because Git&amp;#8217;s looking for a file named &lt;code&gt;pre-commit&lt;/code&gt;. I may at some point need to re-enable the hook if I start submitting patches to someone else&amp;#8217;s project, but in the meantime, for the majority of work that I do in my own one-man repositories, I&amp;#8217;m no longer bothered by an over-protective pre-commit hook.&lt;/p&gt;&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2009/04/23/fixing-git-pre-commit-hook-woes/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2009/04/23/fixing-git-pre-commit-hook-woes/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/42176.html</comments>
  <category>scm</category>
  <category>rails</category>
  <category>git</category>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/41939.html</guid>
  <pubDate>Tue, 24 Mar 2009 02:05:09 GMT</pubDate>
  <title>Deploying a Sinatra app on Dreamhost</title>
  <link>http://lonnon.livejournal.com/41939.html</link>
  <description>&lt;p&gt;I&amp;#8217;ve been down with the flu and confined to the couch for the last couple of days, so what better way to pass the time than learning a new web framework and deploying it to Dreamhost? Only a brain cooked by fever would think something like this might qualify as &lt;em&gt;fun&lt;/em&gt;, but my grey matter is pretty close to hard-boiled by now, and I can only play so much WoW before wanting to shoot myself. So I fired up Google and a text editor and started hacking away.&lt;/p&gt;&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;&lt;h3&gt;Enter Sinatra&lt;/h3&gt;

&lt;p&gt;The most pleasant part of this whole experience was picking up &lt;a href=&quot;http://sinatrarb.com&quot;&gt;Sinatra&lt;/a&gt;, a minimal Ruby web framework that hearkens back to the simpler days of shoving a bunch of Perl into a &lt;span class=&quot;caps&quot;&gt;CGI &lt;/span&gt;script and calling it a day. Like the &lt;span class=&quot;caps&quot;&gt;CGI &lt;/span&gt;script of yore, you can easily stuff a small app into a single file. Unlike that &lt;span class=&quot;caps&quot;&gt;CGI &lt;/span&gt;script, Sinatra lends itself well to &lt;acronym title=&quot;Model View Controller&quot;&gt;MVC&lt;/acronym&gt; separation, test- or spec-driven development, and other modern programming conveniences. It&amp;#8217;s ideal for slapping a quick user interface on some Ruby code.&lt;/p&gt;

&lt;p&gt;Sinatra&amp;#8217;s &lt;a href=&quot;http://www.sinatrarb.com/intro.html&quot;&gt;readme&lt;/a&gt; is a great drink-from-the-fire-hose introduction to what the framework can do, but the minimal &amp;#8220;hello world&amp;#8221; application on Sinatra&amp;#8217;s home page is a bit &lt;em&gt;too&lt;/em&gt; minimal to be instructive. There are some great tutorials listed on the Sinatra site, though. In particular, I found &lt;a href=&quot;http://devver.net/blog/2008/11/building-a-iphone-web-app-in-under-50-lines-with-sinatra-and-iui/&quot;&gt;Building an iPhone web app in under 50 lines with Sinatra and iUI&lt;/a&gt; to be just the ticket for quickly getting up to speed on what Sinatra does. As an added bonus, it&amp;#8217;s got iPhone stuff in it, which is worth at least two squares in Buzzword Bingo.&lt;/p&gt;

&lt;h3&gt;Dreamhost, prepare to be boarded&lt;/h3&gt;

&lt;p&gt;The first step is to make a domain in the Dreamhost panel and configure it to run Passenger. From what I&amp;#8217;ve been reading, Passenger isn&amp;#8217;t really set up to run apps in a subdirectory (like &lt;code&gt;example.com/myapp&lt;/code&gt;), so a new subdomain is the way to go here (like &lt;code&gt;myapp.example.com&lt;/code&gt;). Dreamhost lets you define as many subdomains as you want, so this isn&amp;#8217;t a problem; just click &lt;strong&gt;Add New Domain / Sub-Domain&lt;/strong&gt; in the &lt;strong&gt;Domains&lt;/strong&gt; &amp;gt; &lt;strong&gt;Manage Domains&lt;/strong&gt; screen.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://blog.nyerm.com/images/dh-manage-domains.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;On the Fully Hosted page that appears, check the &lt;strong&gt;Ruby on Rails Passenger&lt;/strong&gt; box. Then set up the web directory as you would for any other site, but add &lt;code&gt;current/public&lt;/code&gt; to the end of the path. We&amp;#8217;re using Capistrano to deploy the app, and Capistrano wants to deploy to a directory called &lt;code&gt;current&lt;/code&gt;. Passenger expects the web directory to point to the app&amp;#8217;s &lt;code&gt;public&lt;/code&gt; folder. Combining those two makes a path ending in &lt;code&gt;current/public&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://blog.nyerm.com/images/dh-fully-hosted.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Let Dreamhost do its thing and create the new domain. Depending on how flaky its systems are and the current phase of the moon, you may have a working subdomain in a few minutes or several hours. I failed my saving throw versus Broken Scripts and got the several hours version when I set up the domain yesterday, resulting in the dreaded &lt;code&gt;bad_httpd_conf&lt;/code&gt; error. You can sometimes force Dreamhost to rebuild your messed up httpd configuration by going back to the Fully Hosted page and just clicking the &lt;strong&gt;Fully host this domain now&lt;/strong&gt; button. No need to change any settings on the page; apparently, performing this little ritual will kick the scripts into gear, and with luck, you&amp;#8217;ll have a working subdomain with Passenger running on it.&lt;/p&gt;

&lt;p&gt;When Dreamhost&amp;#8217;s scripts get around to creating the domain, they&amp;#8217;ll also create its web directory. You&amp;#8217;ll need to ssh over to your account and delete the &lt;code&gt;current&lt;/code&gt; directory that&amp;#8217;s there. Capistrano recreates &lt;code&gt;current&lt;/code&gt; as a symbolic link pointing to the currently deployed version of the application.&lt;/p&gt;



&lt;pre name=&quot;code&quot; class=&quot;ruby:nocontrols:nogutter&quot;&gt;
  &amp;gt; cd ~/sites/sinatra-test.nyerm.com
  &amp;gt; rm -rf current
&lt;/pre&gt;



&lt;h3&gt;Vendoring Sinatra and Rack&lt;/h3&gt;

&lt;p&gt;Though it&amp;#8217;s possible to get your own local gem repository working on Dreamhost (and for some gems, like RMagick, necessary), I find it simpler to unpack gems required by the app into a &lt;code&gt;vendor&lt;/code&gt; folder and just deploy them with the rest of the application.&lt;/p&gt;

&lt;p&gt;As I write this, Dreamhost doesn&amp;#8217;t have Sinatra installed at all, and its copy of Rack is version 0.4.0, which is incompatible with the latest Sinatra (0.9.1.1). So, I unpacked both of these gems into a &lt;code&gt;vendor&lt;/code&gt; folder. Run these commands from the root of your Sinatra project:&lt;/p&gt;



&lt;pre name=&quot;code&quot; class=&quot;ruby:nocontrols:nogutter&quot;&gt;
  &amp;gt; mkdir vendor
  &amp;gt; cd vendor
  &amp;gt; gem unpack rack
  &amp;gt; gem mv rack* rack
  &amp;gt; gem unpack sinatra
  &amp;gt; gem mv sinatra* sinatra
&lt;/pre&gt;



&lt;p&gt;Be sure to change the &lt;code&gt;require &apos;sinatra&apos;&lt;/code&gt; line at the start of your application so it requires the vendor copy of Sinatra:&lt;/p&gt;



&lt;pre name=&quot;code&quot; class=&quot;ruby:nocontrols:nogutter&quot;&gt;
  require &apos;vendor/sinatra/lib/sinatra&apos;
&lt;/pre&gt;



&lt;h3&gt;Capifying and racking&lt;/h3&gt;

&lt;p&gt;With Dreamhost ready to receive your application, it&amp;#8217;s time to get Capistrano in on the action. First you&amp;#8217;ll need to create a &lt;code&gt;Capfile&lt;/code&gt; so Capistrano knows where your application&amp;#8217;s source is and where it should be deployed.&lt;/p&gt;



&lt;pre name=&quot;code&quot; class=&quot;ruby:nocontrols:nogutter&quot;&gt;
  &amp;gt; capify .
&lt;/pre&gt;



&lt;p&gt;Open &lt;code&gt;Capfile&lt;/code&gt; in your favorite editor and replace the sparse default contents of the file with something more like this:&lt;/p&gt;



&lt;pre name=&quot;code&quot; class=&quot;ruby:nocontrols:nogutter&quot;&gt;
  load &apos;deploy&apos; if respond_to?(:namespace)

  default_run_options[:pty] = true
  
  # be sure to change these
  set :user, &apos;username&apos;
  set :domain, &apos;domain.com&apos;
  set :application, &apos;myapp&apos;
  
  # the rest should be good
  set :repository,
      &amp;quot;#{user}@#{domain}:git/#{application}.git&amp;quot;
  set :deploy_to,
      &amp;quot;/home/#{user}/#{application}.#{domain}&amp;quot;
  set :deploy_via, :remote_cache
  set :scm, &apos;git&apos;
  set :branch, &apos;master&apos;
  set :git_shallow_clone, 1
  set :scm_verbose, true
  set :use_sudo, false
  
  server domain, :app, :web
  
  namespace :deploy do
    task :restart do
      run &amp;quot;touch #{current_path}/tmp/restart.txt&amp;quot; 
    end
  end
&lt;/pre&gt;



&lt;p&gt;I found a number of sites with reasonable instructions for deploying Sinatra to Dreamhost, and my favorite is &lt;a href=&quot;http://railstips.org/2008/12/15/deploying-sinatra-on-dreamhost-with-passenger&quot;&gt;John Nunemaker&amp;#8217;s guide on RailsTips&lt;/a&gt;. The &lt;code&gt;Capfile&lt;/code&gt; above is from his article, which is well worth a look.&lt;/p&gt;

&lt;p&gt;The bits that you might need to change in the &lt;code&gt;Capfile&lt;/code&gt; here, aside from the obvious &lt;code&gt;:user&lt;/code&gt;, &lt;code&gt;:domain&lt;/code&gt;, and &lt;code&gt;:application&lt;/code&gt; fill-ins, are the &lt;code&gt;:repository&lt;/code&gt; and &lt;code&gt;:deploy_to&lt;/code&gt; paths. For example, I keep my personal Git repository in a directory that&amp;#8217;s served out by Apache so I can browse the contents. Also, my file structure has an extra &lt;code&gt;sites&lt;/code&gt; directory above the web roots, because I don&amp;#8217;t like the mess that Dreamhost&amp;#8217;s default paths make of my home directory. The appropriate portion of my &lt;code&gt;Capfile&lt;/code&gt; looks like this:&lt;/p&gt;



&lt;pre name=&quot;code&quot; class=&quot;ruby:nocontrols:nogutter&quot;&gt;
  set :repository,
    &amp;quot;#{user}@#{domain}:sites/git.nyerm.com/#{application}.git&amp;quot;
  set :deploy_to,
    &amp;quot;/home/#{user}/sites/#{application}.#{domain}&amp;quot;
&lt;/pre&gt;



&lt;p&gt;The last ingredient needed for deployment to Dreamhost is a rackup configuration file, &lt;code&gt;config.ru&lt;/code&gt;. Pop open the text editor again and enter the following:&lt;/p&gt;



&lt;pre name=&quot;code&quot; class=&quot;ruby:nocontrols:nogutter&quot;&gt;
  require &apos;vendor/rack/lib/rack&apos;
  require &apos;vendor/sinatra/lib/sinatra&apos;
  
  set :run, false
  set :environment, :production
  set :views, &amp;quot;views&amp;quot;
  
  require &apos;hi.rb&apos;
  run Sinatra::Application
&lt;/pre&gt;



&lt;h3&gt;Deploying to Dreamhost&lt;/h3&gt;

&lt;p&gt;Check all your files in and push to the remote Git repository, and you should be ready to deploy with the following commands:&lt;/p&gt;



&lt;pre name=&quot;code&quot; class=&quot;ruby:nocontrols:nogutter&quot;&gt;
  &amp;gt; cap deploy:setup
  &amp;gt; cap deploy
&lt;/pre&gt;



&lt;p&gt;Assuming you don&amp;#8217;t have any typos and Dreamhost is choosing to be merciful, you should now have a Sinatra app running on Dreamhost. On the other hand, if like me you&amp;#8217;re not a divine being of pure logic, you might want to enable Rack&amp;#8217;s logging middleware so you have some clue what&amp;#8217;s not working. Stick the following in your &lt;code&gt;config.ru&lt;/code&gt;, and you&amp;#8217;ll get something more useful than you&amp;#8217;ll find in the Apache logs:&lt;/p&gt;



&lt;pre name=&quot;code&quot; class=&quot;ruby:nocontrols:nogutter&quot;&gt;
  log = File.new(&amp;quot;log/sinatra.log&amp;quot;, &amp;quot;w&amp;quot;)
  STDOUT.reopen(log)
  STDERR.reopen(log)
&lt;/pre&gt;



&lt;h3&gt;Credit where credit is due&lt;/h3&gt;

&lt;p&gt;I found the following articles helpful when trying to get all this working:&lt;/p&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://railstips.org/2008/12/15/deploying-sinatra-on-dreamhost-with-passenger&quot;&gt;Deploying Sinatra on Dreamhost With Passenger&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://devver.net/blog/2008/11/building-a-iphone-web-app-in-under-50-lines-with-sinatra-and-iui/&quot;&gt;Building an iPhone web app in under 50 lines with Sinatra and iUI&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://blog.yetisoftware.com/2009/03/07/sinatra-on-dreamhost/&quot;&gt;Sinatra on Dreamhost&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.sinatrarb.com/book.html#deployment_passenger&quot; title=&quot;mod rails&quot;&gt;Passenger&lt;/a&gt; from the &lt;a href=&quot;http://www.sinatrarb.com/book.html&quot;&gt;Sinatra Book&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2009/03/21/deploying-a-sinatra-app-on-dreamhost/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2009/03/21/deploying-a-sinatra-app-on-dreamhost/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/41939.html</comments>
  <category>rack</category>
  <category>passenger</category>
  <category>sinatra</category>
  <category>howto</category>
  <category>dreamhost</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/41617.html</guid>
  <pubDate>Tue, 10 Mar 2009 01:17:53 GMT</pubDate>
  <title>Helipad, now on GitHub</title>
  <link>http://lonnon.livejournal.com/41617.html</link>
  <description>&lt;p&gt;The &lt;a href=&quot;http://nyerm.com/helipad&quot;&gt;Helipad Ruby interface&lt;/a&gt; is &lt;a href=&quot;http://github.com/lonnon/helipad&quot;&gt;now available on GitHub&lt;/a&gt; in addition to its original home on &lt;a href=&quot;http://rubyforge.org/projects/helipad&quot;&gt;RubyForge&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There&amp;#8217;s no difference at all between the two, apart from the GitHub copy bearing my name, which is GitHub&amp;#8217;s convention for preventing collision between identically-named gems. If you wish to install the gem from GitHub instead of RubyForge, you can do the following:&lt;/p&gt;



&lt;pre&gt;
  &amp;gt; gem sources -a http://gems.github.com
  &amp;gt; sudo gem install lonnon-Helipad
&lt;/pre&gt;&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2009/03/06/helipad-now-on-github/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2009/03/06/helipad-now-on-github/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/41617.html</comments>
  <category>ruby</category>
  <category>helipad</category>
  <category>github</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/41431.html</guid>
  <pubDate>Fri, 20 Feb 2009 10:11:56 GMT</pubDate>
  <title>Improved dynamic human-readable RESTful routing</title>
  <link>http://lonnon.livejournal.com/41431.html</link>
  <description>&lt;p&gt;Earlier in the week I posted about making &lt;a href=&quot;http://blog.nyerm.com/2009/02/16/dynamic-human-readable-restful-routing/&quot;&gt;dynamic &lt;span class=&quot;caps&quot;&gt;REST&lt;/span&gt;ful routes in Rails&lt;/a&gt;. At the end of the article, I mentioned that the method I was using might not work in a production environment, and after searching &lt;em&gt;Agile Web Development with Rails&lt;/em&gt; for the word &amp;#8220;restart,&amp;#8221; I confirmed my suspicions. Generating routes on the fly from data runs afoul of caching, requiring the server to be restarted to pick up changes to the routing. That rules it out as a reliable way to generate pretty &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;s.&lt;/p&gt;

&lt;p&gt;To recap, I&amp;#8217;ve already used &lt;code&gt;map.resources&lt;/code&gt; to generate the usual &lt;code&gt;http://example.com/sections/1&lt;/code&gt; style of &lt;span class=&quot;caps&quot;&gt;REST URL.&lt;/span&gt; I want to be able to route a &lt;span class=&quot;caps&quot;&gt;URL &lt;/span&gt;like &lt;code&gt;http://example.com/about&lt;/code&gt; to the &lt;code&gt;show&lt;/code&gt; method of my Sections controller, as well, to improve human readability (and &lt;acronym title=&quot;search engine optimization&quot;&gt;SEO&lt;/acronym&gt;) of the &lt;span class=&quot;caps&quot;&gt;URL.&lt;/span&gt;&lt;/p&gt;&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;&lt;p&gt;Fortunately, I&amp;#8217;d already thought about how to do this. The solution is to capture the highly variable &lt;span class=&quot;caps&quot;&gt;URL &lt;/span&gt;in a route and process it in the Sections controller to figure out where to send it. The following is now the very last route in my &lt;code&gt;routes.rb&lt;/code&gt; file:&lt;/p&gt;



&lt;pre name=&quot;code&quot; class=&quot;ruby:nocontrols:nogutter&quot;&gt;
  map.section_dispatch &apos;:section&apos;,
                       :controller =&amp;gt; &apos;sections&apos;,
                       :action =&amp;gt; &apos;show&apos;
&lt;/pre&gt;



&lt;p&gt;This route&amp;#8217;s location at the very end of &lt;code&gt;routes.rb&lt;/code&gt; is no accident. It&amp;#8217;s extremely promiscuous, and it will latch onto &lt;em&gt;any&lt;/em&gt; &lt;span class=&quot;caps&quot;&gt;URL &lt;/span&gt;of the form &lt;code&gt;http://example.com/foo&lt;/code&gt;. If it came earlier in the routing, it would prevent many other routes from being triggered, including the &lt;code&gt;http://example.com/sections&lt;/code&gt; &lt;span class=&quot;caps&quot;&gt;REST &lt;/span&gt;route that calls the &lt;code&gt;index&lt;/code&gt; action to display a list of all the sections.&lt;/p&gt;

&lt;p&gt;The route captures whatever comes after the domain part of the &lt;span class=&quot;caps&quot;&gt;URL &lt;/span&gt;in the &lt;code&gt;:section&lt;/code&gt; parameter and sends it along to the &lt;code&gt;show&lt;/code&gt; action in the Sections controller, which is where the really interesting stuff happens:&lt;/p&gt;



&lt;pre name=&quot;code&quot; class=&quot;ruby:nocontrols:nogutter&quot;&gt;
  def show
    section = params[:section]
    if section.nil?
      section = &apos;home&apos;
    end
    @section = Section.find_by_name(section)
    unless @section
      render :file =&amp;gt; &amp;quot;/404.html&amp;quot;,
             :status =&amp;gt; :not_found
    end
  end
&lt;/pre&gt;



&lt;p&gt;Remember I said the route is promiscuous? Here&amp;#8217;s real proof: even a &lt;code&gt;nil :section&lt;/code&gt; parameter gets picked up by the route, which means the root &lt;span class=&quot;caps&quot;&gt;URL &lt;/span&gt;for the site (&lt;code&gt;http://example.com&lt;/code&gt;) is sent to the &lt;code&gt;show&lt;/code&gt; action. The check for &lt;code&gt;section.nil?&lt;/code&gt; assigns the Home section as the desired target; Home is where I keep any bits of content that appear on the front page of the site.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;show&lt;/code&gt; action then looks for a Section in the database whose name matches whatever the route picked up from the &lt;span class=&quot;caps&quot;&gt;URL, &lt;/span&gt;assigning the Section it finds to the instance variable &lt;code&gt;@section&lt;/code&gt; for use by the Section view. However, if the name in the &lt;span class=&quot;caps&quot;&gt;URL &lt;/span&gt;doesn&amp;#8217;t match any Section names, a &lt;code&gt;render&lt;/code&gt; call sends the browser a 404 Not Found error and renders an appropriate page so the site visitor knows she&amp;#8217;s typed in a bad &lt;span class=&quot;caps&quot;&gt;URL.&lt;/span&gt; Eventually, I&amp;#8217;ll replace the static &lt;code&gt;404.html&lt;/code&gt; file with a new controller and view that can generate a more useful 404 page with a search box and helpful links, but that&amp;#8217;s a project for another day.&lt;/p&gt;&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2009/02/20/improved-dynamic-human-readable-restful-routing/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2009/02/20/improved-dynamic-human-readable-restful-routing/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/41431.html</comments>
  <category>programming</category>
  <category>rails</category>
  <category>rest</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/41160.html</guid>
  <pubDate>Thu, 19 Feb 2009 01:55:57 GMT</pubDate>
  <title>Crashing InDesign with bookmarks and hyperlinks</title>
  <link>http://lonnon.livejournal.com/41160.html</link>
  <description>&lt;p&gt;After generating a table of contents for a multi-document InDesign book, I tried to export the book to &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt;. Adobe InDesign CS3 fell right over, presenting me with the friendly &amp;#8220;please tell our developers what the hell you were doing that crashed our fine software&amp;#8221; dialog.&lt;/p&gt;

	&lt;p&gt;When generating the table of contents (&lt;strong&gt;Layout &amp;gt; Table of Contents&lt;/strong&gt;), I selected the &lt;strong&gt;Create &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; Bookmarks&lt;/strong&gt; option. If I omitted the bookmarks, InDesign was able to export a &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; without any trouble, but of course, the &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; was missing the bookmarks. Because the book is nearing 100 pages, having functional bookmarks in the sidebar of Adobe Reader, as well as working hyperlinks in the table of contents, is a necessity for navigating this beast.&lt;/p&gt;

&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;

	&lt;p&gt;After trying every combination I could think of in the &lt;strong&gt;Table of Contents&lt;/strong&gt; dialog, I turned to the &lt;strong&gt;Export Adobe PDF&lt;/strong&gt; dialog (&lt;strong&gt;Book panel menu &amp;gt; Export Book to PDF&lt;/strong&gt;) and started flipping switches there. I discovered that the &lt;strong&gt;Bookmarks&lt;/strong&gt; option in the &lt;strong&gt;Include&lt;/strong&gt; section of the dialog didn&amp;#8217;t make any difference; whether on or off, InDesign still crashed when producing a &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt;.&lt;/p&gt;

	&lt;p&gt;I turned off the &lt;strong&gt;Hyperlinks&lt;/strong&gt; checkbox, and lo and behold, InDesign continued chugging away and gave me a &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt;. None of the bookmark sidebar links worked, nor any table of contents links, nor any other hyperlinks anywhere in the book, but at least InDesign decided to stay with me this time instead of unceremoniously quitting.&lt;/p&gt;

	&lt;p&gt;On the theory that a logical approach wasn&amp;#8217;t working, I started poking at random settings. I got lucky with the first one I tried; turning off &lt;strong&gt;Create Tagged PDF&lt;/strong&gt; not only prevented InDesign from crashing, it produced a fully functional &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; with working bookmarks and hyperlinks. Mission accomplished!&lt;/p&gt;

	&lt;p&gt;I&amp;#8217;m a bit frustrated that InDesign refuses to make a tagged &lt;span class=&quot;caps&quot;&gt;PDF&lt;/span&gt; with working hyperlinks. The whole point to tagged PDFs is that they define document structure, which makes them accessible to assistive reading technologies and lets mobile devices reflow the content to better fit tiny screens. This book isn&amp;#8217;t likely to reach a huge audience to begin with, but it hurts to think that InDesign might be shrinking that audience even further. Given a bit of googling, it appears I&amp;#8217;m not the only one to find &lt;a href=&quot;http://www.adobeforums.com/webx/.59b63953&quot;&gt;problems&lt;/a&gt; &lt;a href=&quot;http://www.listsearch.com/InDesign/Thread/index.lasso?17271&quot;&gt;with&lt;/a&gt; &lt;a href=&quot;http://www.mindfrost82.com/showthread.php?t=274847&quot;&gt;tagging&lt;/a&gt; in InDesign CS3.&lt;/p&gt;&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2009/02/18/crashing-indesign-with-bookmarks-and-hyperlinks/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2009/02/18/crashing-indesign-with-bookmarks-and-hyperlinks/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/41160.html</comments>
  <category>cs3</category>
  <category>wtf</category>
  <category>indesign</category>
  <category>adobe</category>
  <lj:security>public</lj:security>
  <lj:reply-count>3</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/40328.html</guid>
  <pubDate>Wed, 11 Feb 2009 22:49:57 GMT</pubDate>
  <title>TextMate as a blogging tool</title>
  <link>http://lonnon.livejournal.com/40328.html</link>
  <description>&lt;p&gt;There&amp;#8217;s something extraordinarily &lt;em&gt;wrong&lt;/em&gt; about this. I just discovered, through &lt;a href=&quot;http://bjhess.com/blog/2007/03/08/textmate-blogging-wordpress-and-dreamhost/&quot;&gt;Barry Hess&amp;#8217; blog&lt;/a&gt;, that &lt;a href=&quot;http://macromates.com&quot;&gt;TextMate&lt;/a&gt; has a blogging bundle. It hooks up to the ubiquitous &lt;span class=&quot;caps&quot;&gt;XML-RPC&lt;/span&gt; interfaces sported by modern blogging software (Wordpress, Movable Type, Typo, what-have-you) and lets you use your text editor to create and edit weblog posts.&lt;/p&gt;

	&lt;p&gt;This is a far more comfortable interface for composing blog articles than any I&amp;#8217;ve encountered, including the feature-rich web interface in Wordpress itself. I don&amp;#8217;t use the embedded &lt;span class=&quot;caps&quot;&gt;WYSIWIG&lt;/span&gt; editor widget in Wordpress, preferring to format my posts with &lt;a href=&quot;http://www.textism.com/tools/textile/&quot;&gt;Textile&lt;/a&gt; so I can just keep typing instead of trying to figure out what all the little buttons are supposed to do. TextMate does a great job with highlighting Textile, providing just enough coloring and styling to let you know that you&amp;#8217;re doing the markup right without getting in the way of the writing.&lt;/p&gt;

	&lt;p&gt;On top of that, I&amp;#8217;ve got the security of knowing that my prose isn&amp;#8217;t going to disappear if the browser crashes or my network connection flakes out. Need more time to compose a lengthy article? Just save it locally, as a simple text file, and come back to it later. This is the very definition of &amp;#8220;no muss, no fuss.&amp;#8221;&lt;/p&gt;

	&lt;p&gt;Now to see if this bundle works as well in TextMate&amp;#8217;s Windows cousin, &lt;a href=&quot;http://www.e-texteditor.com/&quot;&gt;e&lt;/a&gt;, so I can get the same great feature on my laptop that I have on the iMac at work.&lt;/p&gt;

	&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt; (2009-02-11 21:03): Yes, indeed, this same power exists in e. I am one happy camper.&lt;/p&gt;&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2009/02/11/textmate-as-a-blogging-tool/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2009/02/11/textmate-as-a-blogging-tool/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/40328.html</comments>
  <category>blogging</category>
  <category>wordpress</category>
  <category>textmate</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/39702.html</guid>
  <pubDate>Tue, 25 Nov 2008 02:19:13 GMT</pubDate>
  <title>Silly meme time</title>
  <link>http://lonnon.livejournal.com/39702.html</link>
  <description>&lt;ul&gt;
		&lt;li&gt;Grab the book nearest you. Right now.&lt;/li&gt;
		&lt;li&gt;Turn to page 56.&lt;/li&gt;
		&lt;li&gt;Find the fifth sentence.&lt;/li&gt;
		&lt;li&gt;Post that sentence along with these instructions on your LJ.&lt;/li&gt;
	&lt;/ul&gt;
	&lt;ul&gt;
		&lt;li&gt;Don&amp;#8217;t dig for your favorite book, the coolest, the most intellectual. Use the &lt;em&gt;closest&lt;/em&gt;.&lt;/li&gt;
	&lt;/ul&gt;

	&lt;blockquote&gt;
		&lt;p&gt;&lt;em&gt;Armadillos&lt;/em&gt;: This witty description of the armadillo was produced by the &lt;code&gt;descit&lt;/code&gt; environment.&lt;/p&gt;
	&lt;/blockquote&gt;

	&lt;p&gt;Alas, the nearest book to me is Leslie Lamport&amp;#8217;s &lt;cite&gt;L&lt;sup&gt;A&lt;/sup&gt;T&lt;sub&gt;E&lt;/sub&gt;X User&amp;#8217;s Guide and Reference Manual&lt;/cite&gt;.&lt;/p&gt;&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2008/11/24/silly-meme-time/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2008/11/24/silly-meme-time/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/39702.html</comments>
  <category>silly</category>
  <category>memes</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/39462.html</guid>
  <pubDate>Wed, 29 Oct 2008 00:57:00 GMT</pubDate>
  <title>Apache hinkyness</title>
  <link>http://lonnon.livejournal.com/39462.html</link>
  <description>&lt;p&gt;I encountered a weird web problem today when adding images to the &lt;a href=&quot;http://www.xkl.com&quot;&gt;company website&lt;/a&gt;. The new images I&amp;#8217;d added wouldn&amp;#8217;t appear on their page, and when pointing the browser directly at them, I received a 403 Forbidden error.&lt;/p&gt;

	&lt;p&gt;After insuring that the permissions and filenames were all correct, I sat down with the sysadmin to see if a second pair of eyes and a root login could find anything amiss. After spending half an hour of finding nothing in the logfile or permissions settings, we both gave up.&lt;/p&gt;

	&lt;p&gt;I returned to my desk, and on a whim, performed the following commands:&lt;br /&gt;
&lt;ol&gt;
	&lt;li&gt;&lt;code&gt;cp image-file.gif foo.gif&lt;/code&gt;&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;rm image-file.gif&lt;/code&gt;&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;mv foo.gif image-file.gif&lt;/code&gt;&lt;/li&gt;&lt;br /&gt;
&lt;/ol&gt;&lt;br /&gt;
I can&amp;#8217;t imagine why this would have solved the problem, but it did. The implications&amp;#8201;&amp;#8212;&amp;#8201that something might be messed up deep within the innards of Apache or the Fedora filesystem&amp;#8201;&amp;#8212;&amp;#8201make me worry what other bizarre behavior I can expect from the webserver in the future.&lt;/p&gt;

	&lt;p&gt;This isn&amp;#8217;t the first time machines have had odd behavior in my presence, which I&amp;#8217;ve been able to dispel by performing seemingly unrelated actions. I&amp;#8217;m obviously in the wrong business. I should pack my bags and hit the road as a traveling computer faith healer.&lt;/p&gt;&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2008/10/28/apache-hinkyness/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2008/10/28/apache-hinkyness/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/39462.html</comments>
  <category>wtf</category>
  <category>linux</category>
  <category>web</category>
  <category>apache</category>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/39289.html</guid>
  <pubDate>Wed, 03 Sep 2008 02:15:45 GMT</pubDate>
  <title>Only one</title>
  <link>http://lonnon.livejournal.com/39289.html</link>
  <description>&lt;p&gt;One of the best bits about being me: I have a unique name.&lt;/p&gt;

&lt;div style=&quot;color: #000;&quot;&gt;&lt;br /&gt;
&lt;table width=&quot;350&quot; bgcolor=&quot;#FFFFFF&quot; cellpadding=&quot;1&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;background-color: white; text-align: center;&quot;&gt;&lt;tr&gt;&lt;td style=&quot;background-color: #0066B3; color: white; font: 16px/1.1 Verdana, Arial, Helvetica, sans-serif;&quot;&gt;HowManyOfMe.com&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;border: 1px solid black;&quot;&gt;&lt;table width=&quot;100%&quot; bgcolor=&quot;#FFFFFF&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;background-color: white; text-align: center;&quot;&gt;&lt;tr&gt;&lt;td width=&quot;120&quot; style=&quot;padding-top: 2px;&quot;&gt;&lt;a href=&quot;http://howmanyofme.com&quot; style=&quot;text-decoration: none;&quot;&gt;&lt;img src=&quot;http://extimg.howmanyofme.com/extimages/howmany-logo.png&quot; alt=&quot;Logo&quot; width=&quot;100&quot; height=&quot;100&quot; style=&quot;border: 1px black&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;span style=&quot;font: 16px/1.1 Verdana, Arial, Helvetica, sans-serif; color: #000;&quot;&gt;There are&lt;br /&gt;
&lt;span style=&quot;color: red; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;br /&gt;
&lt;b&gt;or fewer&lt;/b&gt; people with my name in the U.S.A.&lt;/span&gt;&lt;br /&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;a style=&quot;color: #0066B3; text-decoration: underline; font: bold 16px/1.8 Verdana, Arial, Helvetica, sans-serif;&quot; href=&quot;http://howmanyofme.com&quot;&gt;How many have your name?&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;br /&gt;
&lt;/div&gt;&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2008/09/02/only-one/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2008/09/02/only-one/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/39289.html</comments>
  <category>names</category>
  <category>memes</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/38928.html</guid>
  <pubDate>Sat, 30 Aug 2008 10:26:46 GMT</pubDate>
  <title>iPhone clone window bookmarklet</title>
  <link>http://lonnon.livejournal.com/38928.html</link>
  <description>&lt;p&gt;Mobile Safari&amp;#8217;s multiple window interface is amazing, but it lacks the ability to explicitly open a link in a new window. Being a fan of tabbed browsing in desktop browsers, I find it irritating not to be able to leave the current window in place while I follow a link or two.&lt;/p&gt;

	&lt;p&gt;I don&amp;#8217;t have a clever hack to force Safari to open a link in a new window, but I do have the next best thing: a javascript bookmarklet that opens the current page in a new window. This makes following a link in a new window possible, if a bit inelegant.&lt;/p&gt;

&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;

	&lt;p&gt;To install the bookmarklet:&lt;/p&gt;

	&lt;p&gt;&lt;ol&gt;&lt;br /&gt;
&lt;li&gt;Drag the Clone Window link below to your bookmark bar in desktop Safari. Or if you sync to Internet Explorer, right-click the link and choose Add to Favorites, then save it to the Links folder.&lt;/p&gt;

	&lt;p&gt;&lt;a&gt;Clone Window&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;Now that you have the bookmarklet on your browser&amp;#8217;s link bar, connect your iPhone to your computer and sync bookmarks through iTunes.&lt;/li&gt;&lt;br /&gt;
&lt;/ol&gt;&lt;/p&gt;

	&lt;p&gt;To use the bookmarklet:&lt;/p&gt;

	&lt;p&gt;&lt;ol&gt;&lt;br /&gt;
&lt;li&gt;In Mobile Safari, tap the bookmarks button (open book icon) at the bottom of the screen.&lt;/li&gt;&lt;br /&gt;
&lt;li&gt;Locate the Clone Window bookmark; it&amp;#8217;s in the Bookmarks Bar folder if you sync with Safari, or in the Links folder if you sync with IE.&amp;lt;/ok&amp;gt;&lt;br /&gt;
&lt;li&gt;Tap the Clone Window bookmark. Mobile Safari opens a copy of the current page in a new window. You may now follow any link on the page, secure in the knowledge that the page you started from will still be there in another window.&lt;/li&gt;&lt;br /&gt;
&amp;lt;/ok&amp;gt;&lt;/p&gt;

	&lt;p&gt;Happy browsing!&lt;/p&gt;

&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2008/08/29/iphone-clone-window-bookmarklet/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2008/08/29/iphone-clone-window-bookmarklet/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;&lt;/ol&gt;</description>
  <comments>http://lonnon.livejournal.com/38928.html</comments>
  <category>iphone javascript tools</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/38826.html</guid>
  <pubDate>Sun, 17 Aug 2008 19:24:35 GMT</pubDate>
  <title>Jott is a mind boggling&amp;#8230;</title>
  <link>http://lonnon.livejournal.com/38826.html</link>
  <description>&lt;p&gt;Jott is a mind boggling cool technology. I&amp;#8217;m currently posting to my blog by calling a phone number and having it transcribe everything and stick it into a blog post. The future is here and man it&amp;#8217;s really damn cool. &lt;a href=&quot;http://www.jott.com/show.aspx?id=9d4068be-8611-43c9-baad-5b596666c9d1&quot; target=&quot;_blank&quot;&gt;listen&lt;/a&gt;&lt;/p&gt;

	&lt;p&gt;Powered by &lt;a href=&quot;http://jott.com&quot; target=&quot;_blank&quot;&gt;Jott&lt;/a&gt;&lt;/p&gt;&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2008/08/17/jott-is-a-mind-boggling/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2008/08/17/jott-is-a-mind-boggling/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/38826.html</comments>
  <category>technology</category>
  <category>iphone</category>
  <category>productivity</category>
  <lj:security>public</lj:security>
  <lj:reply-count>1</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/38524.html</guid>
  <pubDate>Sun, 10 Aug 2008 19:44:03 GMT</pubDate>
  <title>Running zsh on the iPhone</title>
  <link>http://lonnon.livejournal.com/38524.html</link>
  <description>&lt;p&gt;I jailbroke my iPhone 3G as soon as the &lt;a href=&quot;http://blog.iphone-dev.org&quot;&gt;iPhone Dev Team&lt;/a&gt; had posted their tool to do so, and ever since, I&amp;#8217;ve been screwing about with the command line. There&amp;#8217;s something deeply appealing to my inner nerd about having Unix on my phone, and recreational command line hacking is more fun for me than many of the games available for iPhone.&lt;/p&gt;

	&lt;p&gt;The one thing missing on my journey to mobile nerdvana was &lt;a href=&quot;http://www.zsh.org&quot;&gt;zsh&lt;/a&gt;, my favorite shell. Cydia had a zsh package available as soon as Pwnage Tool 2.0 came out, and I promptly installed it. Unfortuanately, though I was able to run zsh from the command line, I couldn&amp;#8217;t figure out how to set it as the default login shell.&lt;/p&gt;

&lt;a name=&quot;cutid1&quot;&gt;&lt;/a&gt;

	&lt;p&gt;Well, a bit of googling later, and I found out that on the iPhone (and possibly Mac OS X, whence iPhone derives much of its unixy goodness) editing &lt;code&gt;/etc/passwd&lt;/code&gt; won&amp;#8217;t do the trick. In fact, there&amp;#8217;s a big fat comment at the head of &lt;code&gt;/etc/passwd&lt;/code&gt; that informs you that editing it won&amp;#8217;t be particularly useful:&lt;/p&gt;

	&lt;p&gt;&lt;textarea readonly=&quot;readonly&quot; wrap=&quot;off&quot; style=&quot;width: 100%; font-family: Monaco, &amp;#39;Courier New&amp;#39;, Courier, monospace; font-size: 85%;&quot;&gt;
 # Note that this file is not consulted for login.
 # It only exisits for compatability with 4.3BSD utilities.&lt;/textarea&gt;&lt;/p&gt;

	&lt;p&gt;How then to set up default shells? Edit &lt;code&gt;/etc/master.passwd&lt;/code&gt;, of course. iPhone uses this file as its authoritative user database, and changes to the login shell in this file work quite well. Change &lt;code&gt;/bin/sh&lt;/code&gt; to &lt;code&gt;/bin/zsh&lt;/code&gt; at the ends of the root and mobile lines, and you&amp;#8217;re good to go. Here&amp;#8217;s /etc/master.passwd after I&amp;#8217;ve modified it for zsh goodness:&lt;/p&gt;

	&lt;p&gt;&lt;textarea rows=&quot;13&quot; readonly=&quot;readonly&quot; wrap=&quot;off&quot; style=&quot;width: 100%; font-family: Monaco, &amp;#39;Courier New&amp;#39;, Courier, monospace; font-size: 85%;&quot;&gt;
 ##
 # User Database
 #
 # This file is the authoritative user database.
 ##
 nobody:*:-2:-2::0:0:Unprivileged User:/var/empty:/usr/bin/false
 root:rootpassword:0:0::0:0:System Administrator:/var/root:/bin/zsh
 mobile:password:501:501::0:0:Mobile User:/var/mobile:/bin/zsh
 daemon:*:1:1::0:0:System Services:/var/root:/usr/bin/false
 _securityd:*:64:64::0:0:securityd:/var/empty:/usr/bin/false
 _mdnsresponder:*:65:65::0:0:mDNSResponder:/var/empty:/usr/bin/false
 _sshd:*:75:75::0:0:sshd Privilege separation:/var/empty:/usr/bin/false
 _unknown:*:99:99::0:0:Unknown User:/var/empty:/usr/bin/false&lt;/textarea&gt;&lt;/p&gt;

	&lt;p&gt;Note that you must be logged on as root to edit &lt;code&gt;/etc/master.passwd&lt;/code&gt;.&lt;/p&gt;&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2008/08/10/running-zsh-on-the-iphone/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2008/08/10/running-zsh-on-the-iphone/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/38524.html</comments>
  <category>zsh</category>
  <category>hacking</category>
  <category>iphone</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/38295.html</guid>
  <pubDate>Wed, 23 Jul 2008 00:25:15 GMT</pubDate>
  <title>Finally moblogging</title>
  <link>http://lonnon.livejournal.com/38295.html</link>
  <description>&lt;p&gt;WordPress for iPhone is finally out, which gives me the opportunity to post random stuff from wherever I&amp;#8217;m standing, assuming I&amp;#8217;m standing within range of AT&amp;#038;T&amp;#8217;s wireless system.&lt;/p&gt;

	&lt;p&gt;This is the kind of thing I&amp;#8217;ve wanted for years, and though there have been ways to do this for some time now, they&amp;#8217;ve all been too clunky, expensive, or both for me to stay interested in them too long.&lt;/p&gt;

	&lt;p&gt;I can even include pictures right from the phone, which might never get old:&lt;br /&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.nyerm.com/wp-content/uploads/2008/07/p-640-480-732d7ad4-d4c0-4cb4-a640-c9c37fe0b2ea.jpeg&quot;&gt;&lt;img src=&quot;http://blog.nyerm.com/wp-content/uploads/2008/07/p-640-480-732d7ad4-d4c0-4cb4-a640-c9c37fe0b2ea.jpeg&quot; alt=&quot;photo&quot; width=&quot;225&quot; height=&quot;300&quot; class=&quot;alignnone size-full wp-image-364&quot; /&gt;&lt;/a&gt;&lt;/p&gt;&lt;/p&gt;&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2008/07/22/finally-moblogging/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2008/07/22/finally-moblogging/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/38295.html</comments>
  <category>wordpress</category>
  <category>moblogging</category>
  <category>iphone</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/37855.html</guid>
  <pubDate>Sat, 19 Jul 2008 04:44:29 GMT</pubDate>
  <title>Sweet ride</title>
  <link>http://lonnon.livejournal.com/37855.html</link>
  <description>&lt;p&gt;&lt;a href=&quot;http://www.flickr.com/photos/lonnon/2680786257/&quot; class=&quot;tt-flickr tt-flickr-Small&quot;&gt;&lt;img class=&quot;thumb&quot; src=&quot;http://farm4.static.flickr.com/3246/2680786257_8d5766d217_m.jpg&quot; alt=&quot;Failmobile&quot; title=&quot;Failmobile&quot; width=&quot;240&quot; height=&quot;180&quot; border=&quot;0&quot; /&gt;&lt;/a&gt; It&amp;#8217;s long been surmised by tuners and drift racing fanatics that stickers not only add to the aesthetic of your automobile, they can actually make your car go faster. If you extend this theory a bit further, you realize that &lt;em&gt;lots&lt;/em&gt; of stickers will turn your Honda into a &lt;em&gt;hypersonic missile of cool&lt;/em&gt;.&lt;/p&gt;

	&lt;p&gt;That&amp;#8217;s the theory. In practice, it makes you look like a complete dufus. Case in point: Mr. G. Antonov, better known to his friends as &amp;#8220;Jawls,&amp;#8221; as it&amp;#8217;s written on the driver&amp;#8217;s side door. He&amp;#8217;s obviously put this machine through its paces, though; this isn&amp;#8217;t some prettied-up curb queen with a big stereo in it. Have a look at the &lt;a href=&quot;http://flickr.com/photos/lonnon/sets/72157606249416917/&quot;&gt;Flickr set&lt;/a&gt; for all the stunning details.&lt;/p&gt;

	&lt;p&gt;I can respect that it&amp;#8217;s a &lt;em&gt;real&lt;/em&gt; Japanese Honda. This baby&amp;#8217;s got right-hand drive. I only wish him the best of luck next time he visits a drive thru.&lt;/p&gt;&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2008/07/18/sweet-ride/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2008/07/18/sweet-ride/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/37855.html</comments>
  <category>cars commute photos</category>
  <category>uncategorized</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>http://lonnon.livejournal.com/37543.html</guid>
  <pubDate>Sat, 19 Jul 2008 01:13:13 GMT</pubDate>
  <title>Crossposting to LiveJournal</title>
  <link>http://lonnon.livejournal.com/37543.html</link>
  <description>&lt;p&gt;I&amp;#8217;ve been slowly warming to LiveJournal, not because I love its interface or features, but because I have a number of friends over there I keep tabs on. I post infrequently enough to this blog, and coming up with more posts to put in a LJ seems far-fetched, at best.&lt;/p&gt;

	&lt;p&gt;To the rescue: the &lt;a href=&quot;http://lj-xp.com/&quot;&gt;LiveJournal Crossposter&lt;/a&gt;, a WordPress plugin that automatically copies posts from my blog to my LJ as I make them. I was going to let it copy every post from here to LJ, but that went poorly; somewhere after the first hundred posts or so, the plugin tried to shove some malformed &lt;span class=&quot;caps&quot;&gt;XML&lt;/span&gt; at LiveJournal, and its parser barfed with a delightful Perl error message.&lt;/p&gt;

	&lt;p&gt;As a result, I only managed to push posts from 2003, and not wanting a gap in there, I went through and deleted them all from LJ. By hand. This is why I&amp;#8217;m using WordPress. I do stupid power-user stuff like this all too often.&lt;/p&gt;

	&lt;p&gt;With any luck, this should be my first post on LiveJournal. To those of you following my blank LJ already: hello, and I apologize if I just spammed your friends pages with a honking huge pile of old posts that are now deleted. With even more luck (and possibly a miracle or two), I&amp;#8217;ll post things often enough to make it interesting for people.&lt;/p&gt;&lt;p style=&quot;border: 1px solid black; padding: 3px;&quot;&gt;&lt;strong&gt;Originally published at &lt;a href=&quot;http://blog.nyerm.com/2008/07/18/crossposting-to-livejournal/&quot;&gt;nyerm&lt;/a&gt;. You can comment here or &lt;a href=&quot;http://blog.nyerm.com/2008/07/18/crossposting-to-livejournal/#comments&quot;&gt;there&lt;/a&gt;.&lt;/strong&gt;&lt;/p&gt;</description>
  <comments>http://lonnon.livejournal.com/37543.html</comments>
  <category>blogging</category>
  <category>wordpress</category>
  <category>livejournal</category>
  <category>uncategorized</category>
  <category>administrivia</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
</channel>
</rss>
