WP-mass-upgrade

I’ve released the simple shell script I use to batch-upgrade dozens of WordPress installations at once, both on the Birdhouse server and at the J-School. It requires that all WP installations you want to track be subversion checkouts. Probably not useful for very many people, but the topic came up on the uwebd list, so thought I’d put it out there.

Get it here.

Music: Stereolab :: Rainbo Conversation

gpx2ipod 1.3

Version 1.3 of my “geocaching with an ipod” system gpx2ipod is now available, with an all-new interface for establishing text encoding / international character sets. So all you Swedish and Russian and Chinese cachers should now see your native language rendered with all the proper characters on your iPods!

This update based in part on GPL’d contributions from a volunteer Swedish developer. This kind of collaboration is what open source is all about – on my own, I may never have gotten around to looking into the ins and outs of dealing with non-English charsets in gpsbabel and on the iPod. That wasn’t my personal itch that needed scratching, but it was someone else’s. Working together, everyone itches less :)

Music: The Slits :: Ping Pong Affair

gpx2ipod: Mac-Based Paperless Caching Redux

I’ve written a script – gpx2ipod – to enable Mac-based paperless geocaching with an iPod.

Mac-based paperless caching for people who own an iPod but not a PDA. Batch-converts a pile of .gpx files to plain text for use with the iPod’s “Notes” feature. Super-fast — cut your geocaching prep time to a few minutes. gpx2ipod handles both individual and Pocket Query (multiple-cache).gpx files. Cache files will display alphabetically on the iPod for easy access in the field. gpx2ipod can inject generated text files directly into your iPod (most users) or into a local “output” folder (you might not have an iPod but might still want the text files for other purposes). gpx2ipod is a Terminal application (shell script), but can be run painlessly with a double-click — no shell experience required.

The script requires gpsbabel 1.3.4 or higher, and can be downloaded either with or without gpsbabel bundled.

For me, it’s been a very fast way to reduce prep time before going caching – I can now build and receive a pocket query from geocaching.com, then load hundreds of waypoints into the GPSr and all of their metadata into the iPod in a few minutes (previously I had to selectively print out data pages for each cache I intended to visit – a laborious and wasteful process).

Just received an email from a super-happy beta tester who’s as excited by this as I am – gratifying to know I’m not just barking up my own tree. A future version will feed gpx files to the GPSr and text files to the iPod in the same run.

This tool is also available through VersionTracker.

This is the official support / comment page for gpx2ipod.

.command for OS X Shell Scripts

For the next version of gpx2txt, I was looking into AppleScript wrappers and other methods so users wouldn’t be required to run Terminal.app, when I discovered that under OS X you can rename a shell script with the “.command” extension and it’ll run with a double-click. Works a treat – no path issues even. Next version will be much more user-friendly.

Music: Manu Chao :: Luna y Sol

beer.pl

Jaw-dropping for geeks, probably an utter bore for everyone else. Download this perl script to a machine with perl installed and run it from the command line. Whoop-dee-doo, right? Now, open it up in an editor. Holy mother of Shiva. As mneptok says, “Some people have too much time on their hands.”

Music: Tom Waits :: Get Behind The Mule

Paperless Caching for Mac Users

Update: gpx2txt has been superceded by gpx2ipod – please visit that page for up-to-date info and discussions.

Downside of geocaching: The time it takes to prepare notes, making sure you’ll have access to hints and other people’s logs when you get there, etc. And the printing it requires doesn’t feel good from an eco perspective. All this data is available in .gpx files on geocaching.com, but most GPS units won’t display that data.

Paperless caching is where it’s at, but generally assumes you have a PDA. So what if you have an iPod but no PDA? The iPod has this much-overlooked “Notes” feature – mount an iPod, look in the Finder for the Notes folder, and drop in text files.

Amazingly, I haven’t been able to find anything that does this cleanly on the Mac. MacCaching is interesting, but (strangely) sends entries to Address Book rather to Notes, and doesn’t preserve any of the metadata you need on the trail. The workhorse utility gpsbabel is able to convert .gpx files to plain text (usable with iPod Notes), but the GUI version isn’t capable of batch operations. So I wrapped a shell script around the command-line version of gpsbabel to help Mac users do paperless caching with an iPod.

gpx2ipod takes a folder full of .gpx files and converts them to plain text, then injects them directly into an iPod’s Notes folder.

In the future I’ll try and re-package this as an Automator action, no Terminal required.

Update: Version 0.2 is now available, and handles both individual .gpx files and Pocket Query-generated multiple-cache .gpx files.

Update 2: gpx2txt has been completely rewritten as gpx2ipod – now much more user-friendly, with stored preferences and all kinds of bells and whistles.

Go PHP5

PHP4 is seven years old now (amazing!), and PHP5 has been out for nearly three years. But while v4 has gotten pretty long in the tooth, the massive entrenchment of web apps targeted at PHP4 has prevented anything like rapid uptake for version 5. As many as 80% of PHP hosts were still running 4.x as of June 2007. Web hosts who undertake an upgrade risk breaking thousands of customer applications – not OK. But something’s got to break the cycle, which is preventing developers from taking full advantage of all the chocolaty, O-O goodness in v5.

GoPHP5.org is assembling a list of major open source PHP apps committed to dropping all support for v4 by February 2008 as a way to goad hosts into undertaking the difficult transition. The Drupal, Symfony, and phpMyAdmin teams have already signed on, while the WordPress hackers are eager, but wary of the fallout.

Music: Kalama’s Quartet :: Maile Lau Li’ili’i (Little Maile Leaves)

PHP Inside Image Files

Interesting new hack in the wild – embedding PHP (or other*) code inside an otherwise valid image file. And why would anyone do that? Think of a site that allows users to upload avatars or icons or other images, then displays those images back to the public. If the site isn’t taking sufficient precautions during the upload and display stages, a hacker could create an image file with PHP embedded in the byte stream, then name their file myfile.gif.php. A site that then sloppily displayed whatever images were uploaded to it would then display the image inline, and its embedded code would be executed.

The kicker is that even if your site is doing common checks to verify that it’s dealing with a standard image file, such as running the getimagesize() function on it first, those tests may yield a false positive, since the first n bytes check out just fine. You need to verify the filename extension as well, and not serve images from a directory that’s PHP-interpreted. Other suggestions in the article at PHP Classes.

* There’s no reason this same hack wouldn’t work with .ASP or .NET or ColdFusion sites as well, or with image formats other than GIFs.

Music: Tom Verlaine :: Rings

Shell Scripting Class

Decided to further my career and become UNIX certified. Have never taken a computer class in all this time; everything I know I’ve learned “on the road” over the years. I’ll be taking a series of classes through UC Extension one evening a week — a series that will last several semesters, since I have limited time to dedicate. The first class wasn’t scheduled for this semester, so am starting with a shell scripting class taught by John Muster, a gentle and wise Einstein-like figure. His book UNIX Made Easy is our text — he sees the book as a “sherpa,” which I can relate to.

Did a ton of shell scripting in the BeOS days (the 1,000-line RipEnc was my piece de resistance) and so thought I could coast through this, but after tonight, it’s immediately apparent we’ll be rowing this boat hard. Entire first session was on vi; I’ve got enough vi to get things done (which is exactly the level of knowledge he presupposed), but Muster wants advanced vi/vim usage to be like breathing.

Music: The Flaming Lips :: All We Have Is Now