10/21/2008

A Zend_locale Problem:the migration of Zend_Locale

Today, my project based on Zend Framework have this error message:
You
are running Zend_Locale in compatibility mode... please migrate

your scripts.
I search on Google, find this article named::
I18N compatibility mode
So, I change my code in class system_Bootstrap:
private function _buildLocale() {
if (! $this->_locale instanceof Zend_Locale) {
Zend_Locale::$compatibilityMode = false; //add this line
$this->_locale = new Zend_Locale ('zh');
Zend_Registry::set ( 'locale', $this->_locale );
}
return $this->_locale;
}

10/20/2008

Some Commands of SVN

Context: We have a new project named Odour

Get Svn help

$ svn help 

Get sub-commands' help

$ svn help add 

Import a new Project

$ cd ~/project
$ mkdir -p Odour/{trunk,branches,tags}
$ svn import svntest https://localhost/svn/Odour --message "Start project"
$ rm -rf Odour

The aim of this operation is to build a new project named Odour, there are three sub-directory in this project involved trank, branches, and tags. Then you should delete the Odour when you have imported the project to our repository named https://localhost/test/svntest

Checkout a project

$ svn checkout https://localhost/test/svntest/trunk --username= yourname

Some example about the reversion

$ svn diff --revision PREV:COMMITTED foo.php
# shows the last change committed to foo.php

$ svn log --revision HEAD
# shows log message for the latest repository commit

$ svn diff --revision HEAD
# compares your working file (with local changes) to the latest version
# in the repository

$ svn diff --revision BASE:HEAD foo.php
# compares your “pristine” foo.php (no local changes) with the
# latest version in the repository

$ svn log --revision BASE:HEAD
# shows all commit logs since you last updated

$ svn update --revision PREV foo.php
# rewinds the last change on foo.php
# (foo.php's working revision is decreased)

$ svn checkout --revision 3
# specified with revision number

$ svn checkout --revision {2002-02-17}
$ svn checkout --revision {15:30}
$ svn checkout --revision {15:30:00.200000}
$ svn checkout --revision {"2002-02-17 15:30"}
$ svn checkout --revision {"2002-02-17 15:30 +0230"}
$ svn checkout --revision {2002-02-17T15:30}
$ svn checkout --revision {2002-02-17T15:30Z}
$ svn checkout --revision {2002-02-17T15:30-04:00}
$ svn checkout --revision {20020217T1530}
$ svn checkout --revision {20020217T1530Z}
$ svn checkout --revision {20020217T1530-0500}

Update

$ svn up

add


$ svn add foo.file
$ svn add foo1.dir
$ svn add foo2.dir --non-recursive
$ svn delete README

Conflict

The svn will create three files named .mine, .rOLDREV, .rNEWREV separately When the workcopy have confict with header version, for example:

$ ls -l
sandwich.txt
sandwich.txt.mine
sandwich.txt.r1
sandwich.txt.r2

There are there method to resolve this confict.

Method A: modify the sandwich.txt, then run:

$ svn resolved sandwich.txt

Mehtod B: use the header version to override your version

$ cp sandwich.txt.r2 sandwich.txt
$ svn resolved sandwich.txt

Method C: use revert

$ svn revert sandwich.txt
Reverted 'sandwich.txt'
$ ls sandwich.*
sandwich.txt
Then , you can submit your workcopy
$ svn commit --message "Correct some fatal problems"
$ svn commit --file logmsg
$ svn commit

Clean Up
svn cleanup

Build branch

Method A: local build

$ svn checkout http://svn.example.com/repos/calc bigwc
A bigwc/trunk/
A bigwc/trunk/Makefile
A bigwc/trunk/integer.c
A bigwc/trunk/button.c
A bigwc/branches/
Checked out revision 340.

$ cd bigwc
$ svn copy trunk branches/my-calc-branch
$ svn status
A + branches/my-calc-branch

$ svn commit -m "Creating a private branch of /calc/trunk."
Adding branches/my-calc-branch
Committed revision 341.

Method B:remote build

$ svn copy http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/branches/my-calc-branch \
-m "Creating a private branch of /calc/trunk."

Committed revision 341.

Swith to branch from trunk

$ cd calc
$ svn info | grep URL
URL: http://svn.example.com/repos/calc/trunk
$ svn switch http://svn.example.com/repos/calc/branches/my-calc-branch
U integer.c
U button.c
U Makefile
Updated to revision 341.
$ svn info | grep URL
URL: http://svn.example.com/repos/calc/branches/my-calc-branch

Build a tag
$ svn copy http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/tags/release-1.0 \
-m "Tagging the 1.0 release of the 'calc' project."

$ ls
my-working-copy/
$ svn copy my-working-copy http://svn.example.com/repos/calc/tags/mytag
Committed revision 352.

Delete a branch

$ svn delete http://svn.example.com/repos/calc/branches/my-calc-branch \
-m "Removing obsolete branch of calc project."

Create a new repository

$ svnadmin help
...
$ svnadmin help create
...
$ svnadmin create bdb /usr/local/repository/svn/test
$ chown -R svn.svn /usr/local/repository/svn/test

common YUM command in CentOs

1.列出所有可更新的软件清单
命令:yum check-update

2.安装所有更新软件
命令:yum update

3.仅安装指定的软件
命令:yum install

4.仅更新指定的软件
命令:yum update

5.列出所有可安裝的软件清单
命令:yum list

用YUM安装删除软件
装了系统添加删除软件是常事,yum同样可以胜任这一任务,只要软件是rpm安装的。
安装的命令是,yum install xxx,yum会查询数据库,有无这一软件包,如果有,则检查其依赖冲突关系,如果没有依赖冲突,那么最好,下载安装;如果有,则会给出提示,询问是否要同时安装依赖,或删除冲突的包,你可以自己作出判断。
删除的命令是,yum remove xxx,同安装一样,yum也会查询数据库,给出解决依赖关系的提示。


1.用YUM安装软件包
命令:yum install

2.用YUM删除软件包
命令:yum remove

用YUM查询软件信息
我 们常会碰到这样的情况,想要安装一个软件,只知道它和某方面有关,但又不能确切知道它的名字。这时yum的查询功能就起作用了。你可以用 yum search keyword这样的命令来进行搜索,比如我们要则安装一个Instant Messenger,但又不知到底有哪些,这时不妨用 yum search messenger这样的指令进行搜索,yum会搜索所有可用rpm的描述,列出所有描述中和messeger有关的rpm包,于 是我们可能得到gaim,kopete等等,并从中选择。
有时我们还会碰到安装了一个包,但又不知道其用途,我们可以用yum info packagename这个指令来获取信息。


1.使用YUM查找软件包
命令:yum search

2.列出所有可安装的软件包
命令:yum list

3.列出所有可更新的软件包
命令:yum list updates

4.列出所有已安装的软件包
命令:yum list installed

5.列出所有已安装但不在 Yum Repository 內的软件包
命令:yum list extras

6.列出所指定的软件包
命令:yum list

7.使用YUM获取软件包信息
命令:yum info

8.列出所有软件包的信息
命令:yum info

9.列出所有可更新的软件包信息
命令:yum info updates

10.列出所有已安裝的软件包信息
命令:yum info installed

11.列出所有已安裝但不在 Yum Repository 內的软件包信息
命令:yum info extras

12.列出软件包提供哪些文件
命令:yum provides

清除YUM缓存
yum 会把下载的软件包和header存储在cache中,而不会自动删除。如果我们觉得它们占用了磁盘空间,可以使用yum clean指令进行清除,更精确 的用法是yum clean headers清除header,yum clean packages清除下载的rpm包,yum clean all一 股脑儿端


1.清除缓存目录(/var/cache/yum)下的软件包
命令:yum clean packages

2.清除缓存目录(/var/cache/yum)下的 headers
命令:yum clean headers

3.清除缓存目录(/var/cache/yum)下旧的 headers
命令:yum clean oldheaders

4.清除缓存目录(/var/cache/yum)下的软件包及旧的headers
命令:yum clean, yum clean all (= yum clean packages; yum clean oldheaders)

Update the Rsync from 2.8 to 3.0.4 on CentOs

安裝 for CenOS 5 i386 版的 rpmforge-release package

  • wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
  • rpm -ivh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

安裝之後,在 /etc/yum.repos.d/ 目錄底下會多了兩個檔案,分別為 mirrors-rpmforge與 rpmforge.repo

執行 yum update rsync 之後,就可以看到有新版的 rsync 可以升級囉!

10/19/2008

Add x-debugger-server to the test server

Step:
1 download the x-debugger-server
http://downloads.zend.com/pdt/server-debugger/

2 Locate ZendDebugger.so or ZendDebugger.dll file
that is compiled for the correct version of PHP (4.3.x, 4.4.x, 5.0.x, 5.1.x, 5.2.x) in the
appropriate directory.
("5_2_x_comp" is used for me)

2. Add the following line to the php.ini file:
Linux and Mac OS X: zend_extension=/full/path/to/ZendDebugger.so
Windows: zend_extension_ts=/full/path/to/ZendDebugger.dll
zend_debugger.allow_hosts=
zend_debugger.expose_remotely=always
example:


[Zend]
zend_extension_ts=D:/PHP/ext/ZendDebugger.dll
zend_debugger.allow_hosts=127.0.0.1/32
zend_debugger.allow_tunnel=127.0.0.1/32
zend_debugger.expose_remotely=always

3. Place dummy.php file in the document root directory.
when in ZF project :add the DummyphpController.php to default Module

class DummyphpController extends Core_Controller_Abstract {
public function indexAction() {
@ini_set ( 'zend_monitor.enable', 0 );
if (@function_exists ( 'output_cache_disable' )) {
@output_cache_disable ();
}
if (isset ( $_GET ['debugger_connect'] ) && $_GET ['debugger_connect'] == 1) {
if (function_exists ( 'debugger_connect' )) {
debugger_connect ();
exit ();
} else {
echo "No connector is installed.";
}
}

}
}
?>

4. Restart web server.

10/18/2008

set up the player in ubuntu

1 add the resource ,and update ,install it
sudo wget http://www.medibuntu.org/sources.list.d/hardy.list -O /etc/apt/sources.list.d/medibuntu.list
sudo apt-get update && sudo apt-get install medibuntu-keyring && sudo apt-get update

2 install xine
sudo apt-get install libxine1-ffmpeg libxine1-all-plugins libxine1-plugins w32codecs gcc-3.3-base libstdc++5

3 install gstream
sudo apt-get install gstreamer0.10-ffmpeg gstreamer0.10-pitfdll gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse gstreamer0.10-esd
sudo apt-get install gstreamer0.10-fluendo-mpegdemux gstreamer0.10-gnonlin libflashsupport

4 install smplay
sudo apt-get remove totem-mozilla -y
sudo apt-get install smplayer smplayer-themes mozilla-mplayer

10/17/2008

Install process of Ubuntu8.X

The aim of this article is to log the ubuntu install process for PHP developers . So , if you want to work on Ubuntu , this article will give you some hands.
1 Install system by CD
Note:set the language to English

2 Directions layout
Select to manually edit the partition table. I’m doing my testing on a standard 80GB harddrive and will modify these sizes for production.


/boot ext3 200MB bootable
/ ext3 15GB or More (files are relatively static)
swap 4GB (4xRAM if you don't have much memory, down to 1xRAM if you have gobs of memory)
/home ext3 10GB (personal files)
/repository ext3 40G (for you other archives)
/backup ext3 16G (workspace)

3 add the resurce


deb http://archive.ubuntu.org.cn/ubuntu-cn/ hardy main restricted universe multiverse

deb http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy-updates main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy-backports main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu hardy-proposed main restricted universe multiverse

deb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multivers


then

# sudo apt-get update

4 edit fstab

mkdir /home/edwin/workspace
mkdir /home/edwin/repository
sudo gedit /etc/fstab

then add the fllowing

/dev/sda6 /home/edwin/repository ext3 defaults 0 0
/dev/sda5 /home/edwin/workspace ext3 defaults 0 0

5 setting the SCIM
if you have set the current profile that the scim is available, the following process is just for you.
5.1 install scim pinyin
 sudo apt-get install scim-pinyin

5.2 setting scim
sudo im-switch -s scim

5.3 Edit the file /etc/X11/xinit/xinput.d/scim by typing in a terminal (Applications>Accessories>Terminal):
sudo gedit /etc/X11/xinit/xinput.d/scim

If you want to use scim input in KDE applications, you will also have to change the following line :

GTK_IM_MODULE="xim"
QT_IM_MODULE="xim"

into :

GTK_IM_MODULE="scim-bridge"
QT_IM_MODULE="scim-bridge"

5.4 sudo gedit /usr/lib/gtk-2.0/2.10.0/immodule-files.d/libgtk2.0-0.immodules

find the followling line,

"xim" "X Input Method" "gtk20" "/usr/share/locale" "ko:ja:th:zh"

change the them into:

"xim" "X Input Method" "gtk20" "/usr/share/locale" "en:ko:ja:th:zh"


6 setting Right Click Terminal Menu
sudo apt-get install nautilus-open-terminal


7 setting the docs reader
sudo apt-get install xpdf-chinese-simplified xpdf-chinese-traditional poppler-data

8 install zip tools

sudo apt-get install unrar p7zip-full cabextract

9 install devs tools

install zend server
sudo apt-get install build-essential autoconf automake subversion
sudo apt-get install mysql-server mysql-client

10 install system rc tools

sudo apt-get install sysv-rc-conf

10/15/2008

setup Compiz Fusion in ubuntu


1 add deb source

deb http://download.tuxfamily.org/3v1deb feisty eyecandy
deb-src http://download.tuxfamily.org/3v1deb feisty eyecandy

get key
wget http://download.tuxfamily.org/3v1deb/DD800CD9.gpg -O- | sudo apt-key add -

2 update system
sudo apt-get update
sudo apt-get dist-upgrade

3 Install Compiz and Compiz Fusion
sudo apt-get install compiz compiz-gnome compiz-fusion-* compizconfig-settings-manager

4、run Compiz Fusion

in sessions, add the following

compiz --replace

5、if you want to use Compiz Fusion + emerald, so run the following

sudo apt-get install emerald

in sessions

compiz --replace -c emerald &

10/11/2008

Build Flex SDK in Ubuntu 8.X

1、安装Java环境  
(1)安装sun-java6-jre/sun-java6-jdk

sudo apt-get install sun-java6-jre
sudo apt-get install sun-java6-jdk

(2)设置当前默认的java解释器:
sudo update-alternatives --config java

执行后会出现类似如下的画面:
There are 2 alternatives which provide `java'.
Selection Alternative
-----------------------------------------------
*+ 1 /usr/lib/jvm/java-6-sun/jre/bin/java
2 /usr/bin/gij-wrapper-4.1
Press enter to keep the default

  • , or type selection number:
  •   输入有包含 "sun" 的行的前面的数字。如上面显示,则输入1,然后回车确定。    

    (3)编辑/etc/environment,加入下面两行:
    CLASSPATH=.:/usr/lib/jvm/java-6-sun/lib
    JAVA_HOME=/usr/lib/jvm/java-6-sun

    sudo gedit /etc/jvm
    将文件中的/usr/lib/jvm/java-6-sun
    这一行填入到配置块的顶部
    2. 安装flex Sdk
    安装Adobe FLEX 3.0 SDK 从下面的地址http://www.adobe.com/go/flex3_sdk下载Adobe FLEX 3.0 SDK,我下载的是flex_sdk_3.2.0.3562_mpl.zip
    #mkdir /home/edwin/flexSdk
    #cd /home/edwin
    #unzip Desktop/flex_sdk_3.2.0.3562_mpl.zip -d flexSdk/
    #chmod -R 777 flexSdk/bin
    3 测试
    #gedit hello.as
    #/home/edwin/flexSdk/mxmlc hello.as
    #firefox hello.swf