I’ts amazing what you can whip up in just 15 minutes using CPAN (including reading the documentation).


#!/usr/bin/env perl
use warnings;
use strict;

=head1 INTRODUCTION

Checks if there are new unread messages in your GMail Inbox.

=head1 USAGE

    $ perl check_gmail.pl
    1       Swaroop C H     Looks like check_gmail.pl works

=cut

############## Configuration ##############

# Change this to your correct username.
use constant GMAIL_USERNAME => "username";
# Change this to your correct password.
use constant GMAIL_PASSWORD => "password";

########## Don't change anything below this. ##########

use LWP::UserAgent;
use XML::Atom::Feed;

my $fetcher = LWP::UserAgent->new();
$fetcher->agent("check_gmail.pl/0.01");

my $request = HTTP::Request->new(
    'GET'   => "https://mail.google.com/gmail/feed/atom",
);
$request->authorization_basic(GMAIL_USERNAME, GMAIL_PASSWORD);

my $response = $fetcher->request($request);

if (! $response->is_success())
{
    die("Unsuccessful in trying to talk to GMail");
}

my $content = $response->content;
my $feed = XML::Atom::Feed->new($content);
my @new_messages = $feed->entries();

my $i = 1;
foreach my $message(@new_messages)
{
    print join("t", $i, $message->author->name,
                    $message->title), "n";
    $i++;
}

# The End

Update : Baishampayan Ghose quickly jotted down a Python version of this script.

A couple of weeks ago (on July 7th), we had a YEFI Day at work. YEFI stands for Yahoo! Employee Foundation India. As part of the celebrations, we got the Parikrma kids to come and visit our Yahoo! offices.

The Jayanagar children (who see me every Saturday) visited the M G Road office, and as part of Kalpana’s (one of the founders of Parikrma) plan, another colleague and myself would host the Sahakarnagar children at Aztec / EGL premises.

The kids came at around 1 o’ clock and we took them straight for lunch first. The girls came first and they sat down. The boys came in an another vehicle after a while. The Aztec cafeteria was filled with kids with green color shirts, and everyone was wondering what was going on.

First off, I asked who was the naughtiest of them all, and all of them pointed to a single girl, and I got her to explain what all naughty things she does, hehe. Apparently, she’s the only one who confidently slaps any of the naughty boys! Then, I asked their nicknames, and got to know all the names from ‘mosquito’ to ‘kogile’.

Somewhere in between, I asked them what they wanted to do when they grew up – 3 said nurse, 1 said teacher, 1 said computer scientist (whatever that is), 1 said astronaut (!), and so on. I was so happy to hear that only one of them wanted to become a “software engineer”. Maybe I’m being cynical but I think we have enough drones in Bangalore as it is. These kids can do so much more, and their motivation is very different from ours. When I asked why that paticular girl wanted to become a teacher? She said she liked kids and she wanted to help other kids just like Parikrma helped her. I was asking the wannabe-nurses on whether they have put an injection to somebody else … then I asked the ‘kogile’ to sing, and she sang a beautiful kannada song.

Parikrma
Parikrma
Parikrma
Parikrma
Parikrma

(more…)

Today, I achieved 34 km.

Yeah, my stamina has improved.

Here’s some of the “running gyaan” I’ve collected over the past few months:

  • Learn to listen to your body
    • Learn to distinguish between feeling tired or just feeling fatigue, feeling the need for water and the need to take rest.
    • I attribute a part of my development to doing things my way. I didn’t push myself to compete with the others, but I competed with myself.
  • It takes patience to develop stamina. A year ago, I used to run one round in the track field and stop dead-tired. The track was just 400 metres long.
  • Some people find company important for running. I need my iPod and the company.
  • Running in the early morning is better – lesser pollution, lesser noise, lesser people, empty roads, etc.
  • Breathe naturally.
  • Do varying distances of running (The distances should look like a bell curve on a graph)
  • Run 9 min. Walk 1 min. And the cycle continues.
  • Gear is important
  • Drink lots of water. 2 litres per day.
  • Water + Electral = Yummy. And it restores the salts that your body loses.
  • Nothing teaches you determination like running. Because the temptation to stop is immense and you can easily stop.
  • I still have a lot to learn.

In the first weekend of this month, my trekking gang and myself went to Mullainagiri and Bababudangiri for trekking. We’ve never experienced a “monsoon trek” / “rain trek”, so this was our chance to go for it. I’ve done the Mullainagiri trek before and I was quite looking forward to it again. I remember my favorite moment of trekking and suddenly realizing that clouds were below me…

To reach Mullainagiri, start at Chikmagalur bus stand, walk down a few hundred feet and have amazing idly and vada for breakfast at the Soundarya hotel in the main road, and then take a local jeep (next to the bus stand) to the Mullainagiri starting point. We took the jeep option, and as usual, we eventually got on top of the jeep. We had to make sure the jeep driver took us to the small iron arch where the trek is supposed to start.

Breakfast at Soundarya
Top of the jeep
Road
Jeep-skiing
Starting point

(more…)

From the latest Perl.com newsletter* :

Did you know that the country with the second-largest number of Perl.com
readers is India? That’s right! Greetings to everyone on the
subcontinent; tell your friends about us.


  • It’s ironic that an O’Reilly site’s newsletter is not archived anywhere on the web.

When I look at people around me, I often ponder how they manage to live life just like any other day. They tackle work and fun and go home and watch TV and sleep. Then, get up the next day and the cycle continues. I think of them as analogous to “machines”.

On the other hand, I’m more like a wind-up toy. I need to motivate myself regularly to keep me going. I don’t know if there’s a deficiency in me or it’s just that I’m built that way. I usually resort to many tricks and advice and the worst/best part is that these tricks usually work for me.

Why is it that I find it so hard to get motivated?

I can think of several reasons :

  • I have this mental block that “I am not a finisher”. I tend to start things with great enthusiasm but due to past history, I get an uneasy feeling that I won’t be able to complete it, and once you lose confidence and enthusiasm, that’s the end of it. As Abraham Lincoln once said, “Always bear in mind that your own resolution to succeed is more important than any other.”
  • It’s easy to “lose sight” of what’s important. The daily bhaag-daud makes you lose sight of the big picture. As Stephen Covey once said, “The main thing is keeping the main thing the main thing.”
  • Don’t follow the herd mentality. Do what is important to you. “To lead a symphony you must occasionally turn your back on the crowd.”
  • There’s not enough passion. This violates our Dappers Rule.
  • Not enough concentration. One thing at a time. And think while you’re at it. The one thing that I remind myself (and it helps me very effectively) is “You have to think more than you think you should but often less than what you are afraid you have to”.

Looks like I already have 5 points. I guess that part of my “growing up” would be to tackle these issues.

After reading about Mark Pilgrim’s famous switch from Mac OS X to Ubuntu along with his list of must-use stuff, I installed Ubuntu Linux on my system (and removed Fedora Linux in the process…)

First impressions:

  • It is fast. Here’s where I say “Bye Bye Fedora”. Firefox runs smoothly whereas it used to crawl and cry on Fedora (I have a P3 667 MHz Intel machine)
  • The looks are great, especially the bootup screen. My non-techie cousin said “I thought you were starting up some game!”. That’s a good compliment.
  • The booting process is slow. It runs dosfsck, etc which slows down the process a lot.
  • The Add/Remove programs works like a charm. In Fedora, I had to manually update my ‘yum.conf’ for the repositories I needed. Here, I can select the software, and if the “Universe” repository is not enabled, it asks me whether I want to enable it, I click yes, and the rest is taken care of.
  • The printer configuration took just 20 seconds as opposed to more than 5 minutes previously in Fedora where I had to hunt for the right set of drivers and driver options
  • The red quit button at the top right portion of the screen is a nice touch
  • The documentation is excellent. Click on System -> Help -> System Documentation. Click on ‘Ubuntu Desktop Guide’ and start reading. For example, further click on ‘Common Tasks’ -> ‘Music’ and look under the section ‘Using your Ipod’, it clearly recommends how to use/install the “rhythmbox” and “gtkpod” software.
  • Finally a distro that my dad has started to use comfortably
  • EasyUbuntu is a must-use
  • UbuntuGuide.org is a must-read
  • The fact that it is a single-CD distro is both a boon and a bane. Boon because it is easier to give to others and use and is faster to install. Bane because anything else I want to install means a bandwidth hog, for example, any of the compile/build tools.
  • Is it true that Ubuntu has an Indian mirror? Somehow it seems to result in faster downloads.
  • The UbuntuOS blog and their podcast seem interesting, as well as the Unofficial Ubuntu blog
  • Hardcore users will like Planet Ubuntu
  • It’s surprising that I didn’t find many gripes with Ubuntu. Is it that “Desktop Linux” is finally coming of age or is it that the Ubuntu team have done a really good job that others haven’t been able to?