Sunday, January 18, 2009

my sql

Creating a table
mysql> create table guests (autoID,int unsigned,auto_increment)
mysql> insert into guests VALUES (NULL, 'ádam','pop',46) same order as the fields created.
date is typed as "1990-03-05" year,month,day
to delete a table
mysql> drop table {table_nm};
to display the table:-
mysql> select * from guests;
mysql> update guests SET last_name="xyz123" WHERE autoID=1;

MYSQL ADMIN tasks

monitoring status of database server, uptime etc

mysql>status;

Show the databases mounted:-

mysql>show databases;

Create a database

mysql>create database {name};

use a database i.e., use the databse to create tables in it:-

mysql> use {database_name};

Delete a database:-

mysql> drop database {database_name};

Show tables in a database:-

mysql>show tables;

Show the fields in a table:-

mysql> describe {table_name};

Saturday, January 17, 2009

working with debian distro

1. TO LIST ALL DRIVES INSTALLED IN THE SYSTEM
Type the following at prompt:-
/sbin/fdisk -l
The fdisk file is in sbin directory of root.
2. Mounting NTFS & FAT file systems
Mounting is a process where a filesystem is mounted to a particular folder in the system.
(a) NTFS
1. Create a folder /windows/c in media folder in root directory (sudo mkdir /media/windows/c)
2. mount /dev/ windows/c -t ntfs -o nls=utf8,umask=0222
(b) FAT32
1. Create a folder /windows/d in media folder in root directory (sudo mkdir /media/windows/d)
2. mount /dev/ windows/d

Estimating Number of cylinders for a partition based on size estimate

Disk Basics
1.Track: The circular track on a disk
2.Geometric Sector: the Sector made by two radii intersecting all the tracks in the disk from the centre of the disk.
3.Track Sector: The intersection of two geometric radii on the same track which is a part of the geometirc sector is called a track sector.
4. Size of sector:- The size of sector for magnetic disks is 512 bytes and for optical media is normally 2048 bytes.
5. Clusters :- A collection of geometric sectors make a cluster for a filesystem. The cluster may not be comprised of continous sectors. The cluster size defines the least amount of size defined by the filesystem while creating the file.

The basic info while starting fdisk to partition a hard drive may be given in the manner shown below:-
64 heads,32 sectors
Which means there are 32 platters and each platter has a head on top and bottom,therefore, 64 heads and each platter(single side) contributes 32 sectors to a cylinder.
A cylinder is formed by taking one sector on each platter (above and below).
Total no of sectors in a cylinder= No of sectors contributing to a cylinder in the platter * No of platters
32 * 32 * 2= 2048 sectors
We have multiplied by 2 as platter has sectors both above and below.
Another statement in Fdisk is “capacity is cylinders of 2048 X 512 bytes
The above statement indicates that each sector can store 512 bytes. This can also be called as block size and each cylinder contains 2048 sectors. Therefore, each cylinder can store 2048* 512=1048576 bytes

Partition of the drive is done in cylinders . Fdisk also reports that the total no. of cylinders available is 8682. Therefore, if we want swap space of 128 MB, the number of cylinders required would be :-
128 * 1024*1024/1048576=128 cylinders.
Out of 8682 cylinders, 128 would be kept for swap, therefore, for root we have 8682-128=8554 cylinders

Therefore, for a disk with SGI label, The picture before root and swap partitions are created would be :-
Partition # Start End Description
9 0 1 SGI volhdr
11 0 8682 SGI volume

Now, we create partition # 1 (root) and Partition No 2 (swap) using 8554 cylinders and 128 cylinders respectively

Partition # Start End Description
9 0 1 SGI volhdr
11 0 8682 SGI volume
1 2 8554 Linux
2 8555 8682 Swap

TV Tuner on windows choice for capture and viewing

Video for windows (VFW) may be accessed from two drivers:-
1. Traditional (for viewing) This driver delivers good picture quality but has problems while doing capture.
2. New (for capture) :- This driver is primarily for capture. capture is smooth and I have captured hours of tv program using this.
Notice the difference between the dialog boxes for choosing the various options, like say the video source etc between these two drivers.
The video for windows vfw drivers can be changed from the WinVDR options menu.
For viewing the video, you can use either the preview or overlay option. The overlay option uses much less CPU than the preview. So, overlay is the better choice.

Friday, January 9, 2009

installing linux on existing NTFS windows XP

I had a Windows PC with two partitions:-
1. 40 GB NTFS (pri )
2. 40 GB FAT (logical drive on ext )
I am currently using this PC to watch TV. The specs aren't too great, Celeron 1 Ghz Coppermine, 256 MB SDRAM (133 Mhz ) Vintron Intel 810e board, and 80 GB IDE HDD.
Windows XP used to run quite slow on the PC, it was managable, if no multiple windows were open. The only problem in mind was a doubt as to whether the tv tuner card would work in linux. This was the reason I had postponed installation.
However, one day while browsing the net I found that the chipset used in TV tuner card Bt 878 was supported in debain, I decided to upgrade to linux. Now, I had another dilemma..how to keep the existing windows and make a dual boot system.

Dual Boot to Windows

I googled and found this page http://www.nishants.net/articles/ntfsresize.htm . He has neatly mentioned the process. I must say google is a real help. hats off to the people who perfected the search algorithm! My Plan was to install Ubuntu Linux which is a debain based distro. The idea as described in nishant's site was to first 'shrink' the existing windows NTFS partition and then carve out free space for the linux installation. To shrink the partition, and carve out maximum space, i literally emptied my C:\ drive and degragmented it. The idea was to use UBUNTU live CD to do this task. However, ubuntu does not have support for NTFS filesystem. So, two debain packages called libntfs5_1.9.0-1_i386.deb and ntfstools_1.9.0-1_i386.deb were required, once again I googled and found the files, these two files, I copied to the C:\ drive.

Next, I booted using the UBuntu live CD and followed the instructions as given in nishant's site. I could shrink my windows installation to 25 GB as I had desired. This had earmarked around 17 GB of free space for Linux install.

Realizing the Free Space

One more step was necessary however, before this free space was realized. For this I reguired a partition tool. I choose sfdisk. downloaded it (again using google) and made a bootable CD. I booted using this CD and the partition manager launched automatically. The parition manager warned me that there was some error regarding the number of sectors and the space allocated to the volume and whether I wanted to correct it. I clicked yes and immediately, the partition manager showed the free space along with the resized primary partition. The existing logical drive in extended FAT32 partition was also shown. I saved changes, inserted the Ubuntu setup CD and rebooted.

Setting Up UBuntu

I followed the instructions contained in http://ca.geocities.com/zachandloricox@rogers.com/ubuntu/windowsxp.html . Another nice site with all screenshots. The main steps involved were:-

1. select the free space to install ubuntu

2. Select the Automatically Partition the space option

3. Install grub boot loader ( this will show up the boot menu during boot to select between windows and ubuntu OS)

As the installation progressed, I was asked whether I wanted to download the latest packages from ubuntu, i did that, and my installation was being updated online. This is a cool feature.

Now, my next step would be to make my tv tuner card work. This would be dealt in a seperate post! I welcome myself to the Linux World!