Tuesday, November 30, 2010


November started off on a positive note with a presentation at uni that went off pretty well on the first day of the month. But plenty of other things that were planned didn't happen as expected, but it was a good month nonetheless.

I learned a fair bit of C, and can implement everything we learned up to now at uni using it. Object orientation and such are obviously not supported, but the workarounds exist and as many programmers say "C is easier to learn in its entirety, and that is the biggest advantage it gives a coder". Basically, when you know exactly what the language can and cannot do, it makes coding so much easier and more productive.

A thing I didn't get to do was visit ol' Tommy. The time elapsed since I last saw him has hit a new high of 5 freaking months! :( And I don't think I'll get to visit him this weekend either. Sucks ass.

A lot of the travel planned for November had to be shelved, especially due to the bizarre weather conditions. The family did visit Katharagama and the south, but it was a rain affected journey. The planned hike to Nuwara Eliya with Uni buddies didn't work out, and neither did Arugam Bay with Sai and the old thread gang. I did get to spend an extraordinary amount of time at Sai's place though (thanks for the lunches, Sai! :D And the lulz too.) Spending time with one of your best friends in the whole world who only drops by the island once every 15 months or so is one of the true delights of life. :)

Hmmm, so what else. Watched a couple of movies, including "Toy Story 3" (How the hell does Pixar impress over and over again like that???) and "The Social Network"  by David Fincher. The latter was one of the best movies I had ever seen. It had the obvious geek appeal for me ("OMG Zuckerberg uses Linux!!!") and also the first Beatles song in a soundtrack that I've heard in a long time (Baby, You're a Rich Man, off Magical Mystery Tour. Beautiful song.) But what I loved about the film is that he achieved in a couple of years things that most people wouldn't in their entire lifetime. And it made me think... What's the point of being called a geek, what's the point of knowing what a wget command does if you don't apply that stuff and do something exciting, do something that you can be proud of? Will you forever be remembered as a nameless faceless glorified typist who slaved away coding some buggy commercial software, or will you be remembered as a Torvalds, a Stallman or a Cohen? Someone who gave up a boring, well paying life to do something that they genuinely found exciting and worth working towards? It's something I'll have a long hard think about in the next couple of months.

Friday, November 26, 2010

Welcome to the rain-affected test match known as life*

11:21 AM

The downpour keeps steady as I gaze out the window on the second floor of Liberty Plaza. Hard enough to make the towers in the distance a barely visible grey silhouette, but not hard enough to drive away the people from the street. The street, as it runs in front of Liberty, has 6 lanes and is one way, though it functions like a 4 lane road. I love staring at the rain, more so when I'm safely behind a window. Yes, I'm evul like that.

Liberty cinema is playing a Hindi film called Guzaarish. Aishwarya Rai reminds me of a creep zombie for some reason. O_O They're playing an old Bathiya Santhush song called 'Tharuka', which I heard is based on a Hindi song. Earlier they played some hip-hop song which had the lyrics 'This is an awesome ring tone for your phone' in the rap. Hmph.

01:34 PM

We're walking back to Kollupitiya in the rain. The buriyani and doughnuts we had for lunch are getting digested. Talk shifts to malfunctioning computer parts and how to destroy hard drives without any scratch-marks and have them replaced. The school yard has filled up like a lake and a stream is flowing out into the road. Fucktards drive at breakneck speeds in the almost bumper to bumper traffic and splash water all over the pedestrians. I yell obscenities at 'em. Rain is fun.

2:51 PM

We're at the uni canteen again, Meshak, another friend of ours and I (Yes, in the middle of vacation. So what? We kinda missed the place okay?). The second years had decorated the common room with and the wall sported a sign saying 'Thank U'. I guess they threw a little party for the lecturers before 'graduating' from here and moving on to the bigger campus. I'm going to miss them. They were the polar opposite of our own batch, always together, having fun. Even from a distance, it was a treat to watch them. Le sigh.

* Okay, the title has got nothing to do with the post. But it does vaguely sound like something off Chinaman, yes? ;)

Friday, November 19, 2010

Pwnage on the cloud

Cloud computing is touted to be the next big thing. From Google Docs to Dropbox to Chrome OS, innovative applications are putting thousands of super powerful servers at the command of users like you and me. But non of these applications seemed that interesting. Granted, backing up to the cloud is one of the most failsafe ways to secure your data, but none of these things had that Ohmagawd effect. I was reading Gizmodo yesterday (sorry Jerry!) and I was hit with that effect thanks to this.

OnLive MicroConsole
(Image copyright Gawker media. Please don't sue me for unauthorised use!)
Think about it for a second. A game, rendered dynamically on the server, streamed to your home like a normal IPTV stream. Provided network latency is low (something that we really need to work towards in this country), your controller-strokes will be transmitted to some server in Palo Alto and the resultant scene in the video game rendered and retransmitted to your HDTV. It's like having a PS3 without having a PS3. And think about it, you don't have to worry about hardware upgrades, or buying expensive VGAs for the singular purpose of playing games anymore. The physics will be beyond awesome, the system requirements will always be met, and you don't have to deal with those pesky anti-piracy measures because there won't be any piracy anymore. If all the games run on servers, and no retail versions are ever released, there's obviously no way to pirate the games. It's a win-win situ whatever way you look at it. And imagine the amount of money spent on hardware that can be saved. You'll essentially be sharing a server with some dude in Bosnia, and while you sleep (due to the time difference) he'll be pwning away, and while he sleeps it'll be your turn. Playing multiplayer would be a breeze since inter-server connectivity is lightning fast (no need to worry about who's hosting and what his upload speed is anymore!)

And you know what the best part is? Servers hate Windows, because it is buggy, slow and expensive, where as Linux is stable, fast and free. The gaming servers will also need to run on Linux, which means... MORE GAMES FOR LINUX, YO! :D (side note: I discovered an open source clone of one of my favourite classic strategy games: Transport Tycoon Deluxe. It's called OpenTTD and it...is...AWEsome! A must have for any Linux user. There is a port for Windows too.)

All of that being said, I'm still not going to pay $99 a year to play games on my bullcrap internet connection. :P

Thursday, November 18, 2010

2nd Semester ST Project

The main intention I had when setting up this blog was to share coding related stuff and other content that would be deemed boring and too tech-y for my other blog. The following post is about an accomplishment of mine that I'm very happy about, and this seems like the perfect place to share it.

Software Technology was my favourite subject during my (recently concluded) second semester at SLIIT. We were blessed with a wonderful lecturer and assistant lecturer and this, combined with my love for code, resulted in one of the most enjoyable learning experiences I've ever had in my life, comparable to that time during A/Ls that we learned about sub-atomic particles and nuclear energy, or the time in 8th grade which I started my first website on Yahoo! Geocities. (RIP)

So, at the end of the semester, we had to do an assignment based on the stuff we learned. It was done in C++, in Visual Studio, this neat little Windows Forms Application. But all that Microsoft goodness came at a price, and our simple application was 1.8 megabytes large. Another drawback was that it wasn't portable, meaning poor old me couldn't compile it in my GNU/Linux machine.

So after we finished our semester, and began our two month long vacation, I reimplemented the program in C. I simplified the problem that we were given (it would otherwise need an insane amount of coding, which I - a lone programmer without the incentive of assignment marks - would find difficult to do), but also switched the data structure we used to store the records from a linked list to a binary tree. The advantages of using a binary tree would be  that searching and inserting would be pretty fast. I also did use a post order deletion method to ensure that every record on the tree was deleted before exiting the program, so as to ensure that there were no memory leaks.

My original idea for the C program was to implement it in GTK+ (a cross platform widget toolkit, itself written in C), but I settled for the command line in the end because I had no experience with GTK (and very little experience with C itself) and the learning curve could've been too steep to handle. But I did what I could do, and I finished up with this, a working system that does what does. :) And in the process, I learned how to use malloc and got a new found sense of respect for the 'new' feature in C++ which makes memory allocation so much easier.

So this concludes this long, boring and pointless ramble about a piece of code that doesn't really do much at all. But it is released under the GNU general public licence, not because the free software foundation needs crapware like mine, but because it feels so right to give back to the community that has given us so much, including (but not limited to) the OS that I'm using (GNU), the kernel (Linux), the distro (Ubuntu), the web browser (Firefox) as well as the compiler (GCC) and the text editor (gedit) that I used to create the program. Long live software freedom! :)

Thursday, November 11, 2010

The Southern coast in 8 pictures

Over the bridge...

past the temple in the sea...

a beach!

A wide deserted beach, with the softest, whitest sand...

But the sea is rough,

red flags are up,

what to do but walk away...

...at least the pool is tranquil.

Kinda ironic that I'm writing about beaches and sunshine when Colombo is undergoing the worst flooding in decades. What can one do but have hope in times like these.

Sunday, November 7, 2010

The quest for cheap slippers

I'm the kind of guy who wears slippers anywhere (apparently not Coffee Stop, guess that's another for my list of places to never ever visit), hopefully even to my grave. But my old pair of DSI Beach slippers are getting a bit old and I wanted something nice and comfortable to replace them. I always considered spending more than 200 bucks on a pair as blasphemy, but if you're going for the 200 rupee limit there's not really a lot of choice in the local market.

Trusty old DSI beach
The selection is further limited by the fact that I'm a bit anal about details. My ideal pair of slipper has to:

a) Be flat topped. No spiky 'health' slippers for me Sir, thank you very much.
b) Shouldn't be too thick.
c) The top and the bottom should both be very non-slippery, since I jump off buses in the rain in these things.
d) The shape should be the proper round foot-like shape and not hexagons or something.

So I begin my search at Bata. The slippers are a couple of cents cheaper than those at DSI, which is always a nice thing. There's nothing much in the way of colour selection, but dark blue or red with a white stamp on it looks pretty good. Things are going pretty nicely till I flip the slipper over. OMG, the most horrid underside I have ever seen. Plastic, baby... slippery slippery plastic. I throw away the failslippers in disgust and mosey over to DSI.

The DSI beach slippers look good. I like their blue, black and red colours, but their green and orange leave a lot to be desired. I spot this nice looking dark blue pair, but the price tag says 700 BUCKS. -_____- Stupid 'Walkers'...

So I guess there are two kinds of people in this country. People who spend 700 bucks so that their slippers look good, and those who don't. The vast majority of people belong to the latter category, but they're being kept away from slippers that have a semblance of style in them and are possibly being put at deadly risk with those stupid plastic undersides.

Why can't Bata make slippers like these anymore?

Elegant slippers for a more civilised age

Saturday, November 6, 2010

Rainy rainy Katharagama

I've been to Katharagama about a dozen times, and I never knew that it rained like THAT! On the 4th evening, just as we got there, it began to rain by the bucket-load. I hadn't seen rain like that since... since the last time Colombo got flooded! :D

At the end of the day, I was drenched to the bone... and shivering on the bed. The rain subsided somewhat in the night, as we made our way to Kiriwehera in darkness (the electricity supply had been disrupted due to rain) in a tuk-tuk taking a jungle road, all the time hoping that an Elephant won't emerge out of the shadows and just flatten the little thing into a roti pan. Kiriwehera in darkness (and ever increasing rain) was a surreal experience.

By next day though, the rain had thankfully ceased.

Katharagama Maha Dewale

These guys were out in force.
Elephant bathing in Menik ganga.

Sellakatharagama seems to have undergone a construction boom since the last time I visited, which includes the building of a new bridge, a parking lot, a suspension bridge from the temple to the parking lot and a beautiful hollow stupa.

The roads in and around Hambantota are beautiful, though they seem to have undergone a deterioration due to the construction that's still taking place.

P.S. If you ever go that way, don't forget to eat Yoghurt from the NLDB farm in Weerawila. That stuff is gooood. :O

Wednesday, November 3, 2010

Patriot: My take

Word of warning: Long and pointless post ahead.

Let's begin with definitions first.

Patriotism is love of country; devotion to the welfare of one's country; the virtues and actions of a patriot; the passion which inspires one to serve one's country.

Political freedom is the absence of interference with the sovereignty of an individual by the use of coercion or aggression. Freedom is commonly known as a state of being free from government oppression.

"L'Etat, c'est moi." (I am the state.)    – Louis XIV, King of France

First things first, country ≠ the government or the ruler. Loyalty to your country does not mean you should be loyal to your leader. In [an ideal] democracy, the government really has no say in what an individual can do with his life (as long as it's within the laws of the land) and cannot force him to do something that he refuses to do. This is a fundamental human right guaranteed by our constitution and this is why there are Fundamental Rights Petitions in the supreme court. That being said, Sri Lanka is not an ideal democracy. Not really because the paperwork isn't there (we might complain loudly against this 'bahubootha wywastawa' of ours, but really it's positively heavenly compared to, for example, what the Chinese have) but because there are thuggish ministers who are 'above' the law and can mess your life up pretty bad. Ministers with firm handshakes and funny laughs, actually.

So imagine you're Mr. David Senanayaka. You're the son of a famous General Abhaya Senanayaka, who gave his life serving the country. You're quite a hot commodity in the advertising world. You've got a nice wife who's expecting your first child, a mother-in-law who knits stuff for you and friends who talk of our glorious 'Hela Sinhala Buddhist nation' while sipping 800 Rupee lattes in posh Colombo coffee shops. Oh and you hate the government. Not 'hate' as in bitching at the dinner table 'hate', but hate as in "To hell with them, I will not work for them even if it gets me, my wife and unborn child killed." hate.

The reasons for this hatred is not really explained, but thanks to snippets of dialogue I theorise it's because:

a) He believes the government (of the time?) bled his father dry and left his carcass for his mother and him.
b) The severance payment wasn't enough to support them.
c) He believes the government is not doing a good job with post war reconstruction. ("The north got completely demolished by the war. Then why is so much money being spent on the south?")
d) He's wary of the 18th amendment.

So when your bitchy boss sets you up with a government propaganda contract which promises rewards limited only by the star at the centre of our solar system, you pick a fight with your boss, get drunk, badmouth the president of the country in front of his loyal coffeehouse electorate, and get whacked by the minister's thugs. The interventionists offered two plausible alternate endings:

a) Tell the minister to go shove it and leave country fast. Ironic since David is a 'patriot'.
b) Swallow your pride, shut the eff up and work for the government. You're in advertising for heaven's sake, you DON'T HAVE IDEALS! (What sort of messed up moral compass lets people make ads for 'fairness creams'?)

Okay, so final thoughts: You might think you love your country, but that doesn't make you a better person. (Example: me) You might think you're right and the government is wrong, that doesn't make you a patriot and them oppressors. It just means you have political and ideological differences. For all you know, the laughing foetus-murdering minister might 'love the country' as much as you do. There's no definite way of saying that you love your country more than someone else.

But in conclusion, in this country, loyalty to the head of state is more important than loyalty to the state itself. (Example: Compare Sarath Fonseka's present situation to that of Karuna Amman.) In this country, we shut up and keep our heads low, for love of everything we hold dear, and wait for the next election and hope the government doesn't rig its outcome. If you don't like the system David, you might as well a) cut the patriotic crap and leave b) enter politics and attempt to shake things up. Sorry for being blunt, but that's how 'we' roll.

I hear you asking, what's the point of this long and wandering post? My point is that the title of the play should've been "Political Freedom" and not "Patriot". Yes, I'm pointless like that.