Posts

Showing posts from July, 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(); }

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 do

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

Link: What is "Modern Software Development"?

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

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: Web Developer Blog

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 .

jQuery Plugin: addOption

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

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

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: Web Developer Blog , ASP.NET , CSharp