John Lindal’s Blog
Gate
January 16, 2008 on 12:55 pm | In House | No CommentsWe finally have a gate for our driveway that opens all the way and allows our cars to be driven through — again thanks to Peter H. Cease, Lic #687167. The old gate was two sections, and one section could only open partially because the gas meter blocked it. The new gate is a single section, sized to fit the usable space, and a fixed fence spans the remaining gap. My wife designed it beautifully, and Peter built it solidly to last.
Comments welcome!
January 11, 2008 on 7:03 pm | In Miscellaneous | No CommentsI should have done this a long time ago, but I finally discovered that all my comment spam was coming from pings, not from any loophole that allowed posting without first registering and logging in. So comments are now allowed again, and pings have been turned off.
Upgrade
January 10, 2008 on 3:36 pm | In Computers | No CommentsI finally bit the bullet and ugpraded WordPress from 1.5.x to 2.3.2. Congrats to the WordPress team for making it such a painless procedure, even when upgrading from such an old version!
Nanites
January 6, 2008 on 12:27 am | In Crazy ideas | No CommentsWhile lying in bed waiting for my daughter to fall asleep, and having just watched Transformers, I begin thinking about nanotechnology. The popular vision is swarms of ridiculously tiny robots running around fixing things on a scale far too small for humans to see. Is this actually possible?
It might be. Propulsion is clearly possible, since amoebas and bacteria with flagella can do it. Storage of instructions for individual robots is also possible, since the nucleus of a cell contains an enormous amount of data encoded in DNA. The behavior of ants and research on swarm robotics suggests that individual robots do not need to exhibit complex behavior; it’s the interaction between large numbers of simple-minded robots that creates complex behavior.
The trick, of course, is to put it all together. How does one build a system that can move around, interact with its environment, and be programmed to behave in a particular way? What behavior should actually be programmed into individual robots to achieve a desired result?
Transformers
January 6, 2008 on 12:17 am | In Movies | No CommentsI finally got to see Transformers. It was a good test of our new sound system, but unfortunately, that was about it. Well, OK, the robots were cool, but I never really got excited about the original Transformers when I was a kid, because the toys were too darn expensive.
There was nothing original about the plot. Every twist has already been heavily overused: the all-powerful, alien artifact hidden on Earth, the evil menace frozen in Arctic ice, evil robots out to destroy Earth, stupid Americans thinking the Russians/North Koreans/etc. are attacking, the secret government agency hiding information about aliens, alien technology being the real source of all the technological breakthroughs of the 20th century, etc.
I guess it’s par for the course for a summer blockbuster…
Home Theater — Part 3
January 6, 2008 on 12:07 am | In House | No CommentsThe optical cable works perfectly. Now our CD player feeds into our Denon receiver. Most CD’s don’t sound right with 5.1, but they work great in stereo mode. And my wife can finally enjoy her Moulin Rouge CD, because it sounds fantastic in “rock arena” mode
Defeating the Java ResourceBundle cache
January 3, 2008 on 12:37 pm | In Crazy ideas, Programming | 3 CommentsResourceBundle caching in Java is normally a wonderful optimization. In my case, however, I’m building JSP tags with the logic in Java and the markup in property files, so the ResourceBundle cache forces me to restart JBoss every time I make a markup change. This makes iteration very slow, so I went hunting for a way to defeat the cache. A quick search uncovered this blog entry. Unfortunately, this it out of date, because in newer versions of the JDK, ResourceBundle no longer uses sun.misc.SoftCache. The correct code for flushing the ResourceBundle cache is:
Field field = ResourceBundle.class.getDeclaredField("cacheList");
field.setAccessible(true);
Object cache = field.get(null);
if (sun.misc.SoftCache.class.isAssignableFrom(cache.getClass()))
{
((sun.misc.SoftCache) cache).clear();
}
else
{
((java.util.concurrent.ConcurrentHashMap) cache).clear();
}
For this to work, you must create a new instance of ResourceBundle after executing this code.
However, this is only half the solution. It only works for property files that are directly included in my exploded war. I have my tag libraries in jars, so I also need to defeat the Java class loader caching mechanism!
Luckily, this is possible. The trick is to derive a class from URLClassLoader which overrides loadClass() to call findClass() and getResource() to call findResource(). This prevents the call to the parent class loader, so only the URL’s (jars and directories) that my class explicitly passes to the URLClassLoader constructor will be searched.
But we’re still not done, because URLClassLoader caches jar files!
Thankfully, URLClassLoader provides a constructor that accepts a custom URLStreamHandlerFactory. This allows me to provide a customized version of URLStreamHandler which constructs URLConnection objects with caching disabled.
After a deep dive in the JDK 1.5 source, the required code turns out to be very simple:
private static class ResourceURLStreamHandlerFactory
implements java.net.URLStreamHandlerFactory
{
public java.net.URLStreamHandler createURLStreamHandler(
String protocol)
{
return new JarResourceURLStreamHandler();
}
}
private static class JarResourceURLStreamHandler
extends sun.net.www.protocol.jar.Handler
{
@Override
protected java.net.URLConnection openConnection(
URL u)
throws java.io.IOException
{
sun.net.www.protocol.jar.JarURLConnection c =
new sun.net.www.protocol.jar.JarURLConnection(u, this);
c.setUseCaches(false);
return c;
}
}
Sadly, this is a hack, since sun.* is not public, but it works!
Home Theater — Part 2
January 1, 2008 on 7:58 pm | In House, Movies | No CommentsThe JBL speakers sound phenomenal! My daughter loves it. When she watches Shrek, it’s like she’s seeing it for the first time. She gets so excited now, instead of just sitting and watching.
I put the finishing touches on the wiring today. All the audio now goes directly to the Denon receiver, instead of via the TV. The Sony DVD goes directly to the TV, while the Sony VCR and APEX DVD are multiplexed by the receiver, so I can use a single input on the back of the TV for both. This finally gets the APEX DVD off the top of the Sony DVD, so everything runs cooler. If you’ve never heard of APEX, it’s an unknown brand, but it plays anything, no matter how damaged. Sony normally chokes on damaged DVD’s.
The only remaining issue is to connect the Aiwa CD player to the receiver, since the Sony DVD player cannot handle our CD’s. The optical digital cable is on order
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^