Thursday, April 30, 2015

How does the calculator percent key work?


The Windows calculator percent sign works the same way as those cheap pocket calculators (which are often called four-function calculators even though they have around six function nowadays). What you first have to understand is that the percent key on those pocket calculators was not designed for mathematicians and engineers. It was designed for your everyday person doing some simple calculations. Therefore, the behavior of the key to you, an engineer, seems bizarrely counter-intuitive and even buggy. But to an everyday person, it makes perfect sense. Or at least that's the theory.

Let's look at it from the point of view of that everyday person. Suppose you want to compute how much a $72 sweater will cost after including 5% tax.¹ Pull out your handy pocket calculator² (or fire up Calc if you don't have a pocket calculator) and type

72 + 5% =

The result is 75.6, or $75.60, which is the correct answer, because 5% of 72 is 3.6. Add that to 72 and you get 75.6.

Similarly, suppose that sweater was on sale at 20% off. What is the sale price?

72 − 20% =

The result is 57.6 or $57.60. This is the correct answer, because 20% of 72 is 14.4. Subtract that from 72 and you get 57.6.

You can chain these percentage operations, too. For example, how much will you have to pay for that 20%-off sweater after adding 5% tax?

72 − 20% + 5% =

The result is 60.48. A mathematician or engineer would have calculated the same result via the equivalent computation:

72 × 0.80 × 1.05 =

Okay, now that we see how the calculator product designer intended the percent key to be used, let's look at what the calculator engineer it has to do in order to match the specification. When the user enters A + B % =, the result should be A × (1 + B/100) or A + (A × B/100) after you distribute the multiplication over the addition. Similarly, when the user enters A − B % =, the result should be A × (1 − B/100) or A − (A × B/100).

Aha, the calculator engineer says, we can achieve this result by defining the percent key as follows:

When the user enters a value, an operator, a second value, and then the percent key, the first two values are multiplied and the product divided by 100, and that result replaces the second value in the ongoing computation.

Let's walk through that algorithm with our first example.

You type

First value is 72

Operation is addition

Second value is 5

72 × 5 ÷ 100 = 3.6

3.6 becomes the new second value

72 + 3.6 = 75.6, the final result

If you watch the display as you go through this exercise, you will even see the number 3.6 appear in the display once you press the % key. The percentage is calculated and replaces the original value in the ongoing computation.

This algorithm also works for the chained percentages.

You type

First value is 72

Operation is subtraction

Second value is 20

72 × 20 ÷ 100 = 14.4

14.4 becomes the new second value

72 − 14.4 = 57.6, intermediate result

57.6 is the new first value

Operation is addition

Second value is 5

57.6 × 5 ÷ 100 = 2.88

2.88 becomes the new second value

57.6 + 2.88 = 60.48, the final result

This even works for multiplication and division, but there is much less call for multiplying or dividing a number by a percentage of itself.

500 × 5 % =

The result of this is 12,500 because you are multiplying 500 by 5% of 500 (which is 25). The result of 500 × 25 is 12,500. You aren't computing five percentof 500. You're multiplying 500 by 5% of 500. (It appears that the authors of this Knowledge Base article didn't consult with the calculator engineer before writing up their analysis. The percent key is behaving as designed. The problem is that the percent key is not designed for engineers.)

What if you want to compute 5% of 500? Just pick a dummy operation and view the result when you press the percent key.

500 + 5 %

When you hit the percent key, the answer appears: 25. You could've used the minus key, multiplication key, or division key instead of the addition key. It doesn't matter since all you care about is the percentage, not the combined operation. Once you hit the % key, you get your answer, and then you can hit Clear to start a new calculation.

Monday, April 27, 2015

More One - Ways in Bangalore


I was out for a ride Sunday night, and almost got a ticket, because I didn't know they had converted the two lane either way traffic to a two lane one way in Madiwala.

To decongest traffic on Hosur Road, the city police have put some restrictions on the traffic flow at Silk Board and Madiwala junctions from Sunday.

While motorists will be allowed to go from Silk Board Junction to Sarjapura Road Junction and Madiwala check-post, movement of vehicles going to Hosur Road from Madiwala check-post will be restricted.

Vehicles coming from Sarjapura Road junction can go up to Krupanidhi College junction, take a right turn and join Madiwala Santhe Beedi to reach Madiwala Police Station junction-Total Mall junction, Silk Board junction to proceed to Hosur Road.

Motorists going towards Maruthi Nagar can take a right turn at the Koramangala water tank junction, take a right at the Kendriya Sadan and proceed further.

Traffic going towards Madiwala and Silk Board from Koramangala BDA Complex by taking a left turn at Koramangala Water Tank junction, reach Krupanidhi College junction and reach Hosur Road via Madiwala Santhe Beedhi.



Pencil Sharpening is a Serious Business


Its amazing what you run into on the internet. Today I found out that somebody has opened up a very active business on the internet with the sole intention of sharpening…you guessed it, pencils ! I still don't recall how I landed there, but one thing led to another, and I was on David Rees's website:

Here is a guy who sharpens pencils for a living. And he dead serious about it. You can mail him your pencils, and he will mail you back the sharpened pencils as well as the shavings !

Check out this video.


Here's another one.

Saturday, April 25, 2015

A Better Windows clock display


The Windows system has always had an alway on, clock display on the task bar. By default, it displays only the time. You can customize this so that it diplays more details. For instance, here is what my clock displays:


The top line shows time in AM/PM format. The bottom line displays the day and date in detail format. Even the date display in Explorer reflects this detail display.


Here is how you can have this display format your Windows machine:

1: Left click on your clock and choose "Change date and time settings". After that, click on "Change Date and Time" button.


2:  Click on "Change Calendar Settings", and choose these settings for Date:


Short Date: dddd, MMM dd, yyyy

Long Date: dddd, MMM dd, yyyy

3: Click OK all the way back.

Thats it ! You may have to resize the controls on your taskbar to break the clock display into two lines.

Friday, April 24, 2015

Sync Whatsapp Images & Videos to Dropbox


If you are like me, you probably get lots of forwarded Images & Videos via Dropbox, and don't have the time to view them and delete unwanted ones. I have been using a system of syncing the Media folder to my Dropbox folder, so the images & video show up on my laptop. Since I have enabled two way sync, deleting them from dropbox will delete them from Whatsapp folders too.

Here is how to set up the sync in Android.

1: Install Dropsync on your Android device. The free version of Dropsync syncs only one folder , but this is all you will need.


2: Start Dropsync, and login to authorize it to access your Android device. After that, set up the sync in settings.

3:  Sync this folder as source:


This is the parent Media folder, it will contain all images and videos in different sub-folders.

4: Create a new Dropbox folder as the target.


5:  Set up a Two way sync to control the folder from Dropbox. If you don't want to delete files from Whatsapp, select One way sync.


6: Thats it ! Start the sync process, and you will see new Sub folders getting created in Dropbox for Images ,Videos and Wallpapers.


Wednesday, April 22, 2015

ShapeCollage - Remove Watermark


ShapeCollage is a small and fantastic little utility to create quick collages from multiple pictures. Perfect for sharing on social media and other sites. The free version lacks only a few features like custom shapes, which are only available in the paid version. I wanted to quickly make some collages from a  recent trip, and the free version of this little devil was just right for this.

Only one problem.

The free version generates the collages, but also plasters the text "" across the center.

Like this:



This was annoying. I wanted to get rid of this.

I found a way, by editing the exe file directly.


1: Take a backup of the shapecollage.exe file.

2: Then open up the original shapecollage.exe file in an editor, like Notepad++

3: Now search and replace the text "" with a string of 16 spaces.



4. Save the modified exe file. And run it.

Any collage generated by this modified exe will not have any watermark across it.



That's it !

Sunday, April 19, 2015

OK Kanmani


Bakwaas Movie.


Today's Hindu has finally published a review of the movie from the point of view of more sensible viewers:


O Kadhal Kanmani, the latest Mani Ratnam film, is the buzzword now. The film has triggered off a discussion on relationships, live-in and marriage among the youth. The lead pair looked adorable. The visual language was fresh. But something was missing in the story that tackles a modern-day relationship. Aadhi and Tara, the lead pair in the film, decide to go against the nuptials and explore a living-together relationship. Though the theme is fresh, many youngsters feel let down with the way it has been handled by the director.

“Mani Ratnam lacks conviction about live-in relationships,” says Athul Domichen, a media professional from Calicut. According to the 25-year-old, the director has taken an easy way out. “ The lead pair who does not believe in marriage decide to get hitched when they have to split ways to pursue their ambitions.” Aadhi (played by Dulquer Salmaan) is represented as the quintessential metro man who avoids commitment. And so is Tara (Nithya Menen), who comes from a broken family. “I am not against marriage. But then it should not be used as an adhesive to keep two people together. Can’t a relationship sustain with trust and patience too?” asks Athul.

Manasa Ramakrishnan feels the commitment phobia part was overdone. She thinks the film stereotyped youth as anti-marriage. The 25-year-old school teacher from Bangalore adds that the film portrayed marriage as a tough deal. “It is not. It is about companionship. Life can be a lot more organised in marriage and fun too. The movie complicated these aspects unnecessarily. ”

Like any other Mani Ratnam film, this one too comes with classy frames and groovy music. But then, the pretty frames killed the drama and made the story look unrealistic. For instance, a supposedly shady lodge, where Tara and Aadhi spend a night together, is so tastefully designed that it almost looks like an art studio. “The sets were too glossy. The apartment looked unreal. It killed the flavour of romance for me,” says Athul.

In the film, everything is breezy for Tara and Aadhi. Chithra Dhara, a student from English and Foreign Languages University, Hyderabad, wonders if the Indian society is as accepting about living together as picturised in the movie. “The couple hardly faces any kind of moral policing, which is the case with young lovers in the country. Except for one scene, where Tara is interrogated by Aadhi’s relative, they had it easy. It came across as a shallow rom-com .”

Deepti Sreeram, a journalist from New Delhi, believes the film showcased convenient ideas of romance. “As a generation, we are socially independent. But, when it comes to choices pertaining to our partners, we are still not free. Many couples, who live in with their partners, are plagued by financial insecurities and safety issues. They do not even have a space to get physically intimate. The film left all these issues unexplored and conveniently shut us off from reality.”

At one point in the film Aadhi leaves the city without informing Tara, and she is worried. And her friend warns her not to turn possessive and behave like a wife. Many find this aspect a twisted depiction of a live-in relationship. Sindhu Jose, a research scholar from Hyderabad, feels “Live-in might not involve marriage. But then the lovers would want to lead a life together. There is an emotional bonding. It is as complex as a marital relationship. I expected a more nuanced take on the subject from a director like Mani Ratnam.”

Also, Aadhi and Tara seem to be living in a bubble. The world around them is filled with well-wishing uncles, sweet maamis and progressive friends.

In fact, all it takes Tara to convince Aadhi’s landlord for the live-in is belt out a Carnatic music bhajan! Everything fell into place a little too easy, says Deepti. “I missed the intense, risky love portrayed in films like Raavan and Dil Se. Here, both the girl and boy belong to the same class, caste, religion, and their life has no challenges. The movie seems to be hinting that the old generation is okay with us falling in love and even living together so long as we keep these yardsticks in mind!”

Tuesday, April 14, 2015

Android Studio Problems


I got a few days holiday, and I thought I planned on learning and picking up on the new Android Studio IDE which was released in December last year, and maybe develop an app. I had attended a two day beginner's workshop at DroidCon 2013, and had learnt quickly the basics of Android app development. Since then, I lost my projects and code to a hard-drive crash. The new Android Studio looked easier to learn. Or so I thought.

For a beginner, Android Studio sucks. It is too complex a development platform. Before one can start developing apps, one has to first play and win the rpg-game "Installing and Settingup  Android Studio". I have tried and failed for two days to get the basic setup up and running, I think this is because I have multiple installations of Java on my machine. After installation, the studio.exe can be launched, but it tries to connect and download the latest SDK. I had downloaded the bundled version, but looks like it does not have the SDK itself, just the IDE. And…don't get me started on gradle. I wish there was a way to turn it off and do things the way it was done on Eclipse.

Google, if you want to welcome more developers to your platform, you will have to make things easier. Experienced Android developers may not have issues in picking up the new studio. But beginners like me will be lost.

I am going to try again from office, first downloading just the IDE (because the bundle is a joke), and use the faster connection from office to get the SDK. Hopefully, things will be faster.


Tuesday, April 7, 2015

Hacker spaces , or lack of.

Its a pity that there are not many HackerSpaces in Bangalore.


N R Narayana Murthy - biography - Ritu Singh


Generally I do not read biographies, even the ones which are recommended of famous, successful people. That's because these books always go into a praising mode, highlighting every good decision and milestone achieved by its subject person, and hiding away the bad decisions and mistakes. Its specially worse for autobiographies, where the author might delve into a self praising monologue at times. The most used word in such a book would be the single letter word: 'I'. Its always 'I' did this, 'I' did that. 'I' fought, 'I' persisted and 'I' succeeded.

So it was with a little doubt that I chanced upon a small paperback biography of NRN, retailing for less than 100 Rs/-. I was surprised no one mentioned this to me, surely much more has been written about people who have achieved just 1% of NRN's success. So , off I went, and finished the book in 2 hours. (Yep, my old speed reading skills are still with me.)



I couldn't help write something about this book, and it's enviable genius subject. The book itself is written in the simplest english you could find, with no big words to show off the author's control over grammar. There is a little flashback-style to it, NRN's childhood days are covered only from the third chapter onwards..but most of the book is in chronological order. The last two chapters are about Infoys and the Infosys foundation, and I felt it was more like an advertisement than part of the memoir. But the book covers NRN's life from this childhood days till until he stepped down as CEO, and some more. There are some rare pictures from various stages of his life. Kids are gonna love this  ! not to mention the target audience - young twenty something Indians looking for inspiration.

What I could infer:

1: NRN is highly intelligent. There is no denying his brilliant mind allowed him to grasp things others would overlook. He was smart enough to get selected for IIT. Twice !. And then, he went to work over there. There is a part in the book where NRN felt that his life and work at Patni was too slow, and he wanted to speed up. There is a school of thought that brilliant people are generally more successful, but nothing has been concluded.

2: Hard work. NRN proved time and again that there was no substitute for hard work. The book makes it very clear that he worked well into the night, and weekends and holidays in his initial struggle at Infosys often having to neglect his personal life as well. This was one reason why he didn't want his wife to work at Infosys, because he didn't want his family to be neglected. The other, was that he is a man of principles, and didn't want it to look like nepotism.

3: Save. Save whatever you can. During the first years at Infosys, the Murthys kept a strong watch on what they did with their earnings. 1980's India was just getting liberalized, money was hard to come by. The book makes it clear that the Murthy's saved whatever they could, without wasting anything on luxuries. The first office setup was in their spare bedroom !Sudha Murthy used to walk 4 kms to her office, it is mentioned in the book. And the women used to cook for their colleagues.  And they did not have even have a TV at home for a long time. (But then, all they could watch was Doordarshan, right ?). NRN used to meet his clients on bi-cycles and scooters ! Nowadays, just to show off, vendors will rent out cars when they go on client visits. Saving was an important reason why Infosys survived. And grew. The credit-card swiping, expensive-smartphone wielding youngsters of today would never understand the meaning of this simple 4 letter word- save- and how much it can change your life.  NRN and Infy only began spending when the company turned profitable, and only went public long after that. There is something evergreen to be learned here.

4. Values. He is a man of principles. And words like honesty and integrity were more than just words for him. NRN did not simply want to deliver something to his customers, he wanted to build relationships. When he and his six colleagues left Patni, they never poached any clients. And when they faced beurocratic issues in India, they chose to persist and wait. The book says they used to make a lot of phone calls from a public phone, because they did not have a phone of their own ! And when they travelled abroad, they tried to save every nickle and dime, so that that money could be re-purposed positively for the company.  NRN still travells in business class.

Having said all this, it is sad that Infosys, the company built upon such strong core values, is no longer that place.  Yes, they have a huge campus. They provide facilities to their employees no other Indian company can boast of. But the workforce itself is bloated. Today in a typical project, only 10% of the team members work. And they do about 90% of the total work. The rest are simply on the team for billing purposes. Attrition rates are high. They way they judge and select talent is skewed. This year they gave their employees their lowest ever hike, according to the papers. Of the seven founding members, except NRN, all have turned into millionaires with other business interests. NRN was called back to the company when management failed in leading the company positively.

Looks like the management at Infosys is the one who was to read this book. They have to know where they came from.  And for anyone dreaming of starting up a billion dollar enterprise.

Sunday, April 5, 2015

Jurassic Park 4 - the one that didn't get made

Before we begin, a little back-story to fill you in: In 1993, Jurassic Parkwas unleashed upon an unsuspecting public and it took the world by storm. Based on the novel by Michael Crichton, the film was noteworthy for its Oscar-winning special effects and incredible score by John Williams. It was suspenseful, funny, horrifying, exciting; everything you could ever want from a Hollywood blockbuster. Soon after, a sequel followed, and after that, another one. The third film was panned by critics, but it was still a success at the box office, and that was enough reason for the studio to want to put together a fourth.

Jurassic Park 4 introduces us to ex-Navy Seal Nick Harris, who has been contacted by John Hammond to complete a very important task. Harris must voyage out to Isla Nubar to retrieve the shaving cream can filled with dino embryos that Dennis Nedry left behind after he was killed on the island. It appears that, while many of the dinosaurs have been wiped out, some have managed to make it to the mainland, and attacks are becoming quite a problem. The United Nations has outlawed the mining of amber, so Hammond is left with only one solution: use the embryos inside the can of shaving cream to create younger, sterile female predators to take on the remaining species on the island. The problem is, though, that the UN has also outlawed the creation of any new dinosaurs, and a corporation called Grendel International now has full ownership of the island and has equipped it with a security force. So Harris is going to have to be extra careful in finding this can.

When Harris reaches Isla Nubar, he has no problem finding Nedry’s bony remains. Soon, Harris is able to find the target Barbasol can in no time. Activating a homing device he left on the beach, he quickly begins to make his way back, when he hears a rustling behind him, and soon realizes he’s surrounded by camouflaged security rangers. He quietly drops his weapons as they command, but before anyone can think, a colony of excavaraptors attack. Amidst the barrage of the rangers’ gunfire, Harris manages to escape, a raptor hot on his trail. When he finally manages to hide behind an abandoned Jeep, a group of compsognathus strike, and he quickly runs for a nearby building, accidentally leaving his gun behind. Inside the building, which turns out to be an old staff bunker, Harris finds a map which has a layout of all the staff quarters on the island, and it looks like the control center isn’t too far from the beach. With a raptor hot on his trail, Harris begins his journey through the underground utility tunnels. After a brief run in with some dilophosaurs, and the ever-persistent raptor, Harris finally makes it to the beach where a pilot has been waiting for him. Harris begins swimming out into the ocean, where the raptor doesn’t dare venture, but when a kronosaurus catches the lifeline from the plane and destroys it, killing the pilot, Harris is now trapped in the ocean. Luckily, at that moment, a helicopter arrives and Harris grabs hold of its rescue ladder, saving him just in the nick of time. Too bad the helicopter belongs to the Grendel Corporation.

Fortunately, Harris manages to grab the Barbasol can and jump out of the helicopter, landing in the ocean and swimming toward a nearby beach where a Capt. Overton is waiting for him. Pursued by Grendel’s thugs, Harris manages to hide the Barbasol can in the ancient Coca-Cola cooler of a nearby cafe, which he’ll come back to later. Harris finds a hotel he thinks it’ll be safe to stay at, but of course it isn’t. Grendel Corp.’s men have tracked him down once again and bring him to Sweden, where Harris is met by Adrien Joyce, a criminal Harris managed to get kicked out of Honduras for selling weaponry who now works for Grendel. Joyce wants the Barbasol can, offering to match Hammond’s offer, but Harris won’t budge. Instead, Joyce explains he would like Harris’ help with Grendel’s newest project. Grendel has secretly been breeding dinosaurs and splicing their DNA with other species as well as domestic dogs and humans to make them obedient to commands. With proper training, Grendel plans to use these genetically-engineered dinos to act as soldiers—SWAT teams, riot control, that sort of thing—and Harris is the perfect man for the job. Why do they need these genetically-enhanced dino-hybrids? To save Isabel Chartiers—daughter of Bertrand Chartiers, chairman of the Duhamel Group—who is being held for ransom by a group call the North African Liberation Front. Using humans to save her would take far too long; these dinos, with their natural predatory instincts, will find the culprits in no time. Harris gives in and agrees to train the dino-soldiers, who are marvelously fast learners.

When Harris and the dino-soldiers find the kidnappers’ hideout, the dinos go to work tearing the kidnappers to shreds. Not a single one is left alive. And, thankfully, they are able to rescue little Isabel. Job well done. But Grendel’s work is not over. This is just the beginning. They have other missions in mind, and they want Harris on board for good. Their next mission: take down Pepe Aguilar, a drug lord who is holding a number of innocent people prisoner, including the President’s niece. For this mission, they’ll need more than just the genetically-altered raptors. They’re employing the spitters too. Their training goes smoothly at first, until one of the raptors goes a bit berserk and kills a Grendel mercenary. Finally, the beast calms down, but no one is quite sure what went wrong. Later that night, Harris strikes up a deal with Baron von Drax, head of Grendel. He’ll tell von Drax where he hid the embryos as long as they let Maya—a female scientist of theirs who Harris has started to develop feelings for—off the island, free from Grendel. Von Drax agrees, and when Harris breaks the news to her, she is shocked. Realizing there’s not much she can do, she reveals a damning bit of information: It was Grendel Corp. who kidnapped Isabel Chartier in the first place. Harris is horrified, but no matter, because this plot point is never brought up again. And it isn’t long before Grendel send some men out to retrieve the Barbasol can that Harris hid in that Coke cooler. But the DNA inside is not at all what von Drax has been waiting for. They found a decoy. The can was filled with the genes of toads.

Everyone feels good when the mission to take down Pepe Aguilar is a success; everyone but the dinosaurs. It seems that the raptors have become too sentient. They quickly destroy the cameras mounted to their bodies and smash the control-implants placed in their ears. This is their rebellion. The raptors strike on the convoy, with intent to kill. And they do. Carnage ensues as the raptors get their revenge on the humans who held them captive for so long. It isn’t long before the dinos target Harris and Maya, but to these two, they make an exception. It’s almost as if the dinos understand that they were the good guys the whole time, and they leave them alone, disappearing into the jungle, free at last. But what of the real Barbasol can? Well, maybe I missed it somewhere, but that actually managed to get to John Hammond at some point. The end. Really. The end.