<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>王晨的博客</title>
	<atom:link href="http://www.wangchen.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wangchen.org</link>
	<description>wangchen</description>
	<lastBuildDate>Sat, 12 May 2012 21:05:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>充满生命的绿色</title>
		<link>http://www.wangchen.org/2012/03/%e5%85%85%e6%bb%a1%e7%94%9f%e5%91%bd%e7%9a%84%e7%bb%bf%e8%89%b2/</link>
		<comments>http://www.wangchen.org/2012/03/%e5%85%85%e6%bb%a1%e7%94%9f%e5%91%bd%e7%9a%84%e7%bb%bf%e8%89%b2/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 15:06:40 +0000</pubDate>
		<dc:creator>wangchen</dc:creator>
				<category><![CDATA[♥ 日志]]></category>

		<guid isPermaLink="false">http://www.wangchen.org/?p=574</guid>
		<description><![CDATA[IMG_0285, a photo by kitta4587 on Flickr. 学着用另外一个角度看世界。]]></description>
			<content:encoded><![CDATA[<div style="margin: 0 0 10px 0; padding: 0; font-size: 0.8em; line-height: 1.6em;"><a href="http://www.flickr.com/photos/coderay/7024039487/" title="IMG_0285"><img src="http://farm8.staticflickr.com/7119/7024039487_ed0b7254e3.jpg" alt="IMG_0285 by kitta4587" /></a><br/><span style="margin: 0;"><a href="http://www.flickr.com/photos/coderay/7024039487/">IMG_0285</a>, a photo by <a href="http://www.flickr.com/photos/coderay/">kitta4587</a> on Flickr.</span></div>
<p>学着用另外一个角度看世界。</p>
<div class="plus-one-wrap"><g:plusone href="http://www.wangchen.org/2012/03/%e5%85%85%e6%bb%a1%e7%94%9f%e5%91%bd%e7%9a%84%e7%bb%bf%e8%89%b2/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.wangchen.org/2012/03/%e5%85%85%e6%bb%a1%e7%94%9f%e5%91%bd%e7%9a%84%e7%bb%bf%e8%89%b2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>欧阳峰旁白</title>
		<link>http://www.wangchen.org/2012/03/569/</link>
		<comments>http://www.wangchen.org/2012/03/569/#comments</comments>
		<pubDate>Fri, 16 Mar 2012 11:08:38 +0000</pubDate>
		<dc:creator>wangchen</dc:creator>
				<category><![CDATA[♥ 日志]]></category>

		<guid isPermaLink="false">http://www.wangchen.org/?p=569</guid>
		<description><![CDATA[忽然，想起了张国荣，想起了《东邪西毒》，想起了醉生梦死…… 欧阳峰（旁白）： 立春之后就到了惊蜇，每年这个时候，有位朋友来看我。但是他今年没有来。没多久，我收到一封白驼山的来信，我大嫂在两年前的秋天，因为一场大病去世了。我知道黄藥师不会再来，可是我还继续等。我在门外坐了两天两夜，看着天空不断的变化，我才发现，虽然我到达這裡很久，却从来没有看清楚这片沙漠。 以前看见山，就想知道山的后面是什麼。我现在已经不想知道了，我是孤星入命的人，从小父母早死，只好跟哥哥相依为命。从小我就懂得保护自己，我知道要想不被人拒绝，最好的办法就是先拒绝别人。因为这个原因，我再也没有回去，其实那边也不错。可惜已经不能回头。我的命书里说过，夫妻宫太阳化忌，婚姻有实无名，想不到是真的。 那天晚上，我突然很想喝酒，就喝了那半坛「醉生梦死」，好象平常一样，我继续做我的买卖。 没有事的时候，我会望向白驼山。我清楚地记得有一个女人在那边等我，其实「醉生梦死」只不过是她和我开的一个玩笑，你越想知道自己是不是忘记的时候反而记得越清楚。 我曾经听人说过，当你不能够再拥有的时候，你唯一可以做的就是令自己不要忘记。 不知道为什麼，我常常会做同一个梦。没多久，我就离开了这个地方。]]></description>
			<content:encoded><![CDATA[<p>忽然，想起了张国荣，想起了《东邪西毒》，想起了醉生梦死……</p>
<p>欧阳峰（旁白）： 立春之后就到了惊蜇，每年这个时候，有位朋友来看我。但是他今年没有来。没多久，我收到一封白驼山的来信，我大嫂在两年前的秋天，因为一场大病去世了。我知道黄藥师不会再来，可是我还继续等。我在门外坐了两天两夜，看着天空不断的变化，我才发现，虽然我到达這裡很久，却从来没有看清楚这片沙漠。 以前看见山，就想知道山的后面是什麼。我现在已经不想知道了，我是孤星入命的人，从小父母早死，只好跟哥哥相依为命。从小我就懂得保护自己，我知道要想不被人拒绝，最好的办法就是先拒绝别人。因为这个原因，我再也没有回去，其实那边也不错。可惜已经不能回头。我的命书里说过，夫妻宫太阳化忌，婚姻有实无名，想不到是真的。 那天晚上，我突然很想喝酒，就喝了那半坛「醉生梦死」，好象平常一样，我继续做我的买卖。 没有事的时候，我会望向白驼山。我清楚地记得有一个女人在那边等我，其实「醉生梦死」只不过是她和我开的一个玩笑，你越想知道自己是不是忘记的时候反而记得越清楚。 我曾经听人说过，当你不能够再拥有的时候，你唯一可以做的就是令自己不要忘记。 不知道为什麼，我常常会做同一个梦。没多久，我就离开了这个地方。</p>
<p><img src="http://www.wangchen.org/wp-content/uploads/2012/03/5397f2dcaa9cc6f9cc1166fb.jpg" alt="" title="张国荣" width="550" height="734" class="alignleft size-full wp-image-558" /></p>
<div class="plus-one-wrap"><g:plusone href="http://www.wangchen.org/2012/03/569/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.wangchen.org/2012/03/569/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple spider with wget</title>
		<link>http://www.wangchen.org/2012/02/simple-spider-with-wget/</link>
		<comments>http://www.wangchen.org/2012/02/simple-spider-with-wget/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 10:24:57 +0000</pubDate>
		<dc:creator>wangchen</dc:creator>
				<category><![CDATA[♥ 日志]]></category>

		<guid isPermaLink="false">http://www.wangchen.org/?p=547</guid>
		<description><![CDATA[一些临时且定制程度很高的抓取工作，使用系统化的爬虫往往没有使用Shell 效率高，下面是一些思路。 事先用脚本分析出下载连接，存放在一个文件中，然后用split 切割成若干个文件，文件数取决于希望的并发下载进程数量。 使用Wget 进行下载： ?View Code BASH&#160; nohup cat links.txt.aa &#124;awk '{print &#34;wget \&#34;&#34;$0&#34;\&#34; --user-agent=\&#34;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6\&#34; -a wget.log -nv &#34;}'&#124; sh &#38; &#160; nohup cat links.txt.ab &#124;awk '{print &#34;wget \&#34;&#34;$0&#34;\&#34; ...]]></description>
			<content:encoded><![CDATA[<p>一些临时且定制程度很高的抓取工作，使用系统化的爬虫往往没有使用Shell 效率高，下面是一些思路。</p>
<p>事先用脚本分析出下载连接，存放在一个文件中，然后用split 切割成若干个文件，文件数取决于希望的并发下载进程数量。<br />
使用Wget 进行下载：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p547code4'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5474"><td class="code" id="p547code4"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">nohup</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> links.txt.aa <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print &quot;wget \&quot;&quot;$0&quot;\&quot; --user-agent=\&quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6\&quot; -a wget.log -nv &quot;}'</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">nohup</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> links.txt.ab <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print &quot;wget \&quot;&quot;$0&quot;\&quot; --user-agent=\&quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6\&quot; -a wget.log -nv &quot;}'</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">nohup</span> <span style="color: #c20cb9; font-weight: bold;">cat</span> links.txt.ac <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print &quot;wget \&quot;&quot;$0&quot;\&quot; --user-agent=\&quot;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6\&quot; -a wget.log -nv &quot;}'</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #000000; font-weight: bold;">&amp;</span></pre></td></tr></table></div>

<p>模拟了UA，当然模拟Cookies、reference 都没有问题，稍后补上吧。</p>
<p>根据wget.log 统计下载速度：<br />
日志格式：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p547code5'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5475"><td class="code" id="p547code5"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #000000;">2012</span>-02-01 <span style="color: #000000;">17</span>:<span style="color: #000000;">23</span>:<span style="color: #000000;">32</span> URL:http:<span style="color: #000000; font-weight: bold;">//</span>a.b.com<span style="color: #000000; font-weight: bold;">/</span>d.zip <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">196986</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">196986</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> -<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #ff0000;">&quot;d.zip&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000;">2012</span>-02-01 <span style="color: #000000;">17</span>:<span style="color: #000000;">23</span>:<span style="color: #000000;">45</span> URL:http:<span style="color: #000000; font-weight: bold;">//</span>a.b.com<span style="color: #000000; font-weight: bold;">/</span>e.zip <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">49455</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">49455</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> -<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #ff0000;">&quot;e.zip&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></td></tr></table></div>

<p>One-liner 脚本：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p547code6'); return false;">View Code</a> BASH</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5476"><td class="code" id="p547code6"><pre class="bash" style="font-family:monospace;">&nbsp;
<span style="color: #c20cb9; font-weight: bold;">cat</span> ~<span style="color: #000000; font-weight: bold;">/</span>wget.log <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;2012-02-02 17:..:..&quot;</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{a+= substr($4, 2, index($4, &quot;/&quot;)-2)}END{print a}'</span></pre></td></tr></table></div>

<div class="plus-one-wrap"><g:plusone href="http://www.wangchen.org/2012/02/simple-spider-with-wget/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.wangchen.org/2012/02/simple-spider-with-wget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>最爱的VIM Theme</title>
		<link>http://www.wangchen.org/2012/02/%e6%9c%80%e7%88%b1%e7%9a%84vim-theme/</link>
		<comments>http://www.wangchen.org/2012/02/%e6%9c%80%e7%88%b1%e7%9a%84vim-theme/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 14:58:26 +0000</pubDate>
		<dc:creator>wangchen</dc:creator>
				<category><![CDATA[♥ 日志]]></category>

		<guid isPermaLink="false">http://www.wangchen.org/?p=543</guid>
		<description><![CDATA[本来想偷懒用Sina weibo 的相册，结果太悲催了，还是乖乖用Flickr吧！]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/coderay/6805498747/" title="nginx.c (~_Codes_open_nginx-1.0.5_src_core) - VIM3-1 by kitta4587, on Flickr"><img src="http://farm8.staticflickr.com/7018/6805498747_4e80fe3b81.jpg" width="500" height="320" alt="nginx.c (~_Codes_open_nginx-1.0.5_src_core) - VIM3-1"></a></p>
<p>本来想偷懒用Sina weibo 的相册，结果太悲催了，还是乖乖用Flickr吧！</p>
<div class="plus-one-wrap"><g:plusone href="http://www.wangchen.org/2012/02/%e6%9c%80%e7%88%b1%e7%9a%84vim-theme/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.wangchen.org/2012/02/%e6%9c%80%e7%88%b1%e7%9a%84vim-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>厌烦Mac Vim 的图标了吗？</title>
		<link>http://www.wangchen.org/2012/02/%e5%8e%8c%e7%83%a6mac-vim-%e7%9a%84%e5%9b%be%e6%a0%87%e4%ba%86%e5%90%97%ef%bc%9f/</link>
		<comments>http://www.wangchen.org/2012/02/%e5%8e%8c%e7%83%a6mac-vim-%e7%9a%84%e5%9b%be%e6%a0%87%e4%ba%86%e5%90%97%ef%bc%9f/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 09:04:23 +0000</pubDate>
		<dc:creator>wangchen</dc:creator>
				<category><![CDATA[✔ Coding]]></category>
		<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[VIM]]></category>

		<guid isPermaLink="false">http://www.wangchen.org/?p=534</guid>
		<description><![CDATA[看看这个怎么样？ 这是Drew Yeaton 发布的一款图标，我很钟意，分享给大家！ &#60;猛击这里下载Icns 版本&#62;， 如何替换应用图标呢？其实很简单，不用什么第三方工具。 下载icns 文件到本地，用Finder 打开/Applications，找到MacVim，右键点击，在菜单里选择“Get Info”，然后拖动icns 文件到Info 的顶部的图标位置即可。 如果要恢复默认呢？同样打开Get Info，选中图标，然后按Delete 键，就可以咯。 BTW: 这个方法适合任何图标！]]></description>
			<content:encoded><![CDATA[<p>看看这个怎么样？<br />
<img src="http://dribbble.com/system/users/2086/screenshots/337065/vim_icon-300.png?1322700321" alt="Mac Vim Icon" /><br />
这是Drew Yeaton 发布的一款图标，我很钟意，分享给大家！<br />
<a href="http://dribbble.com/shots/337065-MacVim-Icon-Updated-" title="原始地址在这里" target="_blank"></a><br />
<a href="http://vdisk.weibo.com/s/2fGXO">&lt;猛击这里下载Icns 版本&gt;</a>，</p>
<p>如何替换应用图标呢？其实很简单，不用什么第三方工具。<br />
下载icns 文件到本地，用Finder 打开/Applications，找到MacVim，右键点击，在菜单里选择“Get Info”，然后拖动icns 文件到Info 的顶部的图标位置即可。<br />
如果要恢复默认呢？同样打开Get Info，选中图标，然后按Delete 键，就可以咯。</p>
<p>BTW: 这个方法适合任何图标！</p>
<div class="plus-one-wrap"><g:plusone href="http://www.wangchen.org/2012/02/%e5%8e%8c%e7%83%a6mac-vim-%e7%9a%84%e5%9b%be%e6%a0%87%e4%ba%86%e5%90%97%ef%bc%9f/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.wangchen.org/2012/02/%e5%8e%8c%e7%83%a6mac-vim-%e7%9a%84%e5%9b%be%e6%a0%87%e4%ba%86%e5%90%97%ef%bc%9f/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql python in lion 64</title>
		<link>http://www.wangchen.org/2012/01/mysql-python-in-lion-64/</link>
		<comments>http://www.wangchen.org/2012/01/mysql-python-in-lion-64/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 08:25:23 +0000</pubDate>
		<dc:creator>wangchen</dc:creator>
				<category><![CDATA[♥ 日志]]></category>
		<category><![CDATA[Lion]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.wangchen.org/?p=530</guid>
		<description><![CDATA[下载并安装64位版本的MySQL Server community 修改~/.bash_profy： export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/ 下载MySQL-Python，http://mysql-python.sourceforge.net/ 解压缩，并用下面的命令安装： sudo ARCHFLAGS='-arch ix86_64' python setup.py build sudo ARCHFLAGS='-arch ix86_64' python setup.py install 测试： $ python >> import MySQLdb 查看共享库的格式： $ file build/temp.macosx-10.7-ix86_64-2.7/_mysql.o build/temp.macosx-10.7-ix86_64-2.7/_mysql.o: Mach-O 64-bit object x86_64]]></description>
			<content:encoded><![CDATA[<p>下载并安装<strong>64位</strong>版本的MySQL Server community</p>
<p>修改~/.bash_profy：</p>
<pre>
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/
</re>

下载MySQL-Python，http://mysql-python.sourceforge.net/

解压缩，并用下面的命令安装：
<pre>
sudo ARCHFLAGS='-arch ix86_64' python setup.py build
sudo ARCHFLAGS='-arch ix86_64' python setup.py install
</re>

测试：
<pre>
$ python
>> import MySQLdb
</pre>
<p>查看共享库的格式：</p>
<pre>
$ file build/temp.macosx-10.7-ix86_64-2.7/_mysql.o
build/temp.macosx-10.7-ix86_64-2.7/_mysql.o: Mach-O 64-bit object x86_64
</pre>
<div class="plus-one-wrap"><g:plusone href="http://www.wangchen.org/2012/01/mysql-python-in-lion-64/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.wangchen.org/2012/01/mysql-python-in-lion-64/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sharing</title>
		<link>http://www.wangchen.org/2011/12/sharing/</link>
		<comments>http://www.wangchen.org/2011/12/sharing/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 16:14:01 +0000</pubDate>
		<dc:creator>wangchen</dc:creator>
				<category><![CDATA[♥ 日志]]></category>

		<guid isPermaLink="false">http://www.wangchen.org/?p=527</guid>
		<description><![CDATA[今天安排了一位资深的Linux C/C++ 的同事为大家做了一次分享，主要将程序运行时在系统底层究竟是什么样子，可惜的是我今天没能参加，不知道效果如何。 这里说说我对“培训”的看法，其实我喜欢叫它“分享”，这样可以降低讲授者的压力。每周我们会安排30-60分钟的时间，请一些同事分享最近对某些技术的心得，目的是大家共同提高，共同进步，培养分享的氛围（我曾经做过一次，专门聊分享的重要性）。在经历了一段时间的实践，我们发现一些问题，虽然也有成功案例，但大多分享很难提起大家的兴趣，台上照本宣科，台下昏昏欲睡——WHY？ ** 授人以渔 ** 分享，要彻底，毫无保留。不要传授结论，要传授方法。比如，我们做一次Case Study，某网络服务挂掉了，我们用1天的时间解决了，然后我们告诉大家，是因为多进程并发时，某个逻辑中产生了死锁，大家要以后要注意。我想这时一半人已经睡了，我如果知道问题是什么，再弱的人Google 一下也知道如何解决了，分享的意义何在？可悲的是，我们大多数的分享都是这类的。其实，大家更希望了解你是如何发现问题的，你思考的过程，他消化后没准还能举一反三，这才是分享的价值所在。 另一方面，分享不一定把某个问题讲清楚，也许给大家留下一些谜题更有价值。比如之前我们曾做过一次二进制文件的布式存储和分析系统的设计分享，那只是个概念草稿，甚至最终也没有实施，过程中我们聊了，如何给这个问题定性，为什么不使用Hadoop，为什么使用一致性哈希算法，架构为什么设计成这样，等等。大家都在认真的听、思考，并提出了很多问题。虽然这次分享没有什么立竿见影的效果，但不久后，我发现大家在各自架构演进中，都有意无意的引入了一些这次分享中的概念，我想那时埋下的种子——发芽了。 最后：分享，收获>付出。]]></description>
			<content:encoded><![CDATA[<p>今天安排了一位资深的Linux C/C++ 的同事为大家做了一次分享，主要将程序运行时在系统底层究竟是什么样子，可惜的是我今天没能参加，不知道效果如何。</p>
<p>这里说说我对“培训”的看法，其实我喜欢叫它“分享”，这样可以降低讲授者的压力。每周我们会安排30-60分钟的时间，请一些同事分享最近对某些技术的心得，目的是大家共同提高，共同进步，培养分享的氛围（我曾经做过一次，专门聊分享的重要性）。在经历了一段时间的实践，我们发现一些问题，虽然也有成功案例，但大多分享很难提起大家的兴趣，台上照本宣科，台下昏昏欲睡——WHY？</p>
<p>** 授人以渔 **</p>
<p>分享，要彻底，毫无保留。不要传授结论，要传授方法。比如，我们做一次Case Study，某网络服务挂掉了，我们用1天的时间解决了，然后我们告诉大家，是因为多进程并发时，某个逻辑中产生了死锁，大家要以后要注意。我想这时一半人已经睡了，我如果知道问题是什么，再弱的人Google 一下也知道如何解决了，分享的意义何在？可悲的是，我们大多数的分享都是这类的。其实，大家更希望了解你是如何发现问题的，你思考的过程，他消化后没准还能举一反三，这才是分享的价值所在。</p>
<p>另一方面，分享不一定把某个问题讲清楚，也许给大家留下一些谜题更有价值。比如之前我们曾做过一次二进制文件的布式存储和分析系统的设计分享，那只是个概念草稿，甚至最终也没有实施，过程中我们聊了，如何给这个问题定性，为什么不使用Hadoop，为什么使用一致性哈希算法，架构为什么设计成这样，等等。大家都在认真的听、思考，并提出了很多问题。虽然这次分享没有什么立竿见影的效果，但不久后，我发现大家在各自架构演进中，都有意无意的引入了一些这次分享中的概念，我想那时埋下的种子——发芽了。</p>
<p>最后：分享，收获>付出。</p>
<div class="plus-one-wrap"><g:plusone href="http://www.wangchen.org/2011/12/sharing/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.wangchen.org/2011/12/sharing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>失恋33天</title>
		<link>http://www.wangchen.org/2011/11/%e5%a4%b1%e6%81%8b33%e5%a4%a9/</link>
		<comments>http://www.wangchen.org/2011/11/%e5%a4%b1%e6%81%8b33%e5%a4%a9/#comments</comments>
		<pubDate>Mon, 21 Nov 2011 03:41:47 +0000</pubDate>
		<dc:creator>wangchen</dc:creator>
				<category><![CDATA[♥ 日志]]></category>

		<guid isPermaLink="false">http://www.wangchen.org/?p=521</guid>
		<description><![CDATA[昨天去看电影，排队时邂逅了一位多年不见的老朋友，两人的问候方式是“我靠”…… 话说《失恋33天》还是很不错的。 一：文章这个角色的性格有些不一致，时而很娘，时而爷们，是有意为之吗？没看懂。 二：配角亮了，连龙套都亮了，张嘉译、海青等，时间在人们脸上蚀刻皱纹的同时，也会让你的灵魂更加玲珑，所以不必抱怨。 三：“葡萄干”的桥段，我喷了……]]></description>
			<content:encoded><![CDATA[<p>昨天去看电影，排队时邂逅了一位多年不见的老朋友，两人的问候方式是“我靠”……</p>
<p>话说《失恋33天》还是很不错的。</p>
<p>一：文章这个角色的性格有些不一致，时而很娘，时而爷们，是有意为之吗？没看懂。</p>
<p>二：配角亮了，连龙套都亮了，张嘉译、海青等，时间在人们脸上蚀刻皱纹的同时，也会让你的灵魂更加玲珑，所以不必抱怨。</p>
<p>三：“葡萄干”的桥段，我喷了……</p>
<p><img alt="" src="http://img1.douban.com/view/photo/photo/public/p1291304232.jpg" title="失恋33天" width="429" height="600" /></p>
<div class="plus-one-wrap"><g:plusone href="http://www.wangchen.org/2011/11/%e5%a4%b1%e6%81%8b33%e5%a4%a9/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.wangchen.org/2011/11/%e5%a4%b1%e6%81%8b33%e5%a4%a9/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>公式计算</title>
		<link>http://www.wangchen.org/2011/10/%e5%85%ac%e5%bc%8f%e8%ae%a1%e7%ae%97/</link>
		<comments>http://www.wangchen.org/2011/10/%e5%85%ac%e5%bc%8f%e8%ae%a1%e7%ae%97/#comments</comments>
		<pubDate>Sat, 29 Oct 2011 07:52:10 +0000</pubDate>
		<dc:creator>wangchen</dc:creator>
				<category><![CDATA[♥ 日志]]></category>

		<guid isPermaLink="false">http://www.wangchen.org/?p=513</guid>
		<description><![CDATA[看到统计系统的代码往往很罗嗦，写了个小函数，可以一定程度上将逻辑集中，将公式抽取到配置文件中。 有兴趣的朋友可以继续阅读有关闭包的内容。 ?Download expr.py# encoding: utf8 &#34;&#34;&#34; Expr module &#34;&#34;&#34; import types def calc&#40;formula, *args&#41;: &#34;&#34;&#34; 使用给定的参数计算公式的值. @formula: 公式，用'#' 作为参数占位符，比如'#+#'，表示两个数相加 @*args: 参数列表，参数可以是函数 例子: - 数值参数：calc('#+#', 1, 1)，结果为2 - 函数参数：calc('#-#', time.time, time.time)，结果为0 &#34;&#34;&#34; parts = &#91;&#93; pos = 0 for c ...]]></description>
			<content:encoded><![CDATA[<p>看到统计系统的代码往往很罗嗦，写了个小函数，可以一定程度上将逻辑集中，将公式抽取到配置文件中。<br />
有兴趣的朋友可以继续阅读有关闭包的内容。</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left2">Download <a href="http://www.wangchen.org/wp-content/plugins/wp-codebox/wp-codebox.php?p=513&amp;download=expr.py">expr.py</a></span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p5138"><td class="code" id="p513code8"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># encoding: utf8</span>
<span style="color: #483d8b;">&quot;&quot;&quot;
Expr module
&quot;&quot;&quot;</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">types</span>
<span style="color: #ff7700;font-weight:bold;">def</span> calc<span style="color: black;">&#40;</span>formula, <span style="color: #66cc66;">*</span>args<span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;
    使用给定的参数计算公式的值.
    @formula: 公式，用'#' 作为参数占位符，比如'#+#'，表示两个数相加
    @*args: 参数列表，参数可以是函数
    例子:
    - 数值参数：calc('#+#', 1, 1)，结果为2
    - 函数参数：calc('#-#', time.time, time.time)，结果为0
    &quot;&quot;&quot;</span>
    parts = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
    pos = <span style="color: #ff4500;">0</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> c <span style="color: #ff7700;font-weight:bold;">in</span> formula:
        <span style="color: #ff7700;font-weight:bold;">if</span> c <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #483d8b;">'#'</span>:
            <span style="color: #ff7700;font-weight:bold;">if</span> pos <span style="color: #66cc66;">&gt;</span>= <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>args<span style="color: black;">&#41;</span>:
                <span style="color: #ff7700;font-weight:bold;">raise</span> <span style="color: #008000;">Exception</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Index out of range. <span style="color: #000099; font-weight: bold;">\</span>
                        The formula need more arguments'</span><span style="color: black;">&#41;</span>
            part = args<span style="color: black;">&#91;</span>pos<span style="color: black;">&#93;</span>
            <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">callable</span><span style="color: black;">&#40;</span>part<span style="color: black;">&#41;</span>:
                part = part<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
            part = <span style="color: #008000;">str</span><span style="color: black;">&#40;</span><span style="color: #008000;">float</span><span style="color: black;">&#40;</span>part<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
            pos += <span style="color: #ff4500;">1</span>
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            part = c
        parts.<span style="color: black;">append</span><span style="color: black;">&#40;</span>part<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">eval</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>parts<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">'__main__'</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;
    Sample unit test
    &quot;&quot;&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">time</span>
    <span style="color: #ff7700;font-weight:bold;">assert</span> <span style="color: #ff4500;">0</span> == calc<span style="color: black;">&#40;</span><span style="color: #483d8b;">'#-#'</span>, <span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span>, <span style="color: #dc143c;">time</span>.<span style="color: #dc143c;">time</span><span style="color: black;">&#41;</span> 
    <span style="color: #ff7700;font-weight:bold;">assert</span> <span style="color: #ff4500;">2</span> == calc<span style="color: black;">&#40;</span><span style="color: #483d8b;">'#+#'</span>, <span style="color: #ff4500;">1</span>, <span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">'Cool! All cases passed.'</span></pre></td></tr></table></div>

<div class="plus-one-wrap"><g:plusone href="http://www.wangchen.org/2011/10/%e5%85%ac%e5%bc%8f%e8%ae%a1%e7%ae%97/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.wangchen.org/2011/10/%e5%85%ac%e5%bc%8f%e8%ae%a1%e7%ae%97/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>门后的秘密</title>
		<link>http://www.wangchen.org/2011/10/%e9%97%a8%e5%90%8e%e7%9a%84%e7%a7%98%e5%af%86/</link>
		<comments>http://www.wangchen.org/2011/10/%e9%97%a8%e5%90%8e%e7%9a%84%e7%a7%98%e5%af%86/#comments</comments>
		<pubDate>Thu, 20 Oct 2011 03:25:14 +0000</pubDate>
		<dc:creator>wangchen</dc:creator>
				<category><![CDATA[♥ 日志]]></category>

		<guid isPermaLink="false">http://www.wangchen.org/?p=509</guid>
		<description><![CDATA[感谢三火兄 赠书！ 很高兴的发现，其实书中说的某些实践，我们已经在做了，这些是我们这些未受过专业管理训练的人从实际工作中总结出来的。其实书中的道理同样是从实际工作中总结出来的，不过经历的时间跨度更大、更系统、更精辟，这也是看书的好处，拾遗补缺。 信息很奇妙，无论用什么载体，文字、声音、图像，都可能产生误读，与信息本身无关，问题在于接收者，根据不同的接收者应选择适用的方式。而实践是最好的，告诉人一个道理，不如带领他一起去实践，让他自己去感悟，再去协助总结。]]></description>
			<content:encoded><![CDATA[<p>感谢<a href="http://www.li3huo.com">三火兄</a> 赠书！<br />
<img src="http://img3.douban.com/lpic/s4568761.jpg" alt="门后的秘密" /></p>
<p>很高兴的发现，其实书中说的某些实践，我们已经在做了，这些是我们这些未受过专业管理训练的人从实际工作中总结出来的。其实书中的道理同样是从实际工作中总结出来的，不过经历的时间跨度更大、更系统、更精辟，这也是看书的好处，拾遗补缺。</p>
<p>信息很奇妙，无论用什么载体，文字、声音、图像，都可能产生误读，与信息本身无关，问题在于接收者，根据不同的接收者应选择适用的方式。而实践是最好的，告诉人一个道理，不如带领他一起去实践，让他自己去感悟，再去协助总结。</p>
<div class="plus-one-wrap"><g:plusone href="http://www.wangchen.org/2011/10/%e9%97%a8%e5%90%8e%e7%9a%84%e7%a7%98%e5%af%86/"></g:plusone></div>]]></content:encoded>
			<wfw:commentRss>http://www.wangchen.org/2011/10/%e9%97%a8%e5%90%8e%e7%9a%84%e7%a7%98%e5%af%86/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

