Free basics considered harmful!

I have been a passive observer in the ongoing debate about Free Basics and Net Neutrality until I came across this blog by Mark Zuckerberg. TOI, sadly, is a popular newspaper in this part of the world and the blog has the potential to influence  millions of people. Hence I felt that voices of dissent are essential which has led to this blog post.

For the uninitiated, Free Basics can be thought of as an app that you install on your smart phone that in turn, lets you access other apps like Facebook for free without having a data plan. Apart from Facebook itself, it lets you access some other services that are deemed to be essential like Bing and Accuweather.

In the blog post, Mark recites the story of a poor farmer who through Free Basics got access to accurate and timely weather information, and consequently yielded a good harvest. He argues that people who are arguing against this, are doing so without thinking about the consequences of not having access to internet on this poor farmer. He also claims that this whole thing isn’t about Facebook’s commercial interests as there are no ads in Free Basics.

I am deeply skeptical about someone who offers help without asking for anything in return. I am even more skeptical if they sight hard to understand, but, good to hear philosophical reasons for doing so; especially if that someone is a for profit corporate organization. And there is good reason why you should also be skeptical about this too. Allow me to manufacture five scenarios that would illustrate the kind of power that this deal would give Facebook.

In the post internet world, access to people’s mind share is real money. If a billion users use Facebook regularly, telephone companies are going to want to be the ones through whom people access it. This gives Facebook enormous power over the telephone companies and also, through the fact that Facebook gets to decide what constitutes Free Basics, it also gives them enormous power over other companies. Let us imagine that we give into this Free Basics scheme and hundreds of millions of users use the service. That would give Facebook the power to do any of the following things.

  1. Facebook could demand that a corporate giant pay one million dollars to get included in free basics over its startup competitor.
  2. Facebook could demand that a mobile operator like Airtel pay one million dollars to be able to provide access to Free Basics.
  3. The mobile operator could in turn end up charging the regular customers more to offset the costs incurred due to Free Basics
  4. The mobile operator could in turn end up charging the Free Basics user more for other services like calls and SMS to offset the costs incurred due to Free Basics
  5. The government could demand that Facebook block access to certain content through a non transparent channel.

All of my arguments above are pure speculation. Facebook for all we know, may not even have a hidden agenda. But one has to remember the fact that Facebook is not a democratically elected organization. This means that the people who are directly impacted by its actions do not have the power to intervene if and when it turns evil. The public have zero insight into how Facebook gets to decide what should or should not go into Free basics and its monetary  impact, positive or otherwise. Changes like these at this scale are hard to undo. Hence it is of critical importance that they do not come into effect in the first place. Kindly take some time to urge TRAI to act against Free Basics. Oh! and regarding Mark’s claim about not showing any ads, Facebook’s real cash cow could well be its APIs and not Ads.

PS:  This is what Tim Berners Lee has to say about Free Basics. This guy unlike me must know that he’s talking about.

Adios windows phone

This July, I got myself a shiny new Lumia 640 XL. Having been an Android user till then, I was constantly annoyed that any website I visited asked me to install their mobile app on android. Plus, my amazing Nexus 4’s battery gave way – I guess its because I used fake and in-compatible chargers – and I was on the look out for a new mobile. I wanted to try something other than Android and IOS was frankly much too expensive – though still exquisite. But after 5 months’ struggle with Windows, I am ready to pen down my war story.

Maps

Let’s be honest here. Google is just starving Windows phone out of existence and Microsoft hasn’t been helping itself. I have read that Microsoft had developed a Youtube client for Windows phone that Google blocked because it did not comply with their policies. Google had alleged that the client does not display adds and allows downloads. I do not know if these allegations are true as I have not used the app myself, but if they were, it is pretty dumb on MS’s part eh?

But the issue in question is the lack of a decent navigation app on the phone. You can use Google maps on mobile, but the pinch zoom was horrible and did not work at all on my Lumia 640 and it does not have turn by turn voice navigation. Windows maps are just half as good as Google maps. Though they have significant amounts of data, they have yet to cover the smaller details that make Google maps just so intuitive and powerful. For example, Windows maps has turn by turn navigation, but; you cannot ask it to keep only on the main roads, it does not detect ‘slight lefts and rights’ correctly and rather than announcing that ‘your destination is on right’, it asks you to turn right at which time, you are looking for a road that does not exist while some moron is honking you straight to hell. Yes, Windows Maps has offline navigation, but, Meh!

Utility apps

Windows phone has a decent collection of those if you are in India. There’s Uber, Ola, Freecharge, Paytm, Food Panda, Dominos etc. They are okay. Amazon and Flipkart are there too, but all of these guys treat WP as a second class citizen. Some of them lack features – for example, Amazon does not host treasure hunts on Windows phone, but on the whole, you can get along real fine.There is a good collection of popular games as well. No complaints here.

The problem comes when you go looking for something out of the ordinary. I for one, wanted an app that would set off an alarm upon receiving SMS containing certain words. This was not available off the shelf. So I decided to write one. But I faced problems on that front as well which brings me to the next topic.

Pay to develop apps

When I wanted to write my SMS alarm app, I checked out their hello world tutorial. I had to use Visual Studio to develop my app – fair enough. But then, it is not available on Mac. I have an office supplied Mac and I could not install parallels or any other virtualization software to install Windows and did not want to pay for it in the first place anyway. I could get my Mac exchanged for a Windows PC at my office, but Meh!

Hardware

My Lumia costs a cool 15,000 Rupees off the shelf. I managed to get a discount, but its still  a lot of money. In that segment, it is competing with the MI4, One plus One, One plus X, Moto G etc. These are frankly much better phones. They have better touch screen, better resolutions and run on a better platform. They have  plastics. MS simply cannot compete with this lot with their phone unless they provide superb end to end experiences like iStore and Play store to some extent.

I installed the developer preview of Windows Phone 10. This brings a modern look to the OS at a time when Google and Apple are going context sensitive with Google Now and Siri. Cortana is nowhere near good enough. The office suite on Windows Phone 10 is more than competent with Outlook as its email client, Cloud Drive integration etc. Universal apps and Continuum sound cool, but I am skeptical because, I’m not sure how  many app developers even consider a native desktop client. The motivation for UAs and Continuum thus seems to be productivity improvement for people using the office suite a lot. What is their market share and how many of them are willing to own a Windows Phone is a huge question mark.

I ended up exchanging my Lumia for a OPO at one of WeBuys’ outlets for a price I thought was better than anything I could get for my brick of a phone. There are people who are still willing to buy one it seems. But, Microsoft simply has to get its pricing right. The most expensive windows phone is a cool 50,000 Rupees. It is about as expensive as a Nexus 6P and these two phones are nowhere near comparable. If MS cannot do that, Win Phone is going nowhere.

 

Review of Jurassic World

Sequels have a well deserved reputation of not living up to the original. Relatively recent movies like the Spiderman series and the LOR and Batman trilogies have  bucked the trend. Avengers the Age of Ultron relapsed back and I am not even going talk about Harry Potter series. In that sense, Jurassic World never made the mark. But then again I did not expect it to. The first movie took on the hardest challenge of brining dinosaurs back to life. Once they are alive, any subsequent plot is going to be less significant.

JW has its fair share of pluses and minuses. Straight to the short comings then Jarvis and the movie is rife with them!

The characterization is absolutely dismal. Apart from the lead actor, not one single persona is developed properly and stereotyping is rife! The main let downs are

Masrani – The character of the man running the theme park (which of course is fully functional and open to the public) is one of the weakest in the movie. This is saying something since this is the guy who has taken over from John Hammond around whom the plot for first movie was built. No background is developed apart from a passing reference to a conversation with Hammond, does not have a philosophy necessary for a character with such significance, does not intervene in any fashion into the course of the events that unfold and any decision that he makes at all is completely contradictory to his pervious one. And I don’t understand why the Hollywood is keen on accentuating the Indian accent to the point of making dialogs unintelligible. Life of Pi made this mistake and JW sadly follows suite.

Claire – The lead actress is stereotyped to be a pretty girl without brains so much so that its not funny by any stretch of imagination (though the apparently the audience around me loved this). The first movie portrayed Dr. Ellie Sattler as a strong and intelligent scientist (In a male dominated profession – a point which the movie brings out in a wonderful fashion) who influences the course of the plot significantly. Here we have Claire, who’s just interested in numbers (and no she’s not classy enough to be considered a genius with them as well) running around without doing anything at all. It was actually painful to watch her scramble for cover behind Owen petrified and the boys snubbing her offer of protection, deferring to Owen instead.

HoskinsLoweryBarry and Dr. Henry Wu – The compulsory military guy, computer operator, sidekick and the scientist in the movie. Compare this lot with Robert MuldoonDennis NedryDonald Gennaro and Ray Arnold and you know that the movie leaves a lot to be desired.

Characters on one side, the movie is also full of factual inconsistencies of the kind that any solid movie simply cannot afford to have.

The secret gene sequence – When the Indominus Rex is introduced, the genetic make up is revealed to be based on TRex and another half which was supposed to be classified. It is absurd in the extreme why it should be classified (which is not dwelt into). I mean, they were definitely not planning on introducing dragons!! As the movie goes on it becomes apparent why and voila, what else could it be other than velociraptor genes!! Then you will being to understand that the whole reason why it should be classified is to construct one small scene towards the end when the raptors turn against their human trainers.

Usain lightning Bolt – Everyone in this movie outrun dinosaurs almost three times their height without breaking a sweat. You’d exit the hall with a vague but definite suspicion that dinosaurs were as slow as sloth bears if not slower.

Fort Knox – No one bothers to explain why the tourists are enjoying some sunshine with a margarita for Heavens’ sake when a clear warning to seek shelter was issued hours earlier. No mention is being made of evacuating them to a storm shelter at the very least (One should think that the park must have one of them given that things did not exactly go smoothly the last time they had a storm in the first movie)

Look ma I have a gun!– One cannot help but laugh when Owen goes to rescue the boys from the most fearsome dinosaur to walk the earth (which could give trained killers nightmares by just the sight of it) with a gun that a moose which is being hunted would have sneered at!

Strangely with so much at fault, I felt satisfied coming out of the movie. In retrospect I guess its down the velociraptors! Every sequence that they were a part of was thrilling! be it at training or at hunt, they captured my imagination and kept me on the edge of my seat. The graphics were stunning and well composed. Chris Pratt has done a decent job as Owen; one of the few bright spots in the movie apart from the kids. But at in the end, its John Williams‘ immortal sound track that leaves with you when you walk out of that hall.

Quote for the day,

“[seeing the Brachiosaur for the first time] Uh… it’s… it’s a dinosaur!” – Dr. Alan Grant in The Jurassic park!

Book Review – The Monogram Murders

Any fan of Agatha Christie’s, would have heard about the new Poirot book in town written by  Sophie Hannah. I was curious to see the treatment that Poirot would receive outside the hands of the Immortal original author. I would have to admit that the book exceeded my expectations though it fell well short of the Gold Standard. This by no means is to belittle the new work, but should be understood to be a testament to the genius that is Christie. 

Plot

When one lays down the book, one gets the impression that the plot which could have been a very straightforward one was needlessly complicated to create a mystery out of it.

The murder itself is opportunistic in nature. Christie herself has used the type in her legendary Cards on the Table, but only as a sub plot. It is less likely to leave a chill in minds of the reader than the predominantly premeditated ones that are immaculately planned, executed and narrated in most of Christie’s works. That brings me naturally to the second aspect of the book. Narration. 

Narration

The book like a good magic trick (according to Cutter in The Prestigehas three parts to it: The PledgeThe Turn and The Prestige. I personally found The Pledge to be devoid of anything remarkable, The Turn arresting and The Prestige disappointing.

In most of Christie’s books, The Pledge portrays an ordinary routine which turns extraordinary either by the murder or by something that one of the character does or says (Cora in After the Funeral). The order of events are natural. The ones in the new work seem to be taken out of a Sherlock Holmes novel. It is hard to imagine a more unlikely sequence of events than the ones in the new book, though the plot tries to account for them without great success. The opening sequence aims for theatricality rather than logical consistency.

The opening sequence ends with the discovery of the murders. This leads logically into the routine of detection. Here, I cannot imagine a MO more different than Christie’s. No matter how sensational the crime, the routine is Contained. In the new book, the Poirot decided to start the questioning with a hundred people in the room. This is lacks the famous Order and Method that we have come to associate with Poirot.

The sequence which brings out the history behind the crimes on the other hand, is quite good. Here the author is in her element. I especially liked the characterization of Margaret Ernst  who evokes memories of Mrs Lorrimer from The cards on the Table by the virtue of her intellect.

The Prestige – the sequence where Hercule Poirot unravels the mystery is the most disappointing. The narration is drawn out and lacks coherence. One cannot but wonder if it was hurried to get the book to the stands come Christmas.

Hercule Poirot

Truth be told, everything considered, I think the author has done a decent job of bringing Poirot back to life. Yes the new Poirot, lacks the Order and Method, he is more willing to admit mistakes, is more ready to speak out his interpretations of the clues where the original was taciturn, but the author has managed to preserve the mannerisms, the proud, boastful and tasteful personality. Full marks to her in this regard.

One of the little things that I enjoy every much in Chirstie’s works, is Poirot’s French influenced English sentence construction. I really like quantified adjectives that I think somehow suites Poirot’s precise nature (It would be most valuable. An idea of the first excellence – Hercule  Poirot in The five little pigs). This is something that I find less of in the new book, but it does not come across as a criminal omission.

In summary, The Monogram Murders is an ordinary detective fiction, made less ordinary due to the presence of a character recognizable as Hercule Poirot.

Quote for the day

“Crime is terribly revealing. Try and vary your methods as you will, your tastes, your habits, your attitude of mind, and your soul is revealed by your actions.” – Hercule Poirot in The ABC Murders

Building great UX

I am not the typical “UX” guy. I am a developer at core. It is my opinion that in software development, one should not restrict themselves to a job description, but try their hands out on everything that adds value to users of the software. Doing so is much more fun.

This post is inspired from a post that I found on hacker news on building great UIs. UI is a huge part of UX, takes more than just good UI for a great UX.

UX has a very loose definition. In this post I am going to talk about UX for a typical web application.

  1. Light comes from the sky. Use light to project depth.  A great description of this is present in the post which I linked earlier.
  2. Display content horizontally only after capturing user’s attention (eg: forms with label and input control displayed side by side).
  3. Do not display content vertically if the user has to pay attention to more than one line (eg: forms with label on one line and input on the next).
  4. Browsing (look for interesting content) should be vertical and not horizontal.
  5. Keep the user’s eyes in the general area of top left of the screen.
  6. Content outside user’s range of vision blur into the background gradually and should not have sharp features.
  7. Content to which the user is paying attention should be slightly elevated (using light) from the rest if there are borders around it.
  8. Menus should be vertical as they are browse-able (eg Amazon). Horizontal menus are a legacy non-scroll-able desktop applications.
  9. Ads are not special enough to break point #6.
  10. Content with focus has bold text (of different color if needed) but the content should not expand.
  11. Focused content has sharper borders than non focused content.
  12. If it is necessary that the user has to move their eyes, it better be for a good reason. Try to group subsequent actions in the new region.

Things that I have found to be true

Having been a software engineer for four years now and having switched jobs recently, here are a few of my hypotheses about work that have held till now.

  1. It is easy to complain about boring work. Doing so and acting pissed off is self satisfying. But it will eventually bite you as more interesting work will go to someone else unless you keep yourself in the loop.
  2. Its not a sin to be slow, it is a sin to not be curious.
  3. Never say its not my job. Make it your job.
  4. Be conscious of your neighbor’s time.
  5. If you do not understand something, it *is* going to come back to bite you.
  6. Being correct is important. Fooling around will only take you so far.
  7. Technology *is* going to change regardless of whether you like it or not. Fundamentals don’t. They guide you through the changing tech landscape.
  8. Great developers in one technology *will always master* other ones quickly.
  9. Ignorance with regards to what the other person is doing outside of code *is* bliss.
  10. All said and done, software still is a an interesting line of work once you challenge and push yourself.

Download non jar dependency in gradle

We are using gradle as our build tool. Recently, we had to download a third party war which is a maven artifact and bundle it into an RPM which was our distributable. So in some sense the war was a dependency to our project.

As an initial solution, we download the war manually from the maven repository and checked it into our source. The gradle script when building the rpm would then take the war from the source tree and package it along with the RPM. Obviously, we faced troubles when we had to increment the version of the war. We did not want to manually download the war again and replace the war in the source tree.

As a second increment, we downloaded the war using wget from gradle during build time and then packaged it into the RPM. This was a better solution than first one because we did not have to manually download the war every time we had to update the version. But this solution suffered from two problems. One, it expects wget to be installed in your system and two, we loose out on the dependency handling capabilities of gradle. For example, you could specify a + in the version and gradle would automatically fetch the latest version of the war and you don’t even have to manually change the version in the build.gradle file.

So we came up with the third approach with a bit of help. The solution is to add the war as a dependency under a custom configuration and then use the resolve method to download the war. 

configurations {
mrsWar
}

dependencies {
mrsWar "org.openmrs.web:openmrs-webapp:${openmrsVersion}@war"
}

task downloadMRSWar << {
new File("${buildDir}/resources/main").mkdirs();
configurations.mrsWar.resolve().each { file ->
//Copy the file to the desired location
}
}
}

This goes to prove the point that custom dependency configurations is one of the primary reasons why you should switch to gradle if you are using maven.

Twelve factor: Port Binding

I came across 12 factor through my colleagues and was intrigued by their opinion on port binding.  12 factor suggests that each web application be packaged as an executable war file and that the war file should have a web server embedded within it that binds the HTTP Service to a port. Other people have gone a bit further and have packaged the application as a Linux service that runs the war file. This is completely different than the traditional way of deploying web applications to an application container. This post draws a comparison between the two approaches.

Installation

Installation of an application with an embedded server (hence forth called as the 12 factor app) does not require that you place a war file inside the server’s installation directory. The installation directory could differ from host to host and this makes the installation process more complicated. You could work around this complexity by using provisioning tools like puppet, but the fact remains that the root cause of the problem is coupling the installation of your application with the installation of the application server.

Use system package managers

The 12 factor app can be installed through system packages like RPM or Deb since it does not make any assumptions about installation directories. It is theoretically possible to install the traditional application through system packages, but since they would depend upon specific directory structures, it is not a recommended approach as the packages would not be portable.

Fine grained control over resource usage

Say that you have two web applications. Installing them inside the same container means that they are going to compete for resources like heap and perm space, thread pools etc. Lets say that one of those applications need to have high throughput. For applications that require high throughput, you would want to allocate more resources. Since the resources provided by the container is shared between the two applications, there is no guarantee that increasing the amount of resources allocated to the container would automatically get translated into more resources being allocated to the high throughput application. The solution is to split the applications into two separate processes.

Horizontal scaling

Imagine again that there are two web applications. This time, one web application consumes services provided by the other. If they are 12 factor, you could spin up multiple processes for the service provider and put them behind a load balancer at will. This allows you to scale your applications independently of each other.

System resources

Obviosuly, 12 factor apps since they are separate processes, would require more system resources than traditional apps.

Independent start and stop

12 factor apps since they are not inside the same process could be started and stopped independently of each other.

Ordered starts

Consider again that there are two web applications, one consuming the service of another. The service provider should be started before the service consumer. This is not possible if they are inside the same container as there is no specification that guarantees the order in which applications are started inside a container like Tomcat. 12 factor apps though, since they use system services, could take advantage of dependency mechanisms provided by service managers like chkconfig on centos boxes to implement ordering.

OS Specific

12 factor apps, since they use OS packages, are specific to the OS. You need to build separate packages for each OS you are going to deploy to.

Similar Runtime.

12 factor apps are not affected by hard to trace bugs that occur because there is a jar in the lib folder of tomcat that interferes with the one used in your application. This makes the runtime of your application same in all the environments to which it is deployed.

Properties

Since the 12 factor app is an executable war which is not exploded, the configurable properties of the app should be sourced through environment variables and not property files.

Control server based provisioning : Credentials

Provisioning tools like puppet and ansible can operate in two modes

  1. Master slave [control server mode]
  2. Standalone

In the control server mode, there is a process running on the master (control server) which could be used to either manually or automatically provision a new machine. In standalone mode, the puppet or ansible scripts are downloaded to the machine that you want to provision and executed from there.

One problem with Standalone mode is credential information. Regardless of whether your provisioning code is open source (eg github) or not, it is a bad idea to check in credential information into the source code. The provisioning script thus would have to download the credential information from a central and controlled location securely.

Though storing credential information on a central server solves the problem, setting up and running a server process and maintaining it is additional cost that one would have to incur. For small scale automations, the most cost effective strategy might be to manually enter the credential information when you are provisioning a machine. This could be tricky if you would provisioning in the standalone mode, but natural when you are using a control server to configure your machines.

Ansible solves this problem beautifully by allowing you to specify prompts that will get this information at run time from the systems administrator. Given that we are provisioning at most eight machines, we find this strategy more effective than the standlone setup.