The fridge at InterviewStreet office

We bought a fridge two days ago, and spent a day stocking it up. Perhaps it needs a bit more non-liquid content in it, but I think the choco fills and Dark Fantasy biscuits (not to mention the litres of Ice Cream we’ve stocked up on) would do just fine for now :)

And before you start harping on about ‘health’ – the bottom tray has a mysterious cover full of apples shipped from Chennai by mom.

Non-ASCII Characters in HTTP Headers

I was debugging an issue at work today where a (generated) file refused to download in Chrome, but the same URL worked just fine with wget. I remember reading in the HTTP Spec that HTTP headers can only be lower ASCII, so when wget mangled the output file’s name, the problem was obvious – the file name contained a character that wasn’t in lower ASCII (an accented A). Chrome had borked on encountering it, while wget soldiered on. Using iconv to strip non-ASCII characters in the file name on the server side fixed the issue.

Moral of the story? Read the RFCs! The HTTP one, in particular, is remarkably readable and you should read it if you’re doing non-trivial Web Development.

P.S: If I had had time, I’d have went around testing this behavior in several user agents and documenting their behavior (and possibly submitting bug reports) – but .

 

You are a programmer if you can run code in your head

From HN:

From my experience, the largest hurdle first time programmers have is being able to execute programs in their head. It takes a cognitive leap to go from the source code in front of them, and what happens at runtime.

(emphasis mine)

I believe that if you have made that cognitive leap, you can call yourself a programmer. It means you’ve entered into the second hump – you are a programmer. One of us. Welcome :)

This is also the reason why solving programming challenges at places like InterviewStreet Challenges, CodeChef, TopCoder, SPOJ, etc also increase your general programming skills – they require that you continuously run code in the interpreter in your head. Helps you train your procedural memory. Same reason why learning different language paradigms (OOP, Purely Functional, Procedural, etc) makes you a better programmer.

Reminds me that I have four more chapters in SICP to finish and Clojure to learn :)

 

Temptations

Just came across this beautiful piece of conversation that had me doubled up for quite while:

Him: The Nexus S tempts me. Only 20k.

Her: The Galaxy SII tempts me.

Him: Hehe, that’s way out of my range though.

Him: You tempt me!

Her: Hehe, that’s way out of your range too!

:)

“What is the best way to stop your child becoming an athiest?”

From the usually boring Yahoo answers, we have this gem of a question:

What is the best way to stop your child becoming an athiest?

I don’t want any of my children to be punished by God.

However, it also had this gem of an answer:

Do not educate them, or expose them to critical thinking, logic or science.

Lie to them constantly about how the world works. Feed them a steady diet of mumbo jumbo dressed up like real knowledge – the jumbo jet in the whirlwind for example – and pretend that it is deep wisdom.

Make them loathe their own natural bodies and functions. Convince them they are small and weak and worthless and need redemption. Tell them everything enjoyable is grievously wrong to even think about, and that their only fun should be in grovelling to an invisible friend.

Ensure that they resent anyone who is not like them in every way – skin color, nationality, political opinion but especially creed. Make such people out to be evil and vile and give them – impotent minorities all – the fictional power to somehow oppress and persecute the vast majority who do think like you.

Teach them to laugh at and dismiss out of hand any faith but their own. Early – early mind you – make sure they are taught the difference between superstitious deadly error – that one raving lunatic in the desert told the truth about a vicious god who killed people, and divine eternal truth – that another raving lunatic in the desert told the truth about a vicious god who killed people.

Instruct them with all severity and import to never question for themselves – to never think for themselves – to never live for themselves – but to seek answers only in one – just one – particular set of semi-literate bronze age folk tales.

Above all – and this cannot be overemphasized – make sure they cannot spell, use correct grammar, or understand basic English words.

That should do the trick.

It is, however, two years old. Maybe if Yahoo had not been the place where products go to die…

SleepSort from 4Chan

4Chan isn’t exactly what you’d associate with ‘shit, that’s a cool piece of code!’, but look what I found!

(via HN)

Nice hack. And it is O(N) in bitsize of largest number (Ignoring all the overhead of forking new processes, the problem with the race conditions(Sort 0 and 0.1? How about 0.01 and 0.011?), processor contention, etc,.) They basically delegated the sorting to the process scheduler, treating it as a sort of priority queue.

Sometimes you just see a hack so out of the box that it makes you say ‘woah!’ and let your mouth hang open there for a while. One such time this :)

Devlog May 2011

May 25-June 13

Loads of things happened.

Finished/polished up ShortUrl. Pending review. Would go into not just tawiki, but possibly all wmf wikis. YAY!

Moved to a dual monitor setup. Dual 23″ Monitors, one Samsung LED and one Acer LCD. Also moved to 8G of RAM. VMs are much less painful now.

Did a few back/forths with the GSoC extension architecture. It’s still blocking, so working with the non-blocking parts of GSoC now.

Moved to bangalore, atleast temperoarily for now.

Did a tiny bit of work for a friend organizing MP3s with a script. Was fun, operating at that scale. Helped me get back in touch with bash/awk etc.

Rooted/Flashed my Galaxy 3 with a custom ROM. SO MUCH FRIGGIN BETTER, WHY DID I NOT DO THIS BEFORE? The audio is now atleast a few orders of magnitude better.

Moved blog to wordpress. Archived the HiSlain project.

Got my camera. Need to postprocess more. But still :D

May 25

Put in a lot of effort into ShortUrl. Want to finish it up and push it to prod before ‘leaving’. Also learnt a bit more vimfoo. Moved it to svn and got it ready in translatewiki

May 17-24

Nothing positive done. Whatsoever. At all. Exams done, yeah. That’s about it.

May 16

Some TwitterBots work. Increased vim-fu a bit more. Got started on interviewStreet.

Also some work done on new version of ShortURL extension.

May 13-15

Talked out with mentor about components in my GSoC. Got toolserver account. More work on MarathonSin – @ssnbot now runs on it. Moved them all to a server. Increased my vim-fu a bit. Released 2 new versions of yenWikipedia, using a cache to reduce network traffic.

Still not productive enough. The number of Commits I’m doing per day is at an all time low…

May 12-13

Wrote MarathonSin (Declarative Twitter Bots) to keep myself awake. Started on the detailed plans for Mediawiki GSoC.

NEED.TO.BE.MORE.PRODUCTIVE.AAARRGGHHH

May 10-11

Nothing got done for last 3 days. Tried resetting sleep cycle twice, failed.

Did some SICP exercises. Whiteboarded components for GSoC. Nothing much. Sigh.

May 9

Reasonably productive day.

Finished PoC. Talked about bringing back ShortUrl Development. Started doing design work for rest of GSoC project. Read up on MySQL a bit more.

The other thing is coming along nicely too.

May 8

Not very productive day again.

Wrote sql for PoC. Read up on the db functions. Looks like I’ll be done with the PoC by monday.

Went on a Star Trek mini-binge. Tapestry was incredibly timely, even more than usual. Ended with me laughing alongside Picard when he gets finally stabbed. I think I made the right decision :)

May 7

Half of PoC is done. Calling it GPoC. Went off to sleep, but couldn’t so came back and worked. Feels good.

Have a basic extension. Figured out that I can’t just grab a preprocessed DOM off any hook. Need to work that out, but since this is just a ‘Proof of Concept’, I can get away with just running preprocess again. Also investigated the Job Queue and the data table update stuff.

Helped out @msnarain with the #goldenrulesofchennai bit. Wrote code to retreive more tweets further back out.

May 6

Need to break free. Not productive much. Got started on PoC. Ran around trying to get myself camera. Failed.

Helped msnarain with some ‘goldenrulesofchennai’ bits. Let’s see how that works out.

Three days of failure in one day.

Ah, took heart after that, sketched out plan for completing PoC. Looks like one – two days work to me now. Let’s see :)

May 5

Again, not much code. Slight work on geekweekend.in. More progress on planning for PoC. Turns out I don’t have much of a chance making it to Israel. Sigh.

Again, not a very productive day.

May 4

Nice productive discussions with rkirti about various issues. Thanks for doing that :)

Started writing design docs for my GSoC Project. Need to codename that.

Unproductive day code wise.

May 3

My Language Wikipedia works on DuckDuckGo standard. Had given up getting it to work, but the DDG guys pinged me on twitter about it and I had to respect that, no?

My pull req for opensearch module was accepted. Yay.

Made geekcalendar.in. Built a very very tiny static generator that generates it. Deployed it. Tried compass/sass, but in the end came back to plain blueprint+CSS.

Got Ubuntu+Unity and Win7+Photoshop+Fireworks to work under Virtualbox. Yay! Fixed hard disk too.

May 2

Started talking to awjr about beginning GSoC work. My prelim work starts tomorrow, with a Proof of Concept.

Started work on making My Language Wikipedia work on DuckDuckGo.com as well.

Also started work on transliterated search for wikipedia. Fundamental ideas are in place.

Made a commit + pull req for opensearch python module, to let it support setting useragent (since wikipedia will 403 you if you don’t identify yourself)

Met vimzard, sujeet, kashyap and others today. Was fun. vimzard has grown taller.

May 1

Made two releases of My Language Wikipedia extension (formerly yenWikipedia). Works in Google Instant, and Options page auto opens now.

Did some brainfuck related language work. Should complete those soon.

Bought a new domain (geekcalendar.in). Should build/launch it soon.

Note from Present Self to Future Self: Pre-Book your Travel Tickets

Dear Future Me,

I know you don’t want to pre-book travel tickets. You tell yourself that you like the sense of adventure and uncertainity that it gives you. You tell yourself that you need these life expriences.

But I know the truth, ofcourse. You’re just plain ol’ lazy. Too lazy to book your damn tickets. So, get off your ass and book them now. I’ll promise you that I’ll hunt you through time and kill you. Also, I have unlimited access to almost all your past selves (since they will be my future selves), so I might just as well kill them.

So, BOOK YOUR TICKETS, IDIOT!

Sincerely,

Irritated Present Me

 

So, I broke a law by photographing a clock in a railway station

The Forbidden Clock

(Update 3: Manish (@jimanish) was awesome enough to point me to the official stuff from Railway Ministry (pdf here). It starts off by stating the cause for the rules being strict:

A case relating to lapses in allowing shooting of a feature film (which resulted inburning/damage of some passenger coaches provided to the party causing a huge loss tothe Railways)

It then notes that it’s archaic, since you can even shoot from mobile phones, etc. The first few pages give you hope, because they actually read like they were written by normal people (mass reach of still/videography equipment, pointlessness of enforcement, time wasted by enforcement, etc).

However, they then go on to list the list of documents you’ve to submit to whichever people (possibly in different cities), and pay fees (waived if you’re using it for non-commercial purposes! Be grateful!) and then you can take photos. Multiple levels of bureaucracy, that would perhaps set a Vogon salivating. It also goes on to tell you that in certain cases all these can be waived if you can get stuff written to the appropriate level. Sigh.

So, yes, this rule exists. You cannot photograph railway stations without prior permission from a lot of people)

 

(Update 2: Expert governmental bureaucracy navigator @Planemad (Arun Ganesh) offered first hand experience/advice on flickr that I’m reproducing here:

Ive taken pics right in front of RPF personnel, locomotive pilots and other railway people and have never run into any issues. A law does exist, but is not enforced in normal circumstances, especially with cameras becoming a common gadget.

If you ever run into issues at the railway station, the most sensible guy with authority is the station master, and you can be pretty sure he will understand the situation and sort things out.

The RPF guys are better avoided, its a frustratingly shitty job and they dont miss an opportunity to victimize someone who has strayed into some gray area of the rulebook, especially when there’s nobody else with authority around.

Sounds good. I’m sure I wouldn’t have run into issues even if the guy had taken me in, considering he was drunk. Also, somehow, I think the fact that I was shooting with a DSLR was a factor here)

(Update: Sundar (@oliglot) points me to these guides (1, 2)about the laws in place. In short, *yes* these laws exist. Yes, they are stupid. And no, I’m not going to shoot at railway stations anymore. And I’d advice anyone against doing so too (unless they are expert at bribing people (which I’m not, and which isn’t something I condone)) – just heard another horror story where a young guy with a compact was ‘arrested’ and beaten before being released on being bribed. Sigh)

The law in question is one that says you need permission from two different government departments before you can take pictures inside railway stations. The law itself is not certain – my twitter timeline could find only this reference (thanks @cnu!)- and that seems very much focused towards foreign nationals. I’d be glad if anyone could tell me if such a law really exists. I don’t go about breaking laws for fun – laws exist for a reason. This one, however, just feels so much like just an employee out on a power trip than a law designed to keep someone safe – so my guilt/strong moral compass doesn’t kick in.

Now, the story is simple. I was on my way to Velacherry, my preferred form of transport being the MRTS. I was at Chennai Fort station (incorrectly tweeted as Park, apologies), and since I had just missed a train and had to wait 20 mins for another one, decided it would be a good time to test my new 550D.

So I start shooting randomly. It’s been a few years (3?) since I’ve shot photographs ‘properly’ (and then my camera broke), so it took me  a while to get my lines straight and framing right, etc. I shot off quite a few photos, though only three turned out flickrworthy.

Just a few minutes before my train is scheduled to arrive, I walk along and notice this awesome old clock (pictured above), all dusty and not working. I take a picture. Immediately, an obviously drunk (and old – I’d suspect 50+) railway employee (he had a Union card prominently displayed out of his pocket) started screaming at me. His basic argument being variations of:

“Who the fuck do you think you are, taking photos inside railway stations?”

“I’ll put you in jail and beat the shit outta you, I’m (part of|know the) railway police!”

<words about me/my upbringing too harsh to print, even on this blog>

All were in Tamil, repeated, and spoken in a way that made it very obvious that he was drunk. Unsure of how to deal with this situation, I slowly backed away while keeping my mouth shut. This only seemed to enrage him more, and the abuses/threats increased in intensity. He was screaming for well over two minutes. I never opened my mouth.

The train arrived, I got on it, and went on my way. A few bystanders who witnessed the whole situation (but did nothing) told me to chill, that that was just a drunk asshole I should ignore, and that yes, you need prior permission to shoot inside railway stations. I wasn’t sure such a law existed, so I asked around on twitter and got contradicting opinions (jury’s still out on weather such a law exists).

So, what should I have done?

My options were pretty limited. I think staying shut was the best course of action – you can’t argue with a drunk guy, much less a drunk entitled government employee on a power trip. But, I’m sure more experienced streetphotographers would’ve handled the situation better. How do you think I should’ve handled it?

Photographer Rights

This isn’t the first run in I’ve had with Government Employees regarding photography (the last time was when I photographed some traffic police resting in the shade on a hot summer day, they questioned me and made me delete the photographs. That was four years ago though), and I’m sure it won’t be the last…

Thomas Hawk has a lot of posts about how Photography isn’t a Crime. They are, however, US specific, and hence I don’t think I can rely on them in India. Also, even if Laws do exist, they are not enough to save me – nothing will protect me from a policeman who smashes my camera and then arrests me on a false charge because he thinks you were going to use his photograph in some demeaning newspaper article (you know this isn’t far fetched). I love doing street photography, and am wondering how exactly I can keep myself safe. Photowalking in large groups is one, any others?

P.S. Props again to Vijay and iRatzzz for calming me down right after the incident. Also thanks to HP:MOR (read this chapter and you’ll understand).

Why working at “Big Co” is unsatisfying

Update: As usual, good comments at HN.

I’ve been trying to put it in words for a while, and failing utterly every time. swombat gets to the crux of it wonderfully:

At the same time, something really bothered me about my work. It felt pointless. One project I did (whose output was basically a PPT and Word document outlining the successes and failures of a client project), which took two and a half months, had, as its only apparent purpose, the promotion of the person who had led the project. Accenture was paid (quite well) so that I would sit there and produce a piece of paper that justified this person’s promotion.

To me, that didn’t seem like a good use of the precious few years we have on this Earth. In fact, the feeling that I was wasting my time was really killing me inside (I’m not exaggerating).

My life in Accenture before Startups

Indeed. I’d be surprised if anything in the Indian “Big Companies” are any different – perhaps worse (thoughts/experiences?).

There is a silver lining though:

One of the most crucial things I learned in Accenture was how to hold back my habit of being blunt and direct with everyone. I learned to be smoother and far more effective. That’s a valuable thing to learn.

As Vijay would tell you, that’s something I’d definitely find useful – something that every geek would find useful (relevant link about geeks being assholes, and excellent HN comments). Perhaps a stint at Infosys would help me there? :D