Development How Tos

Installing Derby JS on Ubuntu

Jun 11, 2013

Derby is one of a new breed of JavaScript frameworks that take advantage of the interesting NodeJS to create a web app framework that runs your code both on the client and the server. This has a tonne of huge advantages compared to writing a complex JavaScript application that has to communicate with a different language on the server and still maintain visibility to Google. The big advantages I see from this: Only one language to work in makes it easier for developers Communcation between client and server is automatic and seemless Pre-rendered on the server, updated on the client so Google gets the proper content but you still get dynamic updating for your users So with this in mind I decided to do a little test app and of course the first step was getting it installed. These are the steps I had to go through to get it working.

Setting up Git, Github and Cloud9 IDE and Pushing to live server

Dec 10, 2012

I thought it was about time I published another blog post and I have just been messing around trying to set up an ultra simple project using git for source control, Cloud9 IDE for the editor (which is all very simple) and then I thought wouldn’t it be nice to be able to push those changes live from the IDE. So, seemed like a simple thing to do and there were a few posts around on the net that helped but nothing that really pulled all of that together in once place so I thought it would be a perfect thing to explain.

Recursive Filesearch using the PHP Glob function

Jul 31, 2012

A really simple snippet of code that I tend to use when doing big imports of data into a database system. It is rare that the people preparing the files are perfect at following file naming conventions so being able to allow for a bit of flexibility is vital and this tends to do the job. Performance wise this isn’t great because you do a lot of searching that you probably shouldn’t need to do but that is up to the developer to either work around or just be aware of.

Update: WordPress – Dealing with lots of standard image sizes

Jul 31, 2012

This is an update to the blog post and gist I wrote about getting image source filenames from wordpress when all you have is the thumbnail version. It turns out the whole thing is a bit more complicated, especially if your client/editor is uploading files that already have dimensions in the filenames. Not to mention an odd little WordPress “feature” where you sometimes don’t get the files in the sizes you expect.

WordPress – Dealing with lots of standard image sizes

May 16, 2012

WordPress is a fantastic tool for building websites but sometimes there are little things that are a bit tricky – one of those is thumbnail images. All the more frustrating because it gives you almost all of the tools you need – but not quite all of them. Here is a little utility function I have used to get around the fact that there is no wordpress function for getting a thumbnail image for a specific size (even when you have correctly generated the thumbnail at that size using the add_image_size function.

Adding an additional content block to your Magento page

Apr 12, 2012

It turns out that once you understand Magento’s complicated template/layout structure it becomes pretty easy to add content blocks wherever your website needs them. This is just a quick explanation of how that works. So first things first, find your page layout file. This will be under the app/design folder in your themes layout folder and will be named page.xml. This file contins an element called default that (in magento terms) is called a Hook.

Really simply HTTP Authentication on Apache

Apr 7, 2012

There are countless reasons for using some kind of HTTP Authentication on your website but the one I come across most often is to password protect a new site until the client is happy for it to go public. For this kind of situation I usually use the Apache mod_auth_basic module because it is quick and easy to set-up and equally quick to remove once you are ready for the site to be public.

Adding a CMS Block to your Magento footer

Mar 30, 2012

This is a really quick and simple tutorial to explain how to add a CMS Block to your Magento sites footer. It is a simple case of creating the block and a few lines of content added to your layout xml file, all of which I will explain below. First thing is to create a new CMS Block from Magento’s CMS menu and to add some content, taking note of the identifier that you have entered.

Add flag icons to your Magento site header to switch currency

Dec 4, 2011

Out of the box Magento comes with support for multiple currencies to be allowed, even within the same store. If you need this there is a helpful little module that provides a dropdown for your sites sidebar to switch between them and although this is very functional it looks nicer, and I suspect users prefer it, to have currencies selected using icons – and to find them in the header somewhere.

Sorting UK Date format in JQuery Datatables

Dec 1, 2011

DataTables are a brilliant plugin for JQuery that restyle and add functionality to your tables. They add searching, pagination and sorting right out of the box with very little configuration needed – unfortunately the sorting doesn’t support the UK date format so you need to add your own sorting methods – basic ones are supplied by the site itself but I have added a couple of tweaks to handle blank dates.