Tuesday, December 29, 2015

I love you?

"I love you." Is a statement and yet is almost never just that. It embeds in itself, a question when stated for the first time. It asks the listener a question of reciprocation. Do you love me?

I find that it is exceptionally difficult to ask this "statement" and yet when analysed it offers no explanation. If you do not ask, you can never know that s/he loves you and so you will surely never be loved. Yet if you ask, there is at least a chance s/he loves you.

The difficulty I believe arises in the superficial analysis. If you take into account that I love someone without knowing if the feeling is mutual, I run the risk of loving someone who does not love me back. If I do not ask the question, I run this risk.

If however I do ask this question I run the risk of knowing that s/he does not love me back. This possibility of pain in the future overshadows the pain of not knowing anything and thus this statement is difficult to "state".

For all those people in the world who do not tell their loved ones how loved they are, you should. This world needs more love in it.

Friday, December 25, 2015

The nature of the average man.

I fear for this country. My fear is not unreasonable since it is based on observations I have myself taken. It might be biased but even in that case I think it will hold true.

My fear is that this country will have no bright future. No good things will come out of this country since the only people who do good things are the outliers, the statistical improbabilities. Our country's attempt to create these outliers is to simply create more people.

We area attempting to fight quality with quantity in the hope that out of the many random upbringings possible in this country, one will give rise to the next Ramanujan. That is simply too far fetched. One may attempt to do this but it will bear no fruit.

The problem in my opinion lies with the will of the masses. The masses are simply put, intellectually shut off. Take for example the talks between young men in hostels. In the pursuit of excellence in academics these men have enrolled in the best of institutes and yet the dominant conversation in their free time is about the simpler instincts of man.

There is nothing wrong about the simpler pleasures of life. By all means life is a sum of these pleasures, but the people who have decided to devote themselves to study should at least prioritize these pleasures.

Perhaps the problem lies in the assumption that they have decided to enroll. When academic qualification becomes a requirement for a lot of things, people enroll simply to become eligible for that something else. This creates pseudo institutes of learning which offer a stamp of qualification to the students( better called candidates).

My fear is that because the quantity of such people is much more than the people who actually pursue academic excellence, it is more probable that the pseudo-learned will land government jobs than the learned. The government in turn being a majority of such people makes the lives of the learned more difficult.

Such effects are controllable in a small population but in a population as large as the Indian citizenship, this is a major flaw. It causes inertia in the system which takes a lot of time and force to change.

It leads to stagnation in a nation's rise to glory. That is my fear. The population of this country creates intellectual death spots and those spots are what will rule this country.

Wednesday, December 23, 2015

I Aim At Hash

Trickled along, drop by drop,
Evident yet, unstopped.

Ignored as a minuscule thing,
Silently cumulating.
You look at where it's going,
Surprised, there is an ocean growing.

You'll look for her start morn,
Like water for fish she's gone,
Drop by drop,
She has gone beyond your grasp.
Memories you did not live,
Words you did not give,
Now that you've started to talk,
You're afraid she might stop.
She has gone beyond your grasp.

The distance is a pain,
Wonder if she feels the same,
There's none you can blame,
'cause when she was there,
You refused to seize the day.
Never was she in your clasp.
She has gone beyond your grasp.

I implore you,
Lady of his dreams,
Grant him this wish and let him be,
By your side until to a stop,
His heart bleeds.

Maybe she will come back,
But if only you could only ask.
Drop by drop,
She has gone beyond your grasp.

Tuesday, December 22, 2015

Pichai Sundararajan makes me sad.

Living in India one can hardly live a day without hearing about some or the other personality making it big in the world and being of Indian origin.

My first response to such articles and news items was joy at knowing that Indians are doing something substantial. Sundar Pichai gave hope to thousands of programmers in India.

After a while though the term began to bother me. Indian origin. The words mean that the person was not from India but his/her roots could be traced back to us. I felt like an ape rejoicing that humans went to the moon, because of ape-origin.

What I realized is that all these things had motivated us for the wrong reasons. They had never lived in the conditions we live in. They did not know India like we do. All they had were distant roots in this country that we live in and survive everyday.

It means at some level that those people or their ancestors chose to leave this country due to some reasons. It might be that they found the other more lucrative or that they were frustrated with this one. What the essence of my rant is that this country was not good enough.

If indeed we want to celebrate the Indian origin success story we should keep in mind that what we are celebrating is not the success of the country in that field, rather the success of the country in producing a child who could do amazing things but had to leave the country in order to do so.

Sundar might have grown up here but in order to do great things, he had to leave India.

Friday, December 11, 2015

Book Review: Bhima- Vikas Singh

When I first saw the title and illustration I was delighted to be reading about another character of Indian origin.

The cover grips you completely. The charismatic title of 'The Man in the Shadows' lends the thought to the reader that there might me some things they might not know about this character they think they know.

The name itself invokes images of legend and might. When these two things hit you with the wonderfully illustrated images, it fills you with a sense of curiosity. Men in shadows are usually associated with having done enormous tasks or played immense roles in tasks not usually associated with them. What is it that Bhim did which we did not know of?

If Bhim did it then it must me something immense, something of superhuman scale.

The book promises to show you facets of Bhim that you did not previously acknowledge. You expect these to evolve under the sections of the Mahabharat which were briefly touched or under disagreement. You expect to be shown a portrait of Bhim so good that you cannot help yourself but bow to the man.

None of that happen. The reader's perspective of Bhim remains almost unchanged. The only new addition is that perhaps Bhim was a man who had exceptional sex drive to have slept with women of other species and one of great need for acceptance.

All other attempts fail at one point or another. Depiction of combat attempt to lure you in with mentions of muscle names and fail on mentioning that air supply to the brain is blocked. The author fails to realize that the only thing reaching the brain is blood.

An attempt to show Bhim as a philosophical man fails throughout the book as most of his efforts are illustrated to be the work of a simpleton who just happens to hit on deep things. Bhim himself is not capable of deep thought.

There are attempts to reconcile the mystical nature of the Mahabharat though mentions of aliens and evolution being the cause of the deva and rakshas races. It fails when one realizes that evolution always moves to one point. For such stark evolutionary differences to arise, there have to exist impossible conditions on this earth.

Then there is the eternal display of Krishna as a deceitful man, though I have no problem with that. Attempts to show that good and evil are not clearly defined are half hearted and echo of the works of Amish and Arvind Adiga.

Overall the book leaves an unsatisfied taste in the mouth of a reader who was expecting a deep character study. It is mostly a description of the key events of the Mahabharat which involve Bhim peppered with gruesome battle and a desire for sex.

The author in my humble opinion, needs to do a deeper study of characters and techniques before immortalizing them in ink and thus producing a book with potential but no fulfilment.

Thursday, December 3, 2015

Why is Python a high level language?

High level languages are usually defined as languages in which one instruction translates to more than one machine level instructions. Though I find this definition simple and precise, I also find that a lot of students find it difficult to understand this definition.

A simple demonstration can be done in Python. First one must understand that any hardware comes with it's own instruction set. The hardware allows others to instruct it using an instruction set which is created by the manufacturer of the hardware. This is the basic instruction set and consists of things like ADD, SUB, LOAD, BIND etc.

In Python we may consider a hypothetical hardware which needs instructions called byte code to run. Now we see how a simple python program converts to multiple byte code instructions per statement.

First let us create a simple function in Python.
def my_function():
    x = 1
    y = 2
    z = x + y
What this does is create a function that creates two variables x and y and adds them together before storing them in another variable called z.

To see the machine level instructions which must be carried out to complete this function we will add the following to the python file (possibly myfn.py)

import diss

What we get as output is:

  2           0 LOAD_CONST               1 (1)
              3 STORE_FAST               0 (x)

  3           6 LOAD_CONST               2 (2)
              9 STORE_FAST               1 (y)

  4          12 LOAD_FAST                0 (x)
             15 LOAD_FAST                1 (y)
             18 BINARY_ADD
             19 STORE_FAST               2 (z)
             22 LOAD_CONST               0 (None)
             25 RETURN_VALUE

The initial numbers in the first column are line numbers in myfn.py

Hence we can see the expected machine instructions to compute this function. Note that line 2 and 3 in our file expanded to 2 statements while line 4 to 6.

Hence we conclude that Python is a high level language.
For more details refer to the Python docs.

Thursday, November 26, 2015

They are gone

I thought there would be music,
I was wrong,
Colours would become vivid,
Noise to birdsong.

My world should have changed,
I was wrong,
Like every other friend,
Like every other bond.

I should have noticed,
I was wrong,
You won't see your love,
Until they are gone.

Monday, November 23, 2015

My all

You are my light
my solace, my balm,
my peace, my calm
in this raging storm.

You are my shelter,
my cradle, my hope,
my thread of existence,
my only rope.

You are everything
to me, my love.

Saturday, November 14, 2015

What Educators Need to Learn From Machine Learning.

Machine learning. For someone who dreams of being an educator, this was one field which I did not expect to teach me anything with respect to Education. Never have I been so wrong. The very name should have told me something.

Machine Learning is centered around the idea that you can teach machines how to learn from the data it receives. The difference between teaching humans and machines is that for the machine you have to spell it out to completely. A human child already knows how to learn. A teacher's goal is to enhance that ability. What I present here are some things I learnt from studying Machine Learning.

There are two types of training in Machine Learning(ML). The first is supervised and the second is unsupervised. During supervised training, the computer is given input and shown expected output. Essentially what we are saying is "When you see this do this." The computer then learns on it's own to relate the input to the output. This method is fast, efficient and generally the road people take.

The other type of training is unsupervised. You give the computer some data and ask it "What do you see in this data?" generally speaking. This technique might not teach the AI what you intended but it allows it to find patterns that you yourself might have missed.

What educators must take away from this field is the fact that there are a lot of errors when teaching an AI anything. There is the problem of over training, causing the AI to perfectly know the training data but perform badly on new data which is previously unknown. This is akin to the habit of rote learning among students. While it allows you to perform incredibly well on the data you have been trained on, the performance drops drastically once new data is introduced.

Another facet is that AI are generally geared to do different tasks. If a Feed Forward Neural Network is asked to model a  time series it will fail. Not every student is the same. That does not mean that the current education methods count for nothing. What it means is that the educator needs to be especially perceptive of what the student is best suited for. Especially developing that need and letting the student develop that very skill is what an educator must do.

Coming back to rot learning, let me tell you about neural networks. Neural networks were inspired by the nervous system of humans. The brain is essentially a mass of neural networks. This lets us come to a conclusion that can help us teach better. The only way neural networks can learn anything new is by recalling that information again and again. However they are also incredibly good at building shortcuts. Recalling something the same way again and again slowly loses it's effect.

The challenge for the educator is to allow the student to recall the same information in different ways. One might take the example of the number PI. PI is the ratio of a circle's circumference to it's diameter. It is approximated as 22/7. A better approximation of PI is 355/113. Since PI is irrational it contains every possible number within it's never ending and never repeating fractional part.

With that we have created four different ways for the student to access the number PI. This increases the student's actual recall of the number PI itself. The human memory is unique in the fact that the more things you remember the more you can further remember. Let me illustrate. Your task is to remember this next drawing.

With the following bits of information you will know more about this character, thus giving you more ways to recollect it. Ultimately your memory of this character will be impeccable.
  • It is a mandarin character
  • It signifies the sun
  • Originally it did look like a sun.
  • It also signifies a single day 
Now that we know these bits of information we will remember this character better. Another bit of information is the evolution of this character as shown below.
Thus we can see that the more a student learns about a subject, the more they will be able to learn in the future.

With that I conclude this half-rant, half-wish of mine in the hope that I can one day be a good educator.

Wednesday, November 11, 2015

Statistcis of the 2014 General Election

The 2014 General Elections were very popular and saw the introduction of many new faces onto the political platform. Some interesting statistics from those elections and their results are shown here which might lead us to some interesting conclusions. To begin with, let us define our data set. The links used to provide data were:
With these links we had with us the election results of all candidates in the 2014 GE. Along with that we also had with us the number of criminal cases against approximately 1400 candidates.

Using DATA1 and DATA2 we create a list of candidates present in both the data sets. Thus we have ~1000 candidates. From this list we only use 3 pieces of information.
  1. Candidate name
  2. No of criminal cases against them
  3. Number of votes they got
With that we obtain some interesting figures:
  • The minimum vote anyone received was 1
  • The maximum anyone received was 758482
  • The maximum number of criminal cases was 382 against Uday Kumar SP
  • The second highest criminal count was against Sridip Bhattacharya at 57
  • Minimum number of criminal cases were 1
  • Correlation factor between criminal cases and votes was 0.032
Some things of note are:
  • The correlation is weak. Thus it is ignored. In order for it to be relevant, it must be at least greater than 0.1
  • Real criminals are still contesting for public office
For the time being the 2014 GE show nothing interesting statistically for me to discover at my level. I will consider it interesting the day the covariance crosses 0.1

Comments and similar efforts are welcome.

Thursday, November 5, 2015

Secure Distribution of Examination Question papers

During various examinations the secure distribution of Question Papers is an important aspect of the entire examination. In case the paper is compromised the entire examination must be scraped and redone. This introduces a lot of cost to the examination body.

Here we attempt to develop a mechanism to securely deliver question papers for an examination on the day of the examination. Our goals encompass:
  • Secure delivery of the document to exam centers
  • Robustness of system
  • Cost effectiveness
  • Scalability
In order to facilitate this system we will use already existing technology and infrastructure, namely Internet and mobile penetration of India. We will adopt the use of technologies such as websites, public key encryption and hashing.

Common terms used here are:
  • Host: The body/institution responsible for the conduction of the examination.
  • Exam: The examination under discussion.
  • Center: A place where candidates may take the examination. May be an institution/independent body
  • Paper: The examination question paper

The resources needed to complete this objective are:
  • A website controlled by the Host.
  • Printers at the Center
  • Proper backups for printing are necessary in case primary printers fail.
The method employed is:
  • The Host encrypts the paper using PrivateKey1.
  • The resulting document is again encrypted using PrivateKey2
  • This document is made available for download on the website that the Host controls N days prior to the examination, N being selected based on the scale of the examination.
  • Along with this PublicKey2 is made available on the website to authenticate that the downloaded document was indeed indeed generated by the Host.
  • On the day of the examination, the PublicKey1 is declared using one of the mass communication methods discussed later.
  • With PublicKey2 and PublicKey1 the Center can now read the paper.
  • The center now prints copies of the paper as per requirement.
  • It stamps each paper with it's seal/stamp/hologram to verify that this physical paper was generated at the Center.
This method has several weaknesses and strengths. Some are:
  • The points of attack on the paper are reduced to only the Website and the Center.
  • Attacks on the website require a high skill set and thus limits the number of attackers to the system.
  • With proper precautions the chances of take down are limited.
  • Proper security of the website ensures proper security of paper distribution.
  • Authentication of the paper is done through public-key cryptography
Some weaknesses are:
  • There is no way to ensure that the Center prints what is received. They may print a different paper.
  • This can be remedied with a punishment system. After the examination, the Host publishes the paper as plain text.
  • If this is found to be different from what was given to the candidate at the Center, the candidate can report it.
  • In case of a candidate reporting an institute, investigation comprising of the stamped paper with the candidate and the paper published will be undertaken by the Host.
  • If Center is found guilty, it can be blacklisted and possibly a lawsuit filed against it for breach of contract.

For mass communication, SMS, email, content on website can be used to distribute PublicKey1. This has a two fold advantage.
  • People who receive can also forward the messages to their peers.
  • Distribution is organic. False keys will be eliminated by peer review.

With such a system in place it becomes possible to distribute exam papers securely and without much risk.

Saturday, October 31, 2015

Me and my OSes

Operating systems have changed over time to reflect what the end user wants out of them. Over the years I have changed the Operating Systems I have used and they in turn have changed my perception about operating systems. This is my attempt at chronicling them.

My first computer arrived in the house in the year 2002. It was a Compaq Presario preinstalled with Windows Millennium. Those were the days...sigh. The first day we switched on the computer, we could not manage to turn it off. Since it was a new machine we thought that turning off the main power was not really a good option. We had to call a family friend who lived near by to switch off the computer.

Windows ME

Windows ME was the last OS in the 9x series of Microsoft windows. It was a good OS as far as an 8 year old me was concerned. During that time, I had no notion of what a computer was. The entire machine was a black box. A graphical interface provided some confront, something I could work with. At school all the kids had Windows XP and powerful hardware while little old me was stuck with Win ME for whom support stopped in 2003. During those days all I did on a computer was play games. CDs were exchanged between classmates and games were played. Those were the days when I had no notion of the fact that games could be transferred between PCs without CDs. This computer had about 64 MB ram and an 80 GB hard disk. The memorable games played on this machine include Age of empires, Road rash and Rage.

Family members used it from time to time. My mother at one time got one of the family friends to put a BIOS power on password. I remember my sister and me playing detective to guess the password by laying out graphite powder to figure out what mom had typed.

Since I was restricted to just the boot procedure I noticed the flashing prompt to press F12 (or at least I think so) to enter BIOS. Somehow I got into that and reset the firmware to factory settings. I have no clear recollection of how I did that. Mom said, if I can break into it I can do it again so there is no point in the password anymore. The one thing about this OS I remember was that I used to think that frequent crashes were part of the system. They were meant to happen. Now I know they do not. For a child to be tinkering with a computer, ME was a fragile environment.

Windows XP

By about 2008 this machine was too slow to take on the new games in the market. The only purpose of the computer being gaming for me. It had served family members well and was now too slow for me. In 2008 we changed the CPU of the computer. The new machine was still behind the market, 512 MB ram, 250GB HDD and windows XP. This was still too good to be true. A jump from 64 to 512 had me running circles around my father. For a child who wanted the computer for the purpose of gaming, it was a gift in gold.

The first game on that machine was again AoE, though quickly replaced by Duke Nukem. We had shifted to Gurgaon then and I had a new purpose for a computer. Music. The medium of exchange was pen drives but I still only knew about floppy disks. Things changed quickly when Visual basic was introduced to us in class 8. It was VB6 and quiet an amazing thing. It was an entirely new world for me. The best part was that I had asked my teacher if I could do this stuff on my home computer and she had said yes.

Programming was so much fun. I designed a school bell for my school which was sadly never put into practice. I had the good fortune of learning about serial ports and what not. That along with the fact that I was playing warcraft and Runescape on the computer was awesome. things went from good to awesome. I could tinker as much as I wanted and had absolutely no problems.

Then came the big blow. I managed to infect the computer badly enough that it did not start. This led to my first experience in installing an operating system. I bought another XP cd from a local store and sat down to install. There was a lot of jargon and having no computer to browse the Internet on it took me a full 3 days to complete the procedure. Things moved along slowly from there on.

Windows 7

In 2010 along came a laptop in the house. Matter of fact I am still using this machine which was a blessed HP dv4 Pavillion laptop. It came preinstalled with a 32-bit windows 7 home edition. Now this was an experience to be had. For a kid who had grown up on blocky UI and slow computing, the fast i3 processor and nice glossy look of windows 7 will never be forgotten.

Things were awesome for about 2 years. I played Assassin's Creed 1, 2, Brotherhood on the same laptop. Games like counter strike and Call of Duty were a regular feature on this machine. All this despite no Graphic Card.

I had become adept at installing XP by now since I had plenty of practice on the desktop. Every time a trial version of Kaspersky expired, I simply reinstalled the OS. I was now exposed enough to know that there is something called Linux in this world. I began installing windows 7/ubuntu/ windows XP for fun in school computers. Windows 7 definitely was the stepping stone for putting me back in the game. I was up to speed.

Ubuntu 12

During college, I decided to try out Ubuntu. I downloaded the iso and began the installation procedure. This was my first time installing something other than XP. Sure, I messed up. I ended u pre-formatting the entire drive and only Ubuntu on my laptop to boot.

This mistake cost me dearly. I was left with no game to play and no helping hand of Windows. I resigned to my fate and began to learn about Ubuntu. The command line was a new thing and thankfully I took to it like a duck to water. Everything was straightforward and clean. I liked it. Though I still missed the games.

After a while my interest in games waned and I began to explore the wonderful world of Linux and all other open source things. Like an explorer entering the dark continent, I learnt of the rich UNIX history, of the text-editor wars.

I learnt that the World Wide Web was not the Internet, and that Internet Relay Chat was still alive. I learnt new languages. I learnt to like Perl, Java, C and Python. Ok, I fell in love with Python. I learnt that though C was old, it was still of consequence. I learnt of the Linux world.
I messed up my computer quiet a few times, since with great power comes great responsibility. Around this time I started tinkering with AI and so Ubuntu supported me with it's amazing community and support.

Linux Mint

With simplicity came elegance. After a while though Anurag recommended Mint. A cleaner version of Ubuntu in my view. While Ubuntu is great for the person new to the Linux world, it is a little too much on the helping side. It is like the overprotective mother. Mint on the other hand is just right in my opinion. A bit of class and not too helpful. Plus all the niceness of Ubuntu is just a few keystrokes away.

What I particularly liked was the color scheme and the defaults in Mint. It was simply put, easy on the eyes. Mint was where I spent a lot of my learning time. This is the OS that was running on the laptop when I discovered git, python3, virtualenv, irssi and many more such gems.

After a while though, this too felt cumbersome. My progress in the linux world had stopped. There was nothing new to do. There were no new experiences to be had and no new areas to explore.


Along came Archlinux. One day when I still had Mint, I was chatting away on IRC and someone recommended that I go through the rute book(found here) and also that I install Linux From Scratch. As a counter to that another said that Archlinux was good from that perspective too.

The next day I was downloading Archlinux and preparing to install on my computer. The installation took 3 weeks. Turns out that Ubuntu and Mint hide away the details of how a linux box works. There was simply too much I did not know. It took me three weeks to obtain the prerequisite knowledge required to install Archlinux and to practice on virtual machines.

That said, Arhclinux is the best I have come across till date. Simplicity is the highest sophistication.


One still does miss the motherly touch of Ubuntu, and the bumbling clumsiness of Windows; but those are in the past. Hopefully I will try out BOSS linux next and see what it has to offer. Fingers crossed.

Tuesday, September 22, 2015

Understanding Websites

Understanding Websites

This article makes some gross assumptions about the Internet simply in order to
allow a reader completely unversed in the technical literature to understand
what the Internet is. That is because we can only define what we do not know
with what we know

The Internet is a phenomenon. It is the single largest network of information
in the history of the world. Now, it is highly misunderstood as the World Wide
Web. You see the WWW is simply a part of the Internet. Let us get started then.

Our topic of discussion revolves around websites.

noun: website; plural noun: websites; noun: web-site; plural noun: web-sites

    A location connected to the Internet that maintains one or more web pages.

If computers are talking what language are they talking in? Binary is the base
language for all computer communication. Think of binary as alphabets. Grossly,
if you are speaking in English, Spanish, French etc. you are using the same
alphabet. That is what computers are doing. They exchange information in

If we think of binary as alphabets, it comes to mind that how is the language
structure defined? One can associate protocols as language structure.
Iklsdfnnf lsliisejf ljdsknnbb  sldf sjdiielfm sd f jsdfieflsfjd ssaopqrjefsdfn.
Lost me for a bit there? Exactly. If computers did not know what the other
computer was saying this network would be useless. Protocols tell us that
soheimtng is not a correct word and something is. They are convention to allow
computers to convey information to each other. There are lots of protocols
which function over the Internet. Protocols like IMAP and SMTP deal with email
while those like HTTP and HTTPS deal with websites. There are others like FTP
which deal with File transfers.

Websites are information exchanges happening over HTTP or HTTPS. That said,
whenever an exchange happens there are two computers involved. A sender and a
receiver. The method of finding one computer amongst the millions connected to
the Internet is defined in the Internet Protocol(IP). The version 4 of this
protocol (IPv4) tells us that each computer has an address of the form
`xxx.xxx.xxx.xxx` where xxx is a number from 0 to 255.

However when we visit a website we never type in this number which is crucial
to finding the right computer in this haystack. We type in a readable name. The
protocol which allows you to do this is called DNS. When you type in
`google.com` you computer asks it's local DNS server to translate `google.com`
into an IP address.

When setting up a website, this DNS service is crucial otherwise your users
will be stuck typing the IP address into the address bar. This part of the
website building process is buying the domain name. This does not set up the
website for you. All it does is gives you the ability to tell everyone in the
world that `google.com` is actually (go ahead, type that into
your address bar in the browser and you will end up on google)

Buying a domain name gives you the ability to say that `desilingo.com` is
actually machine `xxx.xxx.xxx.xxx`. With that ability you can now take up the role of a server of a website. The server and client of a website are actually machines. There is not special hardware requirement. You could run a server off your laptop for all sane reasons. It is however not advised. Servers are machines which have to run nonstop for months on end(forever theoretically). They tend to be powerful machines requiring special care which the average Joe is not able to offer. Hence we go to a space hosting service.

A hosting service provides you with a computer with a set IP address. The
maintenance of the actual hardware is done by them. They offer things like ((%
uptime; meaning that out of 100 hours your website's computer will be available
99% of the time to everyone in the world. Do not be lured by someone who offers
100% uptime. They are lying. So if your website's computer is somewhere else in
the world how do you control your website? Other protocols are built for such
things. SSH is the most popular choice but others include good old HTTPS. You
control your website via a web interface. Just like you do with blogger.com or

So a website consists of a domain name and a computer to serve your website.
What you serve in a website is the famous Hyper Text Markup Language(HTML). The
most recent version at the time of writing this is HTML5. Writing an HTML
document is a trivial task once you now how to write one. In fact word
processors like Microsoft Word allow you to save documents as `html`. So how
does the world know which file to look for? If you visit the URL
`http://example.com/2015/5/15/diary_entry.html`. You are being served a file called
`diary_entry.html` in a folder called `15` which is in another folder called
`5` which is in turn within a folder called `2015`. These folders are on a
computer identified by the domain name `example.com`

Now comes the difference in static and dynamic websites. Every time you visit
`https://facebook.com` you do not see the same page. If you are not logged in
you see the registration page. If you are logged in you see the profile page.
If the URL is the same how come you are being served a different file every
time? Websites where the URL corresponds to a single file are called static
websites. Websites like Facebook are dynamic.

So in order to set up a website you need a domain name, a server, content to
serve. Some things one should look into are :

Tuesday, September 1, 2015

Ether and light

Dark ether, spread around
no light, yet dark found

some shy, some bright,
these twinklers put up a fight,
against your rage against light.

Woe on the fate of a star,
Their death not known,
for years after their war.

Along comes a demon so bright,
slaying your minions,
o ether against light.

You battle with all your might,
slowly killing this ogre of light,
fifteen days, ether vs light.

only to arise,
feeding on the pain,
of a multitude of starry demise.

This ogre shall rise,
for dark ether, spread around
there is light and so you're bound.

Sunday, August 30, 2015

PyTongue - OSFY article


Teaching programming with non-English languages

Title                     : Teaching programming with non-English languages
Author                 : Arjoonn Sharma
Target Audience  : People who teach programming at various
                               levels and general programming enthusiasts

Any program which must be run needs to be converted to a string of bits in
order to run. This has been true ever since the inception of programmable
computers. If this is the case, then all we need to do is write the proper
string of bits to make any program. Then what do programming languages do?
After all we are not writing bit-strings but are writing text based programs.
The bit-strings are all that a computer needs to run. The programming languages
exist to help us make sense of what we have written. This means that
programming in a language of our own is very much possible. All that is needed
is a method of translating the language to the appropriate bit-string. This is
where PyTongue comes in handy. It lets you teach people who do not know the
Latin script how to program.

For the purpose of teaching programming to children who do not know English I
developed PyTongue. Thus I can teach them Python without having to teach them
English first. Python3 was the choice of language as it has nice Unicode
support throughout and Python by nature has a small learning curve. After a
while people have to learn English as it is the language of the trade. This way
however I can make sure that a child who has the potential to program does not
miss out simply because of a language barrier.

PyTongue has simple logic powering it. It is a transliteration service to be
precise. It takes a program written in one language and transliterates it to
normal Python code which is in English. The new code is then executed.

To get started with PyTongue we must first install Python3 and then install
PyTongue. For this article Ubuntu 14.04 was used.

First we make sure that Python3 is installed. Next we create a directory
`pytongue_folder` and download PyTongue in it.

sudo apt-get install python3
cd ~
mkdir pytongue_folder
cd pytongue_folder
git clone https://github.com/theSage21/pytongue
cd pytongue

In case the `git` command shows an error you can download the `zip` file from
the same link and unzip it. The effect is the same. We need to have a folder
called pytongue. After that we navigate into the folder with

In order to write code in a certain language we need to get the mapping for it.
Some mappings like Hindi, Russian etc are already provided.
Mappings are obtained by running `pytongue-mapgen hi` for Hindi and
so on. The two word short forms are from

A mapping is a word-for-word translation of the basic keywords and builtins
in Python. To create a mapping we need to create a file with the required
language name and write a JSON encoded dictionary having the general structure
of :.

This creates a mapping for the requested language. While it is downloading the
language it prints out the keywords mapped. After this we begin to write a
program. For the purposes of demonstration we will first write a simple 'hello
world' program and then a simple calculator in Hindi.

To write these programs any plaintext editor will do (gedit, vim, notepad etc).
The first line of the program must always be of the format
`# `

Program1: hello.py
# HI
छाप('हैलो दुनिया')

This prints out हैलो दुनिया'

Program2: calc.py
# HI
क = पूर्णांक( इनपुट('एक संख्या दर्ज करें'))
ख = पूर्णांक( इनपुट('एक और संख्या दर्ज करें'))
कार्य = इनपुट('क्या करना है दर्ज करें (+,-,*,/) : ')
अगर कार्य == '+':
    छाप(क + ख)
अगर कार्य == '-':
    छाप(क - ख)
अगर कार्य == '*':
    छाप(क * ख)
अगर कार्य == '/':
    छाप(क / ख)

This prompts you for two numbers and then an operation to perform on them. It
prints out the result of the operation on the two numbers. The translation
created for this program is:-

a = int(input('Enter a number'))
b = int(input('Enter another number'))
op = input('Enter the operation:')
if op == '+':
    print(a + b)
if op == '-':
    print(a - b)
if op == '*':
    print(a * b)
if op == '/':
    print(a / b)

How would someone know what words to use? That is done using the created maps.
The maps are stored as JSON in the languages folder. They are thus editable by
hand. Hence if some translation seems strange to you, you can simply edit by
hand to make it more to your liking. In order to know what a particular
function is called, you simply need to open the particular language file
(`$ gedit ./languages/RU` for russian) and look up the particular
translation pair.

After writing the desired code, we need to run it. Instead of the traditional
`python3 hello.py` command we would have issued, we run the shell script called
`pytongue.sh hello.py`

That is all. We have successfully written python in Hindi. For other languages
similar procedures follow. To sum up, we need

1. Mapping of the required language
2. Source code with first line as `# `
3. Run the program with `pytongue.sh .py`

Have fun with the software and let those who may become great programmers
experience programming even without knowing the Latin script.

Wednesday, August 26, 2015


Recently I made available on PyPi, openjudge. This post is about that library.

Programming contests are popular among engineering colleges in India. Even in other colleges, wherever there happens to be a Computer Science department, a programming contest is sure to happen at least once a year.

Attending various contests in my graduation, I fell in love with them. There was no influence, no underhand tricks. Your code spoke for you. In the University of Delhi, there were contests happening left right and all across. Over the course of two years I began to like programming contests.

The cracks began to appear only once we hosted our own. Checking code was a pain. The accepted method was that contestants were asked to write code on paper for the preliminary rounds. They were simple programs and were designed to be easy to check. This was a huge bottleneck. The main rounds were held after about an hour of the preliminary rounds happening.

In the main rounds the institute provided machines and a compiler (sometimes an IDE) for an already declared language. That was a big handicap for us. We had to send teams proficient in multiple languages. This made life horrible and sometimes limited contests for us.

Then came codechef.com

This website had removed everything we had resented and gone on to produce the perfect mechanism for hosting programming contests. Using the codechef platform however required authority from the Principal and so on. I did not bother.

Being bitten by the 'roll-your-own' bug, I decided to build my own judge. Hence openjudge.

First I had to set up an interface. For that I learnt Django. Then came communication over sockets. After that the problem of multiprogramming and sub processes.

Recently I am struggling with the ability to run these programs in a sandboxed mode. It is an experience which allowed me to grow with the project.

The software now boasts of a capability of handling ~200 participants at the same time. The format we now follow is:
  • Participants get their own machines. If they don't we provide and they cannot complain.
  • No language bars. We support all major languages.
  • A single round of competition. No preliminary and finals. One big code fight
  • A leaderboard for everyone to know who is winning.
Here are a few screenshots.

Tuesday, August 18, 2015


The following is an exchange between man and God... I think. Make what sense you will out of it.

Who are you?
Beyond you.

I can ask anything?
Yes you can.

Why can I not see you?
Because you can see.

Where are you?

Forever is a term of time. I asked for location.
Time is of your making. I answer the best I can.

You are not human?
I am not.

What is the difference between you and me?

You see things in chunks. They are not. You see things. They are not.

Thursday, August 6, 2015


Some years, some days ago
I came across a girl.

Not like any I haven't seen,
a life of another kind.

The wrath of Gods,
titanic and slow to rise,
swells within, dullness dies.

This mute heart screams,
A cry of pine, in my dreams.

I yearn for her,
some years, some days now.

Thursday, July 16, 2015

Does evolution work for dominant species?


That one word explains everything about life on Earth. From the simplest of bacteria to the most complex of organisms Evolution is the one tool which has made it all.

This brings up the question does evolution still work when a species becomes the dominant one on the planet?

Dominance may be defined as when a species begins to have the largest fraction of the population of life in a given area. Humans are definitely the largest population (I am ignoring bacteria here) of multi cellular life on the planet in my opinion.

Evolution works on the thumb rule of limited resources. With limited resources, species have to contend for food. This causes them to evolve by natural selection, as in those unable to gather enough food die out as a result of having no children. This puts evolutionary pressure on the species to evolve and get better at gathering food and creating children or die out. What this means is that everything that a species does is somehow allowing it to be better at producing more children. Everything in this world results from that on drive.

Humans on the other hand are unique. They are undoubtedly the dominant species on this planet. How does evolution affect us? Does it even count? A species which becomes dominant implies that it has a method or some tool which allows it to produce a lot more children than the other species. They can actively control the population of other species and cause artificial selection within them. That is how animal husbandry began and how it works.

For a dominant intelligent species however, the number of children per individual is not dependent on the traits of the individual, unless the traits interfere in actual child creation.

Social service and community concepts work against natural selection by giving everyone an equal chance to produce an equal number of children irrespective of what makes them better. That eases the evolutionary pressure on the dominant species to evolve.

The very attribute that made them dominant now stops their evolution. Let us take another theoretical example.

Imagine a world that is inhabited by lizards, say. Now these lizards are of many different species and of many different regions. Each has evolved to be perfect in it's surroundings. Now there arises a species of lizards which goes on to become the dominant species in the planet. The dominating lizards, lets call them God for lack of a better word. The dominating feature allows them to have unparalleled advantage over every other species on the planet. Let us say that they are the only lizards that can fly, walk and swim.

Now how does this pan out for Gods? Anywhere they go on the planet they dominate the local populace. This leads to them having a population explosion because they can get their food too easily. With that the evolutionary pressure is gone. They stop evolving at the same rate as the rest of the species. A sick God is still a God. A handicapped God is still a God. Hence a God will always have more children than a normal lizard.

So what might happen next? Evolution is still in play but it is in slow motion for the Gods. They do not evolve until they are forced to do so by competing lizards (Titans lets say). Thus if a titan species does not come along, Gods will be stuck where they are. If the titan species does come along, natural selection will proceed at the normal pace.

This might be thought of as a local maxima. Thankfully due to the nature of evolution, The population of lizards will not get stuck there. There will be change, and it might be drastic. The dinosaurs were the dominant species on the planet for quiet some time. Presumably they were wiped out by an asteroid impact. The next best species, humans, which were Titans came out unscathed. The dinosaurs might be thought of as a local maxima. Evolution overcame that and created humans which can read blogs like this one.

All in all evolution may be slowed down for dominant species until one of the other species can compete with them, but it never really stops. Have other theories? Comment.

Tuesday, July 7, 2015


For this next bit play along with me. I propose a few trips in the world of imagination you can muster.

Imagine a world where the ground is a mirror. You have only one sense, the sense of sight. You cannot touch, hear, taste or feel heat etc. All you can do is see. In such a world everything will appear dual. One above the 'ground' and one below. The question then arises, how would you distinguish image from object? How would you decide what is real?

Is the sun above or the one below real? Are you an image or the one below you? How would you know that the other guy does not have thoughts and feelings? If at all how do you decide that you are in control and not merely the reflection of whatever the other guy does?

I think in such a world one cannot distinguish what is real and what is not. Thoughts are welcome in the comments.

Friday, July 3, 2015

Hollow storms

Over a hundred years have stood witness to the men and women who enter this institution and leave with something not explained by words. That something makes them special in this world. They can see what is not seen by many, do what most are ashamed to do and when needed plunge themselves into service with all that they can muster.

This institution stands on something solid, on a bond which surpasses any seen today. My college stands on the foundation of family. That very bond which made the Godfather powerful and gave rise to the Rothschild name makes this college special. As all families we have a head in the Principal, elders in our Professors and siblings in our friends. All said and done we know each other inside out and stand by each other in the face of adversity.

Over the past year my college has been in the eye of a storm of media coverage. Trust me when I say that this storm is of malicious making.Three years I spent in the college. I am the kind of person who attended college on Sundays and from 0600 to 1700 hrs. Most of this time was spent in classes but some was spent with family. Eating, playing, discussing and in general simply enjoying the security of this house. I know just about everyone in college and can say that a lot of people are more than just the casual acquaintance.

It is my general practice to avoid popular news channels. This stems from my experience of seeing them running after headlines and providing very little news about what actually matters. Imagine my surprise when I saw the slandering articles against my Principal in the newspaper on one of my visits to the library. The man I had recently written a thankful letter to, was shown to be a complete fraud. Like I had been taught in college, I tried to verify these facts for myself before reading further. The facts came out fine but during the digging came up other things. The other things which gave solidity of character and intent to my Principal were suspiciously left out of the articles and news coverage. I became suspicious of the news papers.

Next came the all famous magazine string of articles in the newspapers. The Principal was under attack once again. I was in the middle of my studies and so like most of my friends discussed the matter as a side issue. The matter was settled and the media simply did not lose a chance to gather up and throw muck into the college name. It did not matter to us as we were inside the college and knew it better than most reporters who came to college, talked to a few people and the next morn had their respective papers claiming that St. Stephen's had been 'rocked' by some thing or another.

When I was a child I used to think of a newspaper as a medium of truth. Now I understand that the truth is different for a lot of people. Hence opinions may differ. What I completely refuse to accept is that in a population like India, with as many newspapers as hair on my head, I have not heard of one newspaper which favors my college. Nothing else is needed to know that something aligns these papers together against my college. What that might be I do not know. What I will do is believe in what I have seen with my eyes and heard with my ears.

I choose to believe in my Principal, in my college and in the family that accepted me and which is seconded by none other than my blood relatives. I choose to believe that the media is a headline churning economic monster which has chosen to attack my college simply because of the name it bears. A decision soaked in monetary gain or some other cold reason along the same lines. Like street hooligans wanting to gain fame by challenging a champion the news tries to break the spirit of my college. Like the champion we shall respond, not by accepting the challenge, but by politely asking them to work their way up the ranks before they challenge us.

This college gave me my life. It gave me purpose and for that I shall defend it to the last breath in my body.

Tuesday, June 30, 2015

Jokes and a twisted nation.

Any civilization in the world is bound to have it's own jokes. The element of laughter is present in all forms of human life. Unknowingly however, jokes give up a lot about how the society itself thinks. Is it a free society or is it not? Many such questions can be answered simply by looking at the jokes we tell each other.

A joke makes us laugh simply because of the punch line. The punch is something we do not expect. It is not something which happens a lot and hence makes us laugh. The nature of laughter itself is for another article and so we will abstain from it here. On giving some thought to it, do jokes also imbibe in children certain traits specific to the society they grow up in? Let us have a look.

A google search for "top 100 indian jokes" returns some websites. A casual look is enough to show a few things. Some of the jokes I want to use to illustrate my point are:
A teacher asked her class for sentences using the word "beans"..
My Father grows beans," said one student. "My father cooks beans," said
Then little Johnny spoke up: "We are all human beans."
This shows that one would not expect the use of the word 'beans' in 'human beings'. Thus the punch which gets us cracking. The more unexpected the punch, the harder we laugh.

As a old man was driving down the freeway, his car phone rang.
Answering, he heard his wife's voice urgently warning him,
"Herman, I just heard on the news that there's a car going the wrong way on Route 280. Please  be careful!"
"It's not just one car," said Herman, "It's hundreds of them!"
This popular one gets us cracking the first time and consequently loses it's mirth.

What we miss however is that a lot of the jokes we tell are sexist, racist and many other things deemed unworthy of society. We overlook them in jokes as they appear harmless.

A lot of Indian jokes involve sardars. A lot of English jokes involve blonds. Both based on the crux that the sardars and blonds have less than average intelligence. This may seem harmless enough but when repeated in front of a child in formative years, it embeds into them the idea that some people are less intelligent than most.

Then comes the racist side of jokes.
Father's day, the most confusing day in the ghetto.
What might be funny to us as grown adults, with our preconceptions already wired into us, might be instructive for a child. As there is no way of insulating children from the mirth of society, we must ask, do we really want our children growing up with the same preconceptions we have now? Do we really want them to make the same mistakes?

Jokes might lighten us but joking around in front of a child is a serious responsibility. They are powerful tools of social regimentation.
1. top 100 indian jokes
- http://binscorner.com/pages/a/all-time-best-50-jokes.html
- http://believenext.blogspot.in/2012/05/best-joke-ever-top-50-hindi.html
- http://top10wala.in/top-10-hindi-jokes-ever/
- http://best100sms.blogspot.in/2010/02/best-100-hindi-sms-jokes-to-send-to.html

2. top 100 jokes
- http://www.jokes-best.com/
- http://www.mirror.co.uk/news/uk-news/top-100-jokes-edinburgh-fringe-4075470
- http://www.telegraph.co.uk/culture/culturepicturegalleries/11034196/funny-jokes.html
- http://shortestjokes.blogspot.in/2013/03/top-100-funny-jokes.html

Monday, June 8, 2015

My post on HN frontpage

Ever since I have started logging on to HN I have loved it. The people are beautiful.

Finally one of my posts is on the front page!! Yay!
I just felt like putting this here.

Tuesday, June 2, 2015

Listening to paintings

Is beauty dependent on the medium which transmits it? Is a beautiful painting itself beautiful or is it the representation of something which is beautiful? These questions come to mind often when seeing "A thing of beauty".

If one assumes that beauty is in itself an independent thing then one can assume that beautiful things may be translated from one medium to another. Can my visually impaired friends one day see a beautiful painting and understand it?

Introducing audio sight.A piece of software which I wrote to let people without sight experience paintings. A painting goes in one end and an mp3 file comes out the other. How cool is that? The idea was to translate beauty from one medium to another. In a minute we see how that is done but first we have a look at some samples.

That was Vincent Van Gogh's Starry Night converted to sound. It made some sort of sense, although if you look at the things I had obtained in earlier versions of the software you would be very surprised.

Now for the method.

A simple enough task, given that the picture is already digitized. First we re size the picture to smaller dimensions in order to have some sort of melody going on.

After that we start taking one column at a time from the left side. Each pixel in the column dictates what note to play and how long to play it.

With that as we proceed from left to right, we obtain a melodious sounding audio file, which is dictated by the painting and not just something random.

Is beauty dependent on the medium?

The audio did not sound very melodious to me even though I am no art fan and so I conclude that the beauty of a painting lies in the beholder of the painting itself.

Wednesday, May 27, 2015

How good is our education system?

--edit-- Since I read about the central limit theorem in a deeper fashion after publishing I have realized that the bell curve is not demanded by statistical laws. This is because exam results are strongly influenced by factors like the amount of effort students put in. The bell curve is still desirable since it allows us to evenly distribute people. -- edit -- 

Exactly how good is our education system? Touted to be a very good one and supported by a few shining gems, what exactly does the data say about the education system?

During the course of this article you will find some pleasant but unexpected things and some expected ones. About the absolutely shocking I cannot make a promise.

First up is my home state Rajasthan. The Rajasthan Board of Secondary Education has been put under the microscope. The choice was simple, this examination board did not ask for anything other than a roll number to get the results of students. Fair enough. I obliged and wrote a Python script to automatically get as many results as possible. After about 30,000 records my Internet connection was ready to die, and so I stopped mining for more results for the day.

While I was processing the results of my mining, I realized that the results of the CBSE class 12 board examinations were declared. With wild glee I prayed that they too ask for nothing more than a roll number. My prayers were granted. After tinkering with the python script a little it was good to go for the CBSE website. Again I put my computer to use and started mining. After about 50,000 results my Internet connection became really slow and computer became really hot. That got my attention and I stopped mining.

Now for the data analysis part. What should I do to this data? A simple answer was to check if it was following the normal curve. What is normal curve you say? Well normal data in simple words is as follows:-
In any population, if you count the frequency of any trait, you will observe a bell like curve
Now this is a very powerful prediction with roots in solid mathematics. Any deviation from this rule implies a bias in the real world where the data was generated. With this in mind I obtained a histogram.

This is the plot for the Rajasthan Board results. The sample size was 30,000 students. Marks obtained vs frequency.

For simplicity all students who failed were simply not plotted to let us concentrate on those who have passed.

 As expected, a bell curve is observed. There are spikes at regular intervals but they can be explained by assuming that examiners will tend to give 30.5 instead of 30.49 and so on. This is excusable. 

There are some interesting things about this plot though.
  1. The peak of the bell is not at 50 as expected but at approx 54. This is indicative of a system which inherently passes students who appear for the paper.
  2. The slope for the left is steeper for the one on the right. Fewer students seem to be scoring less than the average.
Now for the elephant in the room. Yes, the mammoth spike at 60 surprised me as well. As of now I have been unable to find an explanation for that spike. It is however indicative of something really biased. Some things that caught my eye about it:
  • It is HUGE! It is higher than the peak of the curve.
  • It is ahead of the curve peak.
  • There is no other peak like it.

A spike like that indicates that the system is inherently rigged to provide most students with marks around 60. This is extremely fishy. What is the significance of this number? It is not the fail barrier. Examiners pushing people over the failing marks might have explained such a thing.

This is a skyscraper right in the middle of our marking scheme. One explanation may be that this is some grade demarcation. (this is not confirmed)
Another explanation may be that the sample size was too small. This is less likely as 30k samples for an entire state are enough in my opinion.

 We will talk of this later as I have a conspiracy theory to cook. As soon as the CBSE sample size is noteworthy (arround 1 lakh students) I will plot it's histogram and update this article. Stay tuned.

-- Update -- 1
It seems someone already did this on Quora  for ICSE. Will continue to do for CBSE and pray I have enough data before he does.

-- Update -- 2
After a grueling evening consisting of snail paced mining of results, I turn to Twisted and asyncio. With that I rewrite the code again and behold, the program is faster than The Flash. After a while I get bored and cannot wait to see the plots so I stop. End result, 42294 usable student records obtained.

Maybe someone with more time and better resources can conduct a better analysis.

There is plenty of data now and I have plotted the results. They are at best troubling. Have a look. The data is available here.

Some subjects have a low sample size and you should keep that in mind while looking at the graphs. Some however have a large sample size and still show some very "creative trends".

Things to note:
  • CBSE seems to have the policy, "When in doubt give 95"
  • The overall trend is to pass students.
I believe that examinations are a means of distributing students across marks in order to make it easier to judge them.
100 is considered good only because a small number of students should be able to get it.
 In such a model a bell curve is the best things that could happen. This curve makes us realize that a lot of people are just average. The best and worst are rare cases. To evaluate a person you ask their marks and can judge how many such people are about. 
All of this goes out of the window if the normal distribution is removed from the picture. You no longer have any idea of how good the student is. All you know is that they have obtained such and such marks. The marks themselves have no meaning.All that is left is an empty number.

The current battle of high cutoffs in colleges is entirely due to the non normal distribution of marks if this data is to be believed. Since everyone is in the 95 bracket, the cutoff needs to be higher. A normal distribution ensures that everyone is judged properly and cutoff are reasonable.

Then again I might be rambling, and my sample size is definitely small. (Maybe someone with more experience in stats can help?) The Internet connection is  simply too slow to support such high usage of services.

Until there is someone willing to support this study, this is the best I can manage.
So go ahead and have a look at the graphs and enjoy. There were some subjects I did not know existed( no really, I swear).

Thursday, May 21, 2015

Trai and their blunders

Once TRAI had published the list of emails(read about it here)  it had received along with the addresses I was very skeptic of what measures would be taken to correct this blunder and how effective they would be.

After a little time TRAI decided that in order to discourage Spam bots from using the list as a source, they must do something. A decision with it's heart in the right place. Then came the blow to my intelligence.

The measures TRAI undertook was to replace @ with ( at ) and "." with (dot) in every email.
This was unexpected. If you have ever typed into GMail any address and performed the same replacements you would notice that it does not matter if you use @ or (at).

Another thing of note. I expected it to be relatively easy to extract the emails from the website and compile a list of them. Thus I sat down with my friend's 2G Internet connection on Aircel and began to download the web pages containing the emails. There were 18 we pages of note which contained the emails.

With this in mind, I fired up Vim (text editor) and began to type out a python script which would do the extraction for me. An easy enough job and after letting it run for 192.55 seconds (I timed it) I had a list of 8,90,537 emails. Not quiet the 1 million as claimed but substantially close.

All in all the efforts TRAI made to keep our data private was commendable even though it only took a student with a slow Internet connection and a little knowledge of Python to extract the emails.

As expected my email was also within the ones found.

Thursday, May 14, 2015

Programming in multiple languages.

English is a language that has been the language of progress for a long time. A lot of the best things in the world have come forth from English speakers.

For people who do not natively speak English, programming is a thing which is subject to first learning the language of the world. For a lot of people that is a big step and not always such an easy one if their native language has a different structure along with a different script.

PyTongue to the rescue!! This little piece of code makes writing programs in your native language a lot easier by providing transcription services for python. Sadly the entire ecosystem of python is not supported but on the bright side people can understand the code being written.

For example:-
# HI
छाप('नमस्ते दुनिया!')
के_लिए i में range(10):
जब सच:
    छाप('नमस्ते दुनिया!')
This is code written in Hindi and produces completely understandable results. The second last line evaluates to While True: and so produces an infinite loop (there is no running from those things even in a perfect world.)

For proof of concept I tried out Arabic and Hindi programs and they ran flawlessly on my computer. Although I have pretty much no idea what the Arabic program says, I am sure it makes sense.

Since I know Hindi, I know that the program makes sense, although is a broken manner. This should not matter as constructs in programming languages are made up of only a handful of expressions. The loops are in a specific format and so are the conditional statements.

The downside is that since the software provides only Transliteration the generated programs still have to make sense only in the English way of sentence construction. The program in Hindi makes absolutely no sense in Hindi grammar but is still more readable than a program in English.

Also the programs need to be run; which indicates an interaction with the terminal/ OS in some manner. This itself indicates a point of failure as the OS is English supporting most of the time ( I know of no systems which have commands in other languages. So `ls` still remains `ls`). Sigh, some day I am going to make a language which is language independent. May that day dawn quickly. (I know about Lisp so do not even start. :)

Wednesday, May 13, 2015

Corruption: India's best friend

Why I can say this.

After a sequence of years unearthing scandalous corruption scams one after another, I wanted to know if India would ever be corruption free. Wishful thinking says it will and pessimism says it will not. Those two imposers are not what I put my faith in. I only believe what is backed by data. Since data is only available from the past I had nothing to work with.

With that being the start of this explorers trail, I began to look for methods which might help me satisfy my curiosity. Finally it hit me. I simply needed to simulate populations. With that idea and Python in hand I began to write code. This article is about the code, the results and the idea.

After running about 160 more simulations I discovered that in cases where the police have a pay at least twice as great as the bribe they receive, corruption does not spread to the entire society and is limited in all cases to less than 60%.

--End of Update--

The method of evaluation

First we create people who will populate the society we want to study.
We give people some characteristics
  • They are all born with "initial_money" number of coins.
  • They all have a value "stoicity" coming from the word stoic. This is a measure of how honest they are.
In case that got you thinking, we select the "stoicity" values such that if you would plot the histogram it would result in a Gaussian distribution.

In order to study behavior we must have behavior to study. Hence we add some more attributes to a person.
  • Any person may be "police".
  • Any person may be "criminal".
How does this society operate? Everyone goes about saying hi to everyone else( in a round robin tournament fashion). Whenever two people meet:-
  • One of them is policeman
    • We ask the other person if they want to bribe the policeman?
    • If he says yes we ask the policeman if he accepts?
  • Both of them are policemen
    • We randomly ask one of them if they want to bribe the other?
    • We then proceed to ask the other if they accept the bribe?
  • None of them is a policeman
    • We randomly transact a random amount of coins from one of them to the other.
    • This is to provide a statistically even distribution of people earning money.

    With these things in mind I conducted some simulations with parameters of interest. Parameters being how much to bribe, how much is the punishment of the criminal etc.

    Source code

    All the source code for this was written in Python 3.4.0 and is available on my github repository.

    Results of interest

    All graphs are fractions of population. Hence if policemen is shown at 0.8 it means 80% of the population is policing by behaviour.

    During the first simulation run I found that despite some scenarios where criminals themselves died out, corruption itself never died out. The people who were accepting and giving bribes became policemen. Overall the policemen dominated the society.

    Other simulations also provided similar results. (Most of the plots are available on my github page.)

    No matter how we reward policemen and how we punish crime, once more than 50% of the population is indulging in bribes, police or not, bribing quickly saturates in the population.

    For those interested, here are some more graphs. (I will be posting more as soon as the simulations keep on completing.)