<?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>ProjeKt D.K &#187; gentoo</title>
	<atom:link href="http://blog.punkid.org/tag/gentoo/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.punkid.org</link>
	<description>Where We ROT!</description>
	<lastBuildDate>Sun, 04 Jul 2010 07:51:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<atom:link rel='hub' href='http://blog.punkid.org/?pushpress=hub'/>
		<item>
		<title>aMule下载短信通知的飞信实现</title>
		<link>http://blog.punkid.org/2009/03/27/free-sms-notification-via-fetion-on-amule-completed-download/</link>
		<comments>http://blog.punkid.org/2009/03/27/free-sms-notification-via-fetion-on-amule-completed-download/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 13:37:34 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[aMule]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[飞信]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=303</guid>
		<description><![CDATA[上回用GCalcli实现了给aMule增加下载完成短信通知功能，不过由于GCal的短信格式问题并不完美，在Druggo的提示下转而使用飞信来实现这个吧。 飞信虽然在linux下已经有libfetion和linux-fetion for purple了，不过都没有直观的纯CLI操作方式。找来找去只找到个闭源的飞信机器人，这软件优点是:纯命令操作，简单快捷。 不爽的地方是: 闭源，依赖的库文件有版本要求。而且从主页来看，商业味比较浓，怕有猫腻 初次运行后会生成数个当前用户无访问权限的文件夹，强行删除再运行又会重新生成 唉，我又开始二了，用人家的东西还这么多牢骚。下面是实现方法： 在此处下载飞信机器人的linux版，运行程序依赖的库文件有4个:libcrypto.so.0.9.8, libssl.so.0.9.8, libACE.so.5.6.8, libACE_SSL.so.5.6.8。前两个属于openssh，后两个可以# emerge dev-libs/ace得到，鉴于版本问题和libACE 8MB的体积问题，还是直接下载它提供的库文件包吧。 建议解压后放到自己的$HOME目录下，例如我把它解压到$HOME/fetion-cli下，把解压的4个库文件也放到此目录下。 飞信机器人支持config文件读取帐户信息，创建一个$HOME/.fetion-cli.conf，按以下格式输入你的帐户信息: # ID Mobile Password 1 你的手机号码 你的飞信密码 然后是建立一个bash脚本fetion-sms.sh #!/bin/bash #usage: fetion-sms.sh MobileNum. ENTRY &#160; cd /home/punkid/fetion-cli LD_LIBRARY_PATH=. ./fetion --config=$HOME/.fetion-cli.conf --index=1 --to=$1 --msg-utf8=&#34;$2&#34; 这个脚本用法很简单，输入$ sh fetion-sms.sh 接收方的手机好码 飞信消息内容就完成了。 所以在aMule的Download completed event里配置如下就行了: sh /home/punkid/scripts/fetion-sms.sh 你的手机号码 &#34;%NAME 下载完成&#34; 这回算是比较满意了，飞信接收速度快而且不像GCal那样分两条不完整短信发过来。 Related posts [...]]]></description>
			<content:encoded><![CDATA[<p>上回用GCalcli实现了<a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download" title="给aMule增加下载完成短信通知功能">给aMule增加下载完成短信通知功能</a>，不过由于GCal的短信格式问题并不完美，在<a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/comment-page-1/#comment-1470" title="Comment by Druggo">Druggo的提示</a>下转而使用飞信来实现这个吧。</p>
<p>飞信虽然在linux下已经有libfetion和linux-fetion for purple了，不过都没有直观的纯CLI操作方式。找来找去只找到个闭源的<a href="http://www.it-adv.net/" title="飞信机器人">飞信机器人</a>，这软件优点是:纯命令操作，简单快捷。</p>
<p>不爽的地方是:</p>
<ol>
<li>闭源，依赖的库文件有版本要求。而且从主页来看，商业味比较浓，怕有猫腻</li>
<li>初次运行后会生成数个当前用户无访问权限的文件夹，强行删除再运行又会重新生成</li>
</ol>
<p>唉，我又开始二了，用人家的东西还这么多牢骚。下面是实现方法：<br />
<span id="more-303"></span><br />
在<a href="http://bbs.it-adv.net/viewthread.php?tid=155" title="下载飞信机器人">此处下载飞信机器人的linux版</a>，运行程序依赖的库文件有4个:<code>libcrypto.so.0.9.8</code>, <code>libssl.so.0.9.8</code>, <code>libACE.so.5.6.8</code>, <code>libACE_SSL.so.5.6.8</code>。前两个属于openssh，后两个可以<code># emerge dev-libs/ace</code>得到，鉴于版本问题和libACE 8MB的体积问题，还是直接下载它提供的<a href="http://www.it-adv.net/fetion/downng/library_linux.tar.gz" title="飞信机器人 Linux库文件包">库文件包</a>吧。</p>
<p>建议解压后放到自己的<code>$HOME</code>目录下，例如我把它解压到<code>$HOME/fetion-cli</code>下，把解压的4个库文件也放到此目录下。</p>
<p>飞信机器人支持config文件读取帐户信息，创建一个<code>$HOME/.fetion-cli.conf</code>，按以下格式输入你的帐户信息:</p>
<pre>
# ID    Mobile          Password
1        你的手机号码   你的飞信密码
</pre>
<p>然后是建立一个bash脚本<code>fetion-sms.sh</code></p>
<pre class="bash"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#usage: fetion-sms.sh MobileNum. ENTRY</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>punkid<span style="color: #000000; font-weight: bold;">/</span>fetion-cli
<span style="color: #007800;">LD_LIBRARY_PATH</span>=. .<span style="color: #000000; font-weight: bold;">/</span>fetion <span style="color: #660033;">--config</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>.fetion-cli.conf <span style="color: #660033;">--index</span>=<span style="color: #000000;">1</span> <span style="color: #660033;">--to</span>=$<span style="color: #000000;">1</span> <span style="color: #660033;">--msg-utf8</span>=<span style="color: #ff0000;">&quot;$2&quot;</span></pre>
<p>这个脚本用法很简单，输入<code>$ sh fetion-sms.sh 接收方的手机好码 飞信消息内容</code>就完成了。</p>
<p>所以在aMule的Download completed event里配置如下就行了:</p>
<pre class="bash"><span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>punkid<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>fetion-sms.sh 你的手机号码 <span style="color: #ff0000;">&quot;%NAME 下载完成&quot;</span></pre>
<p>这回算是比较满意了，飞信接收速度快而且不像GCal那样分两条不完整短信发过来。</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
	<li><a href="http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/" title="Use gentoo-bashrc under Archlinux (August 23, 2008)">Use gentoo-bashrc under Archlinux</a> (7)</li>
	<li><a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/" title="Ultimate Guide to Manage Your iPod under Linux : Revised (January 6, 2008)">Ultimate Guide to Manage Your iPod under Linux : Revised</a> (53)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2009/03/27/free-sms-notification-via-fetion-on-amule-completed-download/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>给aMule增加下载完成短信通知功能</title>
		<link>http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/</link>
		<comments>http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 13:40:16 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[aMule]]></category>
		<category><![CDATA[gcalcli]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[Google App]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=301</guid>
		<description><![CDATA[自从入手了E71，装上PuTTY for Symbian OS后就能通过wifi+ssh远程遥控我的电脑了。一个常遇到的问题，人得跑出去，而电脑上的aMule正在挂高清，我想知道我正等着看的东西什么时候下载完成了，然后我好执行远程关机或者选择继续让aMule下载其他的东西。 思索了下，最好的通知方式莫过于短信，而真正可用的免费短信功能莫过于Google Calendar的短信通知了。由于aMule本身就有Events功能，剩下的唯一问题就是能在linux下执行的Gcal CLI了。好在为Google做的third party的大有人在，很快就找到了Gcalcli这个python客户端，连ebuild在Gentoo Bugzilla上都有了。 gcalcli的用法很简单，先在$HOME目录下创建一个.gcalclirc文件，里面写入以下几行: &#91;gcalcli&#93; user:yourname@gmail.com pw:yourpassword cals:all 写法无须解释，最好至少给chmod 600 .gcalclirc下，毕竟密码是明文的，给别人看到就糟了。 然后新建一个download-notify.sh的文件，写入如下几行: #!/bin/bash #usage: download-notify.sh FILENAME &#160; NOTIFY_TIME=`date --date='+5 min' +%R` FILENAME=$1 ENTRY=&#34;$NOTIFY_TIME $FILENAME download finished&#34; &#160; gcalcli quick &#34;$ENTRY&#34; 这是用来快速添加Google Calendar事件的脚本，设定时间是当前时间的5分钟后(给予一定时间差的容错值免得短信还没来得及通知就已经成历史事件了)，文件名将由aMule的Events传递。 接下来要做的是进入Google Calendar设置默认的通知方式，先确保你开通了短信通知功能，然后进入Settings -&#62; Calendars标签页 -&#62; Notifications，将默认通知方式设置为1分钟前短信通知。 剩下的就是aMule设置的问题了。进入Preferences -&#62; Events，在Event types里选择Download completed，有两个可供执行脚本的input框，第一个是当aMule Core发现下载完成时执行指定命令，第二个是仅当aMule GUI发现下载完成时执行指定命令。不管你使用aMule daemon还是aMule GUI，第一个是绝对可行的。所以开启第一个并输入类似命令sh ~/scripts/download-notify.sh "%NAME"。 [...]]]></description>
			<content:encoded><![CDATA[<p>自从入手了E71，装上<a href="http://s2putty.sourceforge.net/" title="PuTTY for Symbian OS">PuTTY for Symbian OS</a>后就能通过wifi+ssh远程遥控我的电脑了。一个常遇到的问题，人得跑出去，而电脑上的aMule正在挂高清，我想知道我正等着看的东西什么时候下载完成了，然后我好执行远程关机或者选择继续让aMule下载其他的东西。</p>
<p>思索了下，最好的通知方式莫过于短信，而真正可用的免费短信功能莫过于<a href="http://calendar.google.com/" title="Google Calendar">Google Calendar</a>的短信通知了。由于aMule本身就有Events功能，剩下的唯一问题就是能在linux下执行的Gcal CLI了。好在为Google做的third party的大有人在，很快就找到了<a href="http://code.google.com/p/gcalcli/" title="Google Calendar Command Line Interface">Gcalcli</a>这个python客户端，连<a href="http://bugs.gentoo.org/195592" title="Bugzilla Bug 195592 - app-misc/gcalcli-1.4 (New Package)">ebuild</a>在Gentoo Bugzilla上都有了。</p>
<p>gcalcli的用法很简单，先在<code>$HOME</code>目录下创建一个<code>.gcalclirc</code>文件，里面写入以下几行:<br />
<span id="more-301"></span></p>
<pre class="bash"><span style="color: #7a0874; font-weight: bold;">&#91;</span>gcalcli<span style="color: #7a0874; font-weight: bold;">&#93;</span>
user:yourname<span style="color: #000000; font-weight: bold;">@</span>gmail.com
pw:yourpassword
cals:all</pre>
<p>写法无须解释，最好至少给<code>chmod 600 .gcalclirc</code>下，毕竟密码是明文的，给别人看到就糟了。</p>
<p>然后新建一个<code>download-notify.sh</code>的文件，写入如下几行:</p>
<pre class="bash"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#usage: download-notify.sh FILENAME</span>
&nbsp;
<span style="color: #007800;">NOTIFY_TIME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #660033;">--date</span>=<span style="color: #ff0000;">'+5 min'</span> +<span style="color: #000000; font-weight: bold;">%</span>R<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">FILENAME</span>=$<span style="color: #000000;">1</span>
<span style="color: #007800;">ENTRY</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$NOTIFY_TIME</span> <span style="color: #007800;">$FILENAME</span> download finished&quot;</span>
&nbsp;
gcalcli quick <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ENTRY</span>&quot;</span></pre>
<p>这是用来快速添加Google Calendar事件的脚本，设定时间是当前时间的5分钟后(给予一定时间差的容错值免得短信还没来得及通知就已经成历史事件了)，文件名将由aMule的Events传递。</p>
<p>接下来要做的是进入Google Calendar设置默认的通知方式，<strong>先确保你开通了短信通知功能</strong>，然后进入Settings -&gt; Calendars标签页 -&gt; Notifications，将默认通知方式设置为1分钟前短信通知。</p>
<p><img src="http://pic.yupoo.com/punkid/0365272b01a6/qj3g0x7f.jpg" alt="gcal-setting" width="500" height="80" border="0" /></p>
<p>剩下的就是aMule设置的问题了。进入Preferences -&gt; Events，在Event types里选择Download completed，有两个可供执行脚本的input框，第一个是当aMule Core发现下载完成时执行指定命令，第二个是仅当aMule GUI发现下载完成时执行指定命令。不管你使用aMule daemon还是aMule GUI，第一个是绝对可行的。所以开启第一个并输入类似命令<code>sh ~/scripts/download-notify.sh "%NAME"</code>。</p>
<p><img src="http://pic.yupoo.com/punkid/5345072b00c2/jc2eie4m.jpg" alt="amule-setting" width="500" height="281" border="0" /></p>
<p>OK，可用了。短信通知还是蛮及时的，唯一不爽的就是Google非得分两条未满短信通知我。</p>
<p><img src="http://pic.yupoo.com/punkid/9235772b0703/b5x926x5.jpg" alt="reminder" width="500" height="281" border="0" /></p>
<p>有了gcalcli能做的事就多了，例如电脑一旦发现sshd遭受brute force attacks时立刻短信通知，对网管应该比较有用吧 :)</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/" title="Ultimate Guide to Manage Your iPod under Linux : Revised (January 6, 2008)">Ultimate Guide to Manage Your iPod under Linux : Revised</a> (53)</li>
	<li><a href="http://blog.punkid.org/2009/03/27/free-sms-notification-via-fetion-on-amule-completed-download/" title="aMule下载短信通知的飞信实现 (March 27, 2009)">aMule下载短信通知的飞信实现</a> (1)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
	<li><a href="http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/" title="Use gentoo-bashrc under Archlinux (August 23, 2008)">Use gentoo-bashrc under Archlinux</a> (7)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Why to Upgrade to Libgpod SVN Build</title>
		<link>http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/</link>
		<comments>http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 16:24:56 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[iPod]]></category>
		<category><![CDATA[libgpod]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=266</guid>
		<description><![CDATA[I didnt pay much attention to the iPod artwork issue until I found the coverflow became extremely slow and out of response occasionally. I&#8217;m using Amarok via libgpod-0.6.0 to manage my iPod library, there&#8217;re approximately 1,000 songs of 68 albums in my iPod. As I checked the iPod_Control/Artwork directory of my iPod, it took up [...]]]></description>
			<content:encoded><![CDATA[<p>I didnt pay much attention to the <a href="http://amarok.kde.org/forum/index.php?action=printpage;topic=15032.0" title="Topic : Artwork on ipod classic on Amarok forums">iPod artwork issue</a> until I found the coverflow became extremely slow and out of response occasionally. </p>
<p>I&#8217;m using <a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/" title="Ultimate Guide to Manage Your iPod under Linux : Revised">Amarok via libgpod-0.6.0</a> to manage my iPod library, there&#8217;re approximately 1,000 songs of 68 albums in my iPod. As I checked the <code>iPod_Control/Artwork</code> directory of my iPod, it took up unexpectedly +300mb for the cover images.</p>
<pre class="bash">punkid<span style="color: #000000; font-weight: bold;">@</span>Genbox <span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>MUGELLO<span style="color: #000000; font-weight: bold;">/</span>iPod_Control $ <span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-h</span> Artwork<span style="color: #000000; font-weight: bold;">/</span>
314M    Artwork<span style="color: #000000; font-weight: bold;">/</span></pre>
<p><span id="more-266"></span><br />
Then I tried iTunes to rebuild my music library, the artwork database shrinks to 53mb.</p>
<pre class="bash">punkid<span style="color: #000000; font-weight: bold;">@</span>Genbox <span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>MUGELLO<span style="color: #000000; font-weight: bold;">/</span>iPod_Control $ <span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-h</span> Artwork<span style="color: #000000; font-weight: bold;">/</span>
53M     Artwork<span style="color: #000000; font-weight: bold;">/</span></pre>
<p>As someone in that post pointed out:</p>
<blockquote><p>
it turns out that iTunes isn&#8217;t actually storing one piece of artwork per track or even one per album &#8211; in my case at least, it stored one cover for only 2 of the tracks on the 12-track album &#8230;
</p></blockquote>
<p>Fortunately this issue has been fixed in the libgpod svn version, and the new artwork database size looks quite impressive. It&#8217;s even smaller than the iTunes&#8217; one.</p>
<pre class="bash">punkid<span style="color: #000000; font-weight: bold;">@</span>Genbox <span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>MUGELLO<span style="color: #000000; font-weight: bold;">/</span>iPod_Control $ <span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-h</span> Artwork<span style="color: #000000; font-weight: bold;">/</span>
18M     Artwork<span style="color: #000000; font-weight: bold;">/</span></pre>
<p>The latest libgpod svn build has already supported the new iPod Nano 4G, and the <a title="Go to comment 1356" href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/#comment-1356">photo issue</a> also seems to be fixed. If you dont have the patience for a &#8220;never-landed&#8221; new stable release, grab the latest <a href="http://sourceforge.net/svn/?group_id=67873" title="SourceForge.net: Subversion">libgpod svn snapshot</a>.</p>
<p>For Gentoo users, you may put the <a href="http://punkid.org/genbox/home/ebuild/media-libs/libgpod/libgpod-9999.ebuild" title="media-libs/libgpod-9999.ebuild">media-libs/libgpod-9999.ebuild</a> into your personal ebuild repo.</p>
<p><strong>Note :</strong> I removed the <code>doc</code> USE flag from the ebuild due to the latest libgpod somehow needs gtk-doc to <a href="http://gtkpod.svn.sourceforge.net/viewvc/gtkpod?view=rev&#038;revision=1727" title="SourceForge.net Repository - [gtkpod] Revision 1727">make distcheck to work correctly</a>. Bad news, KDE fan boys :(</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/" title="Ultimate Guide to Manage Your iPod under Linux : Revised (January 6, 2008)">Ultimate Guide to Manage Your iPod under Linux : Revised</a> (53)</li>
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
	<li><a href="http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/" title="Use gentoo-bashrc under Archlinux (August 23, 2008)">Use gentoo-bashrc under Archlinux</a> (7)</li>
	<li><a href="http://blog.punkid.org/2008/05/26/tips-in-aggregate/" title="Tips in Aggregate (May 26, 2008)">Tips in Aggregate</a> (1)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Backup Your Files Hierarchically to Dreamhost via Rsync</title>
		<link>http://blog.punkid.org/2008/10/29/backup-your-files-hierarchically-to-dreamhost-via-rsync/</link>
		<comments>http://blog.punkid.org/2008/10/29/backup-your-files-hierarchically-to-dreamhost-via-rsync/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 06:18:10 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[rsync]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=263</guid>
		<description><![CDATA[There&#8217;re some easy file backup n&#8217; sync online services such as Amazon S3 and Dropbox, however I find it not so handy when I want to sync my linux files hierarchially. I initially used git to sync my .vimrc file and my own ebuild repo, but it is not cost-efficient as I actually pay little [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;re some easy file backup n&#8217; sync online services such as <a href="http://aws.amazon.com/s3/" title="Amazon S3">Amazon S3</a> and <a href="https://www.getdropbox.com/" title="Dropbox">Dropbox</a>, however I find it not so handy when I want to sync my linux files hierarchially.</p>
<p>I initially used git to sync my <code>.vimrc</code> file and my own ebuild repo, but it is not cost-efficient as I actually pay little attention to the tracking commit things. So I ended up using rsync to synchronize my linux files to my dreamhost account.</p>
<h3>Preparation</h3>
<p>Assuming you&#8217;ve already had a dreamhost account with shell access priviledge (any other hosts with shell access will be fine as well). And you&#8217;re going to backup the following files on your system to the dreamhost server:<br />
<span id="more-263"></span></p>
<pre>
/home/yourname/.aliasrc
/home/yourname/.bashrc
/home/yourname/.config/openbox/
/home/yourname/files/
/home/yourname/.vimrc
/home/yourname/.vim/
/home/yourname/.xinitrc
/home/yourname/.Xdefaults
/etc/fstab
/etc/fonts/local.conf
/etc/make.conf
/etc/portage/package.*
/etc/X11/xorg.conf
</pre>
<p>Ofc you dont want others to see your <code>loveletter.txt</code> and <code>bankaccount.txt</code> under <code>files</code> directory, so the two files should be excluded from synchronization.</p>
<p>Put the following two lines into a textfile (such as <code>~/.rsync/excludes</code>) which we&#8217;ll use it later:</p>
<pre>
/home/yourname/files/loveletter.txt
/home/yourname/files/bankaccount.txt
</pre>
<h3>Howto</h3>
<p>I wrote this script for sync:</p>
<pre>
#!/bin/bash

includes="
/home/yourname/.aliasrc
/home/yourname/.bashrc
/home/yourname/.config/openbox/
/home/yourname/files/
/home/yourname/.vimrc
/home/yourname/.vim/
/home/yourname/.xinitrc
/home/yourname/.Xdefaults
/etc/fstab
/etc/fonts/local.conf
/etc/make.conf
/etc/portage/package.*
/etc/X11/xorg.conf
"

rsync -avzuCRpP --delete --delete-excluded $includes --exclude-from "/home/yourname/.rsync/excludes" -e ssh USERNAME@HOSTNAME:linux/
</pre>
<p>The <code>$includes</code> contains the files you want to sync, * wildcard supported, and to exclude the private files you&#8217;ll need the <code>--exclude-from</code> paramater.</p>
<p><code>USERNAME@HOSTNAME</code> is your dreamhost account and hostname, <code>:linux/</code> means sync the files to the linux directory under your dreamhost home directory.</p>
<p><code>-a</code> parameter makes sure your files will be synchronized recursively.</p>
<p><code>-C</code> is used for ignoring files like <code>.git</code>, <code>.svn</code>, <code>*.bak</code> and so on, ofc we dont want to waste time on transfering these useless things.</p>
<p><code>-R</code> is needed for transfering hierarchically, this means I can sync my <code>/etc/make.conf </code>file right under <code>linux/etc/</code> directory on my dreamhost.</p>
<p><code>-P</code> parameter is quite useful when the transaction is interrupted, you can continue the process somewhen later.</p>
<p>Now you can <code>chmod +x scriptname</code> before you run it first time.</p>
<p>Fetch the backup files from your dreamhost is easy, just to run:</p>
<pre>
rsync -e ssh -av USERNAME@HOSTNAME:linux/ backup/
</pre>
<p>The files will be transfered to the <code>backup</code> directory on the local computer.</p>
<p>You may need the <a href="http://www.debian-administration.org/articles/152" title="Password-less logins with OpenSSH">Password-less SSH Login</a> if you want to add this script to the cron job.</p>
<p>I use this cron job to make sure the script run automatically at 23:30 p.m. on every Monday and Thursday.</p>
<pre>
30 23 * * 1,4   punkid   sh /home/punkid/scripts/autobackup.sh
</pre>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/03/28/howto-setup-git-repo-on-dreamhost/" title="在Dreamhost主机上搭建Git (March 28, 2008)">在Dreamhost主机上搭建Git</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
	<li><a href="http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/" title="Use gentoo-bashrc under Archlinux (August 23, 2008)">Use gentoo-bashrc under Archlinux</a> (7)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2008/10/29/backup-your-files-hierarchically-to-dreamhost-via-rsync/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use gentoo-bashrc under Archlinux</title>
		<link>http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/</link>
		<comments>http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 14:18:03 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Archlinux]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[gentoo]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=235</guid>
		<description><![CDATA[为什么说Gentoo是最好用的linux distro了呢? 一个小小的.bashrc就包含了许多很人性化的设置，省去了很多自己手动配置的烦恼。 Archlinux用户们$ yaourt gentoo-bashrc吧，然后把/usr/share/gentoo-bashrc/bashrc复制到$HOME下。 Related posts 给aMule增加下载完成短信通知功能 (9) 在Archlinux下编译TuxOnIce内核 (2) Why to Upgrade to Libgpod SVN Build (3) Why I &#60;3 Gentoo and Its Community So Much (6) Ultimate Guide to Manage Your iPod under Linux : Revised (53)]]></description>
			<content:encoded><![CDATA[<p>为什么说Gentoo是最好用的linux distro了呢? 一个小小的<code>.bashrc</code>就包含了许多很人性化的设置，省去了很多自己手动配置的烦恼。</p>
<p>Archlinux用户们<code>$ yaourt gentoo-bashrc</code>吧，然后把<code>/usr/share/gentoo-bashrc/bashrc</code>复制到<code>$HOME</code>下。</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/08/14/compile-tuxonice-kernel-in-archlinux/" title="在Archlinux下编译TuxOnIce内核 (August 14, 2008)">在Archlinux下编译TuxOnIce内核</a> (2)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
	<li><a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/" title="Ultimate Guide to Manage Your iPod under Linux : Revised (January 6, 2008)">Ultimate Guide to Manage Your iPod under Linux : Revised</a> (53)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Tips in Aggregate</title>
		<link>http://blog.punkid.org/2008/05/26/tips-in-aggregate/</link>
		<comments>http://blog.punkid.org/2008/05/26/tips-in-aggregate/#comments</comments>
		<pubDate>Mon, 26 May 2008 15:53:56 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=216</guid>
		<description><![CDATA[都是些很零碎的tips，涉及到linux, wordpress, css, php, English &#8230; 选择性阅读吧! Douban and PHP 按照之前QQ签名秀的原理把豆瓣的个人广播系统也给提取出来了，效果请见此test页面。 使用方法是把以下代码添加到你的页面里: &#60;script type=&#34;text/javascript&#34; src=&#34;http://punkid.org/glade/douban/request.php?userid=&#60;strong&#62;username&#60;/strong&#62;&#38;numbers=5&#34;&#62;&#60;/script&#62; 其中userid后面跟的是你的豆瓣用户名，numbers后面是显示条目数(最多10条)。至于怎么polish这个douban的miniblog纯粹是你的CSS活。对了，输出编码是UTF-8。 PHP tips: 用addslashes这个函数可以对字符串进行转义。 Linux 1. Tired of emerging the world? emerge $&#40;eix -Iuc --format-compact &#34;&#60;category&#62;/&#60;name&#62;&#34; dev-libs/* &#124; head -n -1&#41; 可以用来更新某一category(例如dev-libs)下的已安装软件。 2. Ape转mp3 emerge shntools 和 mac-port (gentoo-china overlay提供) 后运行: shnsplit -f filename.cue -t &#34;%n - %t&#34; -o &#34;cust [...]]]></description>
			<content:encoded><![CDATA[<p>都是些很零碎的tips，涉及到linux, wordpress, css, php, English &#8230; 选择性阅读吧!</p>
<h3>Douban and PHP</h3>
<p>按照之前<a href="http://punkid.org/qqsign/" title="QQ签名秀">QQ签名秀</a>的原理把豆瓣的个人广播系统也给提取出来了，效果请见此<a href="http://punkid.org/glade/douban/test.html" title="Douban miniblog test page">test页面</a>。</p>
<p>使用方法是把以下代码添加到你的页面里:</p>
<pre class="xml"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;script</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;http://punkid.org/glade/douban/request.php?userid=&lt;strong&gt;</span></span>username<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/strong<span style="color: #000000; font-weight: bold;">&gt;</span></span></span><span style="color: #ddbb00;">&amp;numbers=5&quot;&gt;&lt;/script&gt;</span></pre>
<p>其中<code>userid</code>后面跟的是你的豆瓣用户名，<code>numbers</code>后面是显示条目数(最多10条)。至于怎么polish这个douban的miniblog纯粹是你的CSS活。对了，输出编码是UTF-8。</p>
<p>PHP tips: 用<a href="http://cn.php.net/manual/en/function.addslashes.php" title="PHP:addslashes">addslashes</a>这个函数可以对字符串进行转义。<br />
<span id="more-216"></span></p>
<h3>Linux</h3>
<h4>1. Tired of emerging the world?</h4>
<pre class="bash">emerge $<span style="color: #7a0874; font-weight: bold;">&#40;</span>eix <span style="color: #660033;">-Iuc</span> <span style="color: #660033;">--format-compact</span> <span style="color: #ff0000;">&quot;&lt;category&gt;/&lt;name&gt;&quot;</span> dev-libs<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span> <span style="color: #660033;">-n</span> -<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre>
<p>可以用来更新某一category(例如dev-libs)下的已安装软件。</p>
<h4>2. Ape转mp3</h4>
<p>emerge shntools 和 mac-port (<a href="http://code.google.com/p/gentoo-china-overlay/" title="Gentoo China Overlay">gentoo-china overlay</a>提供) 后运行:</p>
<pre class="bash">shnsplit <span style="color: #660033;">-f</span> filename.cue <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;%n - %t&quot;</span> <span style="color: #660033;">-o</span> <span style="color: #ff0000;">&quot;cust ext=mp3 lame --preset extreme - %f&quot;</span> filename.ape</pre>
<p>会根据cue文件对ape进行切割成按<code>tracknumber - trackname</code>命名的mp3文件，不过ID3信息没法保存进去，交给<a href="http://www.musicbrainz.org/" title="Musicbrainz">Musicbrainz</a>搞定吧。</p>
<h4>3. 使用Aria2下载器</h4>
<p>原来用的axel不知何故在我的电脑上经常出现Initialing download就停滞不前的情况，无奈&#8230;换了个稍微大点的Aria2。顺便把Gentoo Mirror的默认下载也换成了aria2。更改make.conf如下:</p>
<pre class="bash"><span style="color: #007800;">FETCHCOMMAND</span>=<span style="color: #ff0000;">&quot;/usr/bin/aria2c -c -s 4 -d <span style="color: #007800;">${DISTDIR}</span> -o <span style="color: #007800;">${FILE}</span> <span style="color: #007800;">${URI}</span>&quot;</span>
<span style="color: #007800;">RESUMECOMMAND</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${FETCHCOMMAND}</span>&quot;</span></pre>
<p>至于在firefox里用flashgot启用aria2下载，在<code>Executable path</code>里填<code>/usr/bin/rxvt</code> (任意虚拟终端，别用xterm就是了，那个启动太慢了)，然后在<code>Command line arguments template</code>里填<code>-e aria2c -s 5 -d [FOLDER] [URL]</code></p>
<h3>WordPress</h3>
<h4>1. 只显示当日评论数</h4>
<p>不明白我的意思的，留个言在到首页看下就知道了，当日有留言的日志会格外用类似于<em>3 comments today</em>方式显示。方法很简单，抽数据而已。修改你的模板的index.php，再最顶端添加:</p>
<pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span> 
	<span style="color: #000088;">$nowtime</span> <span style="color: #339933;">=</span> current_time<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'timestamp'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$today</span> <span style="color: #339933;">=</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y-m-d G:i:s'</span><span style="color: #339933;">,</span> <span style="color: #990000;">mktime</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'m'</span><span style="color: #339933;">,</span><span style="color: #000088;">$nowtime</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'d'</span><span style="color: #339933;">,</span><span style="color: #000088;">$nowtime</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">date</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Y'</span><span style="color: #339933;">,</span><span style="color: #000088;">$nowtime</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
<p>然后是修改loop部分:</p>
<pre class="xml"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> if <span style="color: #66cc66;">&#40;</span>have_posts<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> : <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> while <span style="color: #66cc66;">&#40;</span>have_posts<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> : the_post<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;strong<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;?php</span> $today_comments = $wpdb-<span style="color: #000000; font-weight: bold;">&gt;</span></span>get_var(&quot;SELECT COUNT(*) FROM $wpdb-&gt;comments WHERE comment_post_ID = $id AND comment_date &gt;= '$today' AND comment_approved = '1'&quot;); ?&gt;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/strong<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>	
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;div</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;entry&quot;</span></span>
<span style="color: #009900;">		<span style="color: #000000; font-weight: bold;">&lt;h2</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;post-&lt;?php the_ID(); ?&gt;</span></span>&quot; class=&quot;entrytitle&quot;&gt;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;&lt;?php the_permalink() ?&gt;</span></span>&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link to <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span></span>&quot;&gt;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/h2<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;p</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;metadata clearfix&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;strong<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;span</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;cmt&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> if <span style="color: #66cc66;">&#40;</span>$today_comments <span style="color: #000000; font-weight: bold;">&gt;</span></span> 0) { ?&gt;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;a</span> <span style="color: #000066;">class</span>=<span style="color: #ff0000;">&quot;todaycmt&quot;</span> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;&lt;?php the_permalink() ?&gt;</span></span>#comments&quot; title=&quot;Comment on <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span></span>&quot;&gt;<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> echo $today_comments; <span style="color: #000000; font-weight: bold;">?&gt;</span></span> Comment<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> if <span style="color: #66cc66;">&#40;</span>$today_comments<span style="color: #000000; font-weight: bold;">&gt;</span></span>1) echo 's'; ?&gt; Today<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #66cc66;">&#125;</span> else <span style="color: #66cc66;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> comments_popup_link<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'No Comments'</span>, <span style="color: #ff0000;">'1 Comment'</span>, <span style="color: #ff0000;">'% Comments'</span><span style="color: #66cc66;">&#41;</span>; <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #000000; font-weight: bold;">&lt;/span<span style="color: #000000; font-weight: bold;">&gt;</span></span><span style="color: #000000; font-weight: bold;">&lt;/strong<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		...
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
&nbsp;
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #66cc66;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></span>
&nbsp;
		...
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> endif; <span style="color: #000000; font-weight: bold;">?&gt;</span></span></pre>
<p>加重部分是关键。</p>
<h4>2. 过滤某category的feed输出</h4>
<p>在模板的function.php里添加这段代码:</p>
<pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">function</span> RssFilter<span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">is_feed</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #000088;">$query</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'cat'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'-&lt;strong&gt;22&lt;/strong&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
         <span style="color: #b1b100;">return</span> <span style="color: #000088;">$query</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pre_get_posts'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'RssFilter'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
<p>其中22为你的category ID。</p>
<h3>CSS</h3>
<p>CSS的代码书写风格我倾向于单行式，用缩进表明元素的从属关系。例如:</p>
<pre class="css"><span style="color: #cc00cc;">#secondary</span> div<span style="color: #6666ff;">.modules</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">40px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#secondary</span> div<span style="color: #6666ff;">.modules</span> a <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#888</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#secondary</span> div<span style="color: #6666ff;">.modules</span> a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FF32B3</span><span style="color: #00AA00;">;</span>text-decoration<span style="color: #00AA00;">:</span><span style="color: #993333;">underline</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#secondary</span> div<span style="color: #6666ff;">.modules</span> h3 <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#94C742</span><span style="color: #00AA00;">;</span>border-<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">dotted</span> <span style="color: #cc00cc;">#94C742</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#secondary</span> div<span style="color: #6666ff;">.modules</span> ul li <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">3px</span> <span style="color: #933;">8px</span><span style="color: #00AA00;">;</span>border-<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">dashed</span> <span style="color: #cc00cc;">#FF80D0</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#secondary</span> div<span style="color: #6666ff;">.modules</span> ul li<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#F0F8E2</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#bottom_wrapper</span> h3 <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FDF262</span><span style="color: #00AA00;">;</span>border-<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#FDF262</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#bottom_wrapper</span> div<span style="color: #6666ff;">.modules</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>margin<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>float<span style="color: #00AA00;">:</span><span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span>position<span style="color: #00AA00;">:</span><span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>display<span style="color: #00AA00;">:</span><span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#bottom_wrapper</span> div<span style="color: #6666ff;">.modules</span> ul li <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span><span style="color: #933;">1.6em</span><span style="color: #00AA00;">;</span>padding<span style="color: #00AA00;">:</span><span style="color: #933;">3px</span> <span style="color: #933;">2px</span><span style="color: #00AA00;">;</span>border-<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">1px</span> <span style="color: #993333;">dotted</span> <span style="color: #cc00cc;">#528F08</span><span style="color: #00AA00;">;</span>overflow<span style="color: #00AA00;">:</span><span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#bottom_wrapper</span> div<span style="color: #6666ff;">.modules</span> ul li<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#528F08</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#bottom_wrapper</span> div<span style="color: #cc00cc;">#misc</span> table<span style="color: #6666ff;">.calendar</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span><span style="color: #933;">300px</span><span style="color: #00AA00;">;</span>margin-<span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span><span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>border-<span style="color: #993333;">collapse</span><span style="color: #00AA00;">:</span><span style="color: #993333;">separate</span><span style="color: #00AA00;">;</span>border-spacing<span style="color: #00AA00;">:</span><span style="color: #933;">1px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
		table<span style="color: #6666ff;">.calendar</span> td <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span><span style="color: #933;">3px</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">2px</span><span style="color: #00AA00;">;</span>text-align<span style="color: #00AA00;">:</span><span style="color: #993333;">center</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
		table<span style="color: #6666ff;">.calendar</span> td<span style="color: #6666ff;">.calendar_h</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
		table<span style="color: #6666ff;">.calendar</span> td<span style="color: #6666ff;">.today</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#528F08</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
		table<span style="color: #6666ff;">.calendar</span> td<span style="color: #6666ff;">.week</span> <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#528F08</span><span style="color: #00AA00;">;</span>color<span style="color: #00AA00;">:</span><span style="color: #cc00cc;">#FDF262</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>
	<span style="color: #cc00cc;">#bottom_wrapper</span> div<span style="color: #cc00cc;">#tags</span> ul li <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">margin-right</span><span style="color: #00AA00;">:</span><span style="color: #933;">5px</span><span style="color: #00AA00;">;</span>padding<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>display<span style="color: #00AA00;">:</span><span style="color: #993333;">inline</span><span style="color: #00AA00;">;</span>border<span style="color: #00AA00;">:</span><span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span>	
		<span style="color: #cc00cc;">#bottom_wrapper</span> div<span style="color: #cc00cc;">#tags</span> ul li span<span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#bottom_wrapper</span> div<span style="color: #cc00cc;">#tags</span> div <span style="color: #00AA00;">&#123;</span><span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></pre>
<p>也许这种单行的方式不利于阅读，但是类似block的书写方式最大的问题是一旦CSS代码上个几百行的，要找到某一行翻页是件很痛苦的事，而单行定义加上适当的缩进即便不看HTML源代码也能对页面结构有个基本的认识。还有就是&#8230;在VIM下用<code>w</code>,<code>b</code>进行整词跳跃是件很惬意的事，即便是单行也能很快的跳跃到需要修改查看的property。</p>
<h3>English</h3>
<h4>1. take with a pinch of salt</h4>
<p>Radiohead的<em>A Wolf at the Door</em>里有句歌词是<em>Take it with the love its given, take it with a pinch of salt, take it to the taxman</em>。</p>
<p>那<em>take it with a pinch of salt</em>真的是抓把盐吗? 真实的意思有点类似于姑且相信，半信半疑的意思，例如<em>Regarding what you said yesterday, I would take it with a pinch of salt</em>意思就是你昨天说的那些我姑且相信吧。</p>
<h4>Tia Dalma and I go way back</h4>
<p>在电影<em>Pirates of the Carribean : The Man&#8217;s Chest</em> (加勒比海盗2:聚魂棺)，Jack船长带着众人去找女巫Tia Dalma时说: <em>No worries, mates. Tia Dalma and I go way back.</em>。我记得当时我看的思路的版本翻译成了<em>伙计们，别担心，Tia Dalma和我待会就回来</em>。这其实是错误的，<em>go back way</em>的意思是表示两人认识很久了，交情很好。</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2007/04/10/gentoo-notes-part-4/" title="Gentoo 使用笔记 Part 4 (April 10, 2007)">Gentoo 使用笔记 Part 4</a> (4)</li>
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2007/02/18/sereval-ways-to-make-alter-background/" title="浅谈实现网页交替背景颜色的几种方法 (February 18, 2007)">浅谈实现网页交替背景颜色的几种方法</a> (0)</li>
	<li><a href="http://blog.punkid.org/2009/04/03/wp-syntax-improvement/" title="改造WP-Syntax (April 3, 2009)">改造WP-Syntax</a> (5)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2008/05/26/tips-in-aggregate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ultimate Guide to Manage Your iPod under Linux : Revised</title>
		<link>http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/</link>
		<comments>http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/#comments</comments>
		<pubDate>Sun, 06 Jan 2008 13:55:32 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Amarok]]></category>
		<category><![CDATA[ffmpeg]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[Google App]]></category>
		<category><![CDATA[Gwenview]]></category>
		<category><![CDATA[iPod]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[last.fm]]></category>
		<category><![CDATA[mencoder]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/</guid>
		<description><![CDATA[I bought myself an iPod Nano (Product)red by the end of last year, it was cool. But the biggest problem i confront is how do i manage my iPod music library and sorts of things under Linux, since I&#8217;m a linux daily-user, i merely switch back to my Windows XP system. What&#8217;s more, i really [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://photo15.yupoo.com/20080106/015154_465989328_tutyhkya.jpg" alt="Ultimate Guide to Manage Your iPod under Linux" width="500" height="124" border="0" /></p>
<p>I bought myself an iPod Nano (Product)<sup>red</sup> by the end of last year, it was cool. But the biggest problem i confront is how do i manage my iPod music library and sorts of things under Linux, since I&#8217;m a linux daily-user, i merely switch back to my Windows XP system. What&#8217;s more, i really DISLIKE using the iTunes under Windows, it&#8217;s just not so handy to me, as well it costs too much memory. So, with Google&#8217;s help, eventually i found some good solutions to make my iPod work under Linux. And here comes the guide, i&#8217;ll break it down into several sections, enjoy it!</p>
<p><strong>Note</strong>: I&#8217;m using <a href="http://www.gentoo.org" title="Gentoo">Gentoo</a> linux, and <a href="http://www.kde.org" title="KDE">KDE</a> <abbr title="Desktop Environment">DE</abbr>, but i presume things will be much <em>even</em> easier if you&#8217;re using the Everyone-Loves-It <a href="http://www.ubuntu.com/" title="ubuntu">(k)ubuntu</a> linux distro (I&#8217;ll make some notes below each paragraph, letting you ubuntu users know what to do)<br />
<span id="more-187"></span></p>
<h3>Preparation</h3>
<p>Before you get any further, first you need to install libgpod, that&#8217;s the core component to make iPod work under Linux. In Gentoo linux, you can simply run <code>emerge libgpod</code>, but please ensure that you&#8217;ve already added the <code>gtk</code> USE if you want to make the coverflow work, which i&#8217;ll explain later. So run <code>USE="gtk" emerge libgpod</code> is a good choice.</p>
<p><strong>Note</strong>: What if you&#8217;re using (k)ubuntu? Dont worry about the Gentoo <code>USE</code> things, just run <code>apt-install libgpod</code> or some sort of that command (Sorry, I dont have ubuntu installed so i really have no idea the exact package name for libgpod)</p>
<p>To make my iPod automounted, i enabled hald and dbus service, and the KDE itself will handle the rest. Put the <code>hal dbus</code> into your <code>make.conf</code>&#8216;s USE, and emerge the hal and dbus.</p>
<pre class="bash"><span style="color: #666666; font-style: italic;"># echo &quot;sys-apps/hal acpi disk-partition&quot; &gt;&gt; /etc/portage/package.use</span>
<span style="color: #666666; font-style: italic;"># emerge hal dbus</span></pre>
<p>Then run <code>emerge -auvDN world</code> to make everything work with dbus and hal. Or you prefer using <code>eix --installed-without-use hal</code> and <code>eix --installed-without-use dbus</code> to manually check the packages which need re-emerge. After that, lets start &#8216;em.</p>
<pre class="bash"><span style="color: #666666; font-style: italic;"># /etc/init.d/dbus start</span>
<span style="color: #666666; font-style: italic;"># /etc/init.d/hald start</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> you prefer starting them when booting your system, just
<span style="color: #666666; font-style: italic;"># rc-update add dbus default</span>
<span style="color: #666666; font-style: italic;"># rc-update add hald default</span></pre>
<p><strong>Note</strong>: The Ubuntu users can totally ignore what i mention above about the hal and dbus, since Ubuntu has already done these all for you, i said <em>things will be much even easier</em> :)</p>
<h3>Music Library Management</h3>
<p>This is the most important part, the software we need is <a href="http://amarok.kde.org" title="Amarok">Amarok</a>, a multimedia killer app, which is also the <em>best</em> music player AFAIK. To make it work with iPod, lets first do the USE things :)</p>
<pre class="bash"><span style="color: #666666; font-style: italic;"># echo &quot;media-sound/amarok ipod&quot; &gt;&gt; /etc/portage/package.use</span>
<span style="color: #666666; font-style: italic;"># emerge amarok</span></pre>
<h4>1. Identify Your iPod</h4>
<p>Once you get the hal work, the iPod device should be auto mounted (the default path is <code>/media/ipod</code> by udev rules), at least under KDE. Launch your amarok, and switch to the &#8216;Device&#8217; tab, and identify your iPod model under &#8216;Set iPod Model&#8217;.</p>
<p><img src="http://photo15.yupoo.com/20080106/130356_32319682_vizgsmsc.jpg" alt="amarok-ipod-identifier" width="500" height="171" border="0" /></p>
<h4>2. Transfer Music</h4>
<p>Now you can easily &#8216;drag n&#8217; drop&#8217; your mp3s into the &#8216;Device&#8217; tab container, or you can right click the files/albums/playlists to choose &#8216;Transfer to Media Device&#8217;</p>
<p><img src="http://photo15.yupoo.com/20080106/130358_2146271816_upvatfal.jpg" alt="amarok-ipod-transfer1" width="399" height="268" border="0" /></p>
<p><img src="http://photo14.yupoo.com/20080106/130357_1438571723_mjdqcvzc.jpg" alt="amarok-ipod-transfer" width="309" height="238" border="0" /></p>
<p>The next step is simply click &#8216;transfer&#8217;, copy the mp3s into your iPod.</p>
<p><strong>Note</strong>: It&#8217;s supposed to have your music appeared in your iPod if you installed &gt;=libgpod-0.6.0. But what if your iPod (The Classic or Nano 3G, or iTouch) doesnt show any items you&#8217;ve transfered? Then we need to get our hands a little of dirty :)</p>
<p>Run <code>lsusb -v | grep -i Serial</code> with root privilege, and copy the 16-character-long hash string (something like <code>00A27001301221F</code>) into the clipboard. Then open the <code>/media/ipod/iPod_control/Device/SysInfo</code> file with your favorite text editor, append this line into it:</p>
<pre class="bash">FirewireGuid: 0xffffffffffffffff</pre>
<p>Replace the <code>ffffffffffffffff</code> with that 16-character-long hash string you just got.</p>
<h4>3. Cover Flow Effect</h4>
<p>Coverflow effect is really fascinating, you can easily fetch the album art cover from Amazon via Amarok.</p>
<p><img src="http://photo15.yupoo.com/20080106/130356_1113337934_uamvjxru.jpg" alt="amarok-ipod-fetch-cover" width="400" height="240" border="0" /></p>
<p>To make sure your iPod recognize the coverart setting in Amarok, simply click the &#8216;Update Artwork&#8217; under &#8216;Device&#8217; tab, that&#8217;s all, i say THAT&#8217;S ALL :D</p>
<p><img src="http://photo15.yupoo.com/20080106/130355_967800838_mnpdztnq.jpg" alt="amarok-ipod-cover" width="501" height="114" border="0" /></p>
<p><strong>Tip</strong>: If you have some <abbr title="Various Artists">V.A</abbr> albums, you may find it quite disturbing when you flip the cover flow, seeing the same album image several times under different artist names. And they&#8217;re all pointed to the same album! To group &#8216;em under <em>Various Artists</em>, just go to the Amarok&#8217;s &#8216;collection&#8217; tab, right click the album and choose &#8216;Show under Various Artists&#8217;, then re-upload the album to your iPod. Or you can choose &#8216;Do not Show under Various Artists&#8217; if you think the artist name does matter.</p>
<h3>Video Management</h3>
<p>With Amarok, you can also simply drag n&#8217; drop the video files (mov, mp4) into your iPod, you dont need to worry about which directory they&#8217;re supposed to be placed.</p>
<p>So what i&#8217;d demonstrate here is how to convert the AVI movie file into your iPod MP4 file, and how to get the youtube video into your iPod.</p>
<h4>1. Deal with AVI Movie File</h4>
<p>What i want to deal with the avi movie file is to get a scaled clip video with only a few minutes which&#8217;s suitable for iPod playing, as well i&#8217;d also like to embed the subtitle into the clip due to my poor English understanding :D With Mplayer&#8217;s mencoder, everything turns out so easy.</p>
<pre class="bash">Make sure you at least have these USEs enabled <span style="color: #000000; font-weight: bold;">for</span> mplayer. We need <span style="color: #000000; font-weight: bold;">&lt;</span>Code<span style="color: #000000; font-weight: bold;">&gt;</span>encode<span style="color: #000000; font-weight: bold;">&lt;/</span>code<span style="color: #000000; font-weight: bold;">&gt;</span> use to build mencoder support, and those vedio and audio libraries <span style="color: #000000; font-weight: bold;">for</span> encoding.
&nbsp;
<span style="color: #666666; font-style: italic;"># USE=&quot;aac win32codecs xvid encode mp3 quicktime srt&quot; emerge mplayer</span></pre>
<p>Here is the command we&#8217;re gonna run: (based on <a href="http://bones7456.blog.ubuntu.org.cn/2008/08/12/toipod/" title="bones7456's nautilus toiPod script">bones7456&#8242;s nautilus toiPod script</a>)</p>
<pre class="bash">$ mencoder <span style="color: #660033;">-ss</span> 00:<span style="color: #000000;">36</span>:<span style="color: #000000;">36</span> <span style="color: #660033;">-endpos</span> 00:01:<span style="color: #000000;">35</span> \
   <span style="color: #660033;">-of</span> lavf <span style="color: #660033;">-lavfopts</span> <span style="color: #007800;">format</span>=mp4 <span style="color: #660033;">-oac</span> lavc <span style="color: #660033;">-ovc</span> lavc \
   <span style="color: #660033;">-lavcopts</span> <span style="color: #007800;">aglobal</span>=<span style="color: #000000;">1</span>:<span style="color: #007800;">vglobal</span>=<span style="color: #000000;">1</span>:<span style="color: #007800;">vcodec</span>=mpeg4:<span style="color: #007800;">vbitrate</span>=<span style="color: #000000;">600</span>:<span style="color: #007800;">acodec</span>=libfaac:<span style="color: #007800;">abitrate</span>=<span style="color: #000000;">128</span> \
   <span style="color: #660033;">-af</span> <span style="color: #007800;">lavcresample</span>=<span style="color: #000000;">24000</span> <span style="color: #660033;">-vf</span> <span style="color: #007800;">dsize</span>=<span style="color: #000000;">320</span>:<span style="color: #000000;">240</span>:<span style="color: #000000;">0</span>,<span style="color: #007800;">scale</span>=<span style="color: #000000;">0</span>:<span style="color: #000000;">0</span>,<span style="color: #007800;">expand</span>=<span style="color: #000000;">320</span>:<span style="color: #000000;">240</span>,harddup <span style="color: #660033;">-ofps</span> <span style="color: #000000;">25</span> <span style="color: #660033;">-srate</span> <span style="color: #000000;">22050</span> \
   <span style="color: #660033;">-sub</span> <span style="color: #ff0000;">&quot;subtitle.srt&quot;</span> \
   input.avi \
   <span style="color: #660033;">-o</span> output.mp4</pre>
<p>Yeah, i know these commands seem too complex, let me break &#8216;em down into detailed explanation.</p>
<ol>
<li>The <code>-ss</code> means the starting timeline, with<code>-ss</code> the <code>-endpos</code> means shifting forward time. In conjuction, this line <code>-ss 00:36:36 -endpos 00:01:35</code> means we&#8217;re gonna start record the clip from 00:36:36 to 00:38:11 (36:36 + 01:35 = 38:11)</li>
<li>The second, third and the fourth lines make sure the encoding meets the iPod spec requirement. If you have a larger screen like iTouch, iPod, change the <code>320:240</code> to <code>480:320</code>.</li>
<li>And we use <code>-sub "subtitle.srt"</code> to embed to subtitle into the clip</li>
<li>The last line of the first command specifies the output filename</li>
</ol>
<p>If you find the command too complex to recall, you can save the following script to <code>/usr/bin/toIpod</code>, and make sure it has the execute priviilege (<code>chmod a+x /usr/bin/toIpod</code>)</p>
<pre class="bash"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#Copyright (c) 2008 bones7456 (bones7456&lt;A&gt;gmail&lt;D&gt;com)</span>
<span style="color: #666666; font-style: italic;">#Modified by puNk!d</span>
<span style="color: #666666; font-style: italic;">#License: GPL</span>
<span style="color: #666666; font-style: italic;">#version 20080911</span>
&nbsp;
<span style="color: #007800;">SAVEDIR</span>=<span style="color: #ff0000;">&quot;/home/media/video&quot;</span>
&nbsp;
<span style="color: #007800;">INFILE</span>=<span style="color: #ff0000;">&quot;$1&quot;</span>
<span style="color: #007800;">PWD</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">CMD</span>=<span style="color: #ff0000;">&quot;mencoder -of lavf -lavfopts format=mp4 -oac lavc -ovc lavc &quot;</span>
CMD+=<span style="color: #ff0000;">&quot;-lavcopts aglobal=1:vglobal=1:vcodec=mpeg4:vbitrate=600:acodec=libfaac:abitrate=128 &quot;</span>
CMD+=<span style="color: #ff0000;">&quot;-af lavcresample=24000 -vf dsize=320:240:0,scale=0:0,expand=320:240,harddup -ofps 25 -srate 22050 &quot;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${INFILE%.*}</span>.srt&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
	CMD+=<span style="color: #ff0000;">&quot; -sub &quot;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">$PWD</span>/<span style="color: #007800;">${INFILE%.*}</span>.srt<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${INFILE%.*}</span>.ssa&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
	CMD+=<span style="color: #ff0000;">&quot; -sub &quot;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">$PWD</span>/<span style="color: #007800;">${INFILE%.*}</span>.ssa<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${INFILE%.*}</span>.ass&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span>
	CMD+=<span style="color: #ff0000;">&quot; -sub &quot;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">$PWD</span>/<span style="color: #007800;">${INFILE%.*}</span>.ass<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
CMD+=<span style="color: #ff0000;">&quot; -o &quot;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">$SAVEDIR</span>/<span style="color: #007800;">${INFILE%.*}</span>_ipod.mp4<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #ff0000;">&quot; &quot;</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #007800;">$PWD</span>/<span style="color: #007800;">$INFILE</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span>
<span style="color: #7a0874; font-weight: bold;">eval</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$CMD</span> 2&gt;&amp;1&quot;</span></pre>
<p>Now you can run <code>toIpod videofile</code> to convert the video into mp4 file which is stored in <code>/home/media/video</code>, and it will automatically embed the subtitles if the sub file has the same name as the video file.</p>
<p><strong>Note: </strong> The credit of this script goes to <a href="http://bones7456.blog.ubuntu.org.cn/" title="bones7456's blog">bones7456</a>, I only did some small modification to deduct the gnome dependency (zenity tool).</p>
<h4>2. Save Youtube Video into Your iPod</h4>
<p>Here comes another scenario, I&#8217;d like to save the youtube video <a href="http://www.youtube.com/watch?v=4XpnKHJAok8" title="Tech Talk: Linus Torvalds on git">Tech Talk: Linus Torvalds on git</a> into my iPod so i can watch it before sleep. We can achieve this with <a href="http://www.arrakis.es/~rggi3/youtube-dl/" title="youtube-dl">youtube-dl</a> and <a href="http://ffmpeg.mplayerhq.hu/" title="FFmpeg">FFmpeg</a>. If you dont have &#8216;em yet, just emerge &#8216;em!</p>
<pre class="bash"><span style="color: #666666; font-style: italic;"># emerge youtube-dl ffmpeg</span></pre>
<p>Make sure your ffmpeg compiled with at least <code>aac</code>, <code>encode</code>, <code>win32codecs</code> USEs. </p>
<p>Then we can obtain the youtube flv video file by:</p>
<pre class="bash">$ youtube-dl <span style="color: #ff0000;">&quot;http://www.youtube.com/watch?v=4XpnKHJAok8&quot;</span> <span style="color: #660033;">-o</span> output.flv</pre>
<p>And use ffmpeg to convert it into mp4 file.</p>
<pre class="bash">$ <span style="color: #c20cb9; font-weight: bold;">ffmpeg</span> <span style="color: #660033;">-i</span> output.flv <span style="color: #660033;">-acodec</span> libfaac <span style="color: #660033;">-ac</span> <span style="color: #000000;">2</span> output.mp4</pre>
<p>Transfer the output.mp4 with Amarok, its done!</p>
<p><strong>Note: </strong> As <a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/#comment-1292" title="Go to comment-1292">Michel</a> pointed out, if you&#8217;re sick of the endless CLI, try <a href="http://fixounet.free.fr/avidemux/" title="Avidemux">Avidemux</a>,  a GUI tool does make life easier in some cases :D</p>
<h3>Scrobble iPod Play History to Your Last.fm</h3>
<p><img src="http://photo14.yupoo.com/20080106/210414_27255980_jmfhjuqd.jpg" alt="badge_red" width="150" height="60" border="0" /></p>
<p>Amarok has last.fm built-in support, so whenever we play the music, the songs will be scrobbled to our last.fm account automatically. And the exciting thing is, Amarok can also handle iPod play history!</p>
<p><img src="http://photo15.yupoo.com/20080106/130355_1481640377_iosqkwgb.jpg" alt="amarok-ipod-config" width="335" height="385" border="0" /></p>
<p>Just check the &#8216;Synchronize with Amarok statistics&#8217; under &#8216;Configure Media Device&#8217; dialog window. Then plug in your iPod, you can see the submit queue from Amarok status bar if there&#8217;re some tracks unscrobbled.</p>
<h3>Transfer Photos into Your iPod</h3>
<p>I use <a href="http://gwenview.sourceforge.net/" title="Gwenview">Gwenview</a> as my first-choice photo management software on KDE, some of KDE users prefer <a href="http://www.digikam.org/" title="Digikam">Digikam</a>. Whatever, it doesnt matter. Cuz they both support <a href="http://extragear.kde.org/apps/kipi/" title="Kipi Plugins">Kipi Plugins</a> which we need to deal with iPod photo transfer.</p>
<p>Install Gwenview and Kipi-plugins with iPod support: (For ubuntu users, just get the gwenview and kipi!)</p>
<pre class="bash"><span style="color: #666666; font-style: italic;"># USE=&quot;ipod&quot; emerge libkipi kipi-plugins</span>
<span style="color: #666666; font-style: italic;"># USE=&quot;kipi&quot; emerge gwenview</span></pre>
<p><img src="http://photo15.yupoo.com/20080106/130359_1481423218_xnygudzz.jpg" alt="gwenview-ipod-photo" width="499" height="227" border="0" /></p>
<p>Then we can see the &#8216;Export to iPod&#8217; option under &#8216;Plugins&#8217; -&gt; &#8216;Tools&#8217; menu in Gwenview.</p>
<p><strong>Note: </strong> After some investigation and test, I found unfortunately there was no software perfectly delivered the photo transfer function. As kipi-plugin, libpod fails to show up the original picture on iPod whilst gpixpod produces a blank n&#8217; black thumbnail. Read the discussion from <a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/#comment-1271" title="Go to comment 1271">here</a>.</p>
<p><strong>Note 2: </strong> As <a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/#comment-1356" title="Go to comment 1356">Thomas</a> pointed out, there&#8217;s a patch for libgpod to fix the thumbnails problem. Follow the patch here: <a href="http://www.nabble.com/Re%3A-gtkpod-with-ipod-nano-3g-p14516933.html" title="gtkpod with ipod nano 3g">gtkpod with ipod nano 3g</a></p>
<h3>Extras</h3>
<p>Here comes the extra things part on iPod, we got Calendars, Contacts and Notes extras on iPod, but we dont feel like to deal &#8216;em with iTunes. How come we need to do the simple note with a 50mb+ memory cost multimedia software :(</p>
<h4>1. Notes</h4>
<p>It&#8217;s quite easy actually, just put the text files into the <code>/media/ipod/Notes</code> directory, that&#8217;s ALL. </p>
<h4>2. Calendar</h4>
<p>iPod uses Mac&#8217;s iCal calendar file, but we dont have Mac, and neither we have iTunes. But we can use some third-party software like <a href="http://www.gnome.org/projects/evolution/" title="Ximian Evolution">Ximian Evolution</a> or <a href="http://www.mozilla.org/projects/calendar/sunbird/" title="Mozilla Sunbird">Mozilla Sunbird</a> under Linux, nonetheless, personally i&#8217;d like to use some web apps to deal with the iCal file. <a href="http://calendar.google.com/" title="Google Calendar">Google Calendar</a> is definitely my 1st choice.</p>
<p><img src="http://photo15.yupoo.com/20080106/130358_161497164_jwfahtbn.jpg" alt="gcalender-ipod-setting" width="400" height="170" border="0" /></p>
<p>Choose one of your calendars, and click the &#8216;Calendar Settings&#8217;, in the bottom of the setting page, we see the iCal banner in &#8216;Private Address&#8217;, just save it to the <code>/media/ipod/Calendars</code> directory.</p>
<p><img src="http://photo15.yupoo.com/20080106/130358_505461660_uucmiutt.jpg" alt="gcalender-ipod-ical" width="499" height="77" border="0" /></p>
<h4>3. Contacts</h4>
<p>iPod supports vCard to implement its Contacts function, and we can use Gmail to generate the vCard file<br />
(C&#8217;mon, you should at least have a Gmail account unless you&#8217;re a Yahoo! die-hard fan :D )</p>
<p>I&#8217;m gonna save my words on howto do add contacts under Gmail, this is not the part of this iPod-related guide. To export the Gmail contact list into vCard file, click the &#8216;Contacts&#8217; link in Gmail page, then choose to export it with vCard format, save it to your <code>/media/ipod/Contacts</code> directory.</p>
<p><img src="http://photo15.yupoo.com/20080106/130359_1529868949_kkovgecz.jpg" alt="gmail-ipod-contact" width="500" height="281" border="0" /></p>
<h3>END</h3>
<p>That&#8217;s all what i can tell you guys, if you have any other tips on iPod under Linux, feel free to share with us.</p>
<p>And, i know there&#8217;s a software named <a href="http://gtkpod.sourceforge.net/" title="gtkpod">gtkpod</a> which can deals with iPod media synchronizing and photo transfer. But i dont feel like to recommend it, IMHO, its just not so handy as Amarok and Gwenview. Anyway, you might prefer using it if you&#8217;re using Gnome :)</p>
<p> <a href="http://www.pqdvd.com/dvd-to-ipod-video-converter.htm">Ultimate Guide to convert DVD to iPod  using PQ DVD to iPod Converter.</a> We show you how to convert and transfer DVDs to iPod with your favorate movies. DVD to iPod software reviews and everything else related.</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
	<li><a href="http://blog.punkid.org/2007/09/15/an-eye-candy-desktop-brings-me-delightful-comp-experience/" title="An Eye-Candy Desktop Brings Me Delightful Comp Experience (September 15, 2007)">An Eye-Candy Desktop Brings Me Delightful Comp Experience</a> (0)</li>
	<li><a href="http://blog.punkid.org/2007/12/18/ya-gon-learn-mathematics/" title="大家都来学数学 (December 18, 2007)">大家都来学数学</a> (6)</li>
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/feed/</wfw:commentRss>
		<slash:comments>53</slash:comments>
		</item>
		<item>
		<title>Why I &lt;3 Gentoo and Its Community So Much</title>
		<link>http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/</link>
		<comments>http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/#comments</comments>
		<pubDate>Sat, 10 Nov 2007 07:21:23 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ASUS K8N4-E]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[nForce]]></category>
		<category><![CDATA[sata]]></category>
		<category><![CDATA[内核无法识别SATA设备]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/</guid>
		<description><![CDATA[今天，总算是把Gentoo下困扰我N久的一个问题给解决了，把经历分享下，以便与我同命相连的人google到这篇日志。 主要症状是这样的: 使用华硕K8N4-E/Deluxe主板的，无论是使用Gentoo LiveCD 06/07版还是自编译内核(>2.6.13)启动，都无法识别到SATA硬盘设备，必须采用降级内核的方式或者使用Gentoo LiveCD 2005才能正常识别，而在Ubuntu/Fedora Core (2.6.2系列kernel)下却没有这个问题。只要是大于2.6.13的内核无论是gentoo-sources, genkernel, vanilla-sources, mm-sources, sabayon-sources甚至Ubuntu和Fedora的kernel都没用。我曾经在论坛里发过帖子询问，当时没太在意，以为降级内核到2.6.13就算解决了，但是随便kernel的不断更新，问题越来越多了，udev不能用最新的，与之而来的就是hal不能自动挂载移动储存设备，nvidia驱动不能用100系列版本，否则退出X会花屏，xorg-x11不能用7.3，因为没有100系列的nvidia驱动配合，这么多问题差点让我被迫转投ubuntu了，还好最终还是选择向Gentoo Community寻求帮助。 我在open a new thread之前就发现论坛里用同样一块主板的朋友都遇到了这个问题: SATA drives not recognized on kernel &#62; 2.6.11 Problem finding my SATA-drives kernel panic (solved) What does &#8220;VFS: Cannot open root device&#8230;&#8221; mean, exactly? 加上后面两个我之前发布的贴子/回复，搜集好所有信息后，我发了个新的帖子: Kernels(&#62;2.6.13) dont recognize sata disk on K8N4-E [solved] 并给当时发表/回复那些帖子的人发了封private message，也得到了这些人的热心帮助，但是始终没能解决问题。于是我去Gentoo Mailing List上发邮件，也没能得到解决的办法，最终选择了向Gentoo的Bugzilla提交bug，直接询问Gentoo [...]]]></description>
			<content:encoded><![CDATA[<p>今天，总算是把Gentoo下困扰我N久的一个问题给解决了，把经历分享下，以便与我同命相连的人google到这篇日志。</p>
<p>主要症状是这样的: 使用华硕K8N4-E/Deluxe主板的，无论是使用Gentoo LiveCD 06/07版还是自编译内核(>2.6.13)启动，都无法识别到SATA硬盘设备，必须采用降级内核的方式或者使用Gentoo LiveCD 2005才能正常识别，而在Ubuntu/Fedora Core (2.6.2系列kernel)下却没有这个问题。只要是大于2.6.13的内核无论是gentoo-sources, genkernel, vanilla-sources, mm-sources, sabayon-sources甚至Ubuntu和Fedora的kernel都没用。我曾经在论坛里<a href="http://forums.gentoo.org/viewtopic-t-442276.html" title="kernel panic (solved)">发过帖子</a>询问，当时没太在意，以为降级内核到2.6.13就算解决了，但是随便kernel的不断更新，问题越来越多了，udev不能用最新的，与之而来的就是hal不能自动挂载移动储存设备，nvidia驱动不能用100系列版本，否则退出X会花屏，xorg-x11不能用7.3，因为没有100系列的nvidia驱动配合，这么多问题差点让我被迫转投ubuntu了，还好最终还是选择向Gentoo Community寻求帮助。<br />
<span id="more-169"></span><br />
我在open a new thread之前就发现论坛里用同样一块主板的朋友都遇到了这个问题:</p>
<ol>
<li><a href="http://forums.gentoo.org/viewtopic-t-522268.html" title="ATA drives not recognized on kernel &gt; 2.6.11">SATA drives not recognized on kernel &gt; 2.6.11</a></li>
<li><a href="http://forums.gentoo.org/viewtopic-t-525163.html" title="Problem finding my SATA-drives">Problem finding my SATA-drives</a></li>
<li><a href="http://forums.gentoo.org/viewtopic-t-442276.html" title="kernel panic (solved)">kernel panic (solved)</a></li>
<li><a href="http://forums.gentoo.org/viewtopic-t-510265.html" title="What does "VFS: Cannot open root device..." mean, exactly?">What does &#8220;VFS: Cannot open root device&#8230;&#8221; mean, exactly?</a></li>
</ol>
<p>加上后面两个我之前发布的贴子/回复，搜集好所有信息后，我发了个新的帖子:</p>
<p><a href="http://forums.gentoo.org/viewtopic-t-581033.html" title="Kernels(&gt;2.6.13) dont recognize sata disk on K8N4-E [solved]">Kernels(&gt;2.6.13) dont recognize sata disk on K8N4-E [solved]</a></p>
<p>并给当时发表/回复那些帖子的人发了封private message，也得到了这些人的热心帮助，但是始终没能解决问题。于是我去Gentoo Mailing List上发邮件，也没能得到解决的办法，最终选择了向Gentoo的Bugzilla提交bug，直接询问Gentoo Developers。</p>
<p>Bugzilla Bug 194531 : <a href="http://bugs.gentoo.org/show_bug.cgi?id=194531" title="Kernels (&gt;2.6.13) dont recognize the sata harddisk on ASUS K8N4-E motherboard">Kernels (&gt;2.6.13) dont recognize the sata harddisk on ASUS K8N4-E motherboard</a></p>
<p>在这里得到了解决方案，关闭MMCONFIG PCI Access Mode可以成功识别到SATA设备，正如其中一个developer说的: <em>Nforce motherboards don&#8217;t have the best history with the linux kernel</em>。关闭MMCONFIG有两种方式，一是设置内核:</p>
<p>取消自动选择模式和MMCONFIG模式，选择BIOS或者DIRECT方式</p>
<pre>
CONFIG_PCI=y
# CONFIG_PCI_GOBIOS is not set
# CONFIG_PCI_GOMMCONFIG is not set
CONFIG_PCI_GODIRECT=y
# CONFIG_PCI_GOANY is not set
</pre>
<p>二是在grub.conf的kernel行末尾添加<code>pci=nommconf</code>参数来关闭它。</p>
<p>同样，使用Gentoo LiveCD的话，可以在启动时加入启动参数<em>nommconf</em>来顺利引导LiveCD读取SATA硬盘。问题是解决了，不过查看下ubuntu和fedora的kernel config文件，并没有关闭MMCONFIG模式，难道还是Gentoo的问题?</p>
<p>在Developers的帮助下，进入Kubuntu/Fedora LiveCD，<code>cat /proc/iomem</code>发现其中没有那句<code>f0000000-f3ffffff : PCI MMCONFIG 0</code>，意味着Ubuntu和Fedora把MMCONFIG给blacklist了。<strong>哪位使用Ubuntu或者Fedora的朋友麻烦把<code>cat /proc/iomem</code>的结果贴出来给我看下</strong>，我想知道是Ubuntu/Fedora直接blacklist了MMCONFIG还是在硬件检测时根据我的硬件关闭了MMCONFIG。</p>
<p>这样，整个症结就落在了MMCONFIG上，排除了Gentoo本身的因素。</p>
<p>Gentoo之所以受青睐的原因不仅是它的高度可定制性和portage的包管理方式，还有它背后强大的社区支持。<a href="http://forums.gentoo.org/" title="Gentoo Forums">Gentoo的官方论坛</a> 是目前最活跃的linux论坛之一了，里面集结了来自全世界各地的顶尖linux高手和geek，无论是帖子还是回复都是高质量的，即便是不用Gentoo Linux的朋友在里面都能找到很多有价值的东西。而Bugzilla作为forum的补充，提供了与开发人员直接的交流平台，你可以得到最专业的帮助。</p>
<p>I &lt;3 Gentoo and its Community !</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/08/14/compile-tuxonice-kernel-in-archlinux/" title="在Archlinux下编译TuxOnIce内核 (August 14, 2008)">在Archlinux下编译TuxOnIce内核</a> (2)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
	<li><a href="http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/" title="Use gentoo-bashrc under Archlinux (August 23, 2008)">Use gentoo-bashrc under Archlinux</a> (7)</li>
	<li><a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/" title="Ultimate Guide to Manage Your iPod under Linux : Revised (January 6, 2008)">Ultimate Guide to Manage Your iPod under Linux : Revised</a> (53)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Gentoo 使用笔记 Part 6</title>
		<link>http://blog.punkid.org/2007/09/28/gentoo-notes-part-6/</link>
		<comments>http://blog.punkid.org/2007/09/28/gentoo-notes-part-6/#comments</comments>
		<pubDate>Fri, 28 Sep 2007 12:24:50 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/2007/09/28/gentoo-notes-part-6/</guid>
		<description><![CDATA[愈发的发现用电脑离不开linux了啊，尤其是gentoo linux。在Windows下我竟无聊到只能玩CS，然后用个网银了&#8230;此笔记没有长篇大论，只分享一些日常使用Gentoo Linux的Tips (Or maybe you&#8217;ve known that for decades :D )。 使用eix来检索你的portage Gentoo的Portage越来越庞大了，平常使用命令emerge -s package来查找软件包实在是要等很久。建议安装eix，它通过检索portage来实现包的快速查找，而且检索功能十分强大，连overlay的包都能找。 eselect is powerful eselect 是个非常方便的工具，有了它不用再手动给gentoo-sources做/usr/src/linux链接了，不用再为更新profile而重做make.profile的链接了。使用#eselect 查看有多少modules可以使用。然后输入#eselect module-name list来查看该module的属性。例如我要查看我的profile: # eselect profile list Available profile symlink targets: &#91;1&#93; default-linux/x86/2006.1 &#91;2&#93; default-linux/x86/no-nptl &#91;3&#93; default-linux/x86/no-nptl/2.4 &#91;4&#93; default-linux/x86/2006.1/desktop * &#91;5&#93; default-linux/x86/2007.0 &#91;6&#93; default-linux/x86/2007.0/desktop &#91;7&#93; hardened/x86/2.6 &#91;8&#93; selinux/2007.0/x86 &#91;9&#93; selinux/2007.0/x86/hardened 其中带*号的表示这是我当前使用的profile，现在我想更改为最新的2007.0/desktop。显然我不想再使用冗长的#ln -s /usr/portage/profiles/default-linux/x86/2007.0/desktop/ /etc/make.profile命令了，利用eselect我只需要输入#eselect [...]]]></description>
			<content:encoded><![CDATA[<p>愈发的发现用电脑离不开linux了啊，尤其是gentoo linux。在Windows下我竟无聊到只能玩CS，然后用个网银了&#8230;此笔记没有长篇大论，只分享一些日常使用Gentoo Linux的Tips (Or maybe you&#8217;ve known that for decades :D )。</p>
<h3>使用eix来检索你的portage</h3>
<p>Gentoo的Portage越来越庞大了，平常使用命令<code>emerge -s package</code>来查找软件包实在是要等很久。建议安装eix，它通过检索portage来实现包的快速查找，而且检索功能十分强大，连overlay的包都能找。</p>
<h3><em>eselect</em> is powerful</h3>
<p>eselect 是个非常方便的工具，有了它不用再手动给gentoo-sources做<code>/usr/src/linux</code>链接了，不用再为更新profile而重做<code>make.profile</code>的链接了。使用<code>#eselect</code> 查看有多少modules可以使用。然后输入<code>#eselect module-name list</code>来查看该module的属性。例如我要查看我的profile:<br />
<span id="more-139"></span></p>
<pre class="bash"><span style="color: #666666; font-style: italic;"># eselect profile list</span>
Available profile symlink targets:
  <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>   default-linux<span style="color: #000000; font-weight: bold;">/</span>x86<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2006.1</span>
  <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>   default-linux<span style="color: #000000; font-weight: bold;">/</span>x86<span style="color: #000000; font-weight: bold;">/</span>no-nptl
  <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>   default-linux<span style="color: #000000; font-weight: bold;">/</span>x86<span style="color: #000000; font-weight: bold;">/</span>no-nptl<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2.4</span>
  <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>   default-linux<span style="color: #000000; font-weight: bold;">/</span>x86<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2006.1</span><span style="color: #000000; font-weight: bold;">/</span>desktop <span style="color: #000000; font-weight: bold;">*</span>
  <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">5</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>   default-linux<span style="color: #000000; font-weight: bold;">/</span>x86<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007.0</span> 
  <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">6</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>   default-linux<span style="color: #000000; font-weight: bold;">/</span>x86<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007.0</span><span style="color: #000000; font-weight: bold;">/</span>desktop
  <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">7</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>   hardened<span style="color: #000000; font-weight: bold;">/</span>x86<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2.6</span>
  <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">8</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>   selinux<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007.0</span><span style="color: #000000; font-weight: bold;">/</span>x86
  <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">9</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>   selinux<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2007.0</span><span style="color: #000000; font-weight: bold;">/</span>x86<span style="color: #000000; font-weight: bold;">/</span>hardened</pre>
<p>其中带*号的表示这是我当前使用的profile，现在我想更改为最新的2007.0/desktop。显然我不想再使用冗长的<code>#ln -s /usr/portage/profiles/default-linux/x86/2007.0/desktop/ /etc/make.profile</code>命令了，利用eselect我只需要输入<code>#eselect profile set 6</code> 就行了。再如更改内核链接，先用<code>#eselect kernel list</code> 查看当前/usr/src/linux链接指向何处，再通过<code>#eselect kernel set *</code> 来重新设置就行了。</p>
<h3>用<em>parallel-fetch</em> 边emerge边下载</h3>
<p>新装一个Gentoo或者要emerge一大堆软件包要花费大量时间，而其中不少时间还是消耗在下载上的，利用<em>parallel-fetch</em> 可以一边emerge一边以后台方式帮你下载需要的软件包。只要在<code>/etc/make.conf</code>里添加如下这句就行了:</p>
<pre class="bash"><span style="color: #007800;">FEATURES</span>=<span style="color: #ff0000;">&quot;parallel-fetch&quot;</span></pre>
<h3>Control the USE flags with <em>EUSE</em></h3>
<p><em>gentoolkit</em> 里自带的euse是个非常实用的小工具，利用它可以查询相关的USE flag信息，例如<code>#euse -i kde</code>。同时，我们还可以利用<code>#euse -E kde</code>和<code>#euse -D kde</code>在make.conf中分别添加或删除<code>kde</code>的use flag。</p>
<h3>用<em>qlop</em> 查看你的emerge记录</h3>
<p><em>portage-utils</em> 里带的qlop可以用来查看你的emerge log以及当前正在emerge的软件包和消耗时间。例如<code>#qlop -c</code> 来查看当前正在emerge的软件包，用<code>#qlop -tH package-name</code> 来查看过去emerge该软件包的耗时。</p>
<h3>用远程主机提供的ssh做代理</h3>
<p>有国外主机并能够使用ssh的朋友可以使用<code>#ssh -qTfnN -D 9050 用户名@主机名</code> 命令来与远程主机建立tunnel实现端口转发，然后只要在firefox里的代理设置里，把http代理地址设置为127.0.0.1，端口为9050就可以实现那远程主机做代理上网了 ( 参考文章<a href="http://www.chedong.com/blog/archives/001246.html" title="利用Putty通过ssh端口转发实现FireFox和MSN加密代理访问">《利用Putty通过ssh端口转发实现FireFox和MSN加密代理访问》</a> )。</p>
<p>另外，在DH主机的论坛里翻了下，DH主机商的态度是默认允许使用ssh做代理的，但不公开推荐 :D &#8230; 说白了就是放心的用吧! 只要你不拿它乱下非法东东。</p>
<h3>让vim自动识别中文编码</h3>
<p>GB18030/BIG5编码的文档在vim下显示为乱码怎么办?<br />
在<code>.vimrc</code>下加入这句<code>set fileencodings=ucs-bom,utf8,GB18030,Big5,latin1</code>就行了。</p>
<h3><em>!$</em> or <em>Esc + .</em></h3>
<pre class="bash">$ <span style="color: #c20cb9; font-weight: bold;">unzip</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>audio<span style="color: #000000; font-weight: bold;">/</span>mp3<span style="color: #000000; font-weight: bold;">/</span>blur<span style="color: #000000; font-weight: bold;">/</span>blur-13.zip
&nbsp;
假设我们解压完某压缩包后，现在要删除该压缩包文件，我还需要输入后面那一大串路径吗? 我们可以利用<span style="color: #000000; font-weight: bold;">!</span>$来代替，它表示最后一条命令的最后一个参数。现在我们只需要这样了
&nbsp;
$ <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">!</span>$</pre>
<p>或者可以不输入<code>!$</code>，而是按下<code>Esc</code>键再按下<code> . </code>键就可以了，它会自动替你补充上条命令的最后一个参数的。</p>
<h3>Linux无法识别你的新设备</h3>
<p>你的硬件实在太新了，linux无法识别怎么办? 运行<code>#update-pciids</code> 来下载最新的设备信息吧。</p>
<h3>使用希网的动态域名</h3>
<p>我想在自己的电脑上架主机，可我没有固定IP怎么办? 我也没有自己的域名&#8230;先去<a href="http://www.6600.org/" title="希网动态域名服务">希网</a>注册个免费的二级域名，然后根据它提供的动态解析功能，使用lynx来刷新域名所绑定的IP地址。</p>
<pre class="bash"><span style="color: #666666; font-style: italic;">#lynx -mime_header -auth=用户名:密码&quot;http://www.3322.org/dyndns/update?system=dyndns&amp;hostname=你的免费域名&quot;</span></pre>
<p>OK，可以通过你所注册的免费域名访问你在自己电脑上架的主机了。欢迎各位互架主机交流音乐，电影!</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
	<li><a href="http://blog.punkid.org/2007/12/09/vim-tips/" title="VIM Tips (December 9, 2007)">VIM Tips</a> (3)</li>
	<li><a href="http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/" title="Use gentoo-bashrc under Archlinux (August 23, 2008)">Use gentoo-bashrc under Archlinux</a> (7)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2007/09/28/gentoo-notes-part-6/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>An Eye-Candy Desktop Brings Me Delightful Comp Experience</title>
		<link>http://blog.punkid.org/2007/09/15/an-eye-candy-desktop-brings-me-delightful-comp-experience/</link>
		<comments>http://blog.punkid.org/2007/09/15/an-eye-candy-desktop-brings-me-delightful-comp-experience/#comments</comments>
		<pubDate>Sat, 15 Sep 2007 11:57:51 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[compiz-fusion]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[KDE]]></category>
		<category><![CDATA[screenshot]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/2007/09/15/an-eye-candy-desktop-brings-me-delightful-comp-experience/</guid>
		<description><![CDATA[本日志为完全没任何技术含量纯粹秀桌面以发泄隐藏在桌面主人内心小小暴露欲以及尝试超长憋气不断句的不成文章的无聊文章。 Operating System : Gentoo Linux Desktop Environment : KDE + Compiz-Fusion Related posts Ultimate Guide to Manage Your iPod under Linux : Revised (53) 给aMule增加下载完成短信通知功能 (9) Why to Upgrade to Libgpod SVN Build (3) Why I &#60;3 Gentoo and Its Community So Much (6) Use gentoo-bashrc under Archlinux (7)]]></description>
			<content:encoded><![CDATA[<p>本日志为完全没任何技术含量纯粹秀桌面以发泄隐藏在桌面主人内心小小暴露欲以及尝试超长憋气不断句的不成文章的无聊文章。</p>
<p><a href="http://www.yupoo.com/photos/view?id=ff80808114f25d32011508faaf917801" title="来YUPOO看我的照片"><img src="http://photo5.yupoo.com/20070915/194305_1219519687.jpg" alt="snapshot_2007-09-10_1440x900" width="500" height="312" border="0" /></a></p>
<p>Operating System : Gentoo Linux<br />
Desktop Environment : KDE + Compiz-Fusion<br />
<span id="more-128"></span><br />
<a href="http://www.yupoo.com/photos/view?id=ff80808114fa763d011508f6b1783938" title="来YUPOO看我的照片"><img src="http://photo11.yupoo.com/20070915/193844_2080689991.jpg" alt="snapshot_2007-09-15_1440x900" width="500" height="312" border="0" /></a></p>
<p><a href="http://www.yupoo.com/photos/view?id=ff80808114fa6bd8011508feb9656b29" title="来YUPOO看我的照片"><img src="http://photo11.yupoo.com/20070915/194730_1735645341.jpg" alt="snapshot_2007-09-15_1440x900" width="500" height="312" border="0" /></a></p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/" title="Ultimate Guide to Manage Your iPod under Linux : Revised (January 6, 2008)">Ultimate Guide to Manage Your iPod under Linux : Revised</a> (53)</li>
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
	<li><a href="http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/" title="Use gentoo-bashrc under Archlinux (August 23, 2008)">Use gentoo-bashrc under Archlinux</a> (7)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2007/09/15/an-eye-candy-desktop-brings-me-delightful-comp-experience/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
