<?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>水草树 &#187; Study notes</title>
	<atom:link href="http://mifunny.info/category/study/feed" rel="self" type="application/rss+xml" />
	<link>http://mifunny.info</link>
	<description>走走停停看看，恍然大悟。</description>
	<lastBuildDate>Sun, 18 Jul 2010 08:55:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>在PHP中像JQuery一样操作HTML</title>
		<link>http://mifunny.info/work-with-php-but-dance-like-jquery-345.html</link>
		<comments>http://mifunny.info/work-with-php-but-dance-like-jquery-345.html#comments</comments>
		<pubDate>Wed, 16 Jun 2010 12:13:39 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpQuery]]></category>
		<category><![CDATA[pyQuery]]></category>

		<guid isPermaLink="false">http://mifunny.info/work-with-php-but-dance-like-jquery-345.html</guid>
		<description><![CDATA[平时在PHP操作HTML时间吃力不讨好的事情， 虽然有“The DOMComment class”之类的神迹，但远不如javasript操作html来得快。 所以懒人们高出一个 phpQuery， 像JQuery一样操作HTML. &#60;?php include &#8216;phpQuery-onefile.php&#8217;; $doc = phpQuery::newDocumentHTML($html); echo $doc["head &#62; title"]-&#62;text(); ?&#62; 注意： 看了源码，第二个参数可以指定编码。（utf8、gbk&#8230;.） $html 必须是utf-8编码的，否则中文会出现乱码; phpQuery: http://code.google.com/p/phpquery/ python版 pyQuery： http://pypi.python.org/pypi/pyquery]]></description>
			<content:encoded><![CDATA[<p>平时在PHP操作HTML时间吃力不讨好的事情， 虽然有“The DOMComment class”之类的神迹，但远不如javasript操作html来得快。 所以懒人们高出一个 phpQuery， 像JQuery一样操作HTML.</p>
<blockquote style="font-style:normal"><p>&lt;?php<br />
include &#8216;phpQuery-onefile.php&#8217;;<br />
$doc = phpQuery::newDocumentHTML($html);</p>
<p>echo $doc["head &gt; title"]-&gt;text();<br />
?&gt;</p></blockquote>
<p><b>注意：</b> 看了源码，第二个参数可以指定编码。（utf8、gbk&#8230;.） <del datetime="2010-07-18T08:54:46+00:00">$html 必须是utf-8编码的，否则中文会出现乱码;</del><br />
<br />phpQuery: http://code.google.com/p/phpquery/<br />
<br />python版 pyQuery： http://pypi.python.org/pypi/pyquery</p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/work-with-php-but-dance-like-jquery-345.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Nginx根据来源rewrite</title>
		<link>http://mifunny.info/nginx-rewrite-by-referer-344.html</link>
		<comments>http://mifunny.info/nginx-rewrite-by-referer-344.html#comments</comments>
		<pubDate>Wed, 16 Jun 2010 11:57:40 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[Study notes]]></category>
		<category><![CDATA[大佛Linux]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[referer]]></category>
		<category><![CDATA[rewite]]></category>

		<guid isPermaLink="false">http://mifunny.info/nginx-rewrite-by-referer-344.html</guid>
		<description><![CDATA[通过来源rewrite url，可以使得通过A网站，和通过B网站 过来访问内容的是不同的， 但是url还是那个； 是不是很帅！nginx轻松搞定。 if ($http_referer ~* mifunny.info){ &#160;&#160;rewrite ^/7474748\.html$ /html/ld/index.html break; }]]></description>
			<content:encoded><![CDATA[<p> 通过来源rewrite url，可以使得通过A网站，和通过B网站 过来访问内容的是不同的， 但是url还是那个； 是不是很帅！nginx轻松搞定。 </p>
<blockquote style="font-style:normal"><p>
if ($http_referer ~* mifunny.info){<br />
&nbsp;&nbsp;rewrite ^/7474748\.html$ /html/ld/index.html break;<br />
}
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/nginx-rewrite-by-referer-344.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Nginx屏蔽未绑定域名访问</title>
		<link>http://mifunny.info/nginx-stop-other-domain-343.html</link>
		<comments>http://mifunny.info/nginx-stop-other-domain-343.html#comments</comments>
		<pubDate>Wed, 16 Jun 2010 11:50:06 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[Study notes]]></category>
		<category><![CDATA[大佛Linux]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[未绑定域名]]></category>

		<guid isPermaLink="false">http://mifunny.info/nginx-stop-other-domain-343.html</guid>
		<description><![CDATA[当别人把垃圾域名转向至你的服务器时， 如果不采取措施，那么几乎是傻等着被K。(国内机房一般都要求网站主关闭空主机头，防止未备案的域名指向过来造成麻烦。) 在Nginx的配置文件 nginx.cnf 最后加上下面代码： server { &#160;&#160;listen 80 default; &#160;&#160;return 500; } 以此类推， 禁止通过IP访问，可以写成: server { &#160;&#160;listen 80 default; &#160;&#160;server_name _; &#160;&#160;return 500; }]]></description>
			<content:encoded><![CDATA[<p> 当别人把垃圾域名转向至你的服务器时， 如果不采取措施，那么几乎是傻等着被K。(国内机房一般都要求网站主关闭空主机头，防止未备案的域名指向过来造成麻烦。) 在Nginx的配置文件 nginx.cnf 最后加上下面代码： </p>
<blockquote style="font-style:normal"><p>
server {<br />
&nbsp;&nbsp;listen 80 default;<br />
&nbsp;&nbsp;return 500;<br />
}
</p></blockquote>
<p>以此类推， 禁止通过IP访问，可以写成:</p>
<blockquote style="font-style:normal"><p>
server {<br />
&nbsp;&nbsp;listen 80 default;<br />
&nbsp;&nbsp;server_name _;<br />
&nbsp;&nbsp;return 500;<br />
}
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/nginx-stop-other-domain-343.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>计算自然周 &#8211; YEARWEEK</title>
		<link>http://mifunny.info/hwo-to-get-natural-week-in-a-year-342.html</link>
		<comments>http://mifunny.info/hwo-to-get-natural-week-in-a-year-342.html#comments</comments>
		<pubDate>Wed, 16 Jun 2010 11:36:58 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[YEARWEEK]]></category>
		<category><![CDATA[自然周]]></category>

		<guid isPermaLink="false">http://mifunny.info/hwo-to-get-natural-week-in-a-year-342.html</guid>
		<description><![CDATA[自然周嘛，顾名思义，星期一是一周的第一天， 在MySQL中, 可以使用YEARWEEK函数获得: SELECT SQL_NO_CACHE yearweek( from_unixtime( unix_timestamp(&#8217;2010-06-16 19:13:01&#8242;)-86400 ) ) AS week; 结果是 201024 PHP中就稍稍有些麻烦了: &#160;1 &#60;?php &#160;2 &#160;3 $dateStr&#160;=&#160;&#8217;2010-06-16 19:13:01&#8216;; &#160;4 echo&#160;&#160;getYearWeek($dateStr); &#160;5 &#160;6 //获取自然周 &#160;7 function&#160;getYearWeek($dateStr){ &#160;8 &#160;&#160;&#160;&#160;$unixtime&#160;=&#160;strtotime($dateStr); &#160;9 &#160;&#160;&#160;&#160;$ym&#160;=&#160;strftime(&#8216;%Y%m&#8216;, $unixtime); 10 &#160;&#160;&#160;&#160;$w&#160;=&#160;strftime(&#8216;%V&#8216;, $unixtime); 11 &#160;&#160;&#160;&#160; 12 &#160;&#160;&#160;&#160;$y&#160;=&#160;substr($ym, 0, 4); 13 &#160;&#160;&#160;&#160;$m&#160;=&#160;substr($ym, 4, 2); 14 &#160;&#160;&#160;&#160;if(&#160;6&#62;(int)$m&#160;&#38;&#38;&#160;50&#60;$w&#160;){ 15 &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$y&#160;=&#160;(int)$y&#160;-&#160;1; 16 &#160;&#160;&#160;&#160;} 17 &#160;&#160;&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>自然周嘛，顾名思义，星期一是一周的第一天， 在MySQL中, 可以使用YEARWEEK函数获得: <br /> SELECT SQL_NO_CACHE yearweek( from_unixtime( unix_timestamp(&#8217;2010-06-16 19:13:01&#8242;)-86400 ) ) AS week;<br />
结果是 201024
</p>
<p>PHP中就稍稍有些麻烦了:</p>
<blockquote style="font-style:normal;color:#ffffff;background-color:#333333;"><p>
  <font color="#ffff00">&nbsp;1 </font><font color="#ff40ff">&lt;?php</font><br />
  <font color="#ffff00">&nbsp;2 </font><br />
  <font color="#ffff00">&nbsp;3 </font><font color="#ffff00">$</font><font color="#00ffff">dateStr</font>&nbsp;<font color="#ffff00">=</font>&nbsp;&#8217;<font color="#ffff00">2010-06-16 19:13:01</font>&#8216;<font color="#ff40ff">;</font><br />
  <font color="#ffff00">&nbsp;4 </font><font color="#ff40ff">echo</font>&nbsp;&nbsp;getYearWeek<font color="#ff40ff">(</font><font color="#ffff00">$</font><font color="#00ffff">dateStr</font><font color="#ff40ff">)</font><font color="#ff40ff">;</font><br />
  <font color="#ffff00">&nbsp;5 </font><br />
  <font color="#ffff00">&nbsp;6 </font><font color="#00ffff">//获取自然周</font><br />
  <font color="#ffff00">&nbsp;7 </font><font color="#ff40ff">function</font>&nbsp;getYearWeek<font color="#ff40ff">(</font><font color="#ffff00">$</font><font color="#00ffff">dateStr</font><font color="#ff40ff">)</font><font color="#ff40ff">{</font><br />
  <font color="#ffff00">&nbsp;8 </font>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ffff00">$</font><font color="#00ffff">unixtime</font>&nbsp;<font color="#ffff00">=</font>&nbsp;<font color="#00ffff">strtotime</font><font color="#ff40ff">(</font><font color="#ffff00">$</font><font color="#00ffff">dateStr</font><font color="#ff40ff">)</font><font color="#ff40ff">;</font><br />
  <font color="#ffff00">&nbsp;9 </font>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ffff00">$</font><font color="#00ffff">ym</font>&nbsp;<font color="#ffff00">=</font>&nbsp;<font color="#00ffff">strftime</font><font color="#ff40ff">(</font>&#8216;<font color="#ffff00">%Y%m</font>&#8216;, <font color="#ffff00">$</font><font color="#00ffff">unixtime</font><font color="#ff40ff">)</font><font color="#ff40ff">;</font><br />
  <font color="#ffff00">10 </font>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ffff00">$</font><font color="#00ffff">w</font>&nbsp;<font color="#ffff00">=</font>&nbsp;<font color="#00ffff">strftime</font><font color="#ff40ff">(</font>&#8216;<font color="#ffff00">%V</font>&#8216;, <font color="#ffff00">$</font><font color="#00ffff">unixtime</font><font color="#ff40ff">)</font><font color="#ff40ff">;</font><br />
  <font color="#ffff00">11 </font>&nbsp;&nbsp;&nbsp;&nbsp;<br />
  <font color="#ffff00">12 </font>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ffff00">$</font><font color="#00ffff">y</font>&nbsp;<font color="#ffff00">=</font>&nbsp;<font color="#00ffff">substr</font><font color="#ff40ff">(</font><font color="#ffff00">$</font><font color="#00ffff">ym</font>, <font color="#ffff00">0</font>, <font color="#ffff00">4</font><font color="#ff40ff">)</font><font color="#ff40ff">;</font><br />
  <font color="#ffff00">13 </font>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ffff00">$</font><font color="#00ffff">m</font>&nbsp;<font color="#ffff00">=</font>&nbsp;<font color="#00ffff">substr</font><font color="#ff40ff">(</font><font color="#ffff00">$</font><font color="#00ffff">ym</font>, <font color="#ffff00">4</font>, <font color="#ffff00">2</font><font color="#ff40ff">)</font><font color="#ff40ff">;</font><br />
  <font color="#ffff00">14 </font>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ffff00">if</font><font color="#ff40ff">(</font>&nbsp;<font color="#ffff00">6</font><font color="#ffff00">&gt;</font><font color="#ff40ff">(</font><font color="#00ff00">int</font><font color="#ff40ff">)</font><font color="#ffff00">$</font><font color="#00ffff">m</font>&nbsp;<font color="#ffff00">&amp;&amp;</font>&nbsp;<font color="#ffff00">50</font><font color="#ffff00">&lt;</font><font color="#ffff00">$</font><font color="#00ffff">w</font>&nbsp;<font color="#ff40ff">)</font><font color="#ff40ff">{</font><br />
  <font color="#ffff00">15 </font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ffff00">$</font><font color="#00ffff">y</font>&nbsp;<font color="#ffff00">=</font>&nbsp;<font color="#ff40ff">(</font><font color="#00ff00">int</font><font color="#ff40ff">)</font><font color="#ffff00">$</font><font color="#00ffff">y</font>&nbsp;<font color="#ffff00">-</font>&nbsp;<font color="#ffff00">1</font><font color="#ff40ff">;</font><br />
  <font color="#ffff00">16 </font>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ff40ff">}</font><br />
  <font color="#ffff00">17 </font>&nbsp;&nbsp;&nbsp;&nbsp;<br />
  <font color="#ffff00">18 </font>&nbsp;&nbsp;&nbsp;&nbsp;<font color="#ffff00">return</font>&nbsp;<font color="#ffff00">$</font><font color="#00ffff">y</font><font color="#ffff00">.</font><font color="#ffff00">$</font><font color="#00ffff">w</font><font color="#ffff00">;</font><br />
  <font color="#ffff00">19 </font><font color="#ff40ff">}</font>
</p></blockquote>
<p>输出 201024 ; 如果需要计算自然周的第一天和最后一天，不妨参考taobao QA团队的文章:  <a rel="external" href="http://qa.taobao.com/?p=123">php 取得某个自然周的第一天和最后一天的方法</a>  </p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/hwo-to-get-natural-week-in-a-year-342.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP 大数自动转换为科学计数法的无耻问题</title>
		<link>http://mifunny.info/big-number-convert-to-scientific-notation-of-php-341.html</link>
		<comments>http://mifunny.info/big-number-convert-to-scientific-notation-of-php-341.html#comments</comments>
		<pubDate>Wed, 16 Jun 2010 11:00:41 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[precision]]></category>
		<category><![CDATA[sprintf]]></category>
		<category><![CDATA[大数]]></category>
		<category><![CDATA[科学计数法]]></category>

		<guid isPermaLink="false">http://mifunny.info/big-number-convert-to-scientific-notation-of-php-341.html</guid>
		<description><![CDATA[前段时间碰到一个很头疼的问题，就是大于12位的数字在PHP中，会自动转成科学计数法表示。 比如 1234567891234 显示为 1.23456789123E+12 ， 最后只能在计算出大数之后，立即用 sprintf(&#8216;%1.0f&#8217;, $number) 来格式化。 奇怪的是，在我的Arch Linux上却不会自动转换， 只出现在生产机上， 郁闷ing. 上网搜了下， 有不少和我遇到相同问题的: [PHP] 大數運算問題 @ BJ の 狗窩 :: 痞客邦 PIXNET :: PHP大整数输出成科学计数法问题 解决方法: 在PHP配置文件 php.ini 中， 有一行 precision = 14 , 一般*nix上是14，windows上是12； 不过以防万一， 以后编码 但凡遇到12位以上的数字，都用sprintf格式化.]]></description>
			<content:encoded><![CDATA[<p>前段时间碰到一个很头疼的问题，就是大于12位的数字在PHP中，会自动转成科学计数法表示。 比如 1234567891234 显示为 1.23456789123E+12 ， 最后只能在计算出大数之后，立即用 sprintf(&#8216;%1.0f&#8217;, $number) 来格式化。</p>
<p>奇怪的是，在我的Arch Linux上却不会自动转换， 只出现在生产机上， 郁闷ing. 上网搜了下， 有不少和我遇到相同问题的:</p>
<p><a rel="external" href="http://bjstation.pixnet.net/blog/post/31048697">[PHP] 大數運算問題 @ BJ の 狗窩 :: 痞客邦 PIXNET ::</a><br />
<a rel="external" href="http://www.phpfans.net/blog/2/article/33.html">PHP大整数输出成科学计数法问题</a>
</p>
<p><b>解决方法:</b> 在PHP配置文件 php.ini 中， 有一行 precision = 14 , 一般*nix上是14，windows上是12； 不过以防万一， 以后编码 但凡遇到12位以上的数字，都用sprintf格式化.</p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/big-number-convert-to-scientific-notation-of-php-341.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3种PHP-CGI</title>
		<link>http://mifunny.info/run-php-as-cgi-339.html</link>
		<comments>http://mifunny.info/run-php-as-cgi-339.html#comments</comments>
		<pubDate>Sun, 25 Apr 2010 10:54:33 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[CGI]]></category>
		<category><![CDATA[FastCGI]]></category>
		<category><![CDATA[FPM]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[spawn-fcgi]]></category>

		<guid isPermaLink="false">http://mifunny.info/?p=339</guid>
		<description><![CDATA[PHP CGI 有3种形式： 最强悍的FPM, 功能最强大， 只要配置php-fpm.conf即可； fpm主页： http://php-fpm.org/ 使用 spawn-fcgi, 启动命令： env &#8211; PHP_FCGI_CHILDREN=3 PHP_FCGI_MAX_REQUESTS=1000 spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f php-cgi -P /var/run/spawn-fcgi.pid 使用时， 把www-data替换成自己的用户名和群组名； 参数含义如下: &#160;&#160;-f &#60;fcgiapp&#62; 指定调用FastCGI的进程的执行程序位置，根据系统上所装的PHP的情况具体设置 &#160;&#160;-a &#60;addr&#62; 绑定到地址addr &#160;&#160;-p &#60;port&#62; 绑定到端口port &#160;&#160;-s &#60;path&#62; 绑定到unix socket的路径path &#160;&#160;-C &#60;childs&#62; 指定产生的FastCGI的进程数，默认为5（仅用于PHP） &#160;&#160;-P &#60;path&#62; 指定产生的进程的PID文件路径 &#160;&#160;-u和-g FastCGI使用什么身份（-u 用户 -g 用户组）运行，Ubuntu下可以使用www-data，其他的根据情况配置，如nobody、apache等 [...]]]></description>
			<content:encoded><![CDATA[<p>PHP CGI 有3种形式：</p>
<ol style="list-style-type: upper-roman;">
<li> 最强悍的FPM, 功能最强大， 只要配置php-fpm.conf即可；<br /> <br />
  fpm主页： http://php-fpm.org/</li>
<li> 使用 spawn-fcgi, 启动命令： env &#8211; PHP_FCGI_CHILDREN=3 PHP_FCGI_MAX_REQUESTS=1000 spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f php-cgi -P /var/run/spawn-fcgi.pid<br /> <br />
  使用时， 把www-data替换成自己的用户名和群组名；</p>
<blockquote style="font-style:normal"><p>参数含义如下:<br />
&nbsp;&nbsp;-f &lt;fcgiapp&gt; 指定调用FastCGI的进程的执行程序位置，根据系统上所装的PHP的情况具体设置<br />
&nbsp;&nbsp;-a &lt;addr&gt; 绑定到地址addr<br />
&nbsp;&nbsp;-p &lt;port&gt; 绑定到端口port<br />
&nbsp;&nbsp;-s &lt;path&gt; 绑定到unix socket的路径path<br />
&nbsp;&nbsp;-C &lt;childs&gt; 指定产生的FastCGI的进程数，默认为5（仅用于PHP）<br />
&nbsp;&nbsp;-P &lt;path&gt; 指定产生的进程的PID文件路径<br />
&nbsp;&nbsp;-u和-g FastCGI使用什么身份（-u 用户 -g 用户组）运行，Ubuntu下可以使用www-data，其他的根据情况配置，如nobody、apache等<br />
&nbsp;&nbsp;&nbsp;&nbsp;然后我们可以将这行代码加入到/etc/rc.local文件底部，这样系统启动的时候也可以同时启动PHP的FastCGI进程。
</p></blockquote>
</li>
<li> 直接启动php-cgi， 使用命令： php-cgi -b 127.0.0.1:9000<br /> <br />
不过这时php-cgi是使用当前用户身份， 执行session等相关操作会出错， 如果web用户(如ubuntu下的www-data)是可以登录的， 则使用命令： su www-data -l -c &#8220;php-cgi -b 127.0.0.1:9000&#8243;<br /> <br />
如果www-data不能登录(bash位/bin/false), 那么直接修改用户权限，<br /> <br />
&nbsp;&nbsp;&nbsp;&nbsp;sudo chown www-data:www-data which php-cgi<br />
&nbsp;&nbsp;&nbsp;&nbsp;sudo chmod u+s which php-cgi
</li>
</ol>
<p> </p>
<p>BTW： 近段时间看ZF手册，开头有这么一句： 对于只包含有 PHP 代码的文件，结束标志（&#8221;?&gt;&#8221;）是不允许存在的，PHP自身不需要（&#8221;?&gt;&#8221;）, 这样做, 可以防止它的末尾的被意外地注入相应。 晕倒～～ 我这会儿才知道有这茬</p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/run-php-as-cgi-339.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>5种翻墙代理</title>
		<link>http://mifunny.info/gfw-proxy-338.html</link>
		<comments>http://mifunny.info/gfw-proxy-338.html#comments</comments>
		<pubDate>Sun, 18 Apr 2010 13:14:22 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[Study notes]]></category>
		<category><![CDATA[apjp]]></category>
		<category><![CDATA[gappproxy]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[ssh proxy]]></category>
		<category><![CDATA[toolnet]]></category>
		<category><![CDATA[代理]]></category>
		<category><![CDATA[翻墙]]></category>

		<guid isPermaLink="false">http://mifunny.info/gfw-proxy-338.html</guid>
		<description><![CDATA[最近每每翻墙，总想起张小花《史上第一混乱》中那句：“阶级啊，这就是阶级啊！万恶的封建主他们骄奢淫逸，他们鱼肉百姓，他们骑在人民头上拉屎撒尿——这个有点恶心就不说了。”呃～～ 是广播剧版的， 看文字没那么强效果。 好了，下面列出本人使用过、使用着的5中翻墙代理: GAppProxy: 主页 http://code.google.com/p/gappproxy/ , 安装使用FAQ里讲得很明白， 不过部分GAE网址被封， 有些不好使了。 Toonel: java的一个小玩意， 但是速度很慢。 Nginx透明代理: 前文说过了 使用 Nginx 搭建正向代理(透明代理) SSH proxy: 这个不错，可惜godaddy空间不支持; (命令 ssh -D 8001 user@hostname ) APJP: 主页 http://code.google.com/p/apjp/ ， 服务端PHP， 客户端JAVA， 有国外空间的朋友可以选择。]]></description>
			<content:encoded><![CDATA[<p> 最近每每翻墙，总想起张小花《史上第一混乱》中那句：“阶级啊，这就是阶级啊！万恶的封建主他们骄奢淫逸，他们鱼肉百姓，他们骑在人民头上拉屎撒尿——这个有点恶心就不说了。”呃～～ 是广播剧版的， 看文字没那么强效果。</p>
<p> 好了，下面列出本人使用过、使用着的5中翻墙代理: </p>
<ol style="list-style-type: decimal;">
<li>GAppProxy: 主页 <a rel="external" href="http://code.google.com/p/gappproxy/">http://code.google.com/p/gappproxy/</a> , 安装使用FAQ里讲得很明白， 不过部分GAE网址被封， 有些不好使了。</li>
<li>Toonel: java的一个小玩意， 但是速度很慢。</li>
<li>Nginx透明代理: 前文说过了 <a href="http://mifunny.info/use-nginx-build-proxy-337.html" rel="bookmark" title="Permanent Link to 使用 Nginx 搭建正向代理(透明代理)">使用 Nginx 搭建正向代理(透明代理)</a></li>
<li>SSH proxy: 这个不错，可惜godaddy空间不支持; (命令 ssh -D 8001  user@hostname )</li>
<li>APJP: 主页 <a rel="external" href="http://code.google.com/p/apjp/">http://code.google.com/p/apjp/</a> ， 服务端PHP， 客户端JAVA， 有国外空间的朋友可以选择。</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/gfw-proxy-338.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>使用 Nginx 搭建正向代理(透明代理)</title>
		<link>http://mifunny.info/use-nginx-build-proxy-337.html</link>
		<comments>http://mifunny.info/use-nginx-build-proxy-337.html#comments</comments>
		<pubDate>Sun, 04 Apr 2010 13:29:47 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[Study notes]]></category>
		<category><![CDATA[大佛Linux]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[正向代理]]></category>
		<category><![CDATA[透明代理]]></category>

		<guid isPermaLink="false">http://mifunny.info/use-nginx-build-proxy-337.html</guid>
		<description><![CDATA[几天前邮购了张宴牛大的《实战Nginx》, 发现nginx作代理实在是 easy! 下面是正向代理(透明代理)的配置内容: &#8230;. &#160;&#160;user www-data; &#160;&#160;worker_processes 2; &#160;&#160; &#8230; &#8230; &#160;&#160;server &#160;&#160;{ &#160;&#160;&#160;&#160;listen 8181; &#160;&#160;&#160;&#160;&#160;&#160;location / { &#160;&#160;&#160;&#160;&#160;&#160;resolver 8.8.8.8; #DNS最好换一个 &#160;&#160;&#160;&#160;&#160;&#160;proxy_pass http://$http_host$request_uri; &#160;&#160;&#160;&#160;} &#160;&#160;access_log /var/log/nginx/proxy_access.log &#160;&#160;} &#160;&#160;.. &#8230;]]></description>
			<content:encoded><![CDATA[<p>几天前邮购了张宴牛大的《实战Nginx》, 发现nginx作代理实在是 easy! 下面是正向代理(透明代理)的配置内容: </p>
<blockquote style="font-style:normal"><p>&#8230;.<br />
&nbsp;&nbsp;user www-data;<br />
&nbsp;&nbsp;worker_processes 2;<br />
&nbsp;&nbsp; &#8230; &#8230;<br />
&nbsp;&nbsp;server<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;&nbsp;listen 8181;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;location / {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;resolver 8.8.8.8; #DNS最好换一个<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;proxy_pass http://$http_host$request_uri;<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;access_log /var/log/nginx/proxy_access.log<br />
&nbsp;&nbsp;}<br />
&nbsp;&nbsp;.. &#8230;
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/use-nginx-build-proxy-337.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PHP 几种注释的区别</title>
		<link>http://mifunny.info/diff-remark-in-php-333.html</link>
		<comments>http://mifunny.info/diff-remark-in-php-333.html#comments</comments>
		<pubDate>Fri, 26 Mar 2010 13:28:34 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Study notes]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[注释]]></category>

		<guid isPermaLink="false">http://mifunny.info/?p=333</guid>
		<description><![CDATA[注释程序不仅是coder的个人习惯, 更是责任的体现. 那么首先抛出一个实用技巧, 快速无痛注释PHP代码段: 使用/* */注释大段程序, 一旦代码中包含/* */的话, 注释会出错, 所以换个思路使用 if(0){ &#8230; } 更好, ^_^ 历害吧, 这个可是调试时的不败利器哦 严格意义上, PHP 有四种注释. 单行注释 # 与 // , 单行注释在PHP解释时,不予编译, 所以一般用于纪录一写不太重要的注释。多行注释 /* */, C语言风格, 多行注释将和程序一起编译, 所以会增大内存的占用。 文档注释 /** * &#8230; 文档注释 * &#8230; &#8230; */ 上面的形式即是文档注释, 可以理解成多行注释的加强版。如PHPDoc 这样的方案可以根据它自动生成文档。更多资料&#62;&#62; google 我常用标签: @author, @copyright, @example, @desc, @filesource, @see, @version, @param, @return [...]]]></description>
			<content:encoded><![CDATA[<p>注释程序不仅是coder的个人习惯, 更是责任的体现. </p>
<p>那么首先抛出一个实用技巧, <strong>快速无痛注释PHP代码段</strong>: 使用/* */注释大段程序, 一旦代码中包含/* */的话, 注释会出错, 所以换个思路使用 if(0){ &#8230;  } 更好, ^_^  历害吧, 这个可是调试时的不败利器哦 </p>
<p>严格意义上, PHP 有四种注释. 单行注释 # 与 // ,  单行注释在PHP解释时,不予编译, 所以一般用于纪录一写不太重要的注释。多行注释 /* */, C语言风格, 多行注释将和程序一起编译, 所以会增大内存的占用。</p>
<p><span id="more-333"></span><br />
<strong>文档注释</strong> </p>
<blockquote style="font-style:normal"><p>
  /**<br />
   * &#8230; 文档注释<br />
   * &#8230; &#8230;<br />
   */<br /> <br />
   上面的形式即是文档注释, 可以理解成多行注释的加强版。如PHPDoc 这样的方案可以根据它自动生成文档。更多资料&gt;&gt; google<br />
   我常用标签: @author, @copyright, @example, @desc, @filesource, @see, @version, @param, @return
 </p></blockquote>
<p>LD 习惯只用 // 和 文档注释. </p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/diff-remark-in-php-333.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Query Cache &#8211; MySQL邯郸学步</title>
		<link>http://mifunny.info/query-cache-in-mysql-332.html</link>
		<comments>http://mifunny.info/query-cache-in-mysql-332.html#comments</comments>
		<pubDate>Tue, 23 Mar 2010 13:23:33 +0000</pubDate>
		<dc:creator>LD</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[MySQL优化]]></category>
		<category><![CDATA[QC]]></category>
		<category><![CDATA[Query Cache]]></category>

		<guid isPermaLink="false">http://mifunny.info/?p=332</guid>
		<description><![CDATA[在MySQL中有一个Query Cache, 作为类CMS这样的内容导向应用很有用. 开启也很方便, 在 my.conf 中加入 query_cache_type 和 query_cache_size 参数. query_cache_type 0 代表不使用缓冲; 1 代表使用缓冲; 2 代表根据需要使用. 开启QC后,对于频繁更新的表, 使用 SQL_NO_CACHE 屏蔽cache, 如: SELECT SQL_NO_CACHE * FROM test.test001 WHERE &#8230;. ; 如果QC类型为2, 在需要cache时, 使用 SQL_CACHE 打开缓存, 如: SELECT SQL_CACHE * FROM test.test001 WHERE &#8230; ; 网上摘录了一段说明: 1. 何时cache a) mysql query cache内容为 select 的结果集, cache [...]]]></description>
			<content:encoded><![CDATA[<p>在MySQL中有一个Query Cache, 作为类CMS这样的内容导向应用很有用. 开启也很方便, 在 my.conf 中加入 query_cache_type 和 query_cache_size 参数.</p>
<p>query_cache_type 0 代表不使用缓冲; 1 代表使用缓冲; 2 代表根据需要使用.</p>
<p>开启QC后,对于频繁更新的表, 使用 SQL_NO_CACHE 屏蔽cache, 如: SELECT SQL_NO_CACHE * FROM test.test001 WHERE &#8230;. ;</p>
<p>如果QC类型为2, 在需要cache时, 使用 SQL_CACHE 打开缓存, 如: SELECT SQL_CACHE * FROM test.test001 WHERE &#8230; ;</p>
<p><span id="more-332"></span>网上摘录了一段说明:<br /> <br />
<strong>1. 何时cache</strong> </p>
<p>a) mysql query cache内容为 select 的结果集, cache 使用完整的 sql 字符串做 key, 并区分大小写，空格等。即两个sql必须完全一致才会导致cache命中。<br /> <br />
    b) prepared statement永远不会cache到结果，即使参数完全一样。据说在 5.1 之后会得到改善。<br /> <br />
    c) where条件中如包含了某些函数永远不会被cache, 比如current_date, now等。<br /> <br />
    d) date 之类的函数如果返回是以小时或天级别的，最好先算出来再传进去。<br />
select * from foo where date1=current_date &#8212; 不会被 cache<br />
select * from foo where date1=&#8217;2008-12-30&#8242; &#8212; 被cache, 正确的做法<br /> <br />
e) 太大的result set不会被cache (&lt; query_cache_limit)</p>
<p><strong>2. 何时invalidate</strong> </p>
<p>a) 一旦表数据进行任何一行的修改，基于该表相关cache立即全部失效。<br /> <br />
b) 为什么不做聪明一点判断修改的是否cache的内容？因为分析cache内容太复杂，服务器需要追求最大的性能。</p>
<p><strong>3. 性能</strong> </p>
<p>a) cache 未必所有场合总是会改善性能<br />
当有大量的查询和大量的修改时，cache机制可能会造成性能下降。因为每次修改会导致系统去做cache失效操作，造成不小开销。<br />
另外系统cache的访问由一个单一的全局锁来控制，这时候大量&gt;的查询将被阻塞，直至锁释放。所以不要简单认为设置cache必定会带来性能提升。<br />b) 大result set不会被cache的开销<br />
太大的result set不会被cache, 但mysql预先不知道result set的长度，所以只能等到reset set在cache添加到临界值 query_cache_limit 之后才会简单的把这个cache 丢弃。这并不是一个高效的操作。如果mysql status中Qcache_not_cached太大的话, 则可对潜在的大结果集的sql显式添加 SQL_NO_CACHE 的控制。<br />
query_cache_min_res_unit = (query_cache_size – Qcache_free_memory) / Qcache_queries_in_cache</p>
<p><strong>4. 内存池使用</strong> </p>
<p>mysql query cache 使用内存池技术，自己管理内存释放和分配，而不是通过操作系统。内存池使用的基本单位是变长的block, 一个result set的cache通过链表把这些block串起来。因为存放result set的时候并不知道这个resultset最终有多大。block最短长度为 query_cache_min_res_unit, resultset 的最后一个block会执行trim操作。
</p>
<p>还有一个比较全的: <a rel="external" href="http://www.surfchen.org/wiki/MySQL优化#Query_Cache">http://www.surfchen.org/wiki/MySQL优化#Query_Cache</a><br /><a rel="external" href="http://www.freelamp.com/1103001969/index_html"> MySQL Query Cache 效率的计算</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://mifunny.info/query-cache-in-mysql-332.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
