Monthly Archives: February 2009

Hail to the tribal chieftan

I’ve written more about this on my internal company weblog, but suffice it to say that I’ve blogged externally about my ongoing involvement with virtual worlds etc. and I’ve mentioned my minor Internet celebrity friend Mr Hughes on many occasions. I’m not going to go as far as to call him my Yoda, but he’s been a massive influence on me for the past few years.

Fare ye well.

Experiments with PHP and MQTT

Over the past few days I’ve been playing around with combining lightweight messaging and PHP. There are a couple of reasons for this, but the primary one is that I’d like to extend my prototype iPhone CurrentCost monitoring web application to display more up-to-date information about the state of my home energy usage. I’d planned to do this for a while, but recently Mark Taylor created his own version of the iPhone interface (PDF link) and he has got current readings on the front page. Clearly, I have to compete :-)

Actually, in my system, I’d like to do things a different way. The heart of my setup is a Really Small Message Broker. At the moment, data from the CurrentCost meter comes in over the USB connection and is then published in pieces, or on topics, to the RSMB (temperature and energy readings are separate). These published messages are then read by a script which is subscribing to the topics and squirrelling the historical data into an rrdtool database; and also being pushed up to our IBM broker “in the interweb cloud” via an MQTT broker bridge connection.

So in theory, having the up-to-date information in the web UI should be a simple case of grabbing the MQTT publications on each topic and displaying them. The way I’ve coded things (and would prefer to do things), this involves having the ability to subscribe to MQTT publications from PHP.

I’m not at the end of the road yet, but I do have a starting point.

howitworks.png

I’ve got a front-end test page which currently uses Prototype to send an Ajax request to a server-side PHP script (yes, I have had jQuery recommended to me, and I may well look into that instead of Prototype, but this works).

The server-side script uses the Simple Asynchronous Messaging PHP library. SAM is a wrapper which enables a variety of messaging transports to be supported in PHP, such as MQTT, WebSphere MQ or WebSphere Platform Messaging. Just one thing: I found that in order to get the most recent SAM release to work on Ubuntu on my MPC-L, I had to install IBM’s XMS client SupportPac (for some reason, it won’t build without it, even though it is “optional”) and I also had to delete a spurious empty line from the end of /usr/share/php/SAM/php_sam.php to prevent header issues. Other than that, it was all good.

The script is really simple and basically uses all of the defaults to create a connection to my local RSMB over MQTT. The advantage of this being server-side is that I don’t have to open my RSMB to the Internet, the PHP code can connect via localhost. Once that’s done, it creates a subscription on the topic I’ve asked for, and receives the first data that comes along, then echoes it back to the front-end. I could make it auto-updating with Ajax.PeriodicalUpdater too, but there’s no need to put a load on my server.

Wanna see a quick demo? ;-)

I’m quite pleased with the way this is working. There’s some more plumbing to do, and I’ll almost certainly extend the server-side piece to allow two-way communications (publish as well as subscribe) as well as finer-grained control over the options. As a proof-of-concept though, I think this is looking good.

Twiccups?

I’ve been noticing a bunch of issues with the microblogging service du jour lately:

  • apparently, it likes to randomly unfollow people for me
  • then, when I try to re-add / follow them, the API tells me that I’m not allowed to follow them as I’ve hit a following limit. Only, I can’t have done, as I can follow other people.
  • even after “rebalancing” my ratio – now over 1100 followers, which is pretty amazing – it doesn’t let me add that one individual, but I can add others.

I’m not the only one reporting weirdness – one colleague actually “vanished” earlier today, his page and account were not reachable / findable, only to reappear later. Other people have mentioned that they have also encountered the phantom unfollow bug.

Although the fail whale is deployed a lot less often, which is welcome, there do seem to be other signs of instability. Not bad for a free service, but given how central it is becoming and how widely-known it now is, it’s frustrating.

Update: ticket opened.

Some thoughts on openness and trust in government

One of the things I’ve been taking an interest in lately is the slow progression of Internet technologies into UK politics – or should that be the progress of UK politicians onto the web?

We have a small number of Members of Parliament on Twitter (you can find them at Tweetminster), and a few have their own blogs too. Sadly some of the initial government moves to use social media were a bit of a disaster (remember David Miliband’s efforts in this area?). Things have improved as the individuals themselves are more savvy (increasingly true as new generations of MPs come into politics) – Tom Watson is a good example and I was delighted to be able to contribute to the open discussion he invited on the proposed Internet site classification idea.

Recently I was particularly pleased to hear Jo Swinson defend her use of Twitter on Radio 4′s Any Questions. I was also impressed with the tech-savvy she showed in a defence of Wikipedia, and her willingness to respond to people who are not even her direct constituents during a subsequent discussion on Twitter. I don’t want MPs on Twitter so that they can lecture me or send out press releases on their politics; and actually, I don’t see it as a gigantic waste of their time. It’s an excellent way to build relationships, and it can also make them seem more human too. Blogging and twittering encourages the use of more conversational language, and that is important particularly in the political sphere.

In an age of increasing distrust and apathy in democracies around the world, I’d like to see more of this. I’d like to see it extend to both the local level, and the international level, too. Local councils in the UK should be encouraged to make more use of social media. Larger bodies like the EU should be making better efforts in this space too – it’s all very well for them to stream proceedings online, but without a level of human interpretation of the jargon and dense documentation that comes out of the European Parliament, it’s very difficult for ordinary citizens to make sense of what goes on.

Pop quiz: does covering up a significant budget scandal in an intergovernmental body give opponents of that body less, or more, to complain about? Thanks to Google Translate I’ve been able to read a Swedish MEP’s blog entry on the subject

One of [my colleagues] argued for example that I should propose to discharge only to “avoid giving boost to European opposition before the European elections”. A hair-raising way of arguing, I think! This is exactly the opposite. If we do not take problems seriously and sweep justified criticism under the carpet, then we give arguments to the EU opponents!

I have to say that I agree – and more open attitudes like this would do a lot to improve public trust in the institutions that work for us.

Facebook – crowdsourcing a new ToS?

Well the furore over Facebook’s attempt to update / “clarify” their Terms of Service continues.

facebook terms

I’m actually very interested in the whole issue. For a long time now I’ve pointed people at the offending paragraph in the Facebook ToS which has potentially claimed usage rights to what you upload to their servers, and I’ve fought shy of putting a lot of my own photo or video content on the site for that very reason. Those of you who have heard me speak about social media in public may well have heard me point it out in the past. Based on the current wording I still wouldn’t share my family photos on Facebook.

Anyway, the recent amendment to the ToS and the apparent continued claim to retain and use content even after a profile is deleted caused Facebook to rapidly change tack. People are hailing the reversal to the previous ToS as a victory… all I’d say to that is that I was concerned enough about the previous wording. The relevant wording is below, although it’s important to note that the same paragraph goes on to state that Facebook does NOT claim OWNERSHIP of the material, but the wording is pretty clear about usage rights, in my opinion:

By posting User Content to any part of the Site, you automatically grant, and you represent and warrant that you have the right to grant, to the Company an irrevocable, perpetual, non-exclusive, transferable, fully paid, worldwide licence (with the right to sublicence) to use, copy, publicly perform, publicly display, reformat, translate, excerpt (in whole or in part) and distribute such User Content for any purpose, commercial, advertising, or otherwise, on or in connection with the Site or the promotion thereof, to prepare derivative works of, or incorporate into other works, such User Content, and to grant and authorise sublicences of the foregoing.

(excerpted from http://www.facebook.com/terms.php as they stood at 14:00 GMT 18th Feb 2009)

In response to the noisy reaction to the aborted change, Mark Zuckerberg posted on the Facebook blog talking about taking a new approach to crafting and communicating the TOS. I find this particularly interesting, as it suggests that Facebook wants to take a more collective or even potentially a crowdsourced approach to the whole area.

Now, I’ve been through this kind of experience, myself, professionally – IBM has been through the process of creating blogging, virtual worlds, and now social software usage guidelines, and we’ve done so transparently, collaboratively, and with a pleasantly light touch. I’m not yet convinced that Facebook will take such an open and collaborative approach to revising their service guidelines… and as Rooney tweeted earlier, this does present a challenge for a company but as we know it’s not the first time that the socially-networked masses have forced a change in policy, and not even the first time Facebook has been affected. Interesting times, and I will continue to follow this area with interest.

Update: some nice thoughts on the issue here, too.