Monday, May 26, 2008

YourSQL and "no document could be created"

After using the smart little mysql browser YourSQL for one year on my mac, suddenly i could'nt start it any more. It gave me a "no document could be created" error.

Digging a bit gave me hints like the one descriped here (get the right compiled version for intel macs). But since it worked for me already, this couldn't and wasn't be the solution...

The problem was...
Java 6.
I recently made it my default java version.
Switching back to java 5 solved the problem and YourSQL worked fine again!

Tuesday, May 6, 2008

Fastest way to copy files

This uses nio and delegates the work to the underlying os. So this should be the fastest way...

 public static void copy(File srcFile, File destFilethrows IOException {
        FileChannel srcChannel = null;
        FileChannel destChannel = null;
        try {
            srcChannel = new FileInputStream(srcFile).getChannel();
            destChannel = new FileOutputStream(destFile).getChannel();
            long size = srcChannel.size();
            destChannel.transferFrom(srcChannel, 0, size);
        finally {
            if (srcChannel != null)
            if (destChannel != null)