Movie review : Inception

So I watched Inception today and here’s the once sentence verdict – You have to watch this one. First, the trailer -

I’ve been a fan of Christopher Nolan ever since I saw Memento. This one has only strengthened the respect I have felt for him. In Inceptionhe deals with a powerful subject – Dreams. Cobb (Leonardo Di Caprio) is a thief who uses dreams. He creates a world in his victim’s dreams and the victim populates it with his subconsciousness. By designating certain areas or objects as safe zones, he forces the victim to automatically store their innermost secrets in that place. He then proceeds to steal that idea. Now instead of stealing an idea, he’s asked to implant one – an Inception – in exchange for being able to go back to his kids.

Do not expect to sit back and enjoy the movie mindlessly. Christopher Nolan will push your brain. He’ll make you think. You have to let your mind run with the idea to enjoy the movie thoroughly. Imagine the sheer power of the concept he’s explaining here. The story is superb – I hope somebody writes a book with this theme if they haven’t already. It isn’t complicated enough for you to not understand it. But you have to sit down and watch this one with some concentration. It’s written brilliantly. It’s no mean task to make the audience comfortable with a complex concept and then run the rest of the film based on it. It’s a tribute to his skill that Nolan is able to pull this off in an entertaining manner. The film is not slow or dull even in some parts – it runs pretty tight throughout. The last few minutes particularly make for edge of the seat watching.

The ending in itself is a masterpiece. The last few seconds of the movie in itself is so perfect. He does not intend the audience to forget the movie after they come out of the theatre. By leaving a crucial point to his audience’s imagination he has made a master stroke. The 4th level dream introduces some twists to the story line in the last few moments – but in the hands of Nolan it doesn’t seem forced or artificial. Lesser directors would’ve fumbled there.

The performances by the actors leave no room for complaints. Leonardo di Caprio makes for an excellent leading man with a brilliant but troubled mind portrayed effectively. Marion Cotillard plays Cobb’s wife Mal. The other main characters have been brilliantly played by Ellen Page, Tom Hardy and Ken Watanabe. Nolan regular Michael Caine makes a short but well handled performance.

Music by Hans Zimmer stands out. The theme manages to convey the tension and the disturbance of the movie.

Inception– Rating: 9.5 out of 10

What not to do when you are sleepy

1. Write blog posts. Especially ones about “What not to do when you are sleepy”.

2. Write emails. Yeah, that angry one you’re sending – no, don’t do it.

3. Sleep on food. Unless of course you want to smell like pastries.

4. Speak on the phone. Yaawnn.. no I don’t want that credit card.

5. Write code. while($i = 0) { $total += $i; }.

 

There are more. You have to tell me.

IRCTC disabled right click

Many readers of my post on booking tatkal tickets with Firefox’s autofill forms extension have reported that IRCTC has now disabled right clicks. Not only does this hamper saving the form, it is also very annoying. I’ve found a workaround for this. After you fill in the form do not directly go and right click to save the form as a profile. Instead paste this code into the Firefox address bar – javascript:void(document.oncontextmenu=null) . This will re-enable the disabled right click. Now proceed as before.

This code can be used on any site that disables right click

Hat tip to this post on “Re-Enable Right-Click When Web Pages Turn It Off

PQWL status on Railway ticket

PQWL is one of the many Waiting List types that appear on reservation tickets. Practically speaking this is a Waiting List. Technically, there’s a difference between PQWL, CKWL, GNWL etc. The total seats available for reservation on a train are divided among different quotas. There’s the ladies quota, tatkal quota and general quota. Some trains also have what is called the Pooled Quota or PQ. When you book a ticket to a station for which tickets are issued from the pooled quota, then you get a pooled quota waiting list or PQWL if all the tickets available in the PQ quota have already been booked. This is similar to CKWL (Waiting list on the tatkal quota). The pooled quota is used for a bunch of stations who share a pool of tickets. These are relatively minor stations, at least as far as that particular train is concerned. For eg. if you were to book a ticket from Bangalore(SBC) to Rajamundry(RJY) on the Guwahati Express (2509), then you would get tickets assigned from the Pooled Quota. Waiting lists from this PQ quota appear as PQWL on the ticket.

CKWL status

I get a lot of queries regarding ckwl status. These involve questions like -
“I got a tatkal ticket of WL 17 in sleeper on train 2833. Today is 24th Feb 2010. and my train is on 26th Feb.?
Total tatkal seats is 229. Is it likely to be confirmed?”

It’s tough to answer such a question. There are different factors to keep in mind.

1. The route in which the train runs. Some routes, like Chennai – Bangalore route, are busy. Cancellations are probably low here. You are more likely to get a CKWL status if you book a train in a busy route.

2. The day for which the ticket is booked. Tatkal ticket bookings are high on Fridays and Sundays. If you look at tatkal bookings in a busy route like Bangalore <–> Ernakulam, you will find that booking is high on Fridays for Bangalore –> Ernakulam and high on Sundays for Ernakulam –> Bangalore.

3. Which train are you travelling on? If you’ve booked tatkal tickets for a train which is at a convenient time for most people (for eg. Island express at 9:45 pm is convenient for those going from Bangalore –> Ernakulam), then the likelihood of getting a CKWL status is higher compared to getting a CKWL status on a less conveniently timed train ( There’s a train at 5:15 train from Bangalore –> Ernakulam. Not convenient because most people can’t get out of office that early).

4. Occassionally the railways add extra coaches to a train when there’s a big waiting list. Chances are high that your CKWL status becomes confirmed in that case. I assume this is more likely to happen during the rush season (summer holidays?).

5. Some people cancel their tickets at the very last moment.

6. Some people forget to cancel their tickets

I have faced situations where a CKWL 11 did not get converted to a confirmed ticket. But I’ve also faced situations where my CKWL 30 ticket got confirmed. My advice to you is that unless you have a very high CKWL status, say CKWL 50, you ought to wait till the last moment. You won’t get much if you cancel a tatkal ticket anyway. It’s worth a shot.

Mind you, this advice is free and does not come with any guarantees. I’m not responsible if you wait for a ticket and it does not get confirmed. YMMV :P

Identify visits from Google Real time search

Recently Google released its real time search feature. If you want to figure out from your Apache access logs which results are coming from the Google real time search, then you have to look at the referrer field. The Google search referrer url will have a param tbs=rltm in it. rltm stands for real time.

How to programmatically create and log in drupal users

Creating a new user is very easy in Drupal 6. Here’s how.

<p>>
<p>$new_user = array(</p>
<p>&#8216;name&#8217;                   => $username,<br /> &#8216;mail&#8217;                     => $mail,<br /> &#8216;pass&#8217;                    => user_password(),<br /> &#8216;status&#8217;                  => 1,<br /> &#8216;auth_MODULENAME&#8217; => $username<br />)</p>
<p>$user = user_save(NULL,$new_user)</p>
<p>// log the user in</p>
<p>$user = user_authenticate($new_user)</p>
<p>

Now for the explanation. We create a $new_user array with values we want the newly created user to have. We pass this along to the user_save function and set the 1st parameter as NULL. From the code comments in the user module -

* @param $account
* The $user object for the user to modify or add. If $user->uid is
* omitted, a new user will be added.
*
* @param $array
* (optional) An array of fields and values to save. For example,
* array(‘name’ => ‘My name’); Setting a field to NULL deletes it from
* the data column.

So setting the 1st parameter as NULL creates a new user.

The parameters name, mail, pass and status are all self explanatory. The user_password function generates a random password (by default with a length of 10).

The (optional) ‘auth_MODULENAME’ element will record the user as being created externally. This will result in an entry in the authmap table like this -

“aid” “uid” “authname” “module”
“2″ “20″ “USERNAME” “MODULENAME”

The user_authenticate function logs the user in. This function expects an array as a parameter. It first loads the user in using the user_load function and in case of no errors logs the user in.

This approach of logging in a user is useful when we have the array with us which contains the raw values used to create the user. If all you have is the uid of the user, then logging the user in is very simple. Just use the global $user object.

</p>
<p>global $user</p>
<p>$account = user_load( array(&#8216;name&#8217; => &#8216;USERNAME&#8217;) ); // or user_load(UID)</p>
<p>$user = $account</p>
<p>

Don’t use the user_authenticate function here as it expects the raw values(form values). This wil not work -

</p>
<p>$account = user_load( array(&#8216;name&#8217; => &#8216;USERNAME&#8217;) ); // or user_load(UID)</p>
<p>user_authenticate((array)$account)</p>
<p>

It will take whatever password is stored in the user object(the raw password), md5 it and then run a query to load that user. Since the password in the query is not the raw password but the md5, the query will return nothing. This will cause an error in the user_authenticate function.

For a direct code example for programmatic log in, check the devel module’s devel_switch_user function.

Helen Fry – Dilbert strip February 16, 2010

Dilbert.com

I didn’t really get this. Who the heck is Helen Fry? I had to read the comments in the site to realise “Go to Helen Fry” should be read as “Go to Hell and Fry”! :D

There are other beauties in there as well – Sofa King, Helen Wait… :P

PS : click on the image to see it in full size

How to dump or export all the table definitions in a MySQL database

So you have  a database with loads of tables. You want the table definitions of all of them. You don’t really need the data. mysqldump to the rescue!

mysqldump -u USERNAME &#8211;password=PASSWORD &#8211;no-data &#8211;opt DB1 > DUMPFILE

That’s it! Easy as a pie :) The key here is the –no-data option. It dumps all the table definitions, but not the table data.

Want to do this for multiple databases? No problem.

mysqldump -u USERNAME &#8211;password=PASSWORD &#8211;no-data &#8211;opt &#8211;databases DB1 DB2 > DUMPFILE

The –databases option allows you to add multiple databases.

mysqldump -u USERNAME &#8211;password=PASSWORD &#8211;no-data &#8211;opt &#8211;all-databases > DUMPFILE

The –all-databases option allows you to dump all the databases.

mysqldump -u USERNAME &#8211;password=PASSWORD &#8211;no-data &#8211;opt DB1 &#8211;ignore-table DB1.TABLENAME1 &#8211;ignore-table DB1.TABLENAME2 > DUMPFILE

–ignore-table option allows you to skip dumping certain tables. Do not forget to specify the databasename when using this option.

 

Know any more tricks? Let us know in the comments below :)

How I recovered my Thunderbird mail from backup

So the best way to backup your mails from Thunderbird is to copy your complete profile directory. Follow these steps for restoring your mail.

The fool that I am, instead of copying the full profile directory I ended up backing up just the Mail subdirectory in the profile directory. It took me a while to figure out how to restore the backup, so I thought I would share it with you.

The first thing you do is install Thunderbird (if you haven’t already). Now Run( Windows : Start->Run or press Win key+r ; Mac/Linux – you’re smart enough to know :P ) this command “thunderbird.exe -profilemanager”. Create a dummy profile – just have some dummy email address in there. Now exit Thunderbird.

Next step is to find your newly created profile directory. Locate the Mail directory in there. Now you have to copy 2 files from your backup – both have the same name. One has a .msf extension and the other has no extension. I had created a separate thunderbird mail folder with a filter and I needed to backup just that one alone. So I just copied those 2 files (from the Inbox.sbd directory) and put them in the Local Folders subdirectory in the Mail directory (which already had empty files like Trash and Trash.msf).

The file without extension – this is the actual mail file. It’s in the mbox format. The other is an index file.

Acknowledgements :

I posted a question on Aardvarkhttp://vark.com/t/eee11d. I got replies from Shel and Moez. I would like to thank both of them for helping me out.