We all know how to format a date in PHP when using the date functions, but what happens if you’ve only got the ISO format? This doesn’t work with PHP’s date functions.
Well I got this exact situation whilst using Zend_Locale in Zend Framework. Because the locale data files utilised are sourced externally the format comes back in ISO format. A conversion function is provided (Zend_Locale_Format::convertPhpToIsoFormat) however that’s converting the wrong way and won’t help in this situation.
I went ahead and wrote a quick function which will return a formatted date using a provided ISO format, rather than PHP format. It works like the PHP function and accepts the same parameters.
To Mongo’s credit there is a file provided in the source under rpm/init.d-mongod, however when it comes to this being used by SystemD, well it just errors.
This was frustrating, but as I was doing it on a VM, I did what any logical person would do. Installed Mongo from the package manager, took a copy of the required SystemD files, reverted to a snapshot, then installed the latest version of Mongo from source.
After this I adapted the mongod.service file to use the correct locations, ensured all the required directories, files and users were present on the system then started the service et voila, working latest version of MongoDB on Fedora 15 with SystemD
the two required files are:
Or you can just use the RedHat distro based install script I created:
Today was my last day working at my current employers. I’ve been there since May 2007 and had some enjoyable times with a group of people really worth working with, hopefully having made some good friends along the way. I’ve learnt a lot while here both with the corporate environment, being my first long-term employers, and a lot in terms of coding, having written everything from back end systems to the company’s web-sites.
After 5+ years though it was time to up-sticks and find myself a fresh challenge and it’s moving sub-counties in my beloved Yorkshire from South back to West. It was a hard decision to move on after so long, but I feel it’s the right one, and time for a change.
I start at my new employers in just over a week, giving me a nice relaxing week off in-between.
Here’s to the future, different challenges, and a load of new colleagues to get to know.
In June 2011 I decided the site famous to Leeds United fans leedsfans.org.uk had been down for WAY too long. It proved an invaluable resource to Leeds United fans on the history of the club over the years, however the sites host and admin Jabba (Jon) had given up on the project for whatever reason with no immediate intention of reviving it.
I found the last copy taken of the site on archive.org and promptly wrote a simple script to scrape all of the content archive.org had stored into a folder so that I could at-least re-host the static content. I did try to contact Jabba to see if I could take over the original domain, but unfortunately I’ve had no response. I then registered the most similar yet cheap domain name I could find (leeds-fans.org.uk) and put all the content I’d obtained back on the web so people could find it again.
Anyway after looking through the source I decided to try and at-least make the HTML valid until I get a chance to eventually re-design and re-launch the site. This is relatively easy with libtidy installed on your system and php compiled with it available.
I wrote a PHP script to go though a folder of static X/HTML pages, run them through libtidy, keep the doctype and save this back to the file.
If such a script will be useful to you here’s the source also available as a gist on github:
Yep, HTML5’s new localStorage and sessionStorage functionality is great, you can store information you want client side, meaning you don’t have to transfer the data via XHRs to the server, or store it in cookies, or in flash storage to keep it between page views.
There is one downside however. Objects, you can’t store them. It only accepts strings, thus I did what everyone’s doing, used JSON to store the object in storage. This however is a bit, well, annoying. You’ve got to remember all the time to run a JSON.parse or JSON.stringify on the data your using or you’ll simply loose it without any errors being thrown
This lead me to simply write a wrapper for both types of storage so I didn’t have to remember wherever I was using them.