08/06/2012

[PL/SQL] Test a string for a numeric value

In PL/SQL, you can easily check whether a string contains numeric values with:

LENGTH(TRIM(TRANSLATE(string, '0123456789', ' ')))

This will return null if the string contains only numeric characters otherwise it will return the number of non-numeric characters in it.


27/05/2012

[How to] Run multiple Firefox instances

If you'd like to run multiple Firefox instances on Windows without having to fiddle with the profile settings and maybe run different versions too, you can always install both Firefox and Firefox portable (no need to have the same version).

Simply browse to the Firefox portable installation directory and edit the FirefoxPortable.ini file changing AllowMultipleInstances=false to AllowMultipleInstances=true

That's it, you can now run the two browsers side by side.

14/03/2012

Grog application development

So, you decided to give Grog, the PaaS based on OSGi for Public Administrations and private networks a try and downloaded, installed and configured it. Now you'd like to test it with some applications of yours, but how?

In this post  I will describe how to develop and package an OSGi application so that it is Grog-ready.


28/02/2012

10/02/2012

[Java] Find free port

Getting the number of an unused port on the system via Java 7 is as easy as:


import java.net.ServerSocket;


public static int findFreePort(){
int port = 0;
try(ServerSocket server = new ServerSocket(0)){
port = server.getLocalPort();
}catch(Exception e){
System.err.println("unable to find a free port");
return -1;
}
return port;
}


We do not need to call a server.close() since Java 7 does that automatically for us as we used the new try-catch block with resources declaration

03/02/2012

[Java] Access MySQL with Hibernate

In this post we will give a fair example on how to access a MySQL database via Hibernate in Java.
For this example we will be using MySQL server 5.5, Hibernate 3.3 and the Eclipse IDE.