Monday, February 27, 2006

Bush's Approval Rating Month to Month

CBS: Mr. Bush's overall job rating has fallen to 34 percent, down from 42 percent last month.
Down 8 points in one month. I'm sure the recent port debacle had something to do with it, but I wonder what impact tax returns have had. I'm sure wondering where my tax cuts are. ;) Via Dave.

ThreadLocal Memory Leak

ThreadLocal is implemented as a weak hash map. Each thread has a map instance. The map keys are weak references to the ThreadLocal instances themselves. The map values are the thread local values. Just like with WeakHashMap instances, if your value somehow holds a strong reference to the ThreadLocal key, the garbage collector can't reclaim either until you explicitly set the value to null or even better call remove() on the ThreadLocal instance. This bit me in the ass today when I mixed ThreadLocal with nested classes, instances of which have an implicit strong reference to their nesting instance, and failed to properly clean up afterwards. "Implicit" is synonymous with "easy to forget about." Oops.

Sunday, February 26, 2006

The Truth About Stem Cell Research, Federal Funding

Every time I debate stem cell research with a friend who manages Republican political campaigns, he points out that stem cell research isn't illegal; it just doesn't receive federal funding--there's nothing stopping private research. That's a spun half truth. According to tonight's 60 Minutes report, "scientists are only permitted to work with new embryonic stem cell lines if their lab does not receive any federal money." What lab doesn't depend on some degree of federal funding? This means private donors must build new labs from the ground up before they can even think about research (on embryos that are less than 5 years old):
In the meantime, Dr. Arnold Kriegstein, head of stem cell research at the University of California at San Francisco, is raising $5 million in private money to build a brand new laboratory that duplicates facilities the university already has. It’s necessary because scientists are only permitted to work with new embryonic stem cell lines if their lab does not receive any federal money. Even if he already has things like microscopes, Petri dishes and refrigerators, he has to buy the same equipment again for the stem cell research. "Absolutely. All the materials and supplies, all the consumable materials, everything that's involved in any of this work needs to be paid for through private funds," Kriegstein explains. Kriegstein says that is one of the problems researchers face. "It's very costly and it's time-consuming, and it has been slowing down progress in the field," he says.

No Flash Audio on OS X

The problem was confusing, but the fix is simple. Who would have known installing Audacity could make Flash stop working?

Friday, February 24, 2006

Zombie March, San Francisco Round 2

I just received this email from the host of a website dedicated to the first march:
Warning! Warning! More Warning! I've been tracking the activities of a particular hoarde of zombies in San Francisco ever since they attacked last July. I was recently blindsided by the discovery of another hoard with different leaders and behavior patterns. They should be considered extremely dangerous until more is known about them. My best prediction is that they will converge on Union Square at 10pm tonight (Friday) and hoard around town drinking 40s and eating pedestrians.. I'm not an expert on this particular group of undead or their mode of operation, so if this matter concerns you, see http://users.livejournal.com/_bulldoze/168577.html
I wonder how a baby zombie would go over. ;)

HD DVD to Screw Early HDTV Adopters (And Me)

Slashdot is reporting that to thwart piracy, HD DVD players will only support one quarter of the available resolution for component video output. Unlike DVI, component outputs are analog and have no copy protection. If you have only component outputs, you're screwed. Or if you're like me and you want to use your TV's DVI input for your cable box and its component input for your DVD player, you're also screwed.

Thursday, February 23, 2006

Where do deleted pictures go?

Monday, February 20, 2006

OS X RAID Benchmarks

I picked up two 500 GB Lacie Big Disk Extreme external hard drives. The Big Disk Extreme supports USB 2.0 and Firewire 400 and 800. The drives came with all the necessary cables (including an iLink cable in case I want to daisy chain my video camera). I originally planned to mirror the drives using OS X's built-in RAID support so I wouldn't have to worry about backups anymore, but after benchmarking various configurations using Xbench, I think I'll synchronize the drives nightly using Carbon Copy Cloner (CCC) or rsync instead. I tested five different configurations:
  1. The internal 250 GB drive that came in my Quad G5
  2. A single drive connected via Firewire 400
  3. A single drive connected via Firewire 800
  4. Two drives mirrored, one drive connected via Firewire 400, the other via Firewire 800
  5. Two drives mirrored and daisy chained using Firewire 800
All tests were uncached per Xbench. The internal hard drive benchmarks may be artificially slow: the external hard drive has no data on it while the internal drive holds the operating system and all my applications and data. I quit most of the applications, but some processes most likely accessed the internal drive during the test. Is Firewire 800 worth it? Firewire 400 theoretically supports 50 MB/s transfer rates while Firewire 800 supports up to 100 MB/s. The drives far exceeded 50 MB/s in a few tests indicating that using Firewire 800 really does make a difference (sorry MacBook owners). I'm actually surprised by how much better the Firewire 800 configuration performed; perhaps you can attribute the difference to round trips or some other communication overhead. Given that all my computers support Firewire 800, I'm glad I sprung for drives that support it as well. The sluggishness of random 4k block reads across all the configurations shocked me; every test came in at much less than 1 MB/s. I knew it would be slow but not that slow. I'll keep that in mind the next time it comes up in an application design. The mirrored, daisy chained Firewire 800 configuration performance also disappointed. I correctly expected the writes to take twice as long as those for a single Firewire 800 drive, but I incorrectly expected the reads to perform as much as two times faster. Instead the reads were much slower in both sequential cases, the same in the 4k block random read, and only slightly faster in the 256k block random read. In the hopes that putting the drives on separate buses would improve performance, I tried connecting one drive to the Firewire 400 port, but the performance was much worse. To top it off, OS X thought the drives were out of sync and proceeded to catch them up. Based on how long the resync was taking before I canceled it, I suspect OS X was comparing the drives bit by bit, all 500 GB. I ended up erasing and repartitioning so I could run the test. Based on my findings, I'm going to forgo RAID, partition the drives separately, and synchronize them nightly using CCC or rsync. Handling synchronization at the application level will result in more transparency (no worrying about long Disk Utility resyncs and less worrying about how to recover in the event of a failure). I'll get much better write performance and slightly better read performance in real world situations (video editing, etc.). On the downside, I'll have two drives on my desktop instead of one, and I'll risk losing a day's worth of data (or however long I go between syncs). Then again on the upside, I should only mount the backup during syncs which means virii, etc., won't be able to touch it. Now to spoof a .Mac account backed by these puppies.

Sunday, February 19, 2006

Butterfly Effect

Cheesy. I know. We had to spend $10 more at Gymboree to get a $25 coupon, so I grabbed some wings. I faded and antiqued the color and blurred the edges in iPhoto to achieve the effect. By the way, this wasn't professional taken. I threw our white down comforter over the couch, sat Dagny up, took a bunch of pictures, and picked out the best ones. I used a Lumix DMC-FZ5 as recommended on Boing Boing a couple months back. I'm pretty happy with it, but I want higher resolution (it's only 5 MP) and more importantly a camera that can take pictures in lower, indoor lighting without blurring too much (I don't like how the flash washes things out). Who needs to pay a professional photographer $400 to take 2 rolls of film (and that doesn't even include the prints)? This way I own the copyright.

Wednesday, February 15, 2006

You can call a method defined on an anonymous inner class.

News to me. Clever way to define a new class:
  private static <T> Class<T> defineClass(
      ClassLoader parent, final String className, 
      final byte[] bytes) {
    return new ClassLoader(parent) {
      public Class defineClass() { 
        return defineClass(
          className, bytes, 0, bytes.length);
      }
    }.defineClass();
  }

Monday, February 13, 2006

Al Franken on the Huffington Post

I just noticed Al Franken has been blogging on the Huffington Post. Don't miss his comments on Cheney's recent accident:

Over the weekend, Vice President Dick Cheney shot a man in Texas. Asked why he shot the man, the Vice President said, "Just to watch him die."

Seriously, it was an accident. There is nothing funny about the Vice President of the United States shooting a guy.

You know who's doing a "there but for the grace of God go I?" Scalia.

Bush is confused. He thinks Wittington is just fine. He thought he read a headline saying "Wittington Dodges Bullet."

Now, I imagine that Cheney and the President have hunted together. What would have happened if Cheney had shot the President? I think if he shot Bush this way, Bush isn't 78 and he's in pretty good shape, and he's kinda macho. I think he would've gotten up and shot Cheney back. And I think they would've started blasting each other like in a Tarrantino movie.

By the way, Cheney shouldn't be allowed to hunt again, should he? You get one of these, right? I mean he came very close to killing the guy.

I was too hard on Spring...

Sorry, Rod, Keith, Rick et al. I'll even go so far as to say that I no longer believe Spring does more harm than good. Spring's Java API and implementation may leave a lot to be desired (Effective Java should be required reading for Spring committers), but in reality most users rarely see either. Spring users see two things:
  1. XML configuration
  2. Their own clean, injected, testable classes
As much as I like to avoid XML, pure Java has its drawbacks, too. I'd say it's six and one half dozen of the other, but I could do without the type conversion necessitated by XML binding. I might explore using BeanShell as a third alternative, but IDE support for Spring XML is already pretty good, and it can only get better. Spring IDE support also happens to address many of my type checking concerns. If IntelliJ can automatically complete and rename property names and flag errors at development time, do I really care if I'm maintaining Java or XML? Nope. This pretty much kills any aspirations for implementing a lighter weight framework that focuses solely on DI unless you plan on sticking to pure Java or implementing IDE plugins, too. Unfortunately, the pure Java approach limits what an IDE can do. Aside from cleaning up the API and optimizing the implementation, I do have one request for Spring 2.0: simpler custom scopes, i.e. not the currently recommended AOP hack. I want something like this in my Spring XML:
  <bean name="conversation" class="ConversationScope" />
  <bean name="foo" scope="conversation" ... />
In the long term, we need something closer to my ideal factory API in the J2SE so we can strongly type JNDI, the Servlet API, etc. Spring is not that API, but it certainly will do for application development in the mean time.

Friday, February 10, 2006

iTMS Video Gripes

Does the video aspect of iTunes strike you as kind of hacked in and not well planned? The UI refers to videos as "songs" and "podcasts" in various places; is the latter intentional? I have a tough time resizing the video window. Sometimes I right click the video and see a "full screen" option, and sometimes I don't. It's the same video a couple seconds later. I hit command-F and nothing happens; it's still mapped to the visualizer. I don't care about the visualizer when I'm watching video. The thing that bothers me the most is the lack of episode numbers. Unlike songs, I care about watching a season in order, but in many of the views, it's difficult to order shows or even to tell whether they're in the correct order or not. Am I missing something? Update: Sam pointed out in the comments that I can go to the "Edit" menu, click "View Options", and make the episode number visible. Duh. I've been looking under the application preferences the entire time. Thanks, Sam.

Not At the Mercy of Gmail

Winer: They probably do care, in an abstract and aggregate way. But what if the performance never came back? Or what happens if Google stock stops going up? Who wants to be on Gmail when that happens?
If that happens, switch clients. That's the awesome thing about Gmail compared to Yahoo or Hotmail. No lock in. Gmail lets you specify a different email address which effectively makes Gmail just another mail client for me. For example, my email goes to and comes from my crazybob.org address, not my gmail.com address. It's difficult for recipients to tell I even use Gmail. If you use your gmail.com address and still want to switch, use the forwarding feature. When it comes time to export your email and use something else (Apple's Mail.app for example), you can use the POP3 access. Yahoo and Hotmail charge premiums for these features if they offer them at all. Disclaimer: I work for Google.

Tuesday, February 07, 2006

Weeds Is on the iTMS!

I just noticed Weeds, the hit series from Showtime, is on the iTunes Music Store! Weeds is about a suburban housewife widow who resorts to selling ganja to make ends meet. Give it a shot if you haven't already, and keep 'em coming, Apple.

Monday, February 06, 2006

Simple toString() Hack

When you want something short, and you're not in the mood for reflection:
  public String toString() {
    return MyClass.class.getSimpleName()
        + new LinkedHashMap<String, Object>() {{
      put("foo", foo);
      put("bar", bar);
      put("tee", tee);
    }};
  }
Results in:
  MyClass[foo: fooValue, bar: barValue, tee: teeValue]
I use LinkedHashMap because it maintains the order.

Super Bowl XL Commercials

Friday, February 03, 2006

Speed Reading

The interface for this speed reading test is interesting. You could use something like this to read text on your mobile phone. The program could speed up or slow down based on word length, syllables, word frequency (i.e. slow down on words you may not be familiar with), punctuation, etc. Unfortunately, I found that I have trouble comprehending when reading like this.

Thursday, February 02, 2006

RSS Feeds for Comments

RSS feeds make blogs easy enough to keep track of. If your web site doesn't have an RSS feed, don't plan on me keeping track of it; it's just not worth it most of the time. Every once in a while, an entry will catch my eye, and I'll leave a comment. I would almost always like to stick around for the responses. If I'm really interested, I'll keep the site open in a browser tab for a while, refreshing it every now and then. Once it's closed, I completely lose track of the conversation. It pains me to think of all the discussions where I didn't get the last word. If only more blogging tools published RSS feeds for comments... I wonder if the number of comments would go up. Then again, I'd have to pick up an additional RSS reader. I don't think Bloglines updates often enough for this sort of thing (i.e. comments have much faster and shorter lived momentum than the web sites for which it's geared). If I was a Windows user, I'd probably use Google Desktop. That's the down side of using a hosted blogging service such as Blogger (though not having to host my own server anymore more than makes up for it). Then again, that doesn't apply to me in this case because I can go in and fix it.