<?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>I am Hu Kai</title>
	<atom:link href="http://www.iamhukai.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.iamhukai.com</link>
	<description>多研究些问题，少谈些主义</description>
	<lastBuildDate>Sat, 03 Jul 2010 23:17:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>测试覆盖率强迫症</title>
		<link>http://www.iamhukai.com/?p=189</link>
		<comments>http://www.iamhukai.com/?p=189#comments</comments>
		<pubDate>Sat, 03 Jul 2010 23:17:09 +0000</pubDate>
		<dc:creator>我是胡凯</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.iamhukai.com/?p=189</guid>
		<description><![CDATA[越来越多的团队开始意识到测试的重要性并积极开展了测试实践，在这个过程中，常常被夸大功效或者错误使用的便是测试覆盖率和测试覆盖率工具，在这篇文章 中，我希望从心理和技术的角度探讨测试覆盖率和测试覆盖率工具的误用以及应对之道
全文发在infoq上，测试覆盖率强迫症： http://www.infoq.com/cn/articles/test-coverage-ocd
]]></description>
			<content:encoded><![CDATA[<p>越来越多的团队开始意识到测试的重要性并积极开展了测试实践，在这个过程中，常常被夸大功效或者错误使用的便是测试覆盖率和测试覆盖率工具，在这篇文章 中，我希望从心理和技术的角度探讨测试覆盖率和测试覆盖率工具的误用以及应对之道</p>
<p>全文发在infoq上，<a href="http://www.infoq.com/cn/articles/test-coverage-ocd">测试覆盖率强迫症</a>： http://www.infoq.com/cn/articles/test-coverage-ocd</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iamhukai.com/?feed=rss2&amp;p=189</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Visual Studio 技巧第二波</title>
		<link>http://www.iamhukai.com/?p=170</link>
		<comments>http://www.iamhukai.com/?p=170#comments</comments>
		<pubDate>Fri, 21 May 2010 01:19:47 +0000</pubDate>
		<dc:creator>我是胡凯</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.iamhukai.com/?p=170</guid>
		<description><![CDATA[去掉Region:
写代码的时候，我们理应不用关心格式问题，不用关心是否using了一些我们不需要的namespace，因为我们可以在最后运行CTRL + Alt + Ｆ对代码进行format和cleanup, 然而这时候ReSharper会加入丑陋的#region #endregion，去掉的方法如下：


勾掉use default pattern.
把内容拷贝到notepad里面，（因为在上面的界面里面，不能使用CTRL + Ｆ查找）
查找所有的region
删除相应的&#60;Group&#62;譬如：

&#60;Group&#62;
&#60;ImplementsInterface Immediate=&#8221;true&#8221; Region=&#8221;${ImplementsInterface} Members&#8221;/&#62;
&#60;/Group&#62;
这样运行CTRL + Alt + Ｆ的时候世界就清静了。
]]></description>
			<content:encoded><![CDATA[<h2>去掉Region:</h2>
<p>写代码的时候，我们理应不用关心格式问题，不用关心是否using了一些我们不需要的namespace，因为我们可以在最后运行CTRL + Alt + Ｆ对代码进行format和cleanup, 然而这时候ReSharper会加入丑陋的#region #endregion，去掉的方法如下：</p>
<p><img class="aligncenter size-full wp-image-171" title="region" src="http://www.iamhukai.com/wp-content/uploads/2010/05/region.JPG" alt="region" width="589" height="530" /></p>
<ol>
<li>勾掉use default pattern.</li>
<li>把内容拷贝到notepad里面，（因为在上面的界面里面，不能使用CTRL + Ｆ查找）</li>
<li>查找所有的region</li>
<li>删除相应的&lt;Group&gt;譬如：</li>
</ol>
<blockquote><p>&lt;Group&gt;<br />
&lt;ImplementsInterface Immediate=&#8221;true&#8221; <span style="color: #ff0000;">Region</span>=&#8221;${ImplementsInterface} Members&#8221;/&gt;<br />
&lt;/Group&gt;</p></blockquote>
<p>这样运行CTRL + Alt + Ｆ的时候世界就清静了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iamhukai.com/?feed=rss2&amp;p=170</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio 技巧第一波</title>
		<link>http://www.iamhukai.com/?p=163</link>
		<comments>http://www.iamhukai.com/?p=163#comments</comments>
		<pubDate>Fri, 21 May 2010 00:56:35 +0000</pubDate>
		<dc:creator>我是胡凯</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.iamhukai.com/?p=163</guid>
		<description><![CDATA[最近上了微软的贼船，第一个不能适应的就是Visual Studio, 没有见过比它更加愚蠢的编辑器，没有安装Resharper的Visual Studio完全不可用，即便装上也和IntelliJ相去甚远，我打算把这一段时间使用Visual Studio的心得纪录下来，分享给所有人
在所有令我不爽的事情中，无法体面的运行测试是让我最无法忍受的，还好，这个问题可以通过配置VS解决。
配置Context Run:
Context run是指ReSharper会根据光标所在的位置聪明得判断出应该运行单个测试用例，还是应当运行整个测试套，配置方法如图：

配置Run Current Session:
Current Session是指ReSharper会重复运行上一次Context Run运行的测试。这在进行TDD开发时尤为有用，配置方法如图：

我的生活有一大半的时间和IDE打交道，任何一个可以让操作节省一点点时间的优化，对我来讲都是值得的投资。对这一两秒追求的差异，也造成了程序员和卓有成效的程序员之间的差别。
]]></description>
			<content:encoded><![CDATA[<p>最近上了微软的贼船，第一个不能适应的就是Visual Studio, 没有见过比它更加愚蠢的编辑器，没有安装Resharper的Visual Studio完全不可用，即便装上也和IntelliJ相去甚远，我打算把这一段时间使用Visual Studio的心得纪录下来，分享给所有人</p>
<p>在所有令我不爽的事情中，无法体面的运行测试是让我最无法忍受的，还好，这个问题可以通过配置VS解决。</p>
<h2>配置Context Run:</h2>
<p>Context run是指ReSharper会根据光标所在的位置聪明得判断出应该运行单个测试用例，还是应当运行整个测试套，配置方法如图：</p>
<p><img class="aligncenter size-full wp-image-164" title="context_run" src="http://www.iamhukai.com/wp-content/uploads/2010/05/context_run.JPG" alt="context_run" width="646" height="384" /></p>
<h2>配置Run Current Session:</h2>
<p>Current Session是指ReSharper会重复运行上一次Context Run运行的测试。这在进行TDD开发时尤为有用，配置方法如图：</p>
<p><img class="aligncenter size-full wp-image-167" title="current_session" src="http://www.iamhukai.com/wp-content/uploads/2010/05/current_session.JPG" alt="current_session" width="645" height="379" /></p>
<p>我的生活有一大半的时间和IDE打交道，任何一个可以让操作节省一点点时间的优化，对我来讲都是值得的投资。对这一两秒追求的差异，也造成了程序员和<a href="http://book.douban.com/subject/3558788/">卓有成效的程序员</a>之间的差别。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iamhukai.com/?feed=rss2&amp;p=163</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dot之美</title>
		<link>http://www.iamhukai.com/?p=149</link>
		<comments>http://www.iamhukai.com/?p=149#comments</comments>
		<pubDate>Sun, 11 Apr 2010 04:39:52 +0000</pubDate>
		<dc:creator>我是胡凯</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.iamhukai.com/?p=149</guid>
		<description><![CDATA[作为一名开发人员，我的理想世界是一个逻辑化的、简单的、有序的世界，而画图，则是这个世界上空的一朵乌云，因为
它不简单：

会有十几种方框，几十种箭头，有阴影的，没阴影的，有3D效果的，有圆角的，我的选择障碍综合征每当这时就会发作。
它不能以简单的文本方式表现，没法通过版本管理工具跟踪每一次修改。
它的维护成本很高，挪动已经作好的布局，添加一个新的元素都非常耗时。

它不逻辑化：

在于其中很大一部分工作是让它变的好看，譬如对齐，譬如使用合适的箭头&#8230;

在寻觅了很久后，我发现了dot,  它是使用纯文本描述图形的语言，它本身是一种语言规范，不同的实现，譬如Graphviz ， Grappa等。
让我们从一个工作流开始，学习如何安装dot，定义dot language,  生成gif格式的图。
头脑中工作流
这是我头脑中的工作流（我用BrainCapturer工具截的图）我试图去构建的用于描述Curve文档流转的图表，其中需要包含各个角色的职责，各种状态跃迁的条件等。
安装dot
像其它好用的工具一样，dot对于linux和mac非常友好。
linux aptitude包管理器
sudo apt-get install graphviz
mac port包管理器：
sudo port install graphviz
Windows用户可以从http://www.graphviz.org/Download..php下载并安装
安装成功后，运行
dot -v
应当可以看到
dot &#8211; graphviz version 2.22.0 (20090304.0156)
Activated plugin library: libgvplugin_pango.6.dylib
Using textlayout: textlayout:cairo
用dot描述上述工作流
digraph G {
Start                   [label="Start", shape="box"]
Draft_In_Sandbox        [label="Draft", [...]]]></description>
			<content:encoded><![CDATA[<p>作为一名开发人员，我的理想世界是一个逻辑化的、简单的、有序的世界，而画图，则是这个世界上空的一朵乌云，因为</p>
<p>它不简单：</p>
<ul>
<li>会有十几种方框，几十种箭头，有阴影的，没阴影的，有3D效果的，有圆角的，我的选择障碍综合征每当这时就会发作。</li>
<li>它不能以简单的文本方式表现，没法通过版本管理工具跟踪每一次修改。</li>
<li>它的维护成本很高，挪动已经作好的布局，添加一个新的元素都非常耗时。</li>
</ul>
<p>它不逻辑化：</p>
<ul>
<li>在于其中很大一部分工作是让它变的好看，譬如对齐，譬如使用合适的箭头&#8230;</li>
</ul>
<p>在寻觅了很久后，我发现了dot,  它是使用纯文本描述图形的语言，它本身是一种语言规范，不同的实现，譬如<a title="Graphviz" href="http://en.wikipedia.org/wiki/Graphviz">Graphviz</a> ， Grappa等。</p>
<p>让我们从一个工作流开始，学习如何安装dot，定义dot language,  生成gif格式的图。</p>
<h2>头脑中工作流</h2>
<div id="attachment_151" class="wp-caption alignnone" style="width: 460px"><img class="size-full wp-image-151 " title="Curves workflow" src="http://www.iamhukai.com/wp-content/uploads/2010/04/workflow.gif" alt="Curves workflow" width="450" height="395" /><p class="wp-caption-text">Curves workflow</p></div>
<p>这是我头脑中的工作流（我用BrainCapturer工具截的图）我试图去构建的用于描述Curve文档流转的图表，其中需要包含各个角色的职责，各种状态跃迁的条件等。</p>
<h2>安装dot</h2>
<p>像其它好用的工具一样，dot对于linux和mac非常友好。</p>
<p>linux aptitude包管理器</p>
<blockquote><p>sudo apt-get install graphviz</p></blockquote>
<p>mac port包管理器：</p>
<blockquote><p>sudo port install graphviz</p></blockquote>
<p>Windows用户可以从http://www.graphviz.org/Download..php下载并安装</p>
<p>安装成功后，运行</p>
<blockquote><p>dot -v</p></blockquote>
<p>应当可以看到</p>
<blockquote><p>dot &#8211; graphviz version 2.22.0 (20090304.0156)<br />
Activated plugin library: libgvplugin_pango.6.dylib<br />
Using textlayout: textlayout:cairo</p></blockquote>
<h2>用dot描述上述工作流</h2>
<pre>digraph G {
Start                   [label="Start", shape="box"]
Draft_In_Sandbox        [label="Draft", shape="box"]
Ready_For_Publish       [label="Ready For Publish Curve", shape="box"]
Approved                [label= "Approved Curve", shape="box"]
Published_Curve         [label="Published Curve", shape="box"]
Deleted_Curve           [label="Deleted Curve", shape="box"]
Inactive_Curve          [label="Inactive Curve", shape="box"]

Start -&gt; Draft_In_Sandbox                      [label = "Create the curve"]
Draft_In_Sandbox -&gt; Draft_In_Sandbox           [label = "Testing the curve"]
Draft_In_Sandbox -&gt; Ready_For_Publish          [label="Mark as Ready For Publish by owner"]
Ready_For_Publish -&gt; Ready_For_Publish [label="Testing the curve by risk admin"]
Ready_For_Publish -&gt; Approved    [label = "Mark as Approved by risk admin" ]
Approved -&gt; Published_Curve      [label="Published by IT admin"]
Published_Curve -&gt; Deleted_Curve [label="Deleted by IT admin"]
Deleted_Curve -&gt; Published_Curve [label="Restored by IT admin"]
Inactive_Curve -&gt; Published_Curve[label="Reactivate the curve"]
Published_Curve -&gt; Inactive_Curve[label="Activate the curve."]
Published_Curve -&gt; Draft_In_Sandbox[label="Edit/Rename the curve."]
}

这段代码已经自解释了。我就不再浪费口舌了。dot 的语法很简单，对大脑也非常友好，譬如</pre>
<ul>
<li>不需要任何关键字，使用alphanumberic即可定义节点</li>
<li>有向连接 nodeA -&gt; nodeB</li>
<li>无向连接 nodeA &#8212; nodeB</li>
</ul>
<h2>生成图像文件</h2>
<ol>
<li>创建文件workflow.dot</li>
<li>拷贝上述内容至workflow.dot</li>
<li>在命令行中运行 dot -Tgif workflow.dot -o workflow.gif</li>
</ol>
<p>dot支持不同的输出格式，-T 选项用于切换不同的输出格式。</p>
<p>至此，我们便完成了一张图的从最初的构想到最终实现的过程。</p>
<p>dot之美在于简单，在于它定义了一种DSL, 让我可以专注在定义工作流本身。在于定义状态的变迁，维护这张图片，跟踪这张图片都变得简单, 甚至创建图片都变成了一种令我非常愉快的工作, 这种Geek的工作方式是我的至爱。</p>
<p>最后，大家可以去dot画廊看看专家们创建的图片：</p>
<ul>
<li><a href="http://www.graphviz.org/Gallery.php">http://www.graphviz.org/Gallery.php</a></li>
<li><a href="http://www.flickr.com/photos/kentbye/sets/72157601523153827/">http://www.flickr.com/photos/kentbye/sets/72157601523153827/</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.iamhukai.com/?feed=rss2&amp;p=149</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Code Review = Mercurial + WinMerge</title>
		<link>http://www.iamhukai.com/?p=147</link>
		<comments>http://www.iamhukai.com/?p=147#comments</comments>
		<pubDate>Fri, 26 Mar 2010 02:19:57 +0000</pubDate>
		<dc:creator>我是胡凯</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.iamhukai.com/?p=147</guid>
		<description><![CDATA[我爱命令行，我爱Patch格式的diff文件，但当我需要做Code Review的时候我就不再爱她了，特别是我想把代码变化中好的部分和坏的部分展示给全团队看的时候。diff文件对于大面积的浏览非常不友好。
在Windows下，我钟爱的Diff工具是免费软件WinMerge，通过如下方法可以在Mercurial中使能WinMerge(我爱使能这个词，它听起来如此的不像一个词)
下载WinMerge
将WinMergeU加入PATH环境变量
在Console中输入WinMergeU, 可以启动WinMerge
接下来你可以开始配置mercurial了，假设hg的working copy在c:\helloworld
$&#62; cd c:\helloworld\.hg
$&#62; notepad hgrc
加入下面的配置信息：

[extensions]
hgext.extdiff =
[extdiff]
cmd.winmerge = WinMergeU
opts.winmerge = /r /e /x /ub
现在你可以通过运行下面的命令行验证配置是否成功：
$&#62; cd c:\helloworld
$&#62; hg winmerge -r1 -r2
]]></description>
			<content:encoded><![CDATA[<p>我爱命令行，我爱Patch格式的diff文件，但当我需要做Code Review的时候我就不再爱她了，特别是我想把代码变化中好的部分和坏的部分展示给全团队看的时候。diff文件对于大面积的浏览非常不友好。</p>
<p>在Windows下，我钟爱的Diff工具是免费软件<a href="http://winmerge.org/">WinMerge</a>，通过如下方法可以在Mercurial中使能WinMerge(我爱使能这个词，它听起来如此的不像一个词)</p>
<blockquote><p><a href="http://winmerge.org/downloads/">下载</a>WinMerge</p>
<p>将WinMergeU加入PATH环境变量</p>
<p>在Console中输入WinMergeU, 可以启动WinMerge</p></blockquote>
<p>接下来你可以开始配置mercurial了，假设hg的working copy在c:\helloworld</p>
<blockquote><p>$&gt; cd c:\helloworld\.hg</p>
<p>$&gt; notepad hgrc</p></blockquote>
<p>加入下面的配置信息：</p>
<blockquote><p>
[extensions]<br />
hgext.extdiff =</p>
<p>[extdiff]<br />
cmd.winmerge = WinMergeU<br />
opts.winmerge = /r /e /x /ub</p></blockquote>
<p>现在你可以通过运行下面的命令行验证配置是否成功：</p>
<blockquote><p>$&gt; cd c:\helloworld</p>
<p>$&gt; hg winmerge -r1 -r2</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.iamhukai.com/?feed=rss2&amp;p=147</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
