Wednesday, January 9, 2008

Global positioning system(GPS)

Mobile that we using can be used to locate all the people in the case of emergency.that's why GPS(global positioning receiver) located chip was inserted in new phone.Newer phones can be used to track people in 30ft range.cell phone essentially radio.When cell phone is on it sends radio signals to it's cell tower to know where the phone is,this will help a person to move one cell to another cell with out loosing a call.At the same time GPS system receives signal from outer space specifically at least 3 geosynchronous satellites.Using geometric method called tridimentional trilateration,the GPS chip using the satellite signal to calculate its exact location on earth.
If we put a sniffer on a node we can track someone.Node is something which takes all calls coming to a cell tower and release those signals to where they are going.but sniffer is a electronic device that detect specific calls then send that signal to a phone that we are using to tracking.

Global positioning system(GPS)

GPS is a satellite based navigation system.GPS works anywhere in the world under any weather conditions.GPS constellation consist of 24 satellites in 6 near circular orbits.An on board GPS receiver must locked in to at least 3 satellite to calculate 2D position or the movement,if 4 satellites or more receiver can determine the 3D position.Once the user position has been determined GPS unit will start to calculate other information such as speed,track,trip distance,time.These parameters are continually updated by a master control station,which transmits them up to the satellites where they are broadcast as part of a navigational message from each satellite.Civilian GPS uses L1 frequency of 1.5754 GHz in the UHF band(signal travels by line of sight,it can pass clouds,glass and plastic but fail to pass through solid objects).Defense GPS uses L2 frequency of 1.2276 GHz in the UHF band.In the GPS system the modulation used is direct sequence spread spectrum and it is one way transmission system(from satellite to user only,user does not require a transmitter).Modulation method makes GPS system jam resistant,secure and addressable.The in phase component is being C/A (coarse acquisition) code while quadrature component is P-code(precision code).
GPS signal contains 3 different bits of information:
  1. Pseudorandom code,simply an ID code to identify which satellite is transmitting th signal.
  2. Ephemeris data,which is constantly transmitted by each satellite,contains information sbout its status and this is essential to determine its position.
  3. Almanac data,tells the GPS receiver about the position(orbital information) of each GPS satellite throughout the day.
Dilution of precision (DOP) is measure of the quality of the GPS data being received fro the satellite.The effect of DOP can be resolved in to horizontal DOP(HDOP),vertical DOP(VDOP),time DOP(TDOP) and position DOP(PDOP).

Tuesday, January 8, 2008

Played for John Keels hockey team

My first game in Mercantile tournament was against Browns pvt ltd in 08/01/08 at Ovel ground(0-1).I played as a forward for the john keels hockey team.I was really exhosted because I played after 4 months.I'm fortunate to be selected to the company team even if i was joing the company for my 6 months internship.There are players from all the division in the john keels group.Namely transport(DHL),Food and beverages,Hotel management and IT sector(kbsl) etc.I am in my internship at kbsl.But we played the game as team under the same group.It is another opportunity for me to develop my team work skills.John keels have a good hockey team,I'm fortunate to get that exposure.I had played hockey for my school and for the university,now I already had play for a company also.After the match I had some friendly chat with the team members about there role in the group.Now I have friends not only in kbsl but also in the whole group.

Gnuzip

The gzip sources, written in C, are available here in various formats:
  • tar
  • shar
  • zip
  • tar.gz
  • tar.Z
If a file ends in .zip (for example, file.zip) type:
unzip file.zip

If a file ends in .tar (e.g., file.tar) type:
tar -xvf file.tar

tar -zxvpf my_tar_file.tar.gz

I've used my preferred options. I'll explain them:
-z - unzip the file first
-x - extract the files from the tarball
-v - "verbose" (i.e tar tells you what files it's extracting)
-p - preserves dates, permissions of the original files
-f - use the file in question (if you don't specify this, tar just sort of sits around doing nothing)
The files are extracted and your original tarball is preserved (my_tar_file.tar.gz).

If a file ends in .gz (for example, file.gz) type:
gzip -d file.gz

If a file ends in .tar.gz (e.g. file.tar.gz) type:
gzip -d file.tar.gz
and then
tar -xvf file.tar

If a file ends in .tgz (e.g. file.tgz) type:
tar -xvzf file.tgz

If file ends in tar.bz2(file.tar.bz2)type:
bzip2 -d file.bz2

Monday, January 7, 2008

configuring Samba

Samba is open source implementation of the System Message Block(SMB) service used by Microsoft windows 9x and NT,which is known as CIFS.Samba enables windows client to access Linux file systems and printers by using network Neighborhood facility of the windows manager. SMB is high level protocol built on Microsoft 's NetBIOS protocol,which can be run over TCP/IP network.Samba has 2 associated services:
SMB server acts as the browse master(maintains information on available servers and respond to client discover servers) for a network served by SMB.Linux client can access SMB share in 2 ways:
print tool utility lets us to configure access to Samba printers.

Samba is contain in 3 packages
  • samba-common, which contains files needed by samba clients and servers.
  • samba,which contains the samba server.
  • samba-client,which contains the samba smbclient,smbmount and smbprint.
Samba is in such popular use that many Unix distributions come with it already installed.Samba is already installed on my RHEL 4, I checked the version by using the command:

$ smbd -V
Version 3.0.10-1.4E.2

On Red Hat Linux, I use the rpm command to query the installed packages for Samba:

$ rpm -qa | grep samba
samba-client-3.0.10-1.4E.2
samba-3.0.10-1.4E.2
samba-common-3.0.10-1.4E.2

Administration
the main server administratrion script for samba is /etc/init.d/smb.By invoking this with proper arguments we can control the samba server.

to start samba server:
/etc/init.d/smb start or
service smb start

to restart the samba server:
/etc/init.d/smb restart or
service smb restart

to stop samba server:
/etc/init.d/smb stop or
service smb stop

to check samba status:
/etc/init.d/smb status

Basic server configuration

The main Samba configuration file is /etc/smb.conf, which contains two types of directives:
  1. Global directives, which configure the server.
  2. Service directives, which configure shared files and printers.
Samba Global Directives

The host allow directive identifies the client host permitted to access the server.The localhost address 127.0.0.1,should generally be included in the list of hosts.
#specify the hosts that can access the server
host allow = 192.168.1 192.168.2 127. (partial IP addresses note the trailing dot)

For Windows 9x and NT clients,I specify user as the value of the security parameter.For handling authorization on a per-share basis,value can be specified as share.To handle authorization by primary domain controller(PDC) in another server security value must be specified as server.If the client participate in a domain,value should be domain.
#specify the security is imposed at the user level
security = server

Samba service directives

To create a publicly available share,omit the valid user directive and specify public = yes.
To create access to all members of the group,specify public = @group_name.
To avoid to be in a browse list,specify browseable = no.

Client configuration and use

To access a samba share or a windows 9x/NT share from a linux host:
smbmount //server/share /mount_point

To access a share using smbclient //server/share


Troubleshooting

Testparm tests my configuration file(smb.conf) and report any unknown parameters or incorrect syntax. It also performs a check for common misconfiguration and will issue a warning if one is found.
testparm /etc/samba/smb.conf

To list available shares on the server:
smbclient -L localhost -N

If no shares are visible,the WINS server may not be responding,to investigate that:
nmblookup -B localhost __SAMBA__

to check whether SMB clients are properly configured to use WINS:
nmblookup -d 2 '*'

Friday, January 4, 2008

Interesting mathematics 1

Bayesian Spam filter

Bayesian email filters take advantage of Bayes' theorem.Spam filters use Bayesian spam filter to filter out junk email from the record email.Calculate the probability that mail will be a junk taking some key words in to
consideration(refinance,stock,Viagra...these words may have high Bayesian probability).Here you get statistics on how often tokens show up in two bodies of mail, (spam and good,) and then calculate the a statistical value that a single mail is spam by looking at the tokens in it. The more mail in the good and spam mail bodies, the better the filter is "trained".
Bayes' theorem, in the context of spam, says that the probability that an email is spam, given that it has certain key words in it is:

π

It represents the ratio of any circle's circumference to its diameter,approximately equal to 3.14159.π itself has an infinite decimal expansion; because π is an irrational number, its decimal expansion never ends and does not repeat. Simple way of calculating π is by drawing a large circle, then measuring its diameter and circumference, since the circumference of a circle is always π times its diameter.
when we find some thing we can't explain in math we said it is π(pi).So there is question to answer why pi appears many places in Physics, Relativity and number theory seemly unrelated places.
when we droop needles randomly to a sheet of line paper probability of needle will cross a line is equal to the pi(Buffon's needle).
Let the length of the needle is one unit and the distance between the lines is also one unit. There are two variables, the angle at which the needle falls (theta) and the distance from the center of the needle to the closest line (D).


To calculate pi from the needle drops, simply take the number of drops and multiply it by two, then divide by the number of hits, or
2(total drops)/(number of hits) = pi (approximately).

Car Remote


The system consists of a remote, commonly called a "keyfob" and a reciever module located somewhere on the car.When you press the keyfob button, a signal is sent out by the keyfob. This signal includes a numeric pass code.car remote has one to one mapping with the car.but all remotes are in the same frequency.every remote emit numerical code only one car identifies it.Rolling code.every time hit the key it sends different signal to the car.If the combination agrees with the stored information that has been programmed into the receiver module, the doors unlock, lock, or whatever allocated happens.The change is predictable as long as we know the algorithm,it may be simple as adding a 1.

Gambling

Math applies to gambling. Booky wanted to take equal amount of money on each side of the game. Booky always balance two side.But sometime one team is better than the other,he have to adjust the point spread.He have to drop bets to the weak side and keep the balance.He keep the balance he doesn't have to pay for the winner from his own pocket,they get paid from the losers money.For his balance spread he makes 4 1/2% profit for the all the action he takes.

PEMS

PEMS-freeway performance evaluation monitoring system
PEMS is designed to predict optimum traffic route and travel time.There are sensors buried in the roads,that count cars,trucks traffic on the road.And that information is sent to a computer.
constructional theory,point area point volume of flows.Traffic flew like any other fluid system,there are imperfection obstacles,that proves the system to optimize it by reducing its resistance.

Fairy Sequence

Fraction specially a fairy sequence.Say we begin slicing oranges to lot of oranges,but the rule is we can never repeat a cut.First orange cut to a 1/2.Next orange we take 1/3.next 1/4 and next 1/5.In the end we left many orange slices with vary in size.When you place smallest to largest the form a fairy sequence.
F1=(0/1,1/1)
F2=(0/1,1/2,1/1)
F3=(0/1,1/3,1/2,2/3,1/1)
F4=(0/1,1/4,1/3,1/2,2/3,3/4,1/1)
F5=(0/1,1/5,1/4,1/3,2/5,1/2,3/5,2/3,3/4,4/5,1/1)
this is used in book keeping.

why there is no Nobel Prize for Maths

Since 1901, the Nobel Prize has been honoring men and women from all corners of the globe for outstanding achievements in physics, chemistry, medicine, literature, and for work in peace.But there is no Nobel price for mathematics.Mathematicians says Nobel's wife or his mistress had an affair with the mathematician Mittag-Leffler and he doesn't want to share his price with his rivals.But this can't be truth because Alfred Nobel never married.
There are several possible reasons why Nobel did not create a prize for mathematics.Nobel price is for those inventions or discoveries of greatest practical benefit to mankind,but mathematics is not considered as practical science,this would explain the lack of a Mathematics prize.Another possible reason is that there was already a well known Scandinavian prize for mathematicians.And several prizes in Mathematics have similarities to the Nobel Prize.

Wireless networks

Modern wireless communication systems

Wireless communication networks have become much more pervasive than any one could have imagine when the cellular concept was first developed in the 1960s and 1970s.The wide spread success of cellular has led to the development of newer wireless systems and standards for many other types of telecommunication traffic.
Personal communication networks (PCN) refers to a wireless networking concept where any user can make or receive call,no matter where they are, using a light weight,personalized communicator.Personal communication services (PCS) refers to new wireless system that incoperate more network features and more personalized than existing cellular radio systems.



Second Generation(2G) Cellular networks


Unlike first generation cellular systems that relied on FDMA/FDD and analog FM,second generation standards use digital modulation formats and TDMA/FDD and CDMA/FDD multiple access techniques.The most popular 2G standard includes 3 TDMA standards and one CDMA standards:
1.Global System Mobile (GSM),which supports 8 time slotted users for each 200kHz radio channel.(in the PCS spectrum band only)
2.Interim Standard 136 (IS-136),wich support 3 time slotted users for each 30kHz radio channel.
3.Pacific Digital cellular(PDC), a japanese TDMA standards that is similar to IS-136.
4.Interim Standard 95 Code devision Multiple access(IS-95),also known as cdmaone, which supports up to 64 users that are orthogonally coded and simultaneously transmitted on each 1.25 channel.
All 2G technologies offer at least a 3 times increase in spectrum efficiency as compared to the first generation analog technologies.

Evolution to 2.5 Mobile Radio Networks

The 2G technology use circuit switched data modems that limit data users to single circuit-switched voice channel.2G networks only support single user data rates on the order of 10 kilobits per second,which is too low for rapid email and internet browsing applications.This is because 2G standards were designed before the wide spread use of internet.
Even with relatively small user data rates, 2G standards are able to support limited internet browsing and sophisticated short messaging(SMS) capabilities using circuit-switched approach.The new technology 2.5G allow existing 2G equipment to be modified and supplemented with new base station add-ons and subscriber unit software upgrades to support higher data rate transmission for web browsing and e-mail traffic. 2.5G also support new web browsing format language,called wireless application protocol(WAP),that allow standard web pages to be viewed in compressed format specially designed for small hand held potable wireless devices.Japan introduced its own propriety wireless data service and internet micro browser technology called I-mode,on its PDC.I-mode supports games,color graphics and interactive web page browsing using 2G PDC data rate 0f 9.6 kilobits per second.

Evolution for 2.5G TDMA Standards

Three TDMA upgrade option include:
1.High Speed Circuit Switched Data (HSCSD)
2.General Packet Radio Service (GPRS)
3.Enhanced Data rates for GSM Evaluation (EDGE)
These option provide significant improvement in internet access speed over GSM and IS-136 and support the creation of new internet-ready cell phones.

HSCSD for 2.5G GSM

HSCSD allows single mobile subscriber to use consecutive user time slots in GSM standard,in order to obtain high speed data access.HSCSD relaxes the error control coding algorithm that specified in GSM for data transmission and increase data rate to 14.4 kbps.By running up to 4 consecutive time slots,HSCSD able to provide rate up to 57.6 kbps to individual users.Service provider has to implement a software change at existing GSM base station to activate HSCSD.HSCSD is ideal for streaming internet access and real-time interactive web sessions.

GPRS for 2.5G

GPRS is packet based data network,wich is well suited for non-real time internet usage,and applications where the user downloads much more data than its uploads(like retrieval of email,faxes).GPRS supports multi-user network sharing of individual radio channels and time slots.GPRS can support many users than HSCSD but in bursty manner.GPRS subscriber units are automatically instructed to tune to dedicated GPRS radio channels and particular time slot for "always on"access to the network.Implementation of GPRS merely requires the GSM operator to install new router and internet gateway at the base station,along with new software that redefines the base station air interface and time slots,no new RF hardware needed.As the case of packet network throughput experience by user may decreases as more users attempt to use the network or due to poor propagation conditions.GPRS allow dedicated peak 21.4kbps per channel data rate,if all 8 time slots of GSM used for GPRS,an individual user is able to achieve 171.2 kbps (8x21.4).GPRS originally designed to provide packet data access over GSM networks,but later extended to work with IS-136 as well.

EDGE for 2.5G

EDGE requires new hardware and software upgrades to the existing base station.EDGE introduce a new digital format,8-PSK(octal phase shift keying) in addition to existing GMSK modulation.EDGE allows for 9 different air interface formats,known as multiple modulation and coding schemes(MCS),with varying degree of error control protection.So each user connection may adaptively determine the best MCS setting(incremental redundancy) for the particular radio propagation condition and data access requirement of the user.EDGE is sometimes referred to as Enhansed GPRS,EGPRS.Incremental redundancy,is packets transmitted first with maximum error protection and data rate throughput,but subsequent packets are transmitted with less error protection and less throughput.If all 8 time slots are dedicated to EDGE,raw peak throughput data rate of 547.2kbps can be provided.

IS-95B for 2.5 CDMA

IS-95B provides high speed packet and circuit switched data access on a common CDMA radio channel by dedicating multiple orthogonal user channels(Walsh function).IS-95B supports medium data rate(MDR) service by allowing a dedicated user to command up to 8 different user Walsh code simultaneously and in parallel throughput of 115.2kbps per user(8 x 14.4kbps).IS-95B also specifies hard hand off procedure that allow subscriber unit to search different radio channels in the network with out instruction from the switch,and maintain link quality.

Wednesday, January 2, 2008

My Linux trainning

Exiting vi tutor

Press esc then enter

:q -Quit VI. If there have been changes made, the editor will issue a warning message.
:q! -Quit VI without saving changes.
:w -Write out the current file.
:w filename -Write the buffer to the filename specified.
:w >> filename -Append the contents of the buffer to the filename.
:wq -Write the buffer and quit.

Reset root password


  • Reboot the machine
  • Press e to edit the commands before booting, at Red Hat Enterprise Linux ES (2.6.9-22.EL)
  • The entered to the GNU GRUB,where I got three options.
1.root(hd0,0)
2.kernel
3.intitrd
  • Choose kernel and select e to edit.In the grub edit place 1 in the end and enter.
kernel /vmlinuz-2.6.9-22.EL ro root=LABEL=/ rhgb quiet 1
  • then press b for boot from there.
  • I entered to the shell mode,enter passwd there
sh-3.00# passwd
changing password for user root.
New UNIX password:

Auto Mount

Auto mount is useful for nfs, samba, and boot mounts/partitions. Think of having file exist on a central nfs capable server and all of your client machines are then able to automatically mount that file whenever you access them.If the filesystem is unmounted, and a user attempts to access it, it will be automatically (re)mounted. This is especially useful in large networked environments and for crossmounting filesystems between a few machines.
Autofs master configuration file lists one or more directories to take control over. This directory (mount point) will be controlled by the autofs daemon.Each line in the master configuration file gives autofs a mount point,can add any number of mount points, but we will only need one.

#ls /etc/auto* :main file is /etc/auto.master
#vi /etc/auto.master
auto.today --timeout=1s
#vi /etc/auto.today
autodir -fstype=etc3 :/dev/hda14
#service autofs restart


#cd /fsat
#ls
#mount :to check mounting
#ls autodir :auto mount happens
#ls :files can be seen .but after 1s seconds,if no activity happens it will get auto unmounted.Check with date command


#vi /etc/exports
#service nfs restart

use of auto mount

Allow non root people to mount files (specially CD roms)

eg: Host 192.168.10.224 has linux rpm package available in /var/ftp/pub (nfs enabled)
arrange auto mount the above directory as /fsat/pkgs

pkgs -fsat=nfs 192.168.10.224:/var/ftp/pub

How to add a disk file to swap

create a file with a required size.
#dd if=/dev/zero(input file) of=/tmp/myswap(output file) bs=1024k(block size) count=10(10 blocks)
#od -c /tmp/myswap | less
#mkswap /tmp/myswap
#swapon /tmp/myswap
#swapon -s


#useradd :create a new user
#id hnd
#tail /etc/passwd

#newgp :create a new group
#chown hnd /newdir :change the ownership of the new directory to the new user.Inlinux to change the ownership we should be a super user

#groupadd sand :to add a group with out a user
#usermod -g sands hnd :to see how arguments are given just type usermod and enter

#chgrp sands newdir

Allocating user disk quotas

To use quota, file system must be mounted with quota option
#mount -o userquota /dev/hda11 /home/mynewdir
#qutacheck -c /home/mynewdir
#qutaon /home/mynewdir
#usemod -d /home/mynewdir/hnd -m hnd :just changing the home directory
#edquota hnd
#repquota /home/mynewdir :to see
#dv :disk usage


MIrroring

Write the same thiing to both disks,both have same image.
create 2 50 MB partitions hda12 and hda13
:fd linux raid autodetect

#mdadm -C(create) /dev/md0 -l | -n 2(no of devices) /dev/hda12 /dev/hda13
#ls -l /dev/md0 : created
#mdadm --details /dev/md0
#mkfs.ext3 /dev/md0
#mount /dev/md0 /mnt
#mdadm --manage /dev/md0 -f /dev/hda13 :creating a faulty disk
#mdadm -D /dev/md0 :to display
#mdadm -S /dev/md0 :to stop
#mdadm -r /dev/md0 :to remove
the mirror divice is /dev/md0
#mdadm --manage /dev/md0 -a /dev/hda13 :adding another partion hda13


Logical volumes

iF disk 1 has 500MB free available and disk 2 has 300 MB available,in LVM by combining two we can have 800 MB space.

creating a logical volume
:t
:8e
:w

#pvcreate /dev/hda14 /dev/hda15 :physical volume create
#vgcreate vg0 /dev/hda14 /dev/hda15 :volume group creation
#vgdisplay
#lvcreate -L(length) 56m(size) -n(name) lv1 vg0(from)
this created logical volumegoes to /dev/mapper/vg0 -lv1 created from /dev/vg0/lv1

#lvdisplay
#mkfs.ext3 /dev/vg0/lv1
#mount /dev/vg0/lg1 /mnt
#df -h

#lvexpand -L +16m /dev/vg0/lv1 :expanding lv1
#df -h
#ext2online /dev/vg0/lv1 :start using expanded area

Removing

#lvremove /dev/vg0/lv1
#vgremove vg0
#pvremove /dev/hda14
#pvremove /dev/hda15