Projects Cursors & Icons

Vista Drive Icon is a fairly handy utility for Windows XP which changes the icons of the your drives, so that they show a small bar indicating the available space. By default, Vista Drive Icon’s icons are from Vista, and don’t suit the Windows XP style. The icon pack below replaces the Vista icons with their Windows XP counterparts whilst retaining the size bar.
These have been tested with and work with Vista Drive Icon 1.3/1.4.
Download
Download replacement icons
Installation
- Download the package,
- Browse to where you installed Vista Drive Icon, this is usually
C:\Program Files\Vista Drive Icon.
- Unzip the contents of the package into the folder named Icon. Be sure to replace all pre-existing icons.
It may take a short period before the new icons appear. Restarting your computer or logging off and back in again may speed the process.
Software
I reinstalled LimeWire earlier today and remembered why I uninstalled it in the first place. LimeWire would install and load correctly, but upon loading it would crash before connecting. I Google’d for numerous solutions, but none managed to prevent its untimely demise.
It wasn’t until my recent failings did I realize the fatal error only occurred in version 1.6 of the JRE. The solution was simple, run LimeWire under version 1.5. The last revision of the 1.5 JRE is update 13, which must be installed before we can trick LimeWire into running. Our lives are made simpler by the fact that Java doesn’t uninstall previous versions of the JRE when an update is installed.
The easiest way to check is to browse over to C:\Program Files\Java and look for a folder named jre1.5.0_13. If this folder exists you’re in luck. If not, visit Sun’s archive page for JRE 1.5 Update 13 and click the link labelled “Download JRE”.
With Update 13 installed, create a new shortcut in your start menu or desktop and set its destination to the following address (even though its split over multiple lines, it should only be one line):
"C:\Program Files\Java\jre1.5.0_13\bin\java.exe"
-jar "C:\Program Files\LimeWire\LimeWire.jar"
This makes the presumption that your copy of LimeWire is installed under C:\Program Files\LimeWire. If you installed it elsewhere, you will have to change the address. Visa versa for Java.
Running LimeWire is now as simple as double-clicking the shortcut. However, it should be noted that instead of one LimeWire window, two will now appear. The first will be a command prompt. Its ugly, but do not close it as it will also close LimeWire.
Programming PHP
Earlier today I thought I’d edit the title-page wallpaper script, and make it print friendly error messages. Previously it would just die in a very unhelpful way when an error was encountered. It didn’t occur to me before-hand, but my custom error handling script was very antiquated. For one, it had to be called with GET information.
This works well for .htaccess redirects and error documents (which was why I designed it this way a year or so ago), but it is a bad way of calling the error functions from within a running script. For one, PHP won’t allow you to pass GET values in the filename:
include('error.php?code=404'); // will not work
Since I didn’t have the time to overhaul the entire script, I checked for an easy work around. PHP recommends you use URL wrapping instead.
include('http://www.lazymoon.org/error.php?code=404');
But I didn’t like this idea, because if my host disables URL wrapping I’ll be left with broken scripts. Not to mention it takes longer to process.
The easy solution, for those who are interested, is just to set the GET information manually before including the file.
$_GET['code'] = 404;
include('error.php);
This does the job nicely.
Programming PHP
If you have visited the LazyMoon title page (with a recent browser and JavaScript active), you would have noticed the ability to dynamically create a wallpaper form the now symbolic silhouette design. One thing very few people notice is that the wallpapers are automatically sized to match your screen resolution. Meaning I haven’t just designed every possible combination, but programmed a script to create your wallpaper when you request it.
This consumes an unholy amount of memory. To the extent where I suspect my host may get a little upset if too many people request a wallpaper at once.
What is concerning is that PHP doesn’t automatically garbage collect GD resources stored in memory. If someone cancels their request or the script terminates early, that resource will not be destroyed. This only has to happen a handful of times before the memory is filled and I get a unhappy letter with some very large numbers.
If you use the GD library and don’t have a garbage collection function, you are playing dangerously. To get around this, we can write a function and use PHP’s register_shutdown_function to manually free un-destroyed resources.
The code snippet I use is:
function gd_garbage() {
global $img;
if (isset($img)) {
foreach ($img as $i) {
if (get_resource_type($i) == 'gd') {
imagedestroy($i);
}
}
unset($img);
}
}
register_shutdown_function("gd_garbage");
For this to work, we have to store all image resources in an array named $img. However, we shouldn’t rely on garbage collection alone to clean up GD resources, for two very important reasons:
- The function may fail,
- Leaving GD images open until the script terminates is a considerable waste of memory.
It is always recommend that you destroy your images the moment you are done with them, and let the garbage collection handle any mishaps along the way.
Projects Cursors & Icons

The Simple In Black cursor set is a collection of high-contrast black alpha-blended cursors (for use with Windows 2000 onwards), which are intended for people who have high-resolution displays or have issues seeing the cursor. The black cursors have a white outline, making them highly visible on any colour.
Download
Download Simple In Black
Installation
- Download the package,
- Unzip to a location of your choosing,
- Right-click the Install.inf file and press Install,
- Press Start, Control Panel then Mouse,
- Press the Pointers tab,
- Under Scheme, select Simple In Black and press OK.
Different steps are necessary when using Windows Vista.
Feedback and recommendations are welcome.
Programming Java Programming JavaScript Programming PHP
There may come a time when you have to round a number up or down to certain multiples of another number. Since us Australians haven’t had one-cent pieces in quite some time, most purchases are rounded up or down to multiples of five cents.
Enough of my side-story. Here’s some simple code to get the job done:
Java:
import java.lang.Math;
public float roundToGrouping(float number, float grouping) {
return Math.round(number/grouping)*grouping;
}
PHP:
function roundToGrouping($number, $grouping) {
return round($number/$grouping)*$grouping;
}
JavaScript:
function roundToGrouping(number, grouping) {
return Math.round(number/grouping)*grouping;
}