Pluggable PHP

So I’ve been meaning to do this for some time: create a PHP plugin system. I saw the concept (hooks) first inside Drupal, and it’s the same technique I’ve used to implement plugins here.

Here’s what example.php looks like:


function hello() {

  $message = NULL;
  pluggable_serve("replace_welcome_message", $message);
  echo non_null_of($message, "Hello World");
  echo "\n";

<p>... and here's what an example plugin looks like:</p>

 * Singh is King
 * @package pluggable
 * @author Vishnu Gopal
 * @pluggable_hook before_welcome_message @with in_vish_singh_is_king

 * Just prints a preface to the Hello World message
 * @return string Singh is King
 * Notice the plugin three_two_one is also using the same hook.
 * Plugins are called in unspecified order.
function in_vish_singh_is_king() {
  echo "Singh is King!\n";

The code is up here on github – the pluggable-php project – it’s a pretty concise at less than 100 sloc. Take a look at plugins/ for the examples and then fork away and do something useful with it!

The Indian States

Train travel to Mangalore teaches you one thing: the clearcut definition of states that we see on an Indian map is both arbitrary, and a fallacy.

Just the fact that Mangalore has three commonly used names is evidence. The official one now because of Kannadigization is Mangalooru. The British Mangalore is still used more frequently, but for Keralites, it’s Mangalapuram. It’s kind of funny actually – from the starting end, the train is Thiruvananthapuram Mangalapuram Express, when it reaches, it’s Trivandrum Mangalooru Express 🙂

This doesn’t mean the separation of states via language is a bad idea or that everybody in Mangalore is bilingual (I would guess far from it), but everybody there does understand a smattering of Malayalam, and many speak both.

Separating states based on language was a great idea – a brilliant stroke of post-independence diplomacy. How else could you preserve the vast differences between people that make India unique, remove old allegiances to territorial rulers, ensure cohesive growth and representation, and direct an emergence of a new, valid and distinct identity – all at the same time? It’s like a zillion birds with one stone. For the people responsible, see States Reorganisation Act on Wikipedia.

However, the recent creation of new states (Uttarakhand, Jharkhand) based on the existence of a tribal majority is I believe a mistake. What made sense 50 years ago hardly does so now. Isn’t it time we strongly instill the idea of Indianess as opposed to regional or communal identity? (part of what makes U.S. and China so strong is their sense of national fervor) Add to this, there’s the danger that Maoist separatists bring to the country. They’ve already toppled the leadership of one nation (arguably a good thing), and are fast becoming a distinct danger to Federal rule in India. No need to exacerbate that by splitting the country further. Thoughts?

Ubuntu on the Eee PC 901 – A screenshot

Just a screenshot on how I’ve configured Ubuntu on my Eee PC. As you can see, I’m not done yet.

Screenshot of Ubuntu on my Eee PC 901

I’ve become increasingly impressed by Ubuntu since I’ve been introduced to it and I look forward to the day it can replace OSX as my OS of choice. It needs a bit of configuring to be usable still, but for a person who knows *nix and who doesn’t want to spend a lot of money, Ubuntu is a no-brainer decision even now.