Sunday, 6 December 2015

After the flood

Well, I'm back. Back in my comfortable Bangalore apartment.
And I'm not feeling relieved. I'm feeling guilty. Like a deserter.
Being in a catastrophe - and being healthy and not doing anything - isn't a good feeling at all.
I went to Apollo for my results on Wednesday, a day after the rain was the heaviest. I had to wade through waist-deep water, past parents carrying children on their shoulders and a few precious possessions, past patients who had come all the way from Bengal and Orissa for treatment, only to be caught in what was literally the storm of the century.
In Apollo, though, people were working. The nurse who administers the treadmill test had come from her West Mambalam home  - where the water was thigh high at its shallowest - by travelling half-way around the city. I saw Dr Vijay Shankar, my cardiac surgeon, looking tired and noticeably thinner, in his scrubs. Other hospital staffers looked bleary eyed, having stayed overnight in the hospital, as they struggled with systems without networking, trying to provide lab reports and perform X-Rays with generated power.  
There were corporation workers trying to clear blockages on the roads, so that water could drain out, and they were working as it poured. There were cops everywhere, trying to reach areas more inaccessible than moated medieval castles.
All I did was stay at home and watch the water level rise.
I had no lists useful contacts to share. I donated no drinking water - despite having plenty. I didn't take any cooked food to people who needed it. I had mobility and a full tank of petrol, but I didn't use it. All I did was go around looking for milk, and when I found it I didn't kick up a fuss when the shopkeeper told me that he was keeping it for women who had young children who would need it more. I didn't post notifications of people who were missing, or of localities which needed supplies. I didn't, like the guys I saw, go from Saidapet to Kotturpuram, with carloads of supplies, calling their friends to tell them which areas were under served and which areas help had reached.
All I did was fulminate against the rain, the closure of the airport and the cancellation of trains and the inaccessibility of Koyambedu, about how it would screw up my holiday if I couldn't get back to Bangalore by Monday.
Meanwhile, thousand of people have actually been doing things. Fuck politics, fuck religion. RSS guys have been providing aid to those who need it. Muslims have opened up their mosques to provide shelter and are cooking food to distribute to Hindus in temples. Movie stars have rolled up their sleeves and climbed on to boats - photo-ops to be sure, but more than I was doing. Even in their own shallow, opportunistic ways, the news channels have done some good.
But if the only positive things you can say you did when your city was reeling under the worst catastrophe in living memory is that you didn't get drunk and screw around with people trying to make a difference, its a pretty sad reflection on your character.
Well, it looks like I'm getting my vacation.
The prospect, which looked so attractive a week ago, seems so shallow now.

Friday, 8 May 2015

Code monkey like you

It started with Facebook. First, there was a post about Singapore’s PM Lee Hsien Loong talking about wanting to learn Haskell. Then, there was this lovely blog post by one of
Lux's colleagues - Lakshmi Kumaraswami (Does that make her another Lux?) - about her experiences with learning Python. Python is cool. So is Perl. Or Ruby. Over the course of the last few years, I've downloaded a variety of programming languages - swearing that I would spend the time getting to learn them, but never have gone beyond opening the documentation.Erlang. Nimrod. Haskell. Haxe. Clojure.

Maybe it's a nostalgia thing.

Maybe it's about the feeling of power you get. I downloaded a PDF of good old Kernighan and Ritchie. And started my way back up from "Hello, world".

It was like a kick in the nuts.

Like many bad programmers, I had an inflated opinion of my own programming skills. It would be a breeze, doing those old programs again, I thought.

I couldn't have been more wrong.

One of the exercise programs in the first chapter read: "Write a program to copy its input to its output, replacing each string of one or more blanks by a single blank"

I was fucked.

I was looking for ways to assign inputs to string objects and call replace() functions. string objects don't exist in K & R C.

Objects don't exist in C.

In the end, the solution is so simple. If the previous character is a space and the current character is a space, don't do anything. Otherwise, write the current character to the output.

I had to google it.

It wasn't just the code. Setting up the development environment required more thinking than I had done over the past four years combined. My office network administrator treats every user as one with the skills and the intentions of a Russian hacker, which means that I can't install anything that requires changes to the
So I downloaded MinGW. Download, unzip and extract works better than an

Then I wrote "Hello, world".

* Most of what follows is probably humblebragging, about setting up an editor with
* C syntax support. 

I thought, "I need syntax highlighting. Notepad doesn't cut it." 

The usual suspects - Textpad, Multiedit, Notepad++ - were either no longer free or
used installers. 

Then I thought of Scintilla. Scite was a nice and easy to use Notepad substitute, with syntax colouring support for every language I'd downloaded -plus several that I hadn't. 

Downloaded it, unpacked it and found there was no executable file. 

Opened the readme file and it began with

"Scintilla can be built by itself. To build SciTE, Scintilla must first be built."

I needed either a Visual C++ compiler (recommended). The readme also grudgingly informed me that TDM Mingw32 4.7.1 was also supported. 

Oh Good. I had MinGW.

I followed the instructions 
To build Scintilla, make in the scintilla/win32 directory

cd scintilla\win32

Of course, the make failed. 
The compiler spat this message out and refused to proceed.

In file included from c:\mingw\lib\gcc\mingw32\4.8.1\include\c++\cmath:44:0,
from main.cpp:1:
c:\mingw\include\math.h: In function 'float hypotf(float, float)':
c:\mingw\include\math.h:635:30: error: '_hypot' was not declared in this scope
{ return (float)(_hypot (x, y)); }
Googled and found it was known issue with the MinGW compiler. Bug 2250, no less

The support guy's response was:

"I can guess that the problem is unwarranted occlusion of the
prototype for _hypot() in the presence of __STRICT_ANSI__,
while still exposing an inline function implementation which
requires it, but, as I say, I don't have time to pursue it at
present. The work-around is to add -D__NO_INLINE__ to the
compile time options, to hide the offending inline function
That made as much sense to me as you can imagine.
But I latched on to the word "work-around" and figured that I needed to change the compiler options. 


So where were the compiler options? 

I knew the GNU C++ compiler was gcc.exe. So I searched within the Scite folder for all files containing the words gcc. The search turned up a bunch of files - none of which seemed to fit. The only one that seemed to have any relevance was a file called scite.mak. 

Which began with the comment
# Make file for SciTE on Windows Visual C++ version.

But helpfully, it also contained this line

# The main makefile uses mingw32 gcc and may be more current than this file.

And yes, there was a file called makefile in the folder.
There was no use of the word "gcc" in it, but at some point, memory kicked in and I modified the CXXFLAGS to read  $(CFLAGS) -pedantic -fno-rtti  -D__NO_INLINE__

And what do you know, it worked.

And that was a rush. It was the equivalent of untying an irritating knot.

Any one who has pretensions of being a writer has only one thing on his or her minds. To connect. To move the reader. To make the reader feel. Making the reader think requires another set of skills altogether - something that's frankly beyond my ken.

And that's why writing code is such an experience. You can move an inanimate object. Say the right words, and the CPU will do anything you want. Say the wrong words, and the compiler will shit on you, until you get things right. And you're not home, even if your code compiles. A misplaced bracket, and the whole purpose of your program is lost.

Can you imagine how liberating that is? Here is a reader with rules! Here is a reader who gives you honest feedback. No more worrying about whether your friends 'like' the stuff you write - "ooh poor Nari, looking for approval again.  Let's like his post".
When you code, you either use le mot juste or you don't. And if you don't, your reader tells you where you've fucked up. To the line and the position in the line.

It's hard to explain to non-programmers the lure of programming. It shouldn't be. If you like writing, you should like coding. If you like reading, you should like
coding. If you like prose, you should like coding. If you like poetry, you should fucking love coding.

When I was in college - which is shorthand for "when I was young, innocent and romantic", I thought a great deal of poetry. And the best poet, to my mind, was Stephen Crane.

There's this poem by Crane called "A man said to the universe". It's just 24 words long, but it conveys so much. Crane would have been a great programmer, I think. He did so much with so little. And that's the glory of code. What you make of it is what you can make of a severely limited vocabulary - but that vocabulary is enough to send you to the moon and back.

Thursday, 26 March 2015

Who, Who? Random thoughts on sci-fi

I first heard of Doctor Who in school. This was back in the 80s, when I had the reputation of being a 'great reader of books'. It was Woody who asked me if I'd read any Doctor Who.
I understood it was science fiction.
When I was in school I was 'literary'. Which meant I sucked at science. I envied the guys who found physics easy. And I always had a sneaking feeling that I wouldn't understand science fiction. When Star Trek came on Doordarshan, I avoided it, until Narendran told me it was great fun.
Narendran was one of the smartest guys in school - and this was the first time he'd made a recommendation that was outside, well, lessons.
I watched Star Trek. I liked it. I remember Amok Time - where Spock goes nutso, not just because of its Vulcan mating season, but because Kirk is alive. But still, I never went crazy. Never watched the show obsessively.
Any way, it was Sci-Fi. The Sci was a put off.
It took a long while to get over the block. It was Star Wars that helped me through. The effects. The Star Destroyer. "You can't win, Darth" (that scene cracks me up now, after all the mythmaking about a Darth being the embodiment of Sith power. So essentially, Obi Wan says, "You can't win, evil overlord!". Of course, you could go for the Rakata origins - but I don't think Palpatine would suffer another emperor when he was around.)

In the meantime, India has lost, badly, to Australia.

It was in 2006 when I really turned on to Who. I'd been travelling to England quite a bit and I'd caught The Girl in the Fireplace while on one of my trips. I knew David Tennant from the Goblet of Fire movie, and one of my co-workers said that I should check out the series - and that Christopher Eccleston was the better doctor.

This was early on in Tennant's tenure. It was the fourth episode in series 2 - and his fifth full episode if you take the Christmas episode. People were still pining for Eccleston, and the 10-Rose shippers were still few. (Oh God, how I hate the shippers). This was before Turn Left and The Waters of Mars and Blink, before Tennant was the gold standard in Doctors (who the fuck are Tom Baker or Jon Pertwee, anyway).

I think I torrented Rose.

It was - unexpected.

The impression I had of the doctor from The Girl in the Fireplace was a jumble. The scene shifted from the court of Louis XV in 18th century France to a spaceship in the far future. Rose and Mickey were mostly bystanders and seemed to be comic relief. There were definite moments of tension, of course. The clockwork robots taking over the court. The wait for the doctor. The badass moment where the mirror shatters and the doctors rides into court. But still, without context, it was confusing.

The thing about Doctor Who was, at some level, was the weight of mythology behind it. Every comic writer worth his salt - Grant Morrison! Dave Gibbons! Alan Moore!!! - had written for Doctor Who magazine. The fandom was legion. The royal family. Stephen Hawking and Richard Dawkins. Patrick Stewart and Stephen Fry. Peter Jackson. Matt Groening. Douglas Adams had actually written for it - and Dirk Gently's Holistic Detective Agency was a recycled Doctor Who script. What else could Reg be but
a Time Lord, and what else could his his study be but a TARDIS?

You know that there are things you "like" before really experiencing them? You like them just based on peripherals, by things associated with them. If your favourite author becomes a gushing fanboy when talking about someone else, you want to check that person's stuff. If several people you like - across a variety of media - keep talking about the same writer or show or movie, the effect gets amplified.

But even so, seeking the book or show out takes a little push. It can be as simple as picking a book up in a library or store and flipping through the first few pages - and finding yourself thirty pages deep, reading. Or it can be sitting on a bed and flipping channels, jet lagged and tired, and watching something you've heard so much about come up on the screen.

Watching the first few minutes of Rose was comforting. Time and place, obviously London, the present day. Person - a shopgirl who gets up at 7:30 am, takes a bus to work, spends her lunch with her boyfriend, goes back afterwards, and goes through some kind of security check as she leaves.

And then the fun begins.

There's the basement, with ranks of half clothed mannequins standing silently around. There's Rose searching for Wilson (C.E.O, and it took me a while to figure out that it stood for Chief Electrical Officer) and then the door slams locked behind her - and the mannequins start moving.
Looking back, on rewatches, it isn't particularly scary, but when seeing it for the first time, it was creepy. The tension builds up, especially as the first auton starts moving slowly, jerkily and inexorably towards Rose.
We all know what happens next. Rose is backed up against the wall and someone grabs her hand and says "Run!"

And then there's the flight through the elevator and the exposition - the mannequins are made of living plastic, and they are controlled by a relay on the roof. And the Doctor - it is he, of course - has a bomb. He tells Rose to go back to her life of "beans on toast" and heads back into the shop ("Henriks" as per the signs, "Henricks" as per news reports) - then popping out for a minute for the introduction.
"I'm the doctor, by the way, What's your name?"
"Nice to meet you, Rose. Run for your life"

Eccleston was a surprise. No costume as such - just a functional leather jacket and a jersey. No ruffled shirt or scarlet lined cape - no crazy hat and ten-mile long scarf. Hair cut short, almost military. And the features. A big forehead. Big ears. A huge wedge of a nose. And that grin. That crazy-madman-having-the-time-of-his-life grin.

Series One was lovely. The Long Game isn't very good, Simon Pegg notwithstanding. The Dickens story was nice. There were the Slitheen in a particularly noisome two-parter. But that was all right - because immediately after that came one of the best fucking Doctor Who stories ever.


Im not going to go into the sheer brilliance that the episode was. Suffice to say that now you understood how exactly those metal bins could be terrifying - and everyone involved - Rob Shearman, Joe Aherne and most of all Eccleston himself - really got to show you what exactly a Dalek could be.

The episode also introduced the Time War - and why the Doctor was the last of the Time Lords (YANA notwithstanding)

The relationship between the Doctor and Rose was well done too - initially, its clear that she thinks that she is a child - obviously, given their ages. A smart child, but a child. He's like the adult having fun, showing off to the kids. But they both mature, and by the time the Bad Wolf/Parting of the Ways rolls around, the relationship has become sweeter - and more balanced.

From series one, the adventure continues, past Christmases and regenerations, past silent libraries and weeping angels and Martian waters, of 11th hour rescues and doctors' wives and cybermen and zygons and Masters.

In the end, Doctor Who is hardly science fiction.

Its just great fun.

And now, my re-watch begins.

Thursday, 12 March 2015

Saying Goodbye to Terry Pratchett

So Terry is dead.
I was walking home when I saw the email. It was from Penguin Random House and it began “It is with immeasurable sadness that we announce that author Sir Terry Pratchett has died at the age of 66.”
I didn’t read any further then.
Terry is dead.
It’s funny. Sir Terry Pratchett wrote books a continent away, and he was my friend. He was Terry. Not pterry, though I know that story.
It was 2000. I was in Hyderabad, and I was tripping on Harry Potter. On the Potter newsgroups, I came upon a thread asking for recommendations for other fantasy authors. Terry’s Discworld novels were the most frequently mentioned. There were wizards, one poster said. And there was a University full of them. Another recommended that the books be read in chronological order, from The Colour Of Magic on.
I bought The Colour Of Magic at a shop in Secunderabad. It was near Kamat, if memory serves me well. I think it was the Book Selection Centre. The shopkeeper had a shelf full of Pratchetts, and I thought, “That’s good. If this series works out, there’s plenty of stuff for me to read.”
As it turns out, there wasn’t nearly enough, but that’s another story.
I read TCOM. I was … underwhelmed. I could see that it was a parody of existing fantasy literature – I caught the D & D references and that Hrun was obviously Conan. I’d heard of Fafhrd and the Gray Mouser, though I hadn’t read any Leiber. It was also obvious that Bel Shamharoth was Lovecraftian. But I hadn’t read any Anne McCaffrey and only knew of Stormbringer from Nethack. It seemed that the author was trying too hard.
It was still better than most other stuff I was reading then. I bought The Light Fantastic a couple of days later.
The book was better, but still not wow! Ymper Trymon was a satisfactory villain, and I was getting used to the idea of a cowardly hero. And I loved Cohen the Barbarian, especially the quote about the best things in life being “hot water, good dentishtry and and shoft lavatory paper”.
I liked Equal Rites even better. But it took me long time to realize that Pratchett’s books weren’t always funny – not in the Wodehouse sense, which was what I had been expecting at some level. There was serious trope deconstruction, which was always good for a laugh, provided you understood the trope existed. But there was always a kernel of commentary there – about people, about attitudes, and traditions and ideology. And it always made me stop and think.
Take Guards, Guards – this was still early on, when it’s Carrot who is the hero, and Vimes is still a secondary figure, not the determinator-asskicker he would become with the later books. But even here, there’s this: “Down there - he said - are people who will follow any dragon, worship any god, ignore any inequity. All out of a kind of humdrum, everyday badness. Not the really high, creative loathsomeness of the great sinners, but a sort of mass-produced darkness of the soul. Sin, you might say, without a trace of originality. They accept evil not because they say yes, but because they don't say no”
Or take the entirety of Small Gods, one of the finest meditations on faith I’ve ever read. “Fear is a strange soil. It grows obedience like corn, which grow in straight lines to make weeding easier. But sometimes it grows the potatoes of defiance, which flourish underground.” Or “Every five years someone was elected to be Tyrant, provided he could prove that he was honest, intelligent, sensible, and trustworthy. Immediately after he was elected, of course, it was obvious to everyone that he was a criminal madman and totally out of touch with the view of the ordinary philosopher in the street looking for a towel. And then five years later they elected another one just like him, and really it was amazing how intelligent people kept on making the same mistakes.”
Or this one:
““Humans! They lived in a world where the grass continued to be green and the sun rose every day and flowers regularly turned into fruit, and what impressed them? Weeping statues. And wine made out of water! A mere quantum-mechanistic tunnel effect, that'd happen anyway if you were prepared to wait zillions of years. As if the turning of sunlight into wine, by means of vines and grapes and time and enzymes, wasn't a thousand times more impressive and happened all the time”.
By the time I got to Small Gods, I was hooked.
It wasn’t that all of Pratchett’s books were equal. There was the early instalment weirdness – the Granny Weatherwax of Equal Rites is nowhere near the Granny Weatherwax in Carpe Jugulum.  Vimes in Guards Guards is very different from the His Grace Sir Samuel in Snuff, character development notwithstanding. I found Pyramids weak among the early books. Among the later books, I’m not a fan of Monstrous Regiment or Snuff. But dear God, there were so many fantastic books inbetween.
There was Night Watch, my personal favourite – along with another book that I will come to in a bit, which has this quote about people who want to change society:” People on the side of The People always ended up dissapointed, in any case. They found that The People tended not to be grateful or appreciative or forward-thinking or obedient. The People tended to be small-minded and conservative and not very clever and were even distrustful of cleverness. And so the children of the revolution were faced with the age-old problem: it wasn't that you had the wrong kind of government, which was obvious, but that you had the wrong kind of people. As soon as you saw people as things to be measured, they didn't measure up.”
Since he’s gone now, there won’t be any more lines like this.
But Terry had Alzheimers. He was failing. He wanted to rid himself of his embuggerance by drinking a Brompton cocktail and “with Thomas Tallis on my iPod, I would shake hands with Death.”
He didn’t need the cocktail.
The other favourite book is Reaper Man, where Death comes to terms with his own mortality – while Windle Poons, Unseen University’s oldest wizard hasn’t died properly. After the adventure is over and Death is restored, he comes for Poons, who has been quite busy living in his un-life.
Poons and Death have a brief conversation.
Poons says “One lifetime isn’t enough”
“And, with great relief, and general optimism, and a feeling that everything could have been much worse, Windle Poons died”
I can see something similar playing out when Death came for Terry earlier today.
He was always angry. His best characters were angry. His characters were at their best when they were angry.
I don’t want to say “I hope he has no more need for that anger”.
I will miss the anger.
I will miss him.
I will miss the fact that I don’t know what the patrician will do to get Moist Von Lipwig to sort out the problem of tax collection in Ankh Morpork.
I don’t know how Salacia Von Humpeding will shape up in the watch
I don’t know what Tiffany Aching will grow up to be
But it’s OK.
There’s enough stuff in his existing books to keep me happy for a long long time.

Thursday, 5 February 2015

Trying to reason out Radical Islam - 1

When I was a kid, I used to travel to Hyderabad every summer vacation. One of those times, my mother and I shared the cubicle with three Muslim men. Sometime during the journey, they ended their conversation, spread napkins on the floor, turned east, knelt and offered prayers. I remember my mother telling me “Look at them – it doesn’t matter where they are or what they are doing. When the time comes for them to pray, they always will. How many of us (Hindus) are so devoted?”
Most of my student life – I gave little or no thought to religion. Part of it was spending 14 years in a very homogenous, middle class Tambrahm school. I can remember only one Muslim student and one Christian student. There may have been more, but that’s pretty indicative. And in college, there certainly was greater diversity, but religious diversity was lost in the bewildering array of “others” – Chomes. Bongs. Punjus. Kashmiris. Gults. Mallus. Gujjus. Surds.
Even afterwards, I never really thought of terrorism. Violence in Kashmir would be reported, read and forgotten. The Iran Iraq war was – like all wars – about territory and geopolitics. The first Gulf War? Securing America’s oil pipeline.
Then came Ayodhya. And then Dawood and the Bombay blasts. Then the Coimbatore blasts. Then the attack on Red Fort. All these were the result of the mosque demolition – we’d further alienated a marginalized group. And they were retaliating against an unfeeling majority. If the government claimed that it was the vile foreign hand of Pakistan that was rending apart the cloistral peace of our beloved secular nation, that’s what governments did – and what could you expect from an especially kakistocratic example that representatives made of themselves?
As I saw the planes crash into the WTC on 9/11, a part of me felt a grim satisfaction. “Now you know what it is like for the rest of the world,” I thought to myself. And I consumed the news that came out of the US from every source I could find online. I read about the PNAC and learnt about Neocons and Leo Strauss, of Wolfowitz and Richard Perle and David Frum. I thought the fight against the Taliban was justified and the war in Iraq was a BAD idea.
In the years that followed, the BJP and lost elections. Manmohan Singh demonstrated that it was PV Narasimha Rao who was truly the architect of reforms in India and Nira Radia showed how rotten the establishment was. And “Muslim radicalization” became a popular shorthand for everything from Moqtada Al Sadr to Ayman Al Zawahiri.

Which brings me to the point of what I’m trying to get out of my system. What does Islamophobia mean to me? What is Muslim radicalization? Is there something in the Quran and the way that it is interpreted – as some of my friends maintain – that is deeply inimical to the idea of pluralism in civilization?