Tuesday, December 21, 2010

Basel problem

I was thinking about the sum of the infinite series,

Sigma(1/N^2) which sums to PI^2 /6.

I heard this mentioned in the middle of a lecture and tried to solve the problem. When I didn't get any good idea, I cheated and looked at wikipedia to realise it is called Basel Problem.

It has an amazing history behind it. This is the first problem which made Euler famous.
I also his proof given in the wiki page, is elegant [but not rigorous my modern standards]. But more importantly I was amazed to know its value eluded the best of mathematicians of his day! and here was me, sitting and trying to derive the result in 10 minutes.

By the way, generalisation of this is called Riemann Zeta function, with this having value Z(2). So I guess you can think of the generalisation yourself.

Saturday, December 18, 2010

Blackberry no ring or alarm

Today my blackberry stopped ringing for calls or alarm. I looked for solution on the net as usual. One site suggested battery pull.

Sure enough when I removed the battery and replaced, it started working! Even blackberry is like windows in some cases.

Friday, November 26, 2010

ACM programming problems

ACM programming problems archive:

http://www.ntnu.edu.tw/acm/ProblemSetArchive.html

Overflow in Binary search

Overflow in Binary search:
http://googleresearch.blogspot.com/2006/06/extra-extra-read-all-about-it-nearly.html

Apparently this bug was there in Java libraries till JDK 6.0

Friday, November 5, 2010

How to increase sudo timeout in linux

If you are tired of typing sudo too many times:
http://www.go2linux.org/disable-cache-password-sudo

Same procedure for disabling can be used for increasing as well. Just add a line to /etc/sudoers file through visudo

Defaults:userName timestamp_timeout = 20

Saturday, October 30, 2010

Tomcat and default welcome page

I was trying to setup a quick website in my machine and installed tomcat and invoked it from browser as http://hostname it wasn't serving anything. Then I realised I had to add this block in web.xml

index.html
index.htm
index.jsp

browser I added it and added an index.html and it still didn't work. Then I looked at webapps folder and saw a folder ROOT and added index.html there and it started serving home page!

Screen, bash and ctrl+a

Today I was using bash and ctrl+a is very useful for going to the start of a command in bash. But it was not working in my Mac. I thouht it was a problem in Mac bindings and opened keyboard and mouse, terminal preferences etc.
When none of this could fix the issue, I realised that I was ssh'ing to my work machine and using a screen to avoid losing session when connection drops. This program uses ctrl+a as the meta key and was not passing this on to bash. So I had to use
screen -e ^xx

to change the meta key to ctrl+x and everything was fine again.

Monday, August 9, 2010

Java 1.6 on Mac

See here:
http://dhruba.name/2008/12/22/compiling-java-16-projects-using-maven-on-mac-os-x/
http://answers.yahoo.com/question/index?qid=20090415211021AAFgnYh

Saturday, February 20, 2010

one complement and twos complement in google search

It is really cool!

I was searching for 2s complement of -1 [I know how to calculate it. just to be sure!] . I just typed -1 in twos complement and it actually gave
-1 = 0xFFFFFFFF

very nice!

I searched for ones complement of -1 as well and it worked. Good work!