Posts tagged Blogging

Week 120

I’m really quite pleased that there’s not a huge amount to report from the past couple of weeks. There’s been some work done, but not much as I actually managed to take some time off, read some books, and do that kind of thing. And there’s been some tinkering as evidenced by my previous post about Rails 3 and a couple of drafts (more on Rails 3, thoughts on Palm Pre/Web OS development) that will hopefully be ready for publication soon.

We’re still in the US—now in Nashville, TN—and are here till Friday so the pace this week will hopefully remain slow. There’s been some feedback from all the projects I wrapped up before the end of the year and it’ll mostly be about getting on top of that, making adjustments, and then figuring out what the rest of the month holds. Pre-Christmas there was lots in the pipeline, and now I need to figure out how to get them ready to go.

It’d be good to be on top of that as next Monday (the 11th) is the big office move day and who knows what disruptions that’ll bring.

Obsession Times Voice

I didn’t write much (outside of twitter) about SxSW 2009. In part that was because life rushed off in other directions immediately afterwards, and in part there wasn’t much that really inspired me to write. There were numerous good sessions at the conference, but far too many “social media consultants” talking without real experience and far too much focus on “monetising.” Many of us with a longer view of the web and/or more of a technical bent expressed considerable frustration with such sessions and the voting process that had allowed them to dominate the programme.

One session I wish I had made it to was Merlin Mann and John Gruber’s. For months now I’ve had Gruber’s subsequent write-up open in my newsreader awaiting a link from this blog. In it he deftly sums up what so many of the panels seemed to miss, that the starting point for a successful blogging (and, I’d say, most any) venture has to be passion (obsession), and a next step has to be craft. The rest may follow, but it needs those starting points:

What’s so great, so amazing, about this racket is that it doesn’t have to be that way. You can obsess over your work, build an audience based on deep mutual respect, and eventually opportunities to earn money from it will present themselves. I don’t know how it works, I only know that it does.

Handling custom file attachments in WordPress plugins

I’ve been working on a wordpress plugin to make it easy to set a banner image for any blog entry outside the post content. The current approach is flawed as it requires hacking at the form tag for the post edit page to allow file uploads, but while I look around for a better way to do that without sacrificing the simplicity of the UI, I wanted to share some digging I did to figure out how to handle file uploads with wordpress. All this data is available in the documentation, but it took quite a bit of looking to find it and there aren’t enough examples kicking around.

So without further ado…

When wordpress receives a file upload it hands it to the function wp_handle_upload. This takes two arguments:

/*
 * @param array $file Reference to a single element of $_FILES. Call the function once for each uploaded file.
 * @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
 */

and returns:

/*
 * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
 */

In practice that means a successful run will give you something like:

array (
  'file' => '/path/to/webroot/wp-content/uploads/myfile.png',
  'url' => 'http://my.host/wp-content/uploads/myfile.png',
  'type' => 'image/png',
)

It can be found in wp-admin/includes/file.php.

A simplified example of how I’m using it in my wordpress-post-banners plugin follows:

/* Define the callback that will be run when a post is saved */
add_action('save_post', 'post_banners_process_saved_post');
 
/**
 * Process any new file that has been uploaded for this post
 *
 * If a new file has been uploaded, we hand it to wordpress to process
 * and then store the details in a custom field.
 *
 * @param integer $post_id may be the actual ID, may be a revision ID
 * @return null
 */
function post_banners_process_saved_post($post_id) {
  /* If the file we want has been uploaded */
  if (isset($_FILES['post_banner_image'])) {
    $file = wp_handle_upload($_FILES['post_banner_image']);
 
    /* Check if it was an error */
    if (isset($file['error'])) {
      // handle error
    } else {
      // store the image details in a custom field
      global $wpdb;
      $wpdb->query($wpdb->prepare('REPLACE INTO ' . $wpdb->postmeta . ' (`post_id`, `meta_key`, `meta_value` ) VALUES (%s, %s, %s)', 
        $post_ID, 'post_banner_image', $file['url']));
    }
  }
}

I’ll post again once the plugin settles down, but in the meantime hopefully an extra example of how to use wp_handle_upload will help someone.

Demos/Google: How Has The Internet Changed British Democracy?

On Tuesday evening I found myself at a google/demos event, How Has The Internet Changed British Democracy?. Unlike most discussions about the net and democracy I’ve attended, the panel here was very ‘establishment’, consisting of Demos Director Catherine Fieschi , Spectator Editor Matthew D’Ancona, Stephan Shakespeare, the founder of online polling agency YouGov, and BBC Political Editor Nick Robinson. Tom Watson MP was detained in the House of Commons, or he would have joined the panel.

Given the establishment panel it was refreshing to hear a general concensus that while there have been lots of indications of change, the real potential of the net has not yet been realised in British politics. Catherine Fieschi concluded her introductory statements noting that she doesn’t think the internet has changed democracy “yet in our societies, but I think it’s gone some of that way in others.”

A recurring theme, first clearly voiced by Spectator Editor was that we should be looking for a genuinely new form of politics for the internet age, and not simply how the net “facilitates and speeds up” the old forms. There was a general consensus that Gordon Brown’s recently announced “new politics” has (in the words of Catherine Fieschi) “a distinctly 20th century feel” but while many ideas were thrown around, what was naturally lacking was any description of what a 21st century version might look like.

Nick Robinson discussed in some detail how he came to start blogging, first in the form of an “election diary” some years back, and more recently again on the BBC News site. He pointed out that as TV reporter he didn’t get much feedback and that by providing a feedback mechanism the blog had helped his reporting. In particular he pointed to the resignation of former Liberal Democrat leader Charles Kennedy, when there was a sense among some members of the public that reporters had know of Kennedy’s drinking problem and were covering it up. Robinson claimed that he had been unaware of that sense, and that the blog made him aware of it and so able to address it directly.

Robinson was particularly concerned that in an age of on-demand television and increasing narrow-casting it is all too easy for viewers to “opt out” of the political news he believes is vitally important. He sees blogging and other new media as a way to engage a new audience. His eagerness to engage is impressive but I found myself wondering if a better way to handle a situation where people are only watching a narrow selection of news is to try to make sure that reporters work harder to convey the contexts of (and hence the interweaving between) their stories. He hinted towards this in suggestions that he wanted the BBC to make better use of amazon-style recommendation systems for news but I think it bears further development to help people dig deeper into the contexts their interests exist within.

Tom Steinberg of mySociety challenged the panel to discuss a “non-media” aspect of the political process they could see changing in the coming years as a result of the internet and while they shared a focus on the somewhat obvious element of direct accountability (as demonstrated to some extent by mySociety’s projects) the key interest seemed to be in the position for co-creation in the consultative and drafting process. We have tools to gather opinion and to collectively edit documents, can that be harnessed to change the way the government writes Green Papers?

Perhaps the strongest sense I took away was that government needs to wake up to the possibility and need for stronger feedback loops. At the mySociety Disruptive Technologies session earlier in the month Stef Magdalinksi led a discussion that spent quite some time on the need for campaign facilitators to provide feedback loops so that campaigners can see the impact of their actions and all involved can refine their work.

The same possibility exists for government who could be proactive in their responses to petitions especially, as Nick Robinson pointed out, those gathered through the Downing Street Petitions system. Government can use these systems to identify people with specific interests and to supply them with information, whether persuasive or simply educational, to deepen that conversation. Similarly people can be identified to receive alerts about consultations, to be invited to discussions, and so on. It may be possible for expertise and interest at the grassroots to more effectively bubble up into policy making.

It would be naive to think that major change that will happen quickly or withour pressure, but the possibilities are enormous and this session showed that there are people close to the policy making process who are thinking seriously about the possibilities.

The Death of Trackback?

Yesterday, Tom Coates posted a piece entitled “Trackback is dead. Are Comments dead too?” His argument is that trackback spam has put an end to an interesting attempt to knit together posts between different blogs, that we should allow time for mourning, but we should also begin looking for alternatives. The Six Apart Pronet list has carried a number of posts from people agreeing with his analysis.

Trackback never really took off outside of techie circles. The lack of support for it in blogger and the lack of education of new bloggers as to its advantages ensured that. For those of us who are interested in the technical aspects of blogging, and in the potential it offers to change the way we have conversations, it was a great starting point, but it never hit the primetime.

I wonder whether the lack of visual integration based on trackbacks may also have held it back. Reading comments on blogs is a linear process that requires little mental adjustment, but since trackback content rarely extends beyond excerpts, truly following a conversation requires a deep adoption of hypertext reading skills that may not have yet reached critical mass.

The enthusiasm with which people greet technorati’s cosmos when they see it, and the number of bloggers who don’t use trackbacks but who display a technorati profile on their site may be evidence that simpler tools encourage participation, but that could equally just be the ego-stroking possibilities that blog rankings allow. Some people have suggested making use of tags to follow conversations, but I fear that the imprecision would not make for a smooth flow, and the namespace could quickly become very cluttered.

On the technical side, with the Atom Syndication Format approaching stability I wonder whether this may be a good time to consider the possibilities the use of Atom as both Syndication Format and Publishing Protocol offer for a trackback replacement. A couple of years ago, Tim Appnel posted some thoughts on the next generation of trackback and a number of them could be combined with an extended Atom API.

A new form trackback could consist of an atom entry, posted to a given URI, with the recipient following the conventions of the Atom Protocol (and HTTP) to respond. The receiving interface, having access to the full entry, could apply logic to the entry to ensure it wasn’t spam.

The receiving URI could then build up a representation of the conversation as a feed, perhaps with extenstions to represent the flow of the conversation, and tools could display that linearly, threaded, or however seemed most appropriate. Smart clients could spider out from that representation to see if there were other elements that had been missed, aided by the universal uniqueness of entry IDs.

Offering clear ‘conversation views’ it may be easier to evangelise on behalf of this new tool, and by building on top of an existing API the overheads for tool support would be reduced.

What is most clearly missing from this approach is a way to reduce the spam load. More data allows for more sophisticated filtering, but as noted above it increases processing overheads. It may be that the WSSE authentication used within Atom could be used, along with a key included in the entry being commented on, to require the client sending the ‘trackback’ to identify itself, but I suspect this one is going to require further thought.