Tuesday, October 27, 2009

Eclipse SWT 3.5 and an annoying change...

after I moved a part of my software over to eclipse 3.5 to take advantage of bug fixes and new features I noticed that some of my dialogs don't work anymore.

For example the login dialog has 2 fiels. A username and a password. These fields are defiend like this:

password = new Text(content, SWT.BORDER | SWT.PASSWORD);
user = new Text(content, SWT.BORDER);


and in the key listener I validate the inputs. But with version 3.5 key listener won't work on password fields anymore and I didn't find any documentation about it. So instead you need to use a modify listener now

password.addModifyListener(new ModifyListener() {

public void modifyText(ModifyEvent e) {

Friday, October 23, 2009

duplicating a disk under OSX

since my laptop has no cd drive anymore I have no the need of cloning all my cd's with my mac pro.

How to do this?

1. Insert CD/DVD source
2. Fire up a Terminal, you can then determine the device that is you CD/DVD drive using the following command:
$ drutil status
 Vendor   Product           Rev

           Type: DVD-ROM              Name: /dev/disk1
      Cur Write:    8x DVD          Sessions: 1
      Max Write:    8x DVD            Tracks: 1
   Overwritable:   00:00:00         blocks:        0 /   0.00MB /   0.00MiB
     Space Free:   00:00:00         blocks:        0 /   0.00MB /   0.00MiB
     Space Used:  364:08:27         blocks:  1638627 /   3.36GB /   3.13GiB
      Book Type: DVD-ROM
3. Umount the disk with the following command:
$ diskutil unmountDisk /dev/disk1
Disk /dev/disk1 unmounted
4. Create the ISO file with the dd utility (may take some time):
$ dd if=/dev/disk1 of=file.iso bs=2048
5. Test the ISO image by mounting the new file (or open with Finder):
$ hdid file.iso

taken from here

Friday, October 16, 2009

OSX - upgraded my macbook pro to an SSD and the differences

After long considerations I updated my macbook pro to a SSD, from corsair. Since the price seemed to be not to outragios.

Now the tests are clear:



Disk Test    173.68   
    Sequential    132.15   
        Uncached Write    143.67    88.21 MB/sec [4K blocks]
        Uncached Write    101.53    57.44 MB/sec [256K blocks]
        Uncached Read    94.19    27.56 MB/sec [4K blocks]
        Uncached Read    351.79    176.81 MB/sec [256K blocks]
    Random    253.29   
        Uncached Write    121.43    12.85 MB/sec [4K blocks]
        Uncached Write    196.26    62.83 MB/sec [256K blocks]
        Uncached Read    1503.47    10.65 MB/sec [4K blocks]
        Uncached Read    556.60    103.28 MB/sec [256K blocks]

Drive Type ST9500325AS

 Disk Test    43.26  
    Sequential    80.53  
        Uncached Write    78.89    48.44 MB/sec [4K blocks]
        Uncached Write    68.76    38.91 MB/sec [256K blocks]
        Uncached Read    77.68    22.73 MB/sec [4K blocks]
        Uncached Read    104.42    52.48 MB/sec [256K blocks]
    Random    29.57  
        Uncached Write    10.43    1.10 MB/sec [4K blocks]
        Uncached Write    73.40    23.50 MB/sec [256K blocks]
        Uncached Read    64.02    0.45 MB/sec [4K blocks]
        Uncached Read    98.74    18.32 MB/sec [256K blocks]

I think these result's speak for them self!

my trouble with snowleopard and java5

well snow leopard messed up my java installation.

Luckily there is an easy fix to it!

taken from here

cd /tmp/
curl -o java.1.5.0-leopard.tar.gz http://www.cs.washington.edu/homes/isdal/snow_leopard_workaround/java.1.5.0-leopard.tar.gz
tar -xvzf java.1.5.0-leopard.tar.gz
sudo mv 1.5.0 /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0-leopard
cd /System/Library/Frameworks/JavaVM.framework/Versions/
sudo rm 1.5.0
sudo ln -s 1.5.0-leopard 1.5.0
open "/Applications/Utilities/Java Preferences.app"

and move java5 to the top.

Wednesday, October 7, 2009

calculating the variance - groovy style

just had to calculate some variances in a flexible way and like always groovy comes to the rescue.

static double variance(def population) {
long n = 0
double mean = 0
double s = 0.0

population.each {double x ->
double delta = x - mean
mean += delta / n
s += delta * (x - mean)

(s / (n - 1))