Friday, 20 November 2015

Prostitution is legal in INDIA. Yes it is.

Prostitution is Legal in India.

Most people in India don't know that (contrary to popular belief) prostitution is legal in India.
Yes, you read that right.

In fact India happens to be one of the few countries where it is legal.
Now, here is the 'but' that you were waiting for.
There is a clause to this law. Prostitution is legal but pimping is not. So, exchange of sexual services for money is not a crime in India, But pimping or owning/running a brothel are crimes. Serious crimes in fact.
This is why India has prostitution but is not regulated.






Here, the countries marked in blue are the countries where prostitution is legal but pimping is not.
The countries in green are the one where prostitution is legal and is regulated.
The ones in red are those where prostitution is illegal.

Ramanujan magic square


















How do computers work the way they do? When does electricity become executable logic and how?

 Let us start right from the bottom:
  • Matter is composed of atoms (we can go smaller than this but this should be enough for this question)
  • Atoms have electrons and flow of these electrons is defined as electricity
  • Now, to make use of these electrons, we create transistors which can store/free electricity as needed. They are stored in units of 1 (5Volts) and 0 (0 Volts)
  • An 8-bit number is then represented with 8 transistors. So 8-bit representation of the number 3 will be : 0000 0011. How is that achieved in hardware? Keep 8 transistors side-by-side (called registers and memory units). Make the first 6 transistors hold 0V and the next 2 transistors hold 5V
  • Now, an organization of such registers and memory makes a cpu+ram
  • To make it easy to compute using the CPU, we developed machine code. This language is what essentially runs on the CPU. What do I mean by "run"? It means, keep flipping bits. If I want to perform 2+3, in machine, I would store 2 in one register (register explained above) and 3 in another register. Then I would take these values to an Adder unit which would do a mathematical add (not the same as voltage addition) and give me the reply in another register. This is what a sample machine code would look like:


80 02 F3
80 03 F4
88 F3 F4 F5

Obviously, no one understood anything with this. So we came up with an ingenuous system to make it human readable. This is called assembly language. The following piece of code represents the above mentioned numbers:

MOVI 2, REG A
MOVI 3, REG B
ADD REG A, REG B, REG C (add A and B and store in C)

where MOVI = 80
REG A = F3
REG B = F4
REG C = F5
ADD = 88


Voila, our first coding language :)


  • Now, assembly is too hard for humans to remember and code properly in. So they developed compilers that would convert a high level language like C to assembly language (remember, this assembly language does the actual flipping of bits)


So, a C representation of the above mentioned assembly would be:
{
int a = 2; b = 3;
c = a+b;
}


  • Just like people could write poems with English and not with hand signs, we realized that with an expressive language, people could write some better programs. Then compile it to assembly. Then that would flip bits in registers. Which in turn would affect transistors, which affect flow of electrons
  • With the above found expressiveness, we wrote operating systems to maximize hardware usage, since it was seen that the CPU remained idle while we fetched data from disk
  • Everything from your keyboard input to mouse to desktop to windows to sound is a program written in such expressive languages, running on top of the OS
  • On the OS, we developed a network stack called TCP/IP. This stack provided a standardized methodology for computers to communicate with each other
  • Once that was working and we managed to hook computers to each other using cables, we went on to create WWW and http. This allowed people from different networks to communicate with each other. Note that http is a protocol. Servers and Clients are programs that follow (at least) http in addition to internal protocols.


Let's walk the other way, from software to electrons now


  • When you type Google in the browser and hit Enter key, an http request is sent from your browser (the client) to Google (server)
  • In your own computer, the browser is a program written in C/C++
  • This gets compiled to assembly (actually browser is already compiled, you're just giving input numbers to the compiled browser)
  • The operating system (windows/linux etc) and device drivers are all already compiled to assembly and are running on your machine
  • When the browser assembly gets it's turn to run on the CPU, it runs the assembly
  • This assembly code does flipping of bits in registers and memory
  • The registers and memory are composed of transistors
  • Transistors control the flow of electrons and hence electricity.
Computers are man-made miracles of the highest order. No single person could have thought of all this. It has taken more than 50 years and millions of smart people to get to this point. Most computer programmers and professionals I've talked to, have an incomplete picture of what a computer actually is and (as you put it) how does electricity get converted to software.

Tuesday, 10 November 2015

What was the IQ of Shakuntala Devi, The Human Calculator?



While Shakuntala Devi could multiply two 13 digit numbers just under 28 seconds and tell the eighth root of a 14-digit number in less than 10 seconds, everytime, correctly, she could not recite the numbers given to her in the IQ test in reverse order and could only utter 4 digits before stumbling! [1] She was labelled as "average".

And she once calculated 23rd root of a 201-digit number in 50 seconds which was later verified by writing a special program on Univac 1101 at the US Bureau of Standards. [2]

At the University of Rome one of her answers to the problems was found to be wrong by the calculating machine, but after re-checking it was found that the machine had made the mistake and not Shakuntala.

Oh and meanwhile I just came to know I have an IQ of 130! [3] I beat "The Human Calculator" :D
IQ is for fun and doesn't correspond to intellect as much as you'd think :)

Wednesday, 4 November 2015

Few reasons to call Sachin Tendulkar as God of Cricket.



Let us see if he is god of cricket, what do you say?

Highest number of Runs scored in Tests [15,921]

Highest number of Runs scored in ODIs [18,426]

Highest number of Runs scored in International Matches [34,357]

Highest number of Runs scored in World Cups [2,278]

Highest number of Runs scored in a single World Cup [673]

Highest number of Runs scored in Tournament Finals [1851]

Highest number of 100’s scored in Tests [51]

Highest number of 100’s scored in ODIs [49]

Highest number of 100’s scored in International Matches [100]

Highest number of 100’s scored in World Cups [6]

Highest number of 100’s scored in Tournament Finals [6]

Highest number of consecutive 100’s scored in Tournament Finals[4]

Highest number of consecutive 50’s scored in Tournament Finals [4]

Highest number of 50’s scored in Tests [68]

Highest number of 50’s scored in ODIs [96]

Highest number of 50’s scored in International Matches [164]

Highest number of 50’s scored in World Cups [15]

Highest number of 50’s scored in a single World Cup [6]

Highest number of 50+ scores in Tests [119]

Highest number of 50+ scores in ODIs [144]

Highest number of 50+ scores in International Matches [263]

Highest number of 50+ scores in World Cups [21]

Highest number of 50+ scores in a single World Cup [7]

Highest number of 50+ scores in Tournament Finals [16]

Highest number of Man of the Match Awards in ODIs [62]

Highest number of Man of the Match Awards in World Cups [9]

Highest number of Man of the Match Awards in Tournament Finals [8]

Man of the Series of World Cup 2003

Highest number of Man of the Series Awards in ODIs [15]

Highest number of 150+ scores in Tests [20]

Highest number of 150+ scores in ODIs [5]

Highest number of 150+ scores in International Matches [25]

First man to score a 200 in ODIs

First and only man to play 6 World Cups [1992-2011]

First and only man to score 50 Test 100’s

First man to score 50 International 100’s

First and only man to score 75 International 100’s

First and only man to score 25 International 150+ scores

First man to score 100 50+ ODI scores

First man to score 100 50+ Test scores

First man to score 200 International 50+ scores

First man to score 250 International 50+ scores

First man to score 25,000 runs in International Matches

First and only man to score 2000 runs in World Cups

Highest number of 100’s scored in a Calendar year in ODIs [9 in 1998]

Highest number of 50’s scored in a Calendar year in ODIs [13 in 2007]

Highest number of 100’s scored in a Calendar year in International Matches [12 in 1998]

Highest number of Runs scored in a Calendar year in ODIs [1894 in 1998]

First man to score 2500 International Runs in a Calendar year in International Matches

7 Times 1000 Runs in a Calendar year in ODIs [1998-1894; 1996-1611; 2007-1425;2000-1328;2003-1141; 1994-1089; 1997-1011]

6 Times 1000 Runs in a Calendar year in Tests [2010-1562; 2002-1392; 1999-1088;2008-1063;2001-1003; 1997-1000]

450+ runs in a single World Cup on 3 occasions [1996-523; 2003-673; 2011-482]

First and only man to score 30,000+International Runs & take 200+ International Wickets

Highest number of 100’s scored against one team in ODIs [9 vs Australia]

Highest number of Partnership Runs scored in ODIs [8227 with S Ganguly]

Highest number of Partnership Runs scored in International Matches [12,400 with S Ganguly]

Highest number of Opening Partnership Runs in ODIs [6609 with

S Ganguly]

Highest number of Century Partnerships in Tests [20 with R Dravid]

Highest number of Century Partnerships in ODIs [26 with S Ganguly]

Highest number of Century Partnerships in International Matches [38 with S Ganguly]

Highest number of Century Opening Partnerships in ODIs [21 with S Ganguly]

Highest 3rd wicket Partnership in ODIs [237*runs with R Dravid]

Highest number of boundaries hitting Tests [2016]

Highest number of boundaries hitting ODIs [2044]

Highest number of boundaries hitting in Combined Test, ODI and T20 matches [4076]

Highest number of Tests played in a Career [200]

Highest number of ODIs played in a Career [463]

Longest ODI career [23 years]

He is the only player to defend less than 6 runs in ODI twice.

Highest number of consecutive matches played for a team in ODIs[185]

Highest number of 90’s scored in Tests [10]

Highest number of 90’s scored in ODIs [18]

Fastest 10,000 runs in Tests [195 Inns]

Fastest 10,000 runs in ODIs [259 Inns]

Fastest 11,000 runs in ODIs [276 Inns]

Fastest 12,000 runs in Tests [247 Inns]

Fastest 12,000 runs in ODIs [300 Inns]

Fastest 13,000 runs in Tests [266 Inns]

Fastest 13,000 runs in ODIs [321 Inns]

Fastest 14,000 runs in Tests [279 Inns]

Fastest 14,000 runs in ODIs [350 Inns]

Fastest 15,000 runs in Tests [300 Inns]

Fastest 15,000 runs in ODIs [377 Inns]

Fastest 16,000 runs in ODIs [399 Inns]

Fastest 17,000 runs in ODIs [424 Inns]

Fastest 18,000 runs in ODIs [440 Inns]

First man to reach 10,000 runs in ODIs

First man to reach 12,000 runs in Tests

First man to reach 12,000 runs in ODIs

First man to reach 13,000 runs in Tests

First man to reach 13,000 runs in ODIs

First and only man to reach 14,000 runs in Tests

First man to reach 14,000 runs in ODIs

First and only man to reach 15,000 runs in Tests

First and only man to reach 15,000 runs in ODIs

First and only man to reach 16,000 runs in ODIs

First and only man to reach 17,000 runs in ODIs

First and only man to reach 18,000 runs in ODIs

Youngest player to score a Test Century for India [17 yrs]

Youngest player to represent India in ODIs [16 yrs]

Youngest player to captain India in ODIs [23 yrs]

Youngest player to represent India in Tests [16 yrs]

Highest number of 200’s for Indian Tests [6]

Highest number of 200’s for Indian

International Matches [7]

Best All-rounder performance for India in ODIs

[141 & 4/38 vs Australia]

119* vs England

148* vs Australia

114 vs Australia

111 vs South Africa

165 vs England

104* vs Sri Lanka

142 vs Sri Lanka

110 vs Australia

115 vs New Zealand

105 vs West Indies

179 vs West Indies

112* vs Sri Lanka

127* vs Kenya

137 vs Sri Lanka

100 vs Pakistan

118 vs Pakistan

122 vs England

177 vs England

110 vs Sri Lanka

114 vs South Africa

169 vs South Africa

104 vs Zimbawe

117 vs New Zealand

143 vs Sri Lanka

139 vs Sri Lanka

148 vs Sri Lanka

155* vs Australia

177 vs Australia

100 vs Australia

143 vs Australia

134 vs Australia

100* vs Kenya

128 vs Sri Lanka

127* vs Zimbawe

141 vs Australia

118* vs Zimbawe

124* vs Zimbawe

113 vs New Zealand

136 vs Pakistan

124* vs Sri Lanka

140* vs Kenya

120 vs Sri Lanka

126* vs New Zealand

217 vs New Zealand

186* vs New Zealand

116 vs Australia

122 vs South Africa

101 vs Sri Lanka

122 vs Zimbawe

201* vs Zimbawe

146 vs Zimbawe

126 vs Australia

139 vs Australia

122* vs West Indies

101 vs South Africa

146 vs Kenya

155 vs South Africa

103 vs England

176 vs Zimbawe

117 vs West Indies

105* vs England

113 vs Sri Lanka

193 vs England

176 vs West Indies

152 vs Namibia

100 vs Australia

102 vs New Zealand

241* vs Australia

141 vs Pakistan

194* vs Pakistan

248* vs Bangladesh

123 vs Pakistan

109 vs Sri Lanka

100 vs Pakistan

141* vs West Indies

100* vs West Indies

101 vs Bangladesh

122* vs Bangladesh

154* vs Australia

153 vs Australia

117 vs Australia

109 vs Australia

103* vs England

163* vs New Zealand

160 vs New Zealand

138 vs Sri Lanka

175 vs Australia

100* vs Sri Lanka

105* vs Bangladesh

143 vs Bangladesh

100 vs South Africa

106 vs South Africa

200* vs South Africa

203 vs South Africa

214 vs Australia

111* vs South Africa

146 vs South Africa

120 vs England

111 vs South Africa

114 vs Bangladesh


This is why he is named as God Of Cricket. Happy?

Some records will be broken :'(

Why is mathematical constant pi so unique ?


  • William Jones is the person, who introduced the symbol of Pi in the year 1706. But it was Leonhard Euler who popularized it in 1737.
  • Pi has about 6.4 billion known digits which would take a person roughly 133 years to recite without stopping.
  •  The world record holder for the most memorized digits of Pi took nine hours to recite over 44,000 digits of Pi.
  • Some scientists use the fractions 22/7, 355/113  and 104348/33215 to approximate Pi. These fractions have an error of only 0.04025%, 0.00000849% and 0.00000001056% respectively. 
  •  The Babylonians, who found the first known value of Pi, used the fraction 25/8. Although Pi can be approximated by a fraction, it cannot be expressed as a fraction because it is an irrational number. In other words, Pi’s digits go on randomly for infinite.
  • It is impossible to 'square the circle'. In other words, you can't draw a square with the same area as a circle using standard straight-edge and compass construction in a finite number of steps. The Greeks were obsessed with trying to do this. A long time ago people thought there was an illness attached to trying to 'square a cirle' called Morbus Cyclometricus.
  • If one were to find the circumference of a circle the size of the known universe, requiring that the circumference be accurate to within the radius of one proton, only 39 decimal places of Pi would be necessary.
  • At position 763 there are six nines in a row. This is known as the Feynman Point.
  • Pi day is celebrated on March 14 at the Exploratorium in San Francisco (March 14 is 3/14) at 1:59 PST which is 3.14159. Pi Approximation Day is on the 22/7 - that is, July 22. For the past few years, people at Chalmers University have celebrated it.
  • There are people who believe that Pi contains the answer to the universe, or that information is held in the digits. It has even been suggested it contains the VOICE OF GOD. In Carl Sagan's book 'Contact' the places of Pi are found to contain a message from the beings that built the universe.
  • With the help of Hitachi SR 8000, a powerful computer, a Japanese scientist found 1.24 trillion digits of Pi, breaking all the previous records.
  • There are no zeros in the first 31 digits of Pi.
  • First six digits of Pi appear in order at least six times among the first ten million decimals of Pi.

How to create file server using python

We can use a simple python command to create our own server.

Install python : Welcome to Python.org

Open your console. (Terminal in Linux/Mac OSX and cmd in Windows).
Type the following:
python -m SimpleHTTPServer.

For python 3.0 and above : 

python -m http.server 7000


That's it! You have created your own file server. You can now access the files on this machine from other machines over the internet!





You can access the files on this server through your web browser. Just type the following:


http:// [ip-address-of-server]:8000








This will list all the files in the server, and you can browse and download any permitted files just like you do on a normal website.

To find the IP address, I have another section here.

2. How to find your own IP address:

i ) For Windows:

Type:
(windows key + r)
and press [enter].
Type
ipconfig




3. The IPv4 Address section is your required IP.

ii) For Linux/Mac OS X:

Open the terminal, type:

ifconfig