Educating the world

Our blog has over 10,000 readers a month

Why do I use Green Energy?

May 1st, 2010

I don’t want to live in a country that is dependent on oil and I am prepared to pay to make that happen. Being able to generate an unlimited amount of free electricity is the holy grail and once we have achieved this many of the international and political problems would disappear. Imagine how the world would be different if oil, coal and gas were worthless. The saving the environment angle is just a bonus!

STS brakes after uninstalling Java

April 15th, 2010

As new versions of Java are released the Java updater automatically installs them. The number of Java installations on your computer increases. Normal PC housekeeping dictates that you delete the old versions because they are no longer in use.

I used the Window’s Add and Remove Programs option in the Control Panel to un-install all the old JREs leaving only the latest versions. I do a lot of Java programming and I rely on the environment variable JAVA_HOME to tie together a lot of my build scripts and development environments.

When I tried to load Spring Tool Suite (STS) it wouldn’t load and gave the message:

A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run STS. No Java virtual machine was found after searching the following locations: c:/Java/Java/jdk1.6.0_16/javaw.exe

The path of javaw.exe was one of the versions I had un-installed. Even though I had reset the JAVA_HOME and updated the path to point to the new JAVA_HOME/bin it still wasn’t picking up the correct path of the Java installation.

So here is how to fix it:

  1. Find your installation of Spring Tool Suite
  2. Change to that directory
  3. Load the file STS.ini into your favourite text editor.
  4. Change the old command line path from the old version of Java:

    -vm
    C:/Java/Java/jdk1.6.0_16/bin/javaw.exe

    to the new Java path:

    -vm
    C:/Java/Java/jdk1.6.0_18/bin/javaw.exe

    In your set up the version will be different.

    Where 1.6.0_18 is the full path to my latest Java installation.

  5. Save file and re-run Spring Tool Suite

Copying files to a remote share on windows

April 13th, 2010

When you are writing batch scripts (programs that run in the background without user intervention) you often need to copy a file on to a remote machine. If you are not already connected to the machine you will get this message when you try to initiate the copy:

C:\>copy file.txt \\remote-host\c$
Logon failure: unknown user name or bad password.
0 file(s) copied.

You have tried to access a share that is password protected. You must connect to the share and authenticate yourself. It’s easy to do this via Windows Exploder->Tools->Map Network Drive… but how do you do it without using the Windows user interface?

As with all Windows commands it is overly complicated and not very simple to remember, so here are a couple of cheat sheets to connect to, view and disconnect from windows shares.

Connect to a share

net use z: /user:domain\user \\host\share password

See the status of a share

net user z:

Disconnect from a share

net use z: /delete

If you don’t specify a drive letter to map the share on to then you can only reference the share by its full name (\\host\share). You must also disconnect using the full path as well, for example:

net use \\host\share /delete

So to copy a file to a remote machine you can use the following lines:

net use z: /user:domain\user \\host\share password
copy my-file.txt z:\their-file.txt
net use z: /delete

or

net use /user:domain\user \\host\share password
copy my-file.txt \\host\share\their-file.txt
net use \\host\share /delete

depending on whatever floats your boat! Well ok, it’s not that complicated.

Change Plesk 9.3 Horde IMP mail list rows to be selectable

April 6th, 2010

The current version of Plesk 9.3 uses Horde 3.1.7/Imp 4.1.6 which is a little on the old side, but I’m pretty sure this change hasn’t made its way into the new version either.

One of the features of the current mailbox page is that when you select the checkbox it highlights the row. This is very nice, but from a user’s point of view the whole row should be a selectable object. Why should the user have to click the tiny area of the checkbox when the row spans the whole page.

So the problem is how can I make clicking on the row check or uncheck the checkbox.

The solution requires you to update the horde/imp sources so you must have access to them. It is also in an area of Plesk that will be overwritten by future Plesk updates.

First we must move the selectRow onClick operation from the checkbox to the row.
Go to : /usr/share/psa-horde/imp/templates/mailbox

Edit: mailbox.html

Change table row element to:

XML

<tr id="row<tag:messages.uid>" class="<tag :messages.bg>" onclick="selectRow(<tag :messages.uid>);">

and remove the onClick from the checkbox element changing it to:

XML

<tag:overflow_begin><input id="check<tag:messages.uid />" type="checkbox" class="checkbox" name="indices[]" value="<tag :messages.uid><if :search_mbox><tag :idx_separator><tag :messages.mbox></tag></tag></if>" /><if :messages.status><tag :messages.uid>"><tag :messages.status></tag></tag></if><tag:overflow_end>

Next edit javascript.inc and search for “function selectRow".

Change the if statement to:

Code

if (rowOb.className.indexOf('selectedRow') != -1) {
  rowOb.className = rowColors[rowId];
  rowOb = document.getElementById('check' + rowId);
  rowOb.checked = false;
} else {
  rowColors[rowId] = rowOb.className;
  rowOb.className = 'selectedRow';
  rowOb = document.getElementById('check' + rowId);
  rowOb.checked = true;
}

All done!

My perfect 10 pin bowling conditions

April 1st, 2010

Due to the fact that I currently go 10 pin bowling about once a year with work’s sports and social, I forget what conditions I need to set up for myself to play well. It usually takes 2 games of fiddling to remember my technique (such as it is), by which point it is too late.

This is after all my blog and this is something I want to remember, so sorry if it’s not relevant for you. Well it might be if you are shaped like me. These are my conditions for bowling well:

Shoes: Size 10.5
Ball: Weight 12
Stance: Slightly to the right of the central floor marking, angle body a tiny bit to the right.
Bowl: Wiggle your bum, take 3 steps and throw.

The wiggling your bum part turned out to be quite important. It turned it into a joke and made me more relaxed. When I knew victory was within my grasp I could feel the adrenaline start pumping and that’s when things started to go pear shaped.

Evidence:
Score before wiggling 95.
Score with wiggling 165.