Monday, June 22, 2009

Get command-as-meta in Cocoa Emacs 23

I've been running the Cocoa Nightlies of emacs lately. It's been mostly nice, although I switched back to 22 for a while because meta became super by default, and I couldn't figure out how to change it. The solution is to either go into
M-x Customize -> Environment -> Ns

or put

;; Command is meta in OS X.
(setq ns-command-modifier (quote meta))

in your emacs startup files. You'll also need to install an updated emacsclient since the one for emacs 22 won't work with 23.

Saturday, April 11, 2009

ZFS on OS X and Hanging Updaters

I was finishing off my taxes today, and while trying to apply the updater for TaxCut the updater would just hang. It'd completely max out one core of my MBP, and not ever do anything. Finally, in a moment of desperation, I fired up Instruments and started sampling it, and it was getting stuck in a Carbon routine about getting filesystem info. Unmounting my ZFS partition and trying the updater again caused it to go through instantly, with no issues.

Instruments is Made. Of. Awesome.

Monday, February 02, 2009

shepherd: Re-run tests automatically on save

For the past few months I've been using a tool I wrote called Shepherd to help run my tests for me when I'm doing a fast edit/re-test cycle. Shepherd is an OS X only shell tool (although I'd like to see equivalents for other platforms) that uses FSEvents to watch a directory for edits and re-run the tests only when the right kind of file has been edited. This is nice for a couple of reasons: Your editor doesn't need to know tests are being run, and it'll automatically re-run the tests if the code changes for some other reason, like an hg revert.

There are some bugs (^C in the middle of a test run doesn't actually stop the in-progress test run, for example), but it's been a valuable tool for me, and I'm quite late in blogging about it so others can try it out. The code is hosted on BitBucket, so if you have improvements to make, please publish them there in a fork or queue so I can pick them up!

Friday, July 25, 2008

Best iTunes Message Ever

"Purchasing updateAllSoftwareButton" just made me chuckle. Couldn't they have at least named the button something like "All Software Updates" so that a purchase would result in seeing "Purchasing All Software Updates" or something else sane?

Monday, June 30, 2008

Nokia 6085 with iSync

Well, I have an iPhone, but A doesn't, so we just got her a Nokia 6085, which is a huge step up from the Samsung she had. To get it working with iSync, I took this plugin for the 6300 and replaced 6300 with 6085 in all the plists, and it just worked neat as you please.

Syncing over bluetooth is kinda cool. Maybe Apple could work out some minimal ability to sync (say) calendars, contacts, and iTunes play counts over bluetooth, leaving the "big" files for when you've got a wire?

Saturday, May 17, 2008

This just makes me sad. I was booking a hotel room at a major hotel chain, and I got to this form and just started laughing. Am I weird in that I was tempted to try and screw up their system by using those characters?

Also, what kind of place is it that makes a form this not-robust in 2008? That's just asking for trouble.

Wednesday, April 23, 2008

Using ConfigParser on StringIO

ConfigParser is one of those bits of Python that is sadly under-documented. Recently I had need of using ConfigParser on a non-file, which meant using StringIO. Sadly, I couldn't find any examples of how to do this. After a little experimenting, I found that this works:

dummy_config = """[pinky]
narf: True
troz: True
"""
config = ConfigParser.ConfigParser()
s = StringIO.StringIO(dummy_config)
config.readfp(s)
print config.sections()

So there you have it: the secret is the readfp() method, which is mentioned in the output of PyDoc, but Google barely knew about.