Wednesday, 1 May 2013

Trek of a Lifetime

On 26th April, I had my first trek in life. It was a trek from Katraj to Sinhagad night trek. It is roughly 20 km, and you have to cross a 7 mountains and a few hills.

We were 12 people and we started the trek by boarding the bus from Swargate to Katraj. We were all loaded, we had with us heavy bags filled with water bottles, bananas (because nothing gives energy like a banana), glucose packets, biscuits and torches. At roughly 9.45 PM, we reached Kartaj Old Tunnel, which is the starting point of the trek. We started the trek, and it was pretty amazing and easy at first, it was mostly a walk over the hilltops. And that is how this trek is, there is no tough trekking part, its just that it is a very long trek. One of us, Kaushik, had already done this trek before, and we estimated that we’d reach the Sinhagad fort by morning before sunrise.

We had chosen a full moon night so that we could see easily in the dark. We climbed the first small hill, and then we could see the red beacon, our target. In the whole trek, you can see the tower on Sinhagad fort with red beacon on the top, which is like the Pole Star of the trek, there is only the beacon to measure the direction and decide the path. There we took our first break, we sat for some time, and then continued going.

The trek is supposed to be fairly very easy, but it took a very dangerous turn for us, because we went on a wrong path. There was a path, from where we were supposed to go to the right side and climb the mountain in a straightforward and easy path, but in the fun and frolic and the mood of the trek, we took the wrong path. There was a narrow road circumventing the hill, and we started walking on the road. As we continued walking, the road got narrower, and at some point, the road came to a dead end. So instead of going back and finding a new route, we thought we should climb the mountain from there itself. So, we looked up, it was may be 500-600 meters ascend, and, from the look of it, looked pretty normal.

As we started to climb the mountain,  the climb got a bit trickier. It was a 60-70 degrees slope, and the toughest part about it was that, there was nothing to hold on to. We struggled a lot to climb, and at some point of time, the struggle to climb became the struggle to survive. There was mostly mud on the slope, which we cannot hold on to, so as we climbed up, there was a risk of slipping and falling down into the valley, and that would mean only death.

We climbed by holding on to anything we could get, sand, rock, trees and even thorns. It hurt a lot, I could see blood running from my hands when I tried to pull myself up grabbing a trunk of a small bush that had lot of thorns. But, I did not feel the pain, because if I did not climb up, there was no way we could climb down, the descend would be uncontrollable and we would slip down and fall into the valley. Some of us made to the top, including me, and then we realized the grim reality - some of us are still far down and, from the look of it, they were stuck.

We people at the top tried to help them by highlighting the paths with the torches, and then slowly people started climbing up. First 2, then 5, then 6, then 9. 9 people climbed the hill with nothing but sheer determination. And then we realized, Shafi had slipped down and just grabbed on to a tree and was sitting on a rock, he was in a state of shock and was just sitting there not speaking anything. And Vishal was just hanging with Kaushik holding him, he had no energy left in legs to push himself up, he was neither in a comfortable state where he could sit and gain his strength.

We were all in a state of shock, Tejas thought we should call the police and get us somewhere safe, let alone complete the trek. But in such a remote place, there was no cellphone signal, and even if we managed to get one, where should we tell the police to come? As the people at the top were thinking all this, we were surprised to see Shafi climbed up from another path and suddenly appeared on the top and cried for help, immediately I, Harshad and Tejas went there and pulled him up. He had done an amazing feat by climbing on a path, having torch in his mouth and not tiring until he reached the top.

Meanwhile, Vishal had reached a comfortable rock and he told us that someone will need to come down and grab him up, Kaushik had no stamina left to push him up. Our rockstar, Nikil (first one to climb the mountain, our own Rajnikanth), told that he would go down to help him. Nikil went down, half an hour later, we saw Vishal reaching the top, and Nikil following up. It was a sense of relief like nothing before, we had the feeling we had fought and conquered death itself.

All of us sat there, speaking nothing, just trying to swallow the feeling of how we had, for a moment, thought that this was the last day of our lives. As we were sitting there, looking at the clear sky, looking down at the slope every now and then to see what we had accomplished. We had spent 3 hours on the mountain, and we were behind schedule, it was now impossible to make it to the destination before sunrise.

Still, we had the option of turning back, go down the mountain another path and stop the trek, but we decided to continue what we came for. After 15 minutes, we all stood up, and continued the path. But from now on, we all decided to stick to the easy path, and take the help of markers which were laid down to help us decide if we were on the right path.

After that, it got pretty easy. We were climbing up and down mountains and hills, and enjoying the walk in the moonlight. At one point, everyone just stopped. Tejas had spotted something in the bushes, it was glowing in the torch light, and on a closer look, it seemed like a pair of eyes. We all had our fears up, it was some wild animal. All of us picked up stones in our hands, pointed torches and took steps together. To our surprise, it was just a cat, and ran away when we approached closer. We all had a hearty laughter.

As we continued moving further and crossing mountains, the red beacon stayed at its place, it did not appear to get closer. The more mountains we climbed, the more mountains we saw between us and the destination. We could not go back, infact, there was no going back. There was no human population there, nothing but plain lands and valleys below, there was only one path - going forward.

As we continued the trek, fatigue started to take a toll on us. We had started exhausting all our supplies, we were taking frequent breaks, and it was getting very tiring just to climb a small hill. And we knew that there would be sunrise and after that, it would be impossible to continue the trek in the heat. We moved on, but could not defeat the sun in the race. At one point of time, we saw that we had just one more mountain to climb. After we climbed that, we got another shock - we had two more to climb, and from the looks of it, they were big ones, and already sun was continuously coming on our heads and it was getting hotter every moment.

We wanted to rest, but time was short, because the more we rested, the hotter it would get. And we had no water, it was impossible to climb without water, we were dehydrated. We had crossed several mountains and hills and now every step we took produced pain the legs. But anyways we started to climb the first mountain, it was very difficult, but we did it. And then we saw, the last mountain, it was very high. It had a very steep slope. None of us had the stamina to go on. We saw a road below, and a small village. We were very excited to see it. After a lot of debate, we decided to climb down the mountain to the village, and return back without reaching Sinhagad.

We climbed down, it was a very long path, but we finally reached a well. One of the villagers fetched water from the well and we drank from it. It was the sweetest water anyone had in their life. We then asked the locals and, to our surprise, we could reach Sinhagad top by jeeps. We boarded one, and then reached to the top, and relaxed in a tapri (small roadside restaurant). We ate a lot, we ate bhakri and pithla, had the most amazing chaash (taak, is what they call) and dahi from the matki. It was re-vitalizing. Shafi had no stamina to eat and just threw his backpack and slept on the floor of the tapri, we had to wake him up with great effort.

Then we departed, some of us took a direct car to Swargate, and some of us took the jeep to a nearby village and from there took a bus to Swargate. The trek was over, and when we looked back, we were so proud, we had achieved an amazing feat. At one point, it got so scary we thought we’d die, and at one point, it was impossible to take even one step ahead in the scorching sun, but we fought, geared up our willpower, and we did it. It was an amazing trek, one that cannot be forgotten in a lifetime.

Sunday, 17 February 2013

Awesomeness at a startup

My life has been awesome since September ‘12 - when I got placed in Sokrati. Reading news articles about the startups at Silicon Valley or seeing The Social Network made me think it is not possible to have a company with such culture here in India, but when I stepped into Sokrati, my thoughts changed.

The first experience in a company comes from the interview process - which itself was very amazing and breathtaking. The level of the interview questions was amazing, and there were no stereotypical questions that you would see on thousands of interview websites. The questions were based on practical scenarios and fundamentals. It was an amazing experience, and I learned a lot even from the interviews.

Once I was inside the company, it was very nice to feel the startup culture all around me. The whole company sits in one office - and that amazed me because I was from Cognizant. As I spent more time in Sokrati - I came to understand one thing - unlike other places where office politics, stabbing in the back - such practices are common, people here had only one fundamental ideology - learn, code, help and enjoy. Everyone was full of energy, so ready to help others, so focused on work, and so full of life. This was so different from people in ties and formal shirts, this was the t-shirt culture. I had a feeling that my life was going to be awesome here.

That was my first impression about the company. As I’ve been around for 6 months now, I have observed many such awesome things here, and I would be talking about few which I love the most.

First and foremost, people believe in you. Any senior guy (not Team Lead, not Manager, more on that later) is always pushing you to take the leap of faith, whether its trying out a new technology, deployments on production, debugging a hard and frustrating piece of code, organizing an event, people put their faith in you. At first, I got scared when someone gave me a hard task, as I didn’t whether I was upto it, but then as I started doing things, it turned out that because they expect, I can deliver. Its that push that matters. Thats how you grow. Thats how I’ve grown, just in these 6 months.

Another thing, there is no corporate ladder, no team leads, no managers, only Leaders. Everyone matters. Even a fresher has a say in the architecture of a new product if he has something interesting to share. As you continue to be in Sokrati, as and when you can handle people along with code, you are put into a leadership position, but it is unlike other companies where Team Lead or Manager has very little to say in the Technical domain. Here at Sokrati, our leaders are awesome technocrats and even more awesome people managers. Thats how we define Leadership in Sokrati.

The last, but not the least thing, the openness and frankness within the company. Every month we have a Gupshup Meeting where everyone in the company gathers and discusses their project, findings, any fun things to share and brings out any concerns out in the public. This gives every employee a clear vision what is happening inside the company. Everything is transparent. Every quarter, the company goal is shared with everyone, so that everyone in the company knows what he/she has to work for. Personally, this gives me not only a short term goal but a long term vision of where I see myself with the company growing.

This is all I have to say about (briefly) my first impression of Sokrati. Life is awesome here, and I am enjoying the work. Proud to say - I am a Sokratian.

Wednesday, 10 October 2012

Javascript Jinx: Parsing 'Infinity' to get a number

Everyone would agree Javascript is an insane language. It is very easy to make a mistake in Javascript.One thing about Javascript that makes it harder to code in it is that it is a very forgiving language. It does not raise errors (except in extreme cases). So, there are high chances of the code behaving weirdly.

Here is one awesome trick in Javascript. We know that in Javascript, there is no divide-by-zero error. Instead, when you try to divide any number by zero, you get a special number called Infinity. And this trick is about parsing Infinity to get a number.

Try to run this code in Javascript:
var result = parseInt(1/0, 19);
console.log(result);
The result is most unexpected. The output would be: 18.

Wondering how? This is what happened:

1. 1/0 gave Infinity
2. The base here is 19, so Javascript tried to convert ‘Infinity’ to a number in base 19
3. In base 19, the letter I corresponds to digit 18 (like F to 15 in hexadecimal)
4. So, it converted I to 18, then ignored rest of the string since n is not a valid string, and thus we reached 18.

Amazing isn’t it? This is why we have to be very careful with Javascript. Another version of the same trick:
var result = parseInt(1/0, 24);
console.log(result);
This time, the base was 24. So, this string is parsed: Infini, its parsed upto t since is it not a valid number in base 24, and then Infini is converted to a number to get 151176378 as the output.

(Courtersy: Stack Overflow)
P.S: This trick is so famous, try to search 'parseInt(1’ in Google, you will get an instant result.

Tuesday, 2 October 2012

Java Jinx: Differentianting Java API classes from other classes

This article is about how to differentiate Java API classes from other (external API) classes. This will require a bit of history in why Java became so popular and some architectural background about it. Java was mainly designed to work across networks. Main advantage of Java is that once complied, it could run anywhere, so computers connected across networks can play around with the complied Java file and run them directly on their computer. This led to popularization of Java over networks.

But with networks, comes security. So, any Java code coming through the network ran in a Sandbox, and all the classes that were loaded during the execution of the code went through a security check. The classes are loaded using a Class Loader instance, which performs all the required checks before loading any malicious files. But, these checks take time. So, a Primordial Class Loader loads all classes that are part of the Java API to speed up the loading process. Hence all Java API classes are loaded using the Primordial Class Loader and do not have a Class Loader instance.

So the logic is this: take any classes and check its ClassLoader instance exists using the getClassLoader() method, if the value is null, it is a class from an in-built Java API, otherwise, it is a class from external API, not part of Java API bundle.

Here is the code snippet demonstrating the use:
import org.codehaus.jackson.map.ObjectMapper;

public class ClassSourceInfo {

public static void main(String[] args) {
Integer a = new Integer(10); //any Java API class
ObjectMapper mapper = new ObjectMapper(); //any external API class

determineClassSource(a.getClass());
determineClassSource(mapper.getClass());
}

private static void determineClassSource(Class clazz) {
if(clazz.getClassLoader()==null)
System.out.println("Class is part of Java API");
else
System.out.println("Class is not part of Java API");
}
}
Now the question comes, where is this useful. Well, that is for programmers to decide. For example, there can be a scenario where every class which belongs to an external API used in the Production Code be logged into a file, just for debugging purposes.

Tuesday, 29 November 2011

One Step Ahead towards Retail

The recent bill passed in the Parliament that allows 51% FDI in multi-brand retail has created controversy in the political space. The opposition parties are threatening to stall the Winter Session, at a time when Parliament cannot afford to miss the session. Although it is the nature of Opposition to vehemently oppose every move taken by the ruling party, this particular discussion has aroused my interest.

The Congress believes that entry of global players into multi-brand retail space will enhance the entire chain and ultimately benefit the “aam aadmi” in multiple ways, by creating many jobs, by easing prices via supply strengthening, and creating an excellent farmer-to-market infrastructure. The government has ensured this by restricting companies to invest at least $100 million and 50% of it in building back-end infrastructure. Given these rules, there is no doubt that there are going to be positive effects of the decision.

These global players were eagerly waiting to tap the potential India has. They have at least 20 years of experience in building end-to-end infrastructure, and flattening the entire retail process. The kind of technology Wal-Mart offers in retailing is second to none. It has such command over its supply chain management that it is bound to create a technology that will amaze customers. In such an age when India is considered to be one of the fastest growing economies in the world, why should India be bereft of witnessing such a transformation in technology?

The most prominent argument that the Opposition is riding on is that entry of such global players in the retail arena will kick out small retailers and famous “kirana stores”. This argument is baseless as I can think of one comparison that will make this clear. Entry of four wheelers into the market does not kick out the two wheeler market. This may sound a very crude comparison, but this is how I justify it. Big retailers and small retailers are entirely different concepts, and they both cater to different markets. People buying from malls also buy from kirana stores, the main reason being they are fundamentally different concepts of retailing.

Shopping in big malls is considered to be a one-time thing, with urban families going once every weekend or fortnight to buy essential and “non-essential” items. Yes, non-essential items, because a trip to a retail mall always brings in many extraneous items along with the essential ones (accept many families). These trips sometimes are also considered an outing or an experience rather than an absolute necessity. While the kirana stores offer customer satisfaction by giving a personal touch, they also offer home delivery, and offer credit facilities also. They are considered a necessity while malls are not, no one would like to drive 2-3 miles just to buy a loaf of bread. Kirana stores deliver items when urgency is a criterion. Also, in such busy professional life, every one would like to buy things on the way home. In such a scenario, kirana stores have still a long way to go.

One thing that amazes me is why don’t players like Big Baazar, D-Mart or Reliance oppose this move. Because they cater to the same market the big foreign players cater to. If Wal-Mart or Tesco or Carrefour enter Indian market, these are the ones who would be sharing the markets. Any customer after deciding he wants to buy a car would choose between Toyota Etios or Maruti Swift but he definitely won’t be making a choice between Bajaj Pulsar and Maruti Swift. In the same way, whenever a customer wants to go shopping in a mall, he will choose between Wal-Mart or Reliance Mart, creating competition to the big Indian players already present in the market. It is surprising to see why no politician is addressing this issue, perhaps because by addressing small retailers they want to win the votes of those people who think their logic is correct.

Either I am missing some issue on this point, or either the whole economy is shrouded by political debates alone. In my opinion, no market should be restricted, Darwin’s theory of struggle also applies to this space. Let the toughest player survive. Opening the market in 1991 has transformed the entire economy, and this is one thing we should thank Congress for - opening up the market. It is trying to do the same thing now. In such economy when inflation is not easing despite million efforts by RBI, why not give a little chance to these players as well. It won’t in any way harm the current prices, that is for sure. Lets all take one step ahead, together.

Friday, 28 October 2011

Are Great people really Great?

Scores of people have come upon this earth and have contributed a lot to mankind, and we remember them as heroes or saints. Their simple acts have had profound effects on the way this world lives and breathes. These people are remembered for their good qualities, selfless nature, extraordinary intelligence, problem solving capabilities and what not. But, one question that comes to my mind is that - what will happen if people come to the know that dark side of these people? Would their opinion change? Should their opinion change?

The recent death of Steve Jobs created a wave of sadness in this world. Everyone hailed the great master and innovator of technology. We all know that without him, we wouldn’t have the digital world at our hands. PCs, iPods, smartphones, tablets - he brought a revolution, followed by millions of other similar products, leading to a price war that ultimately lead to affordability for the mass. He brought the technology of the sci-fi to the hands of the common people. Undoubtedly, in the words of Thomas Friedman, he made the world flatter. But, do we know the dark side of his persona. As the stories are revealed, there are many aspects of his personality that completely changes our perspective towards him. For example, he demanded perfection from every one of his employees. If an employee had worked all night and his work was not good, he would just tell him “what the hell did you do. you are useless”. He didn’t value hard work, he valued only innovation and perfection. And he was also notorious for firing employees in the corridor, when everyone was watching, just to humiliate the employee for his bad work. He also minced foul words for Bill Gates, Larry Page only because he did not like their work. He was selfish, and obsessive about only Apple’s progress.

Take another example, of one person that is near God to every Indian - Mahatma Gandhi. He gave us independence, gave us new weapons like Civil Disobedience, Non-Cooperation, and Satyagraha. He was an icon with a frail body but determination that no one could shake. But, he was not a good family-man. As we dig deeper inside the story of his life, we come to know that he was neither a good husband, nor a good father. He never cared for his wife nor his children. He was so preoccupied in the fight for his nation that he never had time for his family. His sons had always said “He was the father of our nation, but he could not be our father. We had to pay the price”. There are also speculations that he had left Kasturba in South Africa to live with Kallenbach, an architect. Gandhi was deeply overtaken by Kallenbach’s personality. There are also some speculations that Gandhi had slept with some of her nieces. Some people has gone so far as to call Gandhi “a very dangerous, semi-repressed sex maniac”.

Should these facts change our perspective towards Steve or Gandhi? Do these facts diminish the fact that they contributed a lot to the society? The answer is: No. These facts do not change what they gave to the world. But when such people are made icons, the negative facts are purposefully ignored or forgotten. And when such facts are revealed, it leads to protests and furor. The reason for this is that there is negativity in everyone. But people see such icons as epitome of goodness. They try to ignore the negativeness in icons because they get inspired from them. If they are told about the dark side of these personalities, they feel they possess some of that dark side too. And people can never accept their dark side. They think that “if these people can be bad, what about us? So, they cannot be bad”. They cannot accept the fact that someone so famous can have a dark side too. It is absolute denial.

And this was the only reason Dan Brown’s “Da Vinci Code” created such a controversy, because he tried to expose some facts which tarnished the image of Jesus. Great writers, poets, novelists write for one reason - to inspire people to do good from the good of other people. But there are other writers too - who are interested in telling people the dark side also. It is up to us to know both the sides, and follow the good side. The dark side of these personalities simply tells us one thing - there is good and bad everywhere. But what made the people famous and iconic is not the bad thing, but the good thing. And the good things were enough to shadow the bad things into a little corner which everyone ignores. Embrace the truth, and follow the good. That way, everyone will be happy and aware.

Wednesday, 12 October 2011

Steve's Legacy

A Legendary person has left us: Steve Jobs, the pioneer of many technologies we use today, that have changed our lives altogether. Who would have imagined, that one day the research of Steve duo - Jobs and Wozniak, would transform the world and usher in an era of Personal Computing. Yes, I am talking about Apple II - the Mac that changed the world. It is amusing to imagine that someone without a formal college education can do something so wonderful. For normal people like us, its just impossible to imagine the way Steve would have thought.

He was great not only as an innovator, but also an excellent entrepreneur. Under his tenure, Apple grew. Without him, Apple fell. He switched his field to that of Animation, and transformed it too. There is no single person who does not know what Pixar is. Wherever he went, he had one thing in him - his passion for things. In his famous lecture at Harvard, he had told “When I left Apple, it was the best thing that could happen to me. It was like taking a break from all the fame and starting again as a beginner”. This attitude really helps - the world has always an opportunity to grab, just have a vision for it.

iTunes replaced CDs and DVDs, and iPod replaced the players. Bag on the back, earphones plugged and iPod in the pocket became a symbol of modern youth. Music was being “shuffled” on the fingertips. The previous generation can laugh at themselves waiting for their favorite song to come on Doordarshan or on Aakashvani. iPod signified freedom to the youth. It is really inspiring to see that a technological product such as an iPod, can have not only a technological impact, but social and cultural impact as well. iTunes brought the world closer. It just helped making the world flatter.

iPhone is world’s first touch smartphone, and till date, it is the best. Like Apple II introduced the concept of Personal Computers and GUI, iPhone was the foundation for touchscreen technology. Before iPhone, touchscreen was a sci-fi concept, but after iPhone, we never cared when that child sitting on the next seat used touchscreen technology. iPhone was not only a smartphone and a mobile - it was a concept all together. And just when we were coming out of that shock, we suddenly had iPad and iPad 2. And today we have every mom and pop company making tablets suiting to every market.

What is common between Apple II, iPod, iPhone and iPad? Answer: the reaction that followed. Every competitor followed the suit. After Mac introduced type-face font and a rich GUI, Windows followed it. And today, we have no computer that does not use a GUI. After iPod? Every company in the world came up with their own MP3 players. But still, iPods stand above the crowd. Similarly, after iPhone and iPad, every company started making their own smartphones and tablets. Even Google, the company which is known for some of the best brains in the world - had to bow down to Apple. Many companies launch products, few companies start a revolution. And Apple started revolution not once, twice or even thrice - but four times. That is a rare feat. Steve was really awesome.

He was a real Phoenix - he rose from his ashes every time he fell. He kept going on. Although, there is some part of Steve that doesn’t make us want to respect him. He abused is employees, fired them in the corridor, and he disowned his daughter born in a wedlock. But, everyone has some yin and yang. The world wasn’t affected by his firing a few employees or disowning his daughter, but it was surely affected by his innovation. And we will always remember him for that.