Yes, I am Portable Apps happy recently, that’s because I’ve only just discovered it, and it’s also saving a lot of headaches for me which may occur in the future.  Today I looked up getting Eclipse working under Portable Apps and what d’ya know? It works perfectly.  Personally I followed these instructions to do it with my JDK6 VM (not the latest U build though) and the latest copy of Eclipse and it worked without a hitch.

Setting up the workspace however should - in my opinion - be done slightly differently.  Typically you install the applications in a certain folder (usually F:\Portable Apps\ - dependent on what drive letter your OS has assigned your USB key) and the data goes elsewhere (F:\Documents) so the example given in the above link isn’t good when it comes to backup.  Typically when I backup my documents (and Portable Apps provides a backup application integrated into the software) I only backup the Documents folder, this saves time and makes the backups much smaller.  A full backup is roughly 700MB now, which takes some time, and some hard disk space also.

So now I run document editing software, my IDE, IM, Firefox and Sunbird off my USB key making my desktop almost entirely on my USB key.  The final showdown is Skype which I use regularly for making [free] calls to my family.

Just to mention, I’m now using 1.1GB overall of my 4GB, and that’s almost all the software installed that I require.  Shame this doesn’t run off a Mac though.

As I posted the other day about using Portable Apps you may notice that Mozilla Sunbird comes as standard on one of the installs.  I knew what Mozilla Sunbird was, but I never thought I’d have a need for it, however, upon using it I’ve found that it’s a blessing to have, especially seeing as though I can simply carry it around on my USB key.  As long as there’s a computer available somewhere then I can run it.

My main love of this application is how lightweight it is, there’s nothing complex about it at all.  The views are very configurable and immediately I switched to the month view so I can see what’s going on.  Additionally the repetition options for events is very handy, and already I’ve set in meetings, lectures, times I have to work, rehearsel times et cetera.  Occasionally a repeated event may not occur on certain weeks, and Sunbird can act upon that ensuring it doesn’t occur on certain weeks if you so wish.

Tasks are available at the bottom left of the window shows what tasks need doing, and when they need to be done with the option to hide completed tasks.

In general, this application exposes all of the essential tools you need to manage your time whilst hiding complexity of many time management applications with a simple, intuitive user interface which anyone could figure out.  On top of all this, it’s portable if you so wish!

Portable Apps

by Kieran

Seeing as though I got a 4GB Corsair Voyager USB key for Christmas I thought I’d make better use of it rather than using about 10MB of it.  Last night I installed Portable Apps onto it which is just an application allowing you to install applications onto your USB key and use on any computer without having to install anything on the host computer.  I’m running firefox off it right now in fact.

As good as it is, there are some quirks which I’d like fixed in perhaps future versions to make it more usable.  For a start, is it possible to auto-run from a USB key? At the moment you have to manually run the executable located in the root of your USB key in order to start the application, which although isn’t too much trouble, it would save a lot of time.  I’ve just setup Launchy to be able to open up Portable Apps (manually added it) which saves a bit of time.

Secondly, you can run multiple instances of Portable Apps.  Is there no way to stop this from happening when one is running? Also, you have to click on the icon in the lower right-hand corner in order for it to pop up. Surely there should be a keyboard shortcut?

Finally, I’ve noticed there’s documents, music, pictures and video folders in the application, however, documents just leads to the root directory containing music, pictures and video folders.  Personally I have a lot of documents which I’m constantly working on, and this means there’s no specific quicklaunch folder for them, and they have to be nested in sub-folders not native to the application.

Other than that, for what I use it for it’s excellent and am currently using Open Office, Pidgin, Firefox and xampp on it.  It also comes with a couple of games dependent on the version you get.  The default theme isn’t very nice, but from searching around I can see that there’s quite a few skins available for it.

Generally though, it’s most probably worth getting if you can trust all your data being on your USB key.  I’d say regularly backup the key in case you do lose absolutely everything ;)

There’s a hoard of tutorials on the Internet showing you how to make menus in Java, and they’re just fine, however I always wonder to myself whether they’re the best solution to the common problem of having hundreds of lines of code just to create a menu, so I decided to try out some alternative approaches.

In this tutorial I’ll show you an example from my own project generating menu items dynamically, from any format you wish.

Representing The Data

First of all you need a format to represent the menu items.  For this example I’m using dots by themselves to represent separators, and I’m ending items with a colon to represent them as a menu.  All of these items are contained in one String array, and each element represents an entire menu.  Thus, the format will look like:

{"File: New . Menu-Item Another-Menu-Item . Other-Items", "Tools: Draw . Fill . Editing-Tools"}

This example is extremely basic and there are far better ways of doing it, but for the purpose of this tutorial I’ll keep it simple by not using multi-dimensional arrays, or extracting values from files etc.

Pulling The Data Out

Next we will need to iterate over the list of elements and choose what goes where. You’ll also need to use a small regular expression to split the data by whatever format you choose.  Spaces separate elements in my data representation therefore I use \\s+.


for(String menuElement : menuItems)
{
   String[] splitMenuItems = menuElement.split(”\\s+”);

   menu = new JMenu(splitMenuItems[0].substring(0, splitMenuItems[0].length() - 1));
   menu.addActionListener(this);
   menuBar.add(menu);

   for(String menuItemElement : splitMenuItems)
   {
      if(!menuItemElement.endsWith(”:”) && !menuItemElement.equals(”.”))
      {
         menuItem = new JMenuItem(menuItemElement.replace(’-', ‘ ‘));
         menuItem.setActionCommand(menuItemElement);
         menuItem.addActionListener(this);
         menu.add(menuItem);
      }
      else if(menuItemElement.equals(”.”))
      {
         menu.addSeparator();
      }
   }
}

 Here I use a nested for loop to first iterate over each element in the String array, and each time I do I then split the String into its individual elements and place them into a String array of their own.  A root menu is represented by a proceeding ":" character, so  splitMenuItems[0].substring(0, splitMenuItems[0].length() - 1) takes out the colon at the end of "File:".

In the next nested for loop I ignore elements ending with the ":" character because due to the String split, it naturally includes the first element which is "File:" - you can choose to remove this element if you wish, whatever suits you really.  I also ignore the "." character and if that character does occur the statement will then go over to the else if statement where it will add a separator for every dot found.

Because the menu items are delimited by spaces I needed to handle menu item text with spaces in it.  To do so I merely used "-" characters to represent spaces.  Underscores may have been better as you may actually use hyphens in your menu items.  When one is found I just simply replace it with a space character.

But What About Key Mnemonics?

Key mnemonics allow you to hit a key on your keyboard and that menu item open up.  You may think that this option isn’t as customisable, but it just means there’s a little more work to do.  Obviously we can represent the data in any form we want, and thus to enable key mnemonics simple change the format of the data.  For example, {"File:_69 New . Close . Exit"} - here we can use an underscore to separate mnemonics and then give the integer value of the VK constant which you can then add to setMnemonic(int).

Simple, huh?

(Please note that this code was developed in accordance with my university and thus is copyrighted. You may freely use this code as long as you give a link back here, or at least put my name in your code somewhere. Thanks! :))