Managing Google App Engine SDK versions on OSX with virtualenv

When I first started developing Django apps on Google App Engine (GAE), I downloaded the google app engine launcher. Installing this will install the latest version of the SDK, and will (if you let it) update your path to point to it. This is fine if you are always using the latest version and don’t need to use an older version for some reason. If that is the case you will need to uninstall GAE launcher, find an old installer for the version you want and reinstall.

A more manageable way is to not use the GAE launcher, but to download the SDK manually, then set up a virtualenv to use a particular SDK. I also use virtualenvwrapper to help me switch easily between environments.

This is the pertinent bit – in the folder where your virtual envs are stored, add the path to the app engine sdk in bin/postactivate. Postactivate gets run when you activate the virualenv through virtualenvwrapper. E.g for something using version 1.8.8 you might have something like:-

# This hook is run after this virtualenv is activated.
export PATH=/Users/rickhurst/gae-sdk/1.8.8/google_appengine:$PATH

Catching up – Summer 2013

Rocky the T25 being towed

Ok after a productive start to the blog this year, i’ve failed to post since the start of the summer. I’m going to blame it mostly on my camper van, both literally spending time working on it and camping in it with my family, and also generally all my blogging effort has gone into my “camper van things” blog. I’ve had a fantastic summer, worked less than I probably should have, but now getting back to work (and saving up for some more summer adventures next year!).

So to catch up – i’m now freelancing more or less full-time back at Potato, working on some interesting stuff, notably cutting my teeth with AngularJs framework, which i’ve enjoyed so far. My initial observations are that it is significantly different to Backbone/Marionette that there is no confusion over what technology i’m using, it allows you to be productive very quickly and that it litters your markup with non-standard attributes. The latter may upset purists, but otherwise it gets the thumbs up from me. If you’re interested in learning AngularJs, a good place to start would be the tutorial.

Posted in Uncategorised

Braindump May 2013

Not for the first time i’ve found myself stepping back from Twitter most of this month, and when I got drawn in, I got very frustrated with scatter-gun discussions – found myself trying to explain stuff I just can’t get over in a few characters, resulting in multiple replies especially when there are several people in the discussion, so even less room for content. As someone once said – having a discussion on twitter is like trying to have a conversation through a car window as you repeatedly fly past them.

One such discussion was about recommended Content Management Systems (CMS) – I was trying to explain what my holy grail would be – a dynamic CMS (as opposed to a static site generator such as Jekll), which allows editing of content as text or markdown files or via the web, where content can be synced and versioned using GIT, but also has a “throwaway” database for search e.g. it indexes content in the background but no need to keep restoring it when content is added to live but not dev/ vice versa. I struggled to get that out in a reasonable paragraph and i’m not really started yet!

Another area to deal with is comments – comments should really be counted as valuable content on a blog, so this content should also be stored as static files under version control (to allow it to be synced with other copies of the site, rather than the comments themselves needing versioning). The problem is that 90% of any comment system is anti-spam measures and moderation. Having spam comments committed to my GIT repository is downright dirty!

In other news, I’ve finished my current stint as a JavaScript contractor, and am going to be working full-time for the next month or so on the next phase of my company Olivewood Technology, which will be evolving this year.

Posted in Uncategorised

Braindump April 2013

One of the oldest production web applications i’ve ever built is still happily running mission-critical operations for a small distribution company. I’ll be the first to admit that it is a bit of a mess of different “eras” of code – some of it is even still running classic ASP, which is being slowly (i.e. over a period of years) but surely replaced with PHP5 code. One thing i’m sure about though is that to rebuild the system entirely using something like Django would take months, if not years. So it is is destined to stay as PHP, and therefore as long as it is running and i’m involved with it, i’ll still be writing PHP. I’m fine with this, PHP runs half the internet, was written specifically for the internet, is easily learned and is improving as a language all the time. PHP is a fully Object Orientated language these days, but judging from a recent thread on the underscore mailing list, the perception of PHP remains as warped as ever in the eyes of “proper” programmers!

I’ve managed to sort a couple of things this year that have been missing from my life – firstly, i’ve been doing a bit of mobile working from my camper van office, and secondly i’ve joined a band, after a hiatus of ten years! My last band (Braxton Hicks) was a 9-piece Acid Jazz/ Funk/ Soul band, this new band (name still undecided) is a 3-piece surf-rock trio. We’re still getting a set together, but will be looking for gigs soon!

Bristol surf rock trio the savages

Posted in Uncategorised

Braindump March 2013

There seems to be a trend for free services shutting down recently – following the recent-ish announcements that Posterous (a kind of blog service with strong emphasis on posting by email) is closing down, and this month Google announced they are closing Reader. It’s not surprising that a free service would shut down – they cost money to run, and as businesses start to look at ways of cutting costs, it makes sense to sacrifice free services.

I was surprised about Google Reader though – apparently the user base isn’t as big as I presumed it was, and they decided it was too niche to bother with. I’m also surprised they didn’t just roll it into google plus – surely little effort to gain thousands of much needed G+ users? Meanwhile i’ve moved over to feedly.

Currently most of my stuff is self-hosted, with the exception of comments hosted by Disqus. I really don’t want the hassle of running my own comment system, due to spam, but i’m starting to think about moving to a self-hosted system, maybe something like a self-hosted version of Disqus, that I can easily drop into different blogs? Whatever I use, it needs to have all the usual anti-spam stuff – comment spam is the bane of any aspiring blog software developers life!

I also paid up for a years membership to – same as twitter, I am @rickhurst. It hasn’t become part of my daily social/workflow yet, as not enough of my regular twitter contacts are using it, but I wanted to put my money where my mouth is when I say i’d rather pay for a service than rely on annoying advertising.

I gave a talk on Backbone Marionette at the Southville JS meetup. It was a practical code based demo, I think it went OK. Either way it was a good turnout and nice to have it hosted in a pub back room, so we could continue chatting at the bar afterwards. The code of the (fairly pointless) demo app I put together in blue peter style is online here.

I also gave an ignite talk on remote working at the Anywhere Working Bristol event. That seemed to go down well and it was nice talking about non code-related stuff for once!

I was also pleased when a colleague pointed me to Poweramp for Android – I had been complaining about how most Android music players don’t support gapless playback, which is a real party-pooper when it comes to mix albums such as my favourite mix album of all time Journeys by dj 70 minutes of madness.

I’ve now finished a full-time freelance Javascript contract at ISM Fantasy Games, but will be continuing with them on a 3 day week basis, freeing up some time for my new business venture(s). More about that when the plans are more refined!

Posted in Uncategorised

Brain dump February 2013

I spent a lot of my spare time working on my camper van blog this month, which has now been relaunched as As well as covering my own experiences with mobile working and my VW T25 camper, it is now also a general blog about camper van things (hence the new name!). I’m also tweeting separately about camper van things from @campervanthings. The campervan things blog is mainly just for fun as it’s a personal passion of mine, but i’ve been brainstorming ideas of how I could create a sideline for my business with it – set up a shop? advertising? buying another camper to hire out? – who knows!

One particular improvement to the blog is that I have removed the old lightbox plugin and replaced it with Photoswipe, a responsive image gallery/ lightbox, which make the site much more user-friendly when used on a smartphone or tablet. (Screen grab below – click through to the blog post and click on a thumbnail to try it out)

screengrab of photoswipe being used on

At my current contract gig i’ve been spending a lot of time testing JavaScript with Jasmine and Grunt. I’ve also been getting to know chrome developer tools much better – the most useful discovery being breakpoints in Javascript (thanks to a colleague at ISM who was bemused by the massive amount of console.log statements I was littering the codebase with).

chrome developer tools breakpoint

I’ve got my eye on packery for too old to skate – it currently uses Masonry, but with different length blog posts it often leaves unwanted gaps, so i’m hoping that this along with maybe some smaller blocks I can fill out the page retaining the angled content.

I am now plugged back into the matrix thanks to a contract-free Google Nexus 4. It’s a great device – I was actually on the verge of buying a contract-free iPhone 4S, but the Nexus came back into stock, and is a much higher spec device with bigger screen, for much less money. I’ve found it has helped massively with blogging as the on-screen keyboard is big enough to type fairly quickly in those “down-time” moments. I had to resort to trimming my sim card to microsim size, using a template.

trimming a sim card down to microsim size

Combining and minifying assets on a PHP site with PHP minify

loading seperate css and js assets

I’ve been getting carried away with my Camper Van blog over the last couple of weeks, overcompensating for my lack of actual design skills by adding loads of fancy effects such as Supersized full-screen background images, and Photoswipe for responsive photogallery/lightbox.

Looking at the network tab in chrome developer tools I was reminded how many http requests are needed to serve all the seperate css and javascript files, and that I needed to optimise it a bit. There’s loads of different ways to combine and minify CSS and JavaScript assets – for example using something like Live reload on the desktop during development, or using a server-side on-the-fly system, e.g. Django Compressor on a Django site. In either case this is usually in conjunction with a CSS pre-processor such as SASS

As “on the road” is a PHP site, and I haven’t got round to setting up SASS stuff for it, I decided to use PHP minify, which lets you specify groups of assets to be combined and minified, then serves them up on the fly, using caching (filesystem or memcache) to keep it snappy. The set-up is fairly straightforward, the only thing that might trip up a novice is setting up the caching.

optimised assets loading

As a result (after a bit of refactoring to get things working after moving the js from the head to just before the closing body tag), I now have the site loading in a single js and a single css file, considerably improving the load time, and neatening up the source code. Note that these two screen grabs were taken on different internet connections so the actual load time of the assets shown isn’t a good comparison.

Brain dump January 2013

I haven’t posted to this blog much recently, so I thought i’d set myself a new routine of blogging at least at the end of each month to record some thoughts and links.

Firstly, as of Jan 1st i’ve been Freelance again – towards the end of last year while working full time at Potato, I got a bad case of freelancers itch, and felt that I wanted to make more time for working on other business ventures. When a three-month contract as a mobile web application developer at ISM games came up, I jumped at it. This time round i’m going to try my hardest to not end up juggling client and contract work, and to make sure that I free up time to pursue other things, either between contracts or by landing part-time contract work down the line. The important thing is that i’ve thoroughly learnt from the mistakes I made during my last stint as a freelancer!

Technology-wise i’ve been really enjoying cutting my teeth in proper “single-page” web app development using JavaScript, Backbone.js, Marionette and jQuery mobile. As an advocate of Progressive Enhancement, it’s a bit of a departure for me to be building JavaScript-only apps, but with the application logic mostly on the client side, to make it function without JavaScript really would mean building the application twice. The only compromise approach that i’m aware of is this approach used by airbnb, where JavaScript is used both server and client side, so HTML can be pre-rendered using the same templates on both sides, and application logic can also be shared (to an extent). It is also becoming increasingly clear that JavaScript-only apps needn’t be inaccessible, with screen readers apparently supporting javascript. I haven’t tried any of these, so i’m sure there’s plenty to learn in that area.

I’m also now “getting” the whole mobile-first approach for building web apps, in part due to having to go back to my old Nokia N95 for a while when I had to give back my company Android phone when I left my day job. No, I didn’t use any web apps on the Nokia – it was just too painful to even try to get logged into gmail, but not having access to a smartphone, and not being able to use mobile-only apps such Instagram, reminded me that web apps are primarily being used on smartphones and tablets, and this trend will only increase. Getting these mobile web apps working well, and then adding in additional stuff (only where needed) for people using them on desktop is the right approach, rather than the whole “squash and hide” approach used in responsive websites to scale down from desktop to mobile.

Apart from that, i’m all about Python and Django still – The back end of the web app i’m building uses Django rest framework and I have some personal/ business projects in the pipeline using those.

Lastly, i’ve really been enjoying blogging on my on the road blog, particularly writing about non-web related stuff, such as VW T25 campervans 🙂