<?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>Chunhao's Blog</title>
	<atom:link href="http://chunhao.net/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://chunhao.net/blog</link>
	<description>Life happens, love helps…</description>
	<lastBuildDate>Thu, 23 Jul 2009 06:45:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Partial Eclipse</title>
		<link>http://chunhao.net/blog/partial-eclipse</link>
		<comments>http://chunhao.net/blog/partial-eclipse#comments</comments>
		<pubDate>Thu, 23 Jul 2009 06:30:50 +0000</pubDate>
		<dc:creator>Chunhao</dc:creator>
				<category><![CDATA[other]]></category>

		<guid isPermaLink="false">http://chunhao.net/blog/?p=135</guid>
		<description><![CDATA[Thanks Newton for his discovery of the law of the universe, and so can we predict the occurrence of eclipses so accurately.
On July 22, the solar eclipse occurred in the Yangtze River Basin in China. However, in my hometown, there was only partial eclipse. Following are some photos taken by me, with the assistant of [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks Newton for his discovery of the law of the universe, and so can we predict the occurrence of eclipses so accurately.</p>
<p>On July 22, the solar eclipse occurred in the Yangtze River Basin in China. However, in my hometown, there was only partial eclipse. Following are some photos taken by me, with the assistant of a telescope.</p>
<p style="text-align: center;">
<div class="wp-caption aligncenter" style="width: 530px"><img title="partial-eclipse-1" src="http://blog.chunhao.net/wp-content/uploads/2009/07/DSCN0531.jpg" alt="before most eclipse" width="520" height="390" /><p class="wp-caption-text">before most eclipse</p></div>
<p><span id="more-135"></span></p>
<div class="wp-caption aligncenter" style="width: 530px"><img title="partial-eclipse-2" src="http://blog.chunhao.net/wp-content/uploads/2009/07/DSCN0540.jpg" alt="most eclipse" width="520" height="390" /><p class="wp-caption-text">most eclipse</p></div>
<div class="wp-caption aligncenter" style="width: 530px"><img title="partial-eclipse-3" src="http://blog.chunhao.net/wp-content/uploads/2009/07/DSCN0572.jpg" alt="begin recovery" width="520" height="390" /><p class="wp-caption-text">begin recovery</p></div>
<div class="wp-caption aligncenter" style="width: 530px"><img title="partial-eclipse-4" src="http://blog.chunhao.net/wp-content/uploads/2009/07/DSCN0627.jpg" alt="almost reoved" width="520" height="390" /><p class="wp-caption-text">almost reoved</p></div>
<div class="wp-caption aligncenter" style="width: 530px"><img title="partial-eclipse-5" src="http://blog.chunhao.net/wp-content/uploads/2009/07/DSCN0632.jpg" alt="recoverd" width="520" height="390" /><p class="wp-caption-text">recoverd</p></div>
 <img src="http://chunhao.net/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=135" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/partial-eclipse/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Are Your Fingers Long Enough to Use Vim?</title>
		<link>http://chunhao.net/blog/are-your-fingers-long-enough-to-use-vim</link>
		<comments>http://chunhao.net/blog/are-your-fingers-long-enough-to-use-vim#comments</comments>
		<pubDate>Fri, 12 Jun 2009 12:14:27 +0000</pubDate>
		<dc:creator>Chunhao</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[emacs]]></category>

		<guid isPermaLink="false">http://chunhao.net/blog/?p=122</guid>
		<description><![CDATA[Note: I wrote this post just for fun. Please don’t take it seriously.  Thank you!  
Which editor are you using, Vim or Emacs? And why?
Next time, when you are arguing with other people about which editor is better and trying to persuade others to use your favorite editor, just forget it. If you [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">Note: I wrote this post just for fun. Please don’t take it seriously.</span> <span style="color: #ff0000;"> Thank you!</span> <img src='http://chunhao.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Which editor are you using, Vim or Emacs? And why?</p>
<p>Next time, when you are arguing with other people about which editor is better and trying to persuade others to use your favorite editor, just forget it. If you believe everything is in destiny, it is not an exception for the editor you choose. The choice is written on your fingers.</p>
<p>Several days ago, I learnt from <a href="http://mike.struct.cn">Mike</a> that the choice between using Vim or Emacs depends on your fingers. As he figured out, people have longer fingers prefer to use Vim, while people have shorter fingers prefer to use Emacs. It is amazing, but reasonable.</p>
<p><span id="more-122"></span></p>
<p>Using Vim, the most frequent key you hits might be the &#8220;Esc&#8221;. Vim has three modes: insert mode, command mode and visual mode. Command mode is the bridge of other two modes, and most of navigating and searching is done in command mode. So, when you are using Vim, you must: press &#8220;a&#8221; or &#8220;i&#8221; to start insert mode and input something, then press the &#8220;Esc&#8221; to enter the command mode and do navigation, then enter the insert mode again and then press the &#8220;Esc&#8221; to the command mode. Maybe some times you want to hit &#8220;v&#8221; to enter the visual mode to select something, and after that you must hit the &#8220;Esc&#8221; again back to the command mode. At most time, you are hitting the &#8220;Esc&#8221;. That&#8217;s why they call Vim &#8220;hit Esc to death&#8221;. Of course, you also need Ctrl and Shift in vim, but not so often. For example, when you select contents by line or by block, you will press &#8220;Shift+v&#8221; or &#8220;Ctrl+v&#8221;. When you want to jump to the end of a line, you will press &#8220;$&#8221;(Shift+4). But these cases are much rearer than hitting the &#8220;Esc&#8221;. So, when your fingers are long enough, you will find it very comfortable and easy to hit the &#8220;Esc&#8221;. Maybe that&#8217;s why you like to use Vim.</p>
<p>I have touched Emacs for little times. In Emacs, almost everything except for inputing text are done by &#8220;Ctrl+something&#8221;, &#8220;Shift+something&#8221;, &#8220;Alt+something&#8221;, or even &#8220;Ctrl+Alt/Shift+something&#8221;. That means at most time, one of your finger must hit &#8220;Ctrl&#8221;, &#8220;Shift&#8221; or &#8220;Alt&#8221;. That&#8217;s why they call Emacs &#8220;hit Ctrl to death&#8221;. Some Emacs fans even want to use pedals to help them hit hot keys. I have to twist my fingers to hit those keys. For some complicated combination of keys, I even don&#8217;t know how to hit them comfortably and elegantly. So I gave up Emacs soon to save my hands and fingers. Maybe people who have shorter fingers would fall in love with Emacs because they could hit these hot keys easily without twisting their fingers very much.</p>
<p>Although I prefer Vim, I don&#8217;t mean to comment Emacs and Emacs users. Emacs is also powerful, and even more powerful than Vim (at least in my mind). I admire Emacs users very much because they can learn so many hot keys by heart and use them gently and easily.</p>
<p>If you are still confusing about choosing Vim or Emacs, just check your finger. If your fingers are longer than most of your friends, then just choose Vim without hesitate and you will like the life of hitting the &#8220;Esc&#8221;. If your fingers are shorter than average and you find it&#8217;s uncomfortable to hit the &#8220;Esc&#8221; frequently, then you should definitely choose Emacs.</p>
<p>If you are still arguing with other people about Vim and Emacs, forget it, unless you want to cut some one&#8217;s finger to force them to use Emacs or lengthen some one&#8217;s finger to force them to use Vim.</p>
<p>If you are jeered by Emacs users for you are using such a disharmonious editor that has multiple confusing modes, you could respond them, &#8220;at least I have beautiful long fingers&#8221;. If you are sneered by Vim users for you are using such a complicated editor that requires a pedal to handle the hot keys, you could respond them, &#8220;at least my memory is better than you, since I could remember thousands of hot keys&#8221;.</p>
 <img src="http://chunhao.net/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=122" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/are-your-fingers-long-enough-to-use-vim/feed</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Which email client are you using?</title>
		<link>http://chunhao.net/blog/which-email-client-are-you-using</link>
		<comments>http://chunhao.net/blog/which-email-client-are-you-using#comments</comments>
		<pubDate>Wed, 03 Jun 2009 16:59:18 +0000</pubDate>
		<dc:creator>Chunhao</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[email client]]></category>
		<category><![CDATA[evolution]]></category>

		<guid isPermaLink="false">http://chunhao.net/blog/?p=110</guid>
		<description><![CDATA[What can you do for killing time? Maybe you could figure out what email clients your contacts are using. It&#8217;s funny.
Most people prefer webmail, especially Gmail. Webmail is very easy to use and does not require much configuration. Gmail is the most wonderful webmail. It groups messages by threads and it has a powerful searching [...]]]></description>
			<content:encoded><![CDATA[<p>What can you do for killing time? Maybe you could figure out what email clients your contacts are using. It&#8217;s funny.</p>
<p>Most people prefer webmail, especially Gmail. Webmail is very easy to use and does not require much configuration. Gmail is the most wonderful webmail. It groups messages by threads and it has a powerful searching tool. You can easily find out what you want from the mass.</p>
<p>However, one drawback of webmail is that you cannot access your mail off-line. Although Gmail started to support off-line email recently, I still think that keeping the emails in my local storage is safe and reliable. Moreover, an email client is generally much more customizable than webmail. So, I am using <a href="http://www.gnome.org/projects/evolution/">Evolution</a>, which is the most powerful and standard email client in Linux, to receive and send email everyday.</p>
<p><span id="more-110"></span></p>
<p>As said in the beginning, I want to figure out what email clients my contacts are using. This work is not hard. There might be some fields in the header of email indicating which client this email is generated. The field could be named &#8220;X-Mailer&#8221;, &#8220;X-mailer&#8221;, or &#8220;User-Agent&#8221;. In Evolution, you can open the menu &#8220;Edit&gt;Preferences&gt;Mail Preferences&gt;Headers&#8221;, and check the &#8220;Mailer&#8221;. Then you could see the Mailer information in your mails. Some mails are composed without the Mailer information. I don&#8217;t know why. We just ignore the mails without Mailer information.</p>
<p>Evolution stores mails in the folder &#8220;~/.evolution/mail/local/Inbox.sbd&#8221;. Under this folder, the files without extension are the mail files, which included all the contents of your mail. So, we can grab Mailer informations from these files.</p>
<p>First, we can use &#8220;grep&#8221; to filter the lines containing &#8220;X-Mailer&#8221;, &#8220;X-mailer&#8221;, and &#8220;User-Agent&#8221;. We can store them into a file.</p>
<blockquote><p>cat mail-box-name | grep X-Mailer &gt; outfile</p>
<p>cat mail-box-name | grep X-mailer &gt;&gt; outfile</p>
<p>cat mail-box-name | grep User-Agent &gt;&gt; outfile</p></blockquote>
<p>&#8220;mail-box-name&#8221; is the name of the mail files. Carefully name the outfile. Don&#8217;t let it overwrite the existing file. My suggestion is that you can copy all the mail files to another place and do these operations there. It&#8217;s safe.</p>
<p>Now we get the outfile containing Mailer information. The next step is removing useless information from this file, such as the header &#8220;X-Mailer&#8221; or the version information. This is the most boring part. Maybe there are some sophisticated methods which could do this work automatically, but I am lazy to think them up. For me, I use Vim and <a href="http://en.wikibooks.org/wiki/Learning_the_vi_editor/Vim/Modes">block-edit</a> the text (ctrl+v, then move cursor), and this work is done without much effort. Now we get the file like this:</p>
<blockquote><p>&#8230;<br />
Moto-EZX<br />
Moto-EZX<br />
Moto-EZX<br />
Mozilla<br />
Mozilla<br />
Mozilla<br />
Mutt<br />
Mutt<br />
&#8230;</p></blockquote>
<p>Then we should count them. Use this command:</p>
<blockquote><p>uniq -c inputfile &gt; outputfile</p></blockquote>
<p>Finally we get the file like this:</p>
<blockquote><p>&#8230;<br />
84 Evolution<br />
182 Foxmail<br />
1956 G2/1.0<br />
&#8230;</p></blockquote>
<p>Maybe we need some refinement for these data. For example, remove the very rare entries (e.g &lt; 10), and remove the entries that are obviously web server, such as &#8220;ASPMail&#8221;, &#8220;PHPMail&#8221;, etc.</p>
<p>After refinement, there we come to the OpenOffice Spreadsheet for analyzing these data. Again, we use Vim and block-editing to separate the count and client name, and paste them into  Spreadsheet individually. Then open &#8220;Insert&gt;Chart&#8221; and generate your favourite chart.</p>
<p>Following is my data, in which the size of sample is 3003 (after refinement):</p>
<p style="text-align: center;"><a href="http://chunhao.net/blog/wp-content/uploads/2009/06/data2.png"><img class="aligncenter size-full wp-image-111" title="email-client-distribution" src="http://chunhao.net/blog/wp-content/uploads/2009/06/data2.png" alt="email-client-distribution" width="528" height="264" /></a></p>
<p style="text-align: left;">From the chart we can see the most popular email client of my contacts is Gmail (G2/1.0). Following are Thunderbird and Foxmail. Then it comes Evolution, Apple Mail, SquirrelMail, Outlook and SFUwebmail.</p>
<p>Which client are you using?</p>
 <img src="http://chunhao.net/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=110" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/which-email-client-are-you-using/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tools for Reading Sources</title>
		<link>http://chunhao.net/blog/tools-for-reading-sources</link>
		<comments>http://chunhao.net/blog/tools-for-reading-sources#comments</comments>
		<pubDate>Thu, 21 May 2009 11:39:17 +0000</pubDate>
		<dc:creator>Chunhao</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Doxygen]]></category>
		<category><![CDATA[LXR]]></category>
		<category><![CDATA[LXRng]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[Source Navigator]]></category>

		<guid isPermaLink="false">http://chunhao.net/blog/?p=88</guid>
		<description><![CDATA[Hacking is a good method of learning. And the pre-stage of hacking is reading the source code. You might have this experience: facing a large amount of source code (generally dozens of files), you don&#8217;t know how to start, or you even don&#8217;t know how to read them. A good tool is very helpful for [...]]]></description>
			<content:encoded><![CDATA[<p>Hacking is a good method of learning. And the pre-stage of hacking is reading the source code. You might have this experience: facing a large amount of source code (generally dozens of files), you don&#8217;t know how to start, or you even don&#8217;t know how to read them. A good tool is very helpful for reading code. It can facilitate your understanding of the code and help you find out the things you want as soon as possible. I will introduce you some wonderful tools of browsing sources.</p>
<p>For me, the must-have feathers of a source browsing tool should be:</p>
<ol>
<li>Syntax highlighting</li>
<li>Friendly user interface</li>
<li>Identifier and function search</li>
</ol>
<p><span id="more-88"></span></p>
<p>If you are a Windows user, you might have heard about Source Insight, which is a non-free software. I haven&#8217;t used it, so I am not going to comment it.</p>
<p>For Linux user, the first tool I want to mention is <a href="http://sourcenav.sourceforge.net/">Source Navigator</a>. It is developed and supported by Red hat. It supports C, C++, Java, Tcl, FORTRAN and COBOL. It&#8217;s very powerful. But if you just want to browse sources, I don&#8217;t recommend you to use it. Since it GUI is developed in Tcl, an ancient programming language, the user interface is not very friendly. I bet you don&#8217;t like it.</p>
<p>Another wonderful software is <a href="http://www.doxygen.org">Doxygen</a>. Although it aims to generate documents various programming languages, including C++, C, Java, Objective-C, Python, IDL (Corba and Microsoft flavors), Fortran, VHDL, PHP, C#, and to some extent D, you can treat it as a source browsing tool. It can generate documents in HTML format. So you can read them via Firefox. If the source code is well commented following JavaDoc&#8217;s style, a beautiful documents describing classes, variables, functions could be generated. If the source code is not commented in JavaDoc&#8217;s style, the documents could also be generated, but it just have source codes, without these detailed description about classes, variables, and functions. Doxygen can also generate class-graphs, call-graphs and other similar graphs in UML style, which will help you understand the source.</p>
<p>The disadvantage of Doxygen is that its search result is somehow coarse-grained. It cannot distinguish variables from functions in search result. And it cannot differentiate definition, declaration and reference. So, if you are dealing with a huge project, you may find it uncomfortable to read source generated by Doxygen.</p>
<p>The ultimate tool, in my view, is <a href="http://sourceforge.net/projects/lxr">LXR</a>, which stand for Linux Corss Referencer. Specially, it may be the best choice for you to read Linux source code. Although, namely, LXR aim for Linux source code, it suitable for other projects written in C/C++, COBOL, Java, Perl. It is a web based tool and you can read the source code via Firefox. It uses a database to management cross references. So the search result is very accurate. And it can differentiate definition, declaration and reference.</p>
<p>LXR is famous for its difficulty on setup and configuration. And its user interface cannot be called &#8220;beautiful&#8221;. Luckily, the next generation, <a href="http://lxr.linux.no/">LXRng</a> (<a href="http://lxr.linux.no/linux">demo</a>) is available now. LXRng has a very beautiful and friendly user interface.  Moreover, setup and configuration for LXRng is much simpler than LXR. However, it seems that LXRng currently only support C language. If you need it for C++, you need a slight hack:</p>
<p>Locate to your LXRng&#8217;s installation directory, then open this file:</p>
<blockquote><p>lib/LXRng/Lang/C.pm</p></blockquote>
<p>Find the following code from this file:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">sub</span> pathexp <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">return</span> <span style="color: #009966; font-style: italic;">qr/\.[ch]$/</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>And change it into:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">sub</span> pathexp <span style="color: #009900;">&#123;</span>
    <span style="color: #000066;">return</span> <span style="color: #009966; font-style: italic;">qr/\.[ch]$|\.cpp$/</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Then LXRng should support the C++ files.</p>
<p>Doxygen and LXRng could satisfy most of your requirement. Maybe reading source from Firefox is strange and unfamiliar to you, but I think you will going to like it if you just have a try. If you have no idea about how to use them, just go to their websites, where you can find plenty of documents and toturials.</p>
 <img src="http://chunhao.net/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=88" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/tools-for-reading-sources/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Burning Video DVD on Ubuntu</title>
		<link>http://chunhao.net/blog/burning-video-dvd-on-ubuntu</link>
		<comments>http://chunhao.net/blog/burning-video-dvd-on-ubuntu#comments</comments>
		<pubDate>Sun, 26 Apr 2009 15:21:04 +0000</pubDate>
		<dc:creator>Chunhao</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[DVD]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://chunhao.net/blog/?p=73</guid>
		<description><![CDATA[Burning video DVD is harder than you think. It involves transcoding, subtitles, burning and other complicated things. Each step may not work for you, let alone on Ubuntu!
I just created my first video DVD. My experience may help you get less trouble on burning your video DVD on Ubuntu/Linux.
Most DVD videos are encoded in MPEG-2 [...]]]></description>
			<content:encoded><![CDATA[<p>Burning video DVD is harder than you think. It involves transcoding, subtitles, burning and other complicated things. Each step may not work for you, let alone on Ubuntu!</p>
<p>I just created my first video DVD. My experience may help you get less trouble on burning your video DVD on Ubuntu/Linux.</p>
<p>Most DVD videos are encoded in <a href="http://en.wikipedia.org/wiki/MPEG-2">MPEG-2</a> format. So, if your original video is not encoded into MPEG-2, the first thing you need to do is to transcode it into MPEG-2. There are lots of powerful tools to handle it, such as <a href="http://www.ffmpeg.org/">ffmpeg</a> and <a href="http://www.mplayerhq.hu/">mencoder</a>. They are command-line tools. If you are a crazy fan of command line, you definitely should try them. However, the command line arguments will generally be 10 lines! If you cannot handle them(like me), just try some GUI tools.</p>
<p>The first option is <a href="http://fixounet.free.fr/avidemux/">Avidemux</a>. It&#8217;s powerful and easy to use. However, its <a href="http://en.wikipedia.org/wiki/H264">H264</a> support is poor. When I tried to transcode a H264 video into MPEG-2, it crashed every time. Maybe it works fine with other format, but I have no chances to take a try.</p>
<p><span id="more-73"></span></p>
<p>Another great transcoding tool is <a href="http://gtk-apps.org/content/show.php/Hyper+Video+Converter?content=88970">Hyper Video Converter</a>. It&#8217;s a front-end of ffmpeg and mencoder. Although it looks a bit &#8220;Shanzhai&#8221;, it&#8217;s more powerful than its appearance, since it&#8217;s the frontend of powerful ffmpeg and mencoder. It&#8217;s quite reliable. I used it to transcode my H264 &#8220;mkv&#8221; file into MPEG-2 &#8220;mpg&#8221; file. I recommend you to use it, if you have no requirement on gaudy appearance. The KDE version is <a href="http://www.kde-apps.org/content/show.php/Hyper+Video+Converter?content=67781">here</a>.</p>
<p>Then it goes to create DVD file structure.  Generally, we need a folder contains VEDIO_TS and AUDIO_TS folders and put some necessary information files in them. This work can be done by <a href="http://dvdauthor.sourceforge.net/">dvdAuthor</a>. It&#8217;s also command line based tool. As introduced in its website, there are several frontend for it. The most famous one is <a href="http://qdvdauthor.sourceforge.net/">QDvdauthor</a>. The newest version for Hardy in <a href="http://www.getdeb.net/app/QDVDAuthor">Getdeb</a> is 1.5.0, which is even lower in repository. 1.5.0 has much bugs in creating subtitles, You should use the newest version, 1.7.0, which is available in Getdeb for Intrepid. I am using Hardy, so I compiled 1.7.0 and created a deb package by myself. Grab it if you need.</p>
<p>Now, we are using QDvdauthor 1.7.0. Just create you your DVD file structure using the MPEG-2 video encoded by  Hyper Video Converter. There are some <a href="http://qdvdauthor.sourceforge.net/guide/e_index.html">tutorials</a> for QDvdauther.  Just take a tour if have problems on how to start.</p>
<p>Once you get the DVD file structure including VIDEO_TS and AUDIO_TS, you can test them via VLC or SMPlayer. Take SMPlayer for example, select &#8220;Open&#8221;-&gt;&#8221;DVD from folder&#8221; to test the video.</p>
<p>If everything works, you can create an ISO image. I recommend you to create ISO image and burn image by your self, using <a href="http://www.cdrkit.org/">genisoimage</a> and K3B. Because there are much things that you can control. The most important thing is that current version of genisoimage has a <a href="https://bugs.launchpad.net/debian/+source/cdrkit/+bug/233942">huge bug</a>. The image created by it is not readable by Windows and standalone DVD machine. This bug is not solved in even the latest version 1.9.0. You have to downgrade you genisoimage into 1.2.0 from <a href="http://packages.debian.org/es/etch/genisoimage">debian repository</a>.</p>
<p>One thing that QDvdauther cannot control is the volume name of the image. This is why I recommend you to create ISO image by yourself. You can use this command:</p>
<blockquote><p>genisoimage -dvd-video -udf -V &#8220;Volume-Name&#8221; -o &#8220;dvd.iso&#8221; &#8220;DVD-folder&#8221;</p></blockquote>
<p>&#8220;dvd.iso&#8221; is the ISO image you are going to create. And &#8220;DVD-folder&#8221; is the folder contains VEDIO_TS and AUDIO_TS folders.</p>
<p>Then, add the Error Correction Codes(ECC) to the image</p>
<blockquote><p>dvdisaster -i &#8220;/tmp/Unnamed/dvd.iso&#8221; -mRS02 -n 350000 -c</p></blockquote>
<p>If this command issues error message, maybe you should remove the option &#8220;-n 350000&#8243; or adjust it.</p>
<p>At the last step, burn this ISO image by whatever software you like.</p>
<p>Enjoy your video DVD created on Ubuntu/Linux!</p>
<p>Following is the deb package of QDvdauthor 1.7.0. It could be installed on Ubuntu 8.04.</p>
<p><a href="http://chunhao.net/blog/wp-content/uploads/2009/04/qdvdauthor-170.deb">qdvdauthor-170_deb</a></p>
 <img src="http://chunhao.net/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=73" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/burning-video-dvd-on-ubuntu/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My Chinese Blog</title>
		<link>http://chunhao.net/blog/my-chinese-blog</link>
		<comments>http://chunhao.net/blog/my-chinese-blog#comments</comments>
		<pubDate>Sat, 18 Apr 2009 12:11:39 +0000</pubDate>
		<dc:creator>Chunhao</dc:creator>
				<category><![CDATA[other]]></category>

		<guid isPermaLink="false">http://chunhao.net/blog/?p=66</guid>
		<description><![CDATA[A new blog has been set up. I will post my Chinese articles there.
Here, only English contents will appear from now on. All the old articles in both languages here will be reserved. I will use this blog to post some technique articles related to Linux, programming in English. It should be a good way [...]]]></description>
			<content:encoded><![CDATA[<p>A new blog has been set up. I will post my Chinese articles there.</p>
<p>Here, only English contents will appear from now on. All the old articles in both languages here will be reserved. I will use this blog to post some technique articles related to Linux, programming in English. It should be a good way to practice my English writing.</p>
<p>My Chinese blog: <a href="http://blog.chunhao.net">http://blog.chunhao.net</a></p>
 <img src="http://chunhao.net/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=66" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/my-chinese-blog/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to write an auto-downloading script</title>
		<link>http://chunhao.net/blog/how-to-write-an-auto-downloading-script</link>
		<comments>http://chunhao.net/blog/how-to-write-an-auto-downloading-script#comments</comments>
		<pubDate>Mon, 23 Feb 2009 16:12:06 +0000</pubDate>
		<dc:creator>Chunhao</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[progrmming]]></category>

		<guid isPermaLink="false">http://chunhao.net/blog/?p=59</guid>
		<description><![CDATA[如何写一个自动下载的脚本？
用Linux有一个很好的地方就是你可以很方便地让计算机为你做体力活。当然，前提是你要了解Linux的思维方式。下面就是一个活生生的例子，大家可以看看用Linux是怎么做事情的。
如果你喜欢听评书，这里是个不错的地方。这个网站有很多评书，还有百家讲坛，甚至有声的金庸小说。上面的东西不光可以在线听，而且都可以免费下载，不用注册。但是，只能一个链接一个链接地下载。例如，如果想下载《大唐惊雷》第1回，就要进入一个页面，然后点下载；要下载第2回，就要进入另一个页面，然后再点下载。这样，就无法批量下载一整部评书了。
如果你用Windows，那么你要么人肉点击这些链接，一个一个地下载（可能有100+回）；要么就用C或者Java写一个程序自动下载，前提是你要懂网络编程的细节。
下面，我就说一说在Linux下如何用Shell写一个自动下载脚本：
首先要做的就是分析链接，这个网站上，包含有《大唐惊雷》从第1回到第100回的链接的页面都是很有规律的：
http://www1.5ips.net/down_19_001.htm
http://www1.5ips.net/down_19_002.htm
&#8230;
http://www1.5ips.net/down_19_100.htm
我们需要一个东西能从001递增到100，递增可以用一个for循环解决，但是要输出成001，002这样的就不是很直接。在C语言中，我们可以用printf(&#8220;%03d&#8221;, n)来解决，在Shell中也一样，可以用printf命令：

printf &#34;%03d&#34; $i

此时，包含1-100回链接的页面地址已经生成了，下一步就是要从这些页面中提取出下载链接。如果分析这些页面的源代码，我们可以发现下面代码：

&#60;li&#62;&#60;a href=&#34;http://dx23a.52ps.cn/pingshu/单田芳_大唐惊雷/单田芳_大唐惊雷_001.mp3?0000060.191.99.1203tflag=1235403802opin=5d44be8c1fba6271d12369537d33a135&#38;amp;ip=60.191.99.1.mp3&#34;&#62;&#60;font color=&#34;blue&#34;&#62;点此下载《大唐惊雷》第001回&#60;/font&#62;&#60;/a&#62;&#60;br /&#62;&#60;/li&#62;

我们可以用grep来获得这行。
那么，如何获得里面的下载链接？用sed或者awk也能达到目的，可以我都不会。我用了Python，string有一个split函数，这里按照引号(&#8220;)把这行分开，形成一个list，然后提取适当的元素就可以获得下载链接。用同样的方法还可以获得文件名，例如：&#8221;单田芳_大唐惊雷_001.mp3&#8243;。
大体的方法就是想法就是这样，下面就是具体的脚本：

#!/bin/sh
&#160;
siteurl=&#34;http://www1.5ips.net/&#34;
prefix=&#34;down_192_&#34;
startnum=1
endnum=100
&#160;
for i in `seq $startnum $endnum`
do
    preurl=$siteurl$prefix`printf &#34;%03d&#34; $i`&#34;.htm&#34;
    wget -q -O prehtml $preurl
    iconv -f GBK -t utf-8 prehtml &#124; grep 点此下载 &#38;gt; down_url_line
    down_url=`./geturl.py`
    filename=`./getname.py`
    echo &#34;Starting downloading $i...&#34;
 [...]]]></description>
			<content:encoded><![CDATA[<p>如何写一个自动下载的脚本？</p>
<p>用Linux有一个很好的地方就是你可以很方便地让计算机为你做体力活。当然，前提是你要了解Linux的思维方式。下面就是一个活生生的例子，大家可以看看用Linux是怎么做事情的。</p>
<p>如果你喜欢听评书，<a href="http://www.5ips.net/">这里</a>是个不错的地方。这个网站有很多评书，还有百家讲坛，甚至有声的金庸小说。上面的东西不光可以在线听，而且都可以免费下载，不用注册。但是，只能一个链接一个链接地下载。例如，如果想下载《大唐惊雷》第1回，就要进入一个页面，然后点下载；要下载第2回，就要进入另一个页面，然后再点下载。这样，就无法批量下载一整部评书了。</p>
<p>如果你用Windows，那么你要么人肉点击这些链接，一个一个地下载（可能有100+回）；要么就用C或者Java写一个程序自动下载，前提是你要懂网络编程的细节。</p>
<p>下面，我就说一说在Linux下如何用Shell写一个自动下载脚本：</p>
<p><span id="more-59"></span>首先要做的就是分析链接，这个网站上，包含有《大唐惊雷》从第1回到第100回的链接的页面都是很有规律的：</p>
<blockquote><p>http://www1.5ips.net/down_19_001.htm</p>
<p>http://www1.5ips.net/down_19_002.htm</p>
<p>&#8230;</p>
<p>http://www1.5ips.net/down_19_100.htm</p></blockquote>
<p>我们需要一个东西能从001递增到100，递增可以用一个for循环解决，但是要输出成001，002这样的就不是很直接。在C语言中，我们可以用printf(&#8220;%03d&#8221;, n)来解决，在Shell中也一样，可以用printf命令：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;%03d&quot;</span> <span style="color: #007800;">$i</span></pre></div></div>

<p>此时，包含1-100回链接的页面地址已经生成了，下一步就是要从这些页面中提取出下载链接。如果分析这些页面的源代码，我们可以发现下面代码：</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;li&gt;&lt;a href=&quot;http://dx23a.52ps.cn/pingshu/单田芳_大唐惊雷/单田芳_大唐惊雷_001.mp3?0000060.191.99.1203tflag=1235403802opin=5d44be8c1fba6271d12369537d33a135&amp;amp;ip=60.191.99.1.mp3&quot;&gt;&lt;font color=&quot;blue&quot;&gt;点此下载《大唐惊雷》第001回&lt;/font&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;</pre></div></div>

<p>我们可以用grep来获得这行。</p>
<p>那么，如何获得里面的下载链接？用sed或者awk也能达到目的，可以我都不会。我用了Python，string有一个split函数，这里按照引号(&#8220;)把这行分开，形成一个list，然后提取适当的元素就可以获得下载链接。用同样的方法还可以获得文件名，例如：&#8221;单田芳_大唐惊雷_001.mp3&#8243;。</p>
<p>大体的方法就是想法就是这样，下面就是具体的脚本：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #007800;">siteurl</span>=<span style="color: #ff0000;">&quot;http://www1.5ips.net/&quot;</span>
<span style="color: #007800;">prefix</span>=<span style="color: #ff0000;">&quot;down_192_&quot;</span>
<span style="color: #007800;">startnum</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">endnum</span>=<span style="color: #000000;">100</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">seq</span> <span style="color: #007800;">$startnum</span> <span style="color: #007800;">$endnum</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #007800;">preurl</span>=<span style="color: #007800;">$siteurl</span><span style="color: #007800;">$prefix</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">printf</span> <span style="color: #ff0000;">&quot;%03d&quot;</span> <span style="color: #007800;">$i</span><span style="color: #000000; font-weight: bold;">`</span><span style="color: #ff0000;">&quot;.htm&quot;</span>
    <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-q</span> <span style="color: #660033;">-O</span> prehtml <span style="color: #007800;">$preurl</span>
    iconv <span style="color: #660033;">-f</span> GBK <span style="color: #660033;">-t</span> utf-<span style="color: #000000;">8</span> prehtml <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> 点此下载 <span style="color: #000000; font-weight: bold;">&amp;</span>gt; down_url_line
    <span style="color: #007800;">down_url</span>=<span style="color: #000000; font-weight: bold;">`</span>.<span style="color: #000000; font-weight: bold;">/</span>geturl.py<span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #007800;">filename</span>=<span style="color: #000000; font-weight: bold;">`</span>.<span style="color: #000000; font-weight: bold;">/</span>getname.py<span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Starting downloading <span style="color: #007800;">$i</span>...&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$down_url</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$filename</span>
    <span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-O</span> <span style="color: #007800;">$filename</span> <span style="color: #007800;">$down_url</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Finish downloading <span style="color: #007800;">$i</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
<span style="color: #808080; font-style: italic;"># getname.py</span>
&nbsp;
r = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;down_url_line&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'/'</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> r<span style="color: black;">&#91;</span><span style="color: #ff4500;">5</span><span style="color: black;">&#93;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'?'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
<span style="color: #808080; font-style: italic;"># geturl.py</span>
&nbsp;
r = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;down_url_line&quot;</span><span style="color: black;">&#41;</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'&quot;'</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> r<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span></pre></div></div>

<p>运行脚本之后，大约1个小时，整个100回评书就下完了。当然，脚本还有很多改进的余地，比如说通过参数传入评书的名字，然后自动获取链接前缀。</p>
<p>在Linux下解决问题就是这么简单？在Windows下呢？现在了解网络编程，然后打开VS，稀里糊涂写一堆代码，然后再写一个窗口？然后再复杂的跟踪、调试、修改……有兴趣的话你可以试一试。 <img src='http://chunhao.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>需要说明的是，我对Shell脚本和不是很熟，有时for或者while循环的格式都忘了；Python也不懂，我还没用Python写过程序。所有的东西都是现用现学，现用现Google。</p>
 <img src="http://chunhao.net/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=59" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/how-to-write-an-auto-downloading-script/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Unify the themes</title>
		<link>http://chunhao.net/blog/unify-the-themes</link>
		<comments>http://chunhao.net/blog/unify-the-themes#comments</comments>
		<pubDate>Sun, 22 Feb 2009 15:02:45 +0000</pubDate>
		<dc:creator>Chunhao</dc:creator>
				<category><![CDATA[other]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://chunhao.net/blog/?p=55</guid>
		<description><![CDATA[My site is based on various applications. The blog is based on Wordpress, the wiki is based on Dokuwiki, the photo gallery the Simpleviewer. Other pages are written by hand.
Originally, each part had its own theme. It&#8217;s hard to acces other parts directly from one part. For example, there are no links from my blog [...]]]></description>
			<content:encoded><![CDATA[<p>My site is based on various applications. The blog is based on <a href="http://wordpress.org">Wordpress</a>, the <a href="http://chunhao.net/wiki">wiki</a> is based on <a href="http://www.dokuwiki.org">Dokuwiki</a>, the photo gallery the <a href="http://www.airtightinteractive.com/simpleviewer/">Simpleviewer</a>. Other pages are written by hand.</p>
<p>Originally, each part had its own theme. It&#8217;s hard to acces other parts directly from one part. For example, there are no links from my blog or wiki to my homepage. I decided to change this. Eventually, the goal is achieved.</p>
<p>The theme of my blog is <a href="http://www.livetr.org/blue-pix/">blue-pix</a>. I like it for its briefness. The first thing I did is to port this theme on my home page. This work is pretty simple. I only changed the tags of the CSS file. Then, I modified the blog&#8217;s theme, added a link to homepage. The themes of homepage and blog was unified.</p>
<p>Next thing is my wiki. I have no idea about how to create template on dokuwiki at the beginning. When I refered to <a href="http://www.dokuwiki.org/devel:templates">this link</a>, I started my work. I did a lot of change on CSS and PHP files. Finally, my own template of dokuwiki was created. Now the themes of the whole site is unified, except for the photo gallery.</p>
<p>For the blog&#8217;s theme, blue-pix, I also did lots of modification. The originally version did not support widget, and it did not support Google Analytics and other things. It also did not support thread comments. Now, it works fine. If you are interested in this theme, just feel free to contact me.</p>
<p>I am not an expert on PHP, CSS, and HTML. However, I like hacking. All the problems are solved with the help of Google. I believe one sentence&#8211;don&#8217;t learn to hack, just hack to learn.</p>
<p>&#8212;&#8212;&#8212;&#8211;</p>
<p>Supplement:</p>
<p>Just now, I finished the modification of my <a href="http://chunhao.net/photos/">photo gallery</a>. Now, everything in my site are following the same theme!</p>
 <img src="http://chunhao.net/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=55" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/unify-the-themes/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to synchronize with SSH</title>
		<link>http://chunhao.net/blog/how-to-synchronize-with-ssh</link>
		<comments>http://chunhao.net/blog/how-to-synchronize-with-ssh#comments</comments>
		<pubDate>Fri, 13 Feb 2009 06:08:26 +0000</pubDate>
		<dc:creator>Chunhao</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[synchronize]]></category>

		<guid isPermaLink="false">http://chunhao.net/blog/?p=52</guid>
		<description><![CDATA[I will share my experience in synchronizing files with SSH here. Following are demonstrated by synchronizing Dokuwiki. Of course, you can synchronize everything as you like.
The wiki I used in my homepage is Dokuwiki. The most great feature is that it does not require database connection. It&#8217;s very convenience for personal usage.
I have two Dokuwiki [...]]]></description>
			<content:encoded><![CDATA[<p>I will share my experience in synchronizing files with SSH here. Following are demonstrated by synchronizing Dokuwiki. Of course, you can synchronize everything as you like.</p>
<p>The <a href="http://chunhao.net/wiki/">wiki</a> I used in my homepage is <a href="http://www.dokuwiki.org/">Dokuwiki</a>. The most great feature is that it does not require database connection. It&#8217;s very convenience for personal usage.</p>
<p>I have two Dokuwiki maintained. One is located in localhost, another in the webserver. I always edit the pages on localhost, and synchronize them to the webserver at times. Since Dokuwiki is totally PHP based, without database such as MySQL, I only need to synchronize some files.</p>
<p>All the changes on wiki are reflected on the folder &#8220;data&#8221; in your Dokuwiki path. So every time, I only need to synchronize this folder.</p>
<p>The best way to communicate with webserver is SSH. Fortunately, my webserver <a href="https://www.godaddy.com/">Godaddy</a> support SSH access. Another thing need to concern is synchronizer. Here I use <a href="http://www.cis.upenn.edu/~bcpierce/unison/">Unison</a>. The best description of Unison comes from it&#8217;s the author of this software:</p>
<p><span id="more-52"></span></p>
<blockquote><p>A file-synchronization tool for Unix and Windows<br />
Unison is a file-synchronization tool for Unix and Windows, written<br />
in OCaml. It allows two replicas of a collection of files and<br />
directories to be stored on different hosts (or different disks<br />
on the same host), modified separately, and then brought up to<br />
date by propagating the changes in each replica to the other.</p>
<p>Unison offers several advantages over various synchronization methods<br />
such as CVS, Coda, rsync, Intellisync, etc. Unison can run on and<br />
synchronize between Windows and many UNIX platforms. Unison requires<br />
no root privileges, system access or kernel changes to function. Unison<br />
can synchronize changes to files and directories in both directions,<br />
on the same machine, or across a network using ssh or a direct<br />
socket connection.</p>
<p>Transfers are optimised using a version of the rsync protocol,<br />
making it ideal for slower links. Unison has a clear and precise<br />
specification, and is resilient to failure due to its careful<br />
handling of the replicas and its private structures.</p></blockquote>
<p>If you are using Ubuntu machine, you can install it from the repository just by one command:</p>
<blockquote><p>sudo apt-get install unison</p></blockquote>
<p>There is also a gtk front-end for this software: unison-gtk, but I think it&#8217;s useless at most time.</p>
<p>Now, another problem comes to front&#8211;in order to synchronize files with SSH, both installations of Unison on client and server are required. However, at most time, you don&#8217;t have the permission to install software such as unison on SSH server. Here, we attack this issue by SSHFS. It allows you to mount a remote folder on your machine via SSH.</p>
<p>Everything is OK. I wrote a small script to handle the synchronization:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
sshfs <span style="color: #660033;">-o</span> <span style="color: #007800;">workaround</span>=rename username<span style="color: #000000; font-weight: bold;">@</span>sshserver:<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>html<span style="color: #000000; font-weight: bold;">/</span>wiki wiki-remote<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Synchronising with sshserver&quot;</span>
unison <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>dokuwiki<span style="color: #000000; font-weight: bold;">/</span>data .<span style="color: #000000; font-weight: bold;">/</span>wiki-remote<span style="color: #000000; font-weight: bold;">/</span>data \
  <span style="color: #660033;">-fastcheck</span> <span style="color: #c20cb9; font-weight: bold;">yes</span> \
  <span style="color: #660033;">-ignore</span> <span style="color: #ff0000;">'Path cache'</span> \
  <span style="color: #660033;">-ignore</span> <span style="color: #ff0000;">'Path locks'</span></pre></div></div>

<p>Modify it to fit your actual environment. Note that the argument of sshfs command &#8220;-o workaround=rename&#8221;, this prevents the &#8220;<a href="http://ubuntuforums.org/showthread.php?t=553103">renaming problem</a>&#8220;.</p>
<p>All things done. Excute this script. Or, you could add an cron job to run this script automatically once per day. Have fun in synchronizing files with SSH!</p>
 <img src="http://chunhao.net/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=52" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/how-to-synchronize-with-ssh/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Site moved here</title>
		<link>http://chunhao.net/blog/site-moved-here</link>
		<comments>http://chunhao.net/blog/site-moved-here#comments</comments>
		<pubDate>Mon, 09 Feb 2009 14:57:49 +0000</pubDate>
		<dc:creator>Chunhao</dc:creator>
				<category><![CDATA[other]]></category>

		<guid isPermaLink="false">http://chunhao.net/blog/?p=30</guid>
		<description><![CDATA[I have successfully backordered this new domain name “chunhao.net“, which is better to stand for me than my old domain name “chunhao86.cn”.
I am using 000webhost for the old site, which is really a good free host provider. However, due to my misoperation,  the new domain cannot be located in the free web host any more. [...]]]></description>
			<content:encoded><![CDATA[<p>I have successfully backordered this new domain name “<a title="Chunhao Wang" onclick="javascript:pageTracker._trackPageview('/outbound/article/chunhao.net');" href="../../">chunhao.net</a>“, which is better to stand for me than my old domain name “chunhao86.cn”.</p>
<p>I am using <a onclick="javascript:pageTracker._trackPageview('/outbound/article/www.000webhost.com');" href="http://www.000webhost.com/">000webhost</a> for the old site, which is really a good free host provider. However, due to my misoperation,  the new domain cannot be located in the free web host any more. I switched to another non-free host provider–<a onclick="javascript:pageTracker._trackPageview('/outbound/article/www.godaddy.com');" href="http://www.godaddy.com/">GoDaddy</a>.</p>
<p>Now, most part of the site have been transferred to the new domain here. All the posts and comments in my blog have also been moved properly. The old domain(chunhao86.cn) will keep alive for a long time. However, no upgrading will be presented there any more.</p>
<p>Most things are the same with old ones, except for some some changes. There most significant is  <a href="http://wordpress.org">Wordpress</a>. This new blog is built using Wordpress 2.7, while the old one Wordpress 2.3. There are lots of changes between the two versions, escpecially in the admin page. The new version is more user-friendly and integrated with much new feathers. Thanks for the small quantity of the posts and comments in my old sites, it&#8217;s very easy to move them correctly!</p>
<p>So sorry for you inconvenience! And thank you for touching my new site here. Please keep trace of my new site: <a title="Chunhao Wang" onclick="javascript:pageTracker._trackPageview('/outbound/article/chunhao.net');" href="../../">http://chunhao.net</a>, as well as my blog: <a title="Chunhao Wang's blog" onclick="javascript:pageTracker._trackPageview('/outbound/article/chunhao.net');" href="../../blog">http://chunhao.net/blog</a>.</p>
 <img src="http://chunhao.net/blog/wp-content/plugins/feed-statistics.php?view=1&post_id=30" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/site-moved-here/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
