Exception in thread “main” java.lang.OutOfMemoryError: Java heap space

July 5th, 2008

Just wanted to create a simple Loop with JDBC/MySQL that will read a big database table and proces the data.

Unfortunately the “Java heap space” error occured.

 The following solution worked though:

stmt = con.createStatement(

ResultSet.TYPE_FORWARD_ONLY,

ResultSet.CONCUR_READ_ONLY);

stmt.setFetchSize(Integer.MIN_VALUE);

 

This will tell the driver to step through the resultset instead of loading everything at once.

How to resize & crop images

May 2nd, 2008

If you resize images the easy way, they are either distorted or have different aspect ratios after conversion. So if you need the same image sizes after conversion, independent of the original input sizes, what you need to do is to resize and crop the image. First you resize the image so that the width and length are at least the size of the required output format - then you crop the image and cut off the borders either on the left & right or the top & bottom. Sometimes parts are missing, but this forces users to upload proper images the next time ;-)

here you go:

convert input.jpg -resize “88x” -resize “x88<” -gravity center -crop 88×88+0+0 output.jpg

Object.extend is not a function

April 24th, 2008

I currently encounter a javascript problem on IE….saying “Object.extend is not a function” - which is used inside of the lightbox.js library. Firebug doesn’t moan as much - it just lists this error in the error console…..

Object.extend seems to be deprecated?

Images outside of DIV container (IE Bug)

April 23rd, 2008

I have added a new category “CSS”. Doing CSS that works on all browser is a real pain in the neck…especially finding workarounds to tell lousy Internet Explorer how to behave.

I have had the following problem - a simple div box with images inside:

<div class=”outerBox”>

<div class=”someClass”><img src=”…”/></div>

<div class=”someClass”><img src=”…”/></div>

<div class=”someClass”><img src=”…”/></div>

</div>

IE wouldn’t display the images inside of the DIV - instead they where hovering around below the box.

The solution was: tell the parent outerBox CSS to overflow:auto;

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception

February 13th, 2008

If you ever get this error:

com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: java.net.ConnectException: Connection refused: connect

Just check your database configuration, e.g. in the case of mysql, enter the line:

skip-networking

in your my.cnf file

ProxyRequests not allowed here

October 28th, 2007

Just encountered a problem trying to configure a Proxy redirect inside an .htaccess file:

ProxyRequests not allowed here

Not a single result on Google for this String.

Altavista had a single result in a language I don’t understand.

Metacrawler delivered also a result.

Yahoo had the same result as Altavista….which redirected to Ebay :-(

org.trails.exception.EmptyModelException Model does not exist

October 26th, 2007

And today’s error message of the day is:

org.trails.exception.EmptyModelException Model does not exist

This error message occurs, while extending the HibernateEditPage.

Model does not exist. Well, this error message could also do with some more specific text…..

Unable to parse OGNL expression ’selectedList’: selectedList

October 25th, 2007

Unable to parse OGNL expression ’selectedList’: selectedList

is the error message of the day - when using the Trails HibernateEditPage…..wonder what the reason turns out to be in the end….

Ok - the solution

Inside of of the Pojos, the Annotation @Entity was missing ;-)

… implements ViewRequiresAssociation

October 18th, 2007

Google is getting worse and worse….or maybe there really is no piece of Java code that contains that ?

ViewRequiresAssociation, UpdateRequiresAssociation, RemoveRequiresAssociation in Trails

October 18th, 2007

This is to remind me to do a small example of ViewRequiresAssociation, UpdateRequiresAssociation, RemoveRequiresAssociation in Trails without having the error message that the Annotation is not allowed at this location…..