Educating the world

Our blog has over 10,000 readers a month

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.

Japanese Tour - Conclusion

March 20th, 2010

There’s no way you could say you’ve seen England if you had just visited London and Birmingham, so I won’t try to make you believe I understand Japan from seeing Tokyo and Osaka.

When I told people I was going to Japan, everyone said “it’s really expensive", “no one speaks English” and “they only use cash, so no credit cards". All of these statements turned out to be false.

Maybe it’s just me, but I found the best places to eat were Japanese noodle bars. These are canteen style food bars which sold udon (thick) noodles and rarmen noodles in a soup with vegetables or meat. Some rice dishes were also available. A filling meal could be bought for ¥450-600, and they didn’t hang around when it came to serving. Some of these food places (particularly at stations) were standing room only. They were frequented by most of the locals from business men to street workers. I didn’t seen any non-Japanese people at any of these places.

A great man once said: “Communication is more than just about words” (thanks Dad) and he is absolutely right: there’s pointing and jumping around. But seriously, I found that almost everyone I came across knew a couple of words relating to their job. For example, the station master knew “platform” and numbers. Most of the people in the street knew a splattering of English and everyone else could signal “straight on then turn left". For all those other things I had Swifty’s “Point It” book - a handy book with 1,200 pictures of every day items.

A lot of the restaurants had photos and in most cases they had made the actual meal and left it outside in a glass box so you could see what you were getting. I purposely picked things I didn’t recognise (blind ordering) because I wanted to experiment with the local food.

Pretty much every sign post had an English translation underneath. The spelling was pretty bad, but it has to be said, better than mine! Most of the shopping centres were filled with British and American stores. After travelling through most of them I was surprised how little Japanese there actually was. Since the last Emperor embraced western culture in the spirit of learning, even to the point to wearing western suits, the whole country has followed behind him.

I brought ¥40,000 (£315) out here with me for 7 full days and I’m bringing home ¥7,000, and I haven’t been watching the pennies. It was around ¥2,500 per night in the hostels and they all accepted credit cards. Day passes for the metro where only ¥1,000. Most of the tourist attractions were either free or ¥600-700. The most expensive things where coffee and posh cakes in western style coffee shops. One couldn’t Switch a loaf of bread and a pint of milk like you could in England but who cares.

The restaurant that Koichie took me to was pretty expensive and if you ate like that every night then I can see how the cost would crank up. I wanted to do what they do, live how they live, which is why I got up early and did the journey to the tourist spots with the commuters. After a day of tourist stuff, I switched district with them. If there is one thing I’ll say about communing, it’s that it is eerily quiet!

I found the Japanese people warm and welcoming. The cities seemed crime free and I hardly saw any dodgy people. I didn’t feel like I had to watch my bags or my back!

The whole ethos of the country is different. They are one, working and living to serve the country as a whole. There’s almost no fat people partly because of the low fat diet but mostly because everyone is active. There is a job for every one - even if it is guarding a hole in the ground. You never see anyone working on there own, even in tiny shops there are 2 assistants. I’m sure it is more expensive to run an economy this way but the total cost is balanced across the whole of it. Low unemployment, people can retire at 60 but most of them stay on with a small wage from the government to sweep the streets or supervise road maintenance safety - and they do it because they want to.

On the whole, I have enjoyed my time here and can thoroughly recommend it. When I’ve seen the rest of the world this will be the first place I will see again. Thank-you Japan.

Here are all the journal entries:

  • Japanese tour day 1 - Travelling to Tokyo, Virgin Atlantic’s lovely air stewardess, Asakusa.
  • Japanese tour day 2 - Tsukijishijo fish market, Amidi Budda temple, Ginza, Nissan Gallery, Imperial Palace, Japanese government buildings, real pawn sushi diner.
  • Japanese tour day 3 - Imperial Palace Gardens, Emperor official gift museum, currency museum, Suitengu Shrine - Seven Deities of Good Luck, Akihabara, make friends with noodle bar family.
  • Japanese tour day 4 - private train lines, Shinkansen (or Bullet Train), Shin-Osaka, Osaka, Yakuza, making more friends in a pub/noodle bar.
  • Japanese tour day 5 - Osaka Castle, befriended by a Japanese tourist, Peace Osaka, resturant recommended by friendly stranger, an Englishman working there, Tenjimbashi-suji shopping corridor, Mitzumi and the mad woman, map mystry solved, Namba, Takayumi, sketch for diner.
  • Japanese tour day 6 - Sycophantic Floating Garden Observatory, super effecient Shinkansen (or Bullet Train), Sanyo Fin, kimono, Koichi’s chicken diner, more girls than boys, Mount Fuji.
  • Japanese tour day 7 - showing people around, you again!, Odaiba, Shimbashi mono rail, Fuji TV, White Day, shopping centre, Liar Game, Menji park and shrine, Akihabara, big sushi meal.