Darren Ferguson - Weblog

13 July 2009

Tweet on publish for Umbraco – available to download

Filed under: Umbraco; Twitter - by Darren Ferguson @ 22:07

I've released a new version of my Umbraco package that sends tweets when you publish a content node. The package is available to download from my Umbraco packages page or the our.umbraco project page.

Features include:

  • Complete rewrite of my previous twitter package
  • Configure multiple twitter accounts.
  • Send multiple tweets per publish.
  • Ensure documents are not tweeted on re-publish.
  • Support direct messages and @mentions
  • Send different tweets per document type.
  • Filter tweets by domain.
  • Includes full PDF manual.

So why is this useful? I use the package to publicise blog posts and to send me a direct message when a comment is left on my blog so that I can quickly check whether or not it is a spam comment and act accordingly.

I'll provide a demonstration screen-cast shortly. In the meantime I'd love to hear your feedback.

30 March 2009

Quick Perl script: Scrape your photos from Twitpic

Filed under: Perl; Twitter - by Darren Ferguson @ 10:01

I've been following Noah Everett the creator of twitpic on Twitter. Although he provides a great service it does appear to be a one man show - there is every chance he could get fed up and walk away - I doubt the terms of service give the user any way of getting their photos back if that happened.

Most people use twitpic for throw-away snapshots posted from their handheld device but I use a twitter account with protected updates to create a timeline of my daughter growing up. I photograph her day to day on my iPhone and as my twitter client doesn't offer an option, the photos end up on twitpic. These photos are memories I am not prepared to lose.

Below is the script i run once a week to ensure my photos are backed up.


use strict;
use utf8;

use LWP::Simple;
use XML::Simple;
use Data::Dumper;
use Date::Parse;
use Date::Format;
use XML::DOM;

my $content = get("http://twitpic.com/photos/darrenferguson/feed.rss");
die "Couldn't get it!" unless defined $content;

my $xml = XMLin($content);

foreach my $item (@{$xml->{channel}->{item}}) {
    
    my $link = $item->{link};
    my $date = $item->{pubDate};
    
    $date = str2time($date);
    $date = time2str('%Y-%m-%d_%H-%M-%S_', $date);
    
    $link =~ m|.*/(.*$)|;
    my $id = $1;
    
    
    my $html = get($link);
    
    
    if(defined $html) {
        while($html =~ s|(<img.*?>)||ism) {
            my $tag = $1;
            if($tag =~ m|class\=\"photo-large\"|) {
                $tag =~ m|src\=\"(.*?)\"|;
                my $src = $1;
                my $img_data = get($src);
                
                if(defined $img_data) {           
                    my $fn = "$date-$id.jpg";
                    
                    if(!(-f $fn)) {
                        open FILE, ">$date-$id.jpg";
                        binmode FILE;
                        print FILE $img_data;
                        close FILE;
                    }
                }
            }
        }
    }
}

15 March 2009

Testing my Twitter based location app at FOWA Dublin

Filed under: Twitter - by Darren Ferguson @ 08:39

The week before last the fine folks at Carsonified were kind enough to let me use the attendees of their FOWA Dublin show to test a Twitter/Google Maps/location "mashup" that I had developed. I've been asked to blog my opinions on FOWA, but for this blog post I'll focus on my app.

Here is the mail that went out to the attendees:

----------------------------------------------------------------
Connect with fellow attendees using Twitter!
----------------------------------------------------------------

Darren Ferguson - /  has built a
very cool social twitter app to help you find and meet fellow
conference attendees. So you guys can get the most out of the
event we have set this up for you to use during FOWA Dublin!

Here's how it works:

First, follow fowdublin and wait for it to follow you back.

Keep your twitter profile location up to date or include a link
to a google map at the end of your message when communicating
with fowadublin.

If using an iPhone Tweetie or Twitterific will all allow you to
append map links to your messages. Twitterfon, Sparrow and
Brightkite allow you to update your twitter profile location.

To publicise your location send a direct message to fowadublin,
for example:

    d fowadublin Holiday Inn Hotel Bar, Swilly Road

Optionally attach a twitpic so that people trying to find the
venue have something to recognise.

To find people try the following commands:

    d fowadublin near
    d fowadublin nearest
    d fowadublin newest
    d fowadublin where @twitterid

Don't forget to add a map to the end of the command if you can!
You will receive a direct message as a response - usually within
2-3 minutes. for nearest, newest and where commands the response
will include a link to a map showing you how to find the
appropriate person e.g.

    nearest @fmoriyama 6 mins ago 0.6 miles away in Dublin
http://tinyurl.com/dbre9o "Sycamore House"

If you want to be kept up to date every time someone updates
their location send the following direct message:

    d fowadublin alerts
    d fowadublin noalerts

If you get stuck you can get a reminder of all of these commands
by sending the following direct message:

    d fowadublin help

Tips on updating your location:

If updating from a laptop give street level locations e.g
"Castle St, Dublin" or a Latitude, Longtitude postion.
If updating from an iPhone or other GPS enabled mobile update
your location outside before going into the venue.
If updating from an iPhone update with WIFI turned on even if
you are not connected to a wifi network - Don't ask me why,
you just get a better location fix especially on 2.5g iPhones.

If things don't seem to be working for you. Send an direct
message to fmoriyama for help or email xxx@fergusomoriyama.com

Finally, if you want to get in touch with someone before meeting
up, you have their twitter ID so it is easy to get in touch.

More than anything else, I want to blog about my experience with real world user testing and what I learned from the experience, but first a little background.

About 5 years ago I used to do a lot of drinking around London. I had a number of different groups of friends who were usually out in a bar somewhere in town. The problems were that sometimes they were in a noisy place and couldn't hear their phones, or often just underground. In addition when you know 30 people who may be out having a beer it isn't really practical to phone them one by one, find out where they are and then make a decision about who to join.

If you are still with me you should begin to see how the problem relates to my application. Essentially, it allows dispersed social groups to quickly find one another. As well as drinking buddies the concept works with conference attendees, families and is particularly useful when you are in an unfamiliar city.

5 years ago location information was firmly in the hands of the network operators and the idea was to use network LBS data from cell triangulation and SMS as the medium to communicate with the users. Now, your location data is firmly in your own hands and the TwitterAPI provides a fantastic set of methods for messaging and also for groups (if you consider everyone following one user to be a group).

So what was the feedback?

I hate to admit it but everything I learned I knew already. Through years of working with users It was all obvious.

1. Users don't read instructions. About 75% of the people who tried my app didn't read the instructions, they just started to interact with it in a way that they thought it should work and modified there behaviour gradually as their interactions didn't work. Some persisted, some gave up - amusingly one person was so convinced that my app should work *his* way he continually sent it the same message appended obscenities as he became frustrated that it wasn't working.

I shouldn't have been surprised that no-one reads instructions. When I buy a new laptop, I plug it in and switch it on. When I go to IKEA I lay all of the horrible bits of cheap wood and screws out on the floor and only go the instructions when I really don't understand what I should do next. Lesson learned, people don't read instructions - especially techies.

How could I do it better next time? I'd try a screencast. I find it much easier to absorb technical information if it is being demonstrated to me rather than reading it as text.

2. People want native applications. I thought that the beauty of my idea lay in the fact that that it was device agnostic. As it was based around Twitter and Google maps anyone with the appropriate clients could use it. If you were on an iPhone, laptop, Blackberry or any other device the user experience was pretty much consistent.

I was wrong. Users don't want to type text commands. Users are so used to beautiful simplified GUIs nowadays, so having to type the word nearest is a major headache. Why would they do that? They expect a big red button that says 'nearest'.

Also, why would a user wait for a response when they can have instant feedback. A few years back sending and SMS and waiting a few minutes for a response was an acceptable user experience, now everything is on demand you can have your TV, Music and news whenever you want it, so why would you wait?

Despite the fact it massively and exponentially increases your development/testing overhead it seems that you do need to build native apps or at very least applications that run in the browser. As a direct result of my tests at FOWA I've downloaded and installed the iPhone SDK.

3. Even geeks don't always get location. When people were trying to tell my app where they were they were often being a little too vague. With an application like mine the ideal scenario is that a user provides a latitude/longitude point but when the device they are using doesn't provide this ability or they are somewhere where you can't get a GPS fix (indoors) then you need a fallback.

At FOWA Dublin plenty of people assumed that 'Hotel X' was a sensible description of their location. They assumed that since my application was targeted at an event happening in Dublin then it should be aware that the locations they described were in Dublin. This was interesting and has given me some good ideas for geocoding text based on location history and using sources other than a geocoding API to acquire address data based on a user description. Trying to geocode free text also involves some clever language processing techniques including removing noise/stop words and extracting significant fragments.

The point I am trying to make is that when GPS location fails you have to be very smart to find a user based on how they describe where they are.

Finally as an aside, if you are a tech conference organiser it is well worth setting up a conference Twitter account and persuading your attendees to follow. Although I hadn't considered this before FOWA, having a conference user allows you to see what people are saying about your event in real time. As I was party to the FOWA twitter account I could see what people thought of the speakers as they were on stage and how people thought the WIFI was poor, coffee to expensive and so on.

If you run a conference/social group and would be interested in trying out my application please let me know.

21 January 2009

Quick Umbraco tip: Display twitter feeds on your site

Filed under: Umbraco; Twitter - by Darren Ferguson @ 08:40

First, install the Ferguson Moriyama Feed Cache package for Umbraco. Make sure you read the install instructions which explain how to get the package to run as a scheduled task.

Grab the URL for your twitter feed, mine is http://search.twitter.com/search.atom?lang=en&q=from%3Adarrenferguson. You can turn any twitter search into an atom feed by visiting search.twitter.com and clicking on the ‘Feed for this query’ button after your search.

Next, configure the Feed Cache package to cache your feed. Open <webroot>/umbraco/plugins/FergusonMoriyama/FeedCache/feeds.config and add an entry like the following:

<?xml version="1.0"?>
<feeds>
	<feed>
		<url>http://search.twitter.com/search.atom?q=from%3Adarrenferguson</url>
		<localFile>twit.xml</localFile>
	</feed>
</feeds>

Wait a little while until twit.xml appears in the <webroot>/umbraco/plugins/FergusonMoriyama/FeedCache folder. If it doesn’t there is probably something wrong with your scheduled task setup.

Use the following XSLT macro to display tweets on your site:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:Stylesheet [<!ENTITY nbsp "&#x00A0;">]>
<xsl:stylesheet
 version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:msxml="urn:schemas-microsoft-com:xslt"
 xmlns:umbraco.library="urn:umbraco.library"
 exclude-result-prefixes="msxml umbraco.library Atom"
 xmlns:Atom="http://www.w3.org/2005/Atom">
    
    <xsl:variable name="y" select="document('../umbraco/plugins/FergusonMoriyama/FeedCache/twit.xml')/Atom:feed"/>
    <xsl:output method="xml" omit-xml-declaration="yes"/>
    <xsl:param name="currentPage"/>
    
    <xsl:template match="/">
        <xsl:for-each select="$y/Atom:entry">
            <p>
                <em>
                    <xsl:value-of select="umbraco.library:FormatDateTime(Atom:published, 'MMMM d, yyyy @ H:mm')"/>
                </em>
		<xsl:value-of select="Atom:content" disable-output-escaping="yes"/>
            </p>
        </xsl:for-each>
    </xsl:template>
</xsl:stylesheet>

Obviously you can just change your twitter search to look for hash tags, Umbraco related tweets or whatever you want. There is also a lot more information in the atom feed than I am displaying above and the XLST can be modified to your liking.

14 January 2009

Can’t be bothered to read? Listen to your tweets instead

Filed under: Twitter - by Darren Ferguson @ 13:56

Here is a fun little hack I put together.

Visit http://www.bunbohue.co.uk/index.pl?uid=user&pwd=password

To get an mp3 file of the 5 latest items in your twitter feed. Although this is a 10 minute hack, I guess there is potential in subscribing to this kind of content.

I don't store any user names and passwords.