My Twitter

CAPTCHA Based On Image Orientation

June 5th, 2009

A few months ago 3 Google employees explored an innovative approach to CAPTCHA (What’s Up CAPTCHA? A CAPTCHA Based On Image Orientation). Essentially they suggested that having a user orientate an image into its upright position is easier for users (typing difficult to read text can be problematic) and harder for computers.

Computers find it hard to figure out what this is
A computer finds it really difficult to know if this is correctly orientated.

Here is a version I wrote which to can use on your website.

View Demo Download

This script makes use of jQuery to allow the user to rotate the images and a little PHP to check the image was rotated into the correct position.

Apple Can’t Do Math

June 5th, 2009

I was recently checking my emails and I noticed a nice email from Apple informing me on how I can get a great deal on an iPod Touch if I purchased a Mac. Unfortunately I was a little distracted by the pie chart in the background.

Apple Can't Do Math
Click the image to see a larger picture. I’m quite sure that 50% of a pie graph does not equal 90%

Handling Errors In PHP

June 3rd, 2009

Handling errors in PHP can be quite a handful at times. Here is a really simple PHP class which I use to manage errors:

<?php
/*
errors class - Helps management of errors in a script.

@version
	1.0
@author
	Mike Rogers (FullOnDesin.co.uk)
@last updated
	03 June 2009
@usage
	You are free to share, modify and use this code for commercial or non-commercial uses.
	Please give a link back (to http://www.fullondesign.co.uk/ ) if you can, but you don't have you.
	You use this at your own risk.
*/
class errors {
	var $errors_data;

	/*
	Add the error from $new_error into an array of errors.

	@param
		$new_error	string The text related to your error.
	@return:
		True - Error has been Added
	@example
		add_error('Username is Incorrect');
	*/
	public function add_error($new_error){
		$this->errors_data[] = $new_error;
		return TRUE;
	}

	/*
		Outputs the errors.

	@param
		None
	@return:
		- A div (ID - error) which contains the errors.
		NULL - No errors
	@example
		echo output_errors();
	*/
	public function output_errors(){
		if(is_array($this->errors_data)){
			// Cycle through the errors.
			foreach($this->errors_data as $error)	{
				$return .= '<p>'.$error.'</p>';
			}
		// Add it to the error div
		return '<div id="error">'.$return.'</div>';
		}
		return NULL;
	}
}

// @Example - creating the class:
$errors = new errors;

// @Example - Add an error
$errors->add_error('Username is incorrect');

// @Example - Return the errors
echo $errors->output_errors();
?>

If you are looking to fully integrate a script similar to the above, there is a really good post regarding the set_error_handler() function on Tinsology ( PHP Error Handling ).

Q&A: Dealing With XML, Telling A Friend They Got ‘Had’

May 29th, 2009

This is a Q&A section where I answer some questions I have been asked.

Dealing With XML

Question: Is there a quick and easy built in function in PHP to convert XML to an array?

In short yet, assuming the XML your trying to sieve through is not too complex the simplexml_load_file() function should be able to handle your needs.

Telling a friend they got ‘had’

Question: A colleague of mine recently went about starting his own .com, unfortunately the Designer/Coder they used was awful (for some reason, they did not ask me as well). Basically they paid (a large sum of money) to have a wordpress blog with a tacky (and invalid) design slapped on top of it. Should I tell them they got ripped off, and if yes how should I go about it?

This is quite a sensitive subject, on the one hand they have been seriously ripped off (unclosed tags is not forgivable), but on the other hand they also may not take too kindly to finding out that their website is about as useful as  a burning boat.

I suggest showing your friend his website in another web browser, generally if the coding sucks it should render incorrectly. Hopefully the little nudge in the right direction should set the ball rolling in terms of fixing the problems. If they don’t fix it (or ignore the problem), their loss.

5 Awful 1.0 Ideologies (Which people still believe)

May 23rd, 2009

Here are ideologies from the Web 1.0 era which moron “webmasters” (I use this term sparingly) seem to still use. In most cases it just makes a website annoying and difficult to use.

1. “If there is automatically playing music and videos, it will get a users attention”

Unfortunately not. All this does is aggravating users who are startled by an unknown (and unwanted) audio source. This will obliviously lead to users closing your web browser just to stop the annoying voice. In a recent piece of research by Full On Design in regard to what people like and dislike about websites, one respondent said when asked about automatically playing sales pitches:

I hate it when some annoying sales crap comes up, as it interrupts my music or podcasts [...] normally I would instantly close the website which is to blame.
Anonymous Respondent

Read the rest of this entry »