Sunday, June 29, 2014

Help! My landlord sold my apartment while I was still leasing it!

To continue along the vein of "Something about Everything", here is a post about the Maharashtra Rent Control Act, 1999!

Have you faced the following situation?

  • You are leasing an apartment (with a legal Leave and License Agreement);
  • Your landlord decides to sell the apartment;
  • You are unsure how this affects you?
I'm facing somewhat of a similar situation, and the question foremost on my mind is, can the new landlord evict me if he chooses?

I did some Googling and didn't find anything specific to India (of course, I did find a lot of Yahoo Answers without any reference). So I did a little "light reading" (ha!).

Here's the link (PDF) to the rather long Maharashtra Rent Control Act, 1999 which governs pretty-much everything concerning leases. (If the link is dead, try googling for the phrase "Maharashtra Rent Control Act".)

  • I am not a lawyer; just a stressed-out tenant trying to make sense of it all;
  • I have tried to interpret the rent-control laws as best as I can. If you think I am wrong, please leave a comment!

The relevant portion is in Chapter V, Sub-Section (2), Clause (3). If you can't find it, search for the word "purchase". There are luckily only two matches, both in the same paragraph.

To cut to the chase, here's what the relevant paragraph says (copied verbatim):

Explanation.- A landlord or his successor-in-interest by inheritance or otherwise shall not
be entitled to recover possession under this section from the tenant or his successor-in interest by transmission, where the landlord has acquired the property by purchase, gift,
exchange or otherwise (but excluding acquisition by inheritance or succession or in the
case of premises in a Co-operative Housing Society, by acquisition of a share or right and
interest in such premises by nomination), and where, at the time of acquisition, by
purchase gift, exchange or otherwise the premises had been in the occupation of the
tenant or his predecessor-in-interest from whom the tenancy has been transmitted and
notwithstanding anything contained in any judgement, decree or order of the court or
anything contained in this Act or in any other law for the time being in force, the
provisions of this explanation shall always be deemed to have applied to such a case, and
the landlord shall not be entitled to recover possession in any such case,

What does this mean?
  • "A landlord or his successor-in-interest" - refers to the landlord; let's leave out the "successor-in-interest" part, for simplicity
  • "shall not be entitled to recover possession under this section" - means that he/she cannot evict you, the tenant
  • "from the tenant or his successor-in interest by transmission" - means you the tenant; again, let's leave out the "successor-in-interest" part for simplicity
  • "where the landlord has acquired the property by purchase, gift, exchange or otherwise" - i.e where the landlord has purchased this property from someone
So, to summarize:
"The landlord cannot evict you if he/she has purchased the property from someone else."

Wednesday, June 18, 2014

Fully Automated Google Calendar events from Emails

I love Google Now. It has helped me out of a pickle more than once, especially with its automatic reminders about flights. And now it's expanded into hotel reservations and bus timings as well! *Sigh* At least in the US.

With my move to India, however, gone are the days when I could rely on Google Now. It *sometimes* catches flight ticket emails and registers an event reminder; mostly it fails.

Plus, after all, this is India. That is to say, I travel by trains weekly; so it's trains that I'm interested in. And yes, FYI, I have forgotten to travel on trains before. Slave to technology, fat-slobbering-man-from-WALL-E, call me whatever.

So, assuming you have Google Now properly configured to read your email and calendar, how do you get automatic reminders for upcoming trains?

Let's back up for a minute and examine the facts:
  • Trains in India are primarily reserved through IRCTC.
  • The website sends out a very very templatish email, and that template has not changed in years.
  • Suppose there were a service that could run on every email, and extract the details?
  • Suppose that said service could magically also create a Calendar entry? 
  • In that case, Google Now would then (hopefully) do its job, and display a neat reminder - "Hey, you have a train!"
  • Even in the worst case, Google Calendar would display a notification.
Enter Google Scripts. Using this nifty little tool, I was able to create a script that extracts the relevant info and creates a Google Calendar event!
Obviously, this was a half-day job so it's rusty. Here's what it does:
  • Looks at the latest 20 emails for subject-line "Email From IRCTC"
  • Extracts the information about your upcoming reservation
  • Looks at the journey date in your default calendar
  • If no events are found with text "Train to ", it creates a calendar entry.
  • It sets a popup reminder for 12 hours before your journey.
I loved Google products before, and now I swear by them!

* Looks for emails from IRCTC that announce a train reservation.
* Then extracts email info
* Then adds a calendar entry to your default calendar
* author: vish
function createIRCTCCalendarEntry() {
  //Match Train Name
  var trainNo = new RegExp("<b>Train No</b></td><td.*>([0-9]+)</td>","m");
  var trainName = new RegExp("<td.*><b>Train Name </b></td>$\n^<td.*>([a-zA-Z ]+)</td>","m");
  var trainFrom = new RegExp("<b>From</b></td>$\n^<td.*>([a-zA-Z ]+)</td>","m");
  var trainTo = new RegExp("<b>Reservation Upto</b></td>$\n^<td.*>([A-Z]+)<td","m");
  var trainDate = new RegExp("<b>Date</b></td>$\n^<td.*>([0-9\-]+)","m");
  Logger.log("Hello World");
  var threads = GmailApp.getInboxThreads(0, 20);
  for (var i = 0; i < threads.length; i++) {
    var messageSubject = threads[i].getFirstMessageSubject();
    if (messageSubject == "Email From IRCTC") {
      Logger.log(threads[i].getId() + " is an IRCTC email");
      //get message body
      var messages = threads[i].getMessages();
      var msgBody = messages[0].getBody();    
      //extract relevant details about train
      var match = trainNo.exec(msgBody);        
      var no = match[1];
      var match = trainName.exec(msgBody);        
      var name = match[1];
      var match = trainFrom.exec(msgBody);        
      var from = match[1];
      var match = trainTo.exec(msgBody);        
      var to = match[1];
      var match = trainDate.exec(msgBody);        
      var date = match[1];
      Set description for calendar event
      var desc = "Train no " + no + " (" + name + ")" + " from " + from + " to " + to + " on " + date;
      Proceed only if no null values
      if (no == null || name == null || from == null || to == null || date == null) {
        Logger.log("train details were not parsed correctly; not creating calendar entry");
      } else {
        Extract Date and convert to appropriate form
        var year = date.split("-")[2];
        var month = date.split("-")[1] - 1;
        var day = date.split("-")[0];
        var desiredDate = new Date(year, month, day);
        Logger.log(year + month + day);
        Create event title
        var desiredTitle = 'Train to ' + to;
        If Calendar already has events with exact same name
        Do not proceed
        Logger.log("Creating event in default calendar " + CalendarApp.getDefaultCalendar().getName());
        var eventsForDay = CalendarApp.getDefaultCalendar().getEventsForDay(desiredDate);
        for (var x=0; x<eventsForDay.length; x++) {
          Logger.log("Existing event was found for " + date + " with title: " + eventsForDay[x].getTitle());
          if (eventsForDay[x].getTitle() == desiredTitle) {
            Logger.log("event already exists, aborting!");
          } else {
            var event = CalendarApp.getDefaultCalendar().createAllDayEvent(
              'Train to ' + to, 
              {description: desc});
            Logger.log("Event " + event.getId() + " created on " + event.getDateCreated() + " in calendar " + CalendarApp.getDefaultCalendar().getName()
            + " with start date " + event.getStartTime().toString() );

Sunday, June 8, 2014

Once upon a morning-glory-timelapse

What's the use of three balconies if you can't have a garden? Both of us had been looking to grow plants for a while. So, when I got a chance to visit Bangalore, I jumped at the chance.

Bangalore is not known as the city of gardens (or is it flowers?) for nothing. And Lalbaugh, of course, is its epicenter. Off the tourist trail is a very sophisticated plant nursery with the widest array of flowers you'll see.

(When you enter from the KH Road (Double road) entrance to Lalbagh, keep walking straight until the hill - then turn left. Here's a Google+ entry)

Not just flowers - there's even vegetable seeds! After browsing forever, and wishing I knew the local language (the gardeners speak nothing but Kannada, sadly) I picked up petunia, parsley, fenugreek (methi), kanakambaram and morning glory. 

And then I browsed around a little, before (reluctantly) returning to work. (Yes, I'd slipped out during a particularly boring unproductive day at work). 

That had been in February. Over the next three months, I and my wife tended, nurtured and pruned away at the saplings. We saw the petunia grow, die off, grow again and finally die off with heavy hearts. I guess not everyone of those seedlings was suited to the Pune climate.

The morning glory however was a tough little one. And since the day I pressed that first seed into the mud, I'd wanted to capture its growth. 

So, on a particularly hot sunny day today, I set up my camera and tripod to start capturing the various movements of this particularly active plant in a timelapse. I then went off to work, oblivious of the events to come. 

At around 3, I heard a rhythmic rapping on my cubicle's window. I looked out to see the darkest rainclouds and the gustiest winds I'd seen so far. And I'd left my camera out facing the window. That's the damnnnn moment you never want to get, I guess. So I raced home to find all my balcony and parts of my bedroom completely drenched. 
And sitting in the middle of it all, like this magnesium-alloy saint meditating, was my camera - still clicking away.

"This better be worth it," I kept muttering, cleaning the grime off the lens and ejecting the SD card. And .... it was so worth it!

Here's the result. Enjoy!