Thursday, July 19, 2007

Harry is comming..

July 21, The day I was waiting for the past two years. For all the sane people out there who have no clue what I am talking about, Harry Potter and the Deathly Hallows, the supposedly last Harry Potter book is hitting the book stores on July 21.

The world looks very different now if you see it from the eyes of a Harry Potter fan. All I can see everywhere is the mention of this book and discussion of possible endings. Just yesterday while having lunch at a deli(not a regular one, this one is in the middle of IT campus and the customers are generally just IT guys), a group of 50+ year old people were discussing Horcruxes and Harry's quest in the last book... shattered my colleague's belief that Harry Potter books are for kids :P. Today Cecelia(of PhD comics fame) wrote about it too.

I will be quarantining myself for the weekend. That means no blogs, no mails, no IMs and no calls. Basically am just trying to avoid all the channels that can ruin the ending for me, especially I'll block out all the people who are Harry Potter fans.. I know they'll do the same.

I have never gone ballistic over a book before.. not for a movie, not even for the iPhone :P. J.K.Rowling.. you rock.

Saturday, July 14, 2007

Vim-blogger and Markdown

This guy blogged about posting blogs from emacs, and for reason unknown to me it stirred my old itch to post blogs within the VI editor... with complete support for different teeny nifty features that I have built into my template over the years, without using html(that just breaks the thought process and I can never get it just right). I also needed the dynamic spell check support in firefox2 that I've gotten so used to.
A bit of googling revealed that there was already a vim-blogger plugin!! Some guy known as The Geek Wannabe already had everything in place. The only thing I had to do was follow the steps. The guy did it using GData API. Markdown was included in it, which mean that I can do all the occasional formatting like this code:

#include<iostream>
#include<string>
int main()
{
std::cout<<"Hello World\n";
}

without sweating about replacing the < like signs with & lt; or adding quoted text like this:

Yeehaw.. I am in quotes.

Adding spell check support was a simple matter of invoking :setlocal spell spelllang=en_us.
This post is written and posted completely within *vim*..so all the emac guys out there.. up yours :P. Geek Wannabe, you should run for President's position.


PS: Ah.. bit of rough around the edges indeed.. but all for vim-love.

Sunday, July 01, 2007

Whistling at your computer

Those of you following Slashdot would have noticed the IBM's article to provide commands to your computer by whistling at it. I decided to give it a shot on Ubuntu7.04. Follow these steps to get it working flawlessly on Ubuntu:
  • $sudo apt-get install libsndfile1 libsndfile1-dev libglut libglut-dev
  • Follow the instructions in the linked article and download the file cmdWhistle.pl
  • Replace the functions getEpochSeconds and getEpochMicroseconds in cmdWhistle.pl with this code:

    use Time::HiRes qw(gettimeofday); #Add at the beginning of the file

    sub getEpochMicroSeconds {
    my $seconds=0;
    my $microseconds=0;
    my $timeVal;
    ($seconds, $microseconds) = gettimeofday;
    $timeVal = $seconds.$microseconds;
    $timeVal = substr( $timeVal, 6);

    my $padLen = 10 - length($timeVal);
    $timeVal = $timeVal . "0" x $padLen;

    return($timeVal);
    }#getEpochMicroSeconds

    sub getEpochSeconds {
    my $seconds=0;
    my $microseconds=0;
    ($seconds, $microseconds) = gettimeofday;
    return $seconds
    }#getEpochSeconds

  • After this you can pretty much follow the same instructions that the article explains.
I tried running the few commands(did not try the windowing commands using xwit though) after which my mouth started to hurt and I could not whistle a consistent tune afterwards :( It's a good piece of software, and the sndpeek program that it uses is really awesome and feature rich but I think using whistle as an input is totally infeasible for me.
On the other hand, if you know how to play any kind of wind instrument(like flute, clarinet etc) you can easily write a superkewl password login utility that takes a particular tune as an input... sounds right out of a hollywood movie, doesn't it :)