Archives / Search ›

hex to string?

So I had a string I really needed to retrieve (a serial number that I appear to have misplaced, and which the software conveniently forgot when I swapped hard drives) which was stored in the app’s plist as a large ASCII-encoded hexadecimal number. Turning it into a string should have been easy, and I still maintain it is, but in my late-night torpor this is the best I could come up with:

In [41]: s = '30798C86...'

In [42]: l = [int(''.join(i), 16) for i in zip(s[::2], s[1::2])]
Out[42]: [48, 121, 140, 134, ...]

In [43]: struct.pack('B' * len(l), *l)
Out[43]: '0y\x8c\x86...'

at which point I realized that didn’t look anything like a serial number, so I’ll have to call my parents in the morning to see if they can find the box for said software (thanks, Apple). Still, there must be a better way to do this in Python without explicitly looping through the string.

Update: I asked on IRC, and got:

23:49  bdash> sabi: s.decode('hex') maybe?
23:49  sabi> !!!
23:49  sabi> yes, that's perfect
23:49  bdash> :-)

Thanks Mark.

PowerBook back, finally

I finally got my PowerBook back. I have been using my mother’s old PowerBook G4/400 for the past few months while it’s been away, and had upgraded to a 40 GB hard drive because I couldn’t live with the stock 10 GB one. The old PowerBook felt a lot subjectively faster starting up than the G4/800 I had been using, so when I got it back, I did a quick test.

PowerBook G4/400 with Samsung MP0402H drive (40 GB, 5400 RPM, 8 MB cache), from power on to my last startup item finishing under Mac OS X 10.3.9: 2 minutes. It would have been a few seconds faster if I had set the boot device properly in NVRAM.

PowerBook G4/800 with Toshiba MK4018GAS drive (40 GB, 4200 RPM, 2 MB cache), Mac OS X 10.3.8: 3 minutes, 40 seconds.

Aside from the differing hard drive speeds, the lack of fragmentation in the G4/400’s filesystem could have been a factor, too. I never realized that my drive only had 2 MB of cache; Apple putting that into their “high-end” PowerBook at the time was quite a cheap move. I’ll be swapping the Samsung drive into the G4/800 later today.

ICeCoffEE 1.4.2 status

I made some progress on ICeCoffEE 1.4.2 today—updated to handsome new versions of Unsanity Installer and APE, revised the readme, fixed some innocuous coding errors pointed out by Apple’s GCC 4.0 warnings, eliminated some undocumented API usage I can get rid of now 10.3.9 is the minimum supported OS, and got everything to build on Tiger with Xcode 2.0 (which I’m increasingly enjoying).

ICeCoffEE 1.4.1, in addition to breaking discontiguous selection in NSTextView, has no services-related functionality under Tiger. Nothing crashes; you just get no services menu or list of services to disable. I poked around a bit but seem to be only using the Cocoa services menu APIs in a documented (if slightly unorthodox) manner, so I’ll return to it tomorrow. HotService from DEVONtechnologies is a freeware input manager which adds a Services menu to the menu bar, which may be an interim solution for some ICeCoffEE users.

Also, I finally got another soap dish for the shower today, so we don’t have to accommodate two cakes of soap in a single dish that isn’t wide enough. It’s only been two years!

svn.sabi.net DNS change; the HTML importer exists

My Subversion server for personal projects, svn.sabi.net (aka cmi.sabi.net) runs on my desktop G4 at home off our cable modem connection, and our IP address changed this morning for the first time in almost two years. I’ve updated DNS but it might take a while to propagate. (The new address is 12.208.7.59.)

Robert Chin points out that I was wrong—Spotlight does indeed ship with a HTML importer, but for some reason I still can’t get it to index the release notes. No time to troubleshoot further right now.

Meet securityd… or don’t.

Back in Mac OS X 10.0 and 10.1, the bane of my existence was lookupd dying and hanging the machine impossibly. In Tiger, a similar culprit appears to be securityd.

root        43   0.0  0.2    29332   3632  ??  Ss    8:42PM   0:00.43 /usr/sbin/securityd

Innocent-looking, isn’t it? But when it dies, don’t expect to be able to launch graphical processes, or restart cleanly, or sudo… and it’s died four times in the past week, necessitating the repeated use of the triangle-logoed button on the front of my G4.

‹ Newer Posts  •  Older Posts ›