﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>博客园-ztotem</title><link>http://www.cnblogs.com/ztotem/</link><description /><language>zh-cn</language><lastBuildDate>Wed, 19 Nov 2008 08:51:17 GMT</lastBuildDate><pubDate>Wed, 19 Nov 2008 08:51:17 GMT</pubDate><ttl>60</ttl><item><title>不用游标 遍历记录的sql语句</title><link>http://www.cnblogs.com/ztotem/archive/2008/11/04/1326217.html</link><dc:creator>ztotem</dc:creator><author>ztotem</author><pubDate>Tue, 04 Nov 2008 04:52:00 GMT</pubDate><guid>http://www.cnblogs.com/ztotem/archive/2008/11/04/1326217.html</guid><wfw:comment>http://www.cnblogs.com/ztotem/comments/1326217.html</wfw:comment><comments>http://www.cnblogs.com/ztotem/archive/2008/11/04/1326217.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnblogs.com/ztotem/comments/commentRss/1326217.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/ztotem/services/trackbacks/1326217.html</trackback:ping><description><![CDATA[<p>&nbsp;</p>
<div class="cnblogs_code"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080">--</span><span style="color: #008080">声明变量表@tb</span><span style="color: #008080"><br />
</span><span style="color: #0000ff">declare</span><span style="color: #000000">&nbsp;</span><span style="color: #008000">@tb</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">table</span><span style="color: #000000">(id&nbsp;</span><span style="color: #0000ff">int</span><span style="color: #000000">,name&nbsp;</span><span style="color: #0000ff">varchar</span><span style="color: #000000">(</span><span style="font-weight: bold; color: #800000">50</span><span style="color: #000000">))<br />
<br />
</span><span style="color: #008080">--</span><span style="color: #008080">添加测试数据</span><span style="color: #008080"><br />
</span><span style="color: #0000ff">insert</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">into</span><span style="color: #000000">&nbsp;</span><span style="color: #008000">@tb</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">6</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">aa</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">7</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">bb</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">8</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">cc</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">9</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">dd</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">10</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">abc</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">11</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">ddef</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">12</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">fda</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">13</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">rewr</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">14</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">eyt</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">15</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">jjy</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">16</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">bbbxd</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">17</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">xxx</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">18</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">ffff</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">19</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">wwwwwwww</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">union</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">all</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="font-weight: bold; color: #800000">20</span><span style="color: #000000">,</span><span style="color: #ff0000">'</span><span style="color: #ff0000">aaaaaaaaaa</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;&nbsp;<br />
<br />
</span><span style="color: #008080">/*</span><span style="color: #008080"><br />
查看表中数据<br />
select&nbsp;*&nbsp;from&nbsp;@tb&nbsp;<br />
</span><span style="color: #008080">*/</span><span style="color: #000000"><br />
<br />
</span><span style="color: #008080">--</span><span style="color: #008080">声明循环用的&#8220;指针&#8221;</span><span style="color: #008080"><br />
</span><span style="color: #0000ff">declare</span><span style="color: #000000">&nbsp;</span><span style="color: #008000">@min</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">varchar</span><span style="color: #000000">(</span><span style="font-weight: bold; color: #800000">5</span><span style="color: #000000">)<br />
</span><span style="color: #008080">--</span><span style="color: #008080">赋初值</span><span style="color: #008080"><br />
</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="color: #008000">@min</span><span style="color: #808080">=</span><span style="color: #ff00ff">min</span><span style="color: #000000">(id)&nbsp;</span><span style="color: #0000ff">from</span><span style="color: #000000">&nbsp;</span><span style="color: #008000">@tb</span><span style="color: #000000">&nbsp;&nbsp;<br />
</span><span style="color: #008080">--</span><span style="color: #008080">开始循环</span><span style="color: #008080"><br />
</span><span style="color: #0000ff">while</span><span style="color: #000000">&nbsp;</span><span style="color: #008000">@min</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">is</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">not</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">null</span><span style="color: #000000"><br />
</span><span style="color: #0000ff">begin</span><span style="color: #000000"><br />
&nbsp;&nbsp;</span><span style="color: #0000ff">print</span><span style="color: #000000">&nbsp;</span><span style="color: #008000">@min</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="color: #008080">--</span><span style="color: #008080">打印当前&#8220;指针&#8221;的值</span><span style="color: #008080"><br />
</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="color: #0000ff">select</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="color: #008000">@min</span><span style="color: #808080">=</span><span style="color: #ff00ff">min</span><span style="color: #000000">(id)&nbsp;</span><span style="color: #0000ff">from</span><span style="color: #000000">&nbsp;</span><span style="color: #008000">@tb</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">where</span><span style="color: #000000">&nbsp;id</span><span style="color: #808080">&gt;</span><span style="color: #008000">@min</span><span style="color: #000000">&nbsp;&nbsp;</span><span style="color: #008080">--</span><span style="color: #008080">更新&#8220;指针&#8221;内容，使之移到下一记录</span><span style="color: #008080"><br />
</span><span style="color: #0000ff">end</span></div>
<img src ="http://www.cnblogs.com/ztotem/aggbug/1326217.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43607/" target="_blank">[新闻]后“开放”平台时代</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>在正则中进行判断（三目运算）</title><link>http://www.cnblogs.com/ztotem/archive/2008/10/21/1315936.html</link><dc:creator>ztotem</dc:creator><author>ztotem</author><pubDate>Tue, 21 Oct 2008 06:36:00 GMT</pubDate><guid>http://www.cnblogs.com/ztotem/archive/2008/10/21/1315936.html</guid><wfw:comment>http://www.cnblogs.com/ztotem/comments/1315936.html</wfw:comment><comments>http://www.cnblogs.com/ztotem/archive/2008/10/21/1315936.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cnblogs.com/ztotem/comments/commentRss/1315936.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/ztotem/services/trackbacks/1315936.html</trackback:ping><description><![CDATA[<p>&nbsp;</p>
<p>&nbsp;</p>
<div class="cnblogs_code"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /><span style="color: #0000ff">&lt;</span><span style="color: #800000">a&nbsp;</span><span style="color: #ff0000">href</span><span style="color: #0000ff">="fdsafd"</span><span style="color: #ff0000">&nbsp;target</span><span style="color: #0000ff">="_blank"</span><span style="color: #ff0000">&nbsp;class</span><span style="color: #0000ff">="t"</span><span style="color: #ff0000">&nbsp;</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">fjdafdak</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">a</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br />
<img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">a&nbsp;</span><span style="color: #ff0000">href</span><span style="color: #0000ff">="xxfdsafd"</span><span style="color: #ff0000">&nbsp;title</span><span style="color: #0000ff">="abcde"</span><span style="color: #ff0000">&nbsp;target</span><span style="color: #0000ff">="_blank"</span><span style="color: #ff0000">&nbsp;class</span><span style="color: #0000ff">="t"</span><span style="color: #ff0000">&nbsp;</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">fjaddk<img src="http://www.cnblogs.com/Images/dot.gif"  alt="" /></span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">a</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br />
<img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">a&nbsp;</span><span style="color: #ff0000">href</span><span style="color: #0000ff">="yyfdsafd"</span><span style="color: #ff0000">&nbsp;target</span><span style="color: #0000ff">="_blank"</span><span style="color: #ff0000">&nbsp;class</span><span style="color: #0000ff">="t"</span><span style="color: #ff0000">&nbsp;</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">fjafdk</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">a</span><span style="color: #0000ff">&gt;</span><span style="color: #000000"><br />
<img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /></span><span style="color: #0000ff">&lt;</span><span style="color: #800000">a&nbsp;</span><span style="color: #ff0000">href</span><span style="color: #0000ff">="zzfdsafd"</span><span style="color: #ff0000">&nbsp;target</span><span style="color: #0000ff">="_blank"</span><span style="color: #ff0000">&nbsp;class</span><span style="color: #0000ff">="t"</span><span style="color: #ff0000">&nbsp;</span><span style="color: #0000ff">&gt;</span><span style="color: #000000">fjaddddk</span><span style="color: #0000ff">&lt;/</span><span style="color: #800000">a</span><span style="color: #0000ff">&gt;</span></div>
<p>&nbsp;</p>
<p>朋友需要提取形如以上内容中的url和title，且取title时须判断&lt;a&gt;标签中是否存在title属性，如果存在，则匹配title属性的值，否则匹配&lt;a&gt;&lt;/a&gt;之间的值作为title。</p>
<p>通过三目运算，可以很方便解决上面的需求。</p>
<p>&nbsp;三目表达式&nbsp; (?(expression)yes|no) </p>
<p>说明：如果expression被搜索到就执行yes部分,否则就执行no部分。</p>
<p>编写正则如下：</p>
<div class="cnblogs_code"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img src="http://www.cnblogs.com/Images/OutliningIndicators/None.gif" align="top"  alt="" /><span style="color: #000000">&lt;</span><span style="color: #000000">a&nbsp;href</span><span style="color: #000000">=</span><span style="color: #000000">"</span><span style="color: #000000">(?&lt;url&gt;[^</span><span style="color: #000000">"</span><span style="color: #000000">]</span><span style="color: #000000">*?</span><span style="color: #000000">)</span><span style="color: #000000">"</span><span style="color: #000000">&nbsp;(?(title=</span><span style="color: #000000">"</span><span style="color: #000000">[</span><span style="color: #000000">^</span><span style="color: #000000">"</span><span style="color: #000000">]*?</span><span style="color: #000000">"</span><span style="color: #000000">[</span><span style="color: #000000">^&lt;&gt;</span><span style="color: #000000">]</span><span style="color: #000000">*&gt;</span><span style="color: #000000">[\s\S]</span><span style="color: #000000">*?</span><span style="color: #000000">)title</span><span style="color: #000000">=</span><span style="color: #000000">"</span><span style="color: #000000">(?&lt;title&gt;[^</span><span style="color: #000000">"</span><span style="color: #000000">]</span><span style="color: #000000">*?</span><span style="color: #000000">)</span><span style="color: #000000">"</span><span style="color: #000000">[^&lt;&gt;]*&gt;[\s\S]*?|[^&lt;&gt;]*&gt;(?&lt;title&gt;[\s\S]*?))&lt;/[^&lt;&gt;]*&gt;</span></div>
<p>&nbsp;</p>
<p>经过正则表达式测试工具测试，提取成功。</p>
<img src ="http://www.cnblogs.com/ztotem/aggbug/1315936.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43606/" target="_blank">[新闻]李彦宏首次表态竞价排名问题:有错能改善莫大焉</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>C#后台线程和UI的交互 (转)</title><link>http://www.cnblogs.com/ztotem/archive/2008/10/03/1303603.html</link><dc:creator>ztotem</dc:creator><author>ztotem</author><pubDate>Fri, 03 Oct 2008 14:51:00 GMT</pubDate><guid>http://www.cnblogs.com/ztotem/archive/2008/10/03/1303603.html</guid><wfw:comment>http://www.cnblogs.com/ztotem/comments/1303603.html</wfw:comment><comments>http://www.cnblogs.com/ztotem/archive/2008/10/03/1303603.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/ztotem/comments/commentRss/1303603.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/ztotem/services/trackbacks/1303603.html</trackback:ping><description><![CDATA[摘要: --> 在C#中，从Main()方法开始一个默认的线程，一般称之为主线程，如果在这个进行一些非常耗CPU的计算，那么UI界面就会被挂起而处于假死状态，也就是说无法和用户进行交互了，特别是要用类似进度条来实时显示一些提示信息的时候，这种情况就显得很糟糕。如果多开一些线程来完成一些耗时的计算，那么工作线程也是无法如此更新UI界面中的元素的，比如直接显示一个提示信息：label1.Text=outstr&nbsp;&nbsp;<a href='http://www.cnblogs.com/ztotem/archive/2008/10/03/1303603.html'>阅读全文</a><img src ="http://www.cnblogs.com/ztotem/aggbug/1303603.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43605/" target="_blank">[新闻]杨致远发表博客解释辞职原因</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>ReaderWriterLock(定义支持单个写线程和多个读线程的锁),Mutex(一个同步基元，也可用于进程间同步。 ) </title><link>http://www.cnblogs.com/ztotem/archive/2008/10/02/1303007.html</link><dc:creator>ztotem</dc:creator><author>ztotem</author><pubDate>Wed, 01 Oct 2008 16:34:00 GMT</pubDate><guid>http://www.cnblogs.com/ztotem/archive/2008/10/02/1303007.html</guid><wfw:comment>http://www.cnblogs.com/ztotem/comments/1303007.html</wfw:comment><comments>http://www.cnblogs.com/ztotem/archive/2008/10/02/1303007.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/ztotem/comments/commentRss/1303007.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/ztotem/services/trackbacks/1303007.html</trackback:ping><description><![CDATA[摘要: ReaderWriterLock用于同步对资源的访问。在任一特定时刻，它允许多个线程同时进行读访问，或者允许单个线程进行写访问。在资源不经常发生更改的情况下，ReaderWriterLock所提供的吞吐量比简单的一次只允许一个线程的锁（如Monitor）更高。在多数访问为读访问，而写访问频率较低、持续时间也比较短的情况下，ReaderWriterLock的性能最好。多个读线程与单个写线程交替进行操&nbsp;&nbsp;<a href='http://www.cnblogs.com/ztotem/archive/2008/10/02/1303007.html'>阅读全文</a><img src ="http://www.cnblogs.com/ztotem/aggbug/1303007.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43604/" target="_blank">[新闻]微软公布免费安全软件计划</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>职场九大谎言</title><link>http://www.cnblogs.com/ztotem/archive/2008/10/02/1303006.html</link><dc:creator>ztotem</dc:creator><author>ztotem</author><pubDate>Wed, 01 Oct 2008 16:26:00 GMT</pubDate><guid>http://www.cnblogs.com/ztotem/archive/2008/10/02/1303006.html</guid><wfw:comment>http://www.cnblogs.com/ztotem/comments/1303006.html</wfw:comment><comments>http://www.cnblogs.com/ztotem/archive/2008/10/02/1303006.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/ztotem/comments/commentRss/1303006.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/ztotem/services/trackbacks/1303006.html</trackback:ping><description><![CDATA[<p><br />
1如果你从事的是你喜欢的工作,你会更加开心.<br />
你高估了快乐与你工作之间的关系.到目前为止最重要的因素是---你的乐观程度和你与同事之间的人际关系.如果你是一个悲观者,再好的工作也不能使你开心.如果你有一群很好的朋友和一个快乐的家庭,即使你讨厌你的工作,你也会感到很开心(试想一下一个陷入爱情中的捡破烂的人吧.)<br />
2不断换工作无益于你<br />
不断的换工作是保持你的工作激情和使你个人得到发展的良好途径.以下是对那些跳槽者的一些建议:大部分的人在18~30岁之间都换过八次工作.这就意味着大部分的年轻人都是跳槽者所以雇用经理别无选择,他们只得雇用那些人.跟随潮流,多做一些你没有尝试过的工作吧.<br />
3玻璃天花板仍然存在<br />
玻璃天花板时代的结束并不是因为人们将它打碎,而是人们不再需要它.在玻璃天花板上的生活是为别人一周工作100个小时,没有时间和家人朋友呆在一起.不仅仅是女士对这种升职机会说不,就连男士也无法接受这种升职途径.人们不想利用别人来使自己升职.既然没有人愿意这样做,玻璃天花板的时代也就结束了.(这一段理解的不是很透彻,如有不足望多见谅.)<br />
4办公室政治是陷阱<br />
那些擅长办公室政治的人是那些受到同事欢迎的人.他们常常帮助别人获得他们想要的东西.这就意味着你需要时间去了解别人需要什么,你要怎样做才能帮助他们获得他们想要的东西.你需要随时向别人提供帮助,这样你就不需要坚强的后盾来操纵别人,你日益提升的权威会使你周围的人在你需要的时候帮助你.<br />
5好好工作,你会做的更好<br />
如果你不告诉别人,没有人会知道你在办公室里做什么.所以如果你的工作做的很好,让别人知道..自吹自擂并不是疯了,当你希望别人帮你完成工作才是不现实的想法.所以如果你要做好工作只是一时的激情的话,人们只会认为你的办事能力一般.所以只有你的合作者愿意协助你的时候,你才能将你的工作做到最好.<br />
6你需要有一份好的简历<br />
只有百分之十的人能在随意发送个人简历中获得工作.大部分的人是通过网络关系获得工作的.一旦你和用人单位取得联系,雇佣者觉得你的简历不错,你就有可能被雇用.所以你需要一份好的简历和熟落的网络联系,这样你便不用担心你找不到工作.<br />
7谁擅长网络技术,谁就拥有好的网络交际网<br />
真诚的对待你所遇到的朋友,和你喜欢的人保持联系.你就会有一群欣赏你的朋友,在你有困难的时候帮助你.使用 LinkedIn来联络你的人际关系网,你只需要和你喜欢的朋友在一起你就可以建立一张强大的人际关系网<br />
8只要努力工作好运就会来临<br />
每个人一周都可以工作70个小时,但这并不意味着你把工作做好了.好好吃一顿午餐,早点完成你的工作,完美的思思维需要空间,灵活性和时间,让人们知道当你对着墙看时,你正在思考一个重要的问题.<br />
9发现你的闪光点<br />
除了你自己外没有人能为你创造一个适合你的工作方程式,只有你自己是最了解你的,知道知识是无止境的.找出你自己最喜欢做的事情,朝着这个方向前进.向别人展示你好的一面你就会有好的人际交流网.那些杰出的领导者都极具权威,他们和许多人有着真诚而又意味深长的联系.真诚是改变世界最有效的工具. <br />
</p>
<img src ="http://www.cnblogs.com/ztotem/aggbug/1303006.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43604/" target="_blank">[新闻]微软公布免费安全软件计划</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>10种你会碰到的程序员（翻译）</title><link>http://www.cnblogs.com/ztotem/archive/2008/10/02/1302998.html</link><dc:creator>ztotem</dc:creator><author>ztotem</author><pubDate>Wed, 01 Oct 2008 16:07:00 GMT</pubDate><guid>http://www.cnblogs.com/ztotem/archive/2008/10/02/1302998.html</guid><wfw:comment>http://www.cnblogs.com/ztotem/comments/1302998.html</wfw:comment><comments>http://www.cnblogs.com/ztotem/archive/2008/10/02/1302998.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/ztotem/comments/commentRss/1302998.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/ztotem/services/trackbacks/1302998.html</trackback:ping><description><![CDATA[<p>&nbsp;</p>
<p>你若是一个程序员，你会是哪一种那？</p>
<p>Programmers enjoy a reputation for being peculiar people. In fact, even within the development community, there are certain programmer archetypes that other programmers find strange. Here are 10 types of programmers you are likely to run across. Can you think of any more? <br />
程序员素来就被认为是一个奇特的人群。实际上，就算在程序开发者社群本身之中，也有一些特别的人群能让其他程序员觉得很奇怪。在这我列出10种你可能遇到过的程序员，你能想出更多么？ </p>
<p>&nbsp;</p>
<p>#1: Gandalf <br />
#1:甘道夫 <br />
This programmer type looks like a short-list candidate to play Gandalf in The Lord of the Rings. He (or even she!) has a beard halfway to his knees, a goofy looking hat, and may wear a cape or a cloak in the winter. Luckily for the team, this person is just as adept at working magic as Gandalf. Unluckily for the team, they will need to endure hours of stories from Gandalf about how he or she to walk uphill both ways in the snow to drop off the punch cards at the computer room. The Gandalf type is your heaviest hitter, but you try to leave them in the rear and call them up only in times of desperation. <br />
这种程序员看起来，就像是在《指环王》里扮演甘道夫的最佳候选人。他（甚至是她）有着快要到膝盖的胡子，一顶看起来傻傻的帽子，在冬天可能还会穿一件披风或者是斗篷。对于团队来说幸运的是，此人对自己工作的熟练程度就像甘道夫一样。但不幸的是，他们要经常忍受甘道夫长达数个小时的故事的折磨，而内容主要是关于他或者是她是如何不得不在雪地中上山下山，以把打好孔的纸带送到计算机房。甘道夫类型的程序员是你的究极武器，但是你会总是希望能把他们排到后面，只在快要绝望的时候才向他们寻求帮助。 </p>
<p><br />
#2: The Martyr <br />
#2:烈士 <br />
In any other profession, The Martyr is simply a &#8220;workaholic.&#8221; But in the development field, The Martyr goes beyond that and into another dimension. Workaholics at least go home to shower and sleep. The Martyr takes pride in sleeping at the desk amidst empty pizza boxes. The problem is, no one ever asked The Martyr to work like this. And he or she tries to guilt-trip the rest of the team with phrases like, &#8220;Yeah, go home and enjoy dinner. I&#8217;ll finish up the next three week&#8217;s worth of code tonight.&#8221; <br />
对于任何其它职业来说，烈士其实就是一个工作狂而已。但是在开发者的领域，烈士完全进入了另外一个范畴。工作狂至少会回家洗澡睡觉，而烈士们却会以睡在桌子底下的空皮萨盒子堆之中为荣。而问题是，根本就没人要求烈士们像这样工作。而且他或者她总是想用这样的措辞来使团队中的其他人感到内疚，&#8220;好的，你们回家吃完饭吧。我会在今晚会完成相当于3个星期的工作量的。&#8221; </p>
<p><br />
#3: Fanboy <br />
#3:玩家 <br />
Watch out for Fanboy. If he or she corners you, you&#8217;re in for a three-hour lecture about the superiority of Dragonball Z compared to Gundam Wing, or why the Playstation 3 is better than the XB 360. Fanboy&#8217;s workspace is filled with posters, action figures, and other knick-knacks related to some obsession, most likely imported from Japan. Not only are Fanboys obnoxious to deal with, they often put so much time into the obsession (both in and out of the office) that they have no clue when it comes to doing what they were hired to do. <br />
小心玩家。如果他或者是她注意到了你，你很有可能就要接受3至4个小时关于龙珠z与高达谁更强、或者是playstation 3 与xbox 360哪个更好的演讲。玩家的桌子上总是堆满了明信片、动作人偶、以及其他各种各样相关的装饰品，大部分可能都是从日本进口的。玩家们不光是很难相处，他们有的时候实在是太多时间在这些东西上（无论是在办公室内外），以至于他们根本就不明白他们什么时候该干老板雇他们做的工作。 </p>
<p><br />
#4: Vince Neil <br />
#4:文斯 内尔(一个比较有名的摇滚歌手) <br />
This 40-something is a throwback to 1984 in all of the wrong ways. Sporting big hair, ripped stonewashed jeans, and a bandana here or there, Vince sits in the office humming Bon Jovi and Def Leppard tunes throughout the workday. This would not be so bad if &#8220;Pour Some Sugar on Me&#8221; was not so darned infectious. <br />
这个40岁的家伙就像是颠三倒四的回到了1984.运动型爆炸头，发皱泛白的牛仔裤，还有一条大围巾。文斯还会在工作时间坐在办公室哼着Bon Jovi 和 Def Leppard的歌，这本来也不是很糟，如果《Pour Some Sugar on Me》不是如此的有感染力的话。 <br />
Vince is generally a fun person to work with, and actually has a ton of experience, but just never grew up. But Vince becomes a hassle when he or she tries living the rock &#8216;n roll lifestyle to go with the hair and hi-tops. It&#8217;s fairly hard to work with someone who carries a hangover to work every day. <br />
总体来说，和文斯一起工作是很有趣的，实际上他有丰富的经验，只是永远长不大而已。但是如果文斯决定用他或者是她的摇滚风格来处理自己的头发和生活的时候，情况就会变得很棘手。因为和一个每天都带着宿醉未醒的人一起工作，相当困难。 </p>
<p><br />
#5: The Ninja <br />
#5:忍者 <br />
The Ninja is your team&#8217;s MVP, and no one knows it. Like the legendary assassins, you do not know that The Ninja is even in the building or working, but you discover the evidence in the morning. You fire up the source control system and see that at 4 AM, The Ninja checked in code that addresses the problem you planned to spend all week working on, and you did not even know that The Ninja was aware of the project! See, while you were in Yet Another Meeting, The Ninja was working. <br />
忍者是你们团队当中的重要人物，但是却没人能意识到这点。就好象传奇刺客一样，你不知道忍者是什么时候工作的，但是你总是在第二天早晨发现他们的成果。于是你急忙打开源代码控制系统，然后发现在临晨4点，忍者提交了一份代码，解决了一个你已经研究了一个星期的问题，而你之前甚至都不知道忍者大人知道你所作的项目的存在。明白了吧，当你还在一次次的开会的时候，忍者一直在工作。 <br />
Ninjas are so stealthy, you might not even know their name, but you know that every project they&#8217;re on seems to go much more smoothly. Tread carefully, though. The Ninja is a lone warrior; don&#8217;t try to force him or her to work with rank and file. <br />
忍者是如此的隐蔽，你甚至都不知道他们的名字，但是你知道每一个他们参与的项目都进行的更顺利。不过，注意点，忍者是孤胆战士，不要试图强迫他们在一个严格的等级和文档制度下工作。 </p>
<p><br />
#6: The Theoretician <br />
#6:理论家 <br />
The Theoretician knows everything there is to know about programming. He or she can spend four hours lecturing about the history of an obscure programming language or providing a proof of how the code you wrote is less than perfectly optimal and may take an extra three nanoseconds to run. The problem is, The Theoretician does not know a thing about software development. When The Theoretician writes code, it is so &#8220;elegant&#8221; that mere mortals cannot make sense of it. His or her favorite technique is recursion, and every block of code is tweaked to the max, at the expense of timelines and readability. <br />
理论家知道一切编程需要知道的东西。他或者是她可以花4个小时去探讨一个很冷僻的语言，或者去证明你写的代码是如何的不完美并且有可能会在运行的时候多花3纳秒。问题在于，理论家根本就不知道什么叫软件开发。当理论家写代码的时候，他的代码是如此的&#8220;优美&#8221;，以至于我们这些凡人根本就看不懂。他或者她最喜爱的技术就是递归，每一个代码块都被使用到了极致，而代价就是工程进度和可读性。 <br />
The Theoretician is also easily distracted. A simple task that should take an hour takes Theoreticians three months, since they decide that the existing tools are not sufficient and they must build new tools to build new libraries to build a whole new system that meets their high standards. The Theoretician can be turned into one of your best players, if you can get him or her to play within the boundaries of the project itself and stop spending time working on The Ultimate Sorting Algorithm. <br />
理论家还很容易分心。一个花一个小时就能完成的工作，理论家们往往需要三个月。因为他们认为当前的开发工具不够好，所以他们必须开发一些新的工具来构建新的库从而构建一个全新的系统来迎合他们的高标准。理论家可以成为你最好的团队成员，前提是你能让他专注于你们所做的工程本身，而不是把时间都花在究极排序算法上。 </p>
<p><br />
#7: The Code Cowboy <br />
#7:代码牛仔 <br />
The Code Cowboy is a force of nature that cannot be stopped. He or she is almost always a great programmer and can do work two or three times faster than anyone else. The problem is, at least half of that speed comes by cutting corners. The Code Cowboy feels that checking code into source control takes too long, storing configuration data outside of the code itself takes too long, communicating with anyone else takes too long&#8230; you get the idea. <br />
代码牛仔是一种无法阻止的天性。他或者她几乎总是一个厉害的编程者，并且总是能以别人2至3倍的速度完成工作。问题是，这些代码至少有一半都靠偷工减料得来的。代码牛仔认为把代码提交到源码控制系统太麻烦，把配置信息存贮在代码之外太麻烦，和其它人交流太麻烦&#8230;&#8230;你懂我的意思吧。 <br />
The Code Cowboy&#8217;s code is a spaghetti code mess, because he or she was working so quickly that the needed refactoring never happened. Chances are, seven pages&#8217; worth of core functionality looks like the &#8220;don&#8217;t do this&#8221; example of a programming textbook, but it magically works. The Code Cowboy definitely does not play well with others. And if you put two Code Cowboys on the same project, it is guaranteed to fail, as they trample on each other&#8217;s changes and shoot each other in the foot. <br />
代码牛仔的代码就好像意大利面条一样搅在一起，因为他或者她工作的事如此之快，以至于必要的重够都没有做到。很有可能的是，七页长的核心功能代码也许看起来就像是教科书上关于&#8220;不要这么做&#8221;的示例，而这些代码居然还神奇的可以运行。代码牛仔绝对没办法和别人一起工作。而且，如果你让两个代码牛仔进入同一个工程，那这个工程一定会失败，因为一个总是被另一个人对代码做的修改而干扰，他们总是拼命的在开枪射击自己搭档的脚。 <br />
Put a Code Cowboy on a project where hitting the deadline is more important than doing it right, and the code will be done just before deadline every time. The Code Cowboy is really just a loud, boisterous version of The Ninja. While The Ninja executes with surgical precision, The Code Cowboy is a raging bull and will gore anything that gets in the way. <br />
当按时完成一个工程比把这个工程做好更重要的时候，把一个代码牛仔加入进去吧，这个工程会在截至日期之前完成的。代码牛仔其实就是一个吵闹版的忍者。只是忍者像做外科手术一样精准的编码，而代码牛仔像一只难以控制的公牛，会把所以挡在它面的东西顶翻。 </p>
<p><br />
#8: The Paratrooper <br />
#8:伞兵 <br />
You know those movies where a sole commando is air-dropped deep behind enemy lines and comes out with the secret battle plans? That person in a software development shop is The Paratrooper. The Paratrooper is the last resort programmer you send in to save a dying project. Paratroopers lack the patience to work on a long-term assignment, but their best asset is an uncanny ability to learn an unfamiliar codebase and work within it. Other programmers might take weeks or months to learn enough about a project to effectively work on it; The Paratrooper takes hours or days. Paratroopers might not learn enough to work on the core of the code, but the lack of ramp-up time means that they can succeed where an entire team might fail. <br />
你知道那些电影吧，就是指挥官带着机密作战计划被空降到敌人战线之后。在软件开发中，这样的人叫伞兵。伞兵是你对一个将要失败的工程的最后援助。伞兵们缺乏在一个长期任务上工作的耐心。他们最大的价值是拥有快速学习一堆完全陌生的代码并且使用它们工作的惊人能力。其他程序员也许要花几个星期或者其几个月来熟悉一个工程，以便可以有效的参与其中；伞兵们只需要几个小时或者几天。伞兵快速学会的东西也许不能让他们编写核心代码，但是，没有足够的时间形成一个固定的见解可能会帮助他在整个团队失败的地方取得成功。 </p>
<p><br />
#9: Mediocre Man <br />
#9:庸才 <br />
&#8220;Good enough&#8221; is the best you will ever get from Mediocre Man. Don&#8217;t let the name fool you; there are female varieties of Mediocre Man too. And he or she always takes longer to produce worse code than anyone else on the team. &#8220;Slow and steady barely finishes the race&#8221; could describe Mediocre Man&#8217;s projects. But Mediocre Man is always just &#8220;good enough&#8221; to remain employed. <br />
&#8220;足够好了&#8221;，这就是你从一个庸才那能听到的最好的话。他或者是她总是花更多的时间写出比团队中其他任何人都更差的代码。&#8220;缓慢，刚刚符合要求&#8221;就是对庸才所作的项目的描述。但庸才们总是能做的&#8220;足够好&#8221;，以至于刚好不会被解雇。 <br />
When you interview this type, they can tell you a lot about the projects they&#8217;ve been involved with but not much about their actual involvement. Filtering out the Mediocre Man type is fairly easy: Ask for actual details of the work they&#8217;ve done, and they suddenly get a case of amnesia. Let them into your organization, though, and it might take years to get rid of them. <br />
当你面试这种人的时候，他可以告诉你很多他到参与过的项目，但却很少提到他们到底在这些项目里做了什么。筛出这些庸才的方法很简单：问一下他所做工作的细节，他们会突然得了健忘症。但是，一旦让这种人进入你的组织，你可能要花好几年才能再摆脱他们。 </p>
<p><br />
#10: The Evangelist <br />
#10:传教士 <br />
No matter what kind of environment you have, The Evangelist insists that it can be improved by throwing away all of your tools and processes and replacing them with something else. The Evangelist is actually the opposite of The Theoretician. The Evangelist is outspoken, knows an awful lot about software development, but performs very little actual programming. <br />
无论你在用哪种编程环境，传教士总会坚持认为如果你把现有的工具和工序抛弃掉并换成其它的一些东西，会对你有很大的帮助。传教士实际上就是理论家的反面。传教士总是直来直去，对软件开发很了解，但却很少真正的去编码。 <br />
The Evangelist is secretly a project manager or department manager at heart but lacks the knowledge or experience to make the jump. So until The Evangelist is able to get into a purely managerial role, everyone else needs to put up with his or her attempts to revolutionize the workplace. <br />
传教士有一颗项目经理或者部门经理的心，但却缺乏足够的知识或者经验来完成这个跳跃。所以在传教士最终成为一个纯管理者角色之前，其他人不得不一直忍受传教士们对于彻底革新工作环境的尝试。<br />
&nbsp;<br />
</p>
<img src ="http://www.cnblogs.com/ztotem/aggbug/1302998.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43604/" target="_blank">[新闻]微软公布免费安全软件计划</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>解悟人生三境界(转)</title><link>http://www.cnblogs.com/ztotem/archive/2008/09/21/1295458.html</link><dc:creator>ztotem</dc:creator><author>ztotem</author><pubDate>Sun, 21 Sep 2008 13:12:00 GMT</pubDate><guid>http://www.cnblogs.com/ztotem/archive/2008/09/21/1295458.html</guid><wfw:comment>http://www.cnblogs.com/ztotem/comments/1295458.html</wfw:comment><comments>http://www.cnblogs.com/ztotem/archive/2008/09/21/1295458.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/ztotem/comments/commentRss/1295458.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/ztotem/services/trackbacks/1295458.html</trackback:ping><description><![CDATA[<p>&nbsp;&nbsp; 王国维在他的《人间词话》中描述了人生的三种境界：第一种&#8220;昨夜西风凋碧树，独上高楼，望断天涯路&#8221;；第二种&#8220;衣带渐宽终不悔，为伊消得人憔悴&#8221;；第三种&#8220;众里寻他千百度，蓦然回首，那人却在灯火阑珊处&#8221;。后人归之为：知、行、得三境界。 <br />
&nbsp;</p>
<p>&nbsp; 由王国维的三境界论，推崇的很多，有人效仿&#8220;三境界&#8221;的划分法：知之、好之、乐之；丰之恺认为：&#8220;物质、精神、灵魂&#8221;这是人生三层境界；有人认为，人生三境界不外乎是为自己、为家庭、为社会；也有人说为知、为己、为人；有人认为理想、事业、爱情；还有人形象地比喻为：&#8220;看山是山，看水是水；看山不是山，看水不是水；看山还是山，看水还是水。&#8221;等等，林林总总，琳琅满目。</p>
<p>&nbsp;</p>
<p>&nbsp; 掩卷思之，漫漫的人生历程，是个复杂而多变的过程，对于不同的人生有不同的看法，可谓是仁者见仁，智者见智。本文就&#8220;看山看水&#8221;的三境界而剖析一下。</p>
<p>&nbsp;</p>
<p>&nbsp;&nbsp; &#8220;看山是山，看水是水。&#8221; 这种境界是针对孩子说的，初识世界，纯洁无瑕，一切都是新鲜的、陌生的，眼睛看见什么就是什么，你告诉他这是山，他就认识了山；告诉他这是水，他就认识了水，不会故意认错，以致说1是1，2是2，丁是丁，卯是卯。有一个小故事很能说明这点：一群大人在进行智力竞赛，主持人说&#8220;6&#8221;&#8220;9&#8221;不掉头，就出了个题：&#8220;6+9＝？&#8221;，大家都在想，智力竞赛题目决不会就字面那么简单，结果谁都不敢立即抢答，而是苦苦思索。突然，一个6岁的小女孩争着说等于15，人们都向她投去异样的目光，直到主持人宣布小宝贝的答案正确时，人们才收回目光，并责怪自己的思想太复杂了，错过了抢答的时机。这里说了一个简单的道理，凡事不必太刻意。</p>
<p>&nbsp;</p>
<p>&nbsp; &#8220;看山不是山，看水不是水。&#8221; 这种境界是针对中年人说的，随着年龄的增长，社会阅历的增多，人们的思想也变得越来越复杂了，尤其是在物欲横流的社会，尔虞我诈，互不信任，人们的世界观、人生观、价值观同孩提时代相比，发生了深刻的变化，不再轻易相信眼前的一切，而是用心、用脑去认识这个世界。发现这个世界的问题越来越多，越来越复杂，感觉到社会并不那么单纯，现实也并不那么美好，经常是黑白颠倒，是非混淆，无理走遍天下，有理寸步难行，好人无好报，恶人活千年。进入这个阶段，人是激愤的，不平的，忧虑的，疑问的，警惕的，复杂的。人不愿意再轻易地相信什么。此时，人们看到的山不再是单纯意义上的山，水不再是单纯意义上的水了，叫做看山感慨，看水叹息，以致出现了许许多多借古讽今，指桑骂槐，指鹿为马的故事。有些人，站在这山望着那山更高；沐在此水，又想到那水更净，欲壑难填，永远也没有满足的境地。 </p>
<p>&nbsp;</p>
<p>&nbsp; &#8220;看山还是山，看水还是水。&#8221;这是针对那些走过大半辈子或经历太多事件的人而言，在经历了种种事件，看过了形形色色的人或事，有了一种曾经沧海的感觉，茅塞顿开，回归自然。也许经历了太多，人的境界也高了，不再会为无谓的事或无伤大雅或不可能实现的事而伤脑费神。任尔红尘滚滚，我自清风朗月。面对芜杂世俗之事，一笑了之，这个时候的人看山又是山，看水又是水了。他们更明白，更懂得，以一颗平常心来看待事物，明白如果跳出是非圈子，以观棋者、看戏人的角度来看事物，也许事情会简单许多，正如苏轼所言&#8220;不识庐山真面目，只缘身在此山中。&#8221; 王国维所道&#8220;众里寻她千百度，蓦然回首，那人却在灯火阑珊处&#8221;！人们都希望能到达人生的最高境界，即这第三境界，体味那战胜自我，超越极限后一览众山小的胜利感，然而在这自我提炼、自我实现的过程中，许多优秀的品质都是不可或缺的。 </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 在悠悠岁月中，我们都是匆匆过客，所有的故事都没有结果而结果，我们只有从容走过，无需彷徨，无需犹豫，无需茫然。我们应当往第三种境界发展，这才是人的最高境界，&#8220;宠辱不惊，看庭前花开花落；去留无意，任天外云卷云舒。&#8221;人从烦恼和执着中来，应到无烦恼无执着处去。其实凡事看开一些，未必不是一件好事，&#8220;人生如戏&#8221;，&#8220;戏如人生&#8221;，&#8220;人生如棋&#8221;，&#8220;棋如人生&#8221;，不正说明了人应当看戏者，观棋者吗。也许别人是对的，但我们也没有错，很多事情都无法挽回，再伟大的事情最终也成云烟，所有疯狂之后总归于平静，我们除了平静又能怎样呢？我们唯一能做的，就是坦然面对一切，平静珍惜一切。只有这样，才能更好地面对人生的大起大落，看透秋云春梦，接受世事无常。正如徐志摩《再别康桥》的人生境界：&#8220;悄悄的我走了，正如我悄悄的来，我挥一挥衣袖，不带走一片云彩。&#8221; </p>
<p>&nbsp;&nbsp;&nbsp; 多么洒脱！</p>
<p><br />
　<br />
</p>
 <img src ="http://www.cnblogs.com/ztotem/aggbug/1295458.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43603/" target="_blank">[新闻]《时代》：杨致远被Google玩弄于股掌之间？</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>梓人传</title><link>http://www.cnblogs.com/ztotem/archive/2008/09/19/1294405.html</link><dc:creator>ztotem</dc:creator><author>ztotem</author><pubDate>Fri, 19 Sep 2008 11:16:00 GMT</pubDate><guid>http://www.cnblogs.com/ztotem/archive/2008/09/19/1294405.html</guid><wfw:comment>http://www.cnblogs.com/ztotem/comments/1294405.html</wfw:comment><comments>http://www.cnblogs.com/ztotem/archive/2008/09/19/1294405.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/ztotem/comments/commentRss/1294405.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/ztotem/services/trackbacks/1294405.html</trackback:ping><description><![CDATA[作者：柳宗元（773—819），字子厚。唐代文学家、哲学家，唐宋八大家之一。<br />
<br />
　　裴封叔之第，在光德里。有梓人款其门，愿佣隙宇而处焉。所职，寻、引、规、矩、绳、墨，家不居砻斫之器。问其能，曰：&#8220;吾善度材，视栋宇之制，高深圆方短长之宜，吾指使而群工役焉。舍我，众莫能就一宇。故食于官府，吾受禄三倍；作于私家，吾收其宜大半焉。<br />
　　他日入其宜，其床阙足而不能理，曰：&#8220;将求他工。&#8221;余甚笑之，谓其无能而贪禄嗜货者。<br />
　　其后京兆尹将饰官署，余往过焉。委群材，会群工，成执斧斤，或执刀锯，皆环立向之梓人左持引，右执杖，而中处焉。量栋宇之任，视木之能举，挥其杖，曰&#8220;斧！&#8221;彼执斧者奔而右；顾而指曰：&#8220;锯！&#8221;彼执锯者趋而左。俄而，斤者斫，刀者削，皆视其色，俟其言，莫敢自断者。其不胜任者，怒而退之，亦莫敢愠焉。画宫于堵，盈尺而曲尽其制，计其毫厘而构大厦，无进退焉。既成，书于上栋曰：&#8220;某年、某月、某日、某建&#8221;。则其姓字也。凡执用之工不在列。余圜视大骇，然后知其术之工大矣。其后，京兆尹将饰官署，余往过焉。委群材，会群工，或执斧斤，或执刀锯，皆环立向之。梓人左持引，右执杖，而中处焉。量栋宇之任，视木之能举，挥其杖，曰：「斧！」彼执斧者奔而右；顾而指曰：「锯！」彼执锯者趋而左。俄而，斤者斫，刀者削，皆视其色，俟其言，莫敢自断者。其不胜任者，怒而退之，亦莫敢愠焉。画宫于堵，盈尺而曲尽其制，计其毫厘而构大厦，无进退焉。既成，书于上栋曰：「某年某月某日某建」。则其姓字也。凡执用之工不在列。余圜视大骇，然后知其术之工大矣。<br />
　　继而叹曰：彼将舍其手艺，专其心智，而能知体要者欤！吾闻劳心者役人，劳力者役于人。彼其劳心者欤！能者用而智者谋，彼其智者欤！是足为佐天子，相天下法矣。物莫近乎此也。彼为天下者本于人。其执役者为徒隶，为乡师、里胥；其上为下士；又其上为中士，为上士；又其上为大夫，为卿，为公。离而为六职，判而为百役。外薄四海，有方伯、连率。郡有守，邑有宰，皆有佐政；其下有胥吏，又其下皆有啬夫、版尹以就役焉，犹众工之各有执伎以食力也。<br />
　　彼佐天子相天下者，举而加焉，指而使焉，条其纲纪而盈缩焉，齐其法制而整顿焉；犹梓人之有规、矩、绳、墨以定制也。择天下之士，使称其职；居天下之人，使安其业。视都知野，视野知国，视国知天下，其远迩细大，可手据其图而究焉，犹梓人画宫于堵，而绩于成也。能者进而由之，使无所德；不能者退而休之，亦莫敢愠。不炫能，不矜名，不亲小劳，不侵众官，日与天下之英才，讨论其大经，犹梓人之善运众工而不伐艺也。夫然后相道得而万国理矣。<br />
　　相道既得，万国既理，天下举首而望曰：「吾相之功也！」后之人循迹而慕曰：「彼相之才也！」士或谈殷、周之理者，曰：「伊、傅、周、召。」其百执事之勤劳，而不得纪焉；犹梓人自名其功，而执用者不列也。大哉相乎！通是道者，所谓相而已矣。其不知体要者反此；以恪勤为公，以簿书为尊，炫能矜名，亲小劳，侵众官，窃取六职、百役之事，听听于府庭，而遗其大者远者焉，所谓不通是道者也。犹梓人而不知绳墨之曲直，规矩之方圆，寻引之短长，姑夺众工之斧斤刀锯以佐其艺，又不能备其工，以至败绩，用而无所成也，不亦谬欤！<br />
　　或曰：「彼主为室者，傥或发其私智，牵制梓人之虑，夺其世守，而道谋是用。虽不能成功，岂其罪耶？亦在任之而已！」<br />
　　余曰：「不然！夫绳墨诚陈，规矩诚设，高者不可抑而下也，狭者不可张而广也。由我则固，不由我则圮。彼将乐去固而就圮也，则卷其术，默其智，悠尔而去。不屈吾道，是诚良梓人耳！其或嗜其货利，忍而不能舍也，丧其制量，屈而不能守也，栋桡屋坏，则曰：「『非我罪也』！可乎哉？可乎哉？」<br />
　　余谓梓人之道类于相，故书而藏之。梓人，盖古之审曲面势者，今谓之「都料匠」云。余所遇者，杨氏，潜其名。<br />
<br />
=================================================================<br />
译文<br />
　　翡封叔的家宅在德里地方。有位木匠敲他的门,情愿租间空屋子居住,用替屋主人服役来代替房租.他所执掌的是些度量长短,规划方圆和校正曲直的工具；家里不储备磨砺和砍削的器具。问他有什么能耐,他说：&#8220;我善于计算,测量木材。观看房屋的式样和，高深，圆方，短长的适合不适合；我指挥驱使,而由众工匠去干。离了我,大家就不能建成一栋房子。所以被官府供养,我得到的奉禄比别人多三倍；在私人家里干活,我取全部报酬的一大半。&#8221;后来有一天,我进了他的住屋。他的床缺了腿却不修理,说：&#8220;将要请别的工匠来修理。&#8221;我很耻笑他,说他是没有才能却贪图俸禄,喜爱钱财的人。<br />
　　后来,京兆伊将要修饰官衙的房屋,我到过那里。（在那里）蓄积了大量木材,招集了许多工匠。有的拿着斧斤,有的拿着刀锯,都围成一圈站着,面朝着（那位）木匠。木匠左手拿着长尺,右手拿着木杖,站在中间。他衡量房屋的承担情况,察看木料的性能酌情选用。挥动他的木仗说：&#8220;用斧子砍!&#8221;那拿斧子的就跑道右边去砍；回头指着木材说：&#8220;用锯锯!&#8221;那拿锯的就跑道左边去锯。不一会,拿斧子的砍,拿刀的削,全都看着他的脸色,等待他的发话,没有一个敢自做主张的。那些不能胜任的人,被他愤怒地斥退了,也不敢有一点怨恨。他在墙上绘了官署房子的图样,刚满一尺大小的图样却细致详尽地画出了它的建筑构造.计算图上微小的尺寸而建造起高楼大厦,没有一点误差的地方。已建成后,在上栋上写道：某年某月某日某某修建,原来是他的姓名,凡是被他役使的工匠都不在上面列名。我围绕着一看,感到非常惊讶,然后我才知道他技术的精湛和伟大啊！<br />
　　接着我就感叹地说：他大概是放弃了他的手艺，专门使用他的思想智慧，能知道全局要领的人吧？我听说&#8220;劳心的人役使别人，劳力的人被别人役使&#8221;；他大概是劳心的人吧？有一般技艺的人出力劳动，有才智的人出谋划策，他大概是有才智的人吧？这满可以作为辅佐天子，作天下宰相的人所效法学习的呀！事情没有比这再相近似的了。那辅佐天子，作天下宰相的人，推荐人材，委任职责，发出命令，指派任务，整顿纲纪，进行增减，统一法治。这就好象梓人有正方圆和定曲直的工具而绘制出图样似的。选择天下的官吏，使他们适合自己的职务；安置天下的老百姓，使他们安居乐业。看了国都就了解了郊外，看了郊外就了解了诸侯国，看了诸侯国就了解了整个天下。全国远近，大小各方面的情况，可以根据手中的图本来研究，了解。这就好象梓人在墙上绘画官署房子的图样而完成工程一样。把有才能的人提拔上来，并充分发挥他的本领，使他不必对任何人感恩戴德；把没有才能的人辞退，让他休息，他也不敢恼恨。不夸耀自己的才能，不自尊自大，虚图功名，不亲自去做那些微小琐碎的事情，不干涉众官的工作，每天和天下的杰出的人材一起讨论治理国家的根本道理。这就象梓人善于运用众工匠而不自夸手艺一样。这样以后，做宰相的道理才算懂得，各诸侯国才得到了治理。那些不知道全局要领的人却与此相反。（他们）以谨小慎微，忙忙碌碌为大事，以抄写官署中的文书，薄册为重责，夸耀自己的才能，自尊自大，亲自去做那些微小琐碎的事情，干涉众官的工作，侵夺部下官吏应做的事拿来自己做，并洋洋得意地在相府夸耀自己，却丢掉了那些重大的，长远的事情。这是所说的不懂得做宰相的道理的人。这就象梓人不懂得绳墨可正曲直，规矩可画方圆，寻引可量短长，暂且夺取工匠们的斧子刀锯来帮助他们发挥技艺，却又不能完成他们的工作，以至于事情失败，使用了（他们）却没有成功一样。这不也是错误的吗？<br />
<img src ="http://www.cnblogs.com/ztotem/aggbug/1294405.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43602/" target="_blank">[新闻]Mozilla即将结束对FireFox 2的支持</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>存储过程编写经验和优化措施(转)</title><link>http://www.cnblogs.com/ztotem/archive/2008/09/11/1289311.html</link><dc:creator>ztotem</dc:creator><author>ztotem</author><pubDate>Thu, 11 Sep 2008 09:01:00 GMT</pubDate><guid>http://www.cnblogs.com/ztotem/archive/2008/09/11/1289311.html</guid><wfw:comment>http://www.cnblogs.com/ztotem/comments/1289311.html</wfw:comment><comments>http://www.cnblogs.com/ztotem/archive/2008/09/11/1289311.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cnblogs.com/ztotem/comments/commentRss/1289311.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/ztotem/services/trackbacks/1289311.html</trackback:ping><description><![CDATA[<font face="Times New Roman" size="3"><strong>一、适合读者对象</strong>：数据库开发程序员，数据库的数据量很多，涉及到对SP（存储过程）的优化的项目开发人员，对数据库有浓厚兴趣的人。 　 <br />
<strong>二、介绍</strong>：在数据库的开发过程中，经常会遇到复杂的业务逻辑和对数据库的操作，这个时候就会用SP来封装数据库操作。如果项目的SP较多，书写又没有一定的规范，将会影响以后的系统维护困难和大SP逻辑的难以理解，另外如果数据库的数据量大或者项目对SP的性能要求很，就会遇到优化的问题，否则速度有可能很慢，经过亲身经验，一个经过优化过的SP要比一个性能差的SP的效率甚至高几百倍。 　 <br />
<strong>三、内容：</strong> 　 <br />
1、开发人员如果用到其他库的Table或View，务必在当前库中建立View来实现跨库操作，最好不要直接使用&#8220;databse.dbo.table_name&#8221;，因为sp_depends不能显示出该SP所使用的跨库table或view，不方便校验。 <br />
2、开发人员在提交SP前，必须已经使用set showplan on分析过查询计划，做过自身的查询优化检查。 　 <br />
3、高程序运行效率，优化应用程序，在SP编写过程中应该注意以下几点： <br />
<strong>a)SQL的使用规范</strong>： <br />
　i.　尽量避免大事务操作，慎用holdlock子句，提高系统并发能力。 <br />
　ii.　尽量避免反复访问同一张或几张表，尤其是数据量较大的表，可以考虑先根据条件提取数据到临时表中，然后再做连接。 <br />
　iii.　尽量避免使用游标，因为游标的效率较差，如果游标操作的数据超过1万行，那么就应该改写；如果使用了游标，就要尽量避免在游标循环中再进行表连接的操作。 <br />
　iv.　注意where字句写法，必须考虑语句顺序，应该根据索引顺序、范围大小来确定条件子句的前后顺序，尽可能的让字段顺序与索引顺序相一致，范围从大到小。 <br />
　v.　不要在where子句中的&#8220;=&#8221;左边进行函数、算术运算或其他表达式运算，否则系统将可能无法正确使用索引。 <br />
　vi.　尽量使用exists代替select count(1)来判断是否存在记录，count函数只有在统计表中所有行数时使用，而且count(1)比count(*)更有效率。 <br />
　vii.　尽量使用&#8220;&gt;=&#8221;，不要使用&#8220;&gt;&#8221;。 <br />
　viii.　注意一些or子句和union子句之间的替换 <br />
　ix.　注意表之间连接的数据类型，避免不同类型数据之间的连接。 <br />
　x.　注意存储过程中参数和数据类型的关系。 <br />
　xi.　注意insert、update操作的数据量，防止与其他应用冲突。如果数据量超过200个数据页面（400k），那么系统将会进行锁升级，页级锁会升级成表级锁。 <br />
<strong>b)索引的使用规范</strong>： <br />
　i.　索引的创建要与应用结合考虑，建议大的OLTP表不要超过6个索引。 <br />
　ii.　尽可能的使用索引字段作为查询条件，尤其是聚簇索引，必要时可以通过index index_name来强制指定索引 <br />
　iii.　避免对大表查询时进行table scan，必要时考虑新建索引。 <br />
　iv.　在使用索引字段作为条件时，如果该索引是联合索引，那么必须使用到该索引中的第一个字段作为条件时才能保证系统使用该索引，否则该索引将不会被使用。 <br />
　v.　要注意索引的维护，周期性重建索引，重新编译存储过程。 <br />
<strong>c)tempdb的使用规范：</strong> <br />
　i.　尽量避免使用distinct、order by、group by、having、join、cumpute，因为这些语句会加重tempdb的负担。 <br />
　ii.　避免频繁创建和删除临时表，减少系统表资源的消耗。 <br />
　iii.　在新建临时表时，如果一次性插入数据量很大，那么可以使用select into代替create table，避免log，提高速度；如果数据量不大，为了缓和系统表的资源，建议先create table，然后insert。 <br />
　iv.　如果临时表的数据量较大，需要建立索引，那么应该将创建临时表和建立索引的过程放在单独一个子存储过程中，这样才能保证系统能够很好的使用到该临时表的索引。 <br />
　 v.　如果使用到了临时表，在存储过程的最后务必将所有的临时表显式删除，先truncate table，然后drop table，这样可以避免系统表的较长时间锁定。 <br />
　 vi.　慎用大的临时表与其他大表的连接查询和修改，减低系统表负担，因为这种操作会在一条语句中多次使用tempdb的系统表。 <br />
<strong>d)合理的算法使用</strong>： <br />
根据上面已提到的SQL优化技术和ASE Tuning手册中的SQL优化内容,结合实际应用,采用多种算法进行比较,以获得消耗资源最少、效率最高的方法。具体可用ASE调优命令：set statistics io on, set statistics time on , set showplan on 等。 </font>
 <img src ="http://www.cnblogs.com/ztotem/aggbug/1289311.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43601/" target="_blank">[新闻]IBM"走鹃"险胜"Cray Jaguar" 连任世界最快超级计算机</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item><item><title>正则表达式基础知识(转)</title><link>http://www.cnblogs.com/ztotem/archive/2008/09/09/1287587.html</link><dc:creator>ztotem</dc:creator><author>ztotem</author><pubDate>Tue, 09 Sep 2008 06:49:00 GMT</pubDate><guid>http://www.cnblogs.com/ztotem/archive/2008/09/09/1287587.html</guid><wfw:comment>http://www.cnblogs.com/ztotem/comments/1287587.html</wfw:comment><comments>http://www.cnblogs.com/ztotem/archive/2008/09/09/1287587.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnblogs.com/ztotem/comments/commentRss/1287587.html</wfw:commentRss><trackback:ping>http://www.cnblogs.com/ztotem/services/trackbacks/1287587.html</trackback:ping><description><![CDATA[一个正则表达式就是由普通字符（例如字符 a 到 z）以及特殊字符（称为元字符）组成的文字模式。该模式描述在查找文字主体时待匹配的一个或多个字符串。正则表达式作为一个模板，将某个字符模式与所搜索的字符串进行匹配。如： <br />
<div class="tablediv">
<table cellspacing="0" border="1">
    <tr valign="top">
            <th width="30%">JScript</th>
            <th width="30%">VBScript</th>
            <th width="40%">匹配</th>
        </tr>
        <tr valign="top">
            <td width="30%">/^\[ \t]*$/</td>
            <td width="30%">"^\[ \t]*$"</td>
            <td width="40%">匹配一个空白行。</td>
        </tr>
        <tr valign="top">
            <td width="30%">/\d{2}-\d{5}/</td>
            <td width="30%">"\d{2}-\d{5}"</td>
            <td width="40%">验证一个ID 号码是否由一个2位数字，一个连字符以及一个5位数字组成。</td>
        </tr>
        <tr valign="top">
            <td width="30%">/&lt;(.*)&gt;.*&lt;\/\1&gt;/</td>
            <td width="30%">"&lt;(.*)&gt;.*&lt;\/\1&gt;"</td>
            <td width="40%">匹配一个 HTML 标记。</td>
        </tr>
    </table>
</div>
<br />
下表是元字符及其在正则表达式上下文中的行为的一个完整列表：<br />
<table cellspacing="0" border="1">
    <tr valign="top">
            <th width="16%">字符</th>
            <th width="84%">描述</th>
        </tr>
        <tr valign="top">
            <td width="16%">\</td>
            <td width="84%">将下一个字符标记为一个特殊字符、或一个原义字符、或一个 向后引用、或一个八进制转义符。例如，'n' 匹配字符 "n"。'\n' 匹配一个换行符。序列 '\\' 匹配 "\" 而 "\(" 则匹配 "("。</td>
        </tr>
        <tr valign="top">
            <td width="16%">^</td>
            <td width="84%">匹配输入字符串的开始位置。如果设置了 <strong>RegExp</strong> 对象的 <strong>Multiline</strong> 属性，^ 也匹配 '\n' 或 '\r' 之后的位置。</td>
        </tr>
        <tr valign="top">
            <td width="16%">$</td>
            <td width="84%">匹配输入字符串的结束位置。如果设置了<strong>RegExp</strong> 对象的 <strong>Multiline</strong> 属性，$ 也匹配 '\n' 或 '\r' 之前的位置。</td>
        </tr>
        <tr valign="top">
            <td width="16%">*</td>
            <td width="84%">匹配前面的子表达式零次或多次。例如，zo* 能匹配 "z" 以及 "zoo"。* 等价于{0,}。</td>
        </tr>
        <tr valign="top">
            <td width="16%">+</td>
            <td width="84%">匹配前面的子表达式一次或多次。例如，'zo+' 能匹配 "zo" 以及 "zoo"，但不能匹配 "z"。+ 等价于 {1,}。</td>
        </tr>
        <tr valign="top">
            <td width="16%">?</td>
            <td width="84%">匹配前面的子表达式零次或一次。例如，"do(es)?" 可以匹配 "do" 或 "does" 中的"do" 。? 等价于 {0,1}。</td>
        </tr>
        <tr valign="top">
            <td width="16%">{<em>n</em>}</td>
            <td width="84%"><em>n</em> 是一个非负整数。匹配确定的 <em>n</em> 次。例如，'o{2}' 不能匹配 "Bob" 中的 'o'，但是能匹配 "food" 中的两个 o。</td>
        </tr>
        <tr valign="top">
            <td width="16%">{<em>n</em>,}</td>
            <td width="84%"><em>n</em> 是一个非负整数。至少匹配<em>n</em> 次。例如，'o{2,}' 不能匹配 "Bob" 中的 'o'，但能匹配 "foooood" 中的所有 o。'o{1,}' 等价于 'o+'。'o{0,}' 则等价于 'o*'。</td>
        </tr>
        <tr valign="top">
            <td width="16%">{<em>n</em>,<em>m</em>}</td>
            <td width="84%"><em>m</em> 和 <em>n</em> 均为非负整数，其中<em>n</em> &lt;= <em>m</em>。最少匹配 <em>n</em> 次且最多匹配 <em>m</em> 次。例如，"o{1,3}" 将匹配 "fooooood" 中的前三个 o。'o{0,1}' 等价于 'o?'。请注意在逗号和两个数之间不能有空格。</td>
        </tr>
        <tr valign="top">
            <td width="16%">?</td>
            <td width="84%">当该字符紧跟在任何一个其他限制符 (*, +, ?, {<em>n</em>}, {<em>n</em>,}, {<em>n</em>,<em>m</em>}) 后面时，匹配模式是非贪婪的。非贪婪模式尽可能少的匹配所搜索的字符串，而默认的贪婪模式则尽可能多的匹配所搜索的字符串。例如，对于字符串 "oooo"，'o+?' 将匹配单个 "o"，而 'o+' 将匹配所有 'o'。</td>
        </tr>
        <tr valign="top">
            <td width="16%">.</td>
            <td width="84%">匹配除 "\n" 之外的任何单个字符。要匹配包括 '\n' 在内的任何字符，请使用象 '[.\n]' 的模式。</td>
        </tr>
        <tr valign="top">
            <td width="16%">(<em>pattern</em>)</td>
            <td width="84%">匹配 <em>pattern</em> 并获取这一匹配。所获取的匹配可以从产生的 Matches 集合得到，在VBScript 中使用 <strong>SubMatches</strong> 集合，在JScript 中则使用 <strong>$0</strong>&#8230;<strong>$9</strong> 属性。要匹配圆括号字符，请使用 '\(' 或 '\)'。</td>
        </tr>
        <tr valign="top">
            <td width="16%">(?:<em>pattern</em>)</td>
            <td width="84%">匹配 <em>pattern</em> 但不获取匹配结果，也就是说这是一个非获取匹配，不进行存储供以后使用。这在使用 "或" 字符 (|) 来组合一个模式的各个部分是很有用。例如， 'industr(?:y|ies) 就是一个比 'industry|industries' 更简略的表达式。</td>
        </tr>
        <tr valign="top">
            <td width="16%">(?=<em>pattern</em>)</td>
            <td width="84%">正向预查，在任何匹配 <em>pattern</em> 的字符串开始处匹配查找字符串。这是一个非获取匹配，也就是说，该匹配不需要获取供以后使用。例如，'Windows (?=95|98|NT|2000)' 能匹配 "Windows 2000" 中的 "Windows" ，但不能匹配 "Windows 3.1" 中的 "Windows"。预查不消耗字符，也就是说，在一个匹配发生后，在最后一次匹配之后立即开始下一次匹配的搜索，而不是从包含预查的字符之后开始。</td>
        </tr>
        <tr valign="top">
            <td width="16%">(?!<em>pattern</em>)</td>
            <td width="84%">负向预查，在任何不匹配 <em>pattern</em> 的字符串开始处匹配查找字符串。这是一个非获取匹配，也就是说，该匹配不需要获取供以后使用。例如'Windows (?!95|98|NT|2000)' 能匹配 "Windows 3.1" 中的 "Windows"，但不能匹配 "Windows 2000" 中的 "Windows"。预查不消耗字符，也就是说，在一个匹配发生后，在最后一次匹配之后立即开始下一次匹配的搜索，而不是从包含预查的字符之后开始</td>
        </tr>
        <tr valign="top">
            <td width="16%"><em>x</em>|<em>y</em></td>
            <td width="84%">匹配 <em>x</em> 或 <em>y</em>。例如，'z|food' 能匹配 "z" 或 "food"。'(z|f)ood' 则匹配 "zood" 或 "food"。</td>
        </tr>
        <tr valign="top">
            <td width="16%">[<em>xyz</em>]</td>
            <td width="84%">字符集合。匹配所包含的任意一个字符。例如， '[abc]' 可以匹配 "plain" 中的 'a'。</td>
        </tr>
        <tr valign="top">
            <td width="16%">[^<em>xyz</em>]</td>
            <td width="84%">负值字符集合。匹配未包含的任意字符。例如， '[^abc]' 可以匹配 "plain" 中的'p'。</td>
        </tr>
        <tr valign="top">
            <td width="16%">[<em>a-z</em>]</td>
            <td width="84%">字符范围。匹配指定范围内的任意字符。例如，'[a-z]' 可以匹配 'a' 到 'z' 范围内的任意小写字母字符。</td>
        </tr>
        <tr valign="top">
            <td width="16%">[^<em>a-z</em>]</td>
            <td width="84%">负值字符范围。匹配任何不在指定范围内的任意字符。例如，'[^a-z]' 可以匹配任何不在 'a' 到 'z' 范围内的任意字符。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\b</td>
            <td width="84%">匹配一个单词边界，也就是指单词和空格间的位置。例如， 'er\b' 可以匹配"never" 中的 'er'，但不能匹配 "verb" 中的 'er'。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\B</td>
            <td width="84%">匹配非单词边界。'er\B' 能匹配 "verb" 中的 'er'，但不能匹配 "never" 中的 'er'。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\c<em>x</em></td>
            <td width="84%">匹配由 <em>x</em> 指明的控制字符。例如， \cM 匹配一个 Control-M 或回车符。<em>x</em> 的值必须为 A-Z 或 a-z 之一。否则，将 c 视为一个原义的 'c' 字符。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\d</td>
            <td width="84%">匹配一个数字字符。等价于 [0-9]。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\D</td>
            <td width="84%">匹配一个非数字字符。等价于 [^0-9]。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\f</td>
            <td width="84%">匹配一个换页符。等价于 \x0c 和 \cL。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\n</td>
            <td width="84%">匹配一个换行符。等价于 \x0a 和 \cJ。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\r</td>
            <td width="84%">匹配一个回车符。等价于 \x0d 和 \cM。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\s</td>
            <td width="84%">匹配任何空白字符，包括空格、制表符、换页符等等。等价于 [ \f\n\r\t\v]。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\S</td>
            <td width="84%">匹配任何非空白字符。等价于 [^ \f\n\r\t\v]。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\t</td>
            <td width="84%">匹配一个制表符。等价于 \x09 和 \cI。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\v</td>
            <td width="84%">匹配一个垂直制表符。等价于 \x0b 和 \cK。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\w</td>
            <td width="84%">匹配包括下划线的任何单词字符。等价于'[A-Za-z0-9_]'。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\W</td>
            <td width="84%">匹配任何非单词字符。等价于 '[^A-Za-z0-9_]'。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\x<em>n</em></td>
            <td width="84%">匹配 <em>n</em>，其中 <em>n</em> 为十六进制转义值。十六进制转义值必须为确定的两个数字长。例如，'\x41' 匹配 "A"。'\x041' 则等价于 '\x04' &amp; "1"。正则表达式中可以使用 ASCII 编码。.</td>
        </tr>
        <tr valign="top">
            <td width="16%">\<em>num</em></td>
            <td width="84%">匹配 <em>num</em>，其中 <em>num</em> 是一个正整数。对所获取的匹配的引用。例如，'(.)\1' 匹配两个连续的相同字符。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\<em>n</em></td>
            <td width="84%">标识一个八进制转义值或一个向后引用。如果 \<em>n</em> 之前至少 <em>n</em> 个获取的子表达式，则 <em>n</em> 为向后引用。否则，如果 <em>n</em> 为八进制数字 (0-7)，则 <em>n</em> 为一个八进制转义值。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\<em>nm</em></td>
            <td width="84%">标识一个八进制转义值或一个向后引用。如果 \<em>nm</em> 之前至少有 <em>nm</em> 个获得子表达式，则 <em>nm</em> 为向后引用。如果 \<em>nm</em> 之前至少有 <em>n</em> 个获取，则 <em>n</em> 为一个后跟文字 <em>m</em> 的向后引用。如果前面的条件都不满足，若 <em>n</em> 和 <em>m</em> 均为八进制数字 (0-7)，则 \<em>nm</em> 将匹配八进制转义值 <em>nm</em>。</td>
        </tr>
        <tr valign="top">
            <td width="16%">\<em>nml</em></td>
            <td width="84%">如果 <em>n</em> 为八进制数字 (0-3)，且 <em>m</em> 和 <em>l</em> 均为八进制数字 (0-7)，则匹配八进制转义值 <em>nml。</em></td>
        </tr>
        <tr valign="top">
            <td width="16%">\u<em>n</em></td>
            <td width="84%">匹配 <em>n</em>，其中 <em>n</em> 是一个用四个十六进制数字表示的 Unicode 字符。例如， \u00A9 匹配版权符号 (&#169;)。</td>
        </tr>
    </table>
<p><br />
下面看几个例子：<br />
"^The"：表示所有以"The"开始的字符串（"There"，"The cat"等）；<br />
"of despair$"：表示所以以"of despair"结尾的字符串；<br />
"^abc$"：表示开始和结尾都是"abc"的字符串——呵呵，只有"abc"自己了；<br />
"notice"：表示任何包含"notice"的字符串。<br />
<br />
'*'，'+'和'?'这三个符号，表示一个或一序列字符重复出现的次数。它们分别表示&#8220;没有或<br />
更多&#8221;，&#8220;一次或更多&#8221;还有&#8220;没有或一次&#8221;。下面是几个例子：</p>
<p>"ab*"：表示一个字符串有一个a后面跟着零个或若干个b。（"a", "ab", "abbb",&#8230;&#8230;）；<br />
"ab+"：表示一个字符串有一个a后面跟着至少一个b或者更多；<br />
"ab?"：表示一个字符串有一个a后面跟着零个或者一个b；<br />
"a?b+$"：表示在字符串的末尾有零个或一个a跟着一个或几个b。</p>
<p>也可以使用范围，用大括号括起，用以表示重复次数的范围。</p>
<p>"ab{2}"：表示一个字符串有一个a跟着2个b（"abb"）；<br />
"ab{2,}"：表示一个字符串有一个a跟着至少2个b；<br />
"ab{3,5}"：表示一个字符串有一个a跟着3到5个b。</p>
<p>请注意，你必须指定范围的下限（如："{0,2}"而不是"{,2}"）。还有，你可能注意到了，'*'，'+'和<br />
'?'相当于"{0,}"，"{1,}"和"{0,1}"。<br />
还有一个'&#166;'，表示&#8220;或&#8221;操作：</p>
<p>"hi&#166;hello"：表示一个字符串里有"hi"或者"hello"；<br />
"(b&#166;cd)ef"：表示"bef"或"cdef"；<br />
"(a&#166;b)*c"：表示一串"a""b"混合的字符串后面跟一个"c"；</p>
<p>'.'可以替代任何字符：</p>
<p>"a.[0-9]"：表示一个字符串有一个"a"后面跟着一个任意字符和一个数字；<br />
"^.{3}$"：表示有任意三个字符的字符串（长度为3个字符）；</p>
<p>方括号表示某些字符允许在一个字符串中的某一特定位置出现：</p>
<p>"[ab]"：表示一个字符串有一个"a"或"b"（相当于"a&#166;b"）；<br />
"[a-d]"：表示一个字符串包含小写的'a'到'd'中的一个（相当于"a&#166;b&#166;c&#166;d"或者"[abcd]"）；<br />
"^[a-zA-Z]"：表示一个以字母开头的字符串；<br />
"[0-9]%"：表示一个百分号前有一位的数字；<br />
",[a-zA-Z0-9]$"：表示一个字符串以一个逗号后面跟着一个字母或数字结束。</p>
<p>你也可以在方括号里用'^'表示不希望出现的字符，'^'应在方括号里的第一位。（如："%[^a-zA-Z]%"表<br />
示两个百分号中不应该出现字母）。</p>
<p>为了逐字表达，必须在"^.$()&#166;*+?{\"这些字符前加上转移字符'\'。</p>
<p>请注意在方括号中，不需要转义字符。</p>
<img src ="http://www.cnblogs.com/ztotem/aggbug/1287587.html?type=1" width = "1" height = "1" /><br><br><a href="http://news.cnblogs.com/n/43600/" target="_blank">[新闻]微软正式发布Exchange/SharePoint Online</a><br/><a href="http://www.cnblogs.com" target="_blank">博客园首页</a>&nbsp;<a href="http://space.cnblogs.com" target="_blank">社区</a>&nbsp;<a href="http://news.cnblogs.com" target="_blank">新闻频道</a>&nbsp;<a href="http://space.cnblogs.com/group.htm" target="_blank">小组</a>&nbsp;<a href="http://space.cnblogs.com/q" target="_blank">博问</a>&nbsp;<a href="http://wz.cnblogs.com/" target="_blank">网摘</a>&nbsp;<a href="http://space.cnblogs.com/ing" target="_blank">闪存</a>]]></description></item></channel></rss>