Archive for March, 2008
Some different Firefox extensions
by Jim on Mar.21, 2008, under Firefox, Internets
I thought I’d spend some time searching the vast range of extensions available for Firefox, looking for some potentially great extensions that you don’t hear much about. There are many extensions out there just waiting to be discovered. Many of which can be extremely beneficial for some, but will never be everyones cup of tea.
Most people complain about Firefox 2’s extreme use of memory, Cache Status provides a handy little fix. Providing cache information and the ability to manually clear the cache. I know this is possible from within the about:config menu, but why bother when Cache Status can free up memory for you?
There are plenty of good videos on Youtube, Megatube, Dailymotion, and all those other video streaming sites. Now there are three problems with these sites: you have to be online to view them, the servers can get hit pretty badly causing really slow streaming, and finally videos can often get removed from the sites. Why bother with any of these problems again, when you could just download the video. Many sites provide this functionality, but why not just use this handy extension instead?
Snap shots of websites is one of the features Ask.com is toting as one of their main features that Google does not have. Well why bother with Ask anymore, when you could go back to good old Google and use this extension to get the Snap Shots for you?
That’s it for now, expect another 3 good extensions in the future.
Sleeeeeeeeeeeeeeeeeep!
by Jim on Mar.20, 2008, under Random, The real world
Tired, oh so very tired. As you can see it’s almost 6am and we are doing very little right now. Might as well have gone to bed.
All night java!
by Jim on Mar.19, 2008, under Java, university
Is not very productive. So far we’ve fixed 4 bugs, ate pizza, broke it, fixed it, one of us went to the gym, others slept, ate more crisps, messed about by stealing monitors and keyboards to make the eee pc into a desktop, did some overclocking, thought about java, and sulked over the lack of a kettle. So all in all a good use of time!
The Java is almost complete
by Jim on Mar.18, 2008, under Java, Random, university
The group project is nearing the deadline and the coding side of the work seems to be complete (bar the guaranteed major bug.) I’ll be pulling another all-nighter tomorrow to help finish off the testing and written work.
After numerous last minute revisions to the protocol and the server everything back working again! Loving it when someone recodes the server, client, or protocol then comes up to you and says: “By the way, your Gui is broke.” Really? It was working when I updated and went to bed >:( Perhaps that has happened too many times in the last 5 days for me to care anymore…
Since I am knacked, heres a lovely (Java ish related) comic from xkcd to keep you entertained:

Netbeans 6.1 looks to be another fine product
by Jim on Mar.17, 2008, under Java
After installing Netbeans 6 RC 1 I never really turned back to Netbeans 5.5.1, Netbeans 6 enabled me to be far more productive when coding. The highlighting, searching, and better auto commenting features were enough to make me delete Netbeans 5. Especially after the RC was stable enough to work with. Now Netbeans 6.1 beta 2 has recently appeared, it seems I missed out on having a look at beta 1. At least that means I get to test a more stable IDE.
Now the one huge difference with Netbeans 6.1 is the start up speed. It is almost instant, well in Netbeans terms anyway. On my home system — without any tweaks to the IDE — it loads up my last project in just under 10 seconds. Now you probably want to now how long Netbeans 6 takes, well that takes… 17 seconds (yes, I did just count.) So, for me at least, Sun aren’t making things up about the increased speed of the program.
- Faster cold start and improved startup sequence. Up to 40% faster (with a project opened). Opening projects does not block startup. Go to Type dialog available even during post-startup scanning of sources.
- Various optimizations to reduce I/O and file access (touching disk), improving responsiveness in many situations, especially on slower filesystems (e.g. on network).
- Incremental parsing in java editor speeding up code completion and improving responsiveness of the editor especially with large files (see below).
- Improvements in JSP parser (caching, memory management, update strategies), leading to faster code completion and editor.
- Improvements in Visual Web designer — faster page opening and table drop, lower memory usage, fixed memory leaks, and more (see below).
It seems this major speed improvement is new to beta 2, so if you’re still stuck on beta 1 you might want to change.
There’s also some nice eye candy in there, it seems everyones on the transparency train these days!
I’ve only had one hiccup with the IDE so far, a button just wouldn’t delete in my Gui when using Matisse. I kept getting a little warning light about an error, so I happily submitted the problem. I ended up just tossing the button out of my gui as just one more ‘other component’ (the Netbeans equivalent of tossing it overboard!)
If you could Only Choose Four Firefox Extensions
by Jim on Mar.16, 2008, under Firefox, Internets
It seems to be a widely known face that the real strength behind Mozilla’s Firefox browser is in the wide range of extensions available. Whilst Opera might have more core functionality, Firefox has the potential to be the superior browser, especially now the memory issue is fixed.
But if I could only choose four Firefox extensions, what would I choose? Here are my choices in the usual reverse order:
I find this extension so useful when on a fast line. My internet connection seems to be around the 12Mb area (I don’t know the actual speed, as I get the thing for free) and when your downloading you often find that you get nowhere near your connections actual speed. Using any download manager will do the trick and bring those speeds back into line, but why bother with an external manager when you can have one specially built for your favorite browser?
Whilst Adblock seems to still be the more popular extension, Adblock Plus is by far the superior option for removing adverts from your internet experience. Whilst Adblock requires manual blocking of advertisements, Adblock Plus uses a set of continually updated set of filters to do the blocking automatically. In addition, the extension can — not by default — attempt to regain the space that would have been taken up by the advertisement.
Now although this extension is designed to help testers when using the nightly ‘Minefield’ releases of Firefox, this tool has one major feature that all users of Firefox would find useful — force Firefox to believe an extension is compatible with the current version and enable it. Now why would you want to do this? Well unlike Internet Explorer, which seems to get large updates every now and again; Firefox is updated with bug and security fixes pretty regularly. When this happens all of your extensions will be disabled, as they are signed as being compatible up to the last version released; although many extensions are updated within hours of this occurring, many extensions are not. In addition, users may still be able to use extensions that were abandoned by their creator. Please be careful whilst using this extension, as it could cause problems with your browser.
Everyone hates pop-ups and there are even worse things than pop-ups on the web these days. Thankfully Firefox’s built in pop-up blocker does a good job in removing pop-ups, so do Internet Explorer and Opera, but browsers with blockers just happened to be a double-edged sword. Since a large portion of their pop-ups were annoying anyone anymore, whoever it is that likes to make the damn things decided to work out how to get round all these blockers. Instead the internet (which is serious business by the way) is infested with Javascript based advertisements. These damn things can either block 99.9999% of the bloody screen, follow your scrolling of the page, follow your mouse (by now you start to wonder why they haven’t got the message,) jump out of no-where when you click a link, and steal your first wallet. Ok they might not steal your wallet, but they frustrate me more than pop-ups ever did.
So you could just turn off Javascript, for sure that would kill the little fuckers, but you wouldn’t be able to surf half the web either. So that’s where NoScript comes in and saves the day. NoScript turns off Javascript for every site and lets you whitelist the sites that you do want to allow to use Javascript. Thus you no longer have to view the annoying advertisements, plus you can still do your internet banking. Between NoScript and Adblock Plus you can truely reclaim the web.
What would your choices be?
Hide a Winrar Archive as a Picture
by Jim on Mar.16, 2008, under Internets
Yes, that does sound confusing, but you can hide a .rar achive ‘inside’ a jpeg picture file. You can use this to stash away some files you don’t want other users on your computer from seeing. Alternatively you could just use encryption, but this is a quick and easy way to do things, that lets you hide files effectively from normal users. Be warned that it is possible to find the files with tools such as enCase… Thanks to Helpero for this nice tip.
I’d love to toss in some demonstration pictures, but my computer is currently running Ubuntu and I would need to install Windows to do so!
Basically, with this method you can open the file as either a picture or a rar archive. So a normal user will just double click the file and it will open as a picture, whilst you can drag it into Winrar (or any alternative) and it will open as an archive.
Here we go:
- Find your .rar archive and put it in the same directory as a jpeg picture (I will use C:\ as it is easy to work from there. You can then just copy and paste the file to a better directory.)
- Open a command prompt by clicking Start, then clicking Run, and typing ‘cmd’Â in the Run box and click ok.
- In the Command window (CMD window) that has appeared, type your directory should already be in the C drive other wise you will need to navigate their. If your CMD window starts in a different directory you can either direct the window their using DOS style commands, or just use that directory for the process (simply move the picture and jpeg to that folder.)
- Enter ‘copy /b input.jpg + secret.rar ouput.jpg’ without quotes in the CMD window and press Enter.
Remember input.jpg is the picture you are cloning and secret.rar is the file you are hiding. Output.jpg will be the file that has the winrar archive hidden inside.
Open the archive in Winrar to make sure you got everything working correctly.
Why did I say I would work overtime?
by Jim on Mar.15, 2008, under The real world
Bah, still two more working days at Tesco. Silly me decided to do some overtime on Good Friday, at least the pays good…
One hectic week coming up. Hopefully I’ll have some decent posts for you.
Second to last day at Tesco
by Jim on Mar.14, 2008, under The real world
Woo, only one more Saturday left after tomorrow and I am free of Tesco! Freedoooooooooooom!
I’ve had a good pretty good decent 2 years with the company; although, there have been numerous lots of mishaps. I still like the company and defend it for certain practices, but I had to leave after all the problems with my transfer and I have far too much work to do for University. On the other hand, I seem to have been offered an opportunity by the YHA to help them with SQL (which I suck at.)
1. After moving store, they messed up my payments resulting in no pay for 4 months!
2. My privelige card did not work for the same 4 months… grr!
3. They still haven’t refunded me for travel for an interview. Let me tell you travelling to Welwyn Garden City by train is a pain! You can’t get a return from anywhere but London, as you can’t use the return ticket from anytime between 1pm and 8pm. So you are forced into buying two singles, for me that amounted to £35 each way. Note to Tesco, give me my £70!!!
4. Twice missed out on stock bonuses. First time round because I had worked for 11 months, and not 12, on the cut off date; the second was — again — due to the bloody 4 months in limbo!
5. They fucked up my pay and overpaid me, then took the money back
(Well no-one ever gets away with that, do they?)
6. I don’t think they paid me for any of my overtime during my 4 months in limbo.
7. They thought I had ‘quit’ when I had actually swapped store.
So goodbye Tesco!
Breadth First Tree Traversal in Java
by Jim on Mar.13, 2008, under Java, java code
Coding a breadth first traversal is more complex than a depth first traversal (left to right, or right to left.) Although, the code behind the traversal is not much longer or complex, it just requires a bit of thinking. Source code for the breadth first traversal is at the bottom of the post, alongside source code for the more common depth traversal.
I’ve found that there are little examples – online or in books – of how to do a breadth first traversal, especially for Java. I had to teach myself this from a not too friendly C++ example. I’ll try to explain the basic idea of the traversal, before moving on to the code. I hope for your sake that I can actually explain this…
Suppose you have the following tree:
 Now if you were to run a depth traversal you would go in the following order:
1,2,3,4,5,6,7
As the traversal would go to the left most node, then get the root node of that node, then attempt to try this on the right node. As such:
I know, not the greatest of diagrams… that probably just confused you. The red numbers and arrows correspond to the order in which the traversal works. It will go all the way to the left, before going right; this is probably good in the case above, but sometimes you want to get all the values at a certain depth before moving to the next depth (alternatively see this as getting numbers across the breadth of the tree.) For example, if a tutor asked you to get the numbers in order of how close to the root of the tree they were. A normal traversal would not be able to do this, thus you would have to do a breadth first traversal in order to answer the question. Another good example would be searching for a closest ancestor of two people, a basic depth first traversal may get the correct answer on many occasions; however, it would give erroneous answers with more complex trees. If a breadth first traversal was used it would always give the correct answer.
For example, on the tree above a breadth first traversal would give the result:
4,2,6,1,3,5,7
As you can see the numbers are placed in order of their depth, 4 is the root of the whole tree, 2 and 6 are the subnodes of 4. Then finally you get the subnodes of the subnodes (1,3,5, and 7.)
In order to do such a traversal you will need to have two methods and a queue. The first method deals with the root and its subnodes and the second method will deal with all other nodes.
Basically you should dump the subnodes into the queue, then remove one from the queue and repeat the process. The code does a good job in explaining this.
 Now for the code, full source code is available at the bottom of this post.
Basic Traversal
/**
* Simply runs a basic left then right traversal.
*/
public void basicTraversal()
{
//Check if we can go left
if (left != null)
{
left.basicTraversal();
}
//Add the root
list.add(root);
//Check if we can go right
if (right != null)
{
right.basicTraversal();
}
}
Breadth traversal
 /**
* Runs a breadth first traversal
* This method runs once to get the root and it’s subnodes, then runs
* another method to continue the traversal
*
* @param list ArrayList to store the roots in
* @return ArrayList of type Integer
*/
public ArrayList<Integer> getBreadthTraversal(ArrayList<Integer> list)
{
//Add the root to the arraylist, we know it is always the first entry.
list.add(root);
//Basically we add the first set of nodes into the queue for
//traversing.
//Query if left exists
if (left != null)
{
//Then add the node into the tree for traversing later
queue.add(left);
}
//Same for right
if (right != null)
{
queue.add(right);
}
//Then we call the traverse method to do the rest of the work
return traverse(list);
}
/**
* Called by getBreadthTraversal, this should not be ran without it.
*
* This method completes the breadth first traversal. It will remove the
* first Tree from the queue and add their nodes (left and right)
* to the back of the queue. Then it will append the Tree to the
* ArrayList for returning.
*
*
* @param list ArrayList to list tree roots in
* @return list ArrayList
*/
private ArrayList<Integer> traverse(ArrayList<Integer> list)
{
//Keep traversing until we run out of people
while (!queue.isEmpty())
{
/**
* We take one from the queue.
* As a linked list is a queue it operates as “First In First Out”
* also known as FIFO. So if you add something to a queue you have
* to wait until all other objects are removed before you can
* access the object again.
*/
Tree p = queue.remove();
//Check if it has any subnodes
if (p.left != null)
{
//Add the subnode to the back of the queue
queue.add(p.left);
}
//Same for left
if (p.right != null)
{
//Same here, no queue jumping!
queue.add(p.right);
}
//Append to the ArrayList
list.add(p.root);
}
//And return
return list;
}

