Thursday, February 26, 2009

10 Lifestyle Tips for Cancer Prevention (zz)

http://www.webmd.com/cancer/news/20081028/10-lifestyle-tips-for-cancer-prevention
  • Be as lean as possible without becoming underweight.
  • Be physically active for at least 30 minutes every day.
  • Avoid sugary drinks, and limit consumption of high-calorie foods, especially those low in fiber and rich in fat or added sugar.
  • Eat more of a variety of vegetables, fruits, whole grains, and legumes (such as beans).
  • Limit consumption of red meats (including beef, pork, and lamb) and avoid processed meats.
  • If you drink alcohol, limit your daily intake to two drinks for men and one drink for women.
  • Limit consumption of salty foods and food processed with salt (sodium).
  • Don't use supplements to try to protect against cancer.
  • It's best for mothers to exclusively breastfeed their babies for up to six months and then add other liquids and foods.
  • After treatment, cancer survivors should follow the recommendations for cancer prevention.

Thursday, February 19, 2009

latex word counter

In order to count the words you write in your latex file, two steps are needed.

1, install detex by
sudo apt-get install texlive-extra-utils
2, in your latex file directory
detex yourtexfile.tex | wc -w

That is done.

Tuesday, February 3, 2009

乙肝疫苗要普及宣传


首先看看慢性肝炎在世界分布,来自www.gov.org。中国是乙肝多发区,感染的抓紧治疗,没有感染注意赶紧打疫苗。以下引用 http://www.cdc.gov/hepatitis/B/bFAQ.htm#overview

Who should get vaccinated against hepatitis B?Hepatitis B vaccination is recommended for:
  • All infants, starting with the first dose of hepatitis B vaccine at birth
  • All children and adolescents younger than 19 years of age who have not been vaccinated
  • People whose sex partners have hepatitis B
  • Sexually active persons who are not in a long-term, mutually monogamous relationship.
  • Persons seeking evaluation or treatment for a sexually transmitted disease
  • Men who have sexual contact with other men
  • People who share needles, syringes, or other drug-injection equipment
  • People who have close household contact with someone infected with the hepatitis B virus
  • Healthcare and public safety workers at risk for exposure to blood or blood-contaminated body fluids on the job
  • People with end-stage renal disease, including predialysis, hemodialysis, peritoneal dialysis, and home dialysis patients
  • Residents and staff of facilities for developmentally disabled persons
  • Travelers to regions with moderate or high rates of hepatitis B
  • People with chronic liver disease
  • People with HIV infection
  • Anyone who wishes to be protected from hepatitis B virus infection
Is the hepatitis B vaccine recommended before international travel?

The risk for hepatitis B virus infection in international travelers is generally low, although people traveling to certain countries are at risk. Travelers to regions with moderate or high rates of hepatitis B should get the hepatitis B vaccine.

How is the hepatitis B vaccine series given?

The hepatitis B vaccine is usually given as a series of 3 or 4 shots over a 6-month period.

现在各大医院都应该有,价格应该在80-300rmb, 在美国如果有医保,应该都是免费的。通常3次,0,1月后,6月后距离第一次。

Thursday, December 4, 2008

Hook AMPL with NPSOL 5.0

Thank Dave. M. Gray for the help to modify the makefile

1. NPSOL 5.0 needs to be ordered from http://www.sbsi-sol-optimize.com/asp/sol_product_npsol.htm
After you get npUnix.tar.gz, you can extract it.
You got a directory contains GNUmakefile....
In order to compile and install NPSOL, you need install F2C first, and set the environment variable F2C , for example, in my computer, F2C is installed in /usr/
In command line
export F2C=/usr/
gmake
gmake clean
Therefore, NPSOL will be installed, a new directory will be created (npsol/Linux-i686/optimized/lib) the created directory is dependent on your own system.

2. Download npsol (it is an AMPL interface to NPSOL 5.0) from
http://netlib.bell-labs.com/netlib/ampl, it is a file called netlibfiles.tar
extract netlibfiles.tar , you get solvers/
in solvers/ directory, you may have many .gz files
gunzip *.gz
make -f makefile.u (it depends on your system)
Then amplsolver.a is created in this directory

3. Now go to solvers/npsol
copy all NPSOL library files (/npsol/Linux-i686/optimized/lib) to this directory.
make -f makefile.u
Attention, you may read makefile.u carefully, make some necessary changes according to your system.
cp makefile.u makefile
in makefile

"n = npsol.o version.o $S/amplsolver.a libnpsol_f77.a libblas_f77.a libnlssol_f77.a liblssol_f77.a

npsol: $n
$(CC) -o npsol $n -lf2c -lm -ldl" for my system,Linux localhost 2.6.24-21-generic #1 SMP Tue Oct 21 23:43:45 UTC 2008 i686 GNU/Linux

type make -f makefile
the executable npsol will be created in this directory.

4. Set PATH variables to make the system find this executable
in command line, gedit .bashrc, add npsol path, source .bashrc

5. in AMPL program, just use option solver npsol.

It should work.

Thursday, November 20, 2008

File output and input in Matlab and C

Save matlab workspace variables to a text file
save('filename','variable_name','-ASCII');

Scan this file into a C program
int k1;
FILE *filename;
filename = fopen("filename","r");
for (k1 = 0; k1 < size; k1++)
fscanf(filename, "%f ", &var[k1]);
fclose(filename);

Saturday, November 15, 2008

Weird problems in C debugging

./opt1.sub.h: In function ‘tcf’:
./opt1.sub.h:234: error: stray ‘\357’ in program
./opt1.sub.h:234: error: stray ‘\274’ in program
./opt1.sub.h:234: error: stray ‘\213’ in program
./opt1.sub.h:234: error: expected ‘)’ before ‘zp’

I searched the web, the problem is"
It means you have some goofy characters on that line. They are probably invisible. Try deleting the line entirely and retyping it."----from cprogramming.com

Monday, November 10, 2008

Ubuntu Desktop Recover

Sometimes, when you install new programs on Ubuntu, you may fail to log into the graphic interface again.
In that case, you may try to reinstall ubuntu-destkop by
"sudo apt-get install ubuntu-desktop".
Generally, after rebooting, you will be able to access to the desktop again.
If "xorg.conf" under the /etc/ directory may be corrupted. You can use the backup from that directory by
"cp xorg.conf.backup xorg.conf"