Posts

Of traffic, teams and companies

Image
Swami Gulagulaananda said: " The grand unification theory is nought but analogies connecting seemingly unrelated things " When you drive through Bangalore traffic, more often than not, you are not driving... You are probably waiting at traffic junctions or trying to wiggle through evanescent worm holes. The strange fact about driving is that it becomes automatic after some time - You don't even pay attention while changing gears or switching between the accelerator and the brake. And since that frees up your mind, it tends to wander into the realm of contemplation... As I watched vehicles around me, I drew some parallels that I wanted to list out in this post. 1) Among motorbikes, cars and buses, bikes are the fastest when it comes to rate of picking up speed or accelerating while buses are the slowest. However, once all vehicles start accelerating, bikes soon get left behind as cars and buses zoom past them. Companies are also of these types small caps (start-u...

Knight's Tour

Swami Gulagulaananda said: " The dark knight can never be blocked... nor can the white knight " The Knight's Tour is a mathematical puzzle which I had played on a Windows Phone game called Doors. I didn't know it was called Knight's Tour till I watched this Numberphile video . I had some time to spare and wrote a simple version of it that you can test out below. The objective of the game is to make sure that every square of the board has been occupied by your knight once. Click on any valid square to make your move Programmers: Do you think you can write a program to find solutions? Knight's Tour Move the knight and cover every single square without repeating a square ♞ Restart 5x5 Board Restart 8x8 Board

Yellow Journalism

Image
Swami Gulagulaananda said: " That moron asked me not to be judgemental about him " We love watching movies and I am sure that you have watched this scene that appears in several motion pictures; The protagonist walks into his house and is shocked to see a dead man with a knife sticking out of his stomach. He drops whatever he was holding and rushes towards the slumped body he has identified as his father, an eminent lawyer who fought injustice with a fiery passion. It is obvious to the son that his father was murdered by some land baron / politician who was rubbed the wrong way by the deceased, but he puts those thoughts aside for the moment. He has a slight glimmer of hope that his father might still be alive and worries that he is in pain. He crouches beside his father and pulls the knife out of him. At that exact same time, a police inspector and a couple of constables arrive at that scene on a supposed tip-off. " Hands up, you are under arrest " he shouts as...

Playing old DOS games

Image
Swami Gulagulaananda said: " Only 90's kids will understand this " Remember the good old days of Dangerous Dave, Doom and Commander Keen? I remember spending countless hours playing all those games - Jazz Jackrabbit, Cosmo's cosmic adventures, Hocus Pocus, Prince of Persia... the list is endless. I recently stumbled upon a great way to play those old DOS based games on your modern computer. I thought of sharing it with you guys. Install DosBox The first step is to download and install DosBox, a DOS emulator. Download DosBox Download Games The next step is to download games. There is a wonderful site that hosts all these old games. You can search and download the games of your choice from here. Download Games Make games available on DosBox After you download games, unzip the files Create a dedicated folder to put all your downloaded games. Like, C:\dos_games or ~/dos_games . Now, run DosBox. You should see the terminal. Run the command below: moun...

The Kannada Hater

Image
Swami Gulagulaananda said: " Keep an open mind about everything in life " " There are more Indians in the US than within the borders of India ", he said. " What in heaven's name do you mean? " I asked. He replied, " Yes, in other countries, there are many Indians. But within India, you have a Bihari, a Madarasi, a Tamilian, a Telgite, a Kannadiga, Hindu, Muslim etc. but no Indians " It's an old SMS forward that I paraphrased above. But a deep one nonetheless I was absent-mindedly scrolling through the infinite curated posts on my Facebook wall the other day when I stumbled upon a post. What caught my attention was the fact that my junior from college had ' liked ' it, but the photo of the guy in the post was my former colleague. What was the connection? I then paid a little more attention and noticed that it was a photo accompanied by a write-up of some sort. I clicked on it to expand the content and read something as foll...

The Population Effect

Swami Gulagulaananda said : " Battles won are inconsequential when the war is lost " " Indians don't have any civic sense. Look at the way people drive! Look at all the garbage being strewn around. Tchah! That's why everyone moves to America and Europe. Things are so much cleaner there and people are so much better too. Not unlike here... " is a complaint that is often heard during moments of frustration - especially when that pesky autorickshaw driver cuts you off or comes in the wrong way in a one way road. I had often wondered if these claims are true or not. On a trip to the US, I decided to make comparisons and make some mental notes. My first stop had been the West Coast of the US - San Francisco and the Bay Area predominantly. I found that people drive in a very disciplined manner - There's lane discipline, people don't cut other people off, traffic signals are followed religiously and the distance between two vehicles is enough to fit ...

The Javascript Closure Problem

Swami Gulagulaananda said: " Closure is very important in broken relationships... Also in JavaScript " I was trying to write a fairly simple piece of code where I would create an array of functions in JavaScript. There was a loop and a function would be generated in each iteration such that the body of the function had a dependency on the loop counter. What happened finally was that every function in the loop was the same as the last function. I was bewildered. I understood that it was because of some reference issue but could not come up with a solution easily. Here is a simple piece of code: I was expecting a[0]() to give 0, a[1]() to give 1 and so on. But I was getting 3 each time. How do you solve this? After breaking my head for some time (despite knowing it was something to do with Closures) I posted the question on Stackoverflow. Try solving this problem by yourself before seeing the solution. Here's the solution: