A few days ago I found someone asking an interview questions on mitbbs. The question is as follows. A gambler plays a fair game and bet 1 dollar each time. If he lose all his money, the game stops. Suppose he has 10 dollars and is only allowed to play …
The Power of Generating Functions
Generating functions is a very powerful way to find closed formula for sequences defined iteratively. I was so bored during the final week, so I went on internet for fun. Finally I found someone from Sydney University was asking for help on this question:
(a) If Ln=Ln-1+Ln-2 for …
Working with Class in C++
Illustrative examples for the following discussions can be found here.
-
It is suggested that you also provide a default constructor if you ever provide a user-defined constructor when writing a C++ class.
-
If you want to allow deleting a derived class from a pointer of the base class, you have …
Find Out Proxy in Use
-
Using a Web Service.
-
Open http://wpad/wpad.dat.
-
Figure the proxy out from the contents it returns.
-
-
Use the command
netstat
. This is a universal way and is especially helpful when http://wpad/wpad.dat is not available.-
Inspect the output of
netstat -an | egrep "EST|Proto"
("EST" is …
-
Generating YYYYMM Formatted Dates Using Python
import monthdelta as md
import datetime as dt
import math as math
def quarter(month):
return int(math.ceil(month/3.0))
#end def
d0 = md.date.today()
dates = [d0 + md.monthdelta(i) for i in range(1, 20)]
yyyymms = [d.year*100 + d.month for d in dates]
yymms …
Don't Do Statistics If You Don't Really Undestand It
Lies, damned lies, and statistics.
As a statistician I'm very glad to see that statistics is being widely used in many areas. However, time after time I found that it is really dangerous for people who don't really understand statistics to use it. As we all know that there are …