Ubuntu Server within VirtualBox on Windows 7

April 6th, 2012

In the past I have used an old Dell PC for my development server, generally installing a server distribution of Linux (first CentOS, recently Ubuntu – I made the move primarily because of the great documentation available for Ubuntu, and for the fact that is used by more people).

Just recently, the HDD in my development server has started to become noisy and so I took the decision this morning to replace my development setup before it was forced upon me at an even more inconvenient moment.  I decided that I am not a big fan of using the electricity it takes to power two individual machines, plus it takes up quite a lot of space in my home office.  For this reason I decided to investigate virtualisation and whether or not I can run Ubuntu ‘within’ Windows 7 (my ‘host’ OS).  Whilst not comprehensive, this set of instructions will hopefully help someone out a bit if they’re ever looking to do something similar to this….

Read the rest of this entry »

PHP: Detect if any Chinese characters are in a unicode string

March 9th, 2012

We were looking for a way to detect if any chinese characters existed in a Unicode string in PHP, and came up with the following, which uses Unicode Scripts:

preg_match('/\\p{Han}/u', $description, $matches);
if(count($matches) > 0) {
// chinese characters exist in $description.
}

Aims for the following year

March 4th, 2012

The last twelve months have been busy for me – I got married, we bought our first house together in Cardiff and I started working remotely.  With things having settled down slightly, I have had some time to consider what I’d like to achieve this following year when it comes to my own development.  My aims range from Unit Testing my code and developing in a Test Driven manner to speaking to industry peers at a developer meet.  I’ve listed my aims in this post.

Read the rest of this entry »

Discouraging the accumulation of Technical Debt

December 12th, 2011

I’m nearly four years on from starting with my current employer. This is quite an interesting phase of my employment, in that sites that I worked on when I first started are all reaching the stage where they’re being refreshed, upgraded or completely rewritten.  What this seems to be doing is highlighting to me that there really is such a thing as Technical Debt and it really can be as evil as people say it can.

Read the rest of this entry »

Working from home: Month 1

August 31st, 2011

I have just completed my first full calendar month of the new teleworking arrangement I have with my current employer, so feel it is a good time to write down some of my feelings and detail my experience thus far.  My arrangement is to work remotely for 3 days of my 5 day week, travelling in to the office on two consecutive days, typically Wednesday and Thursday.  This tends to break up my week very nicely in to easy chunks: Monday-Tuesday at home, Wednesday-Thursday in office, Friday at home, and then the weekend.  This in itself is one of the biggest advantages in my view; I get 3 ‘fresh starts’ per week where I can be ultra-productive.  Rarely do I now get ‘that Friday Afternoon feeling!   Following are some tips I have if you are about to start working remotely (and a lot of these points apply to freelance workers too)

Read the rest of this entry »

Distractions – a useful Firefox plugin to stop them in their tracks

March 31st, 2011

At work, I occasionally found that if faced with a particularly mundane piece of work, or something that dragged out for a long period of time, it would be quite easy to get distracted by popular sites such as twitter, BBC news, engadget and various other tech-related but not entirely productive sites.

I thought “someone else must have had this problem”, and if they hadn’t, I was going to write a Firefox Add On to help maintain productivity by blocking distraction web sites. But, alas, someone has beaten me to it! I have found and installed the LeechBlock Firefox add on and it is fantastic. I’ve added my favourite sites to a list of sites to block at any time that isn’t a break time (so here, 9-11, 11.15-1, 1.30-3, 3.15-5) and it’s proven very effective.

Linux: How to recursively download contents of an FTP directory

March 8th, 2011

I was looking for a quick way to recursively download the entire FTP directory for a site that we are transferring. This was, I found, the easiest and most straightforward way:

On the command line interface, assuming you have wget installed, type:

wget -r ftp://USERNAME:PASSWORD@mysite.com/

Hit enter and wait while it retrieves everything for you.

I did it this way because I didn’t want to download 4gb of data to upload again, so ran this command direct from the ‘production’ server with its stupidly fast internet connection. Hours and hours saved!

A problem with forms submitting using AJAX: how to resubmit?

February 22nd, 2011

I’m a fairly regular user of the twitter web front-end, and of Facebook. Both of these have tremendously wide audiences and are hugely popular. Twitter recently attracted a bit of negative press from the technical community for replacing the old, fairly standard URL structure with one that uses ‘hashbangs’ and is fully dependent upon Javascript to serve the correct content. But I’ve another more user-centred complaint about Twitter (and Facebook) relying heavily on Javascript for fundamental parts of their apps (e.g. the ability to tweet, and ability to comment on stuff). That is the removal of the ability to ‘refresh’ or ‘resubmit’ a request…
Read the rest of this entry »

Does your website still need to be functional with Javascript disabled or unsupported?

November 10th, 2010

We have recently been reviewing the amount of development time spent on projects, and have identified one area where a fair chunk of extra time is spent for relatively little gain: Ensuring that web sites are 100% functional with Javascript disabled. The general concensus on the web is that year on year, the number of people (even those technical in nature that browse w3schools) with javascript disabled is falling – but is this a decent reason to consider removing the true graceful degradation that most front end developers have been obsessed with for the last few years?
Read the rest of this entry »

Commenting code – a minor but invaluable investment of time

November 3rd, 2010

I’m a strong believer in code being written in such a way that it is self documenting, but would not use this as an excuse for not adding in English language comments to go alongside the code. After all, comments add a tiny amount to the size of a PHP file and don’t slow down the application at all. Also, the English language comments alongside the code can be used to justify decisions or assumptions you have made, which might make the next programmer’s visit to the file a lot quicker and more productive.

Read the rest of this entry »