Dr Nic

One year on the InterTubes

Dumping thoughts onto the InterTubes, aka blogging, is fun. And I’ve been doing it 1 year now.

Its also challenging.

Its like inviting people over for dinner – you have to clean up your house so they get a completely false impression of how you normally live your life.

Same with code – pasting it into blog articles or releasing projects makes you work harder to clean up code.

Same with the article – like rewriting paragraphs and sentences so they read better.


Remember the I Hired Jeff Clark site from a year ago?

I started this blog a year ago with the idea of it being an Online CV – I’d write clever things, people would comment, and employers would pick me instead of someone else.


Click through for fancy dynamic flash graph [1]

Leaving Tele2

The whole time I’ve been overseas working for Tele2 – a Swedish telephone company, developing their billing systems. No Ruby code anywhere. Lots of perl, some Java, and lots of an internal proprietary language. It hurts to work on that environment.

And today is my last day, so now I can pursue Ruby/Rails with full-time reckless abandon.

Starting with Dr Nic Academy.

What’s left to blog about?

In the last 12 mths, I think I’ve covered a fair bit of (seemingly random) ground: composite keys, magic models, javascript, radrails fixups, newgem, and lately openid.

In the future, the following stuff intrigues me, and it’d be fun to explore:

  1. Social OS – when I use flickr, I add contacts/friends/family and I add photos. When I visit your fancy new Web2.0 site, how can I import this profile information and automatically find all my friends or invite them to use your site? I envisage this built on OpenID, where every app is both an OpenID consumer (you login with OpenID) and possibly an OpenID provider (you can use your account page as a login to other apps).
  2. Mongrel handlers – sexy integration of handlers into the Rails code base, so they are automatically picked up when the mongrel servers are started. I haven’t looked into this at all, so that sentence mightn’t make any sense.
  3. Caching – nothing fancy, I just haven’t figured out how to use it yet. Anyone that used MyConfPlan during RailsConf might have guessed this.
  4. Javascript widget generator – generators get me from “idea” to “ooh that’s pretty” much faster, and avoid the “oh I can’t be bothered setting up the code base” step. I want to write a bunch of widgets for the RoR Oceania blog, to pull data from the RoR Oceania facebook API, so hopefully I can extract some base code into a generator.

As always, I’m completely happy for someone else to tackle these things first. So get cracking :)

[1] The XML for this
Maani graph is mashed from the raw feedburner API via this Ruby CGI script. If you want to use it, you need to turn on the Feedburner API first, and change the start date within the code (currently set to 1/8/2006)

That is, the data goes from feedburner XML to maani XML.

OpenID for WordPress

This blog – nay, this InterTubes HomePage – runs on WordPress.

This website allows you to comment. Like a blog. Let’s call it a blog. That’s shorter than “website”.

To comment you’ve got to fill in your name and email and website every… single… time…

Well, I don’t have to, because I have an account.

So I completely forgot about everyone else’s plight. That is, until one young soldier Rodney Ramdas, ask a good question:

hey is there an openid enabled commenting thingy [for your blog]?

OpenId logo

So I found OpenId plugin for WordPress.

Now you can create an account on my site using OpenID and never have to fill all that crap in again.

UPDATE: See comments below for how to use your blog domain name/url as your OpenID url. As it is this url that is appearing below people’s names, and that’s not what you want. That is, I can use drnicwilliams.com as my OpenID, even though it is actually http://drnicwilliams.myopenid.com/.

You can check that you’ve setup up your blog as your OpenID with this helper site.

Fixing your Feedburner feeds

Feedburner is great – you get snazzy graphs [1]. And other stuff. People use your feedburner link, instead of your raw RSS feed, in their feed reader and Feedburner will track your number of subscribers.

But it cannot track this information if your readers don’t use your Feedburner link. Why wouldn’t they use your Feedburner link? For two reasons:

  • You haven’t included the link on your blog sidebar (most people do this correctly)
  • You haven’t replaced the RSS links in your blog header (most people stuff this up)

Understand, there are two common ways for blog subscribers to add your site to their reader:

Unfortunately for many bloggers, if your readers use the latter method and you haven’t fixed your header (shown below), then they will be signing up for the raw RSS feed, and you’ll be none the wiser about them. They’ll be an invisible subscriber and won’t make your graphs as tall as they should be.

Let’s take an example of a broken blog and fix it for him. But, you can’t actually tell him to fix it otherwise I’ll have to update my example. Ad infinitum. So, its mum’s the word, ok? Only 180 subscribers on this blog – statistically he’s not one of them. Shhhh.

Visit the pinupgeek.com run by Rodney, where you’ll get weekly updates on the forum discussions of core improvements. On the right hand side, you’ll see the heading Subscribe and the RSS logo. The link under this logo is http://feeds.feedburner.com/pinupgeek – a Feedburner link. So we know he wants people to use his Feedburner link so he can watch his pretty graphs.

Now, right click on the page, and select “View Page source”. Note that in the header you’ll see the following:

  <link href="http://www.pinupgeek.com/xml/rss" rel="alternate" title="RSS" type="application/rss+xml" />

This link, of type application/rss+xml, will be used by RSS readers around the world automagically when passed a blog url, instead of an RSS feed link.

Here’s what happens in Netvibes for Rodney’s site:

Blog headers providing incorrect RSS feed link

No Feedburner link, just the raw RSS link (and a RSD feed link – what’s this for??).

So, let’s fix Rodney’s site.

Replace the above link with the following (using your blog’s theme editor):

  <link href="http://feeds.feedburner.com/pinupgeek" rel="alternate" title="RSS" type="application/rss+xml" />

If Rodney did this, then when I added his site into my Netvibes reader – or any other reader – I would automatically pick up his Feedburner link, and not his raw, unmonitored links.

In other words, his graph will get bigger.

[1] My blog is one month old and here is my Feedburner graph:

Feedburner - August 2006

Translation of RSS feeds a failure (part 3)

My path to spying on the Japanese wouldn’t be complete without support for translating RSS feeds. The translation needs to be performed on the feed itself before it hits the feedreader (unless you have non-Ajaxy webreaders that you can translate).

Unfortunately, Google Translate seems to ignore RSS altogether, and just redirects you back to the original RSS feed.

For example, take sample feed: http://d.hatena.ne.jp/hanazukin/rss2

Press the Spy on Japanese bookmarklet (cheat: click here for translation) and you’ll see the original RSS feed in the lower frame. Its not that its been poorly translated – Google just redirects you back to the original page instead of translating it.

Two solutions:

  1. Use a HTML -> RSS feed converter and use the direct translation url (use translate_c? instead of translate? in the url)
  2. Google Translate should add RSS feed translation. Really it cannot be more difficult than HTML translation. Add some caching (which google loves to do anyway) so its not translating each time my feed reader polls the feed, and you’re off and running.
  3. NEW – create a translator proxy that accepts RSS feed urls, converts the feed to a primitive HTML format, translate on google, convert results back to RSS feed

I prefer #2. So, if any Googlers read this blog, or if any friends of Larry & Co. are reading this blog, or if anyone remotely interested in popping over to the Googleplex to pass on a message from me, could ask the Google Translate ppl to add RSS feed support, I’d be a very very happy man.

Foreign tourists to your websites (part 2)

As a follow-up to the recent “Spy on the Japanese” post, you might want a nice set of links for your visitors to translate your page sinto their language.

But, here are your requirements (I can read your mind, I’m a doctor):

  • You know what countries visit your site, so you want to configure it yourself.
  • Since it requires Javascript to be turned on for it to work, you don’t want the links to show if the visitor doesn’t.

Solution: create the links using Javascript.

To allow translations of your blogs/websites via Google Translation, add the following inline Javascript into the sidebar. It was designed for WordPress – you may need to twiddle with the DOM elements created and/or CSS if it looks bad on your site.

The flags can be found at: http://www.famfamfam.com/lab/icons/flags/, and I’ve assumed you’ll store the png images in the /images/flags/ folder. If you store them somewhere else, change the images variable at the top of the script.

So, paste this script into your sidebar and you are saying “Aliens Welcome Here” [1].

        // Each lang in an array: [google lang code, flag name, language name]
        // Flags available at: http://www.famfamfam.com/lab/icons/flags/
        var to_langs  = [['ja', 'jp', 'Japanese'],
                         ['de', 'de', 'German'],
                         ['es', 'es', 'Spanish']];
        var from_lang = 'en';
        var images     = '/images/flags/';

        document.write("<li id='translation'></li>");
        var liDiv = document.getElementById('translation');
        var title = document.createElement("h2");
        var ulDiv = document.createElement("ul");
        for (var i=0; i < to_langs.length; i++) {
          var to_lang = to_langs[i][0];
          var flag    = to_langs[i][1];
          var name    = to_langs[i][2];
          liDiv = document.createElement('li');
          liDiv.innerHTML = "<a href='#' onclick=\"location.href=" +
            "'http://translate.google.com/translate?langpair=" +
            from_lang + "&" + to_lang + "&hl=" + to_lang +
            "&ie=UTF-8&oe=UTF-8&u='" +
            " + encodeURIComponent(location.href)\">" +
            "<img border=0 src='" + images + flag + ".png' /> " + name + "</a>";
        var getme = "<a href='http://drnicwilliams.com/2006/08/30/foreign-tourists-to-your-websites-part-2/'>How to translate my site?</a>";
        var getme_li = document.createElement("li");
        getme_li.innerHTML = getme;

[1] Americans mightn't know that when foreigners visitor your country, we are presented with paperwork to fillout that refers to us as Aliens. Perhaps your government never watches its own Hollywood movies, but this isn't the best phrase to use, I think. Not very welcoming.