Monthly Archives: May 2008

Hibernate and Inheritance Mapping


Hibernate supports multiple types of inheritance mapping, some of them (Table per class, Table per subclass) using a discriminator column to decide the class. The type of the discriminator can be one of string, character, integer, byte, short, boolean, yes_no, true_false In case you need to use any other than string or character, i.e. integer, […]

Read the complete article »

Division by zero


Just a quick reminder for myself: int a = 0/0; // Throws ArithmeticException double d1 = 0/0.0; // d1 is NaN double d2 = 1/0.0; // d2 is Infinity double d3 = -1/0.0; // d3 is -Infinity Can cause some headache if things fall apart in the JDBC driver and not before. Grmpf.

Read the complete article »

Ampersands and XHTML


A regular expression to replace all ampersands (&) in a text that are not part of an entity: t = t.gsub(/&(?!#?\w+;)/, ‘&’) Language is ruby. The regexp feature used is called a negative lookahead.

Read the complete article »

SCJP, finally!


More than a year ago i decided to do the Sun Certified Java Programmer. Shortly after i bought this book, the projects at work and at home were somewhat overwhelming and after all, i realized that a big part of the SCJP is about some weird, crazy and sometimes wrong design decisions of the Java […]

Read the complete article »