First year dreams

So I’ve been quiet over here because I’ve been awfully busy off late. One of the things occupying my time was preperation for the WTMS Annual Production. WTMS is an society that plays music inside the institute. I had the honor of being one of the three Governors of the society this year, which meant a lot of work over the past few weeks.

The show was great. We experimented with a new sound technician which didn’t go too well. But the crowd was nice, the music was good and the finale was explosive. I asked my friend Anutosh to photograph the event and some of the photographs were great, and I thought I’d share some here. Thanks to my friend and depmate Karthik Prabhu for taking photographs as well(he’s keeping the best pics from me, to edit and polish, so you might get a follow-up post).

A little bit of history now. Back in first year, when we really didn’t play anything, me and two very good friends – Ved and DC – spent more time fantasizing about stage antics and imaginary bands and songlists (trivia: we still call ourselves “Ved’s Imaginary Band” or VIB even when we perform on stage), than we did actually playing anything.

One of the things we most wanted to do is to line up next to each other, point the fretboard at the audience, not unlike the thing very characteristic of Iron Maiden. Something like this:

And four years later – lo and behold:

FYI, that’s me on the left of the image. With my best friend Ved in the middle. Vibhav – on the right – was supposed to line up as well, but he stuck to where he was prolly due to the fear of messing up the “Dance of Death” lick. We were like “clean playing be damned! it’s the photo op that counts”. In his defence his solo came out great!

Wait… Something’s not right. DC was supposed to be along with us as well. Kindof difficult since DC plays keyboards (he’s a “synthie” as they call ‘em down here). Thankfully, his E-mu XBoard 49 Midi controller keyboard comes into the rescue.

Errr…. success?

The show closed with local hero and grade-A-nice-guy Ankit “Godwa” Prasad playing a _perfect_ rendition of Pink Floyd’s “Comfortably Numb” – the long extended Pulse Live version. We even projected a video of the concert in the background.

Anyways, the show was great. I was thoroughly exhausted at the end of it. An entire day of setting up several thousand watts worth of sound, setting patches and playing with some of the most talented people I’ve met in my life. And lie down on a stage – just because I could. (image – I’m in the blue shirt, DC’s in black)

Thanks to everyone who came! Hopefully I’ll get to play at Kharagpur once more before I graduate. Until then!

SafetyNet – Easy error reporting for C#/Mono/GTK# apps

Screenshot for the impatient:

SafetyNet

What is it?

SafetyNet is a framework for error reporting and analysis for C# apps on Mono/GTK#. It is shown when an exception cannot be handled appropriately. The user, when faced with the exception can choose to send the stack-trace of the application along with any other information to a central server, where the developers can be informed of potential bugs.

It’s inspired in concept by Google/Mozilla’s Breakpad and the server-side component – “Socorro“. SafetyNet aims to be less of a install-and-forget solution to send dumps after the crash, but rather aims to try and fail gracefully, and give the user a choice to try and save the data before shutting the program down.

Why should one use it?

It is easy to integrate with your existing applications. Since all the failing stacktraces are in one place, it is easy enough to perform rudimentary frequency analysis to find out which sections of the code are failing more often.

Integration will require considerable amount of plumbing – handling crashes, recovery requests, save and die requests, etc are all to be implemented by the developer and application agnostic.

Clientside features (mostly not implemented yet):

  • Show a GTK window presenting details about the error which can be filed as a bug report.
  • Send a SOAP/vanilla POST request to a server containing debug information
  • Integrates with System.Diagnostics by providing a TraceListener to also dump your logs to. The logs will be sent to the report (if allowed by the user).
  • Investingating integration with System.Diagnostics.Debugger
  • Hopeful integration with the global assembly cache – sending more diagnostic information
  • Attaches screenshots of the failed program if required

Server-side features:

The server currently accepts an error report in XML format and stores it to couchdb. It currently does nothing except dump all the error reports together for downloading and offline processing.

Usage:

There’s a singleton class which acts as a central access point. It’s thread safe (I think) and is used to trigger the exception dialog and expose other functionality like the TraceListener, DebugListener, etc.

API:

TODO

Integrating with existing codebases:

A lot of design decisions were based on MonoDevelop’s ErrorDialog, which only shows a stacktrace. My guess will be to put everything in a try-catch

Current status of development:

SafetyNet was extracted from another top-secret project. It’s still in a very early stage with very few features – due to more time dedicated to aforementioned top-secret project. The code will be released as soon as the solution is sufficiently decoupled. All code will be MIT/X11.

Porcupine Tree to play in Mumbai, India!! Oh yeah!

Follow me down, to the valley below. They were arriving somewhere, but not here, but not anymore! Porcupine Tree, the progressive rock band will be headlining Mood Indigo, the IIT Mumbai cultural fest on 21st December. Their website confirms that they will be playing their final show at Mumbai!

Needless to say, I’m so going to be there! I absolutely love their last three albums, and their new album “the incident” is due a week from now. Hopefully, they’ll play some of their more popular songs along with material from the new album.

Hello world!

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

Send to pastebin from within MonoDevelop

I wrote a small addin last evening for all the beautiful MonoDevelop users. This allows you to send your code (either the whole file or a selection) to PasteBin.com from right inside the IDE.

Here’s a quick screenshot: Hosted by imgur.com

This is the first of many text-editor productivity centric addins I hope to release in the future. You can find the code here: http://github.com/ninjagod/MonoDevelop.EditorTools/tree/master. The code is under the MIT/X11 license.

To build, check out MonoDevelop.EditorTools into extras, and build against a built copy of MonoDevelop (and make sure that the newer version of the assemblies are present in your search path). This has been tested against trunk. It builds an addin directly into main/build/addins. I hope to merge this into the MonoDevelop trunk though it’s a really really small feature.

Still to be finxed: 1. The “Copy link” button does not work because I don’t know how to use the clipboard through C#. 2. I need to retrieve the user’s name from the settings 3. I need to remember things like subdomain, name, etc and load them up from a PropertyBag.

And the elusive download link: PasteBinHelper.dll [via] (You can put this in the md-trunk/main/build/Addins/MonoDevelop.EditorTools/PasteBinHelper.dll) and it should work. Since the Addin specifically requests assemblies of version 2.1.0 (trunk), it might not work with 2.0 (don’t let that stop you from trying though)

Migrating website

My two year hosting deal that I purchased with the Wordpress Plugin competition prize money is coming to a close in a week, and it’s been a good run so far. I purchased a Virtual Private Server for my new top-secret project and thought of hosting it on that, but setting up and hardening a lamp server might not be worth the trouble. I decided to give Wordpress.com’s domain hosting service a try. If anyone knows a nice way to host a blog for a domain that isn’t too much of a hassle, a shout out will be much appreciated.

In all probability, you won’t even notice anything :)

Summer of Code – Wrapping up

Sometime in late May, I embarked upon a project to extend MonoDevelop, an open-source C# IDE, to give it Task-context functionality and integration with Bug-trackers, not unlike what Eclipse’s Mylyn provides.

7630 lines of code, and several times my bodyweight in Coffee later, there’s something to show for my work. This may be the end of the program, but I am going to continue working on this for several months to come. After some more testing, I’ll release a very small preview version with some of the unstable/experimental features phased out on the MonoDevelop mailing lists. It’s still far, far, far from complete. It needs several months of work before I’m happy with what it can do, but the basic skeleton is starting to take shape, allowing me to focus more on features rather than worry about the backend.

I had several issues during the program – primarily the fact that I was interning at a company and had to do this on evenings, and weekends – which became extremely tiring. Add to that, the horrid Bangalore traffic, two hour commutes, etc, it became pretty hard. Moving closer to the office with a relative provided some respite. While it would’ve been ideal to hack on my code in the evenings at the office, I couldn’t for legal reasons, so I would hang out at a friend’s place nearby and occasionally work at his place.

My mentor, Michael Hutchinson was so overwhelmingly helpful, it was almost a little embarrassing. When he was unavailable for sometime in the middle, I almost started panicking; it’s really not easy wrestling with such a huge codebase. The other folks over at #monodevelop were incredibly helpful and patient as well. There was one time when I spent two weeks on the backend trying to refactor the code over from a serialization-based storage system to a Database storage system, because the former wouldn’t work because of some circular-dependency constraints. Thanks to some help from the guys on the channel, I realized my woes can be cured by a simple API call I didn’t know about, and thus threw away two weeks worth of work, and moved things back to the old backend. (though in the long run the database would’ve been excruciatingly painful to work with)

Anyways, I need to do some more housekeeping, add some comments here and there and maybe an easter egg or two.

Sneak preview

Sneak preview

Again, this is a very early version and will be subject to massive changes. I will write again soon describing what it’s all about.

Rise and shine :)

About a year ago, I started on a project where I logged detailed statistics on all my regular activities like sleep, eating, exercise, work, etc. I was unsure of what exactly to do with it, but the primary goals was to track improvement, detect negative trends, and infer useful information.

My golden motive was to figure out what altered my erratic wake-up schedule. I have a lot of trouble getting up in the morning most of the time, and it’s one of my long term goals to rise early and effortlessly. I pulled up the spreadsheets last night and tried to see if I can find some correlation between my sleep length and any other factors.

Contrary to what most people think, I found very little correlation between the time I went to bed, and the time I woke up. There’s some correlation between the time I had to get to class or work, which is expected, but nothing that would point to any ‘aha’ moment. There was no evidence showing that exercise affected how much I slept (though there was a surprising correlation between how much I ran in the evening and how good I felt before sleeping).

But one thing really surprised me. When I examined all the days when I had my last meal before 10PM, it was almost always followed by an early rise. Some more examination showed that there was some clear correlation between when I last ate, and when I woke up, regardless of what time I fell asleep.

I decided to try it out for a few days – No food or coffee after 9PM. Period. And I was amazed at the results – regardless of what time I slept, I had no trouble waking up at all. Today was the ultimate test – I had a critical class in the morning at 8:30 AM and I was up till 2:30 AM finishing up an assignment, though I hadn’t eaten after 8PM. I was tempted to get a snack before I slept (I’m in a university – you get food all the time around here), but I refused.

Sure enough, I was up at 7:30AM fresh as a daisy. In fact, after a good breakfast, I found it was actually quite easy to go about and didn’t feel sleepy at all through the rest of the afternoon.

So I encourage you to give this a try – avoid food intake beyond a certain point, and see if it helps being able to wake up early in the morning.

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";</p>

<pre><code>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
</code></pre>

<p>

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!