Thursday, June 30, 2005
Google releases Maps API...home of Noodle Hador revealed
Google has now officially released the API for Google Maps. Using this new technology, I have managed to locate the secret Lair of the Noodle Hador, the place from which he has gained all his knowledge and ideas.
All is now revealed.
Friday, June 24, 2005
ThreadLocal rocks and don't let 'em tell you different
ThreadLocal and thread pools just don't mix. You may get away with using ThreadLocal on a thread but as soon as you return and give that thread back to the application server then you can't assume:
- You'll get called again on the same thread.
- Even if you do get the same thread, it may have different threadlocal values as it may have been used by other applications.
Besides, it's a huge security risk. Suppose an application stores sensitive information on an object held in ThreadLocal. Another customer might send a request which gets processed on a thread just used by a different customer and then one can see the information for the other customer.
He then continues to chide the open-source community for using it. Now technically, his statements are true. There are caveats you need to understand about threads and ThreadLocal. But I might as well say "don't use threads because you can't assume your code will be safe". We don't throw out an extremely useful tool because it requires knowledge to use it.
Instead, he should have offered the solution that anyone who writes J2EE apps and who has discovered the greatness of ThreadLocal knows...use a servlet filter.
Try this:
public final class MyFilter implements Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { String myAttr = request.getSession().getAttribute("myAttr"); MyThreadLocal.set(myAttr); chain.doFilter(request, response); MyThreadLocal.set(null); } }
Of course, you do need to null out the value at the end, as I've done above. Hey, now that I think of it, wouldn't it be nice if the container did this when the thread was returned to the pool? Maybe the security risk is on the side of Websphere! Now if only there was a Websphere developer around.
BTW- For a good article on ThreadLocal, see this one by Brian Goetz. If you want to know why you should use ThreadLocal, just think about all the methods in your application which take a parameter "User user" and how much more elegant your code would be if you got rid of them all.
Sunday, June 12, 2005
There's still time left!!!
Thursday, June 09, 2005
S'lach Lanu Avinu
Wednesday, June 08, 2005
70 Faces...some of them ugly
- Lo Irah This one's not bad. "V'Hayikar lo l'fached k'lal". "H' li v'lo irah". I wasn't sure about it the 1st time I heard it but its growing on me.
- Av Harachamim Boring. I can't seem to focus my attention on it for more than 10 seconds. You can hear a clip here. The clip is 1 minute long. See if you can listen to the whole thing.
- Modim I like this song. It reminds me of the last album. You can hear some of it here.
- Lifnei Adon A completely Hebrew song. Also a completely annoying one.
- Generations Not bad. Can't say I loved it, but I enjoyed it. Nice little keyboard thingy toward the end.
- Shidduch Song I liked this song when I heard the live version included on a hidden track on the 1st album. This version is also good. They added some horns which make it sound very cool. But the live version had a long jam at the end of it which was very exciting. This one doesn't have that...too bad. I would have rather had that than the horns. Here is a live version of it (a different one than is on the 1st album).
- Ein Mayim ...Elah Torah. Ein li elah Ayeif.
- Shir Hashirim This song rocks! No question that this is the best song in the album. A live version is here. On the album version you can understand the lyrics. This song is a pseudo-translation of pieces of Shir Hashirim. Great horns and some good guitar playing by Avi.
- Roll Cool track...makes my head bob back and forth as I type.
- 70 Faces Title track. Jazzy, which I like. But a little too CD101.9 for me, if you know what I mean.
- Hineini A song about Akeidas Yitzchak. It's not such a bad song, but I don't think I would listen to it. The drums are a nice touch.