<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    <title>nullTao | 净空无道 | Blog</title>
    <link>http://blog.nulltao.net/</link>
    <description>如果死真的是种解脱，那么愿死者有他的天堂，愿生者有他的寄托。但愿在宇宙的深处真有一处天堂，有一天当我们在经历生死契阔之后，还有一个地方在等待着我们的——重逢。</description>
    <dc:language>en</dc:language>
    <admin:errorReportsTo rdf:resource="mailto:nulltao@gmail.com" />
    <generator>Serendipity 1.3 - http://www.s9y.org/</generator>
    <pubDate>Sun, 07 Sep 2008 03:00:06 GMT</pubDate>

    <image>
        <url>http://blog.nulltao.net/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: nullTao | 净空无道 | Blog - 如果死真的是种解脱，那么愿死者有他的天堂，愿生者有他的寄托。但愿在宇宙的深处真有一处天堂，有一天当我们在经历生死契阔之后，还有一个地方在等待着我们的——重逢。</title>
        <link>http://blog.nulltao.net/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>看图说话：耿氏凉面</title>
    <link>http://blog.nulltao.net/archives/99-unknown.html</link>
            <category>TrashcaN</category>
    
    <comments>http://blog.nulltao.net/archives/99-unknown.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=99</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://blog.nulltao.net/rss.php?version=2.0&amp;type=comments&amp;cid=99</wfw:commentRss>
    

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;今日晚饭：炸酱凉面，做法简单，口味独特，实乃耿氏厨艺精髓之体现。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/P1060534.JPG&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/P1060534.thumb.JPG&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;五花肉糜、四川甜面酱、香菇丁、葱花熬得如此炸酱，可惜南京找不到六必居的干黄酱买，口味大打折扣……虽然还是那么好吃。想起来小时候帮厨的时候用水去化那个像便便一样的美味的干黄酱的情景了。&lt;/p&gt;
&lt;p&gt;配上黄瓜丝，清脆可口，不过偷懒，没有自己手擀面，市场上买得机制手工面，聊胜于无。&lt;/p&gt;
&lt;p&gt;右上角是&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/iliuchen.blogspot.com&#039;);&quot;  href=&quot;http://iliuchen.blogspot.com&quot; target=&quot;_blank&quot;&gt;室友&lt;/a&gt;赞助的干瘪小葱（买了块一个星期了）拌老豆腐，撒花～～～～～&lt;/p&gt;
&lt;p&gt;顺便翻出来上个星期的芝麻酱凉面配剁椒木耳：&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/P1060530.JPG&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/P1060530.thumb.JPG&quot; /&gt;&lt;/a&gt;&lt;br /&gt;开拌前的：调好的芝麻酱一小碗，陈醋蒜泥一小碗，过水凉面一晚，黄瓜丝半根。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/P1060533.JPG&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/P1060533.thumb.JPG&quot; /&gt;&lt;/a&gt;&lt;br /&gt;拌好的样子，不过芝麻酱的颜色很浅，看得不是很清楚。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/P1060531.JPG&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/P1060531.thumb.JPG&quot; /&gt;&lt;/a&gt;&lt;br /&gt;剁椒木耳，木耳香脆，陈醋微酸，配上剁椒蒜泥，简单美味。&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 06 Sep 2008 00:30:10 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/99-guid.html</guid>
    <category>food</category>
<category>trashcan</category>

</item>
<item>
    <title>看图说话：Google 大爱</title>
    <link>http://blog.nulltao.net/archives/98-Google.html</link>
            <category>TrashcaN</category>
    
    <comments>http://blog.nulltao.net/archives/98-Google.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=98</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://blog.nulltao.net/rss.php?version=2.0&amp;type=comments&amp;cid=98</wfw:commentRss>
    

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;近三天 Google 颇为奇怪，RSS Reader 速度爆慢不说，还经常动不动就自己转向 Chrome 的一个介绍幻灯片的网站，难道 Google 知道偶不会这么快就用他的 Chrome，就用这种方式强迫我？&lt;/p&gt;
&lt;p&gt;问了其他的几个用 RSS Reader 的朋友，都木有这种问题，怪哉。&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/greader1.png&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/greader1.thumb.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;RSS Reader 自动跳转……仔细看地址栏、Tab 标签标题和状态栏……&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/greader2.png&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/greader2.thumb.png&quot; /&gt;&lt;/a&gt;&lt;br /&gt;跳转后的 Slides，真丑……&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sat, 06 Sep 2008 00:19:13 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/98-guid.html</guid>
    <category>google</category>
<category>trashcan</category>

</item>
<item>
    <title>一个 # 不够，那么就多来几个吧</title>
    <link>http://blog.nulltao.net/archives/97-unknown.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/97-unknown.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=97</wfw:comment>

    <slash:comments>3</slash:comments>
    <wfw:commentRss>http://blog.nulltao.net/rss.php?version=2.0&amp;type=comments&amp;cid=97</wfw:commentRss>
    

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;网页中经常要做的一件事情就是让一个链接来执行一个 JavaScript 脚本，例如：&lt;code&gt;&amp;lt; href=&quot;#&quot; onClick=&quot;some_js_here();&quot;&amp;gt;Some text&amp;lt;/a&amp;gt;&lt;/code&gt;，不过这样的副作用是因为有 &lt;code&gt;href=&quot;#&quot;&lt;/code&gt;。所以导致点击完后页面会滚动到最上面。&lt;/p&gt;
&lt;p&gt;以前用的几种解决方案：&lt;/p&gt;&lt;ul&gt;
&lt;li&gt;不写 href，这样会导致很多浏览器不会把 a 标签按照你预期的方式渲染；&lt;/li&gt;
&lt;li&gt;在href 里面直接写 JavaScript 脚本，这样不完全符合 W3C 的规范。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;其实要解决这个问题，不让浏览器把页面滚动到最上面，很简单，&lt;code&gt;href=&quot;&quot;&lt;/code&gt; 里面 多写几个 # 就行了，我一般用 6 个比较保险，这个方法适用于 IE5、IE6、IE7、FF2、FF3。虽然不知道为什么但是很好用。猜测是因为 # 表示进行页内书签的跳转，但是多个 # 浏览器就不知道什么意思了，干脆罢工好了，哈哈。&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 03 Sep 2008 15:15:11 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/97-guid.html</guid>
    <category>html</category>
<category>technique</category>
<category>tip</category>

</item>
<item>
    <title>加入了原创博客联盟</title>
    <link>http://blog.nulltao.net/archives/96-unknown.html</link>
            <category>TrashcaN</category>
    
    <comments>http://blog.nulltao.net/archives/96-unknown.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=96</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.nulltao.net/rss.php?version=2.0&amp;type=comments&amp;cid=96</wfw:commentRss>
    

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/oblogger.org/&#039;);&quot;  href=&quot;http://oblogger.org/&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://oblogger.org/img/8831w.png&quot; border=&quot;0&quot; /&gt;&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 28 Aug 2008 18:40:33 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/96-guid.html</guid>
    <category>oblogger</category>
<category>trashcan</category>

</item>
<item>
    <title>地图聚合的数据格式前三名：KML、GeoRSS 和 GeoJSON</title>
    <link>http://blog.nulltao.net/archives/95-KMLGeoRSS-GeoJSON.html</link>
            <category>TranslatioN</category>
    
    <comments>http://blog.nulltao.net/archives/95-KMLGeoRSS-GeoJSON.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=95</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.nulltao.net/rss.php?version=2.0&amp;type=comments&amp;cid=95</wfw:commentRss>
    

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;原文地址：&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/blog.programmableweb.com/2008/08/27/3-top-data-formats-for-map-mashups-kml-georss-and-geojson/&#039;);&quot;  href=&quot;http://blog.programmableweb.com/2008/08/27/3-top-data-formats-for-map-mashups-kml-georss-and-geojson/&quot; target=&quot;_blank&quot;&gt;3 Top Data Formats for Map Mashups: KML, GeoRSS and GeoJSON&lt;/a&gt;。&lt;/p&gt;
&lt;hr /&gt;

&lt;p&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.programmableweb.com/mapping&#039;);&quot;  title=&quot;ProgrammableWeb&quot; href=&quot;http://www.programmableweb.com/mapping&quot;&gt;&lt;img src=&quot;http://www.programmableweb.com/images/apis/at22.png&quot; alt=&quot;&quot;&gt;&lt;/a&gt; 随着地图聚合给最终用户提供的一系列更广泛的工具和应用程序，它在完善程度和功能性两方面逐渐走向成熟。 因此，我们需要一些预定义好的方法在传统的地理空间数据和新一代的&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.programmableweb.com/mapping&#039;);&quot;  href=&quot;http://www.programmableweb.com/mapping&quot;&gt;地图聚合&lt;/a&gt;之间交换、发布这些地理空间数据，并且使用一种对 web 友好的方式使用这些数据。&lt;/p&gt;
&lt;p&gt;为了满足这种需求，出现了一些新的地理空间数据格式，这能够让更大范围的用户和开发者来聚合地理相关的信息。 下面是当前可供从事地理信息聚合的开发者使用的三种主要数据格式的一个概括：&lt;/p&gt;
&lt;h3&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/code.google.com/apis/kml/&#039;);&quot;  href=&quot;http://code.google.com/apis/kml/&quot;&gt;KML&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;你知道 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/earth.google.com&#039;);&quot;  href=&quot;http://earth.google.com&quot;&gt;Google 地球&lt;/a&gt;的前身，那个流行的名为 Keyhole 的三维地球浏览器吗？ 如果你知道，那么这个基于 XML 的，Google 地球自己的文件格式被叫做 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/code.google.com/apis/kml/&#039;);&quot;  href=&quot;http://code.google.com/apis/kml/&quot;&gt;KML&lt;/a&gt;，意为 Keyhole 标记语言，就不值得惊讶了。 在地理空间相关的网站上，KML 无处不在，KML 支持从类似 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.programmableweb.com/api/google-maps&#039;);&quot;  href=&quot;http://www.programmableweb.com/api/google-maps&quot;&gt;Google 地图&lt;/a&gt;、微软的&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.programmableweb.com/api/microsoft-virtual-earth&#039;);&quot;  href=&quot;http://www.programmableweb.com/api/microsoft-virtual-earth&quot;&gt;虚拟地球&lt;/a&gt;这样商业化的地图 API 和 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.programmableweb.com/api/openlayers&#039;);&quot;  href=&quot;http://www.programmableweb.com/api/openlayers&quot;&gt;OpenLayers&lt;/a&gt; 这样开源的地图 API 中导入、导出数据。 今年早些时候，Google 把 KML 作为一种开放标准发布，并且被开放地理空间联盟 (OGC) 采用。 你可以研读&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/code.google.com/apis/kml/documentation/kmlreference.html&#039;);&quot;  href=&quot;http://code.google.com/apis/kml/documentation/kmlreference.html&quot;&gt;最新的 KML 规范&lt;/a&gt; (当前是 2.2 版) 或者学习如何让 KML 与 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/code.google.com/apis/maps/documentation/reference.html#GGeoXml&#039;);&quot;  href=&quot;http://code.google.com/apis/maps/documentation/reference.html#GGeoXml&quot;&gt;Google 地图 API&lt;/a&gt;、&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/blogs.msdn.com/keithkin/archive/2007/11/20/virtual-earth-api-adding-kml-or-georss-layers-to-the-map.aspx&#039;);&quot;  href=&quot;http://blogs.msdn.com/keithkin/archive/2007/11/20/virtual-earth-api-adding-kml-or-georss-layers-to-the-map.aspx&quot;&gt;虚拟地球&lt;/a&gt;或者 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/dev.openlayers.org/releases/OpenLayers-2.6/doc/apidocs/files/OpenLayers/Format/KML-js.html&#039;);&quot;  href=&quot;http://dev.openlayers.org/releases/OpenLayers-2.6/doc/apidocs/files/OpenLayers/Format/KML-js.html&quot;&gt;OpenLayers&lt;/a&gt; 集成。&lt;/p&gt;
&lt;h3&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/georss.org/&#039;);&quot;  href=&quot;http://georss.org/&quot;&gt;GeoRSS&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/georss.org/&#039;);&quot;  href=&quot;http://georss.org/&quot;&gt;GeoRSS&lt;/a&gt; 提供了一种在 RSS (或者 Atom) 种子里通过特定的编码来包含地理参考信息的方法。GeoRSS 站点上说：&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;RSS 和 Atom 作为一种发布、共享信息的方法，正在逐渐流行起来， 因此，使用互操作的方式描述位置信息，来让程序能够请求、聚合、共享、地图化地理标记过的种子变得益发重要。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;嵌入 &lt;a class=&quot;bodytag&quot; target=&quot;_blank&quot; href=&quot;http://blog.nulltao.net/articles/tag/GeoRSS&quot;&gt;&lt;em&gt;GeoRSS&lt;/em&gt;&lt;/a&gt; 非常简单，仅仅在每个条目中增加一个类似 &lt;code&gt;&amp;lt;georss:point&amp;gt;45.256 -71.92&amp;lt;/georss:point&amp;gt; 这样的元素就行了，这里使用的是&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/georss.org/simple&#039;);&quot;  href=&quot;http://georss.org/simple&quot;&gt;简易GeoRSS&lt;/a&gt; 格式， 如果要需要复杂完整的编码格式，可以选择支持更多的特性的 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/georss.org/gml&#039;);&quot;  href=&quot;http://georss.org/gml&quot;&gt;GeoRSS-GML&lt;/a&gt; 格式。这两种 GeoRSS 格式都支持基本的地理特征 (点、线、边框和多边形)。 和 KML 一样，商业化的地图 API 和开源地图 API 都支持 GeoRSS，并且主要作为导入数据的格式使用。 GeoRSS 许诺对整合内容的会有更好的支持。&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/geojson.org&#039;);&quot;  href=&quot;http://geojson.org&quot;&gt;GeoJSON&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/geojson.org&#039;);&quot;  href=&quot;http://geojson.org&quot;&gt;GeoJSON&lt;/a&gt; 是基于 JavaScript 对象表示法 (JSON)的一种新的数据格式，用来对大量的地理特征进行编码，支持的地理特征有点、线、多边形、多多边形和地理信息集合。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;{ &quot;type&quot;: &quot;Point&quot;, &quot;coordinates&quot;: [43.542, -118.454] }&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class=&quot;bodytag&quot; target=&quot;_blank&quot; href=&quot;http://blog.nulltao.net/articles/tag/GeoJSON&quot;&gt;&lt;em&gt;GeoJSON&lt;/em&gt;&lt;/a&gt; 可以被 JavaScript 简单、快速的解析，而且 GeoJSON 还提供了一个可以很容易的进行交换的轻量级数据格式。 自从 GeoJSON 正式发表 1.0 版后，GeoJSON 的魅力逐渐增加，得到了包括 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.programmableweb.com/api/fire-eagle&#039;);&quot;  href=&quot;http://www.programmableweb.com/api/fire-eagle&quot;&gt;FireEagle&lt;/a&gt; 和 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.programmableweb.com/api/openlayers&#039;);&quot;  href=&quot;http://www.programmableweb.com/api/openlayers&quot;&gt;OpenLayers&lt;/a&gt; 在内的一些流行的 API 的支持 (但是不确定将来是否能够得到类似 Google 地图或者虚拟地球这样的商业 API 的支持)。&lt;/p&gt;
&lt;p&gt;注意 &lt;a class=&quot;bodytag&quot; target=&quot;_blank&quot; href=&quot;http://blog.nulltao.net/articles/tag/GeoRSS&quot;&gt;&lt;em&gt;GeoRSS&lt;/em&gt;&lt;/a&gt; 和 &lt;a class=&quot;bodytag&quot; target=&quot;_blank&quot; href=&quot;http://blog.nulltao.net/articles/tag/GeoJSON&quot;&gt;&lt;em&gt;GeoJSON&lt;/em&gt;&lt;/a&gt; 都采用创作共用授权协议授权。&lt;/p&gt;
&lt;p&gt;我们饶有兴趣的看着这些格式如何发展，而且很想知道类似 &lt;a class=&quot;bodytag&quot; target=&quot;_blank&quot; href=&quot;http://blog.nulltao.net/articles/tag/GeoRSS&quot;&gt;&lt;em&gt;GeoRSS&lt;/em&gt;&lt;/a&gt; 和 &lt;a class=&quot;bodytag&quot; target=&quot;_blank&quot; href=&quot;http://blog.nulltao.net/articles/tag/GeoJSON&quot;&gt;&lt;em&gt;GeoJSON&lt;/em&gt;&lt;/a&gt; 这样的格式能否得到&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.programmableweb.com/apis/directory/1?apicat=Mapping&#039;);&quot;  href=&quot;http://www.programmableweb.com/apis/directory/1?apicat=Mapping&quot;&gt;地图 API&lt;/a&gt; 和地图聚合开发者的采用。&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 28 Aug 2008 18:34:37 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/95-guid.html</guid>
    <category>geojson</category>
<category>georss</category>
<category>kml</category>
<category>map</category>
<category>mashup</category>
<category>translation</category>

</item>
<item>
    <title>解决 propel-convert-xml-schema 把 null 默认值处理为字符串的问题</title>
    <link>http://blog.nulltao.net/archives/94-propel-convert-xml-schema-null.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/94-propel-convert-xml-schema-null.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=94</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.nulltao.net/rss.php?version=2.0&amp;type=comments&amp;cid=94</wfw:commentRss>
    

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;通过 propel-convert-xml-schema 把 xml schema 转化成 PHP 代码的时候，如果一个字符型字段不能为空且没有明确输入默认值，例如：&lt;/p&gt;
&lt;div class=&quot;xml&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;column&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;username&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;type&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;VARCHAR&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;size&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;128&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;required&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;default&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;生成的 PHP 代码中该字段的默认值是 &#039;null&#039; 而不是 null，导致页面输入框的默认值不是空值，而是一个字符串的 null，很恼火。因为要么在页面中每个字段都对 &#039;null&#039; 做特殊处理，要么修改生成的 PHP 类文件，但是一旦重新执行 propel-convert-xml-schema 就会重新覆盖。&lt;/p&gt;
&lt;p&gt;解决办法：修改 &lt;code&gt;propel-generator/classes/propel/phing/PropelCreoleTransformTask.php&lt;/code&gt; 文件（对于 Symfony 来说，就是 &lt;code&gt;symfony/vendor/propel-generator/classes/propel/phing/PropelCreoleTransformTask.php&lt;/code&gt;）。应用如下 patch：&lt;/p&gt;
&lt;div class=&quot;diff&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #440088;&quot;&gt;&lt;span style=&quot;&quot;&gt;507&lt;/span&gt;,510c507&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #991111;&quot;&gt;&amp;lt; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; //$node-&amp;gt;setAttribute&lt;span style=&quot;&quot;&gt;&amp;#40;&lt;/span&gt;&amp;quot;default&amp;quot;, iconv&lt;span style=&quot;&quot;&gt;&amp;#40;&lt;/span&gt;$this-&amp;gt;dbEncoding, &#039;utf&lt;span style=&quot;&quot;&gt;-8&lt;/span&gt;&#039;, $defValue&lt;span style=&quot;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #991111;&quot;&gt;&amp;lt; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; if&lt;span style=&quot;&quot;&gt;&amp;#40;&lt;/span&gt;!empty&lt;span style=&quot;&quot;&gt;&amp;#40;&lt;/span&gt;$defValue&lt;span style=&quot;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #991111;&quot;&gt;&amp;lt; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; $node-&amp;gt;setAttribute&lt;span style=&quot;&quot;&gt;&amp;#40;&lt;/span&gt;&amp;quot;default&amp;quot;, iconv&lt;span style=&quot;&quot;&gt;&amp;#40;&lt;/span&gt;$this-&amp;gt;dbEncoding, &#039;utf&lt;span style=&quot;&quot;&gt;-8&lt;/span&gt;&#039;, $defValue&lt;span style=&quot;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #991111;&quot;&gt;&amp;lt; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #888822;&quot;&gt;---&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #00b000;&quot;&gt;&amp;gt; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; $node-&amp;gt;setAttribute&lt;span style=&quot;&quot;&gt;&amp;#40;&lt;/span&gt;&amp;quot;default&amp;quot;, iconv&lt;span style=&quot;&quot;&gt;&amp;#40;&lt;/span&gt;$this-&amp;gt;dbEncoding, &#039;utf&lt;span style=&quot;&quot;&gt;-8&lt;/span&gt;&#039;, $defValue&lt;span style=&quot;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;参见：&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/trac.symfony-project.org/ticket/2045&#039;);&quot;  href=&quot;http://trac.symfony-project.org/ticket/2045&quot; target=&quot;_blank&quot;&gt;#2045 (propel-convert-xml-schema generate null text as default values) - symfony - Trac&lt;/a&gt;。&lt;/p&gt;
&lt;p&gt;下载：&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/PropelCreoleTransformTask.7z&quot;&gt;PropelCreoleTransformTask.7z&lt;/a&gt;。&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 21 Aug 2008 11:32:56 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/94-guid.html</guid>
    <category>bug</category>
<category>php</category>
<category>propel</category>
<category>symfony</category>
<category>technique</category>

</item>
<item>
    <title>在 Symfony 中结合使用 Structures/DataGrid、sfSmartView、Propel</title>
    <link>http://blog.nulltao.net/archives/93-Symfony-StructuresDataGridsfSmartViewPropel.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/93-Symfony-StructuresDataGridsfSmartViewPropel.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=93</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.nulltao.net/rss.php?version=2.0&amp;type=comments&amp;cid=93</wfw:commentRss>
    

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;今天需要在 &lt;code&gt;symfony&lt;/code&gt; 中使用 datagrid 型控件对一个分页+排序的表格进行展示。但是 &lt;code&gt;sfDataGrid&lt;/code&gt; 写得实在是太糟糕了，没有找到其他的比较好的 plugin。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;PEAR&lt;/code&gt; 中的 &lt;code&gt;Structures/DataGrid&lt;/code&gt; 倒是不错。但是两个问题：无法和现在偶使用的 &lt;code&gt;sfSmartyView&lt;/code&gt; 直接结合，因为在 &lt;code&gt;$datagrid-&gt;fill($smarty);&lt;/code&gt; 的时候，&lt;code&gt;symfony&lt;/code&gt; 还没有生成 view instance，除非直接获取生成的 HTML_TABLE 或者类似的结果，这样不利于 MVC 的分离和对具体样式的控制；二是现有的 &lt;code&gt;datasource&lt;/code&gt; 无法和 &lt;code&gt;symfony&lt;/code&gt; 使用的 &lt;code&gt;propel&lt;/code&gt; 直接结合，如果采用检索全部结果再传递给 &lt;code&gt;Structures/DataGrid&lt;/code&gt; 进行分页处理，那么效率非常低下。&lt;/p&gt;
&lt;p&gt;于是自己写一个 &lt;code&gt;datasource&lt;/code&gt;，并且使用了一点技巧解决和 &lt;code&gt;sfSmartyView&lt;/code&gt; 结合的问题。&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Structures_DataGrid_DataSource_Propel&lt;/code&gt; 类的定义：&lt;/p&gt;
&lt;div class=&quot;php&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;class&lt;/span&gt; Structures_DataGrid_DataSource_Propel &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;extends&lt;/span&gt; Structures_DataGrid_DataSource &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; protected &lt;span style=&quot;color: #0000ff;&quot;&gt;$criteria&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; protected &lt;span style=&quot;color: #0000ff;&quot;&gt;$con&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; protected &lt;span style=&quot;color: #0000ff;&quot;&gt;$object&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; __construct&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$object&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$criteria&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$con&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; parent::&lt;span style=&quot;color: #006600;&quot;&gt;Structures_DataGrid_DataSource&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;object&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$object&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;criteria&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$criteria&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;con&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$con&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.php.net/count&#039;);&quot;  href=&quot;http://www.php.net/count&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;count&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;//TODO: this is not a good way, due to MySQL Bug #21787&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;criteria&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setLimit&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;criteria&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setOffset&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;object&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;doCount&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;criteria&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.php.net/sort&#039;);&quot;  href=&quot;http://www.php.net/sort&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;sort&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$sortSpec&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$sortDir&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;ASC&#039;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;switch&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.php.net/strtolower&#039;);&quot;  href=&quot;http://www.php.net/strtolower&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;strtolower&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$sortDir&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;asc&#039;&lt;/span&gt; :&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;criteria&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;addAscendingOrderByColumn&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$sortSpec&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;case&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;desc&#039;&lt;/span&gt; :&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;criteria&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;addDescendingOrderByColumn&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$sortSpec&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;break&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;default&lt;/span&gt; :&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; PEAR::&lt;span style=&quot;color: #006600;&quot;&gt;raiseError&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Sorting dir must be ASC or DESC!&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;true&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; fetch&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$offset&lt;/span&gt; = &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$len&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$c&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;criteria&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$c&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setOffset&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$offset&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;! &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.php.net/is_null&#039;);&quot;  href=&quot;http://www.php.net/is_null&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;is_null&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$len&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$c&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setLimit&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$len&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$objects&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;object&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;doSelect&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$c&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt; = &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.php.net/array&#039;);&quot;  href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;foreach&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$objects&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$object&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$object&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;toArray&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;BasePeer::&lt;span style=&quot;color: #006600;&quot;&gt;TYPE_COLNAME&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$result&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;&lt;code&gt;action&lt;/code&gt; 中的代码段：&lt;/p&gt;
&lt;div class=&quot;php&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;function&lt;/span&gt; execute&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// get data source&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$c&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Criteria&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$datasource&lt;/span&gt; = &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Structures_DataGrid_DataSource_Propel&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;SysUiaAccountPeer&#039;&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$c&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// setup datagrid&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$datagrid&lt;/span&gt; = &amp;amp; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Structures_DataGrid&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$datagrid&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;bindDataSource&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$datasource&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$datagrid&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setDefaultSort&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.php.net/array&#039;);&quot;  href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; SysUiaAccountPeer::&lt;span style=&quot;color: #006600;&quot;&gt;USERNAME&lt;/span&gt;=&amp;gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;DESC&amp;quot;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$datagrid&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;addColumn&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;new&lt;/span&gt; Structures_DataGrid_Column&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;用户名&#039;&lt;/span&gt;, SysUiaAccountPeer::&lt;span style=&quot;color: #006600;&quot;&gt;USERNAME&lt;/span&gt;, SysUiaAccountPeer::&lt;span style=&quot;color: #006600;&quot;&gt;USERNAME&lt;/span&gt;, &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.php.net/array&#039;);&quot;  href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;&amp;amp;nbsp;&#039;&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;&#039;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// add more columns here&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// use a tip to get output using smarty&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$smarty&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$datagrid&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;setRenderer&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;smarty&#039;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;// set pager params&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$pager&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$smarty&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;smartyGetPaging&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.php.net/array&#039;);&quot;  href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;prevImg&#039;&lt;/span&gt;=&amp;gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;上一页&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;nextImg&#039;&lt;/span&gt;=&amp;gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;下一页&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;separator&#039;&lt;/span&gt;=&amp;gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;|&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;delta&#039;&lt;/span&gt;=&amp;gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;5&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;clearIfVoid&#039;&lt;/span&gt;=&amp;gt;true, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;spacesBeforeSeparator&#039;&lt;/span&gt;=&amp;gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;1&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;spacesAfterSeparator&#039;&lt;/span&gt;=&amp;gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;1&amp;quot;&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;firstPageText&#039;&lt;/span&gt;=&amp;gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;第一页&#039;&lt;/span&gt;, &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;lastPageText&#039;&lt;/span&gt;=&amp;gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;最后页&#039;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$smarty&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;dg&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$datagrid&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;getOutput&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$this&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;pager&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$pager&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;return&lt;/span&gt; sfView::&lt;span style=&quot;color: #006600;&quot;&gt;SUCCESS&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;模板中的处理：&lt;/p&gt;
&lt;div class=&quot;html4strict&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/december.com/html/4/element/table.html&#039;);&quot;  href=&quot;http://december.com/html/4/element/table.html&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;table&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;&amp;lt;!-- Build header --&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/december.com/html/4/element/tr.html&#039;);&quot;  href=&quot;http://december.com/html/4/element/tr.html&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; {section name=col loop=$dg.columnSet}&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/december.com/html/4/element/th.html&#039;);&quot;  href=&quot;http://december.com/html/4/element/th.html&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;th&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;$dg.columnSet&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;col&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;.attributes&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;&amp;lt;!-- Check if the column is sortable --&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; {if $dg.columnSet[col].link != &amp;quot;&amp;quot;} &lt;span style=&quot;color: #009900;&quot;&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/december.com/html/4/element/a.html&#039;);&quot;  href=&quot;http://december.com/html/4/element/a.html&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;a&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #000066;&quot;&gt;href&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;{$dg.columnSet[col].link}&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;{$dg.columnSet[col].label}&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/a&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;&amp;lt;!-- Show the current ordering with an arrow --&amp;gt;&lt;/span&gt;&lt;/span&gt; {if&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; $dg.columnSet[col].name == $smarty.request.orderBy} {if&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; $smarty.request.direction == &amp;quot;ASC&amp;quot;}&lt;span style=&quot;color: #ddbb00;&quot;&gt;&amp;amp;uarr;&lt;/span&gt;{elseif&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; $smarty.request.direction == &amp;quot;DESC&amp;quot;}&lt;span style=&quot;color: #ddbb00;&quot;&gt;&amp;amp;darr;&lt;/span&gt;{/if} {/if} {else}&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; {$dg.columnSet[col].label} {/if}&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/th&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; {/section}&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;&amp;lt;!-- Build body --&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; {section name=row loop=$dg.recordSet}&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/december.com/html/4/element/tr.html&#039;);&quot;  href=&quot;http://december.com/html/4/element/tr.html&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;tr&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;if $smarty.section.row.iteration is even&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000066;&quot;&gt;bgcolor&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;#EEEEEE&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;/if&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; {section name=col loop=$dg.recordSet[row]}&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/december.com/html/4/element/td.html&#039;);&quot;  href=&quot;http://december.com/html/4/element/td.html&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;td&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;$columnSet&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;col&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;.attributes&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;{$dg.recordSet[row][col]}&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; {/section}&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; {/section}&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/december.com/html/4/element/tr.html&#039;);&quot;  href=&quot;http://december.com/html/4/element/tr.html&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;tr&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/december.com/html/4/element/td.html&#039;);&quot;  href=&quot;http://december.com/html/4/element/td.html&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;td&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #000066;&quot;&gt;colspan&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;...&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;{$pager}&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/td&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/tr&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/table&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt; 
    </content:encoded>

    <pubDate>Mon, 18 Aug 2008 00:15:50 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/93-guid.html</guid>
    <category>datagrid</category>
<category>symfony</category>
<category>technique</category>

</item>
<item>
    <title>MySQL 对于 COUNT(*) 和 LIMIT 同时使用的 BUG  </title>
    <link>http://blog.nulltao.net/archives/92-MySQL-COUNT-LIMIT-BUG.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/92-MySQL-COUNT-LIMIT-BUG.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=92</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.nulltao.net/rss.php?version=2.0&amp;type=comments&amp;cid=92</wfw:commentRss>
    

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;对一个有 29 条记录的表进行如下操作：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;div class=&quot;sql&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; COUNT&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; sys_uia_account.ID &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; sys_uia_account&lt;/div&gt;结果 29&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;sql&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; COUNT&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; sys_uia_account.ID &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; sys_uia_account &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;LIMIT&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;10&lt;/span&gt;&lt;/div&gt;结果 29&lt;/li&gt;
&lt;li&gt;&lt;div class=&quot;sql&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; COUNT&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; sys_uia_account.ID &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; sys_uia_account &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;LIMIT&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;10&lt;/span&gt; , &lt;span style=&quot;color: #cc66cc;&quot;&gt;10&lt;/span&gt;&lt;/div&gt;没有结果&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;看来以后使用 &lt;code&gt;COUNT(*)&lt;/code&gt; 的时候不能同时使用 &lt;code&gt;LIMIT offset, row_count&lt;/code&gt; 这种表达方式了。&lt;/p&gt;
&lt;p&gt;PS：如果统计全表记录，使用下面的方法会更加快捷：&lt;/p&gt;
&lt;div class=&quot;sql&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; SQL_CALC_FOUND_ROWS *&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; sys_uia_account;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; FOUND_ROWS&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; ;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;唯一需要注意的就是，这两个查询必须在一起进行，因为 &lt;code&gt;SQL_CALC_FOUND_ROWS&lt;/code&gt; 不对结果进行任何缓存。&lt;/p&gt; 
    </content:encoded>

    <pubDate>Sun, 17 Aug 2008 23:53:05 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/92-guid.html</guid>
    <category>bug</category>
<category>mysql</category>
<category>technique</category>
<category>tip</category>

</item>
<item>
    <title>MySQL 中用 GKB 来让 UTF-8 字段中的中文按照拼音排序</title>
    <link>http://blog.nulltao.net/archives/91-MySQL-GKB-UTF-8.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/91-MySQL-GKB-UTF-8.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=91</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.nulltao.net/rss.php?version=2.0&amp;type=comments&amp;cid=91</wfw:commentRss>
    

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;UTF-8 中的中文不是按照拼音排序的，因此对于 使用 UTF-8 编码集的字段就无法按照拼音进行排序，最简单的解决方法就是转成 GBK 编码。&lt;/p&gt;
&lt;p&gt;实例代码：&lt;div class=&quot;sql&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; *&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;`test`&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ORDER&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;BY&lt;/span&gt; CONVERT&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;`test`&lt;/span&gt;.&lt;span style=&quot;color: #ff0000;&quot;&gt;`name`&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;USING&lt;/span&gt; GBK &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;LIMIT&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; , &lt;span style=&quot;color: #cc66cc;&quot;&gt;30&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;数据库表结构：&lt;div class=&quot;sql&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TABLE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;IF&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;EXISTS&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;`test`&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;`id`&lt;/span&gt; int&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AUTO_INCREMENT&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;`name`&lt;/span&gt; varchar&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; COLLATE utf8_bin &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;,&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;PRIMARY&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;KEY&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;`id`&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; ENGINE=InnoDB &amp;#160;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; CHARSET=utf8 COLLATE=utf8_bin &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AUTO_INCREMENT&lt;/span&gt;=&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt; ;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;测试环境：Windows 2003 Standard Edition，MySQL 5.1.22-rc-community。&lt;/p&gt;
&lt;p&gt;对于偶正在使用的 Symfony 框架，因为使用了 propel 做 ORM，比较难直接操作SQL，除非使用 RAW SQL，而且使用 RAW SQL会导致很多高级特性无法使用，解决方式：&lt;div class=&quot;php&quot; style=&quot;text-align: left&quot;&gt;&lt;ol&gt;&lt;li style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; color: black; font-weight: normal; font-style: normal;&quot;&gt;&lt;div style=&quot;font-family: &#039;Courier New&#039;, Courier, monospace; font-weight: normal;&quot;&gt;&lt;span style=&quot;color: #0000ff;&quot;&gt;$criteria&lt;/span&gt;-&amp;gt;&lt;span style=&quot;color: #006600;&quot;&gt;addAscendingOrderByColumn&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;CONVERT(&#039;&lt;/span&gt; . TestPeer::&lt;span style=&quot;color: #006600;&quot;&gt;NAME&lt;/span&gt; . &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039; USING GBK)&#039;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Sat, 16 Aug 2008 15:39:24 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/91-guid.html</guid>
    <category>mysql</category>
<category>php</category>
<category>sort</category>
<category>technique</category>
<category>utf-8</category>

</item>
<item>
    <title>胡言乱语之奥运会</title>
    <link>http://blog.nulltao.net/archives/90-unknown.html</link>
            <category>TrashcaN</category>
    
    <comments>http://blog.nulltao.net/archives/90-unknown.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=90</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.nulltao.net/rss.php?version=2.0&amp;type=comments&amp;cid=90</wfw:commentRss>
    

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;ul&gt;
&lt;li&gt;在偶看来，奥运会就是一群没有大脑的国人庆祝自己纳的税被浪费掉还欢呼鼓掌发自肺腑的庆祝的脑残盛会。&lt;/li&gt;
&lt;li&gt;本来说不看开幕式的，不过想想还是看看吧。看看张艺谋这次是怎么糟蹋中国文化的。&lt;/li&gt;
&lt;/ul&gt; 
    </content:encoded>

    <pubDate>Fri, 08 Aug 2008 13:07:49 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/90-guid.html</guid>
    <category>olympic</category>
<category>trashcan</category>

</item>
<item>
    <title>让 Firefox3 支持 Flash</title>
    <link>http://blog.nulltao.net/archives/89-Firefox3-Flash.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/89-Firefox3-Flash.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=89</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://blog.nulltao.net/rss.php?version=2.0&amp;type=comments&amp;cid=89</wfw:commentRss>
    

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;Firefox3 在 beta 和 RC 阶段对 Flash 支持的不好是臭名昭著，用 Google 随便搜索 Firefox3+Flash 看看结果就知道了。&lt;/p&gt;
&lt;p&gt;Beata 和 RC 不支持吧。还能说是 bug，今天正式版发布，居然还是不支持，这就说不过去啦。用 Firefox 内嵌的 addons 管理机制安装 Flash 从来就木有成功过。&lt;/p&gt;
&lt;p&gt;最后用如下方法才安装成功：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;下载 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/fpdownload.macromedia.com/get/flashplayer/current/uninstall_flash_player.exe&#039;);&quot;  href=&quot;http://fpdownload.macromedia.com/get/flashplayer/current/uninstall_flash_player.exe&quot; target=&quot;_blank&quot;&gt;Adobe 官方的 FLash 卸载程序&lt;/a&gt;；&lt;/li&gt;
&lt;li&gt;下载 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/fpdownload.macromedia.com/get/flashplayer/current/install_flash_player.exe&#039;);&quot;  href=&quot;http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player.exe&quot; target=&quot;_blank&quot;&gt;Adobe 官方的 Flash 安装程序&lt;/a&gt;；&lt;/li&gt;
&lt;li&gt;关闭 Firefox；&lt;/li&gt;
&lt;li&gt;运行卸载程序，再运行安装程序；&lt;/li&gt;
&lt;li&gt;如果有必须要，则&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/support.mozilla.com/en-US/kb/Troubleshooting+plugins#Re_initializing_the_plugins_database&#039;);&quot;  href=&quot;http://support.mozilla.com/en-US/kb/Troubleshooting+plugins#Re_initializing_the_plugins_database&quot; target=&quot;_blank&quot;&gt;重建 Firefox 插件数据库&lt;/a&gt;。&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;最后一步不是必需的，至少偶就木有用到。&lt;/p&gt;
&lt;p&gt;现在终于能够看到满屏的 Flash 了……下一步，安装 flashblock 插件屏幕它们～hiahia～～&lt;/p&gt;
&lt;p&gt;参考：&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/support.mozilla.com/tiki-view_forum_thread.php?forumId=1&amp;amp;comments_parentId=10088&#039;);&quot;  href=&quot;http://support.mozilla.com/tiki-view_forum_thread.php?forumId=1&amp;comments_parentId=10088&quot; target=&quot;_blank&quot;&gt;FIrefox 3 and Flash pluggins &lt;/a&gt;。&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 18 Jun 2008 11:49:37 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/89-guid.html</guid>
    <category>firefox</category>
<category>flash</category>
<category>technique</category>
<category>tip</category>

</item>
<item>
    <title>做好准备迎接新的平台大战。Google Gears 直指微软领地</title>
    <link>http://blog.nulltao.net/archives/88-Google-Gears.html</link>
            <category>TranslatioN</category>
    
    <comments>http://blog.nulltao.net/archives/88-Google-Gears.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=88</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.nulltao.net/rss.php?version=2.0&amp;type=comments&amp;cid=88</wfw:commentRss>
    

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;原文：&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.techcrunch.com/2008/06/13/google-drives-towards-microsoft-and-adobe-with-gears/&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.techcrunch.com/2008/06/13/google-drives-towards-microsoft-and-adobe-with-gears/&quot;&gt;Get Ready For A New Platform War. Google Gears Drives Straight At Microsoft’s Profits.&lt;/a&gt;。&lt;/p&gt;
	&lt;hr /&gt;
	&lt;p&gt;&lt;img width=&quot;244&quot; height=&quot;158&quot; border=&quot;0&quot; src=&quot;http://www.techcrunch.com/wp-content/nextgenweb2.jpg&quot; alt=&quot;lame_logo&quot; style=&quot;border-width: 0px; float: left;&quot;/&gt; &lt;/p&gt;
	&lt;p&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/crunchbase.com/company/google&#039;);&quot;  href=&quot;http://crunchbase.com/company/google&quot; target=&quot;_blank&quot;&gt;Google&lt;/a&gt; 在去年五月发布了 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.crunchbase.com/product/google-gears&#039;);&quot;  href=&quot;http://www.crunchbase.com/product/google-gears&quot; target=&quot;_blank&quot;&gt;Gears&lt;/a&gt;，之后的一年里 Gears 被认为是一个小众产品，只会有很少开发者和用户用它来开发能够离线访问的 web 程序。兴许你还能回想起当年的争论：在到处都有网络连接的情况下，究竟谁需要离线访问功能，而且还没有足够的程序支持，等等。不到一年的时间，就在几周前，Google 亮出了他的王牌：&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.techcrunch.com/2008/05/28/myspace-shows-facebook-how-its-done-google-gears-to-power-messaging/&#039;);&quot;  href=&quot;http://www.techcrunch.com/2008/05/28/myspace-shows-facebook-how-its-done-google-gears-to-power-messaging/&quot; target=&quot;_blank&quot;&gt;Gears 助力 MySpace 加速邮件系统&lt;/a&gt;。其实 Google 早就加入了这场提供新 web API 的比赛，但是居然一年了都没有人注意到。&lt;/p&gt;
	&lt;p&gt;将来的浏览器很可能会变成运行所有程序的虚拟机。在这种情况下，操作系统会变的透明，就像 Adobe 所作的，它的 Flash 技术是现在使用的最普遍、最统一的 web 虚拟机，而微软则要自保（它的利润的来源）了。Google 不隐瞒他们想瞄准并且攻击微软的野心，他们知道，要做到这点的最好方法就是上移一层把操作系统架空，让浏览器成为标准且强劲的应用程序虚拟机。&lt;/p&gt;
&lt;p&gt;很难在一片评论里表达清楚 Gears 如何改变并且增加 web 程序的功能。以前使用基于浏览器的 Javascript 脚本，&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/myspace.com&#039;);&quot;  href=&quot;http://myspace.com&quot; target=&quot;_blank&quot;&gt;MySpace&lt;/a&gt; 中的一些类似邮件列表和排序、根据好友列表过滤这样的功能会让人感觉很慢，而当浏览器向服务器发送多个请求时，进度条还可能会定住，沙漏图标在不停的旋转。而现在，安装 Gears 只要在确认框点击一下并且等待几秒钟，安装之后，以前让用户抓狂的那些功能现在感觉起来就好象是浏览器自带功能一样。Google 给我们秀了一把 Gears 与 MySpace 集成后的能力，这唤醒了大部分人关注他真正的意图：不再仅是离线浏览，而是直接针对 Adobe 和微软所采取的行动。&lt;/p&gt;
&lt;p&gt;截至目前为止，Google 拥有一系列共计 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.google.com.au/options/index.html&#039;);&quot;  href=&quot;http://www.google.com.au/options/index.html&quot; target=&quot;_blank&quot;&gt;28 个&lt;/a&gt;基于 web 的程序, 这些程序在全世界有数百万的用户。Google 开发 web 程序的技术都是基于标准的 HTML、CSS 和 Javascript。选择 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/en.wikipedia.org/wiki/Ajax&#039;);&quot;  href=&quot;http://en.wikipedia.org/wiki/Ajax&quot; target=&quot;_blank&quot;&gt;Ajax&lt;/a&gt; 仅仅是因为这是最好的解决方案，但是 Google 还要做更多以面对现实，那就是每个类似的 web 开发技术体系都是被一个&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/crunchbase.com/company/microsoft&#039;);&quot;  href=&quot;http://crunchbase.com/company/microsoft&quot; target=&quot;_blank&quot;&gt;直接&lt;/a&gt;的&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/crunchbase.com/company/adobe&#039;);&quot;  href=&quot;http://crunchbase.com/company/adobe&quot; target=&quot;_blank&quot;&gt;竞争者&lt;/a&gt;所开发、控制。Google 对开源浏览器 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.getfirefox.com&#039;);&quot;  href=&quot;http://www.getfirefox.com&quot; target=&quot;_blank&quot;&gt;Firefox&lt;/a&gt; 的开发给予了强大的支持，并且支持开放 web 标准作为他们的技术体系之选。Google 这么做是因为他们的 web 程序都依赖于开放标准，Firefox 的失败会导致 Internet Explorer 复生并且把 web 的控制权拱手让给微软。&lt;/p&gt;
&lt;p&gt;以前，只用基于浏览器的 Javascript 来支持 web 程序对 Google 来说不是个问题。直到竞争者领先一步发布了他们自己的第二代 web 平台，分别是 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/en.wikipedia.org/wiki/Flex&#039;);&quot;  href=&quot;http://en.wikipedia.org/wiki/Flex&quot; target=&quot;_blank&quot;&gt;Flex/AIR&lt;/a&gt; 和 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/crunchbase.com/product/silverlight&#039;);&quot;  href=&quot;http://crunchbase.com/product/silverlight&quot; target=&quot;_blank&quot;&gt;Silverlight&lt;/a&gt;，情况才发生了变化。基于 web 的程序在有了类桌面的界面和功能后能够做什么，从这一方面开说，微软和 Adobe 已经超前了一大步。用不了多久，大大小小的竞争者就会使用竞争性技术平台创建竞争性程序，那会使 Google 的产品看起来像是还停留在上个世纪九十年代的样子。&lt;/p&gt;
&lt;p&gt;留给 Google 的选择现在很明了了：要么放弃使用基于浏览器的 Javascript 和开放标准进行开发，转而接受新技术中的一种，要么继续坚持使用核心 web 技术并且发展这些技术直到成为可行的替代技术。Google 的问题是，新标准和预期的浏览器功能很快就会带来富 web 技术，但是开发那些标准的进度却如此缓慢，以至于很可能需要几年时间才能看到那些标准被广泛的应用。新的 HTML 标准，&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.techcrunch.com/2008/06/05/the-next-gen-web-html5-will-we-ever-see-a-real-standard/&#039;);&quot;  href=&quot;http://www.techcrunch.com/2008/06/05/the-next-gen-web-html5-will-we-ever-see-a-real-standard/&quot; target=&quot;_blank&quot;&gt;HTML5&lt;/a&gt;，特别关注扩展本地浏览器对 web 程序的支持能力，在不用附加私有运行时的情况下。Google web API 的基础就是这些同样的功能以及其他的附加功能。&lt;/p&gt;
&lt;p&gt;由于标准开发的极其缓慢，导致通向更快更好，而且仍旧免费开放的 web 程序之路被堵死了，所以 Google 决定通过 Gears 自己进入这个市场。想法其实很简单：把明天的 web 技术带到今天的浏览器里。这些特定的功能大部分都来自新的 HTML5 规范，但是标准制定小组已经在上面花费了好几年。不想再等这个小组完成规范，Google 自己通过件对浏览器进行扩展，实现了这些功能并且达到了那个小组能达到的最高水平。他们宁愿在短期内抛弃标准（原话是“以后再考虑实现”）也要把他们的 web 程序带到能够对抗 Flash 和 Silverlight 的下一代标准。&lt;/p&gt;
&lt;p&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.crunchbase.com/person/vic-gundotra&#039;);&quot;  href=&quot;http://www.crunchbase.com/person/vic-gundotra&quot; target=&quot;_blank&quot;&gt;&lt;img style=&quot;float: right;&quot; src=&quot;http://www.crunchbase.com/assets/images/resized/0001/7940/17940v1-max-250x250.jpg&quot;/&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Gears 有一个 30 人左右的小组开发，这个小组是 Google 内部开源小组的一部分。这个小组由 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.crunchbase.com/person/vic-gundotra&#039;);&quot;  href=&quot;http://www.crunchbase.com/person/vic-gundotra&quot; target=&quot;_blank&quot;&gt;Vic Gundotra&lt;/a&gt; 带领，再一次讽刺的转变过程中，他由微软的传教士成为 Google 的高级开发者。这个一小组开发者着手进行开发，并且保持 Google 对 Javascript 和开放浏览器虚拟机的兴趣。理论上，他们看起来很可能被大组织或者微软和 Adobe 正在投入各自平台的预算所超过。为了改变这个状况，他们把 Gears 从 Google 中分离出来（字面上也是——现在这个项目名称就只是“Gears”）并且在开源协议下发布源代码。&lt;/p&gt;
&lt;p&gt;第一个发行版将只关注于 HTML5 里面提议的新功能中他们认为最重要的功能：&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.techcrunch.com/2008/05/29/the-next-gen-web-browser-storage-support/&#039;);&quot;  href=&quot;http://www.techcrunch.com/2008/05/29/the-next-gen-web-browser-storage-support/&quot; target=&quot;_blank&quot;&gt;基于客户端的结构化数据和对象存储&lt;/a&gt;。由于选择了首先实现客户端存储，所以下一年里 Gears 会被构架成一个离线应用程序解决方案，由于其他的竞争者好像都没有注意到这个这么巨大目标，所以如果他们不是有意而为之，那么肯定会发展的很好。Google 本来有可能开发他们自己的浏览器，某些博客里的推测和谣言也都指出了这一点，但是浏览器市场竞争激烈，却平淡乏味，而且通常会失败。另外，即使他们开发了自己的新浏览器，他们还要驱使用户接受这个新浏览器，在决定性的市场聚集起来之前只能等待，就是这样，市场上还会有 70% 或者 80% 甚至 90% 的人不使用 Google 的浏览器，却想使用 Google 的程序。&lt;/p&gt;
&lt;p&gt;这种情况下，可选的捷径就是跳过浏览器直接在上面增加一层——Google 自己的 web 层。所有常用浏览器都提供了让开发者扩展功能的机制，这样一来，Google 要做的就是对每个浏览器开发对应的插件。这能让新的 web API 能够适应所有的桌面而不需要用户去适应，最重要的，这比起进入浏览器市场来说见效快而且痛苦少。现在可以让浏览器来做所有无聊的事情：渲染 HTML、显示界面、用户选项等等，与此同时 Google 却在改变现状，埋头向前冲。&lt;/p&gt;
&lt;p&gt;现在 Gears 支持大量完整的新功能，有一些新功能是和微软、Adobe 他们的下一代 web API 相同的，而其他的则是 Google 自己创造出来的。现在函数调用已经&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/code.google.com/p/gears/w/list&#039;);&quot;  href=&quot;http://code.google.com/p/gears/w/list&quot; target=&quot;_blank&quot;&gt;对开发者开放&lt;/a&gt;了，包括后台处理（不会再有沙漏出现）、客户端图像处理、位置感知、更好的文件上传功能，还有浏览器内本地数据库。&lt;/p&gt;
&lt;p&gt;要让新 API 和开发平台的应用被采用需要两方面的支持，一方面是用户的支持，因为这需要用户安装新的插件；另一方面是开发者的支持，使用 Gears 不会让开发变得更容易，这是因为这和开发其他的使用基于浏览器的 Javascript 的程序没有区别，Gears 只是给开发者提供了一系列更多的可以在浏览器内实现的功能而已。Javascript 和 web 开发者不需要学习任何新知识，用户也要做的也只是安装一个插件（与浏览器绑定的交易肯定会发生，所以这一步都可以忽略了）。Flash 花了 5 到 6 年才足够普及，能够让开发者有信心专注于使用 Flash 开发，不过有了 Google 的支持，Gears 可能只需要用一半甚至更小的时间就能做到。&lt;/p&gt;
&lt;p&gt;在这场竞赛中，Google 没有任何损失反而赢得盆满钵丰，Google 一下子就启动了这个新 web API 的基于标准且开源的替代方案。与其他的竞争对手不一样，Google 没有兴趣控制这个平台或者直接用来盈利。相反他们却在试图维持现状：大部分程序使用浏览器里的 Javascript 开发，如果有更多需求那就使用 Flash 或者类似的技术。&lt;/p&gt;
&lt;p&gt;上一次平台大战结束了很久了，但是每次你都能看到类似的技术经验：大公司失败，小公司成功。给这个平衡增加点开源的砝码，结果还是没有一个单独的公司能够占优势。有这么多大公司的加入，而且如此的利益攸关，我们肯定要亲眼见证一场漫长的持久战。只有时间能够告诉我们 Google 的做法能不能带领 web 向前发展。&lt;/p&gt;
&lt;p&gt;&lt;i&gt;本文是 Nik Cubrilovic 写的下一代 web 系列中的一篇，&lt;a href=&quot;http://blog.nulltao.net/plugin/tag/nextgenweb&quot;&gt;在这阅读其他同系列文章&lt;/a&gt;。&lt;/i&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 16 Jun 2008 11:06:36 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/88-guid.html</guid>
    <category>nextgenweb</category>
<category>techcrunch</category>
<category>translation</category>
<category>trashcan</category>

</item>
<item>
    <title>下一代 web：HTML5——我们能等到真正的标准吗？</title>
    <link>http://blog.nulltao.net/archives/87-webHTML5.html</link>
            <category>TrashcaN</category>
    
    <comments>http://blog.nulltao.net/archives/87-webHTML5.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=87</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://blog.nulltao.net/rss.php?version=2.0&amp;type=comments&amp;cid=87</wfw:commentRss>
    

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;原文：&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.techcrunch.com/2008/06/05/the-next-gen-web-html5-will-we-ever-see-a-real-standard/&#039;);&quot;  href=&quot;http://www.techcrunch.com/2008/06/05/the-next-gen-web-html5-will-we-ever-see-a-real-standard/&quot; target=&quot;_blank&quot;&gt;The Next-Gen Web: HTML5 - Will We Ever See A Real Standard?&lt;/a&gt;。&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;img style=&quot;border-width: 0px; float: left;&quot; alt=&quot;lame_logo&quot; src=&quot;http://www.techcrunch.com/wp-content/nextgenweb2.jpg&quot; border=&quot;0&quot; height=&quot;158&quot; width=&quot;244&quot;&gt;
	&lt;/p&gt;&lt;p&gt;本地存储相关的 API 作为最新的 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.whatwg.org/specs/web-apps/current-work/multipage/introduction.html#introduction&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.whatwg.org/specs/web-apps/current-work/multipage/introduction.html#introduction&quot;&gt;HTML5&lt;/a&gt; 规范草案的一部分，我们在&lt;a target=&quot;_blank&quot; href=&quot;http://blog.nulltao.net/archives/86-web.html&quot;&gt;上个星期&lt;/a&gt;看到一些浏览器和插件已经开始采纳这些 API。虽然 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/crunchbase.com/product/gears&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://crunchbase.com/product/gears&quot;&gt;Gears&lt;/a&gt;、&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.opera.com&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.opera.com&quot;&gt;Opera&lt;/a&gt; 还有 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.webkit.org&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.webkit.org&quot;&gt;Webkit&lt;/a&gt; 都已经实现了结构化存储部分的 API，但是 HTML5 规范里其他的部分当前还都没有怎么实现，而且前途不明。HTML5 尽了最大的努力来让所有的浏览器都统一在一个单一且标准化的标记语言和一系列 API 下——但是 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.silverlight.net&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.silverlight.net&quot;&gt;微软&lt;/a&gt;、&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.acrobat.com&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.acrobat.com&quot;&gt;Adobe&lt;/a&gt; 和 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.curl.com&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.curl.com&quot;&gt;其他&lt;/a&gt;的领先者们都有了自己的下一代 web 技术，那么我们还能看到真正的 HTML5 标准吗？&lt;/p&gt;
&lt;p&gt;&lt;big&gt;&lt;strong&gt;历史的教训&lt;/strong&gt;&lt;/big&gt;&lt;/p&gt;
&lt;p&gt;&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.techcrunch.com/wp-content/netscape.jpg&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.techcrunch.com/wp-content/netscape.jpg&quot;&gt;&lt;img style=&quot;border-width: 0px;&quot; alt=&quot;netscape&quot; src=&quot;http://www.techcrunch.com/wp-content/netscape-thumb.jpg&quot; align=&quot;right&quot; border=&quot;0&quot; height=&quot;184&quot; width=&quot;244&quot;&gt;&lt;/a&gt;在适用范围和成果方面，HTML5的成果与历史上早期的 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.w3.org/MarkUp/html3/Contents.html&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.w3.org/MarkUp/html3/Contents.html&quot;&gt;HTML 3.0 规范&lt;/a&gt; 有所相似。返回到 1995 年 4 月，开始起草 HTML 3.0 规范，其目的是向后兼容 HTML 2.0 并且添加新的特性（例如表格）。当时 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.w3.org&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.w3.org&quot;&gt;W3C&lt;/a&gt; 刚刚成立，这个新工作组要完成的第一批规范之一就是 HTML 3.0 规范。
	 在那个时候，浏览器大战即将爆发，当时 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/web.archive.org/web/19961020015116/http://www3.netscape.com/&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://web.archive.org/web/19961020015116/http://www3.netscape.com/&quot;&gt;Navigator&lt;/a&gt; 才发布了五个月，却占有了 80% 的市场份额。微软却才注意到这点，然后仓促的开始开发 Internet Explorer 1.0，并在几个月后发布。&lt;/p&gt;
&lt;p&gt;在 1995 年，不同的浏览器支持不同系列的标记——一直到现在还是这样。随着 Navigator 1.1 新版本的发布，网景突飞猛进，而且还实现了表格、浮动图片和其他的导航元素（例如点击过的链接）。IE 1 是一个完全改造过的浏览器，因为它采用了最大化渲染的方法，就是说，如果 IE 无法确定用户对 HTML 所期望的表现，就尽量猜测并且显示猜测结果。 这导致了很多类似标签不匹配的问题（例如 &lt;code&gt;&amp;lt;b&amp;gt;&amp;lt;p&amp;gt;Header&amp;lt;/b&amp;gt;&amp;lt;/p&amp;gt;&lt;/code&gt;）出现，因为 IE 能够自动纠错，所以这些问题又导致开发者变得懒惰。&lt;/p&gt;
&lt;p&gt;随着 Internet Explorer 的市场占有率持续上升，以及网景和微软各自浏览器的每一次发布和更新，两个浏览器的距离越来越大，市场也随之分成了两个坚固的阵营。以前以 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.faqs.org/rfcs/&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.faqs.org/rfcs/&quot;&gt;RFC&lt;/a&gt; 形式出现的，现在叫做 HTML 的规范，本来的目的是重新统一浏览器，并且让浏览器已经支持的新功能规范化。但是在规范制定者中经常会弥漫着剑拔弩张的气氛，争论究竟哪个浏览器——Navigator 还是 Explorer——对新功能实现的更好。例如，Navigator 和 Explorer 对&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.free-cgi.com/freecgi/reference/multi.php&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.free-cgi.com/freecgi/reference/multi.php&quot;&gt;图片映射图&lt;/a&gt;的实现方式就很不一样，而且还互不兼容。微软要为制造那些混乱的 HTML 标签所负责，例如使用 &amp;lt;top&amp;gt; 和 &amp;lt;bottom&amp;gt; 标签来定义页面中不变的部分（拜网景所赐，这些标签后来演变成了很不友好的框架标签）。&lt;/p&gt;
&lt;p&gt;问题不在于新功能无序的开发，而是两个竞争激烈的浏览器都在实现各自版本的 web，以保卫自己的市场份额并且或者更多的控制权。最后，网景和微软都放弃实现正统的 HTML 3.0 规范，例如&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/wp.netscape.com/assist/net_sites/html_extensions_3.html&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://wp.netscape.com/assist/net_sites/html_extensions_3.html&quot;&gt;网景声明&lt;/a&gt;：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;网景承诺继续支持 HTML 3.0。出于这样的原因，我们走在了前面，采纳了一些更加成熟的方案，我们希望这些方案能够被认可。我们坚信网景 Navigator 2.0 比其他的任何一个商用客户端对 HTML 3.0 规范支持的更好。&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;此外，我们在网景 Navigator 中增加了一些现在还未被 HTML 3.0 规范包含的新功能&lt;/strong&gt;。我们认为这些新功能应该被加进去，作为标准流程的一部分，我们正在&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/wp.netscape.com/assist/net_sites/new_html3_prop.html&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://wp.netscape.com/assist/net_sites/new_html3_prop.html&quot;&gt;提议&lt;/a&gt;标准加入这些新功能&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;而微软被落在支持 HTML 小组成员的后面&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.macuser.co.uk/macuser/reviews/16110/microsoft-internet-explorer-21.html&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.macuser.co.uk/macuser/reviews/16110/microsoft-internet-explorer-21.html&quot;&gt;紧紧追赶&lt;/a&gt;：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;网景非常享受他在浏览器市场上的事实垄断地位（据估算约有 90%），这让网景可以通过引入非官方的，或者所谓的“扩展”标签来加固它的垄断地位。结果导致 web 上充斥着只能在 Navigator 里面正确的浏览的垃圾页面。等到其他的浏览器追上来的时候，网景完成了更多这样的扩展。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;但是持续了不长时间，微软就厌倦了这种玩法。新的发行版&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.microsoft.com/presspass/press/1996/apr96/iemompr.mspx&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.microsoft.com/presspass/press/1996/apr96/iemompr.mspx&quot;&gt;甚至都不提及 HTML&lt;/a&gt; 而是改为讨论构建在微软技术上的 web：&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;微软 Internet Explorer 3.0 是第一个集成了&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/www.wiley.com/legacy/compbooks/catalog/16177-2.htm&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://www.wiley.com/legacy/compbooks/catalog/16177-2.htm&quot;&gt;ActiveXTM&lt;/a&gt; 技术的英特网客户端，这项技术能让开发者能够在英特网上创建具有很高交互性的程序和内容。这些技术能够让万维网站变得丰富、互动，就像动作游戏、多媒体百科全书或者生产力应用程序那样。有史以来，网站第一次不再被技术所限制，而仅仅受限于作者想象力。&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;浏览器大战爆发了快一年的时候，战争从对 HTML 标签支持的斗争升级到了开发富客户端程序的格式和语言之争。在 1996 年 8 月，随着 Internet Explorer 3.0 的发布，&lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/en.wikipedia.org/wiki/JavaScript&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://en.wikipedia.org/wiki/JavaScript&quot;&gt;Javascript&lt;/a&gt;（网景私有的客户端脚本语言）和 &lt;a onclick=&quot;javascript: pageTracker._trackPageview(&#039;/extlink/en.wikipedia.org/wiki/ActiveX&#039;);&quot;  target=&quot;_blank&quot; href=&quot;http://en.wikipedia.org/wiki/ActiveX&quot;&gt;ActiveX&lt;/a&gt;（微软私有的对象容器）之间的斗争一触即发。&lt;/p&gt;
&lt;p&gt;这个故事剩下的部分就是微软在哪里取得胜利的，以及更重要的，微软是怎么赢的，然后浏览器大战已经成为了历史。由于 Web 分裂的很严重，其影响持续了十几年，浪费了开发者很多的时间去开发跨浏览器技巧和各种库。尽管微软得到了浏览器市场的控制权，而且一直不遗余力的推销它私有的用于构建 web 程序的多层技术，但是不知怎么的，最简单