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

<channel>
	<title>某人的栖息地</title>
	<atom:link href="http://www.ooso.net/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ooso.net</link>
	<description>Linux + Apache + Mysql + Php + Flash</description>
	<lastBuildDate>Fri, 03 Jul 2009 02:33:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>启用memcached压缩注意事项</title>
		<link>http://www.ooso.net/archives/475</link>
		<comments>http://www.ooso.net/archives/475#comments</comments>
		<pubDate>Wed, 13 May 2009 23:56:05 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[memcache]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=475</guid>
		<description><![CDATA[在php开发中，开启memcache的数据压缩存储是一件很简单的事情。在多数情况下，压缩数据不仅不会降低程序的执行效率，反倒会因为网络传输的开销降低，带来速度提升。看看最常用的Memcache::set方法:
bool Memcache::set  ( string $key  , mixed $var  [, int $flag  [, int $expire  ]] )
在这个方法中，将$flag设置为MEMCACHE_COMPRESSED即可启用memcache压缩存储。
这样做有什么弊端？

				<span class="readmore"><a href="http://www.ooso.net/archives/475" title="启用memcached压缩注意事项">阅读全文（1179字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>在php开发中，开启<a href="/?tag=memcache">memcache</a>的数据压缩存储是一件很简单的事情。在多数情况下，压缩数据不仅不会降低程序的执行效率，反倒会因为网络传输的开销降低，带来速度提升。看看最常用的Memcache::set方法:<br />
<code>bool Memcache::set  ( string $key  , mixed $var  [, int $flag  [, int $expire  ]] )</code></p>
<p>在这个方法中，将$flag设置为MEMCACHE_COMPRESSED即可启用memcache压缩存储。</p>
<h3>这样做有什么弊端？</h3>
<p>如果没有做额外判断，每一次写入memcache都会启用压缩，不管数据的大小。对应的，每次获得数据都需要做一次解压缩的操作，这是典型的一刀切手法。实际上在数据很小的情况下，不需要压缩，在这个基础上压缩省不了多少空间。</p>
<h3>更好的压缩策略？</h3>
<p>好了，我的想法是在数据超过一定大小（比如2k）的情况下，才开启压缩。这个好办，捋起袖子就干，在调用Memcache::set方法之前，首先判断一下数据的大小，一个strlen就搞定了，再简单不过了。</p>
<div class="igBar"><span id="lphp-4"><a href="#" onclick="javascript:showCodeTxt('php-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-4">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$memcache</span> = <span style="color:#000000; font-weight:bold;">new</span> Memcache;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$memcache</span>-&gt;<span style="color:#006600;">connect</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'localhost'</span>, <span style="color:#CC66CC;color:#800000;">11211</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$flag</span> = <span style="color:#000066;">strlen</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span>&gt; <span style="color:#CC66CC;color:#800000;">2048</span> ? MEMCACHE_COMPRESSED : <span style="color:#CC66CC;color:#800000;">0</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$memcache</span>-&gt;<span style="color:#006600;">set</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'mykey'</span>, <span style="color:#0000FF;">$data</span>, <span style="color:#0000FF;">$flag</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>有人可能会问了，array和object怎么办，这玩意可不能用strlen判断长度。</p>
<p>这还真能难住我一阵子，要知道把array/object写入memcache的时候，php会自动做serialize，再把它当作字符串插入memcache。</p>
<div class="igBar"><span id="lphp-5"><a href="#" onclick="javascript:showCodeTxt('php-5'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-5">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$flag</span> = <span style="color:#000066;">strlen</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000066;">serialize</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$data</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>&gt; <span style="color:#CC66CC;color:#800000;">2048</span> ? MEMCACHE_COMPRESSED : <span style="color:#CC66CC;color:#800000;">0</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>谁会采用这段代码？看起来非常山寨，而且serialize也不快，赔本买卖。</p>
<h3>更好的办法！</h3>
<p>上面的文字都是废话，直接看这段就好。<a href="http://cn2.php.net/manual/en/function.memcache-setcompressthreshold.php">Memcache::setCompressThreshold方法</a>可以包办之前所有的逻辑。</p>
<blockquote><p>Memcache::setCompressThreshold — Enable automatic compression of large values</p></blockquote>
<p><code>bool Memcache::setCompressThreshold  ( int $threshold  [, float $min_savings  ] )</code></p>
<p>举个例子，下面这段会自动启用压缩策略，当数据大于2k时，以0.2的压缩比进行zlib。</p>
<div class="igBar"><span id="lphp-6"><a href="#" onclick="javascript:showCodeTxt('php-6'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-6">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$memcache</span>-&gt;<span style="color:#006600;">setCompressThreshold</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC66CC;color:#800000;">2000</span>, <span style="color:#CC66CC;color:#800000;">0</span>.<span style="color:#CC66CC;color:#800000;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>根据我的测试结果，<strong>setCompressThreshold方法会忽略Memcache::set的flag参数</strong>。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/475/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Git-svn on cygwin</title>
		<link>http://www.ooso.net/archives/520</link>
		<comments>http://www.ooso.net/archives/520#comments</comments>
		<pubDate>Thu, 09 Apr 2009 22:55:21 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[COMMON]]></category>
		<category><![CDATA[cygwin]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=520</guid>
		<description><![CDATA[开始试用最近比较红的git，我看中的是它的本地版本库功能，即便网络比较烂的时候，也可以在本地提交，等到了合适的时候一并传上去。由于以前的代码版本控制使用的是svn，所以我用git-svn过渡一下。
目前在windows下，最好的git客户端恐怕就是装一个cygwin。鼓捣了一个时辰，整理好一些可用的配置文件，陈列一下以备下次使用：
~/.bash_profile
偶尔还会使用svn验证一下check in的情况，刚转过来不放心啊，下面的配置是为了防止svn命令行乱码。命令行git-svn在/usr/sbin/git-core/路径下，是一个perl脚本，为了方便，我把这个路径加入了PATH环境变量。

				<span class="readmore"><a href="http://www.ooso.net/archives/520" title="Git-svn on cygwin">阅读全文（870字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>开始试用最近比较红的<a href="/?tag=git">git</a>，我看中的是它的本地版本库功能，即便网络比较烂的时候，也可以在本地提交，等到了合适的时候一并传上去。由于以前的代码版本控制使用的是svn，所以我用git-svn过渡一下。</p>
<p>目前在windows下，最好的git客户端恐怕就是装一个cygwin。鼓捣了一个时辰，整理好一些可用的配置文件，陈列一下以备下次使用：</p>
<h2>~/.bash_profile</h2>
<p>偶尔还会使用svn验证一下check in的情况，刚转过来不放心啊，下面的配置是为了防止svn命令行乱码。命令行git-svn在/usr/sbin/git-core/路径下，是一个perl脚本，为了方便，我把这个路径加入了PATH环境变量。</p>
<div class="igBar"><span id="lcode-10"><a href="#" onclick="javascript:showCodeTxt('code-10'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-10">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">export PATH=$PATH:/usr/sbin/git-core/</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">export SVN_EDITOR=vim</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">export LC_ALL=en_US.<span style="">UTF</span>-<span style="color:#800000;color:#800000;">16</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">export LC_CTYPE=en_US.<span style="">UTF</span>-<span style="color:#800000;color:#800000;">16</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">export LANG=en_US.<span style="">UTF</span>-<span style="color:#800000;color:#800000;">16</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">export XMODIFIERS=@im=Chinput3</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">stty cs8 -istrip</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">stty pass8</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">export LESSCHARSET=latin1 </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2>~/.inputrc</h2>
<p>去掉注释即可</p>
<div class="igBar"><span id="lcode-11"><a href="#" onclick="javascript:showCodeTxt('code-11'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-11">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set meta-flag on</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set convert-meta off</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set input-meta on</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set output-meta on </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2>~/.gitconfig</h2>
<div class="igBar"><span id="lcode-12"><a href="#" onclick="javascript:showCodeTxt('code-12'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-12">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>user<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">name = muhaha</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">email = aa@bb.<span style="">cc</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>color<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">diff = auto</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">status = auto</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">branch = auto</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>alias<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">st = status</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">rb = svn rebase</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">ci = commit -a</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">co = checkout </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2>常用操作</h2>
<table border="1">
<tr>
<td>clone一个svn</td>
<td>git-svn clone -s svn://xxx.xxx.com</td>
</tr>
<tr>
<td>类svn up操作？</td>
<td>git-svn rebase</td>
</tr>
<tr>
<td>添加文件</td>
<td>git add xfile</td>
</tr>
<tr>
<td>check in</td>
<td>git ci</td>
</tr>
<tr>
<td>往svn库提交</td>
<td>git-svn dcommit</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/520/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>关于mysql proxy 0.7.0</title>
		<link>http://www.ooso.net/archives/501</link>
		<comments>http://www.ooso.net/archives/501#comments</comments>
		<pubDate>Sun, 05 Apr 2009 09:12:40 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[MYSQL]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=501</guid>
		<description><![CDATA[听说mysql proxy 0.7.0即将发布，正好前些日子从bzr上获取mysql proxy的代码编译过，看看当时bzr的版本号，和现在也差不了多少。在这期间，我又花了一些时间把mysql配置成读写分离，出了不少妖蛾子，由于使用的人不太多，解决问题超费劲——搜索不到有帮助的内容啊。但是我可能是比较幸运的，最后成功的实现了读写分离，目前在开发环境运行的比较稳定，所以有必要做个笔记分享一下。
读写分离脚本的问题
刚启动mysql proxy的时候，经常报错 -- "Mysql server has gone away"。我进一步缩小了可能出问题的范围(把环境简化是很重要的查错手段哦！)，比如只连接一个mysql，或者只连接本机的mysql，没有太大帮助，最后是在mysql proxy的日志文件中看到些蛛丝马迹：

				<span class="readmore"><a href="http://www.ooso.net/archives/501" title="关于mysql proxy 0.7.0">阅读全文（1334字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>听说<a href="http://jan.kneschke.de/2009/4/4/mysql-proxy-0-7-0-pre-release">mysql proxy 0.7.0即将发布</a>，正好<a href="http://www.ooso.net/archives/495">前些日子从bzr上获取mysql proxy的代码编译过</a>，看看当时bzr的版本号，和现在也差不了多少。在这期间，我又花了一些时间把mysql配置成读写分离，出了不少妖蛾子，由于使用的人不太多，解决问题超费劲——搜索不到有帮助的内容啊。但是我可能是比较幸运的，最后成功的实现了读写分离，目前在开发环境运行的比较稳定，所以有必要做个笔记分享一下。</p>
<h2>读写分离脚本的问题</h2>
<p>刚启动mysql proxy的时候，经常报错 -- "Mysql server has gone away"。我进一步缩小了可能出问题的范围(把环境简化是很重要的查错手段哦！)，比如只连接一个mysql，或者只连接本机的mysql，没有太大帮助，最后是在mysql proxy的日志文件中看到些蛛丝马迹：</p>
<blockquote><p>
(critical) proxy-plugin.c:1367: (connect_server) [string "/usr/local/share/mysql-proxy/r..."]:69: .address is deprecated. Use .src.name or .dst.name instead<br />
(critical) (read_query) [string "/usr/local/share/mysql-proxy/r..."]:179: .address is deprecated. Use .src.name or .dst.name instead<br />
(critical) proxy-plugin.c.1115: I have no server backend, closing connection
</p></blockquote>
<p>在<a href="http://forums.mysql.com/list.php?146">mysql proxy的论坛</a>上看到有人碰到类似的问题，很简单，读写分离的lua脚本还是旧的，0.6.1时代的产物了，更糟糕的是，即便是即将发布的0.7.0，rw-splitting.lua也是旧版本的。lua脚本中的<b>.address</b>需要替换成<b>.src.name</b>或者<b>.dst.name</b>。</p>
<p><b>解决办法</b> —— 下载<a href="http://bazaar.launchpad.net/%7Ediego-fmpwizard/mysql-proxy/bug-43424/download/head%3A/rwsplitting.lua-20090112150705-l9v35osiopsn0nz0-10/rw-splitting.lua">更新之后的rw-splitting.lua</a>，情况会好转。</p>
<h2>使用prepare方法无法获得结果</h2>
<p>我在测试代码中采用php的pdo_mysql，单独连接mysql是毫无问题的，然而配合mysql proxy使用则是屡屡受挫，查询经常没有结果返回，比较随机，从日志中也找不到有帮助的内容。这次没有找到解决办法，所以我绕了过去，在连接mysql的时候使用伪prepare的方式：</p>
<div class="igBar"><span id="lphp-14"><a href="#" onclick="javascript:showCodeTxt('php-14'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-14">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$option</span> = <span style="color:#000066;">array</span><span style="color:#006600; font-weight:bold;">&#40;</span>PDO::<span style="color:#006600;">ATTR_EMULATE_PREPARES</span> =&gt; <span style="color:#CC66CC;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>据称emulate方式的性能比prepare要好，所以这也算安慰奖了。</p>
<h2>专门的lua脚本分支</h2>
<p>lua脚本开发滞后，是一个比较严重的问题，所以在邮件组上看到有个新的lua脚本分支出来 —— <a href="https://launchpad.net/mysql-proxy-lua-scripts">https://launchpad.net/mysql-proxy-lua-scripts</a>。希望开发速度能跟上来。</p>
<h2>keepalive参数</h2>
<p>mysql proxy还不算太稳定，偶尔crash我也不觉得惊讶，所以新增的keepalive参数很有用。在proxy启动的时候，加上--keepalive参数，它便会努力保持proxy的运行状态，停止了也会自动重启。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/501/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>apache的RewriteMap使用心得</title>
		<link>http://www.ooso.net/archives/493</link>
		<comments>http://www.ooso.net/archives/493#comments</comments>
		<pubDate>Thu, 02 Apr 2009 13:57:47 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[apache]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=493</guid>
		<description><![CDATA[在apache的环境下，rewrite还真是生活之友啊，时不时就得用上。前些日子有个需求，要将url重新转一转。
什么情况？
原来的url
http://www.xxx.com/demo/oldpage.php?param1=1&#038;param2=2

				<span class="readmore"><a href="http://www.ooso.net/archives/493" title="apache的RewriteMap使用心得">阅读全文（1250字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>在apache的环境下，rewrite还真是生活之友啊，时不时就得用上。前些日子有个需求，要将url重新转一转。</p>
<h2>什么情况？</h2>
<p>原来的url<br />
http://www.xxx.com<b>/demo/oldpage.php?param1=1&#038;param2=2</b></p>
<p>转换后的url<br />
http://www.xxx.com/newpage.php?url=<b>%2Fdemo%2Fmypage.php%3Fparam1%3D1&#038;param2%3D2</b></p>
<p>需要把粗体部分的url进行urlencode，能看出上面的字符"?&#038;="都分别转义过，作为参数发给另外一个url。那么这时候请出rewrite还真是最合适不过了。</p>
<h2>坎坷的Rewrite经历</h2>
<p>查查rewrite手册，俺这才知道，转义这活，非得派出<a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#mapfunc">RewriteMap的map function</a>才能做的比较漂亮。现在只有四个内部map function可供差遣： </p>
<ul>
<li>toupper: Converts the key to all upper case.</li>
<li>tolower: Converts the key to all lower case.</li>
<li>escape: Translates special characters in the key to hex-encodings.</li>
<li>unescape: Translates hex-encodings in the key back to special characters.</li>
</ul>
<p>那么很快就有了第一个rewrite出现：<br />
<code><br />
RewriteMap escape int:escape<br />
RewriteRule ^/([^/]*)$ /newpage.php?mi_url_suffix=${escape:$1?%{QUERY_STRING}} [L,PT]<br />
</code></p>
<p>注：这里的int不是intger的意思，它是internal的缩写，表示调用内部函数。</p>
<p>看上去非常简单，跑起来貌似也正....常？且慢，俺打开RewriteLog一瞅，形式不容乐观啊，"&#038;"字符通通没有转义。看来是失败了，爬到狗狗上翻了一下，貌似escape对"?="之类的特殊字符是不做转义的，晕。</p>
<h2>RewriteMap到底</h2>
<p>接着细看apache的rewrite手册，发现RewriteMap还支持自定义脚本，那么还得使出俺的看家绝技——php了。首先弄一个能转义的php，必须非常简单，复杂了apache容易挂掉，写出来发现想复杂都挺难啊：</p>
<p>/usr/local/bin/escape.php</p>
<div class="igBar"><span id="lphp-16"><a href="#" onclick="javascript:showCodeTxt('php-16'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-16">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000; font-style:italic;">#!/usr/bin/php -f</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">while</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$in</span> = <span style="color:#000066;">trim</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#000066;">fgets</span><span style="color:#006600; font-weight:bold;">&#40;</span>STDIN<span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#000066;">fputs</span><span style="color:#006600; font-weight:bold;">&#40;</span>STDOUT, <span style="color:#000066;">urlencode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$in</span><span style="color:#006600; font-weight:bold;">&#41;</span> . <span style="color:#FF0000;">"<span style="color:#000099; font-weight:bold;">\r</span><span style="color:#000099; font-weight:bold;">\n</span>"</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">?&gt;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>在这个脚本里可别使用php:://stdin之类的，具体原因查<a href="/category/php">php</a>手册。相应的，rewrite规则如下：<br />
<code><br />
RewriteMap escape prg:/usr/local/bin/escape.php<br />
RewriteRule ^/([^/]*)$ /newpage.php?mi_url_suffix=${escape:$1?%{QUERY_STRING}} [L,PT]<br />
</code></p>
<p>rewrite规则没有太大的改变，prg表示使用自定义脚本。现在这个版本总算正常运作了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/493/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>wordpress plugin &#8220;search engine related posts&#8221; 1.2发布</title>
		<link>http://www.ooso.net/archives/516</link>
		<comments>http://www.ooso.net/archives/516#comments</comments>
		<pubDate>Sun, 29 Mar 2009 02:19:45 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[GOOGLE]]></category>
		<category><![CDATA[WORDPRESS]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=516</guid>
		<description><![CDATA[去年写了个wordpress插件"search engine related posts"，不知不觉也有将近一年没有更新过了。这个插件的作用：当用户从google搜索到你的博客上，自动显示站内搜索相关的主题。这里没有用到数据库来做相关的搜索工作，而是利用google公开的一些api进行查询，因此对个人博客来说，不会增加服务器负载，完全只是一段js代码而已。
本次1.2相对第一个版本的改动

将javascript提取出来放到单独的js文件里，这是为了减小每个url的大小，浏览器也会对外部js进行缓存，有效的减少带宽输出

				<span class="readmore"><a href="http://www.ooso.net/archives/516" title="wordpress plugin &#8220;search engine related posts&#8221; 1.2发布">阅读全文（479字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>去年写了个wordpress插件"<a href="http://www.ooso.net/archives/392">search engine related posts</a>"，不知不觉也有将近一年没有更新过了。这个插件的作用：当用户从google搜索到你的博客上，自动显示站内搜索相关的主题。这里没有用到数据库来做相关的搜索工作，而是利用google公开的一些api进行查询，因此对个人博客来说，不会增加服务器负载，完全只是一段js代码而已。</p>
<h2>本次1.2相对第一个版本的改动</h2>
<ul>
<li>将javascript提取出来放到单独的js文件里，这是为了减小每个url的大小，浏览器也会对外部js进行缓存，有效的减少带宽输出</li>
<li>js文件已经用<a href="http://developer.yahoo.com/yui/compressor/">yui compressor</a>压缩过，只有900多个字节</li>
<li>支持多语种搜索，修改文件中的$related_posts_lang变量即可，中文用户需要将这个值修改为zh-CN(默认是en-US)</li>
<li>可以去除网页标题中的站名以及部分连接字符，让标题更简短且有意义</li>
</ul>
<h2>下载search engine related posts 1.2</h2>
<p><a href="http://wordpress.org/extend/plugins/search-engine-related-posts/">http://wordpress.org/extend/plugins/search-engine-related-posts/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/516/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>starling试用手记</title>
		<link>http://www.ooso.net/archives/506</link>
		<comments>http://www.ooso.net/archives/506#comments</comments>
		<pubDate>Sat, 21 Mar 2009 10:48:53 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[memcache]]></category>
		<category><![CDATA[queue]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=506</guid>
		<description><![CDATA[twitter最近将ruby实现的消息队列服务器starling开源了，这是一个支持memcache协议的轻量级持久化服务器，因此使用php/perl/ruby/java等多种客户端都没问题，可以将较慢的处理逻辑通过消息队列放在后台处理，同时也支持多点分布式处理。周末找了个闲置的centos 5机器搭了一套starling试用，配合php的memcache扩展测试一番，有点意思。
starling安装步骤
centos默认不带ruby，得重新装，以下安装步骤都是以root身份跑的。


				<span class="readmore"><a href="http://www.ooso.net/archives/506" title="starling试用手记">阅读全文（745字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>twitter最近将ruby实现的<a href="http://github.com/starling/starling/tree/master">消息队列服务器starling</a>开源了，这是一个支持<a href="/?tag=memcache">memcache</a>协议的轻量级持久化服务器，因此使用php/perl/ruby/java等多种客户端都没问题，可以将较慢的处理逻辑通过消息队列放在后台处理，同时也支持多点分布式处理。周末找了个闲置的centos 5机器搭了一套starling试用，配合<a href="/?tag=php">php</a>的memcache扩展测试一番，有点意思。</p>
<h2>starling安装步骤</h2>
<p>centos默认不带ruby，得重新装，以下安装步骤都是以root身份跑的。<br />
<code><br />
yum install ruby ruby-devel rubygems<br />
gem install memcache-client starling<br />
</code></p>
<p>如果你使用yum找不到ruby的相关包，请记得<a href="http://www.ooso.net/archives/495">添加epel repository</a>。安装之后新增的程序：</p>
<ul>
<li>/usr/bin/starling   	#一个ruby脚本，starling的服务程序</li>
<li>/usr/bin/starling_top 	#starling的状态检查程序，可以查看starling的运行状态，类似memcache的状态显示，不同的是能够显示每个key的状态</li>
</ul>
<p>starling启动后默认会在22122端口蹲点守候。</p>
<p>为了使用方便，我修改了一个starling在centos下的启动脚本，放在/etc/init.d/starling，下载地址：<a href="http://customcode.googlecode.com/files/starling">http://customcode.googlecode.com/files/starling</a>。使用方法：<br />
<code>/etc/init.d/starling start|stop|restart</code></p>
<h2>测试程序</h2>
<p>以下是在测试中用的php脚本，说实话php在循环比较大的时候没啥优势，但是关键是简单，几行就搞定了。</p>
<p><strong>写入的测试程序</strong></p>
<div class="igBar"><span id="lcode-19"><a href="#" onclick="javascript:showCodeTxt('code-19'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-19">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#!/usr/bin/php</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;?php</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$m = new Memcache;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$m-&gt;<span style="">addServer</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'127.0.0.1'</span>, <span style="color:#CC0000;">'22122'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$start = microtime<span style="color:#006600; font-weight:bold;">&#40;</span>true<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">for<span style="color:#006600; font-weight:bold;">&#40;</span>$i = <span style="color:#800000;color:#800000;">0</span>; $i &lt;<span style="color:#800000;color:#800000;">10000</span>; ++$i<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">//echo $i, &quot;\n&quot;;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $m-&gt;<span style="">set</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'testtesttesttest'</span>, <span style="color:#CC0000;">'中文测试中文测试中文测试中文测试中文测试中文测试中中文测试中中文中a'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"time:"</span> . <span style="color:#006600; font-weight:bold;">&#40;</span>microtime<span style="color:#006600; font-weight:bold;">&#40;</span>true<span style="color:#006600; font-weight:bold;">&#41;</span> - $start<span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#CC0000;">"<span style="color:#000099; font-weight:bold;">\n</span>"</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p><strong>读出来的测试程序</strong></p>
<div class="igBar"><span id="lcode-20"><a href="#" onclick="javascript:showCodeTxt('code-20'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-20">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#!/usr/bin/php</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;?php</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$m = new Memcache;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$m-&gt;<span style="">addServer</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'127.0.0.1'</span>, <span style="color:#CC0000;">'22122'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">while<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; echo $m-&gt;<span style="">get</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'test'</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <span style="color:#CC0000;">"<span style="color:#000099; font-weight:bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; usleep<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">100</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// 休息一下，否则容易cpu 100%</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2>性能测试</h2>
<p>测试条件:</p>
<ul>
<li>key的长度16B</li>
<li>value的长度100B,</li>
<li>8个并发写入进程</li>
<li>每个进程插入10,000条记录</li>
</ul>
<p>平均每个进程花了7秒完成写入操作，那么照这样计算：</p>
<p><strong>10000 * 8 / 7 = 每秒写入11428次</strong></p>
<p>以上测试进行的比较随意，而且我懒得插入大量数据来测试了，这个比较花时间，所以测试结果仅供参考。由于starling是目前twitter在生产环境中运行的，经过实践检验过，稳定性应该不成问题。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/506/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>在centos 5.2下安装最新的mysql proxy</title>
		<link>http://www.ooso.net/archives/495</link>
		<comments>http://www.ooso.net/archives/495#comments</comments>
		<pubDate>Sat, 14 Mar 2009 14:09:16 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[MYSQL]]></category>
		<category><![CDATA[centos]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=495</guid>
		<description><![CDATA[mysql proxy的代码树已经迁移到lauchpad，采用bazaar进行版本管理。参考了一些文档，在centos 5.2下编译安装最新mysql proxy成功。步骤记录如下（在centos 5下应该也适用）：
首先让EPEL (Extra Packages for Enterprise Linux) repository 生效
 # rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rpm 

				<span class="readmore"><a href="http://www.ooso.net/archives/495" title="在centos 5.2下安装最新的mysql proxy">阅读全文（1677字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>mysql proxy的代码树已经迁移到lauchpad，采用bazaar进行版本管理。参考了一些文档，在centos 5.2下编译安装最新<a href="/?tag=mysql">mysql</a> proxy成功。步骤记录如下（在centos 5下应该也适用）：</p>
<p>首先让EPEL (Extra Packages for Enterprise Linux) repository 生效<br />
<code> # rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rpm </code></p>
<p>确定这些包已经安装：GNU Autotools, flex, pkg-config, bazaar, MySQL client libraries<br />
<code> # yum install autoconf automake libtool flex pkgconfig bzr mysql-devel </code></p>
<p>centos下自带的libevent版本超老，这个没有别的办法，只能自己重新编译，版本需要在1.4.0以上，越高越好<br />
<code><br />
$ wget http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz<br />
$ tar zvfx libevent-1.4.9-stable.tar.gz<br />
$ cd libevent-1.4.9-stable<br />
$ ./configure<br />
$ make<br />
# make install<br />
</code></p>
<p>centos自带的glib版本也比较老，mysql proxy 0.7.0以上需要glib2 2.16.0以上才能编译成功，因此不得不重新编译glib<br />
<code><br />
$ wget http://ftp.gnome.org/pub/gnome/sources/glib/2.18/glib-2.18.4.tar.gz<br />
$ tar zvfx glib-2.18.4.tar.gz<br />
$ cd glib-2.18.4<br />
$ ./configure<br />
$ make<br />
# make install<br />
</code></p>
<p>编译安装lua 5.1<br />
<code><br />
$ wget http://www.lua.org/ftp/lua-5.1.4.tar.gz<br />
$ tar zvfx lua-5.1.4.tar.gz<br />
$ cd lua-5.1.4<br />
$ vi src/Makefile<br />
</code><br />
在CFLAGS里加上-fPIC，因为我在64位机上编译出现了“relocations”错误</p>
<p><code><br />
$ make linux<br />
# make install<br />
# cp etc/lua.pc /usr/local/lib/pkgconfig/<br />
</code></p>
<p><strong>重要：让pkg-config找到自己编译的库在哪里 </strong><br />
<code><br />
$ export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig<br />
</code></p>
<p>最后，从bazaar中检出最新的mysql-proxy源文件进行编译：<br />
<code><br />
$ bzr branch lp:mysql-proxy<br />
$ cd mysql-proxy<br />
$ ./autogen.sh<br />
$ ./configure<br />
$ make<br />
# make install<br />
</code></p>
<p>编译完成，可以检查一下最终结果：<br />
<code><br />
# mysql-proxy -V<br />
</code></p>
<p><code><br />
mysql-proxy 0.7.0<br />
  glib2: 2.18.4<br />
  libevent: 1.4.9-stable<br />
  admin: 0.7.0<br />
  proxy: 0.7.0<br />
</code></p>
<p>配置启动脚本，在系统启动时运行mysql-proxy<br />
<code><br />
cd /etc/init.d<br />
wget http://customcode.googlecode.com/files/mysql-proxy<br />
chmod 0755 /etc/init.d/mysql-proxy<br />
chkconfig mysql-proxy on<br />
</code></p>
<p>增加运行参数<br />
<code><br />
cat >/etc/sysconfig/mysql-proxy<br />
</code></p>
<p><code><br />
# Options to mysql-proxy<br />
# do not remove --daemon<br />
PROXY_OPTIONS="--daemon"<br />
</code></p>
<p>CTRL+D保存，然后就可以使用以下命令启动|停止mysql-proxy<br />
<code><br />
/etc/init.d/mysql-proxy start|stop<br />
</code></p>
<p>参考文档：<br />
<a href="http://blog.zhuzhaoyuan.com/2009/02/how-to-compile-and-install-mysql-proxy-from-bazaar-on-centos-52/">How to Compile and Install MySQL Proxy from Bazaar on CentOS 5.2</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/495/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>131个字符的php framework</title>
		<link>http://www.ooso.net/archives/415</link>
		<comments>http://www.ooso.net/archives/415#comments</comments>
		<pubDate>Tue, 10 Mar 2009 06:40:03 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[framework]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=415</guid>
		<description><![CDATA[在friendfeed上看到这个链接 —— The 140 Characters Webapp Challenge!，这个比赛要求用140个字符的代码造就一个web应用。
里头有36个程序可供投票，基本上全是脚本语言大杂烩：php,perl,ruby,javascript。实现的应用也是五花八门，有相册，类twitter，小游戏，甚至还有php代码框架？摘录如下：
PLAIN TEXT
CODE:

				<span class="readmore"><a href="http://www.ooso.net/archives/415" title="131个字符的php framework">阅读全文（632字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>在<a href="https://friendfeed.com">friendfeed</a>上看到这个链接 —— <a href="http://f055.net/article/final-wrap-up-of-the-140-characters-webapp-challenge/">The 140 Characters Webapp Challenge!</a>，这个比赛要求用140个字符的代码造就一个web应用。</p>
<p>里头有36个程序可供投票，基本上全是脚本语言大杂烩：php,perl,ruby,javascript。实现的应用也是五花八门，有相册，类twitter，小游戏，甚至还有php代码框架？摘录如下：</p>
<div class="igBar"><span id="lcode-23"><a href="#" onclick="javascript:showCodeTxt('code-23'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-23">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">require __DIR__.<span style="color:#CC0000;">'/c.php'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#40;</span>!is_callable<span style="color:#006600; font-weight:bold;">&#40;</span>$c = @$_GET<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'c'</span><span style="color:#006600; font-weight:bold;">&#93;</span> ?: function<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> echo <span style="color:#CC0000;">'Woah!'</span>; <span style="color:#006600; font-weight:bold;">&#125;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; throw new Exception<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'Error'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$c<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>这段代码利用了php5.3的一些新特性：</p>
<ul>
<li>__DIR__</li>
<li>Anonymous functions</li>
<li>?:运算符</li>
</ul>
<p>代码只有131个字符，由于代码极为简陋，安全性也是没得保障的，只能算一个程序的统一入口罢了。</p>
<p>如果用php 5.2来写这段代码，大概就是：</p>
<div class="igBar"><span id="lcode-24"><a href="#" onclick="javascript:showCodeTxt('code-24'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-24">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">require dirname<span style="color:#006600; font-weight:bold;">&#40;</span>__FILE__<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#CC0000;">'/c.php'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">if <span style="color:#006600; font-weight:bold;">&#40;</span>!is_callable<span style="color:#006600; font-weight:bold;">&#40;</span>$c = @$_GET<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'c'</span><span style="color:#006600; font-weight:bold;">&#93;</span> ? $_GET<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#CC0000;">'c'</span><span style="color:#006600; font-weight:bold;">&#93;</span> : create_function<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">''</span>, <span style="color:#CC0000;">"echo 'Woah!';"</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; throw new Exception<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'Error'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$c<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>如果要让这段代码变得实用点，可以在$c前面加上一个前缀，这样安全性会有进一步提升，代码也会相应的增加若干字节。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/415/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>解决memcache连接奇慢问题一例</title>
		<link>http://www.ooso.net/archives/479</link>
		<comments>http://www.ooso.net/archives/479#comments</comments>
		<pubDate>Sat, 07 Mar 2009 03:19:44 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[memcache]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=479</guid>
		<description><![CDATA[最近用xdebug观察线上程序的运行时间统计，发现往日里跑起来像飞的memcache居然是系统中拖后腿的耗时大户，连接时间特长。
运行环境

webserver是apache + php

				<span class="readmore"><a href="http://www.ooso.net/archives/479" title="解决memcache连接奇慢问题一例">阅读全文（788字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>最近用xdebug观察线上程序的运行时间统计，发现往日里跑起来像飞的<a href="/?tag=memcache">memcache</a>居然是系统中拖后腿的耗时大户，连接时间特长。</p>
<h2>运行环境</h2>
<ul>
<li>webserver是apache + php</li>
<li>php memcache extension版本是3.0.2，当时是最新的beta版...</li>
<li>有4个memcache server可供使用</li>
<li>代码中会利用php的Memcache::addServer依次连接四个memcache，长连接方式</li>
</ul>
<h2>现象</h2>
<p>完成四次addServer一共需要300ms以上，但是一旦连接上，获取单个item飞快，时间在3ms以下。<br />
更可恶的问题在于，虽然执行了四次Memcache::addServer，但是实际使用的始终是最后一个memcache，这实在让人崩溃。</p>
<h2>问题解决</h2>
<p>使用了一点搜索技巧，在pecl.php.net上找到了类似的bug: <a href="http://pecl.php.net/bugs/bug.php?id=13483">First get slow when using multiple memcached servers</a></p>
<p>这个bug的描述如下：</p>
<blockquote><p>
We are monitoring memcached performance and noticed that when we added a second memcached via Memcache::addServer the first get request is always slower than the subsequent ones although we are using persitent memcached connections. Switching from crc32 to fnv hashing didn't help either. Is that delay explainable
</p></blockquote>
<p>看起来是最新的memcache extension有一些问题，尝试将这个扩展降级成最新的稳定版2.2.6，然后重启apache看看，memcache连接过慢的问题果然已经解决。</p>
<h2>结论</h2>
<p>吃螃蟹果然是要付出代价的。。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/479/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Friendfeed secure pro for greasemonkey</title>
		<link>http://www.ooso.net/archives/478</link>
		<comments>http://www.ooso.net/archives/478#comments</comments>
		<pubDate>Fri, 06 Feb 2009 08:21:56 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[FIREFOX]]></category>
		<category><![CDATA[friendfeed]]></category>
		<category><![CDATA[greasemonkey]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=478</guid>
		<description><![CDATA[今天听说friendfeed可以支持https://访问了，考虑到目前GFW功能越来越强大，建议所有中国用户都采用这种访问形式。顺手写了一个greasemonkey脚本 —— Friendfeed secure pro，当你采用http://访问friendfeed,那么会自动跳转到https://，firefox下的懒人专用。
满足下面两个条件，你就可以安装这个脚本：

你使用的是firefox

				<span class="readmore"><a href="http://www.ooso.net/archives/478" title="Friendfeed secure pro for greasemonkey">阅读全文（234字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>今天听说<a href="https://friendfeed.com">friendfeed</a>可以支持https://访问了，考虑到目前GFW功能越来越强大，建议所有中国用户都采用这种访问形式。顺手写了一个<a href="/?tag=greasemonkey">greasemonkey</a>脚本 —— <a href="http://www.ooso.net/index.php/archives/478">Friendfeed secure pro</a>，当你采用http://访问friendfeed,那么会自动跳转到https://，firefox下的懒人专用。</p>
<p>满足下面两个条件，你就可以安装这个脚本：</p>
<ul>
<li>你使用的是firefox</li>
<li>你甚至安装了greasemonkey插件</li>
</ul>
<p><a href="http://customcode.googlecode.com/files/FriendfeedSecurePro.user.js">安装Friendfeed secure pro</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/478/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>关于smarty3的一些说明</title>
		<link>http://www.ooso.net/archives/476</link>
		<comments>http://www.ooso.net/archives/476#comments</comments>
		<pubDate>Sun, 01 Feb 2009 10:10:16 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[smarty]]></category>
		<category><![CDATA[template]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=476</guid>
		<description><![CDATA[这些天看到了smarty 3 alpha冒头了，于是花时间做了个走访调查。下面的文字基本上来自其readme：
基本文件文件结构

index.php

				<span class="readmore"><a href="http://www.ooso.net/archives/476" title="关于smarty3的一些说明">阅读全文（838字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>这些天看到了<a href="http://www.smarty.net">smarty 3 alpha</a>冒头了，于是花时间做了个走访调查。下面的文字基本上来自其readme：</p>
<h2>基本文件文件结构</h2>
<pre>
index.php
/libs/
  Smarty.class.php 		#主文件
/libs/sysplugins/		#内部plugin
  internal.*
/plugins/			#外部plugin,可自由扩充
  function.mailto.php
  modifier.escape.php
/templates/			#模板，可以是纯php或传统的smarty模板
  index.tpl
  index_view.php
</pre>
<h2>一个经典的smarty调用</h2>
<div class="igBar"><span id="lphp-29"><a href="#" onclick="javascript:showCodeTxt('php-29'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-29">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'Smarty.class.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$smarty</span> = <span style="color:#000000; font-weight:bold;">new</span> Smarty;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$smarty</span>-&gt;<span style="color:#006600;">assign</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'foo'</span>,<span style="color:#FF0000;">'bar'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$smarty</span>-&gt;<span style="color:#006600;">display</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'index.tpl'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>和之前的版本似乎没什么差别</p>
<h2>SINGLETON</h2>
<p>这个有意义吗？</p>
<div class="igBar"><span id="lphp-30"><a href="#" onclick="javascript:showCodeTxt('php-30'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-30">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$smarty</span> = Smarty::<span style="color:#006600;">instance</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2>模板</h2>
<p>之前的smarty模板，相当于重新定义了一套标签语言，那么smarty3提供了一种新的模板形式，直接支持<a href="/?tag=php">php</a>语法的模板。</p>
<p>但是问题就出来了，我们还有必要用模板吗？</p>
<p>引用php类型模板的一个例子：</p>
<div class="igBar"><span id="lphp-31"><a href="#" onclick="javascript:showCodeTxt('php-31'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-31">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$smarty</span>-&gt;<span style="color:#006600;">display</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'php:mytemplate.tpl'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>模板中可以直接使用熟悉的语法： &lt;?=$foo?&gt; &lt;?=$bar?&gt;</p>
<p>使用php类型模板的话，安全问题需要自己解决。但这个对成熟的团队来说不是问题。</p>
<p>除此之外，新支持字符串类型的模板，感觉比较生猛，离模板之路也是渐行渐远：</p>
<div class="igBar"><span id="lphp-32"><a href="#" onclick="javascript:showCodeTxt('php-32'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-32">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$smarty</span>-&gt;<span style="color:#006600;">display</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'string:This is my template, {$foo}!'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2>smarty3的相关链接</h2>
<ul>
<li><a href="http://smarty-php.googlecode.com/svn/branches/Smarty3Alpha/ ">Smarty 3 Alpha with SVN</a> -- 选择googlecode提供的svn服务还是蛮省钱的</li>
<li><a href="http://groups.google.com/group/smarty-developers">smarty 3开发者邮件组</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/476/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>用gvim编辑firefox的文本框内容</title>
		<link>http://www.ooso.net/archives/432</link>
		<comments>http://www.ooso.net/archives/432#comments</comments>
		<pubDate>Mon, 05 Jan 2009 16:28:08 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[FIREFOX]]></category>
		<category><![CDATA[VIM]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=432</guid>
		<description><![CDATA[到目前为止，已经使用近两年vim，渐渐的对这玩意有一些依赖性。
平常用的是firefox浏览器，为了看上去比较酷或者在装A和装C之间徘徊，我又安装了vimperator插件，这样操作firefox就像用vim一样，干啥都得敲一些键盘命令，浏览网页的时候对鼠标不会太依赖，还可以方便的调整本本的位置比如放在腿上。
为了最大化的利用vim，我不厌其烦的在狗狗上爬来爬去，终于学到一招实用技巧——利用gvim编辑网页中的文本内容。简单的说，只要光标停留在目标网页的文本框里，就可以使用ctrl + i （&#60;C + i&#62;）快捷键biu的一下呼出gvim编辑文本。

				<span class="readmore"><a href="http://www.ooso.net/archives/432" title="用gvim编辑firefox的文本框内容">阅读全文（1043字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>到目前为止，已经使用近两年vim，渐渐的对这玩意有一些依赖性。</p>
<p>平常用的是firefox浏览器，为了看上去比较酷或者在装A和装C之间徘徊，我又安装了<a href="http://vimperator.mozdev.org">vimperator插件</a>，这样操作firefox就像用vim一样，干啥都得敲一些键盘命令，浏览网页的时候对鼠标不会太依赖，还可以方便的调整本本的位置比如放在腿上。</p>
<p>为了最大化的利用<a href="/?tag=vim">vim</a>，我不厌其烦的在狗狗上爬来爬去，终于学到一招实用技巧——利用gvim编辑网页中的文本内容。简单的说，只要光标停留在目标网页的文本框里，就可以使用ctrl + i （&lt;C + i&gt;）快捷键biu的一下呼出gvim编辑文本。</p>
<h2>设置过程笔记</h2>
<ul>
<li>安装vimperator插件</li>
<li>在firefox里输入伪vim命令 <code>:set editor=gvim -f </code></li>
<li>在系统的path环境变量中加入gvim.exe的路径，比如俺的是 <i>D:\Program Files\Vim\vim72</i>，很可能要重启电脑才能生效</li>
</ul>
<p>顺利的话就可以使用前文说到的快捷键了。</p>
<h2>优点</h2>
<ul>
<li>切换页面的时候，不会因为编辑焦点区域丢失导致保存内容失败</li>
<li>论坛中灌水的时候效率明显提升</li>
<li>写wiki或blog的时候得心应手</li>
</ul>
<h2>缺点</h2>
<ul>
<li>对vim的依赖程度会越来越高，不可自拔</li>
</ul>
<h2>本人的_vimperatorrc配置</h2>
<div class="igBar"><span id="lcode-34"><a href="#" onclick="javascript:showCodeTxt('code-34'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-34">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">autocmd LocationChange .* :js modes.<span style="">passAllKeys</span> = /mail\.<span style="">google</span>\.<span style="">com</span>/.<span style="">test</span><span style="color:#006600; font-weight:bold;">&#40;</span>buffer.<span style="">URL</span><span style="color:#006600; font-weight:bold;">&#41;</span> || /google\.<span style="">com</span>\/reader\<span style="color:#FF9933; font-style:italic;">//.test(buffer.URL) || /www\.qidian\.com/.test(buffer.URL)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set complete=sfl</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set titlestring=hello</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set wildoptions=auto</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">noremap &lt;C-V&gt; &lt;C-v&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">noremap &lt;C-Z&gt; &lt;C-z&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">noremap &lt;C-c&gt; &lt;C-v&gt;&lt;C-c&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">noremap &lt;C-a&gt; &lt;C-v&gt;&lt;C-a&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cnoremap &lt;C-c&gt; &lt;C-v&gt;&lt;C-c&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cnoremap &lt;C-v&gt; &lt;C-v&gt;&lt;C-v&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">cnoremap &lt;C-x&gt; &lt;C-v&gt;&lt;C-x&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">inoremap &lt;C-a&gt; &lt;C-v&gt;&lt;C-a&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">inoremap &lt;C-c&gt; &lt;C-v&gt;&lt;C-c&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">inoremap &lt;C-v&gt; &lt;C-v&gt;&lt;C-v&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">inoremap &lt;C-x&gt; &lt;C-v&gt;&lt;C-x&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">inoremap &lt;C-z&gt; &lt;C-v&gt;&lt;C-z&gt;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">inoremap &lt;C-y&gt; &lt;C-v&gt;&lt;C-y&gt;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set nextpattern=\s*下一页|下一张|下一篇|下一頁|下页|后页\s*,^\bnext\b,\bnext\b,\bsuivant\b,^&gt;$,^<span style="color:#006600; font-weight:bold;">&#40;</span>&gt;&gt;|››|»<span style="color:#006600; font-weight:bold;">&#41;</span>$,^<span style="color:#006600; font-weight:bold;">&#40;</span>&gt;|»<span style="color:#006600; font-weight:bold;">&#41;</span>,<span style="color:#006600; font-weight:bold;">&#40;</span>&gt;|»<span style="color:#006600; font-weight:bold;">&#41;</span>$,\bmore\b</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set previouspattern=\s*上一页|上一张|上一篇|上一頁|上页|前页\s*,^\bprev|previous\b, \bprev|previous\b,\bprécédent\b,^&lt;$,^<span style="color:#006600; font-weight:bold;">&#40;</span>&lt;&lt;|‹‹|«<span style="color:#006600; font-weight:bold;">&#41;</span>$,^<span style="color:#006600; font-weight:bold;">&#40;</span>&lt;|«<span style="color:#006600; font-weight:bold;">&#41;</span>,<span style="color:#006600; font-weight:bold;">&#40;</span>&lt;|«<span style="color:#006600; font-weight:bold;">&#41;</span>$ </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/432/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>trac使用经验两则</title>
		<link>http://www.ooso.net/archives/443</link>
		<comments>http://www.ooso.net/archives/443#comments</comments>
		<pubDate>Fri, 28 Nov 2008 10:01:36 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[COMMON]]></category>
		<category><![CDATA[trac]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=443</guid>
		<description><![CDATA[最近开始使用trac进行项目管理，和svn同步。使用过程中解决了两个并不常见的问题，贴出来和大家分享。

如何修改trac的assign to下拉列表
让trac的ticket和bugzilla有同样的状态

				<span class="readmore"><a href="http://www.ooso.net/archives/443" title="trac使用经验两则">阅读全文（1527字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>最近开始使用<a href="http://www.edgewall.org">trac</a>进行项目管理，和svn同步。使用过程中解决了两个并不常见的问题，贴出来和大家分享。</p>
<ul>
<li><a href="#droplist">如何修改trac的assign to下拉列表</a></li>
<li><a href="#bugzilla">让trac的ticket和bugzilla有同样的状态</a></li>
</ul>
<h2 id="droplist">如何修改trac的assign to下拉列表</h2>
<p>trac ticket的assign to下拉列表中的名单，没有保存在配置文件里头。读一下TracFaq有下面发现：</p>
<blockquote><p>This will change the Assign To ticket filed into a select box that only contains existing users. However as it says on the TracTickets page, the user must have logged, in at least once, and set their email address.</p>
<p>If you run multiple Trac sites, and have a set of common users across all Trac sites, it gets annoying to have to log into each one and set the email.</p>
<p>So, what is one to do? Well, there are two things that need to be entered into the database: a session record, and an email record.
</p></blockquote>
<p>所以我们只需要对trac的session表做操作就可以修改assign to的下拉菜单列表。session的表结构如下:</p>
<pre>
Table "session"
Column         | Type    | Modifiers
---------------+---------+-----------
sid            | text    | not null
authenticated  | integer | not null
last_visit     | integer |
</pre>
<h2 id="bugzilla">让trac的ticket和bugzilla有同样的状态</h2>
<p>缺省配置下，trac ticket的状态和bugzilla的bug状态不一样，只有new,fixed,invalid,wontfix,duplicate,worksforme这几种。在trac 0.11之后，可以自己定义workflow，只需要将trac.ini的[ticket-workflow]章节修改一下，就可以支持verify状态：</p>
<p><code><br />
accept = new -> assigned<br />
accept.operations = set_owner_to_self<br />
accept.permissions = TICKET_MODIFY<br />
leave = * -> *<br />
leave.default = 1<br />
leave.operations = leave_status<br />
reassign = new,assigned,reopened -> new<br />
reassign.operations = set_owner<br />
reassign.permissions = TICKET_MODIFY<br />
reopen = resolved,verified,closed -> reopened<br />
reopen.operations = del_resolution<br />
reopen.permissions = TICKET_CREATE<br />
resolve = new,assigned,reopened -> resolved<br />
resolve.operations = set_resolution<br />
resolve.permissions = TICKET_MODIFY<br />
verify = resolved -> verified<br />
verify.permissions = TICKET_MODIFY<br />
close = verified -> closed<br />
close.permissions = TICKET_MODIFY<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/443/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>在CentOS / Red Hat下安装PHP 5.x PECL Filter Extension</title>
		<link>http://www.ooso.net/archives/473</link>
		<comments>http://www.ooso.net/archives/473#comments</comments>
		<pubDate>Mon, 27 Oct 2008 08:22:30 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/473</guid>
		<description><![CDATA[php 5.2之后，默认会装有filter extension，这个扩展可以帮助php开发者过滤用户输入的内容，由php的创始人之一Rasmus Lerdorf提供，可以见我早期的文章介绍。
Q. How do I install filter extension for safely dealing with input parameters supplied via a web form using filter_var()?
A. This extension is part of PHP Core version 5.20 and above. Unfortunately, RHEL / CentOS comes with PHP version 5.1.6. So you need to install this extension by typing the following commands.

				<span class="readmore"><a href="http://www.ooso.net/archives/473" title="在CentOS / Red Hat下安装PHP 5.x PECL Filter Extension">阅读全文（1164字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>php 5.2之后，默认会装有filter extension，这个扩展可以帮助php开发者过滤用户输入的内容，由php的创始人之一Rasmus Lerdorf提供，可以见我<a href="/index.php/archives/202">早期的文章介绍</a>。</p>
<blockquote><p>Q. How do I install filter extension for safely dealing with input parameters supplied via a web form using filter_var()?<br />
A. This extension is part of PHP Core version 5.20 and above. Unfortunately, RHEL / CentOS comes with PHP version 5.1.6. So you need to install this extension by typing the following commands.</p></blockquote>
<p>由于RHEL / CentOS自带的php版本是5.1.6，那么只好手工安装filter扩展。安装过程：</p>
<h2>安装php-devel</h2>
<p>为了编译php extensions，需要安装php-devel包:<br />
<code># yum install php-devel</code></p>
<h2>下载php的源码</h2>
<p>php 5.1.6的源码树中没有包含php_pcre.h header文件, 所以需要另行下载一个php源码. 从php.net下载最新版本的源码并放到/opt目录:<br />
<code># cd /opt<br />
# elinks http://cn2.php.net/get/php-5.2.6.tar.bz2/from/cn.php.net/mirror</code></p>
<p>保存之后解压:<br />
<code># tar -jxvf php-5.2.6.tar.bz2</code></p>
<h2>下载filter extension</h2>
<p>在<a href="http://pecl.php.net">pecl</a>上找到最新的filter源码:<br />
<code># cd /opt<br />
# wget http://pecl.php.net/get/filter-0.11.0.tgz</code></p>
<h2>安装filter extension</h2>
<p>解压文件:<br />
<code># tar -jxvf filter-0.11.0.tgz<br />
# cd filter-0.11.0</code><br />
打开logical_filters.c文件:<br />
<code># vi logical_filters.c</code><br />
找到下面的代码行:</p>
<p><code>#include "ext/pcre/php_pcre.h"</code></p>
<p>修改成 (php_pcre.h的绝对路径):</p>
<p><code>#include "/opt/php-5.2.6/ext/pcre/php_pcre.h"</code></p>
<p>保存并关闭文件. 最后输入下面命令来编译filter扩展:<br />
<code># phpize<br />
# ./configure<br />
# make install</code></p>
<h2>配置Filter Extension</h2>
<p>输入下列命令:<br />
<code># echo 'extension=filter.so' > /etc/php.d/filter.ini </code></p>
<p>然后重启web server即可。</p>
<p>原文: <a href="http://www.cyberciti.biz/faq/rhel-cento-linux-install-php-pecl-filter/">CentOS / Red Hat Linux Install PHP 5.x PECL Filter Extension</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/473/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>php 5.3带来了什么(三)</title>
		<link>http://www.ooso.net/archives/472</link>
		<comments>http://www.ooso.net/archives/472#comments</comments>
		<pubDate>Wed, 24 Sep 2008 08:50:01 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/472</guid>
		<description><![CDATA[之前介绍的php 5.3的新特性，都是方便开发人员的东东。下面介绍个很讨虚拟主机提供商喜欢的特性。
增强的ini文件支持

CGI/ FastCGI支持类似.htaccess的INI配置

				<span class="readmore"><a href="http://www.ooso.net/archives/472" title="php 5.3带来了什么(三)">阅读全文（606字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>之前介绍的php 5.3的新特性，都是方便开发人员的东东。下面介绍个很讨虚拟主机提供商喜欢的特性。</p>
<h2>增强的ini文件支持</h2>
<ul>
<li>CGI/ FastCGI支持类似<b>.htaccess</b>的INI配置</li>
<li>每个目录下都可以有INI设置，ini的文件名取决于php.ini的配置，但是[PATH=/var/www/domain.com], [HOST=www.domain.com]段落的设置用户不能修改。</li>
<li>增强的error handling</li>
<li>允许在ini文件中定义变量和常量，可以在程序中直接调用。</li>
</ul>
<p>附上一段ini文件的例子</p>
<div class="igBar"><span id="lcode-36"><a href="#" onclick="javascript:showCodeTxt('code-36'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-36">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#用户自定义的php.<span style="">ini</span>文件名 <span style="color:#006600; font-weight:bold;">&#40;</span>.<span style="">htaccess</span><span style="color:#006600; font-weight:bold;">&#41;</span>. 默认是<span style="color:#CC0000;">".user.ini"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">user_ini.<span style="">filename</span> = <span style="color:#CC0000;">".user.ini"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#如果要禁用这个特性，设置为空值即可</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">user_ini.<span style="">filename</span> =</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#用户自定义的php.<span style="">ini</span>文件TTL时长<span style="color:#006600; font-weight:bold;">&#40;</span>time-to-live<span style="color:#006600; font-weight:bold;">&#41;</span>，单位为秒，我理解为缓存过期时间。默认为<span style="color:#800000;color:#800000;">300</span>秒 </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">user_ini.<span style="">cache_ttl</span> = <span style="color:#800000;color:#800000;">300</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>PATH=/var/www/domain.<span style="">com</span><span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">variables_order = GPC</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">safe_mode = <span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>my variables<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">somevar = “<span style="color:#800000;color:#800000;">1234</span>”</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">anothervar = $<span style="color:#006600; font-weight:bold;">&#123;</span>somevar<span style="color:#006600; font-weight:bold;">&#125;</span> ; anothervar == somevar</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>ini arrays<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">foo<span style="color:#006600; font-weight:bold;">&#91;</span>bar<span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#800000;color:#800000;">1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">foo<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#800000;color:#800000;">123</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#800000;color:#800000;">2</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">foo<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#800000;color:#800000;">3</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/472/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>memcached Binary协议的ppt</title>
		<link>http://www.ooso.net/archives/471</link>
		<comments>http://www.ooso.net/archives/471#comments</comments>
		<pubDate>Tue, 23 Sep 2008 12:35:09 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[COMMON]]></category>
		<category><![CDATA[memcache]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/471</guid>
		<description><![CDATA[memcached 1.3将开始支持Binary Protocol，下面是一篇介绍的ppt。

大概看了一遍，可以认为memcache的binary协议相对原来基于文本的协议，略快一些。key的长度可以到65536(2 bytes)。而memcache 1.3将仍然保持向后兼容，同时支持文本协议和binary协议。
]]></description>
			<content:encoded><![CDATA[<p>memcached 1.3将开始支持Binary Protocol，下面是一篇介绍的ppt。</p>
<p><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=memcachednighttokyo-1221916987381523-9&#038;stripped_title=memcached-binary-protocol-in-a-nutshell-presentation" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=memcachednighttokyo-1221916987381523-9&#038;stripped_title=memcached-binary-protocol-in-a-nutshell-presentation" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object></p>
<p>大概看了一遍，可以认为<a href="/?tag=memcache">memcache</a>的binary协议相对原来基于文本的协议，略快一些。key的长度可以到65536(2 bytes)。而memcache 1.3将仍然保持向后兼容，同时支持文本协议和binary协议。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/471/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php 5.3带来了什么(二)</title>
		<link>http://www.ooso.net/archives/470</link>
		<comments>http://www.ooso.net/archives/470#comments</comments>
		<pubDate>Sun, 21 Sep 2008 06:44:53 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[MYSQL]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/470</guid>
		<description><![CDATA[接上文
性能提升
php 5.3的总体性能提升了5 - 15%


				<span class="readmore"><a href="http://www.ooso.net/archives/470" title="php 5.3带来了什么(二)">阅读全文（1275字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>接上文</p>
<h2>性能提升</h2>
<p>php 5.3的总体性能提升了5 - 15%</p>
<ul>
<li>md5()快了10-15%</li>
<li>Better stack implementation in the engine</li>
<li>Constants移到read-only内存里</li>
<li>exception处理过程改进(简化，opcodes更少)</li>
<li>(require/include)_once改进，去掉重复open</li>
<li>Smaller binary size &#038; startup size with gcc4</li>
</ul>
<h2>新语言特性</h2>
<h3>__DIR__</h3>
<p>在5.3以前，为了获得当前脚本的目录，需要一次函数调用</p>
<div class="igBar"><span id="lcode-44"><a href="#" onclick="javascript:showCodeTxt('code-44'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-44">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo dirname<span style="color:#006600; font-weight:bold;">&#40;</span>__FILE__<span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// &lt; PHP 5.3 </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>在5.3，只需要一个魔术常量__DIR__就解决了。</p>
<div class="igBar"><span id="lcode-45"><a href="#" onclick="javascript:showCodeTxt('code-45'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-45">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo __DIR__; <span style="color:#FF9933; font-style:italic;">// &gt;= PHP 5.3 </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>?:操作符</h3>
<p>便捷的<b>?:</b>操作符，可以从两个值/表达式中快速取得非空值。</p>
<div class="igBar"><span id="lcode-46"><a href="#" onclick="javascript:showCodeTxt('code-46'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-46">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$a = true ?: false; <span style="color:#FF9933; font-style:italic;">// true</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$a = false ?: true; <span style="color:#FF9933; font-style:italic;">// true</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$a = <span style="color:#CC0000;">""</span> ?: <span style="color:#800000;color:#800000;">1</span>; <span style="color:#FF9933; font-style:italic;">// 1</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$a = <span style="color:#800000;color:#800000;">0</span> ?: <span style="color:#800000;color:#800000;">2</span>; <span style="color:#FF9933; font-style:italic;">// 2</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$a = array<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> ?: array<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// array(1);</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$a = strlen<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">""</span><span style="color:#006600; font-weight:bold;">&#41;</span> ?: strlen<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"a"</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// 1 </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>__callStatic()</h3>
<p>新增了魔术方法__callStatic，功能和__call类似，但是仅对static方法有效。</p>
<div class="igBar"><span id="lcode-47"><a href="#" onclick="javascript:showCodeTxt('code-47'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-47">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class helper <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        static function __callStatic<span style="color:#006600; font-weight:bold;">&#40;</span>$name, $args<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">                echo $name.<span style="color:#CC0000;">'('</span>.<span style="">implode</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">','</span>, $args<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#CC0000;">')'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">helper::<span style="">test</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"foo"</span>,<span style="color:#CC0000;">"bar"</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// test(foo,bar) </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>动态调用static方法</h3>
<p>动态的调用静态方法？动静结合。</p>
<div class="igBar"><span id="lcode-48"><a href="#" onclick="javascript:showCodeTxt('code-48'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-48">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class helper <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        static function foo<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> echo __METHOD__; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$a = <span style="color:#CC0000;">"helper"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$b = <span style="color:#CC0000;">"foo"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$a::$b<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// helper::foo </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>Late Static Binding</h3>
<p>不知道怎么译，可能留个原文更容易理解。静态方法的事件处理时机有变化，以前是在编译期处理，现在是执行期间处理。</p>
<p>在php 5.3之前，下面的代码会输出一个A，但是这不是咱们要的，whoami方法已经在class B中重新定义，它本该输出B才符合咱们想当然的思维。</p>
<div class="igBar"><span id="lcode-49"><a href="#" onclick="javascript:showCodeTxt('code-49'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-49">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class A <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   public static function whoami<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   &nbsp; &nbsp;echo __CLASS__;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   public static function identity<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">     self::<span style="">whoami</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class B extends A <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   public static function whoami<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">      echo __CLASS__;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">B::<span style="">identity</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// A &lt;-- PHP &lt;5.3 </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>下面代码中使用了<b>static::whoami()</b>来调用静态方法。php 5.3之后，由于__CLASS__是在执行期被处理，那么这个例子中能顺利抓到class B。</p>
<div class="igBar"><span id="lcode-50"><a href="#" onclick="javascript:showCodeTxt('code-50'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-50">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class A <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   public static function whoami<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">      echo __CLASS__;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   public static function identity<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">      static::<span style="">whoami</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class B extends A <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   public static function whoami<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">      echo __CLASS__;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">   <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">B::<span style="">identity</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// B &lt;--&gt;= PHP 5.3 </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2>mysqlnd</h2>
<p>见<a href="http://www.ooso.net/index.php/archives/464">mysqlnd成为php 5.3中的默认mysql驱动</a></p>
<p>但是PDO_MySQL暂时还不支持mysqlnd，目前只有mysql(i)扩展可以用到</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/470/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>php 5.3带来了什么(一)</title>
		<link>http://www.ooso.net/archives/469</link>
		<comments>http://www.ooso.net/archives/469#comments</comments>
		<pubDate>Sun, 21 Sep 2008 00:49:31 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/469</guid>
		<description><![CDATA[之前陆续介绍了php 5.3的一些新特性，正好上周看到ZendCon关于5.3的ppt，介绍的更为详细，那么这里做个归总或者说翻译:)
Namespaces
php 5.3最大的改动，毫无疑问就是Namespaces(此前有一篇相关的PHP Namespaces FAQ)。这给php开发人员带来的好处不少，广为人们所诟病的函数命名问题也得到了解决。
代码更清晰

				<span class="readmore"><a href="http://www.ooso.net/archives/469" title="php 5.3带来了什么(一)">阅读全文（1229字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>之前陆续介绍了<a href="/index.php/archives/469">php 5.3的一些新特性</a>，正好上周看到ZendCon关于5.3的ppt，介绍的更为详细，那么这里做个归总或者说翻译:)</p>
<h2>Namespaces</h2>
<p>php 5.3最大的改动，毫无疑问就是Namespaces(此前有一篇相关的<a href="http://www.ooso.net/index.php/archives/418">PHP Namespaces FAQ</a>)。这给php开发人员带来的好处不少，广为人们所诟病的函数命名问题也得到了解决。</p>
<h3>代码更清晰</h3>
<p>5.3之前常见的代码，需要自定义前缀区分函数和类名</p>
<div class="igBar"><span id="lcode-58"><a href="#" onclick="javascript:showCodeTxt('code-58'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-58">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function MY_wrapper<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class MY_DB <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">define<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'MY_CONN_STR'</span>, <span style="color:#CC0000;">''</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">MY_wrapper<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">new MY_DB<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">MY_CONN_STR; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>使用名称空间之后，代码看上去更加clean。</p>
<div class="igBar"><span id="lcode-59"><a href="#" onclick="javascript:showCodeTxt('code-59'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-59">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">namespace MY;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function wrapper<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class DB <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">const CONN_STR = <span style="color:#CC0000;">''</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">use MY AS MY;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">wrapper<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">new DB<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">CONN_STR; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>一个文件中定义了多个namespace</h3>
<p>如果一个文件中定义了多个namespace，应该怎样处理？</p>
<div class="igBar"><span id="lcode-60"><a href="#" onclick="javascript:showCodeTxt('code-60'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-60">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">namespace LIB;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class MySQL <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class SQLite <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$b = new SQLite<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">namespace LIB_EXTRA;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class MScrypt <span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$a = new MScrypt<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">var_dump<span style="color:#006600; font-weight:bold;">&#40;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        get_class<span style="color:#006600; font-weight:bold;">&#40;</span>$a<span style="color:#006600; font-weight:bold;">&#41;</span>,</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">        get_class<span style="color:#006600; font-weight:bold;">&#40;</span>$b<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>以上代码输出为：</p>
<div class="igBar"><span id="lcode-61"><a href="#" onclick="javascript:showCodeTxt('code-61'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-61">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">string<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">18</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#CC0000;">"LIB_EXTRA::MScrypt"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">string<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">11</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#CC0000;">"LIB::SQLite"</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>php是解释执行的语言，以上结果合情合理。</p>
<h3>namespace的优先级</h3>
<p>namespace中定义的函数，类和常量优先，其次才是全局的。</p>
<div class="igBar"><span id="lcode-62"><a href="#" onclick="javascript:showCodeTxt('code-62'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-62">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">namespace foo;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function strlen<span style="color:#006600; font-weight:bold;">&#40;</span>$foo<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> return htmlentities<span style="color:#006600; font-weight:bold;">&#40;</span>$foo<span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo strlen<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"test"</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// test </span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo ::<span style="">strlen</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"test"</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// 4</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo namespace::<span style="">strlen</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"test"</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// test </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>namespace和autoload的友情</h3>
<ul>
<li>autoload会根据namespace名称以及class名称来解析类文件位置</li>
<li>仅当namespace和全局范围都没找到class定义的情况下，autoload才会被触发 </li>
<li>在namespace中定义的__autoload不会被自动调用 </li>
</ul>
<div class="igBar"><span id="lcode-63"><a href="#" onclick="javascript:showCodeTxt('code-63'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-63">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function __autoload<span style="color:#006600; font-weight:bold;">&#40;</span>$var<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> var_dump<span style="color:#006600; font-weight:bold;">&#40;</span>$var<span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#FF9933; font-style:italic;">// LIB::foo</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">require <span style="color:#CC0000;">"./ns.php"</span>; <span style="color:#008000;">/*</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">        &lt;?php</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">                namespace LIB;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">                new foo();</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#008000;">*/</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h3>namespace一些辅料</h3>
<div class="igBar"><span id="lcode-64"><a href="#" onclick="javascript:showCodeTxt('code-64'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-64">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">namespace really::<span style="">long</span>::<span style="">pointlessly</span>::<span style="">verbose</span>::<span style="">ns</span>;  </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">__NAMESPACE__; <span style="color:#FF9933; font-style:italic;">// 新增的魔法常量，表示当前namespace名称</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">class a<span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#006600; font-weight:bold;">&#125;</span>   </div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">get_class<span style="color:#006600; font-weight:bold;">&#40;</span>new a<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; <span style="color:#FF9933; font-style:italic;">// really::long::pointlessly::verbose::ns::a</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">use really::<span style="">long</span>::<span style="">pointlessly</span>::<span style="">verbose</span>::<span style="">ns</span>::<span style="">a</span> AS b; <span style="color:#FF9933; font-style:italic;">// 从名称空间中引用一个类 </span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>注：这里的内容节选自pdf <a href="http://ilia.ws/archives/187-Introduction-to-PHP-5.3-Slides.html">Introduction to PHP 5.3 Slides</a>，后文不再复述。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/469/feed</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>wget的亲戚 &#8211; wput</title>
		<link>http://www.ooso.net/archives/468</link>
		<comments>http://www.ooso.net/archives/468#comments</comments>
		<pubDate>Sat, 20 Sep 2008 11:22:50 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[COMMON]]></category>
		<category><![CDATA[免费软件]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/468</guid>
		<description><![CDATA[世界上最远的距离，是网通到电信 —— 这简直是赤果果的真理！
俺这个狗窝host在南方某个电信机房里，从北京访问页面，速度也还凑合着能过。但是要想通过ftp上传几个文件，几乎是不可能，只有三种情况会发生：

timeout!

				<span class="readmore"><a href="http://www.ooso.net/archives/468" title="wget的亲戚 &#8211; wput">阅读全文（431字）</a></span>]]></description>
			<content:encoded><![CDATA[<p><b>世界上最远的距离，是网通到电信</b> —— 这简直是赤果果的真理！</p>
<p>俺这个狗窝host在南方某个电信机房里，从北京访问页面，速度也还凑合着能过。但是要想通过ftp上传几个文件，几乎是不可能，只有三种情况会发生：</p>
<ol>
<li>timeout!</li>
<li>timeout!</li>
<li>timeout!</li>
</ol>
<p>这天我打算把wordpress升级到最新版本，更新文件就成了个大难题。那么只好找了个server做跳板，用wget的亲戚 - wput来解决文件批量上传的问题：</p>
<div class="igBar"><span id="lcode-66"><a href="#" onclick="javascript:showCodeTxt('code-66'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-66">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">wput -B wordpress<span style="color:#008000;">/* ftp://xxxxxx.net/xxxx/ </span></div>
</li>
</ol>
</div>
</div>
</div>
<p> </p>
<p>这样一行命令就能把整个wordpress上传到ftp指定目录下。</p>
<h2>wput的参数</h2>
<blockquote><p>
Usage: wput [options] [file]… [url]…<br />
url ftp://[username[:password]@]hostname[:port][/[path/][file]]
</p></blockquote>
<p>注：如果username和password有:, @之类的字符，可以用urlencode编码</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/468/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>mysql proxy的常见问题</title>
		<link>http://www.ooso.net/archives/467</link>
		<comments>http://www.ooso.net/archives/467#comments</comments>
		<pubDate>Sat, 20 Sep 2008 09:34:26 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[MYSQL]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/467</guid>
		<description><![CDATA[最近试用mysql proxy，遇到若干问题，好在一一找到了解决方案，列出来备忘。这次使用的版本是0.6.x，也许新版本就没有这些问题了。
无法通过mysql proxy连接mysql
在host,password正确的情况下，也会遇到无法连接mysql的情况，可以查查mysql server是不是使用了old_password，检查my.cnf里面是不是有
PLAIN TEXT

				<span class="readmore"><a href="http://www.ooso.net/archives/467" title="mysql proxy的常见问题">阅读全文（915字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>最近试用<a href="/?tag=mysql">mysql</a> proxy，遇到若干问题，好在一一找到了解决方案，列出来备忘。这次使用的版本是0.6.x，也许新版本就没有这些问题了。</p>
<h2>无法通过mysql proxy连接mysql</h2>
<p>在host,password正确的情况下，也会遇到无法连接mysql的情况，可以查查mysql server是不是使用了old_password，检查my.cnf里面是不是有
<div class="igBar"><span id="lcode-70"><a href="#" onclick="javascript:showCodeTxt('code-70'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-70">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">old_password = <span style="color:#800000;color:#800000;">1</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
有的数据库是从老版本升级上来的，所以会开启这个选项，mysql proxy不支持old_password。另外也可以通过查看密码长度的方式来判断:</p>
<div class="igBar"><span id="lcode-71"><a href="#" onclick="javascript:showCodeTxt('code-71'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-71">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">select length<span style="color:#006600; font-weight:bold;">&#40;</span>password<span style="color:#006600; font-weight:bold;">&#41;</span> from mysql.<span style="">user</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p>
如果长度为16位则是old_password无疑。</p>
<h2>字符乱码</h2>
<p>通过proxy连上数据库之后，查到的字符串始终是乱码，即便手工执行了<b>set names 'utf8'</b>也没有效果。</p>
<p>解决办法，mysql server必须设置</p>
<div class="igBar"><span id="lcode-72"><a href="#" onclick="javascript:showCodeTxt('code-72'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-72">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span>mysqld<span style="color:#006600; font-weight:bold;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">skip-character-set-client-handshake</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">init-connect=<span style="color:#CC0000;">'SET NAMES utf8'</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">default-character-set=utf8 </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<h2>一台mysql slave当掉之后，mysql proxy会报错导致全部的mysql无法连接</h2>
<p>安装了mysql proxy实现读写分离，有master x 1, slave x 2。为了测试failover，停掉了一个slave，然后mysql proxy会一直报错，提示无法连接。这个情况比单点的mysql还糟糕，挂掉一个就全挂掉！mysql的工程师给提供了一段代码，替换掉<b>src/network-mysqld-proxy.c</b>的<b>NETWORK_MYSQLD_PLUGIN_PROTO</b>函数可以解决这个问题。</p>
<p>代码比较长，直接附上下载地址： <a href="http://customcode.googlecode.com/files/network-mysqld-proxy-function.c">network-mysqld-proxy-function.c</a></p>
<h2>定期crash</h2>
<p>这个问题也很糟糕，mysql proxy经常会自己悄悄的停止工作，所幸时间间隔很长。猜想是有内存泄漏的问题存在，希望以后的版本能解决。</p>
<p>我采用的解决办法就是晚上定期重启它。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/467/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>sphinx新建索引的一般流程</title>
		<link>http://www.ooso.net/archives/466</link>
		<comments>http://www.ooso.net/archives/466#comments</comments>
		<pubDate>Sat, 20 Sep 2008 09:19:37 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[COMMON]]></category>
		<category><![CDATA[sphinx]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/466</guid>
		<description><![CDATA[在sphinx中新建索引(不是新增数据)的一般流程：

在sphinx.conf中增加index配置项
手工重建索引，不要使用--rotate参数，例如

				<span class="readmore"><a href="http://www.ooso.net/archives/466" title="sphinx新建索引的一般流程">阅读全文（196字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>在sphinx中新建索引(不是新增数据)的一般流程：</p>
<ul>
<li>在sphinx.conf中增加index配置项</li>
<li>手工重建索引，不要使用--rotate参数，例如
<div class="igBar"><span id="lcode-74"><a href="#" onclick="javascript:showCodeTxt('code-74'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-74">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">/usr/local/sphinx/bin/indexer --config /usr/local/sphinx/etc/sphinx.<span style="">conf</span> --all </div>
</li>
</ol>
</div>
</div>
</div>
<p></li>
<li>重启searchd</li>
</ul>
<p>这样才不会产生<a href="/?tag=shpinx">sphinx</a>索引的临时.new.*文件</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/466/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>从memcache中dump所有key的patch</title>
		<link>http://www.ooso.net/archives/465</link>
		<comments>http://www.ooso.net/archives/465#comments</comments>
		<pubDate>Sat, 23 Aug 2008 04:27:41 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[COMMON]]></category>
		<category><![CDATA[memcache]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=465</guid>
		<description><![CDATA[在邮件组里看到这个补丁，能够将memcache中所有的key dump出来。
I have just finished a patch to dump all keys from memcached.
And I am glad to share this patch to anyone who wants to use it.
In the attachment, there are two python scripts which are used for dump all keys from a memcached server,

				<span class="readmore"><a href="http://www.ooso.net/archives/465" title="从memcache中dump所有key的patch">阅读全文（343字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>在邮件组里看到这个补丁，能够将<a href="/?tag=memcache">memcache</a>中所有的key dump出来。</p>
<blockquote><p>I have just finished a patch to dump all keys from memcached.<br />
And I am glad to share this patch to anyone who wants to use it.</p>
<p>In the attachment, there are two python scripts which are used for dump all keys from a memcached server,<br />
you can find the usage in the example.py script.</p>
<p>Any  questions or advice can mail  to  we_2002 at 163.com </p></blockquote>
<p>用法见example.py</p>
<p>下载:  <a href="http://customcode.googlecode.com/files/memcached-hack.zip">memcached-hack.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/465/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysqlnd成为php 5.3中的默认mysql驱动</title>
		<link>http://www.ooso.net/archives/464</link>
		<comments>http://www.ooso.net/archives/464#comments</comments>
		<pubDate>Wed, 06 Aug 2008 15:15:03 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[MYSQL]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=464</guid>
		<description><![CDATA[mysqlnd成为php 5.3中的默认mysql驱动，它有如下优点：

mysqlnd更容易编译: 因为它是php源码树的一个组成部分
mysqlnd和php内部机制结合更紧密，是优化过的mysql驱动

				<span class="readmore"><a href="http://www.ooso.net/archives/464" title="mysqlnd成为php 5.3中的默认mysql驱动">阅读全文（255字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>mysqlnd成为php 5.3中的默认mysql驱动，它有如下优点：</p>
<ul>
<li>mysqlnd更容易编译: 因为它是php源码树的一个组成部分</li>
<li>mysqlnd和php内部机制结合更紧密，是优化过的mysql驱动</li>
<li>mysqlnd更节省内存，从测试结果来看，比传统的mysql扩展节省40%的内存</li>
<li>mysqlnd更快</li>
<li>mysqlnd提供了丰富的性能统计功能</li>
<li>mysqlnd使用了PHP license以避免不必要的版权纠纷</li>
</ul>
<p>这个改动应同时对mysql和pdo_mysql扩展生效。</p>
<h3>mysqlnd是什么</h3>
<p><a href="http://blogs.mysql.com/kaj/2006/10/25/69/">mysqlnd</a>是<a href="/?tag=mysql">mysql</a>原装的php驱动</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/464/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>php 5.3将提供改进的Lambda函数</title>
		<link>http://www.ooso.net/archives/463</link>
		<comments>http://www.ooso.net/archives/463#comments</comments>
		<pubDate>Mon, 21 Jul 2008 01:32:24 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.ooso.net/?p=463</guid>
		<description><![CDATA[从前的lambda函数
在php里面，传统方法是利用create_function来建立lambda函数，老实说，这个创建过程比较麻烦。拿php手册上的例子来说：
PLAIN TEXT
CODE:

				<span class="readmore"><a href="http://www.ooso.net/archives/463" title="php 5.3将提供改进的Lambda函数">阅读全文（86字）</a></span>]]></description>
			<content:encoded><![CDATA[<h3>从前的lambda函数</h3>
<p>在php里面，传统方法是利用create_function来建立lambda函数，老实说，这个创建过程比较麻烦。拿php手册上的例子来说：</p>
<div class="igBar"><span id="lcode-82"><a href="#" onclick="javascript:showCodeTxt('code-82'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-82">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&lt;?php</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$newfunc = create_function<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'$a,$b'</span>, <span style="color:#CC0000;">'return &quot;ln($a) + ln($b) = &quot; . log($a * $b);'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo <span style="color:#CC0000;">"New anonymous function: $newfunc<span style="color:#000099; font-weight:bold;">\n</span>"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">echo $newfunc<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#800000;color:#800000;">2</span>, M_E<span style="color:#006600; font-weight:bold;">&#41;</span> . <span style="color:#CC0000;">"<span style="color:#000099; font-weight:bold;">\n</span>"</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// outputs</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// New anonymous function: lambda_1</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// ln(2) + ln(2.718281828459) = 1.6931471805599</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">?&gt; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>上头这样一段代码，恐怕一时半会还看不明白$newfunc到底是怎样的一个lambda函数。</p>
<h3>php 5.3的lambda函数语法</h3>
<p>改进的lambda基本语法</p>
<div class="igBar"><span id="lcode-83"><a href="#" onclick="javascript:showCodeTxt('code-83'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-83">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function &amp; <span style="color:#006600; font-weight:bold;">&#40;</span>parameters<span style="color:#006600; font-weight:bold;">&#41;</span> use <span style="color:#006600; font-weight:bold;">&#40;</span>lexical vars<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> body <span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>创建一个简单lambda函数的例子。下面的例子看上去，语法和javascript甚至很接近了，对于我这样一个由javascript入门到php来的coder来说，这样的代码真是让人瞅着亲切。代码最后的<b>;</b>号是不可省略的，否则会碰到语法错误。</p>
<div class="igBar"><span id="lcode-84"><a href="#" onclick="javascript:showCodeTxt('code-84'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-84">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$lambda = function <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> echo <span style="color:#CC0000;">"Hello World!<span style="color:#000099; font-weight:bold;">\n</span>"</span>; <span style="color:#006600; font-weight:bold;">&#125;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>调用方法很多</p>
<div class="igBar"><span id="lcode-85"><a href="#" onclick="javascript:showCodeTxt('code-85'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-85">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">$lambda <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">call_user_func <span style="color:#006600; font-weight:bold;">&#40;</span>$lambda<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">call_user_func_array <span style="color:#006600; font-weight:bold;">&#40;</span>$lambda, array <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>在函数中的简单调用</p>
<div class="igBar"><span id="lcode-86"><a href="#" onclick="javascript:showCodeTxt('code-86'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-86">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function replace_spaces <span style="color:#006600; font-weight:bold;">&#40;</span>$text<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $replacement = function <span style="color:#006600; font-weight:bold;">&#40;</span>$matches<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; return str_replace <span style="color:#006600; font-weight:bold;">&#40;</span>$matches<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#800000;color:#800000;">1</span><span style="color:#006600; font-weight:bold;">&#93;</span>, <span style="color:#CC0000;">' '</span>, <span style="color:#CC0000;">'&amp;nbsp;'</span><span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#CC0000;">' '</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; return preg_replace_callback <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">'/( +) /'</span>, $replacement, $text<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>甚至可以把lambda函数作为结果返回，这样引申的语法变化会相当丰富，想想javascript就知道了</p>
<div class="igBar"><span id="lcode-87"><a href="#" onclick="javascript:showCodeTxt('code-87'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-87">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function getAdder<span style="color:#006600; font-weight:bold;">&#40;</span>$x<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; return function <span style="color:#006600; font-weight:bold;">&#40;</span>$y<span style="color:#006600; font-weight:bold;">&#41;</span> use <span style="color:#006600; font-weight:bold;">&#40;</span>$x<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#FF9933; font-style:italic;">// or: lexical $x;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; return $x + $y;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>还可以导入外部变量到lambda函数，通过关键字<strong>use</strong>完成。如果没有这个关键字，以前可能要通过<strong>global</strong>来传递这些变量。</p>
<div class="igBar"><span id="lcode-88"><a href="#" onclick="javascript:showCodeTxt('code-88'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-88">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">function replace_in_array <span style="color:#006600; font-weight:bold;">&#40;</span>$search, $replacement, $array<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; $map = function <span style="color:#006600; font-weight:bold;">&#40;</span>$text<span style="color:#006600; font-weight:bold;">&#41;</span> use <span style="color:#006600; font-weight:bold;">&#40;</span>$search, $replacement<span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; if <span style="color:#006600; font-weight:bold;">&#40;</span>strpos <span style="color:#006600; font-weight:bold;">&#40;</span>$text, $search<span style="color:#006600; font-weight:bold;">&#41;</span>&gt; <span style="color:#800000;color:#800000;">50</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; return str_replace <span style="color:#006600; font-weight:bold;">&#40;</span>$search, $replacement, $text<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span> else <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; return $text;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; return array_map <span style="color:#006600; font-weight:bold;">&#40;</span>$map, $array<span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>这个patch由Christian Seiler, Dmitry Stogov提供，目前已经加入到php 5.3。</p>
<p>原文见：<a href="http://wiki.php.net/rfc/closures">Request for Comments: Lambda functions and closures</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/463/feed</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>最简便的清空memcache的方法</title>
		<link>http://www.ooso.net/archives/462</link>
		<comments>http://www.ooso.net/archives/462#comments</comments>
		<pubDate>Sun, 20 Jul 2008 01:08:58 +0000</pubDate>
		<dc:creator>Volcano</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[memcache]]></category>

		<guid isPermaLink="false">http://www.ooso.net/index.php/archives/462</guid>
		<description><![CDATA[如果要清空memcache的items，常用的办法是什么？杀掉重启？如果有n台memcache需要重启怎么办？挨个做一遍？
很简单，假设memcached运行在本地的11211端口，那么跑一下命令行：
$ echo ”flush_all” &#124; nc localhost 11211
注：flush并不会将items删除，只是将所有的items标记为expired。

				<span class="readmore"><a href="http://www.ooso.net/archives/462" title="最简便的清空memcache的方法">阅读全文（210字）</a></span>]]></description>
			<content:encoded><![CDATA[<p>如果要清空memcache的items，常用的办法是什么？杀掉重启？如果有n台<a href="/?tag=memcache">memcache</a>需要重启怎么办？挨个做一遍？</p>
<p>很简单，假设memcached运行在本地的11211端口，那么跑一下命令行：<br />
<code>$ echo ”flush_all” | nc localhost 11211</code></p>
<p>注：flush并不会将items删除，只是将所有的items标记为expired。</p>
<p>原文：<a href="http://willj.net/blog/2008/06/10/flushing-memcached-servers-the-easy-way/">Flushing memcached servers the easy way</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ooso.net/archives/462/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 2.224 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2009-07-04 04:45:32 -->
