<?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&#039;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>Fri, 23 Apr 2010 03:54:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Why Python</title>
		<link>http://chunhao.net/blog/why-python</link>
		<comments>http://chunhao.net/blog/why-python#comments</comments>
		<pubDate>Wed, 24 Mar 2010 05:32:19 +0000</pubDate>
		<dc:creator>Chunhao</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://chunhao.net/blog/?p=151</guid>
		<description><![CDATA[Why Python? If it&#8217;s not 10 times better than other languages (except for the running speed), I won&#8217;t bother it. Let me give you an example to show Python&#8217;s awesomeness and attractiveness. Refer to this page for the problem. We are asked to compute the first ten digits of the sum of one-hundred 50-digit numbers: [...]]]></description>
			<content:encoded><![CDATA[<p>Why Python? If it&#8217;s not 10 times better than other languages (except for the running speed), I won&#8217;t bother it.</p>
<p>Let me give you an example to show Python&#8217;s awesomeness and attractiveness.</p>
<p>Refer to <a href="http://projecteuler.net/index.php?section=problems&amp;id=13">this page</a> for the problem. We are asked to compute the first ten digits of the sum of one-hundred 50-digit numbers:</p>
<blockquote><p>37107287533902102798797998220837590246510135740250<br />
46376937677490009712648124896970078050417018260538<br />
74324986199524741059474233309513058123726617309629<br />
&#8230;</p></blockquote>
<p>Suppose you are using C/C++, you probably need to use array to handle each digit of these long numbers, since these languages don&#8217;t support such long integers. If you are using Python, things will be very easy.</p>
<p>Just copy/paste these numbers into a file. Edit it with Vim. Use Vim command:</p>
<blockquote><p>:%s/$/,/g</p></blockquote>
<p>to add a comma to the end of each line. Remove the last comma. Then insert &#8220;array = [" to the beginning of the first line and add a "]&#8221; to the end of the last line.</p>
<p>Add the following to another line:</p>
<blockquote><p>print sum(array)</p></blockquote>
<p>Save this file and run it with Python and here we are done.</p>
<p>Here you can see that Python can handle arbitrary large number, as long as you memory can hold it. This is just a tip of the iceberg of Python&#8217;s advantage. Use it and you will get more and more.</p>
]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/why-python/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<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 [...]]]></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>
<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>
]]></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 believe [...]]]></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>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>
]]></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 [...]]]></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>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>
]]></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>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>
<pre lang="perl">sub pathexp {
    return qr/\.[ch]$/;
}</pre>
<p>And change it into:</p>
<pre lang="perl">sub pathexp {
    return qr/\.[ch]$|\.cpp$/;
}</pre>
<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>
]]></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 [...]]]></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>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>
]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/burning-video-dvd-on-ubuntu/feed</wfw:commentRss>
		<slash:comments>2</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 [...]]]></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>
]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/my-chinese-blog/feed</wfw:commentRss>
		<slash:comments>0</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 [...]]]></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>
]]></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 [...]]]></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>
<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>
<pre lang="bash">#!/bin/sh
sshfs -o workaround=rename username@sshserver:/path/html/wiki wiki-remote/
echo "Synchronising with sshserver"
unison /var/www/dokuwiki/data ./wiki-remote/data \
  -fastcheck yes \
  -ignore 'Path cache' \
  -ignore 'Path locks'</pre>
<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>
]]></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 [...]]]></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>
]]></content:encoded>
			<wfw:commentRss>http://chunhao.net/blog/site-moved-here/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
