Posts Tagged ‘code’

Of Robots And Teapots; Web Geeks Are Not Without A Sense Of Humour

There’s a line from the first Matrix movie, the only really good one out of the trilogy, where Morpheus says earnestly to Neo … fate, it seems, is not without a sense of irony. It’s time to add a corollary to this quote, along the lines of web geeks, it seems, are not without a sense of humour.

Last year, it was the web geeks who run the web servers for Yelp and Last.fm sticking Asimov’s Three Laws of Robotics into their respective site’s robots.txt file. Sadly, it looks like Yelp’s robots.txt is now unfunny and businesslike, but Last.fm’s subversion of this file is still there.

$ curl -X get www.last.fm/robots.txt
User-Agent: *
Disallow: /music?
Disallow: /widgets/radio?

Disallow: /harming/humans
Disallow: /ignoring/human/orders
Disallow: /harm/to/self

But it seems like the BBC’s web geeks also are not without a sense of humour. Earlier today, I happened across one of the more bizarre HTTP status codes out there on the interwebs. Not your usual HTTP 200 Success or HTTP 404 Not Found, but HTTP 418 I'm A Teapot

418 I’m a teapot (RFC 2324)
This code was defined in 1998 as one of the traditional IETF April Fools’ jokes, in RFC 2324, Hyper Text Coffee Pot Control Protocol, and is not expected to be implemented by actual HTTP servers. However, known implementations do exist.

no, really. Take a look at the BBC’s CBeebies site if you don’t believe me.

The page even returns a HTTP 418 status.

Thanks are due to fellow ex-Yahoo! David Overton for pointing this gem out. Honourable second place mention is also due to HTTP 420 Enhance Your Calm.

420 Enhance Your Calm (Twitter)
Returned by the Twitter Search and Trends API when the client is being rate limited. Likely a reference to this number’s association with marijuana. Other services may wish to implement the 429 Too Many Requests response code instead. The phrase “Enhance Your Calm” is a reference to Demolition Man. In the film, Sylvester Stallone’s character John Spartan is a hot-head in a generally more subdued future, and is regularly told to “Enhance your calm” rather than a more common phrase like “calm down”.

… web geeks, it seems, are not without a sense of humour.

Written and posted from home (51.427051, -0.333344)

Beta No More; WP Biographia Hits Version 2.0

It’s taken a while but after 20 commits on GitHub, 1000 odd lines of PHP code, 40 odd WordPress forum posts and, what to me is a staggering, 1100 odd WordPress downloads, WP Biographia finally hits version 2.0. As I’ve written before, this is very much an ongoing learning process and putting version 2.0 out into the wild hasn’t been entirely trouble free, as this thread on the WordPress forums amply shows.

But despite the initial teething problems, version 2.0 is out and the list of enhancements and fixes remains unchanged from the beta version, but the official version 2.0 release of this plugin is now both on GitHub and the WordPress plugin repository and while my Codeage page still remains the official home for this plugin, there’s a nicer looking home on GitHub for WP Biographia courtesy of GitHub’s pages feature.

I Want The Biography Of My Life ...

The vast majority of those 1100 odd WordPress downloads are thanks to the WordPress community itself, who’ve had some nice things to say about WP Biographia, such as Kevin Muldoon on wpmods.com  …

As you will have established by now, I think WP Biographia is a great little plugin. Being able to insert the author box directly into an RSS feed will benefit anyone who runs a multi-author blog or website (or those who accept guest posts regularly). The plugin also adds new social media profile fields to users profile and displays them in the author box automatically.

I encourage you to try it out yourselves and see what the plugin can do.

… and on Smashing Magazine’s noupe.com

Arguably the best looking author bio plugin available for WordPress, WP Biographia gives you complete control over what is shown in the bio area and adds Facebook, Twitter, LinkedIn and Google+ profile fields to every users profile. You can choose whether the box is shown on posts, pages, archives and/or the home page and you can customise the colour scheme and border too.

Without a doubt the plugins best feature is the ability to display author bios in the RSS feed. 99% of blogs don’t include a link to the authors posts or website through their RSS feed therefore the guest poster loses a lot of potential traffic from RSS readers. WP Biographia corrects this by displaying a beautiful looking bio at the end of every post in the RSS feed.

… and Rick Bjarnason

Authors like credit. Make sure you are using this plugin so everybody knows who the writer is. Adds Facebook, Twitter, LinkedIn, and Google Plus profiles, but the real killer feature is that it works in RSS feeds.

A next version of WP Biographia, which will probably end up as v2.1 is now in the works, which includes some of the additional feature requests that people have asked for on the WordPress forums as well as directly by email. Trying to keep the usual home life, work life, coding life balance in check means that quite when v2.1 will see the light of day is unclear and as the Christmas Holiday season is fast approaching it may well be sometime in early 2012, but only time will tell.

Photo Credits: Jacob Martinez on Flickr.
Written and posted from home (51.427051, -0.333344)

WP Biographia Is But A Quarter Of The Way To WP Mappa

In a way, this was all Matt Whatsit‘s fault; he writes very profane and very funny blog posts and reading his recent The Five Stages Of P****d Wife (which you should read if you haven’t already, err, read it) made me laugh, hell, it made me ROFL and LMAO at the same time but it also made me think, though not necessarily about wives or drunkenness …

Now background reading and general swotting up on a topic is all very well but to really learn how to do something you just have to roll your sleeves up and do it yourself. Though it’s probably stretching a comparison too far, you don’t learn to drive a car through reading the highway code; you actually get behind the wheel (preferably under supervision) and … drive. You don’t learn about what food tastes good from a recipe book; you … taste the stuff yourself.

And so it is with writing code and using new and unfamiliar APIs. It was definitely the case with my recent (reacquaintance of, and) foray into JavaScript and the addition of support for Nokia’s Ovi Maps API to the Mapstraction project, with the added benefit of having to teach myself how to move from my (by now very dated) knowledge of version and revision control under CVS to git.

May the source code be with you

So, first JavaScript and Mapstraction and the Nokia Maps API and now to PHP and the WordPress API. There’s a lot of WordPress plugins that do geo-related stuff with your blog but none of them actually do what I want. WP Geo comes close, but it uses Google Maps and Google Maps only. Now I have nothing against Google Maps or the Google Maps APIs but I want maps from the company I work for on my blog.

When I came to add Nokia’s Maps API to Mapstraction I at least had a head start. I’d done some JavaScript and I was at least familiar with the Mapstraction API. But writing a WordPress plugin was another thing entirely. Despite hosting my blog on WordPress since 2004 and being able to hack a moderate amount of PHP, I’d never needed to use the WordPress API. Until now.

Bearing in mind the old adage about walking before you can run I decided the best way to tackle this was to write a WordPress plugin for something much more simplistic and this is where Matt Whatsit comes in. At the foot of each post is a nice little biography; in Matt’s case it read “Stole some Chewits in 1979. The guilt still haunts me“.

So I searched for a plugin that would give me this capability. There’s lots. But as with the desire for a geo-related plugin, none of them did exactly what I wanted. The closest I could find was Jon Bishop’s WP About Author plugin. So, as all WordPress plugins are licensed under the version 2 of the GNU Public License, I took Jon’s plugin and hacked it to do what I wanted it to do. The result is what I’ve called WP Biographia and you should be able to see the results of it at the foot of this post, if you’re reading it from this URL.

 

I now know, or at least understand at a conceptual level with much web searching of the WordPress Codex, how to write and structure a WordPress plugin. I still need to know how to write and structure a WordPress widget but that will form part of the next version of WP Biographia. By then, I should be armed with enough WordPress API knowledge to start to write what I really wanted to write, which is my geo-related plugin, which may, or may not be called WP Mappa. I’m only a quarter of the way there, but it’s a quarter more than when I started this.

In the meantime, WP Biographia is now part of the official WordPress plugin repository and is also up on github as well. It also now has a resident page here on my blog which I’ll update as and when I make sufficient changes and improvements to warrant a new version.

Starting to code again is addictive and I seem to have managed to rack up a few github repositories of recent. WP Biographia is but one of what I’ve christened, in line with the theme of Gary’s Bloggage, Gary’s Codeage. For now, it’s a holding pen for those code projects that live in github but for which I’ve yet to write a formal page on. These may appear sometime in the not too distant future as and when time permits.

Photo Credits: ficek1618 on Flickr.
Written and posted from home (51.427051, -0.333344)