Thursday, December 30, 2010

linux device driver intros from veda hyd

Linux device driver intro 1

Linux device driver intro 2

Linux device driver intro 3

Friday, November 26, 2010

Directory watcher

Directory watcher will update update.txt file with what are the file or directories removed or added from previous run of script.

This is totally shell script.
First copy with dir_watcher name and give execution permissions and run as "./dir_watcher dir_path"

For the first time runs. It takes snapshot of ur directory structure which was provided in cmd.
When second time runs it will take snapshot of directory and if any new files or dir are added then those updates will be written in to update.txt in parent directory.
If dir path not mentioned it will take present dir.

Note:- It won't give information of updated files.
Put this script in crontab so it will run periodically and updates log file with changes.
ex:- 0 12 * * * sh /bin/dir_watcher /home/balu/project/
So, every day at 12 noon it will run and updates the update.txt file in "/home/balu/project/"

Wednesday, November 3, 2010

Use cmd line arguments for expect script.

Below I have given a small example to get a file from ftp server. This code was written using expect.
Usage:- HOST PROMPT$ expect ftp_get_file.exp < IP > < user_name > < password > < file_to_get >

#!/usr/bin/expect -f < IP >
set ip [lrange $argv 0 0]
set username [lrange $argv 1 1]
set password [lrange $argv 2 2]
set file [lrange $argv 3 3]
set timeout -1
#Spwan the Cfm1 Util stub
spawn ftp $ip
expect ":"
send -- "$username\r"
sleep 1
expect "Password:"
send -- "$password\r"
sleep 2
expect ">"
send -- "bi\r"
sleep 1
expect ">"
send -- "ha\r"
sleep 1
expect ">"
send -- "mget $file\r"
sleep 2
expect "?"
send -- "y\r"
sleep 1
expect ">"
send -- "by\r"
sleep 1
expect eof

NOTE:- If ur password contain any special character then use "\" in front of those characters.

Friday, October 8, 2010

Expect scritp runs multiple cmds taking as a variable

Hi as part of unit testing i have written a expect script that expects same things but i need to send some list of cmds. For the first time i have written in the sequence of expect, send, sleep and then for the second and go on. But script is very lengthy if i want to see execution flow of cmds i need to scroll down to entire script.
So i find an alternate solution where i kept all my cmds in one varible and split on newline (i used newline, can be changed) and send these cmds one by one using for.
Below script is small example which will explain what i have done. Pretty simple logic and very basic too.
Have a look......

#!/usr/bin/expect -f
set data "ls
cd ..
cd ..
cd /etc
cd /home/baluenigma

#Spwan the Cfm1 Util stub
spawn /bin/bash
match_max 100000

foreach line [split $data \n] {
expect "[baluenigma@ *]#"
send -- "$line\r"
sleep 1

Above data is varible which holds all cmds which need to be executed.
Foreach is used to read data varible and split on newline char and line varible takes that value. Now expect cmd expects "[baluenigma@ *]#" here '*' used because pwd will change when i used cd cmds which are in data variable.

Tuesday, October 5, 2010

Flv to 3gp converter

First of all I was installed ffmpeg on my centos 5.1 using yum.
If you don't have then simply run "yum install ffmpeg*".
Now to convert flv into 3gp, ffmpeg should contain h263 vedio codes generally it has and amrnb audio codes. In my case i don't have this audio code which was downloaded. Compiled and installed without any problem.
Create a file /bin/fl23gp and write below code.
echo "flv 2 3gb Convertion"
echo ""
if (($# ==0))
echo "Usage: flvto3gp [flv files] ..."

while (($# !=0 ))
ffmpeg -i $1 -s 176x144 -vcodec h263 -r 25 -b 200 -ab 6.7k -sameq -acodec libopencore_amrnb -ac 1 -ar 8000 ${1//.flv/.3gp}
echo "Finished flv-to-3gp convertion"
echo "\" Enjoy \""
echo ""
Run "chmod 777 /bin/flv23gp" .

"ffmpeg -formats | grep amr" will return what are audio codes preset with amr. Which was mentioned in /bin/flv3mp3 file for -acodec as "libopencore_amrnb" .

Thursday, August 26, 2010

Including IP address of your pc in linux prompt

When working remote machine using teminals it some times make quite confusing which teminal is connected to which machine. One way is setting tittle to teminal makes confortable but we can make linux prompt to display IP dynamic by adding code in /etc/bashrc.

Code :-

#------ display ip in prompt -----
#Generally eth0 interface is used
ip=`ifconfig eth0 2>/dev/nul |grep "inet addr" | cut -d ':' -f2| cut -d ' ' -f1`
#echo "--$ip--"
if [ -z $ip ]
#If not eth0 check for eth1
ip=`ifconfig eth1 2>/dev/nul |grep "inet addr" | cut -d ':' -f2| cut -d ' ' -f1`
#echo "--$ip--"
if [ -z $ip ]
# Both interfaces are not available
#`PS1="[\u@\$ip \W]\$"`
#export PS1="[\u@\$ip \W]\$"
user_id=`id -u`
if [ $user_id -eq "0" ]
#for root users

export PS1="[\u@\$ip \W]# "
#For normal users
export PS1="[\u@\$ip \W]\$ "

Add above code in /etc/bashrc. Open new terminal to see the change.

In above i have useded eth0 and eth1 interfaces only because most PCs uses it. we can chane it to ath0 or ath1 or wlan0 depending on ur requirement.

Wednesday, July 28, 2010

Code to display your pc ip in linux prompt

Usually i do ssh connections to 2 or more machines. While switching form one teminal to other i use ifconfig to find to which pc it connected or i use to set title for teminals manully. But I feel there should be something else i can do, thought of putting ip in prompt itslef.

i have add code mentioned below in /etc/bashrc to effect it for all users.

#------ display ip in prompt -----
#Generally eth0 interface is used
ip=`ifconfig eth0 2>/dev/null |grep "inet addr" | cut -d ':' -f2| cut -d ' ' -f1`
#echo "--$ip--"
if [ -z $ip ]
#If not eth0 check for eth1
ip=`ifconfig eth1 2>/dev/null |grep "inet addr" | cut -d ':' -f2| cut -d ' ' -f1`
#echo "--$ip--"
if [ -z $ip ]
# Both interfaces are not available
#`PS1="[\u@\$ip \W]\$"`
#export PS1="[\u@\$ip \W]\$"
user_id=`id -u`
if [ $user_id -eq "0" ]
#for root users
export PS1="[\u@\$ip \W]# "
#For normal users
export PS1="[\u@\$ip \W]\$ "
#----- end ---

Tuesday, June 22, 2010

Ostinato packet generater

If your looking for GUI based packet generator then Ostinato is one of the best option.
Just have a look at this video explains Ostinato how to ....

For further details click here

Tuesday, June 15, 2010

Installation of bugzilla on centos 5.1

Take backup from server(For bugzilla ugrading) :
In server take mysql backup
mysqldump -u user_name -p user_passwd bugs > bugs_backup.spl
`bugs_backup.spl` file contains all bugzilla bugs backup.

Mysql Configuration:
yum install mysql mysql-devel mysql-server

chech mysql is running or not. if not runing /etc/init.d/mysqld start

/usr/bin/mysqladmin -u admin_user password 'admin_password'
mysql -u root_user -p root_passwd
mysql>CREATE USER 'bugs'@'localhost' IDENTIFIED BY 'bugzilla_db_passwd';
mysql>create database bugs;
mysql> show databases;
mysql> GRANT ALL ON *.* TO bugs@localhost IDENTIFIED BY "bugzilla_db_passwd";

Now bugs database i created and a dbuser created with name 'bugs' for bugzilla access.
Bugzilla Installation:
mkdir /bugs

download bugzilla latest version (here i used bugzilla 3.2 version)
mv bugzilla-3.2.tar.gz /bugs

yum install gd-devel
yum install ImageMagick-perl ImageMagick-devel

perl -MCPAN -e 'install "Bundle::Bugzilla"' (Follow bellow steps. if any options is not mentioned for inputs just press enter)

Are you ready for manual configuration? [yes] yes
CPAN build and cache directory? [/home/] /bugs
(1) Africa
(2) Asia
(3) Australasia
(4) Central America
(5) Europe
(6) North America
(7) Oceania
(8) South America
Select your continent (or several nearby continents) [] 4
Select as many URLs as you like (by number),
put them on one line, separated by blanks, e.g. '1 4 5' [] 1

perl ./ --check-modules (install all required modules)

Enter a username to be validated: root_user
Enter this user's password: root_password

perl ./ --check-modules (run 2 or 3 times check all modules installed)
perl ./

Bugzilla Configutration:
in vi /bugs/bugzilla-3.2/localconfig check for following fields
$create_htaccess = 1;
$webservergroup = 'user_group';
$db_driver = 'mysql';
$db_host = 'localhost';
$db_name = 'bugs';
$db_user = 'bugs';
$db_pass = 'bugzilla_db_passwd';
(other thing leave as it is)

perl ./
Enter the e-mail address of the
Enter the real name of the administrator: bug_admin
Enter a password for the administrator account: bug_passwd
Please retype the password to verify: bug_passwd

added mysql user to user_group
vi /etc/httpd/conf/httpd.conf (at the end add the following lines)
Alias /bugs /bugs/ui/bugzilla-3.2

AuthType Basic
AuthName "bugzilla Repository"
AuthPAM_Enabled on
Require group ocusers
Require valid-user
AddHandler cgi-script .cgi
Options +Indexes +ExecCGI
DirectoryIndex index.cgi
AllowOverride Limit


Thursday, June 3, 2010

network packets headers

Ethernet packet header

IP header

TCP header

UDP header
802.11 wifi Header

VLAN header

VxLan Header

youtube downloader

#!/usr/bin/env python
# Copyright (c) 2006-2008 Ricardo Garcia Gonzalez
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
# Except as contained in this notice, the name(s) of the above copyright
# holders shall not be used in advertising or otherwise to promote the
# sale, use or other dealings in this Software without prior written
# authorization.
import getpass
import httplib
import math
import netrc
import optparse
import os
import re
import socket
import string
import sys
import time
import urllib2

# Global constants
const_1k = 1024
const_initial_block_size = 10 * const_1k
const_epsilon = 0.0001
const_timeout = 120

const_video_url_str = ''
const_video_url_re = re.compile(r'^((?:http://)?(?:\w+\.)?youtube\.com/(?:v/|(?:watch(?:\.php)?)?\?(?:.+&)?v=))?([0-9A-Za-z_-]+)(?(1)[&/].*)?$')
const_login_url_str = ''
const_login_post_str = 'current_form=loginForm&next=%%2Fwatch%%3Fv%%3D%s&username=%s&password=%s&action_login=Log+In'
const_age_url_str = ''
const_age_post_str = 'next_url=%%2Fwatch%%3Fv%%3D%s&action_confirm=Confirm'
const_url_t_param_re = re.compile(r', "t": "([^"]+)"')
const_video_url_real_str = ''
const_video_title_re = re.compile(r'<title>YouTube - ([^<]*)</title>', re.M | re.I)

# Print error message, followed by standard advice information, and then exit
def error_advice_exit(error_text):
    sys.stderr.write('Error: %s.\n' % error_text)
    sys.stderr.write('Try again several times. It may be a temporary problem.\n')
    sys.stderr.write('Other typical problems:\n\n')
    sys.stderr.write('* Video no longer exists.\n')
    sys.stderr.write('* Video requires age confirmation but you did not provide an account.\n')
    sys.stderr.write('* You provided the account data, but it is not valid.\n')
    sys.stderr.write('* The connection was cut suddenly for some reason.\n')
    sys.stderr.write('* YouTube changed their system, and the program no longer works.\n')
    sys.stderr.write('\nTry to confirm you are able to view the video using a web browser.\n')
    sys.stderr.write('Use the same video URL and account information, if needed, with this program.\n')
    sys.stderr.write('When using a proxy, make sure http_proxy has http://host:port format.\n')
    sys.stderr.write('Try again several times and contact me if the problem persists.\n')

# Wrapper to create custom requests with typical headers
def request_create(url, data=None):
    retval = urllib2.Request(url)
    if data is not None:
    # Try to mimic Firefox, at least a little bit
    retval.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071127 Firefox/')
    retval.add_header('Accept-Charset', 'ISO-8859-1,utf-8;q=0.7,*;q=0.7')
    retval.add_header('Accept', 'text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5')
    retval.add_header('Accept-Language', 'en-us,en;q=0.5')
    return retval

# Perform a request, process headers and return response
def perform_request(url, data=None):
    request = request_create(url, data)
    response = urllib2.urlopen(request)
    return response

# Conditional print
def cond_print(str):
    global cmdl_opts
    if not (cmdl_opts.quiet or cmdl_opts.get_url):

# Title string normalization
def title_string_norm(title):
    title = ''.join((x in string.ascii_letters or x in string.digits) and x or ' ' for x in title)
    title = '_'.join(title.split())
    title = title.lower()
    return title

# Generic download step
def download_step(return_data_flag, step_title, step_error, url, post_data=None):
        cond_print('%s... ' % step_title)
        data = perform_request(url, post_data).read()
        if return_data_flag:
            return data
        return None

    except (urllib2.URLError, ValueError, httplib.HTTPException, TypeError, socket.error):

    except KeyboardInterrupt:

# Generic extract step
def extract_step(step_title, step_error, regexp, data):
        cond_print('%s... ' % step_title)
        match =
        if match is None:
        extracted_data =
        return extracted_data
    except KeyboardInterrupt:

# Calculate new block size based on previous block size
def new_block_size(before, after, bytes):
    new_min = max(bytes / 2.0, 1.0)
    new_max = max(bytes * 2.0, 1.0)
    dif = after - before
    if dif < const_epsilon:
        return int(new_max)
    rate = bytes / dif
    if rate > new_max:
        return int(new_max)
    if rate < new_min:
        return int(new_min)
    return int(rate)

# Get optimum 1k exponent to represent a number of bytes
def optimum_k_exp(num_bytes):
    global const_1k
    if num_bytes == 0:
        return 0
    return long(math.log(num_bytes, const_1k))

# Get optimum representation of number of bytes
def format_bytes(num_bytes):
    global const_1k
        exp = optimum_k_exp(num_bytes)
        suffix = 'bkMGTPEZY'[exp]
        if exp == 0:
            return '%s%s' % (num_bytes, suffix)
        converted = float(num_bytes) / float(const_1k**exp)
        return '%.2f%s' % (converted, suffix)
    except IndexError:
        sys.exit('Error: internal error formatting number of bytes.')

# Calculate ETA and return it in string format as MM:SS
def calc_eta(start, now, total, current):
    dif = now - start
    if current == 0 or dif < const_epsilon:
        return '--:--'
    rate = float(current) / dif
    eta = long((total - current) / rate)
    (eta_mins, eta_secs) = divmod(eta, 60)
    if eta_mins > 99:
        return '--:--'
    return '%02d:%02d' % (eta_mins, eta_secs)

# Calculate speed and return it in string format
def calc_speed(start, now, bytes):
    dif = now - start
    if bytes == 0 or dif < const_epsilon:
        return 'N/A b'
    return format_bytes(float(bytes) / dif)

# Title string minimal transformation
def title_string_touch(title):
    return title.replace(os.sep, '%')

# Create the command line options parser and parse command line
cmdl_usage = 'usage: %prog [options] video_url'
cmdl_version = '2008.01.24'
cmdl_parser = optparse.OptionParser(usage=cmdl_usage, version=cmdl_version, conflict_handler='resolve')
cmdl_parser.add_option('-h', '--help', action='help', help='print this help text and exit')
cmdl_parser.add_option('-v', '--version', action='version', help='print program version and exit')
cmdl_parser.add_option('-u', '--username', dest='username', metavar='USERNAME', help='account username')
cmdl_parser.add_option('-p', '--password', dest='password', metavar='PASSWORD', help='account password')
cmdl_parser.add_option('-o', '--output', dest='outfile', metavar='FILE', help='output video file name')
cmdl_parser.add_option('-q', '--quiet', action='store_true', dest='quiet', help='activates quiet mode')
cmdl_parser.add_option('-s', '--simulate', action='store_true', dest='simulate', help='do not download video')
cmdl_parser.add_option('-t', '--title', action='store_true', dest='use_title', help='use title in file name')
cmdl_parser.add_option('-l', '--literal', action='store_true', dest='use_literal', help='use literal title in file name')
cmdl_parser.add_option('-n', '--netrc', action='store_true', dest='use_netrc', help='use .netrc authentication data')
cmdl_parser.add_option('-g', '--get-url', action='store_true', dest='get_url', help='print final video URL only')
cmdl_parser.add_option('-2', '--title-too', action='store_true', dest='get_title', help='used with -g, print title too')
(cmdl_opts, cmdl_args) = cmdl_parser.parse_args()

# Set socket timeout

# Get video URL
if len(cmdl_args) != 1:
video_url_cmdl = cmdl_args[0]

# Verify video URL format and convert to "standard" format
video_url_mo = const_video_url_re.match(video_url_cmdl)
if video_url_mo is None:
    sys.exit('Error: URL does not seem to be a youtube video URL. If it is, report a bug.')
video_url_id =
video_url = const_video_url_str % video_url_id

# Check conflicting options
if cmdl_opts.outfile is not None and (cmdl_opts.simulate or cmdl_opts.get_url):
    sys.stderr.write('Warning: video file name given but will not be used.\n')

if cmdl_opts.outfile is not None and (cmdl_opts.use_title or cmdl_opts.use_literal):
    sys.exit('Error: using the video title conflicts with using a given file name.')

if cmdl_opts.use_title and cmdl_opts.use_literal:
    sys.exit('Error: cannot use title and literal title at the same time.')

if cmdl_opts.quiet and cmdl_opts.get_url:
    sys.exit('Error: cannot be quiet and print final URL at the same time.')

# Incorrect option formatting
if cmdl_opts.username is None and cmdl_opts.password is not None:
    sys.exit('Error: password give but username is missing.')

if cmdl_opts.use_netrc and (cmdl_opts.username is not None or cmdl_opts.password is not None):
    sys.exit('Error: cannot use netrc and username/password at the same time.')

if cmdl_opts.get_url is None and cmdl_opts.get_title is not None:
    sys.exit('Error: getting title requires getting URL.')

# Get account information if any
account_username = None
account_password = None

if cmdl_opts.use_netrc:
        info = netrc.netrc().authenticators('youtube')
        if info is None:
            sys.exit('Error: no authenticators for machine youtube.')
        account_username = info[0]
        account_password = info[2]
    except IOError:
        sys.exit('Error: unable to read .netrc file.')
    except netrc.NetrcParseError:
        sys.exit('Error: unable to parse .netrc file.')
    account_username = cmdl_opts.username
    if account_username is not None:
        if cmdl_opts.password is None:
            account_password = getpass.getpass('Type YouTube password and press return: ')
            account_password = cmdl_opts.password

# Get output file name
if cmdl_opts.outfile is None:
    video_filename = '%s.flv' % video_url_id
    video_filename = cmdl_opts.outfile

# Install cookie and proxy handlers

# Log in and confirm age if needed
if account_username is not None:
    url = const_login_url_str % video_url_id
    post = const_login_post_str % (video_url_id, account_username, account_password)
    download_step(False, 'Logging in', 'unable to log in', url, post)

    url = const_age_url_str % video_url_id
    post = const_age_post_str % video_url_id
    download_step(False, 'Confirming age', 'unable to confirm age', url, post)

# Retrieve video webpage
video_webpage = download_step(True, 'Retrieving video webpage', 'unable to retrieve video webpage', video_url)

# Extract video title if needed
if cmdl_opts.use_title or cmdl_opts.use_literal or cmdl_opts.get_title:
    video_title = extract_step('Extracting video title', 'unable to extract video title', const_video_title_re, video_webpage)

# Extract needed video URL parameters
video_url_t_param = extract_step('Extracting URL "t" parameter', 'unable to extract URL "t" parameter', const_url_t_param_re, video_webpage)
video_url_real = const_video_url_real_str % (video_url_id, video_url_t_param)

# Rebuild filename if needed
if cmdl_opts.use_title or cmdl_opts.use_literal:
    if cmdl_opts.use_title:
        prefix = title_string_norm(video_title)
        prefix = title_string_touch(video_title)
    video_filename = '%s-%s.flv' % (prefix, video_url_id)

# Check name
if not video_filename.lower().endswith('.flv'):
    sys.stderr.write('Warning: video file name does not end in .flv\n')

# Retrieve video data
    cond_print('Requesting video file... ')
    video_data = perform_request(video_url_real)
    cond_print('Video data found at %s\n' % video_data.geturl())

    if cmdl_opts.get_title:
        print video_title

    if cmdl_opts.get_url:
        print video_data.geturl()

    if cmdl_opts.simulate or cmdl_opts.get_url:

        video_file = open(video_filename, 'wb')
    except (IOError, OSError):
        sys.exit('Error: unable to open "%s" for writing.' % video_filename)
        video_len = long(['Content-length'])
        video_len_str = format_bytes(video_len)
    except KeyError:
        video_len = None
        video_len_str = 'N/A'

    byte_counter = 0
    block_size = const_initial_block_size
    start_time = time.time()
    while True:
        if video_len is not None:
            percent = float(byte_counter) / float(video_len) * 100.0
            percent_str = '%.1f' % percent
            eta_str = calc_eta(start_time, time.time(), video_len, byte_counter)
            percent_str = '---.-'
            eta_str = '--:--'
        counter = format_bytes(byte_counter)
        speed_str = calc_speed(start_time, time.time(), byte_counter)
        cond_print('\rRetrieving video data: %5s%% (%8s of %s) at %8s/s ETA %s ' % (percent_str, counter, video_len_str, speed_str, eta_str))

        before = time.time()
        video_block =
        after = time.time()
        dl_bytes = len(video_block)
        if dl_bytes == 0:
        byte_counter += dl_bytes
        block_size = new_block_size(before, after, dl_bytes)

    if video_len is not None and byte_counter != video_len:
        error_advice_exit('server did not send the expected amount of data')

    cond_print('Video data saved to %s\n' % video_filename)

except (urllib2.URLError, ValueError, httplib.HTTPException, TypeError, socket.error):
    error_advice_exit('unable to download video data')

except KeyboardInterrupt:

# Finish

Socket programing


Linux Perf and Tuning Guidelines from IBM


Thursday, May 27, 2010

Installing OS in VMware and accessing from VM Client


Download VMware vsphere client and install on windows machine. You may get error with .NET framework upgrade it 2.0 will resolve the issue.


Connect to ESX4.0 server using browse it will have a link to download VMware Vsphere client, download and install it.

Now Open the VMsphere client provide server IP and user/password credentials.

Install new OS in VMware:-

Now VMware VMsphere client will open. Page looks like

Right click on IP as shown in image and select “new virtual machine”.

Now click on next button. If any specific system require are preset then choose “custom”. I choose “Typical” and then next.

Now provide name for image. Here “centos_second” name was chosen.

Now simply click on next button.

Here select the type of OS is going to be installed. Centos is comes under linux and the version dropdown selected as “Other Linux (32-bit).

Virtual disk size should provide how much space required OS and workspace. Click on next .

Now select the “Edit the…” check box and click on continue.

Select the New CD/DVD (adding) from left panel. On right side select one of the options for device type.

Client device:- If Installation source DVD is at client machines drive , select client machine .

Host device:- If Installation source DVD is at servers drive, select “Host Device” automatically gets the location.

Datastore ISO:- Select the location of ISO image location in sever.

Click on finish button.

Now in the left panel, there will be VM image point for Centos with name what earlier provided.

See the below screenshot,

Right click on the point created with name specified earlier and move mouse over the power option and select power on option.

Now status of the operation will show at the bottom panel (Not shown in screenshot).

Again right click on the CENTOS_51 and select “Open console” to open terminal.

In terminal see the booting operation, if booting sequence is not in the order that you specified where source of installation (image) then change the boot sequence.

To change boot sequence click alt+ctrl+insert to reboot the machine and press “f2” or correspond key to enter in to boot sequence and change the boot sequence, save and exit.

Now system boot from DVD or image. From her onwards road will be clear as simple as normal installation. After installation normal GUI comes and do your operation. Do power off from right option where we use to power on the OS.

If already one instance is installed with centos_1 and need to install same OS with same configuration say centos_2.

Now the procedure is:- Assumed that centos_1 is installed and working fine. Now create instance with centos_2 from “New Virtual Machine” option after finished this. Installing OS from CD or DVD.

SSH to VMware server and go to source directory where all vmdk files will be stored file will be centos_1/centos_1-flat.vmdk and size will be same as size mentioned while installing copy this file into centos_2/ this directory and rename to centos_2-flat.vmdk.

Now from client power on the centos_2 it will straightaway works.

Tuesday, May 25, 2010

Testing and types of testing

Software Testing:-
It is the process used to help identify the correctness, completeness, security and quality of developed computer software.
Basically testing is of two types say black box and white box

Black box testing:-

Black box being an external view of the test object.
Types of black box testing
I)functional testing:- In this type of testing, the software is tested for the functional requirements. The tests are written in order to check if the application behaves as expected. Although functional testing is often done toward the end of the development cycle, it can and should, be started much earlier. Individual components and processes can be tested early on, even before it's possible to do functional testing on the entire system. Functional testing covers how well the system executes the functions it is supposed to execute including user commands, data manipulation, searches and business processes, user screens, and integrations. Functional testing covers the obvious surface type of functions, as well as the back-end operations (such as security and how upgrades affect the system).
II)Stress testing:- Stress test is repeated until a level of stress is reached that is higher than expected to be present at a customer site. Race conditions and memory leaks are often found under stress testing.
III) Load testing :- Load testing does not aim to break the system by overwhelming it, but instead tries to keep the system constantly humming like a well-oiled machine.
IV) Ad-hoc:-This type of testing is done without any formal Test Plan.
V)Exploratory testing:- This testing is similar to the ad-hoc testing and is done in order to learn/explore the application. Yet it doesn't get much respect in our field. It can be considered as “Scientific Thinking” at real time
VI)Usability testing:- This testing is also called as ‘Testing for User-Friendliness’. This testing is done if User Interface of the application stands an important consideration and needs to be specific for the specific type of user.
VII) Smoke test:- This type of testing is also called sanity testing and is done in order to check if the application is ready for further major testing.
VIII)Recovery test:- Recovery testing is basically done in order to check how fast and better the application can recover against any type of crash or hardware failure etc.
IX)Volume test:- Volume testing is done against the efficiency of the application. Huge amount of data is processed through the application (which is being tested) in order to check the extreme limitations of the system.
X)Domain test:- Domain testing is the most frequently described test technique. Some authors write only about domain testing when they write about test design. The basic notion is that you take the huge space of possible tests of an individual variable and subdivide it into subsets that are (in some way) equivalent. Then you test a representative from each subset.
XI)Scenario test:- Scenario tests are realistic, credible and motivating to stakeholders, challenging for the program and easy to evaluate for the tester. They provide meaningful combinations of functions and variables rather than the more artificial combinations you get with domain testing or combinatorial test design.
XII)Regression test:- Regression testing is a style of testing that focuses on retesting after changes are made. In traditional regression testing, we reuse the same tests (the regression tests). In risk-oriented regression testing, we test the same areas as before, but we use different (increasingly complex) tests. Traditional regression tests are often partially automated. These note focus on traditional regression.
XIII) User acceptance test:- In this type of testing, the software is handed over to the user in order to find out if the software meets the user expectations and works as it is expected to. In software development, user acceptance testing (UAT) - also called beta testing.
XIV)Alpha test:- In this type of testing, the users are invited at the development center where they use the application and the developers note every particular input or action carried out by the user. Any type of abnormal behavior of the system is noted and rectified by the developers.

White box testing:-
white box being an internal view
I)Unit testing:-The developer carries out unit testing in order to check if the particular module or unit of code is working fine. The Unit Testing comes at the very basic level as it is carried out as and when the unit of the code is developed or a particular functionality is built. Unit testing deals with testing a unit as a whole.
II)Static and dynamic analysis:- Static analysis involves going through the code in order to find out any possible defect in the code. Dynamic analysis involves executing the code and analyzing the output.
III)Statement coverage:- In this type of testing the code is executed in such a manner that every statement of the application is executed at least once. It helps in assuring that all the statements execute without any side effect.
IV)Branch coverage:- No software application can be written in a continuous mode of coding, at some point we need to branch out the code in order to perform a particular functionality. Branch coverage testing helps in validating of all the branches in the code and making sure that no branching leads to abnormal behavior of the application.
V)Security testing:- Security testing is carried out in order to find out how well the system can protect itself from unauthorized access, hacking – cracking, any code damage etc. which deals with the code of application. This type of testing needs sophisticated testing techniques.
VI)Mutation testing:- A kind of testing in which, the application is tested for the code that was modified after fixing a particular bug/defect. It also helps in finding out which code and which strategy of coding can help in developing the functionality effectively.

Source and reference

Thursday, May 13, 2010

Interactive map of linux

Friday, April 30, 2010

Installation and usage of netperf

As name implies netperf is used to estimate network performance in various respects using tcp and udp. There is lot of help available in net, just do a simple search is enough.

What ever iam providing here is a simple installation procedure and a small examples.
#make install

There is a latest version is availabel but i got some issues after installation and went back to this version insted of debugging. (Lack of time).

For simple test run
This will run netperf server, this first time run at local machine.

Now run
TCP STREAM TEST from ( port 0 AF_INET to localhost.localdomain ( port 0 AF_INET
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec

87380 16384 16384 10.01 3684.63

Now these are the statistics when server and client are running on same machine.
Lets try on remote machine(
[root@remote net]#netserver
Starting netserver at port 12865
Starting netserver at hostname port 12865 and family AF_UNSPEC

Now server is ready and starting client at local machien is required.

[root@localhost net]# netperf -H

TCP STREAM TEST from ( port 0 AF_INET to ( port 0 AF_INET
Recv Send Send
Socket Socket Message Elapsed
Size Size Size Time Throughput
bytes bytes bytes secs. 10^6bits/sec

87380 16384 16384 10.23 94.15

Oh!! throughput 94.15 ofcource expected value will be less compared to localhost.

There is lot of options available with this.

Saturday, March 6, 2010

Dead Donkey.. Nice one...

The Dead Donkey!!
City boy, Raj, moved to the village and bought a donkey from an old farmer for Rs.1000. The farmer agreed to deliver the donkey the next day.
The next day the farmer drove up and said, "Sorry Raj-ji, but I have some bad news. The donkey died while I was bringing him here."
Raj replied: "Well then, just give me my money back."
The farmer said: "Can't do that either. I went and spent it already."
Raj said: "OK then, just unload the donkey."
The farmer asked: "What you are going to do with a dead donkey?!"
Raj: "I'm going to raffle him off." (Note: Raffle is like lottery - a group of people draw lots each paying the same amount for a ticket and there is a big prize for the people who win.)
Farmer: "You can't raffle off a dead donkey!"
Raj: "Sure I can. Watch me. I just won't tell anybody he's dead."
A month later the farmer met up with Raj and asked, "What happened with that dead donkey?"
Raj: "I raffled him off. I sold 500 tickets at Rs.10 each and made a profit of Rs.4990 with the donkey worth Rs.1000 as the prize."
Farmer: "Didn't anyone complain?"
Raj: "Just the guy who won. So I gave him back his Rs.10"
Moral of the story - No situation is so bad that it cannot be turned around. You need to just think hard, sorry! smart .

Wednesday, February 10, 2010

Install cpulimit

Install cpulimit

Type the following commands to install latest stable release:
# cd /tmp
# wget ''
# tar -zxvf cpulimit-1.1.tar.gz
# cd cpulimit-1.1
# make
# cp cpulimit /usr/local/sbin/
# rm -rf cpulimit*

A note about Debian / Ubuntu Linux users

Type the following command to install cpulimit:
$ sudo apt-get update
$ sudo apt-get install cpulimit

How do I use cpulimit?

To limit CPU usage of the process called firefox to 30%, enter:
# cpulimit -e firefox -l 30
To limit CPU usage of the process to 30% by using its PID, enter:
# cpulimit -p 1313 -l 30
To find out PID of the process use any of the following:
# ps aux | less
# ps aux | grep firefox
# pgrep -u vivek php-cgi
# pgrep lighttpd

You can also use absolute path name of the executable, enter:
# cpulimit -P /opt/firefox/firebox -l 30

  • -p : Process PID.
  • -e : Process name.
  • -l : percentage of CPU allowed from 0 to 100.
  • -P: absolute path name of the executable program file.

Saturday, January 23, 2010

megan fox video

Management Lesson

Management Lesson

One fine day, a bus driver went to the bus garage, started his bus, and drove off along the route. No problems for the first few stops - a few people got on, a few got off, and things went generally well.

At the next stop, however, a big hulk of a guy got on. Six feet eight, built like a wrestler, arms hanging down to the ground. He glared at the driver and said, "Big John doesn't pay!" and sat down at the back.

Did I mention that the driver was five feet three, thin, and basically week? Well, he was. Naturally, he didn't argue with Big John, but he wasn't happy about it. The next day the same thing happened - Big John got on again, made a show of refusing to pay, and sat down. And the next day, and the next.

This grated on the bus driver, who started losing sleep over the way Big John was taking advantage of him. Finally he could stand it no longer. He signed up for body building courses, karate, judo, and all that good stuff.

By the end of the summer, he had become quite strong; what's more, he felt really good about himself. So on the next Monday, when Big John once again got on the bus and said, "Big John doesn't pay!"

The driver stood up, glared back at the passenger, and screamed, "And why not?"

With a surprised look on his face, Big John replied, "Big John has a bus pass."

Management Lesson:

"Be sure there is a problem in the first place before working hard to solve one."

Friday, January 22, 2010

telugu best comedy sceens with top heros

Take one:-

Take two:-

Take threee:-

Murphy's laws on girls

1. If u think a girl is beautiful, she'll always have a boyfriend to confirm that.

2. The nicer she is...the quicker u will be dumped!!!!!

3. The more the makeup, worse the looks...

4. "99% of the girls in this world are beautiful. Remaining 1% would always be in your company."............ .....100% true.

5. The guy standing next to a beautiful girl can never be her brother.

6. If by any chance the girl you like, likes you too, she will let you know in about 10 years from now ,when you are committed..

7. The more you ignore a girl, the more she'll want to be friends with you.

8. Theory of relativity......
The more u run towards a hot chick....the more she goes away from u...

9. Rule 1: Even if you got her out alone... Just when you are about to let her know about your feelings...she will spot a long lost friend (I guess from Kumbh ka Mela)
Corollary to rule 1: The more desperate you are to tell your feelings to a girl on a private chat, the more probability the long lost friend she discovered is a handsome superman, who beats you in everything 9:1
Axiom 1: The more dedicated you are to the girl, the longer it takes before things work out, but ultimately it will (some smile for the guys).

10. The day the chick you really like comes and speaks to you will be the day when-

a. You are dressed badly
b. You forgot to brush your teeth for the first time in your life
c. Have a bad hair day.

11. All the good girls are either nuns or married. The rest go around with u and ruin your money, health and leave u a total wreck.

12. The more seriously u like a girl...the more seriously her dad will hate u.

13. The love you shower a girl with is directly proportional to the number of bullets her dad will be showering at you.