Sunday, 31 August 2014

Are leaks really leaks?

Yet another iPhone
I think it is time to stop using the word leak and simply say press release instead. With so many technology blogs that thrive on leaks, and with so many leaks, it is becoming glaringly obvious that either all these companies with leaks are either quite incompetent, or simply have extremely competent PR folks.

The iPhone 6 seems to hold the record, with the highest number of leaks and rumours. In fact, these days, some blogs are actually writing round-ups of all the leaks about the iPhone 6. With its release coming up in the near future, you get to read some leaked information about it every other day. I am sure this does more good than harm; there is always a buzz about the product on the Internet, and more and more people get to know about it. Thus, by the time the product is actually launched, everyone is swooning over it. If this is not unintentional, it is definitely a nice strategy.

Of course, the word leak is appealing to the readers; after all, who doesn't like to know a secret? Therefore, most technology blogs won't hesitate to use it. It is really a win-win-win situation; the readers get their spicy news, the blogs get their views, and the product gets some free advertising.

This is all good and acceptable if leaks are rare, and the leaked information is meaningful. When there are too many of them, the word leak loses its charm and importance. Readers won't care much. One must also realize that a blurry photo or two can arouse interest only once in a while.

Wednesday, 14 May 2014

The typical American programmer

Typical American symbolism
The other day a young friend asked me what programming language she should learn, to get a high paying job as soon as possible. I asked her to concentrate on data-structures, algorithms and problem-solving skills in general, instead of focussing on learning one programming language.

But the question still seemed important. I wanted to know what the typical American programmer programs in? How much does she earn? Where is the best place for her to live in?

So, I did my own little 'research' using Google and other websites. Here is what I found. Note that all this data is based the past 12 months (May 2013 to May 2014).

I am focussing on 5 very popular programming languages: Java, Python, Ruby, C# and PHP.

I am also focussing on the following 5 states: Florida, North Carolina, California, New York and Maryland.

1. What is the most preferred programming language?
American interest in programming languages
So, that is what Americans want to learn. Java is clearly the winner here, followed rather closely by Python. All the other languages are far behind them. I am sure one of the main reasons for this is Android. You can't be an Android developer without knowing Java. Moreover, a lot of enterprise systems are still written in JEE. However, a lot of developers from third world countries are Java programmers, and they sure are cheap, so I am assuming the salary of a typical Java programmer won't be very high. We will know if that is actually the case next.

2. What is the average salary of programmers in these languages in the US?

The salaries shown here are the national averages, for that exact designation. So, seniors and associate programmers are bound to get higher or lower salaries. As expected Java developers are paid the least. Now, I am talking about just Java developers (not Android or JEE specialists.) Python and C# seem to be the languages to learn, if you are interested in high salaries.

3. What is the average salary of programmers in these locations?

Here, I am considering the average salary of a "Web Developer". This designation is likely to include most of the languages that I mentioned. So, Florida is the state with the lowest salary, and New York is the one with the highest. This is expected, based on the cost of living in those states.

Based on these, I have come to the conclusion that my young friend should learn Python, and move to New York. The chances of her finding a good job seem to be the best there. But hey, we all should only do what we are interested in doing, and live only where we want to live! So these were merely suggestions.

But I had more questions. What are the salaries in other countries like, compared to the US. Surprisingly, much of the world earns far less than what Americans earn. Here is what I found.
Very interesting indeed. But what are the salaries like in the third world countries, you ask?
Note that those are the yearly salaries of people there. It is more than obvious why companies prefer to outsource projects now.

I have gathered all data from online sources only, so you can always look it up. Some numbers have been rounded off to the nearest 100. That is all for now. Please do leave comments and share.

Tuesday, 13 May 2014

Quick Tip: How to find your public IP address using Python

To know your internal IP address is simple. Just type out ifconfig in the terminal, and you get it.

However, that is not the IP that is visible to external websites. Yes, in the browser, you can simply type "my ip" on Google, and Google will show it for you.

But what if you want to know that public IP address in a script? This tutorial will show you how to do that.

There are a lot of websites that have a JSON-based API that can return your public IP address, and other such information. One such website is

So, if you visit, you will get your public IP address, like this,
  "origin": ""
Now that we know how to get the public IP address, we just need to write a script that can connect to this website, and parse the JSON that it returns. Let us use python for this.
from json import loads
from urllib2 import urlopen

# This line will connect to the website, read its contents
# and parse the JSON output
data = loads(urlopen("").read())
print "The public IP is : %s" % data["origin"]
The output will look like,
The public IP is :
That is all. This is useful if you are using a proxy, and want to confirm that your public IP address is actually different. Note that if the proxy you are using is not truly anonymous, you will get two or more IP addresses, one of which will be yours, and one that belongs to the proxy server.
Hope you liked this quick tip. Please comment and share.