Book Review: The Passionate Programmer


I’ve been putting off writing this post, because I wasn’t sure I could do the book justice, but I read and really enjoyed “The Passionate Programmer” last summer, and I’ve been dipping into it again and again ever since. The book was actually a recommendation from Travis Swicegood, after he saw me give my talk Open Source Your Career. It seems like it’s not a well-known title so I thought I’d share my thoughts on the book and what I got from it.
Continue reading

Installing Gearman for PHP and Ubuntu

I’ve been using Gearman lately in a project that I’m working on, and of course a month later when I came to deploy the code, I had to look up all over again what was required for a gearman server in order to put it on the new platform. Here is the short version for my future reference (and yours, if you like)

Continue reading

Why I Love Unconferences

I’m seeing increasing numbers of unconferences popping up and I must say I’m quite enjoying them. Last year I went to OggCamp, we included an unconference at DPC, and now there’s a PHP-specific event coming up in Manchester: PHP Unconference Europe or phpuceu. I really like unconferences but I think sometimes people don’t know what to expect, so here’s an outline.

Continue reading

Using gnome-keybinding-properties

ubuntu netbook logoLast week I reinstalled my aspireone, which I’ve had for quite a while but which is really excellent for events. I put the latest Ubuntu Netbook Remix onto it and it installed like a dream, with peripherals and powersaving all working correctly. It says something about the positive experiences I’ve had with *buntu installs lately that I even did this over the wifi!

The weird thing was that I don’t really use Gnome on other machines as I prefer KDE, and I hadn’t seen the Unity desktop before (as I understand it, this is a lightweight gnome replacement – it still looks and smells like gnome to me), so there were a few things that were “missing” as far as I was concerned. Easily the most annoying is the Alt+F2 shortcut, I don’t really care what GUI I’m using, I mostly just run things from that! I also realised that I now had workspaces, but that there was no keyboard shortcut to switch between them (I don’t use a mouse, so it’s keyboard or nothing for me).

Enter a wonderful utility called gnome-keybinding-properties.
Continue reading

Using s3cmd To Manage Files on Amazon S3

Recently I moved some podcasts on to Amazon Simple Storage Service, or S3, which I know is great and easy to use, and I’ve used it with some wrappers, but never directly until now. It turns out, unsurprisingly, that S3 is great and easy to use :) I used s3cmd from s3tools – a collection of python scripts that made this really really easy. Even better, I’m an Ubuntu user so s3cmd is already packaged for me and I simply installed with:

sudo aptitude install s3cmd

Once installed, I found s3cmd --help was surprisingly helpful. To start with you need to set up an access key on AWS (Amazon Web Services) using your amazon user credentials, then supply this to s3cmd by using s3cmd --configure and following the prompts.

Continue reading

Quick-Start Guide for Google Charts API

Google Charts API is a nice, freely available tool for creating really good-looking graphs very painlessly. Don’t be fooled by the “API” bit though, there is no need for advanced understanding of HTTP here – you generate most graphs just by adding parameters to a URL! In this post we’ll take a look at a few different ways to generate charts.

One-Off Charts

If you just need a beautiful graph to put into a document or post, then the Chart Wizard is the best place to start. You simply choose the type of chart you want, input your data and choose the colours, labels, settings etc, and the wizard generates the URL for you to copy and paste!

The charts are highly configurable and can easily be changed by editing the URL to the image (view the source of this page to see the URL for the chart shown above). This makes it really easy to generate similar-but-different charts in your web applications, by using the wizard and then replacing some relevant parts of it.

Dynamic Charts

As mentioned above, it is very simple to generate charts with Google Charts API – and all the information for generating the chart is on a URL which returns a png file of the resulting chart. This makes it ideal for integrating into our dynamic web applications and charts that are generated are almost overwhelmingly configurable. That said, there are a few key options that will get you started quickly so let’s take a quick tour.

Continue reading

Navigating Bash History with Ctrl+R

I spend a lot of time at command line, and bash records the history of all the commands I’ve typed and puts it in .bash_history (there’s a limit on how many it stores but for me it goes back a few days). I find it really useful to look back at the history to use the same commands again or edit them slightly. You can press the up arrow to go through your history but it can take a really long time to find what you’re looking for. So instead, try Ctrl + r.

To do this: first press Ctrl + r, then start typing the command or any part of the command that you are looking for. You’ll see an autocomplete of a past command at your prompt. If you keep typing, you’ll get more specific options appear. You can also press Ctrl + r again as many times as you want to, this goes back in your history to the previous matching command each time.

Once you see a command you like, you can either run it by pressing return, or start editing it by pressing arrows or other movement keys. I find this a really useful trick for going back to a command I know I used recently, but which I can’t remember or don’t want to look up again. I hope this is a useful trick for you too!

Github API: Issues List

I’m deeply involved with an open source development project (joind.in, the event feedback site) and we recently made the decision to move our issue tracking away from GitHub (because it’s awful and meets none of the requirements for a bug tracker, but that’s a post for another day). In order to make this happen more smoothly, we wanted to migrate our open issues from github (to JIRA Studio, since Atlassian generously provides accounts here for worthy open source projects – thanks Atlassian!).

I looked around for some export functionality for github but I got a lot of posts complaining it wasn’t there. Since I hate applications that take your data and refuse to let you remove it, I was disappointed by this news but further inspection showed that although there might be no “export from github” button, there’s an API that more than has it covered. The API returns JSON which is easy to work with from many programming languages, and is perhaps even more powerful and flexible than the simple export I initially expected, so here are some examples.

Continue reading

Adding Multiple Axis Labels to a Google Chart

Recently I’ve been working on a project using Google Charts API and I absolutely love it. It makes pretty graphs and shows data really nicely – and it’s very painless. I did trip over a little trick today though which took me a little while to work out, so I thought I’d share it here: how to add two levels of label to an axis.

The axes in Google Charts are a bit interesting, because what they display bears absolutely no resemblance to what data is there – you label the axes separately, even if they are numbers. To label multiple things – in this example a scale and some units, you simply specify the axis more than once. To specify which axes should be shown, use chxt (CHart aXis Title) and set something like this:
&chxt=x,y,y

Then add the labels as required, for example:

http://chart.apis.google.com/chart?chxl=1:|Sun|Mon|Tue|Wed|Thu|Fri|Sat|2:||Week+37
&chxr=0,0,20&chxs=0,676767,11.5,0,lt,676767&chxt=y,x,x&chbh=a
&chs=360x240&cht=bvg&chco=CC0057CC,3D7930&chds=0,20
&chd=t1:10.059,12.578,13.6,11.135,11.018,7.104,6.92|50,60,100,40,20,40,30

This produces a graph like this:

You can then add labels (using chxl) and ranges (uses chxr) to your axes as you wish – and even add axis labels to the top and right hand graph edges, using the t and r axes, with as many of each as you’d like, and using their list position as a parameter to the range/label settings. I hope this is useful to someone, as it took me a little bit of research to figure it out.

Launching Links in Opera from Command Line

I’m an Opera user but I use a number of applications from the command line, and often I want to launch links from those applications into my web browser. I’ve just switched over to reading my feeds using canto (web applications are becoming decreasingly accessible these days, although I’m saving that rant for another day) which is a console-based application. This, like many other applications, allows you to specify a URL handler to use when you want to visit links.

To launch a link into a new tab in an existing Opera window, I simply used this:
opera --remote 'openURL(<url>, new-page)'

Where the <url> is the address to access; the same trick works in other programs too. For example I use irssi for IRC, with the openURL plugin, and this can do the same trick. To launch the link I simply set the http handler like this:
/set openurl_app_http opera --remote 'openURL($1, new-page)'

Since I have to look these settings up every time I want them, I thought I’d blog them for next time – and of course for anyone else who finds this useful between now and then!