Friday, April 14, 2006

Notes on using GnuPG

1. generate key-pair of yourself using
gpg --gen-key

2. Download desired file and its signature. The signature is supposed from person Joe
The desired file: abc.tar.gz
Its signature: abc.tar.gz.sig

3. Obtain the public key of Joe using
gpg --import KEY-FILE
or
gpg --keyserver pgpkeys.mit.edu --recv-key KEY-ID

Here KEY-FILE is the name of the file for the public key of Joe. This file needs to be obtained from Joe or other trusted source.
KEY-ID is the id of the public key of Joe. It should be obtained from Joe or other trusted source.

4. Verify that the signature using is signed using the public key
gpg --verify abc.tar.gz.sig

5. Make sure the key actually belongs to Joe by confirming the key fingerprint of the public key. The ultimate confirmation is by face to face communication.
gpg --fingerprint KEY-ID

6. If you trust Joe and are sure the public key belongs to Joe, you can sign the public key of Joe using
gpg --sign-key KEY-ID

Thursday, April 13, 2006

point vs. rate for mortgage

n: morgage term in number of years
m: number of years to closing
p: paid point

let t= n *annual_rate
s= m* annual_rate

p is equivalent to an increase of t to d+dt
Assuming no closing cost then

dt ~ c*p
c=t*(exp(t)-1)/(exp(t)-exp(t-s)-s)

So paying point p is equivalent to an increase of annual rate of p*(1/n)*c

example 1:
annual rate = 0.06
term = 30 years
closing until 30 years

t = 0.06*30 = 1.8
s = 0.06*30 = 1.8
c = 1.8 *(exp(1.8)-1)/(exp(1.8)-exp(1.8-1.8)-1.8) = 2.797
suppose paid point is 0.01 (1 point)
then the effective annual rate of this mortgage is
0.06 + 0.01 * (1/30) * 2.797 = 0.06093 = 6.093%

example 2:
Everything same as example 1 except that
closing afte 10 years
s = 0.06*10 = 0.6
c = 1.8 *(exp(1.8)-1)/(exp(1.8)-exp(1.8-0.6)-0.6) = 4.268
then the effective annual rate of this mortgage is
0.06 + 0.01 * (1/30) * 4.268 = 0.06142 = 6.142%

example 3:
Everything same as example 1 except that
closing afte 5 years
s = 0.06*5 = 0.3
c = 1.8 *(exp(1.8)-1)/(exp(1.8)-exp(1.8-0.3)-0.3) = 7.169
then the effective annual rate of this mortgage is
0.06 + 0.01 * (1/30) * 7.169 = 0.06239 = 6.239%

Wednesday, April 12, 2006

Time zone in Java

PST is same as GMT-08:00
PDT is same as GMT-07:00

EST is same as GMT-05:00
EDT is same as GMT-04:00

This mean that for example,
20060412 13:00:00 PST is one hour later than 20060412 13:00:00 PDT


These time zone string can be parsed by java.util.SimpleDataFormat class

Monday, April 10, 2006

Cookie file format of Internet explorer

Cookies are at C:\Documents and Settings\[user name]\Cookies

Cookie name
Cookie value
Host/path for the web server setting the cookie
Flags
Exirpation time (low)
Expiration time (high)
Creation time (low)
Creation time (high)
Record delimiter (*)

Conversion of the time to the number of seconds
elapsed since midnight (00:00:00), January 1, 1970,

t = 1e-7*(high*pow(2,32)+low) - 11644473600



Reference:
Galleta - An Internet Explorer Cookie Analysis Tool