Archive for the 'Uncategorized' Category

A public apology

I would like to apologize to the FOSS community for saying some things I shouldn’t have. I take complete responsibility for my actions and statements. I don’t know enough to have said some of the things I said and have removed the offending article. In a moment of weakness, frustration and foolishness, I wrote something without paying attention to what I was writing. Eventually, all hell broke loose and I became a pincushion and the worst place to be at the worst time.

I have much to learn and the only defence I can offer is that I had a horrible day and wanted to let something out. I shouldn’t have spoken so harshly and ignorantly about something a lot of people feel so passionately about.

I only wanted to contribute something back to the community. I’ve organized countless tutorials in college, contributed code whenever I can, and am even doing a summer of code project. I was even convinced after spending last summer working at Google that I should dedicate myself in the future to helping open source some way or another. But suddenly I’m reduced to answering so any hateful emails from the same community I admired, and still admire.

I truly realized the weight of words today. How everyone from your friends to your own parents look down on your mistake - just because your opinion differed from someone else.

Today is my birthday, and while normally I do not pay heed to anything like this, I am wishing that I go back to being the regular metal-head guy who writes code once in a while - not the evil C# developer who wrote ill-formed rants against people. I also wish that a consensus be reached on the conflicts plaguing the community today, if it weren’t for which I’d be outside enjoying my weekend.

My weblog will go permanently offline in 48 hours. My frequently accessed articles on the django-comet bridge will remain. I am going to go completely offline and focus on making tangible contributions to the community and becoming a better programmer.

I will appreciate any constructive advice via email - you can reach me at anirudh@anirudhsanjeev.org.

Easy and powerful natural date parser.

A few months ago, I wrote a patch for Tasque which is a really neat TODO list manager. This allowed you to create duedates on tasks with absolutely no effort

Since my current project (TaskForce) is sort of a TODO list on steroids, I thought I’d pull the patch back out of the deepest corners of gnome bugzilla and use it in my own project, and also decouple it and release it while I’m at it.
It accepts a string, and extracts a task and a date from it.

This is a natural date parser for C# - it allows you to specify a task with a due date and it extracts a valid DateTime object and returns it.

Examples:

I’m pasting the XML documentation of the source code.

		/// Original Task string: "GSoC Proposals due before 3rd april"
		/// The Task is:"GSoC Proposals due" and the due 4/3/2009 3:51:09 PM
		///
		/// Original Task string: "Lab reports due on monday"
		/// The Task is:"Lab reports due" and the due 3/30/2009 3:51:09 PM
		///
		/// Original Task string: "Date at 8PM this saturday"
		/// The Task is:"Date at 8PM" and the due 3/28/2009 3:51:09 PM
		///
		/// Original Task string: "New years' on January 1st"
		/// The Task is:"New years'" and the due 1/1/2010 3:51:09 PM
		///
		/// Original Task string: "Study solid state pysics on tuesday"
		/// The Task is:"Study solid state pysics" and the due 3/31/2009 3:51:09 PM
		///
		/// Original Task string: "Solid state physics test next tuesday"
		/// The Task is:"Solid state physics test" and the due 4/7/2009 3:51:09 PM
		///
		/// Original Task string: "April fools' on 1st"
		/// The Task is:"April fools'" and the due 4/1/2009 3:51:09 PM
		///
		/// Original Task string: "Friend's birthday on Feb 5th"
		/// The Task is:"Friend's birthday" and the due 2/5/2010 3:51:09 PM

Features:
* Extremely robust guessing - if you say “Mid term eval due on 1st”, it looks for the first of next month and adds it.
* Supports natural constructs - if you say “some task due next tuesday”, the task string is “some task”. If you use on/before/during/this/due, those are treated as date descriptors. Moreover if you say “Fix this bug due tommorow”, the task is “fix this bug”. If you say “Fix bug this friday”, the task is “fix bug”.

Usage:
This is written as a simple, uncoupled, highly cohesive class “NaturalDateParser”. Since the name of the class or namespace isn’t mentioned in the functions of interest, you can always extract it and place it in your own code.

To use:

	string input, task;
	DateTime dueDate;
	input = "Mid term evaluations on 6th";

	NaturalDateParser.GuessDateFromString(input, out task, out dueDate); // this has to be in the same namespace

	Console.WriteLine("Output: {0}, DueDate: {1}", task, dueDate); //Output: Mid term evaluations, DueDate: 07/06/2009 11:28:21

Download:
To get the latest version of this class, clone the github gist:
# git clone git://gist.github.com/140483.git
or you can view it from: http://gist.github.com/140483

The code is licensed under the liberal MIT/X11 license. Use it in anything you wish at your own risk.

Unit tests:
I wrote NUnit tests to practice writing the C# tests. If you need to have unit tests for this class, email me and I will send them to you.

A letter to myself

I turn 22 in ~3 hours. Never cared much about birthdays but for the past three years, I write a letter to myself one year in the future, and ten years in the future. I use http://www.futureme.org who’s never forgotten to send me my memorabilia.

Two years ago, I had hit rock bottom in my life so far. I wrote to myself asking to have changed, and last year was a more pleasant email.

Here’s what I hoped to have achieved by this date:

  1. Got an internship at Google or somewhere similar. (I was at Google when I wrote it) [DONE]
  2. Got a tattoo which is 2in x 2in and says “42” and nothing more. [DONE] :)
  3. Clear out all pending courses. [DONE]
  4. Lose last remaining excess weight to a target below 64 kilograms. [DONE]
  5. Learn to stay in the here and now. Focus on the task at hand. [DOING]
  6. Write a good deal of code. [DONE]
  7. Run the 7 kilometers in under 40 minutes [Did it in 31].
  8. Spend more time with friends, and force them if they are busy [DONE]
  9. Migrating the website to Appengine or something. [Meh. if it ain’t broke, don’t fix it]

It’s nice to be able to go back and see what I was up-to two years ago due to the fancy archive feature. It feels good to know that you did what you intended to do, and maybe even a little more.

I’m off to write an email to myself, which will be delivered next year. If you’re reading this – future me, Hello!

Project Conn’r – Easy, open, cross-network communication framework

Close connection - Verbundenheit by alles-schlumpf.One Minute Sales pitch: Conn’r is an open source platform to allow developers to build applications that allow users to exchange realtime information freely between a user‘s client and all the other social contacts from existing social networks – thereby making the humble sign up form redundant. A user with any social network credentials can communicate with another user of the same client as long as they share a common link on atleast one of the many (extendable) supported social networks. This library is being written to prevent companies like Facebook, Twitter, and Google to have sole control over being able to write social applications that exploit their friend graph. With Conn’r - anyone can write an application that works out of the box with all social networks.

Let me illustrate with an example. Suppose I want to write a social whiteboard client application – where users can collaborate with friends and come up with new ideas. I would have to create a new network, add a friend graph database, and make multiple architectures, including a realtime comet-based communication architecture. Last but not least, users will have to sign up and ask others to sign up as well – something which will cause adoption percentage to drop.

If a developer uses Connr to handle all the communications instead, all a user has to enter his/her credentials for any major social network like Twitter, Facebook, MySpace, Google, FriendFeed. The Connr framework will identify all of your friends and send them to a confidential server (which will also be open source). Since the server has also got information of all the other Twitter, Myspace, Facebook, etc users available, it looks for all the relevant connections and connects the users using a jabber bridge.

connr

To illustrate roughly how conn’r works, I have drawn up a rough flowchart. It’s largely self explanatory, and you can download a high resolution version of it or the original .dia source.

The framework does two major functions:

  1. Determine social connections, and find out which of them are connected to the same Connr server.
  2. Abstract a jabber connection by making sure that clients are compatible and to send data of unlimited sizes.

To write an application like Google Wave – with realtime communications between all your friends will become absolutely trivial. We envision a new wave of applications where any user is not limited by what social applications his network provider builds. You can build desktop client apps which use this functionality but also build web-based applications which do not involve a sign up procedure.

The development team:

The project has finished the planning stages. My friend from college Sanket Agarwal is looking into automating Prosody, a blazing fast lua based XMPP server, which we will use to handle the communications, he will start writing the serverside components to match users from various social networks in either C++ or Scala. My personal involvement so far is only the idea, and part of the C#/Mono client library which was extracted from another file-sharing type project I had tried to build earlier.

We will be hosting all our code on Github and I own http://connr.com so I guess the project will live over there. The name was originally for our anonymous chat project but I feel this one has more steam.

(Image from Flickr user alles-schlumpf. Creative commons by-nc-sa)

Congratulations Omegle, you beat us to it.

Over the past couple of months or so, me and a friend were working on an idea, and we kept the details of the same mostly to ourselves. It was called “Connr”, a shortened version of “connector”.

The whole idea was to connect a visitor to another random visitor and let them speak. It was a good idea, and there wasn’t really anybody else who had an idea like this. We were planning to launch early next month on an amazon EC2 server.

Today, I found out about “Omegle“, a service that does exactly what ours does. It received coverage from many major weblogs, including XKCD’s, thus making our product completely redundant even if we do decide to launch it. While our product was more impressive on the backend, and we already figured out how to solve some of the problems that they are facing, they were first - and in this industry that’s all that counts.

While we are terribly disheartened by our idea not making it into the big league, we learnt a lot, and we’re glad that an independent student like us, rather than a faceless corporation got in on this idea.

I would like to wish Leif Brooks, creator of Omegle the best of luck for a successful application.

How to send 420 characters per twitter message

I’m not a big fan of twitter since I closed my account a year ago. I was sick last night and watching the Colbert Report because I couldn’t sleep and Stephen Colbert was interviewing Biz Stone, cribbing about the 140 character limit. I had an idea which seemed great when I thought of it - to apply some on-the-fly compression by exploiting text encoding. Now the idea doesen’t seem so shiny after all.

Abstract:
To send upto 420 characters per twitter message. This will be done by processing the large text to fit into 140 characters. The 140 characters will be the same length and will not appear differently to the server, but will be a jumbled mess of text for any human who reads it. But on running an inflation algorithm on the same text, another user can get back the 420 character message.

Background:
Today, we’ll be exploiting the encoding that Twitter uses for it’s text: UTF-8. UTF-8 is variable length from one to four octets for each character. Since most english messages use ASCII character set, only the first octet is used, and any ascii string is utf-8 compatible by default. It’s a fantastic idea that saves space, and allows the full unicode alphabet because of it’s enormous size in case all four octets are used. Most of the regular english content that you read ever uses more than two or three octets.

Core Idea:
Construct a utf-8 character with 4 bytes. The first byte signals the start of a 4-byte sequence(thus having a value between 240 and 244).
Use each of the three octets to store a different ascii character. This way three ascii characters appear as one utf-8 character, thus only one out of 140 characters is used up. To deflate, read one utf-8 character, and interpret each of the final octets as an ascii character.

Technical complications:

  1. The first byte can’t be used :(. It has to be a value between 240-244.
  2. The second, third and fourth byte can have only 0×80-0xBF (that is 128-191) as the content. This means the size of the character set that we can compress is 64. Sufficient for Alphanumeric characters and spaces. UTF-8 is not to blame here however. A full four-byte encoded character can have 64*64*64 variations (multiply that by 4 considering that the descriptor byte in the first slot can have four combinations), and you get yourself a fine encoding format.
  3. Any non-alphanumeric character would be left alone because it won’t fit in the space that we have for each octet.
  4. Any string polluted with non-alphanum characters would compress real poorly. Consider ‘http://is.gd/1f4′ or something like that. ‘htt’ will be one character, ‘p’ will be one, ‘is’ and ‘gd’ and ‘1f4′ would be singular characters. The code will have to make sure that we don’t use 4 octets by default, or fill in the remaining octets with blanks and discard them during inflation.

Implementation:
I’m guessing the implementation is easy enough, though text encoding is one of the hardest things for me to get right. I’m going to try to use the System.Text.UTF8Encoding and Sytem.Text.Encoder classes to read the bytes and re-construct a new string. I’ll dump the code here when I feel like it.

Ideally, there should be implementations in each major language - javascript, python, C++, C#, actionscript - which are used to write twitter apps. Ideally, a greasemonkey script can be run which looks for compressed utf-8 text and decodes them in the twitter page itself.

Disadvantages:

  1. All clients should necessarily have an inflation script running.
  2. Supports only alphanumeric characters+space
  3. Won’t be searchable.(unless you re-encode the search query itself)

Closing words:
Die twitter! die!

Suse Studio is overflowing with awesome.

After about five months of waiting, I got invited to Suse Studio Alpha. If you don’t know what Suse Studio is, and you are interested to know what it is, (congratulations, you are part of a very small sample set) it’s this:

Suse Studio as far as I used it, is a tool to help you build Ready-to-deploy variant of the opensuse 11.1 distribution. The only catch is that you can have as many or as few packages as required. This allows you to build very specialized “appliances”.

If I wanted to make a distribution catering specifically to multimedia based packages, it’s a throwaway task. You go to the website, add packages from their intuitive web2.0-ish application, and click build. Ten minutes later, a spanking new application is ready for your usage.

I see several use cases of this:

  1. A power user who also uses opensuse can make a distribution perfectly catering to his/her taste.
  2. Perfect for deploying specialized tools in offices, etc. I can make a appliance catered specifically for java development(and later, stab my head with a butter knife), and deploy it on thousands of computers around.
  3. Many more, I’m not going to elucidate here.

If you are truly interested in finding out how it works, you can see the screencast over here.

But here’s my two free-as-in-beer cents on the tool.

  1. Oh god! How did they even manage to build that thing. It’s mind boggling. And they made it a web application. Holy shit! It builds an ISO while you sip coffee! The only thing that can make it better if it can automatically do all your work, write a few research papers for you and store them on the image so it’ll be on your desktop when you start using it.
  2. Will this convince me to move out of my long-term relationship with debian/ubuntu? Probably not.
  3. Will this convince me to build the most badass distro, and waste an evening trying it out when I should be doing something productive? Heck yeah!
  4. While there’s no point in this for me, there’s no doubt that a lot of people will find this really useful to distribute customized applications.

You can look at a screenshot of how it works for me. I was building an appliance with lots of development packages. Finding packages are realy easy with the feature of “patterns”. It’s sort of like groups of packages, like “C++ Development” which do not deserve their own category yet.

I would love to see a tool like this for debian. I’m pretty sure it won’t be much harder than suse’s tool to build. The clock counts down before the open-source hippies ruin a great tool’s reputation claiming that the server-side code is proprietary, despite knowing that it runs on server farms and took a really long time to get running.

Rest assured, this is an awesome product which will make a big impact and not just a novellty(the puns!!! someone make them stop).

Identity Crisis

Anglicizing Indian names in the US is quite common these days. Let’s face it, some names are hard to pronounce. When I was in the US eight years ago I remember mine getting butchered in as many ways as one can count. A few people who knew they had to stay abroad for a longer time did not want to have to spell out their name or correct pronunciation every time they met someone new.

For example, my friend and mentor, Vikram Dendi, who was in the US from his undergraduate times claimed to have shortened it to “Vik” every once in a while when I met him in Bangalore.

Over the past eight years, somehow, people started calling me “Andy”, and it’s stuck surprisingly well. It’s rare to find anyone call me by my given name in college, not for any cultural significance but rather for the sake of convenience. You can’t beat a one syllable name.

I’ve been talking on mailing lists and on IRC more these days and am starting to wonder if I need to regularly use my anglicized name in my online collaborations. The short answer is yes, and the long answer is too boring to put down here.

So I decided I’ll just use my utterly cool domain name which is lying around stale for email. I will be using andy@ninjagod . com for my purposes. So if you can’t remember my name or email address(why would one even need to?), you’ve got somewhere new to fire it off to.

Billion Dollar Programming Language

PHP

(pause for laughter)

PHP

(pause for more laughter)

PHP is RETARDED.

(pause for applause, laughter and cheers)

Now folks, I’m usually very diplomatic and politically correct (except when it comes to java), and a jolly and cheerful guy, but I have to ask the PHP blokes one question:

Why the fuck does every variable have to have a “$” behind it, when every other sane language (I know about perl) manages to do otherwise.

I know PHP powers most of the internet and Wikipedia, heck it powers this website right now. I’ve even written well over a few thousand lines of PHP myself. But for some obscure semantic or parsing benefits you just screwed up a great concept of a easy to deploy serverside scripting language.

Here’s why I think having a dollar behind every variable is pants on head retarded:

  1. Press the “$” key right now. Note that you press the Shift button with your pinky. We do this upto four times a line of code (mostly for () and {} and the occasional badass regular expression). And if you think the emacs pinky is bad, wait till you get PHP pinky
  2. While all programmers would be as useless without a shift key as a ballet dancing sumo wrestlers… I really don’t know how to complete this sentence.
  3. It’s easy to mistype or forget typing it, and very hard to type it considering functions don’t have it and only objects do. And you go ahead and choose a fucking *backslash* as a namespace seperator (don’t believe me, see this article).
  4. Seriously? Backslash? As a namespace seperator this\is\how\it\looks, not to mention wreck unforseen damage for vi users. *backspace* would’ve been a less retarded choice as a namespace seperator.

I hope the django pony kicks your teeth in.

Disclaimer: I’m pissed and ranting. This post is stupid and will be prolly taken down. Moreover, none of my logical docile posts ever get any comments, and I feel the need for collaboration.

Anomit Ghosh, I’m counting the minutes before you put across your $two $cents on the topic.

Morons. All of them.

Just because Jerry Seinfeld, George Carlin, and Randall Munroe can be funny whenever they want to doesen’t mean you can.

April fools’ is the time of the year, when everyone thinks they’re being funny but they’re just being dicks. And when someone thinks pictures of cats with horribly disfigured grammar is funny, you know it’s going to get really pathetic. I’m talking about you - the Internet.

A lot of people know that I have a short term memory length of nearly three seconds in the morning. I spend about five minutes reading my feeds in the morning and I was pleasantly surprised to see interesting and breaking news just to get fooled, and this happened six times in the morning.

I’m pretty sure a conversation like this has happened several places in the world at this time:
Billy: Hey grampa, <enter tragic news here>
Grampa: (goes into shock)
Billy: April fools’!
Grampa: Oh god, I find it hard to breathe, there’s pain in my left arm.
Billy: Good one grampa, but you’re going to have to try harder than that to get me.
Grampa: I’m not kidding, get me to a hospital.
Billy: Get more creative than that

The worst of all seems to be that of slideshare. I’d signed up for their service, which I actually think is pretty neat.

I got an email saying: “You’re a slideshare rockstar”(IF you didn’t know already, “rockstar” is the word I loathe the most.) Now that I’m a slideshare rockstar and was impatiently looking for ways to find slideshare groupies, I smelled something fishy.


We’ve noticed that your slideshow on SlideShare has been getting a LOT of views in the last 24 hours. Great job … you must be doing something right. ;-)

Why don’t you tweet or blog this? Use the hashtag #bestofslideshare so we can track the conversation.

Congratulations,
-SlideShare Team

Every self obsessed half witted moron (a sample set, which, by some freakish coincidence, are all twitter users), decided to blog, twaat, microblog, nanoblog, fermiblog and gloat about their newfound glory. After seeing the pageviews rise and increase hundredfold, they realized that their creative inputs were clearly worth billions. They quit their jobs, brought hundreds of “I’m a slideshare rockstar” Tshirts, maxed out their credit limit knowing that a few minutes on powerpoint would reimburse their investment.

Then they found out that it was a joke with 100x fake page views and everyone got the same email.

Not surprisingly, a lot of people are pissed at slideshare, which is pretty sad because I’m a fan of Rashmi Sinha’s work, which I’ve been following for quite a while now.

There’s a lesson to be learned here, in my opinion:

  1. Humour is contextual. A normal person can be clever and insert a few puns into their text, but that’s it. The funniest jokes are internal, the ones that you crack with your buds, and have a lot of context to them.
  2. What slideshare did wasn’t “fooling”, it was outright lying. I just hope that it doesen’t get them sued or something.
  3. It’s funny to make one or two people laugh. Try it for an entire userbase and you’ll just piss them off.