Setting display brightness: updated tool

Here is my cleaned-up brightness tool, which now uses the IOKit APIs instead of the weird O3Engine SPIs that the old version did.

Quick example:

% ./brightness
usage: ./brightness [-m|-d display] [-v] <brightness>
   or: ./brightness -l [-v]
% ./brightness -l
display 0: main display, ID 0x4270a80
display 0: brightness 0.734375
% ./brightness -v 0.3
display 0: brightness 0.296875

-m changes the brightness of the main display; -d changes brightness of whatever display number/ID you provide. -l -v dumps display attributes—sorry for the ugly XML output, but CoreFoundation claims to be unable to output an OpenStep-format property list even though Cocoa has no problem doing the same.

Setting display brightness

Amit Singh has posted some source code for reading the ambient light sensor on appropriately equipped Apple laptops, and changing the keyboard and display backlight brightness. He sets the display brightness with only documented APIs, which is quite a bit cleaner than the code to do so I wrote about 7 months ago. Needless to say, at the time I couldn’t find the appropriate IOKit methods to do so, so I ended up reverse engineering what the display preference pane did. It’s rather strange that the convoluted Objective-C interface exists, since the IOKit code actually seems shorter!

One thing my code does that Amit’s doesn’t is change the brightness on all connected LCDs, not just the main display (which may not be the internal LCD if you’ve got a laptop connected to an external monitor). This should be easy enough to merge.

Universal F-Script Anywhere released

F-Script Anywhere is now part of the main F-Script distribution, available at fscript.org. Version 1.3 is compatible with Mac OS X 10.4.x, and is a Universal Binary. Many thanks to Robert Chin for picking up FSA’s development.

I still don’t have access to an Intel Mac, but with some help, a Universal build of ICeCoffEE should be ready in the next few weeks.

This American Life track munger

Since This American Life has switched from streaming in RealAudio to MP3, Jon Udell and Jared Benedict have posted some unofficial podcast feeds. Unlike with my previous RealPlayer-to-Audio Hijack Pro-to-iTunes-as-AAC solution, the MP3 files aren’t bookmarkable on my 3G iPod, but they are certainly a lot more convenient to grab for later listening.

Which reminds me, since other people may find it useful—a few weeks ago, I wrote a script which operates on the selected This American Life MP3 tracks in iTunes, renames them to match my existing scheme, and moves the episode number to the track field (especially useful on older iPods where the episode number takes up half the width of the screen).

TALize.png

Download the script here. Sorry for the image; Script Debugger 3’s HTML export appears to have broken—and since I have primarily switched to appscript, I can’t justify the upgrade to version 4. The string parsing pain above should be enough to send anyone running to Python.

“Fun” OS X disk image bug

So I was trying to install OpenSolaris on a CD-less SPARC system using an OS X machine as an install server (because said machine is barfing under FreeBSD, and I’m trying to figure out if it was a hardware problem).

After downloading the DVD image in four pieces, concatenating them together, and mounting it, I think I may have run into some weird disk imaging or filesystem bug on OS X. It’s really rather scary.

% uname -a
Darwin bookworm.local 8.6.0 Darwin Kernel Version 8.6.0: Tue Mar  7 16:58:48 PST
 2006; root:xnu-792.6.70.obj~1/RELEASE_PPC Power Macintosh powerpc
% hdid sol-nv-b40-sparc-dvd.iso
/dev/disk2                                              /Volumes/SOL_11_SPARC
% cp /Volumes/SOL_11_SPARC/Solaris_11/Tools/add_install_client ./one
% disktool -e disk2 0
[...]
***Disk Ejected('disk2')
% hdid sol-nv-b40-sparc-dvd.iso
/dev/disk2                                              /Volumes/SOL_11_SPARC
% cp /Volumes/SOL_11_SPARC/Solaris_11/Tools/add_install_client ./two
% diff one two
Binary files one and two differ
% file one two
one: data
two: data

add_install_client is supposed to be a shell script. A few times running strings on it, I found some OS X filesystem bits, for example:

% strings add_install_client
[...]
ntpd
snmpd
Starter
RetroRun
rter
crashreporterd
[...]
tarter
apcupsd
arter
serialnumberd
ARDHelper
zsh: 697 bus error  strings add_install_client

No time to debug further at the moment, but… yuck.

OpenAlpha

Ever noticed that, when you drag a bunch of documents from the Finder onto an application, the order in which they open is often the exact opposite of what you want, if not outright random?

I’ve cursed this behavior several times, though never cared enough to do something about it—but Cameron Kaiser has. OpenAlpha is his solution: drop your files onto it instead, and they’ll be opened in alphabetical order. It uses my launch tool to do the opening; pretty cool to see my software not only being used, but embedded.

Upgraded to WordPress 2.0.3

Comment spam really is annoying, though it’s getting a run for its money from random Unicode glyph-abusing Brazilians I don’t know asking me to be their friend on Orkut. But four requests in one day!?

It seems WP-Cache was causing the weird blank-page-until-reload issues with WordPress 1.5, which translated into no-page-at-all issues in WordPress 2. Since TextDrive finally seems to have a handle on the server-crashing and performance issues (this server has been up for over 31 days), the caching plugin isn’t as imperative as it used to be, though I do like to be nice about using shared server resources where I can.

Quick WordPress 2 review: AJAXification is good. I don’t like the new admin color scheme; looks too much like a bad ripoff of Slashdot. From time to time gigantic fonts appear, for no apparent reason; being on a 1024×768 display, this sucks. The new WYSIWYG editor isn’t perfect (it turned a paragraph break into a line break the first time I posted this message), but it’s a lot better than most I’ve seen. The dynamic resizability of this editing window is especially slick—alternately, you could say we should have had this kind of stuff on the Web 10 years ago :-)

Still, I think I’ll be going back to MarsEdit as soon as I can; hopefully it’ll get some attention in the form of WebKit content-editable support soon. I’m already very addicted to NetNewsWire 2.1’s syncing, even with the known problems, it works well 99% of the time. When RSS feeds get messed up on iTunes, I end up with tens of old podcasting episodes, which is a lot of data to needlessly download. It’d be cool if I could tell it “don’t accept any posts with dates earlier than the newest (or even oldest) preexisting item in the feed”.

If you notice any site flakiness, please let me know. I realize some of the old posts from the PyCS and (especially) Radio sites still have formatting issues; fixing this is on my to-do list, just rather far down it.