Tuesday, December 05, 2006

use MPICH on linux

Setup environment (assuming csh or tcsh)
setenv PATH mpi_install_dim/bin:$PATH

Setup ssh:
1. Setup host authentication (by administrator), following two files are relevant. See ssh manual page for detail.
/etc/ssh/ssh_known_hosts
/etc/ssh/ssh_host_rsa_key

2. Setup user authentication (by user)
ssh-keygen -b 1024 -t rsa
cp .ssh/is_rsa.pub .ssh/authorized_keys

If ssh is setup correctly, following command should be able to run without entering password:
ssh remosthostname date

Friday, August 18, 2006

conflict of matlab with Intel IPP

If you use latest version of IPP with matlab 7.1,
then you need make sure your IPP\bin and IPP\bin\win32 is ahead of MATLAB's directory in the PATH environment variable.

linux email forwarding

Create a file named .forward at home directory with the following content:
\username, emailname@abc.com

Of couse, you need to change username, emailname and abc.com to suitable value

Saturday, May 27, 2006

Defragment windows system files

Windows Disk defragmenter does not defragment system files.
A good tool PageDefrag at http://www.sysinternals.com/Utilities/PageDefrag.html can do this.

Optimize the System Cache Size

System Key: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ Session ManagerMemory Management]
Value Name: LargeSystemCache
Data Type: REG_DWORD (DWORD Value)
Value Data: "0" for Desktops; "1" for Servers

Reference: http://www.winguides.com/registry/display.php/931/

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

Wednesday, January 25, 2006

Tuesday, January 24, 2006

Using image in LaTex

Convert the image file to jpeg format.
Use jpeg2ps to convert it to eps file.
Then it can be easily used in LaTex

Thursday, November 17, 2005

Tax for mutual fund

Some special rules:
1. To qualify for the qualified dividend (taxed at same rate as long term captical gain), the fund must be held for at least 61 days.
2. Upon selling of a fund held not more than 6 months, part of short term capital loss (if there's any) must be treated as long term captital loss to the limit of long term captital gain distributions.


A good guide is at
http://fairmark.com/mutual/

At the same site, tax information for other investment can also be found.

Tuesday, November 15, 2005

Notes on Yahoo finance historical prices

The adj close is the actual close multiplied by split multiplier and dividend multiplier
See following page for explanation.
http://help.yahoo.com/help/us/fin/quote/quote-12.html

IMPORTANT NOTE: Historical dividend is also adjusted by split multiplier and dividend multiplier

CSV file for historical price can be retrieved by (SPY as example)
http://ichart.finance.yahoo.com/table.csv?s=SPY

HTML page for historical price
http://finance.yahoo.com/q/hp?s=SPY

Wednesday, November 02, 2005

Can people short in an IRA account?

The answer is NO.
Reason (adapt from http://invest-faq.com/articles/ret-plan-trad-ira.html)
The restriction comes from the combination of the following three facts. First, the law governing IRAs says that if any part of an IRA is used as collateral, the entire IRA is considered distributed and thus subject to income tax and penalties. Second, the rules imposed by the Federal Reserve Board et al. say that short sales have to take place in a margin account. Third and finally, margin accounts require that you pledge the account as collateral. So if you try to turn an IRA into a margin account, you'll void the IRA; but without a margin account, you can't sell short.

Monday, October 31, 2005

How to get information about land

Find the website for county assessor's office. Then look for what you need.
For Santa Clara county, it's at http://www.sccgov.org/ari

How to find information about a person, address, or phone number

The following website is exellent:
http://www.reversephonedirectory.com/

Monday, October 24, 2005

Verizon DSL conflicts with NetBeans javadoc help

Cause : Motive SmartBridge (installed with Verizon support center) take over ALT-F1 globally.
Solution : uninstall Verizon support center.

See following page about Motive SmartBridge
http://www.intelliot.com/blog/archives/2004/06/05/motive-smartbridge/