Dave Schweisguth in a Bottle

How many meanings of that can you think of?

Archive for March 2011

Migrating Palm application data to Android

leave a comment »

There can’t be many other people left in the world who have a Palm device whose data they want to move to something newer. I mostly used my series of Palm devices for their built-in productivity applications (Contacts, Calendar, Memos, Tasks) and I was happy with the most recent, a Treo, for six years. Although it’s surprisingly tough, having survived many falls onto concrete sidewalks with only a few scratches, I finally managed to break a few pixels in its screen recently. And the Palm Desktop software doesn’t run on Mac OS later than 10.4, so when I finally retire the older of my Mac laptops I won’t be able to sync the Treo. Time to move on.

Another reason I kept the Treo as long as I did is that I wasn’t looking forward to the migration. I’ve used Palms for twelve years, and I intend to keep my data. I expected it would be a significant project to move it all over. It wasn’t as bad as I feared —  Palm Desktop was prepared to bow out gracefully, in that it could export all of its data into standard or at least reasonable formats — but it took enough experimentation and fiddling that I’ve written it down here on the off chance that it will help someone else who still has this job ahead of them.

Read the rest of this entry »

Advertisements

Written by dschweisguth

March 15, 2011 at 21:58

Posted in Android, Palm, Ruby

Page caching vs. RESTful routes in Rails

leave a comment »

GWW is almost six years old. It began life on Rails 1. It’s picked up on many of the improvements to Rails made since then, but not all of them. One upgrade that remains to be done is to take more advantage of Rails’ RESTful routing. (Yes, that’s a link to the Rails 2.x docs; GWW is waiting on a Phusion Passenger bug to move to Rails 3.)

I recently added a new model type and set of page to GWW — it now explicitly tracks ScoreReports — and took the opportunity to begin using RESTful routes. It worked beautifully; I really appreciate being able to lay down a whole set of standard, named routes with so little code. But when I pushed the score reports tracking feature to production, it broke: creating a new score report (done by pushing a button to submit a form) did nothing, only refreshed to the index view with no new score report at the top. After a little head-scratching and watching the form submission with Live HTTP Headers, I realized that, like seemingly every only-in-production bug, the problem was due to caching.

Read the rest of this entry »

Written by dschweisguth

March 5, 2011 at 17:58

Posted in Programming, Rails, Ruby

Homebrewed ActiveRecord test object factories for rspec

leave a comment »

I recently took GWW from a handful of Test::Unit tests to 100% test coverage. It took some good tools (rspec and RR (Double Ruby) are both terrific), but what I didn’t do was use either of the widely used test object factory libraries, factory_girl or Machinist. I wasn’t going to use Rails fixtures, either — fixtures are just wrong — but the factory libraries rubbed me the wrong way. I could point to bits of each tool that weren’t exactly what I wanted, but the real reason I didn’t use either one was that they both seemed a little much when all I wanted to do was construct a few objects. Yes, I recognized the sound of a wheel about to be reinvented, but I went ahead anyway, and I ended up with a small amount of code very well tuned to my needs, and a couple of nice features that I don’t think the off-the-shelf solutions provide.

Read the rest of this entry »

Written by dschweisguth

March 2, 2011 at 10:01

Posted in Programming, Rails, Ruby, Testing