Friday, November 9, 2007

Relation between BMI, heart disease and cancer

A new government research shows that being
slightly overweight (about 25 pounds) does
not appear to increase a persons chance
of dying from heart disease or cancer.

Well the picture's not all rosy for the
obese ppl, read the complete article to
find out:

Link to the article here.

Interesting advances in medicine

WSJ recently carried a nice article on predicting
medicial futures of individuals based on gene
tests. Though these tests look promising, may face
extreme skepticism on the basis of medical soundness
and the implications on health insurance.

The article provides an excellent tradeoff between,
the advantages and disadvantages of the tests while
fully highlighting their capabilities.

Link to the complete article here.

The hypocrite is at it again!

General Musharraf is back to his awesome ways of
staying in control, gets Benazir in a house arrest.

Excerpt from a web page:
ISLAMABAD, Pakistan - President Gen. Pervez Musharraf yielded to pressure from the United States on Thursday and said Pakistan will hold elections by mid-February. But he showed no sign of ending a political crack down, placing opposition leader Benazir Bhutto under house arrest and detaining thousands ahead of a major protest.

Full article here.

I am not claiming that either Benazir or Nawaz Sharif had a particularly
clean political career, but the extent to which Musharraf can use (or
rather misuse) his power is clearly evident here.

Wednesday, November 7, 2007

Leading zeros with C++ printf

To print leading zeros with the format string in printf use the follwing approach:

printf(" %0kd ", number);

where: k is the size of the number.

Eg: to display 0034 with the number 34 use:
printf("%04d", 34);

Make a user a moderator in yahoo groups

Only a moderator or a owner can do this I guess:
1. Login with your yahoo id on groups.yahoo.com
2. Click on the group "name".
3. Click on the members button the left hand side
4. On the list under my id: "my_id", there is an edit membership option. Click it
5. On the edit membership page there should be a change to moderator option.

Converting windows text files to unix (debian)

Simplest approach is to apt-get (on debian), either of the following applications:

1) dos2unix or
2) tofrodos and use the fromDos utility.

In windows lines end with both CR and LF
In linux, the lines end with LF only.

Tuesday, November 6, 2007

Installing pssh under home without root access

Quick steps to install pssh from source under your home directory
without source rights:

Get the file with the python tools setup:
wget 'http://peak.telecommunity.com/dist/ez_setup.py'

Create a local directory for python tools:
mkdir ~/tools
python ez_setup.py --install-dir="/home/gautam/tools/"
ADD TO .bashrc: export PYTHONPATH=/home/gautam/tools/
python setup.py install
ADD TO .bashrc: export PATH=$PATH:/home/gautam/pssh-1.3.1/bin/

Throws the warning:
error: No urls, filenames, or requirements specified (see --help)

But everything seems to be working fine

First Processor With Cache

The first production machine to carry a cache was the IBM 360/85.
The cache helped the model 85 outperform a more sophisticated model 91.
Model 85 was introduced in 1969.

iwpriv authmode

There are many private ioctls available in MADWifi, here are a few useful ones.
Locking to a Specific Mode ¶

To lock the card to a specific mode, use:

* iwpriv ath0 mode 1 To lock to 11a only.
* iwpriv ath0 mode 2 To lock to 11b only.
* iwpriv ath0 mode 3 To lock to 11g only.
* iwpriv ath0 mode 0 (default) autoselect mode.

Changing Authentication Mode. ¶

Use:

* iwpriv ath0 authmode 1 To use open authentication.
* iwpriv ath0 authmode 2 To use shared key authentication.
* iwpriv ath0 authmode 3 To use 802.1x authentication.


More here

Monday, November 5, 2007

Obesity a function of sleep??

A recent yahoo post says the following:


In experiments by Van Cauter and others, sleep-deprived adults produced more ghrelin, a hormone that promotes hunger, and less leptin, a hormone that signals fullness.

Another explanation: Tired kids are less likely to exercise and more likely to sit on the couch and eat cookies, Lumeng said.

Dr. Stephen Sheldon, director of sleep medicine at Chicago's Children's Memorial Hospital, praised the study and called for more research. He said children's sleep may be disturbed by breathing problems — some caused by overweight, such as sleep apnea, and some caused by enlarged tonsils and adenoids.


Link to the complete article here

Good research!

Writing arrays to binary files in C or C++

FILE *fp = fopen(filename, "wb+")
fwrite(&base_addr, dim_x*dim_y*sizeof(array_type), 1, fp);
fclose(fp);

//to read the same array back
FILE *fp = NULL;
type base_addr[dim_x][dim_y];
fp = fopen(filename, "rb");
fread(&base_addr, dim_x*dim_y*sizeof(array_type), 1, fp);
fclose(fp);

Printing % with fprintf() or printf()

It is surprising that the conventional '\' escape character does not work while printing % character to a file. So instead of using \% in the format string, the
programmer needs to use %% to print % using printf().

Eg: fprintf(fp, "%%");
printf("%%");

Robin Hood and the Sherwood tree

Yahoo recently carried an article on the tree which my legenedary
hero Robin Hood used as a hideout in Nottinghamshire. The story
talks about the fabled "sherwood" and its state as of today.

Link to the article

Brings back sweet memories from yester years.

Sunday, November 4, 2007

Latex \thanks and \titlenote difference

Are the two approaches of doing the same thing with latex - Introducing a footnote with latex. \thanks is widely used with the IEEE templates while \titlenote works best with the ACM latex templates.

Typical usage of these tags is best described as a part of the standard ACM/IEEE template discussions.

Benfords Law

An interesting law that states that the digit "1" appears with a much higher frequency in statistics than the other digits. The digit is claimed to appear 30% of the times over the expected 11%.

I observed this when I saw a typical trend with high number of one's in my simulations.
Cool stuff :)