You could be seeing a great picture here
_

Charles on… anything that comes along

Tuesday 14 November 2006

Filed under: — Charles @ 12:24 am

The programmer as journalist (and vice-versa): hey, that’s a cool future

Just been reading The programmer as journalist, which is a fascinating piece at the Online Journalism Review interviewing Adrian Holovaty (who has a blog), who does work for the Washington Post, basically doing the cool things that appear online.

I so agree with so many of his points..

OJR: What is the value to a journalist in understanding programming, or even learning how to do it?

Holovaty: The main value in understanding programming is the advantage of knowing what’s possible, in terms of both data analysis and data presentation. It helps one think of journalism beyond the plain (and kind of boring) format of the news story.

Programming comes in handy in all sorts of other areas, too, including gathering information. Now that quite a few governments and organizations are publishing data on their own websites, it’s a valuable skill to be able to automate the retrieval of that data and compile it into a format that makes it easy to research and aggregate.

There’s much more. And I think he’s right: there is so much that we could make use of online, or even just in our work. I couldn’t function without automation. I script the downloading of stories from the Technology Guardian website so I can post their URLs on the blog; I script the pulling of those URLs out of a database so I can query Technorati and the totally awful Google Blogsearch (anyone suggest a better blog search engine? Icerocket?) to see who’s been blogging what about our work. (Some people are almost offended that we’ve spotted what they’ve said. How weird is that? You put something up in an environment where linking is everything, and then are surprised when your link is found and followed.)

So anyway, putting it into practise seemed a good idea. I thought I’d implement something I’ve been meaning to do for ages - a cron script to record book sales rankings gained via the Amazon API and show them on a graph. Easy, eh? Well, yes if you just curl the page and extract the sales ranking (it’s simple). Weirdly, much harder if you use the Amazon API, and very much harder if you want to draw a graph not using Excel.

The Amazon API isn’t trivial (isn’t hard either). But the graph! OK, I found an article explaining how on Newsforge: Exploiting Amazon Web Services via PHP and SQLite.

To do the graph, you need the Pear package Image::Graph. Okayyy, I’ve avoided Pear, so tried just downloading the package. But wait! OSX has Pear (a package handler for PHP) already installed! Hurrah! So you try to install Image::Graph. Simple: in Terminal, type

pear install [path to your downloaded Image::Graph .tgz file]

Uh-uh: Warning: touch(): Unable to create file /usr/lib/php/.lock because Permission denied in Registry.php on line 284

Uh? Turns out (to save you the time) that you need to use sudo, because all the PHP stuff belongs to root, and you ordinary admins can’t get at it.

OK. sudo pear install Image::Graph.
It answers: requires package `Image_Canvas' >= 0.3.0
Image_Graph: Dependencies failed

So, no install. Oh hell. To the Image:Canvas download. sudo pear install Image::Canvas

It answers: 'gd' PHP extension is not installed
requires package `Image_Color’ >= 1.0.0
Image_Canvas: Dependencies failed

Sod it. slightly annoyed OK. (downloads Image_Color) sudo pear install Image_Color

It responds: 'gd' PHP extension is not installed
Image_Color: Dependencies failed

Finally I find gd, and download it, and install it. And now I have to go all the way back up the tree.

Oh, no, wait: 'gd' PHP extension is not installed
Image_Color: Dependencies failed

Sod it. At this rate it would be quicker just to open the page every so often and put it in an Excel worksheet. Programmer as journalist? It’s the future. And sometimes, my arse.

5 Responses to “The programmer as journalist (and vice-versa): hey, that’s a cool future”

  1. pauldwaite Says:

    I feel your pain. Weird, I thought the GD image library came with PHP on OS X.

    You *might* try installing Marc Liyanage’s PHP for OS X. You might have done that already, I’m not sure.

    http://www.entropy.ch/software/macosx/php/

    I guess understanding programming (i.e. having that intelligence about what might take a couple of days, what might take a couple of months, and what’ll take years of computer science research) is more important than being able to do it. If you have the understanding, it’ll be easier to pay people like Adrian Holovaty to do it :) And your attempt has at least taught you that this one might take a day, as opposed to a couple of hours :)

  2. Martin Stabe » links for 2006-11-15 Says:

    […] Charles on… anything that comes along: The programmer as journalist (and vice-versa): hey, that’s a cool future The Guardian’s Charles Arthur likes Adrian Holovaty’s notion of the programmer-journalist. But then he tried it for himself… (tags: journalism onlinejournalism) […]

  3. Chad Miko Says:

    Try running a simple PHP script in your browser (, then scroll down the page looking for a section on ‘GD’. Is it enabled?

  4. Charles Says:

    I’ve done phpinfo() on my local Apache. There’s no mention of GD, so I conclude that Apple doesn’t turn it on. (Why not?)

    What I find perplexing is how to change the php config (in php.ini) without raising my privs for the whole usr/lib directory. I’ve edited php.ini -> php.ini.new, now with GD enabled. So I want to rename the old php.ini -> php.ini.old, but can’t seem to do that in the Terminal via sudo. (Am I just missing the right Unix naming command?)

    Then I also face the question, so far unanswered, of how to restart PHP. Any clues?

  5. Press Gazette Blogs - Fleet Street 2.0 » links for 2006-11-15 Says:

    […] Charles on… anything that comes along: The programmer as journalist (and vice-versa): hey, that’s a cool future The Guardian’s Charles Arthur likes Adrian Holovaty’s notion of the programmer-journalist. But then he tried it for himself… (tags: journalism onlinejournalism) […]

Leave a Reply

Powered by WordPress