August 4, 2009 – 12:45 pm
Here’s a trick I had to relearn to get SSH to make a key-authenticated connection in a Cygwin environment. I have my Windows user directory (c:\Users\lonnon) set as my home directory via the HOME environment variable, but many Cygwin programs, like SSH, look for the home directory within Cygwin’s own bizarre little directory structure, at c:\cygwin\home\lonnon (/home/lonnon in Cygwin’s file space). Because my .ssh directory, which contains my key files, isn’t located where Cygwin wants it, I get a “Permission denied (publickey)” error when attempting to connect.
The solution was so simple, I forgot that I’d already done it on my older laptop. I removed the home directory provided by Cygwin and replaced it with a symbolic link to my “real” home directory.
> cd /home
> rm -rf lonnon
> ln -s /cygdrive/c/Users/lonnon lonnon
Yay, presto, it works. Both ssh and scp can find my keys now.
August 4, 2009 – 11:48 am
This is the kind of stuff that drives me absolutely bonkers about Windows. I run Console as a command prompt replacement, and I just installed it on a brand new Vista machine. Unfortunately, every time I ran it, I’d get a security warning similar to this:

Read More »
I have a brand spanking new laptop, and it needs a brand spanking new Ruby on Rails development environment. This being Windows, the only sane way to get a good pile of development tools and a usable shell is to install Cygwin. I’ve had it set up on the old laptop for a while now, and while it’s slow (mostly because that laptop is old, and therefore slow), it works well as a Rails environment.
Of course, every time I set this up there has to be a snag in the process, right? Rails hasn’t shipped with MySQL support for a few versions now, so it’s necessary to manually install a MySQL gem. Unfortunately, there aren’t any library files available for Rubygems to compile against, because the Windows version of MySQL doesn’t install any. If it did, they’d be somewhere Cygwin wouldn’t know about them, anyhow; the MySQL folks don’t officially support Cygwin.
Read More »
I’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 git commit command does its thing, prevents me from committing files until I’ve removed whitespace characters from the ends of all the lines in the files. Cleaning out such whitespace is good practice if you’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.
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’m looking at you, RSpec). When I found that the rake db:migrate task adds trailing whitespace to the schema.rb file, I nearly went ballistic. I’d be okay with keeping the whitespace out of my own code, because I’m just OCD enough to enjoy the exercise, but having to fix code generated by automation tools just pisses me off.
Read More »
March 21, 2009 – 11:32 am
I’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 fun, 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.
Read More »
The Helipad Ruby interface is now available on GitHub in addition to its original home on RubyForge.
There’s no difference at all between the two, apart from the GitHub copy bearing my name, which is GitHub’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:
> gem sources -a http://gems.github.com
> sudo gem install lonnon-Helipad
February 20, 2009 – 1:58 am
Earlier in the week I posted about making dynamic RESTful routes in Rails. At the end of the article, I mentioned that the method I was using might not work in a production environment, and after searching Agile Web Development with Rails for the word “restart,” 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 URLs.
To recap, I’ve already used map.resources to generate the usual http://example.com/sections/1 style of REST URL. I want to be able to route a URL like http://example.com/about to the show method of my Sections controller, as well, to improve human readability (and SEO) of the URL.
Read More »
February 18, 2009 – 6:17 pm
After generating a table of contents for a multi-document InDesign book, I tried to export the book to PDF. Adobe InDesign CS3 fell right over, presenting me with the friendly “please tell our developers what the hell you were doing that crashed our fine software” dialog.
When generating the table of contents (Layout > Table of Contents), I selected the Create PDF Bookmarks option. If I omitted the bookmarks, InDesign was able to export a PDF without any trouble, but of course, the PDF 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.
Read More »
February 16, 2009 – 8:02 pm
I’m slowly becoming a convert to the RESTful routing model in recent versions of Rails, largely because it builds a pile of useful named routes with a tiny amount of code. If I put map.resources :sections in my routes.db file, I instantly get sections_path, edit_section_path, and all their friends. When coding a controller, it’s a lot nicer to write redirect_to section_path than redirect_to :controller => :section, :action => show.
The only difficulty I have with default routes created by map.resources is that, in some cases, they’re ugly and show too much of the application’s internal workings. For example, the application I’m working on now has a Section model, which describes a major section heading in the site (things like About, FAQ, and Help). Instead of having weird routes like /sections/1, I want human-readable URLs like /about. They look nicer, and they’re better for SEO.
Read More »
February 11, 2009 – 3:48 pm
There’s something extraordinarily wrong about this. I just discovered, through Barry Hess’ blog, that TextMate has a blogging bundle. It hooks up to the ubiquitous XML-RPC 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.
This is a far more comfortable interface for composing blog articles than any I’ve encountered, including the feature-rich web interface in Wordpress itself. I don’t use the embedded WYSIWIG editor widget in Wordpress, preferring to format my posts with Textile 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’re doing the markup right without getting in the way of the writing.
On top of that, I’ve got the security of knowing that my prose isn’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 “no muss, no fuss.”
Now to see if this bundle works as well in TextMate’s Windows cousin, e, so I can get the same great feature on my laptop that I have on the iMac at work.
UPDATE (2009-02-11 21:03): Yes, indeed, this same power exists in e. I am one happy camper.