<?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>Refactor the Life &#187; Gentoo</title>
	<atom:link href="http://kunxi.org/archives/category/gentoo/feed/" rel="self" type="application/rss+xml" />
	<link>http://kunxi.org</link>
	<description>Yet another code monkey blog.</description>
	<lastBuildDate>Wed, 05 Oct 2011 13:00:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Poor man&#8217;s NAS</title>
		<link>http://kunxi.org/archives/2008/11/poor-mans-nas/</link>
		<comments>http://kunxi.org/archives/2008/11/poor-mans-nas/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 02:42:26 +0000</pubDate>
		<dc:creator>bookstack</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mybook]]></category>
		<category><![CDATA[samba]]></category>

		<guid isPermaLink="false">http://kunxi.org/?p=315</guid>
		<description><![CDATA[A Network Attached Storage(NAS) has been in my wanted list for quite a long time, thanks to Live Search Cashback program to make it happen: a Western Digital MyBook World Edition(500GB). More information about the hardware specification: ARM926EJ-Sid(wb) [41069265] revision 5 (ARMv5TEJ) 99.73 MHz Memory: 32M VIA Networking Velocity Family Gigabit Ethernet WD5000AAVS-0 500G HD [...]]]></description>
			<content:encoded><![CDATA[<p>A Network Attached Storage(NAS) has been in my wanted list for quite a long time, thanks to <a href="http://search.live.com/cashback/">Live Search Cashback</a> program to make it happen: a Western Digital MyBook World Edition(500GB). More information about the hardware specification:</p>
<ul>
<li>ARM926EJ-Sid(wb) [41069265] revision 5 (ARMv5TEJ) 99.73 MHz</li>
<li>Memory: 32M</li>
<li>VIA Networking Velocity Family Gigabit Ethernet </li>
<li>WD5000AAVS-0 500G HD</li>
</ul>
<p>I believe 100MHz ARM CPU is powerful enough to drive this tiny box, but the limited capacity of memory cripples it as a lame duck. The sustainable file write(85G using lftp mirror) rate is approximately 3.8MB/s. It hardly qualifies any service beyond file server. Now, it is time to hack.</p>
<h1>Jailbreak and SSH</h1>
<p>The first thing to do is to create a user in the web interface of MyBook as root with null password is banned for security reason. Log on with <em>admin</em> and <em>123456</em>, create a user <em>JOE</em> and setup the password for later use.</p>
<p>Run the script discussed in the <a href="http://mybookworld.wikidot.com/first-steps-with-mbwe#toc0">wiki</a>, and ssh with JOE. Now you can su to root with blank password, 0wned!</p>
<h1>User management</h1>
<p>MyBook takes a very intricate way to manage users:</p>
<p>All Samba users are granted shell access, but <em>unix password sync = yes</em> is not set, the <em>/etc/shadow</em> and <em>/var/private/smbpasswd</em> are updated individually by a Perl script via the web interface. The only reasonable explanation is the minimized Samba lacks PAM support.</p>
<p>All user names are capitalized. I assume this is a brutal force approach to address the difference between Samba and Linux native accounts: Windows user name is case insensitive, while Linux is case-sensitive.</p>
<p>As the password scrambled in <em>/etc/shadow</em>, it is easier to add/delete/update users via the web interface, then fine-tune the corresponding files. The user administration executives are hidden in <em>/usr/www/nbin</em>.</p>
<h1>Share with Samba</h1>
<p>The default exported directory is <em>/share/internal/PUBLIC</em>, the permission of the directory is set as <em>rwsr-sr-x</em>, and the owner is <em>www-data</em>, YMMV. So any file/directory created will be owned by www-data. If you are unhappy with the name, you may add a user, e.g joe as discussed before, then add joe to www-data group:</p>
<div class="codesnip-container" ># /etc/group, YMMV<br />
www-data:x:33:share</div>
<p>remember to change the default mask in /etc/smb.conf:</p>
<div class="codesnip-container" >create mask = 0775<br />
directory mask = 0775</div>
<h1>Package management</h1>
<p>Though I am a big fan of Gentoo, it is a little bit paranoid to build everything from scratch. A precompiled package management, like <a href="http://www.nslu2-linux.org/wiki/Optware/Packages?from=Unslung.Packages">Optware</a> makes more sense. Check out <a href="http://mybookworld.wikidot.com/optware ">this tutorial</a> for bootstrapping.</p>
<p>The essential packages for daily administration imho are screen, lftp.</p>
<h1>Feature requests</h1>
<p>There are some itchy miss features, if you happen to know a solution or hint, please drop me a message in the comment:</p>
<p><strong>Access Anywhere</strong>  No mionet, just SSH. If you are a perfectionist, consider to port <a href="http://www.thecodecave.com/article337">this Delphi application</a> to MyBook to host MyBook in your preferred domain.</p>
<p><strong>Download Manager</strong>  A web front-end to listen to download requests from Firefox/IE plugins, then delegate it to wget backend with cookie support. A more aggressive approach may support megaupload happy hour. </p>
<div id="crp_related"><h2>Related Posts:</h2><ul><li><a href="http://kunxi.org/archives/2007/08/195/" rel="bookmark">HOWTO extend the life of Gentoo laptop</a></li><li><a href="http://kunxi.org/archives/2006/10/sync-palm-via-bluetooth/" rel="bookmark">Sync Palm via Bluetooth</a></li><li><a href="http://kunxi.org/archives/2007/07/howto-gentoo-20070-on-dell-700m/" rel="bookmark">HOWTO Gentoo 2007.0 on Dell 700m</a></li><li><a href="http://kunxi.org/archives/2007/05/poor-mans-wireless-network/" rel="bookmark">Poor man's wireless network</a></li><li><a href="http://kunxi.org/archives/2007/04/meet-mr-dtrace-part-2/" rel="bookmark">Meet Mr. DTrace - Part 2</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://kunxi.org/archives/2008/11/poor-mans-nas/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bite by MemoryError</title>
		<link>http://kunxi.org/archives/2008/02/bite-by-memoryerror/</link>
		<comments>http://kunxi.org/archives/2008/02/bite-by-memoryerror/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 07:29:24 +0000</pubDate>
		<dc:creator>bookstack</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[mod_python]]></category>

		<guid isPermaLink="false">http://www.kunxi.org/archives/2008/02/bite-by-memoryerror/</guid>
		<description><![CDATA[In the last post, I worked through the installation and deployment for Django application. And I setup a MoinMoin Wiki as well. Everything works fine until I switched back and forth between the blog and wiki, I got a MemoryError like this: Mod_python error: &#8220;PythonHandler django.core.handlers.modpython&#8221; Traceback (most recent call last): File &#8220;/usr/lib/python2.5/mod_python/apache.py&#8221;, line 299, [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.kunxi.org/archives/2008/02/howto-deploy-django-in-jumpline/">last post</a>, I worked through the installation and deployment for Django application. And I setup a MoinMoin Wiki as well. Everything works fine until I switched back and forth between the blog and wiki, I got a MemoryError like this:</p>
<div class="codesnip-container" >Mod_python error: &#8220;PythonHandler django.core.handlers.modpython&#8221;<br />
Traceback (most recent call last): </p>
<p>  File &#8220;/usr/lib/python2.5/mod_python/apache.py&#8221;, line 299, in HandlerDispatch<br />
    result = object(req)</p>
<p>  File &#8220;/usr/lib/python2.5/site-packages/django/core/handlers/modpython.py&#8221;, line 188, in handler<br />
    return ModPythonHandler()(req)</p>
<p>MemoryError</p></div>
<p>It is most likely that the two application&#8217;s memory footprints exceed the limit. Yes, FastCGI would rescue; unfortunately, it is another advanced feature you have to pay for.  There is no explicitly regulation when I signed up but I think it is quite reasonable to set the resource quota as virtual server is essentially shared hosting shared anyway. I would contact the custom service of Jumpline tomorrow for a better understanding.</p>
<p><strong>Update</strong>: just contact the customer service of Jumpline, they seen have no QoS of the memory footprint or CPU load. I really have no idea whether this good news or bad news.</p>
<div id="crp_related"><h2>Related Posts:</h2><ul><li><a href="http://kunxi.org/archives/2008/02/howto-deploy-django-in-jumpline/" rel="bookmark">HOWTO deploy Django in Jumpline</a></li><li><a href="http://kunxi.org/archives/2008/03/minihowto-deploy-moinmoin-in-jumpline/" rel="bookmark">MiniHOWTO deploy MoinMoin in Jumpline</a></li><li><a href="http://kunxi.org/archives/2008/04/rtfm-the-missing-dot-in-cname/" rel="bookmark">RTFM: the missing dot in CNAME</a></li><li><a href="http://kunxi.org/archives/2009/01/how-to-put-a-file-in-django/" rel="bookmark">How to PUT a file in Django</a></li><li><a href="http://kunxi.org/archives/2007/10/learning-django-by-example8-to-dnd-or-not-to-dnd/" rel="bookmark">Learning Django by Example(8): To DnD or Not to DnD</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://kunxi.org/archives/2008/02/bite-by-memoryerror/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yet another locale problem</title>
		<link>http://kunxi.org/archives/2008/01/yet-another-locale-problem/</link>
		<comments>http://kunxi.org/archives/2008/01/yet-another-locale-problem/#comments</comments>
		<pubDate>Mon, 28 Jan 2008 07:48:16 +0000</pubDate>
		<dc:creator>bookstack</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[python locale]]></category>

		<guid isPermaLink="false">http://www.kunxi.org/archives/2008/01/yet-another-locale-problem/</guid>
		<description><![CDATA[In the last post, we manage to leverage eye3D for standardizing the ID3 tag. But we still got messy code when manually manipulating the tags in the command line. It may result in either wrong arguments or encoding bug. Further investigation focused on eyeD3&#8242;s __init__.py: LOCAL_ENCODING = locale.getpreferredencoding&#40;do_setlocale=False&#41;; if not LOCAL_ENCODING or LOCAL_ENCODING == &#34;ANSI_X3.4-1968&#34;: [...]]]></description>
			<content:encoded><![CDATA[<p>In the <a href="http://www.kunxi.org/archives/2007/11/howto-convert-chinese-mp3-for-id3-v23-standard/">last post</a>, we manage to leverage eye3D for standardizing the ID3 tag.  But we still got messy code when manually manipulating the tags in the command line.  It may result in either wrong arguments or encoding bug.</p>
<p>Further investigation focused on eyeD3&#8242;s <em>__init__.py</em>:</p>
<div class="codesnip-container" >
<div class="python codesnip" style="font-family:monospace;">LOCAL_ENCODING = <span class="kw3">locale</span>.<span class="me1">getpreferredencoding</span><span class="br0">&#40;</span>do_setlocale=<span class="kw2">False</span><span class="br0">&#41;</span><span class="sy0">;</span><br />
<span class="kw1">if</span> <span class="kw1">not</span> LOCAL_ENCODING <span class="kw1">or</span> LOCAL_ENCODING == <span class="st0">&quot;ANSI_X3.4-1968&quot;</span>:<br />
&nbsp; &nbsp; LOCAL_ENCODING = <span class="st0">&#8216;latin1&#8242;</span><span class="sy0">;</span></div>
</div>
<p>Either LOCAL_ENCODING is <em>None</em> or mysterious <em>ANSI_X3.4-1968</em>, the encoding is assumed as <strong>latin1</strong>.  In my Gentoo box, with <em>do_setlocale</em> set <em>False</em>, <em>getpreferredencoding</em> just returns <em>ANSI_X3.4-1968</em> though the locale is <em>en_US.UTF-8</em> instead.</p>
<p>According to the documentation:</p>
<blockquote><p>
On some systems, it is necessary to invoke setlocale  to obtain the user preferences, so this function is not thread-safe. If invoking setlocale is not necessary or desired, do_setlocale  should be set to False.
</p></blockquote>
<p>I need to dig into whether Linux belongs to <em>some systems</em>.  Right now, just apply the patch to eyeD3&#8242;s <em>__init__.py</em>:</p>
<div class="codesnip-container" >37c37<br />
< LOCAL_ENCODING = locale.getpreferredencoding(do_setlocale=False);<br />
---<br />
> LOCAL_ENCODING = locale.getpreferredencoding(do_setlocale=True);</div>
<p>And remember to specify the encoding of tags using <em>&#8211;set-encoding </em>, RTFM for more details.</p>
<div id="crp_related"><h2>Related Posts:</h2><ul><li><a href="http://kunxi.org/archives/2006/11/diagnosis-of-kpilotpalms-messy-text/" rel="bookmark">Diagnosis of KPilot/Palm's messy text</a></li><li><a href="http://kunxi.org/archives/2007/11/howto-convert-chinese-mp3-for-id3-v23-standard/" rel="bookmark">HOWTO convert Chinese MP3 for ID3 v2.3 standard</a></li><li><a href="http://kunxi.org/archives/2008/02/id3-tag-for-programmers/" rel="bookmark">ID3 tag for programmers</a></li><li><a href="http://kunxi.org/archives/2007/07/small-fix-for-libnjb-to-transfer-chinese-tags/" rel="bookmark">Small fix for libnjb to transfer Chinese tags</a></li><li><a href="http://kunxi.org/archives/2007/12/migrate-to-mtp/" rel="bookmark">Migrate to MTP</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://kunxi.org/archives/2008/01/yet-another-locale-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Migrate to MTP</title>
		<link>http://kunxi.org/archives/2007/12/migrate-to-mtp/</link>
		<comments>http://kunxi.org/archives/2007/12/migrate-to-mtp/#comments</comments>
		<pubDate>Sat, 15 Dec 2007 23:37:16 +0000</pubDate>
		<dc:creator>bookstack</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[amarok]]></category>
		<category><![CDATA[mtp]]></category>

		<guid isPermaLink="false">http://www.kunxi.org/archives/2007/12/migrate-to-mtp/</guid>
		<description><![CDATA[About nine months ago, I tried to embrace MTP since Creative Lab does not support their own proprietorial protocol(libnjb is the open source implementation) in Windows Vista, and I was really frustrated by the lame upgrade support. Here is a chance for me to get a 2nd generation Zune which is powered by MTP. Although [...]]]></description>
			<content:encoded><![CDATA[<p>About nine months ago, I tried to embrace MTP since Creative Lab does not support their own proprietorial protocol(<a href="http://libnjb.sourceforge.net/">libnjb</a> is the open source implementation) in Windows Vista, and  I was <a href="http://www.kunxi.org/archives/2007/05/zen-is-less-creative-in-software/">really frustrated</a> by the lame upgrade support.</p>
<p>Here is a chance for me to get a 2nd generation Zune which is powered by MTP. Although libmtp is still in <a href="http://libmtp.sourceforge.net/index.php?page=compatibility">very early stage</a> to bridge the gap, we could predict its future from <a href="http://libmtp.sourceforge.net/index.php?page=history">the history</a>.</p>
<p>Amarok supports MTP if the USE flag <em>mtp</em> is enabled. However, the latest stable version 1.4.7-r2 has a bug when transfer file with CJK characters. The bug happens when interfacing with libmtp:</p>
<div class="codesnip-container" >
<div class="cpp codesnip" style="font-family:monospace;"><span class="kw4">int</span> ret <span class="sy1">=</span> LIBMTP_Send_Track_From_File<span class="br0">&#40;</span><br />
<span class="sy2">-</span> &nbsp; &nbsp; &nbsp; &nbsp;m_device, bundle.<span class="me1">url</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">path</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">latin1</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, trackmeta,<br />
<span class="sy2">+</span> &nbsp; &nbsp; &nbsp; &nbsp;m_device, bundle.<span class="me1">url</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">path</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">local8Bit</span><span class="br0">&#40;</span><span class="br0">&#41;</span>, trackmeta,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;progressCallback, <span class="kw3">this</span>, parent_id<br />
&nbsp; &nbsp; &nbsp;<span class="br0">&#41;</span><span class="sy4">;</span></div>
</div>
<p>The bug is fixed in SVN (<a href="https://bugs.kde.org/show_bug.cgi?id=139722">ticket</a>),  but if we take non-utf8-locale users into account, for example, <a href="http://www.magiclinux.org/">MagicLinux</a> takes GB2312 as the default locale, <em>local8Bit</em> may have more flexibility than hard-coded <em>utf8</em>, and it also worked in the UTF8 environment.  </p>
<p>Here is the <a href="http://static.kunxi.org/migrate-to-mtp/amarok-1.4.7-mtp.patch">patch</a> , and as usual, an <a href="http://static.kunxi.org/migrate-to-mtp/amarok-1.4.7-r3.ebuild">ebuild</a> for Gentoo users (<a href="http://gentoo-wiki.com/HOWTO_Installing_3rd_Party_Ebuilds">manual</a>).</p>
<div id="crp_related"><h2>Related Posts:</h2><ul><li><a href="http://kunxi.org/archives/2007/07/small-fix-for-libnjb-to-transfer-chinese-tags/" rel="bookmark">Small fix for libnjb to transfer Chinese tags</a></li><li><a href="http://kunxi.org/archives/2007/06/howto-display-chinese-in-creative-zenmicro-using-amarok/" rel="bookmark">HOWTO display Chinese in Creative ZenMicro using Amarok</a></li><li><a href="http://kunxi.org/archives/2007/11/howto-convert-chinese-mp3-for-id3-v23-standard/" rel="bookmark">HOWTO convert Chinese MP3 for ID3 v2.3 standard</a></li><li><a href="http://kunxi.org/archives/2007/05/zen-is-less-creative-in-software/" rel="bookmark">Zen is less Creative in software</a></li><li><a href="http://kunxi.org/archives/2007/02/make-it-work/" rel="bookmark">Make it work</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://kunxi.org/archives/2007/12/migrate-to-mtp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOWTO convert Chinese MP3 for ID3 v2.3 standard</title>
		<link>http://kunxi.org/archives/2007/11/howto-convert-chinese-mp3-for-id3-v23-standard/</link>
		<comments>http://kunxi.org/archives/2007/11/howto-convert-chinese-mp3-for-id3-v23-standard/#comments</comments>
		<pubDate>Wed, 07 Nov 2007 17:28:10 +0000</pubDate>
		<dc:creator>bookstack</dc:creator>
				<category><![CDATA[Gentoo]]></category>

		<guid isPermaLink="false">http://www.kunxi.org/archives/2007/11/howto-convert-chinese-mp3-for-id3-v23-standard/</guid>
		<description><![CDATA[Amarok developers probably barely thought about the response from the Chinese users when they eventually dropped the id3 tag codec detection, and enforced ID3v2 specification. &#8220;Amarok is dead&#8221;, claimed in linuxfans.org, the community-powered Magic Linux support forum. Why? Quite a few MP3 files are encoded in GB2312 on id3v1 in China and even worse, some [...]]]></description>
			<content:encoded><![CDATA[<p>Amarok developers probably barely thought about the response from the Chinese users when they eventually dropped the id3 tag codec detection, and enforced ID3v2 specification. &#8220;Amarok is dead&#8221;, claimed in linuxfans.org, the community-powered Magic Linux support forum. Why? Quite a few MP3 files are encoded in GB2312 on id3v1 in China and even worse, some files are encoded with GB2312 in ID3 v2.3 format. What a mess!</p>
<p>I respect their decision, the player has no responsibility to clean the shit of lousy encoders, but we need to face the reality by all means. Here is my cruel life: <a href="http://amarok.kde.org/">Amarok</a> is preferred in Linux, occasionally I am using <a href="http://www.mpg123.de/">mpg123</a> in console mode; using <a href="http://www.foobar2000.org/">foobar2000</a> in Windows, sometimes Windows Media Player; portable MP3 player is Creative Zen Micro. No Mac, no iPod. To make things even worse, the locale in Linux is utf8, while in Windows, it is utf16-le. Last but not the least, I <strong>do</strong> respect specification.</p>
<p>So ID3v1 is not considered, it only supports ISO8859-1, that make it impossible to hold CJK characters. For ID3v2, the most popular version is v2.3, unfortunately, it does not support utf8 encoding. v2.4 supports this codec, but it is seldom picked up by the hardware manufacturer or the application developers.</p>
<p>Let&#8217;s start from the latest specification. ID3 v2.4:</p>
<p>The first bad news is a de facto id3v2 implementation, <a href="http://id3v2.sourceforge.net/">id3v2-0.1.11</a> does not support v2.4. That cost several hours to figure out why the newly added v2.4 disappeared mysterically, the answer is <em>id3v2</em> is even unable to recognize v2.4 tags. <a href="http://eyed3.nicfit.net/">EyeD3</a> is the remedy, this pure python library provides a very neat command line utility to manipulate id3 v2.4 tags. The good news is Creative Zen Micro support v2.4. In fact, I am not quite sure whether the honor goes to Creative Lab, or the libnjb developers.</p>
<p>Another option is v2.3, most popular implementation so far. Unfortunately, it only supports unicode-LE(i.e the default locale of Microsoft Windows), unicode-be and latin-1, no UTF-8 support. To make it even worse, <em>id3v2</em> writes to the tag regardless the locale, that is really horrible!</p>
<p>Here is my effort to address this problem, <a href="http://static.kunxi.org/howto-convert-chinese-mp3-for-id3-v2.3-standard/eyeD3conv">eyeD3conv</a>, as the name suggest, it depends on eyeD3 library. This small utility will convert mistaken-encoded tags to standard Unicode16-LE ID3 v2.3 tag.</p>
<p>And you need to apply this <a href="http://static.kunxi.org/howto-convert-chinese-mp3-for-id3-v2.3-standard/url-encode.diff">patch</a> to fix the encoding bug in eyeD3-0.6.14. The patch has been submitted to the upstream.</p>
<p><strong>Update</strong>: thanks to the author of eyeD3, Travis&#8217; quick response, according to the <a href="http://id3lib.sourceforge.net/id3/id3v2.3.0.html#sec4.3.2">specification</a>,  the url is supposed to be encoded in <em>ascii</em>, so we can simply ignore the URLFrame. Forget the patch, and use the<a href="http://static.kunxi.org/howto-convert-chinese-mp3-for-id3-v2.3-standard/eyeD3conv-r1">updated-version</a>.</p>
<p>Other mis-encoded frames may throw an UnicodeDecode exception when frame is read/written that cancels the succeeding file rename action. Here are some pragmatic tips to work around this issue:</p>
<div class="codesnip-container" >
<div class="bash codesnip" style="font-family:monospace;"><span class="co0"># remove all comments</span><br />
eyeDe <span class="re5">&#8211;remove-comments</span> foo.mp3<br />
<span class="co0"># remove WXXX frame</span><br />
eyeDe <span class="re5">&#8211;set-text-frame</span>=<span class="st0">&quot;WXXX:&quot;</span> foo.mp3</div>
</div>
<p>No idea which application inserts such crap into the tag. </p>
<div id="crp_related"><h2>Related Posts:</h2><ul><li><a href="http://kunxi.org/archives/2008/02/id3-tag-for-programmers/" rel="bookmark">ID3 tag for programmers</a></li><li><a href="http://kunxi.org/archives/2007/06/howto-display-chinese-in-creative-zenmicro-using-amarok/" rel="bookmark">HOWTO display Chinese in Creative ZenMicro using Amarok</a></li><li><a href="http://kunxi.org/archives/2007/07/small-fix-for-libnjb-to-transfer-chinese-tags/" rel="bookmark">Small fix for libnjb to transfer Chinese tags</a></li><li><a href="http://kunxi.org/archives/2007/05/zen-is-less-creative-in-software/" rel="bookmark">Zen is less Creative in software</a></li><li><a href="http://kunxi.org/archives/2007/12/migrate-to-mtp/" rel="bookmark">Migrate to MTP</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://kunxi.org/archives/2007/11/howto-convert-chinese-mp3-for-id3-v23-standard/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>HOWTO translate Gentoo Documentation</title>
		<link>http://kunxi.org/archives/2007/08/howto-translate-gentoo-documentation/</link>
		<comments>http://kunxi.org/archives/2007/08/howto-translate-gentoo-documentation/#comments</comments>
		<pubDate>Mon, 20 Aug 2007 23:26:32 +0000</pubDate>
		<dc:creator>bookstack</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[doc]]></category>
		<category><![CDATA[guidexml]]></category>
		<category><![CDATA[po]]></category>
		<category><![CDATA[translate]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://www.kunxi.org/archives/2007/08/howto-translate-gentoo-documentation/</guid>
		<description><![CDATA[Recently, I am involved in Gentoo Guide translation. This is more or less like a new domain for me since I&#8217;ve never worked in localization. It is quite amazing to see how different pieces integrated to make our lives much easier. This HOWTO is merely the summary of this documentation, left here for personal record. [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, I am involved in Gentoo Guide translation. This is more or less like a new domain for me since I&#8217;ve never worked in localization. It is quite amazing to see how different pieces integrated to make our lives much easier. This HOWTO is merely the summary of <a href="http://groups.google.com/group/gentoo-china/web/poguidexml">this documentation</a>, left here for personal record.</p>
<h2>Head over to the source</h2>
<p>You can use <em>git</em> to sync the repository, or download it from <a href="http://sources.gentoo.org/">online CVS repository</a>. In fact, there is a simpler way to do so referred to <a href="http://www.gentoo.org/doc/en/xml-guide.xml">Gentoo XML Guide</a>: just add <em>?passthru=1</em> to the targeted GuideXML. For example, I am translating the <a href="http://www.gentoo.org/doc/en/alsa-guide.xml">Gentoo Linux ALSA Guide</a>, fetch the original xml via:</p>
<div class="codesnip-container" >wget http://www.gentoo.org/doc/en/alsa-guide.xml?passthru=1 -O alsa-guide.xml</div>
<p>.</p>
<p>However, we need the other pieces like xsl, css, dtd, so we may need checkout all of them from the repository:</p>
<div class="codesnip-container" >cvs -d :pserver:anonymous@anoncvs.gentoo.org/var/cvsroot co gentoo/xml/htdocs/dtd<br />
cvs -d :pserver:anonymous@anoncvs.gentoo.org/var/cvsroot co gentoo/xml/htdocs/css<br />
cvs -d :pserver:anonymous@anoncvs.gentoo.org/var/cvsroot co gentoo/xml/htdocs/xsl<br />
cvs -d :pserver:anonymous@anoncvs.gentoo.org/var/cvsroot co gentoo/xml/htdocs/doc/en/alsa-guide.xml</div>
<h2>Using po to translate</h2>
<p><em>po</em> is the standard for translation. We are using <em>po4a</em> as suggested. First, let&#8217;s move to the right path, i.e <em>$ROOT/gentoo/xml/htdocs/doc</em>, and the translated xml is going to stored in <em>doc/zh_CN</em>.</p>
<div class="codesnip-container" ># generate the po from the original xml<br />
po4a-gettextize -f guide -m en/alsa-guide.xml > zh_CN/alsa-guide.po</div>
<p>emacs has built-in supports for po mode. I am using vim, and found the <a href="http://www.vim.org/scripts/script.php?script_id=695">po.vim</a> plugin is quite neat as well.</p>
<h2>Check before commit</h2>
<p>po or GuideXML are designed for machines, not for human being. It is much easier for eyes to catch the errors when reading rendered HTML.</p>
<div class="codesnip-container" ># generate the translated xml using po<br />
po4a-translate -f guide -m en/alsa-guide.xml -p zh_CN/alsa-guide.po -k 1 > zh_CN/alsa-guide.xml</p>
<p># check the output using xslt<br />
xsltproc &#8211;path ../xsl:en ../xsl/guide.xsl  zh_CN/alsa-guide.xml > zh_CN/alsa-guide.html</p></div>
<p>Before your checkin, ensure you have read through <a href="http://www.gentoo.org/proj/en/gdp/doc/translators-howto.xml">Translators Howto for Gentoo Documentation</a>.</p>
<p>Happy localizing.</p>
<div id="crp_related"><h2>Related Posts:</h2><ul><li><a href="http://kunxi.org/archives/2006/07/todo-after-kernel-update/" rel="bookmark">TODO after kernel update</a></li><li><a href="http://kunxi.org/archives/2007/07/howto-gentoo-20070-on-dell-700m/" rel="bookmark">HOWTO Gentoo 2007.0 on Dell 700m</a></li><li><a href="http://kunxi.org/archives/2005/09/gentoowindows-dual-boot/" rel="bookmark">Gentoo/Windows dual boot</a></li><li><a href="http://kunxi.org/archives/2006/09/is-gentoo-a-nightmare-to-the-experienced-users/" rel="bookmark">Is Gentoo a nightmare to the experienced users?</a></li><li><a href="http://kunxi.org/archives/2006/08/skewed-rects-bug-in-dojo2d/" rel="bookmark">Skewed rects bug in dojo2D</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://kunxi.org/archives/2007/08/howto-translate-gentoo-documentation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HOWTO extend the life of Gentoo laptop</title>
		<link>http://kunxi.org/archives/2007/08/195/</link>
		<comments>http://kunxi.org/archives/2007/08/195/#comments</comments>
		<pubDate>Mon, 06 Aug 2007 01:29:07 +0000</pubDate>
		<dc:creator>bookstack</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[portage]]></category>
		<category><![CDATA[samba]]></category>

		<guid isPermaLink="false">http://www.kunxi.org/archives/2007/08/195/</guid>
		<description><![CDATA[*cough*, I may not qualify this discussion considering my bad record (1, 2), and I just replace the hard disk for the consequent I/O failure today. Anyway, the readers may learn some lesson from my good/bad practice and avoid the same pitfall. Gentoo enjoys the reputation for its source-based distribution and highly-customizable package management, portage. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>*cough*</strong>, I may not qualify this discussion considering my bad record (<a href="http://kunxi.org/archives/2006/03/dead-700m-damn-dell/">1</a>, <a href="http://www.kunxi.org/archives/2006/03/i-am-computer-killer/">2</a>), and I just replace the hard disk for the consequent I/O failure today. Anyway, the readers may learn some lesson from my good/bad practice and avoid the same pitfall.</p>
<p>Gentoo enjoys the reputation for its source-based distribution and highly-customizable package management, <em>portage</em>. However, we pay the price for the flexibility: <em>synchronizing the portage</em>, <em>building applications from source code</em>. Both of the two tasks are I/O extensive, and the latter is also computation-extensive. The following tips aim to offload the burden to the desktop workhorses and eliminate the unnecessary I/O operation as much as possible. </p>
<h1>Choose the right file system</h1>
<p>I am a big fan of JFS regarding its comparable performance with low CPU consumption. Unfortunately, JFS does not support bad block relocation. This is essential since we may still use the hard disk with some dysfunctional sectors, though not suggested.  So I decide to take <em>reiserfs</em> as the default FS with LVM.<br />
<strong>Pro:</strong> I could tell the difference of booting time.<br />
<strong>Con:</strong> when emerging the package, especially <em>boost</em>, the whole system just lost the responsiveness due to the high I/O traffic.<br />
It is really a tough decision. I may go back to JFS if this hard disk is dead, *touch wood*.</p>
<h1>Using tmpfs</h1>
<p>Check this <a href="http://gentoo-wiki.com/TIP_Speeding_up_portage_with_tmpfs">tip</a> in Gentoo Wiki. The <em>temerge</em> works as a charm. It builds the application in memory instead of hard disk, the emerge time is shortened dramatically and the hard disk access is decreased.</p>
<h1>Share the portage over network</h1>
<p>Another I/O extensive operation is <em>emerge  &#8211;sync</em>. According to this <a href="http://gentoo-wiki.com/HOWTO_Using_a_shared_portage_via_NFS">HOWTO</a>, a shared portage not only save the hard disk access, but network bandwidth of the sync servers as well. The file server used in my home network, <em>hippo</em> servers the multimedia files using Samba for one Dell 700m laptop <em>tiger</em> and one Dell Dimension E521 desktop <em>gorilla</em>.  Follow this HOWTO to get Samba works, and we may adapt the changes mentioned in this HOWTO to the system:<br />
Add the<em> emerge &#8211;sync</em> task to the cron:<em> /etc/cron.daily/emerge.cron</em></p>
<div class="codesnip-container" >#!/bin/sh<br />
emerge &#8211;sync > /dev/null 2>&#038;1</div>
<p>Export the portage to the public: <em>/etc/samba/smb.conf</em></p>
<div class="codesnip-container" >[portage]<br />
   comment = public portage<br />
   path = /usr/portage<br />
   public = no<br />
   writable = yes<br />
   browseable = yes<br />
   valid users = share admin</div>
<p>Auto mount the portage in <em>tiger</em>: <em>/etc/fstab</em></p>
<div class="codesnip-container" >//hippo/portage /usr/portage cifs user=share,password=foo,iocharset=utf8</div>
<p>If the laptop is roaming, local <em>/usr/portage</em> would be used. The <em>distfiles</em> and <em>packages</em> are left in the local disk just in case we may need them without network: <em>/etc/make.conf</em></p>
<div class="codesnip-container" >FEATURES=&#8221;sandbox ccache -distlocks autoaddcvs confcache&#8221;<br />
PORTDIR=/usr/portage<br />
DISTDIR=/usr/local/portage/distfiles<br />
PKGDIR=/usr/local/portage/packages<br />
PORTDIR_OVERLAY=&#8221;/usr/local/portage/myportage&#8221;<br />
source /usr/local/portage/layman/make.conf</div>
<p>For eix users: <em>/etc/eixrc</em></p>
<div class="codesnip-container" >PORTDIR_CACHE_METHOD=&#8217;none&#8217;</div>
<p> and put the <em>update-eix</em> into <em>cron.daily</em></p>
<p>For layman users: <em>/etc/layman/layman.cfg</em></p>
<div class="codesnip-container" >storage   : /usr/local/portage/layman</div>
<h1>Offload the build to desktop workhorse</h1>
<p>TO BE CONTINUED&#8230;</p>
<div id="crp_related"><h2>Related Posts:</h2><ul><li><a href="http://kunxi.org/archives/2005/12/tip-emerge-kde-35-splitted-ebuilds/" rel="bookmark">emerge kde 3.5 splitted ebuilds</a></li><li><a href="http://kunxi.org/archives/2007/07/howto-gentoo-20070-on-dell-700m/" rel="bookmark">HOWTO Gentoo 2007.0 on Dell 700m</a></li><li><a href="http://kunxi.org/archives/2007/07/where-is-the-time-machine/" rel="bookmark">Where is the time machine?</a></li><li><a href="http://kunxi.org/archives/2007/07/dilema-of-kernel-upgrade/" rel="bookmark">Dilema of Kernel upgrade</a></li><li><a href="http://kunxi.org/archives/2006/09/is-gentoo-a-nightmare-to-the-experienced-users/" rel="bookmark">Is Gentoo a nightmare to the experienced users?</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://kunxi.org/archives/2007/08/195/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

