Educating the world

Our blog has over 10,000 readers a month

7-Zip's context menu doesn't work under Vista

February 22nd, 2010

Under Vista 7-Zip’s context menu extensions don’t work, everything else about 7-Zip works as normal.

There seems to be something funny about the i368 version of 7-Zip when running under Windows Vista.

To make the context menus work:

  1. Uninstall current version of 7-Zip.
  2. Download the x64 version of 7-Zip.
  3. Install it.

For some peculiar reason the context menu editor is held down 10 layers of menus. I think it’s just because the menu editor is a plug-in. Hopefully, in the next release they’ll integrate this functionality into the actual application so that it’s a little easier to find.

To edit 7-Zip’s context menus:

  1. From the menu select Tools-gt;Options.
  2. Select the Plugins tab.
  3. Highlight 7-Zip and click the Options… button.
  4. Select the System tab.
  5. Ensure Integrate 7-Zip to shell context menu is checked.
  6. Finally check any options you would like to include in the context menu.

1 and 1 hosting package is awful

February 20th, 2010

A customer of mine had their own root server with 1and1. I got a call to investigate why none of their websites were working. After a bit of investigation, I realised I was looking at a half re-installed machine.

It turned out that there had been a media failure on 1and1’s cluster thing where they keep their root servers, so 1and1 had replaced the faulty disc and kicked off a system re-install for all root servers that had space on the faulty drive - WITHOUT EVEN TELLING US.

1and1’s re-install didn’t work properly so there was bits of the new drive and bits of the old drive showing through.

Of course we didn’t get the whole story straight away. They tried to blame it on us for the first few calls my customer made and it was only after I had pieced together what had happened that they actually got anywhere.

That was with the hosting people, and a story like that just wouldn’t be complete without a 1&1 Customer Experience horror story so this is one of mine:
http://www.bigsoft.co.uk/blog/index.php/2009/06/10/1-and-1-worlds-worst-customer-support

Buringing ISOs with ULeadBurn.Now

February 15th, 2010

I am writing this article because it seems to take me ages to find out where the magic switches are in the wizard to let you select “burn iso". ULeadBurn.Now’s documentation is appalling, so I’m writing this to keep it in my mind so I don’t have to make any more coasters trying to figure it out.

  1. Load ULeadBurn.Now from the start menu.
  2. When the wizard comes up select Copy Disc.
  3. In Source, click the Disc image file radio button.
  4. Hit the folder icon and select the ISO image.
  5. Make sure the destination is set to your DVD/RW
  6. Click, Copy when you are finished.

Whatever you do, don’t right click on the ISO and say “SendTo->DVD RW D:” because Vista will burn a standard DVD with an ISO on it - which is totally useless. Thanks Bill.

Simple way of sharing files on a home network

February 8th, 2010

There are several ways of sharing files between 2 (or more) PCs. The simplest is some sort of removable media such as a memory stick or DVD. You might run into problems if your file is bigger than the size of the memory stick. The trouble with copying files around, is that if more than one person is working on it there will be issues around who has got the latest version. This is where a network comes in handy.

Don’t you need a server to share files? No! You can share a directory of your hard drive with other people and you can both edit the file. This ensures there is only one copy of the file.

It’s so easy even my parents can follow these instructions. First you have to pick a computer to be the server. This is where the files actually live, so you are best off picking the computer with the most free space on it.

  1. On your desktop, double click on My Computer.
  2. This will open the list of devices and hard drives. There is a column for Free Space.
  3. Make a note of the free space, for each local drive.
  4. Make a note of the drive letter, with the most free space.

Do this on both computers to find the machine with the largest free space. The following instructions are to be applied to the computer with the largest amount of free space.

  1. Create a folder at the top level on the drive with the most free space.
  2. Call the folder “shared", so that the address bar in Windows Explorer reads “C:\shared” - where “C:” is the drive letter with the most amount of free space.
  3. Inside Windows Explorer, find the “c:\shared” folder, right-click on it and select Properties.
  4. A window will pop up with information about the folder. Click the Sharing and Security tab.
  5. Click the Share this folder radio button. The Share name will be filled in for you with the name of the folder.
  6. Click the Permissions button to alter how much control you want to give the other person. To give yourself an easier life just set the permissions to Allow Full control to Everyone.
  7. Click Ok until you are back at your desktop.

In order to tell other people what our new share name is, we must find out our network name. This is usually referred to as the hostname.

  1. Use the mouse and click the Windows Start menu.
  2. Select Run…
  3. Type: command and press return.
  4. In the box that opens up type: hostname
  5. Make a note of what the hostname is.
  6. Close the box.

You now have all the pieces needed to construct your share name, which looks like this:

\\david\shared

where david is what my hostname command spat out and shared is the name of the folder we are sharing.

Hurray you have just set up a shared folder on your PC. Next we are going to move to the other machine and set up access to that shared folder.

  1. Load in Windows Explorer.
  2. From the menu bar at the top, select Tools, then Map Network Drive…
  3. Select a drive letter. I usually pick a letter that is furthest from my other drive letters, for example “Z:".
  4. Set the Folder to the share name we constructed above, substituting your hostname in place of mine.
  5. Check the Reconnect at login to make sure your connection doesn’t disappear when you switch off your computer.
  6. Click Finish.
  7. Windows will think about it for a while (I don’t know why but this can take up to a minute).
  8. Windows Explorer will refresh with your new “Z” drive.

Well that was easy wasn’t it!

Java's File.renameTo fails on Windows

February 2nd, 2010

I had a problem with renaming a properties file. Java’s File.renameTo() always failed and returned false. There was no explanation as to why it failed, so it left me stuck with no idea what to do.

Windows has a different file locking policy to Unix (and everyone else). Under Windows, if a process has a file open no other process can rename, move or delete the file until that process has closed all handles to it. As if that wasn’t bad enough, if you do leave a file open and your code finishes running the file will still be locked after an unknown amount of time. It could be 30 seconds or it could be never. Hurray for windows :(

So you must ensure that the file you are trying to rename is completely closed. My problem turned out to be in the loading and saving of properties files. Almost all the example code you download relating to reading and writing properties is wrong. Properties.load() and Properties.store() both take file streams. If the stream is still open then the file will be locked.

Most of the examples tell you to load the properties like this:

Code

Properties properties = new Properties();
properties.load(new FileInputStream("filename.properties"));

and save them like this:

Code

Properties properties = new Properties();
properties.store(new FileOutputStream("filename.properties"));

I was under the impression that store and load closed down the stream after they had done their business, but this is not the case. The streams are left open. So when you use the methods above to create a file and read from a file you are leaving the handle open. What’s worse is that because the FileInputStream and FileOutputStream are in-line there is no reference available to close the streams down - and you are stuffed!

The correct method of reading from a Properties file is:

Code

FileInputStream in = null;
Properties properties = new Properties();
try
{
  in = new FileInputStream("file.properties");
  properties.load(in);
}
finally
{
  if (in != null) in.close();
}

and similarly, writing to a Properties file:

Code

FileOutputStream out = null;
Properties properties = new Properties();
try
{
  out = new FileOutputStream("file.properties");
  properties.store(out);
}
finally
{
  if (out != null) out.close();
}

Now, after reading and writing, you have explicitly closed the file and you are free to rename the file without error.