Monday, July 31, 2006

Find out how many days are in a given month (JavaScript)

Often an array is used to figure out how many days there are in a month (and extra work is used to figure out how many days are in February (depending on the leap year)). This method uses the inbuilt Date object, so should be user locale friendly (assuming 12 months in a year). For instance, to find out how many days are in February 2008, you would do: daysInMonth(2008, 2)

function daysInMonth(year, month)
{
 // month is zero based, so take away 1
 month = --month;
 // first day of the following month
 var nextDay;
 // if last month of year, then use first day of following year
 if(month == 11)
 {
  nextDay = new Date(++year, 0);
 }
 // otherwise use next day of current year
 else
 {
  nextDay = new Date(year, ++month);
 }
 // take away a millisecond to get required date
 var requiredDate = new Date(nextDay - 1);
 // return the day
 return requiredDate.getDate();
}

Friday, July 28, 2006

Source Code Hosting from Google

Google now offers hosting for your source code: Google Code - Project Hosting. It seems to use subversion for version control and you can use your Google username (the password is generated for you) to check out code. Labels are used instead of set categories - it would be better if they were used to complement categories instead. It has very few licenses to choose from (which in some ways is good as there are so many open source licenses to choose from) - it lists only the most popular ones.

There are a few downsides though:

  • Code has to be downloaded via SVN (browser or client application), no zip/exe/tar.gz releases
  • Latest updates not shown on homepage (due to lack of releases feature - listing SVN updates would not be very helpful as they page will be constantly changing)
  • No popularity / activity rating (listing most active and popular projects on home page)
  • No Atom (Google don't use RSS) feeds (which is a bit of a surprise)
  • No ability to request features
  • Search page doesn't indicate how it is sorted or offer any status next to results
  • No category view (as tags are used instead)
  • No development status (beta, alpha, stable etc) feature - you use labels instead

If you mostly work with source code and only need the absolute essentials (issue tracking and a place to store your code), this may be fine. But if your needs are greater, CodePlex or SourceForge are better.

I wouldn't expect it to have as many features as SourceForge, but it should at least be at a similar level as CodePlex.

Thursday, July 27, 2006

CodePlex

Microsoft has a community site for code called CodePlex. Like SourceForge, you can create your own projects and download code from existing ones. The good think is that it does not require Microsoft Passport to register / sign in (unlike GotDotNet). However, it is not categorised - i.e. broken down by type (database, desktop, finance, games etc), programming language (C#, VB.NET) or interface (WinForms, WebForms).

Despite that, it is a lot easier to navigate than SourceForge and contains several useful projects (IronPython, Jad Engine - C# + MDX 3D Game Engine, "Atlas" Control Toolkit and more). It also allow GPL'd projects (which I don't think GotDotNet does) - Jad is under the LGPL.

A bit of AJAX would help improve the site (as you need JavaScript just to sign in, so visitors will likely have it enabled). For instance, when you go to a project's page you see a series of tabs, which you then click on the go to another page. If instead of that it loaded the content into the current page, it would be more responsive.

Tuesday, July 25, 2006

Link: What is "Modern Software Development"?

From Coding Horror: What is "Modern Software Development"?. Old checklists (2000 and 1997), but still relevant today.


Tags:

Thursday, July 20, 2006

Link: HTML Color Code Combination Chooser

The HTML Color Code Combination Chooser is a very useful web based utility for picking a colour pallet with colours that compliment each other.


Tags:

Tuesday, July 18, 2006

jQuery Plugin: sortOptions

jQuery Plugin: sortOptions is a plugin that sorts the options in select dropdowns - either ascending (the default), or descending.

jQuery Plugin: removeOption

The jQuery plugin addOption now has a complementary plugin for doing the opposite: removeOption. Both available via jQuery Plugins: addOption/removeOption.

Monday, July 17, 2006

jQuery Plugin: addOption

New plugin: addOption allows you to add items to a select dropdown list via jQuery.

Tuesday, July 11, 2006

jQuery Text Clips for PN2

I have done some jQuery text clips for use in Programmer's Notepad 2. Available, along with the others I have done at: Text Clips for Programmer's Notepad 2

Friday, July 07, 2006

Link: Working with Files and Directories using ASP.NET

Working with Files and Directories using ASP.NET. Handy reference (with snippets in C#) for when you want to do things (creating, renaming, deleting, moving, enumeration, getting properties (e.g. last modified) etc) with files and directories in ASP.NET


Tags: , ,