Posts that cover general aspects of programming.

#! code Logo

Does An IP Address Provide Useful Tracking Information?

18th January 2011 - 7 minutes read time

An IP address is an address for a computer on the Internet. The usual example used is of a web server that can be accessed via a URL that is translated behind the scenes into an IP address, but IP addresses can be used to find any computer on the Internet.

When a normal home broadband user accesses the Internet they send their transmission through their Internet Service Provider (ISP) who have a collection of IP addresses they use for their users. ISPs tend to get blocks of perhaps several thousand IP addresses that they will use as a pool for their users. When a user logs on they are given an IP address and when they log off this address is sent back to the pool for other users to use. The actual systems in use here are a little bit more complex than this, but this is the essential idea.

#! code Logo

PHPNW09 A Review

18th October 2009 - 16 minutes read time

Last weekend saw the second annual PHPNW conference, and it was an excelent conference. There were some 200 people attending the event and we got to see some interesting and informative talks. When I arrived at the talk I received a bag with some brochures in it as well as a KitKat (which I ate for breakfast) and a years subscription to PHP|Architect. Everyone at the conference was also fed very well for lunch and dinner and Sun sponsored a free bar at the end of the first day, which was nice.

What I thought I'd do is go through each of the talks that I attended and copy in my responses from the reviews that I have been posting during the week, but also embellish them with further thoughts and comments. Also, seem to have deleted one or two of my reviews so I will have to write them from scratch anyway.

#! code Logo

Using Netbeans PHP Code Templates

11th September 2009 - 5 minutes read time

Netbeans is a great IDE and with every version lots more features are introduced that make it even better. One thing that I like to use is the code templates, which have been available from version 6.5. Code templates allows you to type a simple command and get a section of code. What commands you can use depend on what version of Netbeans you are using and which programming language you focused on. As a PHP developer I usually download the PHP version, which comes with a set of PHP code templates. To try one out go into a PHP file in Netbeans and enter if followed by a tab. Netbeans will automatically change this into the following:

#! code Logo

A Look At robots.txt Files

18th May 2009 - 6 minutes read time

A robots.txt file is a simple, static, file that you can add to your site in order to stop search engines from crawling the content of certain pages or directories. You can even prevent certain user agents from crawling certain areas of you site.

Lets take a real-world example and look at what you would do if you decided to set up a Feedburner feed in place of your normal RSS feed. I won't go into why you would do this much, other than to say that you get some nice usage statistics and it can save on some processing power on your server as your feed is only looked at when Feedburner updates. Once you have allowed your blog to issue the Feeburner feed instead of your normal feed you then need to stop search engines from indexing the old feed. This stops is appearing in search indexes and things so that you can get your users to grab the Feedburner feed and not your local feed. You would then put a robots.txt file in place with the following content.

#! code Logo

Virtualization With VirtualBox

25th March 2009 - 4 minutes read time

Virtualization is basically a term used to describe the creation of a computer in software. The main benefits of which are that if you want to try out an operating system or test client server communications you don't have to get multiple computers. You can simply create a few computers virtually, which will act just like the real thing.

There are quite a few virtualization products available, some are free and some cost quite a bit of money. After messing about with quite a few different virtualisation products other the past few weeks I have uncovered a great bit of software called VirtualBox from Sun Microsystems.

#! code Logo

7 Tips On Writing Your CV

16th February 2009 - 9 minutes read time

Working for a number of years in the web industry means that I get to see quite a few CVs, and after a while you get a feel for what makes a good one. Your CV (or resumé) is quite often the very first thing anyone ever hears about you, so it is important to get it right. To that end I thought I would impart some of the things I have learned after years of writing my own and reading other people's CVs.

#! code Logo

7 Tips To Improve Website Usability

26th January 2009 - 10 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 - 9 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.

#! code Logo

Writing Function Code To Be More Readable

1st October 2008 - 5 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 - 3 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.


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: Gecko/2008070208 Firefox/3.0.1

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