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

2010年4月11日 星期日

PPTP (VPN) connect using pptp client

While I first time try to use pptp client to build the VPN connection. There were various problems occuring in the setup procedures. The most one is that I am not clear understand there are many firewall/NAT routers that set up with pptp blocking rules (don't allow pptp traffics passing through), so we must use private NAT router to allow pptp connections passing through.

We can use Linux pptp client to build the pptp connection under linux system.
http://pptpclient.sourceforge.net/howto-fedora-core-6.phtml

Install PPTP and the pptpconfig GUI using the following commands:

Step1.
# rpm -Uvh http://pptpclient.sourceforge.net/yum/stable/fc6/pptp-release-current.noarch.rpm
# yum --enablerepo=pptp-stable install pptpconfig

Step2.
enter the server, domain, username and password into the Server tab.

Step3.
In my case, I don't need the following setting.
if your PPTP connection need encryption like MPPE, (your administrator says encryption is required), then on the Encryption tab, click on Require Microsoft Point-to-Point Encryption (MPPE).

Step4.
click on Add, and the tunnel will appear in the list.

Step5.
Click on the tunnel to select it, click on Start, and a window will appear with the tunnel connection log and status.

Step6.
if the connection succeeded, you can try the Ping test button. If the ping fails, you should try to find out why before proceeding. If the ping works, then the tunnel is active and you may now work on routing.

Step7.
In most case, the system will produce a new "ppp0" network interface. This is the point to point network interface that the local LAN traffic will communicate with remote pptp server.

We can add the routing entries like following example to specify dedicated routing domains via the ppp interface (If we clear know which destination routing domains)
# route add -net ${NET} dev ${IFACE}
e.g.
# route add -net 192.168.18.0/24 dev ppp0

or simply change the default route to the ppp0 ip address
# route del default
# route add default gw ${PPP0-IFACE-IP-Address}

我要我的孩子知道的20 件事

我要我的孩子知道的20 件事

1. 成功在於做,不在於得
成功就是將我所有的做最好的運用。成功是在於做,而不在於得;是在於嘗試,而不在於勝利。 / 戴韋恩(Wynn Davis)

2. 人生是艱苦的
人生是一連串的問題。我們要去埋怨?還是去解決這些問題? / 派史考特(M. Scott Peck)

3. 人生充滿樂趣
開懷大笑應該是人與生俱來最高層次的天賦本能。 / 克曾茲(Norman Cousins)

4. 我們依靠選擇而活
上帝並沒有問我們要不要來到人世間,我們只能接受而無從選擇。我們唯一可以做的選擇是:決定如何活著。 / 畢亨利 (Henry Ward Beecner)

5. 態度是一種選擇
人所有的一切都可以被奪走,除了一件東西,就是人在任何情況下,選擇自己的態度與道路的自由。 / 法蘭科爾 (Viktor Frankl)

6. 習慣是成功的關鍵
事實上,成功者與失敗者之間唯一的差別在於,他們擁有不一樣的習慣。 / 曼迪諾(Og Madino)

7. 感恩是一種最好的習慣
不要為你所沒有的抱怨 ……要珍惜你所擁有的。 / 朱德(H. Stanley Judd)

8. 把人生建立在尊敬的基礎上
「所以無論何事,你們願意人怎樣待你們,你們也要怎樣待人。」 / 馬太福音七章12 節

9. 誠實依然是最好的策略
「在國際外交事務、人際關係、勞工、商業、教育、家庭與控制犯罪上,誠實是最好的策略。因為,真理是唯一有效的東西,也是建立持久關係的唯一基礎。」 / 克拉克 (Ramsey Clark)

10. 和善的言語成就大事
「世界上沒有幾件事比積極的鼓勵更有力量,一個微笑、一句樂觀、充滿希望的話。當事情遇到困難時,說一句:『你能辦得到。』」 / 德伏斯 (Richard M. Devos)

11. 真正的動機發自內心
「不論你是誰、你年紀多大,如果你想要得到持久永恆的成功,那驅使你邁向目標的動機必須發自你的內心。」 / 梅爾 (Panl J. Meyer)

12. 目標是有底限的夢想
「有目標的人們成功是因為他們知道他們往那裡前進。」 / 奈丁格爾 (Earl Nightingale)

13. 辛勤工作無與倫比
「生命所提供的最好獎賞就是:有機會為值得做的事情辛勤工作。」 / 羅斯福(Theodore Roosevelt)

14. 有得必有失
「決定你要什麼,決定你願意用甚麼來與之交換,把你的前後次序搞清楚,就開始去工作。」 / 韓特(H. Lamar Hunt)

15. 成功者創造時間
「時間是生命,是不可重來、不可逆轉的。浪費時間就是浪費生命;掌握時間就是掌握生命,並充分地使用生命。」 / 蘭凱 (Alan Lakein)

16. 自尊是自己成就的
「自尊是在你內裡深處對自己價值的感受。」 / 魏特利(Denis Waitley)

17. 心靈成長也需要營養與運動
「身心靈和諧的運作,決定了我們整個人與我們的健康。」 / 桑若森博士 (Dr. Carl Thoresen)

18. 每一個人都有失敗經驗
「如果你願意接受失敗,並從其中有所學習;如果你願意相信失敗是一個化妝的祝福,並從中板回優勢,你就有擁有一個最有利的成功因素與潛能。」 / 舒格曼 (Joseph Sugarman)

19. 用心體會人生基本要素
「這是我的秘密,一個非常簡單的秘密,就是人只有用心眼去看才會看得正確,真正基本的東西是用肉眼看不見的。」小王子 (The Little Prince) / 聖艾克斯柏利 (Antoine de Saint-Exupery)

20. 最基本的原則是做一個好人
「盡你所能的做一切的善事,用你一切可能的方法行善。」 / 魏斯理(John Wesley

原著書名: 20 Things I Want My Kids To Know(我要我的孩子知道的20 件事)
中文譯名:黃金階梯 —人生最重要的二十件事
作者: Hal Urban
出版社:宇宙光