<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.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:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" version="2.0">

<channel>
	<title>风云阁</title>
	
	<link>http://www.iron-feet.com</link>
	<description>笑骂由人，洒脱自如！心若冰清，天塌不惊！</description>
	<lastBuildDate>Thu, 23 Feb 2012 09:39:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ironfeet" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="ironfeet" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/3.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-nc-nd/3.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">ironfeet</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>Volunteering among IT Minggongs</title>
		<link>http://www.iron-feet.com/it/volunteering-among-it-minggongs/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=volunteering-among-it-minggongs</link>
		<comments>http://www.iron-feet.com/it/volunteering-among-it-minggongs/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 09:39:13 +0000</pubDate>
		<dc:creator>Iron_Feet</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[BOINC]]></category>
		<category><![CDATA[reCAPTCHA]]></category>
		<category><![CDATA[Volunteering]]></category>
		<category><![CDATA[WCG]]></category>

		<guid isPermaLink="false">http://www.iron-feet.com/?p=3528</guid>
		<description><![CDATA[前段时间在 Google Reader 上闲逛的时候，发现<a href="http://www.iplaysoft.com/" target="_blank">异次元の世界</a>推荐了一个很不错的东东——<a href="http://www.worldcommunitygrid.org/" target="_blank">World Community Grid</a>

去其主页看了一下，里面写道：


<blockquote>
我们是谁
World Community Grid 将全球各地愿意捐献出自己计算机闲置时间的人汇集在一起，以创造出造福全人类的最大的志愿者计算网格。作为工作的基础，我们坚信：技术创新、具有想象力的科学研究以及大量志愿者这三大因素相结合，可以使我们的地球更加智慧。我们的成功需要像您这样的个人共同将未使用的计算机时间贡献给这项无私的事业。

您如何提供帮助
如果您的计算机已打开，但处于空闲状态，那么请将计算机的计算能力贡献给有益于人类的项目！我们提供免费且安全的软件和系统，使您成为这个社区的一分子，为改变世界做出贡献。一旦安装了该软件，您就可以参与 World Community Grid。就是这样简单！只需单击下面的“立即加入”按钮。
</blockquote>

这正是我想要的东西。作为一个 IT 民工，我不能像 Bill Gates 等富翁投入巨额于公益慈善事业，但也不能因此而拒绝为有益于人类的事情做出点滴的贡献。我的站在很早之前就开始<a target="_blank" href="http://www.iron-feet.com/activities-i-take-part-in/recaptcha/">参与</a>了 <a href="http://recaptcha.net/" target="_blank">reCAPTCHA</a> 项目，试图为古籍的传承尽一份力，到现在都未曾停止过。而眼前的这个 WCG 同样是我力所能及的一个项目，我觉得能参与进去倍感荣幸。

现在这个网格计算支持的项目有解决能源问题、癌症、艾滋、水资源等等，具体可参加此<a href="http://www.worldcommunitygrid.org/stat/viewProjects.do" target="_blank">页面</a>。

经过对 WCG 用了一段以后，发现 WCG 对于负载的控制还是很好的，在你机器繁忙的时候他就会很知趣地停止计算。我并没有因为使用 WCG 而使得机器变慢或者卡死的，这个让我非常满意。

当机器繁忙的时候，就会出现如下日志：

<blockquote>
Thu 23 Feb 2012 04:10:42 PM CST		Suspending computation - CPU usage is too high
</blockquote>

当机器空闲之后，就会出现如下日志：
<blockquote>
Thu 23 Feb 2012 04:11:22 PM CST		Resuming computation
</blockquote>

需要注意的是：WCG 毕竟用了计算机的闲置的计算能力，因此他会在你不知不觉间增加你的电费，毕竟 CPU 闲和繁忙的时候用的电量是不同的:???:其实也多不了多少。所以如果对电费敏感的朋友们请慎重考虑！]]></description>
			<content:encoded><![CDATA[<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://www.iron-feet.com/it/volunteering-among-it-minggongs/' t='Volunteering among IT Minggongs' d='' tag='BOINC,reCAPTCHA,Volunteering,WCG' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://www.iron-feet.com/wp-content/plugins/addthischina/a3.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
<p>前段时间在 Google Reader 上闲逛的时候，发现<a href="http://www.iplaysoft.com/" target="_blank">异次元の世界</a>推荐了一个很不错的东东——<a href="http://www.worldcommunitygrid.org/" target="_blank">World Community Grid</a></p>
<p>去其主页看了一下，里面写道：</p>
<blockquote><p>
我们是谁<br />
World Community Grid 将全球各地愿意捐献出自己计算机闲置时间的人汇集在一起，以创造出造福全人类的最大的志愿者计算网格。作为工作的基础，我们坚信：技术创新、具有想象力的科学研究以及大量志愿者这三大因素相结合，可以使我们的地球更加智慧。我们的成功需要像您这样的个人共同将未使用的计算机时间贡献给这项无私的事业。</p>
<p>您如何提供帮助<br />
如果您的计算机已打开，但处于空闲状态，那么请将计算机的计算能力贡献给有益于人类的项目！我们提供免费且安全的软件和系统，使您成为这个社区的一分子，为改变世界做出贡献。一旦安装了该软件，您就可以参与 World Community Grid。就是这样简单！只需单击下面的“立即加入”按钮。
</p></blockquote>
<p>这正是我想要的东西。作为一个 IT 民工，我不能像 Bill Gates 等富翁投入巨额于公益慈善事业，但也不能因此而拒绝为有益于人类的事情做出点滴的贡献。我的站在很早之前就开始<a target="_blank" href="http://www.iron-feet.com/activities-i-take-part-in/recaptcha/">参与</a>了 <a href="http://recaptcha.net/" target="_blank">reCAPTCHA</a> 项目，试图为古籍的传承尽一份力，到现在都未曾停止过。而眼前的这个 WCG 同样是我力所能及的一个项目，我觉得能参与进去倍感荣幸。</p>
<p>现在这个网格计算支持的项目有解决能源问题、癌症、艾滋、水资源等等，具体可参加此<a href="http://www.worldcommunitygrid.org/stat/viewProjects.do" target="_blank">页面</a>。</p>
<p>经过对 WCG 用了一段以后，发现 WCG 对于负载的控制还是很好的，在你机器繁忙的时候他就会很知趣地停止计算。我并没有因为使用 WCG 而使得机器变慢或者卡死的，这个让我非常满意。</p>
<p>当机器繁忙的时候，就会出现如下日志：</p>
<blockquote><p>
Thu 23 Feb 2012 04:10:42 PM CST		Suspending computation &#8211; CPU usage is too high
</p></blockquote>
<p>当机器空闲之后，就会出现如下日志：</p>
<blockquote><p>
Thu 23 Feb 2012 04:11:22 PM CST		Resuming computation
</p></blockquote>
<p>需要注意的是：WCG 毕竟用了计算机的闲置的计算能力，因此他会在你不知不觉间增加你的电费，毕竟 CPU 闲和繁忙的时候用的电量是不同的<img src="http://www.iron-feet.com/wp-content/plugins/wp-smiley-switcher/noktahhitam/icon_confused.gif" alt="" />其实也多不了多少。所以如果对电费敏感的朋友们请慎重考虑！</p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li>April 8, 2008 -- <a href="http://www.iron-feet.com/sth-in-my-heart/phone-call-minutes-ago/" title="几分钟前宿舍电话响了">几分钟前宿舍电话响了</a> (1)</li><li>December 4, 2011 -- <a href="http://www.iron-feet.com/it/some-interviews/" title="Some Interviews">Some Interviews</a> (2)</li><li>November 6, 2008 -- <a href="http://www.iron-feet.com/still-a-student/life-in-gucas/a-low-accuracy/" title="A Low Accuracy">A Low Accuracy</a> (2)</li><li>June 26, 2006 -- <a href="http://www.iron-feet.com/sth-in-my-heart/happy-words/" title="这段文字，我越看越爽！！！">这段文字，我越看越爽！！！</a> (0)</li><li>April 6, 2006 -- <a href="http://www.iron-feet.com/humor/habit-cures-habit/" title="以毒攻毒[转]">以毒攻毒[转]</a> (4)</li><li>July 6, 2006 -- <a href="http://www.iron-feet.com/sports/football-sports/world-cup-football-sports-sports/zidane-s-worldcup/" title="齐达内的世界杯">齐达内的世界杯</a> (1)</li><li>August 5, 2006 -- <a href="http://www.iron-feet.com/essay/get-health/" title="早日康复吧">早日康复吧</a> (0)</li><li>May 23, 2008 -- <a href="http://www.iron-feet.com/still-a-student/life-in-gucas/birds-shit/" title="鸟屎">鸟屎</a> (0)</li><li>June 27, 2006 -- <a href="http://www.iron-feet.com/sports/football-sports/world-cup-football-sports-sports/the-last-second/" title="最后一秒的点球">最后一秒的点球</a> (3)</li><li>October 25, 2009 -- <a href="http://www.iron-feet.com/sth-in-my-heart/say-thanks-to-my-friends-my-site/" title="Say Thank You to My Friends, Gouxihuan.com &#038; My Site">Say Thank You to My Friends, Gouxihuan.com &#038; My Site</a> (10)</li></ul><hr />
<p><small>© Iron_Feet for <a href="http://www.iron-feet.com">风云阁</a>, 2012. |
<a href="http://www.iron-feet.com/it/volunteering-among-it-minggongs/">Permalink</a> |
<a href="http://www.iron-feet.com/it/volunteering-among-it-minggongs/#comments">One comment</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.iron-feet.com/it/volunteering-among-it-minggongs/&title=Volunteering among IT Minggongs">del.icio.us</a>
<br/>
Post tags: <a href="http://www.iron-feet.com/tag/boinc/" rel="tag">BOINC</a>, <a href="http://www.iron-feet.com/tag/recaptcha/" rel="tag">reCAPTCHA</a>, <a href="http://www.iron-feet.com/tag/volunteering/" rel="tag">Volunteering</a>, <a href="http://www.iron-feet.com/tag/wcg/" rel="tag">WCG</a><br/>
</small></p>
<p><a href="http://feedads.g.doubleclick.net/~a/-hsje2dfRqnCva6b2IJlx-b1Bv0/0/da"><img src="http://feedads.g.doubleclick.net/~a/-hsje2dfRqnCva6b2IJlx-b1Bv0/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/-hsje2dfRqnCva6b2IJlx-b1Bv0/1/da"><img src="http://feedads.g.doubleclick.net/~a/-hsje2dfRqnCva6b2IJlx-b1Bv0/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.iron-feet.com/it/volunteering-among-it-minggongs/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Some Interviews</title>
		<link>http://www.iron-feet.com/it/some-interviews/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=some-interviews</link>
		<comments>http://www.iron-feet.com/it/some-interviews/#comments</comments>
		<pubDate>Sun, 04 Dec 2011 15:05:29 +0000</pubDate>
		<dc:creator>Iron_Feet</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Life in Sogou (Sohu-RD)]]></category>
		<category><![CDATA[Interview]]></category>

		<guid isPermaLink="false">http://www.iron-feet.com/?p=3519</guid>
		<description><![CDATA[除去实习不算，离毕业到现在已经工作了快一年半了。工作中遇到了很多事情，可笑的、可悲的、可恶的、可爱的等等都有。

我一直觉得，面试是一个很费时间的事情，至少到现在我依然这么觉得。但是不可否认的是，面试却又会遇到很多有趣的事情。

之前的一段时间刚好是面试高峰期，面试安排潮水般的涌来，让我面试了不少学生和跳槽的。接下来聊几个比较有趣的情景，里面有我亲自面的，也有我听同事说的，但是我都会用第一人称来写。当然下面的内容我也不会涉及任何一点个人隐私！下文中会有“XXXXXXXXXX”，表示是对内容的省略。

<ol>
<li><strong>“那个”哥</strong>
某天，正值中秋假期刚过。我和同事面一个男应届毕业生。面试一开始，该学生说：“不好意思，我刚刚下火车就赶过来了，有点累。”于是我和同事让他休息会，决定半小时后再来面他。

半小时后，我和同事再次出来面他。让他进行一番简单的自我介绍过后，开始提问：“你这段工作经历，主要是XXXXXXXXXXX，说一下你的简单实现吧。”他回答：“哦！我刚下火车可以倒杯水吗？”我们拿了个一次性杯子给了杯水后，让他继续回答。他喝了口水，一句话不说！

隔了一会，我同事问：“你是不是身体不舒服？不舒服的话休息一下，或者安排你改天面试都行。”
他说：“没关系，我有点那个。”
我又问：“那个？是不是病了？”
他说：“不是，就是有点那个！”
同事问：“什么是那个？不方便的话改天安排时间约你面试吧，你回去休息一下。”
他说：“没问题，继续吧！”

他很简单的回答了一下问题，并且回答的很不理想，感觉就是对自己做的东西不清不楚的。

我们继续问了下一个问题。他又不说话了！
接下来又开始了上面的对话。病了？不是！那怎么了？有点那个。不舒服要休息吗？不需要，有点那个而已。

一个男生，面对两个面试官竟然这么扭捏，当时我和我同事都快抓狂了！

收获：组内一旦有人对某些问题不想回答的时候，就会说一声“我有点那个。”
</li>
<li><strong>背诵姐</strong>
面一个女博士。看简历发现她学的科目，很多都是非常难得牛X科目。让我极度担心是不是书呆子。

面试了一会，我问了一个很老掉牙的面试题：“讲讲现在主流排序算法的时间复杂度。”此女倒背如流。
随后我又问：“那空间复杂度呢？”
答曰：“啊呀，这个昨天没有背啊！”
问道：“那你了解这些算法的原理吗？”
答曰：“了解！”
问道：“那你把几个算法的空间复杂度推导一下给我看看。”
答曰：“没背！”

我当时心想：我勒个去啊，你都不会推导？还说了解~

到了面试最后，我以一个老掉牙问题结束：“对于我们这边，你有什么需要了解和想问的吗？”
答曰：“没有。我知道我这次面的不好，我应该是没戏的。”
我不语！
继续说：“下次面试前，我一定把该背的好好地背熟。”

我当时不是“不语”了，是“无语”了。您这也太老实了吧！

</li>
<li><strong>自恋帝</strong>
面一自信心极度膨胀者。

问：“请你写一下代码，实现一下XXXXXXXXX的功能。”
答曰：“这么简单的东西我一会就写好了。”随后奋笔疾书，写完给我。

拿来一看，千疮百孔！

接着问：“你这个项目，主要是用到了什么算法？”
答曰：“XXXXXXXXXXXX”
问：“那你给我讲下它的原理”
答曰：“你这都不知道啊？我来给你讲下。”我那个汗啊，我是想看看你是不是在忽悠我，怎么就变成我在请教他了。
此人讲解的一塌糊涂，不知道他的自信心从哪里来的。

数日后，接到一电话：“喂，你们什么时候给我发 offer 啊。”
我说：“你那天才参加的只是一面而已。不会这么快发 offer 的。”
对面说：“我这么牛，还要面这么多次啊。你是不是嫉妒我比你牛，把我的简历扔了啊。”
我无语，只能说：“我不会扔掉你的简历的，但是很遗憾，您没有通过一面。”
省略接下来的各种无语对话。

</li>

<li><strong>忙晕乎的前台</strong>
某日，将笔试题、答卷和简历给了一个前台，写上标签：“这个是 ABC 的简历和他要做的题目，明日 X:00 他会来前台，请安排。笔试一小时后请联系 EFG，工位号码是 XXXXXXXXXX”。

到了第二天 X:00 分，ABC 给我电话说：“前台说没有给我的卷子。”我回答：“稍等”后挂了。刚要去找前台，前台来电话说到：“ ABC 你好，你约定的 EFG 同学现在还没来。”我很无语的问答说：“我是 EFG ，我约的是 ABC~”

收获：以后安排面试笔试不再通过前台了。

</li>

<li><strong>挑剔哥</strong>
面试一小会后，我让他写一段代码实现XXXXXXX功能。答曰：“这边环境太少，没法写！”
随后又问了，针对XXXXXXXXX写个简短地实现方案。答曰：“这边环境太差，没法思考！”

我郁闷了，问他：“如果我们的工作环境就是这个样子呢？”答曰：“面试和工作感觉不一样！”

收获：也许以后应该告诉面试的同学，工作环境很差的哦:P
</li>

<li><strong>啥不会哥</strong>
面试进入了开发部分。问道：“C++ 熟悉不？”
答曰：“不熟悉。”好吧，我就不先问 C++ 的东东了。
问道：“你熟悉什么？”
答曰：“C#。”
问道：“那我问你， C# XXXXXXXXXXX”
答曰：“好久没用不记得了。”我无语。
我不耐烦了：“说说你觉得你熟悉的语言，并且最近在用的。”
答曰：“Matlab、Shell。”

于是先后问了 Matlab 的多维数组和 awk 的一些技巧，都不知道。我真想说：“兄弟，你的简历里面描述的绝对不是你。如果真是你，说明你失忆了！”

收获：这年头忽悠人的简历多的去了，但是能这么忽悠人的很真不多。

</li>
</ol>

不得不说，找工作是个运气活、体力活、能力活。除非哥们牛的一定境界了，一般都要费上好多周折。已经工作的朋友们，相信都是过来人。想想 09 年和 10 年形势最差的两年，我刚好轮上了 10 年，当时找工作情景真是不堪回首啊。

今年形势不错，衷心祝愿各位求职者可以拿到理想的  offer 。]]></description>
			<content:encoded><![CDATA[<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://www.iron-feet.com/it/some-interviews/' t='Some Interviews' d='' tag='Interview' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://www.iron-feet.com/wp-content/plugins/addthischina/a3.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
<p>除去实习不算，离毕业到现在已经工作了快一年半了。工作中遇到了很多事情，可笑的、可悲的、可恶的、可爱的等等都有。</p>
<p>我一直觉得，面试是一个很费时间的事情，至少到现在我依然这么觉得。但是不可否认的是，面试却又会遇到很多有趣的事情。</p>
<p>之前的一段时间刚好是面试高峰期，面试安排潮水般的涌来，让我面试了不少学生和跳槽的。接下来聊几个比较有趣的情景，里面有我亲自面的，也有我听同事说的，但是我都会用第一人称来写。当然下面的内容我也不会涉及任何一点个人隐私！下文中会有“XXXXXXXXXX”，表示是对内容的省略。</p>
<ol>
<li><strong>“那个”哥</strong><br />
某天，正值中秋假期刚过。我和同事面一个男应届毕业生。面试一开始，该学生说：“不好意思，我刚刚下火车就赶过来了，有点累。”于是我和同事让他休息会，决定半小时后再来面他。</p>
<p>半小时后，我和同事再次出来面他。让他进行一番简单的自我介绍过后，开始提问：“你这段工作经历，主要是XXXXXXXXXXX，说一下你的简单实现吧。”他回答：“哦！我刚下火车可以倒杯水吗？”我们拿了个一次性杯子给了杯水后，让他继续回答。他喝了口水，一句话不说！</p>
<p>隔了一会，我同事问：“你是不是身体不舒服？不舒服的话休息一下，或者安排你改天面试都行。”<br />
他说：“没关系，我有点那个。”<br />
我又问：“那个？是不是病了？”<br />
他说：“不是，就是有点那个！”<br />
同事问：“什么是那个？不方便的话改天安排时间约你面试吧，你回去休息一下。”<br />
他说：“没问题，继续吧！”</p>
<p>他很简单的回答了一下问题，并且回答的很不理想，感觉就是对自己做的东西不清不楚的。</p>
<p>我们继续问了下一个问题。他又不说话了！<br />
接下来又开始了上面的对话。病了？不是！那怎么了？有点那个。不舒服要休息吗？不需要，有点那个而已。</p>
<p>一个男生，面对两个面试官竟然这么扭捏，当时我和我同事都快抓狂了！</p>
<p>收获：组内一旦有人对某些问题不想回答的时候，就会说一声“我有点那个。”
</li>
<li><strong>背诵姐</strong><br />
面一个女博士。看简历发现她学的科目，很多都是非常难得牛X科目。让我极度担心是不是书呆子。</p>
<p>面试了一会，我问了一个很老掉牙的面试题：“讲讲现在主流排序算法的时间复杂度。”此女倒背如流。<br />
随后我又问：“那空间复杂度呢？”<br />
答曰：“啊呀，这个昨天没有背啊！”<br />
问道：“那你了解这些算法的原理吗？”<br />
答曰：“了解！”<br />
问道：“那你把几个算法的空间复杂度推导一下给我看看。”<br />
答曰：“没背！”</p>
<p>我当时心想：我勒个去啊，你都不会推导？还说了解~</p>
<p>到了面试最后，我以一个老掉牙问题结束：“对于我们这边，你有什么需要了解和想问的吗？”<br />
答曰：“没有。我知道我这次面的不好，我应该是没戏的。”<br />
我不语！<br />
继续说：“下次面试前，我一定把该背的好好地背熟。”</p>
<p>我当时不是“不语”了，是“无语”了。您这也太老实了吧！</p>
</li>
<li><strong>自恋帝</strong><br />
面一自信心极度膨胀者。</p>
<p>问：“请你写一下代码，实现一下XXXXXXXXX的功能。”<br />
答曰：“这么简单的东西我一会就写好了。”随后奋笔疾书，写完给我。</p>
<p>拿来一看，千疮百孔！</p>
<p>接着问：“你这个项目，主要是用到了什么算法？”<br />
答曰：“XXXXXXXXXXXX”<br />
问：“那你给我讲下它的原理”<br />
答曰：“你这都不知道啊？我来给你讲下。”我那个汗啊，我是想看看你是不是在忽悠我，怎么就变成我在请教他了。<br />
此人讲解的一塌糊涂，不知道他的自信心从哪里来的。</p>
<p>数日后，接到一电话：“喂，你们什么时候给我发 offer 啊。”<br />
我说：“你那天才参加的只是一面而已。不会这么快发 offer 的。”<br />
对面说：“我这么牛，还要面这么多次啊。你是不是嫉妒我比你牛，把我的简历扔了啊。”<br />
我无语，只能说：“我不会扔掉你的简历的，但是很遗憾，您没有通过一面。”<br />
省略接下来的各种无语对话。</p>
</li>
<li><strong>忙晕乎的前台</strong><br />
某日，将笔试题、答卷和简历给了一个前台，写上标签：“这个是 ABC 的简历和他要做的题目，明日 X:00 他会来前台，请安排。笔试一小时后请联系 EFG，工位号码是 XXXXXXXXXX”。</p>
<p>到了第二天 X:00 分，ABC 给我电话说：“前台说没有给我的卷子。”我回答：“稍等”后挂了。刚要去找前台，前台来电话说到：“ ABC 你好，你约定的 EFG 同学现在还没来。”我很无语的问答说：“我是 EFG ，我约的是 ABC~”</p>
<p>收获：以后安排面试笔试不再通过前台了。</p>
</li>
<li><strong>挑剔哥</strong><br />
面试一小会后，我让他写一段代码实现XXXXXXX功能。答曰：“这边环境太少，没法写！”<br />
随后又问了，针对XXXXXXXXX写个简短地实现方案。答曰：“这边环境太差，没法思考！”</p>
<p>我郁闷了，问他：“如果我们的工作环境就是这个样子呢？”答曰：“面试和工作感觉不一样！”</p>
<p>收获：也许以后应该告诉面试的同学，工作环境很差的哦<img src="http://www.iron-feet.com/wp-content/plugins/wp-smiley-switcher/noktahhitam/icon_razz.gif" alt="" />
</li>
<li><strong>啥不会哥</strong><br />
面试进入了开发部分。问道：“C++ 熟悉不？”<br />
答曰：“不熟悉。”好吧，我就不先问 C++ 的东东了。<br />
问道：“你熟悉什么？”<br />
答曰：“C#。”<br />
问道：“那我问你， C# XXXXXXXXXXX”<br />
答曰：“好久没用不记得了。”我无语。<br />
我不耐烦了：“说说你觉得你熟悉的语言，并且最近在用的。”<br />
答曰：“Matlab、Shell。”</p>
<p>于是先后问了 Matlab 的多维数组和 awk 的一些技巧，都不知道。我真想说：“兄弟，你的简历里面描述的绝对不是你。如果真是你，说明你失忆了！”</p>
<p>收获：这年头忽悠人的简历多的去了，但是能这么忽悠人的很真不多。</p>
</li>
</ol>
<p>不得不说，找工作是个运气活、体力活、能力活。除非哥们牛的一定境界了，一般都要费上好多周折。已经工作的朋友们，相信都是过来人。想想 09 年和 10 年形势最差的两年，我刚好轮上了 10 年，当时找工作情景真是不堪回首啊。</p>
<p>今年形势不错，衷心祝愿各位求职者可以拿到理想的  offer 。</p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>July 5, 2006 -- <a href="http://www.iron-feet.com/still-a-student/life-in-jnusytu/liberation/" title="解放了">解放了</a> (0)</li><li>March 29, 2006 -- <a href="http://www.iron-feet.com/still-a-student/life-in-jnusytu/wait-for-interview/" title="嚯嚯，要面试了！">嚯嚯，要面试了！</a> (9)</li></ul><hr />
<p><small>© Iron_Feet for <a href="http://www.iron-feet.com">风云阁</a>, 2011. |
<a href="http://www.iron-feet.com/it/some-interviews/">Permalink</a> |
<a href="http://www.iron-feet.com/it/some-interviews/#comments">2 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.iron-feet.com/it/some-interviews/&title=Some Interviews">del.icio.us</a>
<br/>
Post tags: <a href="http://www.iron-feet.com/tag/interview/" rel="tag">Interview</a><br/>
</small></p>
<p><a href="http://feedads.g.doubleclick.net/~a/hOJTa41nsg0yfq_04ezOPWN35-A/0/da"><img src="http://feedads.g.doubleclick.net/~a/hOJTa41nsg0yfq_04ezOPWN35-A/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/hOJTa41nsg0yfq_04ezOPWN35-A/1/da"><img src="http://feedads.g.doubleclick.net/~a/hOJTa41nsg0yfq_04ezOPWN35-A/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.iron-feet.com/it/some-interviews/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Promote Media</title>
		<link>http://www.iron-feet.com/it/premote-media/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=premote-media</link>
		<comments>http://www.iron-feet.com/it/premote-media/#comments</comments>
		<pubDate>Mon, 15 Aug 2011 10:08:31 +0000</pubDate>
		<dc:creator>Iron_Feet</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Ad]]></category>
		<category><![CDATA[Advertisment]]></category>

		<guid isPermaLink="false">http://www.iron-feet.com/?p=3508</guid>
		<description><![CDATA[前些日子去超市购物，赫然发现超市的手推车上都多了一个小屏幕。我第一反应就想到通常在电梯里面的一个一个放广告的小屏幕，看来这年头广告商真是无孔不入啊。

出于好奇和职业关系，平时不爱用推车的我特地推了推车进入了购物区。

一开始我还特地关注了一下这小屏幕上的内容，不外乎2个内容：1. 超市会员购物满多少元，可以换购啥啥玩意的。现在超市都这么干，似乎没什么新意。2. 什么什么大降价等等。这很类似于平时各大网站投放的热门广告，并没有让我感觉到有多少新意。

慢慢地我的注意力就完全从小屏幕挪开了，在超市里面找寻我想购买的东西。无意间我走到一个知名薯片品牌专柜旁边，突然听到“叮！XXX品牌薯片，购买12元，立减2元。”我一下意识到是那个小屏幕发出来的，低头一看屏幕上果然展示的是“XXX品牌薯片满12返2元”的动态广告。赞！真是现实版的匹配广告。由于这个广告，我的确驻足看了一下该品牌的薯片～相信这个“匹配广告”会为该品牌薯片提高销量的。随后我走到了某芝麻糊的区域，它会提示到“某芝麻糊买2送一个杯子”什么的。呃买芝麻糊送悲剧，咋听咋别扭:???:

对于这个“匹配广告”的实现，我想应该就是小屏幕和柜台中放置感应芯片来实现的。至于触发方式不外乎两种可能：
<ol>
	<li><strong>即时触发</strong>
我特地将推车推到比较远的地方，然后推回来。屏幕并没有马上提示“匹配广告”，看来不是即时触发的。这也是可以理解的，万一有个人在好几个品牌的薯片中进行来回比较的话，来一次屏幕就响一次，这搁谁都受不了。</li>
	<li><strong>时序触发</strong>
于是我就呆在薯片区好久没走，果然屏幕隔一段时间就响一次，频率并不高，还是能忍。</li>
</ol>

好吧！也许有人会认为我做这实验蛮蛋疼的。唉！天天折腾广告投放算法和用户挖掘，给落下的毛病。我的确被这个小屏幕吸引了。不过对于安装这个小屏幕的超市而言就比较失败了，因为真正吸引我的不是屏幕里面的广告:P

最后附上该小屏幕的玉照（防止有人说我这个软文，我将图片中所有网址和联系方式等等都抹去了，嚯嚯！）
<img src="/wp-content/uploads/Ad/3.jpg" alt="PromoteMedia" />]]></description>
			<content:encoded><![CDATA[<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://www.iron-feet.com/it/premote-media/' t='Promote Media' d='' tag='Ad,Advertisment' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://www.iron-feet.com/wp-content/plugins/addthischina/a3.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
<p>前些日子去超市购物，赫然发现超市的手推车上都多了一个小屏幕。我第一反应就想到通常在电梯里面的一个一个放广告的小屏幕，看来这年头广告商真是无孔不入啊。</p>
<p>出于好奇和职业关系，平时不爱用推车的我特地推了推车进入了购物区。</p>
<p>一开始我还特地关注了一下这小屏幕上的内容，不外乎2个内容：1. 超市会员购物满多少元，可以换购啥啥玩意的。现在超市都这么干，似乎没什么新意。2. 什么什么大降价等等。这很类似于平时各大网站投放的热门广告，并没有让我感觉到有多少新意。</p>
<p>慢慢地我的注意力就完全从小屏幕挪开了，在超市里面找寻我想购买的东西。无意间我走到一个知名薯片品牌专柜旁边，突然听到“叮！XXX品牌薯片，购买12元，立减2元。”我一下意识到是那个小屏幕发出来的，低头一看屏幕上果然展示的是“XXX品牌薯片满12返2元”的动态广告。赞！真是现实版的匹配广告。由于这个广告，我的确驻足看了一下该品牌的薯片～相信这个“匹配广告”会为该品牌薯片提高销量的。随后我走到了某芝麻糊的区域，它会提示到“某芝麻糊买2送一个杯子”什么的。呃买芝麻糊送悲剧，咋听咋别扭<img src="http://www.iron-feet.com/wp-content/plugins/wp-smiley-switcher/noktahhitam/icon_confused.gif" alt="" /></p>
<p>对于这个“匹配广告”的实现，我想应该就是小屏幕和柜台中放置感应芯片来实现的。至于触发方式不外乎两种可能：</p>
<ol>
<li><strong>即时触发</strong><br />
我特地将推车推到比较远的地方，然后推回来。屏幕并没有马上提示“匹配广告”，看来不是即时触发的。这也是可以理解的，万一有个人在好几个品牌的薯片中进行来回比较的话，来一次屏幕就响一次，这搁谁都受不了。</li>
<li><strong>时序触发</strong><br />
于是我就呆在薯片区好久没走，果然屏幕隔一段时间就响一次，频率并不高，还是能忍。</li>
</ol>
<p>好吧！也许有人会认为我做这实验蛮蛋疼的。唉！天天折腾广告投放算法和用户挖掘，给落下的毛病。我的确被这个小屏幕吸引了。不过对于安装这个小屏幕的超市而言就比较失败了，因为真正吸引我的不是屏幕里面的广告<img src="http://www.iron-feet.com/wp-content/plugins/wp-smiley-switcher/noktahhitam/icon_razz.gif" alt="" /></p>
<p>最后附上该小屏幕的玉照（防止有人说我这个软文，我将图片中所有网址和联系方式等等都抹去了，嚯嚯！）<br />
<img src="/wp-content/uploads/Ad/3.jpg" alt="PromoteMedia" /></p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li>May 13, 2007 -- <a href="http://www.iron-feet.com/sth-in-my-heart/mother-day/" title="母亲节了！">母亲节了！</a> (3)</li><li>December 28, 2007 -- <a href="http://www.iron-feet.com/still-a-student/life-in-gucas/shut-the-computer/" title="封机～～～">封机～～～</a> (2)</li><li>August 18, 2006 -- <a href="http://www.iron-feet.com/it/bumptop-3d-desktop/" title="BumpTop，让我感受到了什么叫做3D桌面。">BumpTop，让我感受到了什么叫做3D桌面。</a> (1)</li><li>December 8, 2008 -- <a href="http://www.iron-feet.com/it/the-problem-on-m-group-in-pidgin/" title="The Problem on M Group in Pidgin~">The Problem on M Group in Pidgin~</a> (0)</li><li>September 17, 2008 -- <a href="http://www.iron-feet.com/it/mono-systemnotsupportedexception-codepage-1252-not-supported/" title="Mono: System.NotSupportedException: CodePage 1252 not supported">Mono: System.NotSupportedException: CodePage 1252 not supported</a> (0)</li><li>September 1, 2006 -- <a href="http://www.iron-feet.com/entertainment/music-song/songs-of-david-tao/" title="从《月亮代表谁的心》到《忘不了》">从《月亮代表谁的心》到《忘不了》</a> (0)</li><li>March 8, 2011 -- <a href="http://www.iron-feet.com/essay/more-scared-than-hurt/" title="More Scared Than Hurt">More Scared Than Hurt</a> (16)</li><li>March 11, 2006 -- <a href="http://www.iron-feet.com/humor/famous-or-not/" title="名人和凡人">名人和凡人</a> (7)</li><li>March 26, 2006 -- <a href="http://www.iron-feet.com/humor/beauty-pics/" title="很搞笑的美女图片">很搞笑的美女图片</a> (4)</li><li>September 13, 2008 -- <a href="http://www.iron-feet.com/it/vi/" title="VI">VI</a> (2)</li></ul><hr />
<p><small>© Iron_Feet for <a href="http://www.iron-feet.com">风云阁</a>, 2011. |
<a href="http://www.iron-feet.com/it/premote-media/">Permalink</a> |
<a href="http://www.iron-feet.com/it/premote-media/#comments">6 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.iron-feet.com/it/premote-media/&title=Promote Media">del.icio.us</a>
<br/>
Post tags: <a href="http://www.iron-feet.com/tag/ad/" rel="tag">Ad</a>, <a href="http://www.iron-feet.com/tag/advertisment/" rel="tag">Advertisment</a><br/>
</small></p>
<p><a href="http://feedads.g.doubleclick.net/~a/sX5HOnic-uOGEk-S9WHWVL_uq9o/0/da"><img src="http://feedads.g.doubleclick.net/~a/sX5HOnic-uOGEk-S9WHWVL_uq9o/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/sX5HOnic-uOGEk-S9WHWVL_uq9o/1/da"><img src="http://feedads.g.doubleclick.net/~a/sX5HOnic-uOGEk-S9WHWVL_uq9o/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.iron-feet.com/it/premote-media/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Miracles</title>
		<link>http://www.iron-feet.com/essay/miracles/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=miracles</link>
		<comments>http://www.iron-feet.com/essay/miracles/#comments</comments>
		<pubDate>Wed, 27 Jul 2011 12:02:01 +0000</pubDate>
		<dc:creator>Iron_Feet</dc:creator>
				<category><![CDATA[Essay]]></category>
		<category><![CDATA[Crash]]></category>
		<category><![CDATA[CRH]]></category>
		<category><![CDATA[Miracle]]></category>

		<guid isPermaLink="false">http://www.iron-feet.com/?p=3487</guid>
		<description><![CDATA[2011年7月1日，第一高速——京沪高铁正式通车了。这意味着什么，意味着很多很多。多到不需要我来赘述了，因为建党节那天各大网站纷纷结合“京沪高铁通车”发出了喜报，一副欣欣向荣的大好景象！

它其实意味着更多！当723动车追尾事件发生后，铁的事实告诉我们：第一高速的安全性杠杠的。动车遭雷劈在铁轨上停了就半个小时左右，惨烈的追尾事件就发生了；而京沪高铁多次因为雷劈（雷劈的够勤快的！）停留于铁轨上，最后还是可以将旅客<strong>安全地</strong>送往目的地。动车和第一高速的差距，显而易见。中国的第一高速必须不是盖的！

723动车追尾事件，转眼间成了一个契机。它让我们看到了一些奇迹。
<ol>
	<li>首先提到的必然是可怜的小伊伊，2岁半的孩子都失去了双亲，同时在车厢里困了这么久，无论是心灵和肉体上的创伤都是无法弥补的。<p/>

小伊伊的堂叔义正词严的婉拒了郝海东的收养请求。而这真的能代表小伊伊能够有个新家吗？一个2岁半就失去了双亲的幼小心灵也许很难再找回家的感觉了。而她的堂叔的一举一动，又说明了什么呢？他是将小伊伊视为自己的亲生女儿般对待而拒绝了郝海东的收养请求，还是觊觎接下来社会各界给予小伊伊的捐款呢？（也许有人会说我以小人之心度君子之腹。呃，我只是说出几个可能性而已，并没有作断定。）

也许若干年后，当小伊伊长大了，成为一个亭亭玉立的小姑娘的时候，她将会成为一个献礼片的题材。2011年7月23日的一个月黑风高的夜晚，天空电闪雷鸣，阴风大作，似有巫妖作乱。两辆动车的追尾即将夺取天真可爱的小伊伊的生命。小伊伊在废墟中奄奄一息，即将停止呼吸，冥冥中，她感觉到眼前一亮，似有一把金色的镰刀和锤子从眼前闪过。她睁开了眼睛，看到一双手将她抱起。无数人热泪盈眶，欢呼雀跃，小伊伊得救了。祖国和党不放弃任何一个生命，不放弃任何一个奇迹的发生。小伊伊你是生命的奇迹，她现在长大了，祖国和党培育她，她深深记住了党和国家对小伊伊的爱护。</li>


	<li>现如今“地沟油”、“塑化剂”等知名和不知名添加剂横行，中国人各个活蹦乱跳的，这说明我们中国人的体质杠杠的！一点添加剂何足挂齿。<p/>

这引以为豪的体质一度让我认为，中国人一旦出了事情绝对不是简单“黄金72小时”就能完事的。这么能扛，至少也要“黄金144小时”两倍时间，这次动车追尾的工作不搞个一星期完成不了。但是党和祖国的营救工作效率真是太高了！不到24小时，营救、修复、通车一气呵成，丝毫没有延迟，奇迹啊！而且仅仅在这么短时间内，还创造了小伊伊这样的生命奇迹，不禁让人热泪盈眶。</li>
</ol>



近期出现的一个一个奇迹，全国人民都觉得振奋人心！不知道各位朋友信不信。怎么可以不信呢，反正我是信了，要对党和国家有信心！但是我们也不能忘了在追尾事件中遇难的同胞们以及国际友人（据说好像有老外，嗯，老外一起见证这些奇迹～）。

在此，风云阁及其博主沉痛悼念在追尾事件中遇难的同胞们以及国际友人。

<img src="/wp-content/uploads/Death/Dian.jpg" alt="" />]]></description>
			<content:encoded><![CDATA[<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://www.iron-feet.com/essay/miracles/' t='Miracles' d='' tag='Crash,CRH,Miracle' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://www.iron-feet.com/wp-content/plugins/addthischina/a3.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
<p>2011年7月1日，第一高速——京沪高铁正式通车了。这意味着什么，意味着很多很多。多到不需要我来赘述了，因为建党节那天各大网站纷纷结合“京沪高铁通车”发出了喜报，一副欣欣向荣的大好景象！</p>
<p>它其实意味着更多！当723动车追尾事件发生后，铁的事实告诉我们：第一高速的安全性杠杠的。动车遭雷劈在铁轨上停了就半个小时左右，惨烈的追尾事件就发生了；而京沪高铁多次因为雷劈（雷劈的够勤快的！）停留于铁轨上，最后还是可以将旅客<strong>安全地</strong>送往目的地。动车和第一高速的差距，显而易见。中国的第一高速必须不是盖的！</p>
<p>723动车追尾事件，转眼间成了一个契机。它让我们看到了一些奇迹。</p>
<ol>
<li>首先提到的必然是可怜的小伊伊，2岁半的孩子都失去了双亲，同时在车厢里困了这么久，无论是心灵和肉体上的创伤都是无法弥补的。
<p/>
<p>小伊伊的堂叔义正词严的婉拒了郝海东的收养请求。而这真的能代表小伊伊能够有个新家吗？一个2岁半就失去了双亲的幼小心灵也许很难再找回家的感觉了。而她的堂叔的一举一动，又说明了什么呢？他是将小伊伊视为自己的亲生女儿般对待而拒绝了郝海东的收养请求，还是觊觎接下来社会各界给予小伊伊的捐款呢？（也许有人会说我以小人之心度君子之腹。呃，我只是说出几个可能性而已，并没有作断定。）</p>
<p>也许若干年后，当小伊伊长大了，成为一个亭亭玉立的小姑娘的时候，她将会成为一个献礼片的题材。2011年7月23日的一个月黑风高的夜晚，天空电闪雷鸣，阴风大作，似有巫妖作乱。两辆动车的追尾即将夺取天真可爱的小伊伊的生命。小伊伊在废墟中奄奄一息，即将停止呼吸，冥冥中，她感觉到眼前一亮，似有一把金色的镰刀和锤子从眼前闪过。她睁开了眼睛，看到一双手将她抱起。无数人热泪盈眶，欢呼雀跃，小伊伊得救了。祖国和党不放弃任何一个生命，不放弃任何一个奇迹的发生。小伊伊你是生命的奇迹，她现在长大了，祖国和党培育她，她深深记住了党和国家对小伊伊的爱护。</li>
<li>现如今“地沟油”、“塑化剂”等知名和不知名添加剂横行，中国人各个活蹦乱跳的，这说明我们中国人的体质杠杠的！一点添加剂何足挂齿。
<p/>
<p>这引以为豪的体质一度让我认为，中国人一旦出了事情绝对不是简单“黄金72小时”就能完事的。这么能扛，至少也要“黄金144小时”两倍时间，这次动车追尾的工作不搞个一星期完成不了。但是党和祖国的营救工作效率真是太高了！不到24小时，营救、修复、通车一气呵成，丝毫没有延迟，奇迹啊！而且仅仅在这么短时间内，还创造了小伊伊这样的生命奇迹，不禁让人热泪盈眶。</li>
</ol>
<p>近期出现的一个一个奇迹，全国人民都觉得振奋人心！不知道各位朋友信不信。怎么可以不信呢，反正我是信了，要对党和国家有信心！但是我们也不能忘了在追尾事件中遇难的同胞们以及国际友人（据说好像有老外，嗯，老外一起见证这些奇迹～）。</p>
<p>在此，风云阁及其博主沉痛悼念在追尾事件中遇难的同胞们以及国际友人。</p>
<p><img src="/wp-content/uploads/Death/Dian.jpg" alt="" /></p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>November 22, 2008 -- <a href="http://www.iron-feet.com/still-a-student/life-in-gucas/a-trip-to-tianjin/" title="A Trip to Tianjin">A Trip to Tianjin</a> (8)</li></ul><hr />
<p><small>© Iron_Feet for <a href="http://www.iron-feet.com">风云阁</a>, 2011. |
<a href="http://www.iron-feet.com/essay/miracles/">Permalink</a> |
<a href="http://www.iron-feet.com/essay/miracles/#comments">2 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.iron-feet.com/essay/miracles/&title=Miracles">del.icio.us</a>
<br/>
Post tags: <a href="http://www.iron-feet.com/tag/crash/" rel="tag">Crash</a>, <a href="http://www.iron-feet.com/tag/crh/" rel="tag">CRH</a>, <a href="http://www.iron-feet.com/tag/miracle/" rel="tag">Miracle</a><br/>
</small></p>
<p><a href="http://feedads.g.doubleclick.net/~a/OS6UA3ZVIIaEMRaGRwnnaMjvzsE/0/da"><img src="http://feedads.g.doubleclick.net/~a/OS6UA3ZVIIaEMRaGRwnnaMjvzsE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/OS6UA3ZVIIaEMRaGRwnnaMjvzsE/1/da"><img src="http://feedads.g.doubleclick.net/~a/OS6UA3ZVIIaEMRaGRwnnaMjvzsE/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.iron-feet.com/essay/miracles/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Electric Fence</title>
		<link>http://www.iron-feet.com/it/electric-fence/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=electric-fence</link>
		<comments>http://www.iron-feet.com/it/electric-fence/#comments</comments>
		<pubDate>Thu, 16 Jun 2011 03:02:39 +0000</pubDate>
		<dc:creator>Iron_Feet</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Life in Sogou (Sohu-RD)]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[efence]]></category>
		<category><![CDATA[Electric Fence]]></category>
		<category><![CDATA[memory debugger]]></category>

		<guid isPermaLink="false">http://www.iron-feet.com/?p=3453</guid>
		<description><![CDATA[最近公司一个同事推荐了一个名为 <a href="http://perens.com/FreeSoftware/ElectricFence/" target="_blank">ElectricFence</a> 的用来检查内存越界的库。于是上网查了一下相关资料，发现很多程序员，尤其是测试人员，极其推崇此库。

我了解了一下该库，并做了一些测试。当然已经知道这个东东，或者不在 Linux 下做 C++ 开发的朋友们，可以直接略过本文。

<a href="http://en.wikipedia.org/wiki/Electric_Fence">WIKI</a> 上提到，

<blockquote>
Electric Fence (or eFence) is a memory debugger written by Bruce Perens. It consists of a library which programmers can link into their code to override the C standard library memory management functions. eFence triggers a program crash when the memory error occurs, so a debugger can be used to inspect the code that caused the error.
</blockquote>

通俗地说：编译的时候， link 了这个库，如果你的程序出现内存错误的时候（如，越界），程序会直接崩溃出 core 。

接下的我们就一步一步地说明和测试一下该库

<ol>
	<li><strong>实验环境：</strong>
		<ul>
			<li>操作系统：Ubuntu 11.04</li>
			<li>内核：2.6.38-9-generic</li>
			<li>g++ gcc 版本：4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)</li>
			<li>eFence 版本：2.1.13-0.1</li>
		</ul>
	</li>
	<li>下载和编译 eFence ：
<pre lang="bash">
wget http://perens.com/FreeSoftware/ElectricFence/electric-fence_2.1.13-0.1.tar.gz
#由于 eFence 作者可能还在对该库进行维护，所以上面的地址未必是最新版本的，需要最新版本的朋友请进去此页面
#http://perens.com/FreeSoftware/ElectricFence/ 
tar xvf electric-fence_2.1.13-0.1.tar.gz
cd electric-fence_2.1.13
g++ -fPIC -shared efence.c page.c print.c -o libefence.so
</pre>
	</li>
	<li><strong>代码测试：</strong>
一般情况下，此类用来测试内存越界问题的库都是将 new delete malloc 等函数进行重写，从而起到监视内存操作的效果。因此可以想到的是，此库应该对于<del datetime="2011-06-16T06:28:04+00:00">  堆  </del>栈的越界是无能为力的。我们可以尝试一下。
		<ul>
			<li><strong>测试对<del datetime="2011-06-16T06:28:04+00:00">  堆  </del>栈的检查</strong>
<pre lang="bash">
$ cat teststack.cpp 
#include <stdio.h>

main()
{
    char p[10];
    printf("%c\tEND\n", p[10]);
    printf("%c\tEND\n", p[100]);
}

$ g++ -g teststack.cpp -o teststack -lefence -lpthread -L. #本文不是介绍 gcc 的，所以关于这些参数，我就不赘述了
$ export LD_LIBRARY_PATH=./
$ ulimited -c unlimited
$ ./teststack 
	END
	END
</pre>

果然没有崩溃出 core 。看来之前的猜测是对的。
			</li>
			<li><strong>测试对<del datetime="2011-06-16T06:28:04+00:00">  栈  </del>堆的检查</strong>
在做完了对<del datetime="2011-06-16T06:28:04+00:00">  堆  </del>栈的测试之后，我们尝试一下对<del datetime="2011-06-16T06:28:04+00:00">  栈  </del>堆的检查
<pre lang="bash">
$ cat testheap.c 
#include <stdio.h>

main()
{
    char* p = new char[10];
    printf("%c\tEND\n", p[10]);
    printf("%c\tEND\n", p[100]);
}

$ g++ -g testheap.cpp -o testheap -lefence -lpthread -L.
$ export LD_LIBRARY_PATH=./
$ ulimited -c unlimited
$ ./testheap 
  Electric Fence 2.1 copyright (C) 1987-1998 Bruce Perens.
	END
Segmentation fault (core dump)
</pre>

可以看到，程序一运行，在标准错误输出里面出现了这么一段文字

<blockquote>
Electric Fence 2.1 copyright (C) 1987-1998 Bruce Perens.
</blockquote>

看来这段文字是告诉我们，库生效了。这也再一次说明，该库对前面的栈的越界检测无能为力。

同时奇怪的是，第一个 END 竟然输出了， p[10] 越界了，但是没有出 core 。而第二个 p[100] 就出 core 。难道是这个库并不能对所有的越界生效？

带着疑问，我把 p[10] 到 p[100] 都尝试了一遍，发现 10 和 11 无效，从 12 开始就出 core 了。

			</li>
		</ul>
	</li>
</ol>


综上：
此库对下面两种情况无效：
<ol>
	<li>栈的越界操作</li>
	<li>堆的小范围越界</li>
</ol>

本文所做的只是一些简单的测试，如果各位有什么好的用法或者建议不吝赐教。

俗话说，求人不如求己。套用在这，就是“求物不如求己”。工具只能起到一个辅助作用，养成一个好的编程习惯和细心的态度才是真正的王道。 :D]]></description>
			<content:encoded><![CDATA[<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://www.iron-feet.com/it/electric-fence/' t='Electric Fence' d='' tag='C++,efence,Electric Fence,memory debugger' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://www.iron-feet.com/wp-content/plugins/addthischina/a3.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
<p>最近公司一个同事推荐了一个名为 <a href="http://perens.com/FreeSoftware/ElectricFence/" target="_blank">ElectricFence</a> 的用来检查内存越界的库。于是上网查了一下相关资料，发现很多程序员，尤其是测试人员，极其推崇此库。</p>
<p>我了解了一下该库，并做了一些测试。当然已经知道这个东东，或者不在 Linux 下做 C++ 开发的朋友们，可以直接略过本文。</p>
<p><a href="http://en.wikipedia.org/wiki/Electric_Fence">WIKI</a> 上提到，</p>
<blockquote><p>
Electric Fence (or eFence) is a memory debugger written by Bruce Perens. It consists of a library which programmers can link into their code to override the C standard library memory management functions. eFence triggers a program crash when the memory error occurs, so a debugger can be used to inspect the code that caused the error.
</p></blockquote>
<p>通俗地说：编译的时候， link 了这个库，如果你的程序出现内存错误的时候（如，越界），程序会直接崩溃出 core 。</p>
<p>接下的我们就一步一步地说明和测试一下该库</p>
<ol>
<li><strong>实验环境：</strong>
<ul>
<li>操作系统：Ubuntu 11.04</li>
<li>内核：2.6.38-9-generic</li>
<li>g++ gcc 版本：4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)</li>
<li>eFence 版本：2.1.13-0.1</li>
</ul>
</li>
<li>下载和编译 eFence ：

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>perens.com<span style="color: #000000; font-weight: bold;">/</span>FreeSoftware<span style="color: #000000; font-weight: bold;">/</span>ElectricFence<span style="color: #000000; font-weight: bold;">/</span>electric-fence_2.1.13-0.1.tar.gz
<span style="color: #666666; font-style: italic;">#由于 eFence 作者可能还在对该库进行维护，所以上面的地址未必是最新版本的，需要最新版本的朋友请进去此页面</span>
<span style="color: #666666; font-style: italic;">#http://perens.com/FreeSoftware/ElectricFence/ </span>
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvf electric-fence_2.1.13-0.1.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> electric-fence_2.1.13
<span style="color: #c20cb9; font-weight: bold;">g++</span> <span style="color: #660033;">-fPIC</span> <span style="color: #660033;">-shared</span> efence.c page.c print.c <span style="color: #660033;">-o</span> libefence.so</pre></div></div>

</li>
<li><strong>代码测试：</strong><br />
一般情况下，此类用来测试内存越界问题的库都是将 new delete malloc 等函数进行重写，从而起到监视内存操作的效果。因此可以想到的是，此库应该对于<del datetime="2011-06-16T06:28:04+00:00">  堆  </del>栈的越界是无能为力的。我们可以尝试一下。</p>
<ul>
<li><strong>测试对<del datetime="2011-06-16T06:28:04+00:00">  堆  </del>栈的检查</strong>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cat</span> teststack.cpp 
<span style="color: #666666; font-style: italic;">#include &lt;stdio.h&gt;</span>
&nbsp;
main<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
    char p<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">10</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;
    <span style="color: #7a0874; font-weight: bold;">printf</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;%c<span style="color: #000099; font-weight: bold;">\t</span>END<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, p<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">10</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
    <span style="color: #7a0874; font-weight: bold;">printf</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;%c<span style="color: #000099; font-weight: bold;">\t</span>END<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, p<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">100</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
$ <span style="color: #c20cb9; font-weight: bold;">g++</span> <span style="color: #660033;">-g</span> teststack.cpp <span style="color: #660033;">-o</span> teststack <span style="color: #660033;">-lefence</span> <span style="color: #660033;">-lpthread</span> -L. <span style="color: #666666; font-style: italic;">#本文不是介绍 gcc 的，所以关于这些参数，我就不赘述了</span>
$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LD_LIBRARY_PATH</span>=.<span style="color: #000000; font-weight: bold;">/</span>
$ ulimited <span style="color: #660033;">-c</span> unlimited
$ .<span style="color: #000000; font-weight: bold;">/</span>teststack 
	END
	END</pre></div></div>

<p>果然没有崩溃出 core 。看来之前的猜测是对的。
			</li>
<li><strong>测试对<del datetime="2011-06-16T06:28:04+00:00">  栈  </del>堆的检查</strong><br />
在做完了对<del datetime="2011-06-16T06:28:04+00:00">  堆  </del>栈的测试之后，我们尝试一下对<del datetime="2011-06-16T06:28:04+00:00">  栈  </del>堆的检查</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">cat</span> testheap.c 
<span style="color: #666666; font-style: italic;">#include &lt;stdio.h&gt;</span>
&nbsp;
main<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
    char<span style="color: #000000; font-weight: bold;">*</span> p = new char<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">10</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;
    <span style="color: #7a0874; font-weight: bold;">printf</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;%c<span style="color: #000099; font-weight: bold;">\t</span>END<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, p<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">10</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
    <span style="color: #7a0874; font-weight: bold;">printf</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;%c<span style="color: #000099; font-weight: bold;">\t</span>END<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>, p<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">100</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
$ <span style="color: #c20cb9; font-weight: bold;">g++</span> <span style="color: #660033;">-g</span> testheap.cpp <span style="color: #660033;">-o</span> testheap <span style="color: #660033;">-lefence</span> <span style="color: #660033;">-lpthread</span> -L.
$ <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LD_LIBRARY_PATH</span>=.<span style="color: #000000; font-weight: bold;">/</span>
$ ulimited <span style="color: #660033;">-c</span> unlimited
$ .<span style="color: #000000; font-weight: bold;">/</span>testheap 
  Electric Fence <span style="color: #000000;">2.1</span> copyright <span style="color: #7a0874; font-weight: bold;">&#40;</span>C<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000;">1987</span>-<span style="color: #000000;">1998</span> Bruce Perens.
	END
Segmentation fault <span style="color: #7a0874; font-weight: bold;">&#40;</span>core dump<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>可以看到，程序一运行，在标准错误输出里面出现了这么一段文字</p>
<blockquote><p>
Electric Fence 2.1 copyright (C) 1987-1998 Bruce Perens.
</p></blockquote>
<p>看来这段文字是告诉我们，库生效了。这也再一次说明，该库对前面的栈的越界检测无能为力。</p>
<p>同时奇怪的是，第一个 END 竟然输出了， p[10] 越界了，但是没有出 core 。而第二个 p[100] 就出 core 。难道是这个库并不能对所有的越界生效？</p>
<p>带着疑问，我把 p[10] 到 p[100] 都尝试了一遍，发现 10 和 11 无效，从 12 开始就出 core 了。</p>
</li>
</ul>
</li>
</ol>
<p>综上：<br />
此库对下面两种情况无效：</p>
<ol>
<li>栈的越界操作</li>
<li>堆的小范围越界</li>
</ol>
<p>本文所做的只是一些简单的测试，如果各位有什么好的用法或者建议不吝赐教。</p>
<p>俗话说，求人不如求己。套用在这，就是“求物不如求己”。工具只能起到一个辅助作用，养成一个好的编程习惯和细心的态度才是真正的王道。 <img src="http://www.iron-feet.com/wp-content/plugins/wp-smiley-switcher/noktahhitam/icon_biggrin.gif" alt="" /> </p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>June 17, 2009 -- <a href="http://www.iron-feet.com/it/volatile-register/" title="volatile &#038; register">volatile &#038; register</a> (0)</li></ul><hr />
<p><small>© Iron_Feet for <a href="http://www.iron-feet.com">风云阁</a>, 2011. |
<a href="http://www.iron-feet.com/it/electric-fence/">Permalink</a> |
<a href="http://www.iron-feet.com/it/electric-fence/#comments">6 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.iron-feet.com/it/electric-fence/&title=Electric Fence">del.icio.us</a>
<br/>
Post tags: <a href="http://www.iron-feet.com/tag/cpp/" rel="tag">C++</a>, <a href="http://www.iron-feet.com/tag/efence/" rel="tag">efence</a>, <a href="http://www.iron-feet.com/tag/electric-fence/" rel="tag">Electric Fence</a>, <a href="http://www.iron-feet.com/tag/memory-debugger/" rel="tag">memory debugger</a><br/>
</small></p>
<p><a href="http://feedads.g.doubleclick.net/~a/mJkSeFxKXGImjywpVHVncA67WoM/0/da"><img src="http://feedads.g.doubleclick.net/~a/mJkSeFxKXGImjywpVHVncA67WoM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/mJkSeFxKXGImjywpVHVncA67WoM/1/da"><img src="http://feedads.g.doubleclick.net/~a/mJkSeFxKXGImjywpVHVncA67WoM/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.iron-feet.com/it/electric-fence/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Little Tools: Killtree &amp; Ssh_auto</title>
		<link>http://www.iron-feet.com/it/little-tools-killtree-ssh_auto/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=little-tools-killtree-ssh_auto</link>
		<comments>http://www.iron-feet.com/it/little-tools-killtree-ssh_auto/#comments</comments>
		<pubDate>Tue, 17 May 2011 15:00:19 +0000</pubDate>
		<dc:creator>Iron_Feet</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Life in Sogou (Sohu-RD)]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[expect]]></category>
		<category><![CDATA[kill]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.iron-feet.com/?p=3426</guid>
		<description><![CDATA[作为一个 IT 民工，在写代码的过程总是会遇到一些不尽如人意之事。这不，我在工作过程中也遇到一些很郁闷的事情！

<ul>
	<li><strong>场景1</strong>
终于写完了一个复杂的流程，流程里面一环套一环。于是乎，很兴奋的开始后台运行，然后在流程的中间文件有个错误之前没有发现。接下来的事情相信很多在非 Windows 环境下作开发的朋友都会遇到的闹心事情：

先用 
<pre lang="bash">
pstree -ap
</pre>

获取了所有进程的情况（下面是节选了其中一部分）
<pre lang="bash">
sh,19058 -c cd\040/search/for_cacti/script;\040sh\040time.sh\040../conf/cpc_performance.conf\0401>>../log/perf.log\0402>&#038;1
  `-sh,19067 time.sh ../conf/cpc_performance.conf
      `-sh,19134 time.sh ../conf/cpc_performance.conf
          &#124;-awk,19138 -F\t -v check_time=20110509\04015:30:01...
          `-rclog,19135 /opt/rclog/rclog -s contextserver --local --cat -l ie_log --last=5
</pre>

当然上面这个进程树，无论是深度还是广度已经算少了，有时候多的能烦死人。
然后很郁闷的，从父到子一个一个的 kill。
<pre lang="bash">
kill -9 19058; kill -9 19067; kill -9 19134; kill -9 19138; kill -9 19135;
</pre>

刚开始的时候，我总是可以耐心地这么一个一个的 kill ，但是时间久了，我就完全不能忍了，这也太崩溃了！为了发扬一下 IT 民工的 DIY 精神，我只得写了一个小脚本 killtree.sh 来帮我处理这个繁琐的过程。

<pre lang="bash">
# Author: Bill Wung
# url: http://www.iron-feet.com
pidkill=$1
pidlist=` ps -eo ppid,pid &#124; sed 1d &#124; awk '{ if( $1!= $2 ) print $1"\t"$2 }' &#124; sort &#124; uniq `

set -u

killpid()
{
    set -x
    kill -9 "$1"
    set +x
    
    for subpid in ` echo "$pidlist" &#124; awk -F"\t" '{ if( $1=='"$1"' ) print $2 }' `
    do
        killpid "$subpid" 
    done

}

killpid "$pidkill"

</pre>

以上面列举的进程情况为例，你只需要执行一下
<pre lang="bash">
sh killtree.sh 19058
</pre>
就 OK 了

</li>
	<li><strong>场景2</strong>
你需要对服务器做一些操作，并且这个操作是需要每天做一次的。如果做成每日流程放入 crontab 那该多好呀。
可是无情的 OP 和我说：“这台机子不允许非 OP 搭建每日流程，也不允许 OP 以外的人为该机器建立 ssh 的信任关系。”
我顿时崩溃:???:。

我完全没法忍受，每天同一时间去手动地跑一个任务，太土鳖了！于是找了一下，发现了一个叫 expect 的东东！

根据 <a href="http://www.linuxmanpages.com/man1/expect.1.php" target="_blank" >Linux Man Page</a> ，expect 自动自动实现人机交互的操作，例如：输入密码、敲个 yes 什么的。

<blockquote>
Expect is a program that "talks" to other interactive programs according to a script. Following the script, Expect knows what can be expected from a program and what the correct response should be. An interpreted language provides branching and high-level control structures to direct the dialogue. In addition, the user can take control and interact directly when desired, afterward returning control to the script.
</blockquote>

大致了解了一下 expect 的语法，写了一个小脚本 ssh_auto.expect 来解决自动登录和发送命令的问题。
<pre lang="expect">
# Author: Bill Wung
# url: http://www.iron-feet.com
set host [lindex $argv 0]
set cmd [lindex $argv 1]
set usr [lindex $argv 2]
set psw [lindex $argv 3]

spawn ssh "$usr@$host" "$cmd"

set timeout 5
expect {
	"(yes/no)" {
		send "yes\r";
		exp_continue
	}
}

set timeout 5
expect {
	"id_rsa'" {
        	send "\r";
        	exp_continue
    	}
}

set timeout 5
expect {
	"Password:" { 
		send "$psw\r";
		exp_continue
	}
}

set timeout 5
expect {
	"password:" {
        	send "$psw\r";
        	exp_continue
	}
}

exit
</pre>

由于该脚本是 expect 的脚本，所以执行的时候需要用 expect 调用。
<pre lang="bash">
expect ssh_auto.expect 10.10.10.10 "cd /aa/bb; sh cc.sh; " root rootpassword
# 第一个参数是目标IP 第二个参数是执行的命令 第三个参数是用户名 第四个就是密码了
</pre>

由于很多 Linux 的发行版都不自带 expect ，所以部分用户需要自行安装一下 expect 才能调用该脚本。

</li>
</ul>

以上两个脚本，只是我平时使用，并考虑到太多的需求。
我会在 Google Code 开一个项目，将我平时随手写的一些小脚本扔进去。各位如果觉得有用的话，可以使用；如果有什么建议的话，更是不吝赐教。

项目的地址是 <a href="http://code.google.com/p/iron-feet-tools/" target="_blank" >http://code.google.com/p/iron-feet-tools/</a> ，目前里面就两个脚本以后会越来越多的。

项目前几天刚建立， wiki 啊什么的改天再完善吧！]]></description>
			<content:encoded><![CDATA[<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://www.iron-feet.com/it/little-tools-killtree-ssh_auto/' t='Little Tools: Killtree &amp;#038; Ssh_auto' d='' tag='Bash,expect,kill,SSH' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://www.iron-feet.com/wp-content/plugins/addthischina/a3.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
<p>作为一个 IT 民工，在写代码的过程总是会遇到一些不尽如人意之事。这不，我在工作过程中也遇到一些很郁闷的事情！</p>
<ul>
<li><strong>场景1</strong><br />
终于写完了一个复杂的流程，流程里面一环套一环。于是乎，很兴奋的开始后台运行，然后在流程的中间文件有个错误之前没有发现。接下来的事情相信很多在非 Windows 环境下作开发的朋友都会遇到的闹心事情：</p>
<p>先用</p>

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

<p>获取了所有进程的情况（下面是节选了其中一部分）</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sh</span>,<span style="color: #000000;">19058</span> <span style="color: #660033;">-c</span> <span style="color: #7a0874; font-weight: bold;">cd</span>\040<span style="color: #000000; font-weight: bold;">/</span>search<span style="color: #000000; font-weight: bold;">/</span>for_cacti<span style="color: #000000; font-weight: bold;">/</span>script;\040sh\040time.sh\040..<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>cpc_performance.conf\0401<span style="color: #000000; font-weight: bold;">&gt;&gt;</span>..<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>perf.log\0402<span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
  <span style="color: #000000; font-weight: bold;">`</span>-sh,<span style="color: #000000;">19067</span> time.sh ..<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>cpc_performance.conf
      <span style="color: #000000; font-weight: bold;">`</span>-sh,<span style="color: #000000;">19134</span> time.sh ..<span style="color: #000000; font-weight: bold;">/</span>conf<span style="color: #000000; font-weight: bold;">/</span>cpc_performance.conf
          <span style="color: #000000; font-weight: bold;">|</span>-awk,<span style="color: #000000;">19138</span> -F\t <span style="color: #660033;">-v</span> <span style="color: #007800;">check_time</span>=<span style="color: #000000;">20110509</span>\04015:<span style="color: #000000;">30</span>:01...
          <span style="color: #000000; font-weight: bold;">`</span>-rclog,<span style="color: #000000;">19135</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>rclog<span style="color: #000000; font-weight: bold;">/</span>rclog <span style="color: #660033;">-s</span> contextserver <span style="color: #660033;">--local</span> <span style="color: #660033;">--cat</span> <span style="color: #660033;">-l</span> ie_log <span style="color: #660033;">--last</span>=<span style="color: #000000;">5</span></pre></div></div>

<p>当然上面这个进程树，无论是深度还是广度已经算少了，有时候多的能烦死人。<br />
然后很郁闷的，从父到子一个一个的 kill。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-9</span> <span style="color: #000000;">19058</span>; <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-9</span> <span style="color: #000000;">19067</span>; <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-9</span> <span style="color: #000000;">19134</span>; <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-9</span> <span style="color: #000000;">19138</span>; <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-9</span> <span style="color: #000000;">19135</span>;</pre></div></div>

<p>刚开始的时候，我总是可以耐心地这么一个一个的 kill ，但是时间久了，我就完全不能忍了，这也太崩溃了！为了发扬一下 IT 民工的 DIY 精神，我只得写了一个小脚本 killtree.sh 来帮我处理这个繁琐的过程。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Author: Bill Wung</span>
<span style="color: #666666; font-style: italic;"># url: http://www.iron-feet.com</span>
<span style="color: #007800;">pidkill</span>=$<span style="color: #000000;">1</span>
<span style="color: #007800;">pidlist</span>=<span style="color: #000000; font-weight: bold;">`</span> <span style="color: #c20cb9; font-weight: bold;">ps</span> <span style="color: #660033;">-eo</span> ppid,pid <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> 1d <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ if( $1!= $2 ) print $1&quot;\t&quot;$2 }'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">uniq</span> <span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-u</span>
&nbsp;
killpid<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-x</span>
    <span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-9</span> <span style="color: #ff0000;">&quot;$1&quot;</span>
    <span style="color: #000000; font-weight: bold;">set</span> +x
&nbsp;
    <span style="color: #000000; font-weight: bold;">for</span> subpid <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span> <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$pidlist</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-F</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> <span style="color: #ff0000;">'{ if( $1=='</span><span style="color: #ff0000;">&quot;$1&quot;</span><span style="color: #ff0000;">' ) print $2 }'</span> <span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #000000; font-weight: bold;">do</span>
        killpid <span style="color: #ff0000;">&quot;<span style="color: #007800;">$subpid</span>&quot;</span> 
    <span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
killpid <span style="color: #ff0000;">&quot;<span style="color: #007800;">$pidkill</span>&quot;</span></pre></div></div>

<p>以上面列举的进程情况为例，你只需要执行一下</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sh</span> killtree.sh <span style="color: #000000;">19058</span></pre></div></div>

<p>就 OK 了</p>
</li>
<li><strong>场景2</strong><br />
你需要对服务器做一些操作，并且这个操作是需要每天做一次的。如果做成每日流程放入 crontab 那该多好呀。<br />
可是无情的 OP 和我说：“这台机子不允许非 OP 搭建每日流程，也不允许 OP 以外的人为该机器建立 ssh 的信任关系。”<br />
我顿时崩溃<img src="http://www.iron-feet.com/wp-content/plugins/wp-smiley-switcher/noktahhitam/icon_confused.gif" alt="" />。</p>
<p>我完全没法忍受，每天同一时间去手动地跑一个任务，太土鳖了！于是找了一下，发现了一个叫 expect 的东东！</p>
<p>根据 <a href="http://www.linuxmanpages.com/man1/expect.1.php" target="_blank" >Linux Man Page</a> ，expect 自动自动实现人机交互的操作，例如：输入密码、敲个 yes 什么的。</p>
<blockquote><p>
Expect is a program that &#8220;talks&#8221; to other interactive programs according to a script. Following the script, Expect knows what can be expected from a program and what the correct response should be. An interpreted language provides branching and high-level control structures to direct the dialogue. In addition, the user can take control and interact directly when desired, afterward returning control to the script.
</p></blockquote>
<p>大致了解了一下 expect 的语法，写了一个小脚本 ssh_auto.expect 来解决自动登录和发送命令的问题。</p>

<div class="wp_syntax"><div class="code"><pre class="expect" style="font-family:monospace;"># Author: Bill Wung
# url: http://www.iron-feet.com
set host [lindex $argv 0]
set cmd [lindex $argv 1]
set usr [lindex $argv 2]
set psw [lindex $argv 3]
&nbsp;
spawn ssh &quot;$usr@$host&quot; &quot;$cmd&quot;
&nbsp;
set timeout 5
expect {
	&quot;(yes/no)&quot; {
		send &quot;yes\r&quot;;
		exp_continue
	}
}
&nbsp;
set timeout 5
expect {
	&quot;id_rsa'&quot; {
        	send &quot;\r&quot;;
        	exp_continue
    	}
}
&nbsp;
set timeout 5
expect {
	&quot;Password:&quot; { 
		send &quot;$psw\r&quot;;
		exp_continue
	}
}
&nbsp;
set timeout 5
expect {
	&quot;password:&quot; {
        	send &quot;$psw\r&quot;;
        	exp_continue
	}
}
&nbsp;
exit</pre></div></div>

<p>由于该脚本是 expect 的脚本，所以执行的时候需要用 expect 调用。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">expect ssh_auto.expect 10.10.10.10 <span style="color: #ff0000;">&quot;cd /aa/bb; sh cc.sh; &quot;</span> root rootpassword
<span style="color: #666666; font-style: italic;"># 第一个参数是目标IP 第二个参数是执行的命令 第三个参数是用户名 第四个就是密码了</span></pre></div></div>

<p>由于很多 Linux 的发行版都不自带 expect ，所以部分用户需要自行安装一下 expect 才能调用该脚本。</p>
</li>
</ul>
<p>以上两个脚本，只是我平时使用，并考虑到太多的需求。<br />
我会在 Google Code 开一个项目，将我平时随手写的一些小脚本扔进去。各位如果觉得有用的话，可以使用；如果有什么建议的话，更是不吝赐教。</p>
<p>项目的地址是 <a href="http://code.google.com/p/iron-feet-tools/" target="_blank" >http://code.google.com/p/iron-feet-tools/</a> ，目前里面就两个脚本以后会越来越多的。</p>
<p>项目前几天刚建立， wiki 啊什么的改天再完善吧！</p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>January 18, 2010 -- <a href="http://www.iron-feet.com/it/one-alternative-method-to-surf/" title="One Alternative Method to Surf">One Alternative Method to Surf</a> (7)</li><li>December 2, 2010 -- <a href="http://www.iron-feet.com/it/data-recovery-from-ext3-file-system/" title="Data Recovery From Ext3 File System">Data Recovery From Ext3 File System</a> (6)</li><li>July 31, 2010 -- <a href="http://www.iron-feet.com/it/httpd-worker-confused-me/" title="Httpd.worker Confused Me">Httpd.worker Confused Me</a> (2)</li><li>December 4, 2008 -- <a href="http://www.iron-feet.com/it/lyrics-show-based-on-bash-script/" title="Lyrics Show Based on Bash Script">Lyrics Show Based on Bash Script</a> (0)</li></ul><hr />
<p><small>© Iron_Feet for <a href="http://www.iron-feet.com">风云阁</a>, 2011. |
<a href="http://www.iron-feet.com/it/little-tools-killtree-ssh_auto/">Permalink</a> |
<a href="http://www.iron-feet.com/it/little-tools-killtree-ssh_auto/#comments">2 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.iron-feet.com/it/little-tools-killtree-ssh_auto/&title=Little Tools: Killtree &#038; Ssh_auto">del.icio.us</a>
<br/>
Post tags: <a href="http://www.iron-feet.com/tag/bash/" rel="tag">Bash</a>, <a href="http://www.iron-feet.com/tag/expect/" rel="tag">expect</a>, <a href="http://www.iron-feet.com/tag/kill/" rel="tag">kill</a>, <a href="http://www.iron-feet.com/tag/ssh/" rel="tag">SSH</a><br/>
</small></p>
<p><a href="http://feedads.g.doubleclick.net/~a/7TQwP-2G-xsQPPmoY-wiTg9VCdM/0/da"><img src="http://feedads.g.doubleclick.net/~a/7TQwP-2G-xsQPPmoY-wiTg9VCdM/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/7TQwP-2G-xsQPPmoY-wiTg9VCdM/1/da"><img src="http://feedads.g.doubleclick.net/~a/7TQwP-2G-xsQPPmoY-wiTg9VCdM/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.iron-feet.com/it/little-tools-killtree-ssh_auto/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>From The Ad of IE 9</title>
		<link>http://www.iron-feet.com/it/from-the-ad-of-ie-9/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=from-the-ad-of-ie-9</link>
		<comments>http://www.iron-feet.com/it/from-the-ad-of-ie-9/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 15:40:32 +0000</pubDate>
		<dc:creator>Iron_Feet</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Browser]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://www.iron-feet.com/?p=3404</guid>
		<description><![CDATA[前几天在邮箱里面收到一封关于微软最近发布的新浏览器 IE9 的广告邮件，内容大致如下：

<blockquote>
你知道吗？
普通浏览器只用了电脑10%的运算能力！

全新的InternetExplorer 9 Bing 和 MSN 优化版，
90%电脑剩余运算能力被释放，充分利用多核CPU及显卡性能，让浏览速度更快！

更全面融合MSN资讯，Bing搜索便捷实用功能，
让生活更从容！
</blockquote>

看完这段文字，我觉得极度无语，不禁笑出了声。慢慢开始回忆我接触 Windows 系统以来，使用 IE 的经历。

IE 是从 Windows 95 升级版开始，同 Windows 系统捆绑发售登上历史舞台的。

虽然我最早接触的 Windows 系统是 Windows 3.1 （比 Windows 95 还早的版本） ，但是我对 Windows 95 升级版和 Windows 98 所捆绑的 IE 4 已经没有什么印象的。因为那会，在我老家，有着一排排电脑的营业场所，不叫“网吧”，而叫“电脑房”。大伙进去了过后，第一个打开的通常都是“红警 95 &#038; 98”、“仙剑”、“星际”、“帝国”等等游戏，压根不会去考虑在没有网络的情况下打开 IE ，而且那会绝大多数人可能都不知道 IE 原来是用来网页（我都想不起来，那会我是否知道“网页”是个什么玩意！）

直到 Windows 98 SE 慢慢主宰了我周围的电脑，我才知道慢慢开始使用 IE 5 。一直觉得 IE 4 和 IE 5 没有本质上的区别，唯一能想到的细微区别是：加载页面的时候，IE 5 的状态栏会展示一个动态的 e 符号；而 IE 4 展示的是一个动态的 Windows 徽标符号（突然觉得我好无聊，那时候怎么观察这个）！

说到 Windows 98 SE ，就会想到 Bill Gates 在发布 Windows 98 SE 时候曾经闹出过的<a href="http://v.youku.com/v_show/id_XNDM2Nzg5MDg=.html" target="_blank">笑话</a>。不可否认， Windows 98 具有高兼容性等等优势，但是 Windows 98 的确也是最受欢迎的几个 Windows 版本中死机和蓝屏率最高的。

它的高死机率大部分情况下都归功于 IE 。在使用 Windows 98 的时候，IE 遇到网络堵塞、或者复杂页面（比如：复杂 JS 、过多图片等等）的时候，就会卡死。而且 IE 一旦卡死，基本上整个 Windows 98 系统也会变得很慢或死机，严重的时候可能直接蓝屏。即使你侥幸把 IE 的进程 kill 掉了，系统速度恢复正常了，也会发现系统无法继续访问网络，不得不重启。其实想想这会很不如直接给个蓝屏，也免得用户折腾了好久最后还是要重启。其实这个问题一直到 XP 都还是经常出现的，这都是拜它捆绑的 IE 6 ，它不光折磨用户还折磨<a href="/activities-i-take-part-in/drop-ie6/" target="_blank">前端开发人员</a> :vangry: 

一个浏览器可以造成系统的迟缓、死机甚至是蓝屏，我可以想象到的最有可能的原因：
<ol>
    <li>占用 CPU 太高。
    一旦遇到复杂情况，就会长时间占用高 CPU ，导致其它进程无法分配到 CPU 时间。
    </li>
    <li>占用 内存 过高
    一旦遇到复杂情况，就会占据过多的内存，进而使用虚存，使得磁盘的速度无法满足对于页面文件过高的 IO 要求。
    </li>
</ol>

当然这两个可能性同时存在，那就更悲剧了。以往看到的浏览器评测或者是浏览器的广告，多数都是以低内存占用和低 CPU 占用为优势特性的；而 IE 9 真是别出心裁，提出“普通浏览器只用了电脑10%的运算能力！全新的InternetExplorer 9 Bing 和 MSN 优化版，90%电脑剩余运算能力被释放，充分利用多核CPU及显卡性能，让浏览速度更快！”的口号。

我们来想象一下，现在有一台机器运作着， 目前只剩 80% 的 CPU 属于 System Idle Process 即空闲状态。然后你打开一个 IE 9 ，嗖地 Internet Explorer 进程占用了 80% CPU。各位是不是觉得很可笑？如果打开是 Matlab ，并且这个 Matlab 再做运算，那也就忍了，毕竟运点运算是很占用 CPU 的；一个浏览器占用这么大的 CPU ，这也太扯淡了吧！

假如在这节骨眼上， IE 9 突然之间嗝屁了，死循环了。也许有人会说：“没这么点背吧。”那可难说，用 IE 有时还就是这么点背！由于 IE 9 占用了剩余的所有 CPU ，连开个任务管理器不能，那只能眼巴巴看着机器卡着被迫强行关机吧。

我们在考虑另外一种情况，有的程序员为了让自己的程序有比较好的稳定性，都会给程序做一个性能适应。它会根据用户机器的实时性能状况，来通过提高和降低运算速度以保证用户体验。

现在有个用户在一个剩余 80% CPU 的环境下启动了类似程序。程序启动后，看看系统状况，一乐：“哇哈哈。闲置了 80% 。”，立马占用了 70% 。随后这用户启动了 IE 9 ，嗖地 10% 被 IE 9 吞噬了。之前那个程序，心想：“好吧，系统资源这么紧张，我让出 10% 吧。”然后 IE 9 毫不客气地再占 10% 。就这么这放一点，那占一点，我咋觉得 IE 9 更像蠕虫病毒了！

在目前发行的浏览器中，我一直觉得 IE 和 Safari 是两大悲催浏览器。例如： Chrome 和 Firefox 等等浏览器，他们的覆盖率可以直接说明他们在浏览器市场的受欢迎程度；而 IE 和 Safari 覆盖率的变化，在更大程度上体现的是 Windows 和 MacOS 以及苹果设备的用户覆盖率。捆绑发售的方式大大地泯灭了他们的真正意义（希望这几句不会引起 Windows 迷和果粉的围攻 :???: ）

迄今为止，很少会有人说 IE 6 的高覆盖率是源于它的优秀，多数都是归结于 Windows XP 的成功。同样 Safari 的提升同样是由于苹果设备中 MacOS 的捆绑。我相信很少有人会用 Windows 版本的 Safari ，至少我体验过 Windows 版本的，真是很不好用。

+++++++++++++++++++++华丽的分割线+++++++++++++++++++
以上是我由 IE 9 广告词引出的一些想法，有扯淡有搞笑也有思考。各位同意的话就交流交流，如果觉得是扯淡的话就一笑了之吧，我不想引起什么口水战。

当然很多广告都是忽悠人的，不知道微软是不是也在忽悠人。我反倒希望这个广告是忽悠人的。当然 IE 9 也有不少让人期待的，比方说对标准的完美兼容、简洁的界面等等。

这几天 Google Reader 真是太抽风，好像 Feedsky 没法统计我的完整订阅量了，这直接导致我右侧订阅量变成了几十，太悲惨了！不知道其他博友有没有遇到这个情况 :o 不知道啥时候可以恢复，唉！

最后扯一下我的浏览器使用变化：
Windows: IE
Windows: Tencent Traveller （QQ浏览器前身， IE 内核）
Windows: Green Browser （IE 内核）
Windows: Opera 时间很短，纯属尝鲜
接下来开始接触 Linux
Windows &#038; Ubuntu: Firefox
Windows: Safari 纯属尝鲜; Ubuntu: Firefox
由于 Firefox 插件一多慢的可以，改用 Chrome， 但是 Linux 版本的迟迟未出，出现了下面的情况
Windows: Chrome; Ubuntu: Firefox
Windows: Chrome; Ubuntu: Chromium
加入了搜狗公司后，支持一下公司的产品，不过确实也很不错 :roll: 不知道这句话会不会被人喷“卖瓜”，其实压根称不上“自夸”啦，偶根本不是浏览器部门的！
Windows: Chrome &#038; 搜狗浏览器; Ubuntu: Chromium
最近突然发现 Chromium 发布了 Windows 版本，我毅然用上了，哇哈哈！
Windows: Chromium &#038; 搜狗浏览器; Ubuntu: Chromium]]></description>
			<content:encoded><![CDATA[<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://www.iron-feet.com/it/from-the-ad-of-ie-9/' t='From The Ad of IE 9' d='' tag='Browser,IE,Internet Explorer' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://www.iron-feet.com/wp-content/plugins/addthischina/a3.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
<p>前几天在邮箱里面收到一封关于微软最近发布的新浏览器 IE9 的广告邮件，内容大致如下：</p>
<blockquote><p>
你知道吗？<br />
普通浏览器只用了电脑10%的运算能力！</p>
<p>全新的InternetExplorer 9 Bing 和 MSN 优化版，<br />
90%电脑剩余运算能力被释放，充分利用多核CPU及显卡性能，让浏览速度更快！</p>
<p>更全面融合MSN资讯，Bing搜索便捷实用功能，<br />
让生活更从容！
</p></blockquote>
<p>看完这段文字，我觉得极度无语，不禁笑出了声。慢慢开始回忆我接触 Windows 系统以来，使用 IE 的经历。</p>
<p>IE 是从 Windows 95 升级版开始，同 Windows 系统捆绑发售登上历史舞台的。</p>
<p>虽然我最早接触的 Windows 系统是 Windows 3.1 （比 Windows 95 还早的版本） ，但是我对 Windows 95 升级版和 Windows 98 所捆绑的 IE 4 已经没有什么印象的。因为那会，在我老家，有着一排排电脑的营业场所，不叫“网吧”，而叫“电脑房”。大伙进去了过后，第一个打开的通常都是“红警 95 &#038; 98”、“仙剑”、“星际”、“帝国”等等游戏，压根不会去考虑在没有网络的情况下打开 IE ，而且那会绝大多数人可能都不知道 IE 原来是用来网页（我都想不起来，那会我是否知道“网页”是个什么玩意！）</p>
<p>直到 Windows 98 SE 慢慢主宰了我周围的电脑，我才知道慢慢开始使用 IE 5 。一直觉得 IE 4 和 IE 5 没有本质上的区别，唯一能想到的细微区别是：加载页面的时候，IE 5 的状态栏会展示一个动态的 e 符号；而 IE 4 展示的是一个动态的 Windows 徽标符号（突然觉得我好无聊，那时候怎么观察这个）！</p>
<p>说到 Windows 98 SE ，就会想到 Bill Gates 在发布 Windows 98 SE 时候曾经闹出过的<a href="http://v.youku.com/v_show/id_XNDM2Nzg5MDg=.html" target="_blank">笑话</a>。不可否认， Windows 98 具有高兼容性等等优势，但是 Windows 98 的确也是最受欢迎的几个 Windows 版本中死机和蓝屏率最高的。</p>
<p>它的高死机率大部分情况下都归功于 IE 。在使用 Windows 98 的时候，IE 遇到网络堵塞、或者复杂页面（比如：复杂 JS 、过多图片等等）的时候，就会卡死。而且 IE 一旦卡死，基本上整个 Windows 98 系统也会变得很慢或死机，严重的时候可能直接蓝屏。即使你侥幸把 IE 的进程 kill 掉了，系统速度恢复正常了，也会发现系统无法继续访问网络，不得不重启。其实想想这会很不如直接给个蓝屏，也免得用户折腾了好久最后还是要重启。其实这个问题一直到 XP 都还是经常出现的，这都是拜它捆绑的 IE 6 ，它不光折磨用户还折磨<a href="http://www.iron-feet.com/activities-i-take-part-in/drop-ie6/" target="_blank">前端开发人员</a> <img src="http://www.iron-feet.com/wp-content/plugins/wp-smiley-switcher/noktahhitam/icon_vangry.gif" alt="" /> </p>
<p>一个浏览器可以造成系统的迟缓、死机甚至是蓝屏，我可以想象到的最有可能的原因：</p>
<ol>
<li>占用 CPU 太高。<br />
    一旦遇到复杂情况，就会长时间占用高 CPU ，导致其它进程无法分配到 CPU 时间。
    </li>
<li>占用 内存 过高<br />
    一旦遇到复杂情况，就会占据过多的内存，进而使用虚存，使得磁盘的速度无法满足对于页面文件过高的 IO 要求。
    </li>
</ol>
<p>当然这两个可能性同时存在，那就更悲剧了。以往看到的浏览器评测或者是浏览器的广告，多数都是以低内存占用和低 CPU 占用为优势特性的；而 IE 9 真是别出心裁，提出“普通浏览器只用了电脑10%的运算能力！全新的InternetExplorer 9 Bing 和 MSN 优化版，90%电脑剩余运算能力被释放，充分利用多核CPU及显卡性能，让浏览速度更快！”的口号。</p>
<p>我们来想象一下，现在有一台机器运作着， 目前只剩 80% 的 CPU 属于 System Idle Process 即空闲状态。然后你打开一个 IE 9 ，嗖地 Internet Explorer 进程占用了 80% CPU。各位是不是觉得很可笑？如果打开是 Matlab ，并且这个 Matlab 再做运算，那也就忍了，毕竟运点运算是很占用 CPU 的；一个浏览器占用这么大的 CPU ，这也太扯淡了吧！</p>
<p>假如在这节骨眼上， IE 9 突然之间嗝屁了，死循环了。也许有人会说：“没这么点背吧。”那可难说，用 IE 有时还就是这么点背！由于 IE 9 占用了剩余的所有 CPU ，连开个任务管理器不能，那只能眼巴巴看着机器卡着被迫强行关机吧。</p>
<p>我们在考虑另外一种情况，有的程序员为了让自己的程序有比较好的稳定性，都会给程序做一个性能适应。它会根据用户机器的实时性能状况，来通过提高和降低运算速度以保证用户体验。</p>
<p>现在有个用户在一个剩余 80% CPU 的环境下启动了类似程序。程序启动后，看看系统状况，一乐：“哇哈哈。闲置了 80% 。”，立马占用了 70% 。随后这用户启动了 IE 9 ，嗖地 10% 被 IE 9 吞噬了。之前那个程序，心想：“好吧，系统资源这么紧张，我让出 10% 吧。”然后 IE 9 毫不客气地再占 10% 。就这么这放一点，那占一点，我咋觉得 IE 9 更像蠕虫病毒了！</p>
<p>在目前发行的浏览器中，我一直觉得 IE 和 Safari 是两大悲催浏览器。例如： Chrome 和 Firefox 等等浏览器，他们的覆盖率可以直接说明他们在浏览器市场的受欢迎程度；而 IE 和 Safari 覆盖率的变化，在更大程度上体现的是 Windows 和 MacOS 以及苹果设备的用户覆盖率。捆绑发售的方式大大地泯灭了他们的真正意义（希望这几句不会引起 Windows 迷和果粉的围攻 <img src="http://www.iron-feet.com/wp-content/plugins/wp-smiley-switcher/noktahhitam/icon_confused.gif" alt="" /> ）</p>
<p>迄今为止，很少会有人说 IE 6 的高覆盖率是源于它的优秀，多数都是归结于 Windows XP 的成功。同样 Safari 的提升同样是由于苹果设备中 MacOS 的捆绑。我相信很少有人会用 Windows 版本的 Safari ，至少我体验过 Windows 版本的，真是很不好用。</p>
<p>+++++++++++++++++++++华丽的分割线+++++++++++++++++++<br />
以上是我由 IE 9 广告词引出的一些想法，有扯淡有搞笑也有思考。各位同意的话就交流交流，如果觉得是扯淡的话就一笑了之吧，我不想引起什么口水战。</p>
<p>当然很多广告都是忽悠人的，不知道微软是不是也在忽悠人。我反倒希望这个广告是忽悠人的。当然 IE 9 也有不少让人期待的，比方说对标准的完美兼容、简洁的界面等等。</p>
<p>这几天 Google Reader 真是太抽风，好像 Feedsky 没法统计我的完整订阅量了，这直接导致我右侧订阅量变成了几十，太悲惨了！不知道其他博友有没有遇到这个情况 <img src="http://www.iron-feet.com/wp-content/plugins/wp-smiley-switcher/noktahhitam/icon_surprised.gif" alt="" /> 不知道啥时候可以恢复，唉！</p>
<p>最后扯一下我的浏览器使用变化：<br />
Windows: IE<br />
Windows: Tencent Traveller （QQ浏览器前身， IE 内核）<br />
Windows: Green Browser （IE 内核）<br />
Windows: Opera 时间很短，纯属尝鲜<br />
接下来开始接触 Linux<br />
Windows &#038; Ubuntu: Firefox<br />
Windows: Safari 纯属尝鲜; Ubuntu: Firefox<br />
由于 Firefox 插件一多慢的可以，改用 Chrome， 但是 Linux 版本的迟迟未出，出现了下面的情况<br />
Windows: Chrome; Ubuntu: Firefox<br />
Windows: Chrome; Ubuntu: Chromium<br />
加入了搜狗公司后，支持一下公司的产品，不过确实也很不错 <img src="http://www.iron-feet.com/wp-content/plugins/wp-smiley-switcher/noktahhitam/icon_rolleyes.gif" alt="" /> 不知道这句话会不会被人喷“卖瓜”，其实压根称不上“自夸”啦，偶根本不是浏览器部门的！<br />
Windows: Chrome &#038; 搜狗浏览器; Ubuntu: Chromium<br />
最近突然发现 Chromium 发布了 Windows 版本，我毅然用上了，哇哈哈！<br />
Windows: Chromium &#038; 搜狗浏览器; Ubuntu: Chromium</p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>January 28, 2010 -- <a href="http://www.iron-feet.com/it/can-html5-easily-be-a-standard/" title="Can HTML5 Easily Be a Standard?">Can HTML5 Easily Be a Standard?</a> (10)</li><li>September 3, 2008 -- <a href="http://www.iron-feet.com/it/google-chrome/" title="Google Chrome">Google Chrome</a> (5)</li></ul><hr />
<p><small>© Iron_Feet for <a href="http://www.iron-feet.com">风云阁</a>, 2011. |
<a href="http://www.iron-feet.com/it/from-the-ad-of-ie-9/">Permalink</a> |
<a href="http://www.iron-feet.com/it/from-the-ad-of-ie-9/#comments">8 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.iron-feet.com/it/from-the-ad-of-ie-9/&title=From The Ad of IE 9">del.icio.us</a>
<br/>
Post tags: <a href="http://www.iron-feet.com/tag/browser/" rel="tag">Browser</a>, <a href="http://www.iron-feet.com/tag/ie/" rel="tag">IE</a>, <a href="http://www.iron-feet.com/tag/internet-explorer/" rel="tag">Internet Explorer</a><br/>
</small></p>
<p><a href="http://feedads.g.doubleclick.net/~a/LSZAZijL0S5jRGwyAVAVwEzhcMU/0/da"><img src="http://feedads.g.doubleclick.net/~a/LSZAZijL0S5jRGwyAVAVwEzhcMU/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/LSZAZijL0S5jRGwyAVAVwEzhcMU/1/da"><img src="http://feedads.g.doubleclick.net/~a/LSZAZijL0S5jRGwyAVAVwEzhcMU/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.iron-feet.com/it/from-the-ad-of-ie-9/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>More Scared Than Hurt</title>
		<link>http://www.iron-feet.com/essay/more-scared-than-hurt/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=more-scared-than-hurt</link>
		<comments>http://www.iron-feet.com/essay/more-scared-than-hurt/#comments</comments>
		<pubDate>Tue, 08 Mar 2011 14:19:00 +0000</pubDate>
		<dc:creator>Iron_Feet</dc:creator>
				<category><![CDATA[Essay]]></category>
		<category><![CDATA[Mother]]></category>

		<guid isPermaLink="false">http://www.iron-feet.com/?p=3398</guid>
		<description><![CDATA[由于本人身体欠佳，昨天很悲催地去医院走了一趟。当然本文要说的显然不会是我看病的过程。

昨天等我做完一系列检查，输完液出了医院后，就打了个电话约 Dorothy 出来吃饭。随后，我无聊地站在路边拿出了 Kindle 边看书边等她。

看了一会，我抬头想看看 Dorothy 出现没。 Dorothy 倒是没看见，但眼前的景象却着实吓了我一大跳：街对面，一个估计刚刚学会走路没多久的娃娃，跌跌撞撞地从一个饭馆门口横穿马路，直朝我走来。

我当时惊呆了！当我回过神来的时候，那个小孩已经走到马路中央红绿灯口；更恐怖的是：这个时候，红灯变绿灯，公交和轿车不停地滴滴并开过。那个孩子毫不畏惧地在轿车中穿行过马路。我都快一身冷汗了，赶紧跑过去，一只手拿着 Kindle ，另外一只手把小孩从马路上拎到了路边。

这时候我才有心情看一下街对面。此时，看见对面孩子母亲（我猜的，具体是不是我真是极度怀疑）一直原地跺脚，一脸地着急，却迟迟不愿意过来抱孩子（此时横向道还是绿灯，不断有车子开过）。看她的样子应该是正打算去一家新疆餐馆吃饭的，那家店的一个伙计朝我慢慢走来，对我说了声“谢谢”，然后把孩子抱走了。我一直看着那个伙计把孩子抱回去并交还到那个女的手里，同时看到那个女子对伙计说谢谢，并进了店里吃饭。然后我继续看起 Kindle 。

虽然我依然看着 Kindle ，心情和之前却完全不一样了。一个母亲竟然做到了这个份上，自己的孩子在马路中央穿梭于机动车之间，竟然只会傻傻地在路边干着急，把希望寄托在两个陌生男人身上，太扯了。万一我和那个伙计有一个是人贩子，抱着就走了，不知道她会不会闯红灯追来。

今天是三八妇女节，按理说发这个似乎不太合适，当个母亲也不容易。但是昨天这一幕让我实在是震惊~

当然，祝福还是需要的：祝各位女性朋友们节日快乐，永远幸福美丽！]]></description>
			<content:encoded><![CDATA[<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://www.iron-feet.com/essay/more-scared-than-hurt/' t='More Scared Than Hurt' d='' tag='Mother' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://www.iron-feet.com/wp-content/plugins/addthischina/a3.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
<p>由于本人身体欠佳，昨天很悲催地去医院走了一趟。当然本文要说的显然不会是我看病的过程。</p>
<p>昨天等我做完一系列检查，输完液出了医院后，就打了个电话约 Dorothy 出来吃饭。随后，我无聊地站在路边拿出了 Kindle 边看书边等她。</p>
<p>看了一会，我抬头想看看 Dorothy 出现没。 Dorothy 倒是没看见，但眼前的景象却着实吓了我一大跳：街对面，一个估计刚刚学会走路没多久的娃娃，跌跌撞撞地从一个饭馆门口横穿马路，直朝我走来。</p>
<p>我当时惊呆了！当我回过神来的时候，那个小孩已经走到马路中央红绿灯口；更恐怖的是：这个时候，红灯变绿灯，公交和轿车不停地滴滴并开过。那个孩子毫不畏惧地在轿车中穿行过马路。我都快一身冷汗了，赶紧跑过去，一只手拿着 Kindle ，另外一只手把小孩从马路上拎到了路边。</p>
<p>这时候我才有心情看一下街对面。此时，看见对面孩子母亲（我猜的，具体是不是我真是极度怀疑）一直原地跺脚，一脸地着急，却迟迟不愿意过来抱孩子（此时横向道还是绿灯，不断有车子开过）。看她的样子应该是正打算去一家新疆餐馆吃饭的，那家店的一个伙计朝我慢慢走来，对我说了声“谢谢”，然后把孩子抱走了。我一直看着那个伙计把孩子抱回去并交还到那个女的手里，同时看到那个女子对伙计说谢谢，并进了店里吃饭。然后我继续看起 Kindle 。</p>
<p>虽然我依然看着 Kindle ，心情和之前却完全不一样了。一个母亲竟然做到了这个份上，自己的孩子在马路中央穿梭于机动车之间，竟然只会傻傻地在路边干着急，把希望寄托在两个陌生男人身上，太扯了。万一我和那个伙计有一个是人贩子，抱着就走了，不知道她会不会闯红灯追来。</p>
<p>今天是三八妇女节，按理说发这个似乎不太合适，当个母亲也不容易。但是昨天这一幕让我实在是震惊~</p>
<p>当然，祝福还是需要的：祝各位女性朋友们节日快乐，永远幸福美丽！</p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>March 1, 2006 -- <a href="http://www.iron-feet.com/sth-in-my-heart/mad-mother/" title="[转]疯娘(太感人了)">[转]疯娘(太感人了)</a> (4)</li></ul><hr />
<p><small>© Iron_Feet for <a href="http://www.iron-feet.com">风云阁</a>, 2011. |
<a href="http://www.iron-feet.com/essay/more-scared-than-hurt/">Permalink</a> |
<a href="http://www.iron-feet.com/essay/more-scared-than-hurt/#comments">16 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.iron-feet.com/essay/more-scared-than-hurt/&title=More Scared Than Hurt">del.icio.us</a>
<br/>
Post tags: <a href="http://www.iron-feet.com/tag/mother/" rel="tag">Mother</a><br/>
</small></p>
<p><a href="http://feedads.g.doubleclick.net/~a/j8KtfnCYo6BMrxxrzrOtGejNoek/0/da"><img src="http://feedads.g.doubleclick.net/~a/j8KtfnCYo6BMrxxrzrOtGejNoek/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/j8KtfnCYo6BMrxxrzrOtGejNoek/1/da"><img src="http://feedads.g.doubleclick.net/~a/j8KtfnCYo6BMrxxrzrOtGejNoek/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.iron-feet.com/essay/more-scared-than-hurt/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>QR Code</title>
		<link>http://www.iron-feet.com/it/qr-code/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=qr-code</link>
		<comments>http://www.iron-feet.com/it/qr-code/#comments</comments>
		<pubDate>Sat, 29 Jan 2011 12:14:16 +0000</pubDate>
		<dc:creator>Iron_Feet</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[QR code]]></category>

		<guid isPermaLink="false">http://www.iron-feet.com/?p=3378</guid>
		<description><![CDATA[前段时间，我的二手黑莓终于寿终正寝了。对于我这种天天要面对无数告警短信的挨踢民工而言，没有手机是万万不能的，于是乎近期入手了一枚 Android 系统的手机（其实是两枚，其中细节不提也罢，多说伤心 :cry: ）

以前我一直认为手机摄像头是个很鸡肋的东西，于是在选购二手黑莓的时候，我选择了一台没有摄像头的型号。然而近期二维码的慢慢流行，使得手机的摄像头又多了一个用处。拿到了新手机后，我立马对二维码了解了一下，发现二维码真是用于向移动设备传输数据的神器啊！

二维码，不同于常见的一维条形码，目前在大陆并不是很常见，但是仔细观察还是可以发现的，比如说火车票等等。

根据 <a href="http://en.wikipedia.org/wiki/QR_Code" target="_blank">wikipedia</a> 的描述：
<blockquote>A QR Code is a specific matrix barcode (or two-dimensional code), readable by dedicated QR Barcode reader and camera phones. The code consists of black modules arranged in a square pattern on a white background. The information encoded can be text, URL or other data.</blockquote>
如上所说，二维码可以保存很多信息，在很多方面可以发挥作用，尤其是对于输入长文字和标点的移动设备而言，简直是个福音。
<ol>
	<li>当你看到一段很赞的文字，想把它摘抄下来。如果提供了这段文字对应的 QR code 时，你就不需要把他打出来，而是像下面一样方便操作就行了。
<img src="/wp-content/uploads/qr/txt.png" alt="txt qr" />
<font color="red">注：左上角是用摄像头拍摄的 QR 图片</font>
</li>
	<li>当你在看书的时候，发现一个网址想用手机打开看看，如果书里面提供了包含该网址信息的 QR code 时，你就不需要再繁琐地输入网址，而是像下面一样方便操作就行了。
<img src="/wp-content/uploads/qr/url.png" alt="url qr" />
</li>
	<li>当你想用手机记录一个朋友的通讯录，如果你的朋友向你提供了包含通讯录的 QR code ，你就不再需要一个字一个字的输入通讯录，而像下图这么方便。
<img src="/wp-content/uploads/qr/vcard.png" alt="vcard qr" />
</li>

</ol>
其实二维码方便的地方还有很多，这个只是九牛一毛而已。

通过调用 Google Chart Tools / Image Charts 的 <a href="http://code.google.com/apis/chart/docs/gallery/qr_codes.html" target="_blank">API</a> ，我们可以很方便的生成。

调用方式也很简单，只要向 http://chart.apis.google.com/chart 传入适合的参数就可以了，参数如下：
<ol>
	<li>cht=qr
这个是必需的，告诉 API ，你需要生成的是二维码。</li>
	<li>chs=&#60;<em>width</em>&#62;x&#60;<em>height</em>&#62;
这个同样是必需的，告诉 API ，你需要生成的二维码的尺寸。</li>
	<li>chl=&#60;<em>data</em>&#62;
这个还是必需的，用来告诉 API 二维码所包含的信息。</li>
	<li>choe=&#60;<em>output_encoding</em>&#62;
终于来了个不是必须的，这个是用来声明生成的二维码所包含信息的编码，默认是 UTF-8 ；其他可选编码是 Shift_JIS 、 ISO-8859-1</li>
	<li>chld=&#60;<em>error_correction_level</em>&#62;&#124;&#60;<em>margin</em>&#62;
可选参数：
error_correction_level 感觉用处不是很大，不再赘述，具体可以参见<a href="http://code.google.com/apis/chart/docs/gallery/qr_codes.html" target="_blank">此处</a>
margin 是指生成的二维码离图片边框的距离</li>
</ol>

我们可以按照上面的参数，先构造生成一个简单的二维码出来，如下：
<pre lang="html4strict">
http://chart.apis.google.com/chart?chs=100x100&#038;cht=qr&#038;chl=%E9%A3%8E%E4%BA%91%E9%98%81&#038;choe=UTF-8
</pre>
其中 %E9%A3%8E%E4%BA%91%E9%98%81 是“风云阁”经过 UrlEncode 后的编码，可以通过本站<a href="http://www.iron-feet.com/tools/encoding-decoding/" target="_blank">此处</a>进行编码

此 URL 就可以生成上面第一张图片的二维码，用相关软件解码后即可以得到“风云阁”这个文本。

上面的图二中网络书签就可以通过 
<pre lang="html4strict">
http://chart.apis.google.com/chart?chs=150x150&#038;cht=qr&#038;chl=URLTO:www.iron-feet.com&#038;choe=UTF-8
</pre> 
来生成。

图三的名片同样不在话下，
<pre lang="html4strict">
http://chart.apis.google.com/chart?chs=500x500&#038;cht=qr&#038;chl=BEGIN:VCARD%0AVERSION:3.0%0AN:Bill;Wung%0AFN:Bill%20Wung%0AORG:%E5%8C%97%E4%BA%AC%E6%90%9C%E7%8B%97%E7%A7%91%E6%8A%80%E5%8F%91%E5%B1%95%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%0ATITLE:%E5%8A%A9%E7%90%86%E7%A0%94%E7%A9%B6%E5%91%98%0APHOTO;VALUE=URL;TYPE=GIF:http://www.site.com/dir_photos/my_photo.gif%0AEMAIL;TYPE=PREF,INTERNET:iron_feet@hotmail.com%0AEND:VCARD&#038;choe=UTF-8
</pre> 
可以生成你所需要的名片 QR 。

名片的格式相对而言比较复杂，采用的是 vCard 格式。

<blockquote>
vCard is a file format standard for electronic business cards. vCards are often attached to e-mail messages, but can be exchanged in other ways, such as on the World Wide Web or Instant Messaging. They can contain name and address information, phone numbers, e-mail addresses, URLs, logos, photographs, and even audio clips.
</blockquote>

比方说，图三的名片采用的是 vCard 3.0 的格式，如下：

<blockquote>
BEGIN:VCARD
VERSION:3.0
N:Bill;Wung
FN:Bill Wung
ORG:北京搜狗科技发展有限公司
TITLE:助理研究员
PHOTO;VALUE=URL;TYPE=JPEG:http://www.gravatar.com/avatar/27026e1c60e2659f3350af30b78565b0?s=80
EMAIL;TYPE=PREF,INTERNET:iron_feet@hotmail.com
END:VCARD
</blockquote>

可以看出， N 表示的是姓名， ORG 表示的是公司， TITLE 表示的是职位等等，当然还有很多可以加入名片的，如电话等等，具体可以参见<a href="http://en.wikipedia.org/wiki/VCard" target="_blank">此处</a>

写入 chl 参数的时候，我们同样需要对这个名片进行一下预处理，首先中文是必须 UrlEncode 一下，同时换行需要用 %0A 替代。

其实 QR 的用途还远远不止上面我所提到的，它还可以用来记录短信、彩信、WIFI热点、 Android 市场 、日历约会、地理位置等等。

如果你有兴趣的话，可以到该<a href="http://code.google.com/p/zxing/wiki/BarcodeContents" target="_blank">页面</a>深入研究]]></description>
			<content:encoded><![CDATA[<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://www.iron-feet.com/it/qr-code/' t='QR Code' d='' tag='QR code' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://www.iron-feet.com/wp-content/plugins/addthischina/a3.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
<p>前段时间，我的二手黑莓终于寿终正寝了。对于我这种天天要面对无数告警短信的挨踢民工而言，没有手机是万万不能的，于是乎近期入手了一枚 Android 系统的手机（其实是两枚，其中细节不提也罢，多说伤心 <img src="http://www.iron-feet.com/wp-content/plugins/wp-smiley-switcher/noktahhitam/icon_cry.gif" alt="" /> ）</p>
<p>以前我一直认为手机摄像头是个很鸡肋的东西，于是在选购二手黑莓的时候，我选择了一台没有摄像头的型号。然而近期二维码的慢慢流行，使得手机的摄像头又多了一个用处。拿到了新手机后，我立马对二维码了解了一下，发现二维码真是用于向移动设备传输数据的神器啊！</p>
<p>二维码，不同于常见的一维条形码，目前在大陆并不是很常见，但是仔细观察还是可以发现的，比如说火车票等等。</p>
<p>根据 <a href="http://en.wikipedia.org/wiki/QR_Code" target="_blank">wikipedia</a> 的描述：</p>
<blockquote><p>A QR Code is a specific matrix barcode (or two-dimensional code), readable by dedicated QR Barcode reader and camera phones. The code consists of black modules arranged in a square pattern on a white background. The information encoded can be text, URL or other data.</p></blockquote>
<p>如上所说，二维码可以保存很多信息，在很多方面可以发挥作用，尤其是对于输入长文字和标点的移动设备而言，简直是个福音。</p>
<ol>
<li>当你看到一段很赞的文字，想把它摘抄下来。如果提供了这段文字对应的 QR code 时，你就不需要把他打出来，而是像下面一样方便操作就行了。<br />
<img src="/wp-content/uploads/qr/txt.png" alt="txt qr" /><br />
<font color="red">注：左上角是用摄像头拍摄的 QR 图片</font>
</li>
<li>当你在看书的时候，发现一个网址想用手机打开看看，如果书里面提供了包含该网址信息的 QR code 时，你就不需要再繁琐地输入网址，而是像下面一样方便操作就行了。<br />
<img src="/wp-content/uploads/qr/url.png" alt="url qr" />
</li>
<li>当你想用手机记录一个朋友的通讯录，如果你的朋友向你提供了包含通讯录的 QR code ，你就不再需要一个字一个字的输入通讯录，而像下图这么方便。<br />
<img src="/wp-content/uploads/qr/vcard.png" alt="vcard qr" />
</li>
</ol>
<p>其实二维码方便的地方还有很多，这个只是九牛一毛而已。</p>
<p>通过调用 Google Chart Tools / Image Charts 的 <a href="http://code.google.com/apis/chart/docs/gallery/qr_codes.html" target="_blank">API</a> ，我们可以很方便的生成。</p>
<p>调用方式也很简单，只要向 http://chart.apis.google.com/chart 传入适合的参数就可以了，参数如下：</p>
<ol>
<li>cht=qr<br />
这个是必需的，告诉 API ，你需要生成的是二维码。</li>
<li>chs=&lt;<em>width</em>&gt;x&lt;<em>height</em>&gt;<br />
这个同样是必需的，告诉 API ，你需要生成的二维码的尺寸。</li>
<li>chl=&lt;<em>data</em>&gt;<br />
这个还是必需的，用来告诉 API 二维码所包含的信息。</li>
<li>choe=&lt;<em>output_encoding</em>&gt;<br />
终于来了个不是必须的，这个是用来声明生成的二维码所包含信息的编码，默认是 UTF-8 ；其他可选编码是 Shift_JIS 、 ISO-8859-1</li>
<li>chld=&lt;<em>error_correction_level</em>&gt;|&lt;<em>margin</em>&gt;<br />
可选参数：<br />
error_correction_level 感觉用处不是很大，不再赘述，具体可以参见<a href="http://code.google.com/apis/chart/docs/gallery/qr_codes.html" target="_blank">此处</a><br />
margin 是指生成的二维码离图片边框的距离</li>
</ol>
<p>我们可以按照上面的参数，先构造生成一个简单的二维码出来，如下：</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">http://chart.apis.google.com/chart?chs=100x100<span style="color: #ddbb00;">&amp;cht=qr&amp;chl=%E9%A3%8E%E4%BA%91%E9%98%81&amp;choe=UTF-8</span></pre></div></div>

<p>其中 %E9%A3%8E%E4%BA%91%E9%98%81 是“风云阁”经过 UrlEncode 后的编码，可以通过本站<a href="http://www.iron-feet.com/tools/encoding-decoding/" target="_blank">此处</a>进行编码</p>
<p>此 URL 就可以生成上面第一张图片的二维码，用相关软件解码后即可以得到“风云阁”这个文本。</p>
<p>上面的图二中网络书签就可以通过</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">http://chart.apis.google.com/chart?chs=150x150<span style="color: #ddbb00;">&amp;cht=qr&amp;chl=URLTO:www.iron-feet.com&amp;choe=UTF-8</span></pre></div></div>

<p>来生成。</p>
<p>图三的名片同样不在话下，</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">http://chart.apis.google.com/chart?chs=500x500<span style="color: #ddbb00;">&amp;cht=qr&amp;chl=BEGIN:VCARD%0AVERSION:3.0%0AN:Bill;</span>Wung%0AFN:Bill%20Wung%0AORG:%E5%8C%97%E4%BA%AC%E6%90%9C%E7%8B%97%E7%A7%91%E6%8A%80%E5%8F%91%E5%B1%95%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8%0ATITLE:%E5%8A%A9%E7%90%86%E7%A0%94%E7%A9%B6%E5%91%98%0APHOTO;VALUE=URL;TYPE=GIF:http://www.site.com/dir_photos/my_photo.gif%0AEMAIL;TYPE=PREF,INTERNET:iron_feet@hotmail.com%0AEND:VCARD<span style="color: #ddbb00;">&amp;choe=UTF-8</span></pre></div></div>

<p>可以生成你所需要的名片 QR 。</p>
<p>名片的格式相对而言比较复杂，采用的是 vCard 格式。</p>
<blockquote><p>
vCard is a file format standard for electronic business cards. vCards are often attached to e-mail messages, but can be exchanged in other ways, such as on the World Wide Web or Instant Messaging. They can contain name and address information, phone numbers, e-mail addresses, URLs, logos, photographs, and even audio clips.
</p></blockquote>
<p>比方说，图三的名片采用的是 vCard 3.0 的格式，如下：</p>
<blockquote><p>
BEGIN:VCARD<br />
VERSION:3.0<br />
N:Bill;Wung<br />
FN:Bill Wung<br />
ORG:北京搜狗科技发展有限公司<br />
TITLE:助理研究员<br />
PHOTO;VALUE=URL;TYPE=JPEG:http://www.gravatar.com/avatar/27026e1c60e2659f3350af30b78565b0?s=80<br />
EMAIL;TYPE=PREF,INTERNET:iron_feet@hotmail.com<br />
END:VCARD
</p></blockquote>
<p>可以看出， N 表示的是姓名， ORG 表示的是公司， TITLE 表示的是职位等等，当然还有很多可以加入名片的，如电话等等，具体可以参见<a href="http://en.wikipedia.org/wiki/VCard" target="_blank">此处</a></p>
<p>写入 chl 参数的时候，我们同样需要对这个名片进行一下预处理，首先中文是必须 UrlEncode 一下，同时换行需要用 %0A 替代。</p>
<p>其实 QR 的用途还远远不止上面我所提到的，它还可以用来记录短信、彩信、WIFI热点、 Android 市场 、日历约会、地理位置等等。</p>
<p>如果你有兴趣的话，可以到该<a href="http://code.google.com/p/zxing/wiki/BarcodeContents" target="_blank">页面</a>深入研究</p>
<h2  class="related_post_title">Random Posts</h2><ul class="related_post"><li>December 23, 2008 -- <a href="http://www.iron-feet.com/still-a-student/life-in-gucas/starting-point/" title="Starting Point">Starting Point</a> (0)</li><li>October 31, 2006 -- <a href="http://www.iron-feet.com/still-a-student/life-in-jnusytu/last-formality/" title="最差最后一个手续了">最差最后一个手续了</a> (2)</li><li>June 20, 2008 -- <a href="http://www.iron-feet.com/entertainment/music-song/lion-king-112/" title="Lion King 11/2">Lion King 11/2</a> (0)</li><li>April 8, 2009 -- <a href="http://www.iron-feet.com/still-a-student/life-in-gucas/meet-han-hong-again-occasionally/" title="Meet Han Hong Again Occasionally">Meet Han Hong Again Occasionally</a> (2)</li><li>July 5, 2008 -- <a href="http://www.iron-feet.com/sth-in-my-heart/friends/" title="Friends">Friends</a> (1)</li><li>May 16, 2008 -- <a href="http://www.iron-feet.com/sth-in-my-heart/baby-i-love-you/" title="[转]宝宝，妈妈会一直佑护你">[转]宝宝，妈妈会一直佑护你</a> (1)</li><li>April 5, 2006 -- <a href="http://www.iron-feet.com/sth-in-my-heart/da-fei-awakes/" title="大飞终于醒来了!">大飞终于醒来了!</a> (6)</li><li>June 15, 2007 -- <a href="http://www.iron-feet.com/still-a-student/life-in-jnusytu/wait-for-graduation/" title="等待毕业">等待毕业</a> (1)</li><li>September 19, 2006 -- <a href="http://www.iron-feet.com/still-a-student/life-in-jnusytu/my-lost-bike/" title="不知道是我背还是小偷背">不知道是我背还是小偷背</a> (2)</li><li>May 14, 2008 -- <a href="http://www.iron-feet.com/sth-in-my-heart/a-student-in-sichuan/" title="终于又联系上了一个四川的同学">终于又联系上了一个四川的同学</a> (0)</li></ul><hr />
<p><small>© Iron_Feet for <a href="http://www.iron-feet.com">风云阁</a>, 2011. |
<a href="http://www.iron-feet.com/it/qr-code/">Permalink</a> |
<a href="http://www.iron-feet.com/it/qr-code/#comments">4 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.iron-feet.com/it/qr-code/&title=QR Code">del.icio.us</a>
<br/>
Post tags: <a href="http://www.iron-feet.com/tag/qr-code/" rel="tag">QR code</a><br/>
</small></p>
<p><a href="http://feedads.g.doubleclick.net/~a/3erbMf6Ear7ckzqX7FPpzA5FOpg/0/da"><img src="http://feedads.g.doubleclick.net/~a/3erbMf6Ear7ckzqX7FPpzA5FOpg/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/3erbMf6Ear7ckzqX7FPpzA5FOpg/1/da"><img src="http://feedads.g.doubleclick.net/~a/3erbMf6Ear7ckzqX7FPpzA5FOpg/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.iron-feet.com/it/qr-code/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Data Recovery From Ext3 File System</title>
		<link>http://www.iron-feet.com/it/data-recovery-from-ext3-file-system/?utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=data-recovery-from-ext3-file-system</link>
		<comments>http://www.iron-feet.com/it/data-recovery-from-ext3-file-system/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 02:37:14 +0000</pubDate>
		<dc:creator>Iron_Feet</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Life in Sogou (Sohu-RD)]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[ext3]]></category>
		<category><![CDATA[ext3grep]]></category>
		<category><![CDATA[recovery]]></category>

		<guid isPermaLink="false">http://www.iron-feet.com/?p=3356</guid>
		<description><![CDATA[以前总是在网上看到很多人问怎么恢复 Linux 分区下误删的文件。当时并没有仔细关注过，真没想到昨天这事摊我身上了。

大致说说这场悲剧的整个过程吧（为了避免一些不必要的麻烦，本文中的文件夹名和设备名都作了修改）

当时我的工作目录是 /source/needrecovered 。
<pre lang="bash">
$ pwd
/source/needrecovered
</pre>

原本打算清空其中的一个子文件
<pre lang="bash">
$ rm -rf canbedeleted/*
</pre>
却把命令给打错了。
<pre lang="bash">
$ rm -rf canbedeleted/ *
</pre>

当时我琢磨着今天怎么删个小文件夹这么慢呢。等我仔细看了下命令，反应过来的时候，已经太迟了。整个工作目录被清空了 :cry: 

没辙了，只能先到网上找找解决方案了，网上大致提到的方法有两种：一种是利用 debugfs ；第二种是<a href="http://www.xs4all.nl/~carlo17/howto/undelete_ext3.html" target="_blank">利用 ext3grep </a>。第一种方法，我尝试了若干次都以失败告终，第二种成功了。但是统一的是：两种方法首先提到的都是将对该分区进行操作的应用先全部关闭，具体如下：
<font color="red">以下的操作尽量使用 root 操作，以提高数据恢复的成功率</font>
<pre lang="bash">
#该命令用于列出操作该分区的进程
fuser -v -m /source
#如果没有很重要的进程，利用下面的命令将其全部 kill 掉
fuser -k -v -m /source
</pre>
<font color="red">执行上面那个命令的时候，务必要将你的工作目录切换到 /source 以外，否则你的 sshd 会被 kill 掉</font>

这样子可以达到两个好处：
<ol>
	<li>防止新的文件操作影响数据的恢复</li>
	<li>方便对磁盘或者分区进行进一步的操作
如： mount 和 umount</li>
</ol>

接下来我们看看磁盘分区情况
<pre lang="bash">
$ df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda8     ext3    7.9G  6.3G  1.2G  84% /source
/dev/sdb1  fuseblk    299G  266G   33G  90% /data/
</pre>
需要恢复的分区是 /dev/sda8 ，挂载点是 /source 。

先将此分区卸载，并在 /data 分区建立一个用于存储备份数据的文件夹
<pre lang="bash">
umount -v /source
mkdir -p /data/recovery
</pre>

现在轮到主角登场了，先去下载一份 <a target="_blank" href="http://code.google.com/p/ext3grep/">ext3grep</a> 的源码，并安装
<pre lang="bash">
cd /data/recovery
#此链接地址以官网最新版本为准
wget http://ext3grep.googlecode.com/files/ext3grep-0.10.2.tar.gz
tar xfz ext3grep-0.10.2.tar.gz
cd ext3grep-0.10.2
./configure --prefix=/data/recovery
make
make install
</pre>

接下来就进入正式的恢复工作了，先对需要恢复的磁盘进行扫描。
<pre lang="bash">
cd /data/recovery
nohup /data/recovery/bin/ext3grep /dev/sda8 --ls --inode 2 &#038;
#建议使用 nohup 和 &#038;，因为如果分区很大的话耗时比较长
</pre>
扫描完毕后， /data/recovery 中会出现两个分别名为 c0d2.ext3grep.stage1 和 c0d2.ext3grep.stage2 的文件。前者可以直接忽略，后者里面保存着可以被恢复备份的文件名。

由于我需要备份的文件很多，几十G，就用下面这个命令进行全部恢复
<pre lang="bash">
cd /data/recovery
nohup /data/recovery/ext3grep/bin/ext3grep /dev/sda8 --restore-all &#038;
#建议使用 nohup 和 &#038;，因为如果分区很大的话耗时比较长
</pre>
<font color="red">需要注意的是，restore-all 参数会将整个磁盘所有文件（已删除可恢复的文件和未被删除还存在的文件）进行恢复和备份处理，所以请确认你的存放恢复文件的分区有足够的空间</font>

如果仅仅是恢复几个文件的话，建议使用 restore-file 参数
备份的文件会存放在工作目录的名为 RESTORED_FILES 的文件夹里，本文中就是 cd /data/recovery/RESTORED_FILES

最后补充一句话：慎用 rm -rf 。]]></description>
			<content:encoded><![CDATA[<script type="text/javascript" src="http://china-addthis.googlecode.com/svn/trunk/addthis.js" charset="utf-8"></script><span class='addthis_org_cn'><a u='http://www.iron-feet.com/it/data-recovery-from-ext3-file-system/' t='Data Recovery From Ext3 File System' d='' tag='Bash,ext3,ext3grep,recovery' href='http://addthis.org.cn/share/' title='收藏-分享'><img src='http://www.iron-feet.com/wp-content/plugins/addthischina/a3.gif' alt='分享家:Addthis中国' align='absmiddle' /></a></span>
<p>以前总是在网上看到很多人问怎么恢复 Linux 分区下误删的文件。当时并没有仔细关注过，真没想到昨天这事摊我身上了。</p>
<p>大致说说这场悲剧的整个过程吧（为了避免一些不必要的麻烦，本文中的文件夹名和设备名都作了修改）</p>
<p>当时我的工作目录是 /source/needrecovered 。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">pwd</span>
<span style="color: #000000; font-weight: bold;">/</span>source<span style="color: #000000; font-weight: bold;">/</span>needrecovered</pre></div></div>

<p>原本打算清空其中的一个子文件</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> canbedeleted<span style="color: #000000; font-weight: bold;">/*</span></pre></div></div>

<p>却把命令给打错了。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> canbedeleted<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">*</span></pre></div></div>

<p>当时我琢磨着今天怎么删个小文件夹这么慢呢。等我仔细看了下命令，反应过来的时候，已经太迟了。整个工作目录被清空了 <img src="http://www.iron-feet.com/wp-content/plugins/wp-smiley-switcher/noktahhitam/icon_cry.gif" alt="" /> </p>
<p>没辙了，只能先到网上找找解决方案了，网上大致提到的方法有两种：一种是利用 debugfs ；第二种是<a href="http://www.xs4all.nl/~carlo17/howto/undelete_ext3.html" target="_blank">利用 ext3grep </a>。第一种方法，我尝试了若干次都以失败告终，第二种成功了。但是统一的是：两种方法首先提到的都是将对该分区进行操作的应用先全部关闭，具体如下：<br />
<font color="red">以下的操作尽量使用 root 操作，以提高数据恢复的成功率</font></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#该命令用于列出操作该分区的进程</span>
<span style="color: #c20cb9; font-weight: bold;">fuser</span> <span style="color: #660033;">-v</span> <span style="color: #660033;">-m</span> <span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">source</span>
<span style="color: #666666; font-style: italic;">#如果没有很重要的进程，利用下面的命令将其全部 kill 掉</span>
<span style="color: #c20cb9; font-weight: bold;">fuser</span> <span style="color: #660033;">-k</span> <span style="color: #660033;">-v</span> <span style="color: #660033;">-m</span> <span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">source</span></pre></div></div>

<p><font color="red">执行上面那个命令的时候，务必要将你的工作目录切换到 /source 以外，否则你的 sshd 会被 kill 掉</font></p>
<p>这样子可以达到两个好处：</p>
<ol>
<li>防止新的文件操作影响数据的恢复</li>
<li>方便对磁盘或者分区进行进一步的操作<br />
如： mount 和 umount</li>
</ol>
<p>接下来我们看看磁盘分区情况</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">df</span> <span style="color: #660033;">-Th</span>
Filesystem    Type    Size  Used Avail Use<span style="color: #000000; font-weight: bold;">%</span> Mounted on
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda8     ext3    7.9G  6.3G  1.2G  <span style="color: #000000;">84</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">source</span>
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdb1  fuseblk    299G  266G   33G  <span style="color: #000000;">90</span><span style="color: #000000; font-weight: bold;">%</span> <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>需要恢复的分区是 /dev/sda8 ，挂载点是 /source 。</p>
<p>先将此分区卸载，并在 /data 分区建立一个用于存储备份数据的文件夹</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #660033;">-v</span> <span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">source</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>recovery</pre></div></div>

<p>现在轮到主角登场了，先去下载一份 <a target="_blank" href="http://code.google.com/p/ext3grep/">ext3grep</a> 的源码，并安装</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>recovery
<span style="color: #666666; font-style: italic;">#此链接地址以官网最新版本为准</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>ext3grep.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>ext3grep-0.10.2.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xfz ext3grep-0.10.2.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> ext3grep-0.10.2
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>recovery
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>接下来就进入正式的恢复工作了，先对需要恢复的磁盘进行扫描。</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>recovery
<span style="color: #c20cb9; font-weight: bold;">nohup</span> <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>recovery<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ext3grep <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda8 <span style="color: #660033;">--ls</span> <span style="color: #660033;">--inode</span> <span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
<span style="color: #666666; font-style: italic;">#建议使用 nohup 和 &amp;，因为如果分区很大的话耗时比较长</span></pre></div></div>

<p>扫描完毕后， /data/recovery 中会出现两个分别名为 c0d2.ext3grep.stage1 和 c0d2.ext3grep.stage2 的文件。前者可以直接忽略，后者里面保存着可以被恢复备份的文件名。</p>
<p>由于我需要备份的文件很多，几十G，就用下面这个命令进行全部恢复</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>recovery
<span style="color: #c20cb9; font-weight: bold;">nohup</span> <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>recovery<span style="color: #000000; font-weight: bold;">/</span>ext3grep<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ext3grep <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda8 <span style="color: #660033;">--restore-all</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
<span style="color: #666666; font-style: italic;">#建议使用 nohup 和 &amp;，因为如果分区很大的话耗时比较长</span></pre></div></div>

<p><font color="red">需要注意的是，restore-all 参数会将整个磁盘所有文件（已删除可恢复的文件和未被删除还存在的文件）进行恢复和备份处理，所以请确认你的存放恢复文件的分区有足够的空间</font></p>
<p>如果仅仅是恢复几个文件的话，建议使用 restore-file 参数<br />
备份的文件会存放在工作目录的名为 RESTORED_FILES 的文件夹里，本文中就是 cd /data/recovery/RESTORED_FILES</p>
<p>最后补充一句话：慎用 rm -rf 。</p>
<h2  class="related_post_title">Related Posts</h2><ul class="related_post"><li>May 17, 2011 -- <a href="http://www.iron-feet.com/it/little-tools-killtree-ssh_auto/" title="Little Tools: Killtree &#038; Ssh_auto">Little Tools: Killtree &#038; Ssh_auto</a> (2)</li><li>July 31, 2010 -- <a href="http://www.iron-feet.com/it/httpd-worker-confused-me/" title="Httpd.worker Confused Me">Httpd.worker Confused Me</a> (2)</li><li>January 18, 2010 -- <a href="http://www.iron-feet.com/it/one-alternative-method-to-surf/" title="One Alternative Method to Surf">One Alternative Method to Surf</a> (7)</li><li>December 4, 2008 -- <a href="http://www.iron-feet.com/it/lyrics-show-based-on-bash-script/" title="Lyrics Show Based on Bash Script">Lyrics Show Based on Bash Script</a> (0)</li></ul><hr />
<p><small>© Iron_Feet for <a href="http://www.iron-feet.com">风云阁</a>, 2010. |
<a href="http://www.iron-feet.com/it/data-recovery-from-ext3-file-system/">Permalink</a> |
<a href="http://www.iron-feet.com/it/data-recovery-from-ext3-file-system/#comments">6 comments</a> |
Add to
<a href="http://del.icio.us/post?url=http://www.iron-feet.com/it/data-recovery-from-ext3-file-system/&title=Data Recovery From Ext3 File System">del.icio.us</a>
<br/>
Post tags: <a href="http://www.iron-feet.com/tag/bash/" rel="tag">Bash</a>, <a href="http://www.iron-feet.com/tag/ext3/" rel="tag">ext3</a>, <a href="http://www.iron-feet.com/tag/ext3grep/" rel="tag">ext3grep</a>, <a href="http://www.iron-feet.com/tag/recovery/" rel="tag">recovery</a><br/>
</small></p>
<p><a href="http://feedads.g.doubleclick.net/~a/LgmGTCi2ZMNuQHeTJl2EsFHL_z4/0/da"><img src="http://feedads.g.doubleclick.net/~a/LgmGTCi2ZMNuQHeTJl2EsFHL_z4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/LgmGTCi2ZMNuQHeTJl2EsFHL_z4/1/da"><img src="http://feedads.g.doubleclick.net/~a/LgmGTCi2ZMNuQHeTJl2EsFHL_z4/1/di" border="0" ismap="true"></img></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.iron-feet.com/it/data-recovery-from-ext3-file-system/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss><!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->

