My Twitter

Archive for the ‘Coding’ Category

Socialize This V1.5 – Coming Soon

Saturday, June 27th, 2009

Just a quick notice, I’m currently working on Socialize This V1.5 and it’s coming along nicely.

New Features:

  • More pre-bundled icons (More of the new icon sets is made by @KirstyBurgoine)
  • Better Icon Management – More power over the icons on your site.
  • Better Social Networking abilities.

If there is anything you want added put it in the comments.

What is a Browser?

Wednesday, June 17th, 2009

Ever wondered how many people know what a browser is? If you haven’t this video may make you cry a little.

Youtube – What is a Browser?

Checking for embarrassing words in a string

Tuesday, June 16th, 2009

I was recently on YouTube and I noticed that did not check the shortened strings for potentially embarrassing shortenings of words.

YouTube's Cock UpHow to make a great example?

Here is the code so you can shorten strings and check for potentially embrassing words.

(more…)

CAPTCHA Based On Image Orientation

Friday, 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.

Handling Errors In PHP

Wednesday, 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 ).