2009/04/28

Subversion主干-分支开发的流程。

使用Subversion辅助开发,有一个重要的概念就是主干与分支。
采用主干与分支的开发方法,可以有几种不同的策略:
1、主干上开发,分支上发布。发布之后,如果分支有BUG(主干可能也是有的),则在分支上修改BUG。然后合并到主干。分支的发布 继续进行。这个一般适用于客户化软件工程的。
2、主干保持一个最新的稳定版本,保证随时能提供稳定的发布版本。而所有的新功能、新技术实验全放在分支上去做开发,进行新技术的验证实验。等分支相对稳定以后,再合并到主干上形成稳定的发布版本。此 时就要更新主干,进行主干版本的升级。很多开源软件基本采取这种策略。
3、还有一种就是这两者的混合,结合两者的优点,即保证随时可以有稳定的版本发布,又能保证客户化的版本分支开发功能及其客 户化版本的维护。

下面介绍采用第2中策略的详细步骤和命令。
以trunk为主干目录,branches下为分支目录。在分支进行开发,稳定后合并入主干。

首先,从主干创建开发分支:
[lax@liulantao-com ~]$ svn cp http://gnu.bnu.edu.cn:8000/repos/www.myshu.org/trunk/ http://gnu.bnu.edu.cn:8000/repos/www.myshu.org/branches/www.myshu.org_20090428/ -m "Creating branch: 20090428."
Committed revision 10.

然后,获取分支代码,进行新特性的开发工作。
[lax@liulantao-com ~]$ svn co http://gnu.bnu.edu.cn:8000/repos/www.myshu.org/branches/www.myshu.org_20090428/

之后,则进入本地的www.myshu.org_20090428目录中进行开发,所有改动直接提交,直至新功能稳定并完成。
[lax@liulantao-com ~]$ cd www.myshu.org_20090428/
[lax@liulantao-com ~]$ [change the code]......
[lax@liulantao-com ~/www.myshu.org_20090248/]$ svn ci -m "Changing something."

分支开发完成后,检查分支的历史,获得创建时所在的版本。
[lax@liulantao-com www.myshu.org_20090428]$ svn log --stop-on-copy -q http://gnu.bnu.edu.cn:8000/repos/www.myshu.org/branches/www.myshu.org_20090428/
------------------------------------------------------------------------
r10 | lax | 2009-04-28 11:46:02 +0800 (Tue, 28 Apr 2009)
------------------------------------------------------------------------
数值最小的版本号是我们需要合并的版本。本例中是r10。记下这个数值。

获取主干的代码。
[lax@liulantao-com ~]$ svn co http://gnu.bnu.edu.cn:8000/repos/www.myshu.org/trunk
[lax@liulantao-com ~]$ cd trunk/

接着将开发分支合并入刚获取的主干代码上。
[lax@liulantao-com trunk/]$ svn merge -r 10:HEAD http://gnu.bnu.edu.cn:8000/repos/www.myshu.org/branches/www.myshu.org_20090428/

然后查看合并后主干代码的状态。
[lax@liulantao-com trunk/]$ svn status

如果没有冲突(conflict),则可以提交了新的主干了。
[lax@liulantao-com trunk/]$ svn ci -m "Adding new features."

现在,主干已经形成一个新的状态。在整个过程中,主干的代码一直保持着稳定可用的状态,而分支代码则处于开发状态。

--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

2009/04/25

Install and Config Sun Java Runtime Environment: How-to.

Install and Config Sun Java Runtime Environment: How-to.
[ http://www.liulantao.com/ ]
 
First, get the latest jre from SUN and get the rpm.
Go-to http://java.com/en/download/manual.jsp, and choose the rpm file.

Then install it using rpm
[lax@liulantao-com JAVA]$ sudo rpm -Uvh jre-6u12-linux-i586.rpm

Make the system recognize it.
[lax@liulantao-com ~]$ sudo /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jre1.6.0_12/bin/java 100 --slave /usr/bin/rmiregistry rmiregistry /usr/java/jre1.6.0_12/bin/rmiregistry --slave /usr/share/man/man1/rmiregistry.1 rmiregistry.1 /usr/java/jre1.6.0_12/man/man1/rmiregistry.1 --slave /usr/share/man/man1/rmiregistry.1.gz rmiregistry.1.gz /usr/java/jre1.6.0_12/man/man1/rmiregistry.1.gz

Then we check the default version. See it, java is there waiting for U!
[lax@liulantao-com JAVA]$ java -version
java version "1.6.0_12"
Java(TM) SE Runtime Environment (build 1.6.0_12-b04)
Java HotSpot(TM) Client VM (build 11.2-b01, mixed mode, sharing)

--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

在Linux上编译安装SUN拼音输入法|Build SunPinyin on GNU/Linux (CentOS/Redhat/Fedora).

〔懒桃原创,转载请注明完整链接http://www.liulantao.com/

= 在Linux上编译安装SUN拼音。 =

Sun Pinyin是最近评价很高的一款中文输入法。

首先安装必须的工具和库文件:
[lax@liulantao-com ~]
$ sudo yum install mercurial scim-devel

如果安装过程中报错,可以添加下面的东西试试:
[lax@liulantao-com ~]$ sudo yum install git gnome-common intltool -y

现在把源代码从库中签出:
[lax@liulantao-com ~]$ hg clone ssh://anon@hg.opensolaris.org/hg/nv-g11n/inputmethod

开始安装过程,以下命令安装使得sun拼音能够在scim中被调用:
[lax@liulantao-com ~]$ cd inputmethod/sunpinyin/ime
[lax@liulantao-com ~]$ ./autogen.sh --prefix=/usr --disable-cle --enable-scim
[lax@liulantao-com ~]$ make
[lax@liulantao-com ~]$ sudo make install

退出桌面,重新登入。从你的SCIM中选择Sun Pinyin就可以了。

--------------------------------------------------------------------------------
Sun Pinyin is a recently high performance chinese input method.

First, Install essential tools and development libraries:
[lax@liulantao-com ~]
$ sudo yum install mercurial scim-devel
 
If something goes wrong in next steps, you may need some of the following packages:
[lax@liulantao-com ~]$ sudo yum install git gnome-common intltool -y

Now, check out the source from opensolaris server:
[lax@liulantao-com ~]$ hg clone ssh://anon@hg.opensolaris.org/hg/nv-g11n/inputmethod

Just install it, with the following commands:
[lax@liulantao-com ~]$ cd inputmethod/sunpinyin/ime
[lax@liulantao-com ~]$ ./autogen.sh --prefix=/usr --disable-cle --enable-scim
[lax@liulantao-com ~]$ make
[lax@liulantao-com ~]$ sudo make install
Logout your desktop and re-login, a fresh sun-pinyin is just there in scim menu.

--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

2009/04/21

磁盘数据救援工具R-Studio

R-Studio 是一个功能强大、节省成本的反删除和数据恢复软件系列。它采用独特的数据恢复新技术,为恢复 FAT12/16/32、NTFS、NTFS5(由 Windows 2000/XP/2003/Vista 创建或更新)、Ext2FS/Ext3FS(LINUX 文件系统)以及 UFS1/UFS2(FreeBSD/OpenBSD/NetBSD 文件系统)分区的文件提供了最为广泛的数据恢复解决方案。R-Studio 运行于本地磁盘和网络磁盘,即使这些分区已被格式化、损坏或删除。对参数进行灵活的设置,可以让您对数据恢复实施绝对控制。


R-Studio 工具恢复适合以下情况:

1、没有进回收站而被直接删除的文件,或者当回收站被清空时的文件;
2、因病毒攻击或电源故障被删除的文件;
3、文件分区被重新格式化后的文件(甚至是不同的文件系统);
4、硬盘上的分区结构被改变或损害时的文件。在这种情况下,R-Studio 工具可以 扫描硬盘,尝试去找到以前存在的分区并从找到的分区恢复文件。
5、有坏扇区的硬盘的文件 R-Studio 数据恢复软件首先拷贝整个磁盘或者部分磁盘内容到一个镜像文件中,然后再处理该镜像文件。当新的坏扇区不断出现在硬盘上时,这一处理方式尤为实用,其余信息必须立即保存。


R-Studio 数据恢复功能详情:
1、标准的"Windows Explorer"风格界面。
2、主机操作系统:Windows 9x、ME、NT、2000、XP、2003 Server、Vista。
3、通过网络进行数据恢复。可以从运行 Win95/98/ME/NT/2000/XP/2003/Vista、Linux 以及 UNIX 的网络计算机上恢复文件。
支持的文件系统:FAT12、FAT16、FAT32、NTFS、NTFS5(由 Windows 2000/XP/2003/Vista 创建或更新)、Ext2FS/Ext3FS (Linux)、UFS1/UFS2 (FreeBSD/OpenBSD/NetBSD)。
4、识别和分析动态(Windows 2000/XP/2003/Vista)、基本和 BSD (UNIX) 分区布局方案。
5、损坏的 RAID 恢复。如果操作系统不能识别出您的 RAID,您可以从其组件创建一个虚拟的 RAID。这样的虚拟 RAID 可以当作真实的 RAID 处理。
6、创建 镜像文件用于整个硬盘、分区或它的一部分。这类镜像文件可以作为常规的磁盘处理。
7、对被损坏或删除的分区、加密文件 (NTFS 5)、额外的数据流 (NTFS, NTFS 5) 进行数据恢复。
8、对如下情况进行数据恢复:
8.1 FDISK 或其它磁盘工具已经在运行;
8.2 VIRUS 侵入;FAT 损坏;MBR 被破坏。
9 识别本地化名称。
10 被恢复的文件可以保存在主机操作系统可以访问的任何(包括网络)磁盘上。
11 文件或磁盘的内容可以在十六进制编辑器中查看或编辑。该编辑器支持 NTFS 文件属性编辑。



--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

2009/04/15

Principles behind the Agile Manifesto

Principles behind the Agile Manifesto


We follow these principles:

Our highest priority is to satisfy the customer
through early and continuous delivery
of valuable software.

Welcome changing requirements, even late in
development. Agile processes harness change for
the customer's competitive advantage.

Deliver working software frequently, from a
couple of weeks to a couple of months, with a
preference to the shorter timescale.

Business people and developers must work
together daily throughout the project.

Build projects around motivated individuals.
Give them the environment and support they need,
and trust them to get the job done.

The most efficient and effective method of
conveying information to and within a development
team is face-to-face conversation.

Working software is the primary measure of progress.

Agile processes promote sustainable development.
The sponsors, developers, and users should be able
to maintain a constant pace indefinitely.

Continuous attention to technical excellence
and good design enhances agility.

Simplicity--the art of maximizing the amount
of work not done--is essential.

The best architectures, requirements, and designs
emerge from self-organizing teams.

At regular intervals, the team reflects on how
to become more effective, then tunes and adjusts
its behavior accordingly.

--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------

2009/04/07

使用SVN+SSH,同步Ruby On Rails代码的脚本

版本库和开发都在自己的笔记本上进行,而服务器则通过svn来同步代码。
每次在服务器上测试都需要运行一系列的命令,并且由于无线网络使用DHCP取得动态ip,每次都要修改。这个过程很麻烦,所以写一个简单的脚本完成这个任务。

基本思路很简单:
首先修改hosts文件(为svn update时提供方便,即使使用动态ip,也可以每次通过主机名来访问),
然后通过svn+ssh来获取代码,
之后则进行初步的设定,配置数据库文件,
最后则执行数据库迁移,并且启动script/server。
---------------------------------------------
[lax@gnu ~]$ cat svn_ssh_from_lax
sudo vi /etc/hosts
svn co svn+ssh://lax/LAX/_DEV_/_SVN_/repos/www.myshu.org/trunk www.myshu.org.devel_trunk
cd www.myshu.org.devel_trunk/ && cp config/database.yml.orig config/database.yml
vi config/database.yml && rake db:drop && rake db:create && rake db:migrate && ruby script/server
---------------------------------------------

只需
$ sh svn_ssh_from_lax
即可运行此脚本来完成任务。

--
Liu Lantao
College of Information Science and Technology, Beijing Normal University
EMAIL: liulantao ( at ) gmail ( dot ) com ;
WEBSITE: http://www.liulantao.com/ .
------