General

Posts that cover general aspects of programming.

Using Simple Input Detailed Ouput Principles With Web Forms

11th November 2008 - 7 minutes read time

If you have a web site then the chances are that there will be a form of some kind on there somewhere. This might be a search box, or a contact form or even a tool. There is one thing that should be followed no matter what sort of form you create and this is the rule of Simple Input Detailed Output, or SIDO for short.

The idea behind SIDO is that you get the user to enter the absolute minimum amount of information when filling out a form, but once complete give them as much information as you can in return. The perfect form should have a single input box, and return at least a page of information from this single starting point.

This is one of the most important things to remember when designing your website, so here are some basic ideas that you should keep in mind when creating a web form using SIDO.

Writing Function Code To Be More Readable

1st October 2008 - 3 minutes read time

Last month I started writing functions in a particular way, which has made my life as a programmer much easier on more than one occasion. No matter how many comments or verbose parameter names you put in you can end up writing code that you will get lost in. The reason is simple. Lets say you had a function that took in a couple of parameters.

The Google Chrome User Agent

3rd September 2008 - 2 minutes read time

As the new Google web browser was released last night (I'm writing this post using the new browser) I thought it would be good to update our readers on the user agent string that this web browser has.

The user agent of any browser can be found out by using the userAgent property of the navigator object. This is available in most modern browsers and is thankfully also present in Google Chrome.

navigator.userAgent

As an example the user agent for FireFox 3 on a Windows XP machine looks like this.

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1

Using the same code, and the same machine, the user agent produced by Google Chrome is as follows.

Some Common Timestamp Intervals

2nd May 2008 - 1 minute read time

Using timestamps is quite a common practice, but converting them into "real life" times can be a little hard. So here are some common time intervals that you might need.

JavaScript Function isNaN

24th December 2007 - 1 minute read time
Small JavaScript function to check if a variable is a number.