Sunday, December 16, 2007

6 Degrees Of Separation

Apparently every person
on the planet knows every other
person through at max 6 intermediate
people.

Eg: I am 3 hops away from
Ex president Clinton since I know
someone who knows someone who
knows Clinton :)

Interesting fact. Comprehensive
experimental studies have confirmed
this behavior across 157 countries.

This feature is also the basis of
small world graphs!

Friday, December 14, 2007

An object in four dimensions


Was reading about solving equations in
n dimensions and how they are rendered.

Found an interesting image of a rotating
tesseract here

Wednesday, December 12, 2007

Fonts Not Embedded

To create a camera ready version
compatible with the IEEE/ACM
standards, do not use the
hyperref and the url packages
in the latex source.

To embed the fonts after the pdf
is created, open the pdf file with
ghostview. Go to the file menu and select
convert. Set device as pdfwrite with a
resolution of 600 and all pages selected.
After clicking the properties button
select the compatibility level of 1.3,
pdfsettings as /prepress, embedd all fonts
as true and subset fonts as true. Then
save the pdf with a different file name.

This should work fine.

Friday, December 7, 2007

Checking the route table in Linux

Mirrored from: http://www.cpqlinux.com/routes.html

netstat -rn
route

Adding and Removing a Network in Linux

route add -net 10.10.10.0/24 gw 192.168.0.1
route del -net 10.10.10.0/24 gw 192.168.0.1

Adding and Removing a specific host in Linux

route add -host 10.10.10.45 gw 192.168.0.1
route del -host 10.10.10.45 gw 192.168.0.1

Adding a Default GW in Linux

route add default gw 192.168.0.1
route del default gw 192.168.0.1

Note: The old gw will still remain and may need to be taken out for the system to function properly.

Routes are made permanent in Red Hat Linux by adding routes to /etc/sysconfig/static-routes Checking the route table in Windows NT

route print

Adding and Removing a network in Windows NT

route add 10.10.10.0 mask 255.255.255.0 192.168.0.1
route delete 10.10.10.0 mask 255.255.255.0 192.168.0.1

Adding and Removing a specific host in Windows NT

route add 10.10.10.45 192.168.0.1
route delete 10.10.10.45 192.168.0.1

Adding a Default GW in Windows NT

route add 0.0.0.0 mask 255.255.255.255 192.168.0.1
or
route add 0.0.0.0 192.168.0.1
or
route -p add 0.0.0.0 192.168.0.1
route delete 0.0.0.0
or
route delete 0.0.0.0 mask 255.255.255.255
or
route delete 0.0.0.0 mask 255.255.255.255 192.168.0.1

Routes are made permanent in Windows NT by using "-p" with the route add command. Here is an example:

route -p add 10.10.10.45 192.168.0.1

prev next index

Wednesday, December 5, 2007

When your car gives up on you...

Just the other day, it snowed in NJ.
For some reason, the brakes on my car
decided not to work just when I was
coming down a steep road. I could
figure out that it was not the car slipping
on the snow but rather my brakes jamming.


I started pumping the breaks trying to revive
them but it just would not work. Finally by sheer
instinct I veered my car over to the curb,
where the friction finally brought my car
to a screeching halt. I will never forget that
one exciting drive in my cougar XR7!

Monday, November 19, 2007

Accessing a class variable inside another class

I thought that the only means to access a class
variable inside another class is by inheriting
or through the use of friend functions.

Another approach is by creating the internal
variable of a class as a pointer, and passing
the pointer to another class to provide full
access to the variable.

Here is a code snipet that shows how it works:

class A{

int *a;
public:
void print(int *t)
{
printf("\nValue from another class: %d", *t);
printf("\nValue from this class : %d", *a);
}
A()
{
*a = 2;
}

};

class B{

int *b;
public:
B()
{
*b = 5;
}
int *getB(void)
{
return b;
}

};

int main()
{
int *temp;
A objA;
B objB;
temp = objB.getB();
objA.print(temp);
}


Result of a run shows:
Value from another class: 5
Value from this class : 2

Saturday, November 17, 2007

Everclear music is good

Was just browsing through some random
music online. Found this portland based
band: Everclear.

Two of their songs "she's so high" and
"wonderful" look to be nice.

Kissing number ??

This is an interesting problem in which you try
to find the maximum number of circles (spheres)
of radius 1 that can be placed next to a
single circle in n dimensions.

Wikipedia carries a very nice article on this.

Tuesday, November 13, 2007

UFO or HFO?

Just the other day me and a couple of my friends were contemplating,
are there really UFOs (unidentified flying objects)? Or is it just
the government trying to hide its high tech next generation planes
(HFO)?

There is another theory which says that some alien crafts are used
for reverse engineering and recreation of air crafts could this really
be possible. Yahoo had an article today about a consortium of
representatives from different countries demanding an investigation into
the UFO phenomenon.

Detailed article here.

Monday, November 12, 2007

CISCO Virtual Labs

Cisco apparently has a sweet product which allows
you to configure devices as if they were real.
The virtual labs software allows the user to telnet
into 7 different devices with the IOS command line
access.

Very useful for CCNA certification I guess.

Intel slated to release faster chips

Computer chipmaker Intel Inc is slated to release faster and more powerful chips with
quad cores based on the 45nm technology. Detailed report on this development
is available here.

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 :)

Saturday, November 3, 2007

Pakistan in a state of emergency!

Pervez Musharraf does it once again!!

NDTV link on the emergency

Suspended the constitution and happily got rid of the chief justice... just for his own personal interest!!

Dictatorship at its best!

Friday, November 2, 2007

C++ compiler for windows

I was searching for a way to get C++ running on my windows machine.
One of the best ways is by installing Cygwin on windows and having the
conventional GNU C compiler tools.

The other (quicker) approach is to install an IDE such as devshed-C++
found here:
Link to devshed-C++

Largest Iceberg

Learnt that C19a is the largest iceberg in the world (as of now).
With all the global warming kicking in.. that might soon change.

Stumbled across this information while I was looking at Google trends in
google labs for the most searched things.. for Nov2 (today) :)

http://www.google.com/trends/hottrends?q=c19a&date=2007-11-2&sa=X

NS2 Installation

Excellent tips on installing NS2 on linux can be found on this page:
http://www.winlab.rutgers.edu/~zhibinwu/

Larsen and Toubro - Mumbai airport facelift!

Interesting news:

Forbes Link to the article

An insider tells me that there are 35 more airports in India that need immediate work.. who gets the contracts?? :) .. wait and watch

Just traveled by the Mumbai CST airport.. has an amazing facelift.

Issuing commands remotely - Gexec

I am currently exploring the utility of issuing commands to multiple nodes concurrently. Considering the use of Gexec.

Gexec can be found here:
http://www.theether.org/gexec/

Wednesday, March 28, 2007

Checking the version of the Madwifi driver on the image

1. The sure way:
Do a modinfo on the driver module and check the version number which shows up.
Eg:
node1-1:/lib/modules/2.6.15-skas3-v8.2/net# modinfo ath_pci
filename: /lib/modules/2.6.15-skas3-v8.2/net/ath_pci.ko
author: Errno Consulting, Sam Leffler
description: Support for Atheros 802.11 wireless LAN cards.
license: Dual BSD/GPL
vermagic: 2.6.15-skas3-v8.2 preempt VIAC3-2 gcc-4.0
depends: ath_hal,wlan,ath_rate_sample
alias: pci:v0000168Cd00000007sv*sd*bc*sc*i*
alias: pci:v0000168Cd00000012sv*sd*bc*sc*i*
alias: pci:v0000168Cd00000013sv*sd*bc*sc*i*
alias: pci:v0000A727d00000013sv*sd*bc*sc*i*
alias: pci:v000010B7d00000013sv*sd*bc*sc*i*
alias: pci:v0000168Cd00001014sv*sd*bc*sc*i*
alias: pci:v0000168Cd00000015sv*sd*bc*sc*i*
alias: pci:v0000168Cd00000016sv*sd*bc*sc*i*
alias: pci:v0000168Cd00000017sv*sd*bc*sc*i*
alias: pci:v0000168Cd00000018sv*sd*bc*sc*i*
alias: pci:v0000168Cd00000019sv*sd*bc*sc*i*
alias: pci:v0000168Cd0000001Asv*sd*bc*sc*i*
parm: ifname:Interface name prefix (default: ath) (charp)
parm: xchanmode:Enable/disable extended channel mode (int)
parm: outdoor:Enable/disable outdoor use (int)
parm: countrycode:Override default country code (int)
node1-1:/lib/modules/2.6.15-skas3-v8.2/net#


If the modinfo does not bring up anything, check the information that may be apart of the
kernel object.

node1-1:/lib/modules/2.6.15-skas3-v8.2/net# strings ath_pci.ko | grep -i version
EEPROM version invalid
%s: mac version > 7.8, not putting device to sleep
Debugging version (ATH)
node1-1:/lib/modules/2.6.15-skas3-v8.2/net#

This does not bring up anything either.

So the other approach is to check if the new command available with th madwifi drivers is on the image.

node1-1:~# which wlanconfig
node1-1:~#

As this does not bring up anything either we determine that this is the old driver.