Techno-baby!

Over the past year or so my Apple product ownership has gone from zero -> four (well maybe 6/7 if you count peripherals). Is this because I am now a Fanboi and will join the queuing masses in the coming months when the iPhone 5 is announced and camp out for days to be the first, yes the first to own it for a nano second. The short answer is no, I’m still not a massive fan in fact when I spent £1500+ on my first Apple product I felt dirty inside and the yorkshireman in me died a bit more. Don’t get me wrong the products are all good, a nice quality, but are still overpriced for what they are. I could have bought 3 decent laptops over the next 5 years for the price of the Macbook Pro. I bought these devices because as a developer it opened up more doors for me.

So around Christmas time when I was trying to desperately come up with a good gift for my wife I turned to Apple once again and bought an iPad. The device doesn’t fit my needs personally, if I’m surfing the net then I want to do it on a fully functioning laptop. If I’m casually surfing, my phone suffices. For my wife however it did fit the need, I wanted a replacement to my wife’s ageing netbook and the iPad fit the bill.

I also had a sneaking suspicion that my one year old Adam would take to it as well. What I didn’t realise was how much and how easily he would take to it. Bear in mind that we are talking about a baby who cannot yet talk and has the attention span of a fly. He was instantly hooked, and in some ways obsessed with the device. It could keep him amused for minutes (a big thing for him)! He instantly got the interaction and was happily switching between apps and making noises, and turning the screen to flip it to the right side. Amazing really for someone so young.

Fast forward 6 months and whilst he still can’t talk (he’s getting there) his level of understanding of what the iPad plays is astounding. We downloaded apps that make animal noises as he likes animals and the education that the iPad has given him is brilliant. As the following video shows, he can identify animals I wouldn’t have believed possible for a 21 month year old. And he definitely hasn’t memorised the locations, they change between portrait/landscape modes, and there are multiple pages. He literally knows what an Elephant is, looks like and sounds like check this link right here now. The video doesn’t show it be he equally can point out flamingos, camels and crocodiles, not your average farm yard.

I never had anything like this as a kid, as obviously the technology wasn’t there, but today it is. I am filled with a sense of awe of what children today will be achieving in 20-30 years with a foundation such as what is the norm today. Technology is amazing.

VirtualBox, IE9, OSX, Test Environment

Since switching to developing on a Mac a year ago one thing which has always been a bit of a pain for me is when I need to test a site specifically on Internet Explorer. Whilst things have improved greatly recently in the need to support this as a browser there are still occasions, albeit quite infrequently, when I simply need to replicate an issue on IE. These occasions are infrequent simply because I use a good base point for my FE work, and IE8/9 are actually quite good (in comparison to IE6/7). Coupled with a policy of progressive enhancement seems to get me 95% of the way there most of the time.

Still there is always those odd occasions to deal with. Because they are so infrequent I have so far gotten along with hi-jacking a colleague’s PC and hoping its a quick fix. Of course this was never going to be a long term solution as its not always going to be a quick fix and it isn’t always going to be available to me. A more permanent solution is required.

As I saw it I had 3 options:

  • Buy a test machine
  • Purchase Parallells and a Win7 License
  • Find a free option

The yorkshire man in me wanted to opt for the third option, after all I have spent a hefty sum on a Mac to do development, spending more money for the odd occasion irked me. Ultimately tho I didn’t hold out for a free option so have been looking to buy a test machine which could double as a machine for my wife. Only problem here is that if my wife has it and I need it then back to square one.

Well this morning I stumbled upon a tweet which looked like it could fulfil my needs. I’d heard of VirtualBox (and even had it installed) but the idea of subsequently having to install an OS such as Win7 seemed like more expense and a lot of hassle. Step forward Greg Thornton who has provided a wonderful script that does everything for you to get up and running with VirtualBox in kinda no time!

Visit Greg’s github page for instructions on how to install it on Mac, then be prepared to wait as it downloads a massive 4GBish of data, just to install IE9. But post install I finally had IE9 available on demand on my Mac for free.

There were a few things I had to discover post install to help with dev which I will detail below but its all available with a quick Google and certainly isn’t a complaint from me.

  • Password to login as Admin was “Password1” – this gets hinted to you on the login screen but still would be nice to be in the README file
  • To access my Mac’s localhost, use the IP 10.0.2.2
  • Hosts file needs to be edited as administrator, right-click on Notepad.exe and select “Run as Administrator”

And thats it, I was happily debugging an IE7 mode in IE9 without having spent a penny. The silver lining was that the money I was saving for a test machine I have spent on a shiny new 27in LED monitor :-)

Doing more with {less}

Been a while since my last blog which disappoints me a lot, didn’t want to leave it too long as I fear just like the gym, once you stop, you stop for an extended period of time. So this is just a quick post to extend my appreciation for Less.

I’m very late to the party here, CSS pre-processors have been around for a while now. I hadn’t looked at them for a few reasons:

  • I didn’t want to learn a new syntax
  • I was worried about source control
  • I was worried I would become dependent on it
  • The compile step may slow me down
  • I don’t actually do a great deal of new projects, I do a lot of maintenance

I’m sure people who haven’t used css pre-processors probably would consider the above to be a pretty standard list, I’ve heard others like you can’t work remotely on a file that then needs compiling etc. Lets be honest though none of the above have that much weight really. Probably the biggest reason was that I was being lazy.

So when I got my last small project which was a 2 day max start to finish brochure site I decided to bit the bullet and go for it. I had a choice between SASS and Less to make, I don’t know if there is a religious war between these two but I chose Less for no other reason than I have used Twitter Bootstrap in the past. A big project like this which uses Less seems like a pretty good advocate of the system. It also gave me a ready made reference guide with real world examples.

I solved the compile issue by purchasing LiveReload which not only compiles Less/Sass on the fly it also refreshes your browser without needing to switch to it sildenafil citrate generic. I am not feeling the full benefit of this part yet as I mostly work from my laptop in a single screen scenario, which is less than ideal. But a quick tab back and forth is still quicker than a tab, Cmd-R. I thoroughly recommend this app.

As to learning the new sysntax, it took me roughly 5 minutes to get used to it. Mixin’s – a breeze, the nested structure – intuitive, variables – a god send. In short I can’t believe I hadn’t used it earlier it was amazing. I also downloaded Less Elements which was a handy starter library for common mixins, a great way to get used to them.

I still have concerns over source control, because in a multi-person team someone could edit the css file direct and then the less file is out of date. This is a communication/discipline issue however and should be addressable.

Did I grow to depend on it, well not yet, but I could see it happening easily. Even now when I am doing a maintenance task I find myself wishing I could use Less on it. Just like when I don’t have my favourite MVC framework available I have to slow down and think about things and wish I had a convenient wrapper library about some basic functionality. If anything not using it all the time means that when I use it again I will probably have to re-learn it, which doesn’t worry me in the slightest.

If you’re not using a CSS pre-processor I seriously recommend giving it a shot.

Do you need a CMS?

I’ve recently started a new project for a client based on the Joomla CMS. Its been a while since I’ve done anything serious with Joomla but I’ve always been able to work with most things so wasn’t overly concerned by the project. The project itself is basically a re-skin of the existing site, no new functionality per se but nice treatment of the content to suit the sites objective of selling the business to the paying public. Now not being a massive expert on Joomla may hinder me slightly and achieving what I want to achieve has probably taken me more time than I expected but what it has done is re-affirmed my belief that ‘out of the box’ CMSes are simply just not worth it.

I have always been a big advocate of bespoke CMSes (or no CMS) and here are some reasons why

  • Your project rarely if ever fits the functionality that a general purpose CMS provides
  • Plugins which fill the holes a CMS has are not a good solution – the quality varies considerably and invariably breaks the upgrade path
  • Time saved in utilising the CMS is most often offset by learning the CMS and working around what it does by default
  • Security of a popular CMS is often low – its a big target of automated vulnerability scripts
  • A CMS 75%+ of the time isn’t used or required, in my experience clients rarely use the CMS, or worse get you to use it for them
  • Budget for a CMS is better spent elsewhere

About the only time this isn’t the case is when you are doing something very specific with a site such as a pure blog, or an ecommerce solution. CMSes just aren’t worth the benefit they provide. This may seem like an odd stance from someone who makes a living basically selling CMS work but experience has taught me that my thinking is more often than not right.

But, but the client needs to be able to update the site themselves… Really they absolutely have to be able to do that? What like twice a year? Seriously if I built a site and the client wanted to make some text amends to a page it would take me about 5 minutes to do it, and more often than not I wouldn’t charge for it, the time taken to raise an invoice outweighs the dev time. If its more than simple text amends, like adding a new section then I’d quote for this work, and you can do more with it. It still probably works out cheaper for you in the long run.

Its a different matter if the site is constantly being changed, a CMS makes perfect sense then, or if the site has a news/events/directory section then again a CMS makes sense, but in those situations go bespoke, it will be quicker and cheaper to build than trying to get Joomla/Drupal/Wordpress to do what you need. Or perhaps try Perch which does a grand job as a small CMS for a bit of text changing.

In the meantime, Joomla you and I have some time to spend together.

2011 Review

Well another year comes to an end so I thought a traditional review would be in order.

This year has been a different one for me, my first year working for myself. I can only say it has so far been nothing short of a success. Whilst I perhaps haven’t had as many clients who are purely mine as I would have liked I have nonetheless forged some really good relationships with other agencies both big and small. I have also renewed old relationships with some old work colleagues who have also gone out on their own.

I have also dabbled in my first contract position which has also proved to be to my liking. I like being able to add something different to the project mix and bring my experience to the fore. All this without having the ultimate responsibility for multiple clients has been refreshing for me personally.

Overall it has been a lot of hard work and I’ve probably worked a bit too much this year. I’ve found it especially hard to turn work down and this has been to my detriment sometimes.

Going back to development after a few years out has also been good. It hasn’t taken long to get back into the swing of things and all the old skills returned. I’ve also learnt a few new things this year. JQuery is fun and makes JavaScript a pleasure again, I hope to get a lot more proficient with this. I’ve also tried out RabbitMQ which was cool, a little Amazon EC2 and integration with both Google Checkout and Sagepay. All very good experience.

My business knowledge has increased although I think I have been lucky so far with my clients and I haven’t had any bad experiences yet which is good. Long may this continue. Managing cash flow has perhaps been the hardest part of working for myself. I think I’m in a fairly good place right now but it is worth keeping an eye on.

I had hoped to devote a bit more time to this blog and whilst I managed to do this early in the year the second half waned a bit due to workload pressures. I’ve still managed (just) at least 1 blog post a month which is my aim to continue. As the second anniversary approaches I’m glad that I have kept this up. Would still love to grow my audience a bit.

Finally from a personal point of view this year continues to keep me on my toes with my wonderfully energetic son. He changes practically every day and watching him grow up and master new skills is very rewarding. Still by far the biggest challenge I have ever faced but one I intend to continue to rise to.

As for 2012, well assuming the world doesn’t end, I have a lot more goals. Try to re-balance the work/life situation is one, continue to learn and get more clients and relationships. Nothing extreme a steady progression is all I ask.

Good luck t

Twitter Boostrap

One thing I love about the open web is the multitude of tools available to you in order to build web sites and applications quickly and to a very high standard. Over the past few years frameworks and libraries have sprung into existence all aimed at a particular problem domain. Back in the day when these libraries weren’t available throwing together a site, with a content management system, that worked across all browsers, and was very robust, was no small task. Thankfully this has become a lot easier. You have MVC frameworks such as CakePHP that take the heavy lifting out of building the backend, you have JavaScript frameworks such as jQuery that abstract out all of the browser quirks between JavaScript engines and make animation and DOM manipulation a breeze, and finally you have CSS frameworks such as 960 grid which make it much easier to do complex layouts.

I utilise a lot of these frameworks, and the examples mentioned above are just one of the many available. One area of framework which I often would like to use is a UI framework for building interfaces. There is jQuery UI which is a very comprehensive framework but having looked at it I find it a little too bloated.

Another such framework which I recently became aware of was Twitter Bootstrap. This is an interface library which provides common markup patterns with associated CSS and a bit of JavaScript to build lovely cross browser user interfaces. The framework isn’t really suitable for public facing websites but is absolutely ideal as an interface to a CMS.

There are plenty of widgets available which makes it easy and quick to develop a consistent set of forms and tables to display and manipulate your data. There are buttons, tabs, menus, messages and even a handy grid system for your complete UI. I have used it recently on a big CMS build and the results were excellent.

There are a few missing widgets which I would particularly like such as a date picker, but these aren’t too hard to plugin from elsewhere. Also there is a robust roadmap for the framework so I expect things like this to be developed soon.

The CMS I built was based on CakePHP which has a number of in-built helpers which make it quick and simple to build forms. Integrating Twitter Bootstrap with CakePHP wasn’t that hard a task but it doesn’t work out of the box. The markup patterns for the helper and bootstrap weren’t compatible. Fortunately the helpers on CakePHP can be highly customised, its not easy but also not a big task.

I aim to release a plugin helper which will make this a lot easier. It will replace the FormHelper and provides some extra methods to output of UI elements. I’ve been very busy recently so haven’t had chance to write it yet, but look out for it soon on github.

Rugby World Cup Post Mortem

So the rugby world cup is over, well for England anyway, for the teams which have embraced the future it continues and good luck to them all. For England the glory days are well and truly behind them 2000-2003. It was always going to be hard to live up to the world class team of 2003, but we’ve been in the doldrums for a while now, and its simply because the game has moved on.

England have nearly always played knock out rugby well, 2007 being the prime example. Grind out results, hey it might not be pretty but it works. Unfortunately it no longer works over 7 games and things need to change drastically or England face many years of toil, disappointment, the occasional high followed by many lows.

Could the quarter final knockout actual be good for England. The answer is yes if they learn from it. I’m no coach, just a long time fan of the game, but I’d like to analyse 5 things which I think needs to be looked at. Take them with a pinch of salt of course, and feel free to disagree, this is my list and I’m not even qualified to comment, its more of a rant than anything else.

Another point to make is that I’m not going to touch on the media circus surrounding the team. Off pitch calamities have been overblown and help no one but the media outlets sell more papers. Yes the team could be more professional and make sacrifices for a 6 week tournament but that isn’t the heart of the issue.

Basic Skills

Much like a footballer who’s paid to kick a leather ball around a field the basics of the game are not that hard. In my eyes every single professional footballer should be able to dribble, shoot with both feet and head the ball, the degree of proficiency with each skill depends on your position but you should be able to do them, after all thats what you are paid handsomely to do.

In rugby the basics are throw the ball, catch the ball and tackle. Much like football your position demands different levels of proficiency in each skill but you should be able to do each of them from 1-15.

So why does the England team knock on so much, and miss so many tackles? Maybe its cause I am so focussed on the England team but it seems to me that we make far too many passes above the receivers head, drop a high percentage of pop passes and miss a lot of tackles, especially when chasing a high ball.

Come on these are the basics, if we can’t get these right how on earth are we supposed to move on to the intermediate skills? The reason the southern hemisphere teams are so much better than us is because they get the basics right. They know that if they pop a pass out of a tackle there will a) be a man on the shoulder to receive the pass, and b) that player will catch the pass.

Its all well and good having a great forward pack, but if every time a chance is created or a break is made, you know the good stuff a player does, if it breaks down because a player can’t catch a ball well thats just pathetic really.

Discipline

The game of rugby has a lot of rules, some of them are strict and are easy to enforce, like no punching or gouging etc. If you do it on the pitch either the ref will see it and punish you or you’ll get cited after the game. That’s the way of it and its the same for every game.

Other rules are a little looser and can go either way, and some of the best players in the world know how to bend the rules to their advantage. And sometimes you have to break the rules to prevent points being scored. Its always been the way and I’ve got no issue with that. You are never going to have a game where no penalties are awarded.

The ref is there to enforce the rules and some refs enforce them better than others (more on that later) but more often than not a ref is going to tell you as a player if you need to leave a ball on the ground alone or if you are in danger of giving a penalty away. If it isn’t one of those times when its give the penalty away or its points, and high points at that, desist in what you are doing. Simple as that. If you are near the half way line and isolated, and risk being turned over, let it happen. Rely on your team mates to win it back, thats what they are there for. Conceding possession, followed be territory and/or points is senseless, and infuriating to watch.

Instinct may stop a player from doing this. Well that isn’t good enough coaches need to coach this instinct out of the players, and players need to work to do it. What there needs to be is a punishment system for persistent offenders. Its no good being the best scrummager in the world if you cost a team 9-12 points a game, and label your team as persistent offenders.

New Talent

You can’t buy experience apparently well that doesn’t seem to ring true very much anymore. Experience at the expense of talent is wrong. Just because a player has played 50-80 times for your country it shouldn’t automatically guarantee you a place. The reason is that a player may have got that experience by simply being the best of a bad bunch, or a mediocre bunch at best.

I’m looking at players like Nick Easter, Louis Deacon, Mark Cueto and Mike Tindall. All good players and experienced ones at that but they have never been world class players and the experience they bring does not make up for this fact.

Our best player by far this tournament was Manu Tuilagi, young, inexperienced and therefore doesn’t know how to grind out a result. Well bollocks to that, he was cleaning up after Tindall all tournament and the only player to consistently break the line. Look at the welsh team, the team isn’t made up of experienced players for the sake of it. Hell Stephen Jones wasn’t even on the bench in the Quarters, and they didn’t even take Martyn Williams!

Its time to ditch this experience, take a plunge and build a new team. If that means we have a couple of years of being in the bottom 3 in the nations, so be it. Its better than persisting with players who are never going to be good enough. And I never thought I’d say this but that may mean ditching Jonny Wilkinson, however for me, and this is quite a personal preference I don’t think Flood is a replacement.

Injuries

Some players never have any luck, if we look back to football there are always some players who always seem to be injured. Kieron Dyer a prime example. So is the case with rugby. Some players seem to be perpetually injured.

Two players spring to mind here, Andrew Sheridan and captain Lewis Moody. On his day Andrew Sheridan is a fearsome player, strong as an Ox and a powerful scrummager. Unfortunately his days are few and far between as he’s always getting injured.

Injuries are part of the game and its gotten a lot worse in the last few years as players have gotten bigger and more mobile due to the changing game and its professionalism. Problem is players who are prone to injury are a liability.

Should a place in a squad go to a player who might last a game just cause he’s quite good. Or is his likely injury going to end up being more disruptive to the squad as a whole?

And your captain’s name is first on the team sheet, a guaranteed spot. Is certainly shouldn’t be the likely case of if he’s not injured, and he shouldn’t be coming off every game after 60 minutes. If you’re prone to injury you probably are not worth the gamble, sad as that may be.

Referees/Laws

My final point is probably going to be a bit contentious as I have always considered the refs in rugby to be sacred and not to be argued with. But for a while now refs have been ruining the experience of watching the game.

The best refs for me have two qualities, they let games flow and deal with incidents as and when they need to, and they treat both teams the same. Sometimes these can be at odds with one another as if the ref is going to be strict and punish both teams then the game doesn’t flow but I’d rather have that than a ref who calls one team up on everything and lets the odd thing slip for the other team.

I would never go as far as to say refs are intentionally biased as I really don’t believe they are but I would say refs can be influenced by the state of a game and give decisions based on what has gone before.

The people running the game need to take a look at some of the rules and see where it is ruining the experience of watching. Things like the scrum where it seems either side is as likely to give a penalty away no matter what is happening.

Captains/players are talking to the ref more and more, which doesn’t seem right. But when the ref is having to explain his decision as the players don’t know what they’ve done wrong, well that isn’t right either and I’ve seen quite a few instances of that.

It may just be sour grapes but I shouldn’t be talking about the refs performance at the end of a game. I’d much rather talk about how good/poor a side have been in the game itself. Unfortunately this isn’t the case very much, and that just feels wrong.

For what its worth I thought the ref had a good game in the one which England lost, he was fair and consistent and thats how it should be.

So there we go the end of my rant. Thats what is wrong in my eyes, fixing things will be down to the England Team and Management whoever that may be post world cup. For now I’d like to wish Wales all the best for the World Cup. You were my dark horses at the start of the tournament and are playing the game which deserves to win. Whether you have enough to beat NZ is still to be seen, but I’ll be cheering you on hopefully all the way!

Bringing the Magic of Star Wars to the Next Generation

A bit more of a light-hearted blog post here. Prompted by seeing this video on the kottke blog got me to thinking randomly about the Star Wars saga today. I was born in the same year as Star Wars came out, its pretty much always been a part of my life and I have seen all six movies quite a few times!

The release order of the films was always a wonder to me as a kid, and when they announced the first three films were being made I literally had a geekgasm. Ultimately the first three films, whilst visually stunning, never really lived up to expectation. They never really had a chance, I was no longer 6 years old, my tastes and expectations had moved on considerably. My opinion now is that the first three films were aimed much like the first movies at the children and not me as an adult. You could say they weren’t as good and probably aren’t, after all the original movies are widely recognised as three of the best movies ever made which is a lot to live up to.

Anyway I’ve moved on and now I have a kid and think its my duty to introduce him to the saga as well. But now I see a bit of a dilemma, what order do I present them in? My initial reaction is the same order they were released, the same order I saw them in. But is this right? Given that the three newer movies would likely be enjoyed by him more than me and seeing the saga in chronological order should make more sense?

Seeing the kids reaction in the video above presents a strong argument to see them in non-chronological order, after all if he’d seen the third movie he’d already know Darth Vader was Luke’s father. George Lucas you have effectively ruined this surprise and many others by revealing stuff that was yet to happen in later movies – you utter bastard.

Would Star Wars have the same magic for Adam as it did for me if he saw the weaker films first? In fact would it have the same magic for him full stop, given that movies have arguably better special effects now than the original movie (although it still holds it own), would it still have the wow factor?

So what to do? I’m still undecided and don’t have to make a decision for a couple of years at least. One thing I’m sure of is there will be more difficult decisions than this to make over the coming years! In the meantime, that reaction above… priceless!

Using S3 with CakePHP

Despite the fact I’ve used amazon S3 on and off for the past 3-4 years I’ve never had to integrate the service into anything and on having to do so for a project I’m currently involved in I’ve come across a bit of a misunderstanding of how it works.

I’ve always assumed it was basically access to a file system on a bunch of server space. There was some clever mapping in the background to push the files/directories around but nothing more than that. Turns out my understanding was wrong. I’m sure the files are still pushed around or mapped to huge SANs in a very clever way but amazon S3 does not have the concept of physical directories.

Amazon S3 is simply a map of keys to files at its most basic level. The keys can contain URI mappings but the actual concept of a directory is incorrect. This misunderstanding stems from using third party tools to access S3. It always seemed like you could created a directory in a bucket, but in most of these tools what you are actually doing is creating a specially named file to represent a directory.

This misunderstanding only became apparent when I was using a simple plugin to my system which interfaced with S3. The plugin uploaded physical files, but what I wanted to do was upload directories for the files first. Something which this library didn’t do.

As always there has to be a better way and in fact there most certainly was. I ended up using the excellent PHP S3 class created by Donovan Schönknecht. Using it was a breeze and integrating it with my CakePHP app turned out to be very simple. Below is an example of pushing a file to S3. Its barebones and not a complete example, in the app I’m working on I have the whole thing integrated with RabbitMQ and the Media plugin through a shell but it should give you an idea of how easy this class is to use.

Download the S3 class and place it in your vendors folder, then in your controller assuming the file is already on the server.


public function pushToS3($file) {

  App::import('Vendor', 'S3');
  $s3 = new S3('access_key', 'secret_key');

  $upload_file = $s3->inputFile($file, false);
  $s3->putObject($upload_file, 'bucket', $file, S3::ACL_PUBLIC_READ);

}

Its as simple as that. The third argument to the putObject() function is where you specify the key to the file, if you want a URI with a directory like structure here is where you specify it.

Huge thanks must go to Donovan Schönknecht as his class takes absolutely all of the heavy lifting required out of interfacing with S3. There’s a whole bunch of operations which the class can do, so if you need to do stuff a bit more complex I would highly recommend using this class.