This blog is deprecated in favor of my new blog, Crafting Cruft.

Please enjoy the fine new content you’ll find there, and thanks for visiting.

Posted in Uncategorized | Comments closed

Installing RubyOSA on Mac OS X Lion

I recently decided to do some scripting of a Mac app, but I wanted to avoid touching AppleScript, because… well, because it’s not fun. RubyOSA is the natural choice for someone who likes Ruby, since it lets you skip the AppleScript step and go straight to the Apple Event “metal.” However, on modern systems (e.g. Lion), RubyOSA has trouble compiling the native gem extensions necessary for installation. It also doesn’t play well with Ruby 1.9. So, here are the basic steps I used to get it working.

  1. Install RVM
  2. Install and activate Ruby 1.8.7 via rvm install 1.8.7; rvm 1.8.7
  3. Get jrom’s patched version of RubyOSA that supports modern OS X
  4. Install the gem from source:
    1. ruby extconf.rb
    2. make
    3. make install

And now you should have a working installation of RubyOSA. Script away!

Posted in code | Comments closed

Dealing with Asset Compression in Android Apps

When developing an Android app, any data file, image or XML file (that is, any Resource or Asset) you use is bundled into your application package (APK) for distribution. The Android Asset Packaging Tool, or aapt, is responsible for creating this bundle, which you can think of as a ZIP file with a particular layout that the Android OS can understand. When your application is installed, whether in development mode or by an end user, this APK file is simply dropped into a special location on the device’s (or emulator’s) filesystem.

As part of preparing your APK, aapt selectively compresses various assets to save space on the device. The way aapt determines which assets need compression is by their file extension. The following code, taken from Package.cpp in the aapt source code, sheds some light on which types of files are not compressed by default:

/* these formats are already compressed, or don't compress well */
static const char* kNoCompressExt[] = {
    ".jpg", ".jpeg", ".png", ".gif",
    ".wav", ".mp2", ".mp3", ".ogg", ".aac",
    ".mpg", ".mpeg", ".mid", ".midi", ".smf", ".jet",
    ".rtttl", ".imy", ".xmf", ".mp4", ".m4a",
    ".m4v", ".3gp", ".3gpp", ".3g2", ".3gpp2",
    ".amr", ".awb", ".wma", ".wmv"

The only way (that I’ve discovered, as of this writing) to control this behavior is by using the -0 (zero) flag to aapt on the command line. This flag, passed without any accompanying argument, will tell aapt to disable compression for all types of assets. Typically you will not want to use this exact option, because for most assets, compression is a desirable thing. Sometimes, however, you will have a specific type of asset (say, a database), that you do not want to apply compression to. In this case, you have two options.

First, you can give your asset file an extension in the list above. While this does not necessarily make sense, it can be an easy workaround if you don’t want to deal with aapt on the command line. The other option is to pass a specific extension to the -0 flag, such as -0 db, to disable compression for assets with that extension. You can pass the -0 flag multiple times, and each time with a separate extension, if you need more than one type to be uncompressed.

Currently, there is no way to pass these extra flags to aapt when using the ADT within Eclipse, so if you don’t want to sacrifice the ease of use of the GUI tools, you will have to go with the first option, and rename your file’s extension.

So, Why Disable Compression Anyway?

For most types of assets, you shouldn’t need to be concerned with how they are packaged. Given the list of extensions above, Android will do the right thing for a large subset of the files you’ll use. If you have a type of asset that is already compressed by nature of the file type, but doesn’t have one of the sanctioned extensions, you can typically ignore that inconsistency and just allow aapt to try to compress it. It will not be very much, if at all, smaller in the final APK, but the performance hit should be relatively minimal unless you just have tons of these files.

This begs the question, why even bother disabling compression? The not-so-obvious answer is that prior to Android 2.3, any compressed asset file with an uncompressed size of over 1 MB cannot be read from the APK. This could come into play if your asset needed to be copied out of the APK and into the app’s writable files area, for example to provide a pre-populated database in your app. When you try to use the various AssetManager or Resources classes’ methods to get an InputStream to the file, it will throw an exception and display a LogCat message like this:

DEBUG/asset(725): Data exceeds UNCOMPRESS_DATA_MAX (1662976 vs 1048576)

The only way around this type of issue is to disable compression for assets that exceed the 1 MB limit. If your file format supports it, you can choose to split the asset into several smaller files that have an uncompressed size of less than 1 MB each, but this can be a real annoyance.

Hopefully the knowledge in this post can help you avoid the headaches I went through to learn it!

Update March 1, 2011: The limit on the uncompressed size of compressed assets was removed in Android 2.3. So someday in the future, when you don’t have to worry about Android versions lower than 2.3, you can avoid this heartache.

Posted in android | Comments closed

Announcing Photos of the Beltline

I am pleased to announce the public availability of a site that I have been working on for over a year now. Photos of the BeltLine is a project of Ruth Dusseault, Artist in Residence at the Georgia Tech College of Architecture, designed to engage college-level students and instructors from around Atlanta in the collaborative effort of documenting the BeltLine and its surrounding territory as it evolves.

Created using the lovely Ruby on Rails, the site integrates the Google Maps API to provide a means for the photographers to place their work on a map of the BeltLine. While the current exhibition features are fairly basic, enhancements are planned that will allow visitors to more easily find photos based on several criteria, including the date they were taken and the user who uploaded them in addition to a full text search.

Beginning tonight, January 10th, there is an exhibit entitled Re\constructing Atlanta: A Contemporary Continuum at the Georgia State University Ernest G. Welch School of Art & Design Gallery, located at the corner of Peachtree Center Ave and Gilmer St downtown. Coverage of the site and the event has been featured in Monday’s AJC, as well.

For more information about the BeltLine, visit the official web site. To find out more about what Ponystyle Industries can do for you, feel free to contact me at

Posted in events, ponystyle | Comments closed

Trials and Errors in Data Transfer

A project that I’ve long been neglecting is the transfer of around 200GB of data from some old hard drives that were in a Linux PC that I had in operation a couple of years ago. What would have ordinarily been a rather trivial task is complicated by the fact that the drives are tethered together via LVM, and they can only be easily read while all simultaneously installed in a Linux environment.

The saga has been ongoing for some time, and it is now in dire need of a happy ending. It has destroyed or temporarily disabled at least four machines and left anger and frustration in its wake. A recent weekend in Knoxville found my friend Joe and I spending several hours attempting to first install the drives in a rather old 2U rack-mount server, only to find that it wouldn’t power on afterwards. Subsequently we moved the drives into an even more ancient 4U server, which would boot up just fine and then switch into a graphics mode that his modern LCD monitor couldn’t understand.

To hold the data, I’ve procured a totally sweet-sounding 500GB Fantom Drives GForce Megadisk, but I’ve yet to even plug the thing in since all of these hardware problems have been distracting me.

My latest plan involves not an actual Linux machine at all, but a virtual machine created by VMWare Fusion. Then I can get no less than three external hard drive enclosures for these old drives and a USB hub that will allow me to plug in all four drives into the girlfriend’s Macbook Pro. Then I’ll boot a Linux live cd of some flavor in a Fusion VM, configure all the drives as an LVM group again, and copy all the data to the new drive, lickety-split.

After all this, I’ll have three old drives in external enclosures that I suppose I could use for storing other things. Perhaps I can just borrow some enclosures from someone and save the unnecessary purchase there. Maybe I can just “borrow” them from the store and return them when I’m done.

Needless to say, the adventure continues. I hope it ends soon.

Posted in nerdery | Comments closed

Who wants to rig an election?

As you may have already seen, some smart folks at Princeton’s Center for IT Policy recently discovered something that I think we all suspected was possible: Diebold voting machines are ridiculously insecure.

Here is a telling video that proves the point nicely:

I encourage you to contact Georgia Secretary of State Cathy Cox and let her know you won’t stand for such shoddy technology at our polling places. If you don’t live in Georgia, your state may also be using Diebold machines or other shoddy equipment. Black Box Voting is a good place to find more information.

Posted in elections, security | Comments closed

REI Live Help is amazing

I needed to retrieve my member number and update my info with REI, and I noticed this convenient link to their Live Help feature on the Member Help page. I’ve always been a little skeptical of these things, but I figured I’d give it a shot. Here is a transcript of the end of our conversation:

Carolyn L: (Your replacement membership card should arrive in two to three weeks. Your member number will remain the same.)
Carolyn L: Is there anything else I can help you with this afternoon?
Me: My girlfriend, who lives in Seattle, is requesting a sandwich. I don’t suppose there is anything you can do?
Carolyn L: *grin* Unfortunately, that service is beyond my reach.
Carolyn L: I can make some good deli recommendations thought.
Me: Well, I appreciate your help at any rate :)
Me: I think she’s going to Red Line if she can ever get off the couch
Carolyn L: *grin* That’s a good place.

Clearly, my skepticism was misplaced. This is a wonderful service! I might just chat them up the next time I need something. Even if they can’t help, at least they’ll be friendly about it.

Posted in Uncategorized | Comments closed

Arizona: Some Arresting Talent

I’ll admit it: I’ve been keeping this to myself for too long.

One of my favorite bands of late, which you may remember from a certain birthday party back in March that got far too much interest from the Atlanta Police, is finally getting some of the critical respect that they’ve definitely earned. Arizona (MySpace) is a Brooklyn-based 5-piece that I was introduced to through my good friend Scott, who has played with most of them in previous musical incarnations. They played an exciting, loud set in Scott’s garage on that storied birthday evening, and it was worth the police intervention if only for the memories.

Fast forward 5 months or so, and witness them featured on NPR’s World Cafe for Monday, September 4. It’s a short piece, but it’s still great press. I appreciate that it largely lets the music speak for itself.

So what are you waiting for? Go listen!

Posted in music | Comments closed

If I think hard enough, maybe I can rewind today

Today has been one worth of much ridicule. Here are the low and highlights:

  • Low: waking up at 04:30 to find the kitchen floor pooling water that was dripping from the ceiling.
  • Low: calling in a personal day for work.
  • Low: fretting over how much this was going to cost me.
  • Low: pouring chunky milk all over my big bowl of healthy cereal.
  • High: finally receiving the insurance claim check from the last home-related incident.
  • Low: driving to Buckhead for a 1.5 hour long dentist visit.
  • High: realizing that my dentist is also a Mercedes nut and getting his recommendation for a good mechanic.
  • Low: returning from Buckhead in rush hour traffic.
  • Medium: realizing that, had I worked in addition to all this, I would have been miserable instead of just OK.
  • High: hitting Thinking Man trivia (2nd place!) and Gravity Pub Trivial Bingo in one night.
Posted in car, house | Comments closed

Big Day for Lucille

Lucille got operated on today. With Cody’s assistance and Rolf’s guidance, I changed the primary and secondary fuel filters and cleaned the ALDA banjo bolt and line. The resulting changes in performance were nothing less than extraordinary! Improved acceleration, a much more apparent turbo boost, and a smoother, quieter engine. I’m beginning to wonder exactly how well-maintained the ol’ girl was before I got her. Alas, things are getting better all the time!

One noticeable effect of these power improvements is an increase in squeaky noise from the belt(s). This had been happening only in high-torque situations, but now it is all across the acceleration spectrum. Soon it will be time to replace those guys.

In other news, Rolf and I went to fill up with some good ol’ corn squeezins at the makeshift Vegenergy filling station on Dekalb Avenue. Three bucks a gallon including taxes is exactly what I paid for regular diesel last time I filled up, and it’s what I paid today as well — but for bio. It’s totally worth it. Aside from all the numerous practical advantages of going bio, it also smells much better. I’m excited.

The Vegenergy people have got a really cool thing in the works over there. A self-contained unstaffed biodiesel pump is about to be operational 24/7. It is basically a shipping container with a pump and credit/debit machine built in to the side of it. Inside lives the tank(s) of fuel! I meant to take a picture there earlier today, but I’m sure I’ll be back soon.

Based on an article I read earlier, I’m somewhat concerned about the trend of increased biofuel production driving vegetable oil prices higher. Traditional fossil fuel production and extraction has obvious environmental and societal effects. I would hate to think that my attempt to move away from those energy sources might cause the cost of meals and food to increase for those who can barely afford it already. Time will tell, I suppose.

Posted in car | Comments closed