<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Star life &#187; Howto</title>
	<atom:link href="http://liuchangjun.com/tag/howto/feed/" rel="self" type="application/rss+xml" />
	<link>http://liuchangjun.com</link>
	<description>无欲速 无见小利 欲速则不达 见小利则大事不成</description>
	<lastBuildDate>Wed, 13 Jul 2011 15:00:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Howto: ZeroMQ (ØMQ) &amp; PyZMQ Install Guide</title>
		<link>http://liuchangjun.com/2011/05/12/howto-zeromq-pyzmq-install-guide/</link>
		<comments>http://liuchangjun.com/2011/05/12/howto-zeromq-pyzmq-install-guide/#comments</comments>
		<pubDate>Thu, 12 May 2011 03:35:22 +0000</pubDate>
		<dc:creator>star</dc:creator>
				<category><![CDATA[Tech Tools]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mq]]></category>
		<category><![CDATA[zeromq]]></category>
		<category><![CDATA[zmq]]></category>

		<guid isPermaLink="false">http://liuchangjun.com/?p=255</guid>
		<description><![CDATA[<p>Homepage: http://www.zeromq.org</p> <p>ØMQ \zeromq\: Ø  The socket library that acts as a concurrency framework. Ø  Carries messages across inproc, IPC, TCP, and multicast. Ø  Connect N-to-N via fanout, pubsub, pipeline, request-reply. Ø  Fast enough for clustered products and supercomputing. Ø  Asynch I/O for scalable multicore message-passing apps. Ø  Large and active open source community. Ø  20+ languages including C, C++, Java, .NET, [...]]]></description>
			<content:encoded><![CDATA[<p>Homepage: <a href="http://www.zeromq.org">http://www.zeromq.org</a></p>
<blockquote><p>ØMQ \zeromq\:<br />
Ø  The socket library that acts as a concurrency framework.<br />
Ø  Carries messages across inproc, IPC, TCP, and multicast.<br />
Ø  Connect N-to-N via fanout, pubsub, pipeline, request-reply.<br />
Ø  Fast enough for clustered products and supercomputing.<br />
Ø  Asynch I/O for scalable multicore message-passing apps.<br />
Ø  Large and active open source community.<br />
Ø  20+ languages including C, C++, Java, .NET, Python.<br />
Ø  Most OSes including Linux, Windows, OS X.<br />
Ø  LGPL free software with full commercial support from iMatix.</p></blockquote>
<p>1. ZeroMQ (ØMQ) Installation<br />
<code><br />
# wget http://download.zeromq.org/zeromq-2.1.6.tar.gz<br />
# tar zxvf zeromq-2.1.6.tar.gz<br />
# cd zeromq-2.1.6<br />
# ./configure<br />
# make<br />
# make install<br />
# vi /etc/ld.so.conf.d/zmq.conf<br />
/usr/local/lib<br />
# ldconfig /etc/ld.so.conf<br />
</code></p>
<p>2. PyZMQ Installation<br />
<code><br />
# easy_install-2.6 pyzmq<br />
</code></p>
<p>3. Study ZMQ<br />
<code><br />
消息队列的适用场合<br />
* 可靠传输<br />
* 分布式计算<br />
* 多进程通信<br />
</code></p>
<p>4. 同类产品<br />
<code><br />
ZeroMQ     关注<br />
RabbitMQ(Erlang)     关注<br />
Apache QPID<br />
Red Hat Enterprise MRG<br />
Fedora AMQP Infrastructure<br />
OpenAMQ<br />
</code></p>
<p>Refer to:<br />
1. ZeroMQ Guide<br />
<a href="http://zguide.zeromq.org/page:all">http://zguide.zeromq.org/page:all</a><br />
2. AMQP和ZeroMQ的分析<br />
<a href="https://docs.google.com/present/view?id=df85d3vm_316dbhtg3f7&amp;pli=1">https://docs.google.com/present/view?id=df85d3vm_316dbhtg3f7&amp;pli=1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://liuchangjun.com/2011/05/12/howto-zeromq-pyzmq-install-guide/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Howto: Transifex Installation and Configuration</title>
		<link>http://liuchangjun.com/2011/04/27/howto-transifex-installation-and-configuration/</link>
		<comments>http://liuchangjun.com/2011/04/27/howto-transifex-installation-and-configuration/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 09:04:09 +0000</pubDate>
		<dc:creator>star</dc:creator>
				<category><![CDATA[Tech Tools]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[transifex]]></category>
		<category><![CDATA[translation]]></category>

		<guid isPermaLink="false">http://liuchangjun.com/?p=252</guid>
		<description><![CDATA[<p>Translation service: http://www.transifex.net/ Open source software: http://www.transifex.org/</p> <p>1. Installation (CentOS 5.2 &#38; Python 2.6 &#38; Django 1.2.4) # easy_install -U transifex Note 1: some related rpm packages will be installed by yum Note 2: the following packages will be installed by python ./Jinja2-2.5.5-py2.6.egg ./Pygments-1.4-py2.6.egg ./PIL-1.1.7-py2.6-linux-i686.egg ./polib-0.6.3-py2.6.egg ./httplib2-0.6.0-py2.6.egg ./userprofile-0.7_r422_correct_validation-py2.6.egg ./Markdown-2.0.3-py2.6.egg ./pycurl-7.19.0-py2.6-linux-i686.egg ./ctypes-1.0.2-py2.6-linux-i686.egg ./transifex-1.0.0-py2.6.egg </p> <p>2. Configuration [...]]]></description>
			<content:encoded><![CDATA[<p>Translation service: <a href="http://www.transifex.net/">http://www.transifex.net/</a><br />
Open source software: <a href="http://www.transifex.org/">http://www.transifex.org/</a></p>
<p>1. Installation (CentOS 5.2 &amp; Python 2.6 &amp; Django 1.2.4)<br />
<code><br />
# easy_install -U transifex<br />
Note 1: some related rpm packages will be installed by yum<br />
Note 2: the following packages will be installed by python<br />
./Jinja2-2.5.5-py2.6.egg<br />
./Pygments-1.4-py2.6.egg<br />
./PIL-1.1.7-py2.6-linux-i686.egg<br />
./polib-0.6.3-py2.6.egg<br />
./httplib2-0.6.0-py2.6.egg<br />
./userprofile-0.7_r422_correct_validation-py2.6.egg<br />
./Markdown-2.0.3-py2.6.egg<br />
./pycurl-7.19.0-py2.6-linux-i686.egg<br />
./ctypes-1.0.2-py2.6-linux-i686.egg<br />
./transifex-1.0.0-py2.6.egg<br />
</code></p>
<p>2. Configuration for development<br />
<code><br />
# cd /usr/lib/python2.6/site-packages/transifex-1.0.0-py2.6.egg/transifex<br />
Note: running the following command by python<br />
./manage.py txcreatedirs        # Create necessary directories<br />
./manage.py syncdb              # Setup DB tables, create superuser<br />
./manage.py migrate             # Setup more DB tables<br />
./manage.py txlanguages   # Create a standard set of languages<br />
./manage.py txcreatenoticetypes # Create a standard set of notice types<br />
./manage.py build_static        # Copy all the addons files to the static dir<br />
</code></p>
<p>3. Running for development<br />
<code><br />
# cd /usr/lib/python2.6/site-packages/transifex-1.0.0-py2.6.egg/transifex<br />
Note: running the following command by python<br />
./manage.py runserver 0.0.0.0:8000      # Start the development server<br />
</code></p>
<p>4. Configuration for apache<br />
<code><br />
# vi /etc/httpd/conf.d/transifex.conf<br />
&lt; IfModule !python_module&gt;<br />
LoadModule python_module modules/python26-mod_python.so<br />
&lt; /IfModule&gt;<br />
&lt; Directory "/var/www/manual/mod/python26-mod_python"&gt;<br />
&lt; Files *.html&gt;<br />
SetHandler default-handler<br />
&lt; /Files&gt;<br />
&lt; /Directory&gt;<br />
&lt; Location "/transifex/"&gt;<br />
SetHandler python-program<br />
PythonHandler django.core.handlers.modpython<br />
SetEnv DJANGO_SETTINGS_MODULE settings<br />
PythonOption django.root /transifex<br />
PythonDebug On<br />
PythonPath "['/usr/lib/python2.6/site-packages/transifex-1.0.0-py2.6.egg/transifex'] + sys.path"<br />
&lt; /Location&gt;</code></p>
<p><code> </code></p>
<p><code>Alias /site_media    /usr/lib/python2.6/site-packages/transifex-1.0.0-py2.6.egg/transifex/site_media<br />
&lt; Directory /usr/lib/python2.6/site-packages/transifex-1.0.0-py2.6.egg/transifex/site_media&gt;<br />
Order Deny,Allow<br />
Deny from all<br />
#       Allow from 127.0.0.1<br />
Allow from 192.168.1.0/24<br />
&lt; /Directory&gt;</p>
<p>Note: change some file permission to apache, e.g. the database file and its parent directory.<br />
</code></p>
<p>Refer to:<br />
<a href="http://help.transifex.net/technical/install.html">Installation Guide</a></p>
]]></content:encoded>
			<wfw:commentRss>http://liuchangjun.com/2011/04/27/howto-transifex-installation-and-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto: MongoDB Installation Guide</title>
		<link>http://liuchangjun.com/2011/04/15/howto-mongodb-installation-guide/</link>
		<comments>http://liuchangjun.com/2011/04/15/howto-mongodb-installation-guide/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 02:45:00 +0000</pubDate>
		<dc:creator>star</dc:creator>
				<category><![CDATA[Tech Tools]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mongodb]]></category>
		<category><![CDATA[nosql]]></category>

		<guid isPermaLink="false">http://liuchangjun.com/?p=249</guid>
		<description><![CDATA[<p>MongoDB (from “humongous”) is a scalable, high-performance, open source, document-oriented database, written in C++.</p> <p>Homepage: http://www.mongodb.org/</p> <p>1. Download the package # uname -a Linux hzserver1 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux # mkdir -p /home/mongo # cd /home/mongo # wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.1.tgz # tar zxvf mongodb-linux-i686-1.8.1.tgz # tree mongodb-linux-i686-1.8.1 [...]]]></description>
			<content:encoded><![CDATA[<p>MongoDB (from “hu<strong>mongo</strong>us”) is a scalable, high-performance, open source, document-oriented database, written in C++.</p>
<p>Homepage: <a href="http://www.mongodb.org/">http://www.mongodb.org/</a></p>
<p>1. Download the package<br />
<code><br />
# uname -a<br />
Linux hzserver1 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:21 EST 2007 i686 i686 i386 GNU/Linux<br />
# mkdir -p /home/mongo<br />
# cd /home/mongo<br />
# wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.1.tgz<br />
# tar zxvf mongodb-linux-i686-1.8.1.tgz<br />
# tree mongodb-linux-i686-1.8.1<br />
mongodb-linux-i686-1.8.1<br />
|-- GNU-AGPL-3.0<br />
|-- README<br />
|-- THIRD-PARTY-NOTICES<br />
`-- bin<br />
    |-- bsondump<br />
    |-- mongo<br />
    |-- mongod<br />
    |-- mongodump<br />
    |-- mongoexport<br />
    |-- mongofiles<br />
    |-- mongoimport<br />
    |-- mongorestore<br />
    |-- mongos<br />
    |-- mongosniff<br />
    `-- mongostat</p>
<p>1 directory, 14 files<br />
</code><br />
Note: 32-bit builds are limited to around 2GB of data. Recommend 64-bit system.</p>
<p>2. Install the package<br />
<img src="http://www.mongodb.org/download/attachments/2097393/sharding.PNG?version=2&#038;modificationDate=1267724627656" alt="Official Architectural Overview" /><br />
<strong>Current servers:</strong><br />
server1(192.168.1.67):<br />
shard1: /home/mongo/data/shard11<br />
shard2: /home/mongo/data/shard21<br />
config1: /home/mongo/data/config<br />
mongos<br />
server2(192.168.1.68):<br />
shard1: /home/mongo/data/shard12<br />
shard2: /home/mongo/data/shard22<br />
config2: /home/mongo/data/config<br />
mongos<br />
Note: server1 &#038; server2 set up to Replica Sets.</p>
<p>1) server1 tree:<br />
<code><br />
# tree /home/mongo<br />
mongo<br />
|-- bin<br />
|   |-- bsondump<br />
|   |-- mongo<br />
|   |-- mongo.start.sh<br />
|   |-- mongod<br />
|   |-- mongodump<br />
|   |-- mongoexport<br />
|   |-- mongofiles<br />
|   |-- mongoimport<br />
|   |-- mongorestore<br />
|   |-- mongos<br />
|   |-- mongosniff<br />
|   `-- mongostat<br />
`-- data<br />
    |-- config<br />
    |   |-- _tmp<br />
    |   |-- config.0<br />
    |   |-- config.1<br />
    |   |-- config.log<br />
    |   |-- config.ns<br />
    |   |-- diaglog.4da6a3ac<br />
    |   |-- diaglog.4da6a4e1<br />
    |   |-- diaglog.4da6ac00<br />
    |   `-- mongod.lock<br />
    |-- mongos.log<br />
    |-- shard11<br />
    |   |-- local.0<br />
    |   |-- local.1<br />
    |   |-- local.2<br />
    |   |-- local.ns<br />
    |   |-- mongod.lock<br />
    |   `-- shard11.log<br />
    `-- shard21<br />
        |-- local.0<br />
        |-- local.1<br />
        |-- local.2<br />
        |-- local.ns<br />
        |-- mongod.lock<br />
        `-- shard21.log</p>
<p>6 directories, 33 files<br />
</code><br />
2) server2 tree:<br />
<code><br />
[root@hzserver2 home]# tree mongo<br />
mongo<br />
|-- bin<br />
|   |-- bsondump<br />
|   |-- mongo<br />
|   |-- mongo.start.sh<br />
|   |-- mongod<br />
|   |-- mongodump<br />
|   |-- mongoexport<br />
|   |-- mongofiles<br />
|   |-- mongoimport<br />
|   |-- mongorestore<br />
|   |-- mongos<br />
|   |-- mongosniff<br />
|   `-- mongostat<br />
`-- data<br />
    |-- config<br />
    |   |-- config.log<br />
    |   |-- diaglog.4da6a371<br />
    |   |-- diaglog.4da6a4f4<br />
    |   |-- diaglog.4da6a573<br />
    |   |-- diaglog.4da6acee<br />
    |   `-- mongod.lock<br />
    |-- mongos.log<br />
    |-- shard12<br />
    |   |-- local.0<br />
    |   |-- local.1<br />
    |   |-- local.2<br />
    |   |-- local.ns<br />
    |   |-- mongod.lock<br />
    |   `-- shard12.log<br />
    `-- shard22<br />
        |-- local.0<br />
        |-- local.1<br />
        |-- local.2<br />
        |-- local.ns<br />
        |-- mongod.lock<br />
        `-- shard22.log</p>
<p>5 directories, 31 files<br />
</code></p>
<p>3. Configuring the Replica Sets<br />
1) Start shard1 replica set<br />
<code><br />
# /home/mongo/bin/mongo -port 10000 -host 192.168.1.67<br />
> config = {_id:'shard1',members:[{_id: 0, host: '192.168.1.67:10000'},{_id: 1, host: '192.168.1.68:10000'}]}<br />
> rs.initiate(config);<br />
</code><br />
2) Start shard2 replica set<br />
<code><br />
# /home/mongo/bin/mongo -port 10000 -host 192.168.1.67<br />
> config = {_id:'shard2',members:[{_id: 0, host: '192.168.1.67:10001'},{_id: 1, host: '192.168.1.68:10001'}]}<br />
> rs.initiate(config);<br />
</code></p>
<p>4. Mongo start scripts<br />
1) server1<br />
<code><br />
# cat /home/mongo/bin/mongo.start.sh<br />
/home/mongo/bin/mongod -shardsvr -replSet shard1 -port 10000 -dbpath /home/mongo/data/shard11 -oplogSize 100 -logpath /home/mongo/data/shard11/shard11.log -fork<br />
/home/mongo/bin/mongod -shardsvr -replSet shard2 -port 10001 -dbpath /home/mongo/data/shard21 -oplogSize 100 -logpath /home/mongo/data/shard21/shard21.log -fork<br />
/home/mongo/bin/mongod -configsvr -dbpath /home/mongo/data/config -port 20000 -logpath /home/mongo/data/config/config.log -logappend -fork<br />
/home/mongo/bin/mongos -configdb 192.168.1.67:20000 -port 30000 -chunkSize 5 -logpath /home/mongo/data/mongos.log -logappend -fork<br />
</code><br />
2) server2<br />
<code><br />
# cat /home/mongo/bin/mongo.start.sh<br />
/home/mongo/bin/mongod -shardsvr -replSet shard1 -port 10000 -dbpath /home/mongo/data/shard12 -oplogSize 100 -logpath /home/mongo/data/shard12/shard12.log -fork<br />
/home/mongo/bin/mongod -shardsvr -replSet shard2 -port 10001 -dbpath /home/mongo/data/shard22 -oplogSize 100 -logpath /home/mongo/data/shard22/shard22.log -fork<br />
/home/mongo/bin/mongod -configsvr -dbpath /home/mongo/data/config -port 20000 -logpath /home/mongo/data/config/config.log -logappend -fork<br />
/home/mongo/bin/mongos -configdb 192.168.1.67:20000 -port 30000 -chunkSize 5 -logpath /home/mongo/data/mongos.log -logappend -fork<br />
</code><br />
Note: mongos only use 1 or 3 configdb.</p>
<p>5. Configuring the Shard Cluster<br />
<code><br />
# /home/mongo/bin/mongo 192.168.1.67:30000/admin<br />
> db<br />
admin<br />
> db.runCommand({addshard:"shard1/192.168.1.67:10000,192.168.1.68:10000", name:"s1", maxsize:20480});<br />
{ "shardAdded" : "s1", "ok" : 1 }<br />
> db.runCommand({addshard:"shard2/192.168.1.67:10001,192.168.1.68:10001", name:"s2", maxsize:20480});<br />
{ "shardAdded" : "s2", "ok" : 1 }<br />
> db.runCommand({listshards:1})<br />
{<br />
        "shards" : [<br />
                {<br />
                        "_id" : "s1",<br />
                        "host" : "shard1/192.168.1.67:10000,192.168.1.68:10000"<br />
                },<br />
                {<br />
                        "_id" : "s2",<br />
                        "host" : "shard2/192.168.1.67:10001,192.168.1.68:10001"<br />
                }<br />
        ],<br />
        "ok" : 1<br />
}<br />
> db.runCommand({enablesharding:"test_database"})<br />
{ "ok" : 1 }<br />
</code></p>
<p>Refer to:<br />
<a href="http://www.taobaodba.com/html/525_525.html">1. 配置mongodb分片群集(sharding cluster)</a><br />
<a href="http://blog.csdn.net/yulchaochow/archive/2010/12/02/6050079.aspx">2. MongoDB shard replica config/ 分片 复制 配置</a></p>
]]></content:encoded>
			<wfw:commentRss>http://liuchangjun.com/2011/04/15/howto-mongodb-installation-guide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto: FFmpeg build in Windows &amp; Linux</title>
		<link>http://liuchangjun.com/2011/04/06/howto-ffmpeg-build/</link>
		<comments>http://liuchangjun.com/2011/04/06/howto-ffmpeg-build/#comments</comments>
		<pubDate>Wed, 06 Apr 2011 02:17:54 +0000</pubDate>
		<dc:creator>star</dc:creator>
				<category><![CDATA[Tech Tools]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://liuchangjun.com/?p=245</guid>
		<description><![CDATA[<p>FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec &#8211; the leading audio/video codec library.</p> <p>Homepage: http://ffmpeg.org/</p> <p>1. Linux Test release: http://ffmpeg.org/releases/ffmpeg-0.6.2.tar.gz # cd ~/ffmpeg # wget http://ffmpeg.org/releases/ffmpeg-0.6.2.tar.gz # tar zxvf ffmpeg-0.6.2.tar.gz # cd ffmpeg-0.6.2 # ./configure # make Example code: ～/ffmpeg/ffmpeg-0.6.2/libavcodec/api-example.c # cd ~/ffmpeg/ffmpeg-0.6.2 # cp [...]]]></description>
			<content:encoded><![CDATA[<p>FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec &#8211; the leading audio/video codec library.</p>
<p>Homepage: <a href="http://ffmpeg.org/">http://ffmpeg.org/</a></p>
<p>1. Linux<br />
Test release: <a href="http://ffmpeg.org/releases/ffmpeg-0.6.2.tar.gz">http://ffmpeg.org/releases/ffmpeg-0.6.2.tar.gz</a><br />
<code><br />
# cd ~/ffmpeg<br />
# wget http://ffmpeg.org/releases/ffmpeg-0.6.2.tar.gz<br />
# tar zxvf ffmpeg-0.6.2.tar.gz<br />
# cd ffmpeg-0.6.2<br />
# ./configure<br />
# make<br />
</code><br />
Example code: ～/ffmpeg/ffmpeg-0.6.2/libavcodec/api-example.c<br />
<code><br />
# cd ~/ffmpeg/ffmpeg-0.6.2<br />
# cp ./lib*/*.a .<br />
# cp ./libavcodec/api-example.c .<br />
# touch Makefile.test<br />
</code><br />
Test Makefile:<br />
<code><br />
CC=gcc<br />
CFLAGS=-I. -L. -L/usr/lib -lm -lz -lavdevice -lavfilter -lavformat -lavcodec -lpostproc -lswscale -lavutil</code></p>
<p><code>OBJECTS = api-example.o</code></p>
<p><code>all: api-example</p>
<p>api-example: $(OBJECTS)<br />
$(CC) -o api-example $(OBJECTS) $(CFLAGS)</p>
<p>api-example.o: api-example.c<br />
$(CC) -c api-example.c $(CFLAGS)</p>
<p></code></p>
<p>&nbsp;</p>
<p><code>.PHONY: clean<br />
clean:<br />
-rm -rf $(OBJECTS) api-example<br />
</code><br />
Note: we should modify the directory of the include files!</p>
<p>2. Windows<br />
Windows builds: <a href="http://hawkeye.arrozcru.org/">http://hawkeye.arrozcru.org/</a><br />
Test release: <a href="http://hawkeye.arrozcru.org/builds/32-bit/dev/ffmpeg-git-8b8bf89-32-bit-dev.7z">http://hawkeye.arrozcru.org/builds/32-bit/dev/ffmpeg-git-8b8bf89-32-bit-dev.7z</a></p>
<p>Example code:<br />
unzip ffmpeg-git-8b8bf89-32-bit-dev.7z into the following directory.<br />
<code><br />
c:\project\ffmpeg\test.win&gt; dir<br />
api-example.c<br />
Makefile.win<br />
doc<br />
include<br />
lib<br />
</code><br />
Note: include the “include” &amp; “lib” in the project, modify the directory of the include files!</p>
]]></content:encoded>
			<wfw:commentRss>http://liuchangjun.com/2011/04/06/howto-ffmpeg-build/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto: usage of tools</title>
		<link>http://liuchangjun.com/2011/02/23/howto-usage-of-tools/</link>
		<comments>http://liuchangjun.com/2011/02/23/howto-usage-of-tools/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 09:31:02 +0000</pubDate>
		<dc:creator>star</dc:creator>
				<category><![CDATA[Tech Tools]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://liuchangjun.com/?p=242</guid>
		<description><![CDATA[yum下载不按照RPM包 <p>Refer to: http://297020555.blog.51cto.com/1396304/477757</p> <p>1. 首先安装yum-downloadonly yum install yum-downloadonly</p> <p>2. 只下载不安装 yum update httpd -y &#8211;downloadonly</p> <p>3. 只下载到指定目录，但不安装 yum update httpd -y &#8211;downloadonly &#8211;downloaddir=/opt</p> ]]></description>
			<content:encoded><![CDATA[<h1>yum下载不按照RPM包</h1>
<p>Refer to: <a href="http://297020555.blog.51cto.com/1396304/477757">http://297020555.blog.51cto.com/1396304/477757</a></p>
<p>1. 首先安装yum-downloadonly<br />
yum install yum-downloadonly</p>
<p>2. 只下载不安装<br />
yum update httpd -y &#8211;downloadonly</p>
<p>3. 只下载到指定目录，但不安装<br />
yum update httpd -y &#8211;downloadonly &#8211;downloaddir=/opt</p>
]]></content:encoded>
			<wfw:commentRss>http://liuchangjun.com/2011/02/23/howto-usage-of-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto: Voip Performance test &#8211; SIPp</title>
		<link>http://liuchangjun.com/2011/02/21/howto-sip-performance-test/</link>
		<comments>http://liuchangjun.com/2011/02/21/howto-sip-performance-test/#comments</comments>
		<pubDate>Mon, 21 Feb 2011 06:26:21 +0000</pubDate>
		<dc:creator>star</dc:creator>
				<category><![CDATA[Tech Tools]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[sip]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://liuchangjun.com/?p=241</guid>
		<description><![CDATA[<p>Homepage: http://sipp.sourceforge.net/</p> <p>测试软件 SIPp v3.2-TLS-PCAP, version unknown, built Feb 17 2011, 10:19:21.</p> <p>安装编译： 下载源代码后重新编译 # wget http://sourceforge.net/projects/sipp/files/sipp/3.2/sipp.svn.tar.gz/download?use_mirror=ncu # tar zxvf sipp.svn.tar.gz # cd sipp.svn # make pcapplay_ossl</p> <p>备注：测试RTP需要pcap包，测试认证需要OpenSSL包，e.g. * C++ Compiler * curses or ncurses library * For authentication and TLS support: OpenSSL &#62;= 0.9.8 * For pcap play support: libpcap and libnet * For [...]]]></description>
			<content:encoded><![CDATA[<p>Homepage: <a href="http://sipp.sourceforge.net/">http://sipp.sourceforge.net/</a></p>
<p>测试软件<br />
SIPp v3.2-TLS-PCAP, version unknown, built Feb 17 2011, 10:19:21.</p>
<p>安装编译：<br />
下载源代码后重新编译<br />
# wget http://sourceforge.net/projects/sipp/files/sipp/3.2/sipp.svn.tar.gz/download?use_mirror=ncu<br />
# tar zxvf sipp.svn.tar.gz<br />
# cd sipp.svn<br />
# make pcapplay_ossl</p>
<p>备注：测试RTP需要pcap包，测试认证需要OpenSSL包，e.g.<br />
* C++ Compiler<br />
* curses or ncurses library<br />
* For authentication and TLS support: OpenSSL &gt;= 0.9.8<br />
* For pcap play support: libpcap and libnet<br />
* For distributed pauses: Gnu Scientific Libraries</p>
<p>测试脚本命令<br />
sipp -sf meeting.xml -inf meeting.csv -l 60 -m 60 -i 192.168.1.67 192.168.1.40:5060</p>
<p>测试流程<br />
1. 创建会议接入号：10000；<br />
2. 创建会议：123456，密码：123；</p>
<p>SIPp UAC               MCU<br />
|(1) INVITE         |<br />
|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&gt;|<br />
|(2) 100 (optional) |<br />
|&lt;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;|<br />
|(3) 183 (optional) |<br />
|&lt;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;|<br />
|(4) 200            |<br />
|&lt;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;|<br />
|(5) ACK            |<br />
|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&gt;|<br />
|                   |<br />
|(6) RFC2833 DIGIT  |<br />
|    (123456#)      |<br />
|                   |<br />
|==================&gt;|<br />
|(7) RFC2833 DIGIT  |<br />
|                   |<br />
|      (123#)       |<br />
|==================&gt;|<br />
|                   |<br />
|(8) RTP send (600s)|<br />
|==================&gt;|<br />
|                   |<br />
|(9) BYE            |<br />
|&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&gt;|<br />
|(10) 200           |<br />
|&lt;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;|</p>
<p>相关脚本：<br />
gennum.sh<br />
<code><br />
#!/bin/bash<br />
echo "SEQUENTIAL" &gt; meeting.csv<br />
i=80000<br />
while [ $i != 89999  ]<br />
do<br />
i=$(($i+1))<br />
echo "$i;10000" &gt;&gt;meeting.csv<br />
#  j=$(($i+1))<br />
#echo "$i;[authentication username=$i password=$i]" &gt;&gt;meeting.csv<br />
done<br />
</code></p>
<p>meeting.csv<br />
<code><br />
SEQUENTIAL<br />
80001;10000<br />
80002;10000<br />
80003;10000<br />
</code></p>
<p>meeting.sh<br />
<code><br />
./sipp -sf meeting.xml -inf meeting.csv -p 10000 -l 60 -m 10000 -i 192.168.1.67 192.168.1.40:15060<br />
</code></p>
<p>meeting.xml<br />
<a href="http://sipp.sourceforge.net/doc/uac_pcap.xml">参考uac_pcap.xml</a></p>
<p>Refer to:<br />
<a href="http://blogold.chinaunix.net/u/4631/showart_220923.html">SIP压力测试最好的工具，SIPp的安装与使用</a></p>
]]></content:encoded>
			<wfw:commentRss>http://liuchangjun.com/2011/02/21/howto-sip-performance-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto: MySQL Master Slave Configuration</title>
		<link>http://liuchangjun.com/2011/02/12/mysql-master-slave/</link>
		<comments>http://liuchangjun.com/2011/02/12/mysql-master-slave/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 03:33:08 +0000</pubDate>
		<dc:creator>star</dc:creator>
				<category><![CDATA[Tech Tools]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[master]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[slave]]></category>

		<guid isPermaLink="false">http://liuchangjun.com/?p=239</guid>
		<description><![CDATA[Mysql Master-Slave configuration 网络环境 <p>主服务器：server1, 192.168.2.231</p> <p>备份服务器：server2, 192.168.1.78</p> 配置主备数据库 创建同步用户 <p>在主数据库上创建同步用户，以便该帐号可以访问主数据库。</p> <p>e.g.</p> <p>mysql&#62; GRANT REPLICATION SLAVE ON *.* TO &#8216;repl&#8217;@&#8217;192.168.1.78&#8242; IDENTIFIED BY &#8217;123456&#8242;;</p> <p>验证方法，可以登录到备份服务器使用下面的命令访问主服务器，如果可以访问说明配置正确：</p> <p># mysql –u repl –p –h 192.168.2.231</p> 修改数据库配置文件 <p>注意：所有服务器的server-id不能相同！！！</p> <p>1. 修改主配置文件</p> <p># vi /etc/my.cnf</p> <p>[mysqld]</p> <p>log-bin=mysql-bin</p> <p>server-id=1   # 1 &#8211; 2^32-1</p> <p>2. 修改备配置文件</p> <p># vi /etc/my.cnf</p> <p>[mysqld]</p> <p>server-id=101      # 1 &#8211; [...]]]></description>
			<content:encoded><![CDATA[<h1>Mysql Master-Slave configuration</h1>
<h2>网络环境</h2>
<p>主服务器：server1, 192.168.2.231</p>
<p>备份服务器：server2, 192.168.1.78</p>
<h2>配置主备数据库</h2>
<h3>创建同步用户</h3>
<p>在主数据库上创建同步用户，以便该帐号可以访问主数据库。</p>
<p>e.g.</p>
<p>mysql&gt; GRANT REPLICATION SLAVE ON *.* TO &#8216;repl&#8217;@&#8217;192.168.1.78&#8242; IDENTIFIED BY &#8217;123456&#8242;;</p>
<p>验证方法，可以登录到备份服务器使用下面的命令访问主服务器，如果可以访问说明配置正确：</p>
<p># mysql –u repl –p –h 192.168.2.231</p>
<h3>修改数据库配置文件</h3>
<p>注意：所有服务器的server-id不能相同！！！</p>
<p>1. 修改主配置文件</p>
<p># vi /etc/my.cnf</p>
<p>[mysqld]</p>
<p>log-bin=mysql-bin</p>
<p>server-id=1   # 1 &#8211; 2^32-1</p>
<p>2. 修改备配置文件</p>
<p># vi /etc/my.cnf</p>
<p>[mysqld]</p>
<p>server-id=101      # 1 &#8211; 2^32-1</p>
<p>3. 重启主备数据库</p>
<p># service mysqld restart</p>
<h3>备份主数据库文件并导入备份数据库（方法一）</h3>
<p>注意：确认主数据库不被修改！！！</p>
<p>1. 主服务器上操作：</p>
<p>备份数据库</p>
<p># mysqldump &#8211;all-databases &gt; /root/mysql-backup.sql</p>
<p>打包备份文件</p>
<p># tar czvf /root/mysql-backup.tar.gz /root/mysql-backup.sql</p>
<p>复制到备份服务器</p>
<p># scp /root/mysql-backup.tar.gz root@server2:/root/</p>
<p>2. 备份服务器上操作：</p>
<p>解压备份文件</p>
<p># cd /root</p>
<p># tar zxvf /root/mysql-backup.tar.gz</p>
<p>导入到备份数据库</p>
<p># mysql –u roo –p &lt; /root/mysql-backup.sql</p>
<h3>备份主数据库文件并导入备份数据库（方法二）</h3>
<p>1. 主服务器上操作：</p>
<p>锁定数据库只读</p>
<p>mysql&gt; FLUSH TABLES WITH READ LOCK;</p>
<p>不要退出上面的命令，备份数据库文件</p>
<p># tar zcvf /root/backup.tar.gz /var/lib/mysql</p>
<p>复制到备份服务器</p>
<p># scp /root/ backup.tar.gz root@server2:/root/</p>
<p>记录master状态</p>
<p>mysql&gt; SHOW MASTER STATUS;</p>
<p>释放数据库锁</p>
<p>mysql&gt; UNLOCK TABLES;</p>
<p>2. 备份服务器上操作：</p>
<p>停止mysql服务</p>
<p># service mysqld stop</p>
<p>解压备份文件</p>
<p># cd /var/lib/mysql</p>
<p># tar zxvf /root/mysql-backup.tar.gz</p>
<p>启动mysql服务</p>
<p># service mysqld start</p>
<h2>配置主备同步</h2>
<h3>查看主数据库状态</h3>
<p>查看master状态，记录下File和Position</p>
<p>mysql&gt; show master status;</p>
<p>| File              | Position  | Binlog_Do_DB | Binlog_Ignore_DB |</p>
<p>| mysql-bin.000001 | 72267996 |              |                  |</p>
<h3>设置Master，查看备份数据库状态</h3>
<p>1. 设置Master</p>
<p>mysql&gt; CHANGE MASTER TO MASTER_HOST=&#8217;192.168.2.231&#8242;, MASTER_USER=&#8217;repl&#8217;, MASTER_PASSWORD=&#8217;123456&#8242;, MASTER_LOG_FILE=&#8217;mysql-bin.000001&#8242;, MASTER_LOG_POS=72267996;</p>
<p>2. 查看slave状态</p>
<p>mysql&gt; show slave status;</p>
<p>| Connecting to master | 192.168.2.231 | repl        |        3306 |            60 | mysql-bin.000001 |            72267996 | mysqld-relay-bin.000001 |            98 | mysql-bin.000001      | No               | Yes               |                 |                     |                    |                        |                         |                             |          0 |            |            0 |            72267996 |              98 | None            |                |             0 | No                 |                    |                    |                 |                   |                |                  NULL |</p>
<p>3. 启动slave</p>
<p>mysql&gt; start slave;</p>
<p>4. 验证同步状态</p>
<p>检查主数据库进程状态，共1个同步进程</p>
<p>mysql&gt; show processlist;</p>
<p>110346 | repl       | 192.168.1.78:45597 | NULL       | Binlog Dump | 59523 | Has sent all binlog to slave; waiting for binlog to be updated | NULL</p>
<p>检查备份数据库进程状态，共2个同步进程</p>
<p>mysql&gt; show processlist;</p>
<p>|    1 | system user |                 | NULL       | Connect | 59472 | Waiting for master to send event                                      | NULL |</p>
<p>|    2 | system user |                 | NULL       | Connect |    35 | Has read all relay log; waiting for the slave I/O thread to update it | NULL |</p>
<p>修改主数据库数据，然后在备份数据库查看备份数据库是否也修改成功。</p>
<h2>FAQ</h2>
<h3>Q1：同步数据库启动失败？</h3>
<p># tail -f /var/log/mysqld.log</p>
<p>101117 12:52:25  mysqld started</p>
<p>101117 12:52:25  InnoDB: Started; log sequence number 0 8769907</p>
<p>101117 12:52:25 [Note] /usr/libexec/mysqld: ready for connections.</p>
<p>Version: &#8217;5.0.22&#8242;  socket: &#8216;/var/lib/mysql/mysql.sock&#8217;  port: 3306  Source distribution</p>
<p>101117 12:56:50 [Warning] Neither &#8211;relay-log nor &#8211;relay-log-index were used; so replication may break when this MySQL server acts as a slave and has his hostname changed!! Please use &#8216;&#8211;relay-log=hzserver2-relay-bin&#8217; to avoid this problem.</p>
<p>101117 13:38:18 [Note] Slave SQL thread initialized, starting replication in log &#8216;FIRST&#8217; at position 0, relay log &#8216;./hzserver2-relay-bin.000001&#8242; position: 4</p>
<p>101117 13:38:18 [Note] Slave I/O thread: connected to master &#8216;repl@hzserver1:3306&#8242;,  replication started in log &#8216;FIRST&#8217; at position 4</p>
<p>101117 13:41:39 [Note] /usr/libexec/mysqld: Normal shutdown</p>
<p>101117 13:41:39 [Note] Slave I/O thread killed while reading event</p>
<p>101117 13:41:39 [Note] Slave I/O thread exiting, read up to log &#8216;hzserver1-bin.000001&#8242;, position 98</p>
<p>101117 13:41:39 [Note] Error reading relay log event: slave SQL thread was killed</p>
<p>101117 13:41:39  InnoDB: Starting shutdown&#8230;</p>
<p>101117 13:41:42  InnoDB: Shutdown completed; log sequence number 0 8769907</p>
<p>101117 13:41:42 [Note] /usr/libexec/mysqld: Shutdown complete</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<h3>A1：修改启动脚本</h3>
<p>增加启动项：&#8217;&#8211;relay-log=hzserver2-relay-bin&#8217;</p>
<p># vi /etc/init.d/mysqld</p>
<p>/usr/bin/mysqld_safe  &#8211;defaults-file=/etc/my.cnf &#8211;pid-file=”$mypidfile” &#8211;log-error=”$errlogfile” &#8211;relay-log=hzserver2-relay-bin&gt;/dev/null 2&gt;&amp;1 &amp;</p>
<h2>参考资料</h2>
<p>官方资料：</p>
<p><a href="http://dev.mysql.com/doc/refman/5.5/en/replication-howto.html">http://dev.mysql.com/doc/refman/5.5/en/replication-howto.html</a></p>
<p>如何设置MySQL同步(Replication)</p>
<p><a href="http://blog.chinaitlab.com/html/30/104830-161852.html">http://blog.chinaitlab.com/html/30/104830-161852.html</a></p>
<p>MYSQL主从复制或双机互备</p>
<p><a href="http://hi.baidu.com/ultimated_fantasy/blog/item/f6752d1843f9450034fa4148.html">http://hi.baidu.com/ultimated_fantasy/blog/item/f6752d1843f9450034fa4148.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://liuchangjun.com/2011/02/12/mysql-master-slave/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto: 安装配置CentOS文件同步</title>
		<link>http://liuchangjun.com/2010/12/17/howto-installation-inotify-tools-rsync/</link>
		<comments>http://liuchangjun.com/2010/12/17/howto-installation-inotify-tools-rsync/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 03:32:54 +0000</pubDate>
		<dc:creator>star</dc:creator>
				<category><![CDATA[Tech Tools]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[rsync]]></category>
		<category><![CDATA[sync]]></category>

		<guid isPermaLink="false">http://liuchangjun.com/?p=237</guid>
		<description><![CDATA[<p>Homepage: inotify-tools</p> <p>master: the source host slave: the destination host</p> <p>1. Download inotify-tools package and installation</p> <p>master # cd ~ master # wget https://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz master # tar zxvf inotify-tools-3.14.tar.gz master # cd inotify-tools-3.14 master # ./configure master # make master # make install</p> <p>2. Generate the SSH KEY to access without the password</p> <p>master # [...]]]></description>
			<content:encoded><![CDATA[<p>Homepage: <a href="https://github.com/rvoicilas/inotify-tools">inotify-tools</a></p>
<p>master: the source host<br />
slave: the destination host</p>
<p>1. Download inotify-tools package and installation</p>
<blockquote><p>master # cd ~<br />
master # wget https://github.com/downloads/rvoicilas/inotify-tools/inotify-tools-3.14.tar.gz<br />
master # tar zxvf inotify-tools-3.14.tar.gz<br />
master # cd inotify-tools-3.14<br />
master # ./configure<br />
master # make<br />
master # make install</p></blockquote>
<p>2. Generate the SSH KEY to access without the password</p>
<blockquote><p>master # cd ~<br />
master # ssh-keygen -t rsa   # two files: id_rsa (private key) &amp; id_rsa.pub (public key) in ~/.ssh/<br />
master # scp ~/.ssh/id_rsa.pub root@slave:~/.ssh/<br />
slave # cat ~/.ssh/id_rsa.pub &gt;&gt; ~/.ssh/authorized_keys<br />
slave # service sshd restart</p></blockquote>
<p>3. Create sync shell</p>
<blockquote><p>master # cat /etc/rc.local<br />
<code>nohup /backup/scripts/sync.sh &amp; &gt; /dev/null 2&gt;&amp;1</code></p></blockquote>
<blockquote><p>master # cat /backup/scripts/sync.sh<br />
<code><br />
#!/bin/sh<br />
ip="xxx.xxx.xxx.xxx yyy.yyy.yyy.yyy" # Add multiple IP address of slave hosts<br />
srcdir="/backup/"<br />
dstdir="/backup/"<br />
/usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y-%H:%M' --format '%T %w%f' -e modify,delete,create,attrib ${srcdir} \<br />
| while read file<br />
do<br />
for i in $ip<br />
do<br />
rsync -aqztH --delete --progress ${srcdir} root@${i}:${dstdir}<br />
done<br />
done</code></p></blockquote>
<p>Refer to:<br />
<a href="http://www.cnblogs.com/captain_jack/archive/2010/09/29/1838493.html">Cent OS 5.4 rsync+inotify配置触发式(实时)远程同步</a></p>
]]></content:encoded>
			<wfw:commentRss>http://liuchangjun.com/2010/12/17/howto-installation-inotify-tools-rsync/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto: GTD tools</title>
		<link>http://liuchangjun.com/2010/11/10/howto-gtd-tools/</link>
		<comments>http://liuchangjun.com/2010/11/10/howto-gtd-tools/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 05:43:13 +0000</pubDate>
		<dc:creator>star</dc:creator>
				<category><![CDATA[Tech Tools]]></category>
		<category><![CDATA[GTD]]></category>
		<category><![CDATA[Howto]]></category>

		<guid isPermaLink="false">http://liuchangjun.com/?p=235</guid>
		<description><![CDATA[<p>EverNote: win/mac/web &#038; iPad/iPhone/Android/BlackBerry/Palm/WinMobile DropBox: win/mac/linux &#038; iphone/ipad/andriod/blackberry Blocked! RTM (Remember The Milk): web OmniFocus: mac/iphone/ipad, trial mode for 14 days Things: mac/iphone/ipad</p> <p>Refer to: What is GTD 【幸福课】如何提高创作型任务的效率？（MAC版） GTD软件工具列表</p> ]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.evernote.com/">EverNote: win/mac/web &#038; iPad/iPhone/Android/BlackBerry/Palm/WinMobile</a><br />
<a href="http://www.dropbox.com">DropBox: win/mac/linux &#038; iphone/ipad/andriod/blackberry</a> Blocked!<br />
<a href="https://www.rememberthemilk.com/">RTM (Remember The Milk): web</a><br />
<a href="http://www.omnigroup.com/">OmniFocus: mac/iphone/ipad, trial mode for 14 days</a><br />
<a href="http://culturedcode.com/things/">Things: mac/iphone/ipad</a></p>
<p>Refer to:<br />
<a href="http://zh.wikipedia.org/zh/GTD">What is GTD</a><br />
<a href="http://www.xingfuke.net/psyblog/xingfuke1796.html">【幸福课】如何提高创作型任务的效率？（MAC版）</a><br />
<a href="http://www.lifebang.com/archives/145">GTD软件工具列表</a></p>
]]></content:encoded>
			<wfw:commentRss>http://liuchangjun.com/2010/11/10/howto-gtd-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Howto: Translation</title>
		<link>http://liuchangjun.com/2010/11/10/howto-translation/</link>
		<comments>http://liuchangjun.com/2010/11/10/howto-translation/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 02:52:32 +0000</pubDate>
		<dc:creator>star</dc:creator>
				<category><![CDATA[Tech Tools]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[translation]]></category>

		<guid isPermaLink="false">http://liuchangjun.com/?p=234</guid>
		<description><![CDATA[<p>Gettext Gettext 主页 简介：是GNU国际化与本地化(i18n)函数库。它常被用于编写多语言程序。</p> <p>xgettext: 源代码 =&#62; .pot模板文件 # xgettext &#8211;help e.g. # xgettext -LPHP /xxx/yyy/zzz.php </p> <p># xgettext --help Usage: xgettext [OPTION] [INPUTFILE]...</p> <p>Extract translatable strings from given input files.</p> <p>Mandatory arguments to long options are mandatory for short options too. Similarly for optional arguments.</p> <p>Input file location: INPUTFILE ... input files -f, --files-from=FILE [...]]]></description>
			<content:encoded><![CDATA[<p>Gettext<br />
<a href="http://www.gnu.org/software/gettext/gettext.html">Gettext 主页</a><br />
<a href="http://zh.wikipedia.org/zh-cn/Gettext">简介：是GNU国际化与本地化(i18n)函数库。它常被用于编写多语言程序。</a></p>
<blockquote><p>xgettext:   源代码 =&gt; .pot模板文件<br />
# xgettext &#8211;help<br />
e.g.<br />
# xgettext -LPHP /xxx/yyy/zzz.php
</p></blockquote>
<p><code># xgettext --help<br />
Usage: xgettext [OPTION] [INPUTFILE]...</p>
<p>Extract translatable strings from given input files.</p>
<p>Mandatory arguments to long options are mandatory for short options too.<br />
Similarly for optional arguments.</p>
<p>Input file location:<br />
  INPUTFILE ...               input files<br />
  -f, --files-from=FILE       get list of input files from FILE<br />
  -D, --directory=DIRECTORY   add DIRECTORY to list for input files search<br />
If input file is -, standard input is read.</p>
<p>Output file location:<br />
  -d, --default-domain=NAME   use NAME.po for output (instead of messages.po)<br />
  -o, --output=FILE           write output to specified file<br />
  -p, --output-dir=DIR        output files will be placed in directory DIR<br />
If output file is -, output is written to standard output.</p>
<p>Choice of input file language:<br />
  -L, --language=NAME         recognise the specified language<br />
                                (C, C++, ObjectiveC, PO, Shell, Python, Lisp,<br />
                                EmacsLisp, librep, Scheme, Smalltalk, Java,<br />
                                JavaProperties, C#, awk, YCP, Tcl, Perl, PHP,<br />
                                GCC-source, NXStringTable, RST, Glade)<br />
  -C, --c++                   shorthand for --language=C++<br />
By default the language is guessed depending on the input file name extension.</p>
<p>Input file interpretation:<br />
      --from-code=NAME        encoding of input files<br />
                                (except for Python, Tcl, Glade)<br />
By default the input files are assumed to be in ASCII.</p>
<p>Operation mode:<br />
  -j, --join-existing         join messages with existing file<br />
  -x, --exclude-file=FILE.po  entries from FILE.po are not extracted<br />
  -c, --add-comments[=TAG]    place comment block with TAG (or those<br />
                              preceding keyword lines) in output file</p>
<p>Language specific options:<br />
  -a, --extract-all           extract all strings<br />
                                (only languages C, C++, ObjectiveC, Shell,<br />
                                Python, Lisp, EmacsLisp, librep, Scheme, Java,<br />
                                C#, awk, Tcl, Perl, PHP, GCC-source, Glade)<br />
  -k, --keyword[=WORD]        additional keyword to be looked for (without<br />
                              WORD means not to use default keywords)<br />
                                (only languages C, C++, ObjectiveC, Shell,<br />
                                Python, Lisp, EmacsLisp, librep, Scheme, Java,<br />
                                C#, awk, Tcl, Perl, PHP, GCC-source, Glade)<br />
      --flag=WORD:ARG:FLAG    additional flag for strings inside the argument<br />
                              number ARG of keyword WORD<br />
                                (only languages C, C++, ObjectiveC, Shell,<br />
                                Python, Lisp, EmacsLisp, librep, Scheme, Java,<br />
                                C#, awk, YCP, Tcl, Perl, PHP, GCC-source)<br />
  -T, --trigraphs             understand ANSI C trigraphs for input<br />
                                (only languages C, C++, ObjectiveC)<br />
      --qt                    recognize Qt format strings<br />
                                (only language C++)<br />
      --debug                 more detailed formatstring recognition result</p>
<p>Output details:<br />
  -e, --no-escape             do not use C escapes in output (default)<br />
  -E, --escape                use C escapes in output, no extended chars<br />
      --force-po              write PO file even if empty<br />
  -i, --indent                write the .po file using indented style<br />
      --no-location           do not write '#: filename:line' lines<br />
  -n, --add-location          generate '#: filename:line' lines (default)<br />
      --strict                write out strict Uniforum conforming .po file<br />
      --properties-output     write out a Java .properties file<br />
      --stringtable-output    write out a NeXTstep/GNUstep .strings file<br />
  -w, --width=NUMBER          set output page width<br />
      --no-wrap               do not break long message lines, longer than<br />
                              the output page width, into several lines<br />
  -s, --sort-output           generate sorted output<br />
  -F, --sort-by-file          sort output by file location<br />
      --omit-header           don't write header with `msgid ""' entry<br />
      --copyright-holder=STRING  set copyright holder in output<br />
      --foreign-user          omit FSF copyright in output for foreign user<br />
      --msgid-bugs-address=EMAIL@ADDRESS  set report address for msgid bugs<br />
  -m, --msgstr-prefix[=STRING]  use STRING or "" as prefix for msgstr entries<br />
  -M, --msgstr-suffix[=STRING]  use STRING or "" as suffix for msgstr entries</p>
<p>Informative output:<br />
  -h, --help                  display this help and exit<br />
  -V, --version               output version information and exit</code></p>
<blockquote><p>msginit:   .pot模板文件 =&gt; .po文件 (翻译者需要工作的对象)<br />
# msginit &#8211;help<br />
Creates a new PO file, initializing the meta information with values from the<br />
user&#8217;s environment.</p></blockquote>
<p><code># msginit --help<br />
Usage: msginit [OPTION]</p>
<p>Creates a new PO file, initializing the meta information with values from the<br />
user's environment.</p>
<p>Mandatory arguments to long options are mandatory for short options too.</p>
<p>Input file location:<br />
  -i, --input=INPUTFILE       input POT file<br />
If no input file is given, the current directory is searched for the POT file.<br />
If it is -, standard input is read.</p>
<p>Output file location:<br />
  -o, --output-file=FILE      write output to specified PO file<br />
If no output file is given, it depends on the --locale option or the user's<br />
locale setting.  If it is -, the results are written to standard output.</p>
<p>Input file syntax:<br />
  -P, --properties-input      input file is in Java .properties syntax<br />
      --stringtable-input     input file is in NeXTstep/GNUstep .strings syntax</p>
<p>Output details:<br />
  -l, --locale=LL_CC          set target locale<br />
      --no-translator         assume the PO file is automatically generated<br />
  -p, --properties-output     write out a Java .properties file<br />
      --stringtable-output    write out a NeXTstep/GNUstep .strings file<br />
  -w, --width=NUMBER          set output page width<br />
      --no-wrap               do not break long message lines, longer than<br />
                              the output page width, into several lines</p>
<p>Informative output:<br />
  -h, --help                  display this help and exit<br />
  -V, --version               output version information and exit</code></p>
<blockquote><p>msgfmt:   .po文件 =&gt; 编译为.mo文件<br />
# msgfmt &#8211;help<br />
e.g.<br />
# msgfmt /xxx/yyy/zzz.po<br />
Note:<br />
msgfmt: messages.po: warning: Charset “CHARSET” is not a portable encoding name.<br />
You should update the “CHARSET” with “utf-8&#8243; in zzz.po file.
</p></blockquote>
<p><code># msgfmt --help<br />
Usage: msgfmt [OPTION] filename.po ...</p>
<p>Generate binary message catalog from textual translation description.</p>
<p>Mandatory arguments to long options are mandatory for short options too.<br />
Similarly for optional arguments.</p>
<p>Input file location:<br />
  filename.po ...             input files<br />
  -D, --directory=DIRECTORY   add DIRECTORY to list for input files search<br />
If input file is -, standard input is read.</p>
<p>Operation mode:<br />
  -j, --java                  Java mode: generate a Java ResourceBundle class<br />
      --java2                 like --java, and assume Java2 (JDK 1.2 or higher)<br />
      --csharp                C# mode: generate a .NET .dll file<br />
      --csharp-resources      C# resources mode: generate a .NET .resources file<br />
      --tcl                   Tcl mode: generate a tcl/msgcat .msg file<br />
      --qt                    Qt mode: generate a Qt .qm file</p>
<p>Output file location:<br />
  -o, --output-file=FILE      write output to specified file<br />
      --strict                enable strict Uniforum mode<br />
If output file is -, output is written to standard output.</p>
<p>Output file location in Java mode:<br />
  -r, --resource=RESOURCE     resource name<br />
  -l, --locale=LOCALE         locale name, either language or language_COUNTRY<br />
  -d DIRECTORY                base directory of classes directory hierarchy<br />
The class name is determined by appending the locale name to the resource name,<br />
separated with an underscore.  The -d option is mandatory.  The class is<br />
written under the specified directory.</p>
<p>Output file location in C# mode:<br />
  -r, --resource=RESOURCE     resource name<br />
  -l, --locale=LOCALE         locale name, either language or language_COUNTRY<br />
  -d DIRECTORY                base directory for locale dependent .dll files<br />
The -l and -d options are mandatory.  The .dll file is written in a<br />
subdirectory of the specified directory whose name depends on the locale.</p>
<p>Output file location in Tcl mode:<br />
  -l, --locale=LOCALE         locale name, either language or language_COUNTRY<br />
  -d DIRECTORY                base directory of .msg message catalogs<br />
The -l and -d options are mandatory.  The .msg file is written in the<br />
specified directory.</p>
<p>Input file syntax:<br />
  -P, --properties-input      input files are in Java .properties syntax<br />
      --stringtable-input     input files are in NeXTstep/GNUstep .strings<br />
                              syntax</p>
<p>Input file interpretation:<br />
  -c, --check                 perform all the checks implied by<br />
                                --check-format, --check-header, --check-domain<br />
      --check-format          check language dependent format strings<br />
      --check-header          verify presence and contents of the header entry<br />
      --check-domain          check for conflicts between domain directives<br />
                                and the --output-file option<br />
  -C, --check-compatibility   check that GNU msgfmt behaves like X/Open msgfmt<br />
      --check-accelerators[=CHAR]  check presence of keyboard accelerators for<br />
                                menu items<br />
  -f, --use-fuzzy             use fuzzy entries in output</p>
<p>Output details:<br />
  -a, --alignment=NUMBER      align strings to NUMBER bytes (default: 1)<br />
      --no-hash               binary file will not include the hash table</p>
<p>Informative output:<br />
  -h, --help                  display this help and exit<br />
  -V, --version               output version information and exit<br />
      --statistics            print statistics about translations<br />
  -v, --verbose               increase verbosity level<br />
</code></p>
<blockquote><p>备注：使用Unix类型操作系统的用户只需设置环境变量中的LC_MESSAGES，程序将自动从相应的.mo 文件中读取语言信息。</p></blockquote>
<p>Mozilla<br />
<a href="http://www.limodev.cn/blog/archives/513">Mozilla的架构设计</a><br />
<a href="http://books.mozdev.org/html/mozilla-chp-11.html">Creating Applications with Mozilla</a></p>
<blockquote><p>DTD (.dtd)<br />
Files containing entities that host the strings from XUL content files.<br />
Property (.properties) or string bundles<br />
Files containing strings that are accessed by JavaScript, C++, and possibly other scripting or component files.<br />
RDF<br />
RDF files are described in XML syntax, so use entities.<br />
HTML and text<br />
Suitable for long text, HTML and XML documents and other content that needs to be localized.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://liuchangjun.com/2010/11/10/howto-translation/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

