Datamal Blog

Friday, April 28, 2006

Representing Monetary values in Java.

Using float to represent a monetary value is a bad idea because the floating point number is not the true number but the closest approximation. So you will get rounding errors this way. BigDecimal is what you should use for monetary calculations, all very well explained here.


There is also a currency class which can be investigated further too.

Tuesday, April 25, 2006

New web framework

Click is a new web framework with Spring Integration.

Hashing a file in three lines

Try this as a quick way to hash files.

Why is Tomcat called Tomcat is one of those questions which is answered for us here along with the burning question why Java is called Java.

Web Testing in Java

Good question asked here about the lack of integrated Web Testing available out the box in modern IDE's. He did mention some of the candidates including :-


A useful alternative was suggested by A. Slominski:-

Very good workaround is to use embedded servlet container (like tomcat) and create new JUnit test runner that starts embedded tomcat before tests and shuts it down when test are finished - it is very fast, no WARing, and you can set breakpoints both in server and application code …