<?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 - TechniquE</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>Tue, 16 Sep 2008 15:42:40 GMT</pubDate>

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

<item>
    <title>终于用上左手的 Logitech V450 Nano Cordless Laser Mouse</title>
    <link>http://blog.nulltao.net/archives/100-Logitech-V450-Nano-Cordless-Laser-Mouse.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/100-Logitech-V450-Nano-Cordless-Laser-Mouse.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=100</wfw:comment>

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

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;和谐四年秋，洒家弱冠六年纪念日当天，于京东购买赛普泰克——啊不，是罗技泰克无尾老鼠一只。&lt;/p&gt;
&lt;p&gt;但是此鼠娘家罗技泰克所附送嫁妆 SetPoint 乃伪劣产品，不得博得洒家新欢 Microsoft Windows 2008 之欢心，2008 不认其名门出身，只当是一 HID compliant Mouse，真是狗眼看人低，微软看鼠卑啊。&lt;/p&gt;
&lt;p&gt;SetPoint 迫东家 2008 的于淫威，亦不敢主仆相认，就是不敢显示出那欲说还羞的 My Mouse 选项卡。&lt;/p&gt;
&lt;p&gt;借古狗洋大人之力，终于在无尾鼠娘家旁边的一个老爷们扎堆聊天的地方找到了前人留下的洋文名帖一张，将藩语译成我中华之文字，方懂上书意思是，喜新厌旧是罪过的，有了新老婆 2008，不能忘了二老婆 Vista 和小妾 XP，须到二老婆或者小妾房中寻得名为 CDDRV2 的仙丹一枚给新老婆服用才可解除新老婆的障眼之疾。&lt;/p&gt;
&lt;p&gt;虽说此方甚好，可以药到病除，但是难为了吾等洁身自好，二老婆小妾皆无之人，难道为了这个还要纳上一房不成？未免荒谬。再看前述之帖，此洋鬼子上留蝇头小楷一行，曰，吾等清白之人之赤心，上可达天庭，故玉帝命他将仙丹藏于一个名为 RapidShare 之八卦炉内，以诚心猛击此&lt;a href=&quot;http://rs524.rapidshare.com/files/141942707/CDDRV2.rar&quot; target=&quot;_blank&quot;&gt;链接&lt;/a&gt;即可得仙丹。&lt;/p&gt;
&lt;p&gt;洒家于是踏上 NJU_BRAS 大道前去寻访仙丹，不曾想，好事多磨，玉帝说 BRAS 戴着不爽，遂令如来将 BRAS 大道缩成极小，以难为用 BRAS 取经之人。无奈之下，退回来继续用 PROXY 小道，道上无人阻碍，方能够到达藩国按洋鬼子之指点找到仙丹，取回，用 LDPINST.exe 做药引给新欢 2008 服下，之间电光火石之间，2008 立马认出洒家的无尾鼠出自罗技泰克名门，立即取名为 Logitech HID compliant Cordless mouse。此时寻到 SetPoint，SetPoint 一看婆家已经接纳此鼠，亦显现出 My Mouse 以和之。&lt;/p&gt;
&lt;p&gt;至此，洒家魂牵梦绕之 My Mouse 终得拨云见日，吾等方能用上左手鼠标。善哉善哉。&lt;/p&gt;
&lt;p&gt;口说无凭，立照为证：
&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/SetPoint.png&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/SetPoint.thumb.png&quot;&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;附上新鼠未嫁之前之裸照一张：
&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/V450.jpg&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/V450.thumb.jpg&quot;&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;附上洋泾兵之贴：&lt;a href=&quot;http://forums.logitech.com/logitech/board/message?board.id=software_mice&amp;thread.id=12498&quot; target=&quot;_blank&quot;&gt;Windows Server 2008 x86(32bit) + Setpoint 4.6 installation &lt;/a&gt;，后来者请自去寻访仙丹。&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 16 Sep 2008 12:23:24 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/100-guid.html</guid>
    <category>mouse</category>
<category>setpoint</category>
<category>technique</category>
<category>tip</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>解决 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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>让 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 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 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 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 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>干活啦，开工啦，ThingingStone开始开发啦</title>
    <link>http://blog.nulltao.net/archives/84-ThingingStone.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/84-ThingingStone.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=84</wfw:comment>

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

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;最近赋闲，恩。好像太过于赋闲了，不怎么写代码手都生了。于是开始开启偶的 ThinkingStone 项目。&lt;/p&gt;
&lt;p&gt;之所以叫这个名字，因为偶准备把 ThinkingRock web 化，人家是 rock，俺就弄个 stone 玩玩吧。呵呵&lt;/p&gt;
&lt;p&gt;顺便玩玩 symfony 框架，据说是 PHP 界最 BT 的框架，偶喜欢，hiahia。&lt;/p&gt;
&lt;p&gt;废话不多说，上两张现在的截图看看，然后就等着发布吧。hoho。&lt;/p&gt;
&lt;p&gt;Contexts:&lt;br /&gt;&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/contextList.png&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/contextList.thumb.png&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Add a new context:&lt;br /&gt;&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/contextInsert.png&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/contextInsert.thumb.png&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Topics:&lt;br /&gt;&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/topicList.png&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/topicList.thumb.png&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Add a new topic:&lt;br /&gt;&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/topicInsert.png&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/topicInsert.thumb.png&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Collect thought:&lt;br /&gt;&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/thoughtCollect.png&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/thoughtCollect.thumb.png&quot;&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Add thoughts:&lt;br /&gt;&lt;a href=&quot;http://blog.nulltao.net/uploads/images/2008/thoughtInsert.png&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;http://blog.nulltao.net/uploads/images/2008/thoughtInsert.thumb.png&quot;&gt;&lt;/a&gt;&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 05 Jun 2008 22:06:59 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/84-guid.html</guid>
    <category>technique</category>
<category>thingingstone</category>

</item>
<item>
    <title>symfony 学习笔记 - 2 - 开始运行 symfony</title>
    <link>http://blog.nulltao.net/archives/75-symfony-2-symfony.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/75-symfony-2-symfony.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=75</wfw:comment>

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

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;h3&gt;安装 symfony 库&lt;/h3&gt;
&lt;h4&gt;用 PEAR 方式安装&lt;/h4&gt;
&lt;div class=&quot;bash&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: #808080; font-style: italic;&quot;&gt;# 在 PEAR 频道列表里添加 symfony 频道 &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;pear channel-discover pear.symfony-project.com &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: #808080; font-style: italic;&quot;&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;pear remote-list -c symfony &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: #808080; font-style: italic;&quot;&gt;# 安装 symfony 包 &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;pear &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt; symfony/symfony &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: #808080; font-style: italic;&quot;&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;symfony -V&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: #808080; font-style: italic;&quot;&gt;# 用下面这句来安装最新的 beta 版 &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: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt; symfony/symfony-beta&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;Symfony 库被安装在以下目录内：&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;code&gt;$php_dir/symfony/&lt;/code&gt;：核心库。&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;$data_dir/symfony/&lt;/code&gt;：symfony
	的程序框架，默认的模块和配置信息，全球化数据等。&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;$doc_dir/symfony/&lt;/code&gt;：文档。&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;$test_dir/symfony/&lt;/code&gt;：单元测试。&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;注：最新版本的 PEAR 安装 symfony 会出现错误，解决方法参见&lt;a
	href=&quot;http://blog.nulltao.net/archives/66-Linux-PEAR-Symfony.html&quot;
	target=&quot;_blank&quot;
&gt;在 Linux 下用 PEAR 安装 Symfony 出现错误的解决方案&lt;/a&gt;。&lt;/p&gt;
&lt;h4&gt;通过 SVN 安装&lt;/h4&gt;
&lt;div class=&quot;bash&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: #808080; font-style: italic;&quot;&gt;# 创建 symfony 库的目录 &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: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; /path/to/symfony &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: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; /path/to/symfony &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: #808080; font-style: italic;&quot;&gt;# 通过 SVN 检出发行版文件 &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;svn checkout http://svn.symfony-project.com/tags/RELEASE_1_0_0/ . &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: #808080; font-style: italic;&quot;&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;php /path/to/symfony/data/bin/symfony -V&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;如果你用 SVN 方式安装，那么你需要在 &lt;code&gt;config/config.php&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: #0000ff;&quot;&gt;$sf_symfony_lib_dir&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;/path/to/symfony/lib/&#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;&lt;span style=&quot;color: #0000ff;&quot;&gt;$sf_symfony_data_dir&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;/path/to/symfony/data/&#039;&lt;/span&gt;;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;h3&gt;创建第一个程序&lt;/h3&gt;
&lt;h4&gt;创建项目&lt;/h4&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: #808080; font-style: italic;&quot;&gt;# 假设当前目录为 htdocs 目录 &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;a href=&quot;http://www.php.net/mkdir&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;mkdir&lt;/span&gt;&lt;/a&gt; myproject &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;cd myproject &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: #808080; font-style: italic;&quot;&gt;# 下面这句适用于 PEAR 安装方式 &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;symfony init-project myproject &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: #808080; font-style: italic;&quot;&gt;# 下面这句适用于 SVN 安装方式 &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;php /path/to/symfony/data/bin/symfony init-project myproject&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;Symfony 会自动生成上一节说的那些目录结构。&lt;/p&gt;
&lt;h4&gt;创建应用&lt;/h4&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;symfony init-app myapp&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;建立 &lt;code&gt;web/sf/&lt;/code&gt; 目录。把 &lt;code&gt;/path/to/symfony/data/web/sf/&lt;/code&gt;
拷贝到 &lt;code&gt;myproject/web/sf/&lt;/code&gt;，或者创建对应的符号链接。&lt;/p&gt;
&lt;p&gt;现在访问 &lt;code&gt;http://localhost/myproject/web/myapp_dev.php/&lt;/code&gt;
应该能看到这样的界面：&lt;/p&gt;
&lt;p&gt;&lt;a
	href=&quot;http://www.symfony-project.org/images/book/dev/F0301.jpg&quot;
	target=&quot;_blank&quot;
&gt;&lt;img src=&quot;http://www.symfony-project.org/images/book/dev/F0301.jpg&quot;
	width=&quot;600&quot;
&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;如果你看到类似这样的界面，那么你的 symfony 第一步安装成功了。&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 28 Feb 2008 16:23:45 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/75-guid.html</guid>
    <category>symfony</category>
<category>technique</category>

</item>
<item>
    <title>symfony 学习笔记 - 1 - 基础知识</title>
    <link>http://blog.nulltao.net/archives/71-symfony-1.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/71-symfony-1.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=71</wfw:comment>

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

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;h3&gt;symfont 的 MVC 实现&lt;/h3&gt;
&lt;ul&gt;
	&lt;li&gt;模型层
	&lt;ul&gt;
		&lt;li&gt;数据库抽象层&lt;/li&gt;
		&lt;li&gt;数据访问&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;视图层
	&lt;ul&gt;
		&lt;li&gt;视图&lt;/li&gt;
		&lt;li&gt;模板&lt;/li&gt;
		&lt;li&gt;布局&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;控制层
	&lt;ul&gt;
		&lt;li&gt;前端控制&lt;/li&gt;
		&lt;li&gt;动作&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;symfont 的工作流：&lt;/p&gt;
&lt;p&gt;&lt;img
	src=&quot;http://www.symfony-project.org/images/book/dev/F0202.png&quot;
/&gt;&lt;/p&gt;
&lt;h3&gt;代码组织&lt;/h3&gt;
&lt;p&gt;代码组织实例：&lt;/p&gt;
&lt;p&gt;&lt;img
	src=&quot;http://www.symfony-project.org/images/book/dev/F0203.png&quot;
/&gt;&lt;/p&gt;
&lt;h4&gt;根目录文件树结构&lt;/h4&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;code&gt;apps/&lt;/code&gt;：一个子目录对应一个应用，通常是 &lt;code&gt;frontend&lt;/code&gt; 对应前台，&lt;code&gt;backend&lt;/code&gt;对应后台。
	&lt;ul&gt;
		&lt;li&gt;&lt;code&gt;frontend/&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;backend/&lt;/code&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;batch/&lt;/code&gt;：需要从命令行运行或者周期性运行的 PHP 批处理脚本。&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;cache/&lt;/code&gt;：配置信息的缓存，以及动作和和模板的缓存(如果你启用了的话)。用这个缓存机制来加速请求的响应速度，每个应用都有一个对应的目录，放置预处理过的
	PHP 和 HTML 文件。&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;config/&lt;/code&gt;：每个项目的常规配置信息。&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;data/：项目里和数据相关的文件，比如数据库模式、SQL 文件，甚至是 SQLite
	的数据库文件。&lt;/code&gt;
	&lt;ul&gt;
		&lt;li&gt;&lt;code&gt;sql/&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;functional/&lt;/code&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;doc/&lt;/code&gt;：项目文档，包括你自己写的文档，和由 PHPDoc 生成的文档。&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;lib/&lt;/code&gt;：外部的类或者库。你可以在这里添加需要在项目级共享的代码。&lt;code&gt;model/&lt;/code&gt;
	目录里是项目整体的对象模型。
	&lt;ul&gt;
		&lt;li&gt;&lt;code&gt;model/&lt;/code&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;log/&lt;/code&gt;：由 symfony 直接生成的日志文件。&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;plugins/&lt;/code&gt;：插件目录。&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;test/&lt;/code&gt;：单元测试和功能测试脚本。在创建项目的过程中，symfony 会自动创建一些测试的。
	&lt;ul&gt;
		&lt;li&gt;&lt;code&gt;unit/&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;functional/&lt;/code&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;&lt;code&gt;web/&lt;/code&gt;：Web 服务器的根目录，只有这个目录里面的文件才能被访问到。
	&lt;ul&gt;
		&lt;li&gt;&lt;code&gt;css/&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;images/&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;js/&lt;/code&gt;&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;uploads/&lt;/code&gt;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;模型目录树文件结构&lt;/h4&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;code&gt;apps/&lt;/code&gt;
	&lt;ul&gt;
		&lt;li&gt;&lt;code&gt;[application name]&lt;/code&gt;
		&lt;ul&gt;
			&lt;li&gt;&lt;code&gt;[module name]&lt;/code&gt;
			&lt;ul&gt;
				&lt;li&gt;&lt;code&gt;actions/&lt;/code&gt;：通常情况下这个目录里只有一个名为 &lt;code&gt;actions.class.php&lt;/code&gt;
				的文件，这个文件里是该模型的全部动作，你也可以分开成单独的文件。
				&lt;ul&gt;
					&lt;li&gt;&lt;code&gt;actions.class.php&lt;/code&gt;&lt;/li&gt;
				&lt;/ul&gt;
				&lt;/li&gt;
				&lt;li&gt;&lt;code&gt;config/&lt;/code&gt;：该模型的自定义配置信息，可以有本地化参数。&lt;/li&gt;
				&lt;li&gt;&lt;code&gt;lib/&lt;/code&gt;：该模型特有的类库。&lt;/li&gt;
				&lt;li&gt;&lt;code&gt;templates/&lt;/code&gt;：与每个动作对应的模板文件。在创建模型的时候会自动生成默认模板文件 &lt;code&gt;indexSuccess.php&lt;/code&gt;。
				&lt;ul&gt;
					&lt;li&gt;&lt;code&gt;indexSuccess.php&lt;/code&gt;&lt;/li&gt;
				&lt;/ul&gt;
				&lt;/li&gt;
				&lt;li&gt;&lt;code&gt;validate/&lt;/code&gt;：专门用来校验表单数据的配置文件。&lt;/li&gt;
			&lt;/ul&gt;
			&lt;/li&gt;
		&lt;/ul&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;Web 目录树文件结构&lt;/h4&gt;
&lt;ul&gt;
	&lt;li&gt;&lt;code&gt;web/&lt;/code&gt;
	&lt;ul&gt;
		&lt;li&gt;&lt;code&gt;css/&lt;/code&gt;：样式表文件。&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;images/&lt;/code&gt;：图形文件。&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;js/&lt;/code&gt;：JavaScript 脚本文件。&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;uploads/&lt;/code&gt;：用户上传的目录。&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt; 
    </content:encoded>

    <pubDate>Wed, 27 Feb 2008 23:45:00 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/71-guid.html</guid>
    <category>symfony</category>
<category>technique</category>

</item>
<item>
    <title>用 .htaccess 文件来屏蔽指定的浏览器的访问</title>
    <link>http://blog.nulltao.net/archives/73-.htaccess.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/73-.htaccess.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=73</wfw:comment>

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

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;最近不知道找谁惹谁了，总是有一个 &lt;code&gt;HTTP_USER_AGENT&lt;/code&gt; 以 &lt;code&gt;larbin&lt;/code&gt; 开头的浏览器访问（估计是用了什么类库吧。不像是一个真正的浏览器），导致偶的访客记录表大量的冗余记录。今天决定用 &lt;code&gt;.httaccess&lt;/code&gt; 来彻底杜绝。&lt;/p&gt;
&lt;p&gt;在 &lt;code&gt;.htaccess&lt;/code&gt; 最后添加如下记录：&lt;/p&gt;
&lt;div class=&quot;apache&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: #00007f;&quot;&gt;RewriteCond&lt;/span&gt; %&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#123;&lt;/span&gt;HTTP_USER_AGENT&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#125;&lt;/span&gt; larbin &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;NC,OR&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&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: #00007f;&quot;&gt;RewriteRule&lt;/span&gt; .* - &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt;F&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;现在，世界清静了。&lt;/p&gt; 
    </content:encoded>

    <pubDate>Tue, 26 Feb 2008 20:24:52 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/73-guid.html</guid>
    <category>htaccess</category>
<category>technique</category>

</item>
<item>
    <title>10 件（也许）你不了解 PHP 的事情</title>
    <link>http://blog.nulltao.net/archives/72-10-PHP.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/72-10-PHP.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=72</wfw:comment>

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

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;来源：&lt;a href=&quot;http://blog.rightbrainnetworks.com/2006/09/18/10-things-you-probably-didnt-know-about-php/&quot; target=&quot;_blank&quot;&gt;10 things you (probably) didn’t know about PHP&lt;/a&gt;&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;PHP 是我用过的语言中，最令人恼火的但同时也是最有趣的语言。我之所以说“令人恼火”主要是因为函数命名极其不一致。尽管我每天都要用到这些函数，我还是要想一下“究竟是 &lt;em&gt;str_pos&lt;/em&gt; 还是 &lt;em&gt;strpos&lt;/em&gt;？是 &lt;em&gt;str_split&lt;/em&gt; 还是 &lt;em&gt;strsplit&lt;/em&gt;？”。另一方面，有时候可以用一行简单的代码就能解决一个难题。&lt;/p&gt;
&lt;p&gt;下面是一些很酷的特性，很可能你也没有注意到：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;使用 &lt;em&gt;&lt;a href=&quot;http://us3.php.net/manual/en/function.ip2long.php&quot;&gt;ip2long&lt;/a&gt;()&lt;/em&gt; 和 &lt;em&gt;&lt;a href=&quot;http://us3.php.net/manual/en=/function.long2ip.php&quot;&gt;long2ip&lt;/a&gt;()&lt;/em&gt; 函数来把 IP 地址转化成整型存储到数据库里。&lt;/strong&gt;这种方法把存储空间降到了接近四分之一（char(15) 的 15 个字节对整形的 4 个字节），计算一个特定的地址是不是在一个区段内页更简单了，而且加快了搜索和排序的速度（虽然有时仅仅是快了一点）。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;在验证 email 地址的时候使用 &lt;em&gt;&lt;a href=&quot;http://us3.php.net/manual/en/function.checkdnsrr.php&quot;&gt;checkdnsrr&lt;/a&gt;()&lt;/em&gt; 函数验证域名是否存在。&lt;/strong&gt;这个内置函数能够确认指定的域名能够解析成 IP 地址。该函数的PHP 文档的&lt;a href=&quot;http://us3.php.net/manual/en/function.checkdnsrr.php#48157&quot;&gt;用户评论&lt;/a&gt;部分有一个简单的用户自定义函数，这个函数基于 checkdnsrr()，用来验证 email 地址的合法性。对于那些认为自己的 email 地址是 “joeuser@wwwphp.net” 而不是 “joeuser@php.net” 的家伙们，这个方法可以很方便的抓住他们。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;如果你使用的是 PHP 5 和 MySQL 4.1 或者更高的版本，考虑抛弃 &lt;em&gt;mysql_*&lt;/em&gt; 系列函数改用改进版的 &lt;em&gt;&lt;a href=&quot;http://us3.php.net/manual/en/ref.mysqli.php&quot;&gt;mysqli_*&lt;/a&gt;&lt;/em&gt; 系列函数。&lt;/strong&gt;一个很好的功能就是你可以使用&lt;a href=&quot;http://us3.php.net/mysqli_stmt_prepare&quot;&gt;预处理语句&lt;/a&gt;，如果你在维护一个数据库密集型站点，这个功能能够加快查询速度。&lt;a href=&quot;http://www.johnjawed.com/benchmarks/&quot;&gt;一些评估分数&lt;/a&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;学会爱上&lt;a href=&quot;http://us3.php.net/language.operators.comparison#language.operators.comparison.ternary&quot;&gt;三元运算符&lt;/a&gt;&lt;/strong&gt;。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;如果你在项目中感觉到有可复用的部分，在你写下一行代码前先看看 &lt;a href=&quot;http://pear.php.net/&quot;&gt;&lt;em&gt;PEAR&lt;/em&gt;&lt;/a&gt; 中是否已经有了。&lt;/strong&gt;很多 PHP 程序员都知道 PEAR 是一个很好的资源库，虽然还有很多程序员不知道。这个在线资源库包含了超过 400 个可以复用的程序片段，这些程序片段你可以立即用刀你的程序里。除非说你的项目真的是非常特别的，你总能找到帮你节省时间的 PEAR 包。（参见 &lt;a href=&quot;http://pecl.php.net/&quot;&gt;PECL&lt;/a&gt;）&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;用 &lt;a href=&quot;http://us3.php.net/manual/en/function.highlight-file.php&quot;&gt;highlight_file&lt;/a&gt;() 来自动的打印出格式化的很漂亮的源代码。&lt;/strong&gt;如果你在留言板、IRC 这些地方寻求一个脚本的帮助的话，这个函数用起来非常的顺手。当然了，要小心不要意外的泄露出你的数据库连接信息和密码等。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;使用 &lt;em&gt;&lt;a href=&quot;http://us3.php.net/manual/en/function.error-reporting.php&quot;&gt;error_reporting(0)&lt;/a&gt;&lt;/em&gt; 函数来防止用户看到潜在的敏感错误信息。&lt;/strong&gt;在理想情况下，发布服务器应该在 &lt;em&gt;php.ini&lt;/em&gt; 里完全禁止。但是如果你用的是一个共享的 web 服务器的话，你没有自己的 &lt;em&gt;php.ini&lt;/em&gt; 文件，那么这种情况下你最好的选择就是在所有脚本的第一行前加上 &lt;em&gt;error_reporting(0);&lt;/em&gt;（或者使用 &lt;a href=&quot;http://us3.php.net/manual/en/function.require-once.php&quot;&gt;require_once()&lt;/a&gt; 方法）。这就能够在出错的时候完全屏蔽敏感的 SQL 查询语句和路径名。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;在网数据库中存储很大的字符串之前使用 &lt;em&gt;&lt;a href=&quot;http://us3.php.net/manual/en/function.gzcompress.php&quot;&gt;gzcompress&lt;/a&gt;()&lt;/em&gt; 和 &lt;em&gt;&lt;a href=&quot;http://us3.php.net/manual/en/function.gzuncompress.php&quot;&gt;gzuncompress&lt;/a&gt;()&lt;/em&gt; 来显式的压缩/解压字符串。&lt;/strong&gt;这个 PHP 内置函数使用 gzip 算法，可以压缩普通文本达 90%。在我每次要读写 &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/blob.html&quot;&gt;BLOB&lt;/a&gt; 类型的字段的时候都使用这些函数。唯一额例外就是当我需要全文检索的时候。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;通过“&lt;a href=&quot;http://us3.php.net/manual/en/functions.arguments.php#functions.arguments.by-reference&quot;&gt;引用&lt;/a&gt;”传递参数的方法从一个函数中得到多个返回值。&lt;/strong&gt;就像三元运算符一样，大部分受过正式编程训练的程序员都知道这个技巧。但是那些 HTML 背景大于 Pascal 背景的程序员都或多或少的有过这样的疑问“在仅能使用一次 &lt;em&gt;return&lt;/em&gt; 的情况下，从一个函数里返回多个值？”答案就是在变量前加上一个 “&amp;amp;” 符号，通过“引用”传递而非“值”传递。&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;完全理解“&lt;a href=&quot;http://us3.php.net/manual/en/security.magicquotes.php&quot;&gt;魔术引号&lt;/a&gt;”和 &lt;a href=&quot;http://en.wikipedia.org/wiki/SQL_injection&quot;&gt;SQL 注入&lt;/a&gt;的危险性。&lt;/strong&gt;我希望阅读到这里的开发者都已经很对 SQL 注入和了解了。不过我还是把这条列在这里，是因为这个确实有点难以理解。如果你还没有听说过这种说法，那么把今天剩下的时间都用来 Google、阅读吧。&lt;/li&gt;
&lt;/ol&gt; 
    </content:encoded>

    <pubDate>Mon, 25 Feb 2008 22:48:17 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/72-guid.html</guid>
    <category>php</category>
<category>technique</category>
<category>tip</category>

</item>
<item>
    <title>在 Linux 下用 PEAR 安装 Symfony 出现错误的解决方案</title>
    <link>http://blog.nulltao.net/archives/66-Linux-PEAR-Symfony.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/66-Linux-PEAR-Symfony.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=66</wfw:comment>

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

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;开发环境：&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Slackware Linux 12.0&lt;/li&gt;
&lt;li&gt;Apache httpd-2.2.6&lt;/li&gt;
&lt;li&gt;PHP 5.2.5&lt;/li&gt;
&lt;li&gt;PEAR 1.6.2&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;根据官方文档，用 PEAR 安装 Symfony的命令如下：&lt;/p&gt;
&lt;div class=&quot;bash&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;pear channel-discover pear.symfony-project.com&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;pear &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt; symfony/symfony&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;p&gt;但是运行 channel-discover 的时候报错：Discovery of channel &quot;pear.symfony-project.com&quot; failed。&lt;/p&gt;
&lt;p&gt;原因：PEAR 本身的 bug，不支持 channel 的 url 中包含 - 字符。&lt;/p&gt;
&lt;p&gt;解决方法：用命令 pear upgrade -f PEAR-1.4.6 把 PEAR 降级到 1.4.6 版，然后正常安装，再用命令 pear upgrade-all 升级 PEAR。&lt;/p&gt;
&lt;p&gt;或者应用 PEAR 的 Bug #6960 补丁修补这个 Bug。此方法见参考链接 2。&lt;/p&gt;
&lt;p&gt;参考链接：&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href=&quot;http://www.symfony-project.org/forum/index.php/t/51/&quot; target=&quot;_blank&quot;&gt;symfony framework forum: Installation and setup =&amp;gt; [resolved]Discovery of channel failed&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://pear.php.net/bugs/bug.php?id=6960&quot; target=&quot;_blank&quot;&gt;PEAR :: Bug #6960 :: channels are not allowed to have &amp;quot;-&amp;quot; in their name&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt; 
    </content:encoded>

    <pubDate>Wed, 23 Jan 2008 15:41:48 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/66-guid.html</guid>
    <category>pear</category>
<category>php</category>
<category>symfony</category>
<category>technique</category>

</item>
<item>
    <title>Debug 的精髓：头疼医脚，脚疼医头</title>
    <link>http://blog.nulltao.net/archives/61-Debug.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/61-Debug.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=61</wfw:comment>

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

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;p&gt;最近几点持续在 debug 程序，继前几天那个&lt;a href=&quot;http://blog.nulltao.net/archives/59-unknown.html&quot;&gt;神奇的错误&lt;/a&gt;之后，今天有碰到了一个极品的神奇错误。&lt;/p&gt;
&lt;p&gt;让朋友帮忙写了一个 JS 特效，然后应用到实际程序中，表现为：IE 下一切正常，FF 下不正常，但是把页面保存在本地再用 FF 浏览，居然也是正常的。&lt;/p&gt;
&lt;p&gt;很神奇，偶也仅仅是把一个文件分成了 HTML、JS、CSS 三个文件而已。没办法，一行一行的拷贝、删除、测试。结果在最后一行，也是 HTML 的第一行，DOCTYPE 声明的时候发现了原因。如果没有 DOCTPE 声明，就是正确的，加上这一行声明，就出错。看来 DOCTYPE 不仅仅只是一个简单的文档控制啊。&lt;/p&gt;
&lt;p&gt;最终结论：debug 就要头疼医脚，脚痛医头！&lt;/p&gt; 
    </content:encoded>

    <pubDate>Thu, 03 Jan 2008 11:29:42 +0800</pubDate>
    <guid isPermaLink="false">http://blog.nulltao.net/archives/61-guid.html</guid>
    <category>doctype</category>
<category>firefox</category>
<category>html</category>
<category>technique</category>

</item>
<item>
    <title>A few tips about how to use mysql-5.1-noinstall package</title>
    <link>http://blog.nulltao.net/archives/60-A-few-tips-about-how-to-use-mysql-5.1-noinstall-package.html</link>
            <category>TechniquE</category>
    
    <comments>http://blog.nulltao.net/archives/60-A-few-tips-about-how-to-use-mysql-5.1-noinstall-package.html#comments</comments>
    <wfw:comment>http://blog.nulltao.net/wfwcomment.php?cid=60</wfw:comment>

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

    <author>nulltao@gmail.com (Wei Geng)</author>
    <content:encoded>
    &lt;h3&gt;HOW-TO Install&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;Download the install package, filename is mysql-noinstall-5.1.22-rc-win32.zip in this case.&lt;/li&gt;
&lt;li&gt;Extract it to the installation location, traditionally, the MySQL server uses &quot;c:\mysql&quot;, but my option is &quot;e:\HTTPD\mysql&quot;, any location you like is OK.&lt;/li&gt;
&lt;li&gt;Create your own config file, it&#039;s a good idea to put this file in your MySQL server installation location, not the system path. You may create this file just containing a [mysqld] section:
&lt;div class=&quot;ini&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: #000066; font-weight:bold;&quot;&gt;&lt;span style=&quot;&quot;&gt;&amp;#91;&lt;/span&gt;mysqld&lt;span style=&quot;&quot;&gt;&amp;#93;&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;# set basedir to your installation path&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: #000099;&quot;&gt;basedir&lt;/span&gt;=&lt;span style=&quot;color: #660066;&quot;&gt;E:\\HTTPD\\mysql&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;# set datadir to the location of your data directory&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: #000099;&quot;&gt;datadir&lt;/span&gt;=&lt;span style=&quot;color: #660066;&quot;&gt;E:\\HTTPD\\mysql\\data&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;Install MySQL as a Windows service, use the command:
&lt;div class=&quot;dos&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;mysqld --install-manual MYSQL51 --defaults-file=e:\HTTPD\mysql\my.ini&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;mysqld --install MYSQL51 --defaults-file=e:\HTTPD\mysql\my.ini&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
Either of the above is ok, the difference is the first command will install the service started manually. &quot;MYSQL51&quot; is the service name.&lt;/li&gt;
&lt;li&gt;Start the service, enter this command:
&lt;div class=&quot;dos&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;net start MYSQL51&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li&gt;Now, all the steps are finished! You can use this:
&lt;div class=&quot;dos&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;mysql -u root&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;
to confirm your MySQL is running.&lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;Notes&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;MySQL lo