Tuesday, August 25th 2009


Blanking out Credit Card numbers in a database with XXXX
posted @ 6:01 am in [ Uncategorized ]

If you have a database table of Credit Cards that a customer has forgotten to mask or blank out, this simple SQL statement will nuke the first 12 digits so that only the last 4 remain as a reference for what card was used = safe 🙂

UPDATE orders SET cc_number = CONCAT(‘XXXXXXXXXXXX’, SUBSTRING(cc_number, 12, 4));

[Change orders to be your table]




Tuesday, April 7th 2009


Uncurling PHP Curl’s character encoding problem
posted @ 3:06 am in [ Uncategorized ]

curl*, and specifically the PHP ‘glue’ that includes curl within the PHP function list, seems to have a strange party quirk where it automatically converts the results from the curl queries into UTF-8 encoding, which means you end up with extended character symbols such as £ signs being converted into weird looking versions like £, and back quotes converted into even weirder symbols such as ‘Caviar’

My first step was to use the PHP utf-8 decode function to get around this, utf8_decode(), however this copes with the £ symbols, but falls over with back quotes and similar ending up with ?Caviar?

So.. after a bit of reading around it turns out that the iconv function can convert between charactersets effortlessly, so the following to convert from UTF-8 and Windows-1252 works perfectly.

$text = iconv(“UTF-8″,”Windows-1252”,$text);

Job done 🙂

*(curl is a command line tool for transferring files with URL syntax – http://curl.haxx.se/)




Friday, October 17th 2008


Debug mode for Safari on Windows
posted @ 3:45 am in [ Uncategorized ]

Firebug is a brilliant debug tool for Firefox, and Safari currently lacks such a great tool – however it does have it’s own inbuilt debugger.

After researching around, it turns out that the way to enable this has changed quite a lot, however the latest way of enabling it is as follows:

 1. Open the Safari preferences file

This is located in

C:\Documents and Settings\<your username>\Application Data\Apple Computer\Safari\Preferences\com.apple.Safari.plist

You may need to enable Tools -> Folder Options -> View -> Display the contents of system folders in your Explorer if you cannot see this folder by default.

 2. Add the following keys to your file

Edit the file and add the following two keys just before the </dict> near the end of the file

 <key>IncludeDebugMenu</key>
 <true/>
 <key>IncluldeInternalDebugMenu</key>
 <true/>

3. Restart Safari

And you have a new Drop Down menu called Develop which lets you do what you need




Friday, October 19th 2007


Disabling and changing the colours of the Google Toolbar AutoFill functionality
posted @ 8:39 am in [ Uncategorized ]

I’m finding more and more users today have the Google Toolbar installed either automatically, or sub-consciously on their machine, which has an interesting feature in it called AutoFill.

AutoFill basically allows you to store a profile of yourself on your machine, and to use this to dynamically populate the fields on web pages you visit – a great concept and actually very handy.

One of the quirks of AutoFill is that it dynamically changes the background colour of form fields it intends on changing to a bright ‘Yellow’ colour to highlight to the user that it is able to help.

This is obviously real trouble if you have non-white background sites like lots of our clients, or beautiful sites that you don’t want highlight penned.

Luckily there is an answer out there in the form of dynamically chanigng the colour of fields changed, either to an alternative colour, or to blank to remove the colour.

I try not to keep code here but have a read of http://code.jenseng.com/google/ where you can see a number of different ways to achieve this and make your own code to help – there’s our version of this here

An excellent way to use this feature to work more in your favour as designers…