Sunday, August 23, 2009

Muna Madan

Gurkha Nepalese Community (GNC), a Sydney-based Nepalese community organization, is staging Muna Madan as part of its annual Dashain festivities this year. A casual conversation with a dear friend of mine who also happens to be one half of a GNC power couple inspired the following thoughts about the most popular lyrical drama of the youngest Himalayan republic.

  • Muna Madan is arguably the greatest work of Nepal's unarguably the greatest poet, Laxmi Prasad Devkota

  • A miniature masterpiece, the work partly owes it popular appeal to its use of folk idioms and metres

  • The drama centres around the trials and travails of a high-caste migrant worker journeying to Lhasa (Tibet) for work and back

  • Apart from the constraints placed by a traditional society on romantic love, the drama also highlights the twin evils of casteism and manpower drain that have impeded Nepal's emergence from the dark shadows of its past

  • The most famous line from Muna Madan, spoken by the high-caste protagonist to a "lowly" Bhote who nurses him back to health, is: "Man becomes great not by caste, but by heart"

Friday, August 21, 2009

Removing Excel VBA password

For whatever reason, one sometimes confronts the need to remove Excel VBA project passwords. Here is an easy way to do it. Hopefully, this will one day spare you hours of googling and frustration.

Monday, August 17, 2009

My City2Surf 2009 Performance

My preparations to run this year's City2Surf under 60 minutes were derailed by a combination of flue, nasty weather and good old inertia (the complete list of excuses actually runs longer than the world's biggest fun run!) Anyway, I clocked 69 minutes 9 seconds, improving last year's result by 39 seconds.

The unexpected 'improvement' - after a month of inactivity, my preparation consisted of four comfortable jogs over the week leading to the event - illustrates what I suspect is the exponential nature of the efforts required to improve one's speed. After a certain point, disproportionate inputs seem to require to exact minuscule gains in speed. Conversely, comfortable pace is not necessarily a prelude to a catastrophic loss (or, is that gain?) in time.

In a sense, running, even the fun ones, is all about timing. One has to know when to hold back and when to give all. As my preparation was far from ideal, I checked my impulse to go all out in the first kilometers even as other adrenaline-fueled runners zoomed past me. It was not until after around 10 km that I upped my tempo. When I crossed the finish line, I still had enough left in the tank to run another 5 km. Perhaps, I held myself back a bit too long but this did not prevent me from feeling very satisfied with my performance, especially considering the comfortable pace that improved on last year's result, which was achieved through far more lung-busting efforts.

Sunday, June 28, 2009

Interesting Python Functions

This post will contain a collection of Python library functions that I found interesting. I will keep adding to the collection as I encounter more interesting functions.

#----------------------------------------------------------------------------
# range() - this function generates a list of numbers
#----------------------------------------------------------------------------

upperBound = 5
range(upperBound) # this generates [0, 1, 2, 3, 4]

lowerBound = 2
range(lowerBound, upperBound) # this generates [2, 3, 4]
range(1, 11, 3) # generates [1, 4, 7, 10].
# range(lowerbound, uppperbound, step)

# an example of range() in action
monthList = ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec")
for i in range(12):
print monthList[i], # prints all the months of the year

#-----------------------------------------------------------------------------------------
# randrange() - generates a random number from a range of numbers
#-----------------------------------------------------------------------------------------

import random # this module is required to use randrange()
random.randrange(6) # generates a random number between 0 to 5 inclusive
random.range(6) + 1 # generates a random number between 1 to 6 inclusive

#--------------------------------------------------------------------------------
# choice() - returns a random element from a sequence
#--------------------------------------------------------------------------------

vowels = ('a','e','i','o','u')
osList = ["linux", "BSD", "UNIX", "NT", "Solaris"]
random.choice(vowels) # randomly selects a vowel
random.choice(osList) # randomly selects an os


Friday, June 26, 2009

A Story of Darkness

Once in a long while, you come across a book that makes you feel like Dostoevsky when he allegedly ran through the streets of St. Petersburg waving a copy of Tolstoy's Anna Karenina and shouting, “This man is God of art!” My own reactions when reading Aravind Adiga's 2008 Man Booker Prize winning debut novel White Tiger was, “This man is a poet of Truth!”

White Tiger is an unflinching look at what the author calls the “Darkness”, the vast underbelly of India where people live on the edge of survival, chaffing under crushing poverty, corrupt institutions, and inherited beliefs and practices that perpetuate their cruel fate. It provides a savage, angry counterpoint to the currently popular narrative of India that has it marching inexorably to unprecedented prosperity and global dominance.

Early in the book, Adiga introduces the theme of the novel in a typically lyrical paragraph:
I am talking of a place in India, at least a third of the country, a fertile place, full of rice fields and wheat fields and ponds in the middle of those fields choked with lotuses and water lilies, and water buffaloes wading through the ponds and chewing on the lotuses and lilies. Those who live in this place call it the Darkness. Please, understand, Your Excellency, that India is two countries in one: an India of Light, and an India of Darkness. The ocean brings light to my country. Every place on the map of India near the ocean is well-off. But the river brings darkness to India – the black river.

Adiga, who did part of his schooling in Sydney, cut his writerly teeth as a correspondent for the Independent, Time and other quality media outlets. This shows in his writing. The narrator, an inhabitant of Darkness who yearns for Light, tells his utterly absorbing story in a language that is a joy to read. Simple, unadorned sentences crackle  with wry humour, sharp wit and sardonic observations that only a uniquely gifted artist can make. Adiga refuses to couch his narrative in Marxist or Manichaen terms, which saves it from being just another banal polemical tract for the underdog.

Unlike some other famous Indian writers, Adiga's voice does not come across as calibrated to appeal to the Western ear. His overriding concern seems to be holding a pitiless mirror to the denizens of the Light and Darkness themselves, and not entertaining distant readers in the cafes of Manhattan or Glebe with fantastic tales of an imagined Orient. Unsentimental, harsh and scathing, Adiga does not absolve the inhabitants of the Darkness themselves from their fate, which he compares to those of butcher-bound roosters trapped in a coop. It is clear to Adiga that the domain of Darkness is not confined to material disparities or geographical boundaries. It subjugates, corrupts and rules the very souls of those who are in its thrall. He has no sympathy for the "human spiders" of the Darkness who, when not wiping tables in cheap roadside tea stalls with dirty rags, occupy themselves with propitiating the absurdly huge array of gods and goddesses of the Darkness, or watching cricket and toothpaste ads on TV.

Monday, June 22, 2009

Tuple, List and Dictionary

This series will feature short notes on Python topics. The idea is to reinforce my learning through "note taking".

Tuple



  • Tuple is just like an array. It is immutable, and holds a sequence of values. However, unlike a C/C++ array, a tuple can store values of mixed types. An example:
      myTuple = ("Python", "PHP", "Ruby", 3.1428, 2009, "Django")


  • Just like a string, a tuple can be indexed, sliced and concatenated with another tuple. When called on a tuple, the len() function returns the total number of elements in the tuple.
    totElements = len(myTuple)
    print totElements # It prints 6



List



  • A list is like a C/C++ dynamic array. Elements can be added, deleted and sorted

  • Just like a tuple, it can store data of mixed types.

  • A list is enclosed in square brackets. For example:
    myList = ["Python", "PHP", "Ruby", "Perl", ('a', 'e', 'i', 'o', 'u')]
    emptyList = [] # this creates an empty list


  • All the tuple operations are applicable to lists


Dictionary



  • A dictionary is like a hash table in other programming languages. It stores data as key-value pairs.

  • A dictionary is enclosed in curly braces.

  • The key must be an immutable data type, i.e. string or tuple. For example,
     
    myDict = {"name" : "Charles Martel", "occupation" : "Palace Mayor, coup leader", "country" : "France"}
    emptyDict = {} # This creates an empty dictionary


Saturday, June 20, 2009

After Missing the Recluse on the Western Mountain

Is there anyone who does not wish to visit a hermitage like the one described in this poem?

AFTER MISSING THE RECLUSE ON THE WESTERN MOUNTAIN
By Qiu Wei
To your hermitage here on the top of the mountain,
I have climbed, without stopping, these ten miles.
I have knocked at your door, and no one answered;
I have peeped into your room, at your seat beside the table.
Perhaps you are out riding in your canopied chair,
Or fishing, more likely, in some autumn pool.
Sorry though I am to be missing you,
You have become my meditation --
The beauty of your grasses, fresh with rain,
And close beside your window the music of your pines.
I take into my being all that I see and hear,
Soothing my senses, quieting my heart;
And though there be neither host nor guest,
Have I not reasoned a visit complete?
... After enough, I have gone down the mountain.
Why should I wait any longer?