<?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://wp.ljf.cn/feed" rel="self" type="application/rss+xml" />
	<link>http://wp.ljf.cn</link>
	<description>所有的努力，都是为了偷懒</description>
	<lastBuildDate>Tue, 24 Apr 2012 09:20:47 +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>PDF转swf</title>
		<link>http://wp.ljf.cn/archives/2162</link>
		<comments>http://wp.ljf.cn/archives/2162#comments</comments>
		<pubDate>Tue, 24 Apr 2012 09:20:47 +0000</pubDate>
		<dc:creator>林 剑锋</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[PDF转swf]]></category>

		<guid isPermaLink="false">http://wp.ljf.cn/?p=2162</guid>
		<description><![CDATA[PDF\WORD\JPG等文件的FLEX读取器： 示例请查看： http://flexpaper.devaldi.com/demo/ PDF阅读功能：http://flexpaper.devaldi.com/examples/unencrypted/view_unencrypted.jsp?doc=Report PDF阅读+编辑功能：http://flexpaper.devaldi.com/annotations.jsp 照片浏览功能：http://flexpaper.devaldi.com/slide.jsp 下载地址： http://flexpaper.devaldi.com/download/ 或： http://code.google.com/p/flexpaper/downloads/list 下载后配置下lib/config.ini.win.php或lib/config.ini.nix.php(根据服务器操作系统决定要修改哪个) 中path.pdf及path.swf的路径 注意：服务器需要安装SWFTools SWFTools 是一组用来处理 Flash 的 swf 文件的工具包，包括： 1. 合并工具 swfcombine 2. 抽取工具 swfextract 3. PDF/JPEG/PNG/AVI/TTF/WAV 到 SWF 的转换工具 ：pdf2swf, jpeg2swf, png2swf, avi2swf, font2swf, and wav2swf&#124; 4. 文本解析工具 swfstrings &#8230; <a href="http://wp.ljf.cn/archives/2162">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>PDF\WORD\JPG等文件的FLEX读取器：</p>
<p>示例请查看：</p>
<p>http://flexpaper.devaldi.com/demo/</p>
<p>PDF阅读功能：http://flexpaper.devaldi.com/examples/unencrypted/view_unencrypted.jsp?doc=Report</p>
<p>PDF阅读+编辑功能：http://flexpaper.devaldi.com/annotations.jsp</p>
<p>照片浏览功能：http://flexpaper.devaldi.com/slide.jsp</p>
<p>下载地址：</p>
<p>http://flexpaper.devaldi.com/download/</p>
<p>或：</p>
<p>http://code.google.com/p/flexpaper/downloads/list</p>
<p>下载后配置下lib/config.ini.win.php或lib/config.ini.nix.php(根据服务器操作系统决定要修改哪个)</p>
<p>中path.pdf及path.swf的路径</p>
<p>注意：服务器需要安装SWFTools</p>
<p>SWFTools 是一组用来处理 Flash 的 swf 文件的工具包，包括：</p>
<p>1. 合并工具 swfcombine<br />
2. 抽取工具 swfextract<br />
3. PDF/JPEG/PNG/AVI/TTF/WAV 到 SWF 的转换工具 ：pdf2swf, jpeg2swf, png2swf, avi2swf, font2swf, and wav2swf|<br />
4. 文本解析工具 swfstrings<br />
5. SWF 解析器 swfdump<br />
6. SWF 读写库 rfxswflib</p>
<p>一个简单的将PDF文档转成SWF的用法：</p>
<p>C:\SWFTools\pdf2swf Paper3.pdf -o Paper3.swf -f -T 9</p>
<p>下载地址：http://www.swftools.org/download.html</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.ljf.cn/archives/2162/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sql注入攻击</title>
		<link>http://wp.ljf.cn/archives/2163</link>
		<comments>http://wp.ljf.cn/archives/2163#comments</comments>
		<pubDate>Fri, 20 Apr 2012 15:44:01 +0000</pubDate>
		<dc:creator>林 剑锋</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://wp.ljf.cn/?p=2163</guid>
		<description><![CDATA[近几年来sql注入攻击非常常见，组合查询语句的编程方式是罪魁祸首。曾有一段时间，为了避免这个问题，抛弃了asp，投入asp.net的怀抱，因为asp.net可以方便的参数化查询，避免sql注入攻击。 近日发现微软有一个文档专门讲这个问题：http://technet.microsoft.com/zh-cn/library/ms161953.aspx 才豁然开朗，原来攻击来源于sql本身的特性。如果编程者不注意审核传入的参数，就很容易被黑客有机可乘。摘录部分内容如下： 如果可能，拒绝包含以下字符的输入。 输入字符 在 Transact-SQL 中的含义 ; 查询分隔符。 &#8216; 字符数据字符串分隔符。 &#8211; 注释分隔符。 /* &#8230; */ 注释分隔符。服务器不对 /* 和 */ 之间的注释进行处理。 xp_ 用于目录扩展存储过程的名称的开头，如 xp_cmdshell。 请注意，如果要使用 LIKE 子句，还必须对通配符字符进行转义： s = s.Replace(&#8220;[", "[[]&#8220;); s = s.Replace(&#8220;%&#8221;, &#8220;[%]&#8220;); s = s.Replace(&#8220;_&#8221;, &#8220;[_]&#8220;); &#8230; <a href="http://wp.ljf.cn/archives/2163">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>近几年来sql注入攻击非常常见，组合查询语句的编程方式是罪魁祸首。曾有一段时间，为了避免这个问题，抛弃了asp，投入asp.net的怀抱，因为asp.net可以方便的参数化查询，避免sql注入攻击。<br />
近日发现微软有一个文档专门讲这个问题：http://technet.microsoft.com/zh-cn/library/ms161953.aspx<br />
才豁然开朗，原来攻击来源于sql本身的特性。如果编程者不注意审核传入的参数，就很容易被黑客有机可乘。摘录部分内容如下：<br />
如果可能，拒绝包含以下字符的输入。</p>
<p>输入字符    在 Transact-SQL 中的含义</p>
<p>;          查询分隔符。<br />
&#8216;          字符数据字符串分隔符。<br />
&#8211;         注释分隔符。<br />
/* &#8230; */  注释分隔符。服务器不对 /* 和 */ 之间的注释进行处理。<br />
xp_        用于目录扩展存储过程的名称的开头，如 xp_cmdshell。</p>
<p>请注意，如果要使用 LIKE 子句，还必须对通配符字符进行转义：</p>
<p>s = s.Replace(&#8220;[", "[[]&#8220;);<br />
s = s.Replace(&#8220;%&#8221;, &#8220;[%]&#8220;);<br />
s = s.Replace(&#8220;_&#8221;, &#8220;[_]&#8220;);</p>
<p>另外，字段长度不够，很容易造成截断启用的注入攻击。所以比如对传入的数据做长度检查。</p>
<p>基本上就这些要点吧，更详细的内容上微软看文档。</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.ljf.cn/archives/2163/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在线生成sitemap的工具</title>
		<link>http://wp.ljf.cn/archives/2157</link>
		<comments>http://wp.ljf.cn/archives/2157#comments</comments>
		<pubDate>Fri, 20 Apr 2012 15:34:31 +0000</pubDate>
		<dc:creator>林 剑锋</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[sitemap]]></category>

		<guid isPermaLink="false">http://wp.ljf.cn/?p=2157</guid>
		<description><![CDATA[网址：http://www.xml-sitemaps.com/ 把网站地址输进去，就可以在线生成了。生成完毕后下载，保存到自己的网站根目录，方便爬行蜘蛛收录。]]></description>
			<content:encoded><![CDATA[<p>网址：http://www.xml-sitemaps.com/<br />
把网站地址输进去，就可以在线生成了。生成完毕后下载，保存到自己的网站根目录，方便爬行蜘蛛收录。</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.ljf.cn/archives/2157/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>sql like 通配符</title>
		<link>http://wp.ljf.cn/archives/2158</link>
		<comments>http://wp.ljf.cn/archives/2158#comments</comments>
		<pubDate>Thu, 19 Apr 2012 02:29:28 +0000</pubDate>
		<dc:creator>林 剑锋</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://wp.ljf.cn/?p=2158</guid>
		<description><![CDATA[很羞愧的忏悔一下，以前我以为就只有百分号一个通配符。 _ 与任意单字符匹配 % 与包含一个或多个字符的字符串匹配 [ ] 与特定范围（例如，[a-f]）或特定集（例如，[abcdef]）中的任意单字符匹配。 [^] 与特定范围（例如，[^a-f]）或特定集（例如，[^abcdef]）之外的任意单字符匹配。 使用like比较字，加上SQL里的通配符，请参考以下： a.. LIKE &#8216;Mc%&#8217; 将搜索以字母 Mc 开头的所有字符串（如 McBadden）。 b.. LIKE &#8216;%inger&#8217; 将搜索以字母 inger 结尾的所有字符串（如 Ringer、 Stringer）。 c.. LIKE &#8216;%en%&#8217; 将搜索在任何位置包含字母 en 的所有字符串（如 Bennet、 Green、McBadden）。 d.. LIKE &#8216;_heryl&#8217; 将搜索以字母 heryl 结尾的所有六个字母的名称（如 &#8230; <a href="http://wp.ljf.cn/archives/2158">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>很羞愧的忏悔一下，以前我以为就只有百分号一个通配符。<br />
_    与任意单字符匹配</p>
<p>%    与包含一个或多个字符的字符串匹配</p>
<p>[ ]  与特定范围（例如，[a-f]）或特定集（例如，[abcdef]）中的任意单字符匹配。</p>
<p>[^]  与特定范围（例如，[^a-f]）或特定集（例如，[^abcdef]）之外的任意单字符匹配。<br />
 使用like比较字，加上SQL里的通配符，请参考以下：<br />
a.. LIKE &#8216;Mc%&#8217; 将搜索以字母 Mc 开头的所有字符串（如 McBadden）。<br />
b.. LIKE &#8216;%inger&#8217; 将搜索以字母 inger 结尾的所有字符串（如 Ringer、<br />
Stringer）。<br />
c.. LIKE &#8216;%en%&#8217; 将搜索在任何位置包含字母 en 的所有字符串（如 Bennet、<br />
Green、McBadden）。<br />
d.. LIKE &#8216;_heryl&#8217; 将搜索以字母 heryl 结尾的所有六个字母的名称（如 Cheryl、<br />
Sheryl）。<br />
e.. LIKE &#8216;[CK]ars[eo]n&#8217; 将搜索下列字符串：Carsen、Karsen、Carson 和 Karson<br />
（如 Carson）。<br />
f.. LIKE &#8216;[M-Z]inger&#8217; 将搜索以字符串 inger 结尾、以从 M 到 Z 的任何单个字<br />
母开头的所有名称（如 Ringer）。<br />
g.. LIKE &#8216;M[^c]%&#8217; 将搜索以字母 M 开头，并且第二个字母不是 c 的所有名称（如<br />
MacFeather）。</p>
<p>例子:<br />
? WHERE FirstName LIKE &#8216;_im&#8217; 可以找到所有三个字母的、以 im 结尾的名字（例如，Jim、Tim）。 </p>
<p>? WHERE LastName LIKE &#8216;%stein&#8217; 可以找到姓以 stein 结尾的所有员工。 </p>
<p>? WHERE LastName LIKE &#8216;%stein%&#8217; 可以找到姓中任意位置包括 stein 的所有员工。 </p>
<p>? WHERE FirstName LIKE &#8216;[JT]im&#8217; 可以找到三个字母的、以 im 结尾并以 J 或 T 开始的名字（即仅有 Jim 和 Tim） </p>
<p>? WHERE LastName LIKE &#8216;m[^c]%&#8217; 可以找到以 m 开始的、后面的（第二个）字母不为 c 的所有姓。</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.ljf.cn/archives/2158/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>唐诗宋词活动</title>
		<link>http://wp.ljf.cn/archives/2155</link>
		<comments>http://wp.ljf.cn/archives/2155#comments</comments>
		<pubDate>Sat, 24 Mar 2012 05:50:18 +0000</pubDate>
		<dc:creator>林 剑锋</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://wp.ljf.cn/?p=2155</guid>
		<description><![CDATA[测试一下！]]></description>
			<content:encoded><![CDATA[<p>测试一下！<br />
<script type='text/javascript' src='http://fw.qq.com/ipaddress'></script>
<div><a href='http://tssc.csfqw.com/index_138.html?fip=' target='_blank' onclick='window.open(this.href + IPData[0]);return false;'><img src='http://www.csfqw.com/banner/fxzmcs/960-70.jpg' alt='潮汕风情网-唐诗宋词'/></a></div>
]]></content:encoded>
			<wfw:commentRss>http://wp.ljf.cn/archives/2155/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DeBug:从windows日志追寻到网站程序的性能瓶颈</title>
		<link>http://wp.ljf.cn/archives/2153</link>
		<comments>http://wp.ljf.cn/archives/2153#comments</comments>
		<pubDate>Sun, 01 Jan 2012 17:55:04 +0000</pubDate>
		<dc:creator>林 剑锋</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[row_number()]]></category>
		<category><![CDATA[性能]]></category>

		<guid isPermaLink="false">http://wp.ljf.cn/?p=2153</guid>
		<description><![CDATA[上文提到，在windows日志中，经常看到这样的错误： 查询处理器用尽了内部资源，无法生成查询计划。这种情况很少出现，只有在查询极其复杂或引用了大量表或分区时才会出现。请简化查询。如果您认为该消息的出现纯属错误，请与客户支持服务部门联系，了解详细信息。 这对于一个拥有十来个二级栏目，每个栏目都是一套独立的程序，并且集中在一个站点的网站来说，找出发生错误的那部分程序，是相当不容易的事情。 第一步，通过日志的来源，确定错误来源于MSSQL SERVER。上文提到，这是使用IN关键词产生的错误描述。并且已经明确，是由于查询的数据量太大，导致资源耗尽还没有得到查询结果。 第二步，通过SQL Server Profiler追踪数据库的查询情况。我把追踪结果存入数据库，然后通过查询Duration数值最大的前100条数据，结果有一个惊人的发现。一条类似这样的查询语句让我震惊了： [pre] select * from (select top 1520 articleid,classId,classname,articlemark,articletitle,hits,case smallpic when &#8221; then &#8216;jnews/images/newslist_26.gif&#8217; else smallpic end as smallpic,description,addtime,author,tag from cms_article where classID=3 and ischeck=1  and articleid in (316577,112553,59078,332886,255516,381339,98365,368853,50991,&#8230;..(此处省略一万字以上) [/pre] 打开项目源代码，查找该查询语句的某些特征字符串，例如：“case smallpic when &#8221; &#8230; <a href="http://wp.ljf.cn/archives/2153">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>上文提到，在windows日志中，经常看到这样的错误：</p>
<blockquote><p>查询处理器用尽了内部资源，无法生成查询计划。这种情况很少出现，只有在查询极其复杂或引用了大量表或分区时才会出现。请简化查询。如果您认为该消息的出现纯属错误，请与客户支持服务部门联系，了解详细信息。</p></blockquote>
<p>这对于一个拥有十来个二级栏目，每个栏目都是一套独立的程序，并且集中在一个站点的网站来说，找出发生错误的那部分程序，是相当不容易的事情。</p>
<p>第一步，通过日志的来源，确定错误来源于MSSQL SERVER。上文提到，这是使用IN关键词产生的错误描述。并且已经明确，是由于查询的数据量太大，导致资源耗尽还没有得到查询结果。</p>
<p>第二步，通过SQL Server Profiler追踪数据库的查询情况。我把追踪结果存入数据库，然后通过查询Duration数值最大的前100条数据，结果有一个惊人的发现。一条类似这样的查询语句让我震惊了：</p>
<p>[pre]</p>
<p>select * from (select top 1520 articleid,classId,classname,articlemark,articletitle,hits,case smallpic when &#8221; then &#8216;jnews/images/newslist_26.gif&#8217; else smallpic end as smallpic,description,addtime,author,tag from cms_article where classID=3 and ischeck=1  and articleid in (316577,112553,59078,332886,255516,381339,98365,368853,50991,&#8230;..(此处省略一万字以上)</p>
<p>[/pre]</p>
<p>打开项目源代码，查找该查询语句的某些特征字符串，例如：“case smallpic when &#8221; then &#8216;jnews/images/newslist_26.gif&#8217; else ”，很快找到了相应的函数。</p>
<p>第三步，分析了一下原查询语句的意图，无非是想对符合某些条件的文章进行分页读取。明白了意图，剩下来的工作就是重写这个方法，以相对高效的方式实现相同的任务。利用MSSQL Server 2005之后新增的row_number()属性，将该功能的查询修改成：</p>
<p>[pre]</p>
<p>string ausql = &#8220;select * from ( &#8221; +                 &#8220;select row_number() over(order by articleid desc) as rownumber,* &#8221; +                 &#8220;from cms_article where ischeck = 1 and &#8221; +                 &#8220;classid in (select classid from cms_artclass where &#8221; +                 &#8221; classid = &#8221; + classID + &#8221; or parentid = &#8221; + classID +                 &#8221; or parentpath like &#8216;%,&#8221; + classID + &#8220;,%&#8217;) &#8221; + str + &#8221; ) as t &#8221; +                 &#8220;where rownumber between &#8221; + startpage + &#8221; and &#8221; + endpage;</p>
<p>[/pre]</p>
<p>条件中也许会由于使用到LIKE关键词而降低效率，不过该字段类型通常为nvarchar(50)左右，应该在可接受的范围之内。相对原来的查询，显得微不足道了。这从Duration的值就可以看出来。新查询的Duration是700左右，旧查询的某次Duration是5500314！</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.ljf.cn/archives/2153/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transact-SQL:数据量大是慎重使用IN关键字</title>
		<link>http://wp.ljf.cn/archives/2151</link>
		<comments>http://wp.ljf.cn/archives/2151#comments</comments>
		<pubDate>Sat, 31 Dec 2011 08:31:00 +0000</pubDate>
		<dc:creator>林 剑锋</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[in]]></category>
		<category><![CDATA[sql查询]]></category>
		<category><![CDATA[耗资源]]></category>

		<guid isPermaLink="false">http://wp.ljf.cn/?p=2151</guid>
		<description><![CDATA[使用IN关键字的查询语句效率是非常低下的。不是万不得已，费用不可的情况，千万别用！当数据量巨大时，还可能会产生以下错误： 在 IN 子句中包括数量非常多的值（数以千计）可能会消耗资源并返回错误 8623 或 8632。若要解决这一问题，请将这些项存储于某个表的 IN 列表中。 错误 8623：   查询处理器用尽了内部资源，无法生成查询计划。这种情况很少出现，只有在查询极其复杂或引用了大量表或分区时才会出现。请简化查询。如果您认为该消息的出现纯属错误，请与客户支持服务部门联系，了解详细信息。 错误 8632：   内部错误: 达到了表达式服务限制。请在您的查询中查找潜在的复杂表达式，并尝试简化它们。 参考：http://msdn.microsoft.com/zh-cn/library/ms177682.aspx 解决办法只有一种：修改查询语句，不要用IN语法。 而更麻烦的问题是，当程序相对复杂时，你可能要通过数据库工具找到产生错误的查询语句，然后改善之！]]></description>
			<content:encoded><![CDATA[<p>使用IN关键字的查询语句效率是非常低下的。不是万不得已，费用不可的情况，千万别用！当数据量巨大时，还可能会产生以下错误：</p>
<blockquote><p>在 IN 子句中包括数量非常多的值（数以千计）可能会消耗资源并返回错误 8623 或 8632。若要解决这一问题，请将这些项存储于某个表的 IN 列表中。</p>
<p>错误 8623：   查询处理器用尽了内部资源，无法生成查询计划。这种情况很少出现，只有在查询极其复杂或引用了大量表或分区时才会出现。请简化查询。如果您认为该消息的出现纯属错误，请与客户支持服务部门联系，了解详细信息。</p>
<p>错误 8632：   内部错误: 达到了表达式服务限制。请在您的查询中查找潜在的复杂表达式，并尝试简化它们。</p></blockquote>
<p>参考：<a href="http://msdn.microsoft.com/zh-cn/library/ms177682.aspx">http://msdn.microsoft.com/zh-cn/library/ms177682.aspx</a></p>
<p>解决办法只有一种：修改查询语句，不要用IN语法。</p>
<p>而更麻烦的问题是，当程序相对复杂时，你可能要通过数据库工具找到产生错误的查询语句，然后改善之！</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.ljf.cn/archives/2151/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FastCGI设置解决大量php-cgi.exe进程导致服务器堵塞</title>
		<link>http://wp.ljf.cn/archives/2143</link>
		<comments>http://wp.ljf.cn/archives/2143#comments</comments>
		<pubDate>Sun, 25 Dec 2011 11:52:34 +0000</pubDate>
		<dc:creator>林 剑锋</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[php-cgi.ee]]></category>

		<guid isPermaLink="false">http://wp.ljf.cn/?p=2143</guid>
		<description><![CDATA[这几天服务器出现了一个问题，流量不高，但是服务器打开超级慢，往往超时了还没有加载完页面。检查了服务器，发现有大量的php-cgi.exe进程，用netstat查询，发现有大量CLOSE_WAIT的链接。用360检查了连接数，居然达到1500个连接以上！ 服务器只有不到5个的php站点，怎么会出现这么多的php-cgi.exe进程呢？程序池中，已经设置了“最大工作进程”为1啦！ 经过研究，发现在FastCGI中也有类似的设置。把“最大实例数”由0改成1即可解决问题。可是在流量不高的情况下，站点打开的速度还是不快，不明白是什么原因。]]></description>
			<content:encoded><![CDATA[<p>这几天服务器出现了一个问题，流量不高，但是服务器打开超级慢，往往超时了还没有加载完页面。检查了服务器，发现有大量的php-cgi.exe进程，用netstat查询，发现有大量CLOSE_WAIT的链接。用360检查了连接数，居然达到1500个连接以上！</p>
<p>服务器只有不到5个的php站点，怎么会出现这么多的php-cgi.exe进程呢？程序池中，已经设置了“最大工作进程”为1啦！</p>
<p><a href="http://wp.ljf.cn/wp-content/uploads/2011/12/webfarm.jpg" rel="lightbox[2143]" title="webfarm"><img class="alignnone size-full wp-image-2145" title="webfarm" src="http://wp.ljf.cn/wp-content/uploads/2011/12/webfarm.jpg" alt="" width="453" height="509" /></a></p>
<p>经过研究，发现在FastCGI中也有类似的设置。把“最大实例数”由0改成1即可解决问题。可是在流量不高的情况下，站点打开的速度还是不快，不明白是什么原因。</p>
<p><a href="http://wp.ljf.cn/wp-content/uploads/2011/12/php-cgi.jpg" rel="lightbox[2143]" title="php-cgi"><img class="alignnone size-full wp-image-2144" title="php-cgi" src="http://wp.ljf.cn/wp-content/uploads/2011/12/php-cgi.jpg" alt="" width="494" height="559" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://wp.ljf.cn/archives/2143/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>vim快捷键</title>
		<link>http://wp.ljf.cn/archives/2133</link>
		<comments>http://wp.ljf.cn/archives/2133#comments</comments>
		<pubDate>Thu, 15 Dec 2011 18:55:48 +0000</pubDate>
		<dc:creator>林 剑锋</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[快捷键]]></category>

		<guid isPermaLink="false">http://wp.ljf.cn/?p=2133</guid>
		<description><![CDATA[basic: ↑ ←   h   j   k   l   → ↓ :w write / save :w {file}       write to file / save as :wq / ZZ write and quit / save and quit :q! / ZQ        force quit / quit without saving &#8230; <a href="http://wp.ljf.cn/archives/2133">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<pre>

basic:
↑
←   h   j   k   l   →
↓

:w
write / save
:w {file}       write to file / save as
:wq / ZZ
write and quit / save and quit
:q! / ZQ        force quit / quit without
saving

d{motion}       delete / cut
y{motion}       yank / copy
p
put / paste

cursor -&gt; line:
a               append
after the cursor
A               append after the line
i
insert before the cursor
I               insert before the line
r
replace at the cursor
R               replace the line
s
substitute at the cursor
S               substitute the line
u
undo            CTRL-R      undo the undo
U               undo the
line
v               start visual mode per character
V               start
visual mode line-wise

forward -&gt; backward:
x               delete
characters forward
X               delete characters backward
p
put after the cursor
P               put before the cursor
o
open a line below
O               open a line above

f{char}
find {char} forward
F{char}         find {char} backward
t{char}
till {char} forward
T{char}         till {char} backward
;
next {char} occurrence
,               previous {char}
occurrence

/{pattern}      search {pattern} forward
?{pattern}
search {pattern} backward
n               next {pattern} occurrence
N
previous {pattern} occurrence

motion / word -&gt; WORD:
w
forward to the start of word
W               forward to the start
of WORD
e               forward to the end of word
E               forward
to the end of WORD
b               backward to the start of word
B
backward to the start of WORD
ge              backward to the end of
word
gE              backward to the end of WORD

0               to
the first character of the line
^               to the first non-blank
character of the line
$               to the last character of the
line
g_              to the last non-blank character of the line

d
-&gt; dd -&gt; D:
d{motion}       delete
dd              delete a
line
D               delete to the end of the line
c{motion}
change
cc              change a line
C               change to the end of
the line
y{motion}       yank/copy
yy              yank/copy a line
Y
same as yy, unfortunately we are not in a perfect
world

advanced:
H               High / to first line on the
window
M               Middle / to middle line of the window
L
Low / to last line on the window

:1 / gg         to first line of the
file
:[+/-]{number}  to relative/absolute line number
:$ / G          to
last line of the file

%               find a matching

:s/old/new
substitute once
:s/old/new/g    substitute all on a
line
:%s/old/new/g   substitute all in the file
:%s/old/new/gi  substitute
all in the file, ignore case
:%s/old/new/gn  count occurrence only, do not
substitute
:%s/old/new/gc  substitute all in the file, with
confirmation

:!{cmd}         execute {cmd} with the shell
:!!
repeat last shell command

:w !sudo tee %  save as root
</pre>
<p>来源：<a href="http://forum.ubuntu.org.cn/viewtopic.php?f=68&amp;t=290466">http://forum.ubuntu.org.cn/viewtopic.php?f=68&amp;t=290466</a></p>
<p>其实记住vim有两个状态就好：插入状态和命令状态。i，进入插入文本状态，ESC，返回命令状态。输入命令前记得先打冒号:</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.ljf.cn/archives/2133/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>windows7：清理远程桌面连接历史记录</title>
		<link>http://wp.ljf.cn/archives/2131</link>
		<comments>http://wp.ljf.cn/archives/2131#comments</comments>
		<pubDate>Wed, 30 Nov 2011 07:03:02 +0000</pubDate>
		<dc:creator>林 剑锋</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[远程桌面历史记录]]></category>

		<guid isPermaLink="false">http://wp.ljf.cn/?p=2131</guid>
		<description><![CDATA[一、清除远程桌面连接下拉地址列表，具体操作：定位注册表到“HKEY_CURRENT_USER\Software\Microsoft \Terminal Server Client\Default”，将右侧所有以“MRU”开头的值删除，如“MR0，MR1，MR2”等 二、清除远程桌面连接主机名和用户名，具体操作：定位注册表到“HKEY_CURRENT_USER\Software\Microsoft \Terminal Server Client\Servers\”，在左侧将其下所有类型为IP地址的项删除。 安全要从细节抓起，共用电脑，更加要注意安全，防止泄露敏感信息。]]></description>
			<content:encoded><![CDATA[<p>一、清除远程桌面连接下拉地址列表，具体操作：定位注册表到“HKEY_CURRENT_USER\Software\Microsoft \Terminal Server Client\Default”，将右侧所有以“MRU”开头的值删除，如“MR0，MR1，MR2”等</p>
<p>二、清除远程桌面连接主机名和用户名，具体操作：定位注册表到“HKEY_CURRENT_USER\Software\Microsoft \Terminal Server Client\Servers\”，在左侧将其下所有类型为IP地址的项删除。</p>
<p>安全要从细节抓起，共用电脑，更加要注意安全，防止泄露敏感信息。</p>
]]></content:encoded>
			<wfw:commentRss>http://wp.ljf.cn/archives/2131/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

