Friday, 17 July 2009

Desktop shortcuts

Under Linux these are called launchers. It took a little while for me to spot this and I was trying to make these the hard way. But Ubuntu's right click menu on the desktop has a 'create launcher' option and that pretty much does it. You get to pick an application type, name it and put in a command. Simple. Well, not quite.

It is simple if you are just trying to run something like an executable which will pop up its own window and let you drive it. I wanted to run a build script and have it wait when it finished so I could see what happened.

The last bit is really important because builds often fail and it is, obviously, a waste of time to go test against a build that did not make it.

I googled and found various advice but none of it quite worked for me, though it did for other people. Here is what I ended up doing:

The command is
gnome-terminal --window-with-profile="keep" -e "/home/mrkimi/project/buildscripts/publish_framework.sh"

People suggested xterm instead of gnome-terminal but that did not work for me. Another thing that did not work was using $HOME instead of the full path. But the command is only half the story.

If you open up a terminal (and this is, of course, a gnome-terminal) there is a menu along the top of the window (no, I never noticed it before either). Use the Edit menu to open up the profiles dialog and create a new profile. I called mine 'keep'. Now edit the profile and look under the 'Title and Command' tab. There's a setting for 'When command exits' and I picked 'Hold the terminal open'.

This means that the terminal window doesn't just close, it waits there until I close it manually.

Some people suggested using the 'read' command to make the terminal wait, and that would save messing about with these profiles and settings. I gather read works like pause under windows. Except that it didn't for me, so I'm going with this approach.

Now I have my build script on a desktop icon just as I wanted and I can see how it finished.

You might wonder why I don't just launch the build from Eclipse. It is just an ant script and Eclipse is good at that. Well, normally I do but this particular project was put together by people who didn't know that and some of the decisions they made were a little strange. Some things you have to just live with, but a decent shortcut (sorry, launcher) to the build script makes it easier.

Friday, 10 July 2009

Linux is fast

I have now officially switched my laptop to Ubuntu 8.04 (Hardy Heron) from Windows XP.
The laptop is a Dell Inspiron 9400. I got it about two and a half years ago and I might have upgraded it sooner except that the new ones all come with Vista and I heard so much bad stuff about Vista that I held back. I figured the way to get past Vista was to switch to Linux and rather than deal with a new machine and a new o/s at the same time I also figured I could do it right away at my own pace.

I got a new disk: a 2.5" SATA drive that fits into the hard disk slot in the laptop, so I can keep the Windows disk for when I need it. I have been slowly walking stuff over to the new disk. I need this machine as my development environment so everything had to be verified before I could switch. I do this stuff carefully.

Anyway, I got to the point where I could run a build on my current project under Linux. This is Eclipse plus Ant building an ear file for deployment on JBoss and Glassfish. Everything works. But, even more interesting: it works much faster.

Doing a full build under windows takes 11 minutes and 40 seconds. Doing the same thing under Linux takes 44 seconds. Yes, 11 minutes shorter. Okay, I had a think about that and I find if I turn off Norton's virus monitoring for the relevant directories it drops to around 5 minutes. But we are still way too slow. My colleagues are using Windows XP on quad core desktops, newer and faster than my laptop. Their build times are two minutes. I'm still ahead.

Some of the difference can be accounted for by the new and much cleaner disk, it is possibly a faster disk too, not sure. Otherwise the hardware is identical. I'm not sure though, that seems a lot of time to account for with just the disk.

I have heard about Windows 7, and I've heard it is better than Vista. But right now I'm pretty happy with what I have. I've got a faster machine and I did not have to buy a new one.

Thursday, 2 July 2009

Unbuntu+Eclipse+Subversion

I got mine working. It was not easy or obvious and it took a fair bit of searching to find the right combination. Under Windows this is easy because there are no choices (well, no obvious ones to me). Under Linux you have to know more about what is going on and there is a lot to know. My approach to these things is to find out just enough to get it working. I have a lot of hard problems to solve, I don't want anymore, I just want this to work.

Under Windows I thought I just installed Subversion, actually I think someone set it up and put it all in a zip file which is what I loaded. That all just worked. So I took a closer look at my Windows system.

There is a plugin called Subversive from polarion. It depends on a connector called JavaHL which is a Win32 binary file, so no use under Linux. Okay, so I need to do something different. Googling revealed another product called Subclipse which is (I think) from Tigris who also do the Subversion server. Got that? Three products that start with 'Sub' easy to get mixed up here.

Both Subclipse and Subversive can use the JavaHL binary. Some people have pulled the JavaHL source and compiled it. But that seems to be no longer necessary because you can install it using the Package Manager now. I tried this, including editing the eclipse.ini file to add the special option but it did not work for me.

The other approach that both of these clients use is the SVNKit which is Java all the way down. I installed that and it works fine.

This is the list of relevant stuff in my Eclipse 'Software Updates and Add-ons' the Installed Software tab.



This is what my subversion page looks like in my windows->preferences:Team/SVN:SVN Connector



I have yet to find any missing features with this approach. Maybe there is a speed issue but I'm on a slow link at the moment and it is... slow, but no slower that I would expect. It handles file compare just fine, some things I read suggested some combinations of things wouldn't do that.

The crucial urls you need (and these things seem to shift over time so this is only correct today):
http://eclipse.svnkit.com/1.2.x/
http://community.polarion.com/projects/subversive/download/eclipse/2.0/ganymede-site/

Just to be precise about versions:
Ubuntu 8.04 Hardy Heron
Eclipse 3.4