Archive for the ‘Computing’ Category

It’s been a while…

Tuesday, August 26th, 2008

It has indeed, as I have been a bit busy lately.

To update you, I have recently started my own freelance company called Fivetwelve, which specialise in web design, development and a whole host of other things. (more…)

Taming the Zend beast

Tuesday, July 29th, 2008

Recently I’ve been seeing Zend Framework pop up more and more. Since the aim of a framework is to “provide a skeleton application” that basically saves me, the developer, time; I was interested. (more…)

Database connection error?

Friday, June 13th, 2008

Sorry about that, had a spot of down-time over night. I was making some changes to the local copy of my site that I use for development.

One change I made was the wp-config file which specifies the criteria for Wordpress to log in to the MySQL database. Naturally, my local copy is different to my remote copy, and I accidentally copied over the remote copy with the local file…

It’s all sorted now though.

Why I love Apple

Wednesday, June 11th, 2008

A few months ago I remember speaking on the phone to Microsoft’s support team because I couldn’t activate a copy of Office 2007. Because I was using it on a Boot Camp partition and sometimes booting it from within OS X with VMware Fusion, naturally the whole Microsoft activation system got a bit confused with the constant hardware changes. So they thought I was a software pirate…which I’m not, despite being completely aware of the whole activation process after years of experience working with the stupid system.

But anyway, on the phone to their team, predictably somewhere in India, I got absolutely nowhere after speaking to a bod, a supervisor and a manager. The result: a downgrade to a dodgy copy Office 2003 and a complete waste of money with regards to Office 2007. So if you read this, Microsoft, why not get in touch and help me activate my software? Don’t complain about the copy of software I’m using when I can prove my purchase of Office 2007 and it’s down to your incompetence that I’m doing it. It’s just pathetic.

With Apple, things are massively different. Recently my MacBook developed a crack in the plastic, resulting from wear and tear near where the clamshell magnets meet the main casing. It’s still well within warranty, so after discovering it seemed like a common problem, I took it into my local Apple store in Kingston.

For those who don’t know, Apple support works in a unique way. Here’s the difference. With Microsoft, you ring a number that costs a body part per minute and speak to an Indian lady who doesn’t even know the difference between a washing machine and Windows XP. With Apple, you go onto their fantastically designed website and use a system called Concierge to book an appointment with a “genius” at your local Apple store. Granted, there aren’t many stores nationwide. But I’m lucky in that respect.

Genius - that’s a good word. Things are slightly different when you do it the Apple way, because every store has at least a genius (I’m guessing) and every single one is sent to the HQ in Cupertino, California to be intensively trained. Wow.

So I go and speak to the genius, who has a unique passion for the product and the brand which just radiates from the communication. Straight away he admitted that the crack was a design fault and even if the MacBook was out of warranty, they’d replace it for free because it was their problem. With Microsoft, you just get told you’re a software pirate by someone with an IQ of 7.

“Our current lead time is seven to ten working days, unfortunately. But we will replace the entire case, keyboard, and so on” he told me. That’s a long time, but I explained that I’ve got a new MacBook Pro on the way so I’ll wait for that to turn up and then bring in the old one for repair. The conversation was far from over. “Will you be looking to migrate your documents over to the new notebook?” he asked. The conversation continued with him explaining the best way of moving over my accumulated digital junk to my new purchase. Wow.

Making the most of his expertise, I decided to ask him about my Leopard upgrade woes. “Yeah, sometimes stability can be an issue when doing an upgrade from Tiger, but if you choose ‘Archive and Install’ as an option from the lower right of the installation screen, I’ve found that can make the difference from a sound install to a bad one.” he happily told me.

Well there we have it. That’s Apple, going the extra mile. If you came to this page looking for reasons to go Mac over Windows, here’s your answer.

Style issues for some users

Sunday, May 11th, 2008

At the moment I’m aware some of the styles are slightly off what they are intended to be on this site. As far as I know, the image border problem affects IE and Firefox users. It seems to be ok with Safari.

Over the next few days I will look at solving the problem.

Configuring virtual hosts with XAMPP

Sunday, April 20th, 2008

I use a nifty piece of software on my Mac called XAMPP, which flawlessly installs an entire PHP and MySQL (along with other features) development environment.

Of course, Mac OS comes bundled with Apache and there’s a lot of info on the Internet to help you configure the factory installed Apache with PHP and MySQL. That said, it’s much easier just to get a whole package that does it for you.

Not convinced? Take a look. You can even get it for Windows, although from experience I find WAMP does the job perfectly.

The most alluring feature of Apache is the ability to configure multiple hosts on one single machine. Professional web hosting companies use the same technique I will demonstrate here in order to host several websites on one physical node, whilst maintaining individuality for the hosted sites. It’s a little thing called “virtual hosts” and it’s something I couldn’t live without.

Let me give you a small example. I currently have four virtual hosts configured on my MacBook. This means that when I open my browser and navigate to “http://ge”, I’m forwarded to a local copy of this site for development purposes. I also have another - “http://xampp” which is a site for accessing the XAMPP administration page and a further two. You see the point. Whilst all DNS names point back to localhost, Apache sends each one to a seperate virtual directory containing a different site.

Configuring hosts
Before doing anything, you need to set up your hosts file. On a Mac, it’s easy to find, in /etc/hosts. I won’t cover doing that here, there are plenty of sites around the Internet to help you. If you’re a grizzled networking veteran you’ll know that hosts is a local file used for DNS resolution.

Specifying the virtual hosts
The thing I noticed with XAMPP is that the build of Apache it installs doesn’t like the standard virtual hosts configuration you specify with WAMP and other builds. In fact, it took me a good few days to find the technique in order to actually get it up and running properly. You should know where your virtual hosts are specified. In the standard httpd.conf file, Apache includes a file seperately for easy management of virtual hosts. You’ll need to un-comment this line:

# Virtual hosts
Include /Applications/xampp/etc/extra/httpd-vhosts.conf

On boot-up, XAMPP now knows to look in the extra directory for a file called httpd-vhosts.conf. Sure enough, with the original name of “vhosts”, this is where you specify your virtual hosts configuration.

This is the bit I found tough - the syntax to use. Luckily for you, all you have to do is copy what I write and fill in the blanks with your bits:

Quite obviously, you’ll see you will need to create a site directory within the htdocs directory to hold your site. Next, you should have noticed the ServerName and ServerAlias conditions. This bit - specified as “ge” for the purpose of this guide - should be the name of your local server that you’ve already configured to point back to 127.0.0.1 in your hosts file.

There isn’t much else to write on this topic. Obviously, it goes without mention, before expecting any changes to take effect you’ll need to restart your XAMPP installation.

If you have any problems, leave me a comment and I can help you out. Good luck and happy developing! :-)

Using mod_rewrite to tidy up your links

Wednesday, March 26th, 2008


First of all, let me start by confessing that I’m not an expert in .htaccess modification. This is something I’ve learnt and I will guarantee that there will thousands of developers who know this topic like the back of their hand. Therefore this little tutorial is for those guys who may have been searching for simply ages for an answer that doesn’t seem to be out there. So please, if you’re an experienced programmer, please do me the liberty of leaving out all the usual flaming stuff that can be found on the likes of YouTube. Instead, please take the liberty of contacting me directly. With that said, let’s move on.

Well finally after a good few days searching solid for how to do it, I’ve done it. What am I talking about? Well, what seems like a basic PHP design tactic these days is tidying up your user’s address bar by using mod_rewrite on Apache. Not only that, but it also makes site design, as well as link management and organisation much, much easier.

I’ll give you an example, if you don’t know what I’m on about. Have you ever been to a site and noticed that in the address bar you see a link that resembles http://acmeinc.com/products or http://someblog.com/archives? The main thing to notice here is that usually people are used to http://acmeinc.com/products.html or http://someblog.com/archives.php - however this isn’t happening in this mod_rewrite technique. It looks much tidier, and makes maintaining the site a lot easier.

What’s going on under the bonnet?

First I need to explain exactly what is happening behind the scenes for those who don’t know. Apache, the server technology of a site, is receiving requests for web addresses, as you’d expect. If a user navigates to http://someblog.com, Apache will automatically look for the default page (usually something along the lines of index.html index.php), and dish it back out to the user. Let’s take a practical example. Consider Facebook - which dishes you out http://www.facebook.com/home.php. All good, but it’s ugly (at least by modern web standards).

Now with this little technique which you’re about to learn, things change. Mod_rewrite modifies the requests by “rewriting” the request that Apache receives from a user’s browser. The mod_rewrite rule I use appends “index.php” to a request if what’s requested isn’t found. Now you know what’s happening behind the scenes, let’s move onto how you can apply this to the structure of the site.



Applying this to a site

Ok, so what we discussed above seems very pointless at first, and usually people struggle to think how they can apply this to benefit their site. However, Wordpress is a good example of how people use it to help them. The technique I use is organising pages into folders that resemble what you would usually use as page names. Considering my site, I have several main sections. Let’s take my portfolio as an example. Usually, you may decide to use “portfolio.php”, and include this in your navigation however in my case things aren’t working this way. I actually have a folder called portfolio in the root of my server, and within that folder, an “index.php” file containing all the juicy content you would originally expect in the “portfolio.php” file.

Can you seen what happens here? So all my links will point simply to “/portfolio” (yes really, view my source) instead of “/portfolio.php”, which means Apache will get a request for http://www.george-edwards.co.uk/portfolio and deal with it by appending “index.php” onto the end.

You should now start to see things taking shape. This theory doesn’t work too greatly with a WordPress driven site (I find the file structure of WordPress pretty messy), but if you use it for developing your own site, you’re going to have a very tidy looking site structure which makes development in a text editor surprisingly simple.

Here’s an example. Consider you’re making a simple site for “Apache Software Ltd.”. Apache (like the name?) may want a typical four page setup - Products, Contact, About and News. Nothing unusual here. But let’s think about the directory structure (click the picture and look at our example in motion):

Post figure 1

Here you can see it in action. Your navigation would be very simple in this case. You may use a PHP include to grab navigation elements from the header.php file in the include folder. But the case remains the same - your links would all be along the line of “/products”, “/contact”, “/about” and “/news”. The same effect happens in the address bar. Your user would be looking at “http://apachesoftware.com/products” and they would never see the ugly “index.php” on the end. Imagine just how simple it is to manage, having everything in folders like that!

Modifying .htaccess to add the rewrite rule

One thing is left. We need to re-do the htaccess file. Simply add the following to the end of the file and restart your Apache service:


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Enjoy. Any thoughts? Let me know via the comment feature.