<?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>窄多之Blog</title>
	<atom:link href="http://www.zhaiduo.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zhaiduo.com</link>
	<description>网站，互联网，旅行 - 2010未来：浏览器化，标准化，框架化，三维化</description>
	<lastBuildDate>Tue, 02 Mar 2010 05:56:28 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Are you ready for WebGL?</title>
		<link>http://www.zhaiduo.com/2010/02/ready_for_webgl/</link>
		<comments>http://www.zhaiduo.com/2010/02/ready_for_webgl/#comments</comments>
		<pubDate>Wed, 24 Feb 2010 06:04:03 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[三维时代]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[CUDA]]></category>
		<category><![CDATA[WebGL]]></category>

		<guid isPermaLink="false">http://www.zhaiduo.com/?p=536</guid>
		<description><![CDATA[The main advantage of WebGL is that cross-device, cross-platform and zero-install. It&#8217;s the new revolution for 3D entertainment on the Internet. It&#8217;s the future.
Javascript with CUDA: Elevating JavaScript Performance Through GPU Power
http://mozillalabs.com/jetpack/2010/01/25/elevating-javascript-performance-through-gpu-power/
It&#8217;s possible to utilize CUDA from within Jetpack now. (See the Jetpack-to-CUDA project)
Jetpack.toGPU() is that hint. Under the hood of Jetpack.toGPU() there is translation [...]]]></description>
			<content:encoded><![CDATA[<p>The main advantage of <a href="http://www.khronos.org/webgl/wiki/Main_Page">WebGL</a> is that cross-device, cross-platform and zero-install. It&#8217;s the new revolution for 3D entertainment on the Internet. It&#8217;s the future.</p>
<p><strong>Javascript with CUDA:</strong> <a href="http://mozillalabs.com/jetpack/2010/01/25/elevating-javascript-performance-through-gpu-power/">Elevating JavaScript Performance Through GPU Power</a></p>
<p>http://mozillalabs.com/jetpack/2010/01/25/elevating-javascript-performance-through-gpu-power/</p>
<p>It&#8217;s possible to utilize CUDA from within Jetpack now. (See the <a href="http://mozillalabs.com/jetpack/2009/11/10/jetpack-0-5-contest-a-winner/">Jetpack-to-CUDA project</a>)</p>
<blockquote><p>Jetpack.toGPU() is that hint. Under the hood of Jetpack.toGPU() there is translation of function(nums, numsSize) {…} to CUDA Kernel and a method of sending C-code to the GPU. Jetpack.toGPU() should be non-blocking. It means “some job” will be done while resNumbers is calculating. Of course, a developer could write their own CUDA Kernel in C to be sent to the GPU. This technique is like in similar to the PyCUDA project.</p></blockquote>
<p><strong>WebGL on Mobile:</strong> <a href="http://www.engadget.com/2009/12/03/nokia-n900-impressively-demos-webgl-3d-graphics/">Nokia N900 impressively demos WebGL 3D graphics</a></p>
<p>http://www.engadget.com/2009/12/03/nokia-n900-impressively-demos-webgl-3d-graphics/</p>
<p><strong>Start to Learn WebGL Now?</strong> <a href="http://learningwebgl.com/blog/?p=28">WebGL Lesson</a></p>
<p>http://learningwebgl.com/blog/?p=28</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhaiduo.com/2010/02/ready_for_webgl/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WebGL三维示例和Js版Box2D物理引擎</title>
		<link>http://www.zhaiduo.com/2010/02/webgl%e4%b8%89%e7%bb%b4%e7%a4%ba%e4%be%8b%e5%92%8cjs%e7%89%88box2d%e7%89%a9%e7%90%86%e5%bc%95%e6%93%8e/</link>
		<comments>http://www.zhaiduo.com/2010/02/webgl%e4%b8%89%e7%bb%b4%e7%a4%ba%e4%be%8b%e5%92%8cjs%e7%89%88box2d%e7%89%a9%e7%90%86%e5%bc%95%e6%93%8e/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 03:58:44 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[三维时代]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Physics Engine]]></category>
		<category><![CDATA[WebGL]]></category>

		<guid isPermaLink="false">http://www.zhaiduo.com/?p=526</guid>
		<description><![CDATA[WebGL示例
http://spidergl.org/code.php
SpiderGL: JavaScript 3D Graphics Library on top of WebGL.

测试环境：XP sp3 + firefox-3.7a2pre.en-US.win32\firefox
about:config激活 webgl.enabled_for_all_sites 为 true
同系统运行多个Firefox版本的办法：firefox.exe -profilemanager -no-remote创建新的profile，指定irefox-3.7a2pre.en-US.win32的安装目录即可。

Js版Box2D
http://box2d-js.sourceforge.net/index2.html

]]></description>
			<content:encoded><![CDATA[<p><strong>WebGL示例</strong><br />
<a href="http://spidergl.org/code.php">http://spidergl.org/code.php</a><br />
SpiderGL: JavaScript 3D Graphics Library on top of WebGL.<br />
<a href="http://www.zhaiduo.com/wp-content/uploads/2010/02/p20100221113356.jpg"><img class="alignnone size-medium wp-image-527" title="p20100221113356" src="http://www.zhaiduo.com/wp-content/uploads/2010/02/p20100221113356.jpg" alt="" /></a></p>
<p>测试环境：XP sp3 + <a href="http://www.khronos.org/webgl/wiki/Getting_a_WebGL_Implementation">firefox-3.7a2pre.en-US.win32\firefox</a><br />
about:config激活 webgl.enabled_for_all_sites 为 true<br />
同系统运行多个Firefox版本的办法：firefox.exe -profilemanager -no-remote创建新的profile，指定irefox-3.7a2pre.en-US.win32的安装目录即可。</p>
<p><a href="http://www.zhaiduo.com/wp-content/uploads/2010/02/p20100221113504.jpg"><img class="alignnone size-full wp-image-528" title="p20100221113504" src="http://www.zhaiduo.com/wp-content/uploads/2010/02/p20100221113504.jpg" alt="" /></a></p>
<p><strong>Js版Box2D</strong><br />
<a href="http://box2d-js.sourceforge.net/index2.html">http://box2d-js.sourceforge.net/index2.html</a></p>
<p><a href="http://www.zhaiduo.com/wp-content/uploads/2010/02/p20100221114319.jpg"><img class="alignnone size-full wp-image-529" title="p20100221114319" src="http://www.zhaiduo.com/wp-content/uploads/2010/02/p20100221114319.jpg" alt="" width="375" height="279" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhaiduo.com/2010/02/webgl%e4%b8%89%e7%bb%b4%e7%a4%ba%e4%be%8b%e5%92%8cjs%e7%89%88box2d%e7%89%a9%e7%90%86%e5%bc%95%e6%93%8e/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FLash与HTML5</title>
		<link>http://www.zhaiduo.com/2010/02/flash%e4%b8%8ehtml5/</link>
		<comments>http://www.zhaiduo.com/2010/02/flash%e4%b8%8ehtml5/#comments</comments>
		<pubDate>Fri, 05 Feb 2010 08:28:02 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[互联网]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[Canvas]]></category>
		<category><![CDATA[SVG]]></category>
		<category><![CDATA[三维]]></category>
		<category><![CDATA[图形化]]></category>

		<guid isPermaLink="false">http://www.zhaiduo.com/?p=506</guid>
		<description><![CDATA[苹果新发布的平板电脑iPad不支持Flash(也不支持USB, 扩展内存和蓝牙)，乔布斯做了解释（因为Flash buggy，常常和苹果的宕机有关），
Apple does not support Flash because it is so buggy. Whenever a Mac crashes more often than not it’s because of Flash. No one will be using Flash. The world is moving to HTML5.
与此同时以降低浏览器对插件的依赖程度为主要目的的HMLT5推出了大量的HTML新特性，其中用以替代Flash的Canvas和SVG图形功能(通过Javascript进行二维/三维绘图，其中二维绘图已经被主流浏览器所支持)让人刮目相看。以前只能用Flash做到的效果，现在不用装插件就可以通过Javascript来实现。我们可以看看下面简单的Canvas/SVG例子


Canvas Particle System
Highcharts
Space Invaders game
Some Adventure-y Guy
JS WARS
nifty game
Canvascape &#8211; &#8220;3D Walker&#8221;
Paint.Web &#8211; painting       [...]]]></description>
			<content:encoded><![CDATA[<p>苹果新发布的平板电脑iPad不支持Flash(也不支持USB, 扩展内存和蓝牙)，乔布斯做了解释（因为Flash buggy，常常和苹果的宕机有关），</p>
<blockquote><p>Apple does not support Flash because it is so buggy. Whenever a Mac crashes more often than not it’s because of Flash. No one will be using Flash. The world is moving to HTML5.</p></blockquote>
<p>与此同时以降低浏览器对插件的依赖程度为主要目的的<a href="http://www.whatwg.org/specs/web-apps/current-work/multipage/">HMLT5</a>推出了大量的HTML新特性，其中用以替代Flash的<a href="https://developer.mozilla.org/en/Canvas_tutorial">Canvas</a>和<a href="https://developer.mozilla.org/en/SVG_In_HTML_Introduction">SVG</a>图形功能(通过Javascript进行二维/三维绘图，其中二维绘图已经被主流浏览器所支持)让人刮目相看。以前只能用Flash做到的效果，现在不用装插件就可以通过Javascript来实现。我们可以看看下面简单的Canvas/SVG例子<br />
<a href="http://www.zhaiduo.com/wp-content/uploads/2010/02/p20100205160125.jpg"><img class="alignnone size-full wp-image-509" title="p20100205160125" src="http://www.zhaiduo.com/wp-content/uploads/2010/02/p20100205160125.jpg" alt="" width="297" height="260" /></a></p>
<ul>
<li><a href="http://www.mrspeaker.net/dev/parcycle/">Canvas Particle System</a></li>
<li><a href="http://highcharts.com/">Highcharts</a></li>
<li><a href="http://croczilla.com/bits_and_pieces/svg/samples/invaders/invaders.svg">Space Invaders game</a></li>
<li><a href="http://www.mrspeaker.net/dev/platform/">Some Adventure-y Guy</a></li>
<li><a href="http://29a.ch/jswars/">JS WARS</a></li>
<li><a href="http://www.paulbrunt.co.uk/2009/09/20/berts-breakdown/">nifty game</a></li>
<li><a href="http://www.benjoffe.com/code/demos/canvascape/">Canvascape &#8211; &#8220;3D Walker&#8221;</a></li>
<li><a href="http://code.google.com/p/paintweb">Paint.Web &#8211; painting              demo, open-source</a></li>
<li><a href="http://arapehlivanian.com/wp-content/uploads/2007/02/canvas.html">Star-field              flight</a></li>
</ul>
<p>Flash未来可谓是凶多吉少。虽然目前看来，和HTML5相比，Flash确实有着明显优势</p>
<ol>
<li> 安装方便</li>
<li>性能流畅</li>
<li>巨大的用户基数</li>
<li>领先的视频/音频播放技术</li>
</ol>
<p>特别是高性能三维网页动画(但是这种优势很快即将不再，OpenGL已经瞄准三维网页市场，推出<a href="http://www.khronos.org/webgl/">WebGL</a>)：</p>
<ul>
<li><a href="http://www.unitzeroone.com/blog/2010/01/20/pixelbender-raytracer-milkyball/">Milkyball, a further extension of my Triangle3D experimentation</a></li>
<li><a href="http://kode80.com/2009/11/19/pv3d-light-rays/">PV3D light rays</a></li>
<li><a href="http://www.derschmale.com/demo/away3d/multipassLantern/">Multi-pass Lantern</a></li>
</ul>
<p>但是Flash仍然有不少隐忧：</p>
<ol>
<li> 始终需要插件安装</li>
<li>三维复杂动画的性能瓶颈</li>
<li>众多竞争对手：苹果公司, Sliverlight, HTML5, WebGL</li>
</ol>
<p>如果有那么一天，Flash将不再是插件，而成为主要浏览器默认的一部分，我想这才是我对Flash的期望。无论如何，对我来说Flash的确是个很棒的玩具和工具，我会继续支持和使用它！至于它能否占领市场，一统天下，乔布斯和HTML5最终能否成为Flash的终结者，我们拭目以待吧。</p>
<p>另外，你准备好<a href="http://www.alistapart.com/articles/get-ready-for-html-5/">HTML5</a>了吗？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhaiduo.com/2010/02/flash%e4%b8%8ehtml5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QuickBox2D</title>
		<link>http://www.zhaiduo.com/2010/01/quickbox2d/</link>
		<comments>http://www.zhaiduo.com/2010/01/quickbox2d/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 09:46:02 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[二维]]></category>
		<category><![CDATA[物理引擎]]></category>

		<guid isPermaLink="false">http://www.zhaiduo.com/?p=497</guid>
		<description><![CDATA[QuickBox2D是AS3二维物理引擎框架Box2D的简化版。可以快速生成二维物理碰撞效果，很容易上手。
QuickBox2D sample &#8211; wonderfl build flash online
这是Wonderfl.net的在线测试，很容易把它做成一个类似于用盘子端皮球的小游戏。有空玩一玩～
]]></description>
			<content:encoded><![CDATA[<p><a href="http://actionsnippet.com/?page_id=1391">QuickBox2D</a>是AS3二维物理引擎框架<a href="http://box2dflash.sourceforge.net/">Box2D</a>的简化版。可以快速生成二维物理碰撞效果，很容易上手。</p>
<div style="text-align:center;width:465px;"><iframe title="QuickBox2D sample - wonderfl build flash online" scrolling="no" src="http://wonderfl.net/blogparts/3aa34a4739ed930b951ada2087f3606f08bb8c89" width="465" height="490" style="border:1px black solid;"></iframe><a href="http://wonderfl.net/code/3aa34a4739ed930b951ada2087f3606f08bb8c89" title="QuickBox2D sample - wonderfl build flash online">QuickBox2D sample &#8211; wonderfl build flash online</a></div>
<p>这是Wonderfl.net的在线测试，很容易把它做成一个类似于用盘子端皮球的小游戏。有空玩一玩～</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhaiduo.com/2010/01/quickbox2d/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RewriteRule里正则表达式减号字符的顺序问题</title>
		<link>http://www.zhaiduo.com/2010/01/rewriterule%e9%87%8c%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e5%87%8f%e5%8f%b7%e5%ad%97%e7%ac%a6%e7%9a%84%e9%a1%ba%e5%ba%8f%e9%97%ae%e9%a2%98/</link>
		<comments>http://www.zhaiduo.com/2010/01/rewriterule%e9%87%8c%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e5%87%8f%e5%8f%b7%e5%ad%97%e7%ac%a6%e7%9a%84%e9%a1%ba%e5%ba%8f%e9%97%ae%e9%a2%98/#comments</comments>
		<pubDate>Wed, 20 Jan 2010 10:17:40 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[杂项]]></category>
		<category><![CDATA[Trouble]]></category>
		<category><![CDATA[正则表达式]]></category>

		<guid isPermaLink="false">http://www.zhaiduo.com/?p=489</guid>
		<description><![CDATA[在用URLRewrite的时候，PHP正则匹配(preg_match)的时候，常常有一个容易忽略的小问题：
有效：RewriteRule ([0-9a-zA-Z\+_\.\-]{3,})/$  /article\-$1.html [L]
无效：RewriteRule ([0-9a-zA-Z\-\+_\.]{3,})/$  /article\-$1.html [L]
仅仅是因为方括号内减号（-）字符顺序的不同，让正则匹配失效。
但这又不是普遍的问题，只是在个别虚拟主机上出现。
下面的解释可以帮我们释疑：
正则表达式通过使用元字符来编码在模式中，元字符不代表其自身，它们用一些特殊的方式来解析。
减号（-）字符可以在字符类中指定一个字符范围。例如，[d-m] 匹配了 d 和 m 之间的任何字符，包括两者。如果字符类中需要减号本身，则必须用反斜线转义或者放到一个不能被解释为指定范围的位置，典型的位置是字符类中的第一个或最后一个字符。
]]></description>
			<content:encoded><![CDATA[<p>在用URLRewrite的时候，PHP正则匹配(preg_match)的时候，常常有一个容易忽略的小问题：</p>
<blockquote><p><span style="color: #008000;">有效：</span>RewriteRule ([0-9a-zA-Z\+_\.\-]{3,})/$  /article\-$1.html [L]<br />
<span style="color: #ff0000;">无效：</span>RewriteRule ([0-9a-zA-Z\-\+_\.]{3,})/$  /article\-$1.html [L]</p></blockquote>
<p>仅仅是因为方括号内减号（-）字符顺序的不同，让正则匹配失效。<br />
但这又不是普遍的问题，只是在个别虚拟主机上出现。</p>
<p>下面的解释可以帮我们释疑：</p>
<blockquote><p>正则表达式通过使用元字符来编码在模式中，元字符不代表其自身，它们用一些特殊的方式来解析。<br />
减号（-）字符可以在字符类中指定一个字符范围。例如，[d-m] 匹配了 d 和 m 之间的任何字符，包括两者。<span style="color: #afd42a;">如果字符类中需要减号本身，则必须用反斜线转义或者放到一个不能被解释为指定范围的位置，典型的位置是字符类中的第一个或最后一个字符。</span></p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.zhaiduo.com/2010/01/rewriterule%e9%87%8c%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f%e5%87%8f%e5%8f%b7%e5%ad%97%e7%ac%a6%e7%9a%84%e9%a1%ba%e5%ba%8f%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Discuz7用firefox无法登录</title>
		<link>http://www.zhaiduo.com/2010/01/discuz7%e7%94%a8firefox%e6%97%a0%e6%b3%95%e7%99%bb%e5%bd%95/</link>
		<comments>http://www.zhaiduo.com/2010/01/discuz7%e7%94%a8firefox%e6%97%a0%e6%b3%95%e7%99%bb%e5%bd%95/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 06:03:51 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Trouble]]></category>

		<guid isPermaLink="false">http://www.zhaiduo.com/?p=487</guid>
		<description><![CDATA[Discuz论坛从5.5升级到6.0，然后再升级到7.0，升级过程很顺利，可是在FireFox3.5.7下用管理员或其它普通用户登录的时候，虽然显示登录成功，但是跳转后还是回到登录窗口。IE8下没有这个问题。
]]></description>
			<content:encoded><![CDATA[<p>Discuz论坛从5.5升级到6.0，然后再升级到7.0，升级过程很顺利，可是在FireFox3.5.7下用管理员或其它普通用户登录的时候，虽然显示登录成功，但是跳转后还是回到登录窗口。IE8下没有这个问题。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhaiduo.com/2010/01/discuz7%e7%94%a8firefox%e6%97%a0%e6%b3%95%e7%99%bb%e5%bd%95/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP5成员重载错误: Indirect modification of overloaded property has no effect</title>
		<link>http://www.zhaiduo.com/2010/01/php5%e6%88%90%e5%91%98%e9%87%8d%e8%bd%bd%e9%94%99%e8%af%af-indirect-modification-of-overloaded-property-has-no-effect/</link>
		<comments>http://www.zhaiduo.com/2010/01/php5%e6%88%90%e5%91%98%e9%87%8d%e8%bd%bd%e9%94%99%e8%af%af-indirect-modification-of-overloaded-property-has-no-effect/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 05:56:26 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP5]]></category>

		<guid isPermaLink="false">http://www.zhaiduo.com/?p=483</guid>
		<description><![CDATA[PHP5成员重载的时候
Class Foo{private $arr;public function __get($key) {if(isset($this->arr[$key])){return $this->arr[$key];}}public function __set($key, $val) {if(isset($this->arr[$key])){$this->arr[$key] = $val;}}}$f = new Foo;$f->test = 1;
出现如下错误：
Notice: Indirect modification of overloaded property Foo::$arr has no effect
根据Google结果：
[27 Sep 2007 8:16pm UTC] brjann at gmail dot com
It seems that declaring the getter as &#8220;public function &#038;__get(){&#8230;}&#8221; does the trick. However, it took some googling to find.
php [...]]]></description>
			<content:encoded><![CDATA[PHP5成员重载的时候
<blockquote><div class="hilight" style="text-shadow: 0px 0px 0px #000;color:008000;"><span style="color:#FF8000">Class</span> Foo{<br /><span style="color:#FF8000">private</span> <span style="color:#804040">$arr</span>;<br /><span style="color:#FF8000">public</span> <span style="color:#FF8000">function</span> <span style="color:#FF8000">__get</span>(<span style="color:#804040">$key</span>) {<br /><span style="color:#FF8000">if</span>(<span style="color:#0000FF">isset</span>(<span style="color:#FF8000">$this</span>->arr[<span style="color:#804040">$key</span>])){<br /><span style="color:#FF8000">return</span> <span style="color:#FF8000">$this</span>->arr[<span style="color:#804040">$key</span>];<br />}<br />}<span style="color:#FF8000">public</span> <span style="color:#FF8000">function</span> <span style="color:#FF8000">__set</span>(<span style="color:#804040">$key</span>, <span style="color:#804040">$val</span>) {<br /><span style="color:#FF8000">if</span>(<span style="color:#0000FF">isset</span>(<span style="color:#FF8000">$this</span>->arr[<span style="color:#804040">$key</span>])){<br /><span style="color:#FF8000">$this</span>->arr[<span style="color:#804040">$key</span>] = <span style="color:#804040">$val</span>;<br />}<br />}<br />}<br /><span style="color:#804040">$f</span> = <span style="color:#0000FF">new</span> Foo;<br /><span style="color:#804040">$f</span>->test = <span style="color:#FF0000">1</span>;</div></blockquote>
出现如下错误：
<blockquote>Notice: Indirect modification of overloaded property Foo::$arr has no effect</blockquote>
根据Google结果：<br />
<a href="http://bugs.php.net/bug.php?id=41641">[27 Sep 2007 8:16pm UTC] brjann at gmail dot com</a>
<blockquote>It seems that declaring the getter as &#8220;public function &__get(){&#8230;}&#8221; does the trick. However, it took some googling to find.</blockquote>
<a href="http://dev.iordanov.net/archives/6">php magic __set and __get</a>
<blockquote>this one works as expected. Actually php interpreter seems to do same thing. Trying to get value if exists and change it. Problem is that when it takes this value there is no place to store it and rise this error. Trying to modify property in not existing array. Solution is to make this array available. Returning values by reference seems to work.</blockquote>
解决办法是给__get()加上引用传递&__get，
<blockquote><div class="hilight" style="text-shadow: 0px 0px 0px #000;color:008000;"><span style="color:#FF8000">public</span> <span style="color:#FF8000">function</span> &<span style="color:#FF8000">__get</span>(<span style="color:#804040">$key</span>) {<br /><span style="color:#FF8000">return</span> <span style="color:#FF8000">$this</span>->arr[<span style="color:#804040">$key</span>];<br />}<br /><span style="color:#804040">$f</span>->array[<span style="color:#888888">'test'</span>] = <span style="color:#FF0000">1</span>;</div></blockquote>
试图帮助函数找到引用被绑定的不存在的变量arr。但是这里存在没有调用__set的问题。<br />
我的办法是$arr转为公有化，放弃__set。
<blockquote><div class="hilight" style="text-shadow: 0px 0px 0px #000;color:008000;"><span style="color:#FF8000">public</span> <span style="color:#804040">$arr</span>;<br /><span style="color:#804040">$f</span>->arr[<span style="color:#888888">'test'</span>] = <span style="color:#FF0000">1</span>;</div></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.zhaiduo.com/2010/01/php5%e6%88%90%e5%91%98%e9%87%8d%e8%bd%bd%e9%94%99%e8%af%af-indirect-modification-of-overloaded-property-has-no-effect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>悲哀啊，如果Google关闭谷歌中国</title>
		<link>http://www.zhaiduo.com/2010/01/%e6%82%b2%e5%93%80%e5%95%8a%ef%bc%8cgoogle%e5%85%b3%e9%97%ad%e8%b0%b7%e6%ad%8c%e4%b8%ad%e5%9b%bd/</link>
		<comments>http://www.zhaiduo.com/2010/01/%e6%82%b2%e5%93%80%e5%95%8a%ef%bc%8cgoogle%e5%85%b3%e9%97%ad%e8%b0%b7%e6%ad%8c%e4%b8%ad%e5%9b%bd/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 10:40:40 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Google与Idea]]></category>
		<category><![CDATA[窄多废话]]></category>

		<guid isPermaLink="false">http://www.zhaiduo.com/?p=476</guid>
		<description><![CDATA[Google宣布考虑关闭Google.cn：
我们认识到，这很可能意味着必须关闭Google.cn，并有可能我们在中国的办事处。
作为中国大陆的互联网从业人员，我们还可以对国内互联网抱有什么希望？难道这就是我们伟大祖国净化互联网，大力推进建设和谐世界的伟大成就？
面对GFW、网站备案、白名单、黑名单、文字狱&#8230;我们已经头痛不已，如今还能证明国内互联网尚存一线生机的谷歌中国也将不复存在，可悲啊！
中国互联网的希望在哪里？我看不到。都说互联网这个虚拟的世界是多么美好，可是我看到的只是真实社会一样的乌烟瘴气！
如今的环境，愈加恶劣，腥风血雨，希望各位混迹在互联网的同仁们好自为之。
更新：谷歌澄清不实的传言，否认已经关闭在中国的办公室和在中国的员工已经接到通知将于近期离职。
]]></description>
			<content:encoded><![CDATA[<p>Google宣布<a href="http://googleblog.blogspot.com/2010/01/new-approach-to-china.html">考虑关闭Google.cn</a>：</p>
<blockquote><p>我们认识到，这很可能意味着必须关闭Google.cn，并有可能我们在中国的办事处。</p></blockquote>
<p>作为中国大陆的互联网从业人员，我们还可以对国内互联网抱有什么希望？难道这就是我们伟大祖国净化互联网，大力推进建设和谐世界的伟大成就？</p>
<p>面对GFW、网站备案、白名单、黑名单、文字狱&#8230;我们已经头痛不已，如今还能证明国内互联网尚存一线生机的谷歌中国也将不复存在，可悲啊！</p>
<p>中国互联网的希望在哪里？我看不到。都说互联网这个虚拟的世界是多么美好，可是我看到的只是真实社会一样的乌烟瘴气！</p>
<p>如今的环境，愈加恶劣，腥风血雨，希望各位混迹在互联网的同仁们好自为之。</p>
<p>更新：<a href="http://googlechinablog.com/2010/01/blog-post_19.html">谷歌澄清不实的传言</a>，否认已经关闭在中国的办公室和在中国的员工已经接到通知将于近期离职。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhaiduo.com/2010/01/%e6%82%b2%e5%93%80%e5%95%8a%ef%bc%8cgoogle%e5%85%b3%e9%97%ad%e8%b0%b7%e6%ad%8c%e4%b8%ad%e5%9b%bd/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>用Curl登录Plesk后台备份文件</title>
		<link>http://www.zhaiduo.com/2010/01/%e7%94%a8curl%e5%a4%87%e4%bb%bdplesk/</link>
		<comments>http://www.zhaiduo.com/2010/01/%e7%94%a8curl%e5%a4%87%e4%bb%bdplesk/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 04:23:46 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.zhaiduo.com/?p=474</guid>
		<description><![CDATA[Plesk很不厚道，备份文件不能轻易用压缩软件解压，很不方便。之前我也用过outlook的办法解压plesk备份文件，不过这个方法在系统升级后已经失效。
我们可以用PHP的Curl模块备份网站文件。
其主要思想是通过Curl直接抓取https后台下，file manager中的文件。
备份环境：Apache/2.2.11 (Win32) SVN/1.5.6 PHP/5.3.0 DAV/2
主要Curl代码如下
$ch = curl_init();
//https支持
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_URL, $url); //plesk 后台路径
curl_setopt($ch, CURLOPT_USERPWD, USERNAME.&#8217;:&#8217;.PASSWORD); //plesk 后台用户名，密码
curl_setopt($ch, CURLOPT_HEADER, 1); //输出header部分
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if ($method == &#8216;POST&#8217;) {
curl_setopt($ch, CURLOPT_POST, 3);
curl_setopt($ch, CURLOPT_POSTFIELDS, $vars); //post提交的urlencode数据
}
$data = curl_exec($ch);
curl_close($ch);
]]></description>
			<content:encoded><![CDATA[<p>Plesk很不厚道，备份文件不能轻易用压缩软件解压，很不方便。之前我也用过<a href="http://www.zhaiduo.com/2008/12/windowsplesk.html">outlook的办法解压plesk备份文件</a>，不过这个方法在系统升级后已经失效。</p>
<p>我们可以用PHP的Curl模块备份网站文件。<br />
其主要思想是通过Curl直接抓取https后台下，file manager中的文件。<br />
备份环境：Apache/2.2.11 (Win32) SVN/1.5.6 PHP/5.3.0 DAV/2<br />
主要Curl代码如下</p>
<blockquote><p>$ch = curl_init();</p>
<p>//https支持<br />
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);<br />
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);<br />
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);</p>
<p>curl_setopt($ch, CURLOPT_URL, $url); //plesk 后台路径<br />
curl_setopt($ch, CURLOPT_USERPWD, USERNAME.&#8217;:&#8217;.PASSWORD); //plesk 后台用户名，密码</p>
<p>curl_setopt($ch, CURLOPT_HEADER, 1); //输出header部分<br />
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);<br />
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);</p>
<p>if ($method == &#8216;POST&#8217;) {<br />
curl_setopt($ch, CURLOPT_POST, 3);<br />
curl_setopt($ch, CURLOPT_POSTFIELDS, $vars); //post提交的urlencode数据<br />
}<br />
$data = curl_exec($ch);<br />
curl_close($ch);</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.zhaiduo.com/2010/01/%e7%94%a8curl%e5%a4%87%e4%bb%bdplesk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[巾*(穴/登)]</title>
		<link>http://www.zhaiduo.com/2010/01/%e5%b7%be%e7%a9%b4%e7%99%bb/</link>
		<comments>http://www.zhaiduo.com/2010/01/%e5%b7%be%e7%a9%b4%e7%99%bb/#comments</comments>
		<pubDate>Sat, 09 Jan 2010 03:49:49 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Mysql]]></category>

		<guid isPermaLink="false">http://www.zhaiduo.com/?p=471</guid>
		<description><![CDATA[论坛里有些汉字比较生僻，所以发布到论坛就会成为很怪的字符，例如，我们常常可以看见“[巾*(穴/登)]”这个东西，这是‘正’字的发音，实际上是绘画的画字的意思，但古书里用的“证”字，现在已经念不通。
在PHPMyadmin里面搜索：SELECT * FROM `bbs_posts` WHERE message like &#8216;%[巾*(穴/登)]%&#8217;;
可是并没搜索到结果。试着把网页编码改为UTF-8，搜索结果就可以看到。
]]></description>
			<content:encoded><![CDATA[<p>论坛里有些汉字比较生僻，所以发布到论坛就会成为很怪的字符，例如，我们常常可以看见“[巾*(穴/登)]”这个东西，这是‘正’字的发音，实际上是绘画的画字的意思，但古书里用的“证”字，现在已经念不通。</p>
<p>在PHPMyadmin里面搜索：SELECT * FROM `bbs_posts` WHERE message like &#8216;%[巾*(穴/登)]%&#8217;;<br />
可是并没搜索到结果。试着把网页编码改为UTF-8，搜索结果就可以看到。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zhaiduo.com/2010/01/%e5%b7%be%e7%a9%b4%e7%99%bb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
