<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="http://feeds.casparant.com/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.casparant.com/~d/styles/itemcontent.css"?><rss 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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" version="2.0">

<channel>
	<title>Caspar Ant</title>
	
	<link>http://www.casparant.com</link>
	<description>Life beyond Linux and Programming</description>
	<pubDate>Sun, 04 Jan 2009 15:23:54 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.casparant.com/CasparAnt" type="application/rss+xml" /><item>
		<title>测试Drivel</title>
		<link>http://www.casparant.com/test-drivel.html</link>
		<comments>http://www.casparant.com/test-drivel.html#comments</comments>
		<pubDate>Sun, 28 Dec 2008 15:04:16 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[Blog Affair]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=229</guid>
		<description><![CDATA[重新使用Drivel试试~~~
关键是测试自动翻译Post名称的插件，哈哈~~~
该日志未加标签
	相关日志
	
	没有相关日志
	
... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>重新使用Drivel试试~~~</p>
<p>关键是测试自动翻译Post名称的插件，哈哈~~~</p>
</p>该日志未加标签
	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li>没有相关日志</li>
	</ul>


<p><a href="http://feedads.googleadservices.com/~a/ztjwml5g1twHplHkRFhzEdCaeXk/a"><img src="http://feedads.googleadservices.com/~a/ztjwml5g1twHplHkRFhzEdCaeXk/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/test-drivel.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Linux下推荐的软件</title>
		<link>http://www.casparant.com/some-softwares-under-linux.html</link>
		<comments>http://www.casparant.com/some-softwares-under-linux.html#comments</comments>
		<pubDate>Sun, 21 Dec 2008 03:19:33 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[Softwares]]></category>

		<category><![CDATA[fetion]]></category>

		<category><![CDATA[qq]]></category>

		<category><![CDATA[software]]></category>

		<category><![CDATA[uml]]></category>

		<category><![CDATA[飞鸽]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=223</guid>
		<description><![CDATA[Web Browser: Firefox3, Opera
FTP Client: Filezilla
BBS Client: FQterm
MSN: Pidgin, emesene
QQ: eva(云帆关了，唉……目前用过的最好的QQ4Linux了), pidgin, QQ for linux
Fetion: libfetion, pidgin
飞鸽: IPTux(已经卸载g2ipmsg了，iptux很强大)
Music Player: Amarok, audacious, mocp(for console)
Movie Player: SMPlayer, VLC
Editor: vim/Gvim, 永中Office个人版(对doc格式的兼容比OOo好，用于交实验报告）
eBook Utils: BooX Viewer(PDG，没找到官网), evince(PDF,看中文需要安装poppler-data这个包), kchmviewer(CHM)
Downloader: DownThemAll(Firefox Plugin)
Input Method: SUN Pinyin
Image Viewer: gpicview
UML: umbrello(不稳定), dia(画得不够标准)
——————其他——————
Checkgmail: 检查gmail账户是否有新邮件
grnotify: 检查google reader是否有新feed

	日志标签飞鸽, uml, fetion, qq, software

	相关日志
	
	Linux软件发布更新收集 (7)
	推荐！飞信手机3.0体验版 (3)
	QQ for Linux 官方版发布 (9)
	pidgin琐碎二三事 [...... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>Web Browser: <a href="http://www.mozillaonline.com/">Firefox3</a>, <a href="http://www.opera.com/browser/download/">Opera</a></p>
<p>FTP Client: <a href="http://filezilla-project.org/download.php">Filezilla</a></p>
<p>BBS Client: <a href="http://code.google.com/p/fqterm/downloads/list">FQterm</a></p>
<p>MSN: <a href="http://www.pidgin.im">Pidgin</a>, <a href="http://emesene.org/download.html">emesene</a></p>
<p>QQ: eva(云帆关了，唉……目前用过的最好的QQ4Linux了), pidgin, <a href="http://im.qq.com/qq/linux/download.shtml">QQ for linux</a></p>
<p>Fetion: <a href="http://www.libfetion.cn">libfetion</a>, <a href="http://www.linuxsir.org/bbs/thread320802.html">pidgin</a></p>
<p>飞鸽: <a href="http://code.google.com/p/iptux/downloads/list">IPTux</a>(已经卸载g2ipmsg了，iptux很强大)</p>
<p><span id="more-223"></span>Music Player: <a href="http://amarok.kde.org/wiki/Download">Amarok</a>, <a href="http://audacious-media-player.org/downloads">audacious</a>, <a href="http://moc.daper.net/download">mocp</a>(for console)</p>
<p>Movie Player: <a href="http://smplayer.sourceforge.net/downloads.php">SMPlayer</a>, <a href="http://www.videolan.org/vlc/">VLC</a></p>
<p>Editor: <a href="http://www.vim.org/download.php">vim/Gvim</a>, <a href="http://www.evermoresw.com.cn/webch/download/downEIOPersonal.jsp">永中Office个人版</a>(对doc格式的兼容比OOo好，用于交实验报告）</p>
<p>eBook Utils: <a href="http://www.lupaworld.com/action_download_itemid_193.html">BooX Viewer</a>(PDG，没找到官网), <a href="http://live.gnome.org/Evince/Downloads">evince</a>(PDF,看中文需要安装poppler-data这个包), <a href="http://www.kchmviewer.net/download.html">kchmviewer</a>(CHM)</p>
<p>Downloader: <a href="https://addons.mozilla.org/en-US/firefox/addon/201">DownThemAll</a>(Firefox Plugin)</p>
<p>Input Method: <a href="http://www.opensolaris.org/os/project/input-method/">SUN Pinyin</a></p>
<p>Image Viewer: <a href="http://lxde.sourceforge.net/gpicview/">gpicview</a></p>
<p>UML: <a href="http://uml.sourceforge.net/download.php">umbrello</a>(不稳定), <a href="http://projects.gnome.org/dia/">dia</a>(画得不够标准)</p>
<p>——————其他——————</p>
<p><a href="http://checkgmail.sourceforge.net/">Checkgmail</a>: 检查gmail账户是否有新邮件</p>
<p><a href="http://grnotify.sourceforge.net/">grnotify</a>: 检查google reader是否有新<a href="http://www.casparant.com/tag/feed" class="st_tag internal_tag" rel="tag" title="标签 feed 下的日志">feed</a></p>
</p>
	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/%e9%a3%9e%e9%b8%bd" title="飞鸽" rel="tag">飞鸽</a>, <a href="http://www.casparant.com/tag/software" title="software" rel="tag">software</a>, <a href="http://www.casparant.com/tag/uml" title="uml" rel="tag">uml</a>, <a href="http://www.casparant.com/tag/fetion" title="fetion" rel="tag">fetion</a>, <a href="http://www.casparant.com/tag/qq" title="qq" rel="tag">qq</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li><a href="http://www.casparant.com/a-collection-of-linux-softwares.html" title="Linux软件发布更新收集 (2008-09-04)">Linux软件发布更新收集</a> (7)</li>
	<li><a href="http://www.casparant.com/recommend-fetion-3.html" title="推荐！飞信手机3.0体验版 (2008-11-02)">推荐！飞信手机3.0体验版</a> (3)</li>
	<li><a href="http://www.casparant.com/qq-for-linux-by-tencent.html" title="QQ for Linux 官方版发布 (2008-07-31)">QQ for Linux 官方版发布</a> (9)</li>
	<li><a href="http://www.casparant.com/something-about-pidgin.html" title="pidgin琐碎二三事 (2008-08-19)">pidgin琐碎二三事</a> (1)</li>
	<li><a href="http://www.casparant.com/ipmsg-problems.html" title="Linux下飞鸽传书的两个问题的解决 (2008-03-12)">Linux下飞鸽传书的两个问题的解决</a> (0)</li>
</ul>


<p><a href="http://feedads.googleadservices.com/~a/-X8qyV4jJDBhCTtpqcOABwO3xIg/a"><img src="http://feedads.googleadservices.com/~a/-X8qyV4jJDBhCTtpqcOABwO3xIg/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/some-softwares-under-linux.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>周年记</title>
		<link>http://www.casparant.com/blog-anniversary.html</link>
		<comments>http://www.casparant.com/blog-anniversary.html#comments</comments>
		<pubDate>Wed, 17 Dec 2008 06:18:26 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[Blog Affair]]></category>

		<category><![CDATA[anniversary]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=222</guid>
		<description><![CDATA[1周年，100篇日志，100个Feedsky订阅，10个Feedburner订阅（- -&#124;&#124;&#124;），2w次访问，20w的Alexa排名。
写Blog也算有些年了，03年开始学习HTML，想做个个人主页，由于美工功底差，做出来的主页惨不忍睹，一度放弃；04年在杂志上了解到Blog，开始写，不过直到06年为止还是什么都不懂的涂鸦阶段，这两年主要停留在两个BSP上，Blogcn.com和Blog.com.cn，选择这两个BSP是因为它们的域名很NB；06开始到07年末，是辗转时期，Blog.com.cn的服务器太慢，抛弃了之后去了新浪，新浪有短时间服务器也开始抽风，于是去了网易，网易之后又去了博客大巴，反正一顿辗转，总是找不到满意的BSP。最后在yegle的教唆之下，选择了自建Blog。
在这个Blog之前的日志，大多是写自己的生活，只是我这人毛病有二，一是不喜欢让自己日志太散，所以一个博客废弃了就喜欢删文章；另一个是喜欢回头去看文章，看到写得太流水的文章也删。所以现在基本上已经找不到我当年的文字了。
写技术Blog也纯... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>1周年，100篇日志，100个Feedsky订阅，10个Feedburner订阅（- -|||），2w次访问，20w的Alexa排名。</p>
<p>写Blog也算有些年了，03年开始学习HTML，想做个个人主页，由于美工功底差，做出来的主页惨不忍睹，一度放弃；04年在杂志上了解到Blog，开始写，不过直到06年为止还是什么都不懂的涂鸦阶段，这两年主要停留在两个BSP上，<a href="http://swordantcs.blogcn.com">Blogcn.com</a>和<a href="http://swordantcs.blog.com.cn">Blog.com.cn</a>，选择这两个BSP是因为它们的域名很NB；06开始到07年末，是辗转时期，Blog.com.cn的服务器太慢，抛弃了之后去了<a href="http://blog.sina.com.cn/swordantcs">新浪</a>，新浪有短时间服务器也开始抽风，于是去了<a href="http://casparant.blog.163.com">网易</a>，网易之后又去了<a href="http://casparant.blogbus.com">博客大巴</a>，反正一顿辗转，总是找不到满意的BSP。最后在<a href="http://yegle.net">yegle</a>的教唆之下，选择了<a href="http://www.lampdrive.com">自建Blog</a>。</p>
<p>在这个Blog之前的日志，大多是写自己的生活，只是我这人毛病有二，一是不喜欢让自己日志太散，所以一个博客废弃了就喜欢删文章；另一个是喜欢回头去看文章，看到写得太流水的文章也删。所以现在基本上已经找不到我当年的文字了。</p>
<p>写技术Blog也纯属是兴趣，还是要感谢<a href="http://monnand.linuxsky.org">monnand</a>带我进入Linux这个伟大的世界，摆弄久了就想分享一些文字，所以就有了这个技术博客。</p>
<p>文章开头的那些数字是堆很普通的数字，我没有能力没有时间也没有想过让我的Blog成为公众关注的站点，自娱自乐，并且能让需要得到信息的朋友们获取需要的信息，足矣。</p>
</p>
	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/blog" title="Blog Affair" rel="tag">Blog Affair</a>, <a href="http://www.casparant.com/tag/anniversary" title="anniversary" rel="tag">anniversary</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li><a href="http://www.casparant.com/baidu-records-me.html" title="终于被百度收录了 (2008-06-08)">终于被百度收录了</a> (10)</li>
</ul>


<p><a href="http://feedads.googleadservices.com/~a/ZO5XAmq9LwarDvrNLnd0w0xZr-g/a"><img src="http://feedads.googleadservices.com/~a/ZO5XAmq9LwarDvrNLnd0w0xZr-g/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/blog-anniversary.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Amarok2 and WP2.7 Released</title>
		<link>http://www.casparant.com/amarok2-and-wp27-released.html</link>
		<comments>http://www.casparant.com/amarok2-and-wp27-released.html#comments</comments>
		<pubDate>Thu, 11 Dec 2008 07:08:33 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[New Releases]]></category>

		<category><![CDATA[amarok]]></category>

		<category><![CDATA[released]]></category>

		<category><![CDATA[Wordpress]]></category>

		<category><![CDATA[wp2.7]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=220</guid>
		<description><![CDATA[等了好久的Amarok2终于发布了。
Ubuntu用户可以参考Kubuntu网站上的Installation Instructions：
1. Follow the Kubuntu Repository Guide to enable Recommended Updates (backports) and add the following to your 'Third-Party Software' tab:
deb http://ppa.launchpad.net/kubuntu-members-kde4/ubuntu intrepid main
2. You can now update an existing Amarok 2 installation to the most recent version using the Adept Updater tool in your system tray.
If you do not have an existing Amarok 2 [...... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>等了好久的Amarok2终于发布了。</p>
<p>Ubuntu用户可以参考Kubuntu网站上的Installation Instructions：</p>
<p>1. Follow the Kubuntu Repository Guide to enable Recommended Updates (backports) and add the following to your 'Third-Party Software' tab:</p>
<blockquote><p>deb http://ppa.launchpad.net/kubuntu-members-kde4/ubuntu intrepid main</p></blockquote>
<p>2. You can now update an existing Amarok 2 installation to the most recent version using the Adept Updater tool in your system tray.</p>
<p>If you do not have an existing Amarok 2 install, please follow the Adept How to and install the package called "<em>amarok-kde4</em>". </p>
<p><span id="more-220"></span>issues——我的机子上出现下列问题：</p>
<p>1. 播放列表、收藏列表不能显示中文，全是???符号。</p>
<p><del datetime="2008-12-11T13:04:29+00:00">2. 启动Amarok后出现HDA Intel does not work的提示。</del>这个问题已经解决：我的系统使用了xine而不是gstreamer，故需要安装phonon-backend-xine这个包。</p>
<p>———————————— WP2.7 ————————————</p>
<p>WP-2.7 也发布了。</p>
<p>下载地址：</p>
<p><a href="http://code.google.com/p/wpcn/">http://code.google.com/p/wpcn/</a></p>
</p>
	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/amarok" title="amarok" rel="tag">amarok</a>, <a href="http://www.casparant.com/tag/wordpress" title="Wordpress" rel="tag">Wordpress</a>, <a href="http://www.casparant.com/tag/released" title="released" rel="tag">released</a>, <a href="http://www.casparant.com/tag/wp27" title="wp2.7" rel="tag">wp2.7</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li><a href="http://www.casparant.com/wordpress-26released.html" title="Wordpress 2.6 发布 (2008-07-16)">Wordpress 2.6 发布</a> (1)</li>
	<li><a href="http://www.casparant.com/alipay-for-linux.html" title="[转]支付宝针Firefox 的安全控件 for Linux (2008-10-23)">[转]支付宝针Firefox 的安全控件 for Linux</a> (6)</li>
	<li><a href="http://www.casparant.com/wordpress-functions.html" title="[转]Wordpress常用函数 (2008-03-07)">[转]Wordpress常用函数</a> (2)</li>
	<li><a href="http://www.casparant.com/ubuntu-hardy-released.html" title="[白鼠五]Ubuntu 8.04发布 (2008-04-24)">[白鼠五]Ubuntu 8.04发布</a> (0)</li>
	<li><a href="http://www.casparant.com/grnotify-100-rc1-released.html" title="[推荐]grnotify-1.0.0-RC1 released (2008-05-13)">[推荐]grnotify-1.0.0-RC1 released</a> (0)</li>
</ul>


<p><a href="http://feedads.googleadservices.com/~a/4aiA9ql84pEmdjgnwt5Ap1sX0Vw/a"><img src="http://feedads.googleadservices.com/~a/4aiA9ql84pEmdjgnwt5Ap1sX0Vw/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/amarok2-and-wp27-released.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>[周末休闲]God Wrote in LISP</title>
		<link>http://www.casparant.com/funny-song-god-wrote-in-lisp.html</link>
		<comments>http://www.casparant.com/funny-song-god-wrote-in-lisp.html#comments</comments>
		<pubDate>Sat, 29 Nov 2008 03:44:17 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[Copid Entries]]></category>

		<category><![CDATA[Programming]]></category>

		<category><![CDATA[gnu]]></category>

		<category><![CDATA[LISP]]></category>

		<category><![CDATA[song]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=211</guid>
		<description><![CDATA[这是一首灰常有意思的歌曲，翻唱自Julia Ecklar的"God Lives on Terra"。
可以看看这里了解一下这首歌曲的歌词：http://www.gnu.org/fun/jokes/eternal-flame.html
GNU社区还推荐了很多有意思的东东，可以去http://www.gnu.org/fun/humor.html查看，作为一个Linuxer和一个Programmer，这些内容可算是相当不错的休闲佐料了～
顺便试一下WP的1bit插件：eternal－flame
囧，居然不支持ogg格式的播放……传个MP3格式的算了，ogg格式下载点此：eternal-flame
附上歌词一览：

I was taught assembler
in my second year of school.
It's kinda like construction work --
with a toothpick for a tool.
So when I made my senior year,
I threw my code away,
And learned the way to program
that I still prefer today.
Now, some folks on the Internet
put their faith in C++.
They swear that it's so [...... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>这是一首灰常有意思的歌曲，翻唱自Julia Ecklar的"God Lives on Terra"。</p>
<p>可以看看这里了解一下这首歌曲的歌词：<a href="http://www.gnu.org/fun/jokes/eternal-flame.html">http://www.gnu.org/fun/jokes/eternal-flame.html</a></p>
<p>GNU社区还推荐了很多有意思的东东，可以去<a href="http://www.gnu.org/fun/humor.html">http://www.gnu.org/fun/humor.html</a>查看，作为一个Linuxer和一个Programmer，这些内容可算是相当不错的休闲佐料了～</p>
<p>顺便试一下WP的1bit插件：<a href="http://www.casparant.com/wp-content/uploads/2008/11/eternalflame.mp3">eternal－flame</a></p>
<p>囧，居然不支持ogg格式的播放……传个MP3格式的算了，ogg格式下载点此：<a href="http://www.casparant.com/wp-content/uploads/2008/11/eternal-flame.ogg">eternal-flame</a></p>
<p>附上歌词一览：</p>
<p><span id="more-211"></span></p>
<blockquote><p>I was taught assembler<br />
in my second year of school.<br />
It's kinda like construction work --<br />
with a toothpick for a tool.<br />
So when I made my senior year,<br />
I threw my code away,<br />
And learned the way to program<br />
that I still prefer today.</p>
<p>Now, some folks on the Internet<br />
put their faith in C++.<br />
They swear that it's so powerful,<br />
it's what God used for us.<br />
And maybe it lets mortals dredge<br />
their objects from the C.<br />
But I think that explains<br />
why only God can make a tree.</p>
<p>For God wrote in Lisp code<br />
When he filled the leaves with green.<br />
The fractal flowers and recursive roots:<br />
The most lovely hack I've seen.<br />
And when I ponder snowflakes,<br />
never finding two the same,<br />
I know God likes a language<br />
with its own four-letter name.</p>
<p>Now, I've used a SUN under Unix,<br />
so I've seen what C can hold.<br />
I've surfed for Perls, found what Fortran's for,<br />
Got that Java stuff down cold.<br />
Though the chance that I'd write COBOL code<br />
is a SNOBOL's chance in Hell.<br />
And I basically hate hieroglyphs,<br />
so I won't use APL.</p>
<p>Now, God must know all these languages,<br />
and a few I haven't named.<br />
But the Lord made sure, when each sparrow falls,<br />
that its flesh will be reclaimed.<br />
And the Lord could not count grains of sand<br />
with a 32-bit word.<br />
Who knows where we would go to<br />
if Lisp weren't what he preferred?</p>
<p>And God wrote in Lisp code<br />
Every creature great and small.<br />
Don't search the disk drive for man.c,<br />
When the listing's on the wall.<br />
And when I watch the lightning burn<br />
Unbelievers to a crisp,<br />
I know God had six days to work,<br />
So he wrote it all in Lisp.</p>
<p>Yes, God had a deadline.<br />
So he wrote it all in Lisp.</p></blockquote>
</p>
	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/lisp" title="LISP" rel="tag">LISP</a>, <a href="http://www.casparant.com/tag/gnu" title="gnu" rel="tag">gnu</a>, <a href="http://www.casparant.com/tag/song" title="song" rel="tag">song</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li>没有相关日志</li>
	</ul>


<p><a href="http://feedads.googleadservices.com/~a/hrKQ8HiDwO3x-dlunTgjsViVTbk/a"><img src="http://feedads.googleadservices.com/~a/hrKQ8HiDwO3x-dlunTgjsViVTbk/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/funny-song-god-wrote-in-lisp.html/feed</wfw:commentRss>
<enclosure url="http://www.casparant.com/wp-content/uploads/2008/11/eternalflame.mp3" length="6669828" type="audio/mpeg" />
		</item>
		<item>
		<title>国内的Service Providers啊……</title>
		<link>http://www.casparant.com/something-about-the-inland-sp.html</link>
		<comments>http://www.casparant.com/something-about-the-inland-sp.html#comments</comments>
		<pubDate>Sat, 29 Nov 2008 03:19:23 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[No Category]]></category>

		<category><![CDATA[163]]></category>

		<category><![CDATA[delete account]]></category>

		<category><![CDATA[pop3]]></category>

		<category><![CDATA[service provider]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=210</guid>
		<description><![CDATA[今天去看了一下我在网易的一个帐户，发现"sword*****"这个帐号终于被删除了。曾经就一顿诟病国内的服务提供商，只提供帐号注册服务，却不提供帐号注销服务，像163, sina, sohu, baidu，都有点像“这地方你想来就来但可不是想走就能走”的意味。看看Google， Yahoo，他们做得多好……
前面提到的那个帐户是去年7月开始停止使用的，后来似乎间间断断又登录了几次，估计网易就是看着我的帐户已经一年没登录过了，所以就删除了。曾经在网易和新浪的帮助里面看到他们说90天不登录就会删除帐号，看来确实是假的。
顺便说一句，163的POP3地址似乎改了，改成了pop3.163.com，以前都是pop.163.com，今天早上Gmail提示不能从163邮箱收邮件，然后就看了看。以前很少有邮箱的POP3地址是pop3开头的，不知道网易此举是什么意思……

	日志标签163, pop3, delete account, service provider

	相关日志
	
	没有相关日志
	
... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>今天去看了一下我在网易的一个帐户，发现"sword*****"这个帐号终于被删除了。曾经就一顿诟病国内的服务提供商，只提供帐号注册服务，却不提供帐号注销服务，像163, sina, sohu, baidu，都有点像“这地方你想来就来但可不是想走就能走”的意味。看看Google， Yahoo，他们做得多好……</p>
<p>前面提到的那个帐户是去年7月开始停止使用的，后来似乎间间断断又登录了几次，估计网易就是看着我的帐户已经一年没登录过了，所以就删除了。曾经在网易和新浪的帮助里面看到他们说90天不登录就会删除帐号，看来确实是假的。</p>
<p>顺便说一句，163的POP3地址似乎改了，改成了pop3.163.com，以前都是pop.163.com，今天早上Gmail提示不能从163邮箱收邮件，然后就看了看。以前很少有邮箱的POP3地址是pop3开头的，不知道网易此举是什么意思……</p>
</p>
	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/delete-account" title="delete account" rel="tag">delete account</a>, <a href="http://www.casparant.com/tag/service-provider" title="service provider" rel="tag">service provider</a>, <a href="http://www.casparant.com/tag/pop3" title="pop3" rel="tag">pop3</a>, <a href="http://www.casparant.com/tag/163" title="163" rel="tag">163</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li>没有相关日志</li>
	</ul>


<p><a href="http://feedads.googleadservices.com/~a/0QyhL8UonjCb9EwTi5nEeoxkqtA/a"><img src="http://feedads.googleadservices.com/~a/0QyhL8UonjCb9EwTi5nEeoxkqtA/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/something-about-the-inland-sp.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Python Web操作MySQL乱码问题的解决</title>
		<link>http://www.casparant.com/char-confusion-in-mysql-under-python-web.html</link>
		<comments>http://www.casparant.com/char-confusion-in-mysql-under-python-web.html#comments</comments>
		<pubDate>Sun, 16 Nov 2008 10:11:51 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[Web Tech]]></category>

		<category><![CDATA[charset]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[psp]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=199</guid>
		<description><![CDATA[乱码，身为CJK语言国度的程序员永恒的主题……
乱码，在stardict里面查了一下翻译，居然出来这么一长串：
characters changed to be irrecognizable because different coder or other reasons
不管怎么说，这次是又碰上乱码了。
症状是这样的，写了几个psp文件，内容大概是通过POST方法从表单获取数据，写入数据库然后另一个页面调用数据库内容显示。结果在写完之后调用显示页面，提示错误：unicodeDecodeError: 'ascii' codec can't decode byte，看来是因为我数据库里的字段用了中文，显示不出来，然后在MySQL里面SELECT * 了一下，发现含中文的内容都是???字样的乱码(以前怎么就没注意捏……）。
上网搜，发现了这个网页：http://blog.csdn.net/foyuan/archive/2007/07/27/1711100.aspx，文中提示了四个步骤确保乱码消失。
因为我写的是PSP页面，不是纯粹的python，似乎不能用#-*- coding -*-来指定编码，但是参照里面提示的两个步骤，我最后也成功解决了乱码问题：
1. 解决MySQL显示乱码，修改/etc/mysql/my.cnf文件，分... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>乱码，身为CJK语言国度的程序员永恒的主题……</p>
<p>乱码，在stardict里面查了一下翻译，居然出来这么一长串：</p>
<blockquote><p>characters changed to be irrecognizable because different coder or other reasons</p></blockquote>
<p>不管怎么说，这次是又碰上乱码了。</p>
<p>症状是这样的，写了几个psp文件，内容大概是通过POST方法从表单获取数据，写入数据库然后另一个页面调用数据库内容显示。结果在写完之后调用显示页面，提示错误：<code>unicodeDecodeError: 'ascii' codec can't decode byte</code>，看来是因为我数据库里的字段用了中文，显示不出来，然后在MySQL里面SELECT * 了一下，发现含中文的内容都是???字样的乱码(以前怎么就没注意捏……）。</p>
<p>上网搜，发现了这个网页：<a href="http://blog.csdn.net/foyuan/archive/2007/07/27/1711100.aspx">http://blog.csdn.net/foyuan/archive/2007/07/27/1711100.aspx</a>，文中提示了四个步骤确保乱码消失。</p>
<p><span id="more-199"></span>因为我写的是PSP页面，不是纯粹的python，似乎不能用#-*- coding -*-来指定编码，但是参照里面提示的两个步骤，我最后也成功解决了乱码问题：</p>
<p>1. 解决MySQL显示乱码，修改<code>/etc/mysql/my.cnf</code>文件，分别在<code>[client]、[mysqld]</code>后指定编码：<code>default-character-set = utf8</code>，重启mysql服务。</p>
<p>2. 解决PSP页面不能解析Unicode字符，在python语法块内，导入sys包，然后指定编码：</p>

<div class="wp_syntax"><div class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
...
&nbsp;
<span style="color: #008000;">reload</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span><span style="color: black;">&#41;</span>
<span style="color: #dc143c;">sys</span>.<span style="color: black;">setdefaultencoding</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'utf-8'</span><span style="color: black;">&#41;</span></pre></div></div>

<p>这样就搞定了，等我后续看看有其他什么问题没……</p>
</p>
	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/charset" title="charset" rel="tag">charset</a>, <a href="http://www.casparant.com/tag/python" title="python" rel="tag">python</a>, <a href="http://www.casparant.com/tag/mysql" title="mysql" rel="tag">mysql</a>, <a href="http://www.casparant.com/tag/psp" title="psp" rel="tag">psp</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li><a href="http://www.casparant.com/some-acquires.html" title="两个收购，N个收购 (2008-01-17)">两个收购，N个收购</a> (1)</li>
	<li><a href="http://www.casparant.com/modpython-configuration-under-ubuntu-804.html" title="Ubuntu 8.04 mod_python Config (2008-10-19)">Ubuntu 8.04 mod_python Config</a> (3)</li>
	<li><a href="http://www.casparant.com/ipmsg-problems.html" title="Linux下飞鸽传书的两个问题的解决 (2008-03-12)">Linux下飞鸽传书的两个问题的解决</a> (0)</li>
</ul>


<p><a href="http://feedads.googleadservices.com/~a/LDCuI_Alwi2K20RHz2kTKnsCvS0/a"><img src="http://feedads.googleadservices.com/~a/LDCuI_Alwi2K20RHz2kTKnsCvS0/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/char-confusion-in-mysql-under-python-web.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Linux 下使用 C 系统调用函数解决抽烟者问题</title>
		<link>http://www.casparant.com/using-c-system-call-to-solve-smoker-problem-under-linux.html</link>
		<comments>http://www.casparant.com/using-c-system-call-to-solve-smoker-problem-under-linux.html#comments</comments>
		<pubDate>Sun, 09 Nov 2008 14:02:37 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[Programming]]></category>

		<category><![CDATA[C]]></category>

		<category><![CDATA[cigarette smoker]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[operating system]]></category>

		<category><![CDATA[semaphore]]></category>

		<category><![CDATA[smoker]]></category>

		<category><![CDATA[syscall]]></category>

		<category><![CDATA[system call]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=192</guid>
		<description><![CDATA[问题描述:The Cigarette-Smokers Problem. Consider a system with three smoker processes and one agent process. Each smoker continuously rolls a cigarette and then smokes it. But to roll and smoke a cigarette, the smoker needs three ingredients: tobacco, paper, and matches. One of the smoker processes has paper, another has tobacco, and the third has matches. [...... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>问题描述:The Cigarette-Smokers Problem. Consider a system with three smoker processes and one agent process. Each smoker continuously rolls a cigarette and then smokes it. But to roll and smoke a cigarette, the smoker needs three ingredients: tobacco, paper, and matches. One of the smoker processes has paper, another has tobacco, and the third has matches. The agent has an infinite supply of all three materials. The agent places two of the ingredients on the table. The smoker who has the remaining ingredient then makes and smokes a cigarette, signaling the agent on completion. The agent then puts out another two of the three ingredients, and the cycle repeats.</p>
<p>问题分析:通过问题描述,可以构建出一个 4 进程的系统,其中 3 个进程为 smoker 程序的实例,另一个是 agent 程序的实例。首先,Agent 执行提供材料的操作(原则上来说,抽烟者先就座等待也是可行的,代码上也易于实现,但是我编写了一段代码发现很累赘,这作为一个需要改进的部分,暂时在代码中做 TODO 标记),然后执行对 Smoker_i的 V 操作唤醒 Smoker_i,其信号量增 1,i 的值由 Agent 随机确定。接着,Agent 开始等待,进程切换到Smoker_i,Smoker_i 执行 P 操作,信号量减为 0,开始获取材料,卷烟,抽烟操作。抽完烟后 Smoker_i执行 V 操作,通知 Agent,然后 Smoker_i 循环至开头,开始等待,进程切换回 Agent。Agent 也开始循环,如此周期往复。采用同步机制的 PV 操作伪码如下:</p>
<p><span id="more-192"></span><br />
<blockquote>
Initial semaphores:<br />
Agent: 0<br />
Smoker_i: 0 (i = 0, 1, 2)</p>
<p>Agent{<br />
loop:<br />
    Offer ingredients;<br />
    V(Smoker_i);<br />
    P(Agent);<br />
    GOTO loop;<br />
}<br />
Smoker_i{<br />
loop:<br />
    P(Smoker_i);<br />
    Get ingredients, roll and smoke;<br />
    V(Agent);<br />
    GOTO loop;<br />
}//i = 0, 1, 2</p></blockquote>
<p>技术细节:</p>
<p>1. Linux 系统调用函数 semget(),semctl(),semop()</p>
<p>1.1.   semget()函数原型:int semget(key_t key,int nsems,int semflg);</p>
<p>这个函数用于创建一个信号量集,创建成功后在操作系统中的 Semaphore Array 中新建一条记录。第一个参数为 Semaphore Array 记录中的 key 值,用于不同进程间识别同一个信号量;第二个参数为信号量集中的信号量个数,如果为 0 则为打开现有的信号量集;第三个参数为信号量创建的操作类型和访问权限。</p>
<p>1.2. semctl()函数原型:int semctl(int semid,int semnum,int cmd,union semun arg);</p>
<p>这个函数用于控制信号量集中的每个信号量,具体操作由第三个参数 cmd 决定。</p>
<p>1.3. semop()函数原型:int semop(int semid,struct sembuf*sops,unsign ednsops);</p>
<p>这个函数用于操作信号量,通过对第二个参数结构体中的内容进行修改,可以封装成 PV 操作。</p>
<p>2. ipcs, ipcrm 命令</p>
<p>由于信号量是在操作系统中的共享区域中,所以可以使用系统命令查看和删除这些信号量集。ipcrm -S KEY 命令可以删除键值为 KEY 的信号量,ipcs 命令可以查看信号量列表(当然其中还有其他 IPC 列表)。</p>
<p>代码：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code"><pre class="cpp cpp" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">/*
 * File: PV.h
 * Author: Caspar Zhang
 */</span>
<span style="color: #339900;">#ifndef _PV_H</span>
<span style="color: #339900;">#define _PV_H</span>
&nbsp;
<span style="color: #339900;">#define SEM_KEY 0x12345678</span>
&nbsp;
<span style="color: #339900;">#define ERR_AND_EXIT(arg) do { \</span>
		<span style="color: #0000dd;">perror</span><span style="color: #008000;">&#40;</span>arg<span style="color: #008000;">&#41;</span>; \
		<span style="color: #0000dd;">exit</span><span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span>; \
	<span style="color: #008000;">&#125;</span> <span style="color: #0000ff;">while</span><span style="color: #008000;">&#40;</span><span style="color:#800080;">0</span><span style="color: #008000;">&#41;</span>
&nbsp;
<span style="color: #0000ff;">int</span> P<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> semid, <span style="color: #0000ff;">int</span> sem_index<span style="color: #008000;">&#41;</span>;
<span style="color: #0000ff;">int</span> V<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> semid, <span style="color: #0000ff;">int</span> sem_index<span style="color: #008000;">&#41;</span>;
&nbsp;
<span style="color: #339900;">#endif /* _PV_H */</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="cpp cpp" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">/*
 * File: PV.c
 * Author: Caspar Zhang
 */</span>
<span style="color: #339900;">#include &quot;PV.h&quot;</span>
<span style="color: #339900;">#include &lt;stdio.h&gt;</span>
<span style="color: #339900;">#include &lt;unistd.h&gt;</span>
<span style="color: #339900;">#include &lt;sys/sem.h&gt;</span>
&nbsp;
<span style="color: #0000ff;">int</span> P<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> semid, <span style="color: #0000ff;">int</span> sem_index<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">struct</span> sembuf buf;
&nbsp;
	buf.<span style="color: #007788;">sem_num</span> <span style="color: #000080;">=</span> sem_index;
	buf.<span style="color: #007788;">sem_op</span> <span style="color: #000080;">=</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span>;
	buf.<span style="color: #007788;">sem_flg</span> <span style="color: #000080;">=</span> SEM_UNDO;
&nbsp;
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>semop<span style="color: #008000;">&#40;</span>semid, <span style="color: #000040;">&amp;</span>buf, <span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span>;
&nbsp;
	<span style="color: #0000ff;">return</span> <span style="color:#800080;">0</span>;
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> V<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> semid, <span style="color: #0000ff;">int</span> sem_index<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	<span style="color: #0000ff;">struct</span> sembuf buf;
&nbsp;
	buf.<span style="color: #007788;">sem_num</span> <span style="color: #000080;">=</span> sem_index;
	buf.<span style="color: #007788;">sem_op</span> <span style="color: #000080;">=</span> <span style="color: #0000dd;">1</span>;
	buf.<span style="color: #007788;">sem_flg</span> <span style="color: #000080;">=</span> SEM_UNDO;
&nbsp;
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>semop<span style="color: #008000;">&#40;</span>semid, <span style="color: #000040;">&amp;</span>buf, <span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">==</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span>
		<span style="color: #0000ff;">return</span> <span style="color: #000040;">-</span><span style="color: #0000dd;">1</span>;
&nbsp;
	<span style="color: #0000ff;">return</span> <span style="color:#800080;">0</span>;
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
</pre></td><td class="code"><pre class="cpp cpp" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">/*
 * File: Agent.c
 * Author: Caspar Zhang
 */</span>
<span style="color: #339900;">#include &lt;unistd.h&gt;</span>
<span style="color: #339900;">#include &lt;stdio.h&gt;</span>
<span style="color: #339900;">#include &lt;stdlib.h&gt;</span>
<span style="color: #339900;">#include &lt;time.h&gt;</span>
<span style="color: #339900;">#include &lt;sys/sem.h&gt;</span>
<span style="color: #339900;">#include &quot;PV.h&quot;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> argc, <span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span>argv<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	<span style="color: #ff0000; font-style: italic;">/*
	 * 0 - Paper and matches
	 * 1 - Matches and tobacco
	 * 2 - Tobacco and paper
	 */</span>
	<span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span>ingredient<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">3</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #008000;">&#123;</span>
		<span style="color: #FF0000;">&quot;Paper and matches&quot;</span>, 
		<span style="color: #FF0000;">&quot;Matches and tobacco&quot;</span>,
		<span style="color: #FF0000;">&quot;Tobacco and paper&quot;</span><span style="color: #008000;">&#125;</span>;
	<span style="color: #0000ff;">int</span> ingred_type;
	<span style="color: #0000ff;">int</span> semid, i;
&nbsp;
	<span style="color: #0000dd;">srand</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">unsigned</span><span style="color: #008000;">&#41;</span><span style="color: #0000dd;">time</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">NULL</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>;
&nbsp;
	<span style="color: #ff0000; font-style: italic;">/* Puts out the Agent's information */</span>
	<span style="color: #0000dd;">fprintf</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">stdout</span>, <span style="color: #FF0000;">&quot;I'm the Agent.<span style="color: #666666; font-weight: bold;">\n</span>&quot;</span> <span style="color: #008000;">&#41;</span>;
&nbsp;
	<span style="color: #ff0000; font-style: italic;">/*
	 * Create a new semaphore set which has 4 semaphores in it.
	 * The first 3 semaphores are the Smokers' state,
	 * the last one is the Agent's state
	 */</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>semid <span style="color: #000080;">=</span> semget<span style="color: #008000;">&#40;</span>SEM_KEY, <span style="color: #0000dd;">4</span>, IPC_CREAT|<span style="color: #208080;">0660</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">&lt;</span> <span style="color:#800080;">0</span><span style="color: #008000;">&#41;</span>
		ERR_AND_EXIT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;semget&quot;</span><span style="color: #008000;">&#41;</span>;
	<span style="color: #0000ff;">for</span> <span style="color: #008000;">&#40;</span>i <span style="color: #000080;">=</span> <span style="color:#800080;">0</span>; i <span style="color: #000080;">&lt;</span> <span style="color: #0000dd;">4</span>; <span style="color: #000040;">++</span>i<span style="color: #008000;">&#41;</span>
		<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>semctl<span style="color: #008000;">&#40;</span>semid, i, SETVAL, <span style="color:#800080;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">&lt;</span> <span style="color:#800080;">0</span><span style="color: #008000;">&#41;</span>
			ERR_AND_EXIT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;semctl&quot;</span><span style="color: #008000;">&#41;</span>;
&nbsp;
	<span style="color: #ff0000; font-style: italic;">/*
	 * The procedures are shown in below:
	 * 1. Offer Ingredients
	 * 2. V(Smoker_i)
	 * 3. P(Agent)
	 * 4. Go to 1 and repeat
	 */</span>
	<span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #ff0000; font-style: italic;">/* Offer the ingredients randomly*/</span>
		ingred_type <span style="color: #000080;">=</span> <span style="color: #0000dd;">rand</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000040;">%</span> <span style="color: #0000dd;">3</span>;
		<span style="color: #0000dd;">fprintf</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">stdout</span>, <span style="color: #FF0000;">&quot;Agent%d: I offered %s, waiting for the smoker.<span style="color: #666666; font-weight: bold;">\n</span>&quot;</span>,
				ingred_type, ingredient<span style="color: #008000;">&#91;</span>ingred_type<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>;
		sleep<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">5</span><span style="color: #008000;">&#41;</span>;
&nbsp;
		<span style="color: #ff0000; font-style: italic;">/*  Wake up the specified smoker */</span>
		<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>V<span style="color: #008000;">&#40;</span>semid, ingred_type<span style="color: #008000;">&#41;</span> <span style="color: #000080;">&lt;</span> <span style="color:#800080;">0</span><span style="color: #008000;">&#41;</span> ERR_AND_EXIT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;V failed&quot;</span><span style="color: #008000;">&#41;</span>;
&nbsp;
		<span style="color: #ff0000; font-style: italic;">/* Wait for smoker to roll and smoke */</span>
		<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>P<span style="color: #008000;">&#40;</span>semid, <span style="color: #0000dd;">3</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">&lt;</span> <span style="color:#800080;">0</span><span style="color: #008000;">&#41;</span> ERR_AND_EXIT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;P failed&quot;</span><span style="color: #008000;">&#41;</span>;
	<span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #0000ff;">return</span> <span style="color:#800080;">0</span>;
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
</pre></td><td class="code"><pre class="cpp cpp" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">/*
 * File: Smoker.c
 * Author: Caspar Zhang
 */</span>
&nbsp;
<span style="color: #339900;">#include &lt;stdio.h&gt;</span>
<span style="color: #339900;">#include &lt;stdlib.h&gt;</span>
<span style="color: #339900;">#include &lt;sys/sem.h&gt;</span>
<span style="color: #339900;">#include &quot;PV.h&quot;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> argc, <span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span>argv<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
	<span style="color: #ff0000; font-style: italic;">/*
	 * 0 - Tobacco Smoker
	 * 1 - Paper Smoker
	 * 2 - Matches Smoker
	 */</span>
	<span style="color: #0000ff;">char</span> <span style="color: #000040;">*</span>ingredient<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">3</span><span style="color: #008000;">&#93;</span> <span style="color: #000080;">=</span> <span style="color: #008000;">&#123;</span><span style="color: #FF0000;">&quot;Tobacco&quot;</span>, <span style="color: #FF0000;">&quot;Paper&quot;</span>, <span style="color: #FF0000;">&quot;Matches&quot;</span><span style="color: #008000;">&#125;</span>;
	<span style="color: #0000ff;">int</span> smoker <span style="color: #000080;">=</span> argv<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#91;</span><span style="color:#800080;">0</span><span style="color: #008000;">&#93;</span> <span style="color: #000040;">-</span> <span style="color: #FF0000;">'0'</span>;
	<span style="color: #0000ff;">int</span> semid;
&nbsp;
	<span style="color: #ff0000; font-style: italic;">/* Puts out the Smoker's information */</span>
	<span style="color: #0000dd;">fprintf</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">stdout</span>, <span style="color: #FF0000;">&quot;I'm a smoker. I have %s<span style="color: #666666; font-weight: bold;">\n</span>&quot;</span>, ingredient<span style="color: #008000;">&#91;</span>smoker<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>;
&nbsp;
	<span style="color: #ff0000; font-style: italic;">/* Get the existed semaphore set */</span>
	<span style="color: #ff0000; font-style: italic;">/* TODO How to create semaphores if smoker process executed first? */</span>
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">&#40;</span>semid <span style="color: #000080;">=</span> semget<span style="color: #008000;">&#40;</span>SEM_KEY, <span style="color:#800080;">0</span>, <span style="color:#800080;">0</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">&lt;</span> <span style="color:#800080;">0</span><span style="color: #008000;">&#41;</span>
		ERR_AND_EXIT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;semget&quot;</span><span style="color: #008000;">&#41;</span>;
	<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>semctl<span style="color: #008000;">&#40;</span>semid, smoker, GETVAL, <span style="color:#800080;">0</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">&lt;</span> <span style="color:#800080;">0</span><span style="color: #008000;">&#41;</span>
		ERR_AND_EXIT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;semctl&quot;</span><span style="color: #008000;">&#41;</span>;
&nbsp;
	<span style="color: #ff0000; font-style: italic;">/*
	 * The procedures are shown in below:
	 * 1. P(Smoker_i)
	 * 2. Get Ingredients, Roll and Smoke
	 * 3. V(Agent)
	 * 4. Go to 1 and repeat
	 */</span>
	<span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #008000;">&#41;</span>
	<span style="color: #008000;">&#123;</span>
		<span style="color: #ff0000; font-style: italic;">/* Wait for the Agent*/</span>
		<span style="color: #0000dd;">fprintf</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">stdout</span>, <span style="color: #FF0000;">&quot;%s: I'm waiting for the agent.<span style="color: #666666; font-weight: bold;">\n</span>&quot;</span>, ingredient<span style="color: #008000;">&#91;</span>smoker<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>;
		sleep<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">5</span><span style="color: #008000;">&#41;</span>;
&nbsp;
		<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>P<span style="color: #008000;">&#40;</span>semid, smoker<span style="color: #008000;">&#41;</span> <span style="color: #000080;">&lt;</span> <span style="color:#800080;">0</span><span style="color: #008000;">&#41;</span> ERR_AND_EXIT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;P failed&quot;</span><span style="color: #008000;">&#41;</span>;
&nbsp;
		<span style="color: #ff0000; font-style: italic;">/* Roll and smoke */</span>
		<span style="color: #0000dd;">fprintf</span><span style="color: #008000;">&#40;</span><span style="color: #0000ff;">stdout</span>, <span style="color: #FF0000;">&quot;%s: I get the ingredients, I'm rolling and smoking now.<span style="color: #666666; font-weight: bold;">\n</span>&quot;</span>, 
				ingredient<span style="color: #008000;">&#91;</span>smoker<span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>;
		sleep<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">5</span><span style="color: #008000;">&#41;</span>;
&nbsp;
		<span style="color: #ff0000; font-style: italic;">/* Wake up Agent */</span>
		<span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>V<span style="color: #008000;">&#40;</span>semid, <span style="color: #0000dd;">3</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">&lt;</span> <span style="color:#800080;">0</span><span style="color: #008000;">&#41;</span> ERR_AND_EXIT<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;V failed&quot;</span><span style="color: #008000;">&#41;</span>;
	<span style="color: #008000;">&#125;</span>
&nbsp;
	<span style="color: #0000ff;">return</span> <span style="color:#800080;">0</span>;
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>顺便附一段用Java多线程实现的抽烟者问题解决代码，用Semaphore这个类实现的。</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
</pre></td><td class="code"><pre class="java java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.Random</span>;
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">java.util.concurrent.Semaphore</span>;
&nbsp;
<span style="color: #008000; font-style: italic; font-weight: bold;">/**
 * @author caspar
 *
 */</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> AgentSmokerProblem 
<span style="color: #009900;">&#123;</span>
	<span style="color: #666666; font-style: italic;">/* Create 4 semaphores, the first is for agent and the rest are for smokers */</span>
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> Semaphore sem_agent;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> Semaphore<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> sem_smoker <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Semaphore<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span>;
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> 
	<span style="color: #009900;">&#123;</span>
		<span style="color: #666666; font-style: italic;">/* Initialize the semaphores to 0 */</span>
		sem_agent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Semaphore<span style="color: #009900;">&#40;</span>0<span style="color: #009900;">&#41;</span>;
		sem_smoker<span style="color: #009900;">&#91;</span>0<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Semaphore<span style="color: #009900;">&#40;</span>0<span style="color: #009900;">&#41;</span>;
		sem_smoker<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Semaphore<span style="color: #009900;">&#40;</span>0<span style="color: #009900;">&#41;</span>;
		sem_smoker<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Semaphore<span style="color: #009900;">&#40;</span>0<span style="color: #009900;">&#41;</span>;
&nbsp;
		<span style="color: #666666; font-style: italic;">/* Create agent and smokers */</span>
		Agent agent <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Agent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		Smoker<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> smoker <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Smoker<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span>;
		smoker<span style="color: #009900;">&#91;</span>0<span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Smoker<span style="color: #009900;">&#40;</span>0<span style="color: #009900;">&#41;</span>;
		smoker<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Smoker<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>;
		smoker<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> Smoker<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span>;
&nbsp;
		<span style="color: #666666; font-style: italic;">/* Start the threads */</span>
		agent.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		smoker<span style="color: #009900;">&#91;</span>0<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		smoker<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
		smoker<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span>.<span style="color: #006633;">start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Agent <span style="color: #000000; font-weight: bold;">extends</span> <span style="color: #003399;">Thread</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">public</span> Agent<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Agent&quot;</span><span style="color: #009900;">&#41;</span>;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> run<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> smoker_type <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;tobacco&quot;</span>, <span style="color: #0000ff;">&quot;paper&quot;</span>, <span style="color: #0000ff;">&quot;matches&quot;</span><span style="color: #009900;">&#125;</span>;
		<span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> ingre_type <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;paper and matches&quot;</span>,	<span style="color: #0000ff;">&quot;matches and tobacco&quot;</span>, <span style="color: #0000ff;">&quot;tobacco and paper&quot;</span><span style="color: #009900;">&#125;</span>;
&nbsp;
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Agent is ready...&quot;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
		<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>			
			<span style="color: #666666; font-style: italic;">/* Agent running, offering ingredients */</span>
			<span style="color: #000066; font-weight: bold;">int</span> smoker_num <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Random</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">nextInt</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Agent: I offer &quot;</span> <span style="color: #339933;">+</span> ingre_type<span style="color: #009900;">&#91;</span>smoker_num<span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> 
					<span style="color: #0000ff;">&quot;, now waiting for the smoker who has &quot;</span> <span style="color: #339933;">+</span> smoker_type<span style="color: #009900;">&#91;</span>smoker_num<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span>;			
			<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
				sleep<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2000</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InterruptedException</span> e1<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				e1.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">/* Call the corresponding smoker */</span>
			AgentSmokerProblem.<span style="color: #006633;">sem_smoker</span><span style="color: #009900;">&#91;</span>smoker_num<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">release</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
			<span style="color: #666666; font-style: italic;">/* Wait for the smoker */</span>
			<span style="color: #000000; font-weight: bold;">try</span>	<span style="color: #009900;">&#123;</span>
				AgentSmokerProblem.<span style="color: #006633;">sem_agent</span>.<span style="color: #006633;">acquire</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Exception</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">class</span> Smoker <span style="color: #000000; font-weight: bold;">extends</span> <span style="color: #003399;">Thread</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000066; font-weight: bold;">int</span> smoker_num;
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> Smoker<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> smoker_num<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">super</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Smoker &quot;</span> <span style="color: #339933;">+</span> smoker_num<span style="color: #009900;">&#41;</span>;
		<span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">smoker_num</span> <span style="color: #339933;">=</span> smoker_num;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> run<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> smoker_type <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;tobacco&quot;</span>, <span style="color: #0000ff;">&quot;paper&quot;</span>, <span style="color: #0000ff;">&quot;matches&quot;</span><span style="color: #009900;">&#125;</span>;
		<span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> ingre_type <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span><span style="color: #0000ff;">&quot;paper and matches&quot;</span>,	<span style="color: #0000ff;">&quot;matches and tobacco&quot;</span>, <span style="color: #0000ff;">&quot;tobacco and paper&quot;</span><span style="color: #009900;">&#125;</span>;
&nbsp;
		<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;The smoker has &quot;</span> <span style="color: #339933;">+</span> smoker_type<span style="color: #009900;">&#91;</span>smoker_num<span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot; is ready...&quot;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
		<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
			<span style="color: #666666; font-style: italic;">/* Smoker is waiting for the Agent*/</span>
			<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
				AgentSmokerProblem.<span style="color: #006633;">sem_smoker</span><span style="color: #009900;">&#91;</span>smoker_num<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">acquire</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InterruptedException</span> e1<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				e1.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">/* Smoker get ingredients, roll and smoke*/</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;The smoker has &quot;</span> <span style="color: #339933;">+</span> smoker_type<span style="color: #009900;">&#91;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">smoker_num</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;: I get the &quot;</span> <span style="color: #339933;">+</span> 
					ingre_type<span style="color: #009900;">&#91;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">smoker_num</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #0000ff;">&quot;, Let me roll a cigarette and smoke.&quot;</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
				sleep<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2000</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InterruptedException</span> e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				e.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">/* Call agent */</span>
			AgentSmokerProblem.<span style="color: #006633;">sem_agent</span>.<span style="color: #006633;">release</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
&nbsp;
			<span style="color: #666666; font-style: italic;">/* Smoker is waiting*/</span>
			<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;The smoker has &quot;</span> <span style="color: #339933;">+</span> smoker_type<span style="color: #009900;">&#91;</span><span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">smoker_num</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> 
					<span style="color: #0000ff;">&quot;: I finish smoking, now waiting for the agent.&quot;</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
				sleep<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2000</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">InterruptedException</span> e1<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				e1.<span style="color: #006633;">printStackTrace</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>;
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

</p>
	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/semaphore" title="semaphore" rel="tag">semaphore</a>, <a href="http://www.casparant.com/tag/c" title="C" rel="tag">C</a>, <a href="http://www.casparant.com/tag/smoker" title="smoker" rel="tag">smoker</a>, <a href="http://www.casparant.com/tag/operating-system" title="operating system" rel="tag">operating system</a>, <a href="http://www.casparant.com/tag/system-call" title="system call" rel="tag">system call</a>, <a href="http://www.casparant.com/tag/cigarette-smoker" title="cigarette smoker" rel="tag">cigarette smoker</a>, <a href="http://www.casparant.com/tag/java" title="java" rel="tag">java</a>, <a href="http://www.casparant.com/tag/syscall" title="syscall" rel="tag">syscall</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li><a href="http://www.casparant.com/java-tips.html" title="纯发泄，Java考点 (2008-06-10)">纯发泄，Java考点</a> (9)</li>
	<li><a href="http://www.casparant.com/cute-c-program.html" title="一个很好很强大的程序 (2008-01-13)">一个很好很强大的程序</a> (1)</li>
</ul>


<p><a href="http://feedads.googleadservices.com/~a/MhsLh7duvf9TdAl2CuGy-1gS_HI/a"><img src="http://feedads.googleadservices.com/~a/MhsLh7duvf9TdAl2CuGy-1gS_HI/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/using-c-system-call-to-solve-smoker-problem-under-linux.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>推荐！飞信手机3.0体验版</title>
		<link>http://www.casparant.com/recommend-fetion-3.html</link>
		<comments>http://www.casparant.com/recommend-fetion-3.html#comments</comments>
		<pubDate>Sun, 02 Nov 2008 14:34:44 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[Softwares]]></category>

		<category><![CDATA[3.0]]></category>

		<category><![CDATA[beta]]></category>

		<category><![CDATA[fetion]]></category>

		<category><![CDATA[飞信]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=190</guid>
		<description><![CDATA[经Summer大人告知，飞信手机版已经有3.0测试版了。我最关心的问题是3.0版本能否支持震动提醒，其原因是我在教室上课的时候开着飞信，关闭了声音提示，结果某慕老是说我不回短信，我不是没收到提醒么……
前往这里查看，果然有3.0的测试版了，查看了下我的N81在支持列表上，可惜下下来之后是N95的，不过装好后能正常使用。
体验了一把，感觉相当cool，类iPhone的界面(配在N95上确实会显得更合适)，进飞信界面之后不是像2.0版本一样直接出聊天窗口，而是有一个集成界面，包含了设置、聊天、电话簿管理、资讯、掌上营业厅等功能，不过对我来说这些功能都是偶尔用到而已，我更关心的是飞信聊天。
震动提示果然有了，而且可以和手机情景模式关联了。就凭这一点，我就毫不犹豫地换下了原来的2.0版本。
不过毕竟是测试版，刚用了半个小时，就发现了好多BUG，等下去社区提交吧，对这个版本还是非常期待的～～

	日志标签fetion, beta, 3.0, 飞信

	相关日志
	
	pi... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>经<a href="http://hsummer.com">Summer大人</a>告知，飞信手机版已经有3.0测试版了。我最关心的问题是3.0版本能否支持震动提醒，其原因是我在教室上课的时候开着飞信，关闭了声音提示，结果某慕老是说我不回短信，我不是没收到提醒么……</p>
<p>前往<a href="http://ue.fetion.com.cn/News.aspx?ID=10">这里</a>查看，果然有3.0的测试版了，查看了下我的N81在支持列表上，可惜下下来之后是N95的，不过装好后能正常使用。</p>
<p>体验了一把，感觉相当cool，类iPhone的界面(配在N95上确实会显得更合适)，进飞信界面之后不是像2.0版本一样直接出聊天窗口，而是有一个集成界面，包含了设置、聊天、电话簿管理、资讯、掌上营业厅等功能，不过对我来说这些功能都是偶尔用到而已，我更关心的是飞信聊天。</p>
<p>震动提示果然有了，而且可以和手机情景模式关联了。就凭这一点，我就毫不犹豫地换下了原来的2.0版本。</p>
<p>不过毕竟是测试版，刚用了半个小时，就发现了好多BUG，等下去社区提交吧，对这个版本还是非常期待的～～</p>
</p>
	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/beta" title="beta" rel="tag">beta</a>, <a href="http://www.casparant.com/tag/fetion" title="fetion" rel="tag">fetion</a>, <a href="http://www.casparant.com/tag/30" title="3.0" rel="tag">3.0</a>, <a href="http://www.casparant.com/tag/%e9%a3%9e%e4%bf%a1" title="飞信" rel="tag">飞信</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li><a href="http://www.casparant.com/something-about-pidgin.html" title="pidgin琐碎二三事 (2008-08-19)">pidgin琐碎二三事</a> (1)</li>
	<li><a href="http://www.casparant.com/some-softwares-under-linux.html" title="Linux下推荐的软件 (2008-12-21)">Linux下推荐的软件</a> (4)</li>
</ul>


<p><a href="http://feedads.googleadservices.com/~a/pHKLU_V4gntoT7pLiF3yg8T7j1s/a"><img src="http://feedads.googleadservices.com/~a/pHKLU_V4gntoT7pLiF3yg8T7j1s/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/recommend-fetion-3.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>(杂物间)我的Ubuntu 8.10配置</title>
		<link>http://www.casparant.com/my-ubuntu-intrepid-config.html</link>
		<comments>http://www.casparant.com/my-ubuntu-intrepid-config.html#comments</comments>
		<pubDate>Sat, 01 Nov 2008 15:25:22 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[Ubuntu Linux]]></category>

		<category><![CDATA[config]]></category>

		<category><![CDATA[intrepid]]></category>

		<category><![CDATA[ubuntu 8.10]]></category>

		<category><![CDATA[ubuntu intrepid]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=188</guid>
		<description><![CDATA[注：这篇文章不是写给屏幕前的你的，是我自己堆放杂物用的。
首先删除我不需要的软件：

sudo aptitude purge \
evolution evolution-common evolution-exchange evolution-plugins evolution-webcal \
tracker tracker-search-tool tracker-utils \
gnome-games ekiga gnome-orca f-spot xsane rhythmbox brasero \
totem totem-common totem-gstreamer totem-mozilla totem-plugins \
openoffice.org-base-core openoffice.org-gtk openoffice.org-impress openoffice.org-style-human \
openoffice.org-calc openoffice.org-help-en-gb openoffice.org-l10n-common \
openoffice.org-thesaurus-en-au openoffice.org-common openoffice.org-help-en-us \
openoffice.org-l10n-en-gb openoffice.org-thesaurus-en-us openoffice.org-core \
openoffice.org-help-zh-cn openoffice.org-l10n-en-za openoffice.org-writer openoffice.org-draw \
openoffice.org-help-zh-tw openoffice.org-l10n-zh-cn openoffice.org-emailmerge \
openoffice.org-hyphenation openoffice.org-l10n-zh-tw openoffice.org-gnome \
openoffice.org-hyphenation-en-us  openoffice.org-math

然后安装各种软件：

sudo apt-get install build-essential sun-java6-* ant vim-full [...... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>注：这篇文章不是写给屏幕前的你的，是我自己堆放杂物用的。</p>
<p>首先删除我不需要的软件：</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> purge \
evolution evolution-common evolution-exchange evolution-plugins evolution-webcal \
tracker tracker-search-tool tracker-utils \
gnome-games ekiga gnome-orca f-spot xsane rhythmbox brasero \
totem totem-common totem-gstreamer totem-mozilla totem-plugins \
openoffice.org-base-core openoffice.org-gtk openoffice.org-impress openoffice.org-style-human \
openoffice.org-calc openoffice.org-help-en-gb openoffice.org-l10n-common \
openoffice.org-thesaurus-en-au openoffice.org-common openoffice.org-help-en-us \
openoffice.org-l10n-en-gb openoffice.org-thesaurus-en-us openoffice.org-core \
openoffice.org-help-zh-cn openoffice.org-l10n-en-za openoffice.org-writer openoffice.org-draw \
openoffice.org-help-zh-tw openoffice.org-l10n-zh-cn openoffice.org-emailmerge \
openoffice.org-hyphenation openoffice.org-l10n-zh-tw openoffice.org-gnome \
openoffice.org-hyphenation-en-us  openoffice.org-math</pre></div></div>

<p><span id="more-188"></span>然后安装各种软件：</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential sun-java6-<span style="color: #000000; font-weight: bold;">*</span> ant vim-full subversion subversion-tools \
<span style="color: #c20cb9; font-weight: bold;">bison</span> <span style="color: #c20cb9; font-weight: bold;">flex</span> apache2 mysql-server php5-common php5-mysql phpmyadmin <span style="color: #c20cb9; font-weight: bold;">autoconf</span> <span style="color: #c20cb9; font-weight: bold;">automake</span> codeblocks \
libwxbase2.8-0 libwxgtk2.8-0 libwxbase2.8-dev libwxgtk2.8-dev \
texlive texlive-math-extra texlive-latex-base texlive-latex-extra \
texlive-latex-recommended texlive-pictures texlive-science texlive-bibtex-extra \
texlive-common latex-beamer latex-cjk-chinese ttf-arphic-<span style="color: #000000; font-weight: bold;">*</span> hbf-<span style="color: #000000; font-weight: bold;">*</span> \
openssh-server samba winbind cvsd telnetd libxine1-ffmpeg \
scim-bridge-client-qt compizconfig-settings-manager python-mutagen tilda \
gstreamer0.10-<span style="color: #000000; font-weight: bold;">*</span> smplayer mplayer-nogui mozilla-mplayer vlc mozilla-plugin-vlc \
audacious audacious-plugins audacious-plugins-extra amarok gftp qterm checkgmail \
rar unrar alien p7zip-full zhcon eva avant-window-navigator awn-manager</pre></div></div>

<blockquote><p>编程开发工具<br />
gcc+gdb：build-essential<br />
Java：sun-java6-* ant<br />
编辑器VIM：vim-full<br />
版本控制：subversion subversion-tools<br />
词法分析：Bison/Flex：bison flex<br />
LAMP：apache2 mysql-server php5-common php5-mysql phpmyadmin<br />
Autotools：autoconf automake<br />
IDE Codeblocks：codeblocks<br />
wxWidgets库：libwxbase2.8-0 libwxgtk2.8-0 libwxbase2.8-dev libwxgtk2.8-dev<br />
Latex：texlive texlive-math-extra texlive-latex-base texlive-latex-extra \<br />
texlive-latex-recommended texlive-pictures texlive-science texlive-bibtex-extra \<br />
texlive-common latex-beamer latex-cjk-chinese ttf-arphic-* hbf-*</p></blockquote>
<blockquote><p>服务<br />
SSH：openssh-server<br />
SAMBA：samba winbind<br />
CVS：cvsd<br />
Telnet：telnetd</p></blockquote>
<blockquote><p>实用软件<br />
SCIM-Bridge：scim-bridge-client-qt<br />
Compiz特效管理器CCSM：compizconfig-settings-manager<br />
DOCK栏awn：avant-window-navigator awn-manager<br />
音乐ID3v2标签转码Mutagen：python-mutagen<br />
嵌入式终端Tilda：tilda<br />
ZIP tools：rar unrar alien p7zip-full<br />
CHM Viewer：kchmviewer<br />
解码器gstreamer：gstreamer0.10-* libxine1-ffmpeg<br />
视频播放Mplayer/SMplayer：smplayer mplayer-nogui mozilla-mplayer<br />
视频播放器VLC：vlc mozilla-plugin-vlc<br />
音乐播放器Audacious：audacious audacious-plugins audacious-plugins-extra<br />
音乐管理器Amarok：amarok<br />
eva：eva<br />
gFTP：gftp<br />
Qterm：qterm<br />
CheckGmail：checkgmail<br />
zhcon：zhcon</p></blockquote>
<p>最后是各种编译三部曲时候需要用到的dev包或者不常用的软件包</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> xorg-dev libx11-dev python-dev \
libgtk2.0-dev python-gtk2-dev python-cairo-dev libglade2-dev libdbus-glib-<span style="color: #000000;">1</span>-dev \
libgnome-desktop-dev libgnome2-dev libgnomevfs2-dev libgconf2-dev libwnck-dev \
libqt3-headers libqt3-mt-dev kdelibs4-dev libvte-dev libconfuse-dev libsexy-dev \
libnotify-dev librsvg2-dev libgnome-menu-dev libgtop2-dev python-alsaaudio \
python-feedparser libpanel-applet2-dev libsigc++-<span style="color: #000000;">2.0</span>-dev libglibmm-<span style="color: #000000;">2.4</span>-dev \
libgtkmm-<span style="color: #000000;">2.4</span>-dev libgnomeuimm-<span style="color: #000000;">2.6</span>-dev libgnet-dev libgdome2-dev intltool \
python-gnome2-extras libgtkspell-dev libmeanwhile-dev network-manager-dev \
libperl-dev tcl-dev tk-dev libmad0-dev libavcodec-dev libavformat-dev libpostproc-dev \
liba52-dev libfribidi-dev libqt4-dev libqt4-sql-sqlite libsvn1 libtool pyqt4-dev-tools python-qt4 \
python-qt4-common pidgin-dev libpurple-dev doxygen graphviz libnspr4-dev libnss3-dev</pre></div></div>

<p>———————————— 预留分割线，用于Ubuntu 8.10体验 ————————————</p>
<p>1. Ubuntu 8.10 安装中文语言包后，默认安装了两个软件 PCMan X BBS Client和stardict，前者功能还比不上QTerm，除了表情功能比较方便之外；后者是我们不可或缺的软件，<del datetime="2008-11-15T05:37:31+00:00">默认安装了字典，很贴心的改进。</del>字典是在线获取的，要离线字典还得去那个死慢死慢的网页上去下</p>
<p>待续。</p>
</p>
	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/ubuntu-810" title="ubuntu 8.10" rel="tag">ubuntu 8.10</a>, <a href="http://www.casparant.com/tag/ubuntu-intrepid" title="ubuntu intrepid" rel="tag">ubuntu intrepid</a>, <a href="http://www.casparant.com/tag/ubuntu-linux" title="Ubuntu Linux" rel="tag">Ubuntu Linux</a>, <a href="http://www.casparant.com/tag/config" title="config" rel="tag">config</a>, <a href="http://www.casparant.com/tag/intrepid" title="intrepid" rel="tag">intrepid</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li><a href="http://www.casparant.com/ubuntu-hardy-config.html" title="Ubuntu 8.04 Config (2008-04-29)">Ubuntu 8.04 Config</a> (12)</li>
	<li><a href="http://www.casparant.com/pkg-config.html" title="我是菜鸟之pkg-config命令 (2008-07-19)">我是菜鸟之pkg-config命令</a> (3)</li>
	<li><a href="http://www.casparant.com/stop-trying-gentoo.html" title="咱先不折腾了 (2008-09-03)">咱先不折腾了</a> (16)</li>
	<li><a href="http://www.casparant.com/opera-font-config.html" title="[转]Ubuntu下Opera字体配置 (2008-02-21)">[转]Ubuntu下Opera字体配置</a> (2)</li>
	<li><a href="http://www.casparant.com/ubuntu-hardy-released.html" title="[白鼠五]Ubuntu 8.04发布 (2008-04-24)">[白鼠五]Ubuntu 8.04发布</a> (0)</li>
</ul>


<p><a href="http://feedads.googleadservices.com/~a/o3EeCiuj9kXaFihHsUntLVMfrD0/a"><img src="http://feedads.googleadservices.com/~a/o3EeCiuj9kXaFihHsUntLVMfrD0/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/my-ubuntu-intrepid-config.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Ubuntu配置补遗</title>
		<link>http://www.casparant.com/ubuntu-configuration-appendix.html</link>
		<comments>http://www.casparant.com/ubuntu-configuration-appendix.html#comments</comments>
		<pubDate>Fri, 31 Oct 2008 12:53:36 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[Ubuntu Linux]]></category>

		<category><![CDATA[configure]]></category>

		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=193</guid>
		<description><![CDATA[值此Ubuntu 8.10发布之际（终于发布了，再不发布那就得叫Ubuntu 8.11了），特作此文。本文只是作为一个Ubuntu入门教材参考，因为很多人说我写Ubuntu安装教程时很多地方写的很模糊，对于没有Linux基础的人来说无异于天书- -b 孩子们，满足你们的愿望吧…
本文基于如下对读者的假设：
1. Ubuntu Linux安装成功。如果迄今为止没有成功，请询问身边已经安装成功的人。我相信安装成功的人的数量，在学校抓一把至少其中含有一个。
2. 了解终端是什么，知道如何打开终端输入命令，了解命令语法。如果不知道如何打开终端输入命令，我也没办法……以下所有叙述，如果涉及命令操作，必然是在终端中进行操作。学过DOS的人应该对这一点在理解上没有难度，在Windows下用过cmd 运行ping命令检测网络的人在理解上应该也没有难度。关于命令的语法，比如sudo apt-get install OO_AND_XX这个命令，表示在使用root权限(sudo)的情况下使用软件包管理工具(apt-get)进行安装 (install)OO_AND_XX这个软件... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>值此Ubuntu 8.10发布之际（终于发布了，再不发布那就得叫Ubuntu 8.11了），特作此文。本文只是作为一个Ubuntu入门教材参考，因为很多人说我写Ubuntu安装教程时很多地方写的很模糊，对于没有Linux基础的人来说无异于天书- -b 孩子们，满足你们的愿望吧…</p>
<p>本文基于如下对读者的假设：</p>
<p>1. <a href="http://www.casparant.com/tag/ubuntu-linux" class="st_tag internal_tag" rel="tag" title="标签 Ubuntu Linux 下的日志">Ubuntu Linux</a>安装成功。如果迄今为止没有成功，请询问身边已经安装成功的人。我相信安装成功的人的数量，在学校抓一把至少其中含有一个。</p>
<p>2. 了解终端是什么，知道如何打开终端输入命令，了解命令语法。如果不知道如何打开终端输入命令，我也没办法……以下所有叙述，如果涉及命令操作，必然是在终端中进行操作。学过DOS的人应该对这一点在理解上没有难度，在Windows下用过cmd 运行ping命令检测网络的人在理解上应该也没有难度。关于命令的语法，比如sudo apt-get install OO_AND_XX这个命令，表示在使用root权限(sudo)的情况下使用软件包管理工具(apt-get)进行安装 (install)OO_AND_XX这个软件包的操作；同理sudo gedit /etc/apt/sources.list这个命令表示在使用root权限的情况下使用gedit这个文本编辑器打开/etc/apt/路径下的 sources.list这个文件进行编辑(真费劲- -b)</p>
<p><span id="more-193"></span>3.了解Linux下root权限的基本知识，为什么在2中的例子都要带上root而你见过的Redhat的教科书上就没有？因为上述命令是需要root权限的……</p>
<p>由于Ubuntu LiveCD不带开发工具的不良嗜好，在进行编程和开发之前，需要解决工具的安装问题。你所需要的工具都需要从网络上获取，因此你需要更新你的网络源。网络源是一个仓库，通过在/etc/apt/sources.list下的URL更新仓库中的软件包列表，然后通过apt-get或aptitude工具从列表上下载、安装、卸载所需的软件包。</p>
<p>在此提供一些比较好的教育网内的源列表：</p>
<blockquote><p># 北邮Openware源，北邮校内人士首选源。曾经我说过这个源比较不稳定，但是后来经过验证，还是挺稳定的，推荐<br />
deb ftp://openware.byr.edu.cn/pub/mirror/ubuntu/ intrepid main multiverse restricted universe<br />
deb ftp://openware.byr.edu.cn/pub/mirror/ubuntu/ intrepid-backports main multiverse restricted universe<br />
deb ftp://openware.byr.edu.cn/pub/mirror/ubuntu/ intrepid-proposed main multiverse restricted universe<br />
deb ftp://openware.byr.edu.cn/pub/mirror/ubuntu/ intrepid-security main multiverse restricted universe<br />
deb ftp://openware.byr.edu.cn/pub/mirror/ubuntu/ intrepid-updates main multiverse restricted universe</p></blockquote>
<blockquote><p># 台湾高性能计算中心(NCHC)源：<br />
deb http://free.nchc.org.tw/ubuntu/ intrepid main restricted multiverse universe<br />
deb http://free.nchc.org.tw/ubuntu/ intrepid-updates main restricted multiverse universe<br />
deb http://free.nchc.org.tw/ubuntu/ intrepid-security main restricted multiverse universe<br />
deb http://free.nchc.org.tw/ubuntu/ intrepid-proposed main restricted multiverse universe<br />
deb http://free.nchc.org.tw/ubuntu/ intrepid-backports main restricted multiverse universe</p></blockquote>
<blockquote><p># 台湾交大(NCTU)源：<br />
deb http://ubuntu.csie.nctu.edu.tw/ubuntu/ intrepid main multiverse restricted universe<br />
deb http://ubuntu.csie.nctu.edu.tw/ubuntu/ intrepid-backports main multiverse restricted universe<br />
deb http://ubuntu.csie.nctu.edu.tw/ubuntu/ intrepid-proposed main multiverse restricted universe<br />
deb http://ubuntu.csie.nctu.edu.tw/ubuntu/ intrepid-security main multiverse restricted universe<br />
deb http://ubuntu.csie.nctu.edu.tw/ubuntu/ intrepid-updates main multiverse restricted universe</p></blockquote>
<p>从上述三个中挑选一个源，覆盖到/etc/apt/sources.list下即可。覆盖方法：</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gedit <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list</pre></div></div>

<p>打开后挑选一个源，复制到文件中，覆盖原内容，保存退出。其中要注意的一点是，如果你的Ubuntu版本是8.04，那么保持源列表中的"hardy"不变，如果你的是Ubuntu 8.04，请将所有的"intrepid"改成"hardy"，如果是7.10，那么改成"gutsy"。</p>
<p>安装完毕之后，请执行下列命令更新软件列表(仅仅是软件列表，还没有更新系统和下载软件)：</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> update</pre></div></div>

<p>更新完毕之后，如果你的网速太慢，就不要执行更新操作了，凑合着用吧，如果速度还行，可以执行下列命令更新系统：</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> dist-upgrade</pre></div></div>

<p>更新或者没有更新完系统之后，可以选择安装中文输入法和中文语言包支持。这一步我一般是在图形界面下完成的：到系统(System)->系统管理(Administration)->语言支持(Language Support)中，勾选汉语(Chinese)选项，自动下载中文语言包和SCIM的拼音支持。</p>
<p>准备工作结束，可以开始安装编译器gcc了。</p>
<p>如果你只是运行sudo apt-get install gcc，那么当你写完一个c程序之后运行gcc test.c会提示你找不到头文件。那是因为你没有装libc-dev这个包。包含lib开头和dev结尾的软件包在Ubuntu下很流行，它表示这是一个开发库(developing library)，其中包含了C语言标准头文件和库。在Ubuntu下另外有一个软件包集合了这些常用的C/C++开发工具，它的名字叫build- essential。所以你可以只运行下列命令就可以完成gcc的配置：</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential</pre></div></div>

<p>gcc是一个强大的工具，目前我只是使用它来编译C、C++和ASM，关于gcc的更多使用方法，可以使用下列两个方法：</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">man</span> <span style="color: #c20cb9; font-weight: bold;">gcc</span></pre></div></div>

<p>http://gcc.gnu.org/onlinedocs/</p>
<p>至于man命令的作用，请运行man man-_-|||</p>
<p>接下去可以按相同的方法安装gdb，只需要一条命令：</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">gdb</span></pre></div></div>

<p>然后谈谈vi。现在大家使用的vi基本上都是vim，可以使用方向键来控制移动，而Ubuntu自带的vi由于习惯问题让人很不适应，所以你应该安装vim-full这个软件，它包含了vim和gvim，后者是一个GUI化的vim编辑器：</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> vim-full</pre></div></div>

<p>刚离开VS或者VC的你，可能不适应Linux下的编程环境。然而适应VI的操作是一个必须的技能，传说Linux程序员有三种，使用VI进行开发的，使用EMACS开发的，和使用其他进行开发的。如果你有兴趣了解emacs，可以运行下列命令：</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> emacs21</pre></div></div>

<p>vi和emacs的使用，请访问下列站点：</p>
<p>http://vimdoc.sourceforge.net/htmldoc/usr_toc.html</p>
<p>http://www.gnu.org/software/emacs/manual/</p>
<p>至此，vi+gcc+gdb的开发环境基本上搭建完毕，进行操作系统课上的基础编程作业应该绰绰有余了。</p>
</p>
	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/programming" title="Programming" rel="tag">Programming</a>, <a href="http://www.casparant.com/tag/configure" title="configure" rel="tag">configure</a>, <a href="http://www.casparant.com/tag/ubuntu-linux" title="Ubuntu Linux" rel="tag">Ubuntu Linux</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li><a href="http://www.casparant.com/stop-trying-gentoo.html" title="咱先不折腾了 (2008-09-03)">咱先不折腾了</a> (16)</li>
	<li><a href="http://www.casparant.com/ubuntu-hardy-released.html" title="[白鼠五]Ubuntu 8.04发布 (2008-04-24)">[白鼠五]Ubuntu 8.04发布</a> (0)</li>
	<li><a href="http://www.casparant.com/wine-in-ubuntu.html" title="Wine在Ubuntu下的优异表现 (2008-01-26)">Wine在Ubuntu下的优异表现</a> (9)</li>
	<li><a href="http://www.casparant.com/ubuntu-hardy-config.html" title="Ubuntu 8.04 Config (2008-04-29)">Ubuntu 8.04 Config</a> (12)</li>
	<li><a href="http://www.casparant.com/gcc-4-3-1-bootstrap-succeeded-under-opensolaris.html" title="OpenSolaris编译安装gcc4.3.1成功 (2008-08-13)">OpenSolaris编译安装gcc4.3.1成功</a> (0)</li>
</ul>


<p><a href="http://feedads.googleadservices.com/~a/Q54i_Ltu0kaQCadPYmU4CavJuRo/a"><img src="http://feedads.googleadservices.com/~a/Q54i_Ltu0kaQCadPYmU4CavJuRo/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/ubuntu-configuration-appendix.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>[转]支付宝针Firefox 的安全控件 for Linux</title>
		<link>http://www.casparant.com/alipay-for-linux.html</link>
		<comments>http://www.casparant.com/alipay-for-linux.html#comments</comments>
		<pubDate>Thu, 23 Oct 2008 11:55:05 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[Copid Entries]]></category>

		<category><![CDATA[alipay]]></category>

		<category><![CDATA[firefox]]></category>

		<category><![CDATA[released]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=185</guid>
		<description><![CDATA[在支付宝的官方Blog上，已经可以使用了。打开alipay的页面终于可以登录了，只是登录后要付款，发现招行还是不行，支付宝里面没钱也是白搭啊……
下载地址在这里：http://blog.alipay.com/
下面是官方消息的转载，暂时不支持数字签名。不管怎么说，还是值得期待的。


作者：西毒 与 支付宝产品技术部安全研发组
自从上次支付宝在官方网志上宣布将支持 Firefox 浏览器后，已经有很多用户询问什么时候能够支持 Linux 平台下的 Firefox ，现在是可以做出回答的时候了：尽管该安全控件(针对 Linux 下 Firefox 的安全控件)还没有正式在官方网站上发布，本 Blog 用户可以提前体验啦。
      下载: 支付宝安全控件 for Linux 平台 的 Firefox ( MD5:02240053d32688ed996e3a4788042801 ) 
使用方法：下载上述链接的文件，解压缩成两个文件:
$ tar -zxvf aliedit.tar.gz 
推荐校验 MD5 值：
$ md5sum aliedit.tar.gz
02240053d32688ed996e3a4788042801  aliedit.tar.gz
并将这两个文件复制到 ~/.mozilla/plugins 目录：
$ cp aliedit.so aliedit.xpt ... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>在支付宝的官方Blog上，已经可以使用了。打开alipay的页面终于可以登录了，只是登录后要付款，发现招行还是不行，支付宝里面没钱也是白搭啊……</p>
<p>下载地址在这里：<a href="http://blog.alipay.com/">http://blog.alipay.com/</a></p>
<p>下面是官方消息的转载，暂时不支持数字签名。不管怎么说，还是值得期待的。</p>
<p><span id="more-185"></span><br />
<blockquote>
<p>作者：西毒 与 支付宝产品技术部安全研发组</p>
<p>自从上次支付宝在官方网志上宣布将支持 Firefox 浏览器后，已经有很多用户询问什么时候能够支持 Linux 平台下的 Firefox ，现在是可以做出回答的时候了：尽管该安全控件(针对 Linux 下 Firefox 的安全控件)还没有正式在官方网站上发布，本 Blog 用户可以提前体验啦。</p>
<p>      下载: <a href="http://blog.alipay.com/wp-content/2008/10/aliedit.tar.gz">支付宝安全控件 for Linux 平台 的 Firefox</a> ( MD5:02240053d32688ed996e3a4788042801 ) </p>
<p>使用方法：下载上述链接的文件，解压缩成两个文件:</p>
<p>$ tar -zxvf aliedit.tar.gz </p>
<p>推荐校验 MD5 值：</p>
<p>$ md5sum aliedit.tar.gz<br />
02240053d32688ed996e3a4788042801  aliedit.tar.gz</p>
<p>并将这两个文件复制到 ~/.mozilla/plugins 目录：</p>
<p>$ cp aliedit.so aliedit.xpt ~/.mozilla/plugins </p>
<p>重新启动 Firefox 即可。</p>
<p>安全提示：下载前请做一下 MD5 校验。同时在官方站点发布正式的针对 Linux 下 Firefox 的安全控件之前，不要相信任何来自其他网站的安全控件。</p>
<p>补充说明：目前在 Linux 下的支付宝安全控件也不支持数字证书。</p>
<p>如遇到任何问题，请在本贴留言。如遇到 Bug 或者其他软件缺陷也请即时联系我们，支付志的运营团队将为您准备一份相应的礼品。</p>
<p>–EOF–
</p></blockquote>
</p>
	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/released" title="released" rel="tag">released</a>, <a href="http://www.casparant.com/tag/alipay" title="alipay" rel="tag">alipay</a>, <a href="http://www.casparant.com/tag/firefox" title="firefox" rel="tag">firefox</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li><a href="http://www.casparant.com/ubuntu-hardy-released.html" title="[白鼠五]Ubuntu 8.04发布 (2008-04-24)">[白鼠五]Ubuntu 8.04发布</a> (0)</li>
	<li><a href="http://www.casparant.com/grnotify-100-rc1-released.html" title="[推荐]grnotify-1.0.0-RC1 released (2008-05-13)">[推荐]grnotify-1.0.0-RC1 released</a> (0)</li>
	<li><a href="http://www.casparant.com/wordpress-26released.html" title="Wordpress 2.6 发布 (2008-07-16)">Wordpress 2.6 发布</a> (1)</li>
	<li><a href="http://www.casparant.com/wine-10-released.html" title="Wine 1.0 Released (2008-06-18)">Wine 1.0 Released</a> (0)</li>
	<li><a href="http://www.casparant.com/qq-for-linux-by-tencent.html" title="QQ for Linux 官方版发布 (2008-07-31)">QQ for Linux 官方版发布</a> (9)</li>
</ul>


<p><a href="http://feedads.googleadservices.com/~a/gXv05c8UbsaXCdd8d59s0O6u92o/a"><img src="http://feedads.googleadservices.com/~a/gXv05c8UbsaXCdd8d59s0O6u92o/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/alipay-for-linux.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>Ubuntu 8.04 mod_python Config</title>
		<link>http://www.casparant.com/modpython-configuration-under-ubuntu-804.html</link>
		<comments>http://www.casparant.com/modpython-configuration-under-ubuntu-804.html#comments</comments>
		<pubDate>Sun, 19 Oct 2008 05:22:27 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[Ubuntu Linux]]></category>

		<category><![CDATA[Web Tech]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[mod_python]]></category>

		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=183</guid>
		<description><![CDATA[第一步，安装mod_python

sudo apt-get install libapache2-mod-python

第二步，将mod_python模块加入到启用列表中

sudo ln -s /etc/apache2/mods-available/mod_python.load /etc/apache2/mods-enabled/

注：在Ubuntu 8.10中，对应的模块配置文件名已经改成了python.load，后文中提到的也应相应改成python.conf
第三步，配置mod_python
先在/etc/apache2/mods-available/下新建一个文件mod_python.conf

sudo vi /etc/apache2/mods-available/mod_python.conf

加入如下内容：

1
2
3
4
5
&#60;Directory /var/www&#62;
    AddHandler mod_python .py
    PythonHandler test
    PythonDebug On
&#60;/Directory&#62;

然后同样加入启用列表：

sudo ln -s /etc/apache2/mods-available/mod_python.conf /etc/apache2/mods-enabled/

第四步，重启apache服务器

sudo /etc/init.d/apache2 restart

第五步，测试
在/var/www下新建一个文件，test.py，输入内容为：

1
2
def index&#40;req&#41;:
    return &#34;Test Successfully&#34;;

在浏览器输入http://localhost/test.py

	日志标签python, mod_python, apache

	相关日志
	
	Python Web操作MySQL乱码问题的解决 (5)

... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>第一步，安装mod_python</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libapache2-mod-python</pre></div></div>

<p>第二步，将mod_python模块加入到启用列表中</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>mods-available<span style="color: #000000; font-weight: bold;">/</span>mod_python.load <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>mods-enabled<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p><strong>注：在Ubuntu 8.10中，对应的模块配置文件名已经改成了python.load，后文中提到的也应相应改成python.conf</strong></p>
<p>第三步，配置mod_python</p>
<p>先在<code>/etc/apache2/mods-available/</code>下新建一个文件<code>mod_python.conf</code></p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>mods-available<span style="color: #000000; font-weight: bold;">/</span>mod_python.conf</pre></div></div>

<p>加入如下内容：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="xml xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;Directory</span> /var/www<span style="color: #000000; font-weight: bold;">&gt;</span></span>
    AddHandler mod_python .py
    PythonHandler test
    PythonDebug On
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/Directory<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p><span id="more-183"></span>然后同样加入启用列表：</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>mods-available<span style="color: #000000; font-weight: bold;">/</span>mod_python.conf <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>mods-enabled<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>第四步，重启apache服务器</p>

<div class="wp_syntax"><div class="code"><pre class="bash bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p>第五步，测试</p>
<p>在<code>/var/www</code>下新建一个文件，test.py，输入内容为：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="python python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">def</span> index<span style="color: black;">&#40;</span>req<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #483d8b;">&quot;Test Successfully&quot;</span>;</pre></td></tr></table></div>

<p>在浏览器输入<code>http://localhost/test.py</code></p>
</p>
	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/python" title="python" rel="tag">python</a>, <a href="http://www.casparant.com/tag/mod_python" title="mod_python" rel="tag">mod_python</a>, <a href="http://www.casparant.com/tag/apache" title="apache" rel="tag">apache</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li><a href="http://www.casparant.com/char-confusion-in-mysql-under-python-web.html" title="Python Web操作MySQL乱码问题的解决 (2008-11-16)">Python Web操作MySQL乱码问题的解决</a> (5)</li>
</ul>


<p><a href="http://feedads.googleadservices.com/~a/9MUVLSsmu8ST26Ad6KuEYPwnEYg/a"><img src="http://feedads.googleadservices.com/~a/9MUVLSsmu8ST26Ad6KuEYPwnEYg/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/modpython-configuration-under-ubuntu-804.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>推荐：永中集成Office2009个人版发布</title>
		<link>http://www.casparant.com/recommend-using-eioffice-2009-personal.html</link>
		<comments>http://www.casparant.com/recommend-using-eioffice-2009-personal.html#comments</comments>
		<pubDate>Fri, 17 Oct 2008 07:41:07 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[New Releases]]></category>

		<category><![CDATA[eio]]></category>

		<category><![CDATA[office]]></category>

		<category><![CDATA[personal]]></category>

		<category><![CDATA[永中]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=178</guid>
		<description><![CDATA[这几天太忙，好久没有更新了。今天上来推荐一个软件：几天前，永中推出了它的Office2009版本，永中的Office一直都支持Linux平台，这次的亮点是永中有了免费的版本：集成Office个人版。
永中Office的排版和WORD比较相近，这下交老师的实验报告就不用跑虚拟机下开Windows了。永中Office还支持M$ Office 2007格式，也支持UOF格式（虽然现在我还用不到）。永中Office的导出PDF功能还包含了自动书签功能，这一点比OOo好。不过OOo3.0发布了，我还没去下载，不知道使用效果如何。
顺便提示一个小技巧，因为永中Office用的永中宋体是直接放到了/usr/share/fonts/zh_CN/TrueType下，这个字体会直接影响系统中的字体，比如我的Qterm，为了恢复系统字体的原状，我尝试修改字体配置文件未果，最后发现永中Office字体除了上面的路径，还需要查找自带的JRE的路径，因此将字体文件移动到/opt/Evermore/EIOffice/Jre/lib/fonts/下即可，这样永中Office可以用宋体字体，系统字体也不会受到影响(话说宋体在Linux... ]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.casparant.com/wp-content/uploads/2008/10/logo_eio.gif"><img src="http://www.casparant.com/wp-content/uploads/2008/10/logo_eio.gif" alt="" title="logo_eio" width="190" height="42" class="alignleft size-medium wp-image-180" /></a>这几天太忙，好久没有更新了。今天上来推荐一个软件：几天前，永中推出了它的Office2009版本，永中的Office一直都支持Linux平台，这次的亮点是永中有了免费的版本：<a href="http://www.evermoresw.com/webch/download/downEIOPersonal.jsp">集成Office个人版</a>。</p>
<p>永中Office的排版和WORD比较相近，这下交老师的实验报告就不用跑虚拟机下开Windows了。永中Office还支持M$ Office 2007格式，也支持UOF格式（虽然现在我还用不到）。永中Office的导出PDF功能还包含了自动书签功能，这一点比OOo好。不过OOo3.0发布了，我还没去下载，不知道使用效果如何。</p>
<p>顺便提示一个小技巧，因为永中Office用的永中宋体是直接放到了/usr/share/fonts/zh_CN/TrueType下，这个字体会直接影响系统中的字体，比如我的Qterm，为了恢复系统字体的原状，我尝试修改字体配置文件未果，最后发现永中Office字体除了上面的路径，还需要查找自带的JRE的路径，因此将字体文件移动到/opt/Evermore/EIOffice/Jre/lib/fonts/下即可，这样永中Office可以用宋体字体，系统字体也不会受到影响(话说宋体在Linux下显示的效果灰常难看……)。</p>
<p>最后上个截图：</p>
<p><span id="more-178"></span><a href="http://www.casparant.com/wp-content/uploads/2008/10/eio.png"><img src="http://www.casparant.com/wp-content/uploads/2008/10/eio-600x375.png" alt="" title="eio" width="600" height="375" class="aligncenter size-medium wp-image-181" /></a></p>

	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/release" title="New Releases" rel="tag">New Releases</a>, <a href="http://www.casparant.com/tag/office" title="office" rel="tag">office</a>, <a href="http://www.casparant.com/tag/eio" title="eio" rel="tag">eio</a>, <a href="http://www.casparant.com/tag/%e6%b0%b8%e4%b8%ad" title="永中" rel="tag">永中</a>, <a href="http://www.casparant.com/tag/personal" title="personal" rel="tag">personal</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li><a href="http://www.casparant.com/ms-office-2003-under-wine.html" title="Wine M$ Office 2003 成功 (2008-06-28)">Wine M$ Office 2003 成功</a> (2)</li>
</ul>


<p><a href="http://feedads.googleadservices.com/~a/65JMzRtFZRMGUFPSIQ0uq4ArHk4/a"><img src="http://feedads.googleadservices.com/~a/65JMzRtFZRMGUFPSIQ0uq4ArHk4/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/recommend-using-eioffice-2009-personal.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>浮躁与习惯</title>
		<link>http://www.casparant.com/flippancy-and-habit.html</link>
		<comments>http://www.casparant.com/flippancy-and-habit.html#comments</comments>
		<pubDate>Sun, 28 Sep 2008 07:17:29 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[*Nix Life]]></category>

		<category><![CDATA[Linux]]></category>

		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=176</guid>
		<description><![CDATA[在开始之前，请你想几个问题：

当你学Windows的时候，你花了多长时间？几小时？几天？几个月？还是现在仍旧有各种各样解决不了的问题？
当你在War3上为了手速记键盘操作快捷键的时候，你是否觉得记几个长度不超过10个字母的命令比这困难很多？
当你在Windows下碰到问题的时候，你是抱怨Windows这个系统太不人性化还是老老实实虚心向别人请教问题？

当你仔细考虑了这些问题之后，再往下看。
也许你接触计算机很早，但是在你面前的界面很有可能是带着窗口的系统——有可能是Windows 3.1，也有可能是Windows95。还记得你拿着鼠标努力记住左右键的作用的那一刻么，还记得你背诵104键盘的每个按键的名称的那一段时光么？当然一段时间之后，你解决了基本设备的问题，你开始使用你面前的这个带着窗口的系统。你开始经历蓝屏、死机、鼠标无响应，当你步入新千年，网络开始大面积普及的时候，你开始经历病毒、流氓软件。也许你右手边的鼠标已经被你摔坏... ]]></description>
			<content:encoded><![CDATA[<p class='fp'>在开始之前，请你想几个问题：</p>
<ul>
<li>当你学Windows的时候，你花了多长时间？几小时？几天？几个月？还是现在仍旧有各种各样解决不了的问题？</li>
<li>当你在War3上为了手速记键盘操作快捷键的时候，你是否觉得记几个长度不超过10个字母的命令比这困难很多？</li>
<li>当你在Windows下碰到问题的时候，你是抱怨Windows这个系统太不人性化还是老老实实虚心向别人请教问题？</li>
</ul>
<p>当你仔细考虑了这些问题之后，再往下看。</p>
<p>也许你接触计算机很早，但是在你面前的界面很有可能是带着窗口的系统——有可能是Windows 3.1，也有可能是Windows95。还记得你拿着鼠标努力记住左右键的作用的那一刻么，还记得你背诵104键盘的每个按键的名称的那一段时光么？当然一段时间之后，你解决了基本设备的问题，你开始使用你面前的这个带着窗口的系统。你开始经历蓝屏、死机、鼠标无响应，当你步入新千年，网络开始大面积普及的时候，你开始经历病毒、流氓软件。也许你右手边的鼠标已经被你摔坏过好几次。但是我问你，你有抱怨过Windows XXX系统怎么这么糟糕，一点也不人性化，不方便“非专业人士”使用之类的话么？</p>
<p>好吧，在Windows的熏陶下，你度过了你的青少年时代，你是一个有理想有道德有文化有纪律的大学生，你现在每天学习偶尔还打游戏，你自己很忙。你不再有时间呆坐在电脑面前，你不再有热情像以前探究Windows一样来学习一个新的操作系统。你用了几天之后，你碰到了你最初学Windows一样的问题——也许你当初连C盘D盘是什么东东都不知道——你开始抱怨为什么Linux与你的习惯差距那么大。</p>
<p><span id="more-176"></span>习惯，这是Linux Beginner容易抱怨这个操作系统的一个原因。你会问，Linux为什么不能符合我使用的Windows的使用习惯？当你被一个垄断的操作系统同化了10年之后，因为习惯，你开始抵触另一个伟大的操作系统。</p>
<p>人都是这样。</p>
<p>我初二的时候，不知道程序到底是什么东西，我只知道我面前的代码最后的那一行RUN之后可以出现一个游戏。于是我断断续续在那段代码上调试了几个月。凭的只是一种热情。</p>
<p>现在我的大二已经过去，我看着眼前的代码，开始感到思维枯竭，别说调试了，运行一下就失去了兴趣。</p>
<p>这是一个充满浮躁的年纪。这是作为Linux初学者容易抱怨的另一个原因。当你在Linux论坛上抱怨Linux的问题这么多，请你出门左拐，看看Windows论坛上的问题，是不是很少？不见得。请不要在没有试图解决过问题的时候，断然认为这个系统是一个糟糕的系统。你可以认为它不适合现在的你使用，Linux is for people who REALLY wants to know it.</p>
</p>
	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/linux" title="Linux" rel="tag">Linux</a>, <a href="http://www.casparant.com/tag/windows" title="windows" rel="tag">windows</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li><a href="http://www.casparant.com/funny-real-desktop.html" title="好玩的Real Desktop (2008-06-25)">好玩的Real Desktop</a> (6)</li>
	<li><a href="http://www.casparant.com/gentoo-or-ubuntu.html" title="Gentoo还是Ubuntu? (2008-08-18)">Gentoo还是Ubuntu?</a> (8)</li>
</ul>


<p><a href="http://feedads.googleadservices.com/~a/KUbBVoaOPToMHdtuwkwuBNPraH8/a"><img src="http://feedads.googleadservices.com/~a/KUbBVoaOPToMHdtuwkwuBNPraH8/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/flippancy-and-habit.html/feed</wfw:commentRss>
		</item>
		<item>
		<title>跟风Chrome</title>
		<link>http://www.casparant.com/using-chrome-under-windows.html</link>
		<comments>http://www.casparant.com/using-chrome-under-windows.html#comments</comments>
		<pubDate>Mon, 22 Sep 2008 13:44:08 +0000</pubDate>
		<dc:creator>Ant</dc:creator>
		
		<category><![CDATA[Web Tech]]></category>

		<category><![CDATA[chrome]]></category>

		<category><![CDATA[google]]></category>

		<category><![CDATA[strokeit]]></category>

		<guid isPermaLink="false">http://www.casparant.com/?p=174</guid>
		<description><![CDATA[看来Google推出for Linux的Chrome还有待时日，那我就在实验室的XP上用用win下的版本好了。那天在三联生活周刊上都看到了Chrome的文章，看来Google推出的东西当真是能引起水波荡漾啊。
其实Chrome出来的当天我就下载试用了，安装包只有那么一丁点大，还要进行在线安装。这就意味着某人叫我帮她下载一个Chrome给她离线安装的愿望不能实现了- -&#124;&#124;&#124;当时用了一会儿马上就卸掉了，原因是：没有鼠标手势……
后来在网上看到可以用软件代替的方法启用鼠标手势。就是使用strokeit这个软件。这个软件专门针对Chrome作了优化，我安装后使用起来和Firefox插件感觉没有什么两样，相当不错。所以Chrome从此就常驻我的系统了。
Google采用的是Webkit+V8，对于Web上的新技术我不了解，但是V8的前景据很多人说很好，这样看来Google有戏。
Google俨然成了一个品牌，据说推出下载没多久就下载记录破百万了~

	日志标签Web Tech, chrome, google, strokeit

	相关日志
	
	完成feedburner到Google帐户... ]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.casparant.com/wp-content/uploads/2008/09/chrome.png"><img src="http://www.casparant.com/wp-content/uploads/2008/09/chrome.png" alt="" title="chrome" width="145" height="52" class="alignleft size-medium wp-image-175" /></a>看来Google推出for Linux的Chrome还有待时日，那我就在实验室的XP上用用win下的版本好了。那天在三联生活周刊上都看到了Chrome的文章，看来Google推出的东西当真是能引起水波荡漾啊。</p>
<p>其实Chrome出来的当天我就下载试用了，安装包只有那么一丁点大，还要进行在线安装。这就意味着某人叫我帮她下载一个Chrome给她离线安装的愿望不能实现了- -|||当时用了一会儿马上就卸掉了，原因是：没有鼠标手势……</p>
<p>后来在网上看到可以用软件代替的方法启用鼠标手势。就是使用strokeit这个软件。这个软件专门针对Chrome作了优化，我安装后使用起来和Firefox插件感觉没有什么两样，相当不错。所以Chrome从此就常驻我的系统了。</p>
<p>Google采用的是Webkit+V8，对于Web上的新技术我不了解，但是V8的前景据很多人说很好，这样看来Google有戏。</p>
<p>Google俨然成了一个品牌，据说推出下载没多久就下载记录破百万了~</p>

	<h2>日志标签</h2><ul class="linkcat"><li><a href="http://www.casparant.com/tag/chrome" title="chrome" rel="tag">chrome</a>, <a href="http://www.casparant.com/tag/google" title="google" rel="tag">google</a>, <a href="http://www.casparant.com/tag/web" title="Web Tech" rel="tag">Web Tech</a>, <a href="http://www.casparant.com/tag/strokeit" title="strokeit" rel="tag">strokeit</a></li></ul>

	<h2>相关日志</h2>
	<ul class="st-related-posts">
	<li><a href="http://www.casparant.com/migrate-feedburner-account-to-google-succeeded.html" title="完成feedburner到Google帐户的迁移 (2008-09-05)">完成feedburner到Google帐户的迁移</a> (7)</li>
	<li><a href="http://www.casparant.com/i-finally-see-my-feedburner-page.html" title="原来这就是我在FeedBurner的界面呀 (2008-09-13)">原来这就是我在FeedBurner的界面呀</a> (13)</li>
</ul>


<p><a href="http://feedads.googleadservices.com/~a/yPvFaTC3joqRgzz9LC5Ljh9fAGQ/a"><img src="http://feedads.googleadservices.com/~a/yPvFaTC3joqRgzz9LC5Ljh9fAGQ/i" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.casparant.com/using-chrome-under-windows.html/feed</wfw:comme