Blog Archives

Update a MySQL column trimming a constant number of characters

Will remove the first 4 characters. E.g. ABCD1234, ABCD1235 -> 1234, 1235: UPDATE table_name SET title = RIGHT(column_name, CHAR_LENGTH(column_name) – 4) WHERE clause;

Posted in SQL

Display your Twitter feed from a website

I have put up several posts on how to display recent Tweets in a webpage with PHP. However, Twitter has switched to it’s API v1.1 from today, so all of my previous articles have become obsolete. The easiest thing to

Posted in HTML/CSS, PHP

Identify a (web) link in a string with PHP

If you want to process some text and output the same text with HTML links automatically created for you, then look no further: $newstring = preg_replace(‘!(http|ftp|scp)(s)?://[a-zA-Z0-9.?&_/]+!’, “<a href=”\” target=’_blank’></a>”,$sting);

Posted in PHP Tagged with:

UK to MySQL Date in C#

A C# snippet that will allow a function to be written where a string is passed in, containing a date in the format dd/mm/yyyy, and have that replaced by yyyy-mm-dd: // Matches 2 digits forward slash 2 digits forward slash

Posted in C#

Displaying your latest Tweet in PHP – updated

Back in 2011 I posted a method for displaying your latest tweet in php. However times change, and the twitter API has been changed beyond all recognition. I have updated my script to interpret the JSON response from the latest

Posted in PHP Tagged with: , ,

Notes on the Raspberry Pi

OS used: debian6-19-04-2012 I wanted to be able to play with my Pi, but allow others in my household to watch TV, so I picked up a 3.5″ TFT monitor from ebay for under £15, to make use of the RCA

Posted in Linux Tagged with: , ,

Set date and time of a Linux device from a Windows batchfile

I had a client with Linux device that whose clock is not as reliable as it should be, running a time-critical application. As a workaround fix I wrote a Windows batchfile to update the Linux date and time, and  he

Posted in General Tagged with: ,

Force a favicon onto a webpage

<link rel=”shortcut icon” href=”http://www.my-domain.com/myfavicon.ico” type=”image/x-icon” /> This will force a favicon onto your webpage – useful if you house different websites in subfolders – each subfolder site (or page for that matter) can have a different favicon.

Posted in General, HTML/CSS Tagged with: ,

More mobile browser detection testing

My standard method of mobile browser detection as detailed in my previous post here involves the PHP function preg_match(). Unfortunately for me, having compiled a stripped down version PHP to run on ARM linux, the preg_match() function was not included (probably

Posted in General, PHP