Monday, July 10, 2017

Moo | What do cows think of anyway?

Cows. They spend 23 hours of their day looking fixedly at their surroundings. They're born hard-wired with the very basic necessities of life; they understand they need food(1) to stay strong, reproduce to prevent their species from extinction(2), poop to keep their insides clean(3) and sleep to be able to walk and chew food the next day(4). They have the very basic emotions; fight or flight; they know they can scare flies, and know they must run away from lions and tigers(5). Lastly, they have the super-power to ward of harmless flies with their tails only if they desire to.

Beyond that, they confidently occupy the roads of the nation sitting in the middle, I repeat, the middle of the streets, constructing a reality like ours in an alternative universe by warping time and space under the influence of different dimensions, creating spheres and circles with constants other than Pi, processing thoughts of millions in a parallelized manner, creating models for learning that do not follow the neural network, and create a form of life that is mutually exclusive of what species on Earth consider fundamentals to life-form. At other times they're indexing radiations from outer-space-beings faster than Google.

I'm kidding. But I'm extremely curious to know what cows think all day long, all year long, without giving a dime's heed to the world around them.

-

(1) they magically know what food to eat and what not to
(2) how any animal knows how to mate makes me very curious; why the urge to keep their species alive makes me even more curious
(3) they're savage; they'll do just anywhere. But how do they know how to use their tails to clean off the remaining grit?
(4) they all know when to sleep; when it becomes dark and they can't see. What happens if you keep this animal in artificial daylight all the time?
(5) they're not afraid of humans who don't carry sticks, and they surprisingly know human traffic will never crash into them and will always make their way around them, yet they're afraid of tigers and lions. What if for the next 100 years humans keep crashing into them -- would they evolve to be scared of human traffic?

Sunday, June 25, 2017

Inception | This is probably the best thing you'll read this month

Inception is the sort of movie that makes you think about it for hours after you see it. This is the second time I've seen the movie, and of course, after watching it I googled whether it was all a dream. I came across this post that I'm sharing as is. It isn't written by me, though I wish I could think of something as stirring as this. This will blow your mind, especially the very last sentence. 
Inception is one of those movies people theorize about, so here’s my take. I have not read about it or looked it up except to check the characters’ names, so this is based solely on what I got from watching it. Needless to say, tremendous spoilers follow for those who have not seen it. 
It’s all a dream. Ariadne (Ellen Page) is leading an inception on Cobb (Leonardo DiCaprio). The entire film is that inception, and we never see reality. 
In reality (which I will label “level 1”), the details of Cobb’s wife and past are basically as we’ve been shown. To help him get over her death and move on, someone has arranged an inception to implant him with that idea. (We don’t know who arranged this, or why; more on that later). The characters we meet as Cobb’s team are actually Ariadne’s team. 
When the inception process is explained in the film, we’re told the characters must go three levels in– a dream within a dream within a dream– to get deep enough to implant the idea. Well, that’s not deep enough on someone as skilled as Cobb. To make this work, they must go five levels in, and they can only do that through what the film calls “running with Mr. Charles”. They must turn Cobb’s subconscious against him and trick him into going deeper by convincing him he is running an inception of his own on someone else. 
The highest “reality” we are shown is actually a dream (level 2). In this level, Cobb is a vigilante on the run. The forces out to get him are actually projections– his defense system. (Mal makes that comparison toward the end.) He is given a strong incentive to perform an inception on Fischer– who, in level 1 reality, may not even exist. 
Ariadne presents her dream-self to Cobb as someone who will become his confidant. Because she is a neophyte, he can trust her. Because she relies on his guidance, he is not threatened by her. Because she is a prodigy, she can swiftly “learn” everything she needs to know without contradicting the above. And she is recommended to Cobb by Cobb’s mentor and father figure; we are told later that someone’s relationship with their father informs the path to their subconscious. 
Ariadne’s bond with Cobb doesn’t come from curiosity or happenstance. Her goal all along is to get into Cobb’s head and deal with his issues. When she wants more info or has strong feelings about how to proceed, she isn’t just concerned; she’s hitting him up for information and trying to direct his path. When she catches him sneaking dreams with his dead wife, she caught that on purpose. 
Levels 3, 4, and 5 are presented as the inception on Fischer. This is all one big red herring; what’s presented to us as Fischer’s journey is really Cobb’s. The “real” (level 2) Fischer is sedated on the 747. In his dream (level 3), he is kidnapped, and everybody goes to sleep in the van, leading to level 4. On this level, Cobb informs Fischer that he is dreaming. (Fischer thinks level 3 is reality, and Cobb thinks level 2 is reality.) Browning is framed so that Fischer will have an excuse to go into Browning’s head. There are several levels of deception on level 4: Fischer thinks he’s going into Browning’s head, Cobb is using that belief to get deeper into Fischer’s head, and Ariadne is using THAT belief to get deeper into Cobb’s head. 
On level 5, Mal shoots Fischer. The film portrays this as a huge problem that can potentially strand everybody in limbo. Not true! It was all part of the plan. Cobb had to believe that his irrational refusal to accept his wife’s death had led to disaster, making his problem as urgent as possible. This is achieved when his refusal to shoot Mal, even though he knows she’s not real, leads to her shooting Fischer and endangering everybody. The stakes are finally high enough so that Cobb has both a reason to go one level deeper and a reason to sort his problems out, once and for all. (At the very start of level 5, Cobb wonders what’s there for Fischer, and Ariadne says “what’s there for you?”) 
It is Ariadne’s idea for her and Cobb to go one level deeper. In level 6, Cobb finally learns to let Mal go. THIS is his inception! In a dream within a dream within a dream within a dream within a dream, he is implanted with the idea that his dream-wife is not his real wife and that he must move on; this idea, implanted so deeply, will grow in him. 
Meanwhile, Fischer’s inception works too: his father tells him on level 5 to be his own man, and on level 3, Fischer tells us that the dream made him realize he needs to do that. When Fischer wakes up on level 2, he just thinks he’s had an inspiring dream about his father and fellow passengers, not knowing it was all an elaborate attempt to change how he thinks about his father. Cobb got his end of the deal, and could finally go home to his kids. 
When the film ends, Cobb wakes up. The entire film has been a dream that helped him realize how he needs to handle his wife’s death. Ariadne’s work is done. 
As for who arranged the inception, and why? It doesn’t really make a difference. Maybe someone benevolent wanted to help Cobb move on. Maybe someone stood to gain from Cobb’s emotional breakthrough, similar to Saito’s reason for ordering the inception on Fischer. Maybe Cobb was in “limbo” the whole time, and this was a rescue mission. But I had a thought about this– the final thing I realized before writing this post. 
We don’t know what’s happened in level 1 since Mal’s death. All we really know is that Cobb feels guilty about it. But reuniting with his kids is such a strong motivation on level 2 that it’s probably true on level 1 as well. On level 2, he can’t see them because he’s on the run from the law, but since that’s just his self-defense system, that can’t be true of level 1. So what’s another reason why he might be separated from his kids, and might need to work through Mal’s death before seeing them again? 
It’s a bit obvious, but it fits: Cobb’s inability to deal with Mal’s death has driven him insane. He’s probably in an asylum, and probably wishes he could go back to his kids and a normal life. Ariadne’s motivation is probably therapeutic. When Cobb wakes up in level 1 and has learned to cope with Mal’s death, he will have been healed. 
And in the asylum, he is, of course, inmate #528491.
-
The only thing that doesn't fit is, does he ever go back to level 1? The movie ends with him accepting happiness at level 2 (though he doesn't know this is level 2) as his reality. How does Ariadne plan to bring him back to reality from the level that he completely believes as reality?

Saturday, June 10, 2017

Mario's running on our wall!

It had been about two months since we shifted into our new home in Bangalore, and every weekend we would make such grand plans of printing posters and sticking them up. This one particular Saturday we even forced ourselves to sit down before ordering lunch to spend an hour searching for posters and discussing ideas.

We ended up watching friends. 

This procrastination happened for almost a month, until I sat down and forced myself to it all on my own - it's almost always impossible to motivate a group to get things done if there's no deadline. I made a list of things I like/liked as a child, but just couldn't find worthy high resolution graphics that I could download without paying.

So here's what I did. I used to play Nintendo Gameboy a lot as a child, Super Mario Bros was my favorite game. I googled a whole lot of Mario grahics - the bricks, the clouds, the bushes, the coins, (which to be honest was quite tough) and resized them to all match the same size ratio. My (finally motivated) flatmates helped me cut them out and stick them on the wall. Cutting them out was quite difficult, especially the bushes that had infinite curves. Fun fact, the bushes and the clouds are identical! We thought of the level design without referring to an existing level.


So this was my Saturday spent well, and it was a lot of fun! If you'd like to make your own Mario level, I've collated the graphics in a file - Download the Mario characters and level graphics here

The interviewer asked the elephant to climb that tree

TL;DR: Being a good interviewer is difficult; but it'll earn you a lot of bonus points and send you to heaven.

As an interviewer you're practically shaping the near and even possibly far future of the interviewee.

The very fault of every interviewer is to ask what he expects candidates to know, not to extract what the candidate knows best. Just as with enough make-up and wigs all air-hostesses are made to look identical, interviewers treat candidates from all walks of life as the same factory produced robots.

This is exactly what happens. Horses, dogs, elephants and fish are treated the same.

The lack of ability of an interview to mould himself to find the very best in every new candidate is what makes traditional interviews a terrible failure!
Any professional worth his salt should be much like a psychologist, he should be able to pick up in the short duration he spends with you whether you're fit for the role you applied for, and even be able to suggest where you'd fit better.

Unfortunately, here's what happens behind the scenes. Full time employees/professors/professionals are asked to recruit talent for a day by their organization. Most sulk the moment they're asked to do this. The organizations hand over a list of 20-50 questions along with their answers. The sulking interviewers then ask each candidate a random set of these questions - you're in luck if you're asked something you know!

If you're one of the above, try very hard to be a good interviewer, please? Be crystal clear of your ideal candidate; do your research, know exactly who you're looking for in various fields of your business. But don't stop at that; you should know you will never find your ideal candidate - look for someone who has worked on their own projects and talks about them with extreme passion. Passionate people, people who always want to do something are huge assets to have around - not only do they do their work well, they're generally fluent communicators that inspire others around them to get work done, and think laterally.

Acing the Placement Season in University

TL;DR : Here's what I learnt the hard way about finding a job.

It's that time of the year again; probably the most difficult of your years at university. One by one, companies come and companies go - and from the looks of it you seem to stay there forever. The typical format of these interviews is, each company sends a panel of ~10 people to your campus to hire about 1 - 15 people out of 80 - 300 candidates in under 8 hours. From the perspective of the panel, you can imagine how difficult that'd be! Some companies have a specialized panel whose only job is to hire from a large mass. But for most other companies that cannot afford a hiring panel, employees are requested to conduct these. It's a long day where they are forced to actively listen to similar stories over and over again.

You can't change the format of the game, but you can play the rules to your advantage. Here's what you should do.

1. [Target your companies] Sit for only those you really want to get into. From seniors, or past placement records you know the companies visit your campus. Choose 3 companies and know everything there is to know about them. Google their interviews; text your seniors about what's new in the company. Don't sit for each compay that comes by. Losing is hard, especially when like a line of dominoes, day after day each one tumbles as each company selects their talent and leaves you out.

2. [Stay away from the noise] Placements are unfair - it's as simple as that. There'll be this chap that never did anything but got into Morgan Stanley because he was the first to get interviewed, or this other very talented batchmate didn't get selected because his interviewer was pedantic and an absolute sadist. People will talk, that's all they can do. There'll be this buzz throughout the semester of 'oh, do you know what happened to this guy?', or, 'ah, I feel so bad for her, she's been sitting for days on end and she goes till the final round, and doesn't get in'. Steer away from this noise as much as you can - just know from the beginning that it is incomprehensible to understand why someone got selected over the other; most of the time it's the panel to blame; the room that you get sent to.

3. [YOU guide your interview] You're the one who wants the job. Its in the first couple of minutes that the panel decides if they like you; but that's a psychological human trait anyway - we all do that on first interactions. You have to sell yourself and steer the conversation in what you're strong at. Not all candidates have the same technical abilities, and no one interviewer can know the plethora of technologies out there. So the interviewer generalizes and asks you questions from a set the company prepared and sent to their inboxes earlier in the day. Steer the interviewer away from that paper; interest him in your strengths. This doesn't always work; some interviewers are robots, that are rigidly tied to the rules.

4. [Look at it from the interviewer's POV] There's a reason to why campus placements are so unpredictable. Imagine yourself in the shoes of the head interviewer team of company X. You've been handed the task of selecting 8 people from a batch of 270 students, in under 8 hours. Your team isn't one of robots - they're all lazy, unfit humans that are accustomed to the luxury of centralized air conditioning and their buttocks resting on cosy office chairs. So, you as the panel head, how do you go about it? Even if you have a team of 6 by your side, each interviewer cannot conduct more than 10 full stretch interviews in a day - and by the time they reach the last interviee, they're exhausted and will not listen to what you have to say - they'll be blunt, expressionless and just sadists, for their job is done. Try not to be the last interviee.

-

In larger organizations, there's typically a gap between the recruiting team and the technology team, and they never know the exact requirements/portfolios of candidates. So how do you filter out people that would be perfect matches, when you don't know the requirements in the first place? Better yet; the recruiting team is never held accountable - so even if they hire poor talent they're never going to work with them anyway! 

Tuesday, May 23, 2017

The BIllion Dollar Mistake | NPE

TL;DR: null pointers will ruin your life.

If you've used Java on a large scale project, you're lying if you haven't faced this dreaded million dollar mistake, first introduced to the world of programming in 1965. It's uglier than a Windows backslash, odder than a ===, far more common than the latest release of a JS library, more confusing than understanding a GC, ever so slightly harder to debug than interger overflows - I'm talking about a programmer's guilty temptation, the horrid null pointer exception.

Homer, and computer programmers all around the globe.

Tony Hoare, the creator of null very casually says "I couldn’t resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years."

Very true, Mr. Hoare. Last week, I (finally) re-released Lifehacks on the playstore - having forgotten to perform one vital test. That very silly mistake caused over 11,000 crash reports.


The first four rows - they're all a part of the utility - a function returned a null value, and I never checked for it. PS: Ignore the number of chrome tabs/windows open.
It's a terrible mistake, and I've received hundreds of complaints because of this tiny error. Note to self: should've added units tests. But I didn't have the time, really.

So here's how to not use null in the future.

1. Never return null from a method. Just never do that. Instead, return an empty String, Collection, or whatever your method is returning. Just never a return null;
2. Use the @NotNull,@Nullable annotations.
3. If you're on Java 1.8+, use optionals. Read more in this article.

-
Reference : The initial half of this post is taken (with modifications) from this article.

Sunday, May 21, 2017

The Art of Summarization

At Google I/O, the CEO conveys an entire years worth of work of over 50,000 employees, and also hints at future developments. All in less than half an hour.

At a TED talk, the speaker conveys years, if not decades worth of research, their journey and enlightenments. An entire summary keeping the audience as engaged and as attentive as possible in a span of under 20 minutes.

-

An entire semester is dedicated to doing a project in our University - most students do internships during this period. At the end of the project we go back to college to present what we did in the 4 months. Every year students complain professors shamelessly thrash students, especially those who do their internships outside of University.

They do so rightly. Having sat through 15 such presentations of my batchmates, students just don't know how to put their point through!

Presenting what you've done for 4 months in 10 minutes is an art. You have to give them a background of where you're working and what the company does, which project team you're in, specifically what you did and finally how it affected the company. All in 10 minutes.

Here's what I learnt.

1. The ELI5 principle.
Know your audience. They're people. Don't assume level of knowledge. In the simplest words, Explain to me Like I'm 5 years old (ELI5), what you did. Its the lack of ability to say in simple words what you did that causes disconnect between you and your audience.

2. Demo. Demo, demo, demo!
Let your work do the talking - they'll ask you questions based on what they make of your demonstration. Here's an example.

Say you make this astonishing discovery about this phenomenon called rainbows. So, naturally you go ahead and explain to your audience, a rainbow is a meteorological phenomenon that is caused by reflection, refraction and dispersion of light in water droplets resulting in a spectrum of light appearing in the sky, caused by sunlight appearing in the section of sky directly opposite the sun - they really won't care. Show them a rainbow and they'll stand jaw dropped clapping in appreciation.

3. Loud, clear, simple words. They'll lose their attention cuz they've been doing this all day. Its in the first 2 minutes of any talk that the audience decides whether they want to continue listening or not.

4. Listen. Indians, if not all people are inherently terrible listeners. We jump to conclusions and argue at the instant we see anything going against us. Listen very carefully when you're asked a question. Don't jump to answering immediately. Let the question sink in, take a second or two, and then answer.

5. Show them the best, don't talk about the rest. Only you know what you've done and only you know what's wrong with your work. It's a very human thing for you to assume others may figure out what's wrong with your work. Show them the best of what you've done - the moment you tell them you hacked your way through, or give them a hint at what may not work because of so and so, you've lost your audience - honesty does not always work. They won't know a thing until you tell them!