Friday, December 11, 2009

Compiling With Boost

add
export CPLUS_INCLUDE_PATH /home/amit/boost_dir/


or
g++ -I /home/amit/boost_dir/ file.c -o output

Sunday, October 25, 2009

Useful Commands redirecting console output

To make a file Zero size
cat /dev/null > filename.log

Directing Std out in file
command >& file_name

REdirecting Error to stdout
2>&1

Wednesday, August 12, 2009

Useful Clearcase Commands

ct lsco ----                   shows all checked out files in current directory
ct lsco -cview ---         shows all checked out of current set view files in Current Directory
ct lsco -cview –all --    To list all the files that are already checked out in this view
ct lsco -cview -avobs -short    Lists all co files from all mounted vobs. short (just file names )
ct \ls ----                     shows fiellist with labels
ct lsco -cview -avobs -fmt "%d\t%[version_predecessor]p\t%En\n" shows date predecessor and file name from all monunted views.
alias lc="cleartool lsco -cview -avobs"
alias lcs="cleartool lsco -cview -avobs -short"
alias lcf="cleartool lsco -cview -avobs -fmt \"%d\t%[version_predecessor]p\t%En\n\""



Checkouts
ct co -nc filename ----                     checkout without comment
ct co -c "checkout" filename ----     checkout with comment -c
ct co -c "checkout" *.c -----           all .c files in current Directory

Check in
ct ci -nc * -----                              checkin all files in dir without comments
Check in all co
cleartool ci -nc `cleartool lsco -cview -all -short`

Uncheckout
ct unco filename

Uncheckout  all files in current Dir 
cleartool unco  `cleartool lsco -cview  -short`

Uncheckout  all files in View
cleartool unco  `cleartool lsco -cview -all -short`

To remove private files from view
ct lsprivate | xargs rm -rf

Make label
ct mklbtype -nc LABEL_NAME
ct mklabel AMIT_04_24 `ct find /vob/wibb_capc/ -ver 'version(.../branch_name/LATEST)' -print `

Find commands
ct find dir_path -version 'version(.../branch_name/LATEST)' -print to see all versions of file in view

find all files of paticular label

ct find dir_path -ver 'lbtype( TA_LI_REBASE_24)' -print

findmerge
cleartool findmerge dir_path -fversion WMX-CAPC_R2.5_REL-1.44.00 -merge –gmerge ----gmerge is for graphical must to solve conflicts
ct findmerge dir_path -fversion .../branch_name/LATEST -print

find files that are changed between labels
cleartool find dir_path -version 'lbtype(lable_name_1) && ! lbtype(lable_name_2)' -print

To Search a Label
ct lstype -kind lbtype | grep name_to_search

List all branches in VOB
ct lstype -kind brtype | grep name_to_search
------------------------------------------------------------------------------
I was trying to co in a temp View and got ERROR
cleartool: Error: branch type "tmp-abc" not found in VOB "/vob/myvob" and no global type definition can be found.

How to resolve???
cleartool describe /vob/my_vob | more
Hyperlinks:
Merge <- /vob/my_vob/.@@/main/ttt-main/rrr_r1.0_bld-2.00/1 Not able to resolve it ---------------Config spec ------------------ Note: 1
Copy config spec from other view
ct catcs -tag view_name > ~/new_spec
ct setcs new_spec

Note: 2
After creating view we have to create Branch because in config spec we keep on rule pertaining to Check outs .
mkbranch dev-111
we need to create branch dev-111
ct mkbrtype -nc dev-111
if it gives error
Brtype must be made in admin vob
means we are not in admin vob
ct mkbrtype -nc dev-111@/vob/mainvob

Note: 3
As we know it executes top to bottom
Never include any branch before mkbranch RULE
other wise it will get check out form there and not from our branch .
CR view config_spec -
element * .../dev-1111/LATEST # CR branch
element .../lost+found -none
mkbranch dev-111
element * .../dev-222/LATEST # Always add Branch here <------- element * SOMELABEL1.0 # Baseline element * .../some_ver_of_loadline/0 element * RELEASE1.0 element * /main/0 end mkbranch dev-1111 -------------------- TO freeze included branche changes time can be used Example: element * .../dev-2222/LATEST -time 23-Apr.11:00 TO make Sharable branch
mkview -share_br -cr crno -b LABEL
to create a view based on an existing shared branch -
mkview -clone_br branch_name -mknt -b LABEL -tag view_name

Ref: http://www.yolinux.com/TUTORIALS/ClearcaseCommands.html

Rpm command

Command to verify installed rpms with name
rpm --verify `rpm -qa | grep urRpmname `


To Extract RPM
rpm2cpio   nameofFile.rpm | cpio -ivd

Tuesday, August 11, 2009

How to Search and Replace stirng using sed

I had to Edit file /etc/sysconfig/ntpd to add option -x in NTPS for instant Sync
cat /etc/sysconfig/ntpd
# Drop root to id 'ntp:ntp' by default.
OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid"

# Set to 'yes' to sync hw clock after successful ntpdate
SYNC_HWCLOCK=no

# Additional options for ntpdate
NTPDATE_OPTIONS=""

I used command
sed -i "s/OPTIONS=.*/OPTIONS=\"-x -g -u ntp:ntp -p \/var\/run\/ntpd.pid\"/" /etc/sysconfig/ntpd

but it was changing wherever OPTION is in Script i.e NTPDATE_OPTIONS was also getting changed
:s/old/new /1 dindnt work in sed

I searched and find out how to solve this
using ^ operator
This command ran fine
sed -i "s/^OPTIONS=.*/OPTIONS=\"-x -g -u ntp:ntp -p \/var\/run\/ntpd.pid\"/" /etc/sysconfig/ntpd