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.
Originally published at nyerm. You can comment here or there.
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 the rest of this entry » )Originally published at nyerm. You can comment here or there.
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
Originally published at nyerm. You can comment here or there.
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.
Originally published at nyerm. You can comment here or there.
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 the rest of this entry » )Originally published at nyerm. You can comment here or there.
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.
Originally published at nyerm. You can comment here or there.
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.
Originally published at nyerm. You can comment here or there.
Spurred by my need to upload a bunch of notes from the now-defunct Stikkit to my account on Helipad, I wrote a Ruby wrapper for Helipad’s XML-over-HTTP API. The interface takes care of all the XML magic, letting you concentrate on the fun stuff: playing with your documents on Helipad.
hp = Helipad.new("lonnon@example.com",
"password")
source = File.read("cake_recipe.txt")
response = hp.create(:title => "Cake",
:tags => "recipe",
:source => source)
puts "Recipe saved" if response.saved?
The Helipad Ruby interface can be installed through rubygems:
gem install Helipad --remote
Documentation is available here:
If you’re interested in the source code and current state of development, you can find the Helipad Ruby interface over on RubyForge:
Originally published at nyerm. You can comment here or there.
- Grab the book nearest you. Right now.
- Turn to page 56.
- Find the fifth sentence.
- Post that sentence along with these instructions on your LJ.
- Don’t dig for your favorite book, the coolest, the most intellectual. Use the closest.
Armadillos: This witty description of the armadillo was produced by the
descitenvironment.
Alas, the nearest book to me is Leslie Lamport’s LATEX User’s Guide and Reference Manual.
Originally published at nyerm. You can comment here or there.
I encountered a weird web problem today when adding images to the company website. The new images I’d added wouldn’t appear on their page, and when pointing the browser directly at them, I received a 403 Forbidden error.
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.
I returned to my desk, and on a whim, performed the following commands:
cp image-file.gif foo.gifrm image-file.gifmv foo.gif image-file.gif
I can’t imagine why this would have solved the problem, but it did. The implications — that something might be messed up deep within the innards of Apache or the Fedora filesystem — make me worry what other bizarre behavior I can expect from the webserver in the future.
This isn’t the first time machines have had odd behavior in my presence, which I’ve been able to dispel by performing seemingly unrelated actions. I’m obviously in the wrong business. I should pack my bags and hit the road as a traveling computer faith healer.
Originally published at nyerm. You can comment here or there.
Mobile Safari’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.
I don’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.
( Read the rest of this entry » )Originally published at nyerm. You can comment here or there.
Jott is a mind boggling cool technology. I’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’s really damn cool. listen
Powered by Jott
Originally published at nyerm. You can comment here or there.
I jailbroke my iPhone 3G as soon as the iPhone Dev Team had posted their tool to do so, and ever since, I’ve been screwing about with the command line. There’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.
The one thing missing on my journey to mobile nerdvana was zsh, 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’t figure out how to set it as the default login shell.
( Read the rest of this entry » )Originally published at nyerm. You can comment here or there.
WordPress for iPhone is finally out, which gives me the opportunity to post random stuff from wherever I’m standing, assuming I’m standing within range of AT&T’s wireless system.
This is the kind of thing I’ve wanted for years, and though there have been ways to do this for some time now, they’ve all been too clunky, expensive, or both for me to stay interested in them too long.
I can even include pictures right from the phone, which might never get old:
Originally published at nyerm. You can comment here or there.
It’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 lots of stickers will turn your Honda into a hypersonic missile of cool.
That’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 “Jawls,” as it’s written on the driver’s side door. He’s obviously put this machine through its paces, though; this isn’t some prettied-up curb queen with a big stereo in it. Have a look at the Flickr set for all the stunning details.
I can respect that it’s a real Japanese Honda. This baby’s got right-hand drive. I only wish him the best of luck next time he visits a drive thru.
Originally published at nyerm. You can comment here or there.
I’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.
To the rescue: the LiveJournal Crossposter, 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 XML at LiveJournal, and its parser barfed with a delightful Perl error message.
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’m using WordPress. I do stupid power-user stuff like this all too often.
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’ll post things often enough to make it interesting for people.
Originally published at nyerm. You can comment here or there.


