New and Very Useful! View any Post in Diva Mode!

June 11, 2010
Mariah Carey

Mariah Carey photo under Creative Commons license from Flickr User Capital M

Driving around Phoenix, you hear a lot of ‘classic’ 70s and 80s music, and the worst of modern music. I can’t tell you how many times I’ve heard Whitney Houston and Leona Lewis. Argh!

Anyway, in my insanity, I decided to write a quick thing that converts and post on this site into diva mode! Simply add a /whitney/ to the start of the URL.

So, for this post, try going to

It doesn’t work particularly well. But I don’t care. I just wanna dance with somebody.

PHP Script to Follow Someone Else’s Twitter Followers

June 6, 2010

A gopher, for no reason really

I was going to write an introduction about how I don’t think that Twitter follower numbers are particularly important, but how/why I wrote this script anyway. But, to be honest, if you have a practical ethical use for this, that’s all I care about – who cares why I wrote it in the first place?

This PHP script is designed to be run on the command line. Once configured with your username, password, and the username of another twitter user, it will loop through their followers, and your account will follow each one (but remember, there are all kinds of limits in place, so you’ll probably follow a maximum of 1000 daily – and, depending on your following/follower ratio – up to a maximum of 2000 followers for your account).

One final note: I don’t use this (or anything similar) for my personal @zambonini Twitter account, in case you were wondering. This was written with a very specific purpose in mind, not as a general tool I use for my Twitter accounts.

 *  1. From
 *  2. Please use responsibly. Don't use to spam.
 *  3. Remember there's currently a 1000 daily limit to how many you can follow.
 *  4. Plus, you might reach the 2000/whatever-ratio limit for your account.
 *  5. This needs the CURL library.
 *  6. Uses some code from

// *** SET THESE ***
$my_username                    = 'yourtwitterusername';
$my_password                    = 'yourtwitterpassword';
$user_whose_followers_to_follow = 'anothertwitterusername'; 

// Get the followers of the chosen user
$aUserIds = get_follower_ids($user_whose_followers_to_follow);

// Feedback - how many we found
$num_to_follow = count($aUserIds);

echo "{$num_to_follow} unique/new users found from {$user_whose_followers_to_follow}\n\n";

// Follow each one
foreach ($aUserIds as $id_to_follow)
    echo "Following {$id_to_follow}\n";
    followUser($id_to_follow, $my_username, $my_password);

echo "Done!\n\n";

// *** Functions ***
function get_follower_ids($username)
    $url = '' . $username;
    $xml = file_get_contents($url);

    preg_match_all('/<id>([^<]+)<\/id>/', $xml, $aMatch);

    return $aMatch[1];

// Based on a function from

function followUser($id, $my_username, $my_password)
    $request_url = '' . (int) $id . '.xml';

    $ch = curl_init($request_url);

    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, array());
    curl_setopt($ch, CURLOPT_USERPWD, $my_username . ':' . $my_password );
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_NOBODY, 0);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_USERAGENT, 'Twitter Follow Others Followers PHP Script');
    @curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:', 'X-Twitter-Client: ',
                                                          'X-Twitter-Client-Version: ',
                                                          'X-Twitter-Client-URL: '));

    $response = curl_exec($ch);


Museum Search: Recommendations

June 5, 2010

About four weeks ago, I played around with a huge log of people’s search data from a museum/gallery/collections website. Lots of interesting little findings ‘fell out’ of the analysis, that I thought I’d quickly share with you:

  • Museum search boxes should be at least 20 characters wide. It’s diminishing returns after that.
  • Museum searches should fall-back to SOUNDEX() searches against painter names, if 0 results are found for the initial search. About 80% of the top 10 searches are for painter/sculptor/creator names – i.e. this is the most popular ‘type of thing’ to search for. However, the search logs show 58 variations of spelling for ‘Picasso’. Many of these could be picked up if painter names were stored alongside a SOUNDEX() of their name, then when no results are found for the initial search query, a SOUNDEX() of the search query can be compared against this pre-stored value, to find painters that ‘sound like’ the word that was typed in (e.g. Picaso, Piccaso).
  • Advanced operators/wildcards aren’t really used that much (0.3% of searches used * or “”), so they should only be implemented if they don’t require substantial investment. Similarly, instructions/notes about how to use them don’t need to be prominent (or perhaps this is why they don’t get used!).
  • Museum searches should pre-load and predictive suggest (via Javascript) the top 10 search queries, which account for 7.6% of all searches.
  • Client-side validation should be used (Javscript) to check the validity/specificity of the search query. In this data, numbers 2 to 5 of the most popular searches were: (blank) – i.e. no value, the, van, john. None of these are really specific enough to return useful results to the user; these type of common, non-specific queries could be detected on submission, and the user challenged to be more specific (rather than them waiting for the search results page, finding nothing of use, then having to hit back and try again).

Here’s a nice little graphic for you, to finish off the post:

Museum Search Data Analysis

What #1 on Hacker News Does For Your Stats

May 31, 2010

The Januarist - Stats for May

The Januarist isn’t the most popular blog in the world, but thanks to lots of good content and some great incoming links (e.g. from Wikipedia and Boing Boing), it usually attracts about 100 visits a day (mostly through search engine referrals).

Yesterday (well, on 31 May 2010), a new post called “Why Are the East of Cities Usually Poorer?” was published, which became the #1 link on Hacker News. It stayed there for at least 3-4 hours (I went to bed as it was still #1) – and, as I write this, it’s currently still on the front page at #19, some 16 hours later.

The graph above shows the results – so far, 10,000 visits today. I’m not sure whether this is typical of that position/duration for Hacker News, or whether the long weekend / Sunday evening (in the US, when it was first published) had a positive/negative influence. Either way, it looks pretty frickin’ good on the graph! (Though it does make the rest of the graph look a little pathetic). Coincidentally, that tiny little bump around May 22nd (which was actually 600 visits, so not that ‘tiny’), was also caused by Hacker News, linking to the Interesting Datasets post – though in this case, it didn’t get to #1 (I can’t remember where it reached), but did still make the ‘front page’.

Of course, the business person inside me knows that this traffic is fleeting, and will disappear as quickly as it appeared. And we won’t make a dime from it (we hand-pick Amazon-affiliate related books next to each post, but never really make a sale).

However, it’s all great for the long-term strategy of the blog: this has created tens of quality incoming links from less transient sources (I can see them already in the Google Analytics stats), which greatly improve our trust/PageRank, and therefore our ability to rank with new content. It’s all about the long-term, baby.

A Google Analytics Dashboard to Check Today’s Referrers for Multiple Websites

May 30, 2010

I spend a LOT of time on Google Analytics (GA), especially since increasing the number of blogs that I regularly write content for (Contentini, The Januarist, Amorphous Blog, Lame But Cool, this one…).

For me, the most valuable part of GA is keeping an almost real-time check on where traffic is coming from / who’s linking to my articles (‘monitoring buzz’ is, I guess, the modern phrase for such a thing), so that I can a) respond, and b) learn from what is successful for each audience.

My time on GA is therefore spent clicking between different profiles, and on each one manually selecting todays date, then manually drilling down to the referrers and keywords. On days that I publish a blog post or two, I can do this a few times an hour (I’m obsessive compulsive), so it takes a non-trivial chunk out of my day.

I’ve tried looking for tools to speed this up, but can’t find anything that works as quickly and as specifically as I’d like – even the impressive Trakkboard is a bit heavyweight, and doesn’t give options to just select ‘today’ as a date (I’ve tried).

So this morning I finally bit the bullet, and knocked-up a quick webpage that uses the Google Analytics API to list all of the blogs I’m interested in (all 5 of them), and displays the referring URLs and keywords for TODAY only. It also shows me a little timer, so that I know when I last refreshed. It also stores the list of URLs in a cookie for me, so that if a new one appears, it can highlight it in a lovely pink (so that I can see new traffic sources on each refresh).

Part of my hacked Google Analytics Todays Referrer dashboard

Excuse Alert: the low figures in the above screen grab are obviously because I took it early Sunday afternoon!

It’s not perfect, it’s messy and hard-coded, but it’s exactly what I need, and saves me time. It’s the definition of a hack.

Anyway, should you face a similar situation, here’s the PHP Script. Like I said, it’s messy and hard coded to my exact situation, so be prepared to tweak it. You’ll also need to download the excellent GAPI PHP class – it’s just a single file – and put it in the same directory.