General

Posts that cover general aspects of programming.

#! code Logo

7 Tips To Improve Website Usability

26th January 2009 - 8 minutes read time

Website usability should be an essential part of your online strategy, but it is so easily overlooked or overshadowed by pretty design. Here is a quick list of 7 things that can cause your users to get frustrated and go elsewhere.

1. Search
Search is a very important part of any site, and if it doesn't work then your users will just get frustrated and go to another company. Website search usability comes in two parts, the search box itself and the results.

When creating a search box you need to have a single text box and a button labelled "Search". That is about as complicated as you need to go, although it is okay to have a drop down box of categories, as long as the default is "All Categories". When the user has done a search, the search box should contain what they searched for, so that they can refine their query if the need to.

#! code Logo

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.

#! code Logo

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.

function myFunction($intNum1, $intNum2){
 // function does something
}

Normal practice is to check the parameters to make sure that they are what you expected them to be before continuing on with the rest of the function. Let's say that we only want the numbers to be in a range. If they are not in the range the function should return false. Many programmers might start of writing something like this.

#! code Logo

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.

#! code Logo

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.

#! code Logo

JavaScript Function isNaN

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