« March 2004 | Main | May 2004 »

Put Champagne on ice

April 23, 2004

The good news finally came yesterday. A 2 year long fight with a major UK developer over a new St George development site in an existing woodland was over.

The results from the public enquiry had come back: the local residents, represented by SRRA, had won.

The process culminated in a public enquiry where the arguments from both sides were presented and a decision was made by the inspector:

In my judgement the overall planning balance is heavily weighted against the scheme. The manner in which the present proposals respond to the attributes and address the constraints of the site has sacrificed many environmental quality objectives for the sake of maximising the amount of accommodation. I conclude that the appeals should be dismissed and that planning permission should be refused

Have a look at the SRRA summary or download the inspectors full report.

I have learned that the democratic system is a double-edged sword. While it gave us residents an opportunity to affect the local council in their decision, it also gave the developers right to appeal a chain of decisions against their "monstrous" plans. (However their practice of submitting dual identical applications in order not to give the council a chance to reply in assigned time and thus escalating the matter was less than honest.)

The victory would not have been possible without the organisation skills and eloquence of local resident Phillipe Auclair. As another resident put it, "A whole lot of people were doing their bit but without Phillipe's help we would not have known what our bits were". Phillipe's eloquence was both a motivator to all of us and a stinging to the developer's arguments.

"Is this the end?" one of the local residents asked. "It's more like the beginning of a long struggle to keep the woodland unharmed" was the consensus of the groups leading group.



Netbeans 3.6

April 22, 2004

I have been using NetBeans 3.6 for a couple of days now and can say it's a very good improvement on the previous version 3.5.1.

(NetBeans is a free, open source development tool. Mainly for Java development but also suitable for C/C++)

The intention was to wait until end of summer 2004 and release version 4.0 but because of the fierce competition (Eclipse, IntelliJ, JBuilder and etc) an intermediate version was released with promises of what is to come.

The most prominent change is that the window system has been completely redone. Away with the clunky and very Java-ish interface. In with a leaner, more native looking and intuitive one.

While I suspect that this enhancement required a lot of work input, the user will not notice too much difference (this is good).

Other useful features include code folding, smart brackets, help with overriding methods, Servlet 2.4 and JSP 2.0 code completion and much more.

In previous versions it was needed to download several modules after an install but they all seem to be included in 3.6: database explorer, XML/XSL support, tasklists and more.

NetBeans 3.6 support J2SDK 1.4.1 and above but prefers 1.4.2 so make sure to update it from Sun web site.



Potatoes

April 09, 2004

potatoWhat happens to you if your diet consists of (too) many potatoes and you have been working long hours lately? You end up dreaming about writing software for storing data in... wait for it... potatoes.

My particular version of the dream consisted of me joining a new software project. I was briefed by a project manager that the business of sending data into potatoes is particularly tricky due to the volatile(?) nature of potato data storage.

Apparently it is not possible to know the location of the data inside a potato once it has been transmitted. Instead, some kind of feed-back mechanism had to be developed.

My first innovation in the new project was to incorporate real-time virus checking while transmitting the data to the said potato. I figured that the last thing one would want was a virus ridden potato. Makes sense in a kind of nonsense way.



Zatoichi - Kill Bill meets Stomp

April 02, 2004

I didn't know anything about this movie until I was well seated in the cinema chair. As soon as I saw that the movie was directed by Takeshi Kitano I knew I was in for a treat.

The movie is set in a small Japanese rural town run by two rivalling gangs. Zatoichi who is a blind masseur but in secret is a master swordsman stumbles into this town.

Quickly he meets up with a female farmer and two beautiful dancing and singing sister. Their goal becomes to fight the two gangs that are ruling the village and bothering the farmers.

Zatoichi's nemesis is a ronin (Samurai with no owner) who as well is a master swords man. He is hired as bodyguard by one of the gang's bosses and thus is put against Zatoichi.

Humour plays a big part in the movie, often serving as a relieve from violence and graphic scenes. The humour was sometime bit too childish from time to time but overall generated a nice atmosphere.

So, what does Stomp have to do anything with this? You'll have to watch the movie, especially the ending, to find out.



Validating a DB Connection

April 02, 2004 You may have been tempted to execute Connection.isClosed() to test whether a connection is live and can be reused. This is however not sufficient as the Sun JDBC API guide states:

"Note that the method Connection.isClosed is guaranteed to return true only when it is called after the method Connection.close has been called. As a result, a programmer cannot depend on this method to indicate whether a connection is valid or not. Instead, a typical JDBC client can determine that a connection is invalid by catching the exception that is thrown when a JDBC operation is attempted."

The only safe way of ensuring that a connection is valid is to execute a tiny query and catch any SQLExceptions thrown. If no exceptions are thrown, you can go on and using that connection.

If any exceptions are thrown, it is safest to close that connection, set the reference to null and create a new connection.

What query to execute?

It would be nice to execute a general (database independent) method like Connection.getMetaData(). Unfortunately I have seen some indication that this may be successful even when a connection is invalid.

To be on the safe side it is best to execute a query like "SELECT COUNT(*) FROM WHERE 1 = -1". We are using SQL server so the table sysusers is a safe bet:

    /**
     * A method that tests whether a connection is valid by executing
simple query and catch any exceptions

     */
    private boolean connectionIsValid(Connection dbConn) {
        //log.debug("ENTER connectionIsValid(): "+dbConn);        
        boolean result = true;
        
        PreparedStatement psr = null;
        try {
            //Prepared statement is used to cache the compiled SQL
            psr = dbConn.prepareStatement("SELECT COUNT(*) FROM sysusers WHERE 1 = -1");
            psr.executeQuery();
        catch (SQLException e) {
            log.debug("Excpetion occured, connection is not valid. "+e.getMessage());
            try {
                dbConn.close()//dbConn is never null at this point
                dbConn=null;
            catch (Exception ee) {
                //quite
            }
            result = false;
        finally {
            try {
                //free up resource kept by the test statement
                if (psr!=null) {
                    psr.close();
                }               
                psr=null;
            catch (Exception e) {
                //quite
            }
        }        
        //log.debug("EXIT connectionIsValid(): "+result);
        return result;
    }