PHP date function – output a friendly UK style date with ordinal date suffix and ‘hrs’ suffix on time

14th April, 2012 – 5:53 pm
This post is more to remind me in the future but perhaps someone else will find it useful? I like the UK date format - I like to fight the Americanism of not using the ordinal suffix and I also like 'hrs' on 24-hour clock times. Sun 18th Mar 19:00hrs Here is the date function for it... date('D jS M H:i\h\r\s', $mydate); If $mydate is omitted you'll get the time now. Warning - if you use double quotes you won't get 'hrs' you'll get 'h s' as the \r will be converted as return char!! Note how I escape chars that aren't even PHP date() control chars, this is future proofing a new control char being added - they only added microseconds in 5.2.2!

Create 100 different images Containing a Number – The Image Equivalent of Lorem Ipsum

15th March, 2012 – 10:53 am
Often I get asked to design things which require displaying of products and I don't yet have the images.  I've written a script to do just that.  If you're not a PHP coder and just want a zip with 100 - 600 random images - here it is. I need some filler so use a static image - doesn't help prove that I'm using the correct image for the result for the product.  What I needed was a zip with 100 (or 600!) meaningful(ish) jpgs. This script produces just that with random background colours and number. Here is the output - the colours please me greatly. [caption id="attachment_141" align="aligncenter" width="300" caption="Useful for filler for beta sites."][/caption]   Remember if you're using PHP on Windows to check  your php.ini file that extension=php_gd2.dll  is enabled.  I've commented about the font used but you will have to amend these lines.    The script actually outputs the last image for testing though ...

Exporting MS Project 2007 Tasks to MS Excel with Indenting

26th January, 2012 – 2:12 pm
Apparently MS Project 2010 fixes this issue but I've often wanted to copy the tasks complete with  the indenting to Excel to provide a quick and dirty report for non-project users.   When you use copy and paste you look the formatting - grrr!  Here is a quick and dirty solution. Insert column into Project (right click on the  grey header bar above your tasks and choose  Insert Column Select Field Name: Outline Level  Now select and copy your tasks including this column to Excel. For my formulas Col A = ID, Col B = Outline Level, Col C = task name, adjust yours accordingly! Insert in the next free column the following formula =CONCATENATE(REPT("   ",B1-1),C1) There you go - quick and dirty as I said! [caption id="attachment_133" align="aligncenter" width="1024" caption="MS Project Tasks Formatted in Excel"][/caption]  

Moving PHP Solutions from Windows to Linux

17th December, 2011 – 11:16 am
I'm currently building a ticketing / holiday booking application in my spare time in PHP / MySQL.  When I started in PHP I used Linux for my development platform because my laptop ran, the rather terrible, Windows Vista.  I've since upgraded to Windows 7 and find myself using this instead of my Linux share now (oh the shame!). I develop using the excellent WAMP Server  and then copy up to a cheapie Linux host I have.  What could possibly go wrong?! Well for a start there are obvious configuration difference issues (trying to keep the same versions of PHP and its extensions.  I have the error settings set to be as verbose as possible to try and trap issues in my coding before I set the code lose on the server (these are not exposed on the website so that you don't expose the error out to web visitors – security risks) but ...

VII Worcester Wassail – 10th December 2011

8th December, 2011 – 9:43 pm
Saturday 10th December brings the seventh annual Worcester Wassail.  Twelve pints in the loyal city - we return every year just to completely ruin ourselves.   You can download our route guide here. Worcester_Wassail_Dec_2011   1.  The Cap ‘n’ Gown  - 45 Upper Tything  01905 28914 Turn right out of Foregate Street railway station and walk under the bridge.  The pub is ten minutes up the road, just past the school, on the left - this walk always feels longer when it’s cold and pissing it down though.  Established in 1849 and, up until a few years ago, little had changed (except hopefully the odd barrel) now it’s full of faux wood panelling with a strange L-shaped layout and sparse feel (as there are only a few tables) luckily most of you don’t turn up until much later anyhow.  They look after their beer here which is lucky as you’ll still have the power of taste ...

Plotting Numbers of Bugs Raised Each Day From a BugTracker in Excel

7th December, 2011 – 4:31 pm
I had a requirement to plot the number of bugs raised on each day on a graph to show how many are raised.   The bugs were stored in the very wonderful BugTracker.NET .  The problem was I had a list of bugs with a date time. ID MAX(dateUpdated) 2 11/04/2011 09:10 4 12/04/2011 16:48 14 18/04/2011 21:03 15 20/04/2011 07:14 16 20/04/2011 20:30 17 20/04/2011 20:30   Here is how I solved it.  Open in Excel and copy just the IDs and dates to a new sheet. In column three add the following formula (it make the SQL datetime a short date – if you have access to the original DB then do this as a query – NOTE:- UK Date format!!)  =DAY(B2) & "/" & MONTH(B2) & "/" & YEAR(B2) I usually copy and paste as values to get rid of excel formulas into a new sheet called BugsByDate Find your min and max dates by sorting the data) In a new data sheet enter “Date” in column A and ...

The Didsbury Dozen 19th November 2011

18th November, 2011 – 1:08 pm
This is a departure from our standard route - we're going classic.  With the reopening of Ye Olde Cock it's *almost* possible to do a proper pub crawl in just East Didsbury again.  This is going to be controversial as a lot of people love The Metropolitan (not me!). As we're going back to basics I thought it would be nice to have a classic route guide too - so I found the oldest one I could and have kept the text largely the same. The Didsbury Dozen Nov 2011 Route Guide We're starting at 1300hrs in the Woodstock - see you there! The route is: The Woodstock (Barlow Moor Road) The Nelson (Barlow Moor Road)  The (Famous) Crown (Wilmslow Road) The Didsbury (Wilmslow Road) Ye Olde Cock Inn (Wilmslow Road) The Royal Oak (Wilmslow Road) Fletcher Moss (aka The Albert) (William Street)  The (John) Milson Rhodes (School Lane)  The Dog & Partridge (Wilmslow Road) The Slug & Lettuce (Wilmslow Road)  The Station (Wilmslow Road) O'Neills (Wilmslow Road)   

A Really Pleasant Day on the East Lancs Railway

19th September, 2011 – 12:30 pm
If you've seen any other page on this site you'll be aware I like nothing better that a pubcrawl.  The never-grown-up-kid in me quite likes trains too.  Add the two together and you have a Rail Ale Trail! Now - throw in a steam train and you have something really special!  So here is my (unofficial) version of the ELR Rail Ale Trail.  The ELR folk do actually run guided tours - this route is based around their leaflet with some tweaks with a number of stops on the Metro with some varying degrees of pub quality!   We took the trip on a blue weekend - if you want to follow my timings ensure you check on their very well designed calendar - if you're doing this in the summer there are more services so it might not have to be such an early start!!!   STOP 1 - Manchester to Bury Bolton ...

Can’t Get Out of Bed and USB cables Up or Down?

1st March, 2011 – 3:31 pm
Steve’s Time Saving and Swearing Saving Guide. My two top tips. 1. USB Cables – ever find when you’re plugging these buggers in – particularly when you’re trying to plug them in behind the back of a PC you try it three different ways up (despite the fact there are a only two) AND IT WAS RIGHT THE FIRST TIME. Simple solution – to get it right every time. Every single USB cable(*) has a USB logo on it – this *always* goes face up. There you go – have probably 15 minutes of your life back. * - on every single USB cable I own it does 2. Tip to get up in the morning. This is a bit more like self flagellation. Struggle to get up in the morning?? Take on my simple reward / fine solution. It works like this – everytime your alarm goes off and you fail to ...

Stockport Suds Stroll – a Stockport Pub Crawl

4th February, 2011 – 3:32 pm
It's my birthday but we recently had a Didsbury Dozen and a Rail Ale Trail. So what to do? Design a new pub crawl. Here is my original 10 pub, pub crawl around Stockport! You can download the guide from the link below. Stockport Suds Stroll - in Word DOCX format Stockport-Suds-Stroll - in PDF format This pub crawl starts in Heaton Mersey – get either the Magic Bus #42 bus to Parrswood or the more expensive Stage coach which heads up Didsbury Road and drops you outside the Griff. 1. The Griffin – 552 Didsbury Road One internet review reads “I wasn't born in the Griffin Hotel, but I wish I was. I would have my wedding reception here, if I believed in marriage! We worked out that the beer is so cheap it's more economical to spend your evenings here than heat your own house.” ...