Sorcerer's Tower

JavaScript Leap Year check

I've just needed to fix a calendar that didn't implement leap years, and thus was missing 29th Feb this year.

Unfortunately, Google was bringing up various functions that rely on how browsers handle oddities in the built-in date functions, which isn't a sensible approach.

So, here is how to do it relying on the leap year formula:

function isLeapYear(year)
{return ((year%4 == 0) && (year%100 != 0 || year%400 == 0));}

And to implement that:

function readDaysInMonth(month,year)
	if (month == 1 && isLeapYear(year) == true) return 29;
	else return [31,28,31,30,31,30,31,31,30,31,30,31][month];

(Remember, in JS months are 0-indexed, hence 1 = Feb)

Fusebox 5.5 is out now!

The highly anticapted next major version of Fusebox has finally been released to the website.

Fusebox 5.5 allows you to use the Fusebox applications without using XML, which should please many people.

Instead of fusebox.xml it checks conventional places for your circuits, and instead of circuit.xml it can either use CFCs, where each function is a fuseaction, or just a directory, where each file is a fuseaction.

It also brings support for dynamic do to both xml and non-xml configuration, which is a feature I've really wanted on a couple of occasions.

Get it while it's hot...

Beehive Forum 0.8 out now!

The newest version of Beehive Forum has been released today, with a large selection of new features, improvements, and fixes.

It is very much recommended that users of previous versions upgrade to the latest version without delay - upgrade paths are available from both 0.6.* and 0.7.* so there is no excuse!

For those not familiar with Beehive, it is a superb free and open-source discussion forum system which (in addition to its superior interface) exhibits several rare and unique features which make it a joy to use. For example: there is a relationship system which allows you to ignore others users, or their signatures, or give them amusing nicknames that only you see; each user also has an individiual word filter, with a regular expression option for very powerful filtering; there's a flexible polling system with groupable options, public/private ballot, fixed/changable votes; and many other cool things.

To learn more you can look at the Beehive website, or you can go straight to the SourceForge project page to download it now.

Railo 2.0 out now!

The final release of Railo 2.0 is now available for download from the re-vamped Railo website.

If you've already tried Railo, you'll probably be wanting to head straight to the download page.

If you want to know more about what Railo is and why you might be interested, read on...

Why Railo 2?

A while ago I wrote an entry about why people should consider Railo. Well, with the Release Candidate for version 2.0, there comes a lot more reasons for using Railo. And here are twenty of them...