Coding
I was recently on YouTube and I noticed that did not check the shortened strings for potentially embarrassing shortenings of words.
How to make a great example?
Here is the code so you can shorten strings and check for potentially embrassing words.
Read the rest of this entry »
Posted June 16th, 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.

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.
Posted June 5th, 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 ).
Posted June 3rd, 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.
Posted May 29th, 2009
CSS sheets revolutionized the way websites are managed and created; they essentially made managing the design a piece of cake.
However, many webmasters (and blog lords) forget to add a print sheet (many of the themes for wordpress lack even a simple CSS print sheet). Here is a quick video tutorial on creating a simple print CSS really quickly.
Read the rest of this entry »
Posted May 21st, 2009