2010年5月26日 星期三

Linux Development - svn

Windows SVN software
TortoiseSVN
http://tortoisesvn.tigris.org/


svn command option -r can set the following values. I will diagnose these values when I am free.
-r [--revision] ARG : ARG (some commands also take ARG1:ARG2 range)
A revision argument can be one of:
NUMBER revision number
'{' DATE '}' revision at start of the date
'HEAD' latest in repository
'BASE' base rev of item's working copy
'COMMITTED' last commit at or before BASE
'PREV' revision just before COMMITTED

Q. HEAD, BASE, COMMITTED, PREV means what in svn?


Commit code to svn
# svn commit -m "message" commited-file

Update codes commited by other one
# svn update

Get the current working directory file status
# svn status

See the file difference
# svn log filename
# svn diff -r r669:676 filename

See the diff summary in a revision comparison
$ svn diff -r1302:1303 --summarize
M XXXX/abcd.h
M YYYY/zxcv.c


check out the specified revision from the svn source trunk
# svn co svn://ipaddress/pathTotheTrunk/trunk -r1232
# svn co svn://ipaddress/pathTotheTrunk/trunk@1232 PATH
PATH is the local-folder name which will store the check-out files

update the file to the latest version of the source trunk
# svn up -rHEAD path-to-the-source-file

update the file to the revision 1232 of the source trunk
# svn up -r1234 path-to-the-source-file


update the code in a specified date
# find . -name .svn -execdir svn update -r {2011-04-04} \;

import project to the svn repository, the below "myproject" is the imported folder
# svn import --no-ignore myproject svn://repository-address/path/to/newproject

After this command, all the files contained in the myproject will upload to the newproject folder of svn repository.
And we can use the following svn-address to check out this new project, like following command
# svn co svn://repository-address/path/to/newproject

we can use the option --no-ignore to avoid svn ignore the default ignored files (include .so ...)
Under version-controlled status
# svn st --no-ignore
# svn add --no-ignore local-folder
Import a directory of non-version-controlled
# svn import --no-ignore localFolder URL

Export the SVN repository files without the version-control tags (clean directory tree) to the local-folder
# svn export URL local-folder

change to the working directory
svn merge source-branch-URL -cSource-Revision
or
svn merge -r9189:HEAD source-branch-URL target-branch-WC


This will be useful when you create a branch for new feature implement,
and you want to reintegrate the implemented new feature back to trunk. The merging process will include 2 phases.


1st,
Keeping a Branch in Sync with trunk
$ pwd
.../your-branch
$ svn merge [--dry-run] ^/trunk
After Sync,
$ # build, test, verify, ...
$ svn commit -m "......"


second,
Reintegrating a Branch back to trunk
you need a clean working copy of the trunk first,
$ pwd
.../your-trunk
$ svn update # (make sure the working copy is up to date)
$ svn merge [--dry-run] --reintegrate ^/branches/your-branch
$ # build, test, verify, ...
$ svn commit -m "......"


How to use the TortoiseSVN to create the new branch or tag?
1. Use the "Log Message" to browase the specified source trunk
Note: remember to enable the "Show All" button in the most bottom screen.
2. type the search string in the "searching-field"
3. The "Log Message" will list all the comformed revision in the screen.
4. Click right button on the spevified revision. Select the "Create branch/tag from revision" from the pop-up menu. Then there will appear a sub window with title "COPY (Branch /Tag)". See the following figure for example.




















5. Select the right path in the "To URL" field. Note that svn-branch will under "branch" folder and svn-tag will under "release" folder.
6. Finally click "OK" will finish the processing.

Linux Command - alias

# alias ==> show all the alias settings
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias cp='cp -i'
alias vi='vim'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

# unalias cp ==> release the "cp" alias setting

2010年5月24日 星期一

Linux Server - Delta UPS power manager software

Ever use the Delta UPS, the type is 水瓶座Plus系列

http://www.delta.com.tw/ch/product/ps/ups/index.asp

Download software
http://59.125.232.140/tc/index.aspx

電力管理大師2000 v3.01.26
The software package mainly contains 2 daemons, upsd and monitor

start upsd
# /usr/local/smart/upsd
or
# /usr/local/smart/upsd start

stop upsd
# /usr/local/smart/upsd stop

Another daemon "monitor" was a GUI X program that can configure/monitor the UPS status.

But it seems not stable in the Fedora/CentOS 64bits platform.

2010年5月18日 星期二

Linux Command - rpm

rpm download site
http://pkgs.org/search/?keyword=
http://rpm.pbone.net/

安裝
rpm -ivh MySQL-3.23.41-1.i386.rpm

升級
rpm -Uvh MySQL-3.23.41-1.i386.rpm

移除
rpm -e MySQL

rpm-qa //查詢所有安裝過的套件

rpm -qpl MySQL-3.23.41-1.i386.rpm //查某個RPM檔的內容

驗證
不小心誤刪檔案,對整個系統做確認動作,以了解哪些部分檔案遺失。
rpm -Va


查詢某一個檔案是屬於哪一個套件
#rpm -qf /usr/bin/ftp
查詢某一個rpm檔的相關資訊
#rpm –qpi MySQL-3.23.41-1.i386.rpm
查詢某一個rpm檔的內容
#rpm –qpl MySQL-3.23.41-1.i386.rpm
查詢系統已安裝的套件資訊
#rpm –qai
更新許多已安裝套件的新版本
#rpm –Fvh *.rpm

Setup a specified RPM file (remeber to use root privilege)
# rpm –Fvh XXX.rpm
# sudo rpm –Uvh python-lxml-2.2.3-1.1.el6.i686.rpm

>> Guides to list/extract the rpm files to the system specified directory
1.Use rpm2cpio or rpm -qpl to list files and full paths in the package:
$ rpm2cpio | cpio -t

2.To extract everything to the current directory:
$ rpm2cpio | cpio -ivd

2010年5月10日 星期一

Linux Command - unrar

How to use unrar

unrar command supports various options below are common options that you need to use everyday.
Task: To open rar (unpack) file in current directory type command:

$ unrar e file.rar

Please note that replace file.rar filename with your actual filename.
Task: List (l) file inside rar archive:

$ unrar l file.rar
Task: To extract (x) files with full path type command:

$ unrar x file.rar

(D) To test (t) integrity of archive, file type command:
$ unrar t file.rar