Life of the IT-Drummer

En vevlogg av Tobias Rusås Olsen.

Bike Hero!

Awesome.

No comment
taintedsong.com taintedsong.com taintedsong.com

JSF: Make your own error messages.

Today we had trouble with changing the default error messages in JSF, they were pretty confusing. After surfing the net, we found an easy solution:

  1. Make a file called messages.properties and put it somewhere in your source folder (for example in a resource folder).
  2. Go to the faces-context.xml, and add the following inside the faces-context tag:
    <application>
    <message-bundle>resource.messages</message-bundle>
    </application>
  3. Open the messages.properties and add lines using this format: javax.faces.component.UIInput.REQUIRED=New value

These are some of the replaceable fields:

Key Description
javax.faces.component.UIInput.CONVERSION Conversion error occurred
javax.faces.component.UIInput.REQUIRED Value is required
javax.faces.component.UISelectOne.INVALID Value is not a a valid option
javax.faces.component.UISelectMany.INVALID Value is not a valid option
javax.faces.validator.NOT_IN_RANGE Specified attribute is not between the expected values of {0} and {1}
javax.faces.validator.DoubleRangeValidator.MAXIMUM Value is greater than allowable maximum of ‘{0}’
javax.faces.validator.DoubleRangeValidator.MINIMUM Value is less than allowable minimum of ‘{0}’
javax.faces.validator.DoubleRangeValidator.TYPE Value is not of the correct type
javax.faces.validator.LengthValidator.MAXIMUM Value is greater than allowable maximum of ‘{0}’
javax.faces.validator.LengthValidator.MINIMUM Value is less than allowable minimum of ‘{0}’
javax.faces.validator.LongRangeValidator.MAXIMUM Value is greater than allowable maximum of ‘{0}’
javax.faces.validator.LongRangeValidator.MINIMUM Value is less than allowable minimum of ‘{0}’
javax.faces.validator.LongRangeValidator.TYPE Value is not of the correct type

If you have a required field, you already have a value overwritten for javax.faces.component.UIInput.REQUIRED, but it’s not very nice, therefore you might wanna replace it with something smoother.

No comment
taintedsong.com taintedsong.com taintedsong.com

Buttersafe - a webcomic.

I would just like to recommend the web comic Buttersafe, which is just great. Here one example:

New Pet at buttersafe

And link to the comic: buttersafe.com

Freakin fantastic: A funny strip

No comment
taintedsong.com taintedsong.com taintedsong.com

Badam pysj

No comment
taintedsong.com taintedsong.com taintedsong.com

Game: Athletics.

I came across a pretty damn hard, but fun game today. The point is to run (or crawl) as long as possible. Easy, right? But this isn’t Track and Field. You have control over the calves and tights of our runner, controlled by four buttons, and it’s a real challange. My record is 5,7 meter, but I’ve heard rumours that people have gone 28 meter.

Can you beat me?

Link: Athelics game

3 Comments
taintedsong.com taintedsong.com taintedsong.com

DRE700 for president!!


Voting Machines Elect One Of Their Own As President

1 Comment
taintedsong.com taintedsong.com taintedsong.com

Mobile phone + water + one night = ?

About a month ago, my little sister got herself a new mobile phone. It was a Sony Ericsson Walkman phone, with a high pixel camera, great mp3 capabilities and other features, and my sister seemed happy with it. Unfortunately, my sister is not the best at taking good care of her phones (at the end, her last one was a total mess, I’ve never seen a phone in such bad shape, it was taped together with duct tape). Hence, one night, she dropped it by accident on the ground .. into a puddle of water … and didn’t realize she had lost the phone from her pocket. And the phone was not found until the next day.

The phone did of course not work. It’s inside was full of water and dirt, and the inside of the screen was filled with water, it was clear that this was pretty much a lost project. They tried cleaning it, heating it in the oven on low temperature, but the result remained the same: It was broken.

Some weeks later, I asked to see the phone to see how bad it was, and yes, it was pretty damn bad. The inside looked half rusted or at least pretty dirty. Still I thought I would try to fix it, and connected the phone to the charger, hoping that the screen would light up. But the phone did not react. I left it for dead, and we spent the rest of the day looking for another phone on da intarwebz.

Yesterday, I would say around two-three weeks since that time, my sister was awoken in the middle of the night by her “broken” phone ringing. It was the wake-up-service on the phone, and she could not believe what she heard. She attached her sim-card in the phone, and “booted” it up. Miraculously, everything was working just as before it was broken! The camera, sending sms, the music-player, it all worked! And this concludes this happy story.

Has anybody ever experienced something similar? Are the mobile phones today more sturdy than before? I think it’s quite amazing.

1 Comment
taintedsong.com taintedsong.com taintedsong.com

Plumbo - the base of all evil.

This is a long personal story with a lack of interesting points, so if you have something better to do, you should do that.

A while back, our sink got totally blocked, and just wouldn’t drain water at all. So I decided to buy the classic sink-drainer in norway: plumbo. I usually have great respect for such strong base powder (or any chemicals in general), and at the beginning, this was the case.

We tried pouring down some powder directly in the sink (without checking the pipes below it), but there was just not enough space, so I actually filled the hole with plumbo before I realized it was .. not enough room to pour boiling water. Therefore there obviously was a mismatch between plumbo powder and boiling water. Therefore, the plumbo coagulated (if this is the right term), and made a solid mass in the pipes.

A day later, we discovered that it was possible to remove the pipes below the sink (this we should have done earlier), and managed to remove some water and a lot of dirt from the pipes. Now my plan was to hit it with plumbo again, but it didn’t help. Some time later, we managed to remove all the pipes, including the “problem”-pipe. This pipe had a massive blockage, consisting of dirty water, plumbo and dirt, and it was a pretty hard mix.

We tried slamming the pipe toward the sink in order to remove the blockage, but it was of no use. It was at this time, a time when I was pretty mad and very eager to remove the blockage, that I took a butter knife, and stuck it in there to remove parts of it. It was at that moment that a piece from the plumbo mix jumped up at a great speed, and hit me conviently in the eye. Great.

I immediately flushed my eye in the sink for about five minutes, and didn’t feel that bad. The pain was light and I thought to myself that this was ok. But still, the eye is not something you wanna play games with, so I planned a visit to the paramedic facility (Legevakten?) the next day. This decision was based on the fact that the pain was mild (it felt like having a splinter in my eye, for then rubbing it for some time), and my vision was as good/bad as before.

The next day I waited a few hours at the paramedic facility and a doctor did some tests on my eye. Their conclusion was that I was lucky, and it appered that the damage was mostly done outside of the iris of my eye. To be sure, I was sent to an eye facility the next day, and even got an eye patch, hurray! I sure felt like a pirate. I was not sure if my eyes should be closed or open inside the patch, but I think the point was to close my eye, but the patch did a very poor job, and I must say that it was VERY tricky walking around with one eye. It felt like beeing slighty drunk.

The next day, I went to the eye specialist, (the doctor from yesterday didn’t manage to get an appointment, so it took another hour and a half before it was my turn) and a nice doctor told me that I had been lucky, and that I should be more careful with plumbo. Ow, and if you, lady doctor, are reading this: When you search at things on google, you don’t need to use the + between words. :D (And what kind of world do we live in, when googling gives you better information than calling the poison central? I guess that’s progress. :) ) I also found out that my vision is poor, so a visit to an optician is at it’s place. So now I’m on steroids (Spersadex with Chloramphenicol, eye drops), and my eyes are feeling fine.

On this journey, I learned a lot about eyes and chemical injuries, here are the key notes:

  • If your eyes have been in contact with chemicals: FLUSH YOUR EYES. For up to 30 minutes. At least 10 minutes. It’s damn important in order to milden the chemicals in your eye. This is MORE important than going to the doctor.
  • Go find a doctor. This is important if you wanna save your eye. If you have such an accident, you probably will spend 3-6 hours under a special salty sink. Not much fun, but beeing blind ain’t either.
  • When treating chemicals: Wear eye protection. All of the troubles I’ve been through could have been avoided by applying the right precautions.
2 Comments
taintedsong.com taintedsong.com taintedsong.com

Todays note:

Java EE:

If your application server crashes, and nothing works: Delete stupid .jar files from domain/lib/ext.

No comment
taintedsong.com taintedsong.com taintedsong.com

GWT, Java and Josh Bloch at Google.

I came over a great talk at youtube the other day, which I really enjoyed. It’s from Joshua Bloch, currently Chief Java Architect at Google, who has worked with Google Web Toolkit (which is like a ajax and javascript written with the Java-language), and also was part of the Java.util.Collection and java.math libraries among others. He’s also one of the guys who made the java puzzles presentation I have presented to you earlier (which is great as well).

In this talk, he discusses dynamic versus static programming languages, GWT, some of the Java libraries, why Java is great, some parts about static analysis and the program findbugs (which I recently used for a compulsory exersize (and yes, it works)). It’s presented in an interesting way, so if you are intestered in Java and such, this is a recommended watch:

No comment
taintedsong.com taintedsong.com taintedsong.com