Emulating "defer" in C, with Clang or GCC+Blocks Emulating "defer" in C, with Clang or GCC+Blocks

Posted by smokris on 2015.10.08 @ 23:24

Filed under:

In the Go language (and now Apple’s Swift), there’s a new control-flow mechanism: defer.

When you tag a function call with the defer keyword, its execution is deferred until the end of the current scope. This makes it easy to construct an ad-hoc use of the RAII pattern — handy for placing resource initialization and finalization next to each other, to make it less likely that you’ll forget to finalize a resource.

I was curious whether it was possible to do something similar in C. It turns out it’s pretty straightforward. [more...]

Found: 25-year-old COSI visitor guide Found: 25-year-old COSI visitor guide

Posted by smokris on 2013.07.14 @ 18:44

Filed under:

I’m in the middle of cleaning and packing to move house, and I came across a time capsule I made as part of a workshop at COSI (Columbus, Ohio’s science museum), 25 years ago today (1988.07.14). I was 5 years old at the time.

Included in the time capsule were two pieces of yarn identifying my height and circumference, and a personal-facts sheet, mentioning such things as my favorite musician (Herbie Hancock, of whom I’d recently become aware via his appearance on Sesame Street) and my favorite toy (the Yamaha PSS-470 synthesizer with its wonderful FM modulation control panel).

And this Souvenir Program, submitted for your approval — [more...]

Hacking Open Atrium: adding Features within the Contexts of your Spaces Hacking Open Atrium: adding Features within the Contexts of your Spaces

Posted by smokris on 2011.12.05 @ 19:02

Filed under:

Last Saturday at DrupalCamp Ohio, I presented an introduction to the basic concepts behind the Open Atrium Drupal install profile, and a demonstration of how to create custom Open Atrium Features. [more...]

Apple Radar vs. Time Apple Radar vs. Time

Posted by smokris on 2011.12.02 @ 11:01

Filed under:

I recently filed an Apple Bug Report, which was marked as a duplicate. The actual bug isn’t terribly important, but the difference between the serial number of the bug I filed (10426480) and the serial number of its alleged duplicate (3323328) — about 7 million — surprised me. Just how old was this still-unfixed bug?

I slogged through the lists.apple.com archives and the bugs users have manually posted on openradar.appspot.com to compile a list of Radar Numbers and the dates they were filed, and ended up with this: [more...]

Recovering From a Failed ZFS Root Mirror Disk Recovering From a Failed ZFS Root Mirror Disk

Posted by smokris on 2010.11.14 @ 18:13

Filed under:

Hypothetical. Say, for example, you’ve got a ZFS mirror on disk0 and disk1, from which your Nexenta system boots. A year or two later, disk0 crashes, and starts spewing messages such as the following:

 ahci: [ID 860969 kern.warning] WARNING: ahci0: ahci_port_reset port 0 the device hardware has been initialized and the power-up diagnostics failed

Shortly thereafter there’s a storm and the power goes out for several hours and drains your entire humongous UPS, and when the power finally comes back on, the system won’t boot — it stops at the grub prompt; issuing a standard boot command fails. [more...]

Please No More Animated Shorts on Environmentalism Thank You. Please No More Animated Shorts on Environmentalism Thank You.

Posted by smokris on 2010.04.27 @ 01:38

Filed under:

The Athens Film Festival 2010’s Animation Show played tonight and I watched it.

My personal perusal of the last two decades worth of SIGGRAPH reels squarely places the topic environmentalism as the most commonly-used central theme. (What’s the connection here?)

So, I’m tired of animated shorts on the topic of environmentalism and social responsibility. And I’m even tireder of mockumentaries. I’m therefore going to refrain from [more...]

Release: Move Message To Sent Folder 1.2 Release: Move Message To Sent Folder 1.2

Posted by smokris on 2009.11.20 @ 14:00

Filed under:

Move to Sent Menu Screenshot

  • Works on Snow Leopard (with Mail.app running in either 32bit or 64bit).
  • After moving a message, automatically selects the following message (instead of selecting nothing).

Mailbundle attached.

electro-music 2009: the videos electro-music 2009: the videos

Posted by smokris on 2009.11.07 @ 14:08

Filed under:

now playing:

http://vimeo.com/channels/em2009

JFS on Linux = Surprisingly Lossy JFS on Linux = Surprisingly Lossy

Posted by smokris on 2009.03.08 @ 19:29

Filed under:

I set up a RAID media server a couple years ago, and decided to give JFS2 a try, since it’s touted as being fast and reliable across the spectrum of usecases. My setup is primarily write-once-read-many, for storing the terabytes of audio and video recordings I’ve made over the last decade for project ruori and the like.

Several weeks ago, the power went out for an extended period of time while I was away, and, while it was on UPS backup, it failed to shutdown cleanly and the power was suddenly cut when the UPS ran out.

When I brought the machine back up, the volume wouldn’t mount, so I ran jfs_fsck on it. jfs_fsck said that the journal was corrupt, and started block-scanning. It came up with a pretty big list of files and directories that were irrevocably corrupt. Parts of a few of them got linked into /lost+found, but the majority simply vanished.

Funny thing is, I hadn’t made any changes to these files in several years. I could understand if maybe some very recent FS updates were lost due to write-caching, but why did it lose track of these ancient files?

This reminds me of the rampant table corruption of MS-DOS’s FAT16 filesystem, which couldn’t keep track of a needle dancing on the point of a needle.

So, plus one for backups of backups, and minus one for JFS on Linux. I think I’ll be rebuilding the machine with ZFS-fuse. Or OpenSolaris, for that matter.

NSSound and Enumerating CoreAudio Output Devices NSSound and Enumerating CoreAudio Output Devices

Posted by smokris on 2008.08.12 @ 10:16

Filed under:

Cocoa’s NSSound provides a blindingly simple way to play back audio asynchronously, and even provides some metadata and control over how the audio is played back.

It uses the default sound device, by default. It gives you the ability to change the output device.

According to the documentation:

- (void)setPlaybackDeviceIdentifier:(NSString *)playbackDeviceIdentifier

Specifies the receiver’s output device.

playbackDeviceIdentifier
    Unique identifier of a sound output device.

That’s it. What is the “Unique identifier of a sound output device”? What format is this “Unique identifier”? How do I get a list of the “Unique identifiers” of the available output devices on my system? [more...]