Monday, February 27, 2006
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
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
Friday, February 24, 2006
Zombie March, San Francisco Round 2
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/I wonder how a baby zombie would go over. ;)_bulldoze/168577.html
HD DVD to Screw Early HDTV Adopters (And Me)
Thursday, February 23, 2006
Monday, February 20, 2006
OS X RAID Benchmarks
- The internal 250 GB drive that came in my Quad G5
- A single drive connected via Firewire 400
- A single drive connected via Firewire 800
- Two drives mirrored, one drive connected via Firewire 400, the other via Firewire 800
- Two drives mirrored and daisy chained using Firewire 800
Sunday, February 19, 2006
Butterfly Effect
Wednesday, February 15, 2006
You can call a method defined on an anonymous inner 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
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...
- XML configuration
- Their own clean, injected, testable classes
<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
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!
Monday, February 06, 2006
Simple toString() Hack
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.