Friday, 26 October 2018

Of Geopolitics and Games

Swami Gulagulaananda said:
"Life is a game in which only the fittest survive"

I have always found geopolitics to be a fascinating subject. The world is composed of groups of people who have divided the Earth into various chunks. Peaceniks like to say that the world is one family - "Vasudhaiva Kutumbakam". However, the world doesn't run on such idealism. Many countries, in reality, are trying to increase their spheres of influence while trying to undermine their rivals. Some countries vie for regional dominance while others try to be superpowers.

Any country that is seeking to be a dominant player in the game of geopolitics tries to subjugate their competition by adopting a few tried and tested techniques. One of them is the use of financial pressure. The US, with her dominant position as the world's largest economy, is able to pressurise other countries such as Iran, Korea and Russia through sanctions. By imposing trade embargos and preventing other partners from trading with them, the U.S. tries to exert stress on them. While larger economies such as Russia and India may not feel the pressure as much, smaller countries do. Eventually, such countries yield and toe the line.

There are two aspects to note here - The country that intends to apply pressure needs to be an economic giant with considerable clout and that this method is an overt action. The former limits the number of countries that can pull it off to a very small number of elite nations. The U.S., the E.U. and China are among those that could pull it off.

Countries that cannot use this method may resort to an alternate method. This alternate method that may be preferred by countries with clout when covertness is preferred. This method involves creating internal strife in the target country. There have been numerous examples of this: Pakistan stokes violence in India, Saudi Arabia and Iran in several countries in the Middle East including Yemen, and the U.S. has been notorious for this in numerous instances, with Syria being the most recent victim.

The idea is to prop up opposition by the citizens of the target country and to paint the government as an evil and fascist. Once these rebels gain momentum, they will receive extensive media coverage which in turn will help recruit more people. The government in its attempt to curtail protests will inevitably use force to some extent. The rebels then cry foul and paint a picture of victimisation and accuse the government of using excessive force on its own citizens. The incessant media rhetoric will force other countries to intervene and legitimise the claim of the false opposition. Foreign powers then justify arming and training the rebels to help bring down the evil, fascist incumbent government and replace it with a government of the people, for the people and by the people. The real intent, of course, is to replace the government with a puppet government that toes their line.

The target country has to exhaust her resources to cull the armed opposition. The weakened nation now becomes a sitting duck for external powers to take over or may become an unstable region where proxy wars are fought.

The beauty of these two methods is that the country that wishes to impose its will on the target country does not expend significant resources or incur losses in terms of human resources. The financial method results in the crippling of nations that are very dependent on foreign partners. The latter causes the downfall of the nation due to the infighting of her own citizens.

Red Alert 2 was a popular command and conquer game of yore. In the game, one can choose to represent a country and skirmish with opponents. The game allows the construction of buildings such as barracks and war factories in order to create infantry and mechanised units. The game can be played in numerous ways. One can create a large number of tanks and fight a bloody war or perform multiple shoot-and-scoot operations.

Ore miners are units that help in the collection of ores (unsurprisingly) and help in the generation of revenue. Yuri is the name of a unit who can perform mind control on enemy units and convert them to his side. I decided to use a combination of the two methods listed above in the game and was impressed that they worked remarkably well in the game producing the same results as the real world.

During the course of the game, I initiate blitz attacks on the enemy's ore miners in "shoot and scoot" operations. In essence, I try to take them out as quickly as possible. This creates a financial constraint on the opponent as the revenue generation begins to decline. With lesser money coming in, the enemy's ability to produce attack and defence units gets severely degraded. This slows down the enemy's unit production. However, pushing this beyond a limit forces the enemy to sell existing structures to raise funds to build ore miners in a bid to increase funds. This is very similar to the trade embargos and sanctions of the real world.

I use the Yuri units to convert enemy units. A single special unit called Yuri Prime has the superpower of being able to project his mind control ability at a phenomenal range. I use this unit to convert units deep inside enemy territory. The opponent, on suddenly perceiving an enemy in the middle of its territory, destroys the "enemy". Yuri Prime then proceeds to convert another unit, often the unit that just killed the previous "enemy" unit. While Yuri Prime guffaws maliciously at the irony, the enemy begins to lose its units at an alarming rate.

This attrition combined with the enemy being forced to sell its defensive units to raise funds makes it extremely vulnerable to an advancing army.

On several occasions, I have had to use not more than three tanks to decimate an entire camp. I could do with fewer units because there is no resistance to prevent this onslaught. My games have often ended with a loss of just a handful of my units - perhaps 3-5, while the enemy has lost hundreds.

Being dependent is often the main cause of one's downfall. Nations that aspire to become superpowers must invest heavily in developing infrastructure and human resources. Patriotism needs to be instilled in the citizenry in order to prevent brainwashing by foreign powers that hope to create havoc by hollowing countries from within. Citizens should become more mature and realise that everything that is described in the media and on social media is not necessarily true. If we do not take care of these aspects, we will end up selling our assets and killing our own units in order to pave the way to a foreign power to invade us without breaking a sweat.

Saturday, 18 August 2018

Natural Factories

Swami Gulagulaananda said:
"Nature loves symmetry. I wonder why? Did all asymmetric ones die out?"

We have to consider various aspects while trying to develop a complex system. Take the example of a car. We first start by defining what features and qualities the final car needs to have. Then, we move to divide the car into logical subunits. We think about the design of each of these subunits and how they will interact with one another. The subunits should perform their tasks efficiently but also be economical to produce while looking aesthetically pleasing. We've to think about the energy source or fuel, rate of consumption, rate of recharge, wastes produced and how to eliminate, etc.

Once we're ready with this, we move on to develop a prototype, run various tests, iteratively improve the design till we reach a design that's meeting all the goals sufficiently.

We then proceed to mass produce them. This, of course, requires capital for land, factories, workers, machinery, etc. We should be able to store raw materials, we need processes and managers to ensure effective utilisation of said resources, etc.

As I sit in my garden pondering deep thoughts, I see a few bugs crawling about, flying about, feeding on leaves and other insects... These insects are fully developed units, capable of motion both on land and in the air. They consume energy but refill it as they run out. They're also aesthetically pleasing (debatable? Some of them are gorgeous)

But at the same time, there are no actual factories. Though there's fantastic engineering involved, they're factories by themselves.

I'd a small pot that had a plant in it. After the plant died, I just left it out in the garden. Some days later, I saw tiny mysterious plants of a different kind  sprouting out of it. Nature somehow finds ways of propagating life. Probably these seeds were in the soil already and were dormant, or they arrived through an external agent like an insect, animal or wind. But they did manage to sprout.

And that brings me to the final part of the thought. Is it possible for mankind to create engineering products like drones by making use of concepts that exist in nature? And if they're too complex to understand, can we bend existing "natural technology" to do what we want? I understand that this is not really new thought and that much of genetic engineering revolves around this. But the idea of developing newer kinds of self healing, self repairing, self regenerating units that can perpetuate themselves but also be programmed is amazing.

I'm sure that we will be able to purchase blank bees in the future that will provide API interfaces for custom programming. You will be able to transfer custom code and the bees will perform all the actions. The code can be transferred to the next generation as well. Of course, a mistake in the code will result in bugs containing bugs.

One of the other questions to think about is whether this is ethical. Is it ethical to have living creatures produced for the sole reason of serving mankind in a specific way. I immediately dismissed this thought thinking about the abattoirs in the world.

I hope that the future will be a time where man has developed material science to the extent that natural substances can be mimicked. These are also biodegradable and can work in swarms.

Sunday, 12 August 2018

On Mindfulness

Swami Gulagulaananda quoted Kanakadasa:
"naanu hodare hodenu [I can go if I could go]"

There was a tale that I had heard in my childhood. Kanakadasa, the great poet and saint, was asked who could attain salvation by his master, Vyasatirtha. Kanakadasa replied, "naanu hodare hodenu" in Kannada. The sentence can be translated to: "I might go if I want". Many of the scholars at the convention were offended that Kanakadasa had earlier told that nobody at the convention, including his own master, could attain salvation. However, his master saw wisdom in Kanakadasa's words and asked him to elaborate what he said. Kanakadasa explains his pun, which can also be translated as "If I goes, I could go", meaning that a person who rejects ego can attain salvation.

As I looked around at society in general, I started seeing a pattern. I saw a certain quality lacking in most people, and I wondered what the right word for that quality should be - The answer: Mindfulness.

The term mindfulness has started cropping up in multiple places now. I heard about mindfulness a few years ago when an acquaintance started a blog on mindfulness. Most people associate mindfulness with meditation. In this post, I would like to discuss mindfulness as the word: "The quality or state of being conscious or aware of something."

The next time you see an escalator, pay attention to the steps. You'll notice that every escalator has a yellow stripe along the centre. The yellow stripe is like a lane separator.

People who wish to simply stand and ride up the escalator should stand on the right side of the line. People who wish to walk up the escalator taking advantage of the movement should walk on the left side of the line. You'll see a similar yellow stripe on moving pathways in airports.

Most people are unaware of this fact and stand around simply without adhering to this rule. Not being aware of a fact doesn't qualify as lack of mindfulness. However, not allowing a person whom they see that a person walking up the escalator to pass, is lack of mindfulness. Why do they have to wait till someone comes up to them and says "Excuse Me?" when they have noticed this person walking up to them?

Mindfulness is being aware of what is happening around us - being mindful of people around us, being mindful about the trouble that we put others through due to our actions, or thinking how we can alleviate the pain of others through our actions. One does not necessarily have to go out of their way help others. One simply needs to tune in to their surroundings and go beyond the self to understand what's happening around.

Two days back, I was riding towards my house on my motorcycle when the car in front of me suddenly swerved to the left without warning because he wanted to stop. I applied the brakes immediately, more or less being convinced that I was going to ram into the car. Fortunately, the bike skidded to a halt about a foot behind the car. The sound made by my bike skidding prompted the passengers in the car and the driver to look back at the source. Being rattled, I questioned the man why he hadn't turned on his indicator if he wanted to turn to the left. Rather than apologising, the passenger at the back turned defensive and indignant as if I was not paying attention while driving and started arguing. The driver who knew that he had made a mistake should have simply apologised. But we digress. The main point was that the driver was not being mindful of his surroundings - He simply turned his car to the left because that was what he wanted to do. He was not mindful of what impact his actions could have on others.

I am sure that looking around will give you plenty of other examples of situations where people can be more mindful. People who play songs in the metro or bus or while walking in the parks without using earphones, people who talk and laugh raucously, people who honk incessantly, people who double park, park incorrectly, drive in the opposite direction are examples of people not being mindful in obvious ways... People not cleaning gym equipment after use, leaving toilet seats up, not flushing all the way, not muting phones during meetings or while watching movies in theatres are other (subtler?) examples of not exercising mindfulness.

As a population, we need to start becoming mindful - And most of us can achieve this goal of moving towards mindfulness. However, people who have had a sense of entitlement ingrained in them for a long time or people who are more self centred may find it very hard to acknowledge that they were wrong in the first place. After all, acknowledgement of mistakes is a prerequisite to course correction.

Therefore, it is imperative that we teach children to be mindful and sensitive to others right from their childhood. If we teach children the differences between right and wrong and how their actions have ramifications, they will grow up to be upstanding and outstanding citizens of the country.

Remember to be mindful. Jai Hind.

Monday, 6 August 2018

The Eye Opener

Swami Gulagulaananda said:
We all owe a debt to society… You are significantly more privileged than you think

The soft rays of the morning sun slipped through the blinds and woke up Simi. As she opened her well rested eyes, a smile formed on her face as she looked at the calendar on the wall. Just one more day to go. She looked at the neat array of stuffed dolls adorning a specially created shelf. But this birthday was special and she knew exactly what she wanted. "Maaaa!! Coffee!!" she yelled.

A few moments later, her parents walked into her room, beaming at their daughter. Offering her the cup, her mom asked her, "Just one more day for your birthday, Simi beta. What do you want for your present?" This was the moment that she was waiting for. She held the cup between her palms and interwoven fingers and looked at the brown liquid. Then, gushing a little, she said "Ma, Pa, I want the new iPhone X". At this, her mom turned to look at her dad. Her dad obviously hadn't expected such an expensive request. "iPhone? Beta, isn't that very expensive? Ummm ask for something else", said her dad as he fumbled for words. He didn't want to disappoint his angel daughter.

"No. For this birthday, I want an iPhone." replied Simi. "It's very expensive Simi. Besides, what does it do that your phone doesn't do?" reasoned her mom. "All my friends have one. I also want one" said Simi. "I'll not be able to afford an iPhone Simi, I'm sorry." said her dad as he walked away. A visibly upset Simi turned her head away as her mom tried to mollify her.

With a start, she jumped out of her bed and said, "I'm going for a drive." and ran down the stairs, ignoring her mother's pleas to not go out on an empty stomach.

Having driven for about 30 minutes, Simi felt her throat feeling dry. Her tongue seemed to get heavy. She picked her bottle to drink but found that it contained very little water. She had forgotten to refill it. She looked around and found herself near a slum. She got out of her car and walked up to a small house. She saw an elderly lady sitting outside, chopping some vegetables.  "Aunty, may I've some water?" asked Simi, indicating her bottle. The elderly lady looked up and smiled at her. "Of course, of course, come in, little girl" she said, accepting the bottle. The elderly lady walked into the tiny house followed by Simi who had to bend her head to pass through the low door.

She was surprised by what she saw inside. The house was very plain and had only one room. The flooring was of red oxide. One of the walls had some kind of a battered shelf with a few utensils arranged on it. She saw a trunk with a few clothes in one corner, a small bed with a pillow and a thin blanket along another wall. The lady carefully poured water into the bottle from an earthen pot. Simi continued to observe the tiny house. She saw a tattered wall hanging. It was a makeshift board for children. It said "A for Apple, B for Ball, C for Cat".

Simi was surprised at this. "Aunty, what is this?" she asked. "Ah, I teach some of the local children here. I've studied till seventh and I want these children to be able to read. I hope that education will bring them out of this abject poverty" she said as she returned Simi's bottle. "Why don't you sit for some time? I'll make some tea for you", she said. Simi was very curious about this lady and the slum. She spent half hour drinking tea and listening to the wonderful stories, how excited the children around the locality are to learn new things, how people help one another, how people run up to the nearest STD booth when they get a call from their village, how they fear that the government will tear away their hutments and render them homeless. Simi listened with rapt attention. These people went through a lot. "Aunty, give me the phone number of that booth", said Simi as she left bidding goodbye to the lady.

The next morning, Simi was awakened by her parents. "Happy Birthday, Simi beta!". Simi woke up with a wide smile saying "Thank you" in a sing-song manner. "Beta, I thought a lot, and I've decided to get you that iPhone", said her dad. Simi looked at her dad and smiled with a twinkle in her eye. "I'm coming to the market with you".

Two hours later, a kid ran up to the elderly lady's house. "Aunty, aunty, you've a phone call". The elderly lady wondered who had called her. She slowly walked towards the telephone booth down the street. Picking up the phone, she said, “Hello? Who’s speaking?

Hi aunty! This is Simi, from yesterday! Guess what, aunty? I got a present from my parents and I am calling you from my new iPhone! Isn’t that cool?

How should the story have ended?
My original intent was to give it a funny ending where Simi says that she called up the elderly lady to say “Guess what? I am calling you from my new iPhone! Isn’t that cool?”
Or perhaps, Simi decides to donate a board, books and other materials to the elderly lady to educate the children. Or go a step further to even teach the children herself… (some forward)

Each of us is a Simi and we all have a choice… I read somewhere that we all owe a debt to society and that we should do our part to give back to the society in some way.

I don’t know if charity is the right solution - Perhaps there is a better way. If anyone has any good ideas, please let me know

Saturday, 23 June 2018

The Europe Trip: Part 1 - Preparation

Swami Gulagulaananda quoted Abraham Lincoln:
"Give me six hours to chop down a tree and I will spend the first four sharpening the axe"

Europe is a dream destination for many travel enthusiasts. Having read about the intricate work of Michaelangelo, the grandeur of the Vatican, the glorious Roman empire as well as of relatively modern periods of the Nazi era, I thought that a visit to Europe may be a great idea.

I am not a travel expert, but I will try to walk through some of the things that I did in order to make my entire trip hassle-free. Spend time to prepare well and the trip will go through smoothly. There are a couple of ways to plan your trip. One, is through package tours with a travel agency like Kesari Travels, Thomas Cook, etc. and the other is to plan your entire trip yourself.

Booking through travel agencies has several advantages. You don't have many headaches. The agency takes care of everything, including stay, food and point to point travel. Personally, I tried travelling through an agency once and I liked the way in which they had taken care of everything. What I didn't like was the schedules. We had to stick to their schedule and we didn't have the choice of spending more time in some areas and less in another. Also, you don't have many customisation options in these package tours.

I prefer planning the entire trip myself. This way, I have complete control over every element of the trip. It is a lot of work but the result is totally worth it. This post is about preparing for your trip if you plan it yourself and while most of the advice is relevant to other places, some points are very specific to Europe.

At this point, I would like to thank Google for the fantastic work that they have been doing. They are truly on their way towards organising the entire world.


Google Trips

This app has proved to be an invaluable tool and is an absolute must while planning your trip. Google Trips is a trip planning tool that allows you to:
  • maintain all reservations (hotels, travel, etc.) in a single place
  • maintain places that you have planned to visit in a city
  • get recommendations of places to visit in a city
  • get valuable tips about transportation (metro, bus, taxi, etc.) within a city

There are alternatives available, but I stuck with Google Trips.

Google Maps

Google Maps might seem to be a no-brainer. However, apart from showing the route to a particular place, Google Maps also has the public transport option. That shows you exactly which Metro or Bus to take, the boarding stop, the direction, the intermediate stops and where to get off.


Public transport in Europe is fantastic and very cheap. Sometimes, though, you may choose to travel by Uber. Having Uber installed and ready may prove to be useful.


Tourist locations in Europe have a reputation of having several pickpockets, especially Rome. Several people have had their passports stolen and apparently even hotel rooms aren't safe. While most hotels and even B&Bs have safes installed in rooms, I decided to keep very important things close to me.

I decided to purchase a bag which proved to be an invaluable companion throughout the trip. The bag is called "God's Ghost Backpack" and you can buy it from Amazon if you would like. 

I would highly recommend buying this backpack. It has several compartments and the bag is theft-proof. It's made of a robust material and the zips are positioned such that one cannot open them without getting it off their backs. I kept everything including passports, laptop, camera and other important paraphernalia inside this bag. It's water resistant and has a rain protection cover add-on if you would like to purchase (I got that as well).

Also, remember that bags sometimes get lost. So, make sure that your essentials are distributed across bags (don't put all your eggs in the same basket)

Food and Water

Tap water is potable and directly consumable in all places that we visited. A simple Google search will help you get this information in case you are unsure. However, bottled water is extremely pricy, with a one litre bottle costing € 5 - That's about ₹ 400 and is totally not worth it. Make sure that you read labels on water bottles in hotel rooms to see if they are complementary or charged.

Surprisingly, most restaurants also charge for water. So, it would be better for you to carry a pre-filled bottle of water to avoid paying a high price for something as basic as water.

There are plenty of restaurants in Europe and there are plenty of Indian restaurants in Europe as well. So food is not much of a problem. If you are a vegetarian, there are plenty of vegan/vegetarian restaurants as well. However, there are very limited Indian vegetarian restaurants (sometimes non-existent). Some cities like Paris offer multiple Indian pure vegetarian restaurants like Saravanaa Bhavan and Sangeetha which are absolutely fantastic (better than most restaurants in Bangalore), in Rome, passable and in Brussels, non-existent.

You can consider carrying ready-to-eat food where you just add hot water and have it available, if you are a stickler. Most hotels and B&Bs have microwave ovens and hot water kettles available. 


There are several apps for keeping track of expenses. Personally, I maintained everything on a Google Sheets document.

Not all places accept cards, and sometimes, a little extra is charged if you use a card. So, carry money in a combination of card and cash. You can use International Credit Cards, International Debit Cards of Forex Cards, depending on your preference. A simple Google search will help you choose. Personally, I opted for the prepaid Forex card.

In Europe, there is an additional charge called as Tourism Tax that gets charged while checking into the hotel. The charge is around € 3-4 per person per day.


You have two major options - Staying in hotels or staying in B&Bs. Each has its own advantages and disadvantages.

For the uninitiated, B&Bs or Bed and Breakfast places are an alternative to staying in hotels. They are generally entire apartments or apartment rooms rented to you for the few days that you plan to stay in a city. While they are considered to be a cheaper alternative, I didn't find their pricing to be different when compared to hotel rooms.

One advantage of staying in a B&B is that you may get a kitchen and occasionally a washing machine. Kitchens are fully featured with refrigerators, microwave ovens, electric kettles, dishwashers, coffee and tea, sugar, etc. Some B&Bs offer breakfast, some offer croissants, cakes and biscuits while others don't offer anything beyond the plain kitchen. This is something that you will have to read about the one that you are looking at.

These B&Bs are run quite professionally - They provide receipts, sometimes provide maps and other useful information, etc. They even have cleaning people who clean your rooms, just like a hotel. So, you don't have to worry much about that. If the location is really good (close to the places that wish to visit), it is something that you should seriously consider if other parameters are met.

Hotels, on the other hand, are pretty standard. My suggestion is to go for well known chain hotels like Best Western, Crowne, Holiday Express, Ibis etc. Apart from offering budget rooms, they sometimes offer additional services like shuttle services that can save you some money. Most hotels have electric kettles and coffee makers, some like Best Western also have microwave ovens.

Almost every hotel and B&B in Italy has toilets equipped with bidets along with toilet paper. But the rest of Europe only have toilet paper. The bathrooms are equipped with shower gels and the shampoos aren't great. So, you may want to carry your own personal shampoo.

I used Expedia for all my bookings. They even have options of reserving rooms without paying in advance and refundable bookings. This can be particularly useful if your visa is not ready.


Make sure that you avoid using MakeMyTrip. Their customer service is absolutely horrible. Read more about it here.


Public transport in Europe is absolutely fantastic. Cities like Rome, Venice, Paris and Berlin have the concept of a single pass that can be used any number of times in a single day. The same pass can be used on metro trains, trams and buses and can be a significantly cheaper option compared to taxis. The public transport network is great in Europe. Some other cities like Brussels and Amsterdam have their public transport tickets like in Bangalore, where each trip costs money.

Google Maps has the public transport option that shows the metro train or bus number, direction, intermediate stops etc. It even tells you when to expect the next train/bus. This option is a must-use.

Occasionally, you may want to hail taxis. Hailing taxis on the road is not very easy. Taxis in taxi stands are easier to board. Taxis are well regulated in Europe and the prices are pretty standard across normal taxis and Uber. 

Travelling from one city to another, within the same country or across countries, is possible via train and airplane. The trains are super smooth and are a great way to look at the countryside along the journey. You'll love it if you are a fan of rail journeys. However, some train journeys could take longer and you may want to consider airplanes for those journeys. I opted for trains when the time was under 2 hours and airplanes when train journeys were longer (like around 7-8 hours).

For booking trains, you can consider websites like Rail Europe and Trainline.


You have to apply for a visa depending on the port of entry or the country where you plan to spend the longest period of time. If you live in a city that doesn't have a consulate (most of us do), then you can opt for working with a company called VFS Global. They have a website that is very straightforward. Book an appointment and make sure that you carry all the required documents in the exact order in which they have requested. You will have very little time inside. Get a photocopy of each document for each person in your group because they process visas independently. Visas take about 15 days to arrive after the submission of documents. It's better to complete the visa process at least a month prior to your trip.

Make sure that you avoid using MakeMyTrip. Their customer service is absolutely horrible. Read more about it here.

The problems of scale

Swami Gulagulaananda said:
"There are always problems associated with scale... especially when my weight doesn't seem to reduce"

Scalability has been a popular buzz word for some time and with the increasing use of the internet, social media and machine learning, data collections and performing operations at scale has become very important. But scale isn't something that is necessarily confined to the realm of technology. In this post, let's have a look at how solutions that work for some problems don't work at scale.

A long time ago, I came across a fascinating website called Project Euler. Project Euler presented us with a series of mathematical problems of increasing difficulty and the objective is solve them under a minute using a computer program. The first few could be as simple as sum of the first 100 numbers or sum of first 50 even numbers which were quite easy to solve for even novice programmers. Most engineering students might remember these as practice problems as part of their curriculum. Then you may also remember a problem that asks you if a number, x, is prime or not. How do you check if a number is prime or not? You divide the number by 2 (or take the integer nearest to the square root) and ensure that the number x is not divisible by 2 or any odd number till half (or square root). If even one number can divide x, then x is not a prime number.

There was another problem that asked us to find the, say 100th, prime number. Now, the problem became somewhat interesting. We had to start with an odd number, and keep incrementing by 2 to go to the next odd number. Then, for every odd number, we have to determine if the number is prime or not. If the number is prime, then we increment a counter and proceed. This seems to be a relatively easy solution, and for smaller numbers, the answers pop out quite quickly. However as we proceed to larger numbers, the same operation of dividing larger numbers by halves (or square roots) is repeated several times resulting in a significant delay in the overall solution and you end up taking a really long time. (The solution, in case you are interested, is to use the Sieve of Sundaram or sieve of Eratosthenes)

Thus, the solution of determining if a number is prime or not cannot be used to effectively solve a related problem due to scale. Even our power computers take considerably longer than a minute as you increase it from 100th prime to say 200th prime.

The same is true for restaurants and businesses. If you have visited any restaurant where you place order and collect your food from the counters, like the self service Darshini restaurants, you will notice one of three types:

  • You order along with the rest of the customers. The guy keeps placing plates on the counter. Whoever is closest picks them up and you often feel cheated if someone who came after you got his food first
  • You order along with the rest of the customers. However, there is one guy who keeps collecting the tokens from you and maintaining a mental note of who came first and who came later. He ensures that food gets delivered on a first come first serve basis
  • There is a numbered token system. Food is given based on the token. You show your token and collect your food
The first ones are obviously the worst. However, they are the easiest to implement because there is no additional overhead involved. This system relies on the goodness of people that people are self regulating and will pick up orders in the same order in which they gave the tokens. Let us assume that there are only 3 customers at the counter. Then, this system will work without any issues because it is easier to manage and since people are being watched by other people, they will be at their best behaviour. However, as the number of people increase, like during a rush hour, this system will simply collapse. Customers will be watching like hawks so that they don't get cheated. Some customers might even be motivated to get someone else's food first because they know how long they have to wait.

The second system is relatively better. But it has an additional overhead of a man watching. We have to rely on his memory. Also, since looking at the order isn't his full time job, he is bound to slip up occasionally and thus, it ceases to remain a scalable solution.

The third solution is the most scalable of the lot and you can see the smoothest operators using this solution. Even McDonald's that has improved their processes over the years uses this. Thus, solutions that work at lower scale don't work at higher scales.

I have made similar observations while boarding buses or metro trains. During peak hours, people wait for the doors to open. The moment the door opens, people clamour to get in to try and get a seat (or at least get into the vehicle so that they don't have to wait). However, during non-office hours, people follow the rules and breathe easy, wait till the door opens, get in and stroll to their seats. The resources are more and the competition is low.

And these observations are not limited to Bangalore or India even. I made similar observations in western nations within Europe as well as in the US. It is a myth that cars in the US or Europe don't honk as much as they do in India. It is not really a behavioural problem. They don't honk because they are not presented with the situation. When I was in New York City and in Berlin, cab drivers demonstrated behaviours very similar to those in Bangalore during peak hours where they threaded their cabs across lanes, honked and swore. 

And thus, we have to look at Bangalore and India quite differently when comparing with other countries. A lot of things that work at lower scales don't work at higher scales.

Monday, 16 April 2018

The Cynical Citizen

Swami Gulagulaananda said:
"A person with jaundiced eyes sees everything yellow... figuratively speaking"

A lawyer who deals with contracts and divorces observes that every litigant who approaches him complains about breaches of contracts and unhappy marriages. As he goes through years of practice, he perhaps becomes cynical and distrusts contracts and marriages because he has seen so many of them fall apart. However, the reality could be that there are thousands of happy marriages and thousands of people who have been adhering to their contractual obligations. And yet, the lawyer never gets to hear of them in his daily routine - If everything was fine, people wouldn't approach a lawyer to tell him that everything is going hunky-dory...

Let's have a look at policemen. Policemen are among those who are often distrusted by the average citizen. Most of the times, an ordinary citizen's opinions of policemen is that they are lazy, corrupt, don't do their jobs and accept bribes. Lieutenant Tragg from the famous Perry Mason series (Mystery series by Erle Stanley Gardner) laments about the state of policemen in an epic monologue in The Case of the Moth-Eaten Mink. Hundreds and thousands of policemen work very hard under very harsh situations and very low pay. Many of them lose their lives when terrorists like Naxals target and attack policemen for no fault of theirs. But we, average citizens, don't remember their sacrifices. We often attach the pot-bellied bribe-taking image to the policeman and paint the entire force with a single brush.

This is particularly important in today's digital world where usage of social media is growing rampantly. Everyday, we see our newsfeed or wall getting plastered with posts. And since these social media websites are adding intelligence to their systems, they make it a point to show you more of what they think matters to you. This results in your feed getting plastered with more of similar content, resulting in an avalanche of similar posts.

For a moment, try to suspend your personal opinions and leanings before continuing. If you 'liked' a post that was shared by a friend of yours who doesn't like the Prime Minister, you will start seeing more such posts where attacks are being made against the Prime Minister. These posts show content where the Prime Minister has 'failed' to meet promises made. Notice that I have put failed in quotes, because the reality doesn't matter for the moment - The fact is that this content is displayed to you because you seemed to 'like' it before. Now the fact that you are shown more of the similar content further reinforces your opinions - "Yes, the Prime Minister is indeed a big fat liar", you feel, and you will like this post again. Social Media websites mark this as content 'liked by this user' and show you more of the same posts since you have shown interest in this content, suppressing other content that shows good things done by the Prime Minister.

This is the same, irrespective of the kind of content you are liking. However, over a period of time, we become like the aforementioned lawyer - a cynic, because you are not seeing any good happening. It is because we are not actively seeking out information, but rather simply consuming information as it is presented to us. Since this 'news' is getting tailor-made and curated for you, the reinforcement flywheel will continue to fuel your original thoughts.

If you think that your country is failing you, you will start seeing a hundred problems in your country. If you think of your country as a place brimming with unbridled potential, then you will see a hundred opportunities. The reality is that your country is the same - It is your attitude that changes your viewpoint.

It is, therefore, important to not broadly paint an entire nation of a billion with the same colour. It is important to take a step back and look at each news item objectively and understand that you are seeing only a slice of the real world - a slice that was customised for you because the website thinks that this is who you are... If you saw other slices, you would perhaps arrive at a different conclusion. You would see that the world is not as grim as it originally appeared, nor as happy as it originally appeared. In reality, the world is the world, and you can see it with eyes of a pessimist, an optimist... or preferably, a realist.

Related Video

Tuesday, 27 March 2018

Phone numbers for signing up is quite dangerous

Swami Gulagulaananda said:
"Reduce, reuse... I am not so sure about recycling phone numbers"

In the good ol' days, people used to create accounts on various platforms using email addresses. But as smart phones started becoming ubiquitous and as 'Mobile First' approaches became the norm with a million apps cropping up every other day, a paradigm shift happened in the sign up process - Mobile numbers were introduced for registering new accounts.

Mobile numbers had a few advantages over email addresses - Creating an email addresses is cheap, and people can quickly create multiple email addresses without much hassle. However, people most likely have only one number, and occasionally, some have two. People are less likely to abuse systems like First time user discount using mobile phones because it is not possible, unlike emails. Verification using OTP is a lot faster than signing up using emails.

And so, signing up using mobile phones started becoming the de-facto standard. But what about platforms that had already accounts registered using email addresses? They decided to create a hybrid system of accepting mobile numbers in the future and then allowed customers to sign in using either method. Paytm and Facebook are fine examples of this.

However, one thing has not been taken into account by most of these companies. People some times give up their phone numbers, and these numbers get recycled. And this can create a lot of problems.

Today, one of my friends went into a panic mode. Her Facebook profile had the picture of an unknown moustached man and his name adorned her profile's name-slot. She believed that her account had been hacked by some guy... The reality was that he was the new user of her old phone number - a number she had abandoned some time back. So, the moustached man simply signed up/signed into his Facebook account using his phone number. Facebook simply looked up to see if an account with such a phone number already existed - Since it did, it happily gave access of this account to him.

We were able to quickly boot him out - After using email recovery to sign in, we changed password, removed all signed in users, kicked him out a second time after he signed in again, and then disassociated the phone number to lock him out. While the profile picture was brought back, Facebook's policy of not being able to change names for 60 days has made his name stick to her profile (a complaint has been registered)

However, this got me thinking about other places where we also use phone numbers - Especially these days with a large number of app based wallets like Paytm, Mobikwik, Tez and PhonePe using mobile numbers to not only create accounts, but also use the phone number to connect with the bank to get account information. This is very dangerous.

Developers should make it a point to make sure that phone numbers are not primary IDs, but instead, create an account ID and use phone numbers as one of the ways to sign in, so that disassociation doesn't result in account deletion (Facebook has done this... AWS Cognito does this by default)

Also, there should be a service that deletes phone numbers from all associated accounts like banks, wallets, social media, etc. so that recycling doesn't cause this much heart burn.

Sunday, 18 March 2018

The Mole

Swami Gulagulaananda said:
"The higher the moving parts, the higher the chance of failure. Unless you have a process set up"

Startled by the shrill sound of my digital alarm, I groped around to hit the snooze button. I thought I had explicitly turned it off, but I was mistaken. Sleep had eluded me for the past few weeks due to the murder case that had kept me awake through several nights at a stretch, and having finally solved it, these few winks of sleep that I had been having were well deserved. As I groggily waved my arms into the darkness trying to reach my clock, I realised by the alternate shimmering of the screen, that it was my phone that had been ringing. Through my heavy eyelids, I tried to concentrate on the name on the screen - It was the Police Commissioner.

The sight of that label jolted me upright. I immediately grabbed the phone and answered it. "I'm sorry to wake you up in the middle of the night, Surya, but there has been a development. How soon can you meet me at the office?", he asked sombrely. "I can leave immediately. I'll be there in twenty minutes, Sir", I answered. "Good boy. We'll be waiting for you" and he disconnected the call.

As I raced through the quiet thoroughfare, I wondered what the new development was. Through the corner of my eye, I observed a pack of cigarettes that had been lying around for a while. I was tempted to reach out for it, and remembering my resolution to quit, decided to ignore it. The cigarettes were tempting me, beckoning me to inhale a lungful of the addictive menthol and tobacco smoke, but my resolution was stronger. It had to be. I am not a slave to a roll of tobacco. I decided to toss the cigarettes out of the window and get rid of the source of temptation once and for all, and suddenly a large banner showing an ad of Swacch Bharat whizzed past me.

The parking lot offered me a buffet of spaces to pick from. I decided to pick the one that was closest to the building and eased my car into it. There were three other cars including the police commissioners. The constable by the entrance gave me a perfunctory salute as he stifled a yawn. I nodded to him and jogged up the stairs to the first floor and reached the commissioner's office. The commissioner's discussion with two other gentlemen abruptly ceased as his eyes fell on me waiting by the door. Introducing me to them, he said "Ah, gentlemen, I would like you to meet Surya, the best undercover agent in Karnataka. He has infiltrated and gathered information for the toughest of cases. In my opinion, if anyone can get this done, it is him. He is the man of the hour".

The rare praises lavished by the commissioner brought some hues to my otherwise pallid cheeks. Slightly embarrassed by the unexpected turn of events, I smiled and shook hands with the two men. "The pleasure is ours, young man. If you are everything that Sharma has assured us, then you are the only man who can achieve this. Let us introduce ourselves. My name is Avinash Gupta and this is my colleague Ravindra Reddy. We have recently received information that there has been an upheaval and complete consolidation of the underworld drug business in Karnataka by men from Maharashtra who have taken the state by storm." Drugs? They woke me up for drugs?

"Naturally, you must be wondering that drugs aren't a big enough problem here. But that's where you are wrong. This organisation is not to be trifled with. The consolidation is nearing completion, and these are people with massive amounts of money, muscle and weapons - Powerful, automatic weapons. If they are allowed to flourish here, they will pump huge amounts of money to recruit low level street corner sellers and pour drugs into colleges, destroying the youth and their future. No, this cannot happen. The organisation is run like a corporate, Surya, and it's driven by one man known as Wazir. The only way to destroy this organisation is to destroy Wazir."

I was carefully listening to the man, waiting to understand what role I was supposed to play. As though sensing my imminent question, he continued, "The organisation works very effectively because arresting low level sellers doesn't work. You see, under normal circumstances, when one perpetrator is caught, the entire scheme starts tumbling like dominoes. They rat on their accomplices in a bid to save their own skin. But Wazir runs his organisation differently and that's why they thrive", he said, as though admiring the man's shrewdness. "In Wazir's drug organisation, people don't know one another. Suppliers don't know who the seller is. They use messaging applications, codes and go through elaborate systems, never having to need face to face contact. Dead drops are the best way to exchange, and the fear for their lives prevent curiosity from creeping in. Wazir runs a tight ship, and only he knows how the entire process is run. It's a very complex network and he has been managing it very well"

His partner took out a file and placed it in front of me. "We got this information from a delivery agent whom we apprehended by a stroke of luck. He was stopped for questioning for a completely different reason, and the man panicked thinking that the police had grown suspicious of him. He pulled out his gun on our men that resulted in an unfortunate casualty. We did manage to gather a lot of valuable information, which we have shared with you thus far. This is a real breakthrough. This delivery agent was supposed to meet Wazir's second in command as his role was being upgraded. This is a singular opportunity, and we want to capitalise on this. Since the two men have never met before, I want to send our man in his place and gather intelligence about their organisation. Well, that's where you come into the picture."

I turned around and looked at the commissioner who stared back into my eyes. It seemed like he had very high hopes on me, and I was not one to turn my back towards my duty and my country. "When is the meeting happening?" I asked Reddy. "It's happening today" he replied.

"This is crazy.", I ejaculated. "This is too short a notice from me. I have a process. Before infiltrating any organisation, I canvas them for several weeks to understand their patterns and idiosyncrasies,  to know who's who and what the pecking order is like. You don't just walk willy-nilly into a powerful crime syndicate headquarters and take meetings with the boss's right hand man. No, postpone the meeting by at least a week. I cannot do it before that. That would be suicide."

Reddy looked expectantly towards Avinash Gupta with a hint of despair on his face. Avinash Gupta patiently replied, "I fully expected that answer, Surya. This is where we come into picture. The file that Ravi has handed to you contains all the information that we have collected on Wazir and his organisation. Besides, though you are going for the meeting alone, there will be policemen everywhere in plainclothes for your safety. The file even contains questions that you should be asking him. We will have your back all the way through."

I drove back to my house for a change of clothes. The journey back home was completely different from my earlier one. This time, there were a million thoughts running through my head, a file on the seat next to mine and a cigarette on my lips, releasing wisps into the air and tar down my throat, as it calmed me down. On reaching home, I immediately sat down to work. The file was indeed detailed, with a character profile of the man I was supposed to be very elaborately explained, his mannerisms described, his North Karnataka accent among many other things.

I was at the cheap restaurant at the appointed hour. It was a sunny afternoon, and I was in this dingy eatery on the first floor of the building trying to wash down what the waiter claimed to be a paratha with some watered down juice, rather than enjoying a delicious buffet in the fine dine restaurant across the street. Very soon, the plates were empty and I got tired of waiting for the thug. I had worn the leather jacket and red scarf as mentioned in the file, and nobody had approached me. Thinking that the meeting was a failure, I decided to pay off my bill and get the hell out of there. Suddenly a shadow formed on my table. I looked up to see a man with a slick face, oiled hair and a french beard, smiling at me like he knew me. I raised my eyebrows and asked him what he wanted. "The boss is waiting for you in the basement. And don't worry about your bill, it's been taken care of. Take the elevator." A small rat scurried out of my way as I stepped out of the door towards the elevator. A large man with a tattoo stood by the elevator holding it open for me. As I stepped in, I noticed that the button had already been pressed for the basement. As the doors closed,  I could see the slick man grinning at me through the gap. A sudden chill ran down my spine. Had they discovered that I was a policeman? Was I descending towards my death? Before I could contemplate further and press the emergency button, the elevator announced that I was in the basement and the doors opened into a poorly lit space. I walked out and and tried to find my thug when suddenly powerful arms grabbed me from behind, another put a dark bag over my head and a gun was pushed into my abdomen. "Don't make any sudden moves or you are dead. Nod if you understand." I nodded. My hands were tied and I was shoved into a car. I had two men on either side and a third drove the car.

After what seemed to be an hour of driving, the car drove down a slope and finally halted. I realised that we were in another basement, making it impossible for me to determine where I was. I was escorted by the two men through another elevator into a nice building with heavily curtained windows. With the bag off my head, I tried to look around to see if I could gather any clues. They untied me and asked me to sit on a bench outside a door. "It's just like waiting to see the doctor", smiled a goon as he looked at my worried countenance, "except there you could get a shot, and here you could get shot".  He chuckled at his lame joke and walked away as the door in front of me opened and a man in a suit invited me in. This was it. "I hope you were not offended by the way in which you were brought in. You never know when you are being followed. As they say, the price of liberty is eternal vigilance. If you want to be free and safe from the police, we need to be vigilant" he smiled.

I smiled back, shrugged it off and followed him into the room. I looked around to see if I could figure out where I was. The fully carpeted room was plainly furnished, with a few pictures adorning the walls and a large rosewood table at the centre. There were neat looking wooden cabinets along the walls and a large bookshelf behind the chair on which the suited thug was seated. I noticed he had been intently observing me. "Is everything alright?" he asked. "I am just a little shaken by the escort service, that's all", I answered. "Ah, put that behind you. Look, you've been working with us on a contractual basis for some time now. Wazir is extremely impressed with your deliveries. The reason we brought you in is to invite you to join us full time." He pushed a small notepad across the table. I looked at the large number scribbled on it. There were many zeroes following the first digit. I turned up questioningly towards the man. "That's per week, of course" he answered. This was a ton of money!

"Well? What're your thoughts?" he asked me. "The amount is, of course, quite satisfactory. However, before I accept the offer, I would like to meet Wazir", I said. "You're joking, right? Nobody meets Wazir. That's the way it's always been", he replied. "Look. I like to know whom I am working for. My services, as you have seen, are not cheap. I can take my talent elsewhere. It's not like I need the money."

The man thought about it for some time and pressed a button under his table before answering "Alright, let me check with him." Two men, dressed in full black, walked in looking like bouncers from a local pub. "Escort him to his room and make sure that he is protected", he said, smiling at me. I understood what he meant.

I was pondering over my next move. My phone and wallet had been taken away from me. The clock on the wall showed that I had been waiting for about seven hours. Suddenly the door opened and the suited thug walked in with a briefcase in his hand. "Wazir has agreed for the meet. However, you have to deliver one last time. Here, take this." I accepted the briefcase and lay it on the table and said to him, "Give me the delivery information". He looked at me with some surprise and said "The delivery information is inside the case, as always." I immediately realised that I had made a faux pas. Could this blunder raise suspicion in his mind? I opened the case and was expecting to see it filled with drugs. But what I beheld before me made me realise that my faux pas was nothing compared to the blunder of the gentlemen I had met in the morning. The styrofoam casing inside had an imported handgun, a silencer, a key and a photograph of a distinguished looking man. "It's been loaded. We leave in an hour. Deliver him and you earn a meeting with Wazir". I asked him who he was. "Soldiers never question orders. Just get it done." he said and shut the door.

This man, the man I was pretending to be, was supposed to be an assassin, not some drug supplier. I felt like a complete idiot, and I was stuck in this situation. There was no way for me to escape, no way to communicate with my fellow officers, and even if I could, no way to tell them where I was. The hour was up and the suited man and his bouncers entered the room. One of the bouncers handed me a black bag and asked me to put it over my head so that I couldn't see. I was led to the basement and seated in a car, just like earlier, with a bouncer on either side. After a long drive, the car finally stopped. "You can take it off now", said the voice of the suited man. I took off the bag and breathed in a lungful of air. The deep breath calmed me down. We were in a dark alley and all the houses on this road seemed to have very high walls. "That's the house", said the suited man, pointing to a house with a car parked in front of it. "It's simple, go in, finish the job and come out."

With the gun firmly in by belt, I tugged the jacket closer to myself and calmly walked towards the gate, looking around to see if anyone else was watching me besides the suited man and his crew. There was a deafening silence. Though I seemed extremely calm while opening the gate, a hundred thoughts were racing through my mind. Should I kill this man? It would definitely get me deeper into the organisation. But I didn't even know this man. What if he was an innocent man? A law enforcer even? Is the mission that saves hundreds of lives in the future more important or the life of some man? But wait, what this was no innocent man? What if he was a rival drug lord and this was part of the final consolidation? No, he was no drug lord. The man looked far too distinguished. I pulled out the key from my pocket and silently slipped it into the keyhole. Before I turned it, I tried to recollect the layout of the house from the profile provided behind the photograph. The man lived alone, according to the profile, so I didn't have to worry about additional deaths. These were no ordinary thugs. They were as organised as my own bureau. I suddenly realised that my bureau and being organised was an example of an oxymoron.

I turned the key slowly and grabbed the handle of the door and pushed it in. The door opened, noiselessly, and I walked into a small room. I could hear the sound of the TV from the drawing room inside. I carefully walked to the edge of the door and peered inside. The TV was tuned to a channel that showed a cricket match and a glass of scotch was on the table. The match was suddenly interrupted by an ad. The man picked up his phone and started mindlessly scrolling through it, occasionally tapping on it. He was probably browsing through Facebook. He was just a regular guy. As I was planning on my next move, my eyes fell on the refrigerator in the adjacent room.

I walked out hurriedly, not bothering to lock the door. As I opened the gate to exit the building, I saw that the suited man had started walking towards the house with a gun in his hand. "What took you so long?" he asked in an irritated voice. "It's done. Let's get out of here", I replied, walking towards the car. "No, I need confirmation. Show me." he said, grabbing my arm and pulling me back. "Look, it's not a good idea to hang around a dead body. The job is done. Let's get out before someone sees us." I tried to convince him, but it didn't seem to have an effect on him. We both walked back to the house. I pushed open the door, coughed and cleared my throat. We walked into the drawing room and stopped at the door, because the suited man didn't need much evidence beyond what he saw. The man lay dead, face down, in a pool of his own blood. The blood spatter around him was a clear indicator of what had passed on some time ago. Satisfying himself with the gory scene, he said, "Alright, let's get out of here"

I sat quietly between the bouncers on our way back with the bag on my head. I smiled at my ingenuity. I had walked in quickly, held the gun to the man's face and asked him to keep quiet and not panic. I told him that I was a policeman and he had to do exactly what I told him if he wanted to stay alive. Assuring him that I wouldn't hurt him, I had sprinted to the refrigerator and pulled out a bottle of tomato ketchup, some beet juice and added some water to get the consistency right. I asked the man to lie on the floor, face down, and had set to work. Having worked on several homicides throughout my career, I knew exactly how murder scenes looked. By the time I was done, the masterpiece looked realistic. I told him that I would warn him with a cough in the unlikely chance I had to come back, and that he would have to hold his breath for as long as he could and remain motionless. The man had complied, following which I shot twice into the couch and everything had worked out exactly as planned.

The car finally stopped. The suited man asked the bouncers to stay back in the car. He held my arm and helped me walk. As I struggled to walk on the uneven surface of a muddy trail, occasionally stumbling, I thanked my good fortune for not being blind. We finally stopped. The suited man took the bag off of my head. I looked around and saw that we were in the middle of a strange wilderness. "Wazir will meet you in a few minutes. Wait here, and don't move", he said, and walked back a few steps. He then turned to me and said "You know what? I didn't trust you when I first saw you. You have a certain quality about you which made me uncomfortable. I thought you were a cop. But Wazir, he had no doubts about you. He said that you were the number one assassin in the market. I told Wazir that I didn't think it was a good idea. I wanted to give you a test and see the proof for myself. So I hope you don't think less of me and certainly don't think less of Wazir. It was my idea, and I am sorry for not trusting you.", he said, rather sheepishly. He then turned around and walked back towards the car. A few moments later, I could hear the sound of the car driving away.

I was in the middle of nowhere, standing alone, in the starless night. I suddenly realised how tired I was. However, I was close to the end. It was time. Suddenly a deep voice came out from behind a nearby tree, "You know what makes me successful? Hiring the best people". I turned towards the tree. The silhouette of a man appeared next to it. "He didn't trust you from the beginning. And though I told him that it was his choice to test you, it was organised by me. I was the one that sent you the briefcase and set the parameters of the test..." The man stepped forward with a gun in his hand, "and you, my friend, have failed the test!"

I saw a sudden flash of light in his hand and felt a searing pain in my chest. As I fell backwards, I felt my energy draining out of my body. The man appeared in front of me and the light of the moon illuminated his entire body, highlighting the deep red stains of tomato ketchup and beet juice on him. He pointed his gun at me, and I saw one final flash of light...

[Parts of the story were inspired by TV show Castle]

You may also like to read:

Other short stories that I wrote