100% Geek The Adventures of Peter Boughton:
CFML; Web Development; Photography.


Archives for February 2008

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)

Posted by Peter on 22-February-08 at 11:32 ~ 0 comments ~ Category:


Project:Photon - Part IV

Almost a year since my last update on Project:Photon, and progress is depressingly low.

So for both new readers and those without a perfect memory, a quick reminder of Project:Photon's primary objective: a small and silent device for high-capacity storage with full backup facilities (mirroring and versioning).

This posting is an update on where I have reached.


Previous Parts:
Project:Photon — Part I
Project:Photon — Part II
Project:Photon — Part III


read more...

Posted by Peter on 16-February-08 at 20:22 ~ 2 comments ~ Category:


Introducing Chinook ADS

CHINOOK Advanced Deployment System is a new project I have started on RIA Forge, with the aim of becoming the perfect deployment tool for everyone.

I have spent a lot of time at work with deployment. We have a variety of different applications; we deploy to live, staging and testing servers; we need to deploy different source-control branches; we need to ensure that configs are updated between deployments; and so on.
We currently have a tool that kinda works, but is far from perfect, and I intend to fix that by creating Chinook ADS.

In order to make Chinook ADS the best it can be, it needs to be capable of handling any type of deployment methodology - whether exporting from source control or just syncing across a network - if you need to regenerate parsed files or just change a config.ini - Chinook ADS will be built to work reliably with whatever can be thrown at it.

I already plenty of thoughts on how I will structure the tool, but before I allow them to solidify into an initial prototype, I want to get the opinions of as many people as possible on how their deployments work, so I can sure that this works for everyone.

If you do any form of deployment, whether this is done manually, using ant build scripts, with another tool, or whatever - I would appreciate details of how your deployments work, along with any other information which might be useful.

You can either post your thoughts here, reply on the Chinook ADS development blog, or reply at the Chinook ADS forums.

Please also spread word of this to others - I want to ensure I get as many different methods as possible, to ensure that Chinook ADS is able to meet all deployment needs.

Posted by Peter on 02-February-08 at 22:22 ~ 0 comments ~ Category: ,