Welcome to my little corner of the Interweb. This is my metaphorical scratchpad, soapbox, and junk drawer.

Let me just tell you right up front: I have not developed the habit of posting here. So this stuff may be pretty old!

This afternoon I was iChatting with my excellent co-founder Jonathan when my video started to go all jittery. I checked iStat and saw that kernel_task was using about 200% CPU time. That seemed…odd. Since the chat was rapidly becoming unusable, I signed off temporarily to debug the problem.

At first I blamed Time Machine, which happened to be doing a backup at the time. I’ve seen some crazy CPU usage when Time Machine is “cleaning up”. But stopping the backup didn’t help. In fact, rebooting didn’t help. Something very weird was going on.

I thought to myself, “this is a job for DTrace!” and spent an enjoyable ten minutes poking around in DTrace-land. Eventually I ran across hotkernel.pl which, despite its age, still seems to work. It told me most of the time was going into the function machine_idle. Uh, what?

Now, we have four cats, and most of them have figured out that a MacBook Pro is a lovely, warm place to sleep, and one of them happened to be sleeping on it. Perhaps due to my cursing, she decided to find a more peaceful spot for a nap. As soon as she left, kernel_task CPU time started going down, and so did the fan speed. Pretty soon everything was back to normal.

Clearly the cat was to blame (so often the case). She had blocked the ventilation on my MacBook and somehow caused this bizarre behavior. Doing further research using the google, I discovered the possible answer—though I’m not sure it has been confirmed by Apple. Apparently, when the MacBook Air came out, there was some controversy because it was so easy to overheat it (e.g., by playing 1080p video for two minutes), and it reacted by shutting down processor cores to conserve power. “They” say that Apple issued a patch so that instead of shutting down a core, the kernel scheduler just stops using it, and the unused time shows up under kernel_task. “Their” theory is that it looks better to customers than a disabled core. An amusing case of engineering by PR, if true.

Now I’m wondering if this situation is detectable in software, so next time I can just have an alert box that tells me what’s really going on.

Comments

Photo by Roasting Plant

On a visit to New York City last week I had the pleasure of stopping by the Lower East Side branch of Roasting Plant, which has to be the ideal coffee place for geeky perfectionists like myself. The coffee is roasted in small batches on-site. When you place your order, the counter clerk touches the screen, and whoosh! a measured amount of your selected coffee beans are whisked through pneumatic tubes over your head, directly into an automated espresso machine that grinds, tamps, and brews the coffee. It’s like the canteen at the Willy Wonka factory. Oh, and the coffee tastes good, too.

Comments

Where do you put the global settings for your Rails application? There are several “app config” plugins out there, but they seem too complicated to me. I just want the following:

  • Store configuration data in a YAML file checked into Git.
  • Store more sensitive configuration data in environment vars or Heroku config.
  • Simple access, no magic: AppConfig['key.subkey']

This is so simple it isn’t even a plugin, just a file to stick in the lib dir and require.

Comments

I am going through the >3000 pictures we took in Antarctica, and noticed that some of them were way out of order. It turns out that one of the cameras' clocks was set 12 hours off. Then I realized the other camera was set to Pacific time anyway, so really it was five hours off.

A few minutes of searching around later, I found jhead, a command-line JPEG header tool with a very convenient function:

jhead -ta+5:00 *.jpg

This adds five hours to the Date Taken of all the JPG files in a directory. Spiffy. A shout out to Matthias Wandel for making this free tool available. His pipe organ looks pretty neat too! There’s something about computer folks and pipe organs…

Comments