Date intervals in PostgreSQL

Recently I had to use PostgreSQL date functions. PostgreSQL manual states that it is possible to add an interval to a date using:

select date '2001-09-28' + interval '1 hour'

It doesn’t state that interval can be more complex, like this:

select date '2001-09-28' + interval '5 day 13 hour 11 minute 5 second'

Update – Netbeans 6.5 on Ubuntu/Kubuntu 9.04

After installing Kubuntu 9.04 I checked for NetBeans version in repository – and it was 6.5.

So now official way of installing NetBeans 6.5 is:

sudo apt-get install netbeans

This will install NetBeans and a lot of dependencies. After download and installation are finished, you will have NetBeans properly installed on your computer.

This means that manual installation as described before is discouraged, at least until NetBeans 6.7 is released.

Installing Patch 1 for NetBeans 6.5

First patch for NetBeans 6.5 was published on December 9th 2008.It brings number of enhancements and bug fixes.

Patch should be installed through NetBeans update process.

Open Tools -> Plugins menu.

In Updates tab, after clicking Reload Catalog button we’ll see ‘Auto Update Services’ available:

update-nb65-1

Continue reading

How to Install Eclipse 3.4 (Ganymede) on Ubuntu / Linux

Eclipse is leading open source development environments for Java, with support for JEE and JME development and entire ecosystem of plugins that makes it suitable for any software development task.

At the moment of writing, Ubuntu repositories contain Eclipse 3.2.2 while latest release is version 3.4.1. If one wants to stay current with Eclipse version, it has to be installed manually.

Continue reading

Customizing PMD rules on NetBeans 6.5

In previous article we have shown how to install and run PMD plugin in NetBeans and how to interpret the analysis report. In this tutorial we will show how to choose rules that are applicable to our project and how to define our own rules if predefined doesn’t satisfy our need.

Continue reading

Install and Use PMD plugin on NetBeans 6.5

There are more than few tools that help us maintain the code we write correct and working. We can divide them in source code and class file analyzers.

One of them is PMD, tools that is actively developed since year 2000. It is mature and provides integration with all important IDEs. On the PMD website, developers say that PMD checks:

  • Possible bugs – empty try/catch/finally/switch statements
  • Dead code – unused local variables, parameters and private methods
  • Suboptimal code – wasteful String/StringBuffer usage
  • Overcomplicated expressions – unnecessary if statements, for loops that could be while loops
  • Duplicate code – copied/pasted code means copied/pasted bugs

In this article we will show how it can be installed and used in NetBeans 6.5.

Continue reading

Como instalar NetBeans 6.5 en Ubuntu / Linux

Netbeans 6.5 es recién publicado. Por suerte, existe un instalador por Linux y aquí voy a mostrar como funciona:

Por descargar instalacion de NetBeans, haz un click sobre:

http://services.netbeans.org/bouncer/index.php?product=netbeans-6.5-java&os=linux

Por asegurarse que archivo esta descargado correctamente y que su contenido es original, puedes calcular su suma verificadora md5 y comparara con valor del sitio de NetBeans:

md5sum netbeans-6.5-ml-java-linux.sh

Para poder ejecutar el archivo, abre una linea de comandos y en la carpeta donde está el archivo ingresa comando:

chmod +x netbeans-6.5-ml-java-linux.sh

y despues podemos ejecutarlo:

./netbeans-6.5-ml-java-linux.sh
 Continue reading 

Installing and using Code Coverage plugin in NetBeans 6.5

One of techniques to ensure that software is properly and thoroughly tested is to get code coverage information and find which blocks of code weren’t executed at all.

There is a number of code coverage tools for Java applications. One of them, free and mature is Emma ( http://emma.sourceforge.net/ ) which is one used by NetBeans code coverage plugin.

Installing plugin

To install plugin, select Tools -> Plugins and choose “Code Coverage” in the list of available plugins:

code-coverage-1

Continue reading

Installing NetBeans on Ubuntu – official way (updated)

There is NetBeans package in Ubuntu repositories. The official and supported way is to install it using apt. In that case, NetBeans will be updated automatically.

Problem with this approach is that current NetBeans package is not the last one. On November 23rd 2008 it was version 6.01. In case that you need newer package, follow procedure described in Installing NetBeans 6.5 on Linux / Ubuntu.

Continue reading

Adding Sybase JDBC driver to NetBeans 6.5

NetBeans 6.5 includes JDBC drivers for Postgresql and Mysql, two most popular opensource databases. Database integration in NetBeans is done is such way that it is possible to create database connection and use it in built-in SQL client or JPA modelling/programming.

In order to use databases more common in enterprise world, we need to add a JDBC driver to NetBeans.

In this example we will add and configure Sybase database connection.

Continue reading