Tuesday, December 25, 2012

Red Riding Hood

Movie Review : Red Riding Hood
Director : Catherine Hardwicke
Genre : Fantasy / Mystery
Starring : Amanda Seyfried, Gary Oldman, Virginia Madsen
Released : 2011
My Rating : 4 out of 10

I debated a lot with myself before writing this review, as in, do I even want to admit that I watched this movie ? I decided the least I could do is save your time.

Some ideas have a perennial appeal. Vampire stories have fascinated people since hundreds of years. No matter how many books are written, how many movies (and TV serials) are made, and how bad many of those are, there is always a market for them. The whole "Twilight" saga has proved just how effective this money making machine is. But those poor Werewolves, they are not so lucky. Just by themselves, they cannot dupe lot of people in parting with their money.

That does not stop Hollywood from trying. This time, the werewolves are being forced to draw references from the classic children's story. Of course, there is a love triangle involving a teen-aged girl as the central character, and 2 boys - one rich, one poor. Well, this movie is directed by Catherine Hardwicke, who also directed the first movie of Twilight saga. Now you know who the target audience is, and why I should have stayed away. Alas, I missed all the danger signs.

The story happens in a fictional medieval village. Werewolves are breaking their long held agreement and are terrorizing the villagers. In this village lives Valerie (Amanda Seyfried) - the girl with a red hood. She is the center of the story, surrounded by her family and the two young men who are courting her. She has a curious encounter with the Werewolf, whose identity is unknown. To solve that mystery and to capture the werewolf, an obnoxious werewolf hunter comes to help the villagers. To complete the reference to the children's story, Valerie has a grandmother, and this character adds to the mystery.

Such a plot is part of the problem, but just a part. The bigger issue is the poorly written and unbelievably amateurish love triangle. It's boggles the mind that the movie got funded with such a glaring flaw in the script. Even harder to believe is the fact that, the two male leads manage to do a worse job than the writers. Absolutely no one can accuse them of having any acting skills. How on earth, a movie aimed at teen-aged girls can hope to have any success with such wooden male actors ? As Twilight has shown, if you want to get away with poor plot, you need to hire actors that can attract droves of teenage girls. Else your market disappears faster than the werewolves can change back to a human form.

When compared to these flaws the mystery aspect of the movie seems to work well, even though it's filled with holes. The writers deliberately provide clues that try to misguide the viewers, but they just seem forced. The best part of the movie is the cinematography. The atmosphere is maintained quite well, but it's not enough to carry the movie.

Amanda Seyfried does as best as she can with the material. I wish Virginia Madsen, who plays the role of Valerie's mother, had more screen time. She still looks gorgeous. Gary Oldman plays the obnoxious part well, but his character is pointlessly forced onto the story.

This is one of those movies with better promotions (trailers, posters) than the actual product. I say, skip this one. In any case, it's not for the kids.


Tuesday, December 18, 2012

Anand-Morozevich 2007 Mexico WCC

Every true sports fan has his or her unforgettable moments, both happy and sad. I am no exception. From Cricket, Soccer, Tennis, Field Hockey, NFL etc and Chess. Yes, chess does that too. I often watch chess games live on the internet, and sometimes get goose bumps when my favorite player is playing an exciting, razor sharp position. Once in a while, there is simply a "Wow" moment, and it's etched in the memory forever.

This is from the Round 11 game of 2007 World Chess Championship in Mexico.Anand won the tournament to become the unified world chess champion. Later he successfully defended that title against Kramnik, Topalov and most recently Gelfand. He was at the height of his chess creativity in those years, which has sadly been absent from his recent play.

Let's first look at the position before the final move.
Morozevich has just played
55. ... Qe4

Position after Black's 55 ... Qe4
What would you do in this position ? White has 3 connected passed pawns that will net him a win easily, as long as the black queen can be neutralized. Right now, the black queen is attacking both the white knight and the e pawn. The pawn needs only 2 moves to become a queen, but just the rook alone is not enough of a support. So giving up the knight to protect the pawn may be risky. Giving up this advanced pawn, means a long hard struggle to queen the other 3 pawns. So what should be done ?

Before we look at Anand's brilliant trick, let's take a few steps back.
During the game following position arose.
Position after Black's 32. ... Rh4-h5

In this position, Morozevich indicated a desire to draw by repetition of moves. It's roughly even but unclear position. Anand could have accepted the draw and still kept a comfortable lead. But he decided to press on. White then went on to capture the queen side pawns, Black captured pawns on the king side.Eventually queens got exchanged. Morozevich had sacrificed his central pawns to gain tempo, and reached a position where he was guaranteed to get the queen. Still White is better.

Position after Black's 50. ...Kh7-h6

At this point Black is willing to sacrifice the bishop to get his queen. Anand played the following move. Later it became clear that he had calculated all the way till the end.
51. Rc4!
Position after White's 51. Rc4!

Game continued ...
51. ...  h3
52. Rxc5 h2
The race is getting closer, and there is nothing to stop black from getting his queen. My heart had started beating faster.

Position after Black's 52. ... h2

53. Ne3! blocks the rook from attacking the pawn
53. ... Ra1+
Position after Black's 53. ... Ra1+

This helps Black get his queen with a check.
54. Kxa1 h1Q+
55. Ka2 Qe4

This is the problem position mentioned earlier. I thought Morozevich's queen could be enough to prevent Anand from winning, and I was on the edge of my seat.
Now comes the knockout punch
56. Re5!

1-0
Black resigned.

Whit's e4 pawn is unstoppable now ! Because if
56. ... Qxe5
57. Ng4
forks the king and the queen.

As beautiful as 56. Re5! is, here is why it's great. Anand had seen this when he played 51.Rc4!, meaning he had seen the problem position in his mind, and solved it before even being played. So if you solved the puzzle, ask yourself, can you "see" it in your mind 4 moves before and solve it too ?

Anand played all his last 5-6 moved very fast. And when I saw the last rook move, it was the ultimate wow moment, forever etched in the memory.






Saturday, December 8, 2012

Cool to be a fool

Sometimes you like just one or two songs from an artist, but not many other. That's what happened to me with this song from Joe Nichols. He has a few other songs that have made it to the Billboard charts for Country Songs, but this is the only one I really like. Mainly because of the lyrics.

It's from the 2002 album "Man With A Memory". The album earned him Grammy nominations, and an award from Academy of Country Music. A couple of other songs from the same album were more popular than the one I have chose. The most famous, "Impossible" is quite good too.

It's a short song, so I am presenting the full lyrics here. The self-mocking is quite common in country songs, and this is a great example.
Here I sit, a nobody with no one
Bein' me, ain't really all that fun
Leavin' her, wasn't very smart
Admittin' I was wrong wouldn't be so hard

If it was cool to be a fool
I'd be the hippest guy around
If a heartache made you famous
I'd be known from town to town
If tears were made of pennies
And a cold beer brought her back
My bank account and self esteem
Would both be in the black
If some Hollywood producer made a movie that was sad
About some guy who lost the best thing he ever had
Hey, I could be a star
If it was cool to be a fool

But we all know the way it really is
You don't get recognized, for doin' things like this
You spend a lot of time, feelin' sorry for yourself
It doesn't really mean that much to anybody else
The video didn't make a whole lot of sense to me, but that's not uncommon with music videos. Enjoy ...


Friday, November 30, 2012

The Miracle of Freedom



Book Review : The Miracle of Freedom
Authors : Chris Stewart, Ted Stewart
My Rating : 3 out of 5

The complete title of the book is "The Miracle of Freedom : Seven Tipping Points That Saved the World"

Do you think that we are extremely lucky to be born in these times ? I do. My understanding of History suggests that, common people on an average have never lived a better life. In many parts of the world, people have the freedom to self-govern. It's not a perfect world, there is hunger and oppression in many countries, but remember, just a couple of centuries ago, democracy was virtually unknown to the most of the planet. Even in Western Countries with established democracies, suffrage became universal only in last 150 years or so.

All throughout history, almost everywhere in the world, lives of commoners had been considered near meaningless by whatever form of regime that existed. Wars and destruction have been all too frequent. The chance of being born to slavery was always much higher than being born in a privileged family.

Today's democratic system is not a logical outcome of any evolutionary process. It happened by chance. Considering how fragile it is in many societies, it's continuation is not a guarantee either. So how did our species come to this social destination that values individual freedom, and pursuit of happiness for everyone above some vague glory for a king or a religion ?

That is an enormously fascinating subject that the authors Chris Stewart (Republican Congressman from Utah) and Ted Stewart (Chief Judge of US District Court in Utah) tackle in their book. Or should I say, claim to tackle in this book.

First the good part. Their position about the exceptional state of today's political system is easy to agree with. They have a knack of engaging writing and make this a page-turner. The format of interleaving history, with stories of completely fictional characters works most of the time. Much of the presented history is accurate.

The bad news is plenty. I have no issues with their choice of events. I didn't always agree with the importance they give to a certain event, but it's a subjective choice. The problem is not this choice. The problem is the assertions they make.

If I have to summarize the book's arguments in once sentence, it is this. These key events saved Christianity and Western Europe, hence we have a political system that is based on individual freedom.

That's a bold claim bordering on propaganda. Especially the Christianity part. It's really hard to accept that any organized religion can be given credit for capitalism and freedom of thought. I am always willing to listen to a well-reasoned argument. No such argument came forth in the book. Instead, just a lot of assertions are made. Even for the not-religious aspect, arguments are not strong enough. I don’t think the defeat of Xerxes saved the world. Because I don’t think there is any evidence that the Greek kings were in support for democracy, and by all accounts the Persian Empire founded by Cyrus the Great was famous for its respect for human rights.

Although I am not a religious person, I happen to have a favorable view of most religions. I think a lot of good has come from Christianity or any other religions. I am not making a politically correct statement. I very sincerely think that, even when you subtract all the atrocities committed in the name of the religion, the impact of religion on human happiness is still positive. That's just my viewpoint on this gray area. Nevertheless, I simply cannot accept that capitalism and freedom derived from Christianity.

On the other hand, I do agree somewhat with authors about the positive contributions of the Western Europe to the development of democracy and capitalism. This is another touchy subject for most people. But it is not as gray subject to me. Foundation of most of the "modern" achievements in all forms of human thinking indeed happened in Western Europe. This is not to say, that no other society achieved anything, or have not made any contribution. Hence the keyword "modern". Why this happened is a complex subject, and I encourage everyone to read Pulitzer Prize winning "Guns, Germs and Steel" by Jared Diamond - one of the best books I have read.

But was this achieved in Europe because of Christianity or in spite of it ? The authors agree that there was a dark medieval period due to corruption in the Church, but still claim that Christianity is somehow responsible for reason and freedom of thought. That's simply an overreach. I am aware that most of the scientists, including Newton and Darwin, were Christian and religious. Still, if Christianity played a role in their discoveries and inventions, it was miniscule. And what about the political thinkers and philosophers, who formulated the theories and affected our way of thinking ? How much of the credit for the work done by all the thinkers from Adam Smith to Carl Marx can be attributed to Christianity - probably none.

If there were no religious angle to their arguments, the book would have had great merit. As it is, I guess this book will have an appeal to someone leaning towards the Conservative Christian spectrum of politics. For most others, it will be frustratingly unsatisfying.

Sunday, November 25, 2012

Alaska Animals and Birds

One of the main reasons to go to Alaska was to see the wildlife - especially the Grizzly Bears. Watching a grizzly bear fishing in the Kenai river was like a dream come true.

As I found out, taking pictures of wildlife is not so easy. They have more important things to do - like finding food for themselves and their family - and are not really willing to pose for the camera. In spite of the not-so-great quality of the photos, they still are warm reminders of an unforgettable experience.

You can click on any photo to start a slideshow.

This big guy was just over 50 feet away. He had found a nice secluded spot for fishing. He quickly found a fish and disappeared into the woods to eat.

It's very common to see the moose along many spots near the highway. This baby moose was slow to follow its mother into the thick tall bushes, so I could capture a few snaps.



Denali visitors are greeted with this sign. Notice the nails on the border. When the bears started chewing on the sign, these were put to prevent them from devouring the whole board !

We saw more than a dozen bears in one day.



A sow with 2 cubs.


The biggest surprise was seeing a wolf. In the millions of square miles, there are just over 70 wolves. So their sightings are rare.



There are many types of marine mammals too. The cutest are the Sea Otters. They prefer relaxing in ice cold water.


Another main attraction of Alaska is the Bald Eagle. It's a pleasure to see this huge and majestic bird smoothly glide across the sky.


Magpie is a very common bird seen nearly everywhere in Alaska.



One highlight was the colony of Kittiwakes, thousands of them nesting on sheer vertical cliffs.


Among the many migratory birds are the famous Sandhill Cranes.


These are all in the wild. If you love nature, Alaska is definitely a place to visit.

Sunday, November 11, 2012

Why I am happy about President Obama's reelection ?

I am neither a Democrat, nor a Republican. I tend to like positions taken by people who call themselves "Libertarian". Honestly, I don't like any label. I do not even want to be considered an "Independent". I would prefer to be labeled as "A Man With No Label". :-)

The ideas that appeal to me a lot are founded on fiscal conservatism, individual responsibility, personal liberty and small government. Especially the last one. Government ought to play as little role in our lives as possible. That sounds more like a Republican. So why am I happy that President Obama won ?

I voted for President Obama in 2008. I was very hopeful for a real change. I feel disillusioned like many others, but I still think it was a right decision to vote for him. He is not perfect, no one is. The types of issues a US President deals with are highly complex. It's not always easy to put the decisions in binary buckets of right and wrong. Reality is more nuanced, with very few moral certainties. I like his handling of foreign policy, especially ending the war in Iraq and hopefully in Afghanistan. The drone strikes are a much more complex issue. Such issues present very troubling philosophical questions. That's true even for the decisions about Economy. The bailout of the Auto industry can clearly be seen as against the principles of Capitalism. At the same time, it has been really positive. At least in the short term. These are issues on which arguments can go on forever.

My biggest disillusion comes from the fact that, the big boys on Wall Street have escaped without consequences for their actions that caused the economy to collapse. Maybe proving criminal intent is tough in such matters. Maybe their money has bought influence, and hence so few cases have been brought against Wall Street by the Obama Administration. A clear wrong decision was to appoint the same people - Lawrence Summers, Timothy Geithner - who share the blame for the crisis, in charge of solving the crisis.

The trickiest issue is of course the health care reforms. I do not know enough on this subject, so I am confused. Interestingly, that wasn't really a differentiating factor in the election, as Obamacare seems to me very similar to Romneycare.

These are matters of personal opinion. No president is ever going to make decisions that everyone agrees with. Some decision will turn out to be good, some bad, most both good and bad. So what, if there are decisions that I find wrong ? What matters to me is, does the President have the right intentions ? Does he really care about helping the nation ? I think President Obama does. I never thought that about Romney. How do I know that's how they really feel ? I don't. It's my perception based on their words, their actions and their life. You can say, the President fooled me. Maybe he did. But Romney certainly didn't fool many. And that's the point.

More importantly, most of the Republican Party seems that way to me. It’s not that the Democratic Party has fooled me. I don't believe for a minute that the Democratic Party is the party that cares for poor, and for minorities, and for immigrants. They just don't seem to be openly against these groups, they may be even pandering to them. The Republican Party on the other hand seems to be pandering to only rich, and to a small section of the country. If that's an incorrect perception, then the Republicans haven't conveyed their message effectively.

That's unfortunate. I don't want the Republican Party to be labeled as such. For better or worse, these are the only two parties we will ever have for the foreseeable future. I want both of them to be strong, to counter balance each other. I live in California, and the state government is scarily Democratic. It's a big government that seems to be controlled by public unions and always looking for excuses to increase taxes. I tend to vote Republican in local elections, but my vote hasn't mattered much.

Without a strong Republican opposition, the Democratic controlled government may very well spend us to bankruptcy. But how can I believe in Republican cries for fiscal conservatism when they care about it only when not in power ? When President Bush started two wars without funding, and was increasing the deficit by providing tax cuts to the wealthy, the Tea Party was nowhere to be found. How can I believe a party (or its candidate) when social welfare is claimed to be dragging the country down, but corporate welfare is seen as a solution ? How can a hard working person who fails to earn over the minimum income tax bracket is seen as a free-loader, but a corporation which succeeds in using tax loopholes to avoid paying a dime in taxes is something to be proud of ? It's possible that the people who give their vote to the Democratic candidates do not hate rich, contrary to what is often claimed, and perhaps they see that the rich have rigged the system, and hence support increasing the taxes on them.

The Republican Party's message about fiscal conservatism is muddled, sounds hypocritical and generates suspicions. That's not all. It comes with the baggage that's impossible for me to accept. For example, global warming to them is an opinion, not a scientific fact. What we need is a debate on effectiveness of the solutions, not a debate on whether global warming is real. Their views on the issues surrounding women's health are outright despicable.

It's legitimate for them to question President Obama's competency. He should be called on the embarrassing debacle on "Operation Fast and Furious" and complete mishandling of the Benghazi situation. But it has to be done in the total context of his foreign policy, which includes many accomplishments as well. He didn't sell out America, he made mistakes. Even Republican presidents make mistakes. He could have done more to help the economy, sure. But he did quite a few positive things, and recovery, albeit slow, is happening. Let's be real. Neither President Bush can be completely blamed for the economic collapse, nor President Obama can be completely blamed for the tepidness of the recovery. The repercussions of the deleveraging caused by the collapse of asset bubbles will go on for a long time.

The degree of competence of the Obama Administration is a matter of opinion, which as expected varies along party lines. Even if I agree with republican campaign about the level of incompetency (and I don't), what's the replacement ? Except Ron Paul, every one of their candidates in primary seemed plain crazy. I would have voted for Ron Paul, even with his controversial past. Because he would have been the right choice for our problems today. Put simply, the Republican Party failed to offer a reasonable alternative.

I am happy about the election result. Relieved, more than happy. President Obama's reelection was not just a personal victory. It was defeat of a vicious campaign that started right after his first election. I could never understand the hatred for President Obama. The man received very little cooperation from Republicans. It was as if they cared about defeating him more than helping the country. It backfired. In spite of the state of the economy.

I hope the Republican Party takes a cold hard look at their failings. I hope they are led in future by someone more like Chris Christie, Rand Paul, Marco Rubio and not Paul Ryan or Sarah Palin. I hope they figure out that being compassionate is possible while being conservative. That science and God can co-exist quite well for most people. And managing perception about themselves is more important than creating misperceptions about their opponent. Because when both parties are strong viable alternatives, the country as a whole will benefit.

Sunday, November 4, 2012

Project Euler : Problem 49

If you want to challenge yourself at writing algorithms to solve mathematical problems, then Project Euler is a nice site for you. The problems have a wide range of difficulty. I found the problem 49 surprisingly rich in terms of strategies that can be employed to solve it.

The problem statement is :
The arithmetic sequence, 1487, 4817, 8147, in which each of the terms increases by 3330, is unusual in two ways: (i) each of the three terms are prime, and, (ii) each of the 4-digit numbers are permutations of one another.

There are no arithmetic sequences made up of three 1-, 2-, or 3-digit primes, exhibiting this property, but there is one other 4-digit increasing sequence.

What 12-digit number do you form by concatenating the three terms in this sequence?
Unusual indeed. The numbers have to be prime and permutations of each other, and make up an arithmetic sequence.

Of course, there are many ways to solve the problem. One obvious candidate is use some sort of brute force approach. But what's the fun in doing that ? So I decided to try an efficient approach. I am sure there are many alternatives. The one I tried is as follows.

Note that there are 3 unusual properties. I used them to break the problem in 3 steps and wrote a small, efficient program for each step.

1. Generate Prime Numbers.
Obviously, if we inspect only the 4 digit prime numbers, it's going to reduce the problem space and speed up the solution. As long as generating prime numbers is not expensive. The standard textbook solution for this is to use "Sieve Of Eratosthenes", that offers a near linear algorithm to generate the prime numbers. You can find more explanation here. Using this program, we generate a list of 4-digit primes in ascending order.

2. Group the numbers that are permutations of each other
By treating the numbers as string of digits, we can compare any two numbers to check if they are permutations of each other. The brute force algorithm will have O(N^2) complexity. I wrote an algorithm with linear complexity that works especially well when the cardinality of alphabet set is not very high. You can find the algorithm here. With this step done, we have grouped together all the 4 digit primes that are permutations of each other. Since the original list of all the primes was already in sorted order, each group is also sorted in ascending order.

3. Find the arithmetic sequence
This is bit harder than the first 2 steps. Now, if you just want to examine a given sequence of numbers to decide if it is an arithmetic sequence, then that's very easy to do. But that's not what I wanted. I wanted to write an algorithm to find all the arithmetic sequences within a given sequence. Solving this more generic problem is NOT necessary to solve the Project Euler problem. Becase we are told that the sequence contains only 3 numbers. Moreover, we have already grouped the numbers based on permutations. So either the group is a desired sequence or not. That's simple to test. But if you were not given the problem specific information, then you have to find an arithmetic sequence within  a larger sequence. For example, I found a set of 11 primes that are permutations of each other. The entire set is not an arithmetic sequence. But a subset could have been. You can find the details of my solution to the generic problem here.

By connecting these steps, you can find the solution of the problem. On my MacBook Pro, it took less than one minute for my Java program to generate all the prime numbers, group them based on permutations and find the sequence.

Some interesting facts. There are 174 permutation groups within the 4 digit primes that have more than 3 members in it. For example
[3253, 5233, 5323] 
[6899, 8699, 8969, 9689] 
[2039, 2309, 2903, 3209, 9203].

The longest two have 11 primes in each !
[1237, 1327, 1723, 2137, 2371, 2713, 2731, 3217, 3271, 7213, 7321] 
[1279, 1297, 2179, 2719, 2791, 2917, 2971, 7129, 7219, 9127, 9721].

But none of these contain any sequences.

The most curious fact is not mentioned in the problem. The other prime permutaiton sequence, has exactly the same difference in it's terms, 3330 !! That means : The only 2 arithmetic sequences of 4 digit primes such that the numbers are permutations of each other, have exactly the same difference. The one was already given in the problem. The other one we have to find. Both sequences have the same difference, 3330. Really interesting.

The Project Euler guidelines suggest not to disclose the solution. It's OK to explain the strategy. Hence I have not given the solution here.

Monday, October 22, 2012

English Vinglish

Movie Review : English Vinglish
Director : Gauri Shinde
Genre : Family Drama
Starring : Sridevi, Adil Hussain, Sulabha Deshpande, Priya Anand
Released : October 2012
My Rating : 7 out of 10

I rarely write reviews of Indian movies. Firstly, I am not a professional reviewer. Mostly, I just want to note my reactions. Secondly I write a review, when I want to talk about a good movie that deserves to be watched and people around me seem to have missed it. For an Indian movie, everyone has seen it before me, because I don't go to theaters as often, and I refuse to watch pirated DVDs. So there is not much point writing the review - notable exceptions being Dharm and Khamosh Pani.

I watched "English Vinglish" becuase it seemed a rare family friendly Bollywood movie, and it is. It is a comeback movie for actress Sridevi, who ruled the Indian box office in her prime. That was a less of a reason for me, as I was one of those odd people who was totally apathetic to her star powers. I could never tolerate her dialogue delivery, and this movie reminded me that strongly. She did have the charisma and acting skills to carry an entire movie on her shoulders, and she does that with spades here.

Sridevi plays the central character of Shashi Godbole, a middle-aged housewife, with a good family - a successful and faithful husband, a typical teenaged daughter, an adorable son, and for a change, a supportive mother-in-law. Shashi is a great cook, and in spite of the daily struggles, manages to run a small operation of selling homemade sweets. It's a simple life. Simple, however does not mean, without sorrows. In spite of being totally devoted to her family, she is under-appreciated, and often a subject of mockery and put-downs. The reason - her lack of ability to fluently speak English. She has to travel to New York to help with her niece's wedding. While there, she enrolls herself in a crash course to learn English. This experience turns out to be a course in self-discovery as well.

The simplicity of this story is the strength, because it's told sincerely. This sincerity ensures that it doesn't become unrealistic. When Shashi completes her course, her English still sounds rough. She doesn't defeat anyone in the knowledge of the language - she just learns enough to get by.That same sincerity is also highlighted by a near lack of extremes. Shashi's family comes across not as some exceptional case, but one that we all can relate to. Their interactions are not contrived, but are those we all have experienced and/or seen in our lives. She is not being treated terribly by her family. She is not just being treated respectfully.

That's an important point the movie succeeds in making. As Shashi says in a scene, she doesn't need love, she has it, what she needs is respect. Hence there was never a scope for an affair or a love triangle. It's a movie whose characters are mature and composed in their behavior.

It's not a perfect movie. There were places where I cringed. The biggest problem is the constitution of the group of students. A Mexican nanny, a Pakistani cab driver in New York, a French cook, a South-Indian Software Engineer with problems with his English accent, an Asian lady who works in a hair salon ! If that's not stereotyping on steroids, then I don't know what is. Of course, the teacher is gay - filling the obligatory role of the nice person belonging to a minority group, which happens to be gays these days. Such formulaic treatment unnecessarily reduces the impact of the theme.

Fortunately, the director avoids other clichés. The difficulties faced by a visitor in a foreign land are kept realistic, and not used to create unnaturally uncomfortable scenes. And thankfully, there is no preaching. No over-the-top emotional reunions at the end. The movie makes effort at every juncture to avoid being overly sentimental. It still is predictable. In a movie like this, that's what we want. Predictable happy ending.

Sridevi is being praised for her effort here, and it's well deserved. What should also be mentioned is, acting is really good across the board. Although her character is feeling neglected in the story, the movie revolves around Sridevi and kind of neglects almost everyone else. Not a huge minus, because whatever we need to learn about other characters, the director manages to convey that in brief scenes.

I have to tip my hat to director Gauri Shinde. It's a great debut. The first couple of opening minutes were my favorite. In just a few frames, without showing anyone's face, she built the foundation of the story - in Shashi's family everyone else's needs come before hers. Brilliantly done. This is as much Gauri Shinde's movie as it is Sridevi's.

I recommend this movie to even those who haven’t watched many Bollywood movies. It's slow. It's not great but it's very good, and quite safe for kids of these days.

(Trivia: The movie being shown in the flight that Sridevi's character watches is "Sourcecode").

Saturday, October 20, 2012

Source Code

Movie Review : Source Code
Director : Duncan Jones
Genre : SciFi / Action
Starring : Jake Gyllenhaal, Michelle Monaghan, Vera Farmiga
Released : 2011
My Rating : 8 out of 10

About 20 years ago, "Groundhog Day" successfully used the idea of someone stuck in a time loop, to create a memorable movie.  As you watch "Source Code", it is impossible to not be reminded of it. The 1993 Bill Murray movie was firmly in the "Romantic Comedy" genre, and did not offer any explanations as to why the time loop happened. On the other hand, "Source Code" is an action thriller, and does offer some explanation as to why this time loop is happening.

Near Chicago, a train is making its routine journey. On board, Sean (Jake Gyllenhaal) wakes from his nap. He is sitting in front of a young woman who is acting as if she is his girlfriend. Sean doesn't recognize her. In fact he doesn't even think he is Sean. He thinks he is a soldier (Colter) and should have been in Afghanistan. As he is trying to make sense of all this, suddenly there is an explosion and Sean finds himself trapped in what seems like a remote isolated spaceship. Here on a screen a woman appears, indeed refers to him as Colter, provides little explanation and sends him back to the same point in time where he wakes up from the nap.

These first opening minutes are brilliantly done. Our curiosity is perked, we are confused a bit and desperately want to know what's going on. Next few iterations in the time loop reveal more and more details. As we get more clarity about what's going on, we start wondering why and how it's happening. That's when the movie starts feeling a bit lost in the maze.

Giving more details would reduce the impact of the style of the narrative – a style often labeled as "mind bending". We are told that past cannot be changed and the aim of the time travel is to only understand it more. That's a very reasonable premise. In any movie like this, you have to allow for certain technological feats. Sending someone's mind back in the past and superimposing it on another person's brain is the core idea here. Take it or leave it.

Since the character goes back in time to the same spot, there is a lot of repetition in subsequent events. Both director Duncan Jones and writer Ben Ripley are successful in overcoming this big challenge. Whether you like the movie or not, you will not be bored. The story moves faster than the speed of the train on which it happens. It also helps that, at just about 90 minutes, it is not over-extended. The problem is elsewhere - incomplete explanations.

Jake Gyllenhaal is the centerpiece of the movie. His personality is simple and likeable, and his acting skills are more than adequate for this role. He starts out as much confused as us, pieces together the puzzle for and with us. As both Sean and Colter, he shows the progression of his realizations as the movie goes on.

As you can imagine, there are two things we are trying to solve here as viewers. Who is the bad guy that's causing the explosion, why is he doing that and how will he be stopped. Secondly, why is Colter being forced to undergo this traumatic time travel and how will it be resolved. The first works as the action movie, second works as the SciFi movie. The action movie is very flat. The whole "save the next terrorist attack" is not gripping at all. But it's realistic - because the "Source Code" technology only allows you to go back 8 minutes or so. Why 8 minutes, who knows ! Given that constraint, our hero can do only so much.

The SciFi part is the most interesting. From "Matrix" to "Inception", a common theme is to present the mind as something far more potent than the physical existence in which it is realized. Sometimes it's done via virtual reality, sometimes via mind manipulation. Here it's slightly different. The pseudo-philosophical discussions generated by such movies irritate me. But it's also true that a lot about mind and universe is still a mystery to us. Spoiler alert : If the movie makes you want to know more about what it says in the end, you can read Hidden Reality - but after watching the movie.

I recommend this movie as a solid science fiction movie. Know in advance that some of your questions will remain unanswered.


Sunday, September 30, 2012

GaDiMa-4

One of the aspects of GaDiMa's music that has always amazed me is the sheer range of emotions expressed in his songs. Being a lyricist for movies offered him many opportunities to write about all sorts of situations. He utilized these situations to write simple, touching and amazing lyrics.

The noted Marathi poet Suresh Bhat has penned many songs that are famous for the sensuous feelings expressed in them. This song written by GaDiMa from movie "मुम्बईचा जावई" is in the same category. Now it's not my unfair intention to pigeon-hole Suresh Bhat lke that. He has written amazing GHazals in Marathi. But, it's also true that many of his sensuous songs are very well-known. I am just comparing this GaDiMa song to those.

कारे दुरावा, कारे अबोला,
अपराध माझा, असा काय झाला ?

I have a complaint against this song. This is a blatantly unrealistic मुखडा (refrain). Which wife in this world even entertains a suggestion that she is the one to be blamed ? And asks her husband why he is not talking to her ? The husbands are not asked the reason for their silence, they are supposed to stay silent. :-)

Asha sounds just wonderful here. In a song that is less about स्वर (notes) and more about भाव (emotions), she adds a nice touch of  लाडिकता when she sings

नीज येत नाही मला एकटीला,
तरी ना विचारी धरी हनुवटीला,
मान वळविसी तू वेगळ्या दिशेला ...

The tune by the great Sudhir Phadake is sublime. Just as the lyrics become more direct in the last stanza, he shifts the gears a bit.

रात जागवावी असे आज वाटे,
तृप्त झोप यावी, पहाटे पहाटे,
नको जागणे हे, नको स्वप्नमाला ...

Quite explicit for that age, but not cheap.

The movie was remade in Hindi as "Piya Ka Ghar", starring Jaya Bhaduri, Anil Dhawan with the famous Kishore song, "Ye Jeevan Hai". Still no comparison to the soundtrack of the Marathi movie. I will cover the other songs from the movie in later posts.




Previously :

Sunday, September 16, 2012

Spartacus


Review : Spartacus (A TV series)
Aired on : Starz
Released : 2010
My Rating : 5 out of 10

Starz released the first season of the Spartacus series in 2010, titled "Spartacus : Blood and Sand". The lead actor - Andy Whitfield - was diagnosed with cancer, and production of the sequel had to be stopped. While he was being treated, Starz produced a prequel instead. Sadly, Whitfield passed away in 2011 and the sequel was later produced with Liam McIntyre playing the lead role.

I have only watched the season 1 on DVD, and this review is specifically of that season.  It consists of 13 episodes, each of 1 hour.

The story is loosely based on historical facts. In ancient Roman empire, around 70 BC, there was indeed a slave gladiator called Spartacus. He was probably captured from Thrace (modern day Bulgaria) and served in a "ludas" (gladiator school) in the city of "Capua". He organized a rebellion by forming an army of fellow slaves. The Roman Army eventually crushed their rebellion in what's now known as the "2nd Serville War".

Season 1 starts with the capture of Spartacus, and ends with the successful start of his rebellion. Almost all events in between are completely fictional as historical details of Spartacus remain obscure.

When I wrote the review for "Rome", I added a strong warning that it's not fit even for teenagers. Spartacus leap frogs Rome in the aspect of being offensive, and falls woefully short in everything else. If you couldn't watch Rome because it was too explicit, you shouldn't even think about watching Spartacus. If you liked Rome (and I did), for its gripping narrative, you shouldn't expect the same from Spartacus.

The idea here is to shock the viewers. Plain and simple. The appropriate name for this series would have been "Blood and Skin", as that's all the series seems to be interested in. It's possible that for some viewers, this is a guilty pleasure. To me, it was beyond saturation. The same types of scenes are shown over and over again.

There is a small kernel of a good plot here. Although these are gladiators, they are just glorified slaves, with no rights, no freedom and just objects that can be sacrificed for the entertainment of the elites. It's impossible to not feel their plight. There are some political machinations, and they add some intrigue to the storyline. The focus of the series is elsewhere. To appeal to the base instincts, by showing beautiful women fawning over bare chested savage hunks, who are bent on killing each other in the most grotesque way. With the topic being gladiators, one might expect fight sequences that keep you on the edge of your seat. Alas, they are quite unrealistic - inspired more by the movie 300, than say Troy. (Note : Troy was NOT a good movie, but had great duels. And 300 was a visually impressive movie, but it's not famous for duels.)

The acting is a bright spot. Andy Whitfield as the lead actor is superb and convincing. A trivia : In the late 90s, there was a series with more modest aspirations, called "Xena: The Warrior Princess". It had good ratings in the demography "adult male", solely because of Lucy Lawless. She expertly plays the role of Lucretia here. The best performance though is by John Hannah who plays the role of Quintus Batiatus, owner of the ludas, which happens to be the only multidimensional character in the story.

I am not sure if I can recommend Spartacus. It's not that it fails at being good art. It's just that it has no intention of being a good art. The series is very clear about its goals. There is no point watching this series with the expectation of watching a historical fiction, and complaining that it fails to deliver. It delivers perfectly well, but something totally different - lot of sex and lot of unrealistic violence. If that's not what you want, don't watch this.

Monday, September 10, 2012

Finding Arithmetic Sequences

As a final step of solving a problem, I needed to find out arithmetic sequences within a series of numbers. I am not sure if there is a more efficient algorithm than what I wrote. This one will do the job just fine - the complexity is quite close to O(N^2), which seems fair to me.

The problem.
Given a series of integers in ascending order, we have to find all the arithmetic sequences that occur in the entire series. An arithmetic sequence is defined as a sequence of 3 or more integers in ascending order such that difference between any pair of consecutive integers is same.
For example.
In the series, 2 3 4 5 6 7 8 9, there are 5 sequences. The entire series is a sequence with difference as 1. Then there are (2 4 6 8), (3 5 7 9), (2 5 8) and (3 6 9).
A number can be part of multiple sequences, and multiple sequences can have the same difference between the consecutive integers.

This possibility of a number being in multiple sequences may make the problem seem harder. It isn't that hard.

The idea behind my solution is simple.
1. Iterate over the sorted array from the first element to the second last.
2. For each number i, iterate from the next number j to last. This gives us all the pairs [i,j].
3. For each pair, find the difference, d = j - i.
4. Keep a map with this difference d as the key, and for value - a list of all sequences that have this difference in its consecutive numbers. Note that this will be a list of sequences, as there can be more than one sequence for that difference.
5. See if the difference was already encountered, if not create a new list of sequences.
6. If there was an existing list of sequences, find the sequence in that list that has the first number i. If a sequence was found, add j to it. If not, we create a new sequence and add i and j to it. It's very important to note that for a given difference, there can be only one sequence that has the number i in it. For a sequence, we will use a set data structure.
7. At the end of all iterations, we have created an interesting data structure. At the top level is the map, that uses an the difference between consecutive integers as the key, and for value it has a list of sequences that have that difference. And each sequence is a set.
8. When using this data structure, we have to discard the sequences that have only 2 elements in it.
Let's see how this work for the sequence 2 4 5 6 8 9. The following list shows how the data structure will look after each iteration.

i = 2, j = 4. Map { 2:[(2,4)] }
i = 2, j = 5. Map { 2:[(2,4)] 3:[(2,5)] }

i = 2, j = 6. Map { 2:[(2,4)] 3:[(2,5)] 4:[(2,6)] }
...
i = 4, j = 5. Map { 1:[(4,5)] 2:[(2,4)] 3:[(2,5)] 4:[(2,6)] 6:[(2,8)] 7:[(2,9)] }

i = 4, j = 6. Map { 1:[(4,5)] 2:[(2,4,6)] 3:[(2,5)] 4:[(2,6)] 6:[(2,8)] 7:[(2,9)] }
i = 4, j = 8. Map { 1:[(4,5)] 2:[(2,4,6)] 3:[(2,5)] 4:[(2,6) (4,8)] 6:[(2,8)] 7:[(2,9)] }

Note that till these iterations, there is only one true sequence in the data structure above : 2:[(2,4,6)]. Of course more would be found in later iterations.

With this, let's look at the Java code.
/**
 *  Finds arithmetic sequences within a list of sorted numbers
 */
public static void findSequence (int[] nums)
{

    // Iterate over the array
    // Starting from first element, till second last element
    // For every element, iterate over the list again to find all pairs
    // For every pair, find the difference
    // For the difference, find the sequences
    //
    // There can be multiple arithmatic sequences for the same difference.
    // See if the lower number is already part of any sequence for that diff.
    // If yes, then add the higher number to that set.
    // Else, create a new set, add both numbers to it
    //
    // Any set that has 3 or more elements
    // is an arithmetic sequence.


    // Note the data structure.
    // Map the difference to a collection of sequences.
    // Each sequence is a SortedSet

    Map >> arith_sequences
        = new HashMap >> ();

    for (int i = 0 ; i < nums.ltheength - 1 ; i++ ) {
      for ( int j = i+1 ; j < nums.length ; j++ ) {
        // work on each pair
        long diff = nums[j] - nums[i] ;
        if ( ! arith_sequences.containsKey (diff) ) {
          // create the collection when the diff is
          // encountered for the first time
          arith_sequences.put (diff, new ArrayList>()) ;
        } //
       
        Collection> sequences_for_diff
                   = arith_sequences.get (diff) ;

        boolean found_sequence = false ;
        for (SortedSet sequence : sequences_for_diff) {
        if ( sequence.contains (nums[i]) ) {
            found_sequence = true ;
            sequence.add (nums[j]) ;
            break ;
        } //
      } //
      // if no sequence was found that contained i,
      // then create a new one
      if ( ! found_sequence ) {
        SortedSet sequence = new TreeSet () ;
        sequence.add (nums[i]) ;
        sequence.add (nums[j]) ;
        sequences_for_diff.add (sequence) ;
      } //
    } //
  } //



} //

The complexity is obviously at least O(N^2). For every pair of thse N*N pairs, we iterate to find the sequence that has the lower number in it. Intuitively, it may seem that the worst case will happen when the array contains N consecutive integers from 1 to N. Then the map will have keys for each number from 1 to N-1. But the value will have a list that contains only one sequence, and it will be found in just one iteration. For multplying the complexity, we need the list to have many sequences for the same difference. This depends on the data. Honestly, I do not know how to compute that complexity. Of course the cost of manipulating the data structure - adding a number to the sorted set should also be taken into account. Again, it's getting added only at the end - so that should be fast.

In any case, this is simple, and reasonably efficient algorithm for the job.

Friday, September 7, 2012

Work In Progress

One of the strengths of Alan Jackson's music is the lyrics. If "Remember When" was very sentimental, this "Work In Progress" is a humorous admission of every husband's incompetence, and their inability to win some approval from their better half. Let's call it Husbands Anthem.

Admittedly, this tune is not all that great. But Alan's singing makes up for it, and it is funny.
Alright, I admit it; I forgot our anniversary.
I did pick up the baby this morning at the nursery.
That ain't no big thing; It's a gold star for me.

You get tired and disgusted with me,
When I can't be just what you want me to be.
...
I even asked the Lord to try to help me:
He looked down from Heaven, said to tell you please;
Just be patient, I'm a work in progress.

My personal favorite is
I try to do that health thing like you want me to do,
That low-fat, no fat's gettin' hard to chew.
Now, I love your cookin', honey,
But sometimes, I need some real food.



Previously :
It's a little too late
Remember When

Monday, September 3, 2012

Is Everyone Hanging Out Without Me?



Book Review : Is Everyone Hanging Out Without Me?
Author : Mindy Kaling
My Rating : 3 out of 5

The complete title of the book is "Is Everyone Hanging Out Without Me? (And Other Concerns)".

Like so many other books, I came to know about this book when the author was interviewed on The Daily Show. I became interested, because I had never heard of Mindy Kaling before.

So a couple of admissions before I begin the review. I have not watched the NBC show "Office". I have heard great things about it (and the original BBC show), but never saw it. After reading the book, I definitely plan to watch it on DVD.

Secondly, I am not a fan of the genre "auto-biography" or "memoir". I think there are very few people in this world who live a truly extra-ordinary life, and should tell the details about their own lives to others.

With this bias and the complete lack of knowledge about the author, I started reading the book with some curiosity. Curious, because I was pleasantly surprised to find a lead writer of "Office" to be a child of Indian immigrants. And the title is definitely catchy.

This is a memoir sprinkled with many random observations. Some chapters are about her life as child of loving parents. Some about how she got to be where she is today. Some chapters are just randomly inserted observations.

She comes across as a very normal person. Someone who you would love to have as a friend. She doesn't shy away from bragging once in a while, but is mostly honest. The writing is smart, frank, quirky, cute and definitely funny. All this adds up to a book that can be hilarious at many places and be read quickly.

But still, all that cannot hide the flaws. One of which is, the book oozes with narcissism. I do not want to take away any of her achievements. I just don't think these are great enough to write a book about - yet. I wish her well, I hope she continues her success. But right now, there is not enough substance to be written about. Hence, lot of small chapters are added about various lists, such as what is her definition of friendship, what she looks for in a guy and all those topics that everyone thinks of themselves as an authority. Then, there are many inside jokes that I didn't really care about.

I am on the fence about recommending this book. It is funny. Maybe you can browse through some chapters (in any order, it really doesn't matter), and see if you want to read more. It's a pleasant read that will make you laugh, but I am not sure if it's worth the time to read from start to finish.

Wednesday, August 22, 2012

Alaska : Aerial Photos Of Mount McKinley

Mount McKinley is the tallest peak in North America. At just over 20,000 feet, it is not much of a competition to even the top 25 peaks in Himalaya. But it boasts a majestic view in Denali National Park. Incidentally, Denali is the native name of the mountain.

Photos of the mountain are ubiquitous in Alaska brochures, especially with its reflection in Wonder Lake. I would say that's false advertizing. Because very few people ever gets to see that ! When we visited the park, we took the only allowed mode of transportation - the shuttle bus - as far as it takes you - all the way to the wonder lake. The bus driver told us that only 10-15 % people get to see the full view of the mountain. The "Great One"  (that's what Denali means) is quite moody and makes its own weather, and likes to hide behind clouds on most days. Add to that there has to be no wind, else the lake will have ripples and reflection won't be that good.

Even with the slim chance of seeing the mountain in its full glory, the park is on the must-visit list for many other reasons. We got to see a glimpse of the peak of the mountain for just few minutes. So no photos from the ground. But we did get to see the mountain and its glaciers from the air ! The sight fills you with awe.








Saturday, August 18, 2012

Alaskan Humor

I have heard this kind of joke before, but never seen/heard anyone actually make the mistake.

Just last week in Alaska, we needed to carry food with us for the whole day. So I went to a Subway and ordered a few footlong sandwiches. I requested them to cut each in 4 pieces and wrap it as two 6 inch subs, and put a label in every bag.

When I went to pick up my order, every bag was labeled, and on the back of each label were these notes.


They were really nice people and obviously not native English speakers. So I don't want to publicly embarrass them and hence I won't reveal which town this was in. But I can answer one question right away that many of you might have. No, they were not of Indian origin.

Sunday, August 12, 2012

Alaska !

Alaska ! The great land. The last frontier.

Over last many years, I have watched numerous nature related shows on PBS/Discovery channel. Some of them multiple times, especially if they are about Alaska or Africa. The calving of tidewater glaciers making thunderous sounds. Cute Sea Otters playing on the floating broken ice. Thousands of Kittiwake living in a colony on a sheer vertical cliff. Bald Eagles smoothly gliding across the sky. Endless forests of Spruce and Birch trees. The giant Mount McKinley towering in the harsh Denali National Park. Dall Sheep standing on slopes that seem impossible to navigate. Migrating birds. The unbelievable life cycle of Salmon who come back to their birthplace to spawn and die. And of course the bears. Alaska is bear country, and I am totally fascinated by bears. I can watch them all day, especially if they are fishing.

I have watched these scenes over and over again. Dreaming, that one day I will be able to experience all this. And now I can say that I have. I watched the glaciers calving, heard the thunder. Observed the otters playing in ice cold water. Watched the Kittiwake colony in amazement. Saw the majestic Bald Eagle taking off from the peak of a tall tree. Saw the migrated Sandhill Cranes. Took aerial shots of Mount McKinley and its glaciers. Saw the Dall Sheep moving around the scary slopes. I was lucky enough to see one of those few wolves in Denali and the illusive lynx. Saw how the salmon turn crimson at the end of their life cycle.

Yes, and to top it all, I saw the bears. Saw them sprinting across the fields. Saw them digging up roots. Was thrilled by seeing a sow and her two cubs. Watched them taking their signature stroll. And I saw one fishing and eating a salmon in the Kenai river. That was a sight I will never forget.

This was a dream come true. And I still want more. I have yet to see the two largest land carnivores in the wild. The polar bear and the Kodiak bear.

I came back less than 24 hours ago. And I am already missing Alaska. At least I have the photos. Hundreds of them. I will upload them as soon as I am done sorting.

Sunday, July 22, 2012

Mendocino Flowers

During a recent camping trip, we visited Mendocino. It was a very cloudy / foggy day, so I could not take any good pictures of the coastline. So the attention turned to the flowers in the front-yards of all the shops in the downtown. They have a very nice variety of flowers there.








Related Posts Plugin for WordPress, Blogger...