11 June 2011

SQuirreL - a competent but low user experience SQL GUI

I have on and off used SQuirreL. It is cross-plattform cross-database SQL GUI. Well, the cross-database is limited to JDBC drivers, but it covers most databases (including H2 and Mysql). The software is written in java so it will probably execute on any plattform, although I have only used it on Windows.

The most common operation I want with a tool like this is the ability to look and edit table data. SQuirreL can do this, and this for free.

But the problem with this software is that it is hard to use. I will give three examples why it is hard to use, but there are more things so be prepared to invest a little bit of time to use it.
  1. Installer privileges
    The installer program is made with IzPack. It is easy to run the jar file just by double click on it. However a Windows user quickly realises that the installer does not run with elevated privileges so the program cannot be installed in c:\Program Files\. I have seen other IzPack installers that detects this and tried to elevate the privileges via Windows UAC feature. Why doesn't this installer doesn't do this? I had to manually start cmd with elevated privileges and run java -jar squirrel-sql-3.2.1-install.
  2. Manual installing of drivers
    JDBC driver are standardized so it is easy to implement a software to use them. But I had to manually installs my database drivers and put them in C:\Program Files (x86)\squirrel-sql-3.2.1\lib folder. Why why why? If distribution of drivers is a license issue, please add an automatic download feature in the installer that does this.
  3. How to add a new row in a table?
    I spent some time to find out how to add a row to a table. I tried to right click on a gray (blank) area in the table listing. But no luck. The solution: right click in the contents (table contents) are and a pop up menu is shown a it is possible to select "Insert Row". When you do this a hard to use row editor visualizes.

 

08 June 2011

TortoiseGit difference between Fetch and Remote Update

In the TortoiseGit application, in the "Git Sync..." dialog there is a drop down box with different options. I tried to figure out the difference between Fetch and Remote Update:
 I found this good answer on StackOverflow: http://stackoverflow.com/questions/2688251/what-is-the-difference-between-git-fetch-origin-and-git-remote-update-origin.

04 June 2011

Slow scala installer

I'm trying to install Scala using the IzPack Scala installer (a jar file). It is extremely slow. I found this post about the problem: http://www.scala-lang.org/node/9670.

Just as the post above suggests I can with Windows Sysinternals Process Monitor (Procmon.exe) see that the installer file is read many (many) times:

03 June 2011

Does Apress squeeze out books without editing?

I'm no journalist. I'm not even good at writing, but then again I'm not paid money to write. But even though I don't have high demands on my own texts I have high demands on books I buy. I recently bought two books from the publisher Apress. The quality of writing in these books have been less than mediocre. This has started me to wonder if Apress editors even reads the books before printing. Perhaps they are more concerned to squeeze out books than making sure the quality of the texts are good.

Git usability and "staging"

The company I work for has decided to switch from CVS/SVN to Git, so I'm learning Git. I have previously worked with Mercurial, so you might think that it should be easy?!

One big difference between Git and other VCS is that Git has the concept of "staging" area. Before a file can be committed it must be staged. The advantage this gives (claimed by advocates of the staging concept) is that is gives you more control over what you commit.

I'm not that convinced... I think that the motivation for this concept is weak, and it introduces a complexity to Git that is totally unnecessary. My biggest motivation for this is: you should use a GUI! If you are a command line junkie you can stop reading now a go back to your black terminal window.

It is no convincidence that the GUI of both (Eclipse) Egit and Tortoisegit completely hides the staging concept. Why? Because there is no need for it when you can select what files to commit individually.

So maybe I was a little bit harsh about "command line junkies". I myself uses a command line when it is warranted. But I firmly believes that you should use a GUI when it is better. In this case it gives an overview and you are less likely to perform errors.

01 June 2011

A (fragile) way of asserting that no Exception is logged

The best logging framework for java is probably Simple Logging Facade for Java or (SLF4J). When using this when developing a library you can be sure that your library logging will be handled whatever logging framework is used by the application.

The slf4j-simple implementation is good when executing tests. It "simply" logs to System.err. It made an effort to assert if there are any exception logged when running a Junit test case:

package se.lesc.blog;

import static org.junit.Assert.*;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class JunitSlf4jLoggerTest {

    @Test
    public void testCodeShouldNotYeildExceptionInLog() throws Exception {
        //Store away System.err (that slf4j-simple uses to log to).
        //Note: This is a bit fragile!
        PrintStream oldSystemError = System.err;

        //Re-route System.error to a buffer
        ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
        PrintStream printStream = new PrintStream(byteStream);
        System.setErr(printStream);

        //Invoke production code
        new MyProductionCode();
        
        //Make sure no exception has been logged 
        String logging = new String(byteStream.toByteArray(), "utf-8");
        assertTrue("No Exception should be found in log",
            ! logging.contains("Exception"));
        
        //Reset re-routing of System.err
        System.setErr(oldSystemError);
    }
    
    private static class MyProductionCode {
        private final Logger logger =
            LoggerFactory.getLogger(MyProductionCode.class);
        MyProductionCode() {
            logger.error("Something went wrong", new Exception());
        }
    }
}

28 May 2011

Ninite - a great way to install programs

I recently re-installed my computer (due to a disc crash). This time I tried the Ninite (http://ninite.com/) way to install software. It is a web page where you can check what programs to install. The web page has the most popular free software. When you have selected what programs to install you download the Ninite installer and run it. The installer will download and install each software automatically. I tried it and it worked great!