Learning to touch type properly

So, one of my goals for this year was to learn to touch type. I pretty much ignored this goal until last week, when I opened up my copy of Mavis Beacon Typing Tutor. Right now I can type with the correct fingering, without looking, but it is painfully slow – i’m still waiting for the magic moment where I don’t have to pre-calculate every key, and remember which finger to press it with! This is the first blog post I have ever written using the correct technique and it has taken ages, but am determined to stick with it until I am fluent, so expect lots of short blog posts with minimal punctuation until I have this thing nailed!

Tags: Uncategorised

Another flat-file driven blog/ cms engine on the block

I’ve just been looking at Statamic, which is a markdown-driven CMS and blog, self-hosted and written in PHP. It’s commercial rather than open-source, but at a reasonable price, like Perch. It looks reasonably mature and has support for add-ons and lots of cool stuff. I’ll probably buy a copy just to mess around with.

If I ever need to build another PHP CMS-driven site, i’ll certainly give this a go, as i’m still obsessed with the idea of having content as flat files under source control. I like the idea that you could set up a staging site using something like this, and the client/ project manager could be adding content, and you can periodically log into the server, commit the content to GIT and sync you local dev copy in both directions.

Also, with the end result still being a dynamic PHP site (unlike the static sites compiled by the likes of Jekyll), you can still develop dynamic features into the resulting site and integrate in other PHP modules, e.g. forums and shopping carts etc.

As for what this means for my own PHP text-file driven blog eatStatic, it re-confirms that I shouldn’t be putting any effort into building any CMS features in, and to concentrate only on maintaining as a blog engine for my own stuff, and only adding the features I need. I haven’t had a look at the blog functionality provided by Stamatic yet, but having built eatStatic to fit my own ideal travel blog workflow, it would probably need some work to make me happy!

I’ve also mentioned a Python port of eatStatic in the past, and would still like to do something in this area, but I can’t help but think i’d be better off concentrating on a module to plug into another blog engine / CMS, to avoid reinventing the wheel yet again. Before I do anything else I want to experiment with all the current static-site generators – to see if there is some way to build on this – e.g. a python app that takes content set up for a Jekyll site and syncs it with content in a mezzanine (or other Django-based CMS).

A quick google around for “python static site generator” has thrown up this: http://ringce.com/hyde

Sub-optimal web content workflow used by many agencies

I’ve worked at a fair few agencies in my time, and despite most agencies now using content management systems as standard, the content population and revision workflow is usually sub-optimal:-

  1. Designer inputs the content into a photoshop file
  2. PNG or PDF of the document is signed off by the client, or amends requested, which the designer deals with
  3. Developer copies the content into the CMS (they may need to create some custom content-types or templates to make this work)
  4. If the content needs to change – the designer is asked to change the photoshop document, and back to step 2
  5. At no point will the client touch the CMS, or entertain the idea of a few days training in basic HTML or markdown*

Yes, I think we can all see a flaw with this workflow – no need to point out how things could be done differently in the comments!

* I don’t care if your CMS has a really good WYSIWYG editor – it’s either too limited or too powerful, so an untrained editor at best will never really get the result that they want, at worst do some real damage!

Pushing a local git repo to a bare remote

Often I create a git repo locally, but then want to push it to a remotely hosted repo.

On the server, create a folder and move into it, then:-


git init --bare


Then in your local git repo:-


git remote add origin ssh://username@yourserver/path/to/repo.git
git push --all origin


(this assumes your remote repo is accessible via ssh)

Analysis of my social media usage

Over the last couple of years i’ve tried to rationalise the way I use various social media sites, and I realised that how I use a service has evolved over time.

Flickr

I think flickr was the first social network (of sorts) that I signed up to, in 2005. It was the instagram of it’s day, but with an important difference in that people uploaded whole galleries at a time. It made a real feature of the use of tags, so that you could follow an event, or add contacts and follow their streams. I even signed up for a pro account to allow me to create more galleries. I’d also use it as a blog/ diary – frequently posting pictures of the coffee or beer I was drinking (like I say – the instagram of it’s time). I kept twitter for personal/ creative use, rather than posting family pics, baby photos etc., but the fact that it had a permissions system meant that I could restrict content to people marked as friends if I wanted to. I’m not really using flickr now, and am shortly to let my pro membership expire – it doesn’t offer me enough as a paid service, it’s hardly changed over the last few years, it feels clunky to use. Also, alarmingly it also seems to be full of really good photographers, which doesn’t fit in with my desire to post grainy camera phone pics of my food, like I now do on instagram.

Facebook

I also dived into facebook in 2005 (I think), and pre-twitter, most of my friends were from the web industry, and I used it mostly like I do with twitter now, for joining in conversations mainly about building web things. As it became more mainstream, I started using it to keep in contact with old friends and current non-techie friends, and it became a strange mix. I was also getting friend requests from people i’d never met, and as facebook became more.. err… social, I started to trim my contacts down to only people I had met in real life. When twitter took off, many people had their twitter and facebook status updates synchronised, and this started to drive me mad, seeing the same things over and over, so one night I deleted pretty much all my web industry friends (all of them were on twitter anyway), stopped posting anything techie to my status updates and embraced it as a way of keeping up with non-techie/ web industry friends (old and current) and family.

Twitter

My twitter use hasn’t evolved that much – I post less pictures of my food and coffee than I once did (as i’ve already mentioned, I have instagram for that now), but due to it only having basic privacy settings, I tend not to post any family pictures, and am pretty guarded about posting anything personal. It’s mostly for technical discussion, but is also social, as of course some of my web industry friends have become good friends out of work (but still tend to talk shop down the pub). The thing I still really hate about twitter is that there is no native “mute” function (although it exists in some twitter clients), which means that I tend to unfollow people if they get a bit noisy tweeting from a conference or something, then by the time you go back to follow them again, they’ve been offended and decided to unfollow you back! I have to say facebook is much better for dealing with this kind of thing – you can anonymously mute people, and it’s much easier to group people and select who sees what. Twitter has lists, and i’ve tried grouping people into lists, so I can choose to only see tweets from certain groups of people, but it has no prominence as a feature in the native twitter UI, and people feel sidelined if they are only on a list and not on your main timeline.

Instagram

I was late to the party on this, only starting to actively use it in the last few months, but just like flickr back in 2005, I use it to explore my creative side (mediocre pictures of clouds, coffee and food), and as a kind of diary, to remind myself what I was up to, and where I had been. Instagram public profiles have just arrived, and this has made me feel unsure about how I want to use instagram. Even though initially my pictures were set to public, it still felt like a fairly private personal thing, that I just shared with a few friends and web industry aquaintances, so i’ve set it to private for the time being. I don’t really want or need to showcase my instagram pictures to the general public, but occasionally I will post them over to facebook or twitter. So not sure which way i’ll go on that – if I do choose to make it public, i’ll be less likely to post any family or personal stuff, and there’s only so many cloud pictures my instagram followers can take!

A few notes on image uploading and configuration in Django

I recently added image uploading to Too Old To Skate, and not having set up a “normal” django site for a while, hit about every stumbling block possible, so here are a few notes. Please bear in mind there may be other, better ways to achieve this – i’d love to hear them.

Adding an Image field

This is achieved simply by adding an ImageField to your model, e.g.:-


photo = models.ImageField(upload_to='image_uploads', blank=True)


Separate static and media directories

The static folder is where your local site assets go e.g. CSS and Javascript. Locally these are served up from /static/ by the django dev server, and on a live site this should be set up as aliases to serve by your web server (in my case Apache).

The media folder is where user-uploaded files go, in subdirectories specified in ‘upload_to’ in your image field in the model. The root is configured in settings.py, but unlike the static folder you will need to do some configuration to get the local dev server serving files up from this directory (and its sub-directories). The location of the media root needs to be different to static root, which threw me slightly, though I guess it makes sense to keep your own static assets and uploaded media entirely separate.

To get the local dev server serving up files from /media and its subdirectories, add this to urls.py:-


# you'll need to add this if you aren't already importing settings
from django.conf import settings

if settings.DEBUG:
urlpatterns += patterns('',
(r'^media/(?P.*)$', 'django.views.static.serve', {
'document_root': settings.MEDIA_ROOT}))


Permissions

Permissions need to be set on your media folder to allow uploaded files to be saved. This depends on your set-up, but for me adding write permissions for group allowed apache + wsgi + python (whichever one of those it appears as?) to save files and create directories.

PIL and libjpeg

As usual this caused me massive headaches to get running both locally and on my web server, and as usual I tried so many things i’m not 100% sure which steps actually made a difference in the end!

Learning by Teaching (a crash course in Backbone.js)

rick hurst southville js backbone talk

On Wednesday, the day after my lightning talk at the Django meetup, I gave a talk “An introduction to Backbone.js“, at a newly formed javascript meetup, loosely based around the locality of southville in Bristol. This was an interesting experience as other than using Backbone.js on one project (largely written by other people, so I only really dipped into it to add stuff), when I was volunteered to do the talk by Andy Mcgregor, I didn’t actually know a great deal about Backbone!

When it came to the crunch, i.e. pretty much the day before the talk, I started searching for online tutorials that might demonstrate what I wanted to cover in the talk, and the first one that I found was Hello Backbone.js by Artur Adib, which provides a fantastic step through with a set of examples building up on the previous example. I created a little “To Do” list app based roughly on these examples.

I then found an excellent set of video tutorials called Introduction to Backbone.js, by Joe Zim, which run through some interactive examples for Models, Views, Collections, Routers and Ajax within backbone, which really helped the penny drop for me, and gave me a basis for my own live-coding examples. The audience (of about 20 people – not bad for a highly localised, highly niche meetup!), were a mixture of people who already know backbone and people who have never used it, but hopefully there was something useful there for everyone. On a personal level, being put under pressure to be able to demonstrate something, accelerated my backbone knowledge very quickly, to the point that I would confidently start my next project using backbone.

The moral of the story is – if you want to learn a new skill quickly, you don’t need to pay to go to a workshop – volunteer to do a talk instead! Even if you don’t want to do a talk, find your friendly local user groups (or friendly online user groups, if there’s none local to you), and get involved. I’m not knocking paid workshops – there’s a place for those and i’m sure some of them are good value for money, but i’ve always loved the way that the web community are happy to share their knowledge for free, and you really can find the knowledge out there without spending your hard earned cash! Being part of the web community provides valuable support too when you get stuck, something that doesn’t happen in the world of “traditional” paid training.

The next southville js talk is “An introduction to CoffeeScript” by Tom Holder on wednesday 12th July, kindly hosted again by SimpleWeb. Also keep an eye on the Bristol Web Folk calendar for upcoming web related events in Bristol – there’s loads!

Photo above nabbed from an instagram pic by Chris Mytton

DBBUG lightning talks June 2012

Rick Hurst giving a talk on django snippets

On tuesday Potato Bristol hosted the Django Bristol and Bath User Group (DBBUG) lightning talks. It went really well and it was nice to have some technical content as well as the usual beer and chat. The turnout was great and so were the talks.

First up was Chris Hall – “Django from the outside in (and back again)” talking about his experience as a PHP/Drupal developer using Django on a project for the first time.

Second up was me, talking about my simple Django content management tool “Snippets” (shortly to be renamed as soon as I can think of something suitable, as googling around there are too many other similar projects under the same name). I was pleased by the response and interest in Snippets considering it is such a simple tool – mainly the result of an evenings experimentation. This gives me an incentive to develop it further, as it shows there is a demand for simple tools like these, especially if you just want to add a small amount of editable copy into a web app, but don’t want the overhead of a full CMS.

Ed Crewe then talked about “using eggs for managed release and deployment“.

Jamil Appa fron ZenoTech talked about “Using Django to front an application that makes
use of GPUs in the Cloud”.

Lastly Russ Ferriday from SponsorCraft, talked about the spray project.

Ed has kindly created a lanyrd page for the event.

Web developer tools of the trade

I’ve had to change machines a few times recently, and each time I wish I had a decent checklist of what I need to be able to do my job. I thought it might actually be an interesting blog post, detailing not just what I use, but why.

Machine: macbook air

I blogged about using a 13 inch macbook as my main machine for web development before, so I won’t repeat it here – the main point I want to make here is that I don’t want to be using more than one computer and it needs to be a laptop that runs some flavour of unix natively and will run the latest versions of Adobe Creative Suite reliably, and a mac laptop fits the bill. Why does it need to be a laptop? It was essential when I was a freelancer – I worked on site at clients offices and not many of them would supply a computer. My current employer provides hot-desks with monitor/mouse keyboard etc. for people to plug their laptops into.

OSes: OSX, Ubuntu and Windows

In the past i’ve experimented with Linux on cheaper non-mac laptops, but I always get caught out by needing a native version of photoshop running – using wine or VM’s to do this has proved slow and unreliable. If Adobe really wanted to put a dent in Apple’s revenues, they should release a linux version – I know many people who would drop OSX if they weren’t dependent on Adobe products.

Why not windows as my main OS? Mainly because it doesn’t run unix natively, but I also find windows a pain to maintain and keep stable and secure.

I keep Virtual Machines (VM) for when I need to develop or test stuff in windows – Windows 7, plus other versions for testing on different versions of internet explorer. I still look after some legacy classic ASP stuff, so for this I have microsoft webmatrix installed on the Windows 7 VM, which as a cut-down version of IIS for local development. I also use Heidi SQL as a GUI for MySql on windows, and Sublime Text (mentioned later) for code editing.

I also keep an ubuntu VM for LAMP development, mainly so I can keep it separated from the Python/ Django/ Appengine orientated dev environment I use in my day-job at Potato. It also makes it transportable and easy to back up.

Graphics Editor: Adobe Photoshop latest version-ish

I’m not a designer so shouldn’t necessarily need Photoshop, but I receive layered photoshop files from different designers and agencies, and I need to do stuff with them. When i’ve tried switching to other tools in the past, as some will open layered photoshop files, but i’ve been caught out by one missing feature or another, usually from the latest, or almost latest version of photoshop. So it looks like I will be a slave to Adobe until such a point where I stop being a front-end developer, or start working with designers who don’t use Adobe products (do they exist?). Otherwise i’d happily jump to something like pixelmator on OSX, or Gimp.

Code Editor: Sublime Text 2

I actually began writing this blog post months ago, but left it as a draft, and this section used to read Textmate! I used textmate for several years, but always had stability issues with it when I needed to edit something from a mounted folder or over sFTP. Sublime does the former quite well, and the latter is possible using macfusion. I haven’t really explored sublime at all, so i’m probably only using a tiny percentage of its features, but it seems to do everything textmate did (or rather everything I did with textmate). The thing that really won me over is that there are versions for OSX, linux and windows, and the licence is transferable. This means that in the rare times I have to use other operating systems, I can use the same editor, which is great.

Code editing over FTP:Coda

I also bought a copy of coda, which I found invaluable when I was a freelancer, as some of my freelance clients were pretty old-skool with their hosting and I needed to use FTP, often including the necessity to edit stuff (local settings/ config files etc) directly on the live server without SSH access. Coda is great for this, and is also a nice text editor that I tried to start using full-time, but it was missing the “autocomplete strings already in the page” feature (i.e. if you added really_long_variable_name to a page, it appears as a suggestion when you start typing it again) that Textmate and sublime do really well. Actually, I haven’t even installed it on this machine, not sure I will now..

Code editing in the terminal: Emacs

I usually install Emacs (No X version) on whatever server i’m accessing via ssh, for editing files on the server. I only know all the basic operations needed to be productive with it.

Server-Side web development: Python, Django and PHP

Wait, did I say Python *and* PHP in the same sentence? My chosen technology for building websites these days is the Django framework which runs on Python, but for years I also built stuff with PHP. Unlike most of the Python community, I don’t have a problem with PHP, and will continue to use it for some things – the big advantage of PHP is that it runs on most shared web hosts, whereas Python/Django needs more specialist hosting environments.

Why not Rails? Basically i’ve been trying not to stretch myself too thinly, as I have a habit of doing. I wouldn’t rule out learning Rails in the future, but there’s only so many hours in the day! I am however learning Node.js, as I see it as a logical progression of my existing JavaScript knowledge, and think server-side JavaScript will be big in the future.

Source Control: GIT (with SourceTree as a GUI)

I’ve blogged before about how i’ve moved over to GIT from SVN. I do this mostly from the command line, but I also have a copy of SourceTree, which I find really useful for preparing large commits and searching logs etc.

General FTP and sFTP: Filezilla

I have to stress here that I only ever use FTP for website deployment when forced to – I don’t run it on my own server, and deploy all my sites via GIT, in pretty much the same way I used to with SVN. Also Appengine has it’s own deployment process, and doesn’t support FTP or anything close to it!

So, with that clear, if I ever need to do some general FTPing for whatever reason (the last time was to bulk upload about 200 video files to a client’s wordpress site on shared hosting), I use the excellent FileZilla. Just like Sublime Text 2, there are handily versions for OSX, Windows and Linux.

AppEngine python SDK/ GoogleAppEngineLauncher

To develop Django apps on AppEngine (or more specifically Python AppEngine apps that use parts of Django), you install Google App Engine Launcher. We actually deploy apps via the command line rather than using the launcher GUI, but it’s all part of the same install.

Databases: MySQL and PostGres

For PHP and non-appengine Django stuff I mainly use MySQL. It does what I need it to, and i’m confident the performance and scalability are more than enough for most projects. I also use PostgreSQL for GeoDjango projects, using the PostGIS extension.

General Django dev: virtualenv and pip

For any local sites running Django I install a copy of Django and specific packages in a virtualenv. This means that I can have multiple different versions of Django installed with different dependencies in a sandbox. I also use virtualenv when deploying a Django site on my server, allowing me to have different standalone django versions on the server too. I install dependencies using PIP.

Email: Gmail web interface

I don’t use a desktop mail client anymore, preferring to use the gmail web interface, for both my personal gmail account and google apps for domains email accounts. This is for two main reasons: my gmail account is so massive that the mail app on OSX struggles with it – it ends up contstantly syncing and you are never quite sure if it is up to date, and also in the past I have ended up switching machines so frequently that it was just a pain trying to get everything set up. I actually get on fine with the Gmail web interface and would be lost without its search!

Front end debugging: Firebug and chrome developer tools

I still think firebug is the most important tool in a front-end web developers toolkit. Chrome developer tools does exactly the same thing, but my familiarity with firebug stops me moving over to chrome full-time, along with possible caching issues I once experienced with JavaScript generated DOM elements.