Monday, 30 April 2007

A guys day

My brothers took me out yesterday to the "Guy Show" at Lansdowne. Pretty cool... lots and lots of expensive toys like jet skis, boats, trucks, bikes, and 4 wheelers. I took a picture of a dinner room table that you can remove the top and it's a pool table. Awesome. I always find that those shows are more about dreams than reality, but they are cool none the less.

After that we went over to top karting in hull. I can still smell the gas fumes when I think of it. I had no idea how physically hard it is. My muscles are killing me today. Not that I am a super good driver, my brothers lapped me twice. Then for dinner I got yummy ribs as we reviewed how to drive the track.

So, it was a good day. ;-)

Saturday, 28 April 2007

Can I wait?

My computer is driving me nuts. It's sooooooooo slow. Really, all that I can do with it is use firefox. If that's all I'm doing, it's okay. I was waiting for leopard to come out so that I wouldn't have to pay for the upgrade. I'm not sure that I can wait till September. Is my sanity worth the cost of just getting a new computer now and eating the cost of the upgrade?

Right now I am scanning some old family photos... it's very slow going. A lot of time just waiting for the computer to respond back. For example, in windows explorer, right clicking, I have to wait 15-20 seconds for the menu to show up. Never mind the time it takes to scan the photo.

*sigh* I may break down in the next while and just buy a mac. I don't think I'm going to go cheap either. Lots of memory, lots of disk space. We'll see.

Friday, 27 April 2007

Social networking

Lately I've been getting a lot of invites from friends for me to join crackbook and LinkedIn. So far I have resisted joining the "social networking scene" for fear that it would eat up more of my free time. Granted, I always find ways to use up time when I should be doing other things (eg. blogging instead of making dinner). Am I missing out on why these sites are so good? Probably.

Currently my online presence is email, this blog, and flickr. No more icq or msn for me. I just sort of lost interest. Am I being antisocial? Perhaps. At this point I figure that I'll just break down one day and make an account... probably in the summer sometime.

Damn kids and their new fangled social networking...

Thursday, 26 April 2007

Exercise prevents crazy

In higher stress times, exercise is a great way to reduce the amount of crazy. No exercise? More than enough crazy to go around...

On an unrelated note, I get married one month from today.

Wednesday, 25 April 2007

i18n in a java web app

There are at least a few strategies for supporting different languages (i18n) in a web app. These strategies are for non-constant data the the user controls which could change from request to request. For text that doesn't really change, it's best to use whatever i18n strategy that the MVC you are using recommends (ResourceBundles). I'm going to outline a few with the pro's and con's of each.

1) Walk the model
When you are passing the model to the view, you "walk" all of the objects, telling them what language they are supposed to display. The jsp is simple because you have just one "write" tag that is language agnostic. The bad part is that for every request you have to make sure you walk everything that's in every scope and make sure the model knows what language the request is. Not easy, and very error prone.

2) View knows what what it speaks
The objects have methods for every language it supports. This means that the jsp's know what language the request is, and for every language that it supports there is a if / else clause to print out the correct text. This isn't so bad if you are supporting 2 languages. It's not something that you could use if you were supporting many languages though. It leads to messy jsp's and having to test the view for every language to ensure that it is rendering correctly.

3) Threading? Keep it local.
Using a static member is out since that would be shared across the jvm, not something you want for a multi threaded app. However, there is something that allows you to use static-like access while still being thread safe: ThreadLocal. This means that you can leave your view clean, and you don't have the complicated task of of walking the model. Through a filter, you can set what the language is and then you are just coupling the model to a "language helper" that has a ThreadLocal member. One downside is that each model object will have logic for every language to support, for every field. Not too bad, since you have to put it somewhere, and with this method you only do it in one place.

I've always used #2, but have never really been happy with it. I have not used #3 yet, but I have seen it used. When I saw it I had one of those "why didn't I think of that!" type of moments. I'm looking forward to making my code cleaner. ;-)

Dry humour

I don't think that I would have been so cool if my performance was interrupted like Mike Daisey's was. I think that it's funny that he asked the protesters to stay and discuss why they were not happy. Well, it looks like those protesters just helped make him famous. What's the line: "I don't care what you write about me, just spell my name right"?

Tuesday, 24 April 2007

The Machine is Us/ing Us

The other day at work I saw a really cool video and thought that I would share. It's worth 5 minutes.