Archive for April, 2006

Nepal: Can they agree on a prime minister now?

Okay, so I’ve had my breakfast, grabbed a coffee, and arrived back at my machine to see that Nepal’s king Gyanendra has asked the ‘opposition parties’ (they weren’t opposition before last February, but who remembers that?) to put forward their candidate for prime minister. In his address, which was televised (as was his address to take over the country last Febrary), he claimed that ‘”Executive power of the kingdom of Nepal, which was in our safekeeping, shall from this day be returned to the people.”

This is, of course, a tremendous victory for the hundreds of thousands of protesters who have defied shoot-on-sight curfew orders and the dozen or so who’ve been killed defying those curfews, all in an attempt to wrest power away from Gyanendra and restore ‘democracy’, aka the political parties.

There’s a aspect of cunning in the King’s announcement, however, that suggests he may not be done with politics any time soon. The oppositional political parties have recently been united in their protest against Gyanendra, but their history of cooperation is awful to say the least. The last time Nepal had a ‘multi-party democracy’, they couldn’t hold parliament for even a full day without the session breaking into literal chaos as political opponents argued and sometimes physically fought. Now, they must agree on a prime minister. Gyanendra has challenged his opponents to back up their talk, so to speak. He could have scheduled elections and avoided this challenge.

Gyanendra’s public justification for assuming power last February was the political parties’ inability to agree on anything. Now, they must prove him wrong, or he will continue to rule. Of course, not quite forgotten in all this is the Maoists, who had entered into a rather uneasy alliance with the political parties, but only for the purpose of bringing down Gyanendra. How will they react? Do they want their leader to be prime minister? Hmm…

Comments (2)

Conflict in Nepal: King’s hand forced?

It’s been 11 days since my latest post (due in part to a hard drive crash, but that’s another story), and it appears tensions are higher than ever in Nepal, especially Kathmandu, to the point king Gyanendra will be forced to relinquish some control.

Here’s the message I received today from the Canadian Embassy in Nepal:

7:00 am, Friday - 21 April 2006
Kathmandu, Nepal

The Government has announced another day time curfew for Friday, 21 April 2006. The 11-hour curfew will start at 9:00 am and end at 8:00 p.m. The areas covered are all areas within the ring road in Kathmandu and Patan (Lalitpur) districts, and parts of Bhaktapur district. The security personnel have been given shoot at sight orders to those defying curfew orders. Canadian citizens are requested to strictly follow the curfew orders and stay input during the curfew hours.

Protesters in Kathmandu (courtesy BBC) According to the BBC, however, Nepali citizens are not following these curfew orders by any stretch of the imagination, heading out to the streets in droves (over 200,000, according to Nepal News), calling for Gyanendra to restore power to the political parties. This, after 3 protesters were killed and many others injured when police opened fire at the Kalanki intersection on Thursday, and a protester killed on Wednesday was cremated by police without family present.

BBC claims Gyanendra will ‘address the nation’ about 3 minutes ago, making a ‘major announcement’. Considering the current unrest, and, more importantly, a recent visit from India’s ambassador and hints from US ambassador James Moriarty, one would expect this announcement to include some sort of timeline for re-establishing a parliamentary democracy. One can never underestimate the influence India has on Nepal’s affairs….

Anyway, must go have breakfast and wait for the content of this Big Announcement.

Comments

Shoot on sight curfew continues in Nepal

A message I received today from the Canadian Embassy in Nepal:

The Government of Nepal has imposed another day curfew in Kathmandu (and parts of Kirtipur and Bhaktapur) from 11:00 to 18:00 on Monday, April 10th. Day curfews are expected to continue in the days ahead. Curfew timing may change. The indefinite night time Curfew in/around Kathmandu from 23:00 to 0300 remains unchanged. Curfew are also in place in several towns across the country. There is a curfew in Pokhara today (10-Apr-06) from 09:00 to 20:00. Curfew will likely be imposed in Pokhara in the days ahead. Curfew timing may change. Canadians in Nepal are urged to respect the curfew.

Yikes. I’m not sure if I wish I was back in Kathmandu or not. Seems almost exciting, if you can avoid being shot, as these protests may finally force king Gyanendra into political isolation and remove him from power. United we Blog! for a Democratic Nepal, who has folks on the ground in Kathmandu and across Nepal. These folks are full of excitement, suggestingthat latest demonstrations are the beginnings of a People’s Revolution akin to the events of 1990 that forced a constitutional monarchy.

In terms of the protests, Yahoo News is reporting that about 1500 protesters defied the curfew by gathering in Kirtipur and blocking a road with boulders, to which Nepalese “security forces” responded with tear gas. This is the third consecutive daytime curfew. Yahoo news also suggests king Gyanendra’s government has, in the last week, arrested numerous protest organizers, cut mobile telephone service, and, of course, banned public assembly — an eery flashback to tactics Gyanendra employed during his infamous royal takeover last February.

I suppose we’ll see who’s going to back down first — though if Gyanendra actually did kill his brother’s entire family in order to gain the kingship, one would suspect he’s not planning to relinquish control any time soon.

Comments (37)

Yet more violence in Nepal: Soldiers shooting protesters?

The political situation in Nepal has been rather unstable for years, and one could no doubt fill an entire weblog with scintilating commentary on the twists and turns of Nepal’s political landscape. Perhaps some day I will. (Quick preview of various topics: Did the crown prince really kill himself and his entire family? What do they mean by “black substance”? The king shut down the telephones on democracy day? What, the king “escaped” across the street to the Indian embassy? Hey, why is that Chinese diplomat in Kathmandu?)

But I digress, as the news today is scintilating, and uncomfortable enough for now, with CBC news reporting Nepal’s king Gyanendra has temporarily quelled citizen protests by imposing an all-day curfew (that means stay inside) in Kathmandu and threatening to shoot any violators (that means anyone outside). Both the CBC story and BBC news report the king’s actions are motivated by recently growing protests of his centralized power, protests which have recently become violent to the point of tear gas and 1 demonstrator shot dead in western Nepal. Perhaps the king is afraid of a Maoist attach, as BBS news also reports.

King Gyanendra initially claimed he would return power to the political parties after 3 years — enough time for him to destroy the Maoist insurgency which the incumbent political parties had failed to quell. Unfortunately, this plan seems to be back-firing as quickly as Gyanendra troops are firing on non-Maoist protesters, and as a result, critics claim Maoist anti-monarchy rhetoric is as appealing as ever. For their part, the previously sacked political parties are either unwilling to wait 3 years for their promised return to power, or, more likely, believe the king has no intention on ever relinquishing his current control. Instead, they appear intent on forcing Gyanendra’s hand now.

I suppose we’ll have to stay tuned for more details, as current events are pointing toward more and more confrontation…

Comments

Extending Prototype for Javascript Inheritance : Class.extend()

Many folks around the web are raving about Prototype, a Javascript library written by Sam Stephenson which features “a unique, easy-to-use toolkit for class-driven development and the nicest Ajax library around.” (I stole that line from the prototype site).

Prototype’s popularity is certainly due in part to it’s inclusion in current web darling Ruby on Rails, but that ought not to slag the package (or rails) one bit — I’ve used prototype a fair bit over at GeoBirds, and have become rather reliant on it. In many ways, it solves a ton of problems I didn’t realize I had. Heck, by simply shortening document.getElementById to $, prototype has saved me countless keystrokes, although one might rightly suggest I should have written myself a helper function earlier.

If you’re like me, however, you’re still rather troubled by prototype’s claim of “class-driven development” in Javascript. In fact, you’re probably a little fuzzy on the differences between object-oriented and prototype-based languages (hey, is that why they called it prototype?), and, if you’ve investigated them, you find approaches to enabling classical object-oriented development in Javascript rather unintuitive. (See here, here, and here, all good stuff, but rather painful to use).

Enter prototype’s solution: the Class object and Object.extend() method. Sam Stephenson uses them throughout the library (check out the source!), and they allow users like us to do simple object-oriented programming. For example:

// create an empty Person class
var Person = Class.create();   
 // define the Person interface     
Person.prototype = {                 
    initialize: function(name) {
        this.name = name;
    },
   
    show: function() {
        alert(this.name);
    }
});

var myperson = new Person(“Ken”);
// alerts "Ken"
myperson.show();

and

// create an empty Employee class
var Employee = Class.create()
// extend Person                         
Object.extend(Employee.prototype,Person.prototype);     
// extend Employee interface
Object.extend(Employee.prototype, {                 
    initialize: function(name,salary) {
        // super constructor
        Person.prototype.initialize.call(this, name)
        this.salary = salary;
    },

    show: function() {
        alert(this.name + ‘ earns ‘ + this.salary);
    }
});

var myemployee = new Employee(“Ken”, 100000000)
// alerts "Ken earns 100000000"
myemployee.show();

Not bad. No offence, but, in my opinion, prototype beats other Javascript OO approaches I’ve encountered. Still, I’m troubled that we have to define class creation, inheritance, and interfaces separately. Whatever happened to this?

class Person {
    protected var name;
   
    public Person(thename) {
        name = thename
    }

    public String show() {
       return name;
    }
}

class Employee extends Person {
    protected var salary;
       
    public Employee(thename,thesalary) {
        super(thename);
        salary = thesalary;
    }
   
    public String show() {
           return name + ‘ ‘ + salary;
    }
}

Seems a whole lot more intuitive to me, but, of course, that was Java, and the only relationship between Java and Javascript is a name suggesting either an Indonesian island or my early-morning brew. Luckily, a small extension to prototype gets us something similar. I call it Class.extend()

Object.extend(Class, {
    extend: function(source,additions) {
        var newclass = Class.create();
        if ($C(source)) {
            Object.extend($C(newclass),$C(source));
        }
        Object.extend($C(newclass), additions);
        return newclass;
    }
});

function $C(object) { return object.prototype; }

Explain? Well, Class.extend() simply combines all the class definition steps of our earlier Employee extends Person example.

Using Class.extend, we can now say the following:

var Person = Class.extend({}, {
    initialize: function(name) {
        this.name = name;
    },
   
    show: function() {
        alert(this.name);
    }
});

var Employee = Class.extend(Person, {
    initialize: function(name,salary) {
        $C(Person).initialize.call(this, name);
        this.salary = salary;
    },

    show: function() {
        alert(this.name + ‘ earns ‘ + this.salary);
    }
});

Try it out (code). It’s a small extension, but I find Class.extend() saves me a ton of hassle. In fact, I now use Class.extend() by default and can nearly pretend I’ve never heard of object prototypes.

Comments (117)