Tuesday, October 30, 2007

Java 6 meet Linux on MacBook Pro

It seems there's no Java 6 in the new OSX Leopard from Apple.

I mean, it's not like it's been almost 11 months since SUN released Java 6 on Linux, Solaris and Windows. And I bet it's more than an year since Apple started getting code for Java 6 from SUN in order to customize it in due time.

But I guess the iPhone and transparent menu is far too important to actually put some developers work on Java.

It's bad enough that they are supposed to force down on my throat a new OS release for a new JDK version -- I just want Java 6 on Tiger thank you very much. But now, they are delaying even that !

So, I'm thinking that in the future I'll probably go back to Linux and stay there. I thought proprietary Microsoft software is bad; well, I'm starting to believe maybe proprietary Apple software is just as bad (only prettier).

Hence, the first step is to get Linux working and see the hardware support. Because if it's not good enough I might just go for a Thinkpad.

What about that Apple ?

Monday, October 22, 2007

Coupon or negative numbers' marketing

I've noticed a little trend in TV commercials nowadays in Romania and it also applies to computing: new commercials or new advertisements always underline the negative number, the "user gain". Stay with me...

So, you want a new car ? Well, our car is the best: it's 1000 euro "buyer (bar)gain".

Want to be subscribed to our useless service ? How could you refuse: the first month is free!

Why don't you migrate to the new version: it's 10% faster !

Want to take a 20 year long mortgage for 100K euro ? We are the best: we give you 4K euro for free.

As you noticed, all these advertisements avoid the real issue. They avoid, the actual price (or actual speed, actual time to completion, etc).

All they brag about is that you get this discount or that super-offer. But they don't even bother to tell you the actual cost anymore.

I mean, in their mind, getting anything for free should be reason enough for people to buy their product. Makes sense to me... NOT.

My opinion is that this coupon advertisement is trying very hard to confuse the buyer. Because if anyone uses the same unit for their product like price, it's easy to compare products.

But how hard is it to compare an offer where I get 2 free months with one that gives me a free (cheap) cell-phone or another one where I may have already won an all-expense paid trip to the Bahamas. See ? It's almost impossible.

So, please, marketing gurus, stop telling me things I don't care. Tell me things I can quantify: if I get a discount, how much will it still cost ?; if your product is faster than the old one, how fast is it actually (maybe the old product ran on Cyrix processors).

The exception is when I already am a customer so I do care what I have to gain. 10% speed: sure ! Half memory usage: excellent ! Less CPU usage: even better.

Thursday, October 18, 2007

New NetBeans Platform-based tool

I just noticed on my RSS feeds some talk about VisualVM so I went and downloaded it.

First, by the screenshots alone it was clear to me it's a NetBeans Platform application. Also, the charts look awfully like the NetBeans Profiler ones. Well, lo an behold, it is a simple Platform application holding the profiler cluster.

What's annoying me is that the profiling part only works with Java 6 (not available on OSX). But the NetBeans Profiler does work with Java 5 if we just configure the proper agent. I would have been nice for VisualVM to also use the agent as not everyone is using Java 6.

Second, the OSX integration is less than stellar (it's the 1st release so I'll excuse them). The menu doesn't show up on the apple menubar the 1st time you run the tool (but on subsequent runs it does, strangely). Also, no launcher like in the IDE.

Oh, forgot to mention it uses the NetBeans Platform from NetBeans 6. Looking good guys.

Thursday, October 04, 2007

(Maven) Building to a ramdrive

I own a MacBook Pro and I have a few projects with Maven (and MevenIDE on NetBeans).

What's annoying me with the build system is that it usually writes a lot to the disk. Not only is that quite unnecessary (as the files will be overridden in no time) but the laptop hard-disk is also quite slow and all this writing is trashing it.

The solution: write to a ramdrive ! As you all know, a ramdrive is a "virtual" hard-disk that sits in your RAM and goes away when you shutdown the machine (not that I care, the build files are temporary).

First step: create the ramdisk

There are some utilities that do this, but it's quite doable from the terminal (eventually with a shellscript).

  1. First, get your disksize in MB and multiply it by 2048. So 256MB means 524288.
  2. Next, create the device: hdik -nomount ram://524288 The command will also display the name of the new device file.
  3. Create a HFS filesystem in there: newfs_hfs -v "disk name"/dev/diskXXX , where diskXXX is whatever the previous command printed
  4. Mount the filesystem: mkdir /Volumes/diskXXX &&
    diskutil mount /dev/diskXXX
You'll probably need to run some of these commands as root (su admin-user, sudo sh). I also set my non-admin user as owner with chown -R myUser:myUser /Volumes/diskXXX

At this point you should have a new 256MB drive mounted.

Second step: link maven folders


Now, I have to set the "target" folders on the ramdisk. Normally the orthodox way is to change the pom but I just didn't get it working. So my old-school solution is to use symbolic links.

This could be smarter as a "mvn clean" will remove the links we just create (but just keep a script in place that recreates this).

My script is:

for i in *; do
echo $i;
mkdir -p "$1/$i/target";
ln -s "$1/$i/target" "$i/target";
done

and I run it in the folder that keeps all my Maven projects (a flat hierarchy). Note the $1 which is the argument to the script. I use it like this:

$./linkramdisk.sh /Volumes/diskXXX

Building

All the links are in place so you can try a mvn install and see how fast it works. I my case, I reduced the build time (with no unit-tests) from 27 seconds to 17 seconds.

That doesn't seem much, but it does add up for larger projects and most importantly, it keeps the hard-drive out of the loop.

Oh, did I mention I also use FileVault on my account ? That's another reason one would like to avoid writing to disk: no need to encrypt something useless like a build artifact...

The Trouble with Harry time loop

I saw The Trouble with Harry (1955) a while back and it didn't have a big impression on me. But recently I rewatched it and was amazed a...