<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[Doctor's WebLog]]></title> 
<link>http://www.gaobo.info/index.php</link> 
<description><![CDATA[博乐的自留地]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[Doctor's WebLog]]></copyright>
<item>
<link>http://www.gaobo.info/read.php/734.htm</link>
<title><![CDATA[今天终于成功整合了ZS、Android、FlashBuilder4，彻底解决“内存不足”“无法加载设计模式”问题]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sun, 29 Aug 2010 13:18:06 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/734.htm</guid> 
<description>
<![CDATA[ 
	先庆幸一下自己的运气，哇咔咔<br />所用的软件版本：<br />ZendStudio：7.2<br />Android SDK：1.5、1.6、2.1、2.2<br />FlashBuilder：4<br />整合这几个东西按理说不麻烦，先安装ZS，然后按照Android的办法添加SDK什么的，最后下载FlashBuilder for Eclipse的版本，安装后提取出需要的目录并在ZS的设置里添加路径和dropin/Flex.link即可。<br />可是问题就出在这最后一步上，全弄完后新建Flex项目，提示&ldquo;内存不足，无法加载设计模式&rdquo;。搜了很久，大家都是说修改ini配置文件，增大XMS等设置，我这里也试过了，改到1G都还是不行，反而每一次修改都会让FlashBuilder的序列号失效（&hellip;&hellip;），每次都要重新输入新序列号。<br /><br />还好，最最后终于让我找到了<a href="http://hi.baidu.com/zjt34/blog/item/574fd0485b6319fc82025ce8.html" target="_blank">一个办法</a>：<br />首先下载APE.zip，下载地址：<a href="http://www.respua.nl/APE.zip"><a href="http://www.respua.nl/APE.zip" target="_blank">http://www.respua.nl/APE.zip</a></a>； <p>然后解压缩至X:&#92;Program Files&#92;Common Files&#92;Adobe&#92;即可，最后的文件目录是这样子的：</p><p>X:&#92;Program Files&#92;Common Files&#92;Adobe&#92;APE&#92;3.1，该文件夹下有四个dll文件。<br />重启ZS，搞定。</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/zend/" rel="tag">zend</a> , <a href="http://www.gaobo.info/go.php/tags/studio/" rel="tag">studio</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/android/" rel="tag">android</a> , <a href="http://www.gaobo.info/go.php/tags/sdk/" rel="tag">sdk</a> , <a href="http://www.gaobo.info/go.php/tags/flash/" rel="tag">flash</a> , <a href="http://www.gaobo.info/go.php/tags/flex/" rel="tag">flex</a> , <a href="http://www.gaobo.info/go.php/tags/builder/" rel="tag">builder</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2595%25B4%25E5%2590%2588/" rel="tag">整合</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BC%2580%25E5%258F%2591/" rel="tag">开发</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/733.htm</link>
<title><![CDATA[Zend Studio代码提示工作不正常的解决办法]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sat, 28 Aug 2010 12:32:02 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/733.htm</guid> 
<description>
<![CDATA[ 
	很简单，删除电脑当前用户下这个文件：<br />DefaultWorkspace7/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.dltk.ui.prefs<br />（例如：C:&#92;Users&#92;Administrator&#92;Zend&#92;workspaces&#92;DefaultWorkspace7&#92;.metadata&#92;.plugins&#92;org.eclipse.core.runtime&#92;.settings&#92;org.eclipse.dltk.ui.prefs<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/zend/" rel="tag">zend</a> , <a href="http://www.gaobo.info/go.php/tags/studio/" rel="tag">studio</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25BB%25A3%25E7%25A0%2581/" rel="tag">代码</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%258F%2590%25E7%25A4%25BA/" rel="tag">提示</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/732.htm</link>
<title><![CDATA[50个非常有用的PHP工具]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 18 Aug 2010 08:54:56 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/732.htm</guid> 
<description>
<![CDATA[ 
	<h3>调试工具</h3><ul><li><a href="http://code.google.com/p/webgrind/"><span style="color: #006699">Webgrind</span></a> </li><li><a href="http://xdebug.org/index.php"><span style="color: #006699">Xdebug</span></a> </li><li><a href="http://gubed.mccabe.nu/"><span style="color: #006699">Gubed PHP Debugger</span></a> </li><li><a href="http://www.php-debugger.com/dbg/"><span style="color: #006699">DBG</span></a> </li><li><a href="http://www.php-debug.com/www/"><span style="color: #006699">PHP_Debug</span></a> </li><li><a href="http://sourceforge.net/projects/php-dyn/"><span style="color: #006699">PHP_Dyn</span></a> </li><li><a href="http://www.bluestatic.org/software/macgdbp/"><span style="color: #006699">MacGDBp</span></a><br /></li></ul><h3>测试和优化工具</h3><ul><li><a href="http://www.phpunit.de/"><span style="color: #006699">PHPUnit</span></a> </li><li><a href="http://www.simpletest.org/"><span style="color: #006699">SimpleTest</span></a></li><li><a href="http://selenium-rc.openqa.org/"><span style="color: #006699">Selenium</span></a> </li><li><a href="http://matrix.squiz.net/developer/tools/php_cs"><span style="color: #006699">PHP_CodeSniffer</span></a> </li><li><a href="http://dbug.ospinto.com/"><span style="color: #006699">dBug</span></a> </li><li><a href="http://www.coderholic.com/php-profile-class/"><span style="color: #006699">PHP Profile Class</span></a><br /></li></ul><h3>文档工具</h3><ul><li><a href="http://phpdoc.org/"><span style="color: #006699">phpDocumentor</span></a> </li><li><a href="http://phpdox.net/"><span style="color: #006699">PHP DOX</span></a><br /></li></ul><h3>安全工具<br /></h3><ul><li><a href="http://www.phpcaptcha.org/"><span style="color: #006699">Securimage</span></a> ：验证码工具。 </li><li><a href="https://trac.anl.gov/scavenger/wiki/WikiStart"><span style="color: #006699">Scavenger</span></a> </li><li><a href="http://php-ids.org/"><span style="color: #006699">PHP-IDS</span></a> </li><li><a href="http://blog.evaria.com/2007/pixy-the-php-security-scanner/"><span style="color: #006699">Pixy</span></a> ：代码检查工具。<a href="http://www.phpchina.com/html/21/n-16721.html" target="_blank" class="l"></a> </li></ul><h3>图形处理</h3><ul><li><a href="http://www.maani.us/charts4/"><span style="color: #006699">PHP/SWF Charts</span></a> </li><li><a href="http://pchart.sourceforge.net/index.php"><span style="color: #006699">pChart - a chart-drawing PHP library</span></a> </li><li><a href="http://wideimage.sourceforge.net/wiki/MainPage"><span style="color: #006699">WideImage</span></a> </li><li><a href="http://www.magickwand.org/"><span style="color: #006699">MagickWand For PHP</span></a><br /></li></ul><h3>代码优化</h3><ul><li><a href="http://pear.php.net/package/PHP_Beautifier"><span style="color: #006699">PHP_Beautifier</span></a> </li><li><a href="http://www.waterproof.fr/products/phpCodeBeautifier/"><span style="color: #006699">PHPCodeBeautifier</span></a> </li><li><a href="http://qbnz.com/highlighter/"><span style="color: #006699">GeSHi - Generic Syntax Highlighter</span></a><br /></li></ul><h3>版本控制系统</h3><ul><li><a href="http://phing.info/trac/"><span style="color: #006699">Phing</span></a> </li><li><a href="http://code.google.com/p/xinc/"><span style="color: #006699">xinc</span></a><br /></li></ul><h3>有用的拓展，使用工具和类</h3><ul><li><a href="http://simplepie.org/"><span style="color: #006699">SimplePie</span></a> ：PHP RSS 解析程序 </li><li><a href="http://htmlpurifier.org/"><span style="color: #006699">HTML Purifier</span></a> ：可以用来移除所有恶意代码(XSS)，而且还能确保你的页面遵循W3C的标准规范。 </li><li><a href="http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf"><span style="color: #006699">TCPDF</span></a> ：一个用于快速生成PDF文件的PHP5函数包。 </li><li><a href="http://www.jonasjohn.de/lab/htmlsql.htm"><span style="color: #006699">htmlSQL</span></a> ：一个是你可以方便的对HTML和XML内容方便的使用类似SQL语句进行检索的PHP类。 </li><li><a href="http://searchlightdigital.com/the-greatest-php-snippet-file-ever-using-quicktext-for-notepad"><span style="color: #006699">The Greatest PHP Snippet File Ever (Using Quicktext for Notepad++)</span></a> </li><li><a href="http://creole.phpdb.org/trac/"><span style="color: #006699">Creole</span></a> ：用PHP5编写， 是一个基于真正意义的OO的层，API接口以JDBC为基础。 </li><li><a href="http://www.codeplex.com/PHPLinq"><span style="color: #006699">PHPLinq</span></a> ：<span class="l">用SQL语法操作PHP数组。</span> </li><li><a href="http://www.xm1math.net/phpmathpublisher/"><span style="color: #006699">PHPMathPublisher</span></a>：作者是一位法国中学数学老师。 </li><li><a href="http://www.phpmyadmin.net/home_page/index.php"><span style="color: #006699">phpMyAdmin</span></a> ：可以通过互联网在线控制和操作MySQL。 </li><li><a href="http://www.codeplex.com/PHPExcel"><span style="color: #006699">PHPExcel</span></a> ：相当强大的MS Office Excel 文档生成类库。 </li><li><a href="http://p.horm.org/er/"><span style="color: #006699">Phormer</span></a> :一个轻量级，强大的PHP在线相册。 </li><li><a href="http://www.xajaxproject.org/"><span style="color: #006699">xajax PHP Class Library</span></a> :一个开源的<em>PHP</em> 类库，用来构建WEB上的<em>Ajax</em> 程序。 </li><li><a href="http://phpuserclass.com/"><span style="color: #006699">PHP User Class</span></a> ：用户管理。 </li><li><a href="http://gtk.php.net/"><span style="color: #006699">PHP-GTK</span></a> ：为了证明PHP是一种远远超越网络应用程序的有效的工具而开发的。使用<em>PHP-GTK</em>你可以建立独立的GUI（用户图形界面）应用程序。<br /></li></ul><h3>在线工具和资源 </h3><ul><li><a href="http://code.google.com/p/minify/"><span style="color: #006699">Minify!</span></a> ：使用 PHP5 开发的用于合并压缩 js/css 文件的应用程序。合并压缩之后的结果可通过 HTTP gzip/deflate 及一些相关头，优化客户端缓存。 </li><li><a href="http://en.dklab.ru/lib/HTTP_StaticMerger/"><span style="color: #006699">HTTP_StaticMerger</span></a>：自动&ldquo;合并&rdquo;CSS和JavaScript文件。 </li><li><a href="http://www.phpobjectgenerator.com/"><span style="color: #006699">PHP Object Generator</span></a> ：一个开源的<em>PHP</em>代码生成器。它能够为你的PHP4/<em>PHP5</em>应用程序生成简洁和可测试的面向对象代码。 </li><li><a href="http://www.gotapi.com/php"><span style="color: #006699">gotAPI/PHP</span></a> </li><li><a href="http://www.koders.com/"><span style="color: #006699">koders</span></a> :开放源代码搜索。 </li><li><a href="http://pecl.php.net/"><span style="color: #006699">PECL</span></a> ：含有PHP 开发组提供的不同扩展库的信息。<br /></li></ul><h3>浏览器中的工具（Firefox插件）</h3><ul><li><a href="http://www.firephp.org/"><span style="color: #006699">FirePHP</span></a> ：是基于<a href="http://www.ooso.net/index.php/archives/294"><span style="color: #006699">Firebug</span></a>的一个扩展，可以用来在Firebug的console中方便的输出php的调试信息又不影响php程序的正常运行。 </li><li><a href="http://phplangeditor.mozdev.org/"><span style="color: #006699">phpLangEditor</span></a> ：是一个用来翻译各种PHP变数的工具. </li><li><a href="https://addons.mozilla.org/en-US/firefox/addon/3505"><span style="color: #006699">PHP Lookup</span></a> :是一个内置的搜索栏，以帮助您快速查找引用的PHP语法。 </li><li><a href="https://addons.mozilla.org/en-US/firefox/addon/8984"><span style="color: #006699">PHP Manual Search</span></a> ：一个方便的搜索栏，从您的Web浏览器中<a href="http://www.php.net/docs.php"><span style="color: #006699">搜索官方PHP文档</span></a>。<br /></li></ul><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/tool/" rel="tag">tool</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25B7%25A5%25E5%2585%25B7/" rel="tag">工具</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/730.htm</link>
<title><![CDATA[社交网数据库技术分析]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 18 Aug 2010 06:12:17 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/730.htm</guid> 
<description>
<![CDATA[ 
	<p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">传统互联网正在迈向一个全新的时代<span style="font-family: Times New Roman">&mdash;&mdash;</span><span>社交服务网（</span><span style="font-family: Times New Roman">Social&nbsp;Networking&nbsp;Service</span><span>）时代，从</span><span style="font-family: Times New Roman">&ldquo;</span><span>人与机器</span><span style="font-family: Times New Roman">&rdquo;</span><span>的时代迈向</span><span style="font-family: Times New Roman">&ldquo;</span><span>人与人</span><span style="font-family: Times New Roman">&rdquo;</span><span>的时代。互联网社交服务网站的发展验证了</span><span style="font-family: Times New Roman">&ldquo;</span><span>六度分隔理论</span><span style="font-family: Times New Roman">&rdquo;</span><span>（</span><span style="font-family: Times New Roman">Six&nbsp;Degrees&nbsp;of&nbsp;Separation</span><span>），即</span><span style="font-family: Times New Roman">&ldquo;</span><span>人际关系脉络方面你必然可以通过不超出六位中间人间接与世上任意先生女士相识</span><span style="font-family: Times New Roman">&rdquo;</span><span>。个体的社交圈会不断地扩大和重叠并最终形成大的社交网络。无论是国外的</span><span style="font-family: Times New Roman">Facebook</span><span>、</span><span style="font-family: Times New Roman">MySpace</span><span>、</span><span style="font-family: Times New Roman">Twitter</span><span>，还是国内的开心网、人人网等都一头扎进社交网，因为他们认定社交网必然掀起新一轮的互联网革命。</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">社交网的一个显著特点是支持巨大用户数，例如<span style="font-family: Times New Roman">Facebook</span><span>支持超过</span><span style="font-family: Times New Roman">3</span><span>亿的用户，其数据中心运行着超过万台的服务器，为遍布全球的用户提供信息通讯服务。另外，任何两个社交网用户都可能交互，也就是必须支持任何两个数据库用户的数据关联操作。这对于服务端的数据库管理提出了极大的挑战。</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt; font-weight: bold">关系数据库与<span style="font-family: Times New Roman">NoSQL </span><span>数据库 </span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">关系数据库使用者遵循一些数据库范式，这些范式是数据库设计中的一系列原理和技术，目的是为了减少数据库中数据冗余和增进数据的一致性。结构化查询语言<span style="font-family: Times New Roman">SQL</span><span>大量使用多表连接操作，</span><span style="font-family: Times New Roman">SQL</span><span>的通用性可以为使用者带来很多方便。</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">随着越来越多大规模工作负荷应用的发行，对可伸缩性的需求，可能会变得非常迅速和无比庞大。</span><span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">关系数据库的确能伸缩自如，但通常只能在单台服务器节点上进行。例如采用表分区技术，一个表格可以由多个物理文件组成，虽然表格的容量增大了，但该表格仍然只能由一数据库引擎管理；另外增加一物理文件时，表格<span style="font-family: Times New Roman">Schema</span><span>得做改动，也就是还不能支持动态扩容。</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">一旦单节点的能力抵达上限，就得通过多服务器节点来扩展来分发负载。这时关系数据库的复杂性就开始影响其潜在的扩展规模了。<span style="font-family: Times New Roman">RDBMS</span><span>支持分区视图（</span><span style="font-family: Times New Roman">Partition&nbsp;View</span><span>）&nbsp;技术，也就是支持联邦数据库（</span><span style="font-family: Times New Roman">Federated&nbsp;Database</span><span>）（如图</span><span style="font-family: Times New Roman">1</span><span>）。一个分区视图可以由多个分布在不同数据库节点服务器上的表格组合而成，数据库用户看到的只是该视图，不必关心物理表格。通过数据水平分割技术，分区视图把负载分担到多个数据库节点服务器上。扩容时，该方法除了需改动视图定义外，分区视图成为分布式数据库系统的中心，存在单点故障问题。另外，跨数据库节点之间多表格间连接操作的支持出现极大困难。</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt"><br /></span></p><div style="width: 310px"><a href="http://www.programmer.com.cn/wp-content/uploads/2010/07/%E6%8A%80%E6%9C%AF-1.gif" target="_blank"><img src="http://www.programmer.com.cn/wp-content/uploads/2010/07/%E6%8A%80%E6%9C%AF-1-300x149.gif" border="0" alt="图1&nbsp;&nbsp;IBM联邦数据库的体系结构" title="技术-1" width="300" height="149" /></a> <p>图1 IBM联邦数据库的体系结构</p></div><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">当试图扩展数据库系统到成百上千个节点时，将导致不堪复杂性之重负，这一特点使得<span style="font-family: Times New Roman">RDBMS</span><span>在大型分布式系统平台市场里的生存能力被大幅削减。</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">为了能向客户提供一个伸缩自如的空间存放应用数据，供应商实际上只有一种真正的选择<span style="font-family: Times New Roman">&mdash;&mdash;</span><span>实现一种新型的专注于可扩展性的数据库系统，而牺牲掉关系数据库所带来的其他好处。</span><span style="font-family: Times New Roman">NoSQL</span><span>是非关系型数据存储的广义定义，它打破了长久以来关系型数据库与</span><span style="font-family: Times New Roman">ACID</span><span>理论大一统的局面。</span><span style="font-family: Times New Roman">NoSQL</span><span>数据存储不需要固定的表结构，通常也不存在连接操作，在超大型数据存取上具备关系型数据库无法比拟的性能优势。该术语在</span><span style="font-family: Times New Roman">2009 </span><span>年初得到了广泛认同，其中</span><span style="font-family: Times New Roman">Key-Value</span><span>数据模型是解决大型数据库系统扩充问题的一种可行的解决方案。</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt; font-weight: bold">Berkeley&nbsp;DB&nbsp;Key-Value<span>数据模型</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt; font-weight: bold"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">Berkeley&nbsp;DB<span>是一种支持</span><span style="font-family: Times New Roman">Key-Value</span><span>数据模型的嵌入式数据库存储引擎。它不支持</span><span style="font-family: Times New Roman">Client/Server</span><span>网络访问方式，程序通过进程内的</span><span style="font-family: Times New Roman">API</span><span>访问数据库，不支持</span><span style="font-family: Times New Roman">SQL</span><span>或者其他数据库查询语言，不支持表结构和数据列。访问数据库的程序自主决定数据如何储存在记录里，一条记录由一个称为键（</span><span style="font-family: Times New Roman">Key</span><span>）的数据块和一个称为值（</span><span style="font-family: Times New Roman">Value</span><span>）的数据块组成。</span><span style="font-family: Times New Roman">Berkeley&nbsp;DB</span><span>不对记录里的数据进行任何包装。应用程序可通过回调函数来定义不同键之间的大小关系，记录和它的键都可以达到</span><span style="font-family: Times New Roman">4GB</span><span>的长度。尽管架构简单，</span><span style="font-family: Times New Roman">Berkeley&nbsp;DB</span><span>却支持很多高级的数据库特性，比如</span><span style="font-family: Times New Roman">ACID </span><span>数据库事务处理、细粒度锁、 </span><span style="font-family: Times New Roman">XA</span><span>接口、热备份以及同步复制。</span><span style="font-family: Times New Roman">Berkley&nbsp;DB</span><span>为不同用户提供多种功能集（</span><span style="font-family: Times New Roman">Feature&nbsp;Set</span><span>）：支持单个写线程的数据存储（</span><span style="font-family: Times New Roman">Data&nbsp;Store</span><span>）；支持多并发写线程的并发数据存储（</span><span style="font-family: Times New Roman">Concurrent&nbsp;Data&nbsp;Store</span><span>）；支持</span><span style="font-family: Times New Roman">ACID</span><span>和灾难恢复的事务数据存储（</span><span style="font-family: Times New Roman">Transactional&nbsp;Data&nbsp;Store</span><span>）；通过复制支持容错的高可靠数据存储（</span><span style="font-family: Times New Roman">High&nbsp;Availability</span><span>）。</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">关系数据库系统由存储引擎和关系引擎两个独立部分组成。存储引擎负责记录存储、索引和事务处理，关系引擎负责基于存储引擎提供的服务，分析<span style="font-family: Times New Roman">SQL</span><span>、制定查询执行计划等。</span><span style="font-family: Times New Roman">Berkeley&nbsp;DB</span><span>是一种存储引擎。例如</span><span style="font-family: Times New Roman">MySQL</span><span>数据库可采用</span><span style="font-family: Times New Roman">MyISAM</span><span>、</span><span style="font-family: Times New Roman">InnoDB</span><span>、</span><span style="font-family: Times New Roman">Berkeley&nbsp;DB</span><span>等存储引擎，如图</span><span style="font-family: Times New Roman">2</span><span>所示。</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt"><br /></span></p><div style="width: 310px"><a href="http://www.programmer.com.cn/wp-content/uploads/2010/07/%E6%8A%80%E6%9C%AF-2.gif" target="_blank"><img src="http://www.programmer.com.cn/wp-content/uploads/2010/07/%E6%8A%80%E6%9C%AF-2-300x165.gif" border="0" alt="图2&nbsp;&nbsp;MySQL使用的不同的存储引擎" title="技术-2" width="300" height="165" /></a> <p>图2 MySQL使用的不同的存储引擎</p></div><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">Berkeley&nbsp;DB<span>支持平衡树（</span><span style="font-family: Times New Roman">BTree</span><span>）、哈希（</span><span style="font-family: Times New Roman">Hash</span><span>）、队列（</span><span style="font-family: Times New Roman">Queue</span><span>）和记录（</span><span style="font-family: Times New Roman">Record</span><span>）等数据集存储和索引方式，还支持根据</span><span style="font-family: Times New Roman">Key-Value</span><span>中的</span><span style="font-family: Times New Roman">Key</span><span>创建集群索引（</span><span style="font-family: Times New Roman">Clustered&nbsp;Index</span><span>）。这样记录集的物理次序就根据</span><span style="font-family: Times New Roman">Key</span><span>值大小来排列。如果要查询结果记录集的键值为给定的一个范围，该特性对于支持这种类型的快速查询起了很大作用。</span><span style="font-family: Times New Roman">Berkeley&nbsp;DB</span><span>的一个</span><span style="font-family: Times New Roman">Key-Value</span><span>记录集称为一个数据库，会存储在一个单独文件中。</span><span style="font-family: Times New Roman">Berkeley&nbsp;DB</span><span>通过创建辅助数据库（</span><span style="font-family: Times New Roman">Secondary&nbsp;Database</span><span>），允许对记录集建立非集群索引（</span><span style="font-family: Times New Roman">Non-Clustered&nbsp;Index</span><span>）。非集群索引适用于快速查询结果为一条记录，该记录的键值为给定的一个值。例如社交网用户数据集：</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="letter-spacing: -0.15pt; color: #000000; font-size: 9pt">User&nbsp;&lt;UID,&nbsp;First_Name,&nbsp;Last_Name,&nbsp;Icon,&nbsp;E-mail&gt;</span><span style="color: #000000; font-size: 9pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">如果以<span style="font-family: Times New Roman">UID</span><span>作为主数据库的键，其他字段作为主数据库的值，可再创建一个辅助数据库，以</span><span style="font-family: Times New Roman">E-mail</span><span>作为辅助数据库的键，辅助数据库的值为</span><span style="font-family: Times New Roman">E-mail</span><span>所对应的</span><span style="font-family: Times New Roman">UID</span><span>，也就是指向主数据库记录的指针。若在一个</span><span style="font-family: Times New Roman">Key-Value</span><span>数据库查询，一般可根据查询条件创建成一个键值，引擎返回一个游标（</span><span style="font-family: Times New Roman">Cursor</span><span>），该游标指向等于或大于该键值的结果数据集。</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">不难看出<span style="font-family: Times New Roman">Berkeley&nbsp;DB</span><span>使用的索引技术与</span><span style="font-family: Times New Roman">SQL&nbsp;Server</span><span>、</span><span style="font-family: Times New Roman">Oracle</span><span>等高端数据库系统是一样的。</span><span style="font-family: Times New Roman">RDBMS</span><span>中经常使用的表格连接操作，在</span><span style="font-family: Times New Roman">Berkeley&nbsp;DB </span><span>中不再支持，需要应用程序去实现两个数据集的连接操作。这是</span><span style="font-family: Times New Roman">Key-Value</span><span>数据模型与关系数据模型典型的区别。</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">Berkeley&nbsp;DB&nbsp;<span>除了作为</span><span style="font-family: Times New Roman">MySQL</span><span>的存储引擎之外，还应用在</span><span style="font-family: Times New Roman">OpenLDAP</span><span>、</span><span style="font-family: Times New Roman">MemCache</span><span>等知名软件。</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">与<span style="font-family: Times New Roman">Berkeley&nbsp;DB</span><span>类似的数据库引擎还有</span><span style="font-family: Times New Roman">Tokyo&nbsp;Cabinet/&nbsp;Tyrant</span><span>等。</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt; font-weight: bold">社交网数据库系统<span style="font-family: Times New Roman">Cassandra </span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">以<span style="font-family: Times New Roman">Facebook</span><span>用户数据集为例，不可能把</span><span style="font-family: Times New Roman">3</span><span>亿条数据集存放在同一个表格、文件或由同一台计算机处理，这要求系统能支持数据分区，把数据集分割在多台节点计算机中，每台计算机分担一部分负载，当用户增加到一定程度时，系统能允许加入新的节点计算机，并且尽可能地减少数据迁移。</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt"> </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">2007<span>年</span><span style="font-family: Times New Roman">10</span><span>月</span><span style="font-family: Times New Roman">30</span><span>日，</span><span style="font-family: Times New Roman">Amazon</span><span>的</span><span style="font-family: Times New Roman">CTO&nbsp;Werner&nbsp;Vogels</span><span>发表了一篇文章，讨论了一种基于</span><span style="font-family: Times New Roman">Key-Value</span><span>数据模型的存储系统</span><span style="font-family: Times New Roman">Dynamo</span><span>。该系统支撑了不少</span><span style="font-family: Times New Roman">Amazon</span><span>的面向电子商务等关键性应用，它采用的存储引擎是 </span><span style="font-family: Times New Roman">Berkeley&nbsp;DB </span><span>事务数据存储（</span><span style="font-family: Times New Roman">Transactional&nbsp;Data&nbsp;Store</span><span>）。</span><span style="font-family: Times New Roman">Dynamo</span><span>系统主要为存储</span><span style="font-family: Times New Roman">1M</span><span>左右甚至更小的内容，如购物车、推荐列表等。</span><span style="font-family: Times New Roman">Dynamo</span><span>设计上有下面一些特点。</span></span></p><ul><li><span style="font-family: 'Times New Roman'; font-size: 10.5pt"><span>通过数据分区复制来支持高可靠性与高可伸缩性。</span></span></li><li><span style="font-family: 'Times New Roman'; font-size: 10.5pt"><span>始终可写。</span></span></li><li><span style="font-family: 'Times New Roman'; font-size: 10.5pt"><span>一致性与写入速度的折中，不要求同步写入所有副本。</span></span></li><li><span style="font-family: 'Times New Roman'; font-size: 10.5pt"><span>对称，完全去中心化，人工管理工作很小。</span></span></li></ul><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">Cassandra&nbsp;DB<span>最初由</span><span style="font-family: Times New Roman">Facebook</span><span>开发，后来转变成为开源项目。它是一个为网络社交云计算设计的数据库，主要特点是它不再是一个数据库，而是由一堆数据库节点共同构成的一个分布式网络服务，对</span><span style="font-family: Times New Roman">Cassandra </span><span>的一个写操作会被复制到其他节点上去，对</span><span style="font-family: Times New Roman">Cassandra</span><span>的读操作也会被路由到某个节点上面去读取。对于</span><span style="font-family: Times New Roman">Cassandra</span><span>群集来说，扩展性能是比较简单的事情，只管在群集里面添加节点就可以了。</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">Cassandra<span>的用户包括</span><span style="font-family: Times New Roman">Facebook</span><span>、</span><span style="font-family: Times New Roman">Twitter</span><span>和</span><span style="font-family: Times New Roman">Digg</span><span>等。</span><span style="font-family: Times New Roman">Digg</span><span>工程副总裁</span><span style="font-family: Times New Roman">John&nbsp;Quinn</span><span>说：</span><span style="font-family: Times New Roman">&ldquo;Cassandra</span><span>采用完全分散的模式，每个节点都一样，不会出现单点故障。它的容错率也非常高，数据可以被复制到数据中心的多个节点中。它还非常具有弹性，随着新设备的加入，其读写吞吐量将呈线性增加。</span><span style="font-family: Times New Roman">&rdquo;</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">Cassandra<span>以</span><span style="font-family: Times New Roman">Amazon</span><span>专有的完全分布式的 </span><span style="font-family: Times New Roman">Dynamo</span><span>为基础，结合了</span><span style="font-family: Times New Roman">Google&nbsp;BigTable</span><span>基于列族（</span><span style="font-family: Times New Roman">Column&nbsp;Family</span><span>）的数据模型。</span><span style="font-family: Times New Roman">P2P</span><span>去中心化的存储。很多方面都可以称之为</span><span style="font-family: Times New Roman">Dynamo&nbsp;2.0</span><span>。</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">图<span style="font-family: Times New Roman">3</span><span>为</span><span style="font-family: Times New Roman">Cassandra</span><span>、</span><span style="font-family: Times New Roman">Dynamo</span><span>、</span><span style="font-family: Times New Roman">Key-Value</span><span>之间的关系及在社交网上的应用。箭头表示依赖关系。</span></span></p><div style="width: 310px"><a href="http://www.programmer.com.cn/wp-content/uploads/2010/07/%E6%8A%80%E6%9C%AF-3.gif" target="_blank"><img src="http://www.programmer.com.cn/wp-content/uploads/2010/07/%E6%8A%80%E6%9C%AF-3-300x263.gif" border="0" alt="图3&nbsp;&nbsp;Cassandra、Dynamo、Key-Value关系图" title="技术-3" width="300" height="263" /></a> <p>图3 Cassandra、Dynamo、Key-Value关系图</p></div><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt; font-weight: bold">分布式存储系统<span style="font-family: Times New Roman">Dynamo</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">Dynamo<span>采用</span><span style="font-family: Times New Roman">Consistent&nbsp;Hashing</span><span>算法来实现数据分区。</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">Consistent&nbsp;Hashing<span>基本原理是：首先求出服务器节点的哈希值，并将其配置到</span><span style="font-family: Times New Roman">0</span><span>～</span><span style="font-family: Times New Roman">2^32</span><span>的圆上。然后用同样的方法求出存储数据的键的哈希值，并映射到圆上。再从数据映射到的位置开始顺时针查找，将数据保存到找到的第一个服务器上。如果超过</span><span style="font-family: Times New Roman">2^32</span><span>仍然找不到服务器，就会保存到第一台服务器上。如图</span><span style="font-family: Times New Roman">4</span><span>所示。</span></span></p><div style="width: 310px"><a href="http://www.programmer.com.cn/wp-content/uploads/2010/07/%E6%8A%80%E6%9C%AF-4.gif" target="_blank"><img src="http://www.programmer.com.cn/wp-content/uploads/2010/07/%E6%8A%80%E6%9C%AF-4-300x235.gif" border="0" alt="图4 数据分割到4个节点数据库" title="技术-4" width="300" height="235" /></a> <p>图4 数据分割到4个节点数据库</p></div><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">如果添加一台服务器。只有在圆上，增加服务器的地点逆时针方向的第一台服务器上的部分数据需要迁移到新的节点数据库。如图<span style="font-family: Times New Roman">5</span><span>所示。</span></span></p><div style="width: 310px"><a href="http://www.programmer.com.cn/wp-content/uploads/2010/07/%E6%8A%80%E6%9C%AF-5.gif" target="_blank"><img src="http://www.programmer.com.cn/wp-content/uploads/2010/07/%E6%8A%80%E6%9C%AF-5-300x254.gif" border="0" alt="图5 添加Node5后需要迁移的数据" title="技术-5" width="300" height="254" /></a> <p>图5 添加Node5后需要迁移的数据</p></div><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">数据分区后，数据块被复制到<span style="font-family: Times New Roman">N</span><span>个节点上。复制时因为更新产生的一致性问题的维护采取类似拜占庭容错</span><span style="font-family: Times New Roman">Quorum</span><span>协议（</span><span style="font-family: Times New Roman">Byzantine&nbsp;Fault-tolerance&nbsp;Quorum</span><span>）的机制以及去中心化的复制同步协议。当一个存储节点被认为是拜占庭节点时，它的行为可能任意偏移，表现在：拒绝响应请求、发送错误消息、存储错误信息。</span><span style="font-family: Times New Roman">Quorum</span><span>协议中除了</span><span style="font-family: Times New Roman">N</span><span>之外还有两个关键参数：</span><span style="font-family: Times New Roman">R</span><span>与</span><span style="font-family: Times New Roman">W</span><span>。</span><span style="font-family: Times New Roman">R</span><span>代表一次成功的读取操作中最小参与节点数量，</span><span style="font-family: Times New Roman">W</span><span>代表一次成功的写操作中最小参与节点数量。</span><span style="font-family: Times New Roman">R</span><span>和</span><span style="font-family: Times New Roman">W</span><span>直接影响性能、一致性。</span><span style="font-family: Times New Roman">R </span><span>和 </span><span style="font-family: Times New Roman">W </span><span>值过小则影响一致性，过大则影响效率，这两个值要平衡。如果</span><span style="font-family: Times New Roman">W</span><span>设置为</span><span style="font-family: Times New Roman">1</span><span>，则一个实例中只要有一个节点可写就写成功，不会影响写效率；如果</span><span style="font-family: Times New Roman">R</span><span>设置为</span><span style="font-family: Times New Roman">1</span><span>，只要有一个节点可读，就读成功，不会影响读效率。</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt; font-weight: bold">Facebook<span>数据库查询语言：</span><span style="font-family: Times New Roman">FQL</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">Facebook<span>为开发者提供一套和</span><span style="font-family: Times New Roman">SQL</span><span>风格一致的数据库查询语言，称为</span><span style="font-family: Times New Roman">Facebook&nbsp;Query&nbsp;Language </span><span>（</span><span style="font-family: Times New Roman">FQL</span><span>）。</span><span style="font-family: Times New Roman">FQL</span><span>是一种基于列的数据查询语言。提供丰富的条件查询，甚至包括子查询。</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">例如，以下<span style="font-family: Times New Roman">FQL</span><span>查询已安装</span><span style="font-family: Times New Roman">Facebook</span><span>应用程序的用户</span><span style="font-family: Times New Roman">$app_user</span><span>的好友</span><span style="font-family: Times New Roman">ID</span><span>集合：</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">SELECT&nbsp;uid&nbsp;FROM&nbsp;user&nbsp;WHERE&nbsp;is_app_user&nbsp;=&nbsp;1&nbsp;AND&nbsp;uid&nbsp;IN&nbsp;（SELECT&nbsp;uid2&nbsp;FROM&nbsp;friend&nbsp;WHERE&nbsp;uid1&nbsp;=&nbsp;$app_user）</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">与<span style="font-family: Times New Roman">SQL</span><span>重要区别是</span><span style="font-family: Times New Roman">FQL</span><span>不支持：</span></span></p><ul><li><span style="font-family: 'Times New Roman'; font-size: 10.5pt"><span>多表连接：</span><span style="font-family: Times New Roman">JOIN</span><span>操作</span></span></li><li><span style="font-family: 'Times New Roman'; font-size: 10.5pt"><span>分组： </span><span style="font-family: Times New Roman">GROUP&nbsp;BY</span><span>操作</span></span></li><li><span style="font-family: 'Times New Roman'; font-size: 10.5pt"><span>排序：</span><span style="font-family: Times New Roman">ORDER&nbsp;BY</span><span>操作</span></span></li></ul><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">随着技术发展，一部分基于列结构的<span style="font-family: Times New Roman">NoSQL</span><span>数据库开始支持分租、排序等复杂数据统计分析功能。</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">举例：查询好友信息</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">Facebook<span>应用程序从以下两个数据集中查找一用户的好友数据集信息：</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">User&nbsp;&lt;UID,First_Name,&nbsp;Last_Name,&nbsp;Icon&gt;</span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">Friend_List&nbsp;&lt;UID,&nbsp;Friend_UID&gt;</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-size: 10.5pt">注<span style="font-family: Times New Roman">Friend_UID</span><span>是一指向</span><span style="font-family: Times New Roman">User</span><span>（</span><span style="font-family: Times New Roman">UID</span><span>）的外键。</span></span><span style="font-family: 'Times New Roman'; font-size: 10.5pt">RDBMS<span>应用程序可使用数据集连接操作实现：</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">SELECT&nbsp;f.UID,&nbsp;u.Friend_UID,&nbsp;u.First_Name,&nbsp;u.Last_Name,&nbsp;u.Icon</span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">FROM&nbsp;Friend_List&nbsp;f,&nbsp;User&nbsp;u</span></p><p style="margin-top: 0pt; text-indent: 18pt; margin-bottom: 0pt"><span style="font-size: 9pt">WHERE&nbsp;f.Friend_UID&nbsp;=&nbsp;u.UID&nbsp;AND </span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">f.UID=@Input_UID</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">在社交网数据库系统中，由于<span style="font-family: Times New Roman">User</span><span>数据分布在多台服务器中，其连接操作和外键约束实际上不能支持。</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">在<span style="font-family: Times New Roman">Facebook</span><span>中查找一用户的好友信息，得分</span><span style="font-family: Times New Roman">A</span><span>、</span><span style="font-family: Times New Roman">B</span><span>两步操作实现：</span></span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">A步</span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">SELECT&nbsp;Friend_UID</span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">INTO&nbsp;@Out_Record_Set</span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">FROM&nbsp;Friend_List&nbsp;f</span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">WHERE&nbsp;f.UID=@Input_UID</span></p><p style="margin-top: 0pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">B步 </span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">FOR&nbsp;EACH&nbsp;（Friend_UID&nbsp;in&nbsp;@Out_Record_Set）</span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">SELECT&nbsp;u.Friend_UID,&nbsp;u.First_Name,&nbsp;u.Last_Name,&nbsp;u.Icon</span></p><p style="margin-top: 0pt; margin-bottom: 0pt"><span style="color: #000000; font-size: 9pt">FROM&nbsp;User&nbsp;u</span></p><p style="margin-top: 0pt; text-indent: 18pt; margin-bottom: 0pt"><span style="font-size: 9pt">WHERE&nbsp;u.UID&nbsp;=&nbsp;Friend_UID</span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt; font-weight: bold">No-SQL:&nbsp;Not&nbsp;Only&nbsp;SQL </span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">对于那些关系复杂的数据处理和分析统计，<span style="font-family: Times New Roman">SQL</span><span>值得花钱。但当数据库结构非常简单时，</span><span style="font-family: Times New Roman">SQL</span><span>可能没有太大用处。如果能用普通文件存储代替数据库系统的话，优选普通文件存储。</span></span></p><p style="margin-top: 0pt; text-indent: 21pt; margin-bottom: 0pt"><span style="font-family: 'Times New Roman'; font-size: 10.5pt">对于社交网，能够不受限制的扩展比更丰富的功能更加重要。建立大规模社交网成本的压力让很多社交网开发人员努力去寻找更高性价比的解决方案。研究表明基于普通廉价硬件的分布式存储解决方案比现在的高端数据库更加可靠。支持<span style="font-family: Times New Roman">SQL</span><span>的</span><span style="font-family: Times New Roman">RDBMS</span><span>不能解决所有问题的时候，</span><span style="font-family: Times New Roman">NoSQL</span><span>不是简单的</span><span style="font-family: Times New Roman">No&nbsp;SQL</span><span>，其本质是</span><span style="font-family: Times New Roman">Non-Relational</span><span>，这时候</span><span style="font-family: Times New Roman">NoSQL</span><span>也就成为</span><span style="font-family: Times New Roman">Not&nbsp;Only&nbsp;SQL</span><span>。<br /><br /><span style="font-size: 9pt">（本文来自《程序员》杂志10年0</span><span style="font-size: 9pt">7</span><span style="font-size: 9pt">期）</span></span></span></p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/social/" rel="tag">social</a> , <a href="http://www.gaobo.info/go.php/tags/database/" rel="tag">database</a> , <a href="http://www.gaobo.info/go.php/tags/db/" rel="tag">db</a> , <a href="http://www.gaobo.info/go.php/tags/tech/" rel="tag">tech</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25A4%25BE%25E4%25BA%25A4/" rel="tag">社交</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593/" rel="tag">数据库</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/724.htm</link>
<title><![CDATA[几个小技巧]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 09 Aug 2010 13:04:01 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/724.htm</guid> 
<description>
<![CDATA[ 
	<strong>1.简易判断ip地址合法性</strong><br/><div class="code">if(!strcmp(long2ip(sprintf(&quot;%u&quot;,ip2long($ip))),$ip)) &#123;<br/>echo &quot;is ip&#92;n&quot;;<br/>&#125;</div><br/><br/><strong>2.E-Mail的正则判断</strong><br/><div class="code">eregi(&quot;^&#91;_&#92;.0-9a-zA-Z-&#93;+@(&#91;0-9a-zA-Z&#93;&#91;0-9a-zA-Z_-&#93;+&#92;.)+&#91;a-zA-Z&#93;&#123;2,6&#125;$&quot;, $email);</div><br/><br/><strong>3.检测ip地址和mask是否合法的例子</strong><br/><div class="code">$ip = &#039;192.168.0.84&#039;;<br/>$mask = &#039;255.255.255.0&#039;;<br/>$network = &#039;192.168.0&#039;;<br/><br/>$ip = ip2long($ip);<br/>$mask = ip2long($mask);<br/>$network = ip2long($network);<br/><br/>if( ($ip &amp; $mask) == $network) echo &quot;valid ip and mask&#92;n&quot;;</div><br/><strong>4.关于表单刷新</strong><br/>问：为什么我在点击浏览器的后退按钮后，所有字段的信息都被清空了？<br/>答：这是由于你在你的表单提交页面中使用了 session_start 函数。该函数会强制当前页面不被缓存。<br/>解决办法为，在你的 Session_start 函数后加入 header(“Cache-control: private”);<br/>注意在本行之前你的PHP程序不能有任何输出。<br/>补充：还有基于session的解决方法，在session_start前加上<br/><div class="code">session_cache_limiter(&#039;nocache&#039;);// 清空表单<br/>session_cache_limiter(&#039;private&#039;); //不清空表单，只在session生效期间<br/>session_cache_limiter(&#039;public&#039;); //不清空表单，如同没使用session一般</div><br/>可以在session_start();前加上 session_cache_limiter("private,max-age=10800");<br/><br/><strong>5.快速搞定文件下载头部输出</strong><br/><div class="code">header(&quot;Content-type: application/x-download&quot;);<br/>header(&quot;Content-Disposition: attachment; filename=$file_download_name;&quot;);<br/>header(&quot;Accept-Ranges: bytes&quot;);<br/>header(&quot;Content-Length: $download_size&quot;);<br/>echo &#039;xxx&#039;;</div><br/><br/><strong>6.用header输出FTP下载方式，并且支持断点续传</strong><br/><div class="code">header(&#039;Pragma: public&#039;);<br/>header(&#039;Cache-Control: private&#039;);<br/>header(&#039;Cache-Control: no-cache, must-revalidate&#039;);<br/>header(&#039;Accept-Ranges: bytes&#039;);<br/>header(&#039;Connection: close&#039;);<br/>header(&quot;Content-Type: audio/mpeg&quot;);<br/>header(&quot;Location:ftp://download:1@1.1.1.1/1/1/1.rmvb&quot;);</div><br/><br/><strong>7.一个不错的打印DEBUG信息的函数</strong><br/><div class="code">function debug()<br/>&#123;<br/>if (!defined(&#039;DEBUG&#039;))&#123;<br/>return;<br/>&#125;<br/>$args = func_get_args();<br/>$msg = $args&#91;0&#93;;<br/>array_shift($args);<br/>$else = implode(&#039; &#039;, $args);<br/>printf(&quot;&#91;Debug&#93; $msg &#91;addition info&#93;: $else&#92;n&quot;);<br/>&#125;</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/tip/" rel="tag">tip</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%258A%2580%25E5%25B7%25A7/" rel="tag">技巧</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/723.htm</link>
<title><![CDATA[Header 跳转详细规则 函数]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 09 Aug 2010 12:57:15 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/723.htm</guid> 
<description>
<![CDATA[ 
	函数定义：<br/><div class="code">&lt;?php<br/>/**<br/>* HTTP Protocol defined status codes<br/>* @param int $num<br/>*/<br/>function statHTTPStatus($num) &#123;<br/>&nbsp;&nbsp;static $http = array (<br/>&nbsp;&nbsp;&nbsp;&nbsp;100 =&gt; &quot;HTTP/1.1 100 Continue&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;101 =&gt; &quot;HTTP/1.1 101 Switching Protocols&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;200 =&gt; &quot;HTTP/1.1 200 OK&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;201 =&gt; &quot;HTTP/1.1 201 Created&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;202 =&gt; &quot;HTTP/1.1 202 Accepted&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;203 =&gt; &quot;HTTP/1.1 203 Non-Authoritative Information&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;204 =&gt; &quot;HTTP/1.1 204 No Content&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;205 =&gt; &quot;HTTP/1.1 205 Reset Content&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;206 =&gt; &quot;HTTP/1.1 206 Partial Content&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;300 =&gt; &quot;HTTP/1.1 300 Multiple Choices&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;301 =&gt; &quot;HTTP/1.1 301 Moved Permanently&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;302 =&gt; &quot;HTTP/1.1 302 Found&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;303 =&gt; &quot;HTTP/1.1 303 See Other&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;304 =&gt; &quot;HTTP/1.1 304 Not Modified&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;305 =&gt; &quot;HTTP/1.1 305 Use Proxy&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;307 =&gt; &quot;HTTP/1.1 307 Temporary Redirect&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;400 =&gt; &quot;HTTP/1.1 400 Bad Request&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;401 =&gt; &quot;HTTP/1.1 401 Unauthorized&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;402 =&gt; &quot;HTTP/1.1 402 Payment Required&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;403 =&gt; &quot;HTTP/1.1 403 Forbidden&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;404 =&gt; &quot;HTTP/1.1 404 Not Found&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;405 =&gt; &quot;HTTP/1.1 405 Method Not Allowed&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;406 =&gt; &quot;HTTP/1.1 406 Not Acceptable&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;407 =&gt; &quot;HTTP/1.1 407 Proxy Authentication Required&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;408 =&gt; &quot;HTTP/1.1 408 Request Time-out&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;409 =&gt; &quot;HTTP/1.1 409 Conflict&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;410 =&gt; &quot;HTTP/1.1 410 Gone&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;411 =&gt; &quot;HTTP/1.1 411 Length Required&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;412 =&gt; &quot;HTTP/1.1 412 Precondition Failed&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;413 =&gt; &quot;HTTP/1.1 413 Request Entity Too Large&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;414 =&gt; &quot;HTTP/1.1 414 Request-URI Too Large&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;415 =&gt; &quot;HTTP/1.1 415 Unsupported Media Type&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;416 =&gt; &quot;HTTP/1.1 416 Requested range not satisfiable&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;417 =&gt; &quot;HTTP/1.1 417 Expectation Failed&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;500 =&gt; &quot;HTTP/1.1 500 Internal Server Error&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;501 =&gt; &quot;HTTP/1.1 501 Not Implemented&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;502 =&gt; &quot;HTTP/1.1 502 Bad Gateway&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;503 =&gt; &quot;HTTP/1.1 503 Service Unavailable&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;504 =&gt; &quot;HTTP/1.1 504 Gateway Time-out&quot;<br/>&nbsp;&nbsp;);<br/>&nbsp;&nbsp;header($http&#91;$num&#93;);<br/>&#125;<br/>?&gt;</div><br/>用法：<br/><div class="code">&lt;?php<br/>statHTTPStatus(301);<br/>Header(&quot;Location: http://www.gaobo.info/&quot;);<br/>exit;<br/>?&gt;</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/header/" rel="tag">header</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2587%25BD%25E6%2595%25B0/" rel="tag">函数</a> , <a href="http://www.gaobo.info/go.php/tags/function/" rel="tag">function</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/722.htm</link>
<title><![CDATA[一个短小精悍的MySQL类]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 09 Aug 2010 12:54:38 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/722.htm</guid> 
<description>
<![CDATA[ 
	<p><a href="attachment.php?fid=93">点击这里下载文件</a></p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.gaobo.info/go.php/tags/class/" rel="tag">class</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593/" rel="tag">数据库</a> , <a href="http://www.gaobo.info/go.php/tags/db/" rel="tag">db</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/718.htm</link>
<title><![CDATA[在WinXP下配置PHP 5.2.13出现的囧事]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 05 Jul 2010 08:16:38 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/718.htm</guid> 
<description>
<![CDATA[ 
	今天需要在一个WinXP下配置一个PHP 5.2.13的开发环境，开始图省事，安装IIS以后，下载一个PHPOpt4IIS安装，结果装完打开localhost查看phpinfo()，报错：&ldquo;您未被授权查看该页&rdquo;和&ldquo;HTTP 错误 401.3 - 未经授权：访问由于 ACL 对所请求资源的设置被拒绝。&rdquo;<br />很诡异的错误信息。<br />一开始以为是Web目录的权限问题，反复修改IUSR用户的权限，甚至连这个用户的密码都修改和同步了还是没变化&hellip;&hellip;&hellip;&hellip;<br />重新GG、BAIDU了下，<a href="http://hi.baidu.com/daxxing/blog/item/d7a2e0c8053566137e3e6f44.html" target="_blank">有人提到这个可能性</a>：<br />&ldquo;翻了好多网站，看到有说为了安全，把windows目录去掉了user组，asp.net就无法正常使用了，想想不会是是php.exe php.ini php5isapi.dll这几个文件没有users的问题导致吧&rdquo;<br />抱着试一试的心理打开Windows&#92;System32目录下的所有PHP Dlls的属性，切换到&ldquo;安全&rdquo;选项卡，提示这些文件之间权限不一致，是否清除到默认，选择是，再次查看，发现OK了。<br />iisreset<br />打开localhost查看phpinfo()，Oh YEAH!!<br /><br />=============不怎么华丽的分割线=============<br /><br />配置好PHP后发现无论怎么设置extension_dir都无效，各种扩展都无法被加载，继续囧&hellip;&hellip;<br />突然发现用的是NTS（Non-Thread Safe）的版本，马上换一个TS的试一下。<br />好了。<br />继续囧&hellip;&hellip;<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/windows/" rel="tag">windows</a> , <a href="http://www.gaobo.info/go.php/tags/xp/" rel="tag">xp</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/localhost/" rel="tag">localhost</a> , <a href="http://www.gaobo.info/go.php/tags/phpinfo/" rel="tag">phpinfo</a> , <a href="http://www.gaobo.info/go.php/tags/iusr/" rel="tag">iusr</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%259D%2583%25E9%2599%2590/" rel="tag">权限</a> , <a href="http://www.gaobo.info/go.php/tags/nts/" rel="tag">nts</a> , <a href="http://www.gaobo.info/go.php/tags/thread/" rel="tag">thread</a> , <a href="http://www.gaobo.info/go.php/tags/safe/" rel="tag">safe</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/717.htm</link>
<title><![CDATA[WSF/PHP调用带有WS-Security支持的Web Service时的注意事项]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 05 Jul 2010 04:30:42 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/717.htm</guid> 
<description>
<![CDATA[ 
	<p>目前在PHP中调用带有WS-Security支持的Web Service解决方案还是比较少的，WSF/PHP是一个不错的选择，官方首页为<a href="http://wso2.org/projects/wsf/php"><a href="http://wso2.org/projects/wsf/php" target="_blank">http://wso2.org/projects/wsf/php</a></a>，下面就介绍下在运用WSF/PHP的时候需要注意的一些地方</p><p>1、WSF/PHP【WSO2 Web Services Framework for PHP】 是WSO2.ORG提供的专门针对PHP调用Web Service的一个优秀框架，使用非常简单；但是WSO2不仅仅提供针对PHP的ws框架，而且还对其他很多中语言提供开发框架，比如基于Spring、Perl、Ruby&hellip;&hellip;，除此之外还提供很多其他框架和培训服务，具体可查询wso2.org和wso2.com；<br />2、WSF/PHP模块的安装需要很多其他的支持包，在windows下面体现为一些dll文件，主要包括Libxml2、iconv、Openssl、zlib，而不仅仅是Libxml2【GNOME XML Library】；安装过程中需要将这些依赖dll全部都集中到wsf_c/lib/目录中；这些依赖包可以到<a href="http://www.zlatkovic.com/pub/libxml/"><a href="http://www.zlatkovic.com/pub/libxml/" target="_blank">http://www.zlatkovic.com/pub/libxml/</a></a>下载，下载完成之后对各压缩包解压，dll文件一般位于/bin/目录中；<br />3、WSF所依赖的这些dll文件一定需要copy到/windows/system32/中才行，否则加载模块不成功；这点和官方文档中说的直接将wsf_c/lib/加入到path中即可是不一致的；当然这点可能有其他方式可以解决，因为我不精通PHP，但是和一些同事沟通过，但没结果；<br />4、验证是否正常加载了WSF模块，只用php -m命令查看列表是不够的，即时WSF模块没有加载成功，但是php.ini中设置了WSF模块，那php -m的列表中也会包括WSF；最保险的做法是查看服务器日志比如Apache；<br />5、在申明WSSecurityToken实例的时候，参数receiverCertificate是用来加密Soap消息的，而不是用来验证服务端返回的签名信息的，所以若只是需要签名，那该参数无需设置；WSF/PHP目前还没有提供验证服务端返回的签名信息功能的；<br />6、WSF/PHP调用WS时默认使用SOAP 1.2协议，这可能会对某些服务端ws调用时出错，若需要设置使用SOAP版本，则可以在申请WSClient实例时设置参数&quot;useSOAP&quot; =&gt; &quot;1.1&quot;实现</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/web/" rel="tag">web</a> , <a href="http://www.gaobo.info/go.php/tags/service/" rel="tag">service</a> , <a href="http://www.gaobo.info/go.php/tags/ws/" rel="tag">ws</a> , <a href="http://www.gaobo.info/go.php/tags/security/" rel="tag">security</a> , <a href="http://www.gaobo.info/go.php/tags/framework/" rel="tag">framework</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/714.htm</link>
<title><![CDATA[数据库方面的经典网站]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 09 Jun 2010 00:56:56 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/714.htm</guid> 
<description>
<![CDATA[ 
	<a href="http://www.dbms2.com/"><a href="http://www.dbms2.com/" target="_blank">http://www.dbms2.com/</a></a><br /><a href="http://www.odbms.org/blog/"><a href="http://www.odbms.org/blog/" target="_blank">http://www.odbms.org/blog/</a></a><br /><a href="http://perspectives.mvdirona.com/"><a href="http://perspectives.mvdirona.com/" target="_blank">http://perspectives.mvdirona.com/</a></a><br /><a href="http://databasecolumn.vertica.com/"><a href="http://databasecolumn.vertica.com/" target="_blank">http://databasecolumn.vertica.com/</a></a><br /><a href="http://asktom.oracle.com/"><a href="http://asktom.oracle.com/" target="_blank">http://asktom.oracle.com/</a></a><br /><a href="http://www.itpub.net/"><a href="http://www.itpub.net/" target="_blank">http://www.itpub.net/</a></a><br /><a href="http://peter-zaitsev.livejournal.com/"><a href="http://peter-zaitsev.livejournal.com/" target="_blank">http://peter-zaitsev.livejournal.com/</a></a><br />《MySQL High Availability》<br /><a href="http://www.dbta.com/"><a href="http://www.dbta.com/" target="_blank">http://www.dbta.com/</a></a><br /><a href="http://blogs.sybase.com/database/"><a href="http://blogs.sybase.com/database/" target="_blank">http://blogs.sybase.com/database/</a></a><br /><a href="http://blogs.sybase.com/sybaseiq/"><a href="http://blogs.sybase.com/sybaseiq/" target="_blank">http://blogs.sybase.com/sybaseiq/</a></a>(这是列式数据库的专业文章) <br /><a href="http://blogs.msdn.com/sqlcrd/"><a href="http://blogs.msdn.com/sqlcrd/" target="_blank">http://blogs.msdn.com/sqlcrd/</a></a><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/db/" rel="tag">db</a> , <a href="http://www.gaobo.info/go.php/tags/database/" rel="tag">database</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593/" rel="tag">数据库</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25BB%258F%25E5%2585%25B8/" rel="tag">经典</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25AB%2599%25E7%2582%25B9/" rel="tag">站点</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25BD%2591%25E7%25AB%2599/" rel="tag">网站</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/709.htm</link>
<title><![CDATA[最简单实现iframe自适应高度]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 28 May 2010 16:04:32 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/709.htm</guid> 
<description>
<![CDATA[ 
	<div class="code">&lt;iframe id=&quot;iFrame1&quot; name=&quot;iFrame1&quot; width=&quot;100%&quot; onload=&quot;this.height=iFrame1.document.body.scrollHeight&quot; frameborder=&quot;0&quot; src=&quot;index.htm&quot;&gt;&lt;/iframe&gt;</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/iframe/" rel="tag">iframe</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%25AB%2598%25E5%25BA%25A6/" rel="tag">高度</a> , <a href="http://www.gaobo.info/go.php/tags/height/" rel="tag">height</a> , <a href="http://www.gaobo.info/go.php/tags/html/" rel="tag">html</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/694.htm</link>
<title><![CDATA[22个所见即所得在线Web编辑器]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 26 Feb 2010 07:28:05 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/694.htm</guid> 
<description>
<![CDATA[ 
	本文搜集了 22 个 Web 在线编辑器，它们基本代表了当前 Web 编辑器的现状。 <p><a href="http://sixrevisions.com/user-interface/rich-text-editors-for-2010-and-beyond/"><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-01_rte_lead_img.jpg" border="0" alt="Rich-Text Editors for 2010 and Beyond" width="550" height="200" /></a><br />1. <a href="http://tinymce.moxiecode.com/">TinyMCE</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-02_tinymce.jpg" border="0" alt="TinyMCE" width="550" height="182" /><br /><br />免费，开源，轻量，基于 JavaScript，高度可定制，跨平台。<br />2. <a href="http://www.fckeditor.net/">FCKEditor</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-03_ckeditor.jpg" border="0" alt="FCKEditor" width="550" height="176" /><br /><br />免费，开源，用户量庞大，有良好的社区支持。<br />3. <a href="http://developer.yahoo.com/yui/editor/">YUI Editor</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-04_yui.png" border="0" alt="YUI Editor" width="550" height="180" /><br /><br />属于 Yahoo! YUI 的一部分，能输出纯净 XHTML 代码。<br />4. <a href="http://nicedit.com/">NicEdit</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-05_nicedit.jpg" border="0" alt="NicEdit" width="550" height="120" /><br /><br />简单，易用，轻量，外观漂亮。<br />5. <a href="http://kupu.oscom.org/">Kupu</a> <br /><a href="http://en.wikipedia.org/wiki/Kupu"><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-06_kupu.jpg" border="0" alt="Kupu" width="550" height="168" /></a><br /><br />开源，支持 Ajax 保存，跨平台，易于集成，由 OSCOM 推出。<br /><br />6. <a href="http://www.freerichtexteditor.com/">Free Rich Text Editor</a> <br /><a href="http://www.freerichtexteditor.com/"><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-07_freerte.png" border="0" alt="Free&nbsp;&nbsp;Rich Text Editor" width="550" height="151" /></a><br /><br />非常容易部署，输出 XHTML 代码，功能丰富。<br />7. <a href="http://www.webwizguide.com/webwizrichtexteditor/">WebWiz RichTextEditor</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-08_webwiz.jpg" border="0" alt="WebWiz RichTextEditor" width="550" height="145" /><br /><br />这是一个商业产品，并不免费，但功能非常丰富，基于 ASP，JavaScript 和 DHTML。<br />8. <a href="http://xstandard.com/">XStandard</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-09_xstandard.png" border="0" alt="XStandard" width="550" height="109" /><br /><br />故名思意，这个编辑器会生成符合标准的纯净 XHTML 代码。<br />9. <a href="http://avidansoft.com/dsrte/">Damn Small Rich Text Editor</a> <br /><img src="http://images.sixrevisions.com/2010/02/01-10_damnsmall.jpg" border="0" alt="Damn Small Rich Text Editor" width="550" height="150" /><br /><br />基于 jQuery 和 PHP 后台，非常小巧（~18K），但功能丰富。<br />10. <a href="http://www.themaninblue.com/experiment/widgEditor/">WidgEditor</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-11_widgeditor.jpg" border="0" alt="WidgEditor" width="550" height="161" /><br /><br />简单，易用，开源，即使浏览器不支持 JavaScript，仍能很好地工作。<br />11. <a href="http://www.kevinroth.com/rte/">Kevin Roth&rsquo;s Cross Browser Rich Text Editor</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-12_rothrte.jpg" border="0" alt="Kevin Roth&rsquo;s Cross Browser Rich Text Editor" width="550" height="234" /><br /><br />一个不错的编辑器，支持皮肤，符合 XHTML 标准，跨浏览器兼容，分免费版和收费版两个版本。<br />12. <a href="http://www.openwebware.com/">OpenWYSIWYG</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-13_openwysiwyg.jpg" border="0" alt="OpenWYSIWYG" width="550" height="136" /><br /><br />拥有许多出色的功能，容易部署，速度极快。<br />13. <a href="http://www.codeplex.com/rte">CodePlex Rich Text Editor</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-14_codeplex.png" border="0" alt="CodePlex Rich Text Editor" width="550" height="97" /><br /><br />基于 ASP.NET，目前只支持 IE 和 Firefox。<br />14. <a href="http://freetextbox.com/">FreeTextBox</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-15_freetextbox.png" border="0" alt="FreeTextBox" width="550" height="161" /><br /><br />集成了相册，拼写检查等功能，尤其适合 ASP.NET 项目。<br />15. <a href="http://www.codeplex.com/richtextedit">Silverlight Rich Text Editor</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-16_silverlight.jpg" border="0" alt="Silverlight Rich Text Editor" width="550" height="94" /><br /><br />适合与微软的 Silverlight 一起使用，功能丰富，不过，似乎原作者已经不再更新这个项目了。<br />16. <a href="http://www.bitfluxeditor.org/">BXE (Bitflux Editor)</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-17_bitflux.png" border="0" alt="BXE (Bitflux Editor)" width="550" height="94" /><br /><br />从 2002 年以来一直开源，拥有一批非常忠实的用户和社区，据称是目前最好的 WYSIWYG 编辑器之一。<br />17. <a href="http://markitup.jaysalvat.com/home/">MarkItUp!</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-18_markitup.jpg" border="0" alt="MarkItUp!" width="550" height="236" /><br /><br />基于 jQuery，轻量，支持键盘快捷键，支持多种代码，包括 HTML, Textile, Wiki Syntax, Markdown, BBcode。<br />18. <a href="http://dojotoolkit.org/book/dojo-book-0-9/part-2-dijit/advanced-editing-and-display/editor-rich-text">Dijit Editor for Dojo</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-19_dojo.jpg" border="0" alt="Dijit Editor for Dojo" width="550" height="100" /><br /><br />基于 Dojo JavaScript 框架，输出干净 HTML 代码，支持插件，拥有清新的按钮。<br />19. <a href="http://www.cdolivet.com/editarea/editarea/docs/">EditArea</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-20_editarea.png" border="0" alt="EditArea" width="550" height="98" /><br /><br />易于集成，干净代码，实时语法加亮，自动缩进，多语种支持，多实例支持，全屏模式等功能。<br />20. <a href="http://www.wymeditor.org/">WYMeditor</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-21_wymeditor.jpg" border="0" alt="WYMeditor" width="550" height="124" /><br /><br />输出干净的 XHTML + SCTRICT 代码，注重结构与语义，在输出结构化 XHTML 代码方面是最佳方案。<br />21. <a href="http://www.unverse.net/whizzywig-cross-browser-html-editor.html">Whizzywig</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-22_whizzywig.png" border="0" alt="Whizzywig" width="550" height="161" /><br /><br />多浏览器支持，Web 安全色选择器，支持表格，图片，Word 代码清洁，拼写检查等功能。<br />22. <a href="http://xinha.webfactional.com/">Xinha</a> <br /><img style="border: black 1px solid" src="http://images.sixrevisions.com/2010/02/01-23_xinha.png" border="0" alt="Xinha" width="550" height="152" /><br /><br />基于<a href="http://www.opensource.org/licenses/bsd-license.html">BSD协议</a>，易于部署与扩展，拥有很好的社区支持。</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/web/" rel="tag">web</a> , <a href="http://www.gaobo.info/go.php/tags/editor/" rel="tag">editor</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25BC%2596%25E8%25BE%2591%25E5%2599%25A8/" rel="tag">编辑器</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2589%2580%25E8%25A7%2581%25E5%258D%25B3%25E6%2589%2580%25E5%25BE%2597/" rel="tag">所见即所得</a> , <a href="http://www.gaobo.info/go.php/tags/wysiwyg/" rel="tag">wysiwyg</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/669.htm</link>
<title><![CDATA[如何进行平台型网站架构设计？]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Tue, 27 Oct 2009 13:33:37 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/669.htm</guid> 
<description>
<![CDATA[ 
	<p>在欧拉的&ldquo;<a href="http://www.iisol.cn/?p=865" target="_blank"><span style="color: #0b59b2">平台网站架构设计之我所见</span></a>&rdquo;的博客中，他从选择技术方案和物理架构、平台研发和架构优化等方面阐述了他在多年的平台型网站架构设计过程中的经验心得。</p><p>欧拉先是分析了在选择技术方案和物理架构中的几个常见问题，以来解决如何提高开发效率，使平台具有高性能、高负载性的问题：</p><blockquote><strong>开发语言和数据库：</strong>我个人觉的最关键是你和你的团队最擅长的开发语言和数据库是哪个，古语有云：&ldquo;工欲善其事,必先利其器！&rdquo;，趁手的开发语言和数据库有助于事半功倍。试想如果你选择了一个并不很熟悉的语言，也许这个语言和数据库在基础性能上的确比你掌握的语言好，但是在研发过程中学习曲线肯定长。<br /><br /><strong>成熟框架还是自己实现：</strong>我个人的一些经验是，尽量使用开源的成熟框架，因为平台研发初期使用成熟的开源框架，能提高开发效率，并且在质量上有保证。我曾经接手过一个平台的改版，框架是前面开发人员自己写的，里面的一些设计思想不是很成熟，导致平台在负载增高后性能很差，整改起来很麻烦。 </blockquote><p>除此之外，Web Server/DB Server/Cache Server的选择也是很重要的一点，欧拉认为这一部分一定要使用具有前瞻性、易配置、能监控和维护的产品，并提出几个选型的标准：丰富和深入的配置选项、基于高并发模型、支持负载均衡和请求分发、高效的缓存机制、实时的状态监控机制等。而对于操作系统的选择，则要稳定安全、易管理和维护、易监控等。对于物理架构，即服务器的搭建方式，欧拉同样认为前瞻性是非常重要的：</p><blockquote>平台初期的话，我想大部分访问量都不高，Web Server/DB server/Cache Server放在一台服务器上都没问题。但是自己心里最好能预估一下这个平台会发展到什么样的规模，在做架构设计的时候，按照事先预估的来决定怎么做物理架构，并为以后的架构升级做准备。说到这里，想到前百度架构师雷鸣说过的一句话，当你的会员数达到目前的5倍或10倍的时候，架构就要升级。 </blockquote><p>在实质性的研发过程中，需要注意的是平台网站研发的模式和传统IT项目研发的不同，以前是开发过程中要和客户、需求人员等打交道，而现在关注的是产品设计。对于平台网站研发项目的管理，欧拉推荐使用敏捷开发方法，通过设立短的发布周期进行迭代开发，并使用JIRA等成熟的项目管理系统进行管理等。对于团队研发需要注意的地方，欧拉总结如下：</p><ul><li>合适的开发工具； </li><li>如何控制代码质量； </li><li>（根据）需要引入新框架； </li><li>知识总结和培训。 </li></ul><p>对网站研发过程中的架构优化、存储和搜索等关键点，欧拉也分享了自己的经验，比如对于网站速度慢，而却又不知如何下手的问题，欧拉提出的解决方案是：</p><blockquote>我的经验是从数据开始，从最外围开始画圈，找到源头。先从外围开始收集日志，比如access_log访问日志或sql_log数据库操作日志，找出访问最多的10条日志和执行时间最长的10条日志，然后根据日志去反查到底是什么引起的操作，然后一条条的解决。如果解决不了，那么就考虑重构。 </blockquote><p>在文章的最后，欧拉来分享了一些他认为有价值的资料，比如<a href="http://www.tech-q.cn/thread-1216-1-1.html" target="_blank"><span style="color: #0b59b2">新型的大型BBS架构（Squid+Nginx）</span></a>、<a href="http://www.tech-q.cn/thread-1301-1-1.html" target="_blank"><span style="color: #0b59b2">Nginx图片服务器的架构方案</span></a>、<a href="http://www.tech-q.cn/thread-1330-1-1.html" target="_blank"><span style="color: #0b59b2">校内相册发展过程及核心技术分析爆料</span></a>、<a href="http://www.tech-q.cn/thread-721-1-3.html" target="_blank"><span style="color: #0b59b2">架构设计贵在务实</span></a>、<a href="http://www.tech-q.cn/thread-857-1-2.html" target="_blank"><span style="color: #0b59b2">大型网站架构不得不考虑的10个问题</span></a>等。<br /><br />摘自：<a href="http://www.infoq.com/cn/news/2009/10/how-to-design-platform-websites"><a href="http://www.infoq.com/cn/news/2009/10/how-to-design-platform-websites" target="_blank">http://www.infoq.com/cn/news/2009/10/how-to-design-platform-websites</a></a></p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/web/" rel="tag">web</a> , <a href="http://www.gaobo.info/go.php/tags/platform/" rel="tag">platform</a> , <a href="http://www.gaobo.info/go.php/tags/website/" rel="tag">website</a> , <a href="http://www.gaobo.info/go.php/tags/architecture/" rel="tag">architecture</a> , <a href="http://www.gaobo.info/go.php/tags/design/" rel="tag">design</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25B9%25B3%25E5%258F%25B0/" rel="tag">平台</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25BD%2591%25E7%25AB%2599/" rel="tag">网站</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%259E%25B6%25E6%259E%2584/" rel="tag">架构</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25AE%25BE%25E8%25AE%25A1/" rel="tag">设计</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/658.htm</link>
<title><![CDATA[[转]ASP.NET比拼PHP，谁是速度之王？]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 30 Sep 2009 01:09:27 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/658.htm</guid> 
<description>
<![CDATA[ 
	新闻来源:IT168<br />刚刚在9月编程语言排行榜上取得历史性突破的PHP在Web开发领域最到的对手可能就是基于微软.NET技术的ASP.NET。近日，微软的Joe Stagner在博客上发表了一系列文章比较了PHP和ASP.NET性能方面的文章，引起了来自双方程序员的大量回应。Joe表示，他会将这样的测试持续下去，并寻求更为合适的方式，以获得对实际项目来说尽可能有参考价值的结论。 <p></p><div>&nbsp;</div>Joe在博客中称，一般来说，作性能测试的目的是要尝试证明一方比令一方要快。我受雇于微软，同时编写PHP和ASP.NET代码。我在.NET出现之前就在使用PHP，两个东西我都很喜欢。<br /><br />所以，我很难说出哪个更好。当我说PHP好话时，我的微软同事们会写信来批评我，而当我发表倾向于ASP.NET的言论时，我的PHP朋友们会说我是微软的托。<br /><br />我进行这个测试是因为每个人都对PHP的性能有自己的看法(Windows vs. Linux &amp; 5.2 vs. 5.3)，却没人能给出明确的数据。<br /><br />ASP.NET比拼PHP的测试环境如下：<br /><br />&nbsp;&nbsp;&nbsp; * 　　所有的测试都在同一台机器上运行(拥有4G内存和60G 7200转硬盘的Toshiba Tecra M5)。<br />&nbsp;&nbsp;&nbsp; * 　　Ubuntu 9和Windows Server 2008标准版分别安装于独立(但相同)的硬盘中。<br />&nbsp;&nbsp;&nbsp; * 　　Linux使用Apache2，Windows使用IIS 7作为各自的Web服务器。<br />&nbsp;&nbsp;&nbsp; * 　　双方的操作系统都进行了完整的patch或升级。<br />&nbsp;&nbsp;&nbsp; * 　　双方的系统和运行时都没有进行额外的性能增强。<br /><br />从实验结果上看，PHP在Linux和Windows的执行性能各有千秋：<br /><br />&nbsp;&nbsp;&nbsp; * 　　纯粹的语句执行在Windows上表现更好。<br />&nbsp;&nbsp;&nbsp; * 　　函数调用在Windows上更快。<br />&nbsp;&nbsp;&nbsp; * 　　对象的创建和访问，对于PHP 5.2来说在Linux上更快，但是对于PHP 5.3来说则是Windows更快。<br />&nbsp;&nbsp;&nbsp; * 　　类库调用在Linux上快得多(如在Ubuntu上进行加密要比Windows要快3到5倍)。<br /><br />Linux与Windows平台对比<br /><br />在Linux上访问文件性能略高于Windows，不过Windows上文件复制的性能要比Linux慢60%，可能是ACL高级安全的缘故。<br /><br />在Linux上访问MySQL要比Windows快不少，而且在Windows上运行PHP 5.3的情况则更为恶劣(不过从下面PostgreSQL的情况上来看，这应该是糟糕实现的缘故)。<br /><br />PostgreSQL在两个平台上的性能非常接近(1000个操作的差距在0.06秒之内)&mdash;&mdash;无论是PHP 5.3还是PHP 5.2，Windows上表现都略胜一筹。<br /><br />Windows上PHP 5.2访问MS SQL Server的性能稍逊于在Linux上访问MySQL(此时还没有面向PHP 5.3的SQL Server支持)。<br /><br />对于纯粹的PHP执行性能来说，Linux和Windows相差无几，这不会成为选择Linux或Windows作为部署平台的决定性因素。如果你在构建一个应用程序，那么PostgreSQL可能是更好的选择。因为它在两个平台上的表现都很优秀。<br /><br />如果你的应用程序必须使用MySQL，那么选择Windows就需要早些计划扩展性问题了(个人认为Sun不太可能为Windows优化MySQL的性能)。<br /><br />PHP的第一个版本的SQL Server驱动程序要比MySQL或PostpreSQL要慢一些，但这应该不会成为问题。第二个版本的驱动器正在开发之中，它会带来性能提升。<br /><br />在Joe看来，全面来看，PHP和IIS团队在执行性能上已经做的非常成功，接下来就需要各开源程序的团队(Drupal、WordPress、Joomla等等)为各平台进行性能优化了。<br /><br />不过，除了文件复制操作之外，ASP.NET在性能方面全面领先于PHP(无论部署在Linux还是Windows上面)：<br /><br />Linux上访问MySQL的性能稍稍优于Windows上访问SQL Server的性能(使用普通的数据类型和SELECT语句)。但是这里的差距几乎可以忽略不计。<br /><br />ASP.NET(C#)操作，如对象使用，类库调用等等，其性能都远高于PHP。对于这个测试结果，Joe补充道：<br /><br />我知道我的一些PHP朋友和Linux伙计们要跳出来驳斥我的测试和结果了。<br /><br />我一直在思考，这样的性能比较是否需要加入一些高级的优化选项。不过.NET方面也有例如多线程，异步请求，和各种缓存方式可以使用<br /><br />请注意&mdash;&mdash;我并没有说&ldquo;ASP.NET更快，所以你不应该使用PHP!&rdquo;，我使用认为，PHP过于简单导致对某些高级应用来说有些举步维艰，就像ASP.NET在项目早期会有学习方面的复杂性。<br /><br />对我来说，PHP最令人兴奋的地方不是它的语言/平台，而是成千上万聪明的PHP开发人员，以及各种优秀的项目(如Drupal、Joomla、WordPress、PHPBB、Nuke等等)。<br /><br />可以这么认为，PHP在Windows和Linux上的性能处于同一个水平上，我现在终于可以为Windows编写那些我盼望着许多年的PHP类库了。<br /><br />Joe还公开了测试代码。他表示，如果你对这个测试的结果有疑义，可以亲自进行这个实验，或是编写你自己的测试代码进行试验。<br /><br />文章发布之后，许多网友对这一测试结果发表了看法。Joe基本上逐一回复了其中的主要观点：<br /><br />&ldquo;我使用ASP.NET只是因为我喜欢Visual Studio IDE&rdquo;&mdash;&mdash;我个人认为Visual Studio是最有生产力的开发工具。但是，PHP的有不错的选择。我使用Zend Studio，PHPEd，Komodo，Delphi for PHP，这些都很不错。我讨厌Eclipse，不过Zend也在这方面为PHP开发做了不少扩展。<br /><br />应该比较ASP的性能&mdash;&mdash;不用了，谢谢。旧式的ASP与目前的PHP与ASP.NET差距太大了。做这种比较，似乎是在建议使用ASP开发新项目，我强烈不建议你这么做。<br /><br />32位与64位系统对比<br /><br />32位与64位系统之间的比较&mdash;&mdash;这些测试的目的并不是为了体现64位系统上的性能差距。今后的测试我会增加64位的场景。<br /><br />&ldquo;PHP丑陋至极&rdquo;&mdash;&mdash;哦，我不同意。旧式ASP要丑陋多了。你可以写出非常可怕而丑陋的PHP代码，也可以写出丑陋而可怕的C#或VB代码。同样，你也可以写出优雅的C++样式的PHP。这完全只和开发人员的技能有关。<br /><br />应该使用Windows上的Apache进行测试&mdash;&mdash;Apache是Linux上的服务器，不过我认为如果你在Windows上不使用IIS 7则会损失太多太多东西了。<br /><br />&ldquo;有办法在Win2K8中，在不损失安全性的前提下加快文件复制性能吗?&rdquo;&mdash;&mdash;似乎不行。我认为这涉及到Windows服务器上的ACL系统。我以后可能会测试通过数据流读取文件的性能，有些东西的性能可能会有所改善。不过，Web应用程序一般不会编程来复制大量文件。<br /><br />&ldquo;PHP一直是，也永远只是一个半专业性质的环境&rdquo;&mdash;&mdash;这种说法狗屁不通。PHP平台上有许多专业的，高质量的应用程序，也有很多我非常尊敬的开发人员。是否专业是开发人员的问题，不是PHP或ASP.NET的问题。<br /><br />&ldquo;我认为比较没有opcode缓存的PHP很不公平，.NET是编译执行的，而PHP需要每次都解释并&lsquo;编译&rsquo;页面&rdquo;&mdash;&mdash;我同意这个测试可能不够完整，但是我不认同这个逻辑。我测试PHP的方式，就和下载安装的方式一样。我的虚拟主机也没有安装op-code缓存。而事实上，ASP.NET自带这个特性也并不意味着测试是不公平的，这是因为PHP缺少这个特性&mdash;&mdash;不过这个要求很合理，我正在准备新的测试。<br /><br />&ldquo;说PHP不是一个&lsquo;专业的&rsquo;语言很没道理，因为几乎所有最大的站点都是用PHP构建的&rdquo;&mdash;&mdash;这种说法是没道理，不过说那些站点&ldquo;几乎都是&rdquo;用PHP构建的也是错误的。有些是，有些不是。<br /><br />如果你们看到这一数据之后对ASP.NET信心倍增我自然很高兴。如果我不认为.NET是开发Web应用程序来说是一种更好的选择&mdash;&mdash;至少不属于其它平台，那么我也不会在微软工作了。<br /><br />但是&hellip;&hellip;如果你因为这些数据而忽视PHP，也是错误且幼稚的行为。<br /><br />从纯技术角度来说，我认为.NET远比PHP强大，但这并不意味着PHP不够强大。在我看来，PHP的力量体现在众多的应用程序以及可用的框架。<br /><br />大约一周以后，Joe公开了第二次测试的结果。与前一个测试相比，第二个测试主要有以下两个改变：<br /><br />为Linux和Windows上安装了op-code缓存，并重新运行了大部分测试。<br /><br />由于一些依赖项的问题，PHP 5.3 + APC的测试平台变成了Debain 5操作系统。<br /><br />对于第二次测试及其结果，Joe解释到：<br /><br />从结果上看，Ubuntu和Debian上运行PHP的性能差距可以忽略不计。部分条目的性能有些细小的改进，有些则有25%的提高，但是总体来说其效果比我想象中要来得低。<br /><br />使用APC之后，一些条目的运行反而变慢了，不过我认为这只是机器所造成的误差。请注意，表格中显示的不是第一次的结果，都是经过两次刷新，确认是在缓存命中时得到的结果。<br /><br />我认为现在的测试非常公平。<br /><br />空的循环测试和空的函数执行非常重要，因为这反映了语言或平台的基础消耗。这是处页面传输等性能开销外的性能消耗，是一个重要的考虑方面。<br /><br />我的一些PHP朋友也认可这个测试的准确性，不过给出了非常有见解的补充：<br /><br />ASP.NET在性能上的领先不会对我有什么影响。PHP是我的最爱，我的应用程序已经足够快了。没错，ASP.NET在基础性能上是比较快，但是我的应用程序可以通过优秀的页面实现和JavaScript实践把这部分性能补回来。<br /><br />此外，根据上一次实验的结果，在Windows平台上运行PHP时，在MySQL和文件的访问上有一些性能问题，微软许多团队都向我获取了相关信息。希望这些数据都够转变为切实的改进。<br /><br />Joe表示，他将收集大家认为更公平，更有意义的测试场景。以下是他所计划的测试项目：<br /><br />&nbsp;&nbsp;&nbsp; * 　　实际页面测试：循环，寒暑调用和对象操作是一类测试，不过页面的整体呈现则是另一种有意义的测试。<br />&nbsp;&nbsp;&nbsp; * 　　负载测试：哪一个环境可以同时处理更大量的请求。<br />&nbsp;&nbsp;&nbsp; * 　　在负载测试中，哪一方的性能会下降地更快。<br />&nbsp;&nbsp;&nbsp; * 　　在各种情况下，64位平台的表现如何。<br /><br />国内也曾经进行过PHP在Linux和Windows平台上的性能测试。微软在WordCamp China 2009大会上公开了之前与康盛创想合作进行的性能评估结果：在Windows Server 2008 + IIS上运行PHP，从平均相应时间，每秒处理的请求数，以及数据吞吐量等多方便均优于Linux + Apache的托管方式<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/asp/" rel="tag">asp</a> , <a href="http://www.gaobo.info/go.php/tags/.net/" rel="tag">.net</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/fast/" rel="tag">fast</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%2580%259F%25E5%25BA%25A6/" rel="tag">速度</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25AF%2594%25E8%25BE%2583/" rel="tag">比较</a> , <a href="http://www.gaobo.info/go.php/tags/windows/" rel="tag">windows</a> , <a href="http://www.gaobo.info/go.php/tags/iis/" rel="tag">iis</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/654.htm</link>
<title><![CDATA[Windows 7(IIS 7.5)下安装PHP 5.3]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 10 Sep 2009 12:50:30 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/654.htm</guid> 
<description>
<![CDATA[ 
	经过多次尝试，从<a href="http://windows.php.net/download" target="_blank">http://windows.php.net/download</a>下载php-5.3.0-nts-Win32-VC9-x86.msi安装最为保险。安装的过程中可以选择需要开启的扩展。<br/>安装程序会自动在IIS中添加FastCGI扩展，因此安装完毕后即可运行phpinfo()<br/><br/>需要注意的地方：<br/>1、date.timezone一定要配置：<br/><div class="code">date.timezone = Asia/Shanghai</div><br/>2、访问MySQL可能会报错：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">mysqlnd cannot connect to MySQL 4.1+ using old authentication</div></div><br/>新的mysqlnd库需要使用MySQL 4.1新的41-byte的密码格式，使用旧的16字节的密码将导致mysql_connect()和类似的函数产生一个错误：mysqlnd cannot connect to MySQL 4.1+ using old authentication. (mysqlnd不能用旧的验证方式来连接到MySQL 4.1以上的版本)<br/>解决办法：<br/>用命令行登录mysql，输入语句<br/><div class="code">set password for &#039;root&#039;@&#039;localhost&#039; = PASSWORD(&#039;xxx&#039;);</div><br/>注意这里密码函数不是OLD_PASSWORD而是PASSWORD<br/>另外MySQL的配置文件中不能出现old-password=1<br/>3、XDebug<br/>zend_extension_ts变成了zend_extension，其他没有变化<br/>目前XDebug 2.0.5在FastCGI模式下有兼容BUG，导致PHP崩溃，故暂时无法使用<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/windows/" rel="tag">windows</a> , <a href="http://www.gaobo.info/go.php/tags/7/" rel="tag">7</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/fastcgi/" rel="tag">fastcgi</a> , <a href="http://www.gaobo.info/go.php/tags/xdebug/" rel="tag">xdebug</a> , <a href="http://www.gaobo.info/go.php/tags/iis/" rel="tag">iis</a> , <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/641.htm</link>
<title><![CDATA[用PHP程序实现支持页面后退的两种方法]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 17 Aug 2009 04:49:06 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/641.htm</guid> 
<description>
<![CDATA[ 
	<p>在开发过程中，往往因为表单出错而返回页面的时候填写的信息都不见了，为了支持页面回跳，可以通过两种方法实现。</p><p>第一，使用Header方法设置消息头Cache-control <br />header('Cache-control: private, must-revalidate');&nbsp; //支持页面回跳<br />第二，使用session_cache_limiter方法&nbsp;<br />//注意要写在session_start方法之前<br />session_cache_limiter('private, must-revalidate');</p><p><br />补充：<br />Cache-Control消息头域说明<br />Cache-Control指定请求和响应遵循的缓存机制。在请求消息或响应消息中设置Cache-Control并不会修改另一个消息处理过程中的缓存处理过程。请求时的缓存指令包括no-cache、no-store、max-age、max-stale、min-fresh、only-if- cached，响应消息中的指令包括public、private、no-cache、no-store、no-transform、must- revalidate、proxy-revalidate、max-age。各个消息中的指令含义如下：</p><p>&nbsp;&nbsp;&nbsp; Public指示响应可被任何缓存区缓存。</p><p>&nbsp;&nbsp;&nbsp; Private指示对于单个用户的整个或部分响应消息，不能被共享缓存处理。这允许服务器仅仅描述当用户的部分响应消息，此响应消息对于其他用户的请求无效。</p><p>&nbsp;&nbsp;&nbsp; no-cache指示请求或响应消息不能缓存</p><p>&nbsp;&nbsp;&nbsp; no-store用于防止重要的信息被无意的发布。在请求消息中发送将使得请求和响应消息都不使用缓存。</p><p>&nbsp;&nbsp;&nbsp; max-age指示客户机可以接收生存期不大于指定时间（以秒为单位）的响应。</p><p>&nbsp;&nbsp;&nbsp; min-fresh指示客户机可以接收响应时间小于当前时间加上指定时间的响应。</p><p>&nbsp;&nbsp;&nbsp; max-stale指示客户机可以接收超出超时期间的响应消息。如果指定max-stale消息的值，那么客户机可以接收超出超时期指定值之内的响应消息。</p><p></p><p>关于表单刷新</p><p>问：为什么我在点击浏览器的后退按钮后，所有字段的信息都被清空了？</p><p>答：这是由于你在你的表单提交页面中使用了 session_start 函数。该函数会强制当前页面不被缓存。解决办法为，在你的 Session_start 函数后加入 header(&quot;Cache-control: private&quot;); 注意在本行之前你的PHP程序不能有任何输出。</p><p>补充：还有基于session的解决方法，在session_start前加上 <br />引用:<br />session_cache_limiter('nocache');// 清空表单<br />session_cache_limiter('private'); //不清空表单，只在session生效期间<br />session_cache_limiter('public'); //不清空表单，如同没使用session一般</p><p>可以在session_start();前加上 session_cache_limiter(&quot;private,max-age=10800&quot;);</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/http/" rel="tag">http</a> , <a href="http://www.gaobo.info/go.php/tags/cache/" rel="tag">cache</a> , <a href="http://www.gaobo.info/go.php/tags/session/" rel="tag">session</a> , <a href="http://www.gaobo.info/go.php/tags/header/" rel="tag">header</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%25A1%25B5%25E9%259D%25A2/" rel="tag">页面</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2590%258E%25E9%2580%2580/" rel="tag">后退</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/637.htm</link>
<title><![CDATA[汉字的正则表达式]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 13 Aug 2009 13:24:26 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/637.htm</guid> 
<description>
<![CDATA[ 
	一个程序需要用到验证用户的输入全为汉字，找了下，发现了汉字的正则表达式：<br/><div class="code">/^(&#91;&#92;x00-&#92;x7F&#93;&#124;&#91;&#92;x80-&#92;xFE&#93;&#91;&#92;x40-&#92;x7E&#92;x80-&#92;xFE&#93;)&#123;30&#125;/</div><br/>PHP Code：<br/><div class="code">$str = &quot;测试汉字&quot;;<br/>if(preg_match(&quot;/^&#91;&quot;.chr(0xa1).&quot;-&quot;.chr(0xff).&quot;&#93;+$/&quot;, $str)) &#123;<br/>echo &quot;这是一个纯中文字符串&quot;;<br/>&#125; else &#123;<br/>echo &quot;这不是一个纯中文字串&quot;;<br/>&#125;</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25B1%2589%25E5%25AD%2597/" rel="tag">汉字</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25AD%25A3%25E5%2588%2599/" rel="tag">正则</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25A1%25A8%25E8%25BE%25BE%25E5%25BC%258F/" rel="tag">表达式</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/636.htm</link>
<title><![CDATA[Javascript函数默认参数的设定方法]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Tue, 11 Aug 2009 14:12:11 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/636.htm</guid> 
<description>
<![CDATA[ 
	在Javascript中定义参数的默认值不像C#、PHP……等语言中方便，直接在形参上赋值即可。我研究了下，参考了一些资料，发现可以按以下方法定义，需要的朋友也可以参考下：<br/><div class="code">&lt;script language=javascript&gt;<br/>function writestr()<br/>&#123;<br/>&nbsp;&nbsp;var str = arguments&#91;0&#93; &#124;&#124; &quot;我是默认参数&quot;;<br/>&nbsp;&nbsp;return str;<br/>&#125;<br/>document.write(writestr()+&quot;&lt;br&gt;&quot;);<br/>document.write(writestr(&quot;我是设定的参数&quot;)+&quot;&lt;br&gt;&quot;);<br/>&lt;/script&gt;</div><br/>“&#124;&#124;”后是参数的默认值。<br/>注意：使用这种方法有个问题，就是当参数是0，false，null时为无效<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/js/" rel="tag">js</a> , <a href="http://www.gaobo.info/go.php/tags/javascript/" rel="tag">javascript</a> , <a href="http://www.gaobo.info/go.php/tags/function/" rel="tag">function</a> , <a href="http://www.gaobo.info/go.php/tags/argument/" rel="tag">argument</a> , <a href="http://www.gaobo.info/go.php/tags/parameter/" rel="tag">parameter</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2587%25BD%25E6%2595%25B0/" rel="tag">函数</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%258F%2582%25E6%2595%25B0/" rel="tag">参数</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%25BB%2598%25E8%25AE%25A4/" rel="tag">默认</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/634.htm</link>
<title><![CDATA[Javascript Error: ******** is not a function表单元素无法修改type属性]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 10 Aug 2009 08:27:12 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/634.htm</guid> 
<description>
<![CDATA[ 
	<p>今天在写一段JS时遇到这样的错误：&ldquo;******** is not a function&rdquo;<br />这个Javascript方法是有定义的，而且也没有错误，那是什么原因引起的呢？<br />经过几番周折，终于找到了罪魁祸首，<strong>name和id与方法同名了</strong>，这样一来就引起了系统冲突！<br />解决方法：将元素的name和id重命名就OK了！<br /><br />还是这段JS，其中在做一个效果的时候，需要实时修改一个input的type，但是浏览器提示有错误，搜索了下，发现表单元素input中的type属性是只读的，不能修改&hellip;&hellip;orz，后来选择了别的折中的方法解决。<br /><a href="http://bbs.51js.com/viewthread.php?tid=7557"><a href="http://bbs.51js.com/viewthread.php?tid=7557" target="_blank">http://bbs.51js.com/viewthread.php?tid=7557</a></a></p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/javascript/" rel="tag">javascript</a> , <a href="http://www.gaobo.info/go.php/tags/error/" rel="tag">error</a> , <a href="http://www.gaobo.info/go.php/tags/function/" rel="tag">function</a> , <a href="http://www.gaobo.info/go.php/tags/input/" rel="tag">input</a> , <a href="http://www.gaobo.info/go.php/tags/type/" rel="tag">type</a> , <a href="http://www.gaobo.info/go.php/tags/readonly/" rel="tag">readonly</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/629.htm</link>
<title><![CDATA[发一个ZendStudio 7的注册码]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 24 Jul 2009 12:01:54 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/629.htm</guid> 
<description>
<![CDATA[ 
	ZendStudio for Eclipse出了7.0 Beta，但是不少朋友苦于没有注册码，只能试用&hellip;&hellip;<br />冒风险给出一个注册码吧：<br />PHPer<br /><span style="color: #ffffff">3CECEC4463CC4CEFC4463CC4<br /></span><span style="color: #000000">（按Ctrl+A全选查看）</span><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/zend/" rel="tag">zend</a> , <a href="http://www.gaobo.info/go.php/tags/studio/" rel="tag">studio</a> , <a href="http://www.gaobo.info/go.php/tags/eclipse/" rel="tag">eclipse</a> , <a href="http://www.gaobo.info/go.php/tags/keygen/" rel="tag">keygen</a> , <a href="http://www.gaobo.info/go.php/tags/register/" rel="tag">register</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25B3%25A8%25E5%2586%258C/" rel="tag">注册</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/626.htm</link>
<title><![CDATA[《站长》俱乐部2009全国18城市互动之旅——重庆]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 22 Jul 2009 06:09:17 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/626.htm</guid> 
<description>
<![CDATA[ 
	<p>先前石头在Q上跟我说过<a href="http://www.phpchina.com/?action-viewnews-itemid-34713" target="_blank">这件事</a>，我当时还以为是站长聚会之类的，这两天在这里听了以后才发现受益匪浅。<br /><br />这次活动其实是一次社区运行的培训活动，受邀前来的大多是本地的社区站长、本地互联网公司老总和网络知名人士等等，在前来参加活动的人群中，我发现了名人：GJJ，没想到在这里碰到了鼎鼎大名的老郭<img src="images/emot/grin.gif" border="0" width="24" height="24" />。此外，还有本地商盟网的远波、MJ文化传媒的老罗&hellip;&hellip;老罗之前好像是在正大呆过，而这两天我也发现了正大的其他人。<br /><br />官方来到重庆的人有（不完全统计）：明顺、张翔、石头、秦正云、张铭、杜均、卲霞&hellip;&hellip;还有几个我叫不上名字的，官方这几年规模越来越大了，公司人数已经是我05年去北京时候的20倍了，^_^<br /><br />培训的课程内容主要有：<br />1、李明顺，康盛副总裁/《站长》俱乐部执行会长：《2009互动之旅&mdash;&mdash;垂直及地方社区的发展与未来》<br />2、杜均，康盛UCH运营部主管：《社区SNS的运营技巧及经验培训》<br />3、秦正云，康盛技术支持部：《社区论坛的技术及运营实战培训》<br />4、徐嘉，百度联盟发展部产品运营经理：《百度网盟推广合作细节及操作》<br />5、钱钰，化龙巷CEO：《地方社区网站的运营和营销之道》<br />6、张铭，康盛Yes玩运营部：《站长如何通过WebGame获取收入》<br /><br />本来我也受邀介绍下重庆PHP和PEA的情况，但是时间紧张，只有在午餐的时候和大家讨论了，呵呵。<br /><br /><br />照片在他们的相机中，回头奉上。</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/%25E7%25AB%2599%25E9%2595%25BF/" rel="tag">站长</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25BF%25B1%25E4%25B9%2590%25E9%2583%25A8/" rel="tag">俱乐部</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25BA%2592%25E5%258A%25A8/" rel="tag">互动</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%2587%258D%25E5%25BA%2586/" rel="tag">重庆</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BC%2580%25E6%25BA%2590/" rel="tag">开源</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BA%25B7%25E7%259B%259B/" rel="tag">康盛</a> , <a href="http://www.gaobo.info/go.php/tags/comsenz/" rel="tag">comsenz</a> , <a href="http://www.gaobo.info/go.php/tags/discuz/" rel="tag">discuz</a> , <a href="http://www.gaobo.info/go.php/tags/yeswan/" rel="tag">yeswan</a> , <a href="http://www.gaobo.info/go.php/tags/ucenter/" rel="tag">ucenter</a> , <a href="http://www.gaobo.info/go.php/tags/home/" rel="tag">home</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/622.htm</link>
<title><![CDATA[一个不错的Bug跟踪管理系统]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 13 Jul 2009 05:32:06 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/622.htm</guid> 
<description>
<![CDATA[ 
	用了Mantis、BugFree、Trac后，发现所有这些都多少有点不尽人意，说不出来为什么，后来偶然发现了台湾同胞写的一个系统&mdash;&mdash;Bug Tracker，感觉还不错，如果有朋友正在找Bug跟踪管理系统，推荐尝试。<br />他官方自己描述的特色如下： <ul><li>安裝非常非常非常容易 </li><li>使用容易 </li><li>完整的權限管理機制 </li><li>更新回報時會自動發送 Email 通知 </li><li>客戶回報系統 </li><li>匿名回報介面 </li><li>可搜尋、過濾每個資料欄位 </li><li>常見問題及文件管理系統 </li><li>完整的系統日誌及使用情形統計 </li><li>支援 UTF-8 </li><li>支援多國語使用者介面 </li><li>可以上傳附加檔案 </li><li>在輸入資料時可以使用 HTML 編輯器 </li><li>支援 PostgreSQL 及 MySQL </li><li>支援需經身份認証的 SMTP 送信</li></ul><p>官方站点上有在线测试功能。<br />URL：<a href="http://www.twbsd.org/cht/bug_tracker/index.php?page=main.htm"><a href="http://www.twbsd.org/cht/bug_tracker/index.php?page=main.htm" target="_blank">http://www.twbsd.org/cht/bug_tracker/index.php?page=main.htm</a></a><br />Download：<a href="attachment.php?fid=75">点击这里下载文件</a></p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/bug/" rel="tag">bug</a> , <a href="http://www.gaobo.info/go.php/tags/track/" rel="tag">track</a> , <a href="http://www.gaobo.info/go.php/tags/tracker/" rel="tag">tracker</a> , <a href="http://www.gaobo.info/go.php/tags/mantis/" rel="tag">mantis</a> , <a href="http://www.gaobo.info/go.php/tags/bugfree/" rel="tag">bugfree</a> , <a href="http://www.gaobo.info/go.php/tags/trac/" rel="tag">trac</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25B4%25A8%25E9%2587%258F/" rel="tag">质量</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25B7%259F%25E8%25B8%25AA/" rel="tag">跟踪</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25AE%25A1%25E7%2590%2586/" rel="tag">管理</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/617.htm</link>
<title><![CDATA[Web开发与设计师速查手册大全（下）]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 09 Jul 2009 00:52:24 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/617.htm</guid> 
<description>
<![CDATA[ 
	本文将着重介绍 Web 前端设计者常用速查手册。其中涉及颜色速查表以及 Adobe 众多设计工具的速查手册。 <p></p><h3 class="subtitle">Color Codes</h3><h4><a href="http://www.addedbytes.com/cheat-sheets/colour-chart/">RGB Hex Colour Chart</a></h4><p>这张 RGB 16进制颜色速查表刚好可以打印在整张 A4 纸上，包含216种所谓的 Web 安全色。下载（<a href="http://www.addedbytes.com/download/rgb-hex-cheat-sheet-v1/png/">PNG</a> &#124; <a href="http://www.addedbytes.com/download/rgb-hex-cheat-sheet-v1/pdf/">PDF</a> ）</p><p><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/colour-chart.jpg" border="0" alt="CHEAT_SHEETS" /></p><h4><a href="http://www.veign.com/downloads/guides/qrg0006.pdf">Color Reference Guide</a> （配色表,下载 <a href="http://www.veign.com/downloads/guides/qrg0006.pdf">PDF</a> ）</h4><p><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/qrg0006.jpg" border="0" alt="CHEAT_SHEETS" width="621" height="279" /></p><h4><a href="http://www.pagetutor.com/pagetutor/makapage/pics/net216-2.gif">Web Safe Color Chart</a> （Web 安全色,下载 <a href="http://www.pagetutor.com/pagetutor/makapage/pics/net216-2.gif">GIF</a> ）</h4><p><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/net216-2.jpg" border="0" alt="CHEAT_SHEETS" width="621" height="330" /></p><h4><a href="http://acodingfool.typepad.com/blog/html-colors-cheat-sheet.html" target="_blank">HTML Colors Cheat Sheet</a> (<a href="http://acodingfool.typepad.com/blog/html-colors-cheat-sheet.html">预览</a> &#124; <a href="http://acodingfool.typepad.com/blog/pdf/html_colors_cheatsheet_v2.pdf">下载</a> )<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/html_colors_cheatsheet.jpg" border="0" alt="CHEAT_SHEETS" width="621" height="799" /></h4><h4><a href="http://www.mambo.net/cgi-bin/TempProcessor/view/113">RGB Values for Macbeth Color Checker</a> （Macbeth 色卡之 RGB 色值，<a href="http://www.mambo.net/cgi-bin/TempProcessor/view/113">预览</a> ）</h4><p><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/TempProcessor.jpg" border="0" alt="CHEAT_SHEETS" width="621" height="394" /></p><h3 class="subtitle">Dreamweaver</h3><h4><a href="http://subdivision.co.uk/adobe-dreamweaver-cs4-shortcuts-cheatsheet/" target="_blank">DreamWeaver CS4 Keyboard Shortcuts (PC)</a></h4><p>DW PC CS4 版快捷键速查手册，<a href="http://subdivision.co.uk/wp-content/uploads/2009/02/DreamweaverCS4_PC_Shortcuts.pdf">下载（PDF）</a></p><p><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/DreamweaverCS4_PC.jpg" border="0" alt="CHEAT_SHEETS" width="621" height="394" /></p><h3 class="subtitle">Illustrator</h3><h4>Adobe Illustrator CS4 Shortcuts (<a href="http://www.nobledesktop.com/shortcuts-illustratorcs4-mac.html" target="_blank">Mac</a> &ndash; <a href="http://www.nobledesktop.com/shortcuts-illustratorcs4-pc.html" target="_blank">PC</a> )</h4><p>Adobe Illustrator CS4 快捷键速查表。下载（<a href="http://www.nobledesktop.com/download/shortcut_guides/illustrator_cs4_shortcuts_mac.pdf">MAC PDF</a> &#124; <a href="http://www.nobledesktop.com/download/shortcut_guides/illustrator_cs4_shortcuts_pc.pdf">PC PDF</a> ）</p><p><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/illustrator.jpg" border="0" alt="CHEAT_SHEETS" width="621" height="296" /></p><h3 class="subtitle">Indesign</h3><h4>Adobe InDesign CS4 Keyboard Shortcuts (<a href="http://www.nobledesktop.com/shortcuts-indesigncs4-mac.html" target="_blank">Mac</a> &ndash; <a href="http://www.nobledesktop.com/shortcuts-indesigncs4-pc.html" target="_blank">PC</a> )</h4><p>Adobe InDesign CS4 快捷键速查表，下载 （<a href="http://www.nobledesktop.com/download/shortcut_guides/indesign_cs4_shortcuts_mac.pdf">MAC PDF </a>&#124; <a href="http://www.nobledesktop.com/download/shortcut_guides/indesign_cs4_shortcuts_pc.pdf">PC PDF</a> ）</p><h4><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/indesign.jpg" border="0" alt="css-cheat-sheet" width="621" height="327" /></h4><h3 class="subtitle">Photoshop</h3><h4><a href="http://morris-photographics.com/photoshop/shortcuts/downloads/PSCS3_Keyboard_Shortcuts_PC.pdf" target="_blank">Photoshop CS3 Keyboard Shortcut</a> （hotoshop CS3 快捷键速查，<a href="http://morris-photographics.com/photoshop/shortcuts/downloads/PSCS3_Keyboard_Shortcuts_PC.pdf">下载 PDF</a> ）</h4><h4><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/c3.jpg" border="0" alt="css-cheat-sheet" width="620" height="334" /></h4><h4><a href="http://creativetechs.com/tipsblog/photoshop-cs4-shortcut-cheatsheets/" target="_blank">Photoshop CS4 Shortcut Cheatsheets</a> （Photoshop CS4 快捷键速查，下载 <a href="http://morris-photographics.com/photoshop/shortcuts/downloads/PSCS4_Keyboard_Shortcuts_Mac.pdf">MAC PDF</a> &#124; <a href="http://morris-photographics.com/photoshop/shortcuts/downloads/PSCS4_Keyboard_Shortcuts_PC.pdf">PC PDF</a> ）</h4><h4><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/c4.jpg" border="0" alt="css-cheat-sheet" width="621" height="321" /></h4><h4><strong><a href="http://creativetechs.com/tips/tip_resources/cheatsheets/Photoshop-Brush-Cheatsheet.pdf" target="_blank">Brush Tool cheatsheetush Tool cheat sheet for Photoshop</a> （Photoshop 笔刷速查手册，<a href="http://creativetechs.com/tips/tip_resources/cheatsheets/Photoshop-Brush-Cheatsheet.pdf">下载 PDF</a> ）</strong></h4><h4><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/brush.jpg" border="0" alt="css-cheat-sheet" width="621" height="321" /></h4><p><strong><a href="http://planetozh.com/download/refcards/Photoshop.pdf" target="_blank">Adobe Photoshop Quick Reference Guide</a> （Photoshop 速查手册，<a href="http://planetozh.com/download/refcards/Photoshop.pdf">下载 PDF</a> ）</strong></p><h4><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/soa-platform.jpg" border="0" alt="css-cheat-sheet" width="621" height="321" /></h4><p><strong><a href="http://www.diyphotography.net/black-white-cheatsheet-for-photoshop" target="_blank">Black &amp; White Cheatsheet For Photoshop</a> （如何在 Photoshop 中处理黑白图,<a href="http://www.diyphotography.net/files/images/photoshop_bw_cheatsheet.psd">下载 PSD</a> ）</strong></p><h4><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/blackandwhite.jpg" border="0" alt="css-cheat-sheet" width="621" height="328" /></h4><p><strong><a href="http://www.customguide.com/pdf/photoshopmac-quick-reference-cs3.pdf" target="_blank">Photoshop Quick reference card</a> (Photoshop 快速参考，<a href="http://www.customguide.com/pdf/photoshopmac-quick-reference-cs3.pdf">下载 PDF</a> )</strong></p><h4><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/photoshopmac-quick.jpg" border="0" alt="css-cheat-sheet" width="621" height="453" /></h4><h4><a href="http://creativetechs.com/tipsblog/photoshop-lasso-tool-cheatsheet/" target="_blank">Photoshop Lasso Tool Cheat Sheet</a> （Photoshop 套索选择工具速查，<a href="http://creativetechs.com/tips/tip_resources/cheatsheets/Photoshop-Lasso-Cheatsheet.pdf">下载 PDF</a> ）</h4><h4><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/lasso.jpg" border="0" alt="css-cheat-sheet" width="621" height="346" /></h4><h4><strong><a href="http://simplephotoshop.com/photoshop_tools/index.htm" target="_blank"><strong>Photoshop Toolbox Reference</strong> </a>（Photoshop 工具箱参考手册，全部 Flash 格式教程，<a href="http://simplephotoshop.com/photoshop_tools/index.htm">直接浏览</a> ）</strong></h4><h4><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/photoshop-reference.jpg" border="0" alt="css-cheat-sheet" width="621" height="346" /></h4><h4><a href="http://livedocs.adobe.com/en_US/Photoshop/10.0/help.html?content=WS7D245964-27B4-403e-82D5-DDD1CB19A82B.html" target="_blank">Keys for using the Layers palette </a>（层操作快捷键，<a href="http://livedocs.adobe.com/en_US/Photoshop/10.0/help.html?content=WS7D245964-27B4-403e-82D5-DDD1CB19A82B.html">直接浏览</a> ）</h4><h4><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/palette.jpg" border="0" alt="css-cheat-sheet" width="621" height="339" /></h4><h3 class="subtitle">Flash</h3><h4>Flash CS4 Keyboard Shortcuts(<a href="http://subdivision.co.uk/adobe-flash-cs4-shortcuts-cheatsheet/" target="_blank">PC and Mac</a> )</h4><p>Flash CS4 快捷键速查，下载 <a href="http://subdivision.co.uk/wp-content/uploads/2009/03/FlashCS4_OSX_Shortcuts.pdf">MAC PDF</a> &#124; <a href="http://subdivision.co.uk/wp-content/uploads/2009/03/FlashCS4_PC_Shortcuts.pdf">PC PDF</a></p><h4><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/flash.jpg" border="0" alt="css-cheat-sheet" width="600" height="302" /></h4><h4><a href="http://actionscriptcheatsheet.com/downloads/as3cs_top_level.pdf" target="_blank">ActionScript 3.0 Top Level Cheat Sheet</a></h4><p>ActionScript 3.0 高阶速查手册，<a href="http://actionscriptcheatsheet.com/downloads/as3cs_top_level.pdf">下载 PDF</a></p><h4><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/designer-cheat-sheet/action.jpg" border="0" alt="css-cheat-sheet" width="600" height="302" /></h4><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/web/" rel="tag">web</a> , <a href="http://www.gaobo.info/go.php/tags/design/" rel="tag">design</a> , <a href="http://www.gaobo.info/go.php/tags/develop/" rel="tag">develop</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BC%2580%25E5%258F%2591/" rel="tag">开发</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25AE%25BE%25E8%25AE%25A1/" rel="tag">设计</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2589%258B%25E5%2586%258C/" rel="tag">手册</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/615.htm</link>
<title><![CDATA[Web开发与设计师速查手册大全（上）]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sun, 28 Jun 2009 15:04:02 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/615.htm</guid> 
<description>
<![CDATA[ 
	作为 Web 开发与设计师，免不了在工作时查询大量资料，某个 Web 色值，某个 JavaScript 库的核心语法，这类资料如果攒齐了，怕有半间屋子那么多，如果用 Cheet Sheet 也许几十页纸就够了，本文收集了近百份用于 Web 开发与设计的 Cheet Sheet，你会发现他们非常实用。 <p>HTML, XHTML, CSS2 <a href="http://acodingfool.typepad.com/blog/css-cheat-sheet.html">CSS2 Cheat Sheet</a> <br /><a href="http://acodingfool.typepad.com/blog/images/cheatsheets/css_cheatsheet_v2_pg1_large.jpg"><img src="http://acodingfool.typepad.com/blog/images/cheatsheets/css_cheatsheet_v2_pg1_small.jpg" border="0" /></a> <a href="http://acodingfool.typepad.com/blog/images/cheatsheets/css_cheatsheet_v2_pg2_large.jpg"><img src="http://acodingfool.typepad.com/blog/images/cheatsheets/css_cheatsheet_v2_pg2_small.jpg" border="0" /></a><br /><br />一份完整的 CSS2 速查手册。<a href="http://acodingfool.typepad.com/blog/css-cheat-sheet.html">预览</a> &#124; <a href="http://acodingfool.typepad.com/blog/pdf/css_cheatsheet_v2.pdf">下载</a> （PDF）<br /><a href="http://www.gosquared.com/images/help_sheets/CSS%20Help%20Sheet%2002.pdf">Gosquared CSS help sheets</a> <br />设计和结构都很整齐，漂亮。<a href="http://www.gosquared.com/images/help_sheets/CSS%20Help%20Sheet%2002.pdf">下载（PDF）</a><br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/css_help_sheets.jpg" border="0" /> <a href="http://www.addedbytes.com/cheat-sheets/css-cheat-sheet/">addedbytes CSS2 Cheat Sheet</a> <br />该速查手册只有一页纸，包含 CSS 2.1 全部选择器和属性，还包含一个盒子模型示例。下载（<a href="http://www.addedbytes.com/download/css-cheat-sheet-v2/pdf/">PDF</a> &#124; <a href="http://www.addedbytes.com/download/css-cheat-sheet-v2/png/">PNG</a>）<br /><br /><img src="http://www.addedbytes.com/cheat-sheets/thumbnails/css_v2_plain.png" border="0" /><br /><a href="http://refcardz.dzone.com/refcardz/corecss-part1">Core css</a> <br />将 CSS 的核心知识分成3部分，包含了 CSS 的方方面面。<a href="http://refcardz.dzone.com/assets/request/refcard/4784?oid=lan4784&amp;amp;amp;uid=0">下载</a> （需免费注册）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/corecss-part1.jpg" border="0" /> <img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/corecss-part3.jpg" border="0" /> <a href="http://www.eddiewelker.com/wp-content/uploads/2007/09/csscheatsheet.pdf">CSS Shorthand Cheat Sheet</a> <br />一些不容易记住的 CSS 元素。<a href="http://www.eddiewelker.com/wp-content/uploads/2007/09/csscheatsheet.pdf">下载</a> （PDF）<br /><a href="http://www.veign.com/downloads/guides/qrg0007.pdf">CSS2 &ndash; Quick Reference Guide &ndash; PDF</a> <a href="http://www.veign.com/downloads/guides/qrg0007.pdf">下载</a>（PDF） <a href="http://acodingfool.typepad.com/blog/2009/01/xhtml.html">XHTML 1.1 Cheat Sheet</a> <br /><a href="http://www.w3.org/TR/xhtml11/">XHTML 1.1</a> 细则中涉及到的所有元素与属性。<a href="http://acodingfool.typepad.com/blog/xhtml-11-cheat-sheet.html">预览</a> &#124; <a href="http://acodingfool.typepad.com/blog/pdf/xhtml_1.1_cheatsheet_v3.pdf">下载</a><br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/xhtml_1_1_cheatsheet.jpg" border="0" /> <a href="http://www.gosquared.com/images/help_sheets/HTML%20Help%20Sheet%2002.pdf">Gosquared html help sheets</a> <br />设计漂亮，结构精良的 HTML 速查。<a href="http://www.gosquared.com/images/help_sheets/HTML%20Help%20Sheet%2002.pdf">下载</a>（PDF）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/html-help_sheets.jpg" border="0" /> <a href="http://www.addedbytes.com/cheat-sheets/html-cheat-sheet/">HTML Cheat Sheet</a> <br />一份 A4 纸大小的单页 HTML 速查表。下载 （<a href="http://www.addedbytes.com/download/html-cheat-sheet-v1/pdf/">PDF</a> &#124; <a href="http://www.addedbytes.com/download/html-cheat-sheet-v1/png/">PNG</a>）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/html.jpg" border="0" /> <a href="http://acodingfool.typepad.com/blog/html-character-entities-cheat-sheet.html">HTML Character Entities Cheat Sheet</a> <br />该表包含 <a href="http://www.w3.org/TR/html4/sgml/entities.html">HTML 4 字符标识</a>，包括 ISO8859-1 (Latin-1) 中的字符。<a href="http://acodingfool.typepad.com/blog/html-character-entities-cheat-sheet.html">预览</a> &#124; <a href="http://acodingfool.typepad.com/blog/pdf/html_entities_cheatsheet_v3.pdf">下载</a><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/html_entities_cheatsheet.jpg" border="0" /><br /><a href="http://acodingfool.typepad.com/blog/html-colors-cheat-sheet.html">HTML Colors Cheat Sheet</a> <br />该 HTML 颜色表包含 1050 种颜色。<a href="http://acodingfool.typepad.com/blog/html-colors-cheat-sheet.html">预览</a> &#124; <a href="http://acodingfool.typepad.com/blog/pdf/html_colors_cheatsheet_v2.pdf">下载</a>（PDF）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/html_colors_cheatsheet.jpg" border="0" /> <a href="http://www.addedbytes.com/cheat-sheets/colour-chart/">RGB Hex Colour Chart</a> <br />RGB 16进制颜色表。包含216种 Web 安全色。下载 （<a href="http://www.addedbytes.com/download/rgb-hex-cheat-sheet-v1/png/">PNG</a> &#124; <a href="http://www.addedbytes.com/download/rgb-hex-cheat-sheet-v1/pdf/">PDF</a>）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/rgb-hex-cheat.jpg" border="0" /> Scripting 速查手册 <a href="http://www.addedbytes.com/cheat-sheets/javascript-cheat-sheet/">JavaScript Cheat Sheet</a> <br />包含 JavaScript 的 的方法与函数，正则表单时，以及 XMLHttpRequest 对象。下载（<a href="http://www.addedbytes.com/download/javascript-cheat-sheet-v1/png/">PNG</a> &#124; <a href="http://www.addedbytes.com/download/javascript-cheat-sheet-v1/pdf/">PDF</a>）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/javascript.jpg" border="0" /> <a href="http://www.wait-till-i.com/stuff/JavaScript-DOM-Cheatsheet.pdf">JavaScript DOM Cheatsheet</a> <br />JavaScript DOM 结构速查手册。<a href="http://www.wait-till-i.com/stuff/JavaScript-DOM-Cheatsheet.pdf">下载</a>（PDF）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/javascript-dom.jpg" border="0" /> <a href="http://acodingfool.typepad.com/blog/2009/01/jquery-13-cheat-sheet.html">jQuery 1.3 Cheat Sheet</a> <br />jQuery 1.3 速查表。<a href="http://acodingfool.typepad.com/blog/jquery-13-cheat-sheet.html">预览</a> &#124; <a href="http://acodingfool.typepad.com/blog/pdf/jquery_1.3_cheatsheet_v1.pdf">下载</a>（PDF）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/acodingfooljquery.jpg" border="0" /> <a href="http://mediavrog.net/blog/2008/06/11/mootools/mootools-12-cheat-sheet/">mootools 1.2 cheat sheet</a> <br />另一个 JavaScript 库 MooTools 1.2 速查手册。<a href="http://mediavrog.net/blog/wp-content/uploads/2008/08/mootools-12-cheat-sheet-pf.pdf">下载</a>（PDF）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/mootools.jpg" border="0" /> <a href="http://thinkweb2.com/projects/prototype/prototype-1602-cheat-sheet/">Prototype 1.6.0.2 Cheat Sheet</a> <br />JavaScript 库 Prototype 1.6.0.2 速查手册。<a href="http://thinkweb2.com/projects/prototype/downloads/Prototype%20Cheat%20Sheet%201.6.0.2">下载</a>（PDF）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/prototype_cheatsheet_1.6.0.2.jpg" border="0" /> <a href="http://wps.aw.com/wps/media/objects/2234/2287950/javascript_refererence.pdf">Addison-Wesley&rsquo;s JavaScript Reference Card</a> <br />JavaScript 参考手册。<a href="http://wps.aw.com/wps/media/objects/2234/2287950/javascript_refererence.pdf">下载</a>（PDF）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/javascript_refererence.jpg" border="0" /> <a href="http://refcardz.dzone.com/refcardz/jquery-selectors">jQuery selectors</a> <br />对 jQuery 开发者来说，该速查手册不可或缺，详细列举了 jQuery 所有选择器。<a href="http://refcardz.dzone.com/assets/request/refcard/3088?oid=lan3088&amp;amp;amp;uid=0">下载</a> （免费注册）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/jquery-selectors.jpg" border="0" /> 服务器端编程 <a href="http://www.addedbytes.com/cheat-sheets/php-cheat-sheet/">PHP Cheat Sheet (V2)</a> <br />单页 PHP 参考手册，包含日期格式，正则表达式以及常用函数。下载 （<a href="http://www.addedbytes.com/download/php-cheat-sheet-v2/pdf/">PDF</a> &#124; <a href="http://www.addedbytes.com/download/php-cheat-sheet-v2/png/">PNG</a>）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/php.jpg" border="0" /> <a href="http://www.stevengould.org/portfolio/independent/php-refcard/PHPRefCard.pdf">Php 4 Reference Card</a> PHP4 参考速查手册。<a href="http://www.stevengould.org/portfolio/independent/php-refcard/PHPRefCard.pdf">下载</a>（PDF） <img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/php4.jpg" border="0" /> <a href="http://www.blueshoes.org/en/developer/php_cheat_sheet/">PHP Cheat Sheet</a> <br />PHP 比较操作速查手册。<a href="http://www.blueshoes.org/en/developer/php_cheat_sheet/">下载</a><br /><a href="http://www.xml.su/">XML (eXtensible Markup Language) in one page</a> XML 单页速查手册。<a href="http://www.xml.su/">直接访问</a> <img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/xml.jpg" border="0" /> <a href="http://www.mulberrytech.com/quickref/XMLquickref.pdf">XML Syntax Quick Reference</a> XML 语法参考。<a href="http://www.mulberrytech.com/quickref/XMLquickref.pdf">下载</a>（PDF） <img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/XMLquickref.jpg" border="0" /> SEO 速查手册 <a href="http://www.seomoz.org/blog/the-web-developers-seo-cheat-sheet">The Web Developer&rsquo;s SEO Cheat Sheet</a> <br />出自 SEO MOZ 的 SEO 速查手册，包括重要的 SEO HTML 标签，搜索引擎索引的限制，Title 标签语法建议等。<a href="http://www.seomoz.org/user_files/SEO_Web_Developer_Cheat_Sheet.pdf">下载</a>（PDF）<br /><img src="http://www.tripwiremagazine.com/wp-content/uploads/images/stories/Articles/cheat-sheets/soemoz.jpg" border="0" /> </p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/web/" rel="tag">web</a> , <a href="http://www.gaobo.info/go.php/tags/design/" rel="tag">design</a> , <a href="http://www.gaobo.info/go.php/tags/develop/" rel="tag">develop</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BC%2580%25E5%258F%2591/" rel="tag">开发</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25AE%25BE%25E8%25AE%25A1/" rel="tag">设计</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2589%258B%25E5%2586%258C/" rel="tag">手册</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/611.htm</link>
<title><![CDATA[匹配域名的正则表达式]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Tue, 02 Jun 2009 00:58:49 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/611.htm</guid> 
<description>
<![CDATA[ 
	昨天搞了IPv4的正则，今天又需要域名的，我汗……<br/>干脆直接去Regular Expression Library找算了，合格的如下：<br/><div class="code">^&#91;a-zA-Z0-9&#93;+(&#91;a-zA-Z0-9&#92;-&#92;.&#93;+)?&#92;.(aero&#124;biz&#124;com&#124;coop&#124;edu&#124;gov&#124;info&#124;int&#124;mil&#124;museum&#124;name&#124;net&#124;org&#124;ac&#124;ad&#124;ae&#124;af&#124;ag&#124;ai&#124;al&#124;am&#124;an&#124;ao&#124;aq&#124;ar&#124;as&#124;at&#124;au&#124;aw&#124;az&#124;ba&#124;bb&#124;bd&#124;be&#124;bf&#124;bg&#124;bh&#124;bi&#124;bj&#124;bm&#124;bn&#124;bo&#124;br&#124;bs&#124;bt&#124;bv&#124;bw&#124;by&#124;bz&#124;ca&#124;cc&#124;cd&#124;cf&#124;cg&#124;ch&#124;ci&#124;ck&#124;cl&#124;cm&#124;cn&#124;co&#124;cr&#124;cs&#124;cu&#124;cv&#124;cx&#124;cy&#124;cz&#124;de&#124;dj&#124;dk&#124;dm&#124;do&#124;dz&#124;ec&#124;ee&#124;eg&#124;eh&#124;er&#124;es&#124;et&#124;fi&#124;fj&#124;fk&#124;fm&#124;fo&#124;fr&#124;ga&#124;gb&#124;gd&#124;ge&#124;gf&#124;gg&#124;gh&#124;gi&#124;gl&#124;gm&#124;gn&#124;gp&#124;gq&#124;gr&#124;gs&#124;gt&#124;gu&#124;gw&#124;gy&#124;hk&#124;hm&#124;hn&#124;hr&#124;ht&#124;hu&#124;id&#124;ie&#124;il&#124;im&#124;in&#124;io&#124;iq&#124;ir&#124;is&#124;it&#124;je&#124;jm&#124;jo&#124;jp&#124;ke&#124;kg&#124;kh&#124;ki&#124;km&#124;kn&#124;kp&#124;kr&#124;kw&#124;ky&#124;kz&#124;la&#124;lb&#124;lc&#124;li&#124;lk&#124;lr&#124;ls&#124;lt&#124;lu&#124;lv&#124;ly&#124; ma&#124;mc&#124;md&#124;mg&#124;mh&#124;mk&#124;ml&#124;mm&#124;mn&#124;mo&#124;mp&#124;mq&#124;mr&#124;ms&#124;mt&#124;mu&#124;mv&#124;mw&#124;mx&#124;my&#124;mz&#124;na&#124;nc&#124;ne&#124;nf&#124;ng&#124;ni&#124;nl&#124;no&#124;np&#124;nr&#124;nu&#124;nz&#124;om&#124;pa&#124;pe&#124;pf&#124;pg&#124;ph&#124;pk&#124; pl&#124;pm&#124;pn&#124;pr&#124;ps&#124;pt&#124;pw&#124;py&#124;qa&#124;re&#124;ro&#124;ru&#124;rw&#124;sa&#124;sb&#124;sc&#124;sd&#124;se&#124;sg&#124;sh&#124;si&#124;sj&#124;sk&#124;sl&#124;sm&#124;sn&#124;so&#124;sr&#124; st&#124;su&#124;sv&#124;sy&#124;sz&#124;tc&#124;td&#124;tf&#124;tg&#124;th&#124;tj&#124;tk&#124;tm&#124;tn&#124;to&#124;tp&#124;tr&#124;tt&#124;tv&#124;tw&#124;tz&#124;ua&#124;ug&#124;uk&#124;um&#124;us&#124;uy&#124;uz&#124;va&#124;vc&#124;ve&#124;vg&#124;vi&#124;vn&#124;vu&#124;wf&#124;ws&#124;ye&#124;yt&#124;yu&#124;za&#124;zm&#124;zr&#124;zw&#124;AERO&#124;BIZ&#124;COM&#124;COOP&#124;EDU&#124;GOV&#124;INFO&#124;INT&#124;MIL&#124;MUSEUM&#124;NAME&#124;NET&#124;ORG&#124;AC&#124;<br/></div><br/>描述：Based of from Steward Haddock's domain nam Checks domain names. This is an attempt to deal with some of the issues of the other reg ex in not handling leading periods(.), hypens(-). and valid extension.<br/>匹配：mydomain.com &#124; my-domain.info &#124; mydomain.aero<br/>不匹配：-mydomain.com &#124; mydomain.aaa &#124; .mydomain.com<br/><br/><div class="code">^(&#91;a-zA-Z0-9&#93;(&#91;a-zA-Z0-9&#92;-&#93;&#123;0,61&#125;&#91;a-zA-Z0-9&#93;)?&#92;.)+&#91;a-zA-Z&#93;&#123;2,6&#125;$</div><br/>描述：Checks domain names. This validates domains based on latest specifications (RFCs 952 and 1123 dealing with hostnames and RFC 1035 dealing with domain name system requirements) except that it only includes realistic fully-qualified domains: 1. requires at least one subdomain 2. allows shortest top-level domains like &quot;ca&quot;, and &quot;museum&quot; as longest. Other validation rules: 1. Labels/parts should be seperated by period. 2. Each label/part has maximum of 63 characters. 3. First and last character of label must be alphanumeric, other characters alphanumeric or hyphen. 4. Does not check maxlength of domain which incidentally is 253 characters of text (255 binary representation). For a regular expression that matches ALL domains: ^([a-zA-Z0-9]([a-zA-Z0-9&#92;-]&#123;0,61&#125;[a-zA-Z0-9])?&#92;.)*[a-zA-Z0-9]([a-zA-Z0-9&#92;-]&#123;0,61&#125;[a-zA-Z0-9])?$<br/>匹配：regexlib.com &#124; this.is.a.museum &#124; 3com.com<br/>不匹配：notadomain-.com &#124; helloworld.c &#124; .oops.org<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/%25E6%25AD%25A3%25E5%2588%2599/" rel="tag">正则</a> , <a href="http://www.gaobo.info/go.php/tags/regular/" rel="tag">regular</a> , <a href="http://www.gaobo.info/go.php/tags/expression/" rel="tag">expression</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25A1%25A8%25E8%25BE%25BE%25E5%25BC%258F/" rel="tag">表达式</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%259F%259F%25E5%2590%258D/" rel="tag">域名</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25A8%25A1%25E5%25BC%258F/" rel="tag">模式</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/610.htm</link>
<title><![CDATA[匹配合格IPv4地址的正则表达式]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 01 Jun 2009 07:48:48 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/610.htm</guid> 
<description>
<![CDATA[ 
	今天写个小程序，需要用正则来匹配IP地址看其是否合格，本来打算自己写，但转念一想，估计这玩意应该有很多人已经做过了，于是上网搜索。郁闷的是找了半天发现网友们给出的都是很简单的模式，不适合做严谨的判断。没办法，只有自己搞了……<br/>匹配合格IP地址的正则表达式的模式如下：<br/><div class="code">^(25&#91;0-5&#93;&#124;2&#91;0-4&#93;&#91;0-9&#93;&#124;&#91;0-1&#93;&#123;1&#125;&#91;0-9&#93;&#123;2&#125;&#124;&#91;1-9&#93;&#123;1&#125;&#91;0-9&#93;&#123;1&#125;&#124;&#91;1-9&#93;)&#92;.(25&#91;0-5&#93;&#124;2&#91;0-4&#93;&#91;0-9&#93;&#124;&#91;0-1&#93;&#123;1&#125;&#91;0-9&#93;&#123;2&#125;&#124;&#91;1-9&#93;&#123;1&#125;&#91;0-9&#93;&#123;1&#125;&#124;&#91;1-9&#93;&#124;0)&#92;.(25&#91;0-5&#93;&#124;2&#91;0-4&#93;&#91;0-9&#93;&#124;&#91;0-1&#93;&#123;1&#125;&#91;0-9&#93;&#123;2&#125;&#124;&#91;1-9&#93;&#123;1&#125;&#91;0-9&#93;&#123;1&#125;&#124;&#91;1-9&#93;&#124;0)&#92;.(25&#91;0-5&#93;&#124;2&#91;0-4&#93;&#91;0-9&#93;&#124;&#91;0-1&#93;&#123;1&#125;&#91;0-9&#93;&#123;2&#125;&#124;&#91;1-9&#93;&#123;1&#125;&#91;0-9&#93;&#123;1&#125;&#124;&#91;0-9&#93;)$<br/></div><br/>后来到<a href="http://www.regexlib.com/" target="_blank">http://www.regexlib.com/</a>搜了下，居然一样<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/ip/" rel="tag">ip</a> , <a href="http://www.gaobo.info/go.php/tags/ipv4/" rel="tag">ipv4</a> , <a href="http://www.gaobo.info/go.php/tags/address/" rel="tag">address</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%259C%25B0%25E5%259D%2580/" rel="tag">地址</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25AD%25A3%25E5%2588%2599/" rel="tag">正则</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25A1%25A8%25E8%25BE%25BE%25E5%25BC%258F/" rel="tag">表达式</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%258C%25B9%25E9%2585%258D/" rel="tag">匹配</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25A8%25A1%25E5%25BC%258F/" rel="tag">模式</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/609.htm</link>
<title><![CDATA[IE7、FF DIV高度不能自适应问题的解决方案]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 01 Jun 2009 03:09:10 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/609.htm</guid> 
<description>
<![CDATA[ 
	今天有人问我这样一个问题：一个XHTML页面中，最底部的一个footer层居然跑到了中间的pagebody层上面，挨在了header层下面，更奇怪的是footer层中的图片却好好的呆在页面底部……orz<br/>解决方法如下，其实也很简单：<br/>给pagebody层的CSS样式增加如下内容：<br/><div class="code">height: 100%;<br/>overflow: auto;<br/></div><br/>搞定！<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/internet/" rel="tag">internet</a> , <a href="http://www.gaobo.info/go.php/tags/explorer/" rel="tag">explorer</a> , <a href="http://www.gaobo.info/go.php/tags/firefox/" rel="tag">firefox</a> , <a href="http://www.gaobo.info/go.php/tags/div/" rel="tag">div</a> , <a href="http://www.gaobo.info/go.php/tags/css/" rel="tag">css</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%25AB%2598%25E5%25BA%25A6/" rel="tag">高度</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%2587%25AA%25E9%2580%2582%25E5%25BA%2594/" rel="tag">自适应</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/585.htm</link>
<title><![CDATA[6个jQuery图表的Web扩展应用]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 02 Mar 2009 00:25:52 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/585.htm</guid> 
<description>
<![CDATA[ 
	<p>随着jQuery、Mootools、prototype等知名的JavaScript框架的应用变的越来越强大，浏览器对最新版本CSS属性的支持，除去页面中Flash的应用之外，图表应用变的越来越广泛实用。本文为你整理了6个实用性强的jQuery图表插件，概述了它们各自的功用和优势。</p><p></p><h4>1，<a href="http://code.google.com/p/flot/" target="_blank" onfocus="return true;undefined"><span style="color: #003366">Flot</span></a></h4><p align="center"><a href="http://code.google.com/p/flot/" target="_blank" onfocus="return true;undefined"><span style="color: #003366"><img class="insertimage" src="attachment.php?fid=55" border="0" /></span></a></p><p>从交互性的层面来说，jQuery实现的 <a href="http://code.google.com/p/flot/" target="_blank" onfocus="return true;undefined"><span style="color: #003366">Flot</span></a>图表和Flash实现的图表效果已经是非常的接近。图表输出效果相当的流畅光滑，注重视觉效果。你也可以和data points数据节点配合使用，当鼠标hover到某个数据节点时，会得到对应节点的数值说明内容的反馈信息。</p><p align="center"><a href="http://people.iola.dk/olau/flot/examples/zooming.html" onfocus="return true;undefined"><img class="insertimage" src="attachment.php?fid=56" border="0" /></a></p><p>如上图所示，你也可以选择图表的一部分内容，获得这些特殊区域的数据；同时，你还可以对数据节点进行放大处理。</p><p><strong>优势: </strong>线条、节点、区域填充、柱状图以及以上功能的组合。</p><h4>2，<a href="http://omnipotent.net/jquery.sparkline/" target="_blank" onfocus="return true;undefined"><span style="color: #003366">Sparklines</span></a></h4><p align="center"><a href="http://omnipotent.net/jquery.sparkline/" target="_blank" onfocus="return true;undefined"><span style="color: #003366"><img class="insertimage" src="attachment.php?fid=57" border="0" /></span></a></p><p><a href="http://omnipotent.net/jquery.sparkline/" target="_blank" onfocus="return true;undefined"><span style="color: #003366">Sparklines</span></a> 是我最欣赏的微型图表实现工具。真正实现了仪表风格的图表样式（登录到你的 Google Analytics 就知道什么样子了)。另外一个好的功用就是，可以帮助在所有的图表插件中实现 self-refresh 的能力。</p><p><strong><strong>优势</strong>:</strong> 楔形、线条、柱状图以及以上功能的组合。</p><h4>3， <a href="http://www.maxb.net/scripts/jgcharts/include/demo/#1" target="_blank" onfocus="return true;undefined"><span style="color: #003366">Google Charts Plugin</span></a></h4><p align="center"><a href="http://www.maxb.net/scripts/jgcharts/include/demo/#1" onfocus="return true;undefined"><span style="color: #003366"><img class="insertimage" src="attachment.php?fid=58" border="0" /></span></a></p><p><a href="http://www.maxb.net/scripts/jgcharts/include/demo/#1" target="_blank" onfocus="return true;undefined"><span style="color: #003366">Google Charts plugin</span></a> 是通过jQuery插件将<a href="http://code.google.com/apis/chart/" target="_blank" onfocus="return true;undefined"><span style="color: #003366">Google Charts API</span></a>应用到Web程序的一个非常简单的方式。同时，这个 API 本身也是非常的简单易用 。允许使用简单的jQuery调用，设置你自己需要的参数：</p><blockquote><p>.attr(&lt;span&gt;'src'&lt;/span&gt;, api.make(&lt;span&gt;&lt;strong&gt;&#123;&lt;/strong&gt;&lt;/span&gt;data : [[&lt;span&gt;153&lt;/span&gt;, &lt;span&gt;60&lt;/span&gt;, &lt;span&gt;52&lt;/span&gt;], [&lt;span&gt;113&lt;/span&gt;, &lt;span&gt;70&lt;/span&gt;, &lt;span&gt;60&lt;/span&gt;], [&lt;span&gt;120&lt;/span&gt;, &lt;span&gt;80&lt;/span&gt;, &lt;span&gt;40&lt;/span&gt;]]&lt;strong&gt;&#125;&lt;/strong&gt;)) </p></blockquote><p><strong><strong>优势</strong>:</strong> 柱状图、重叠柱状图、线条、楔形、3D楔形。</p><h4>4，<a href="http://www.reach1to1.com/sandbox/jquery/jqchart/" target="_blank" onfocus="return true;undefined"><span style="color: #003366">jQuery Chart 0.21</span></a></h4><p align="center"><a href="http://www.reach1to1.com/sandbox/jquery/jqchart/" onfocus="return true;undefined"><img class="insertimage" src="attachment.php?fid=59" border="0" /></a></p><p><a href="http://www.reach1to1.com/sandbox/jquery/jqchart/" target="_blank" onfocus="return true;undefined"><span style="color: #003366">jQuery Chart 0.21</span></a>看起来似乎并不是一个特别好看的图表插件。实现的也是基本的功能，但它的使用却是非常灵活、易用的。</p><p><strong>实例</strong>（添加值给图表）</p><blockquote><p>.chartAdd(&#123;&rdquo;label&rdquo;:&rdquo;Leads&rdquo;,&rdquo;type&rdquo;:&rdquo;Line&rdquo;,&rdquo;color&rdquo;:&rdquo;#008800&Prime;,&rdquo;values&rdquo;:[&quot;100&quot;,&quot;124&quot;,&quot;222&quot;,&quot;44&quot;,&quot;123&quot;,&quot;23&quot;,&quot;99&quot;]&#125;)</p></blockquote><p><strong>优势:</strong> 区块、线条、柱状图以及以上功能的组合。</p><h4>5，<a href="http://jsgt.org/lib/jquery/plugin/jqchart/sample/v003/test-use-gradient.html" target="_blank" onfocus="return true;undefined"><span style="color: #003366">jQchart</span></a></h4><p align="center"><a href="http://jsgt.org/lib/jquery/plugin/jqchart/sample/v003/test-use-gradient.html" target="_blank" onfocus="return true;undefined"><span style="color: #003366"><img class="insertimage" src="attachment.php?fid=60" border="0" /></span></a></p><p><a href="http://jsgt.org/lib/jquery/plugin/jqchart/sample/v003/test-use-gradient.html" target="_blank" onfocus="return true;undefined"><span style="color: #003366">jQchart</span></a> 可以实现在图表中的拖拽动作和动画转换功能。如果你的CSS应用够好，可以实现外观不错的图表效果。与其他插件相比，jQchart的实现功能似乎有些单一。</p><p><strong>优势:</strong> 柱状图、线条</p><h4>6，<a href="http://xaviershay.github.com/tufte-graph/" target="_blank" onfocus="return true;undefined"><span style="color: #003366">TufteGraph</span></a></h4><p align="center"><a href="http://xaviershay.github.com/tufte-graph/" target="_blank" onfocus="return true;undefined"><span style="color: #003366"><img class="insertimage" src="attachment.php?fid=61" border="0" /></span></a></p><p><a href="http://xaviershay.github.com/tufte-graph/" target="_blank" onfocus="return true;undefined"><span style="color: #003366">Tuftegraph</span></a> 生成的柱状图漂亮精致，而且可以实现层叠效果。相比<a href="http://code.google.com/p/flot/" target="_blank" onfocus="return true;undefined"><span style="color: #003366">Flot</span></a> 的精致小巧，<a href="http://xaviershay.github.com/tufte-graph/" target="_blank" onfocus="return true;undefined"><span style="color: #003366">Tuftegraph</span></a>也可以实现自身的减压，变得更加轻便。</p><p><strong>优势:</strong> 柱状图、重叠柱状图。</p><p>以上6中同样通过jQuery实现的图表效果，却各有各的优势和局限，你可以根据自身项目的需求，有选择性地使用，我们的原则就是：简单、实用、兼容性强。</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/jquery/" rel="tag">jquery</a> , <a href="http://www.gaobo.info/go.php/tags/chart/" rel="tag">chart</a> , <a href="http://www.gaobo.info/go.php/tags/plugin/" rel="tag">plugin</a> , <a href="http://www.gaobo.info/go.php/tags/web/" rel="tag">web</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2589%25A9%25E5%25B1%2595/" rel="tag">扩展</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BA%2594%25E7%2594%25A8/" rel="tag">应用</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/586.htm</link>
<title><![CDATA[15个网站用户体验优化禁忌]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sun, 01 Mar 2009 14:54:32 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/586.htm</guid> 
<description>
<![CDATA[ 
	<p>对于一个界定明确的用户群体来讲，其用户体验的共性是能够经由良好设计的实验来认识到。</p><p>用户体验，英文叫做User Experience，缩写为UE或者UX。一种纯主观的在用户访问一个网站或使用一个产品（服务）的过程中建立起来的心理感受。他们的印象和感觉，是否成功，是否享受，是否还想再来/使用。他们能够忍受的问题，疑惑和BUG的程度。因为它是纯主观的，就带有一定的不确定因素。个体差异也决定了每个用户的真实体验是无法通过其他途径来完全模拟或再现的。</p><p>1、超长的页面下载时间</p><p>如果页面下载时间超过30秒，很难有用户会喜欢你的网站。</p><p>2、无限制的使用Flash及图片</p><p>适当的用一些图片及Flash，可以增加网站的生动性，增加视觉冲击力。但无限制的使用Flash及图片，会造成页面文件超大，占用浏览者的CPU资源，并且不利于页面更新及搜索引擎对网站的抓取。企赢营销在服务企业客户时也会遇到纯Flash的整站首页网站，建议网站建设过程中要考虑视觉效果的同时，把优化的因素重视起来。</p><p>3、网站页面过长</p><p>你认为有多少浏览者有兴趣看你网页中最下面的内容，不要拿自己来作比喻，因为99%以上的人才刚学会上网。</p><p>在王建硕的一篇文章中提到：&ldquo;1995年Jakob Neilson做的互联网用户调查，美国的用户在1994年的时候，只有10%的用户会拖动浏览器右边的滚动条，而绝大多数，90%的用户，打开一个网站，只看浏览第一屏看到的内容，就以为看到了全部，而不会向下滚动。&rdquo;</p><p>现在中国也有这样的人，而且为数不少。在一个网站的首页，能看到第三屏内容的人只有10%以下，一个过长的网站很容易引起浏览者的视觉疲劳，更何况大部分浏览者很有可能已经被前两屏的内容吸引到别的页面去了。</p><p>4、不友好的导航</p><p>不友好的导航是最影响用户操作的，不能让用记很方便的找到自己想到的内容。用户来到一个页面不知如何返回上一页，不知道当前页面是在哪个栏目下的，这样的网站很可能用户来了一次就不会再来了。</p><p>5、过期的信息</p><p>很久不更新的信息，很容易让浏览者感到反感，而且在心中也会对你这个网站的品牌形象大打折扣。</p><p>6、死连接或连接错误</p><p>这个就不说了，这是最基本的错误，但是好些还有这样的错误，包括新浪这种大网站。</p><p>7、孤立的页面</p><p>用户不知用什么方法返回首页，这种情况往往是出现在信息提示页或内容调查的结果页上。</p><p>8、页面没有视觉差异</p><p>页面没有视觉差异，页面设计很&ldquo;平&rdquo;，缺少&ldquo;层次感&rdquo;，缺少视觉冲击力和亮点或者视觉冲击力突出的并不是网站的主体内容。这是没有经验的设计师设计大型网站时最容易犯的错误。</p><p>把一大堆信息铺天盖地的展示到浏览者的眼前，你认为他会记住多少。页面设计要吸引并引导浏览者来观看你想推广的内容或产品，当然对网页&ldquo;层次感&rdquo;的<br />设计平不是简单的用一些纯度高的颜色来实现，要根据页面的环境及周边元素综合考虑。就象在一个黑板中画一个白点很明显，但在一个白板上画一个白点就看不清<br />楚了。</p><p>9、链连没有标准的表现形式</p><p>现在很多刚上网站的人还只认为有带下画线的文字才是链接，网站要有统一标准的链接表现形式，并且要和没有连接的文字有区别，要让浏览者很方便的认出哪些是连接的文字。</p><p>如果是图片加的连接要在图片下标出&ldquo;点击图片见大图&rdquo;，图片一定要加ALT属性。&ldquo;更多&rdquo;要用中文写，最好不要MORE或者标点符号代替。</p><p>10、过多的运用新技术</p><p>所谓新技术，就是只有少数人掌握的技术，虽然有可能他的视觉效果很好，功能很强大，但过多的运用新技术，就意味着你准备抛弃99%的用户。</p><p>11、缺少互动的内容</p><p>缺少互动的内容，缺少网友的参与，不能让网友表达情感和思想，注定这个网站只是个死网站。</p><p>12、过复杂的文件目录及文件名</p><p>过复杂的文件目录及文件名，不利用搜索引擎对页面的抓取，并且也不利于浏览者的记忆。几乎100%的人输入网址时会用到IE的缓存，目录和文件过于复杂，排在IE缓存很靠下的地方，你当然被第二次访问的机率小的多。</p><p>不要说什么用收藏夹，不会有超过一半的人会用收藏夹。而且象我这种收藏夹过于庞大的人，想在收藏夹里找一个网址也是比较不容易的。</p><p>13、使用框架</p><p>不建议使用框架，不为什么，就因为搜索引荐不喜欢。连Google的广告计划中，对有框架的代码都是单独的。</p><p>14、恶意插件，恶意弹出窗口</p><p>15、页面中不要过多的用_blank</p><p>过多的弹出新窗口，会大量占用计算机的资源，影响浏览者的浏览速度。</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/user/" rel="tag">user</a> , <a href="http://www.gaobo.info/go.php/tags/experience/" rel="tag">experience</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%2594%25A8%25E6%2588%25B7%25E4%25BD%2593%25E9%25AA%258C/" rel="tag">用户体验</a> , <a href="http://www.gaobo.info/go.php/tags/taboo/" rel="tag">taboo</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25A6%2581%25E5%25BF%258C/" rel="tag">禁忌</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/583.htm</link>
<title><![CDATA[在PHP中使用SOAP方式调用WebService需要注意的地方]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sun, 22 Feb 2009 12:05:44 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/583.htm</guid> 
<description>
<![CDATA[ 
	发现个细节问题，不知道是不是和语言以及开发环境有关，暂且先记录下来。<br/>PHP和.NET都可以使用SOAP方式开发出被调用的WebService，在PHP中调用这些WebService的方式都是相同的。<br/>不同的是调用PHP开发的WebService与.NET开发的WebService的RPC方法的方式上（挺拗口的。。。），下面用个例子说明：<br/>调用PHP开发的WebService：<br/><div class="code">$client = new SoapClient(null, array(&#039;location&#039; =&gt; &quot;http://********/theinterface.php&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#039;uri&#039; =&gt; &quot;http://test-uri/&quot;,<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#039;encoding&#039; =&gt; &#039;UTF-8&#039;));<br/>$param = array(&#039;dir&#039; =&gt; &#039;./themes&#039;);<br/>$client-&gt;listThemes(&#039;./themes&#039;);</div><br/>调用.NET开发的WebService：<br/><div class="code">$client = new SoapClient(&#039;http://*******/WebService/WSEcd.asmx?WSDL&#039;, array(&#039;encoding&#039; =&gt; &#039;utf-8&#039;));<br/>$param = array();<br/>$result = $client-&gt;__soapCall(&#039;TestLink&#039;, array(&#039;parameters&#039; =&gt; $param));<br/>$TestLinkResult = $result-&gt;TestLinkResult;</div><br/>不同之处就在于牵着可以将RPC方法作为SOAPClient对象的方法直接使用，后者则要使用“__soapCall”方法调用RPC方法并传入参数。<br/>另外，在PHP中调用SOAP方式的WebService，对于PHP而言，最好是直接使用SOAPServer的地址，而不使用WSDL文件（虽然使用ZendStudio可以生成WSDL文件，但是生成的文件似乎存在问题，比如其中的参数和返回值类型都不是很规范），如上例；而对.NET则最好是使用WSDL文件。<br/>以上的细节对于JAVA是否存在还不清楚。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/.net/" rel="tag">.net</a> , <a href="http://www.gaobo.info/go.php/tags/webservice/" rel="tag">webservice</a> , <a href="http://www.gaobo.info/go.php/tags/soap/" rel="tag">soap</a> , <a href="http://www.gaobo.info/go.php/tags/rpc/" rel="tag">rpc</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/581.htm</link>
<title><![CDATA[CSS如何使DIV层水平居中(包括水平/垂直) ]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 16 Feb 2009 04:42:43 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/581.htm</guid> 
<description>
<![CDATA[ 
	今天用CSS碰到个很棘手的问题,DIV本身没有定义自己居中的属性,<br/>网上很多的方法都是介绍用上级的text-align: center然后嵌套一层DIV来解决问题.<br/>可是事实上这样的方法科学吗?<br/>经过网络搜索和亲自实验得出以下结论:<br/>正确的也是对页面构造没有影响的设置如下:<br/>对需要水平居中的DIV层添加以下属性:<br/><div class="code">margin-left: auto;<br/>margin-right: auto;</div><br/>经过这么一番设置问题似乎解决了,在FF中已经居中了,可是在IE中看竟然还是没有居中!<br/>郁闷了一下午,就是找不出问题所在,还特地比较了网上的文章竟然一模一样.<br/>问题到底出在哪里呢?<br/>感谢网友乐天无用帮忙找出了这个邪门问题的原因.<br/>原来是L-Blog默认没有在HTML前加上DTD,于是IE就以HTML而不是XHTML来解释文档.<br/>问题并不在CSS而在XHTML网页本身.<br/>需要加上这样的代码才能使得上述设置有效果:<br/><div class="code">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</div><br/>如果您希望更为严格的XHTML 1.0 Strict或者XHTML 1.1请查阅相关文档.<br/>以上测试均基于Windows XP SP2版IE6和FireFox 1.0最终版.<br/><br/><strong>如何使DIV居中</strong><br/><br/>主要的样式定义如下：<br/><div class="code">body &#123;TEXT-ALIGN: center;&#125;<br/>#center &#123; MARGIN-RIGHT: auto; MARGIN-LEFT: auto; &#125;</div><br/>说明：<br/>首先在父级元素定义TEXT-ALIGN: center;这个的意思就是在父级元素内的内容居中；对于IE这样设定就已经可以了。但在mozilla中不能居中。解决办法就是在子元素定义时候设定时再加上“MARGIN-RIGHT: auto;MARGIN-LEFT: auto; ”<br/>需要说明的是，如果你想用这个方法使整个页面要居中，建议不要套在一个DIV里，你可以依次拆出多个div，只<br/>要在每个拆出的div里定义MARGIN-RIGHT: auto;MARGIN-LEFT: auto; 就可以了。<br/><br/><strong>如何使图片在DIV 中垂直居中</strong><br/>用背景的方法。举例：<br/><div class="code">body&#123;BACKGROUND: url(http://www.w3cn.org/style/001/logo_w3cn_194x79.gif) #FFF no-repeat center;&#125;</div><br/>关键就是最后的center,这个参数定义图片的位置。还可以写成“top left”(左上角)或者"bottom right"等，也可以直接写数值"50 30"<br/><br/><strong>如何使文本在DIV中垂直居中</strong><br/><br/>如果是文字，便不能用背景方法，可以用增高行距的办法变通实现垂直居中，完整代码如下：<br/><div class="code">&lt;html&gt;<br/>&lt;head&gt;<br/>&lt;style&gt;<br/>body&#123;TEXT-ALIGN: center;&#125;<br/>#center&#123; MARGIN-RIGHT: auto;<br/>MARGIN-LEFT: auto;<br/>height:200px;<br/>background:#F00;<br/>width:400px;<br/>vertical-align:middle;<br/>line-height:200px;<br/>&#125;<br/>&lt;/style&gt;<br/>&lt;/head&gt;<br/>&lt;body &gt;<br/>&lt;div id=&quot;center&quot;&gt;&lt;p&gt;test content&lt;/p&gt;&lt;/div&gt;<br/>&lt;/body&gt;<br/>&lt;/html&gt;</div><br/>说明：<br/>vertical-align:middle;表示行内垂直居中，我们将行距增加到和整个DIV一样高line-height:200px;然后插入文字，就垂直居中了。<br/>CSS+DIV控制页面中元素垂直居中代码 全局和区域垂直居中<br/><div class="code">&lt;style type=&quot;text/css&quot; media=screen&gt;<br/>body<br/>&#123;<br/>text-align: center;<br/>&#125;<br/>#a<br/>&#123;<br/>width: 200px;<br/>height: 400px;<br/>background: #000;<br/>&#125;<br/>#b<br/>&#123;<br/>margin-top: expression((a.clientHeight-50)/2);<br/>width: 50px;<br/>height: 50px;<br/>background: #FFF;<br/>&#125;<br/>#c<br/>&#123;<br/>position: absolute;<br/>left: expression((body.clientWidth-50)/2);<br/>top: expression((body.clientHeight-50)/2);<br/>width: 50px;<br/>height: 50px;<br/>background: #F00;<br/>&#125;<br/>&lt;/style&gt;<br/>&lt;div id=&quot;a&quot;&gt;<br/>&lt;div id=&quot;b&quot;&gt;&lt;/div&gt;<br/>&lt;/div&gt;<br/>&lt;div id=&quot;c&quot;&gt;&lt;/div&gt;</div><br/>另一方法:<br/><div class="code">&lt;div style=&quot;background:blue;position:absolute;left:expression((body.clientWidth-50)/2);top:expression((body.clientHeight-50)/2);width:50;height:50&quot;&gt;&lt;/div&gt;</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/css/" rel="tag">css</a> , <a href="http://www.gaobo.info/go.php/tags/div/" rel="tag">div</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25B0%25B4%25E5%25B9%25B3/" rel="tag">水平</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%259E%2582%25E7%259B%25B4/" rel="tag">垂直</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25B1%2585%25E4%25B8%25AD/" rel="tag">居中</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/580.htm</link>
<title><![CDATA[配置PHP5支持PostgreSQL 8.3.6]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sun, 15 Feb 2009 06:21:51 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/580.htm</guid> 
<description>
<![CDATA[ 
	昨晚安装了PostgreSQL，今天测试用PHP连接，结果总是提示：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">您的 PHP 中没有完整的数据库支持。</div></div><br/>郁闷……搜索了半天也没找到解决的办法，不过后来还是解决了，呵呵<br/>先进入PostgreSQL的安装目录下的installer目录，执行以下命令：<br/><div class="code">vcredist_x86.exe /q:a /c:&quot;msiexec /i vcredist.msi /qb!&quot;</div><br/>接下来在系统环境变量的Path中添加PGSQL安装目录下的bin目录路径，然后把lib目录下的libpq.dll复制到Windows&#92;system32下（这一步是关键，这个是PHP支持PGSQL的库文件），最后重启IIS。搞定！<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/postgre/" rel="tag">postgre</a> , <a href="http://www.gaobo.info/go.php/tags/sql/" rel="tag">sql</a> , <a href="http://www.gaobo.info/go.php/tags/libpq/" rel="tag">libpq</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/579.htm</link>
<title><![CDATA[整合Zend Studio For Eclipse和ExtJS]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 12 Feb 2009 14:57:41 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/579.htm</guid> 
<description>
<![CDATA[ 
	<p>spket是Eclipse下的JS开发插件，支持Ext，下面是在Zend Studio For Eclipse中集成Ext的步骤：</p><p>1、选择Help -&gt; Software Updates -&gt; Find and Install...-&gt; Search for new features to install -&gt;New remote site... <br />Name: &quot;Spket&quot;<br />Url: &quot;<a href="http://www.spket.com/update/"><a href="http://www.spket.com/update/" target="_blank">http://www.spket.com/update/</a></a>&quot;</p><p>下载完毕重启 Eclipse <br /></p><p>2、Window -&gt; Preferences -&gt; Spket -&gt; JavaScript Profiles -&gt; New ； <br />输入&ldquo;ExtJS&rdquo;点击OK； <br />选择&ldquo;ExtJS&rdquo; 并点击&ldquo;Add Library&rdquo;然后在下拉条中选取&ldquo;ExtJS&rdquo;； <br />选择 &ldquo;ExtJS&rdquo;并点击&ldquo;Add File&rdquo;，然后在你的./ext-2.x/source目录中选取&ldquo;ext.jsb&rdquo; 文件<br /></p><p>3、设置新的ExtJS Profile，选中并点击&ldquo;JavaScript Profiles&rdquo; 对话框右手边的&ldquo;Defalut&rdquo;按钮<br /></p><p>4、设置文件关联：</p><p>Window -&gt; Preferences -&gt;General-&gt; Editors-&gt; File...</p><p>选择JS 为 Spket JavaScript Editor(default)</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/zeng/" rel="tag">zeng</a> , <a href="http://www.gaobo.info/go.php/tags/studio/" rel="tag">studio</a> , <a href="http://www.gaobo.info/go.php/tags/eclipse/" rel="tag">eclipse</a> , <a href="http://www.gaobo.info/go.php/tags/extjs/" rel="tag">extjs</a> , <a href="http://www.gaobo.info/go.php/tags/javascript/" rel="tag">javascript</a> , <a href="http://www.gaobo.info/go.php/tags/spket/" rel="tag">spket</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/573.htm</link>
<title><![CDATA[10个精选免费网站分析工具]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sat, 17 Jan 2009 09:20:18 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/573.htm</guid> 
<description>
<![CDATA[ 
	什么是<a href="http://www.yeeyan.com/articles/tag/Web"><em>Web</em></a>分析学？web分析是指，收集站点对于访客的可用性以及有效性方面的有意义的信息，并对web内容的数据进行集合和分析的过程。Web分析相关的网络应用非常丰富，你也许已经知道类似 <a href="http://zhengyong.net/marketing/free-google-analytics-tool.html">Google Analytics</a> 和 <a href="http://zhengyong.net/marketing/crazy-egg-web-analytics-tool.html">Crazy Egg</a> 的最有影响力的网站分析应用，以及类似 <a href="http://www.alexa.com/">Alexa</a> 和 <a href="http://www.compete.com/">Compete</a> 等远程网站服务。<br /><br />我们这里先跳过这些知名的应用[参考：<a href="http://zhengyong.net/marketing/understanding-your-visitors.html">免费访客行为分析研究工具</a>]，并探讨一些不太知名的网络分析选项。在本文中，你将发现<strong>10个精选的<a href="http://www.yeeyan.com/articles/tag/%E5%85%8D%E8%B4%B9"><em>免费</em></a>web分析工具和应用程序</strong>，他们可以帮助你收集和分析与你网站内容有关的数据。<br />1. <a href="http://piwik.org/">Piwik</a> <br />这里可以参考<a href="http://piwik.org/demo/index.php?module=CoreHome&amp;amp;amp;action=index&amp;amp;amp;idSite=1&amp;amp;amp;period=day&amp;amp;amp;date=yesterday">Piwik的在线演示</a><br /><em>Piwik</em> 是一个开放源代码的网站分析应用，它使用PHP和MySql开发。Piwik有一个允许你任意延伸和自定义的&ldquo;插件&rdquo;系统。你可以选择仅仅安装你需要的插 件，或者全部安装。Piwik插件系统，和你想象的一样，它也给你一个创建你自己的定制扩展应用的可能，并且piwik是个轻量级的应用，下载包只有 1.9MB。<br /><br />2. <a href="http://firestats.cc/">FireStats</a> <br />参考 <a href="http://firestats.cc/">FireStats的在线演示</a>.<br /><em>FireStats</em> 是一个简单和直接的网站分析应用，使用PHP和MySql开发。它支持多种平台，包括C#站点，Django站点，Drupal，Joomla等CMS，以及<a href="http://zhengyong.net/marketing/category/wordpress">Wordpress</a>和<a href="http://firestats.cc/wiki/InstallUpgrade">其他的一些平台</a>。 你是一名经验丰富的开发人员吗？FireStats 还有一个 <a href="http://firestats.cc/wiki/API">优秀的API[应用程序接口]</a> ，它可以协助你创建你自己的基于你的FireStats数据的特制应用程序或发布平台组件 (想象看: <em>在你的wordpress博客显示下载次数最多的10个文件</em>) 。<br /><br />3. <a href="http://report.reinvigorate.net/snoop">Snoop</a> <br /><em>Snoop</em> 是一个基于桌面，运行在 Mac OS X 和 Windows XP/Vista 平台的web分析工具。它运行后，会驻留在你的系统状态栏或系统托盘中，当一些事件发生的时候，会有声音来提醒你。另外一个显著的Snoop特色就是<a href="http://report.reinvigorate.net/name_tags">Name Tags</a> 选项，允许你使用&ldquo;标记&rdquo;来更容易的识别访客。因此，当在财务部门Joe的访问你的网站时，你会立刻知道。<br /><br />4. <a href="http://web.analytics.yahoo.com/">Yahoo! Web Analytics</a> <br /><em>Yahoo! <a href="http://www.yeeyan.com/articles/tag/Web"><em>Web</em></a> analytics</em> 是在web分析行业占据主导地位的<a href="http://zhengyong.net/marketing/category/%E4%BA%92%E8%81%94%E7%BD%91%E6%96%B0%E9%97%BB/google-%E4%BA%92%E8%81%94%E7%BD%91%E6%96%B0%E9%97%BB">Google</a> Analytics的另一个替代选择。它属于企业级的，健壮的，基于Web的第三方分析服务，特别是对于多用户集团，它更容易的实现数据的访问。yahoo网站分析工具全面提供你需要的web分析工具，比如图表工具，自定义设计（并且可打印）报表、以及实时数据跟踪。<br /><br />5. <a href="http://bbclone.de/">BBClone</a> <br />参考<a href="http://bbclone.de/demo/">BBClone的在线演示</a><br />如果你正在寻找一个简单的，服务端的并且不依赖于第三方服务的web应用来监控网站数据，<em>BBClone</em> - 一个基于PHP的服务端应用，为你报告详细的站点流量和访客数据。它支持32种本地化语言，包括英语，中文，德文，日文等。BBClone能够与时下最受 欢迎的发布平台容易的集成，比如Drupal，Wordpress，Textpattern等。 由于它是基于日志文件的，因此它不需要你使用其他的服务端关系数据库。<br /><br />6. <a href="http://www.woopra.com/">Woopra</a> <br /><em>Woopra</em> 是使用Java开发的web分析应用。它分为两个部分，包括一个桌面应用进行数据分析研究，还有一个监控站点统计的<a href="http://zhengyong.net/marketing/category/%E4%BA%92%E8%81%94%E7%BD%91%E5%BA%94%E7%94%A8/web-service">web service</a>。 Woopra 有一个健壮的用户接口，一个允许你运行在多个网站和域名和直观的管理系统，甚至还提供一个聊天功能，因此你可以通过与访客交谈来收集非商业信息。 Woopra当前还处于beta版本，并且需要你请求一个私有数据beta注册。<br /><br />7. <a href="http://www.jawstats.com/">JAWStats</a> <br /><em>JAWStats</em> 也是一个服务端的网站分析应用，它与最流行的 <a href="http://awstats.sourceforge.net/">AWStats</a> 协同运行(实际上，如果你是使用的共享主机计划的话，那么AWStats很可能已经安装好了)。 JAWStats 在awstats的基础上进行了两个扩展 - 依靠减轻服务器资源的使用来提升执行性能，在用户接口部分做了一点提升。<br /><br />8. <a href="http://4q.iperceptions.com/default.aspx?c=en-US">4Q</a> <br />有很大部分的web分析涉及数字运算和数值数据。原始数据只告诉你事件的一部分，另外经常与实际用户进行交互的办法来处理分析数据也会非常的有用。 <a href="http://zhengyong.net/marketing/4q-online-survey-tool.html">4Q</a> 的开发人员 Avinash Kaushik 让这变得非常完美，他说：&ldquo;web分析对于&lsquo;what&rsquo;非常适用，但却不适用&rsquo;why&rsquo; &rdquo;。<em>4Q</em> 是一个简单的调查应用，专注于使用实际用户的反馈来补充和提升你的传统网站分析数字。下面有个<a href="http://www.youtube.com/watch?v=o2LJliORQPQ">YouTube video</a> 会告诉你如何容易的安装 <a href="http://zhengyong.net/marketing/4q-online-survey-tool.html">4Q web分析工具</a>.<br /><br />9. <a href="http://www.mochibot.com/">MochiBot</a> <br /><em>MochiBot</em> 是一个免费的web分析和跟踪工具，它特别为 <a href="http://en.wikipedia.org/wiki/Flash">Flash</a> 资源设计。 使用 MochiBot，你可以看到什么人正在分享你的flash内容，人们视差了你的内容多少次，很好的帮助你跟踪你的flash内容是否被剽窃或非法转载。 安装 MochiBot 很轻快，只需要你可以简单的copy几行ActionScript到你需要监控的.fla文件中去。<br /><br />10. <a href="http://www.quate.net/grape">Grape Web Statistics</a> <br />参考<a href="http://extremetuxracer.com/grape/">Grape Web Statistics在线演示</a><br /><em>Grape <a href="http://www.yeeyan.com/articles/tag/Web"><em>Web</em></a> Statistics</em> 是一个简单，开源的面向开发人员的网站分析应用。它有一个清爽和可用的接口，并且还有一个扩展的API可以定制你的安装。Grape后端采用PHP程序，你可以在任何运行PHP的操作系统上使用该工具。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/web/" rel="tag">web</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25BD%2591%25E7%25AB%2599/" rel="tag">网站</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25AB%2599%25E7%2582%25B9/" rel="tag">站点</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2585%258D%25E8%25B4%25B9/" rel="tag">免费</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25B5%2581%25E9%2587%258F/" rel="tag">流量</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2588%2586%25E6%259E%2590/" rel="tag">分析</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25B7%25A5%25E5%2585%25B7/" rel="tag">工具</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/572.htm</link>
<title><![CDATA[8款超棒的在线设计工具]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sat, 17 Jan 2009 09:17:26 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/572.htm</guid> 
<description>
<![CDATA[ 
	<a href="http://kuler.adobe.com/#create/fromacolor">kuler Create</a><br /><em>kuler</em>这是一个在线的配色工具，用户可以创建自己的配色，保存和评论。<br /><br /><a href="http://www.pixlr.com/editor/">pixlr</a><br /><em>pixlr</em>是一款免费的简单易用的在线图像编辑工具，你可以在这个网站上对图片进行编辑、调整、使用滤镜，支持的图片格式有.jpg .gif 和 .png三种。这个网站有一个十分好的地方，就是你无需注册就可以使用其全部功能（很多类似的网站都需要注册才能使用），而且其界面设计的简单而又不失光滑感，绝对不逊色于那些专业的在线图像编辑网站。<br /><br /><a href="http://wellstyled.com/tools/colorscheme2/index-en.html">Wellstyled Color Scheme Generator</a><br />Wellstyled&rsquo;s <em>Color Scheme Generator</em> 是由Javascript写成的。透过选择不同的主色，色盘就会提供几种配合的颜色，而且这个 Color scheme 工具还提供了不少的 settings，可以选择出不同效果的配色。而且这个工具不用安裝，可以在网上直接使用，快捷方便。<br /><br /><a href="http://fontstruct.fontshop.com/">FontStruct</a><br /><em>FontStruct</em> 是一个在线设计字体的工具，由FontShop创建，编辑和共享字体。FontStructor是一个很方便的工具，可以制作出我们想要的好看字体。您需要注册一个免费的帐户来访问这个工具。<br /><br /><a href="http://www.typetester.org/">Typetester</a><br /><em>Typetester</em> 允许您测试，调整，和比较屏幕字体。它有各种各样的字体，其中包括Arial和Verdana这些网络字体，也可以使用您的个人字体。<br /><br /><a href="http://typenav.fontshop.com/">TypeNavigator</a><br /><em>TypeNavigator</em>是一个非常聪明的网络工具，能够帮助设计人员识别字体。它十分强大，可以帮助你找到你所喜欢的字体。<br /><br /><a href="http://www.blindtextgenerator.com/">Dummy Text Generator</a><br />The <em>Dummy Text Generator</em> 是一款多功能的在线文本编辑工具。它的口号是&ldquo;&quot;Lorem ipsum generator for web designers&quot;, 它还可以帮助设计人员进行排版和打印的工作。<br /><br /><a href="http://bgpatterns.com/">BGPatterns</a><br /><em>BGPatterns</em>是一个用于生成背景的在线工具。直观用户界面,可以让您修改和调整背景的样式。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/%25E5%259C%25A8%25E7%25BA%25BF/" rel="tag">在线</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25AE%25BE%25E8%25AE%25A1/" rel="tag">设计</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25AB%2599%25E7%2582%25B9/" rel="tag">站点</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25BD%2591%25E7%25AB%2599/" rel="tag">网站</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/571.htm</link>
<title><![CDATA[2008年国外最佳Web设计/开发技巧、脚本及资源总结]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 12 Jan 2009 12:32:57 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/571.htm</guid> 
<description>
<![CDATA[ 
	<strong>工具&amp;Web应用</strong><br /><a href="http://www.smashingapps.com/2008/11/27/13-most-essential-open-source-apps-that-you-probably-like-to-say-thank-you.html">13个可能会让你说&rdquo;Thank You&rdquo;的必不可少的开源应用</a><br /><a href="http://www.conversion-rate-experts.com/articles/understanding-your-visitors/">14个免费工具让你了解为什么人们会放弃访问你的网站</a><br /><a href="http://www.allwebdesignresources.com/webdesignblogs/graphics/40-css-generators-creators-and-makers/">40+CSS生成器</a><br /><a href="http://speckyboy.com/2008/03/30/74-great-web-apps-for-web-designers-we-have-forgotten-about/">74个我们可能已经忘记的适合网页设计师的很棒的Web应用</a><br /><a href="http://www.insidecrm.com/features/webmaster-turbo-kit-042108/">50+能提高你的网站速度和性能的技巧和资源</a><br /><a href="http://sixrevisions.com/tools/tools_monitoring_website_popularity/">15个可以监视网站人气的工具</a><br /><a href="http://blog.bingo929.com/20-free-page-seo-analysis-tools.html">20个免费的SEO网站分析工具</a>(已翻译成中文)<br /><a href="http://www.jasonbartholme.com/11-powerful-firefox-3-add-ons-that-can-replace-standalone-applications/">11个功能强大甚至可以替代标准应用程序的Firefox3扩展插件</a><br /><a href="http://www.hongkiat.com/blog/10-free-photo-managing-software-you-should-at-least-know/">10个你至少应该了解的免费照片管理软件</a><br /><a href="http://webjackalope.com/15-things-every-web-developers-should-be-thankful-for/">作为Web前端开发工程师应到感谢的15件事</a><br /><a href="http://blog.bingo929.com/15-bookmarklets.html">15个前端开发/网页设计师必备的Bookmarklet</a>(已翻译成中文)<br /><a href="http://woork.blogspot.com/2008/11/20-great-php-framework-for-developers.html">20大的PHP开发框架</a><br /><a href="http://www.divitodesign.com/2008/08/66-links-to-learn-the-webdesign-basics/">66个学习网页设计基础的链接</a><br /><a href="http://mashable.com/2008/11/01/web-development-tools/">Web开发工具箱： 120 +Web开发新工具</a><br /><br /><strong>脚本、补丁及Hack</strong><br /><a href="http://speckyboy.com/2008/02/10/the-top-40-free-ajax-javascript-code-for-web-designers/">40大免费Ajax及JavaScipt代码</a><br /><a href="http://freelancefolder.com/15-top-site-elements/">所有顶级网站应有的15个关键元素</a><br /><a href="http://designm.ag/resources/converting-psd-to-html/">将PSD效果图转换为HTML/CSS的10大教程</a><br /><a href="http://dzineblog.com/2008/10/30-tooltips-scripts.html">30+JavaScript, Ajax &amp; CSS工具提示脚本</a><br /><a href="http://www.hongkiat.com/blog/50-nice-clean-css-tab-based-navigation-scripts/">50+漂亮的基于纯CSS的导航脚本</a><br /><a href="http://www.hongkiat.com/blog/40-most-wanted-wordpress-tricks-and-hacks/">40+最热门的wordpress秘诀和技巧</a>， <a href="http://www.hongkiat.com/blog/30-more-most-wanted-wordpress-tips-tricks-and-hacks/">30+ More</a><br /><a href="http://nettuts.com/articles/web-roundups/30-eye-opening-web-development-screencasts/">30+让你大开眼界的Web前端开发视频教程</a><br /><a href="http://www.designvitality.com/blog/2008/08/19-css-menu-tutorials-to-spice-up-your-web-designs/">19个CSS菜单教程来为你的网站添加更多趣味</a><br /><a href="http://blog.bingo929.com/30-css-tec-examples.html">精选30个优秀的CSS技术和实例</a>(已翻译成中文)<br /><a href="http://www.knowtebook.com/34-free-html-newsletter-templates-for-startups-899.htm">34+免费通讯(Email等)用HTML模板</a><br /><a href="http://www.smashingmagazine.com/2008/10/16/50-excellent-ajax-tutorials/">50个优秀的Ajax教程</a><br /><a href="http://blog.bingo929.com/12-javascript-browser-css-wrong.html">12种Javascript解决常见浏览器兼容问题的方法</a>(已翻译成中文)<br /><a href="http://www.smashingmagazine.com/2008/11/18/15-helpful-in-browser-web-development-tools/">15个有帮助的基于浏览器的Web前端开发工具</a><br /><a href="http://www.smashingmagazine.com/2008/09/11/75-really-useful-javascript-techniques/">75个(真正的)很有帮助的JavaScipt技术</a><br /><a href="http://speckyboy.com/2008/03/16/the-best-cheat-sheets-for-web-designers-and-developers-from-css-ajax-perl-vbscript/">Web设计/开发最佳使用手册(19)</a><br /><a href="http://speckyboy.com/2008/10/26/20-amazing-javascript-prototype-scripts-elements-widgets-classes/">20个神奇的Javascipt脚本原型、元素、Widgets、类&hellip;</a><br /><a href="http://nettuts.com/tutorials/javascript-ajax/10-rare-but-clever-javascript-techniques/">10个聪明的JavaScipt技术用来提升你的UI界面</a><br /><a href="http://nettuts.com/tutorials/javascript-ajax/20-excellent-ajax-effects-you-should-know/">10个你必须知道的很棒的Ajax特效</a><br /><a href="http://speckyboy.com/2008/10/19/35-easy-to-use-free-ajax-navigation-solutions/">35个使用简便的Ajax/JavaScipt导航解决方案</a><br /><a href="http://www.catswhocode.com/blog/web-design/top-10-css-buttons-tutorial-list-29">10大CSS按钮教程列表</a><br /><a href="http://webtecker.com/2008/06/12/10-free-chart-scripts/">10个免费图表脚本</a><br /><br /><strong>技巧<br /></strong><a href="http://nettuts.com/tutorials/php/10-principles-of-the-php-masters/">10个精通PHP的原理</a><br /><a href="http://nettuts.com/tutorials/html-css-techniques/6-easy-ways-to-improve-your-html-emails/">6个简单方法来改善您的HTML邮件</a><br /><a href="http://www.smashingmagazine.com/2008/08/18/7-principles-of-clean-and-optimized-css-code/">整理及优化CSS代码的7个原则</a>(已翻译成中文)<br /><a href="http://www.smashingmagazine.com/2008/11/12/12-principles-for-keeping-your-code-clean/">保持你的代码整洁的12个原则</a><br /><a href="http://blog.bingo929.com/spice-up-your-images-with-css-5-way.html">使用CSS为图片添加更多趣味的5种方法</a>(已翻译成中文)<br /><a href="http://www.prelovac.com/vladimir/wordpress-optimization-guide">10个优化技巧</a><br /><a href="http://www.redswish.co.uk/10-seo-elements-all-websites-should-have/">所有网站都应具备的10个SEO元素</a><br /><a href="http://www.equivalence.co.uk/archives/101">编写赏心悦目的代码的7种方法</a><br /><a href="http://blog.bingo929.com/10-css-shorthand-tips.html">10个CSS简写技巧让你永远受用</a>(已翻译成中文)<br /><a href="http://www.yongfook.com/items/view/81/10-dirty-little-web-development-tricks">10个Web开发小技巧</a><br /><a href="http://blog.themeforest.net/general/15-css-tricks-that-must-be-learned/">15个必须学会的CSS技巧</a><br /><a href="http://www.noupe.com/design/101-css-techniques-of-all-time-part-1.html">101个CSS技术-第一部分</a>,<a href="http://www.noupe.com/css/101-css-techniques-of-all-time-part2.html">第二部分</a><br /><br /><strong>资源</strong><br /><a href="http://blog.bingo929.com/20-websites-web-design-usabillity.html">推荐20个关于网站可用性及界面设计的网站</a>(已翻译成中文)<br /><a href="http://blog.bingo929.com/31-practical-web-interface-design-tutorials.html">精选31个网站界面设计实践教程</a>(已翻译成中文)<br /><a href="http://speckyboy.com/2008/08/19/a-study-in-ajax-web-trends-what-are-the-best-free-ajax-resources-70-of-the-best-ajax-resources/">Ajax网页趋势研究，什么是最好的免费Ajax资源？(70+最佳Ajax资源)</a><br /><a href="http://blog.bingo929.com/10-sources-ajax-javascript.html">10个非常棒的Ajax及Javascript实例资源网站</a>(已翻译成中文)<br /><a href="http://blog.bingo929.com/gifts-from-designers-to-you-best-of-2008.html">精选2008年最佳设计素材资源&amp;灵感</a> (已翻译成中文)<br /><a href="http://blog.bingo929.com/10-ajax-effects-website-fanciness.html">10种JavaScript特效实例让你的网站更吸引人</a><br /><a href="http://blog.bingo929.com/css-frameworks-15.html">精选15个国外CSS框架</a>(已翻译成中文)<br /><a href="http://speckyboy.com/2008/04/09/41-of-the-best-mootools-ajax-example-downloads/">41个最佳Mootools Ajax实例下载</a><br /><a href="http://blog.bingo929.com/20-websites-learn-css.html">推荐20个让你学习并精通CSS的网站</a>(已翻译成中文)<br /><a href="http://speckyboy.com/2008/04/02/65-excellent-jquery-resources-tutorialscheat-sheetsebooksdemosplugins/">65个优秀的jQuery资源(教程、手册、电子书、demo、插件&hellip;)</a><br /><a href="http://blog.bingo929.com/300-jquery-css-mootools-js-navigation-menus.html">300+Jquery, CSS, MooTools 和 JS的导航菜单资源</a>(已翻译成中文)<br /><a href="http://blog.bingo929.com/12-free-text-editors-for-web-developer.html">推荐12款可用于前端开发的免费文本编辑器</a>(已翻译成中文)<br /><a href="http://blog.bingo929.com/10-beautiful-icons-for-web.html">网页设计必备的10套漂亮图标集</a>(已翻译成中文)<br /><br /><strong>生成器<br /></strong><a href="http://www.thewebsqueeze.com/articles/25-color-palette-generating-resources-for-web-designing.html">25个用于网页设计的颜色调色板生成器资源</a><br /><a href="http://www.smashingapps.com/2008/10/21/13-free-online-tools-that-helps-you-to-create-and-host-your-website.html">12款免费在线工具帮助你创建和托管你的网站</a><br /><a href="http://webtecker.com/2008/04/09/25-web-20-generators/">25款Web2.0生成器</a><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/2008/" rel="tag">2008</a> , <a href="http://www.gaobo.info/go.php/tags/web/" rel="tag">web</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25AE%25BE%25E8%25AE%25A1/" rel="tag">设计</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BC%2580%25E5%258F%2591/" rel="tag">开发</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%258A%2580%25E5%25B7%25A7/" rel="tag">技巧</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%2584%259A%25E6%259C%25AC/" rel="tag">脚本</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25B5%2584%25E6%25BA%2590/" rel="tag">资源</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/564.htm</link>
<title><![CDATA[ie6-ie7-fx 兼容问题汇总]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 24 Nov 2008 03:17:16 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/564.htm</guid> 
<description>
<![CDATA[ 
	<strong>1, FF下给 div 设置 padding 后会导致 width 和 height 增加, 但IE不会.(可用!important<span class="t_tag">解决</span>)<br />2, 居中问题.</strong> <blockquote>1).垂直居中.将 line-height 设置为 当前 div 相同的高度, 再通过 vertical-align: middle.( 注意内容不要换行.)<br />2).水平居中. margin: 0 auto;(当然不是万能)<br /></blockquote><strong>3, 若需给 a 标签内内容加上 样式, 需要设置 display: block;(常见于导航标签)</strong><br /><strong>4, FF 和 IE 对 BOX 理解的差异导致相差 2px 的还有设为 float的div在ie下 margin加倍等问题.</strong><br /><strong>5, ul 标签在 FF 下面默认有 list-style 和 padding . 最好事先声明, 以避免不必要的麻烦. (常见于导航标签和内容列表)</strong><br /><strong>6, 作为外部 wrapper 的 div 不要定死高度, 最好还加上 overflow: hidden.以达到高度自适应.</strong><br /><strong>7, 关于手形光标. cursor: pointer. 而hand 只适用于 IE.</strong><br /><br /><strong>1 针对firefox ie6 ie7的css样式</strong><br />现在大部分都是用<strong>!important</strong>来<strong>hack</strong>，对于<strong>ie6</strong>和<strong>firefox</strong>测试可以正常显示，但是<strong>ie7</strong>对<strong>!important</strong>可以正确解释，会导致<span class="t_tag">页面</span>没按要求显示！找到一个针对<strong>IE7</strong>不错的<strong>hack</strong>方式就是使用&ldquo;<strong>*+html</strong>&rdquo;，现在用IE7浏览一下，应该没有问题了。<br /><br />现在写一个<span class="t_tag">CSS</span>可以这样： <blockquote>#1 &#123; color: #333; &#125; /* Moz */<br />* html #1 &#123; color: #666; &#125; /* IE6 */<br />*+html #1 &#123; color: #999; &#125; /* IE7 */<br /></blockquote>那么在<strong>firefox</strong>下字体颜色显示为#333，<strong>IE6</strong>下字体颜色显示为#666，<strong>IE7</strong>下字体颜色显示为#999。<br /><br /><strong>2 css布局中的居中问题</strong><br />主要的样式定义如下： <blockquote>body &#123;TEXT-ALIGN: center;&#125;<br />#center &#123; MARGIN-RIGHT: auto; MARGIN-LEFT: auto; &#125;<br /></blockquote>说明：<br />首先在父级元素定义<strong>TEXT-ALIGN: center;</strong>这个的意思就是在父级元素内的内容居中；<br />对于<strong>IE</strong>这样设定就已经可以了。<br />但在<strong>mozilla</strong>中不能居中。解决办法就是在子元素定义时候设定时再加上&ldquo;<strong>MARGIN-RIGHT: auto;MARGIN-LEFT: auto; </strong>&rdquo;<br />需要说明的是，如果你想用这个方法使整个页面要居中，建议不要套在一个<strong>DIV</strong>里，你可以依次拆出多个<strong>div</strong>，<br />只要在每个拆出的<strong>div</strong>里定义<strong>MARGIN-RIGHT: auto;MARGIN-LEFT: auto;</strong> 就可以了。<br /><br /><strong>3 盒模型不同解释.</strong> <blockquote>#box&#123; width:600px; //for ie6.0- width:500px; //for ff+ie6.0&#125;<br />#box&#123; width:600px!important //for ff width:600px; //for ff+ie6.0 width /**/:500px; //for ie6.0-&#125;<br /></blockquote><strong>4 浮动ie产生的双倍距离</strong> <blockquote>#box&#123; float:left; width:100px; margin:0 0 0 100px; //这种情况之下IE会产生200px的距离 display:inline; //使浮动忽略&#125;<br /></blockquote>这里细说一下<strong>block,inline</strong>两个元素,<strong>Block</strong>元素的特点是:总是在新行上开始,高度,宽度,行高,边距都可以控制(块元素);<strong>Inline</strong>元素的特点是:和其他元素在同一行上,...不可控制(内嵌元素); <blockquote>#box&#123; display:block; //可以为内嵌元素模拟为块元素 display:inline; //实现同一行排列的的效果 diplay:table;<br /></blockquote><strong>5 IE与宽度和高度的问题</strong><br /><strong>IE</strong>不认得<strong>min</strong>-这个定义，但实际上它把正常的<strong>width</strong>和<strong>height</strong>当作有<strong>min</strong>的情况来使。这样问题就大了，如果只用宽度和高度，<br />正常的浏览器里这两个值就不会变，如果只用<strong>min-width</strong>和<strong>min-height</strong>的话，<strong>IE</strong>下面根本等于没有设置宽度和高度。<br />比如要设置背景图片，这个宽度是比较重要的。要解决这个问题，可以这样： <blockquote>#box&#123; width: 80px; height: 35px;&#125;html&gt;body #box&#123; width: auto; height: auto; min-width: 80px; min-height: 35px;&#125;<br /></blockquote><strong>6 页面的最小宽度</strong><br /><strong>min-width</strong>是个非常方便的<strong>CSS</strong>命令，它可以指定元素最小也不能小于某个宽度，这样就能保证排版一直正确。但<strong>IE</strong>不认得这个，<br />而它实际上把<strong>width</strong>当做最小宽度来使。为了让这一命令在<strong>IE</strong>上也能用，可以把一个<strong>&lt;div&gt;</strong> 放到 <strong>&lt;body&gt;</strong> 标签下，然后为<strong>div</strong>指定一个类：<br />然后<strong>CSS</strong>这样设计： <blockquote>#container&#123; min-width: 600px; width:expression(document.body.clientWidth &lt; 600? &quot;600px&quot;: &quot;auto&quot; );&#125;<br /></blockquote>第一个<strong>min-width</strong>是正常的；但第2行的<strong>width</strong>使用了<strong>Javascript</strong>，这只有<strong>IE</strong>才认得，这也会让你的HTML文档不太正规。它实际上通过<strong>Javascript</strong>的判断来实现最小宽度。<br /><br /><strong>7 清除浮动</strong> <blockquote>.hackbox&#123; display:table; //将对象作为块元素级的表格显示&#125;或者.hackbox&#123; clear:both;&#125;<br /></blockquote>或者加入<strong>:after</strong>（伪对象）,设置在对象后发生的内容，通常和<strong>content</strong>配合使用，<strong>IE</strong>不支持此伪对象，非<strong>IE </strong>浏览器支持，<br />所以并不影响到<strong>IE/WIN</strong>浏览器。这种的最麻烦的..... <blockquote>#box:after&#123; content: &quot;.&quot;; display: block; height: 0; clear: both; visibility: hidden;&#125;<br /></blockquote><strong>8 DIV浮动IE文本产生3象素的bug</strong><br />左边对象浮动，右边采用外补丁的左边距来定位，右边对象内的文本会离左边有3px的间距. <blockquote>#box&#123; float:left; width:800px;&#125;#left&#123; float:left; width:50%;&#125;#right&#123; width:50%;&#125;*html #left&#123; margin-right:-3px; //这句是关键&#125;<br /></blockquote>HTML<span class="t_tag">代码</span> <blockquote>&lt;div id=&quot;box&quot;&gt; &lt;div id=&quot;left&quot;&gt;&lt;/div&gt; &lt;div id=&quot;right&quot;&gt;&lt;/div&gt;&lt;/div&gt;<br /></blockquote><strong>9 属性选择器(这个不能算是兼容,是隐藏css的一个bug)</strong> <blockquote>p[id]&#123;&#125;div[id]&#123;&#125;<br /></blockquote>这个对于<strong>IE6.0</strong>和<strong>IE6.0</strong>以下的版本都隐藏,<strong>FF</strong>和<strong>OPera</strong>作用<br />属性选择器和子选择器还是有区别的,子选择器的范围从形式来说缩小了,属性选择器的范围比较大,如<strong>p[id]</strong>中,所有p标签中有id的都是同样式的.<br /><br /><strong>10 IE捉迷藏的问题</strong><br />当<strong>div</strong><span class="t_tag">应用</span>复杂的时候每个栏中又有一些链接，<strong>DIV</strong>等这个时候容易发生捉迷藏的问题。<br />有些内容显示不出来，当鼠标选择这个区域是发现内容确实在页面。<br />解决办法： <blockquote>对<strong>#layout</strong>使用<strong>line-height</strong>属性 或者给<strong>#layout</strong>使用固定高和宽。页面结构尽量简单。<br /></blockquote><strong>11 高度不适应</strong><br />高度不适应是当内层对象的高度发生变化时外层高度不能自动进行调节，特别是当内层对象使用<strong>margin </strong>或<strong>paddign</strong> 时。<br /><br />例： <blockquote>&lt;div id=&quot;box&quot;&gt;<br />p对象中的内容<br />&lt;/div&gt;<br /></blockquote>CSS： <blockquote>#box &#123;background-color:#eee; &#125;<br />#box p &#123;margin-top: 20px;margin-bottom: 20px; text-align:center; &#125;<br /></blockquote>解决方法：在<strong>P对象</strong>上下各加2个空的<strong>div</strong>对象<strong>CSS</strong>代码： <blockquote>.1&#123;height:0px;overflow:hidden;&#125;<br /></blockquote>或者为<strong>DIV</strong>加上<strong>border</strong>属性。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/ie6/" rel="tag">ie6</a> , <a href="http://www.gaobo.info/go.php/tags/ie7/" rel="tag">ie7</a> , <a href="http://www.gaobo.info/go.php/tags/firefox/" rel="tag">firefox</a> , <a href="http://www.gaobo.info/go.php/tags/internet/" rel="tag">internet</a> , <a href="http://www.gaobo.info/go.php/tags/explorer/" rel="tag">explorer</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25B5%258F%25E8%25A7%2588%25E5%2599%25A8/" rel="tag">浏览器</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2585%25BC%25E5%25AE%25B9%25E6%2580%25A7/" rel="tag">兼容性</a> , <a href="http://www.gaobo.info/go.php/tags/css/" rel="tag">css</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/562.htm</link>
<title><![CDATA[data: URLs]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Tue, 18 Nov 2008 07:49:41 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/562.htm</guid> 
<description>
<![CDATA[ 
	以data:开头，后面加入MIME类型和内容，即可将一个文件包含在一个URL内。包含二进制文件的格式为<br /><strong>data:image/gif;base64,BASE64编码</strong>。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/data/" rel="tag">data</a> , <a href="http://www.gaobo.info/go.php/tags/url/" rel="tag">url</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%258C%2585%25E5%2590%25AB/" rel="tag">包含</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2596%2587%25E4%25BB%25B6/" rel="tag">文件</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/545.htm</link>
<title><![CDATA[为MySQL、SQLServer增加外键的SQL语句]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Tue, 09 Sep 2008 01:55:18 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/545.htm</guid> 
<description>
<![CDATA[ 
	记录以备忘<br/>语法其实是一致的：<br/><div class="code"><br/>ALTER TABLE 表1<br/>ADD CONSTRAINT 外键名<br/>FOREIGN KEY (表1的列名)<br/>REFERENCES 表2(表2的列名)<br/>ON UPDATE CASCADE<br/>ON DELETE CASCADE;<br/></div><br/>其中，表1与表2之间是多对一或一对一的关系。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.gaobo.info/go.php/tags/sql/" rel="tag">sql</a> , <a href="http://www.gaobo.info/go.php/tags/server/" rel="tag">server</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25A4%2596%25E9%2594%25AE/" rel="tag">外键</a> , <a href="http://www.gaobo.info/go.php/tags/foreign/" rel="tag">foreign</a> , <a href="http://www.gaobo.info/go.php/tags/key/" rel="tag">key</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/541.htm</link>
<title><![CDATA[为Aptana Studio 1.1增加PHP的Run和Debug]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 28 Aug 2008 13:40:16 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/541.htm</guid> 
<description>
<![CDATA[ 
	今天突然想起来Aptana Studio很久没升级了，于是乎心血来潮Update。。。<br />我一直是用这个东东调试JavaScript，今天升级完毕后也顺带安装了PHP和AIR、RoR的plugin，装完后新建了几个project，感觉挺不错，而且在网上还发现<a href="http://www.aptana.tv/" target="_blank">aptana.tv</a>有不少官方和其他用户提供的教学视频，很适合才使用Aptana Studio的朋友。但是（我为什么要说但是？），木有发现关于PHP的&hellip;&hellip;<br /><br />安装完plugin后，我便开始从设置中寻找其能够直接Run和Debug PHP程序的方式。经过摸索，发现Aptana支持Server View，里边默认已经有了两个：<br />Internal Web Server，端口8000<br />Jaxer Server，端口5375<br />然后在这个View的工具按钮上发现了：<br /><img class="insertimage" src="attachment.php?fid=38" border="0" width="268" height="140" /><br />呵呵，点击&ldquo;Connect to Generic Web Server&rdquo;，在对话框中仿照下图设置：<br /><img class="insertimage" src="attachment.php?fid=39" border="0" width="566" height="554" /><br />设置完毕后点击OK即可添加一个本地的WebServer作为Run和Debug的后台Web环境。<br />接下来，在Run菜单中点击&ldquo;Run&hellip;&hellip;&rdquo;，在左侧&ldquo;WebBrowser&rdquo;那里点右键，&ldquo;New&hellip;&hellip;&rdquo;，参考下图内容设置：<br /><img class="insertimage" src="attachment.php?fid=40" border="0" width="741" height="472" /><br />设置完毕后点击OK即可。然后打开要Run的PHP程序，在Run按钮下选择你刚刚建立的这个Run方式，即可在对应的浏览器中执行这个PHP程序了，^_^～～<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/aptana/" rel="tag">aptana</a> , <a href="http://www.gaobo.info/go.php/tags/studio/" rel="tag">studio</a> , <a href="http://www.gaobo.info/go.php/tags/debug/" rel="tag">debug</a> , <a href="http://www.gaobo.info/go.php/tags/server/" rel="tag">server</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/540.htm</link>
<title><![CDATA[Zend Studio 6.0.1安装中文语言包的方法]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sat, 23 Aug 2008 01:39:22 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/540.htm</guid> 
<description>
<![CDATA[ 
	1. 下载语言包，61M&nbsp;&nbsp; <a href="http://downloads.zend.com/studio-eclipse/6.0.1/ZendStudio6.0-Language-Pack-it.zip" target="_blank">http://downloads.zend.com/studio-eclipse/6.0.1/ZendStudio6.0-Language-Pack-it.zip</a><br/>2.解压到一个目录，如I:&#92;Downloads&#92;ZendStudio6.0-Language-Pack-it<br/>3.打开eclipse，Help->Software Updates->Find and Install<br/>4.在弹出的子窗体中选择Search for new features to install，Next<br/><a href="http://www.gaobo.info/attachment.php?fid=31" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=31" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>5.在Update sites to visit子窗体中，请勿勾选Sites to include in search中的默认项<br/>点击New Location Site，选择I:&#92;Downloads&#92;ZendStudio6.0-Language-Pack-it，确定后会出现在Sites to include in search中，并且默认勾选，然后Finish<br/><a href="http://www.gaobo.info/attachment.php?fid=32" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=32" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>这时候更新管理器会自动查找。<br/><a href="http://www.gaobo.info/attachment.php?fid=33" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=33" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>6.查找完毕后，在Search Results窗体的结果：<br/><a href="http://www.gaobo.info/attachment.php?fid=34" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=34" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>展开后我们发现许多中文简体的语言包哈！<br/>勾选全部后发现一个问题<br/>WYSIWYG PHP/HTML Editing NL Feature (1.0.0.200805051510) requires feature “com.xored.composer”.<br/>所见即所得编辑器缺少一个关键部件，那么我们暂时先不安装它，取消勾选，Next<br/><a href="http://www.gaobo.info/attachment.php?fid=35" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=35" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>7. 同意条款，然后依次Next，Finish，Install All，重启eclipse后即可。<br/><a href="http://www.gaobo.info/attachment.php?fid=36" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=36" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><a href="http://www.gaobo.info/attachment.php?fid=37" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=37" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>PS：这个语言包并不是完全汉化，不过常用功能基本涵盖了。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/zend/" rel="tag">zend</a> , <a href="http://www.gaobo.info/go.php/tags/studio/" rel="tag">studio</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25AE%2580%25E4%25BD%2593/" rel="tag">简体</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25B8%25AD%25E6%2596%2587/" rel="tag">中文</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25B1%2589%25E5%258C%2596/" rel="tag">汉化</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/539.htm</link>
<title><![CDATA[Zend Studio 6.0升级到6.01的方法]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sat, 23 Aug 2008 01:33:20 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/539.htm</guid> 
<description>
<![CDATA[ 
	其实Zend官方已经给出了升级方法，按照附件PDF文档中的指示一步一步操作即可。<br /><a href="attachment.php?fid=30">点击这里下载文件</a><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/zend/" rel="tag">zend</a> , <a href="http://www.gaobo.info/go.php/tags/studio/" rel="tag">studio</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%258D%2587%25E7%25BA%25A7/" rel="tag">升级</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/538.htm</link>
<title><![CDATA[PHP Remote Debugging - DBG + Xdebug]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 21 Aug 2008 09:39:38 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/538.htm</guid> 
<description>
<![CDATA[ 
	<p>在前面两篇中，分别提到了如何用<a href="http://onezstudio.blogspot.com/2006/10/php-remote-debugging-dbg.html"><span style="color: #225588">DBG</span></a>和<a href="http://onezstudio.blogspot.com/2006/10/php-remote-debugging-xdebug.html"><span style="color: #225588">Xdebug</span></a>扩展模块，在IDE中进行PHP Remote Debugging。</p><p>谈到IDE，<a href="http://www.phpeclipse.net/"><span style="color: #225588">PHPeclipse</span></a>也是一个目前比较流行的PHP开发环境。其正式的版本中，使用DBG作为调试器。目前在其开发版本中，包含了对Xdebug的支持。PHPeclipse在使用DBG的时候，不需要DBG Listener，其内置了监听器，缺省所使用得端口也有所改变。</p><p>对php.ini进行设置，以实现同时对DBG和Xdebug模块，以及多个PHP IDE的支持。具体的设置如下：</p><blockquote><pre style="font-size: 100%; font-family: courier new">...<br />extension=php_dbg.dll<br /><br />[Debugger]<br />debugger.enabled=on<br />debugger.profiler_enabled=on<br />debugger.JIT_enabled=on<br />debugger.JIT_port=7869, 10000/16<br />...<br />zend_extension_ts=&quot;ext/php_xdebug.dll&quot;<br />xdebug.remote_enable=1<br />xdebug.remote_handler=dbgp<br />xdebug.remote_mode=req<br />xdebug.remote_host=127.0.0.1<br />xdebug.remote_port=9000<br />xdebug.show_exception_trace=on<br />xdebug.show_local_vars=on<br />xdebug.show_mem_delta=on<br />xdebug.idekey=&lt;idekey&gt;</pre></blockquote><p>在使用调试器的时候，不要启用Zend Optimizer。Xdebug必须占用zend_extension_ts，才能进行Remote Debugging。</p><p>这里，Xdebug的loading，使用了相对路径，也可以使用绝对路径，以适应PHP扩展模块目录的位置变化。<br />PHP Remote Debugging，相应的配置要涉及到Web Server端和IDE端，以及实际页面的访问。一开始的时候，有些摸不着头脑，理清楚了，就比较简单。</p><p>了解PHP的调试，一定会走到PHP在线帮助的&ldquo;Appendix E. Debugging PHP&rdquo;。在这一页的最后，又见到了熟悉的老朋友，一段Python代码，一个简单的在线调试监听器。运行这段Python code之后，在浏览器上输入在线调试指令，真的就连接过来了，从而知道PHP Remote Debugging是如何开始的。</p><p>无论DBG还是Xdebug，都在调试开始指令中，包含了所调试PHP脚本的完整的路径名和文件名。这样，IDE就可以直接打开相应的文件进行调试，在本机直接跳过HTTP URL到FS File这样的映射(Mapping)。</p><p>所使用的PHP解释器，是Web Server上的那个Parser，而不是IDE附带或连接的PHP。在Remote Debugging的过程中，IDE使用的PHP根本就没有用上。所以，IDE的PHP不必和Web Server的保持一致，甚至可以不设置。</p><p>DBG模块，可以对多个Port提供调试支持。PHPeclipse中的调试端口不固定，要写成debugger.JIT_port=7869, 10000/16这个样子。</p><p>Remote Debugging的过程，从Client/Server的角度来看，IDE充当了Server，在指定端口上监听调试连接。PHP的DBG和Xdebug扩展模块，则是Client。调试从浏览器的开始指令发起，PHP的调试器从Web Server那里得到调试指令，就去和对应端口的Server，即IDE联系，从而开始一个Remote Debugging的对话。</p><p>前面的Post中，提到Xdebug所使用的DBGp，是一个基于XML的多语言调试协议。在DBGp的开始指令中，还包含了脚本语言项。因此，Xdebug is not for PHP only, but also Python, Ruby...。如果在项目中，要在PHP、Python和Ruby之间跨越，使用Xdebug作为Remote Debugging的手段，无疑是非常合适的。这应该就是为什么Komodo选择Xdebug的原因吧。</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/debug/" rel="tag">debug</a> , <a href="http://www.gaobo.info/go.php/tags/dbg/" rel="tag">dbg</a> , <a href="http://www.gaobo.info/go.php/tags/xdebug/" rel="tag">xdebug</a> , <a href="http://www.gaobo.info/go.php/tags/zend/" rel="tag">zend</a> , <a href="http://www.gaobo.info/go.php/tags/optimizer/" rel="tag">optimizer</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25B0%2583%25E8%25AF%2595/" rel="tag">调试</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/537.htm</link>
<title><![CDATA[PHP Remote Debugging - Xdebug]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 21 Aug 2008 09:37:55 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/537.htm</guid> 
<description>
<![CDATA[ 
	<p>PHP Remote Debugging，另一个比较流行的调试模块是<a href="http://xdebug.org/"><span style="color: #225588">Xdebug</span></a>。Xdebug，使用上非常方便，在遇到exception的时候，能够将Application当前的状况，变量、call trace等信息，友好地直接输出到web页面上。</p><p>从<a href="http://xdebug.org/"><span style="color: #225588">Xdebug</span></a>上下载Xdebug for PHP的扩展模块，将其置于PHP的ext目录中。在php.ini中增加，</p><blockquote><pre style="font-size: 100%; font-family: courier new">extension=php_xdebug.dll<br /><br />xdebug.show_exception_trace=on<br />xdebug.show_local_vars=on</pre></blockquote><p>这样就可以在Web Application遇到语法或值溢出等exception的时候，显示相关变量和调用堆栈。</p><p>对于PHP Remote Debugging，需要在php.ini中对Xdebug进行更多的设置。</p><blockquote><pre style="font-size: 100%; font-family: courier new">zend_extension_ts=&quot;ext/php_xdebug.dll&quot;<br />xdebug.remote_enable=1<br />xdebug.remote_handler=dbgp<br />xdebug.remote_mode=req<br />xdebug.remote_host=127.0.0.1<br />xdebug.remote_port=9000<br />xdebug.idekey=&lt;idekey&gt;<br />xdebug.show_exception_trace=on<br />xdebug.show_local_vars=on<br />xdebug.show_mem_delta=on</pre></blockquote><p>并将和Zend Optimizer有关的选项全部关闭。在phpinfo()中，检查是否成功启动Xdebug。</p><p>Xdebug支持多个调试协议，<a href="http://www.xdebug.org/docs-debugger.php"><span style="color: #225588">GDB</span></a>、<a href="http://www.xdebug.org/docs-dbgp.php"><span style="color: #225588">DBGp</span></a>和PHP3。这里使用的是DBGp，一个基于XML的多语言调试协议。</p><p>目前，Xdebug的最新版本是2.0.0 Beta。和DBG Debugger相比，支持Xdebug的IDE还不太多。这里以<a href="http://www.activestate.com/Products/Komodo/"><span style="color: #225588">Komodo</span></a>为例，说明基于Xdebug扩展，如何进行Remote Debugging。</p><p>安装好Komodo 3.5.3之后，设置Preferences - Debugger - Proxy中的，</p><blockquote><pre style="font-size: 100%; font-family: courier new">Listen for debug connections on port: 9000</pre></blockquote><p>再选择Debug - Listen for Remote Debugger。如果出现勾号，没有出错信息的话，Komodo is ready for remote debugging。</p><p>输入Xdebug调试开始指令，</p><blockquote><pre style="font-size: 100%; font-family: courier new"><a href="http://localhost/myscript.php?XDEBUG_SESSION_START=1" target="_blank">http://localhost/myscript.php?XDEBUG_SESSION_START=1</a></pre></blockquote><p>切换到Komodo，对PHP程序进行在线调试。</p><p>上述指令，会启动一个持续的Xdebug调试session，后续PHP脚本会自动进入在线调试状态。也可以只对单个PHP脚本进行单次Remote Debugging。</p><blockquote><pre style="font-size: 100%; font-family: courier new"><a href="http://localhost/myscript.php?XDEBUG_SESSION_START" target="_blank">http://localhost/myscript.php?XDEBUG_SESSION_START</a></pre></blockquote><p>这样就不需要再输入调试中止指令，直接退出Remote Debugging。调试中止指令，格式如下，</p><blockquote><pre style="font-size: 100%; font-family: courier new"><a href="http://localhost/myscript.php?XDEBUG_SESSION_STOP" target="_blank">http://localhost/myscript.php?XDEBUG_SESSION_STOP</a></pre></blockquote><p>需要指出的是，XDEBUG_SESSION_STOP不会立即停止对当前PHP的在线调试，而是停止对此以后的PHP的Remote Debugging。</p><p>Xdebug提供了一个xdebug_break()函数，直接在程序中设置断点，而不是在Komodo中设置。</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/debug/" rel="tag">debug</a> , <a href="http://www.gaobo.info/go.php/tags/xdebug/" rel="tag">xdebug</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25B0%2583%25E8%25AF%2595/" rel="tag">调试</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/536.htm</link>
<title><![CDATA[PHP Remote Debugging - DBG]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 21 Aug 2008 09:36:37 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/536.htm</guid> 
<description>
<![CDATA[ 
	<p>PHP Remote Debugging，是对PHP Web应用程序进行调试的最直接、最有力的手段。尤其是现在，框架横行的时代，光靠阅读源码和简单的echo，显然进展不快。</p><p>Remote Debugging，直译过来是&ldquo;远程调试&rdquo;，个人更愿意翻译成&ldquo;在线调试&rdquo;，即在实际使用Web Server的情况下，对Web Application进行调试。</p><p>诸多PHP IDE，都集成了广泛使用的<a href="http://dd.cron.ru/dbg/"><span style="color: #225588">DBG</span></a>调试模块。这里以<a href="http://www.waterproof.fr/products/PHPEdit/"><span style="color: #225588">PHPEdit</span></a>为例，介绍如何使用DBG进行PHP程序的在线调试。PHPEdit包含了DBG Listener和DBG Debugger，能够进行单步跟踪、全局和局部变量检查等功能，用它进行Remote Debugging，非常方便、实用。</p><p>在启动PHPEdit的时候，DBG Listener也会一同启动。在系统托盘区，可以找到一个类似雷达天线的图标，那个就是PHP DBG Listener。DBG Listener的基本设置，</p><blockquote><pre style="font-size: 100%; font-family: courier new">Bind address:&nbsp;&nbsp;0.0.0.0<br />Port:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;7869<br />IDE COM class： PHPEdit IDE<br /> X Breakpoint on script start<br /> X Breakpoint on script finish</pre></blockquote><p>最后这两行设置，会在PHP脚本的开始和结束的地方，自动设置断点。这样就不必手工去设置断点了。当你不清楚程序的整体结构和入口点的时候，这就显得很方便。DBG Listener通常是处于等待(Waiting)的状态。</p><p>设置PHPEdit，以便进行在线调试。在PHPEdit Perferences中，选择Debugger。</p><blockquote><pre style="font-size: 100%; font-family: courier new">X HTTP (SAPI or remote CGI)<br /> X Use backslashed in filenames on remote filesystem (win32)<br /> X Make file name low case before mapping</pre></blockquote><p>后续的Mapping部分，是将实际要访问的HTTP URL和本机的文件目录对应起来。如果Web Server和PHPEdit在同一台机器上，就没有必要在本机再建立一个工作备份，Mapping可不设。</p><p>设置完成之后，点击Debug - Start Listener，以准备接受Remote Debugging指令。一旦PHPEdit和DBG Listener配置好之后，就不需要每次都去Start Listener，PHPEdit会自动开始对Remote Debugging的监听。</p><p>Web Server这一端，需要修改php.ini以提供对DBG的支持。在php.ini的Dynamic Extensions段，增加</p><blockquote><pre style="font-size: 100%; font-family: courier new">extension=php_dbg.dll<br /><br />[Debugger]<br />debugger.enabled=on<br />debugger.profiler_enabled=on<br />debugger.JIT_enabled=on<br />debugger.JIT_port=7869</pre></blockquote><p><br />DBG的扩展模块，可以从<a href="http://dd.cron.ru/dbg/download.php?h=213.1-mod-php"><span style="color: #225588">这里</span></a>下载。选择合适的版本，放到php的扩展目录下，并改名为php_dbg.dll。对于版本号高于5.1.2的PHP，用for 5.1.2的那个dll即可。</p><p>通过查看phpinfo()的输出信息，确认PHP DBG模块被正确安装。</p><blockquote><pre style="font-size: 100%; font-family: courier new">This program makes use of the Zend Scripting Language Engine:<br />Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies<br />&nbsp;&nbsp;&nbsp;&nbsp;with DBG v2.15.1, (C) 2000,2006, by Dmitri Dmitrienko<br />...<br />dbg<br />DBG php debugger, version 2.15.1, Copyright 2001, 2006, Dmitri<br /> Dmitrienko, <a href="http://www.nusphere.com" target="_blank">www.nusphere.com</a> <br /><br />Version&nbsp;&nbsp;&nbsp;&nbsp;2.15.1&nbsp;&nbsp;<br />Linked&nbsp;&nbsp;&nbsp;&nbsp; as a shared library.&nbsp;&nbsp;<br />Profiler&nbsp;&nbsp; compiled, enabled&nbsp;&nbsp;<br /><br />Directive&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Local Value&nbsp;&nbsp;Master Value <br />debugger.enable_session_cookie On&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On <br />debugger.enabled&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On <br />debugger.fail_silently&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On <br />debugger.ignore_nops&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Off&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Off <br />debugger.JIT_enabled&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On <br />debugger.JIT_host&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;clienthost&nbsp;&nbsp; clienthost <br />debugger.JIT_level&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3 <br />debugger.JIT_port&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;7869&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7869<br />debugger.profiler_enabled&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;On&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On <br />debugger.session_nocache&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; On <br />debugger.timeout_seconds&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 300&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;300</pre></blockquote><p>现在一切准备就绪，可以开始PHP Remote Debugging了。DBG Remote Debugging不会自动开启，需要激活一下。在浏览器中，输入</p><blockquote><pre style="font-size: 100%; font-family: courier new"><a href="http://localhost/myscript.php?DBGSESSID=1@localhost:7869" target="_blank">http://localhost/myscript.php?DBGSESSID=1@localhost:7869</a></pre></blockquote><p>就会切换到PHPEdit，打开myscript.php，光标会自动停在myscript.php中PHP程序部分的开始。接下来，就是标准的debug操作，跟踪、步进、变量察看等等。随着PHP代码的运行结束，最后输出的Web Page就会出现在浏览器中。这样就完成了一个DBG的调试周期。</p><p>一旦开启DBG在线调试，之后就不再需要附加Active Command了。以后对每个PHP页的访问，都会自动进入调试状态。</p><p>使用下面的命令，中止DBG Remote Debugging，取消调试。</p><blockquote><pre style="font-size: 100%; font-family: courier new"><a href="http://localhost/myscript.php?DBGSESSID=0" target="_blank">http://localhost/myscript.php?DBGSESSID=0</a></pre></blockquote><p>DBG Listener可以支持多个IDE，如果安装有多个支持DBG的IDE，需要注意实际使用哪个IDE进行调试。</p><p>如果在未开启DBG Listener或相应的IDE的情况下，使用Active Command，或者在Remote Debugging过程中，IDE退出，浏览器上都会得到出错信息。此时，需要附加取消调试的指令，才能恢复对PHP页面的正常访问。</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/debug/" rel="tag">debug</a> , <a href="http://www.gaobo.info/go.php/tags/ide/" rel="tag">ide</a> , <a href="http://www.gaobo.info/go.php/tags/dbg/" rel="tag">dbg</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25B0%2583%25E8%25AF%2595/" rel="tag">调试</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/533.htm</link>
<title><![CDATA[InnoDB和MyISAM的差别]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 14 Aug 2008 08:56:25 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/533.htm</guid> 
<description>
<![CDATA[ 
	InnoDB和MyISAM是在使用MySQL最常用的两个表类型，各有优缺点，视具体应用而定。基本的差别为：MyISAM类型不支持事务处理等高级处理，而InnoDB类型支持。MyISAM类型的表强调的是性能，其执行数度比InnoDB类型更快，但是不提供事务支持，而InnoDB提供事务支持已经外部键等高级数据库功能。<br />MyIASM是IASM表的新版本，有如下扩展：<br />二进制层次的可移植性。&nbsp;&nbsp;<br />NULL列索引。&nbsp;&nbsp;<br />对变长行比ISAM表有更少的碎片。&nbsp;&nbsp;<br />支持大文件。&nbsp;&nbsp;<br />更好的索引压缩。&nbsp;&nbsp;<br />更好的键码统计分布。&nbsp;&nbsp;<br />更好和更快的auto_increment处理。&nbsp;&nbsp;<br />以下是一些细节和具体实现的差别：<br />1.InnoDB不支持FULLTEXT类型的索引。<br />2.InnoDB 中不保存表的具体行数，也就是说，执行select count(*) from table时，InnoDB要扫描一遍整个表来计算有多少行，但是MyISAM只要简单的读出保存好的行数即可。注意的是，当count(*)语句包含 where条件时，两种表的操作是一样的。<br />3.对于AUTO_INCREMENT类型的字段，InnoDB中必须包含只有该字段的索引，但是在MyISAM表中，可以和其他字段一起建立联合索引。<br />4.DELETE FROM table时，InnoDB不会重新建立表，而是一行一行的删除。<br />5.LOAD TABLE FROM MASTER操作对InnoDB是不起作用的，解决方法是首先把InnoDB表改成MyISAM表，导入数据后再改成InnoDB表，但是对于使用的额外的InnoDB特性（例如外键）的表不适用。<br />另外，InnoDB表的行锁也不是绝对的，如果在执行一个SQL语句时MySQL不能确定要扫描的范围，InnoDB表同样会锁全表，例如update table set num=1 where name like &ldquo;%aaa%&rdquo;<br />任何一种表都不是万能的，只用恰当的针对业务类型来选择合适的表类型，才能最大的发挥MySQL的性能优势。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593/" rel="tag">数据库</a> , <a href="http://www.gaobo.info/go.php/tags/innodb/" rel="tag">innodb</a> , <a href="http://www.gaobo.info/go.php/tags/myisam/" rel="tag">myisam</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/531.htm</link>
<title><![CDATA[MySQL性能优化TIPS]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 14 Aug 2008 08:50:32 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/531.htm</guid> 
<description>
<![CDATA[ 
	总结了一些MySQL优化方面的技巧<br /><br /><strong>一. 启动参数优化</strong><br />修改 my.cnf (或者my.ini)，加入/修改以下几行<br /><br />#设定缓存的连接数,节省连接时的开销<br />back_log = 64<br /><br />#禁用文件系统外部锁<br />external-locking = 0<br /><br />#禁用BDB,如果你确实不需要的话,innodb也是如此<br />skip-bdb<br /><br />#索引缓冲,如果是专用的数据库服务器,可以设置高达服务器内存的一半,如果不是专用的,<br />#还是设置得低一点<br />key_buffer = 512M<br /><br />#缓存数据表数量,如果内存较大,可以设置稍微高一点,否则还是设置低一点<br />#设置这个参数可以参见系统状态中的 open_tables(表示当前打开的数据表总数)<br />#和 opened_tables(表示所有打开的数据表总数)<br />table_cache = 128<br /><br />#禁用dns解析,如果你的授权信息中采用dns授权方式了,就不能启用该选项<br />skip-name-resolve<br /><br />#记录慢查询和没有使用索引的查询,便于帮助分析问题所在<br />long_query_time = 1<br />log-slow-queries = /usr/local/mysql/data/slow.log<br />log-queries-not-using-indexes<br /><br />其他参数诸如 sort_buffer_size,net_buffer_length,read_buffer_size,read_rnd_buffer_size,myisam_sort_buffer_size,<br />thread_cache_size,query_cache_size,max_binlog_cache_size 等请查询MySQL手册,然后做出合适的调整.<br /><br /><strong>二. 其他小TIPS</strong><br /><br />* 针对Innodb表,尽量不执行 SELECT COUNT(*) 语句,因为Innodb表没有类似MyISAM那样的内部计数器来记录表记录总量,执行这个操作将会全表扫描,速度很慢.<br />* 尽量使用MyISAM表,除非必须使用其他类型,因为MyISAM类型的总体读写效率是相当高的,缺点是表级锁,而不是行/页级锁.<br />* 善用 EXPLAIN来帮助你分析查询优化情况<br />* 如果需要对一个较大的且并发读写较多的数据表做 GROUP BY 等统计操作,建议使用摘要表来存储统计信息,定期更新统计表,这可能获得很大的性能改善.<br />* 查询时如果有 ORDER BY分句的话,注意让它的字段顺序和索引字段顺序对应,这样能加快排序速度<br />* 如果有一个多字段索引,则查询时,必须按照索引顺序来使用,否则该索引不会用到.例如:<br />索引 `idx_`(col1, col2, col3),那么查询 SELECT .... FROM ... WHERE col1=1 AND col2=2; 使用索引,而查询 ... WHERE col2=2 AND col3=3; 或 ... WHERE col1=1 AND col3=3; 则不使用索引.<br />* WHERE 中的条件如果有恒量类型的(如 `field` = 1),就尽量放在前面,这样能更快的执行过滤.<br />* 2 个表连接时,连接字段的类型最好一致(包括字段长度),这样的话索引速度快多了.<br />* 大部分情况下,字符类型的字段索引值需要一部分,例如 CREATE INDEX char_idx ON tbl1 ( name(10) );<br />* 尽量使用最合适的数据类型,能使用 ENUM 就不使用 TINYINT ,能使用 SMALLINT 就不使用 MEDIUMINT.这样能节省存储空间,增加数据存储量,提高搜索速度.不要担心这样会对省级产生很大的影响,因为加入从 TINYINT 类型改变为 INT 的话,并不会改变原来的数据.<br />* 如果知道某个表总是频繁使用的话,可以把它放到 hot_cache 中,用以下方法:<br /><br />SET GLOBAL hot_cache.key_buffer_size=128*1024;<br />CACHE INDEX `xxx` IN hot_cache;<br /><br />* 把拖沓复杂,速度慢的的查询分解成多个简洁明了的查询,这样尽管查询次数多了,但是总体速度和效率却可能反而更高了,而且也减少了锁表的可能.<br />* 执行查询时,尽量不使用外部函数,因为这样的话就无法使用可能存在的索引,并且无论如何都会极大地降低效率.如: ... WHERE `create_time` &gt; UNIX_TIMESTAMP(NOW()); 这样的查询.可以在程序中把当前的时间取得,然后直接执行构造好了的SQL语句.<br />* 在索引字段上使用 LIKE 查询时,左边不要使用 '%' 修饰符,这样就可以利用索引,否则无法使用索引.如 ... `name` LIKE 'yejr%';.<br />* 如果有可能,多使用存储过程,这大概能获得 22% 的性能提高.<br />* 如果并发访问量相对最大连接数小多了的话,最好使用永久连接,这样能节省不少连接时的系统资源损耗.<br />* 定期的在MyISAM表上执行 OPTIMIZE TABLE,这能整理随便,提高索引效率.<br />* 如果你主要按 col1，col2，...顺序检索记录,请在对表大量更改后执行 ALTER TABLE ... ORDER BY col1, col2, ... 语句,这可以获得更好的性能.<br />* 对于频繁更改的MyISAM表,应尽量避免更新所有变长字段(VARCHAR、BLOB和TEXT).<br />* 对于记录总数超过500万的单表,就应该赶紧考虑分表了.分表策略有多种,比如按ID号段,或者按时间切分,等等.<br />* 创建数据表时尽量指定字段不能为NULL,并且有默认值.<br />* 使用 LOAD DATA,而不是使用大批量的 INSERT 语句来导入数据.<br />* 使数据表名和字段名尽可能的短,例如在 user 表中使用字段名 name,而不是 user_name.<br />* 用 DELAY_KEY_WRITE = 1 选项让MyISAM更快地更新索引,因为在表关闭之前它们不刷新到硬盘上.缺点是如果服务器如果突然被杀掉了,重启之后就必须运行 myisamchk 修复索引才行.<br />* 采用复制机制来分摊读数据的负载,把写数据只放在主服务器上,把读平均分摊到各个从服务器上,能大大提高系统负载.<br /><br />数据库性能优化涉及到系统硬件和软件的方方面面，本文讨论的主要是编译和配置优化、服务器参数调整、如何选用合适的表类型，以及如何用数据库内建的命令辅助 分析和优化性能，特别是如何用EXPLAIN辅助优化查询的性能。原文出处：<a href="http://www.devshed.com/Server_Side/MySQL/Optimize/"><a href="http://www.devshed.com/Server_Side/MySQL/Optimize/" target="_blank">http://www.devshed.com/Server_Side/MySQL/Optimize/</a></a><br /><br />在Apache, PHP, MySQL的体系架构中，MySQL对于性能的影响最大，也是关键的核心部分。对于Discuz!论坛程序也是如此，MySQL的设置是否合理优化，直接 影响到论坛的速度和承载量！同时，MySQL也是优化难度最大的一个部分，不但需要理解一些MySQL专业知识，同时还需要长时间的观察统计并且根据经验 进行判断，然后设置合理的参数。<br /><br />下面我们了解一下MySQL优化的一些基础，MySQL的优化我分为两个部分，一是服务器物理硬件的优化；二是MySQL自身(my.cnf)的优化。<br /><br />(1) 服务器硬件对MySQL性能的影响<br />a) 磁盘寻道能力（磁盘I/O）,以目前高转速SCSI硬盘(7200转/秒)为例，这种硬盘理论上每秒寻道7200次，这是物理特性决定的，没有办法改变。 MySQL每秒钟都在进行大量、复杂的查询操作，对磁盘的读写量可想而知。所以，通常认为磁盘I/O是制约MySQL性能的最大因素之一，对于日均访问量 在100万PV以上的Discuz!论坛，由于磁盘I/O的制约，MySQL的性能会非常低下！解决这一制约因素可以考虑以下几种解决方案：<br />使用 RAID-0+1磁盘阵列，注意不要尝试使用RAID-5，MySQL在RAID-5磁盘阵列上的效率不会像你期待的那样快；抛弃传统的硬盘，使用速度更 快的闪存式存储设备。经过Discuz!公司技术工程的测试，使用闪存式存储设备可比传统硬盘速度高出6－10倍左右。<br />b) CPU 对于MySQL应用，推荐使用S.M.P.架构的多路对称CPU，例如：可以使用两颗Intel Xeon 3.6GHz的CPU。<br />c) 物理内存对于一台使用MySQL的Database Server来说，服务器内存建议不要小于2GB，推荐使用4GB以上的物理内存。<br /><br />(2) MySQL自身因素当解决了上述服务器硬件制约因素后，让我们看看MySQL自身的优化是如何操作的。对MySQL自身的优化主要是对其配置文件my.cnf中的各项参数进行优化调整。下面我们介绍一些对性能影响较大的参数。<br />由于my.cnf文件的优化设置是与服务器硬件配置息息相关的，因而我们指定一个假想的服务器硬件环境：<br />CPU: 2颗Intel Xeon 2.4GHz<br />内存: 4GB DDR<br />硬盘: SCSI 73GB<br /><br />许多新手往往把重新编译源代码看成是一种无可避免的灾祸，其实编译源代码还能对程序的最终性能起到显著的影响。编译过程可以用不同流水线上装配同样型号 的汽车比拟：第一条流水线由素质较低的工人操作，装配程序未能尽善尽美，零件装配误差较大；第二条流水线由高素质的技术工人操作，汽车装配程序合理，且利 用最好的工具保证产品的高质量。虽然两条流水线上装配出来的汽车外观一模一样，但两种汽车的性能表现却可能大不相同。对于编译器来说情况也完全相似，有些 编译器装配出来的程序要比其他编译器的更好。<br /><br />编译时考虑所有可用的选项也是极其重要的。很可能某些编译器的默认选项值不能符合要求， 或者，为了满足应用的特定需求，我们需要指定一些特殊的编译选项。正如MySQL文档所指出的，只要采用了更好的编译器或者使用更合理的编译选项，应用性 能的提高程度可以达到10-30%。<br /><br />既然如此，编译时具体应该注意哪些问题才能让MySQL数据库运行得更快呢？<br /><br />▲ 使用pgcc编译器<br />如果系统使用的是奔腾处理器，那么pgcc（Pentium GCC）正是为这些系统下运行的程序提供的专用编译器。pgcc是gcc编译器（<a href="http://www.gnu.org/software/gcc/" target="_blank">http://www.gnu.org/software/gcc/</a>）的 奔腾优化版，用pgcc编译MySQL代码可以让整体性能提高10%以上！关于pgcc的更多信息，请参见http: //www.goof.com/pcg/。当然，如果系统使用的不是奔腾处理器，采用这种方法提高MySQL的运行速度就不合适了，因为正如其名字所示， pgcc是专门为奔腾系统提供的。<br /><br />▲ 把mysqld编译成静态模式<br />以不带共享库的形式编译mysqld同样可以提高性能。在配置行加入下面这个选项可以将mysqld编译成静态模式：<br />% &gt;./configure -with-mysqld-ldflags=-all-static [--其他配置选项]<br /><br />▲ 配置示例<br />下面的配置命令经常用于提高MySQL的性能：<br />% &gt;CFLAGS=&quot;-O6 -mpentiumpro -fomit-frame-pointer&quot; CXX=gcc CXXFLAGS=&quot;-O6<br />-mpentiumpro -fomit-frame-pointer -felide-constructors -fno-exceptions -fno-rtti&quot;<br />./configure --prefix=/usr/local --enable-assembler --with-mysqld-ldflags=-all-static<br />--disable-shared<br /><br />详细解释每个gcc选项的作用已经超出了本文的范围，请访问gcc的说明文档了解这些信息（<a href="http://gcc.gnu.org/" target="_blank">http://gcc.gnu.org/</a>）。注意不要拘泥于这个例子，请在命令行执行man gcc仔细了解每一个gcc选项的含义。<br /><br />正确的编译方法固然重要，但它只是提高MySQL服务器性能工作的一部分。MySQL服务器的许多参数会影响服务器的性能表现，而且我们可以把这些参数保存到配置文件，使得每次MySQL服务器启动时这些参数都自动发挥作用。这个配置文件就是my.cnf。<br /><br />MySQL服务器提供了my.cnf文件的几个示例，它们可以在/usr/local/mysql/share/mysql/目录下找到，名字分别为my -small.cnf、my-medium.cnf、my-large.cnf以及my-huge.cnf。文件名字中关于规模的说明描述了该配置文件适 用的系统类型。例如，如果运行MySQL服务器的系统内存不多，而且MySQL只是偶尔使用，那么使用my-small.cnf配置文件最为理想，这个配 置文件告诉mysqld daemon使用最少的系统资源。反之，如果MySQL服务器用于支持一个大规模的在线商场，系统拥有2G的内存，那么使用mysql-huge.cnf 最为合适。<br /><br />要使用上述示例配置文件，我们应该先复制一个最适合要求的配置文件，并把它命名为my.cnf。这个复制得到的配置文件可以按照如下三种方式使用：<br />全局：把这个my.cnf文件复制到服务器的/etc目录，此时文件中所定义的参数将全局有效，即对该服务器上运行的所有MySQL数据库服务器都有效。<br />局部：把这个my.cnf文件复制到[MYSQL-INSTALL-DIR]/var/将使该文件只对指定的服务器有效，其中[MYSQL-INSTALL-DIR]表示安装MySQL的目录。<br />用户：最后，我们还可以把该文件的作用范围局限到指定的用户，这只需把my.cnf文件复制到用户的根目录即可。<br /><br />那么，如何设置my.cnf文件中的参数呢？或者进一步说，哪些参数是我们可以设置的呢？所有这些参数都对MySQL服务器有着全局性的影响，但同时每 一个参数都和MySQL的特定部分关系较为密切。例如，max_connections参数属于mysqld一类。那么，如何才能得知这一点呢？这只需执行如下命令：<br />% &gt;/usr/local/mysql/libexec/mysqld --help<br /><br />该命令将 显示出和mysqld有关的各种选项和参数。要寻找这些参数非常方便，因为这些参数都在&ldquo;Possible variables for option --set-variable (-O) are&rdquo;这行内容的后面。找到这些参数之后，我们就可以在my.cnf文件中按照如下方式设置所有这些参数：<br /><br />set-variable = max_connections=100<br /><br />这行代码的效果是：同时连接MySQL服务器的最大连接数量限制为100。不要忘了在my.cnf文件[mysqld]小节加上一个set-variable指令，具体请参见配置文件中的示例。<br /><br /><strong>数据库的常规优化</strong><br /><br />MySQL 本身的配置文件 my.cnf（或 my.ini）中的相关参数，对整个数据库系统来说尤为重要。针对不同的服务器内存容量，MySQL 程序包中提供了 my-small.cnf、my-medium.cnf、my-large.cnf、my-huge.cnf 四个分别适用于服务器内存不低于 64M、256M、512M、1G 情况下的参数设置，您可以根据自身机器的实际情况，数据库应用所占比重，在上述四个文件中提供的参数基础上对配置文件进行修改。Unix 类系统用户，建议将配置文件命名为 my.cnf 放置于 /etc 中；Windows 系统用户直接在 Winmysqladmin.exe 中对 my.ini 进行修改即可。 除了以上默认的配置文件提供的参数以外，通常情况您还需要在 [mysqld] 后修改或增加以下的参数以适应大部分 web 应用程序的需要：<br />*&nbsp;最大连接数为 600，以满足一般应用对连接数的需要：增加 max_connections = 600。根据我们的经验，500～1000 是较为合适的数值，没必要将其设置为超过 1000，那只会造成对资源的浪费。<br />*&nbsp;不使用 innodb 和 bdb：增加两行内容，分别是 skip-innodb 和 skip-bdb。Discuz! 和大部分 web 应用程序不需要使用此两项功能，因此将其关闭以节约内存和磁盘空间，提高效率。<br />*&nbsp;连接超时时间 5，避免空闲进程过多的内存占用：增加 wait_timeout = 5。通过减少超时时间，使得使用 pconnect（长期连接）的用户在利用其不需反复验证用户名和密码的同时，避免打开过多的空闲进程，减少内存消耗。<br />*&nbsp;禁止端口连接：增加 skip-networking。如果使用 Unix 类操作系统，数据库和 httpd 在同一台服务器，且不需要远程读取数据库，可增设此项参数，关闭默认的 3306 端口，有效提禁止外部网络未经授权的访问，避免端口被用以进行 DDoS 攻击。Windows 系统不需要（不能）增加这个参数。<br />其他参数的配置在此不详述，如果您对服务器及 MySQL 数据库有相当的了解，可以通过数据库的日常运行情况，有针对性的进行修改。<br /><br /><strong>数据表优化（Optimize Table）</strong><br /><br />当数据库中删除了大量的数据后，可能会发现数据文件尺寸并没有减小。这是因为删除操作后在数据文件中留下碎片所致。Discuz! 在系统数设置界面提供了数据表优化的功能，可以去除删除操作后留下的数据文件碎片，减小文件尺寸，加快未来的读写操作。您只要在做完批量删除，或定期（如每一两个月）进行一次数据表优化操作即可。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.gaobo.info/go.php/tags/discuz/" rel="tag">discuz</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2580%25A7%25E8%2583%25BD/" rel="tag">性能</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25BC%2598%25E5%258C%2596/" rel="tag">优化</a> , <a href="http://www.gaobo.info/go.php/tags/tip/" rel="tag">tip</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%258A%2580%25E5%25B7%25A7/" rel="tag">技巧</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593/" rel="tag">数据库</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/527.htm</link>
<title><![CDATA[PHP 5.3要发布了]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 06 Aug 2008 13:41:02 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/527.htm</guid> 
<description>
<![CDATA[ 
	前几天就得知PHP发布了5.3 Alpha，刚刚去php.net看了下新版本的介绍，发现果然多了一些新东东，呵呵。<br /><br /><li><a href="http://php.net/language.namespaces"><span style="color: #000099">Namespaces</span></a> (documentation maybe out dated)</li><p><strong>这就是传说中的&ldquo;命名空间&rdquo;啦，^_^</strong></p><li><a href="http://php.net/oop5.late-static-bindings"><span style="color: #000099">Late static binding</span></a> and <a href="http://php.net/language.oop5.overloading"><span style="color: #000099">__callStatic</span></a> </li><p><strong>支持&ldquo;晚（静态）绑定&rdquo;了</strong></p><li><a href="http://wiki.php.net/rfc/closures"><span style="color: #000099">Lambda functions and closures</span></a> </li><p><strong>支持&lambda;函数和闭包运算</strong></p><li>Addition of the <a href="http://php.net/book.intl"><span style="color: #000099">intl</span></a>, <a href="http://php.net/book.phar"><span style="color: #000099">phar</span></a> (phar is scheduled for some more work a head of alpha2), <a href="http://php.net/book.fileinfo"><span style="color: #000099">fileinfo </span></a>and <a href="http://php.net/book.sqlite3"><span style="color: #000099">sqlite3</span></a> extensions </li><p><strong>支持intl、phar、fileinfo和sqlite3等扩展</strong></p><li>Optional cyclic garbage collection </li><p><strong>可选的循环垃圾收集器</strong></p><li>Optional support for the <a href="http://forge.mysql.com/wiki/PHP_MYSQLND"><span style="color: #000099">MySQLnd</span></a> replacement driver for libmysql </li><p><strong>可选的替代libmysql的MySQLnd支持</strong></p><li>Windows older than Windows 2000 (Windows 98, NT4, etc.) are not supported anymore (<a href="http://wiki.php.net/internals/windows/releasenotes"><span style="color: #000099">details</span></a>) </li><p><strong>不再支持Win2000以前的系统（Windows 98, NT4等等）</strong></p><li>New syntax features like <a href="http://php.net/language.types.string#language.types.string.syntax.nowdoc"><span style="color: #000099">NOWDOC</span></a>, limited GOTO, ternary short cut &quot;?:&quot;</li><p><strong>支持新的语法特性如&ldquo;NOWDOC&rdquo;等，限制了&ldquo;GOTO&rdquo;和三元运算符&ldquo;?:&rdquo;等</strong><br /><br />在我看来，此次版本步进，最大的意义在于上边的&ldquo;命名空间&rdquo;、&ldquo;晚（静态）绑定&rdquo;和MySQLnd，&ldquo;命名空间&rdquo;的呼声很高，早就应该加进去了；&ldquo;晚（静态）绑定&rdquo;现在还没看到实际东西，暂不做评论；至于MySQLnd，这个是MySQL官方出品的&ldquo;Native driver for PHP&rdquo;，针对这句话，<a href="http://forge.mysql.com/wiki/PHP_MYSQLND">官方是这么解释的</a>：<br /></p><li>&ldquo;native&rdquo;: This doesn&rsquo;t mean &ldquo;written in PHP&rdquo;; that would be too slow. PHP itself is a program written in C. Therefore &ldquo;native&rdquo; means this driver is written in C and tightly integrated into PHP at the C level. This allows the driver to achieve maximum performance (just like libmysql). </li><p><strong>这意味着不是&ldquo;以PHP编写&rdquo;，因为那样速度很慢。PHP本身是用C语言编写的，因此&ldquo;native&rdquo;意味着这个数据库驱动也是以C语言编写并在C语言级别上与PHP紧密集成。这使得驱动能够发挥最大的效能（类似libmysql）。</strong></p><li>&ldquo;driver&rdquo;: This is not a new programming API or PHP extension; there are already three APIs (ext/mysql, ext/mysqli, PDO/MySQL) and three extensions, so there is no need for more. Rather, mysqlnd is a library that implements the MySQL low-level communication protocol. This library can be used by the existing extensions. Currently ext/mysql and ext/mysqli have been modified so they can optionally use mysqlnd instead of libmysql, and PDO/MySQL will be modified later. </li><p>这不是一个新的API或PHP扩展，已经有三套API（ext/mysql、ext/mysqli、PDO/MySQL）和三套扩展所以不必开发更多的。而MySQLnd更像是一个实现了与MySQL底层通讯协议的库，可以被已经存在的扩展使用。现在ext/mysql和ext/mysqli已经过修改可以选择使用MySQLnd来代替libmysql，PDO/MySQL随后也将做修改。</p><li>&ldquo;for PHP&rdquo;: This is nothing new in the sense that libmysql is also for PHP. But mysqlnd is published under the terms of the PHP license whereas libmysql was not. Therefore, unlike with libmysql, there is no need for the FLOSS License Exception to make the license compatible with that of PHP. Those who recall the (partly heated) discussions about the exception might be especially happy to hear about this.</li><p>与libmysql for PHP而言，这没什么变化，但MySQLnd基于PHP License发布而libmysql不是。因此，不再需要FLOSS License以使其兼容，对于提出这项内容的人而言是一个好消息。<br /><br />期待PHP 5.3 Stable的发布！</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%259E%2583%25E5%259C%25BE%25E6%2594%25B6%25E9%259B%2586%25E5%2599%25A8/" rel="tag">垃圾收集器</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2591%25BD%25E5%2590%258D%25E7%25A9%25BA%25E9%2597%25B4/" rel="tag">命名空间</a> , <a href="http://www.gaobo.info/go.php/tags/namespace/" rel="tag">namespace</a> , <a href="http://www.gaobo.info/go.php/tags/gabage/" rel="tag">gabage</a> , <a href="http://www.gaobo.info/go.php/tags/collector/" rel="tag">collector</a> , <a href="http://www.gaobo.info/go.php/tags/mysqlnd/" rel="tag">mysqlnd</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2599%259A%25E7%25BB%2591%25E5%25AE%259A/" rel="tag">晚绑定</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/521.htm</link>
<title><![CDATA[Subversion的属性功能]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 23 Jul 2008 05:26:50 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/521.htm</guid> 
<description>
<![CDATA[ 
	Subversion的属性是非常好用的功能,它将一些工作自动化，实现为受版本控制的源文件添加元信息的作用。属性是外部不可见的，可以简单认为是附加上在文件上的信息，和文件大小之类的信息是一样的，只不过他是通过subversion来管理的。属性的名称和值可以是你希望的任何值，限制就是名称必须是可读的文本，并且最好的一点是这些属性也是版本化的，就像你的文本文件内容，你可以像提交文本修改一样修改、提交和恢复属性修改，当你更新时也会接收到别人的属性修改—你不必为适应属性改变你的工作流程。<br/>Subversion保留了一组名称以svn:开头的属性，来预定义一些有用的功能。比如你常会看到一些人的源代码底部有像下面之类标识的文字：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">$Id: main_window.py 68 2008-06-30 02:05:05Z Len $</div></div><br/>这就使用了Subversion 中的 svn:keywords的自动属性，它让将发生在源代码中的一些属性的变化自动地更新到源代码中。这行字的意思是表示，main_windows.py 这个源代码文件最后被用户 len 更新于 2008-6-30 02:05:05Z，修订版本号为 68。要实现这样的自动更新，你只要对需要这样属性的文件上使用下面这行指令。 <br/><div class="code">&gt; svn propset svn:keywords &quot;Id&quot; main_window.py</div><br/>或者使用TortoiseSVN中的Properties的操作按钮，方便地增加新的属性。接着需要在源代码文件中需要 Subversion 进行自动更新的地方插入 $Id$ 这样的 Keyword，那么在你下次进行提交更新时，该$Id$ 就会被 Subversion 自动替换为$Id: main_window.py 68 2008-06-30 02:05:05Z Len $ 这样的格式。 <br/>Subversion 中可以使用的Keyword 包括下面这些：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">Id <br/>上面介绍过的综合的格式 <br/>LastChangedDate <br/>最后被修改的时间，缩写为 Date。 <br/>LastChangedBy <br/>最后修改该源代码文件的用户名，缩写为 Author。 <br/>LastChangedRevision <br/>最后修订的版本号，缩写为 Revision。</div></div><br/>如果想每次向Subversion服务器提交文件修改时，都要设置文件的属性，则需要进行Subversion配置的修改。配置文件在你用户的主目录下，在Windows下应类似于C:&#92;Documents and Settings&#92;Len&#92;Application Data&#92;Subversion&#92;config文件，Len是Windows用户名，注意Application Data是隐藏文件夹，需要显示全部文件才能看到。接着如下相应的修改，对你想要处理的文件做配置。<br/><div class="code">enable-auto-props = yes&nbsp;&nbsp; <br/>&#91;auto-props&#93;&nbsp;&nbsp; <br/>*.c = svn:keywords=Id&nbsp;&nbsp; <br/>*.py = svn:keywords=Id</div><br/>对于开源项目，常见其源文件头部有着版权声明的文本，这些操作大多也是通Subversion的属性功能来完成的，有关更详细的介绍和操作指南，可参见<a href="http://www.subversion.org.cn/svnbook/1.4/index.html" target="_blank">Subversion中文手册</a>中的<a href="http://www.subversion.org.cn/svnbook/1.4/svn.advanced.props.html" target="_blank">属性</a>章节。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/subversion/" rel="tag">subversion</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25B1%259E%25E6%2580%25A7/" rel="tag">属性</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%2589%2588%25E6%259D%2583/" rel="tag">版权</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/522.htm</link>
<title><![CDATA[MetaWeblog API中文说明]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 23 Jul 2008 01:49:11 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/522.htm</guid> 
<description>
<![CDATA[ 
	<strong>1、什么是MetaWeblog？</strong> <br />MetaWebBlog API（MWA）是一个Blog程序接口标准，允许外部程序来获取或者设置Blog的文字和熟悉。他建立在XMLRPC接口之上，并且已经有了很多的实现。<br /><strong>2、基本的函数规范</strong> <br />有三个基本的函数规范： <br />metaWeblog.newPost (blogid, username, password, struct, publish) 返回一个字符串，可能是Blog的ID。 <br />metaWeblog.editPost (postid, username, password, struct, publish) 返回一个Boolean值，代表是否修改成功。 <br />metaWeblog.getPost (postid, username, password) 返回一个Struct。 <br />其中blogid、username、password分别代表Blog的id（注释：如果你有两个Blog，blogid指定你需要编辑的blog）、用户名和密码。 <br />struct的含意： <br />在newPost和editPost中，struct是一个RSS 2.0规范中里面的定义。的定义如下： <br />元素 说明 例子 <br />title The title of the item. Venice Film Festival Tries to Quit Sinking <br />link The URL of the item. <a href="http://nytimes.com/2004/12/07FEST.html" target="_blank">http://nytimes.com/2004/12/07FEST.html</a> <br />description The item synopsis. Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged. <br />author Email address of the author of the item <br />category Includes the item in one or more categories <br />comments URL of a page for comments relating to the item <br />enclosure Describes a media object that is attached to the item <br />guid A string that uniquely identifies the item. <br />pubDate Indicates when the item was published. <br />source The RSS channel that the item came from. <br />其中最主要的三个元素是title、link和description。如果Blog工具不支持title和link，description就是目录（Content）。category是一个数组，是这个Post所属的类别。如果类别不存在，服务器端将只处理存在的类别。 <br />3、<strong>metaWeblog.newMediaObject </strong><br />metaWeblog.newMediaObject (blogid, username, password, struct) 返回一个数组 <br />其中blogid、username、password分别代表Blog的id（注释：如果你有两个Blog，blogid指定你需要编辑的blog）、用户名和密码。struct必须包含name, type 和bits三个元素，当然也可以包含其他元素。 <br />name代表数据的名称，type是数据的MIME类型，譬如audio/mpeg 、image/jpeg和video/quicktime。bits是数据的base64编码形式的数据流。 <br />如果调用失败，它显示错误信息。如果调用成功，返回值是一个Struct，里面至少包含一个Url元素，代表数据的HTTP或者FTP Url。 <br />4、<strong>metaWeblog.getCategories</strong> <br />metaWeblog.getCategories (blogid, username, password) 返回一个struct。 <br />返回值包含所有的Blog的类别，每一个列别包含description, htmlUrl and rssUrl。 <br /><strong>5、metaWeblog.getRecentPosts</strong> <br />metaWeblog.getRecentPosts (blogid, username, password, numberOfPosts) 返回一个结构（struct）的数组（array）。 <br />每一个Struct包含getPost返回值一样的结构。 <br />numberOfPosts是返回的数量。 <br /><strong>6、调用验证和错误显示</strong> <br />同Blogger API不同的是，metaWeblog没有APPKEY这个概念，你可以自己设置。 <br />同时建议使用标准的XMLRPC Fault来显示错误。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/meta/" rel="tag">meta</a> , <a href="http://www.gaobo.info/go.php/tags/weblog/" rel="tag">weblog</a> , <a href="http://www.gaobo.info/go.php/tags/api/" rel="tag">api</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2587%25BD%25E6%2595%25B0/" rel="tag">函数</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25A7%2584%25E8%258C%2583/" rel="tag">规范</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25AF%25B4%25E6%2598%258E/" rel="tag">说明</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25BB%258B%25E7%25BB%258D/" rel="tag">介绍</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/519.htm</link>
<title><![CDATA[PHP模拟POST行为代码总结]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sun, 20 Jul 2008 07:48:54 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/519.htm</guid> 
<description>
<![CDATA[ 
	GET行为比较简单，POST比较复杂一些。这里提供两种方法供选择：<br/><br/>第一：手写代码<br/>第二：利用HttpClient php类库<br/><br/>第一种方法：代码如下：<br/><div class="code">&lt;?PHP&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$flag = 0;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;//要post的数据&nbsp;&nbsp;&nbsp;&nbsp; <br/>$argv = array(&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp; &#039;var1&#039;=&gt;&#039;abc&#039;,&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; &#039;var2&#039;=&gt;&#039;你好吗&#039;);&nbsp;&nbsp;&nbsp;&nbsp; <br/>//构造要post的字符串&nbsp;&nbsp;&nbsp;&nbsp; <br/>foreach ($argv as $key=&gt;$value) &#123;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; if ($flag!=0) &#123;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $params .= &quot;&amp;&quot;;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $flag = 1;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; &#125;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; $params.= $key.&quot;=&quot;; $params.= urlencode($value);&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; $flag = 1;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; &#125;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; $length = strlen($params);&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //创建socket连接&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; $fp = fsockopen(&quot;127.0.0.1&quot;,80,$errno,$errstr,10) or exit($errstr.&quot;---&gt;&quot;.$errno);&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; //构造post请求的头&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; $header = &quot;POST /mobile/try.php HTTP/1.1&quot;;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; $header .= &quot;Host:127.0.0.1&quot;;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; $header .= &quot;Referer:/mobile/sendpost.php&quot;;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; $header .= &quot;Content-Type: application/x-www-form-urlencoded&quot;;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; $header .= &quot;Content-Length: &quot;.$length.&quot;&quot;;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; $header .= &quot;Connection: Close&quot;;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp; //添加post的字符串&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; $header .= $params.&quot;&quot;;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; //发送post的数据&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; fputs($fp,$header);&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; $inheader = 1;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; while (!feof($fp)) &#123;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $line = fgets($fp,1024); //去除请求包的头只显示页面的返回数据&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($inheader &amp;&amp; ($line == &quot;&#92;n&quot; &#124;&#124; $line == &quot;&quot;)) &#123;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $inheader = 0;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#125;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($inheader == 0) &#123;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo $line;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#125;&nbsp;&nbsp;&nbsp;&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; &#125;&nbsp;&nbsp;&nbsp;&nbsp; <br/>fclose($fp);&nbsp;&nbsp;&nbsp;&nbsp; <br/>?&gt;</div><br/>第二种方法是：使用httpclient类，代码如下：<br/><div class="code">$pageContents = HttpClient::quickPost(&#039;http://example.com/someForm&#039;, array(&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#039;name&#039; =&gt; &#039;Some Name&#039;,&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#039;email&#039; =&gt; &#039;email@example.com&#039;&nbsp;&nbsp; <br/>));</div><br/>使用附件的类库，也可以去官方下载最新的类库，官方地址为：<a href="http://scripts.incutio.com/httpclient/index.php" target="_blank">http://scripts.incutio.com/httpclient/index.php</a><br/>附加一些php httpclient的其他几个用法<br/><br/>静态方法获取网页<br/><div class="code">$pageContents = HttpClient::quickGet(&#039;http://example.com/&#039;);</div><br/>Get方法获取<br/><div class="code">$client = new HttpClient(&#039;example.com&#039;);&nbsp;&nbsp;&nbsp;&nbsp;<br/>if (!$client-&gt;get(&#039;/&#039;)) &#123;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;die(&#039;An error occurred: &#039;.$client-&gt;getError());&nbsp;&nbsp;&nbsp;&nbsp;<br/>&#125;&nbsp;&nbsp;&nbsp;&nbsp;<br/>$pageContents = $client-&gt;getContent();</div><br/>带调试的Get方法获取<br/><div class="code">$client = new HttpClient(&#039;example.com&#039;);&nbsp;&nbsp;&nbsp;&nbsp;<br/>$client-&gt;setDebug(true);&nbsp;&nbsp;&nbsp;&nbsp;<br/>if (!$client-&gt;get(&#039;/&#039;)) &#123;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;die(&#039;An error occurred: &#039;.$client-&gt;getError());&nbsp;&nbsp;&nbsp;&nbsp;<br/>&#125;&nbsp;&nbsp;&nbsp;&nbsp;<br/>$pageContents = $client-&gt;getContent();</div><br/>带自动转向的Get方法<br/><div class="code">$client = new HttpClient(&#039;www.amazon.com&#039;);&nbsp;&nbsp;&nbsp;&nbsp;<br/>$client-&gt;setDebug(true);&nbsp;&nbsp;&nbsp;&nbsp;<br/>if (!$client-&gt;get(&#039;/&#039;)) &#123;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;die(&#039;An error occurred: &#039;.$client-&gt;getError());&nbsp;&nbsp;&nbsp;&nbsp;<br/>&#125;&nbsp;&nbsp;&nbsp;&nbsp;<br/>$pageContents = $client-&gt;getContent();</div><br/>检查页面是否存在<br/><div class="code">$client = new HttpClient(&#039;example.com&#039;);&nbsp;&nbsp;&nbsp;&nbsp;<br/>$client-&gt;setDebug(true);&nbsp;&nbsp;&nbsp;&nbsp;<br/>if (!$client-&gt;get(&#039;/thispagedoesnotexist&#039;)) &#123;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;die(&#039;An error occurred: &#039;.$client-&gt;getError());&nbsp;&nbsp;&nbsp;&nbsp;<br/>&#125;&nbsp;&nbsp;&nbsp;&nbsp;<br/>if ($client-&gt;getStatus() == &#039;404&#039;) &#123;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;echo &#039;Page does not exist!&#039;;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&#125;&nbsp;&nbsp;&nbsp;&nbsp;<br/>$pageContents = $client-&gt;getContent();</div><br/>伪造客户端<br/><div class="code">$client = new HttpClient(&#039;example.com&#039;);&nbsp;&nbsp;&nbsp;&nbsp;<br/>$client-&gt;setDebug(true);&nbsp;&nbsp;&nbsp;&nbsp;<br/>$client-&gt;setUserAgent(&#039;Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3a) Gecko/20021207&#039;);&nbsp;&nbsp;&nbsp;&nbsp;<br/>if (!$client-&gt;get(&#039;/&#039;)) &#123;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;die(&#039;An error occurred: &#039;.$client-&gt;getError());&nbsp;&nbsp;&nbsp;&nbsp;<br/>&#125;&nbsp;&nbsp;&nbsp;&nbsp;<br/>$pageContents = $client-&gt;getContent();</div><br/>登录验证并请求一个网页<br/><div class="code">$client = new HttpClient(&#039;example.com&#039;);&nbsp;&nbsp;&nbsp;&nbsp;<br/>$client-&gt;post(&#039;/login.php&#039;, array(&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#039;username&#039; =&gt; &#039;Simon&#039;,&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#039;password&#039; =&gt; &#039;ducks&#039;&nbsp;&nbsp; <br/>));&nbsp;&nbsp;&nbsp;&nbsp;<br/>if (!$client-&gt;get(&#039;/private.php&#039;)) &#123;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;die(&#039;An error occurred: &#039;.$client-&gt;getError());&nbsp;&nbsp;&nbsp;&nbsp;<br/>&#125;&nbsp;&nbsp;&nbsp;&nbsp;<br/>$pageContents = $client-&gt;getContent();</div><br/>HTTP授权<br/><div class="code">$client = new HttpClient(&#039;example.com&#039;);&nbsp;&nbsp;&nbsp;&nbsp;<br/>$client-&gt;setAuthorization(&#039;Username&#039;, &#039;Password&#039;);&nbsp;&nbsp;&nbsp;&nbsp;<br/>if (!$client-&gt;get(&#039;/&#039;)) &#123;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;die(&#039;An error occurred: &#039;.$client-&gt;getError());&nbsp;&nbsp;&nbsp;&nbsp;<br/>&#125;&nbsp;&nbsp;&nbsp;&nbsp;<br/>$pageContents = $client-&gt;getContent();</div><br/>输出头信息<br/><div class="code">$client = new HttpClient(&#039;example.com&#039;);&nbsp;&nbsp;&nbsp;&nbsp;<br/>if (!$client-&gt;get(&#039;/&#039;)) &#123;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;die(&#039;An error occurred: &#039;.$client-&gt;getError());&nbsp;&nbsp;&nbsp;&nbsp;<br/>&#125;&nbsp;&nbsp;&nbsp;&nbsp;<br/>print_r($client-&gt;getHeaders());</div><br/>设置一个域内重定向最多次数<br/><div class="code">$client = new HttpClient(&#039;www.amazon.com&#039;);&nbsp;&nbsp;&nbsp;&nbsp;<br/>$client-&gt;setDebug(true);&nbsp;&nbsp;&nbsp;&nbsp;<br/>$client-&gt;setMaxRedirects(3);&nbsp;&nbsp;&nbsp;&nbsp;<br/>$client-&gt;get(&#039;/&#039;);</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/http/" rel="tag">http</a> , <a href="http://www.gaobo.info/go.php/tags/client/" rel="tag">client</a> , <a href="http://www.gaobo.info/go.php/tags/post/" rel="tag">post</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AF/" rel="tag">客户端</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25BB%25A3%25E7%25A0%2581/" rel="tag">代码</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/515.htm</link>
<title><![CDATA[5个有趣的浏览器地址栏JavaScript代码]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 18 Jul 2008 12:20:01 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/515.htm</guid> 
<description>
<![CDATA[ 
	这篇分享几个在地址栏实现的Javascript有趣效果和应用。能在浏览器地址栏实现的效果太多了，字体放大、显示所有图片、显示Cookie等等。<br/>1、编辑网页<br/>在地址栏输入下面的代码按enter，网页上所有元素都能变成可编辑状态，你可以移动、调整元素大小。如果你只是讨厌某个网站想发泄一下，我建议你使用NetDisater。<br/>代码如下：<br/><div class="code">javascript:document.body.contentEditable=&#039;true&#039;; document.designMode=&#039;on&#039;; void 0</div><br/><br/>2、无敌风火轮<br/>在地址栏运行下面的代码可使页面上所有图片元素一个接一个地转圈。<br/>改变代码里的“img”成任何网页上有的字符，可以使这些字符做无敌风火轮运动。<br/>代码如下：<br/><div class="code">javascript:R=0; x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300; y5=200; DI=document.getElementsByTagName(&quot;img&quot;); DIL=DI.length; function A()&#123;for(i=0; i-DIL; i++)&#123;DIS=DI&#91; i &#93;.style; DIS.position=&#039;absolute&#039;; DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+&quot;px&quot;; DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+&quot;px&quot;&#125;R++&#125;setInterval(&#039;A()&#039;,5); void(0);</div><br/><br/>3、晃来晃去<br/>不但是你，浏览器也不是那么喜欢这个javascript。在地址栏运行这个代码后，浏览器会迅速地晃来晃去。<br/>代码如下：<br/><div class="code">javascript:function flood(n) &#123;if (self.moveBy) &#123;for (i = 200; i &amp;gt; 0;i--)&#123;for (j = n; j &amp;gt; 0; j--) &#123;self.moveBy(1,i); self.moveBy(i,0);self.moveBy(0,-i); self.moveBy(-i,0); &#125; &#125; &#125;&#125;flood(6);&#123; var inp = &quot;D-X !msagro na dah tsuj resworb rouY&quot;; var outp = &quot;&quot;; for (i = 0; i &amp;lt;= inp.length; i++) &#123;outp =inp.charAt (i) + outp ; &#125; alert(outp) ;&#125;; reverse</div><br/>如果这个代码无效，请将"&gt;"改成">"，"&It;'改成"<"。<br/><br/>4、计算器<br/>在地址栏输入下面的代码，可以实现简单的四则运算：<br/><div class="code">javascript: alert(34343+3434-222);</div><br/>事实上这个代码可以继续简化，比如简化成这样：<br/><div class="code">javascript: 34343+3434-222</div><br/><br/>5、防钓鱼验证<br/>某些钓鱼网站提供的URL和网页本身的URL是不一致的，你可以用下面的代码进行验证，当两个URL相差太大的时候，你就要稍加小心了：<br/><div class="code">javascript:alert(&quot;The actual URL is:tt&quot; + location.protocol + &quot;//&quot; + location.hostname + &quot;/&quot; + &quot;nThe address URL is:tt&quot; + location.href + &quot;n&quot; + &quot;nIf the server names do not match, this may be a spoof.&quot;);</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/javascript/" rel="tag">javascript</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25B5%258F%25E8%25A7%2588%25E5%2599%25A8/" rel="tag">浏览器</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%259C%25B0%25E5%259D%2580%25E6%25A0%258F/" rel="tag">地址栏</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25BB%25A3%25E7%25A0%2581/" rel="tag">代码</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/509.htm</link>
<title><![CDATA[用PHP5 SOAP遇到的一个问题]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 23 Apr 2008 02:49:23 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/509.htm</guid> 
<description>
<![CDATA[ 
	之前用PHP5的SOAP扩展写过一些东西，感觉还是很好用的。写Server的时候可以选择使用或不使用WSDL模式。但是昨天在写一个应用的时候却死活不能得到想要的结果，郁闷的发慌了…………<br/>Server：<br/><div class="code">&lt;?php<br/>class....<br/><br/>$fluxinterface = new SoapServer(null, array(&#039;uri&#039; =&gt; &quot;....&quot;, &#039;encoding&#039;=&gt;&#039;UTF-8&#039;));<br/>$fluxinterface-&gt;setClass(&quot;....&quot;);<br/>$fluxinterface-&gt;handle();<br/>?&gt;</div><br/><br/>Client：<br/><div class="code">&lt;?php<br/>$client = new SoapClient(null, array(&#039;location&#039; =&gt;&quot;....&quot;, &#039;uri&#039; =&gt; &#039;....&#039;, &#039;encoding&#039; =&gt; &#039;UTF-8&#039;));<br/>$param = array(&#039;path&#039; =&gt; $dir);<br/>$result = $client-&gt;__soapCall(&#039;GetDIRInfo&#039;, &#039;parameters&#039; =&gt; $param);<br/>?&gt;</div><br/>在Server那边测试直接new一个对象，调用方法，返回的很正常，但是在Client这边无论如何都得不到预期的值……<br/>翻遍手册找不到相关资料，搜索也一直没有找到解决办法，最后尝试把Client的代码最后一句换成这样：<br/><div class="code">$result = $client-&gt;__soapCall(&#039;GetDIRInfo&#039;, $param);</div><br/>结果出乎意料，行了！<br/>可是以前一直是以上面开始那种方式写的，是可以的，真是咄咄怪事……………………<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/soap/" rel="tag">soap</a> , <a href="http://www.gaobo.info/go.php/tags/server/" rel="tag">server</a> , <a href="http://www.gaobo.info/go.php/tags/client/" rel="tag">client</a> , <a href="http://www.gaobo.info/go.php/tags/wsdl/" rel="tag">wsdl</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/504.htm</link>
<title><![CDATA[PHP5连接MSSQL 2005的方法]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 03 Apr 2008 09:07:23 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/504.htm</guid> 
<description>
<![CDATA[ 
	<p>一个Case需要使用PHP5连接MS SQL Server 2005，找了些资料自己琢磨了下，搞定了，呵呵<br /><br />环境：<br />- Apache 2.2.6<br />- PHP 5.2.5<br />- SQL Server 2005<br />- Windows XP SP2<br /></p><p><br />步骤：</p><p>1. 首先按通常做法配置好PHP5连接MS SQL Server<br />2. 下载正确版本的 ntwdblib.dll (2000.80.194.0)，地址： <a href="http://webzila.com/dll/1/ntwdblib.zip"><a href="http://webzila.com/dll/1/ntwdblib.zip" target="_blank">http://webzila.com/dll/1/ntwdblib.zip</a></a><br />3. 覆盖 apache2.2.6&#92;bin&#92;ntwdblib.dll<br />4. 覆盖 php5.2.5&#92;ntwdblib.dll<br />5. 运行 SQL Server 配置管理器：SQL Server Configuration Manager，打开协议 Protocols<br />6. 允许命名管道 &quot;named pipes&quot; 和 &quot;tcp/ip&quot;<br />7. 右键点击 &quot;tcp/ip&quot;，打开属性 Properties 标签 &quot;IP addresses&quot;<br />8. 在 TCP 动态端口 &quot;TCP Dynamic Ports&quot; 填入 1433<br />9. 重启 SQL Server、Apache和PHP<br /><br />使用以下方式连接MS SQL Server 2005：<br />mssql_connect('localhost,1433', USERNAME, PASSWORD);</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/mssql/" rel="tag">mssql</a> , <a href="http://www.gaobo.info/go.php/tags/microsoft/" rel="tag">microsoft</a> , <a href="http://www.gaobo.info/go.php/tags/sql/" rel="tag">sql</a> , <a href="http://www.gaobo.info/go.php/tags/server/" rel="tag">server</a> , <a href="http://www.gaobo.info/go.php/tags/2005/" rel="tag">2005</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/498.htm</link>
<title><![CDATA[在Zend Studio for Eclipse 6中自动换行]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 26 Mar 2008 05:05:32 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/498.htm</guid> 
<description>
<![CDATA[ 
	Zend Studio for Eclipse 6用了有些日子了，发现这么牛×的IDE居然没有自动换行，找遍了设置都找不到，今天终于让我想到了一个替代办法：<br/>1、打开ZS6，Help菜单—Software Updates—Find and Install，如图：<br/><a href="http://www.gaobo.info/attachment.php?fid=15" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=15" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>2、选择第二项，下一步：<br/><a href="http://www.gaobo.info/attachment.php?fid=16" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=16" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>3、点击“New Remote Site”，在弹出的对话框中按下图填写：<br/>URL：<a href="http://ahtik.com/eclipse-update" target="_blank">http://ahtik.com/eclipse-update</a><br/><a href="http://www.gaobo.info/attachment.php?fid=17" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=17" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>4、OK后下一步，等待片刻后选择对话框中的“WordWrap”，下一步：<br/><a href="http://www.gaobo.info/attachment.php?fid=18" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=18" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>5、当然是接受License啦，不接受没法用了，呵呵：<br/><a href="http://www.gaobo.info/attachment.php?fid=19" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=19" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>6、确认要装的扩展，继续下一步：<br/><a href="http://www.gaobo.info/attachment.php?fid=20" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=20" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>7、点击“Install”或“Install All”都可以，反正只有一项：<br/><a href="http://www.gaobo.info/attachment.php?fid=21" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=21" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>8、使用的时候，在代码上点右键，点击“Virtual Word Wrap”即可，如图：<br/><a href="http://www.gaobo.info/attachment.php?fid=22" target="_blank"><img src="http://www.gaobo.info/attachment.php?fid=22" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>从此，整个代码清净了……<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/zend/" rel="tag">zend</a> , <a href="http://www.gaobo.info/go.php/tags/studio/" rel="tag">studio</a> , <a href="http://www.gaobo.info/go.php/tags/eclipse/" rel="tag">eclipse</a> , <a href="http://www.gaobo.info/go.php/tags/word/" rel="tag">word</a> , <a href="http://www.gaobo.info/go.php/tags/wrap/" rel="tag">wrap</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%2587%25AA%25E5%258A%25A8%25E6%258D%25A2%25E8%25A1%258C/" rel="tag">自动换行</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/495.htm</link>
<title><![CDATA[简单的CSS图片自适应]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Tue, 11 Mar 2008 07:33:30 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/495.htm</guid> 
<description>
<![CDATA[ 
	适应宽度为600像素，所有图片大于600px就按比例缩小为600px，小于则不适应。<br/><div class="code"><br/>img&#123;<br/>&nbsp;&nbsp;max-width:600px;<br/>&nbsp;&nbsp;width:expression(width&gt;600?&quot;600px&quot;:width);<br/>&#125;<br/></div><br/>expression 不是符合WEB标准的做法，不到万不得以不建议使用。但是不能不承认IE的很多扩展是不错的，IE不应该被轻视！<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/css/" rel="tag">css</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%259B%25BE%25E7%2589%2587/" rel="tag">图片</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%2587%25AA%25E9%2580%2582%25E5%25BA%2594/" rel="tag">自适应</a> , <a href="http://www.gaobo.info/go.php/tags/web/" rel="tag">web</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/494.htm</link>
<title><![CDATA[网站重构的流程]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 07 Mar 2008 07:13:00 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/494.htm</guid> 
<description>
<![CDATA[ 
	网站重构的流程是先写 DIV 还是先写 CSS ，一种观点是：<br />先结构，后表现，再行为。通俗点就是先 HTML 构架，再 CSS 渲染，最后写入 Javascript。<br />在<a href="http://www.ajaxian.com/" target="_blank"> Ajaxian </a>上看到的一个Gif 动画正好简单阐述了网站从结构到表现的过程。<br /><img class="insertimage" src="attachment.php?fid=14" border="0" width="512" height="384" /><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/%25E7%25BD%2591%25E7%25AB%2599/" rel="tag">网站</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%2587%258D%25E6%259E%2584/" rel="tag">重构</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25B5%2581%25E7%25A8%258B/" rel="tag">流程</a> , <a href="http://www.gaobo.info/go.php/tags/div/" rel="tag">div</a> , <a href="http://www.gaobo.info/go.php/tags/css/" rel="tag">css</a> , <a href="http://www.gaobo.info/go.php/tags/html/" rel="tag">html</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/490.htm</link>
<title><![CDATA[简单的javascript判断浏览器]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sat, 01 Mar 2008 13:58:00 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/490.htm</guid> 
<description>
<![CDATA[ 
	以下JS代码能够简洁的实现对操作系统的判断<br/><div class="code"><br/>var Client = &#123;<br/>&nbsp;&nbsp;Engine: &#123;&#039;name&#039;: &#039;unknown&#039;, &#039;version&#039;: &#039;&#039;&#125;,<br/>&nbsp;&nbsp;Features: &#123;&#125;<br/>&#125;;<br/><br/>Client.Features.xhr = !!(window.XMLHttpRequest);<br/>Client.Features.xpath = !!(document.evaluate);<br/><br/>if (window.opera) Client.Engine.name = &#039;opera&#039;;<br/>else if (window.ActiveXObject) Client.Engine = &#123;&#039;name&#039;: &#039;ie&#039;, &#039;version&#039;: (Client.Features.xhr) ? 7 : 6&#125;;<br/>else if (!navigator.taintEnabled) Client.Engine = &#123;&#039;name&#039;: &#039;webkit&#039;, &#039;version&#039;: (Client.Features.xpath) ? 420 : 419&#125;;<br/>else if (document.getBoxObjectFor != null) Client.Engine.name = &#039;gecko&#039;;<br/>Client.Engine&#91;Client.Engine.name&#93; = Client.Engine&#91;Client.Engine.name + Client.Engine.version&#93; = true;<br/></div><br/>可能的结果<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>Client.Engine.ie = true; //IE浏览器，版本不限<br/>Client.Engine.ie6 = true; //IE 6<br/>Client.Engine.ie7 = true; //IE 7<br/>Client.Engine.opera = true; //opera<br/>Client.Engine.gecko = true; //Mozilla/Gecko(包括firefox)<br/>Client.Engine.webkit = true; //Safari<br/>Client.Engine.webkit419 = true; //Safari2<br/>Client.Engine.webkit420 = true; //Safari3<br/></div></div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/javascript/" rel="tag">javascript</a> , <a href="http://www.gaobo.info/go.php/tags/js/" rel="tag">js</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25BB%25A3%25E7%25A0%2581/" rel="tag">代码</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25B5%258F%25E8%25A7%2588%25E5%2599%25A8/" rel="tag">浏览器</a> , <a href="http://www.gaobo.info/go.php/tags/ie/" rel="tag">ie</a> , <a href="http://www.gaobo.info/go.php/tags/firefox/" rel="tag">firefox</a> , <a href="http://www.gaobo.info/go.php/tags/opera/" rel="tag">opera</a> , <a href="http://www.gaobo.info/go.php/tags/safari/" rel="tag">safari</a> , <a href="http://www.gaobo.info/go.php/tags/mozilla/" rel="tag">mozilla</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/489.htm</link>
<title><![CDATA[PHP开源AJAX框架]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sat, 01 Mar 2008 12:07:17 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/489.htm</guid> 
<description>
<![CDATA[ 
	<p><strong><span style="color: #ff6600">jQPie</span></strong> <br />这是一个扩展自jQuery，结合PHP的一个Ajax框架。支持XML，HTML和JSON handler。jQPie提供的功能包括： <br />利用$.getJSON方法简化来自PHP的请求和处理数据。 <br />利用$.(element).load方法注入PHP生成的html到某一页面元素中。 <br />利用$.jqpie方法直接从web页面调用PHP函数。在响应$.jqpie调用时从PHP函数反过来调用jQuery。</p><p><strong><span style="color: #ff6600">phpmsajax</span></strong> <br />一组PHP文件用来支持在PHP Web应用程序中使用Microsoft AJAX Library。 </p><p><strong><span style="color: #ff6600">jsLINB</span></strong> <br />jsLINB 是一个完全的浏览器端javascrīpt解决方案，兼容大部分现代浏览器(IE6.0/IE7.0/firefox1.5 /firefox2.0/opera9/Safari2.0，Safari 缺乏测试)。它可以帮助程序开发者实现各种类型的RIA应用-在提供更加强大框架的同时更加易用。压缩的核心代码仅仅50k, 包括了javascrīpt类型检查，强制类型，精密且灵活的事件模型，自定义事件，observer和tie/untie， boxing/unBoxing/reBoxing模型，直接调用，dom生成，查询，遍历和操作，css 样式操作，css 类操作，dom属性操作，javascrīpt完美OO实现，javascrīpt线程，高级Ajax，强大的Drag Drop，超级控件(可在外观/模板/行为/数据模型四个维度上定制的标准控件，可完全自定义控件)等。 </p><p><strong><span style="color: #ff6600">My-BIC</span></strong> <br />My-BIC是一个易于使用，强大的Ajax/PHP框架。 <br />支持XML,JSON和TEXT的格式Ajax数据传输。支持EasyForms：调用一个函数就能取得Form中的所有值，并为你创建一个少许美化的查询串。ajaxObj.getForm ('formid')。 JSON客户端Encoding支持：利用该功能你就能够在客户端或服务器之间发送和接收经过JSON Encoding的数据。 网络断线保护：当服务器Down掉时My-BIC将帮助你删除请求并阻止产生更多的调用。内置Submission队列：所有的AJAX请求将会发送到正确的顺序中，所有请求都会被存储在队列中防止被覆盖。提供一个帮助你在运行期进行调试的可视化操作界面。 </p><p><strong><span style="color: #ff6600">aSSL</span></strong> <br />aSSL：SSL for Ajax。这个开源项目可用于那些需要SSL支持的Ajax应用中。 </p><p><strong><span style="color: #ff6600">PHPLiveX <br /></span></strong>PHPLiveX是一个PHP类库可用于在web页面中使用Ajax调用PHP函数。它非常易于使用，在调用一个PHP函数不需要附加额外的功能，包含一个灵活地预加载属性，兼容IE, Opera, Mozilla, Firefox等浏览器。 </p><p><strong><span style="color: #ff6600">RSPA</span></strong> <br />RSPA是一个基于组件事件驱动的ajax框架适用于PHP4与PHP5。使用这个框架可以从客户端控制事件调用服务器端PHP class函数。也可以在服服务器端直接操作客户端对象。 </p><p><strong><span style="color: #ff6600">phpAjaxTags</span></strong> <br />phpAjaxTags是模仿著名Java标签库&quot;AjaxTags&quot;的一个PHP标记库。简单但强大，易于使用与安装。不需要编写js代码就能实现ajax功能。</p><p><strong><span style="color: #ff6600">XAJAX</span></strong> <br />xajax 通过Javascrīpt直接调用PHP函数。它使用Javascrīpt stub来调用PHP脚本中的函数，对象方法，和类方法。服务器端响应由于xajax响应对象创建，该对象提供非常多的命令比如：给一个HTML元素赋值，显示一个警告对话框等。还支持自定义脚本输出。所有特定浏览器代码(如使用XMLHttpRequest)都是抽象的，并且发送各种数据类型到服务器端都非常容易实现。xajax提供多种配置选项目以便易于与现存web应用或框架相集成。它的Javascrīpt核心简洁明了，而且可以通过覆盖来支持更多的高级Javascrīpt功能。 </p><p><strong><span style="color: #ff6600">NanoAjax</span></strong> <br />NanoAjax是一个基于PHP5，面向对象(包括Javascrīpt和PHP)的AJAX框架。它使用JSON作为数据交换格式。NanoAjax能够把多个虚拟请求归结到一个正真的请求当中。整个框架非常小，并且易于使用。基于class的服务器端事件处理方式。 </p><p><strong><span style="color: #ff6600">Pear:HTML_AJAX</span></strong> <br />Pear:HTML_AJAX是一个相当成熟的Ajax框架, 使用JSON进行数据传输。內建丰富的例子，包括留言板、登录、grab&hellip;等等。 </p><p><strong><span style="color: #ff6600">Ajax Agent</span></strong> <br />Ajax Agent是一个非常易于使用(只需三行代码)，并且非常强大的开源框架用于快速构建AJAX或RIA应用程序。支持复杂的数据类型比如： associated arrays与object。使用JSON(Javascrīpt Object Notation)作为数据交换格式。 </p><p><strong><span style="color: #ff6600">AjaxAC</span></strong> <br />AjaxAC是一个PHP框架可用于开发/创建/生成AJAX应用程序。 特点如下： <br />1.所有应用程序代码全都包含在一个单独的class中(可以附带任何Javascrīpt包)。 <br />2.PHP文件/HTML页面的调用非常简洁。 <br />3.内置简化处理Javascrīpt事件的功能 <br />4.内置创建和处理subrequest的功能。 <br />5.可以自定义配置值，所以某些元素可以在运行期才被设置。 <br />6.没有杂乱的Javascrīpt代码塞满所调用的Html代码，所有事件都是被动态附加上的。 <br />7.易于与模板引擎相集成基于以上两点原因。 <br />8.易于挂钩(hook)现有的PHP classe或MySQL数据库以便从subrequest返回数据。 </p><p><strong><span style="color: #ff6600">AJASON</span></strong> <br />AJASON是一个基于PHP5的AJAX开发包。它具有以下特点： <br />1.PHP5与Javascrīpt代码完全采用面向对象开发。 <br />2.从Javascrīpt异步调用PHP函数与对象方法。 <br />3.能够在服务器与客户端之间交换复杂的数据类型像arrays与object (更确切地说是对象属性)。 <br />4.使用Javascrīpt回调函数来处理服务端响应。 <br />5.能够在客户端处理服务端的AJASON错误。</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BC%2580%25E6%25BA%2590/" rel="tag">开源</a> , <a href="http://www.gaobo.info/go.php/tags/ajax/" rel="tag">ajax</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25A1%2586%25E6%259E%25B6/" rel="tag">框架</a> , <a href="http://www.gaobo.info/go.php/tags/jqpie/" rel="tag">jqpie</a> , <a href="http://www.gaobo.info/go.php/tags/phpmsajax/" rel="tag">phpmsajax</a> , <a href="http://www.gaobo.info/go.php/tags/jslinb/" rel="tag">jslinb</a> , <a href="http://www.gaobo.info/go.php/tags/my-bic/" rel="tag">my-bic</a> , <a href="http://www.gaobo.info/go.php/tags/assl/" rel="tag">assl</a> , <a href="http://www.gaobo.info/go.php/tags/phplivex/" rel="tag">phplivex</a> , <a href="http://www.gaobo.info/go.php/tags/rspa/" rel="tag">rspa</a> , <a href="http://www.gaobo.info/go.php/tags/phpajaxtags/" rel="tag">phpajaxtags</a> , <a href="http://www.gaobo.info/go.php/tags/xajax/" rel="tag">xajax</a> , <a href="http://www.gaobo.info/go.php/tags/nanoajax/" rel="tag">nanoajax</a> , <a href="http://www.gaobo.info/go.php/tags/pear%253Ahtml_ajax/" rel="tag">pear:html ajax</a> , <a href="http://www.gaobo.info/go.php/tags/ajaxagent/" rel="tag">ajaxagent</a> , <a href="http://www.gaobo.info/go.php/tags/ajaxac/" rel="tag">ajaxac</a> , <a href="http://www.gaobo.info/go.php/tags/ajason/" rel="tag">ajason</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/488.htm</link>
<title><![CDATA[最常用的十大Ajax框架]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sat, 01 Mar 2008 12:03:42 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/488.htm</guid> 
<description>
<![CDATA[ 
	No1&mdash;Prototype<br /><br />　 　特点：一个非常优雅的JS库，定义了JS的面向对象扩展，DOM操作API，事件等等，之上还有rico/script.aculo.us实现一些JS 组件功能和效果(尚不够完善)，以prototype为核心，形成了一个外围的各种各样的JS扩展库，是相当有前途的JS底层框架，突出特点就是非常易学 易用，门槛很低，常常是一两行JS代码就可以搞定一个相关的功能。同时它也是RoR集成的AJAX JS库。<br /><br /><a href="http://www.prototypejs.org/" target="_blank">Prototype官方站点</a><br /><br />No2&mdash;Dojo<br /><br />　 　特点：Dojo包括了Javascript本身的语言扩展，以及各个方面的工具类库，和比较完善的UI组件库；Dojo设计的包加载机制 (Package System)和模块化(Libraries)的结构，能保持更好的扩展性，提高执行性能，减轻了用户开发的工作量，并保持一定的灵活性(用户可以自己编 写扩展)；Dojo官方网站有着丰富的学习资源；专业的开发团队，可以保证更新速度及质量。 <br /><br /><a href="http://www.dojotoolkit.org/" target="_blank">Dojo官方站点</a><br /><br />No3&mdash;Mootools<br /><br />　 　特点：小巧高效，完整下载36k；模块化设计，合理规范，优雅的OOP风格；创新的下载过程，可以跟据自己的需要勾选相应的模块下载，Build Your Own Framework；Effects模块(moo.fx)轻量高效,可以实现优雅、可定制、easing的动画；完整的API文档，丰富的范例。 <br /><br /><a href="http://mootools.net/" target="_blank">Mootools官方站点</a><br /><br />No4&mdash;JQuery<br /><br />　 　特点：短小精悍(19k)，接口设计得精妙(自然语言的风格)，与程序思路配合精密。极大限度地体现了javascript的特性；支持xpath查 询，dom1-3，轻松选择需要的元素；css支持；简单的动画实现，支持自定义动画；支持插件开发，现有插件多；完整的api文档以及范例，易学；拥有 官方UI程序供使用，效果好。 <br /><br /><a href="http://jquery.com/" target="_blank">JQuery官方站点</a><br /><br />No5&mdash;Dwr<br /><br />　　特点：把java类转化为javascript类由dwr自 动完成，只需简单的配置；应用起来极其简单。开发者不要该服务器代码就可以集成；容易测试。和webwork一样，隐藏的http协议；强扩展性。例如与 spring集成，只需修改一点代码；性能。就与jason等简单比较，dwr性能可能是最好的。 <br /><br /><a href="http://tag.csdn.net/tag/dwr/1.html" target="_blank">Dwr实用技术汇总</a><br /><br />No6&mdash;Buffalo<br /><br />　　特点：国人开发的Ajax框架。定义了Web远程调 用的传输基础，并且将远程调用对象完整的序列化到了本地，成为可以被JavaScript编程触及的对象。Buffalo中的重要组件- BuffaloBinding，提供了将JavaScript对象绑定到HTML元素的能力。这种绑定将是无侵入的，只需要在HTML元素中加入若干个不 影响排版的属性，即可将数据与界面绑定。 <br /><br /><a href="http://tag.csdn.net/tag/Buffalo/1.html" target="_blank">Buffalo实用技术汇总</a><br /><br />No7&mdash;Yui<br /><br />　　特点：Yahoo发布的AJAX组件库，是一个包含了各个方面，从工具类库到通讯，到UI组件的综合性JS库。YUL的最大优势在于文档非常齐全，而且有Yahoo的支持，缺点是库目前还不全，功能也不强大。 <br /><br /><a href="http://developer.yahoo.com/yui/" target="_blank">Yui官方站点</a><br /><br />No8&mdash;Ext<br /><br />　　特点：Ext来自于对YUI的扩展，扩展後功能和界面都有了很大的提高。初期仅仅是对YUI的对话框扩展，后来逐渐有了自己的特色，深受网友的喜爱。 <br /><br /><a href="http://extjs.com/" target="_blank">Ext官方站点</a><br /><br />No9&mdash;Qooxdoo<br /><br />　　特点：不通过常规的HTML来构造页面，完全使用JS以类似VB/Delphi风格的编程方式构造Web GUI界面，比较适合内网面向C/S风格的web应用，而不适合面向Internet的界面多变风格的应用。 <br /><br /><a href="http://tag.csdn.net/tag/qooxdoo/1.html" target="_blank">Qooxdoo实用技术汇总</a><br /><br />No10&mdash;Spry<br /><br />　　特点：设计规范，功能全面，文档丰富,面向设计人员而不是开发人员。与其它一些Ajax框架相比，它的服务器端的技术不是很可靠。它依赖于XML，XML可以很容易被Spry组件接受。 <br /><br /><a href="http://tag.csdn.net/tag/Spry/1.html" target="_blank">Spry实用技术汇总</a><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/%25E5%25B8%25B8%25E7%2594%25A8/" rel="tag">常用</a> , <a href="http://www.gaobo.info/go.php/tags/ajax/" rel="tag">ajax</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25A1%2586%25E6%259E%25B6/" rel="tag">框架</a> , <a href="http://www.gaobo.info/go.php/tags/prototype/" rel="tag">prototype</a> , <a href="http://www.gaobo.info/go.php/tags/dojo/" rel="tag">dojo</a> , <a href="http://www.gaobo.info/go.php/tags/mootools/" rel="tag">mootools</a> , <a href="http://www.gaobo.info/go.php/tags/jquery/" rel="tag">jquery</a> , <a href="http://www.gaobo.info/go.php/tags/dwr/" rel="tag">dwr</a> , <a href="http://www.gaobo.info/go.php/tags/buffalo/" rel="tag">buffalo</a> , <a href="http://www.gaobo.info/go.php/tags/yui/" rel="tag">yui</a> , <a href="http://www.gaobo.info/go.php/tags/ext/" rel="tag">ext</a> , <a href="http://www.gaobo.info/go.php/tags/qooxdoo/" rel="tag">qooxdoo</a> , <a href="http://www.gaobo.info/go.php/tags/spry/" rel="tag">spry</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/487.htm</link>
<title><![CDATA[Microsoft’s SQL Server 2005 driver for PHP]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sat, 01 Mar 2008 02:13:12 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/487.htm</guid> 
<description>
<![CDATA[ 
	微软最近也在PHP上频频有所作为，先是之前针对IIS对FASTCGI的支持，现在是为PHP写了个MSSQL的扩展。 <p>新扩展与现有的MSSQL扩展的区别如下：</p><li>SQL Server 2000以后的数据库支持varchar存放大于255个字节的数据，而现有的只支持255个字节 </li><li>现有的不支持nvarchar类型 </li><li>新扩展没有PDO的实现 </li><li>新扩展只能运行在WINDOWS平台 </li><li>新扩展不提供源代码，只有DLL文件 </li><li>新扩展支持data streams </li><li>新扩展在PHPINFO里将显示sqlsrv support enabled <p>更多信息请访问官方网站：<a href="http://www.microsoft.com/sql/technologies/php/default.mspx" onclick="return true;javascript:urchinTracker ('/outgoing/www.microsoft.com/sql/technologies/php/default.mspx');"><a href="http://www.microsoft.com/sql/technologies/php/default.mspx" target="_blank">http://www.microsoft.com/sql/technologies/php/default.mspx</a></a><br />提供个下载吧：<br /><a href="attachment.php?fid=10">点击这里下载文件</a></p></li><p><br />======================================<br />Updated on 2008.8.18<br />今天发现微软把这个扩展升级到1.0正式版了，下边是这个版本的下载<br /><a href="attachment.php?fid=28">点击这里下载文件</a></p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/%25E5%25BE%25AE%25E8%25BD%25AF/" rel="tag">微软</a> , <a href="http://www.gaobo.info/go.php/tags/microsoft/" rel="tag">microsoft</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/sql/" rel="tag">sql</a> , <a href="http://www.gaobo.info/go.php/tags/server/" rel="tag">server</a> , <a href="http://www.gaobo.info/go.php/tags/2005/" rel="tag">2005</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2589%25A9%25E5%25B1%2595/" rel="tag">扩展</a> , <a href="http://www.gaobo.info/go.php/tags/extension/" rel="tag">extension</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/485.htm</link>
<title><![CDATA[PHP中GBK和UTF8编码处理]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 22 Feb 2008 03:17:22 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/485.htm</guid> 
<description>
<![CDATA[ 
	<strong>一、编码范围</strong><br/><br/>1. GBK (GB2312/GB18030)<br/>&#92;x00-&#92;xff&nbsp;&nbsp;GBK双字节编码范围<br/>&#92;x20-&#92;x7f&nbsp;&nbsp;ASCII<br/>&#92;xa1-&#92;xff&nbsp;&nbsp;中文<br/>&#92;x80-&#92;xff&nbsp;&nbsp;中文<br/><br/>2. UTF-8 (Unicode)<br/>&#92;u4e00-&#92;u9fa5 (中文)<br/>&#92;x3130-&#92;x318F (韩文<br/>&#92;xAC00-&#92;xD7A3 (韩文)<br/>&#92;u0800-&#92;u4e00 (日文)<br/>ps: 韩文是大于[&#92;u9fa5]的字符<br/><br/>正则例子:<br/>preg_replace("/([&#92;x80-&#92;xff])/","",$str);<br/>preg_replace("/([u4e00-u9fa5])/","",$str);<br/><br/><strong>二、代码例子</strong><br/><div class="code"><br/>//判断内容里有没有中文-GBK (PHP)<br/>function check_is_chinese($s)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;return preg_match(&#039;/&#91;&#92;x80-&#92;xff&#93;./&#039;, $s);<br/>&#125;<br/><br/>//获取字符串长度-GBK (PHP)<br/>function gb_strlen($str)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$count = 0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;for($i=0; $i&lt;strlen($str); $i++)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$s = substr($str, $i, 1);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (preg_match(&quot;/&#91;&#92;x80-&#92;xff&#93;/&quot;, $s)) ++$i;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++$count;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;return $count;<br/>&#125;<br/><br/>//截取字符串字串-GBK (PHP)<br/>function gb_substr($str, $len)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$count = 0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;for($i=0; $i&lt;strlen($str); $i++)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($count == $len) break;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(preg_match(&quot;/&#91;&#92;x80-&#92;xff&#93;/&quot;, substr($str, $i, 1))) ++$i;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;++$count;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;return substr($str, 0, $i);<br/>&#125;<br/><br/>//统计字符串长度-UTF8 (PHP)<br/>function utf8_strlen($str) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$count = 0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;for($i = 0; $i &lt; strlen($str); $i++)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$value = ord($str&#91;$i&#93;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($value &gt; 127) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$count++;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($value &gt;= 192 &amp;&amp; $value &lt;= 223) $i++;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif($value &gt;= 224 &amp;&amp; $value &lt;= 239) $i = $i + 2;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif($value &gt;= 240 &amp;&amp; $value &lt;= 247) $i = $i + 3;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else die(&#039;Not a UTF-8 compatible string&#039;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$count++;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;return $count;<br/>&#125;<br/><br/><br/>//截取字符串-UTF8(PHP)<br/>function utf8_substr($str,$position,$length)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$start_position = strlen($str);<br/>&nbsp;&nbsp;&nbsp;&nbsp;$start_byte = 0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;$end_position = strlen($str);<br/>&nbsp;&nbsp;&nbsp;&nbsp;$count = 0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;for($i = 0; $i &lt; strlen($str); $i++)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($count &gt;= $position &amp;&amp; $start_position &gt; $i)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$start_position = $i;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$start_byte = $count;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(($count-$start_byte)&gt;=$length) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$end_position = $i;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;&nbsp;&nbsp;&nbsp;&nbsp;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$value = ord($str&#91;$i&#93;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($value &gt; 127)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$count++;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if($value &gt;= 192 &amp;&amp; $value &lt;= 223) $i++;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif($value &gt;= 224 &amp;&amp; $value &lt;= 239) $i = $i + 2;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif($value &gt;= 240 &amp;&amp; $value &lt;= 247) $i = $i + 3;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else die(&#039;Not a UTF-8 compatible string&#039;);<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$count++;<br/><br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;return(substr($str,$start_position,$end_position-$start_position));<br/>&#125;<br/><br/><br/>//字符串长度统计-UTF8 &#91;中文3个字节，俄文、韩文占2个字节，字母占1个字节&#93; (Ruby)<br/>def utf8_string_length(str)<br/>&nbsp;&nbsp;&nbsp;&nbsp;temp = CGI::unescape(str)<br/>&nbsp;&nbsp;&nbsp;&nbsp;i = 0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;j = 0;<br/>&nbsp;&nbsp;&nbsp;&nbsp;temp.length.times&#123;&#124;t&#124;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if temp&#91;t&#93; &lt; 127<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i += 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;elseif temp&#91;t&#93; &gt;= 127 and temp&#91;t&#93; &lt; 224<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j += 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if 0 == (j % 2)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i += 2<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j = 0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j += 1<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if 0 == (j % 3)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i +=2<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j = 0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;return i<br/>&#125;<br/><br/>//判断是否是有韩文-UTF-8 (JavaScript)<br/>function checkKoreaChar(str) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;for(i=0; i&lt;str.length; i++) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if(((str.charCodeAt(i) &gt; 0x3130 &amp;&amp; str.charCodeAt(i) &lt; 0x318F) &#124;&#124; (str.charCodeAt(i) &gt;= 0xAC00 &amp;&amp; str.charCodeAt(i) &lt;= 0xD7A3))) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return true;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&nbsp;&nbsp;return false;<br/>&#125;<br/>//判断是否有中文字符-GBK (JavaScript)<br/>function check_chinese_char(s)&#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;return (s.length != s.replace(/&#91;^&#92;x00-&#92;xff&#93;/g,&quot;**&quot;).length);<br/></div><br/><br/><strong>三、参考文档</strong><br/><br/><a href="http://www.unicode.org/" target="_blank">http://www.unicode.org/</a> <br/><a href="http://examples.oreilly.com/cjkvinfo/doc/cjk.inf" target="_blank">http://examples.oreilly.com/cjkvinfo/doc/cjk.inf</a><br/><a href="http://www.ansell-uebersetzungen.com/gbuni.html" target="_blank">http://www.ansell-uebersetzungen.com/gbuni.html</a><br/><a href="http://www.haiyan.com/steelk/navigator/ref/gbk/gbindex.htm" target="_blank">http://www.haiyan.com/steelk/navigator/ref/gbk/gbindex.htm</a><br/><a href="http://baike.baidu.com/view/40801.htm" target="_blank">http://baike.baidu.com/view/40801.htm</a><br/><a href="http://www.chedong.com/tech/hello_unicode.html" target="_blank">http://www.chedong.com/tech/hello_unicode.html</a><br/><br/>另：<br/><div class="code"><br/>/*<br/>* 中文截取，支持gb2312,gbk,utf-8,big5 <br/>*<br/>* @param string $str 要截取的字串<br/>* @param int $start 截取起始位置<br/>* @param int $length 截取长度<br/>* @param string $charset utf-8&#124;gb2312&#124;gbk&#124;big5 编码<br/>* @param $suffix 是否加尾缀<br/>*/<br/>public function csubstr($str, $start=0, $length, $charset=&quot;utf-8&quot;, $suffix=true)<br/>&#123;<br/>if(function_exists(&quot;mb_substr&quot;))<br/>return mb_substr($str, $start, $length, $charset);<br/>$re&#91;&#039;utf-8&#039;&#93; = &quot;/&#91;&#92;x01-&#92;x7f&#93;&#124;&#91;&#92;xc2-&#92;xdf&#93;&#91;&#92;x80-&#92;xbf&#93;&#124;&#91;&#92;xe0-&#92;xef&#93;&#91;&#92;x80-&#92;xbf&#93;&#123;2&#125;&#124;&#91;&#92;xf0-&#92;xff&#93;&#91;&#92;x80-&#92;xbf&#93;&#123;3&#125;/&quot;;<br/>$re&#91;&#039;gb2312&#039;&#93; = &quot;/&#91;&#92;x01-&#92;x7f&#93;&#124;&#91;&#92;xb0-&#92;xf7&#93;&#91;&#92;xa0-&#92;xfe&#93;/&quot;;<br/>$re&#91;&#039;gbk&#039;&#93; = &quot;/&#91;&#92;x01-&#92;x7f&#93;&#124;&#91;&#92;x81-&#92;xfe&#93;&#91;&#92;x40-&#92;xfe&#93;/&quot;;<br/>$re&#91;&#039;big5&#039;&#93; = &quot;/&#91;&#92;x01-&#92;x7f&#93;&#124;&#91;&#92;x81-&#92;xfe&#93;(&#91;&#92;x40-&#92;x7e&#93;&#124;&#92;xa1-&#92;xfe&#93;)/&quot;;<br/>preg_match_all($re&#91;$charset&#93;, $str, $match);<br/>$slice = join(&quot;&quot;,array_slice($match&#91;0&#93;, $start, $length));<br/>if($suffix) return $slice.&quot;…&quot;;<br/>return $slice;<br/>&#125;<br/></div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/gbk/" rel="tag">gbk</a> , <a href="http://www.gaobo.info/go.php/tags/utf8/" rel="tag">utf8</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25BC%2596%25E7%25A0%2581/" rel="tag">编码</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25A4%2584%25E7%2590%2586/" rel="tag">处理</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/479.htm</link>
<title><![CDATA[结构优化与索引优化]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sat, 02 Feb 2008 03:57:38 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/479.htm</guid> 
<description>
<![CDATA[ 
	索引能加快查询速度，而索引优化和查询优化是相辅相成的，既可以依据查询对索引进行优化，也可以依据现有索引对查询进行优化，这取决于修改查询或索引，哪个对现有产品架构和效率的影响最小。<br />索引优化与查询优化是多年经验积累的结晶，在此无法详述，但仍然给出几条最基本的准则。<br />首先，根据产品的实际运行和被访问情况，找出哪些SQL语句是最常被执行的。最常被执行和最常出现在程序中是完全不同的概念。最常被执行的SQL语句，又可被划分为对大表(数据条目多的)和对小表(数据条目少的)的操作。无论大表或小表，有可分为读(SELECT)多、写(UPDATE/INSERT)多或读写都多的操作。<br />对常被执行的SQL语句而言，对大表操作需要尤其注意：<br />l 写操作多的，通常可使用写入缓存的方法，先将需要写或需要更新的数据缓存至文件或其他表，定期对大表进行批量写操作。同时，应尽量使得常被读写的大表为定长类型，即便原本的结构中大表并非定长。大表定长化，可以通过改变数据存储结构和数据读取方式，将一个大表拆成一个读写多的定长表，和一个读多写少的变长表来实现；<br />l 读操作多的，需要依据SQL查询频率设置专门针对高频SQL语句的索引和联合索引。<br />而小表就相对简单，加入符合查询要求的特定索引，通常效果比较明显。同时，定长化小表也有益于效率和负载能力的提高。字段比较少的小定长表，甚至可以不需要索引。<br />其次，看SQL语句的条件和排序字段是否动态性很高(即根据不同功能开关或属性，SQL查询条件和排序字段的变化很大的情况)，动态性过高的SQL语句是无法通过索引进行优化的。惟一的办法只有将数据缓存起来，定期更新，适用于结果对实效性要求不高的场合。<br />MySQL索引，常用的有PRIMARY KEY、INDEX、UNIQUE几种，详情请查阅MySQL文档。通常，在单表数据值不重复的情况下，PRIMARY KEY和UNIQUE索引比INDEX更快，请酌情使用。<br />事实上，索引是将条件查询、排序的读操作资源消耗，分布到了写操作中，索引越多，耗费磁盘空间越大，写操作越慢。因此，索引决不能盲目添加。对字段索引与否，最根本的出发点，依次仍然是SQL语句执行的概率、表的大小和写操作的频繁程度。<br />MySQL中并没有提供针对查询条件的优化功能，因此需要开发者在程序中对查询条件的先后顺序人工进行优化。例如如下的SQL语句：<br />SELECT * FROM table WHERE a&gt;&rsquo;0&rsquo; AND b&lt;&rsquo;1&rsquo; ORDER BY c LIMIT 10; <p>事实上无论a&gt;&rsquo;0&rsquo;还是b&lt;&rsquo;1&rsquo;哪个条件在前，得到的结果都是一样的，但查询速度就大不相同，尤其在对大表进行操作时。<br />开发者需要牢记这个原则：最先出现的条件，一定是过滤和排除掉更多结果的条件；第二出现的次之；以此类推。因而，表中不同字段的值的分布，对查询速度有着很大影响。而ORDER BY中的条件，只与索引有关，与条件顺序无关。<br />除了条件顺序优化以外，针对固定或相对固定的SQL查询语句，还可以通过对索引结构进行优化，进而实现相当高的查询速度。原则是：在大多数情况下，根据WHERE条件的先后顺序和ORDER BY的排序字段的先后顺序而建立的联合索引，就是与这条SQL语句匹配的最优索引结构。尽管，事实的产品中不能只考虑一条SQL语句，也不能不考虑空间占用而建立太多的索引。<br />同样以上面的SQL语句为例，最优的当table表的记录达到百万甚至千万级后，可以明显的看到索引优化带来的速度提升。<br />依据上面条件优化和索引优化的两个原则，当table表的值为如下方案时，可以得出最优的条件顺序方案：<br />字段a 字段b 字段c<br />1 7 11<br />2 8 10<br />3 9 13<br />-1 0 12<br />最优条件：b&lt;&rsquo;1&rsquo; AND a&gt;&rsquo;0&rsquo;<br />最优索引：INDEX abc (b, a, c)<br />原因：b&lt;&rsquo;1&rsquo;作为第一条件可以先过滤掉75%的结果。如果以a&gt;&rsquo;0&rsquo;作为第一条件，则只能先过滤掉25%的结果<br />注意1：字段c由于未出现于条件中，故条件顺序优化与其无关<br />注意2：最优索引由最优条件顺序得来，而非由例子中的SQL语句得来<br />注意3：索引并非修改数据存储的物理顺序，而是通过对应特定偏移量的物理数据而实现的虚拟指针 </p><p>EXPLAIN语句是检测索引和查询能否良好匹配的简便方法。在phpMyAdmin或其他MySQL客户端中运行EXPLAIN+查询语句，例如EXPLAIN select * FROM table WHERE a&gt;&rsquo;0&rsquo; AND b&lt;&rsquo;1&rsquo; ORDER BY c;这种形式，即使得开发者无需模拟上百万条数据，也可以验证索引是否合理，相关细节请参考MySQL说明。<br />值得提出的是，Using filesort是最不应当出现的情况，如果EXPLAIN得出此结果，说明数据库为这个查询专门建立了一个用以缓存结果的临时表文件，并在查询结束后删除。众所周知，硬盘I/O速度始终是计算机存储的瓶颈，因此，查询中应当尽全力避免高执行频率的SQL语句使用filesort。尽管，开发者永远都不可能保证产品中的全部SQL语句都不会使用filesort。<br />限于篇幅，本文档远远没有涵盖数据库优化的方方面面，例如：联合索引与普通索引的可重用性、JOIN连接的索引设计、MEMORY/HEAP表等。数据库优化实际上就是在很多因素和利弊间不断权衡、修改，惟有在成功与失败经验中反复推敲才能得出的经验，这种经验往往就是最难能可贵和价值连城的。<br />由于MySQL 3.23至5.0的变化很大，因此程序中尽量不使用特殊的SQL语句，以免带来兼容性问题，并给数据库移植造成困难。<br />通常在MySQL 4.1以上版本，应使用相当的字符集来存储，例如GBK/BIG5/UTF-8。传统的latin1编码虽然有一定的兼容性，但仍然不是推荐的选择。使用相应非默认字符集时，程序每次运行时需要使用SET NAMES &lsquo;character_set&rsquo;;来规定连接、传输和结果的字符集。<br />Mysql 5.0以上新增了数种SQL_MODE，默认的SQL_MODE依服务器安装设置不同而不同，因此程序每次运行时需要使用SET SQL_MODE=&rsquo;&rsquo;;来规定当前的SQL模式。</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/sql/" rel="tag">sql</a> , <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593/" rel="tag">数据库</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25BC%2598%25E5%258C%2596/" rel="tag">优化</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25B4%25A2%25E5%25BC%2595/" rel="tag">索引</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%259F%25A5%25E8%25AF%25A2/" rel="tag">查询</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/476.htm</link>
<title><![CDATA[各浏览器的Javascript效率对比]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 28 Jan 2008 11:52:11 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/476.htm</guid> 
<description>
<![CDATA[ 
	从“译言”上的<a href="http://yeeyan.com/articles/view/15184/3589" target="_blank">一篇文章</a>据悉各浏览器 Javascript 的对比。我个人作为一名“准”的 Javascript 开发者，对此事自然比较的关注。<a href="http://webkit.org/perf/sunspider-0.9/sunspider.html" target="_blank">SunSpider</a>的测试面我还是保持对其信任的态度的，正如原文所说的“它是一组被精心设计的测试，易于运行也非常全面”。<br/><br/>下面是测试的内容：<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content">3d - 纯粹 JavaScript 的 3D 渲染运算，但并不包含渲染部分。它包含大量的浮点运算和数组操作。<br/>access - 数组，对象属性和变量的访问读取。<br/>bitops - 位操作，这在游戏、数学运算和多种编码解码中有重要应用。它也是JavaScript中唯一的整数运算。<br/>controlflow - 控制流结构 (重复，递归，条件)。目前它主要是递归结构，但其它结构也均被包含。<br/>crypto - 真实的加密代码，主要为位操作和字符串操作。<br/>date - "date"对象性能。<br/>math - 多种数学运算类型。<br/>regexp - 正则表达式。<br/>string - 字符串处理，包括生成一个巨型"tagcloud"的代码，解压压缩过的 Javascript 代码等等。</div></div><br/><a href="http://www.gaobo.info/attachment/200801/1201520775_8968f3cc.jpg" target="_blank"><img src="http://www.gaobo.info/attachment/200801/1201520775_8968f3cc.jpg" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>除了上述的对比之外，下面的统计图更能直观的对比各浏览器的性能。<br/><a href="http://www.gaobo.info/attachment/200801/1201520932_54941560.jpg" target="_blank"><img src="http://www.gaobo.info/attachment/200801/1201520932_54941560.jpg" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>虽然测试所生成的字符串在大部分的生产情况下几乎不可能发生，但我对于 IE 如此低下的运行效率还是颇有微词。排除 IE 最薄弱的字符串操作，本人和原文作者同样的感到惊讶的就是排除字符串的测试， Firefox 的速度并不比 IE 快多少。<br/><br/>Safari 也是我一直关注的浏览器，它在此项的测试中的效率还是感到非常满意的。至于 Opera，看得出原文的作者也给予其非常高的评价，“世界上最快的浏览器”这个称号看来的确名至所归。<br/><br/>总结一下，由于现在国内大部分浏览器市场还是 IE 为主，所以根据上述的测试，特别是对于 Javascript 方面，字符串的操作是尤其要考虑下它的性能的。发现 IE 中 Javascript 的正则的运行效率还是比较的满意的，可能以后如果碰到字符串方方面的操作比较，我会优先考虑使用正则。<br/><br/>最后，推荐继续阅读下 <a href="http://yeeyan.com/articles/view/15184/3589" target="_blank">原文链接</a>。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/%25E6%25B5%258F%25E8%25A7%2588%25E5%2599%25A8/" rel="tag">浏览器</a> , <a href="http://www.gaobo.info/go.php/tags/javascript/" rel="tag">javascript</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2595%2588%25E7%258E%2587/" rel="tag">效率</a> , <a href="http://www.gaobo.info/go.php/tags/ie/" rel="tag">ie</a> , <a href="http://www.gaobo.info/go.php/tags/internet/" rel="tag">internet</a> , <a href="http://www.gaobo.info/go.php/tags/explorer/" rel="tag">explorer</a> , <a href="http://www.gaobo.info/go.php/tags/firefox/" rel="tag">firefox</a> , <a href="http://www.gaobo.info/go.php/tags/safari/" rel="tag">safari</a> , <a href="http://www.gaobo.info/go.php/tags/opera/" rel="tag">opera</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/475.htm</link>
<title><![CDATA[PHP 4.4.8发布，是4.4系列也是4系列最后一个正式版本]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sun, 27 Jan 2008 12:06:06 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/475.htm</guid> 
<description>
<![CDATA[ 
	<p>07年夏天快过完的时候就在PHP官方看到消息说不再提供对4.*系列的支持，并将终结这个系列的版本，结果今天发现1月又有个新的Release：<br /><div class="quote"><div class="quote-title">引用</div><div class="quote-content">PHP 4.4.8 Released [03-Jan-2008] The PHP development team would like to announce the immediate availability of PHP 4.4.8. It continues to improve the security and the stability of the 4.4 branch and all users are strongly encouraged to upgrade to it as soon as possible. This release wraps up all the outstanding patches for the PHP 4.4 series, and is therefore the last normal PHP 4.4 release. If necessary, releases to address security issues could be made until 2008-08-08.</div></div><br />这段话的大致意思是说4.4.8继续改进了4.4分支的安全性和稳定性并推荐所有用户尽快升级到此版本。这个发布版包括了4.4系列所有重要的补丁，是4.4系列的最后一个正式Release。如果必要的话，发送到邮件列表的安全通知将会继续到2008-8-8。</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/release/" rel="tag">release</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%258F%2591%25E5%25B8%2583/" rel="tag">发布</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%258D%2587%25E7%25BA%25A7/" rel="tag">升级</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25A1%25A5%25E4%25B8%2581/" rel="tag">补丁</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/467.htm</link>
<title><![CDATA[用ZDE生成WSDL文档应该注意的问题]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Tue, 25 Dec 2007 08:28:20 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/467.htm</guid> 
<description>
<![CDATA[ 
	学校的社区需要提供给数字化校园一个查询DC用户的社区帐号的WebService接口，我用ZDE写好代码并用PHP建立Client测试过没有问题后放到了服务器上。但是C#开发那边却说始终无法访问我提供的接口方法……<br/>于是GG、BAIDU……终于让我找到：<br/>用ZDE自身生成WSDL文件的工具并不够完全智能化，对于参数类型和返回值类型的说明应该放在PHP的注释中。如：<br/><div class="code">/**<br/><br/> &nbsp;* @param &nbsp;string $username<br/><br/> &nbsp;* @param &nbsp;integer $userid<br/><br/> &nbsp;* @return string <br/><br/> &nbsp; */<br/> &nbsp; &nbsp; function ....<br/></div><br/>写的时候根据上面的规则才可以生成WSDL文件，不然的话生成的WSDL文件没有数据类型的说明。<br/>另注意PHP中没有int的数据类型，要用integer 。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/zde/" rel="tag">zde</a> , <a href="http://www.gaobo.info/go.php/tags/zend/" rel="tag">zend</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/soap/" rel="tag">soap</a> , <a href="http://www.gaobo.info/go.php/tags/web/" rel="tag">web</a> , <a href="http://www.gaobo.info/go.php/tags/service/" rel="tag">service</a> , <a href="http://www.gaobo.info/go.php/tags/c%2523/" rel="tag">c#</a> , <a href="http://www.gaobo.info/go.php/tags/wsdl/" rel="tag">wsdl</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/462.htm</link>
<title><![CDATA[让人郁闷的phpMyAdmin 2.11]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sun, 25 Nov 2007 13:57:53 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/462.htm</guid> 
<description>
<![CDATA[ 
	这次的项目要对所有文件和数据库进行UTF-8编码，所以抛开了用了多年的MySQL 4.0.26，装了个5.1.19 Beta，没想到在把数据库复制过去并在PMA中建立了用户以后，程序始终提示无效的MySQL查询结果。这下把我整郁闷了……<br/><br/>我以为是程序的问题，检查了多遍，找不出任何错误；而且程序在别的地方运行的非常好。<br/>又怀疑是MySQL的问题，卸载了5.1.19，换另一个版本，依旧。<br/>再回去检查程序，还是没问题……<br/>时间在一点一滴的流逝……<br/><br/>在我出去了一趟回来的路上，猛地想起会不会是MySQL用户的权限问题？立刻打开PMA检查，发现一个可疑的权限：<br/>****&#92;_%<br/>这是什么，先不管他了，删除，然后重新添加此用户对数据库的权限。测试。OK！<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/phpmyadmin/" rel="tag">phpmyadmin</a> , <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%259D%2583%25E9%2599%2590/" rel="tag">权限</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/459.htm</link>
<title><![CDATA[SQL Server 2005 Driver for PHP(CTP, 2007.10)]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sat, 10 Nov 2007 14:00:01 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/459.htm</guid> 
<description>
<![CDATA[ 
	微软最近在PHP上动作频频，先是前不久发布了针对IIS对FASTCGI的支持，现在是为PHP写了个MSSQL的扩展，真可谓PHP界的福音啊<br/><br/>新扩展与现有的MSSQL扩展的区别如下：<br/># SQL Server 2000以后的数据库支持varchar存放大于255个字节的数据，而现有的只支持255个字节<br/># 现有的不支持nvarchar类型<br/># 新扩展没有PDO的实现<br/># 新扩展只能运行在WINDOWS平台<br/># 新扩展不提供源代码，只有DLL文件<br/># 新扩展支持data streams<br/># 新扩展在PHPINFO里将显示sqlsrv support enabled<br/><br/>更多信息请访问官方网站：<a href="http://www.microsoft.com/sql/technologies/php/default.mspx" target="_blank">http://www.microsoft.com/sql/technologies/php/default.mspx</a><br/><a href="attachment/200711/1194703162_0.rar">点击这里下载文件</a><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/sql/" rel="tag">sql</a> , <a href="http://www.gaobo.info/go.php/tags/server/" rel="tag">server</a> , <a href="http://www.gaobo.info/go.php/tags/2005/" rel="tag">2005</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2589%25A9%25E5%25B1%2595/" rel="tag">扩展</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BE%25AE%25E8%25BD%25AF/" rel="tag">微软</a> , <a href="http://www.gaobo.info/go.php/tags/microsoft/" rel="tag">microsoft</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/457.htm</link>
<title><![CDATA[Javascript中的getYear()在firefox中的显示问题]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 07 Nov 2007 06:30:43 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/457.htm</guid> 
<description>
<![CDATA[ 
	今天在写javascript时候用到了Date object,调用了getYear()方法，在IE下面测试是2007，在firefox下面却成了107。<br/><br/>原因就是 javascript 的兼容性问题<br/><br/>var today = new date();<br/>var year = today.getYear();<br/><br/>在 Firefox 里面 getYear 返回的是 "当前年份-1900" 的值 (以前都如此)<br/>而微软很NB的做了一个改动：<br/>当today的年份大于等于2000的时候 直接把1900加上了 返回的 200X (而不是10X)<br/>如：today年份是1999 返回99<br/> &nbsp; &nbsp;today年份是2000 返回2000<br/><br/>一个简单的解决是加一个判断：<br/>year = (year<1900?(1900+year):year);<br/><br/>也有另外的方法<br/>通过 getFullYear getUTCFullYear 去调用<br/>var year = today.getFullYear();在IE,FireFox都适用。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/javascript/" rel="tag">javascript</a> , <a href="http://www.gaobo.info/go.php/tags/getyear/" rel="tag">getyear</a> , <a href="http://www.gaobo.info/go.php/tags/date/" rel="tag">date</a> , <a href="http://www.gaobo.info/go.php/tags/firefox/" rel="tag">firefox</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2585%25BC%25E5%25AE%25B9%25E6%2580%25A7/" rel="tag">兼容性</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/454.htm</link>
<title><![CDATA[用CSS实现文字竖排]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 05 Nov 2007 01:42:54 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/454.htm</guid> 
<description>
<![CDATA[ 
	orz，CSS做到了以前我们想破头都不知道应该怎么做的事情<br/><div class="code">&lt;style type=&quot;text/css&quot;&gt;<br/>&lt;!--<br/>.fs &#123;<br/> &nbsp; &nbsp;writing-mode:tb-rl; /*基本上就是这句的化腐朽为神奇了*/<br/> &nbsp; &nbsp;text-align:center;<br/> &nbsp; &nbsp;width: 36px;<br/> &nbsp; &nbsp;letter-spacing: 2px;<br/>&#125;<br/>--&gt;<br/>&lt;/style&gt;<br/>&lt;div class=&quot;fs&quot;&gt;欢迎来到我的BLOG:http://www.gaobo.info/，在FF中似乎不起作用哦~&lt;/div&gt;</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/css/" rel="tag">css</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2596%2587%25E5%25AD%2597/" rel="tag">文字</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25AB%2596%25E6%258E%2592/" rel="tag">竖排</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/448.htm</link>
<title><![CDATA[Zend Develop Environment的使用心得]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 26 Oct 2007 02:29:56 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/448.htm</guid> 
<description>
<![CDATA[ 
	终于下定决心换PHP的IDE了，呵呵。用了4、5年的Editplus了，还真有点舍不得<br/><br/>先把环境搭好。之前我一直是IIS+Editplus+FireFox(IETab)的组合。现在先把IIS停掉，然后安装ZendCore，最新的版本是2.5，可以在download.phpchina.com下载到（ZendPlatform和ZendStudio也可以在这里下载，下边不再赘述）。这是个免费软件，作用是自动搭建运行和调试PHP的环境，安装以后会增加一个Windows服务，名字叫ZendCoreApache。不爽的一点是装的过程中非得去Zend官方下载那个Zend Framework，还不能取消这一步，我这里连Zend官方速度并不快，结果下载就等了20来分钟……orz<br/><br/>装好后，可以进入<a href="http://localhost/ZendCore" target="_blank">http://localhost/ZendCore</a>，输入安装时候的密码即可。进去以后可以在Configuration-PHP和Extensions里边进行php.ini的设置和调整，终于图形化了……改好以后保存设置，然后重启ZendCoreApache服务即可。<br/><br/>装完ZendCore以后，PHP的环境其实可以算搭建完成，但是如果你想测试代码的效率，对代码进行概要分析和优化，那么可以选择安装ZendPlatform，这个东西提供了一个和ZendStudio联合的方式来对代码的各个部分进行详细的分析，效果很好，有饼图输出，可惜不是免费的，安装的时候选择Trial可以试用1个月，^_^<br/><br/>最后，安装ZendStudio。我用的是5.5.0 Build 270的版本，装完以后默认是英文界面，不过可以通过修改配置文件调为中文（详见<a href="http://www.gaobo.info/read.php/401.htm" target="_blank">http://www.gaobo.info/read.php/401.htm</a>）。需要注意的是装完ZendStudio以后对Debug Server的设置：工具-首选项-调试，按以下设置：<br/><br/>调试方式：服务器<br/>Debug URL：<a href="http://localhost/" target="_blank">http://localhost/</a><br/>客户机IP：127.0.0.1<br/><br/>其他都不动，按默认设置即可。<br/><br/>这样的话应该可以进行PHP的开发和调试工作了，<span style="color: #FF0000;">但是需要注意一点，也是最重要的：默认安装以后的WEB根目录是ZendCoreApache目录下的htdocs目录，如果需要更改，请自行修改ZendCoreApache的httpd.conf文件。并一定把原来htdocs目录下的dummy.php文件复制到新的WEB根目录下，否则ZendStudio中连接Debug Server不会成功的。</span><br/><br/>最后说下ZendStudio的不足：<br/>1、编辑器中对中文的支持。如果为编辑器窗口选择了其他字体，那么要么英文显示别扭要么中文显示别扭，目前还是用默认设置好<br/>2、默认文件编码方式是UTF8，这对不少国内的PHPer来说还不太适应<br/>3、内置浏览器不支持框架，orz……<br/><br/>这两天看到ZendTech发布了新的基于Eclipse的ZendStudio Neon，也试用了下，虽然还是Beta，但已经解决了上面的三点不足，呵呵<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/zend/" rel="tag">zend</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/develop/" rel="tag">develop</a> , <a href="http://www.gaobo.info/go.php/tags/environment/" rel="tag">environment</a> , <a href="http://www.gaobo.info/go.php/tags/studio/" rel="tag">studio</a> , <a href="http://www.gaobo.info/go.php/tags/core/" rel="tag">core</a> , <a href="http://www.gaobo.info/go.php/tags/platform/" rel="tag">platform</a> , <a href="http://www.gaobo.info/go.php/tags/debug/" rel="tag">debug</a> , <a href="http://www.gaobo.info/go.php/tags/apache/" rel="tag">apache</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25B0%2583%25E8%25AF%2595/" rel="tag">调试</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%258E%25AF%25E5%25A2%2583/" rel="tag">环境</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BC%2580%25E5%258F%2591/" rel="tag">开发</a> , <a href="http://www.gaobo.info/go.php/tags/neon/" rel="tag">neon</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25BD%25BF%25E7%2594%25A8/" rel="tag">使用</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BF%2583%25E5%25BE%2597/" rel="tag">心得</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/447.htm</link>
<title><![CDATA[Memcache 协议（中英对照）]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 25 Oct 2007 15:34:07 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/447.htm</guid> 
<description>
<![CDATA[ 
	不容易见到的资料，呵呵 <table border="0" cellspacing="1" cellpadding="4" width="100%"><tbody><tr><td width="50%" style="color: #336600"><h5>协议</h5></td><td width="50%" style="color: #336600"><h5>Protocol</h5></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">memcached 的客户端使用TCP链接 与 服务器通讯。（UDP接口也同样有效，参考后文的 &ldquo;UDP协议&rdquo; ）一个运行中的memcached服务器监视一些（可设置）端口。客户端连接这些端口，发送命令到服务器，读取回应，最后关闭连接。</td><td valign="top" style="font-size: 13px; line-height: 20px">Clients of memcached communicate with server through TCP connections. (A UDP interface is also available; details are below under &quot;UDP protocol.&quot;) A given running memcached server listens on some (configurable) port; clients connect to that port, send commands to the server, read responses, and eventually close the connection.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">结束会话不需要发送任何命令。当不再需memcached服务时，要客户端可以在任何时候关闭连接。需要注意的是，鼓励客户端缓存这些连接，而不是每次需要存取数据时都重新打开连接。这是因为memcached 被特意设计成及时开启很多连接也能够高效的工作（数百个，上千个如果需要的话）。缓存这些连接，可以消除建立连接所带来的开销（/*/相对而言，在服务器端建立一个新连接的准备工作所带来的开销，可以忽略不计。）。</td><td valign="top" style="font-size: 13px; line-height: 20px">There is no need to send any command to end the session. A client may just close the connection at any moment it no longer needs it. Note, however, that clients are encouraged to cache their connections rather than reopen them every time they need to store or retrieve data. This is because memcached is especially designed to work very efficiently with a very large number (many hundreds, more than a thousand if necessary) of open connections. Caching connections will eliminate the overhead associated with establishing a TCP connection (the overhead of preparing for a new connection on the server side is insignificant compared to this).</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">在memcache协议中发送的数据分两种：文本行 和 自由数据。 文本行被用于来自客户端的命令和服务器的回应。自由数据用于客户端从服务器端存取数据时。同样服务器会以字节流的方式传回自由数据。/*/服务器不用关心自由数据的字节顺序。自由数据的特征没有任何限制；但是通过前文提到的文本行，这项数据的接受者（服务器或客户端），便能够精确地获知所发送的数据库的长度。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">There are two kinds of data sent in the memcache protocol: text lines<br />and unstructured data. Text lines are used for commands from clients<br />and responses from servers. Unstructured data is sent when a client<br />wants to store or retrieve data. The server will transmit back<br />unstructured data in exactly the same way it received it, as a byte<br />stream. The server doesn't care about byte order issues in<br />unstructured data and isn't aware of them. There are no limitations on<br />characters that may appear in unstructured data; however, the reader<br />of such data (either a client or a server) will always know, from a<br />preceding text line, the exact length of the data block being<br />transmitted.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">文本行固定以&ldquo;&#92;r&#92;n&rdquo;(回车符紧跟一个换行符)结束。 自由数据也是同样会以&ldquo;&#92;r&#92;n&rdquo;结束，但是 &#92;r(回车符)、&#92;n(换行符)，以及任何其他8位字符，均可出现在数据中。因此，当客户端从服务器取回数据时，必须使用数据区块的长度来确定数据区块的结束位置，而不要依据数据区块末尾的&ldquo;&#92;r&#92;n&rdquo;，即使它们固定存在于此。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">Text lines are always terminated by &#92;r&#92;n. Unstructured data is _also_<br />terminated by &#92;r&#92;n, even though &#92;r, &#92;n or any other 8-bit characters<br />may also appear inside the data. Therefore, when a client retrieves<br />data from a server, it must use the length of the data block (which it<br />will be provided with) to determine where the data block ends, and not<br />the fact that &#92;r&#92;n follows the end of the data block, even though it<br />does.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr><tr><td valign="top" style="color: #336600"><h5>键值</h5></td><td valign="top" style="color: #336600"><h5>Keys</h5></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">存储在memcached中的数据通过键值来标识。键值是一个文本字符串，对于需要存取这项数据的客户端而言，它必须是唯一的。键值当前的长度限制设定为250字符（当然，客户端通常不会用到这么长的键）；键值中不能使用制表符和其他空白字符（例如空格，换行等）。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">Data stored by memcached is identified with the help of a key. A key<br />is a text string which should uniquely identify the data for clients<br />that are interested in storing and retrieving it. Currently the<br />length limit of a key is set at 250 characters (of course, normally<br />clients wouldn't need to use such long keys); the key must not include<br />control characters or whitespace.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr><tr><td valign="top" style="color: #336600"><h5>命令</h5></td><td valign="top" style="color: #336600"><h5>Commands</h5></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">所有命令分为3种类型</td><td valign="top" style="font-size: 13px; line-height: 20px">There are three types of commands. </td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">存储命令（有3项：&rsquo;set&rsquo;、&rsquo;add&rsquo;、&rsquo;repalce&rsquo;）指示服务器储存一些由键值标识的数据。客户端发送一行命令，后面跟着数据区块；然后，客户端等待接收服务器回传的命令行，指示成功与否。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">Storage commands (there are three: &quot;set&quot;, &quot;add&quot; and &quot;replace&quot;) ask the<br />server to store some data identified by a key. The client sends a<br />command line, and then a data block; after that the client expects one<br />line of response, which will indicate success or faulure.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">取回命令（只有一项：&rsquo;get&rsquo;）指示服务器返回与所给键值相符合的数据（一个请求中右一个或多个键值）。客户端发送一行命令，包括所有请求的键值；服务器每找到一项内容，都会发送回客户端一行关于这项内容的信息，紧跟着是对应的数据区块；直到服务器以一行&ldquo;END&rdquo;回应命令结束。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">Retrieval commands (there is only one: &quot;get&quot;) ask the server to<br />retrieve data corresponding to a set of keys (one or more keys in one<br />request). The client sends a command line, which includes all the<br />requested keys; after that for each item the server finds it sends to<br />the client one response line with information about the item, and one<br />data block with the item's data; this continues until the server<br />finished with the &quot;END&quot; response line.<br /></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">/*?*/其他的命令都不能携带自由数据。在这些命令中，客户端发送一行命令，然后等待（由命令所决定）一行回应，或最终以一行&ldquo;END&rdquo;结束的多行命令。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">All other commands don't involve unstructured data. In all of them,<br />the client sends one command line, and expects (depending on the<br />command) either one line of response, or several lines of response<br />ending with &quot;END&quot; on the last line.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">一行命令固定以命令名称开始，接着是以空格隔开的参数（如果有参数的话）。命令名称大小写敏感，并且必须小写。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">A command line always starts with the name of the command, followed by<br />parameters (if any) delimited by whitespace. Command names are<br />lower-case and are case-sensitive.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">一些客户端发送给服务器的命令会包含一些时限（针对内容或客户端请求的操作）。这时，时限的具体内容既可以是Unix时间戳（从1970年1月1日开始的秒钟数），或当前时间开始的秒钟数。对后者而言，不能超过 60*60*24*30（30天）；如果超出，服务器将会理解为Unix时间戳，而不是从当前时间起的秒偏移。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">Some commands involve a client sending some kind of expiration time<br />(relative to an item or to an operation requested by the client) to<br />the server. In all such cases, the actual value sent may either be<br />Unix time (number of seconds since January 1, 1970, as a 32-bit<br />value), or a number of seconds starting from current time. In the<br />latter case, this number of seconds may not exceed 60*60*24*30 (number<br />of seconds in 30 days); if the number sent by a client is larger than<br />that, the server will consider it to be real Unix time value rather<br />than an offset from current time.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr><tr><td valign="top" style="color: #336600"><h5>错误字串</h5></td><td valign="top" style="color: #336600"><h5>Error strings</h5></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">每一个由客户端发送的命令，都可能收到来自服务器的错误字串回复。这些错误字串会以三种形式出现：</td><td valign="top" style="font-size: 13px; line-height: 20px">Each command sent by a client may be answered with an error string<br />from the server. These error strings come in three types:</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">- &quot;ERROR&#92;r&#92;n&quot; </td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">意味着客户端发送了不存在的命令名称。</td><td valign="top" style="font-size: 13px; line-height: 20px">means the client sent a nonexistent command name.</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">- &quot;CLIENT_ERROR &lt;error&gt;&#92;r&#92;n&quot;</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">意味着输入的命令行里存在一些客户端错误，例如输入未遵循协议。&lt;error&gt;部分是人类易于理解的错误解说&hellip;&hellip;</td><td valign="top" style="font-size: 13px; line-height: 20px">means some sort of client error in the input line, i.e. the input<br />doesn't conform to the protocol in some way. &lt;error&gt; is a<br />human-readable error string.</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">- &quot;SERVER_ERROR &lt;error&gt;&#92;r&#92;n&quot;</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">意味着一些服务器错误，导致命令无法执行。&lt;error&gt;部分是人类易于理解的错误解说。在一些严重的情形下（通常应该不会遇到），服务器将在发送这行错误后关闭连接。这是服务器主动关闭连接的唯一情况。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">means some sort of server error prevents the server from carrying<br />out the command. &lt;error&gt; is a human-readable error string. In cases<br />of severe server errors, which make it impossible to continue<br />serving the client (this shouldn't normally happen), the server will<br />close the connection after sending the error line. This is the only<br />case in which the server closes a connection to a client.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">在后面每项命令的描述中，这些错误行不会再特别提到，但是客户端必须考虑到这些它们存在的可能性。</td><td valign="top" style="font-size: 13px; line-height: 20px">In the descriptions of individual commands below, these error lines<br />are not again specifically mentioned, but clients must allow for their<br />possibility.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr><tr><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">存储命令</span></h5></td><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">Storage commands</span></h5></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">首先，客户端会发送一行像这样的命令：</td><td valign="top" style="font-size: 13px; line-height: 20px">First, the client sends a command line which looks like this:</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">&lt;command name&gt; &lt;key&gt; &lt;flags&gt; &lt;exptime&gt; &lt;bytes&gt;&#92;r&#92;n</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;command name&gt; 是 set, add, 或者 repalce</td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;command name&gt; is &quot;set&quot;, &quot;add&quot; or &quot;replace&quot;</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px"><ul><li>set 意思是 &ldquo;储存此数据&rdquo; </li><li>add 意思是 &ldquo;储存此数据，只在服务器*未*保留此键值的数据时&rdquo; </li><li>replace意思是 &ldquo;储存此数据，只在服务器*曾*保留此键值的数据时&rdquo;</li></ul></td><td valign="top" style="font-size: 13px; line-height: 20px"><ul><li>&quot;set&quot; means &quot;store this data&quot;. </li><li>&quot;add&quot; means &quot;store this data, but only if the server *doesn't* already<br />hold data for this key&quot;. </li><li>&quot;replace&quot; means &quot;store this data, but only if the server *does*<br />already hold data for this key&quot;.</li></ul></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;key&gt; 是接下来的客户端所要求储存的数据的键值</td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;key&gt; is the key under which the client asks to store the data</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;flags&gt; 是在取回内容时，与数据和发送块一同保存服务器上的任意16位无符号整形（用十进制来书写）。客户端可以用它作为&ldquo;位域&rdquo;来存储一些特定的信息；它对服务器是不透明的。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;flags&gt; is an arbitrary 16-bit unsigned integer (written out in<br />decimal) that the server stores along with the data and sends back<br />when the item is retrieved. Clients may use this as a bit field to<br />store data-specific information; this field is opaque to the server.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;exptime&gt; 是终止时间。如果为0，该项永不过期(虽然它可能被删除，以便为其他缓存项目腾出位置)。如果非0（Unix时间戳或当前时刻的秒偏移），到达终止时间后，客户端无法再获得这项内容。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;exptime&gt; is expiration time. If it's 0, the item never expires<br />(although it may be deleted from the cache to make place for other<br />items). If it's non-zero (either Unix time or offset in seconds from<br />current time), it is guaranteed that clients will not be able to<br />retrieve this item after the expiration time arrives (measured by<br />server time). </td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;bytes&gt; 是随后的数据区块的字节长度，不包括用于分野的&ldquo;&#92;r&#92;n&rdquo;。它可以是0（这时后面跟随一个空的数据区块）。</td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;bytes&gt; is the number of bytes in the data block to follow, *not*<br />including the delimiting &#92;r&#92;n. &lt;bytes&gt; may be zero (in which case<br />it's followed by an empty data block).</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">在这一行以后，客户端发送数据区块。</td><td valign="top" style="font-size: 13px; line-height: 20px">After this line, the client sends the data block:</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">&lt;data block&gt;&#92;r&#92;n</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;data block&gt; 是大段的8位数据，其长度由前面的命令行中的&lt;bytes&gt;指定。</td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;data block&gt; is a chunk of arbitrary 8-bit data of length &lt;bytes&gt;<br />from the previous line.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">发送命令行和数据区块以后，客户端等待回复，可能的回复如下：</td><td valign="top" style="font-size: 13px; line-height: 20px">After sending the command line and the data blockm the client awaits<br />the reply, which may be:</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">- &quot;STORED&#92;r&#92;n&quot;</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">表明成功.</td><td valign="top" style="font-size: 13px; line-height: 20px">to indicate success.</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">- &quot;NOT_STORED&#92;r&#92;n&quot; </td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">表明数据没有被存储，但不是因为发生错误。这通常意味着add 或 replace命令的条件不成立，或者，项目已经位列删除队列（参考后文的&ldquo;delete&rdquo;命令）。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">to indicate the data was not stored, but not<br />because of an error. This normally means that either that the<br />condition for an &quot;add&quot; or a &quot;replace&quot; command wasn't met, or that the<br />item is in a delete queue (see the &quot;delete&quot; command below).</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr><tr><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">取回命令</span></h5></td><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">Retrieval command</span></h5></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">一行取回命令如下：</td><td valign="top" style="font-size: 13px; line-height: 20px">The retrieval command looks like this:</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">get &lt;key&gt;*&#92;r&#92;n</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;key&gt;* 表示一个或多个键值，由空格隔开的字串</td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;key&gt;* means one or more key strings separated by whitespace.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">这行命令以后，客户端的等待0个或多个项目，每项都会收到一行文本，然后跟着数据区块。所有项目传送完毕后，服务器发送以下字串：<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">After this command, the client expects zero or more items, each of<br />which is received as a text line followed by a data block. After all<br />the items have been transmitted, the server sends the string</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">&quot;END&#92;r&#92;n&quot;</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">来指示回应完毕。</td><td valign="top" style="font-size: 13px; line-height: 20px">to indicate the end of response.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">服务器用以下形式发送每项内容：</td><td valign="top" style="font-size: 13px; line-height: 20px">Each item sent by the server looks like this:</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">VALUE &lt;key&gt; &lt;flags&gt; &lt;bytes&gt;&#92;r&#92;n<br />&lt;data block&gt;&#92;r&#92;n</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;key&gt; 是所发送的键名</td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;key&gt; is the key for the item being sent</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;flags&gt; 是存储命令所设置的记号</td><td valign="top" style="font-size: 13px; line-height: 20px"><p>- &lt;flags&gt; is the flags value set by the storage command</p></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;bytes&gt; 是随后数据块的长度，*不包括* 它的界定符&ldquo;&#92;r&#92;n&rdquo;</td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;bytes&gt; is the length of the data block to follow, *not* including<br />its delimiting &#92;r&#92;n</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;data block&gt; 是发送的数据</td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;data block&gt; is the data for this item.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">如果在取回请求中发送了一些键名，而服务器没有送回项目列表，这意味着服务器没这些键名（可能因为它们从未被存储，或者为给其他内容腾出空间而被删除，或者到期，或者被已客户端删除）。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">If some of the keys appearing in a retrieval request are not sent back<br />by the server in the item list this means that the server does not<br />hold items with such keys (because they were never stored, or stored<br />but deleted to make space for more items, or expired, or explicitly<br />deleted by a client).</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr><tr><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">删除</span></h5></td><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">Deletion</span></h5></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">命令&ldquo;delete&rdquo;允许从外部删除内容：</td><td valign="top" style="font-size: 13px; line-height: 20px">The command &quot;delete&quot; allows for explicit deletion of items:</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">delete &lt;key&gt; &lt;time&gt;&#92;r&#92;n</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;key&gt; 是客户端希望服务器删除的内容的键名</td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;key&gt; is the key of the item the client wishes the server to delete</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;time&gt; 是一个单位为秒的时间（或代表直到某一刻的Unix时间），在该时间内服务器会拒绝对于此键名的&ldquo;add&rdquo;和&ldquo;replace&rdquo;命令。此时内容被放入delete队列，无法再通过&ldquo;get&rdquo;得到该内容，也无法是用&ldquo;add&rdquo;和&ldquo;replace&rdquo;命令（但是&ldquo;set&rdquo;命令可用）。直到指定时间，这些内容被最终从服务器的内存中彻底清除。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;time&gt; is the amount of time in seconds (or Unix time until which)<br />the client wishes the server to refuse &quot;add&quot; and &quot;replace&quot; commands<br />with this key. For this amount of item, the item is put into a<br />delete queue, which means that it won't possible to retrieve it by<br />the &quot;get&quot; command, but &quot;add&quot; and &quot;replace&quot; command with this key<br />will also fail (the &quot;set&quot; command will succeed, however). After the<br />time passes, the item is finally deleted from server memory.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&lt;time&gt;参数 是可选的，缺省为0（表示内容会立刻清除，并且随后的存储命令均可用）。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">The parameter &lt;time&gt; is optional, and, if absent, defaults to 0<br />(which means that the item will be deleted immediately and further<br />storage commands with this key will succeed).</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">此命令有一行回应：</td><td valign="top" style="font-size: 13px; line-height: 20px">The response line to this command can be one of:</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">- &quot;DELETED&#92;r&#92;n&quot;</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">表示执行成功</td><td valign="top" style="font-size: 13px; line-height: 20px">to indicate success</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">- &quot;NOT_FOUND&#92;r&#92;n&quot;</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">表示没有找到这项内容</td><td valign="top" style="font-size: 13px; line-height: 20px">to indicate that the item with this key was not found.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">参考随后的&ldquo;flush_all&rdquo;命令使所有内容无效<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">See the &quot;flush_all&quot; command below for immediate invalidation<br />of all existing items.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr><tr><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">增加/减少</span></h5></td><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">Increment/Decrement</span></h5></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">命令 &ldquo;incr&rdquo; 和 &ldquo;decr&rdquo;被用来修改数据，当一些内容需要 替换、增加 或减少时。这些数据必须是十进制的32位无符号整新。如果不是，则当作0来处理。修改的内容必须存在，当使用&ldquo;incr&rdquo;/&ldquo;decr&rdquo;命令修改不存在的内容时，不会被当作0处理，而是操作失败。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">Commands &quot;incr&quot; and &quot;decr&quot; are used to change data for some item<br />in-place, incrementing or decrementing it. The data for the item is<br />treated as decimal representation of a 32-bit unsigned integer. If the<br />current data value does not conform to such a representation, the<br />commands behave as if the value were 0. Also, the item must already<br />exist for incr/decr to work; these commands won't pretend that a<br />non-existent key exists with value 0; instead, they will fail.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">客户端发送命令行：</td><td valign="top" style="font-size: 13px; line-height: 20px">The client sends the command line:</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">incr &lt;key&gt; &lt;value&gt;&#92;r&#92;n<br />或<br />decr &lt;key&gt; &lt;value&gt;&#92;r&#92;n</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;key&gt; 是客户端希望修改的内容的建名</td><td valign="top" style="font-size: 13px; line-height: 20px"><p>- &lt;key&gt; is the key of the item the client wishes to change</p></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;value&gt; 是客户端要增加/减少的总数。</td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;value&gt; is the amount by which the client wants to increase/decrease<br />the item. It is a decimal representation of a 32-bit unsigned integer.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">回复为以下集中情形：</td><td valign="top" style="font-size: 13px; line-height: 20px"><p>The response will be one of: </p></td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">- &quot;NOT_FOUND&#92;r&#92;n&quot;</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">指示该项内容的值，不存在。</td><td valign="top" style="font-size: 13px; line-height: 20px">to indicate the item with this value was not found</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;value&gt;&#92;r&#92;n ，&lt;value&gt;是 增加/减少 。</td><td valign="top" style="font-size: 13px; line-height: 20px">- &lt;value&gt;&#92;r&#92;n , where &lt;value&gt; is the new value of the item's data,<br />after the increment/decrement operation was carried out.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">注意&quot;decr&quot;命令发生下溢：如果客户端尝试减少的结果小于0时，结果会是0。&quot;incr&quot; 命令不会发生溢出。</td><td valign="top" style="font-size: 13px; line-height: 20px">Note that underflow in the &quot;decr&quot; command is caught: if a client tries<br />to decrease the value below 0, the new value will be 0. Overflow in<br />the &quot;incr&quot; command is not checked.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px"><p>&hellip;&hellip;</p><p></p></td><td valign="top" style="font-size: 13px; line-height: 20px">Note also that decrementing a number such that it loses length isn't<br />guaranteed to decrement its returned length. The number MAY be<br />space-padded at the end, but this is purely an implementation<br />optimization, so you also shouldn't rely on that.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr><tr><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">状态</span></h5></td><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">Statistics</span></h5></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">命令&quot;stats&quot; 被用于查询服务器的运行状态和其他内部数据。有两种格式。不带参数的：<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">The command &quot;stats&quot; is used to query the server about statistics it<br />maintains and other internal data. It has two forms. Without<br />arguments:</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc"><span style="color: #cccccc">&nbsp;</span>stats&#92;r&#92;n</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">这会在随后输出各项状态、设定值和文档。另一种格式带有一些参数：</td><td valign="top" style="font-size: 13px; line-height: 20px"><p>it causes the server to output general-purpose statistics and<br />settings, documented below. In the other form it has some arguments:</p><br /></td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">stats &lt;args&gt;&#92;r&#92;n</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">通过&lt;args&gt;，服务器传回各种内部数据。因为随时可能发生变动，本文不提供参数的种类及其传回数据。</td><td valign="top" style="font-size: 13px; line-height: 20px">Depending on &lt;args&gt;, various internal data is sent by the server. The<br />kinds of arguments and the data sent are not documented in this vesion<br />of the protocol, and are subject to change for the convenience of<br />memcache developers.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr><tr><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">各种状态</span></h5></td><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">General-purpose statistics</span></h5></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">受到无参数的&quot;stats&quot;命令后，服务器发送多行内容，如下：</td><td valign="top" style="font-size: 13px; line-height: 20px">Upon receiving the &quot;stats&quot; command without arguments, the server sents<br />a number of lines which look like this:</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">STAT &lt;name&gt; &lt;value&gt;&#92;r&#92;n</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">服务器用以下一行来终止这个清单：</td><td valign="top" style="font-size: 13px; line-height: 20px">The server terminates this list with the line</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">END&#92;r&#92;n</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">在每行状态中，&lt;name&gt; 是状态的名字，&lt;value&gt; 使状态的数据。 以下清单，是所有的状态名称，数据类型，和数据代表的含义。<br /></td><td valign="top" style="font-size: 13px; line-height: 20px">In each line of statistics, &lt;name&gt; is the name of this statistic, and<br />&lt;value&gt; is the data. The following is the list of all names sent in<br />response to the &quot;stats&quot; command, together with the type of the value<br />sent for this name, and the meaning of the value.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">在&ldquo;类型&rdquo;一列中，&quot;32u&quot;表示32位无符号整型，&quot;64u&quot;表示64位无符号整型，&quot;32u:32u&quot;表示用冒号隔开的两个32位无符号整型。</td><td valign="top" style="font-size: 13px; line-height: 20px"><p>In the type column below, &quot;32u&quot; means a 32-bit unsigned integer, &quot;64u&quot;<br />means a 64-bit unsigner integer. '32u:32u' means two 32-but unsigned<br />integers separated by a colon.</p></td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px"><table border="0" cellspacing="0" cellpadding="0" width="94%" bgcolor="#003366"><tbody><tr><td><table border="0" cellspacing="1" cellpadding="2" width="100%" style="font-size: 13px; line-height: 20px"><tbody><tr><td width="100" align="center" valign="top" style="color: #336600" bgcolor="#cc9933"><strong><span style="font-size: 13px; line-height: 20px">名称/Name</span></strong></td><td width="80" align="center" valign="top" style="color: #336600" bgcolor="#cc9933"><strong><span style="font-size: 13px; line-height: 20px">类型/Type</span></strong></td><td colspan="2" align="center" valign="top" style="color: #336600" bgcolor="#cc9933"><strong><span style="font-size: 13px; line-height: 20px">含义/</span></strong><strong>Meaning</strong></td></tr><tr><td valign="top" bgcolor="#ffe3aa">pid</td><td valign="top" bgcolor="#ffe3aa">32u</td><td valign="top" bgcolor="#ffe3aa">服务器进程ID</td><td valign="top" bgcolor="#ffe3aa">Process id of this server process</td></tr><tr><td valign="top" bgcolor="#ffe3aa">uptime</td><td valign="top" bgcolor="#ffe3aa">32u</td><td valign="top" bgcolor="#ffe3aa">服务器运行时间，单位秒</td><td valign="top" bgcolor="#ffe3aa">Number of seconds this server has been running</td></tr><tr><td valign="top" bgcolor="#ffe3aa">time</td><td valign="top" bgcolor="#ffe3aa">32u</td><td valign="top" bgcolor="#ffe3aa">服务器当前的UNIX时间</td><td valign="top" bgcolor="#ffe3aa">current UNIX time according to the server</td></tr><tr><td valign="top" bgcolor="#ffe3aa">version</td><td valign="top" bgcolor="#ffe3aa">string</td><td valign="top" bgcolor="#ffe3aa">服务器的版本号</td><td valign="top" bgcolor="#ffe3aa">Version string of this server</td></tr><tr><td valign="top" bgcolor="#ffe3aa">rusage_user</td><td valign="top" bgcolor="#ffe3aa">32u:32u</td><td valign="top" bgcolor="#ffe3aa">该进程累计的用户时间<br />(秒:微妙)</td><td valign="top" bgcolor="#ffe3aa">Accumulated user time for this process <br />(seconds:microseconds)</td></tr><tr><td valign="top" bgcolor="#ffe3aa">rusage_system</td><td valign="top" bgcolor="#ffe3aa">32u:32u</td><td valign="top" bgcolor="#ffe3aa">该进程累计的系统时间 <br />(秒:微妙)</td><td valign="top" bgcolor="#ffe3aa">Accumulated system time for this process <br />(seconds:microseconds)</td></tr><tr><td valign="top" bgcolor="#ffe3aa">curr_items</td><td valign="top" bgcolor="#ffe3aa">32u</td><td valign="top" bgcolor="#ffe3aa">服务器当前存储的内容数量</td><td valign="top" bgcolor="#ffe3aa">Current number of items stored by the server</td></tr><tr><td valign="top" bgcolor="#ffe3aa">total_items</td><td valign="top" bgcolor="#ffe3aa">32u</td><td valign="top" bgcolor="#ffe3aa">服务器启动以来存储过的内容总数</td><td valign="top" bgcolor="#ffe3aa">Total number of items stored by this server <br />ever since it started</td></tr><tr><td valign="top" bgcolor="#ffe3aa">bytes</td><td valign="top" bgcolor="#ffe3aa">64u</td><td valign="top" bgcolor="#ffe3aa">服务器当前存储内容所占用的字节数</td><td valign="top" bgcolor="#ffe3aa">Current number of bytes used by this server <br />to store items</td></tr><tr><td valign="top" bgcolor="#ffe3aa">curr_connections</td><td valign="top" bgcolor="#ffe3aa">32u</td><td valign="top" bgcolor="#ffe3aa">连接数量</td><td valign="top" bgcolor="#ffe3aa">Number of open connections</td></tr><tr><td valign="top" bgcolor="#ffe3aa">total_connections</td><td valign="top" bgcolor="#ffe3aa">32u</td><td valign="top" bgcolor="#ffe3aa">服务器运行以来接受的连接总数</td><td valign="top" bgcolor="#ffe3aa">Total number of connections opened since <br />the server started running</td></tr><tr><td valign="top" bgcolor="#ffe3aa">connection_structures</td><td valign="top" bgcolor="#ffe3aa">32u</td><td valign="top" bgcolor="#ffe3aa">服务器分配的连接结构的数量</td><td valign="top" bgcolor="#ffe3aa">Number of connection structures allocated <br />by the server</td></tr><tr><td valign="top" bgcolor="#ffe3aa">cmd_get</td><td valign="top" bgcolor="#ffe3aa">32u</td><td valign="top" bgcolor="#ffe3aa">取回请求总数</td><td valign="top" bgcolor="#ffe3aa">Cumulative number of retrieval requests</td></tr><tr><td valign="top" bgcolor="#ffe3aa">cmd_set</td><td valign="top" bgcolor="#ffe3aa">32u</td><td valign="top" bgcolor="#ffe3aa">存储请求总数</td><td valign="top" bgcolor="#ffe3aa">Cumulative number of storage requests</td></tr><tr><td valign="top" bgcolor="#ffe3aa">get_hits</td><td valign="top" bgcolor="#ffe3aa">32u</td><td valign="top" bgcolor="#ffe3aa">请求成功的总次数</td><td valign="top" bgcolor="#ffe3aa">Number of keys that have been requested and <br />found present</td></tr><tr><td valign="top" bgcolor="#ffe3aa">get_misses</td><td valign="top" bgcolor="#ffe3aa">32u</td><td valign="top" bgcolor="#ffe3aa">请求失败的总次数</td><td valign="top" bgcolor="#ffe3aa">Number of items that have been requested <br />and not found</td></tr><tr><td valign="top" bgcolor="#ffe3aa">bytes_read</td><td valign="top" bgcolor="#ffe3aa">64u</td><td valign="top" bgcolor="#ffe3aa">服务器从网络读取到的总字节数</td><td valign="top" bgcolor="#ffe3aa">Total number of bytes read by this server <br />from network</td></tr><tr><td valign="top" bgcolor="#ffe3aa">bytes_written</td><td valign="top" bgcolor="#ffe3aa">64u</td><td valign="top" bgcolor="#ffe3aa">服务器向网络发送的总字节数</td><td valign="top" bgcolor="#ffe3aa">Total number of bytes sent by this server to <br />network</td></tr><tr><td valign="top" bgcolor="#ffe3aa">limit_maxbytes</td><td valign="top" bgcolor="#ffe3aa">32u</td><td valign="top" bgcolor="#ffe3aa">服务器在存储时被允许使用的字节总数</td><td valign="top" bgcolor="#ffe3aa">Number of bytes this server is allowed to<br />use for storage. </td></tr></tbody></table></td></tr></tbody></table></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr><tr><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">其它命令</span></h5></td><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">Other commands</span></h5></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px"><p>&ldquo;flush_all&rdquo;命令有一个可选的数字参数。它总是执行成功，服务器会发送&ldquo;OK&#92;r&#92;n&rdquo;回应。它的效果是使已经存在的项目立即失效（缺省），或在指定的时间后。此后执行取回命令，将不会有任何内容返回（除非重新存储同样的键名）。flush_all 实际上没有立即释放项目所占用的内存，而是在随后陆续有新的项目被储存时执行。flush_all 效果具体如下：它导致所有更新时间早于flush_all所设定时间的项目，在被执行取回命令时命令被忽略。</p></td><td valign="top" style="font-size: 13px; line-height: 20px">&quot;flush_all&quot; is a command with an optional numeric argument. It always succeeds, and the server sends &quot;OK&#92;r&#92;n&quot; in response. Its effect is to invalidate all existing items immediately (by default) or after the expiration specified. After invalidation none of the items will be returned in response to a retrieval command (unless it's stored again under the same key *after* flush_all has invalidated the items). flush_all doesn't actually free all the memory taken up by existing items; that will happen gradually as new items are stored. The most precise definition of what flush_all does is the following: it causes all items whose update time is earlier than the time at which flush_all was set to be executed to be ignored for retrieval purposes.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&ldquo;version&rdquo;命令没有参数：</td><td valign="top" style="font-size: 13px; line-height: 20px">&quot;version&quot; is a command with no arguments:</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">version&#92;r&#92;n</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">在回应中，服务器发送：</td><td valign="top" style="font-size: 13px; line-height: 20px">In response, the server sends</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">&quot;VERSION &lt;version&gt;&#92;r&#92;n&quot;</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&lt;version&gt; 是服务器的版本字串。</td><td valign="top" style="font-size: 13px; line-height: 20px">where &lt;version&gt; is the version string for the server.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&ldquo;quit&rdquo;命令没有参数：</td><td valign="top" style="font-size: 13px; line-height: 20px">&quot;quit&quot; is a command with no arguments:</td></tr><tr><td colspan="2" valign="top" style="font-size: 13px; line-height: 20px" bgcolor="#cccccc">quit&#92;r&#92;n</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">接收此命令后，服务器关闭连接。不过，客户端可以在不再需要时，简单地关闭连接就行，并不一定需要发送这个命令。</td><td valign="top" style="font-size: 13px; line-height: 20px">Upon receiving this command, the server closes the connection. However, the client may also simply close the connection when it no longer needs it, without issuing this command.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr><tr><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">UDP 协议</span></h5></td><td valign="top" style="color: #336600"><h5><span style="font-size: 13px; line-height: 20px">UDP protocol</span></h5></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">当来自客户端的连接数远大于TCP连接的上限时，可以使用基于UDP的接口。UDP接口不能保证传输到位，所以只有在不要求成功的操作中使用；比如被用于一个&ldquo;get&rdquo;请求时，会因不当的缓存处理而发生错误或回应有遗失。</td><td valign="top" style="font-size: 13px; line-height: 20px">For very large installations where the number of clients is high enough that the number of TCP connections causes scaling difficulties, there is also a UDP-based interface. The UDP interface does not provide guaranteed delivery, so should only be used for operations that aren't required to succeed; typically it is used for &quot;get&quot; requests where a missing or incomplete response can simply be treated as a cache miss.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">每个UDP数据包都包含一个简单的帧头，数据之后的内容与TCP协议的描述类似。在执行所产生的数据流中，请求必须被包含在单独的一个UDP数据包中，但是回应可能跨越多个数据包。（只有&ldquo;get&rdquo;和&ldquo;set&rdquo;请求例外，跨越了多个数据包）</td><td valign="top" style="font-size: 13px; line-height: 20px">Each UDP datagram contains a simple frame header, followed by data in the same format as the TCP protocol described above. In the current implementation, requests must be contained in a single UDP datagram, but responses may span several datagrams. (The only common requests that would span multiple datagrams are huge multi-key &quot;get&quot; requests and &quot;set&quot; requests, both of which are more suitable to TCP transport for reliability reasons anyway.)</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">帧头有8字节长，如下（均由16位整数组成，网络字节顺序，高位在前）：</td><td valign="top" style="font-size: 13px; line-height: 20px">The frame header is 8 bytes long, as follows (all values are 16-bit integers in network byte order, high byte first):</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px"><ul><li>0-1 请求ID </li><li>2-3 序号 </li><li>4-5 该信息的数据包总数 </li><li>6-7 保留位，必须为0</li></ul></td><td valign="top" style="font-size: 13px; line-height: 20px"><ul><li>0-1 Request ID </li><li>2-3 Sequence number </li><li>4-5 Total number of datagrams in this message </li><li>6-7 Reserved for future use; must be 0</li></ul></td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">请求ID有客户端提供。一般它会是一个从随机基数开始的递增值，不过客户端想用什么样的请求ID都可以。服务器的回应会包含一个和请求中的同样的ID。客户端使用请求ID来区分每一个回应。任何一个没有请求ID的数据包，可能是之前的请求遭到延迟而造成的，应该被丢弃。</td><td valign="top" style="font-size: 13px; line-height: 20px">The request ID is supplied by the client. Typically it will be a monotonically increasing value starting from a random seed, but the client is free to use whatever request IDs it likes. The server's response will contain the same ID as the incoming request. The client uses the request ID to differentiate between responses to outstanding requests if there are several pending from the same server; any datagrams with an unknown request ID are probably delayed responses to an earlier request and should be discarded.</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">序号的返回是从0到n-1，n是该条信息的数据包数量。</td><td valign="top" style="font-size: 13px; line-height: 20px">The sequence number ranges from 0 to n-1, where n is the total number of datagrams in the message. The client should concatenate the payloads of the datagrams for a given response in sequence number order; the resulting byte stream will contain a complete response in the same format as the TCP protocol (including terminating &#92;r&#92;n sequences).</td></tr><tr><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td><td valign="top" style="font-size: 13px; line-height: 20px">&nbsp;</td></tr></tbody></table><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/memcache/" rel="tag">memcache</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%258D%258F%25E8%25AE%25AE/" rel="tag">协议</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%258A%25A0%25E9%2580%259F/" rel="tag">加速</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/429.htm</link>
<title><![CDATA[在 ZendStudio 中开启 PHP 5.2.x 环境的远程调试功能]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 10 Sep 2007 14:59:23 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/429.htm</guid> 
<description>
<![CDATA[ 
	以前每当一个 ZendStudio 的新版本发布时都会同时发布一个新版的 ZendStudioServer 组件，这个组件可以让我们很方便地进行远程调试。但是自从 Zend 发布了 ZendPlatform 以后他们就不再更新 ZendStudioServer 组件了。这就导致我们只能远程调试 PHP 5.1.x 的环境，而不能调试 PHP 5.2.x。要想调试 PHP 5.2.x 只能装一个庞大的 ZendPlatform。：（ <br/><br/>因此我一直在找一个“轻量级”的解决方案。最近在 Zend.com 发现一个好东西：ZendDebugger-5.2.3-Windows-i386.zip，直觉告诉我，这就是我想要的。果不其然，今天试验成功！<br/><br/>下面就说一说我的试验步骤：<br/><br/>1. 到这里下载 <a href="http://downloads.zend.com/pdt/server-debugger/ZendDebugger-5.2.3-Windows-i386.zip" target="_blank">ZendDebugger-5.2.3-Windows-i386.zip</a>，然后将其解压到某一目录，比如：C:&#92;Program Files&#92;Zend，这就会在该目录里面新建一个 ZendDebugger-5.2.3-Windows-i386 子目录，里面有 4_3_x_comp、4_4_x_comp、5_2_x_comp 等目录，将这些 x_y_z_comp 分别改为 php-x.y.z（比如将目录 5_2_x_comp 改为 php-5.2.x）； <br/><br/>2. 确保已经加载了 Zend Extension Manager，如果安装了 Zend Optimizer 则会自动安装 Zend Extension Manager，若没有安装请先安装 Zend Optimizer 。或者你可以把 Zend Optimizer 中 ZendExtensionManager.dll 给提取出来，然后手工在 php.ini 中添加一行：<br/><br/>zend_extension_ts=”C:&#92;Program Files&#92;Zend&#92;ZendOptimizer&#92;ZendExtensionManager.dll”<br/>其中 ZendExtensionManager.dll 的位置请根据你的实际情况填写； <br/><br/>3. 在 Web Server 的 php.ini 添加下面几行：<br/><br/>zend_extension_manager.debug_server_ts="C:&#92;Program Files&#92;Zend&#92;ZendDebugger-5.2.3-Windows-i386"<br/>zend_debugger.expose_remotely=allowed_hosts<br/>zend_debugger.allow_hosts=127.0.0.1/32,192.168.1.0/24,192.168.1.0/24<br/>zend_debugger.allow_tunnel=127.0.0.1/32 <br/><br/>zend_extension_manager.debug_server_ts 的值请根据你的实际情况填写，就是 php-x.y.z 的父目录。<br/><br/>4. 把 ZendDebugger-5.2.3-Windows-i386 目录下的 dummy.php 复制到你的 Web 站点根目录。<br/><br/>5. 重启你的 Web Server，OK！<br/><br/>简单总结一下：Zend Studio 的远程调试是由 ZendStudioServer 组件（ZendDebuger.dll）提供的。本质上这是一个 Zend 扩展，因此你只要能把这个 Zend 扩展启用就可以了。只是 Zend 公司出品的 Zend 扩展只能由那个 Zend Extension Manager 负责加载，所以我们才需要做一些额外的步骤，否则只需简单地加一行 zend_extension_ts = xxxxxx 而已。<br/><br/>检查解决：<br/><br/>先看一下 phpinfo() 里面有没有“with Zend Extension Manager v1.x.x, Copyright (c) 2003-2006, by Zend Technologies“，若没有则说明没有正确加载 Zend Extension Manager，您需要先加载一下。方法见步骤2。然后再看有没有“ with Zend Debugger v5.2.3, Copyright (c) 1999-2006, by Zend Technologies” 这句话。没有则说明没有加载 Zend Debugger。请再设法加载 Zend Debugger 。<br/><br/>总之，一步一步来，先确认问题在哪里然后才好解决。：）<br/><br/>使用：<br/><br/>在 Zend Studio 【Debug】–>“Debug URL（选中下面的“The Server”复选框）” 填写dummy.php的页面地址保存即可。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/zend/" rel="tag">zend</a> , <a href="http://www.gaobo.info/go.php/tags/studio/" rel="tag">studio</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%258E%25AF%25E5%25A2%2583/" rel="tag">环境</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25BF%259C%25E7%25A8%258B%25E8%25B0%2583%25E8%25AF%2595/" rel="tag">远程调试</a> , <a href="http://www.gaobo.info/go.php/tags/debug/" rel="tag">debug</a> , <a href="http://www.gaobo.info/go.php/tags/platform/" rel="tag">platform</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/417.htm</link>
<title><![CDATA[两段建立xmlHTTP对象的代码]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 02 Aug 2007 03:37:25 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/417.htm</guid> 
<description>
<![CDATA[ 
	为了兼容常见的浏览器的话，可以考虑用下边两段代码之一：<br/><div class="code"><br/> &nbsp;function CreateXMLHttp()<br/> &nbsp;&#123;<br/> &nbsp; xmlHttp = false;<br/> &nbsp; if(typeof XMLHttpRequest != &#039;undefined&#039;)<br/> &nbsp; &#123;<br/> &nbsp; &nbsp;var xmlHttp = new XMLHttpRequest();<br/> &nbsp; &nbsp;return xmlHttp;<br/> &nbsp; &#125;else if(window.ActiveXObject)<br/> &nbsp; &#123; &nbsp;<br/> &nbsp; &nbsp;var IEXMLHttpVersion = &#91;&quot;MSXML2.XMLHttp.4.0&quot;,&quot;MSXML2.XMLHttp.3.0&quot;,&quot;MSXML2.XMLHttp&quot;,&quot;Microsoft.XMLHttp&quot;&#93;;<br/> &nbsp; &nbsp;//for Microsoft Internet Explorer<br/> &nbsp; &nbsp;for(var i= 0 ;i &lt; IEXMLHttpVersion.length; i++)<br/> &nbsp; &nbsp;&#123;<br/> &nbsp; &nbsp; try<br/> &nbsp; &nbsp; &#123;<br/> &nbsp; &nbsp; &nbsp; &nbsp;var xmlHttp = new ActiveXObject(IEXMLHttpVersion&#91;i&#93;); <br/> &nbsp; &nbsp; &nbsp; &nbsp;return xmlHttp;<br/> &nbsp; &nbsp; &#125;catch(e)<br/> &nbsp; &nbsp; &#123;<br/> &nbsp; &nbsp; &nbsp;//Do nothing<br/> &nbsp; &nbsp; &#125;<br/> &nbsp; &nbsp;&#125;<br/> &nbsp; &nbsp;&#125;else<br/> &nbsp; &nbsp;&#123;<br/> &nbsp; &nbsp; throw new Error(&quot;XMLHttp object could be created.&quot;);<br/> &nbsp; &nbsp;&#125;<br/> &nbsp;&#125;<br/> &nbsp;xmlHttp = CreateXMLHttp();<br/> &nbsp;xmlHttp.setRequestHeader(&quot;Content-Type&quot;,&quot;text/xml&quot;);<br/> &nbsp;xmlHttp.setRequestHeader(&quot;Content-Type&quot;,&quot;gb2312&quot;);</div><br/><br/><div class="code">var xmlHttp=null; <br/>try <br/>&#123; <br/> &nbsp; &nbsp;xmlHttp=new ActiveXObject(&quot;Msxml2.XMLHTTP&quot;) <br/>&#125; <br/>catch(e) <br/>&#123; <br/> &nbsp; &nbsp;try <br/> &nbsp; &nbsp;&#123; <br/> &nbsp; &nbsp; &nbsp; &nbsp;xmlHttp=new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;) <br/> &nbsp; &nbsp;&#125; <br/> &nbsp; &nbsp;catch(oc)<br/> &nbsp; &nbsp;&#123; <br/> &nbsp; &nbsp; &nbsp; &nbsp;xmlHttp=null <br/> &nbsp; &nbsp;&#125; <br/>&#125;<br/> &nbsp; &nbsp; &nbsp; &nbsp; <br/>if ( !xmlHttp &amp;&amp; typeof XMLHttpRequest != &quot;undefined&quot; ) <br/>&#123; <br/> &nbsp; &nbsp;xmlHttp = new XMLHttpRequest() <br/>&#125;</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/xmlhttp/" rel="tag">xmlhttp</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25AF%25B9%25E8%25B1%25A1/" rel="tag">对象</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25B5%258F%25E8%25A7%2588%25E5%2599%25A8/" rel="tag">浏览器</a> , <a href="http://www.gaobo.info/go.php/tags/msxml/" rel="tag">msxml</a> , <a href="http://www.gaobo.info/go.php/tags/ie/" rel="tag">ie</a> , <a href="http://www.gaobo.info/go.php/tags/firefox/" rel="tag">firefox</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/412.htm</link>
<title><![CDATA[EA 0.95 for PHP5/PHP4]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sun, 15 Jul 2007 01:10:40 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/412.htm</guid> 
<description>
<![CDATA[ 
	之前用过eAccelerator（以下简称EA），觉得优化的速度和效果都还算不错，尤其是Discuz!论坛的页面执行时间，多数情况下能够提高一个数量级，实属难能可贵，呵呵。不过在php主版本号步进到5以后，似乎很久没看到EA更新了，即使有貌似也不稳定。昨天在几个地方看到帖子，于是来记录一笔，以待有机会进行大负载测试，行得通的话就上Server使用，呵呵。<br/>下载：<br/><a href="http://www.sitebuddy.com/PHP/Accelerators/eAccelerator_windows_binaries_builds" target="_blank">eAccelerator binaries for PHP 5.x (windows builds)</a><br/><a href="http://www.sitebuddy.com/PHP/Accelerators/eAccelerator_windows_binaries_builds_php_4" target="_blank">eAccelerator binaries for PHP 4.x (windows builds)</a><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>Zend Optimizer 是Zend官方发布的免费PHP优化器，国内外大多数用户对这一产品的唯一评价是“Zend Loader”。这种说法是因为该产品所谓的优化只是提供了一个页面压缩输出功能，其最主要的目的是为Zend相继推出的PHP代码“混淆器”铺桥搭路，让混淆后的PHP代码可以在计算机上得到执行。如果您打算真正获得高效PHP缓存，建议您选择 eaccelerator 。<br/><br/>Zend的市场推广能力非常之强，这样致使国内外大多数人采用Zend混淆器加密PHP代码。如果想使用被Zend混淆器加密过的代码，那么你必须安装Zend Optimizer。这就引出了我们的主要问题，如何既可以获得执行Zend混淆器加密代码的能力，又可以获得 eaccelerator 的高效率优化。<br/><br/>值得庆幸的是 eaccelerator 提供了对Zend扩展界面的支持，它可以和Zend Optimizer和平相处。让您轻松达到 “既可以获得执行Zend混淆器加密代码的能力，又可以获得 eaccelerator 的高效率优化”的目的。<br/><br/>我习惯性以ZEND扩展的方式配置该模块，下面是我使用的配置（官方标配）：<br/><br/>在PHP.INI文件段，eaccelerator的配置内容写在Zend Optimizer之前，并做如下配置：<br/><br/>[Zend]<br/>zend_extension_ts="d:&#92;xampp&#92;xampp&#92;php&#92;ext&#92;eAccelerator.dll"<br/>;eAccelerator加速器路径部分PHP版本此处使用 zend_extension<br/>eaccelerator.shm_size="16"<br/>;eAccelerator使用的内存<br/>eaccelerator.cache_dir="D:&#92;xampp&#92;xampp&#92;tmp"<br/>;eAccelerator缓冲目录，记得给web server可读写权限。<br/>eaccelerator.enable="1"<br/>;eAccelerator是否启用<br/>eaccelerator.optimizer="1"<br/>;eAccelerator优化功能<br/>eaccelerator.check_mtime="1"<br/>eaccelerator.debug="0"<br/>eaccelerator.filter=""<br/>eaccelerator.shm_max="0"<br/>eaccelerator.shm_ttl="0"<br/>eaccelerator.shm_prune_period="0"<br/>eaccelerator.shm_only="0"<br/>eaccelerator.compress="1"<br/>eaccelerator.compress_level="9"<br/>zend_extension_ts = "d:&#92;xampp&#92;xampp&#92;php&#92;zendOptimizer&#92;lib&#92;ZendExtensionManager.dll"<br/>zend_extension_manager.optimizer_ts = "d:&#92;xampp&#92;xampp&#92;php&#92;zendOptimizer&#92;lib&#92;Optimizer"<br/>;zend_optimizer.enable_loader = 1<br/>;开启Zend Loader以解析Zend混淆器加密过的PHP代码。默认开启，此行配置只是起到说明作用。<br/>zend_optimizer.optimization_level=1023<br/>;禁止优化功能，避免冲突。<br/>;zend_optimizer.optimization_level=15<br/>;zend_optimizer.license_path =<br/></div></div><br/><br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>eAccelerator php.ini 设置<br/><br/>;extension="eaccelerator.so"<br/>zend_extension="/usr/lib/php4/eaccelerator.so"<br/>;zend_extension_ts="/usr/lib/php4/eaccelerator.so"<br/>;extension="eaccelerator.dll"<br/>;zend_extension_ts="c:&#92;php4&#92;eaccelerator.dll"<br/>;zend_extension="c:&#92;php4&#92;eaccelerator.dll" <br/>您必须取消一条注释 (而且同时只能是一条被取消) 以便使用下面的描述来装载 eAccelerator 的扩展.<br/>eAccelerator 兼容于 Zend Optimizer's loader. Zend Optimizer 在 eAccelerator 的安装结束进行后必须在 php.ini 中配置. 如果您不使用用脚本来编码的 Zend Encoder ,那么我们不推荐您安装成 Zend Optimizer 加上 eAccelerator 这种模式.<br/><br/>eaccelerator.shm_size = "64" <br/>eAccelerator 可以使用的共享内存的数量 (以兆为单位) . "0" 是指操作系统的默认值. 默认值是 "0".<br/><br/>eaccelerator.cache_dir = "/tmp/eaccelerator" <br/>这个目录是给磁盘缓存使用. eAccelerator 在这里储存预先编译好的代码, 进程数据, 内容以及用户的自定义内容. 同样的数据也能被储存在共享内存中 (这样可以提高访问速度). 默认的设置是 "/tmp/eaccelerator".<br/><br/>eaccelerator.enable = "1" <br/>打开或者关闭 eAccelerator. "1" 是指打开, "0" 是指关闭. 默认值是 "1".<br/><br/>eaccelerator.optimizer = "1" <br/>打开或者关闭内置的 peephole optimizer,它可以提高代码的执行速度. "1" 是指打开, "0" 是指关闭. 默认值是 "1".<br/><br/>eaccelerator.debug = "0" <br/>打开或者关闭调试记录. "1" 是指打开, "0" 是指关闭. 默认值是 "0".<br/><br/>eaccelerator.check_mtime = "1" <br/>打开或者关闭 PHP 的文件修改检查. "1" 是指打开, "0" 是指关闭. 如果您在修改以后重新编译 PHP 的文件,那么您应当设置为 "1". 默认值是 "1".<br/><br/>eaccelerator.filter = "" <br/>决定哪些 PHP 文件应该被缓存. 您可以指定一个范围 (比如 "*.php *.phtml"),这样被指定的文件就会被缓存或者被排出在外. 如果使用字符 "!" 来指定这个范围, 符合这个范围的文件就被排出在外. 默认值是 "" ,意思是说 - 所有的 PHP 脚本都会被缓存.<br/><br/>eaccelerator.shm_max = "0" <br/>利用 "eaccelerator_put()" 这个功能选项来关闭在共享内存中加载大量数据. 它指出最大的被允许的大小，以字节为单位 (10240, 10K, 1M). 使用 "0" 来关闭这个限制. 默认值是 "0".<br/><br/>eaccelerator.shm_ttl = "0" <br/>当 eAccelerator 尝试从共享内存中获得数据来创建新的脚本缓存但失败以后,它从共享内存中删除所有的至少在 "shm_ttl" 秒以前没有被访问的脚本。默认值是 "0" ,意思是说 - 不要从共享内存中删除任何文件.<br/><br/>eaccelerator.shm_prune_period = "0" <br/>当 eAccelerator 尝试从共享内存中获得数据来创建新的脚本缓存但失败以后,它尝试删除旧的脚本，前提是在这之前的这个尝试在超过 "shm_prune_period" 秒之前被执行. 默认值是 "0" ,意思是说 - 不要尝试从共享内存中删除任何文件.<br/><br/>eaccelerator.shm_only = "0" <br/>打开或者关闭在磁盘上缓存编译过的脚本. 这个参数对会话数据和内容缓存没有效果. 默认值是 "0" ,意思是说 - 使用磁盘和共享内存来缓存。<br/><br/>eaccelerator.compress = "1" <br/>打开或者关闭缓存后的内容压缩. 默认值是 "1" ,意思是说打开压缩.<br/><br/>eaccelerator.compress_level = "9" <br/>内容缓存后被压缩的程度. 默认值是 "9" ,意思是说使用最大程度的压缩率。<br/><br/>eaccelerator.keys = "shm_and_disk"<br/>eaccelerator.sessions = "shm_and_disk"<br/>eaccelerator.c <br/>决定哪些 keys, 会话数据和内容被缓存. 可能的值是:<br/>"shm_and_disk", 在共享内存中和磁盘上缓存数据 (默认值)<br/>"shm", 在共享内存中或者磁盘上缓存数据,如果共享内存被使用的尺寸已经超过 "eaccelerator.shm_max" 所定义的范围。<br/>"shm_only", 在共享内存中缓存数据<br/>"disk_only", 在磁盘上缓存数据<br/>"none", 不缓存任何数据<br/><br/>eaccelerator.admin.name="yourusername"<br/>eaccelerator.admin.password="yourpassword" <br/>您可以使用 eaccelerator.php 通过网页的页面来管理 eAccelerator. 您应该把这个文件放在您的网站上. 为了安全,推荐您不要通过您本地的IP地址来访问这个脚本。<br/><br/>创建 eAccelerator 的密码<br/><br/>php -q eaccelerator_password.php<br/>改变网页页面方式访问 (eaccelerator.php)这个文件的访问密码<br/><br/>Enter admin name: admin<br/>New admin password: eaccelerator<br/>Retype new admin password: eaccelerator<br/></div></div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/eaccelerator/" rel="tag">eaccelerator</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/zend/" rel="tag">zend</a> , <a href="http://www.gaobo.info/go.php/tags/discuz/" rel="tag">discuz</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%259C%258D%25E5%258A%25A1%25E5%2599%25A8/" rel="tag">服务器</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25BC%2598%25E5%258C%2596/" rel="tag">优化</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/401.htm</link>
<title><![CDATA[把Zend Studio 5.5改为简体中文版的办法]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 18 May 2007 01:06:16 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/401.htm</guid> 
<description>
<![CDATA[ 
	每次装完Zend Stuidio5.5发现都是英文的，倒不是英文的看不懂，只是觉得不太方便，于是发现了将其改为简体中文版的方法：<br/>在&#123;X&#125;:&#92;Documents and Settings&#92;&#123;User&#125;&#92;ZDE&#92;config_5.&#123;x&#125;&#92;desktop_options.xml文件中，找到如下代码：<br/><div class="code">&lt;customized_property ID=&quot;desktop.language&quot;&gt;<br/>&lt;locale language=&quot;en&quot; country=&quot;&quot; variant=&quot;&quot;/&gt;<br/>&lt;/customized_property&gt;</div><br/>将en改为zh，重启zend后就可以了，最后记得把那文件改为只读。<br/><br/><strong>Zend Studio 5.5下载地址</strong>：<br/><a href="http://www.crsky.com/soft/5453.html" target="_blank">http://www.crsky.com/soft/5453.html</a><br/><a href="http://down.chinaz.com/s/2635.asp" target="_blank">http://down.chinaz.com/s/2635.asp</a><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/zend/" rel="tag">zend</a> , <a href="http://www.gaobo.info/go.php/tags/studio/" rel="tag">studio</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25AE%2580%25E4%25BD%2593/" rel="tag">简体</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25B8%25AD%25E6%2596%2587%25E7%2589%2588/" rel="tag">中文版</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/400.htm</link>
<title><![CDATA[Mysql联合多表更新和删除]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 18 May 2007 00:29:30 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/400.htm</guid> 
<description>
<![CDATA[ 
	（节选自mysql手册）<br/><strong>多表更新</strong><br/>在 MySQL 3.23 中，你可以使用 LIMIT # 来确保只有给定的记录行数目被更改。 <br/>如果一个 ORDER BY 子句被使用(从 MySQL 4.0.0 开始支持)，记录行将以指定的次序被更新。这实际上只有连同 LIMIT 一起才有用。<br/>从 MySQL 4.0.4 开始，你也可以执行一个包含多个表的 UPDATE 的操作： <br/><div class="code">UPDATE items,month SET items.price=month.price<br/>WHERE items.id=month.id;</div><br/>注意：多表 UPDATE 不可以使用 ORDER BY 或 LIMIT。 <br/><br/><strong>多表删除</strong><br/>第一个多表删除格式从 MySQL 4.0.0 开始被支持。第二个多表删除格式从 MySQL 4.0.2 开始被支持。<br/>仅仅在 FROM 或 USING 子句 之前 列出的表中的匹配记录行被删除。效果就是，你要以从多个表中同时删除记录行，并且同样可以有其它的表用于检索。 <br/>在表名后的 .* 仅仅是为了兼容 Access： <br/><div class="code">DELETE t1,t2 FROM t1,t2,t3 WHERE t1.id=t2.id AND t2.id=t3.id</div><br/>or<br/><div class="code">DELETE FROM t1,t2 USING t1,t2,t3 WHERE t1.id=t2.id AND t2.id=t3.id</div><br/>在上面的情况下，我们仅仅从 t1 和 t2 表中删除匹配的记录行。 <br/>如果一个 ORDER BY 子句被使用(从 MySQL 4.0.0 开始支持), 记录行将以指定的次序删除。这实际上只有连同 LIMIT 一起才有用。示例如下： <br/><div class="code">DELETE FROM somelog<br/>WHERE user = &#039;jcole&#039;<br/>ORDER BY timestamp<br/>LIMIT 1</div><br/>这将删除匹配 WHERE 子句的，并且最早被插入(通过 timestamp 来确定)的记录行。 <br/>DELETE 语句的LIMIT rows 选项是 MySQL 特有的，它告诉服务器在控制权被返回到客户端之前可被删除的最大记录行数目。这可以用来确保一个特定的 DELETE 命令不会占用太长的时间。你可以简单地重复使用 DELETE 命令，直到被影响的记录行数目小于 LIMIT 值。 <br/>从 MySQL 4.0 开始，在 DELETE 语句中可以指定多个表，用以从一个表中删除依赖于多表中的特殊情况的记录行。然而，在一个多表删除中，不能使用 ORDER BY 或 LIMIT。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%2581%2594%25E5%2590%2588/" rel="tag">联合</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25A4%259A%25E8%25A1%25A8/" rel="tag">多表</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%259B%25B4%25E6%2596%25B0/" rel="tag">更新</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2588%25A0%25E9%2599%25A4/" rel="tag">删除</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/394.htm</link>
<title><![CDATA[PHP连接PostgreSQL]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 25 Apr 2007 10:28:31 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/394.htm</guid> 
<description>
<![CDATA[ 
	主要有以下四种方法：<br/>1、用adodb联结：<br/><div class="code">&lt;?php<br/>Session_Start();<br/>$user=$_POST&#91;&quot;user&quot;&#93;;<br/>$pwd=$_POST&#91;&quot;pwd&quot;&#93;;<br/>if(isset($user)) &#123;<br/>$_SESSION&#91;&quot;user&quot;&#93;=$user;<br/>$_SESSION&#91;&quot;pwd&quot;&#93;=$pwd;&#125;;<br/>session_write_close ();<br/>error_reporting(0);<br/>include_once(&#039;/usr/share/php/adodb/adodb-errorhandler.inc.php&#039;);<br/>include_once(&#039;/usr/share/php/adodb/adodb.inc.php&#039;);<br/>$db =&amp;ADONewConnection(&#039;postgres&#039;); # eg &#039;mysql&#039; or &#039;postgres&#039;<br/>// $db-&gt;debug = true;<br/>$host=&#039;xxx.xxxx.xxx&#039;;<br/>$port=&#039;5432&#039;;<br/>$dbname=&#039;test&#039;;<br/>$user=$_SESSION&#91;&quot;user&quot;&#93;;<br/>$password=$_SESSION&#91;&quot;pwd&quot;&#93;;<br/>$conn_string = &quot;host=$host dbname=$dbname user=$user password=$password port=$port&quot;;<br/>$db-&gt;Connect($conn_string) or die(&quot;can&#039;t connect!&quot;);<br/>?&gt;</div><br/>2、直接联结：<br/><div class="code">&lt;?php<br/>//dl(&#039;pgsql.so&#039;);<br/>Session_Start();<br/>$user=$_POST&#91;&quot;user&quot;&#93;;<br/>$pwd=$_POST&#91;&quot;pwd&quot;&#93;;<br/>if(isset($user)) &#123;<br/>$_SESSION&#91;&quot;user&quot;&#93;=$user;<br/>$_SESSION&#91;&quot;pwd&quot;&#93;=$pwd;&#125;;<br/>session_write_close ();<br/>echo &#039;&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&gt;&#039;;<br/><br/>$host=&#039;xxxx.xxxx.xxxx&#039;;<br/>$port=&#039;5432&#039;;<br/>$dbname=&#039;test&#039;;<br/>$conn_string = &quot;host=$host dbname=$dbname user=$user password=$password port=$port&quot;;<br/>$dbconn = pg_connect($conn_string) or die(&quot;Could not connect&quot;);<br/>if ($dbconn)&#123;echo &#039;ok&#039;;&#125;else&#123;echo &#039;fales&#039;;&#125;;<br/>print_r(pg_version());<br/><br/>$query=&#039;select * from bzzl&#039;;<br/>$rs=pg_query($dbconn,$query);<br/>$fd=pg_fetch_assoc($rs);<br/><br/>echo &quot;&#92;n&quot;;<br/>$myfd=$fd&#91;&#039;dw&#039;&#93;;<br/>echo $myfd;<br/><br/>pg_close($dbconn);<br/>?&gt;</div><br/>3、使用pdo联结：<br/><div class="code">&lt;?php<br/>// Connect to an ODBC database using driver invocation<br/>$htmm=&#039;&lt;html&gt;&#039;;<br/>$htmm.=&#039;&lt;head&gt;&#039;;<br/>$htmm.=&quot;&lt;meta http-equiv=&#039;Content-Type&#039; content=&#039;text/html; charset=UTF-8&#039;&gt;&quot;;<br/>$htmm.=&#039;&lt;title&gt;产品基础数据&lt;/title&gt;&#039;;<br/>$htmm.=&#039;&lt;/head&gt;&#039;;<br/>echo $htmm;<br/>$host=&#039;xxx.xxxx.xxxx&#039;;<br/>$port=&#039;5433&#039;;<br/>$dbname=&#039;test&#039;;<br/>$user=&#039;xxxxxx&#039;;<br/>$password=&#039;xxxxxxxxxxxxx&#039;;<br/>//$cc = &quot;host=$host,dbname=$dbname,port=$port&quot;;<br/>$dsn = &quot;pgsql:host=$host port=$port dbname=$dbname&quot;;<br/><br/><br/>try &#123;<br/>$dbh = new PDO($dsn, $user, $password);<br/>&#125; catch (PDOException $e) &#123;<br/>echo &#039;Connection failed: &#039; . $e-&gt;getMessage();<br/>&#125;<br/>//echo &quot;&lt;p&gt;&quot;;<br/>echo &#039;&lt;table border=1 borderwidth=0&gt;&#039;;<br/>$sql=&#039;select * from cpjcsj&#039;;<br/>print &#039;&lt;tr&gt;&lt;th&gt;产品代码&lt;/th&gt;&lt;th&gt;产品代号&lt;/th&gt;&lt;th&gt;产品名称&lt;/th&gt;&lt;/tr&gt;&#039;;<br/>foreach ($dbh-&gt;query($sql) as $row) &#123;<br/>print &#039;&lt;tr&gt;&lt;td&gt;&#039;.$row&#91;&#039;cpdm&#039;&#93;.&#039;&lt;/td&gt;&#039;;<br/>print &#039;&lt;td&gt;&#039;.$row&#91;&#039;cpdh&#039;&#93; . &#039;&lt;/td&gt;&#039;;<br/>print &#039;&lt;td&gt;&#039;.$row&#91;&#039;cpmc&#039;&#93; . &#039;&lt;/td&gt;&lt;/tr&gt;&#039;;<br/>&#125;<br/>// echo &quot;&lt;/p&gt;&quot;;<br/>echo &quot;&lt;/table&gt;&quot;;<br/>$dbh-&gt;disconnect;<br/>?&gt;</div><br/>4、使用pear-db联结<br/><div class="code">&lt;?php<br/>require_once &#039;DB.php&#039;;<br/><br/>$dsn = array(<br/>&#039;phptype&#039; =&gt; &#039;pgsql&#039;,<br/>&#039;username&#039; =&gt; &#039;xxxxxxxx&#039;,<br/>&#039;password&#039; =&gt; &#039;xxxxxxxxxx&#039;,<br/>&#039;hostspec&#039; =&gt; &#039;xxxx.xxxx.xxxx&#039;,<br/>&#039;database&#039; =&gt; &#039;xxxxx&#039;,<br/>&#039;port&#039; =&gt; &#039;5433&#039;<br/>);<br/><br/>$options = array(<br/>&#039;debug&#039; =&gt; 2,<br/>&#039;portability&#039; =&gt; DB_PORTABILITY_ALL,<br/>);<br/><br/>$db =&amp; new DB;<br/>$conn=$db-&gt;connect($dsn, $options);<br/>if (PEAR::isError($db)) &#123;<br/>die($db-&gt;getMessage());<br/>&#125;else&#123;echo &#039;dbconnect ok&#039;;&#125;<br/>$sql=&#039;select * from cpjcsj;&#039;;<br/>$sth=&amp;$conn-&gt;prepare($sql);<br/>$res=&amp;$conn-&gt;execute($sth);<br/>if (PEAR::isError($res)) &#123;<br/>die($res-&gt;getMessage());&#125;<br/>while ($res-&gt;fetchInto($row)) &#123;<br/>// Assuming DB&#039;s default fetchmode is DB_FETCHMODE_ORDERED<br/>echo $row&#91;1&#93; . &quot;&#92;n&quot;;<br/>&#125;</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25BF%259E%25E6%258E%25A5/" rel="tag">连接</a> , <a href="http://www.gaobo.info/go.php/tags/postgre/" rel="tag">postgre</a> , <a href="http://www.gaobo.info/go.php/tags/sql/" rel="tag">sql</a> , <a href="http://www.gaobo.info/go.php/tags/adodb/" rel="tag">adodb</a> , <a href="http://www.gaobo.info/go.php/tags/pdo/" rel="tag">pdo</a> , <a href="http://www.gaobo.info/go.php/tags/pear/" rel="tag">pear</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/393.htm</link>
<title><![CDATA[MySQL的错误代码详细列表]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sun, 22 Apr 2007 01:08:49 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/393.htm</guid> 
<description>
<![CDATA[ 
	见下文件<br/><a href="attachment/200704/1177204105_0.rar">点击这里下载文件</a><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%2594%2599%25E8%25AF%25AF/" rel="tag">错误</a> , <a href="http://www.gaobo.info/go.php/tags/%25E4%25BB%25A3%25E7%25A0%2581/" rel="tag">代码</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25AF%25A6%25E7%25BB%2586/" rel="tag">详细</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2588%2597%25E8%25A1%25A8/" rel="tag">列表</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/387.htm</link>
<title><![CDATA[SOAP中的字符集编码转换]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 05 Apr 2007 07:12:14 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/387.htm</guid> 
<description>
<![CDATA[ 
	soap通信协议中支持的encoding有utf-8,iso-8859-1,us-ascii，对于我们使用汉字的中国人来说，的确很不方便。<br/>php5中包含了一个soap模块，soapclient可以使用gbk等，soapclient自动完成gbk到utf-8的转换。<br/><div class="code">$client = new SoapClient(&#039;test.wsdl&#039;,array(&#039;encoding&#039; =&gt; &#039;GBK&#039;));</div><br/>soapsevrer就只能是utf-8,iso-8859-1,us-ascii这几种了，如果在soapserver中使用了gbk,就可能会出错。<br/>php4可以使用nusoap，如果是gbk就只能自己转换到utf-8了。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/soap/" rel="tag">soap</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25AD%2597%25E7%25AC%25A6%25E9%259B%2586/" rel="tag">字符集</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25BC%2596%25E7%25A0%2581/" rel="tag">编码</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25BD%25AC%25E6%258D%25A2/" rel="tag">转换</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/386.htm</link>
<title><![CDATA[PHP5中的SOAP方式]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 05 Apr 2007 01:47:38 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/386.htm</guid> 
<description>
<![CDATA[ 
	这里是一个例子<br/>server.php: <br/><div class="code">&lt;?php<br/>function getQuote($fpsecode) &#123; <br/>global $dbh;<br/>$result = array();<br/>try &#123; <br/>$query = &quot;SELECT fprice, fcansale, fbalance, fbaltip FROM tblbalance where upper(trim(fpsecode)) = secode limit 1&quot;;<br/>$stmt = $dbh-&gt;prepare($query);<br/>$stmt-&gt;execute(array(’secode’ =&gt; strtoupper(trim($fpsecode))));<br/>$stmt-&gt;bindColumn(’fprice’, $fprice);<br/>$stmt-&gt;bindColumn(’fcansale’, $fcansale);<br/>$stmt-&gt;bindColumn(’fbalance’, $fbalance);<br/>$stmt-&gt;bindColumn(’fbaltip’, $fbaltip);<br/>while($row = $stmt-&gt;fetch(PDO_FETCH_BOUND)) &#123; <br/>//<br/>&#125;<br/>&#125; catch (PDOException $e) &#123; <br/>echo $e-&gt;getMessage();<br/>&#125;<br/>return $fprice; //你可以返回一个数组<br/>&#125;<br/><br/>$dsn = ’pgsql:host=192.168.*.* port=5432 dbname=db user=123456 password=123456’;<br/>try &#123; <br/>$dbh = new PDO($dsn);<br/>&#125; catch (PDOException $e) &#123; <br/>die(’Connection failed: ’ . $e-&gt;getMessage());<br/>&#125;<br/>ini_set(&quot;soap.wsdl_cache_enabled&quot;, &quot;0&quot;); // disabling WSDL cache<br/>$server = new SoapServer(&quot;stockquote.wsdl&quot;); //配置文件<br/>$server-&gt;addFunction(&quot;getQuote&quot;);<br/>$server-&gt;handle();<br/>?&gt;</div><br/><br/>stockquote.wsdl: <br/><div class="code">&lt;?xml version =’1.0’ encoding =’UTF-8’ ?&gt;<br/>&lt;definitions name=’StockQuote’<br/>targetNamespace=’http://example.org/StockQuote’<br/>xmlns:tns=’ http://example.org/StockQuote ’<br/>xmlns:soap=’http://schemas.xmlsoap.org/wsdl/soap/’<br/>xmlns:xsd=’http://www.w3.org/2001/XMLSchema’<br/>xmlns:soapenc=’http://schemas.xmlsoap.org/soap/encoding/’<br/>xmlns:wsdl=’http://schemas.xmlsoap.org/wsdl/’<br/>xmlns=’http://schemas.xmlsoap.org/wsdl/’&gt;<br/><br/>&lt;message name=’getQuoteRequest’&gt;<br/>&lt;part name=’symbol’ type=’xsd:string’/&gt;<br/>&lt;/message&gt;<br/>&lt;message name=’getQuoteResponse’&gt;<br/>&lt;part name=’Result’ type=’xsd:float’/&gt;<br/>&lt;/message&gt;<br/><br/>&lt;portType name=’StockQuotePortType’&gt;<br/>&lt;operation name=’getQuote’&gt;<br/>&lt;input message=’tns:getQuoteRequest’/&gt;<br/>&lt;output message=’tns:getQuoteResponse’/&gt;<br/>&lt;/operation&gt;<br/>&lt;/portType&gt;<br/><br/>&lt;binding name=’StockQuoteBinding’ type=’tns:StockQuotePortType’&gt;<br/>&lt;soap:binding style=’rpc’<br/>transport=’http://schemas.xmlsoap.org/soap/http’/&gt;<br/>&lt;operation name=’getQuote’&gt;<br/>&lt;soap:operation soapAction=’urn:xmethods-delayed-quotes#getQuote’/&gt;<br/>&lt;input&gt;<br/>&lt;soap:body use=’encoded’ namespace=’urn:xmethods-delayed-quotes’<br/>encodingStyle=’http://schemas.xmlsoap.org/soap/encoding/’/&gt;<br/>&lt;/input&gt;<br/>&lt;output&gt;<br/>&lt;soap:body use=’encoded’ namespace=’urn:xmethods-delayed-quotes’<br/>encodingStyle=’http://schemas.xmlsoap.org/soap/encoding/’/&gt;<br/>&lt;/output&gt;<br/>&lt;/operation&gt;<br/>&lt;/binding&gt;<br/><br/>&lt;service name=’StockQuoteService’&gt;<br/>&lt;port name=’StockQuotePort’ binding=’StockQuoteBinding’&gt;<br/>&lt;soap:address location=’http://192.168.3.9/php5/server.php’/&gt;<br/>&lt;/port&gt;<br/>&lt;/service&gt;<br/>&lt;/definitions&gt;</div><br/><br/>client.php: <br/><div class="code">&lt;?php<br/>$client = new SoapClient(&quot;stockquote.wsdl&quot;);<br/>$result = $client-&gt;getQuote(&quot;nde005&quot;);<br/>print_r($result);<br/>?&gt;</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php5/" rel="tag">php5</a> , <a href="http://www.gaobo.info/go.php/tags/soap/" rel="tag">soap</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/384.htm</link>
<title><![CDATA[PHP实现多服务器共享SESSION数据]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 05 Apr 2007 01:42:06 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/384.htm</guid> 
<description>
<![CDATA[ 
	一、问题起源<br/>稍大一些的网站，通常都会有好几个服务器，每个服务器运行着不同功能的模块，使用不同的二级域名，而一个整体性强的网站，用户系统是统一的，即一套用户名、密码在整个网站的各个模块中都是可以登录使用的。各个服务器共享用户数据是比较容易实现的，只需要在后端放个数据库服务器，各个服务器通过统一接口对用户数据进行访问即可。但还存在一个问题，就是用户在这个服务器登录之后，进入另一个服务器的别的模块时，仍然需要重新登录，这就是一次登录，全部通行的问题，映射到技术上，其实就是各个服务器之间如何实现共享 SESSION 数据的问题。<br/>二、PHP SESSION 的工作原理<br/>在解决问题之前，先来了解一下 PHP SESSION 的工作原理。在客户端（如浏览器）登录网站时，被访问的 PHP 页面可以使用 session_start() 打开 SESSION，这样就会产生客户端的唯一标识 SESSION ID（此 ID 可通过函数 session_id() 获取/设置）。SESSION ID 可以通过两种方式保留在客户端，使得请求不同的页面时，PHP 程序可以获知客户端的 SESSION ID；一种是将 SESSION ID 自动加入到 GET 的 URL 中，或者 POST 的表单中，默认情况下，变量名为 PHPSESSID；另一种是通过 COOKIE，将 SESSION ID 保存在 COOKIE 中，默认情况下，这个 COOKIE 的名字为 PHPSESSID。这里我们主要以 COOKIE 方式进行说明，因为应用比较广泛。 <br/>那么 SESSION 的数据保存在哪里呢？当然是在服务器端，但不是保存在内存中，而是保存在文件或数据库中。默认情况下，php.ini 中设置的 SESSION 保存方式是 files（session.save_handler = files），即使用读写文件的方式保存 SESSION 数据，而 SESSION 文件保存的目录由 session.save_path 指定，文件名以 sess_ 为前缀，后跟 SESSION ID，如：sess_c72665af28a8b14c0fe11afe3b59b51b。文件中的数据即是序列化之后的 SESSION 数据了。如果访问量大，可能产生的 SESSION 文件会比较多，这时可以设置分级目录进行 SESSION 文件的保存，效率会提高很多，设置方法为：session.save_path="N;/save_path"，N 为分级的级数，save_path 为开始目录。当写入 SESSION 数据的时候，PHP 会获取到客户端的 SESSION_ID，然后根据这个 SESSION ID 到指定的 SESSION 文件保存目录中找到相应的 SESSION 文件，不存在则创建之，最后将数据序列化之后写入文件。读取 SESSION 数据是也是类似的操作流程，对读出来的数据需要进行解序列化，生成相应的 SESSION 变量。<br/><br/>三、多服务器共享 SESSION 的主要障碍及解决办法<br/>通过了解 SESSION 的工作原理，我们可以发现，在默认情况下，各个服务器会各自分别对同<br/>一个客户端产生 SESSION ID，如对于同一个用户浏览器，A 服务器产生的 SESSION ID 是 30de1e9de3192ba6ce2992d27a1b6a0a，而 B 服务器生成的则是 c72665af28a8b14c0fe11afe3b59b51b。另外，PHP 的 SESSION 数据都是分别保存在<br/>本服务器的文件系统中。如下图所示：<br/><a href="http://www.gaobo.info/attachment/200704/1175737218_0.gif" target="_blank"><img src="http://www.gaobo.info/attachment/200704/1175737218_0.gif" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>确定了问题所在之后，就可以着手进行解决了。想要共享 SESSION 数据，那就必须实现两个目标：一个是各个服务器对同一个客户端产生的 SESSION ID 必须相同，并且可通过同一个 COOKIE 进行传递，也就是说各个服务器必须可以读取同一个名为 PHPSESSID 的 COOKIE；<br/>另一个是 SESSION 数据的存储方式/位置必须保证各个服务器都能够访问到。简单地说就是多服务器共享客户端的 SESSION ID，同时还必须共享服务器端的 SESSION 数据。<br/><br/>第一个目标的实现其实很简单，只需要对 COOKIE 的域（domain）进行特殊地设置即可，<br/>默认情况下，COOKIE 的域是当前服务器的域名/IP 地址，而域不同的话，各个服务器所设<br/>置的 COOKIE 是不能相互访问的，如<br/><a href="http://www.gaobo.info/attachment/200704/1175737218_1.gif" target="_blank"><img src="http://www.gaobo.info/attachment/200704/1175737218_1.gif" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/><br/>四、代码实现<br/>首先创建数据表，MySQL 的 SQL 语句如下：<br/><div class="code">CREATE TABLE `sess` (<br/>`sesskey` varchar(32) NOT NULL default &quot;&quot;,<br/>`expiry` bigint(20) NOT NULL default &quot;0&quot;,<br/>`data` longtext NOT NULL,<br/>PRIMARY KEY (`sesskey`),<br/>KEY `expiry` (`expiry`)<br/>) TYPE=MyISAM</div><br/>sesskey 为 SESSION ID，expiry 为 SESSION 过期时间，data 用于保存 SESSION 数据。<br/><br/>默认情况下 SESSION 数据是以文件方式保存，想要使用数据库方式保存，就必须重新定义 SESSION 各个操作的处理函数。PHP 提供了session_set_save_handle() 函数，可以用此函数自定义 SESSION 的处理过程，当然首先要先将 session.save_handler 改成 user，可在 PHP 中进行设置：<br/>session_module_name("user");<br/>接下来着重讲一下 session_set_save_handle() 函数，<br/>此函数有六个参数：<br/>session_set_save_handler ( string open, string close, string read, string write, string destroy, string gc )各个参数为各项操作的函数名，这些操作依次是：打开、关闭、读取、写入、销毁、垃圾回收。PHP 手册中有详细的例子，<br/>在这里我们使用 OO 的方式来实现这些操作，详细代码如下：<br/>代码: <br/><div class="code">&lt;?php<br/>define(&quot;MY_SESS_TIME&quot;, 3600); <br/>//SESSION 生存时长<br/>//类定义<br/>class My_Sess<br/>&#123;<br/>function init()<br/>&#123;<br/>$domain = &quot;.infor96.com&quot;;<br/>//不使用 GET/POST 变量方式<br/>ini_set(&quot;session.use_trans_sid&quot;,0);<br/>//设置垃圾回收最大生存时间<br/>ini_set(&quot;session.gc_maxlifetime&quot;,MY_SESS_TIME);<br/><br/>//使用 COOKIE 保存 SESSION ID 的方式<br/>ini_set(&quot;session.use_cookies&quot;,1);<br/>ini_set(&quot;session.cookie_path&quot;,&quot;/&quot;);<br/>//多主机共享保存 SESSION ID 的 COOKIE<br/>ini_set(&quot;session.cookie_domain&quot;, $domain);<br/><br/>//将 session.save_handler 设置为 user，<br/>//而不是默认的 files<br/>session_module_name(&quot;user&quot;);<br/>//定义 SESSION 各项操作所对应的方法名：<br/>session_set_save_handler(<br/>array(&quot;My_Sess&quot;, &quot;open&quot;),<br/>//对应于静态方法 My_Sess:pen()，下同。<br/>array(&quot;My_Sess&quot;, &quot;close&quot;),<br/>array(&quot;My_Sess&quot;, &quot;read&quot;),<br/>array(&quot;My_Sess&quot;, &quot;write&quot;),<br/>array(&quot;My_Sess&quot;, &quot;destroy&quot;),<br/>array(&quot;My_Sess&quot;, &quot;gc&quot;)<br/>);<br/>&#125; //end function<br/><br/>function open($save_path, $session_name) &#123;<br/>return true;<br/>&#125; //end function<br/><br/>function close() &#123;<br/>global $MY_SESS_CONN;<br/><br/>if ($MY_SESS_CONN) &#123; <br/>//关闭数据库连接<br/>$MY_SESS_CONN-&gt;Close();<br/>&#125;<br/>return true;<br/>&#125; //end function<br/><br/>function read($sesskey) &#123;<br/>global $MY_SESS_CONN;<br/><br/>$sql = &quot;SELECT data FROM sess WHERE sesskey=&quot;.$MY_SESS_CONN-&gt;qstr($sesskey).&quot; AND expiry&gt;=&quot;.time();<br/>$rs =&amp; $MY_SESS_CONN-&gt;Execute($sql);<br/>if ($rs) &#123;<br/>if ($rs-&gt;EOF) &#123;<br/>return &quot;&quot;;<br/>&#125; else &#123; <br/>//读取到对应于 SESSION ID 的 SESSION 数据<br/>$v = $rs-&gt;fields&#91;0&#93;;<br/>$rs-&gt;Close();<br/>return $v;<br/>&#125; //end if<br/>&#125; //end if<br/>return &quot;&quot;;<br/>&#125; //end function<br/><br/>function write($sesskey, $data) &#123;<br/>global $MY_SESS_CONN;<br/><br/>$qkey = $MY_SESS_CONN-&gt;qstr($sesskey);<br/>$expiry = time() + My_SESS_TIME; <br/>//设置过期时间<br/><br/>//写入 SESSION<br/>$arr = array(<br/>&quot;sesskey&quot; =&gt; $qkey,<br/>&quot;expiry&quot; =&gt; $expiry,<br/>&quot;data&quot; =&gt; $data);<br/>$MY_SESS_CONN-&gt;Replace(&quot;sess&quot;, $arr, &quot;sesskey&quot;, $autoQuote = true);<br/>return true;<br/>&#125; //end function<br/><br/>function destroy($sesskey) &#123;<br/>global $MY_SESS_CONN;<br/><br/>$sql = &quot;DELETE FROM sess WHERE sesskey=&quot;.$MY_SESS_CONN-&gt;qstr($sesskey);<br/>$rs =&amp; $MY_SESS_CONN-&gt;Execute($sql);<br/>return true;<br/>&#125; //end function<br/><br/>function gc($maxlifetime = null) &#123;<br/>global $MY_SESS_CONN;<br/><br/>$sql = &quot;DELETE FROM sess WHERE expiry&lt;&quot;.time();<br/>$MY_SESS_CONN-&gt;Execute($sql);<br/>//由于经常性的对表 sess 做删除操作，容易产生碎片，<br/>//所以在垃圾回收中对该表进行优化操作。<br/>$sql = &quot;OPTIMIZE TABLE sess&quot;;<br/>$MY_SESS_CONN-&gt;Execute($sql);<br/>return true;<br/>&#125; //end function<br/>&#125; ///:~<br/><br/>//使用 ADOdb 作为数据库抽象层。<br/>require_once(&quot;adodb/adodb.inc.php&quot;);<br/>//数据库配置项，可放入配置文件中（如：config.inc.php）。<br/>$db_type = &quot;mysql&quot;;<br/>$db_host = &quot;192.168.212.1&quot;;<br/>$db_user = &quot;sess_user&quot;;<br/>$db_pass = &quot;sess_pass&quot;;<br/>$db_name = &quot;sess_db&quot;;<br/>//创建数据库连接，这是一个全局变量。<br/>$GLOBALS&#91;&quot;MY_SESS_CONN&quot;&#93; =&amp; ADONewConnection($db_type);<br/>$GLOBALS&#91;&quot;MY_SESS_CONN&quot;&#93;-&gt;Connect( $db_host, $db_user, $db_pass, $db_name);<br/>//初始化 SESSION 设置，必须在 session_start() 之前运行！！<br/>My_Sess::init();<br/>?&gt;</div><br/><br/>五、遗留问题<br/>如果网站的访问量很大的话，SESSION 的读写会频繁地对数据库进行操作，这样效率就会明显降低。考虑到 SESSION 数据一般不会很大，可以尝试用 C/Java 写个多线程的程序，用 HASH 表保存 SESSION 数据，并通过 socket 通信进行数据读写，这样 SESSION 就保存在内存中，读写速度应该会快很多。另外还可以通过负载均衡来分担服务器负载。不过这些都只是我自己的一些想法和假设，并没有实践过<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25AE%259E%25E7%258E%25B0/" rel="tag">实现</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%259C%258D%25E5%258A%25A1%25E5%2599%25A8/" rel="tag">服务器</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2585%25B1%25E4%25BA%25AB/" rel="tag">共享</a> , <a href="http://www.gaobo.info/go.php/tags/session/" rel="tag">session</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2595%25B0%25E6%258D%25AE/" rel="tag">数据</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/385.htm</link>
<title><![CDATA[PHP的IIS操作类]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 04 Apr 2007 01:42:40 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/385.htm</guid> 
<description>
<![CDATA[ 
	<a href="attachment/200704/1175737419_0.rar">点击这里下载文件</a><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/iis/" rel="tag">iis</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2593%258D%25E4%25BD%259C/" rel="tag">操作</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25B1%25BB/" rel="tag">类</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/383.htm</link>
<title><![CDATA[MySql数据库的列类型（字段类型）]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Mon, 02 Apr 2007 06:02:50 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/383.htm</guid> 
<description>
<![CDATA[ 
	MySQL数据库的表是一个二维表，由一个或多个数据列构成。<br/>每个数据列都有它的特定类型，该类型决定了MySQL如何看待该列数据，我们可以把整型数值存放到字符类型的列中，MySQL则会把它看成字符串来处理。<br/>MySQL中的列类型有三种：数值类、字符串类和日期/时间类。<br/>从大类来看列类型和数值类型一样，都是只有三种。但每种列类型都还可细分。<br/>下面对各种列类型进行详细介绍。<br/><br/><strong>数值类的数据列类型</strong><br/>数值型的列类型包括整型和浮点型两大类。<br/><br/>TINYINT：1字节 非常小的正整数，带符号：-128~127，不带符号：0~255 <br/>SMALLINT：2字节 小整数，带符号：-32768~32767，不带符号：0~65535 <br/>MEDIUMINT：3字节 中等大小的整数，带符号：-8388608~8388607，不带符号：0~16777215 <br/>INT：4字节 标准整数，带符号：-2147483648~2147483647，不带符号：0~4294967295 <br/>BIGINT：8字节 大整数，带符号：-9223372036854775808~9233372036854775807，不带符号：0~18446744073709551615 <br/>FLOAT：4字节 单精度浮点数，最小非零值：+-1.175494351E-38，最大非零值：+-3.402823466E+38 <br/>DOUBLE：8字节 双精度浮点数，最小非零值：+-2.2250738585072014E-308，最大非零值：+-1.7976931348623157E+308 <br/>DECIMAL：M+2字节 以字符串形式表示的浮点数，它的取值范围可变，由M和D的值决定。 <br/><br/><strong>整型数据列类型</strong><br/><br/>MySQL有五种整型数据列类型，即TINYINT，SMALLINT，MEDIUMINT，INT和BIGINT。它们之间的区别是取值范围不同，存储空间也各不相同。<br/>在整型数据列后加上UNSIGNED属性可以禁止负数，取值从0开始。<br/><br/>声明整型数据列时，我们可以为它指定个显示宽度M(1~255)，如INT(5)，指定显示宽度为5个字符,如果没有给它指定显示宽度，MySQL会为它指定一个默认值。显示宽度只用于显示，并不能限制取值范围和占用空间，如：INT(3)会占用4个字节的存储空间，并且允许的最大值也不会是999,而是INT整型所允许的最大值。<br/><br/><strong>浮点型数据列类型</strong><br/><br/>MySQL有三种浮点型数据列类型，分别是：FLOAT，DOUBLE和DECIMAL。<br/>浮点类数据类型有一个最大可表示值和一个最小非零可表示值，最小非零可表示值决定了该类型的精确度。<br/><br/>MySQL 4.0.2版之后，FLOAT和DOUBLE都可以指定UNSIGNED属性。当指定该属性时，取值范围不平移到正数区间，而只是简单地把浮点类型的负数部份去掉。<br/><br/>浮点类型也有M(1~255)和D(1~30，且不能大于M-2)。分别表示显示宽度和小数位数。M和D在FLOAT和DOUBLE中是可选的，默认，当MySQL版本大于3.23.6时，FLOAT和DOUBLE类型将被保存为硬件所支持的最大精度。DECIMAL的M和D值在MySQL3.23.6后可选，默认D值为0,M值为10。 <br/><br/><strong>如何选择数值类数据列类型？</strong><br/><br/>为了节省存储空间和提高数据库处理效率，我们应根据应用数据的取值范围来选择一个最适合的数据列类型。如果把一个超出数据列取值范围的数存入该列，则MySQL就会截短该值，如：我们把99999存入SMALLINT(3)数据列里，因为SMALLINT(3)的取值范围是-32768~32767，所以就会被截短成32767存储。显示宽度3不会影响数值的存储。只影响显示。<br/><br/>对于浮点数据列，存入的数值会被该列定义的小数位进行四舍五入。如把一个1.234存入FLOAT(6.1)数据列中，结果是1.2。<br/><br/>DECIMAL与FLOAT和DOUBLE的区别是：DECIMAL类型的值是以字符串的形式被储存起来的，它的小数位数是固定的。它的优点是，不会象FLOAT和DOUBLE类型数据列那样进行四舍五入而产生误差，所以很适合用于财务计算；而它的缺点是：由于它的存储格式不同，CPU不能对它进行直接运算，从而影响运算效率。DECIMAL(M，D)总共要占用M+2个字节。<br/><br/><strong>数值类数据列的属性</strong><br/><br/>ZEROFILL属性适用于所有数值类数据列类型，作用是，如果数值的宽度小于定义的显示宽度，则在数值前填充0。<br/>UNSIGNED属性不允许数据列出现负数。<br/>AUTO_INCREMENT属性可生成独一无二的数字序列。只对整数类的数据列有效。<br/>NULL和NOT NULL属性设置数据列是否可为空。<br/>DEFAULT属性可为数据列指定默认值。<br/><br/><strong>字符串类数据列类型</strong><br/><br/>字符串可以用来表示任何一种值，所以它是最基本的类型之一。<br/>我们可以用字符串类型来存储图象或声音之类的二进制数据，也可存储用gzip压缩的数据。<br/>下表介绍了各种字符串类型：<br/><br/>CHAR[(M)] M字节 M字节 <br/>VARCHAR[(M)] M字节 L+1字节 <br/>TINYBLOD，TINYTEXT 2^8-1字节 L+1字节 <br/>BLOB，TEXT 2^16-1字节 L+2 <br/>MEDIUMBLOB，MEDIUMTEXT 2^24-1字节 L+3 <br/>LONGBLOB，LONGTEXT 2^32-1字节 L+4 <br/>ENUM('value1','value2',...) 65535个成员 1或2字节 <br/>SET('value1','value2',...) 64个成员 1,2,3,4或8字节 <br/><br/>L+1、L+2是表示数据列是可变长度的，它占用的空间会根据数据行的增减面则改变。数据行的总长度取决于存放在这些数据列里的数据值的长度。L+1或L+2里多出来的字节是用来保存数据值的长度的。在对长度可变的数据进行处理时，MySQL要把数据内容和数据长度都保存起来。<br/><br/>如果把超出字符串最大长度的数据放到字符类数据列中，MySQL会自动进行截短处理。<br/><br/>ENUM和SET类型的数据列定义里有一个列表，列表里的元素就是该数据列的合法取值。如果试图把一个没有在列表里的值放到数据列里，它会被转换为空字符串(“”)。<br/><br/>字符串类型的值被保存为一组连续的字节序列，并会根据它们容纳的是二进制字符串还是非二进制字符而被区别对待为字节或者字符：<br/><br/>二进制字符串被视为一个连续的字节序列，与字符集无关。MySQL把BLOB数据列和带BINARY属性的CHAR和VARCHAR数据列里的数据当作二进制值。<br/><br/>非二进制字符串被视为一个连续排列的字符序列。与字符集有关。MySQL把TEXT列与不带BINARY属性的CHAR和VARCHAR数据列里的数据当作二进制值对待。<br/><br/>在MySQL4.1以后的版本中，不同的数据列可以使用不同的字符集。在MySQL4.1版本以前，MySQL用服务器的字符集作为默认字符集。<br/><br/>非二进制字符串，即我们通常所说的字符串，是按字符在字符集中先后次序进行比较和排序的。而二进制字符串因为与字符集无关，所以不以字符顺序排序，而是以字节的二进制值作为比较和排序的依据。下面介绍两种字符串的比较方式：<br/><br/>二进制字符串的比较方式是一个字节一个字节进行的，比较的依据是两个字节的二进制值。也就是说它是区分大小写的，因为同一个字母的大小写的数值编码是不一样的。<br/><br/>非二进制字符串的比较方式是一个字符一个字符进行的，比较的依据是两个字符在字符集中的先后顺序。在大多数字符集中，同一个字母的大小写往往有着相同的先后顺序，所以它不区分大小写。<br/><br/>二进制字符串与字符集无关，所以无论按字符计算还是按字节计算，二进制字符串的长度都是一样的。所以VARCHAR(20)并不表示它最多能容纳20个字符，而是表示它最多只能容纳可以用20个字节表示出来的字符。对于单字节字符集，每个字符只占用一个字节，所以这两者的长度是一样的，但对于多字节字符集，它能容纳的字符个数肯定少于20个。<br/><br/><strong>CHAR和VARCHAR</strong><br/><br/>CHAR和VARCHAR是最常用的两种字符串类型，它们之间的区别是：<br/><br/>CHAR是固定长度的，每个值占用相同的字节，不够的位数MySQL会在它的右边用空格字符补足。<br/><br/>VARCHAR是一种可变长度的类型，每个值占用其刚好的字节数再加上一个用来记录其长度的字节即L+1字节。<br/><br/>CHAR(0)和VARCHAR(0)都是合法的。VARCHAR(0)是从MySQL4.0.2版开始的。它们的作用是作为占位符或用来表示各种on/off开关值。<br/><br/>如何选择CHAR和VARCHAR，这里给出两个原则：<br/><br/>如果数据都有相同的长度，选用VARCHAR会多占用空间，因为有一位用来存储其长度。如果数据长短不一，选用VARCHAR能节省存储空间。而CHAR不论字符长短都需占用相同的空间，即使是空值也不例外。<br/><br/>如果长度出入不大，而且是使用MyISAM或ISAM类型的表，则用CHAR会比VARCHAR好，因为MyISAM和ISAM类型的表对处理固定长度的行的效率高。<br/> <br/>在一个数据表里，只要有一个数据列的长度是可变的，则所有数据列的长度将是可变的。MySQL会进行自动地转换。一个例外，CHAR长度小于4的不会进行自动转换，因为MySQL会认为这样做没必要，节省不了多少空间。反而MySQL会把大量长度小的VARCHAR转换成CHAR，以减少空间占用量。 <br/><br/><strong>BLOB和TEXT</strong><br/><br/>BLOB是二进制字符串，TEXT是非二进制字符串。两者都可存放大容量的信息。<br/><br/>有关BLOB和TEXT索引的建立：<br/><br/>BDB表类型和MySQL3.23.2以上版本的MyISAM表类型允许在BLOB和TEXT数据列上建立索引。<br/><br/>ISAM、HEAP和InnoDB表不支持大对象列的索引。<br/><br/>使用BLOB和TEXT应注意的问题：<br/><br/>由于这两个列类型所存储的数据量大，所以删除和修改操作容易在数据表里产生大量的碎片，需定期运行OPTIMIZE TABLE以减少碎片和提高性能。<br/><br/>如果使用的值非常巨大，就需对服务器进行相应的优化调整，增加max_allowed_packet参数的值。对那些可会用到变些巨大数据的客户程序，也需加大它们的数据包大小。<br/><br/><strong>ENUM和SET</strong><br/><br/>ENUM和SET都是比较特殊的字符串数据列类型，它们的取值范围是一个预先定义好的列表。ENUM或SET数据列的取值只能从这个列表中进行选择。ENUM和SET的主要区别是：<br/><br/>ENUM只能取单值，它的数据列表是一个枚举集合。它的合法取值列表最多允许有65535个成员。例如：ENUM("N","Y")表示，该数据列的取值要么是"Y"，要么就是"N"。<br/><br/>SET可取多值。它的合法取值列表最多允许有64个成员。空字符串也是一个合法的SET值。<br/><br/>ENUM和SET的值是以字符串形式出现的，但在内部，MySQL以数值的形式存储它们。<br/><br/>ENUM的合法取值列表中的字符串被按声明定义的顺序被编号，从1开始。<br/><br/>SET的编号不是按顺序进行编号的，SET中每一个合法取值都对应着SET值里的一个位。第一个合法取值对应0位，第二个合法取值对应1位，以此类推，如果数值形式的SET值等于0,则说明它是一个空字符串，如果某个合法的取值出现在SET数据列里，与之对应的位就会被置位；如果某个合法的取值没有出现在SET数据列里，与之对应的位就会被清零。正因为SET值与位有这样的对应关系，所以SET数据列的多个合法取值才能同时出现并构成SET值。<br/><br/><strong>字符串类型数据列的字符集属性</strong><br/><br/>在MySQL 4.1以前的版本，字符串数据列的字符集由服务器的字符决定，MySQL 4.1版以后的版本可对每个字符串数据列指定不同的字符串。如果按默认方式设置，可按数据列、数据表、数据库、服务器的顺序关联字符串的字符集，直到找一个明确定义的字符集。<br/><br/><strong>日期,时间型数据列类型</strong><br/><br/>DATE 1000-01-01~9999-12-31 3字节(MySQL3.23版以前是4字节 ) 0000-00-00 <br/>TIME -838:59:59~838:59:59 3字节 00:00:00 <br/>DATETIME 1000-01-01 00:00:00~9999-12-31 23:59:59 8字节 0000-00-00 00:00:00 <br/>TIMESTAMP 19700101000000~2037年的某个时刻 4字节 00000000000000 <br/>YEAR YEAR(4)：1901~2155 YEAR(2)：1970~2069 1字节 0000 <br/><br/>MySQL总是把日期和日期里的年份放在最前面，按年月日的顺序显示。<br/><br/>DATE、TIME、DATATIME数据列类型<br/><br/>DATE、TIME和DATATIME类型分别存放日期值、时间值、日期和时间值的组合。它们的格式分别是“CCYY-MM-DD”、“hh:mm:ss”、“CCYY-MM-DD hh:mm:ss”。<br/><br/>DATATIME里的时间值和TIME值是有区别的，DATATIME里的时间值代表的是几点几分，TIME值代表的是所花费的时间。当向TIME数据列插值时，需用时间的完整写法，如12分30秒要写成“00:12:30”。<br/><br/><strong>TIMESTAMP数据列类型</strong><br/><br/>TIMESTAMP数据列的格式是CCYYMMDDhhmmss，取值范围从19700101000000开始，即1970年1月1号，最大到2037年。它的特点是能把数据行的创建或修改时间记录下来：<br/><br/>如果把一个NULL值插入TIMESTAMP列，这个数据列就将自动取值为当前的日期和时间。<br/><br/>在创建和修改数据行时，如果没有明确对TIMESTAMP数据列进行赋值，则它就会自动取值为当前的日期和时间。如果行中有多个TIMESTAMP列，只有第一个会自动取值。<br/><br/>如果对TIMESTAMP设置一个确定的日期和时间值，则会使TIMESTAMP的自动取值功能失效。<br/><br/>TIMESTAMP默认的列宽是14,可指定列宽，以改变显示效果。但不论你指定的列宽如何，MySQL都是以4字节来存储TIMESTAMP值，也总是以14位精度来计算。<br/><br/>如果需要把创建时间和最近一次修改时间同时记录下来，可以用两个时间戳来记录，一个记录创建时间，一个记录修改时间。不过需记住两件事，一是要把记录修改时间的TIMESTAMP数据列放在最前面，这样才会自动取值；二是创建一条新记录时，要用now()函数来初始化创建时间TIMESTAMP数据列，这样，该TIMESTAMP数据列就不会再变化。<br/><br/><strong>YEAR</strong><br/><br/>YEAR是一种单字节的数据列类型，YEAR(4)的取值范围是1901~2155,YEAR(2)的取值范围是1970~2069,但只显示最后两位数。MySQL能自动把两位数字年份转换成四位数字的年份，如97和14分被转换成1997和2014。转换规则是这样的：<br/><br/>年份值00~69将被转换成2000~2069；<br/><br/>年份值70~99将被转换成1970~1999。<br/> <br/>00被转换成0000,而不是2000。因为数值00也就是0,而0值是YEAR的一个合法取值。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593/" rel="tag">数据库</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2588%2597/" rel="tag">列</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25B1%25BB%25E5%259E%258B/" rel="tag">类型</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25AD%2597%25E6%25AE%25B5/" rel="tag">字段</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/381.htm</link>
<title><![CDATA[利用CSS，不通过replace替换标引HTML标记]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 30 Mar 2007 06:41:10 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/381.htm</guid> 
<description>
<![CDATA[ 
	<div class="entry-body"><p>其实css也是将HTML从数据和表现分离的有力工具。石头的<a href="http://tristones.viaspeip.com/archives/000336.html"><span style="color: #0082ff">CSS Oriented Design</span></a>：COD非常合我的口味，摒弃TOD(Table Oriented Design)还真不是意见容易的事情，但是一旦实现，系统本身就实现了分工和协作：就能像Winamp一样换皮肤了，从而发挥用户最大的能动性。最直接的例子就是本网站使用的<a href="http://www.movabletype.com/"><span style="color: #0082ff">MT系统</span></a>，所有的STYLE都来自<a href="http://www.movablestyle.com/"><span style="color: #0082ff">MovableStyle</span></a>。</p></div><div id="more" class="entry-more"><p>需求：将XML结果集中的&lt;b&gt;显示成红色，其实完全可以通过客户端的CSS实现：<br />代码如下：</p><p>首先<br />&lt;blockquote&gt;<br />利用CSS，不通过replace替换&lt;b&gt;标引&lt;/b&gt;HTML标记<br />&lt;/blockquote&gt;<br />利用CSS，不通过replace替换&lt;b&gt;标引&lt;/b&gt;HTML标记<br /></p><p>这样：<br />在CSS中定义了：b &#123;color:red;&#125;<br />后，所有的&lt;b&gt;除了加粗外，还有红色的属性，为了防止整个页面中的其他&lt;b&gt;都被标红，我将结果都放在一个&lt;<br />blockquote&gt;中，然后再在CSS中定义：<br />&lt;style&gt;&lt;!--<br />blockquote b &#123;color:red;&#125;<br />//--&gt;<br />&lt;/style&gt;<br />由于CSS的继承关系，只有所有在blockquote中的&lt;b&gt;才会被标红：</p><p>通过设置 font-weight:normal 甚至可以让&lt;b&gt;字体变细。</p><p>通过这个问题：得出一下2个结论<br />1 设计带有标引的对外搜索服务时，可以使用&lt;b&gt;做为标记<br />2 在客户端，可以通过CSS来实现控制。</p><p><a href="http://dezwozhere.com/links.html"><span style="color: #0082ff">关于：CSS, Accesibility and Standards Links</span></a></p><p><br />后记：<br />也曾经一段时间非常追求XML/XSLT/CSS的数据/结构/表现分离的理念。但是XSLT实施成本的确比较高，所以Resin上开发了基于XHTML的轻量级模板技术，我觉得还挺人性的 ASP .net的实现也是类似。</p><p>可能没有最好的模式，只有最合适的模式：关键还是要看开发本身的复杂程度<br />数百行代码过程性编程效率可能最高；<br />千行代码量可能面向函数开发效率最高；<br />万行代码量时，可能就不得不OO了。</p></div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/css/" rel="tag">css</a> , <a href="http://www.gaobo.info/go.php/tags/replace/" rel="tag">replace</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%259B%25BF%25E6%258D%25A2/" rel="tag">替换</a> , <a href="http://www.gaobo.info/go.php/tags/html/" rel="tag">html</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25A0%2587%25E8%25AE%25B0/" rel="tag">标记</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/379.htm</link>
<title><![CDATA[关于select ... where的小技巧]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Tue, 27 Mar 2007 04:49:41 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/379.htm</guid> 
<description>
<![CDATA[ 
	<span style="color: #0000ff">对于select ... where ... 类型的语句。<br />对于OR条件， 需要把命中率高的条件放在前面。<br />对于AND条件，需要把条件限制范围小的条件放在前面。<br /></span>(mysql)<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.gaobo.info/go.php/tags/select/" rel="tag">select</a> , <a href="http://www.gaobo.info/go.php/tags/where/" rel="tag">where</a> , <a href="http://www.gaobo.info/go.php/tags/and/" rel="tag">and</a> , <a href="http://www.gaobo.info/go.php/tags/or/" rel="tag">or</a> , <a href="http://www.gaobo.info/go.php/tags/sql/" rel="tag">sql</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%258A%2580%25E5%25B7%25A7/" rel="tag">技巧</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/376.htm</link>
<title><![CDATA[Mysql数据库引擎快速指导]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Tue, 27 Mar 2007 03:24:57 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/376.htm</guid> 
<description>
<![CDATA[ 
	<p>Mysql数据库引擎之间的异同罗列如下：<br /><strong>ISAM</strong><br />　　ISAM是一个定义明确且历经时间考验的数据表格管理方法，它在设计之时就考虑到数据库被查询的次数要远大于更新的次数。因此，ISAM执行读取操作的速度很快，而且不占用大量的内存和存储资源。ISAM的两个主要不足之处在于，它不支持事务处理，也不能够容错：如果你的硬盘崩溃了，那么数据文件就无法恢复了。如果你正在把ISAM用在关键任务应用程序里，那就必须经常备份你所有的实时数据，通过其复制特性，MySQL能够支持这样的备份应用程序。</p><p><strong>MyISAM</strong><br />　　MyISAM是MySQL的ISAM扩展格式和缺省的数据库引擎。除了提供ISAM里所没有的索引和字段管理的大量功能，MyISAM还使用一种表格锁定的机制，来优化多个并发的读写操作。其代价是你需要经常运行OPTIMIZE TABLE命令，来恢复被更新机制所浪费的空间。MyISAM还有一些有用的扩展，例如用来修复数据库文件的MyISAMChk工具和用来恢复浪费空间的MyISAMPack工具。</p><p>　　MyISAM强调了快速读取操作，这可能就是为什么MySQL受到了Web开发如此青睐的主要原因：在Web开发中你所进行的大量数据操作都是读取操作。所以，大多数虚拟主机提供商和Internet平台提供商（Internet Presence Provider，IPP）只允许使用MyISAM格式。</p><p><strong>HEAP</strong><br />　　HEAP允许只驻留在内存里的临时表格。驻留在内存里让HEAP要比ISAM和MyISAM都快，但是它所管理的数据是不稳定的，而且如果在关机之前没有进行保存，那么所有的数据都会丢失。在数据行被删除的时候，HEAP也不会浪费大量的空间。HEAP表格在你需要使用SELECT表达式来选择和操控数据的时候非常有用。要记住，在用完表格之后就删除表格。让我再重复一遍：在你用完表格之后，不要忘记删除表格。</p><p><strong>InnoDB和Berkley DB<br /></strong>　　InnoDB和Berkley DB（BDB）数据库引擎都是造就MySQL灵活性的技术的直接产品，这项技术就是MySQL++ API。在使用MySQL的时候，你所面对的每一个挑战几乎都源于ISAM和MyISAM数据库引擎不支持事务处理也不支持外来键。尽管要比ISAM和MyISAM引擎慢很多，但是InnoDB和BDB包括了对事务处理和外来键的支持，这两点都是前两个引擎所没有的。如前所述，如果你的设计需要这些特性中的一者或者两者，那你就要被迫使用后两个引擎中的一个了。</p><p>　　如果感觉自己的确技术高超，你还能够使用MySQL++来创建自己的数据库引擎。这个API为你提供了操作字段、记录、表格、数据库、连接、安全帐号的功能，以及建立诸如MySQL这样DBMS所需要的所有其他无数功能。深入讲解API已经超出了本文的范围，但是你需要了解MySQL++的存在及其可交换引擎背后的技术，这一点是很重要的。估计这个插件式数据库引擎的模型甚至能够被用来为MySQL创建本地的XML提供器（XML provider）。（任何读到本文的MySQL++开发人员可以把这一点当作是个要求。）</p><p>　　至于对已存在数据的表可以使用alter table先转换原表类型再建立全文索引。</p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2595%25B0%25E6%258D%25AE%25E5%25BA%2593/" rel="tag">数据库</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BC%2595%25E6%2593%258E/" rel="tag">引擎</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BF%25AB%25E9%2580%259F/" rel="tag">快速</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%258C%2587%25E5%25AF%25BC/" rel="tag">指导</a> , <a href="http://www.gaobo.info/go.php/tags/isam/" rel="tag">isam</a> , <a href="http://www.gaobo.info/go.php/tags/myisam/" rel="tag">myisam</a> , <a href="http://www.gaobo.info/go.php/tags/heap/" rel="tag">heap</a> , <a href="http://www.gaobo.info/go.php/tags/innodb/" rel="tag">innodb</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/360.htm</link>
<title><![CDATA[javascript中的var_dump()]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 16 Mar 2007 05:43:14 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/360.htm</guid> 
<description>
<![CDATA[ 
	搜索到的，觉得比较有用：<br/><div class="code">function var_dump(obj) &#123;<br/> &nbsp; if(typeof obj == &quot;object&quot;) &#123;<br/> &nbsp; &nbsp; &nbsp;return &quot;Type: &quot;+typeof(obj)+((obj.constructor) ? &quot;&#92;nConstructor: &quot;+obj.constructor : &quot;&quot;)+&quot;&#92;nValue: &quot; + obj;<br/> &nbsp; &#125; else &#123;<br/> &nbsp; &nbsp; &nbsp;return &quot;Type: &quot;+typeof(obj)+&quot;&#92;nValue: &quot;+obj;<br/> &nbsp; &#125;<br/>&#125;//end function var_dump</div><br/>用法：<br/><div class="code">alert(var_dump(变量名))</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/js/" rel="tag">js</a> , <a href="http://www.gaobo.info/go.php/tags/javascript/" rel="tag">javascript</a> , <a href="http://www.gaobo.info/go.php/tags/var_dump/" rel="tag">var dump</a> , <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/355.htm</link>
<title><![CDATA[DIV/层并排布局]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Tue, 13 Mar 2007 05:24:28 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/355.htm</guid> 
<description>
<![CDATA[ 
	以下在firefox，ie下都能很好显示。<br/><div class="code"><br/>#divLeft<br/>&#123;<br/> &nbsp; float: left;<br/> &nbsp; position: relative;<br/> &nbsp; background-color: aqua;<br/> &nbsp; height: 200px;<br/> &nbsp; width: 30%;<br/>&#125;<br/>#divRight<br/>&#123;<br/> &nbsp; float: right;<br/> &nbsp; margin-left: 1px;<br/> &nbsp; position: relative;<br/> &nbsp; height: 200px;<br/> &nbsp; background-color: blue;<br/> &nbsp; width: 69%;<br/>&#125;<br/></div><br/>需注意的是：<br/> &nbsp; 1，层最好宽度不固定。宽度一固定，那么当浏览器的屏幕宽度不够时，右边的DIV会显示到左边DIV之下，浏览器是很老实的，它不会帮你智能裁剪，所以才需要使用百分比。现在的网页大部分布局DIV都能随屏幕尺寸伸缩自己。<br/> &nbsp; 2，百分比宽度也不能全用尽，比如像这样：30% vs 70%，至少要留出1%的宽度。右边DIV最好加上margin-left。<br/> &nbsp; 3，如果需宽度固定，只需在所有布局DIV的外围套一个全局的宽度固定的层。<br/> &nbsp; 最后，作了Coder不必要成为web ui设计者，但是稍微了解一下，也没甚么坏处，^_^。像struts的tiles，ofbiz的screen，webwork的sitemesh，如果布局布的好要省多少事啊。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/css/" rel="tag">css</a> , <a href="http://www.gaobo.info/go.php/tags/div/" rel="tag">div</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25B1%2582/" rel="tag">层</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25B9%25B6%25E6%258E%2592/" rel="tag">并排</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25B8%2583%25E5%25B1%2580/" rel="tag">布局</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%258E%2592%25E7%2589%2588/" rel="tag">排版</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/351.htm</link>
<title><![CDATA[以支持多种浏览器的方式创建XMLHttpRequest对象]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 09 Mar 2007 07:08:15 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/351.htm</guid> 
<description>
<![CDATA[ 
	这段代码的核心分为三步：<br/>1.建立一个变量 xmlHttp 来引用即将创建的 XMLHttpRequest 对象。 <br/>2.尝试在 Microsoft 浏览器中创建该对象： <br/>(1)尝试使用 Msxml2.XMLHTTP 对象创建它。 <br/>(2)如果失败，再尝试 Microsoft.XMLHTTP 对象。 <br/>3.如果仍然没有建立 xmlHttp，则以非 Microsoft 的方式创建该对象。 <br/>最后，xmlHttp 应该引用一个有效的 XMLHttpRequest 对象，无论运行什么样的浏览器。<br/><div class="code"><br/>/* Create a new XMLHttpRequest object to talk to the Web server */<br/>var xmlHttp = false;<br/>/*@cc_on @*/<br/>/*@if (@_jscript_version &gt;= 5)<br/>try &#123;<br/> &nbsp;xmlHttp = new ActiveXObject(&quot;Msxml2.XMLHTTP&quot;);<br/>&#125; catch (e) &#123;<br/> &nbsp;try &#123;<br/> &nbsp; &nbsp;xmlHttp = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);<br/> &nbsp;&#125; catch (e2) &#123;<br/> &nbsp; &nbsp;xmlHttp = false;<br/> &nbsp;&#125;<br/>&#125;<br/>@end @*/<br/>if (!xmlHttp &amp;&amp; typeof XMLHttpRequest != &#039;undefined&#039;) &#123;<br/> &nbsp;xmlHttp = new XMLHttpRequest();<br/>&#125;<br/></div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/%25E6%25B5%258F%25E8%25A7%2588%25E5%2599%25A8/" rel="tag">浏览器</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%2588%259B%25E5%25BB%25BA/" rel="tag">创建</a> , <a href="http://www.gaobo.info/go.php/tags/xmlhttprequest/" rel="tag">xmlhttprequest</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25AF%25B9%25E8%25B1%25A1/" rel="tag">对象</a> , <a href="http://www.gaobo.info/go.php/tags/xml/" rel="tag">xml</a> , <a href="http://www.gaobo.info/go.php/tags/ajax/" rel="tag">ajax</a> , <a href="http://www.gaobo.info/go.php/tags/javascript/" rel="tag">javascript</a> , <a href="http://www.gaobo.info/go.php/tags/js/" rel="tag">js</a> , <a href="http://www.gaobo.info/go.php/tags/microsoft/" rel="tag">microsoft</a> , <a href="http://www.gaobo.info/go.php/tags/ie/" rel="tag">ie</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/350.htm</link>
<title><![CDATA[JavaScript收集]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 09 Mar 2007 05:02:27 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/350.htm</guid> 
<description>
<![CDATA[ 
	<p style="background: white; margin: 0cm 0cm 0pt; line-height: 12pt; text-align: left; mso-pagination: widow-orphan; mso-line-height-rule: exactly" class="MsoNormal" align="left"><span style="font-size: 9pt; color: #333333; font-family: 'Tahoma','sans-serif'; mso-fareast-font-family: 宋体; mso-font-kerning: 0pt"><a href="https://compdoc2cn.dev.java.net/prototype/html/prototype.js.cn.html"><span style="color: #3366cc; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none">prototype.js</span><span style="color: #3366cc; font-family: 宋体; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma"><span>开发笔记</span></span></a><br /><a href="http://plod.popoever.com/archives/000833.html"><span style="color: #3366cc; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none">Prototype 1.5.0 Pre0</span><span style="color: #3366cc; font-family: 宋体; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma"><span>的小抄</span></span><span style="color: #3366cc; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none">(Cheat Sheet)</span></a><br /><a href="http://openrico.org/"><span style="color: #3366cc; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none">Rico</span></a><br /><a href="http://developer.yahoo.com/yui/"><span style="color: #3366cc; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none">Yahoo! UI Library</span></a><br /><a href="http://mochikit.com/"><span style="color: #3366cc; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none">MochiKit &ndash; A lightweight Javascript library</span></a><br /><a href="http://www.aflax.org/"><span style="color: #3366cc; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none">AFLAX: A JavaScript Library for Macromedia&rsquo;s Flash&trade; Platform</span></a><br /><a href="http://dojotoolkit.org/"><span style="color: #3366cc; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none">Dojo - DojoToolkit.org</span></a><br /><a href="http://script.aculo.us/"><span style="color: #3366cc; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none">script.aculo.us - web 2.0 javascript</span></a><br /><a href="http://jquery.com/"><span style="color: #3366cc; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none">jQuery: New Wave Javascript</span></a><br /><a href="http://linuxtoy.org/archives/juploadr.html"><span style="color: #3366cc; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none">jUploadr</span><span style="color: #3366cc; font-family: 宋体; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none; mso-ascii-font-family: Tahoma; mso-hansi-font-family: Tahoma"><span>：上传图片到</span></span><span style="color: #3366cc; text-decoration: none; mso-bidi-font-size: 11.0pt; text-underline: none"> Flickr</span></a></span></p><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/js/" rel="tag">js</a> , <a href="http://www.gaobo.info/go.php/tags/javascript/" rel="tag">javascript</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25B5%2584%25E6%2596%2599/" rel="tag">资料</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2594%25B6%25E9%259B%2586/" rel="tag">收集</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/344.htm</link>
<title><![CDATA[PHP中使用单、双引号定义字符串的区别]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sun, 04 Mar 2007 08:19:42 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/344.htm</guid> 
<description>
<![CDATA[ 
	相信还是有不少人不知道其中的差别，这里就稍微解释下。<br/>PHP中定义字符串的方法有两种，使用双引号和单引号都可以定义一个字符串：<br/><div class="code">$str1=&quot;$string1 string $string2&quot;;<br/>$str2=&#039;$string1 string $string2&#039;;</div><br/>二者都定义了一个字符串，一般情况下两种定义方法没有什么区别。但当引号中含有字符“$”的时候，就有所不同：使用单引号定义的时候，php解释器会将引号内的所有字符（包括字符“$”）都原封不动地赋值给字符串变量；而在使用双引号定义的时候，php解释器会将引号内的“$”字符以及其后的合法字符翻译为变量（此处合法字符指的是字母、数字和下划线）直到遇到一个非法字符才认为变量名结束，此非法字符及其后的字符（除了“$”）都被视为一般字符赋给字符串变量，直到遇到下一个“$”为止。这个在双引号内直接使用变量的特性在php3中是不允许的，php4为了方便利用已有字符串变量定义新的字符串，增加了这个功能。上例中使用双引号定义字符串$str1的方法和使用<br/><div class="code">$str1=$string1.&quot; string &quot;.$string2;</div><br/>的方法是等效的。后者可能更符合一些人的习惯，但前者更直观和易于阅读一些。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%258D%2595%25E5%25BC%2595%25E5%258F%25B7/" rel="tag">单引号</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%258F%258C%25E5%25BC%2595%25E5%258F%25B7/" rel="tag">双引号</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25AD%2597%25E7%25AC%25A6%25E4%25B8%25B2/" rel="tag">字符串</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/343.htm</link>
<title><![CDATA[十大网站设计错误]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sat, 03 Mar 2007 13:57:39 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/343.htm</guid> 
<description>
<![CDATA[ 
	　　1、搜索引擎不友好<br/><br/>　　搜索引擎对于难以处理和识别的打字稿、复数、连字号等等各种各样的问题，搜索的准确度会降低。显然，如果搜索引擎刻意去迎合这种错误使用的话，会伤害到所有的搜索使用者。<br/><br/>　　一个相关的问题是，搜索引擎区分结果是依靠文档的重要性，而只是按照内容关联次数简单地进行结果区分。<br/><br/>　　当找不到信息的时候，搜索是用户的救生索。即使有高级搜索功能，建议还是使用简单搜索，搜索形式应该是一个简单的录入框，就像我们常见的那一种。<br/><br/>　　2、使用PDF文件做为在线阅读<br/><br/>　　用户讨厌在浏览的时候跳出PDF文件，因为那会打断用户的浏览过程，因为普通的浏览器按钮无法工作，因此即使如打印或保存文档这样简单的事情也会变得复杂。由于其版面设计是基于纸张优化的，因此文字的字体很少会和用户的流量其窗口相适应。没有了平滑的滚动浏览，有的只是超小号的字体。<br/><br/>　　更糟糕的是，PDF文件内容是分块的，很难浏览。<br/><br/>　　PDF是对于印刷及发行手册等和其他需要打印的大文件来讲是很合适的，使用它的目的只是为了保留它的信息使其网页上浏览成为现实。<br/><br/>　　3、未改变已访问链接的颜色<br/><br/>　　一个好的浏览历史能够帮助你了解目前的位置，因为那是你浏览的起点。知道过去和现在的位置反过来使得决定下一步去哪里变得容易了。链接是这些浏览过程中的一个关键因素。用户可以不去访问那些没有用处的地址，相反，他们会访问那些对他们有帮助的链接地址。<br/><br/>　　最重要的是，他们知道哪些网页已经访问过了，这样就不必一次又一次访问同一个历史页面。<br/><br/>　　但是这些好处只是基于一个重要的假设：由于网站提供不同的颜色显示，用户可以分辨出哪些链接访问过，哪些链接没有访问过。如果访问一个链接后颜色没有发生变化，那么用户很可能会感到迷惑并无意中反复访问同一历史页面。<br/><br/>　　4、文字未排版<br/><br/>　　将所有文字堆积在一起是一种可怕的体验，浏览这样的文字将是痛苦的经历。<br/><br/>　　在线写作，并不是为了打印，需要让用户能很好地阅读，下面是几个改进的要点：<br/><br/>　　使用子标题<br/><br/>　　使用列表<br/><br/>　　突出关键字<br/><br/>　　使用小段落<br/><br/>　　反金字塔结构<br/><br/>　　简单的写作风格<br/><br/>　　5、固定字体大小<br/><br/>　　CSS样式不幸让网站有权禁止浏览器的“改变字体大小”的功能，并使得网站有一个固定的字体大小。对于大多数人的年龄超过40岁的人来说，这个固定地文字大小实在太小了。<br/><br/>　　尊重用户的喜好，让他们按照自己的需要修改文字的大小，同时，明确字体大小是相对的，而非绝对显示像素的数量多少。<br/><br/>　　6. 网页标题搜索引擎不友好<br/><br/>　　搜索是用户发现网站的最重要途径，搜索用户找到一个独立网站的最重要的方法。网页的标题是你吸引新用户或老用户从搜索列表中定位到你网站的主要工具。<br/><br/>　　网页的标题文字是在标记之间的文字，并通常作为搜索引擎结果列表中的链接文字。搜索引擎一般只显示标题开头66个字，是真正的缩略内容。<br/><br/>　　网页标题也用户将一个网址加为书签时的默认文字，对于你的主页，应该以公司名称开头，接着是网站的简介，不要用“The”或“Welcome to”做为开头文字。<br/><br/>　　对于其他网页来说，标题应该是将具体内容的概要文字说明，由于网页标题是浏览器窗口的标题，也是用户任务条上的标签，多个窗口下将会显示每一页的标题，因此，如果你所有的网页标题字都相同的话，对于开了多个窗口的用户来说，你网站的可用性将严重降低。<br/><br/>　　7、所有的东西看起来都像广告<br/><br/>　　有选择地吸引注意力是相当有力的途径。用户已经学会了对挡在眼前的那些目的性很强的广告采取不予理睬的态度。这也就是为何点击率每年以半数速度下降，网络广告根本不起作用的原因。<br/><br/>　　不幸的是，这也使得用户忽视了那些看起来很像广告的设计样式。毕竟，当你不理会某些东西时，就不会仔细地研究它并搞清楚它是什么。<br/><br/>　　因此，最好避免任何类似广告的设计。这一指导方针所传达的含义随着新的广告形式出现而变化。目前遵循以下规则：<br/><br/>　　无视横幅：着用户将不会把注意力放在任何看似横幅广告的东西，这取决于它的形状及位置。<br/><br/>　　避免使用动画：用户会忽视那些闪烁的文字或其它侵略性很强的动画。<br/><br/>　　净化弹出窗口：用户在弹出窗口完全打开前就会将其关闭，有时是带着极端厌恶的情绪。<br/><br/>　　8、违反设计惯例<br/><br/>　　一致性是最重要的可用性原则之一：当事物遵循相同的原则运作时，用户不用担心发生意外，因为他们根据先前的经验已经很清楚将会发生什么事情。就像你每次在牛顿的头顶上放下一个苹果，它一定会砸中他的脑袋一样。<br/><br/>　　用户的期望实现得越多，他们就越感觉是自己在控制整个系统，并且更加喜欢它。相反地，用户则会感到可靠程度不够。想想，当我释放苹果时，它变成了西红柿并朝着天空蹦出一英里，那多荒诞！<br/><br/>　　9、打开新的浏览器窗口<br/><br/>　　打开新的浏览窗口就像一个吸尘器推销员在上门推销时，直接将烟灰缸里的杂物倾倒在消费者家中的地毯上。拜托！不要用任何窗口污染我的屏幕（尤其在当前操作系统低劣的窗口管理技术下），如果我需要一个新窗口，我会自己打开的。<br/><br/>　　设计者打开新窗口的本意是要让用户留在他的站点上。但是却忽略了控制用户的机器所带来的负面效应，这种策略恰恰弄巧成拙，因为当用户想通过“后退”按钮返回先前的站点时，已经做不到了。用户通常注意不到新窗口已经被打开，尤其当他们的显示器很小，而窗口又正好是最大化时。因此，当用户想要返回原来的站点时，面对的却只是一个不可用的灰色“后退”按钮。<br/><br/>　　点击链接的标准结果是目标页面在当前的浏览窗口中加载，取代现有页面。出现其它的任何情况都违背了用户的期望，令他们感到对网络的控制不稳定。用户痛恨那些突然弹出来的窗口，当用户想要在新窗口打开一页的时候，会自己使用“在新窗口打开”功能，因此不要用一些代码来干扰了用户浏览器的操作。<br/><br/>　　10、不回答用户的提问<br/><br/>　　用户是因为某个目的才访问你的网站。他们方式可能是想购买你的产品或者其他，但最终却失败了，因为网站没有提供用户寻找的资料信息。<br/><br/>　　事实上问题远没有这么简单，如果你不告诉用户具体情况，用户就会以为你的产品或服务不能满足他们的需求，因此用户就不会购买你的产品，或者有一些信息，深深隐藏在各种文档之间，用户没有时间阅读所有这些隐藏的信息，因此也就认为它们不存在。<br/><br/>　　不回答用户提问的最坏的例子是拒绝提供产品和服务的价格清单，没有任何B2C的商务网站会犯这种错误，但是这在B2B中却普遍存在，大多数“企业解决方案”的提出，让你不能告诉用户他们适合100个站点、还是10万个站点人。价格是最主要的作用是便于想用户提供相应的产品，避免提供一个不成熟的产品给用户。<br/><br/>　　即使是B2C网站有时页会忘记在所有地方提供相关产品价格清单，例如在目录页或者搜索结果页，要知道，在这两种情况下，价格是关键，它让用户能够区分不同的产品并找到最合适的目标。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/%25E7%25BD%2591%25E7%25AB%2599/" rel="tag">网站</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25AE%25BE%25E8%25AE%25A1/" rel="tag">设计</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%2594%2599%25E8%25AF%25AF/" rel="tag">错误</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25B5%258F%25E8%25A7%2588%25E5%2599%25A8/" rel="tag">浏览器</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/339.htm</link>
<title><![CDATA[在SELECT语句中同时使用COUNT和DISTINCT]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 28 Feb 2007 08:35:59 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/339.htm</guid> 
<description>
<![CDATA[ 
	一般都是这样使用的：SELECT COUNT(列名)……或SELECT DISTINCT……，如果需要同时使用COUNT和DISTINCT，应该这样写：SELECT COUNT(DISTINCT 列名)……，其中，“列名”不能使用*，至少要给出一个列的名称。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/mysql/" rel="tag">mysql</a> , <a href="http://www.gaobo.info/go.php/tags/select/" rel="tag">select</a> , <a href="http://www.gaobo.info/go.php/tags/count/" rel="tag">count</a> , <a href="http://www.gaobo.info/go.php/tags/distinct/" rel="tag">distinct</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25AF%25AD%25E6%25B3%2595/" rel="tag">语法</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/338.htm</link>
<title><![CDATA[php.ini 配置详细选项]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Tue, 27 Feb 2007 14:58:40 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/338.htm</guid> 
<description>
<![CDATA[ 
	php.ini 或 php3.ini 是 PHP 在启动时会读取的配置文件。该文件的存放路径为 /usr/local/lib/。在 PHP 3.x 版的配置文件为 php3.ini；而在 PHP 4.x 版改为 php.ini。若 PHP 安装成服务器的模块，则在 Web 服务器启动执行时会读取，之后就不再读取，因此改动配置的话要重新启动 Web 服务器。若使用独立 PHP CGI 方式，则每次都读一次。<br/><br/>要看目前的系统配置，可以用phpinfo()看到。以下为选项配置 <br/><br/><br/>php_value name value <br/>配置变量名称和值。本选项需 PHP 4.x 版之后才能使用。 <br/><br/>php_flag name on&#124;off <br/>配置标志布尔变量选项。本选项需 PHP 4.x 版之后才能使用。 <br/><br/>php_admin_value name value <br/>配置 Apache 的配置文件变量。原来在 .htaccess 的配置改到这个选项配置。本选项需 PHP 4.x 版之后才能使用。 <br/><br/>php_admin_flag name on&#124;off <br/>配置布尔变量当标志。本选项需 PHP 4.x 版之后才能使用。 <br/><br/>asp_tags boolean <br/>配置 PHP 程序是否解析以 ASP Script 语法 <% %> 的标记 (tag)。本选项在 PHP 3.0.4 之后才可使用。更多的细节可以参考>嵌入方法的部份。 <br/><br/>auto_append_file string <br/>配置本选项可以让指定的文件附加在原 PHP 程序后面自动执行。若 PHP 程序中有用到 exit() 函数，则指定的文件不会执行。参数 string 即为指定自动执行的文件。 <br/><br/>auto_prepend_file string <br/>配置本选项可以让指定的文件在原 PHP 程序之前自动执行。参数 string 即为指定自动执行的文件。 <br/><br/>cgi_ext string <br/>本选项配置 CGI 程序的扩展名。 <br/><br/>display_errors boolean <br/>本选项配置是否要将执行的错误信息显示在用户的浏览器上。 <br/><br/>doc_root string <br/>配置服务器的文件及 PHP 文件放置的根目录。 <br/><br/>engine boolean <br/>本选项需要使用apache的模块方式使用 PHP。可配置是否要使用 PHP 引擎。在 httpd.conf 中加入 php3_engine on/off 亦可配置某目录或某虚拟网站是否要用 PHP 解析器。 <br/><br/>error_log string <br/>本选项用来配置错误记录文件。在 UNIX 系统上参数 string 即为文件名。Windows NT 会将记录记在事件检视器的日志之中。Windows 95/98 则不支持系统记录。 <br/><br/>error_reporting integer <br/>本选项用来配置系统记录的等级。参数 integer 即为等级的级数标志，可以加在一起，默认值为 7，见下表 <br/>级数 说明 <br/>1 一般的错误 <br/>2 一般的警告 <br/>4 解析错误 <br/>8 非关键的警告 <br/><br/>open_basedir string <br/>本选项用来配置提供 PHP 存取的最底层目录。从该指定目录之下的文件或目录，PHP 程序才能存取。使用本选项主要是为了系统安全性的考虑。参数 string 即为要限制的最底层目录节点。值得注意的是在 UNIX 系统中，若该节点之下的文件或目录有符号链结 (symbolic link)，则可能会让使用本选项的目的打折，因此在目录的设计上考虑，也是 Webmaster 的重要任务。默认值是所有文件均可存取。在 PHP 3.0.7 版之后，可以配置多个底层目录。 <br/><br/>gpc_order string <br/>配置 GET/POST/COOKIE 三种模块的顺序及规则。参数 string 即为要配置的规则，例如：配置成 "GP" 表示忽视 cookie，并在存取方法 (method) 相同时，以 POST 取代 GET。 <br/><br/>ignore_user_abort string <br/>默认值为 Off。用来配置当传输未完成时，用户端断线是要继续处理。 <br/><br/>include_path string <br/>为 PHP 程序中 require、include 及 fopen_with_path 等函数的文件搜寻路径。在 UNIX 或 Windows 中的斜线方向不同。 <br/><br/>log_errors boolean <br/>指定程序错误时是否要记录在 log 文件中。 <br/><br/>magic_quotes_gpc boolean <br/>配置 GET/POST/COOKIE 三种模块的特殊字符，包含单引号、双引号、反斜线、及空字符 (NUL) 是否要自动加入反斜线当溢出字符。 <br/><br/>magic_quotes_runtime boolean <br/>配置返回资料是否自动加入反斜线当溢出字符。 <br/><br/>magic_quotes_sybase boolean <br/>配置 sybase 资料中单引号要自动加上反斜线当溢出字符。 <br/><br/>max_execution_time integer <br/>配置程序最久执行时间。单位是秒。 <br/><br/>memory_limit integer <br/>配置程序最多使用多少内存。 <br/><br/>short_open_tag boolean <br/>配置是否使用短的 PHP 标记 (<? ?>)。若不使用，则必须要用 <?php 作为程序的开头，若要使程序合乎 XML 的标准则要关闭本功能。 <br/><br/>track_errors boolean <br/>打开本选项可使最后的错误信息跟着全局变量 $php_errormsg。 <br/><br/>track_vars boolean <br/>打开本选项可让用户输入的字符串自动解析到变量之中，而不用自己处理。 <br/><br/>upload_tmp_dir string <br/>指定上传文件临时路径。 <br/><br/>user_dir string <br/>指定用户根目录的路径。 <br/><br/>warn_plus_overloading boolean <br/>若打开本选项，字符串间就只能用英文的句号 (.) 链接，而不能用加号 (+) 链接字符串。 <br/><br/>SMTP string <br/>在 Windows 系列操作系统中，用来指定 SMTP 服务器，供 mail 函数使用。参数 string 为 SMTP 服务器名字。 <br/><br/>sendmail_from string <br/>配置 "From: " 字符串供 Windows 系列操作系统使用 mail 函数。 <br/><br/>sendmail_path string <br/>配置 sendmail 程序的放置路径。例如 /usr/sbin/sendmail。 <br/><br/>safe_mode boolean <br/>配置 PHP 在安全模式下执行。 <br/><br/>safe_mode_exec_dir string <br/>配置安全模式程序执行的路径。 <br/><br/>debugger.host string <br/>指定远端调试的服务器名称，可以是 IP 或 Domain Name。 <br/><br/>debugger.port string <br/>配置远端调试服务器的端口 (port)。 <br/><br/>debugger.enabled boolean <br/>配置是否可以为调试模式。 <br/><br/>enable_dl boolean <br/>本选项要使用apache模块 (Apache module) 的方式才有效。用来配置 PHP 的函数可否作用。当系统处于安全模式 (safe-mode) 时，本选项 enable 也无法使用 dl() 函数。 <br/><br/>extension_dir string <br/>配置动态函数的路径。 <br/><br/>extension string <br/>PHP 启动时所要载入的动态扩充功能。 <br/><br/>mysql.allow_persistent boolean <br/>配置是否允许 MySQL 数据库持续连接 (persistent connections)，会影响函数。 <br/><br/>mysql.max_persistent integer <br/>配置每个处理程序最多保持几个 MySQL 持续连接。 <br/><br/>mysql.max_links integer <br/>配置每个处理程序最多开几个 MySQL 连接，包括持续连接。 <br/><br/>msql.allow_persistent boolean <br/>配置是否允许 mSQL 数据库持续连接 (persistent connections)，会影响函数。 <br/><br/>msql.max_persistent integer <br/>配置每个处理程序最多保持几个 mSQL 持续连接。 <br/><br/>msql.max_links integer <br/>配置每个处理程序最多开几个 mSQL 连接，包括持续连接。 <br/><br/>pgsql.allow_persistent boolean <br/>配置是否允许 Postgres 数据库持续连接 (persistent connections)，会影响函数。 <br/><br/>pgsql.max_persistent integer <br/>配置每个处理程序最多保持几个 Postgres 持续连接。 <br/><br/>pgsql.max_links integer <br/>配置每个处理程序最多开几个 Postgres 连接，包括持续连接。 <br/><br/>sybase.allow_persistent boolean <br/>配置是否允许 Sybase 数据库持续连接 (persistent connections)，会影响函数。 <br/><br/>sybase.max_persistent integer <br/>配置每个处理程序最多保持几个 Sybase 持续连接。 <br/><br/>sybase.max_links integer <br/>配置每个处理程序最多开几个 Sybase 连接，包括持续连接。 <br/><br/>sybct.allow_persistent boolean <br/>配置是否允许 Sybase-CT 数据库持续连接 (persistent connections)，默认值是打开的。 <br/><br/>sybct.max_persistent integer <br/>配置每个处理程序最多保持几个 Sybase-CT 持续连接。默认值为 -1 表示无限制。 <br/><br/>sybct.max_links integer <br/>配置每个处理程序最多开几个 Sybase-CT 连接，包括持续连接。默认值为 -1，表示没有限制。 <br/><br/>sybct.min_server_severity integer <br/>配置 Sybase-CT 服务器错误报告的最少笔数。默认值为 10。 <br/><br/>sybct.min_client_severity integer <br/>配置 Sybase-CT 客户端错误报告的最少笔数。默认值为 10。 <br/><br/>sybct.login_timeout integer <br/>配置 Sybase-CT 最久可以使用的登入时间。默认值为 1 分钟。 <br/><br/>sybct.timeout integer <br/>配置 Sybase-CT 的 query 操作时间限制。默认值为无限制。 <br/><br/>sybct.hostname string <br/>配置 Sybase-CT 可连接机器名称。默认值不设限 <br/><br/>ifx.allow_persistent boolean <br/>配置是否允许 Informix 数据库持续连接 (persistent connections)，会影响函数。 <br/><br/>ifx.max_persistent integer <br/>配置每个处理程序最多保持几个 Informix 持续连接。 <br/><br/>ifx.max_links integer <br/>配置每个处理程序最多开几个 Informix 连接，包括持续连接。 <br/><br/>ifx.default_host string <br/>配置 Informix 默认连接的服务器名称，供ifx_connect()或ifx_pconnect()函数使用。 <br/><br/>ifx.default_user string <br/>配置 Informix 默认连接的用户帐号，供ifx_connect()或ifx_pconnect( 函数使用。 <br/><br/>ifx.default_password string <br/>配置 Informix 默认连接的用户密码，供ifx_connect()或ifx_pconnect() 函数使用。 <br/><br/>ifx.blobinfile boolean <br/>配置 Informix 长位类模式，0 表在内存；1 表在文件中。亦可以在 PHP 程序中使用ifx_blobinfile_mode()函数来修改。 <br/><br/>ifx.textasvarchar boolean <br/>配置 Informix 文字模式默认值，0 表返回 blob 的代码；1 表返回 varchar 字符串。亦可在 PHP 程序中使用ifx_textasvarchar() 函数来修改配置。 <br/><br/>ifx.byteasvarchar boolean <br/>配置 Informix 位组模式默认值，0 表返回 blob 的代码；1 表返回 varchar 字符串。亦可在 PHP 程序中使用ifx_byteasvarchar() 来修改配置。 <br/><br/>ifx.charasvarchar boolean <br/>配置 Informix 返回字符串的字尾空格是否要自动去除。 <br/><br/>ifx.nullformat boolean <br/>配置 NULL 字段的返回方式，true 表示返回字符串 NULL，false 表格返回字符串 ""。亦可在 PHP 程序中以ifx_nullformat() 修改。 <br/><br/>bcmath.scale integer <br/>配置 BC 高精确度函数库的小数点位数。 <br/><br/>browscap string <br/>配置浏览器的开文件能力名。 <br/><br/>uodbc.default_db string <br/>配置 ODBC 默认连接的数据库名称，供odbc_connect()或odbc_pconnect()函数使用。 <br/><br/>uodbc.default_user string <br/>配置 ODBC 默认连接的用户帐号，供odbc_connect()或odbc_pconnect()函数使用。 <br/><br/>uodbc.default_pw string <br/>配置 ODBC 默认连接的用户密码，供odbc_connect()或函数使用。 <br/><br/>uodbc.allow_persistent boolean <br/>配置是否允许 ODBC 数据库持续连接 (persistent connections)，会影响odbc_pconnect()函数。 <br/><br/>uodbc.max_persistent integer <br/>配置每个处理程序最多保持几个 ODBC 持续连接。 <br/><br/>uodbc.max_links integer <br/>配置每个处理程序最多开几个 ODBC 连接，包括持续连接。 <br/>以下和 session 有关的配置值，都在 PHP 4.x 以上的版本方支持。在 php.ini 的配置文件中。 <br/><br/>session.save_handler <br/>定义 session 储存资料的文件名称。默认值为 files。 <br/><br/>session.save_path <br/>定义 session 储存资料的文件路径。默认值为 /tmp。 <br/><br/>session.name <br/>配置 session 所使用的 cookie 名称。默认值为 PHPSESSID。 <br/><br/>session.auto_start <br/>配置 session 是否自动打开。默认值为 0 (否)。 <br/><br/>session.lifetime <br/>配置 cookie 送到浏览器后的保存时间，单位为秒。默认值为 0，表示直到浏览器关闭。 <br/><br/>session.serialize_handler <br/>定义连续/解连续资料的标头，本功能只有 WDDX 模块或 PHP 内部使用。默认值为 php。 <br/><br/>session.gc_probability <br/>配置每笔要求回应时的废物蒐集 (gc, garbage collection) 处理机率。默认值为 1。 <br/><br/>session.gc_maxlifetime <br/>配置废物被清除前的存活秒数。 <br/><br/>session.extern_referer_check <br/>决定参照到客户端的 Session 代码是否要删除。有时在安全或其它考虑时，会配置不删除。默认值为 0。 <br/><br/>session.entropy_file <br/>配置 session 代码建立时，使用外部高熵值资源或文件来建立，例如 UNIX 系统上的 /dev/random 或 /dev/urandom。 <br/><br/>session.entropy_length <br/>配置 session 从高熵值资源读取的位组数。默认值为 0。 <br/><br/>session.use_cookies <br/>配置是否要将 session 变成 cookie 存在用户端。默认值为 1，表是打开本功能。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/ini/" rel="tag">ini</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%2585%258D%25E7%25BD%25AE/" rel="tag">配置</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/331.htm</link>
<title><![CDATA[数学方法、逻辑判断实现、Ajax和密码强度]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Wed, 24 Jan 2007 06:46:38 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/331.htm</guid> 
<description>
<![CDATA[ 
	以下部分转贴一个Blog的文章。<br/>一个名叫viBlogging的blog系统中需要的一个功能：在用户注册时根据输入的密码来显示密码强度（模仿passport的，不过是使用Atlas）。<br/>对于密码强度，分为弱、中、强三等级，我的判断规则是：<br/><br/>1。如果密码的位数在3～4位之间，如果只含有字母，那么强度为弱。<br/>2。如果密码的位数在3～4位之间，如果还含有数字，那么强度也为弱。<br/>3。如果密码的位数在3～4位之间，如果含有非字母数字的字符，那么强度为中。<br/>4。如果密码位数在5～7之间，只含有字母的强度为弱<br/>5。如果密码位数在5～7之间，同时还有数字的强度为中。<br/>6。如果密码位数在5～7之间，同时还有非字母数字字符的强度为强。<br/>7。如果密码长度大于7，如果只含有字母，那么强度为中。<br/>8。如果密码长度大于7，如果还含有数字的话强度为中。<br/>9。如果密码长度大于7，如果含有非字母数字字符的话，强度为强。<br/><br/>如果此时昨晚规则的分析后就着手写代码的话，那要写一堆if嵌套了。这样做的话，很可能会使得逻辑陷入混乱，很有可能一些情况就被忽略过去了。更为严重的是，这样写严重降低了代码的可读性。如果我必须用这样的方式来写，那我首先会去写unit test，其次再附详细的doc或注释来说明。<br/><br/>Okay，那我们进一步来分析一下。我们上述的9个条件都是由密码长度和密码复杂度两部分来结合判断出来的。那么我们可以拆分一下，如下图所示（请大家先只看第一个表格）：<br/><a href="http://www.gaobo.info/attachment/1169620912_0.png" target="_blank"><img src="http://www.gaobo.info/attachment/1169620912_0.png" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>我们现在写两个函数，<strong>分别</strong>计算长度和复杂度对应的强度，并返回。这里我们用&#123;0,1,2&#125;和&#123;0,1,3&#125;来表示（为什么后者是&#123;0,1,3&#125;在后面会讲到）那么我们可以很容易把上面的9个规则总结成第一个表格来表示。<br/><br/>到这里为止，我可以分别使用i和j来表示拆分后的强度的表示，好，现在我们可以去写清晰一点的if..else嵌套或if..switch嵌套了，这里我们可以用标识符了，采用了<strong>简单的分而治之</strong>的思想，整个规则也被简化为了7步了（读者可以自己考虑一下），思路清晰了许多。<br/><br/>但是目前为止，我们<strong>还是没有脱离嵌套条件分支语句的尴尬和不便</strong>。<br/><br/>Okay，我们<strong>继续</strong>对这个逻辑的返回结果作分析：<br/><strong>强度：情况1，情况2 ＝ &#123;(i1,j1),(i2,j2),....&#125; § [(i+j)min,(i+j)max]</strong><br/>Strong: F,I = &#123;(!0,3)&#125; § [4,5]<br/>Medium: G,E,H,C = &#123;(2,0),(!0,1),(3,0)&#125; § [2,3]<br/>Weak: A,B,D = &#123;(0,!3),(1,0)&#125; § [0,1]<br/><br/>好，这样<strong>结果就很清楚了</strong>，当返回的i+j在>3时，那么强度肯定是strong的，如果小于2，那么肯定是weak的，剩下的就是Medium的了。这样<strong>只要写一个switch就完成任务了</strong>（我只在有双分支的时候用if，2个以上的都用switch，学过编译原理的应该知道它比if效率高，可是.net中他俩有什么性能区别我不知道，但是如果不出意外，应该还是比if效率高吧）。<br/><br/>此文仅在提供一种分解问题和归类问题各部分结果的小方法，当然也有“运气成分”(这就是为什么用&#123;0,1,3&#125;不用&#123;0,1,2&#125;的原因)。抛砖引玉，希望能学到更好的解决办法。<br/><br/>接下来是通过JS来实现判断密码强度：<br/><div class="code"><br/> &nbsp; &nbsp;&lt;script type=&quot;text/javascript&quot;&gt;<br/> &nbsp; &nbsp; &nbsp; &nbsp;var PasswordStrength =&#123;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Level : &#91;&quot;高，实在是高&quot;,&quot;还行啦&quot;,&quot;靠，这样也行&quot;&#93;,<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LevelValue : &#91;30,20,0&#93;,//强度值<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Factor : &#91;1,2,5&#93;,//字符加数,分别为字母，数字，其它<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;KindFactor : &#91;0,0,10,20&#93;,//密码含几种组成的加数 <br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Regex : &#91;/&#91;a-zA-Z&#93;/g,/&#92;d/g,/&#91;^a-zA-Z0-9&#93;/g&#93; //字符正则数字正则其它正则<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#125;<br/> &nbsp; &nbsp; &nbsp; &nbsp;PasswordStrength.StrengthValue = function(pwd)<br/> &nbsp; &nbsp; &nbsp; &nbsp;&#123;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var strengthValue = 0;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var ComposedKind = 0;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for(var i = 0 ; i &lt; this.Regex.length;i++)<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#123;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var chars = pwd.match(this.Regex&#91;i&#93;);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(chars != null)<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#123;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strengthValue += chars.length * this.Factor&#91;i&#93;;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ComposedKind ++;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#125;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#125;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;strengthValue += this.KindFactor&#91;ComposedKind&#93;;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return strengthValue;<br/> &nbsp; &nbsp; &nbsp; &nbsp;&#125; <br/> &nbsp; &nbsp; &nbsp; &nbsp;PasswordStrength.StrengthLevel = function(pwd)<br/> &nbsp; &nbsp; &nbsp; &nbsp;&#123;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;var value = this.StrengthValue(pwd);<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for(var i = 0 ; i &lt; this.LevelValue.length ; i ++)<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#123;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if(value &gt;= this.LevelValue&#91;i&#93; )<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return this.Level&#91;i&#93;;<br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#125;<br/> &nbsp; &nbsp; &nbsp; &nbsp;&#125;<br/> &nbsp; &nbsp; &nbsp; <br/> &nbsp; &nbsp; &nbsp; &nbsp;alert(PasswordStrength.StrengthLevel(&quot;23&quot;)); <br/> &nbsp; &nbsp; &nbsp; &nbsp;alert(PasswordStrength.StrengthLevel(&quot;abcd123&quot;)); &nbsp; &nbsp; <br/> &nbsp; &nbsp; &nbsp; &nbsp;alert(PasswordStrength.StrengthLevel(&quot;abcd!%23&quot;)); &nbsp;<br/> &nbsp; &nbsp;&lt;/script&gt;</div><br/>最后，通过一个JS的类来实现检测密码强度：<br/><a href="attachment/1169621158_0.rar">点击这里下载文件</a><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/%25E6%2595%25B0%25E5%25AD%25A6%25E6%2596%25B9%25E6%25B3%2595/" rel="tag">数学方法</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%2580%25BB%25E8%25BE%2591%25E5%2588%25A4%25E6%2596%25AD/" rel="tag">逻辑判断</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25AE%259E%25E7%258E%25B0/" rel="tag">实现</a> , <a href="http://www.gaobo.info/go.php/tags/ajax/" rel="tag">ajax</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25AF%2586%25E7%25A0%2581/" rel="tag">密码</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25BC%25BA%25E5%25BA%25A6/" rel="tag">强度</a> , <a href="http://www.gaobo.info/go.php/tags/javascript/" rel="tag">javascript</a> , <a href="http://www.gaobo.info/go.php/tags/js/" rel="tag">js</a> , <a href="http://www.gaobo.info/go.php/tags/atlas/" rel="tag">atlas</a> , <a href="http://www.gaobo.info/go.php/tags/c%2523/" rel="tag">c#</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/329.htm</link>
<title><![CDATA[为Javascript数组添加一个inArray方法]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Thu, 18 Jan 2007 06:24:44 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/329.htm</guid> 
<description>
<![CDATA[ 
	了解 PHP 的朋友都知道， PHP 里面有个很好用的函数叫“in_array”，它可以用来检查数组中是否存在某个值，本文介绍的是通过 prototype 向 javascript 数组添加一个类似的方法，简单但是实用。<br/><div class="code">&lt;script type=&quot;text/javascript&quot;&gt;<br/>Array.prototype.inArray = function (value) &#123;<br/>// Returns true if the passed value is found in the<br/>// array. &nbsp;Returns false if it is not. <br/>&nbsp;&nbsp;var i;<br/>&nbsp;&nbsp;for (i=0; i &lt; this.length; i++) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;// Matches identical (===), not just similar (==).<br/>&nbsp;&nbsp;&nbsp;&nbsp;if (this&#91;i&#93; === value) &#123;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return true;<br/>&nbsp;&nbsp;&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;&#125;<br/>&nbsp;&nbsp;return false;<br/>&#125;;<br/>&lt;/script&gt;</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/javascript/" rel="tag">javascript</a> , <a href="http://www.gaobo.info/go.php/tags/js/" rel="tag">js</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2595%25B0%25E7%25BB%2584/" rel="tag">数组</a> , <a href="http://www.gaobo.info/go.php/tags/inarray/" rel="tag">inarray</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2596%25B9%25E6%25B3%2595/" rel="tag">方法</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/328.htm</link>
<title><![CDATA[如何阻止表单重复提交、防刷新、防后退]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Tue, 16 Jan 2007 02:52:02 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/328.htm</guid> 
<description>
<![CDATA[ 
	这个问题有几种解决方案如下。<br/>1 服务器端的解决方法。这是我最为推荐的方法。优点是判断准确，兼容性最大。<br/>做法：a页面显示表单，然后提交b页面处理，处理完后重定向到c页面显示结果。<br/><br/>1.0 在访问a页面时在session里生成一个标志ID,例如<br/><div class="code">//伪代码<br/>session(&quot;submitID&quot;)=random()</div><br/>然后把这个值写到表单的一个hidden的input里<br/><div class="code">//伪代码<br/>&lt;%response.write(&quot;&lt;input name=submitID2 type=hidden value=&#92;&quot;&quot;+session(&quot;submitID&quot;)+&quot;&#92;&quot;&gt;&quot;)%&gt;</div><br/>1.1 b页面处理时判断表单所提交的submitID2的值是否和session中的submitID一致，不一致的话重定向到报错页面，一致的话把session中的submitID清空然后进行表单处理<br/><div class="code">//伪代码<br/>session(&quot;submitID&quot;)=&quot;&quot;<br/>//然后处理提交......</div><br/>处理完成后重定向到c页面<br/><br/>1.2 c页面其实就没什么好说的了，就是一个显示处理结果的页面。<br/><br/>2 客户端用js解决<br/>这种方法不好，因为必然会遇到不同浏览器的兼容性问题，而且是必然可以绕过的。唯一的优点就是简单，不需要太多的编码<br/><br/>2.0防止后退<br/>在每个页面的最顶上加上这个代码<br/><div class="code">&lt;script&gt;window.history.forward();&lt;/script&gt;</div><br/>2.1防止刷新<br/>我很难想到什么好方法可以做到。因为要屏蔽的地方太多了。只好采用一种很烂的方法：<br/><div class="code">&lt;body onunload=&quot;location=&#039;about:blank&#039;&gt;&quot; &lt;!-- 这个方法只是个想法，没有经过调试 --&gt;</div><br/>Tags - <a href="http://www.gaobo.info/go.php/tags/web/" rel="tag">web</a> , <a href="http://www.gaobo.info/go.php/tags/html/" rel="tag">html</a> , <a href="http://www.gaobo.info/go.php/tags/%25E7%25A8%258B%25E5%25BA%258F/" rel="tag">程序</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%2598%25BB%25E6%25AD%25A2/" rel="tag">阻止</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25A1%25A8%25E5%258D%2595/" rel="tag">表单</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%2587%258D%25E5%25A4%258D%25E6%258F%2590%25E4%25BA%25A4/" rel="tag">重复提交</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%258F%2590%25E4%25BA%25A4/" rel="tag">提交</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%2598%25B2%25E5%2588%25B7%25E6%2596%25B0/" rel="tag">防刷新</a> , <a href="http://www.gaobo.info/go.php/tags/%25E9%2598%25B2%25E5%2590%258E%25E9%2580%2580/" rel="tag">防后退</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/326.htm</link>
<title><![CDATA[使用JSLint完成JavaScript语法检查]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Sun, 14 Jan 2007 02:26:30 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/326.htm</guid> 
<description>
<![CDATA[ 
	JSLint是一个JavaScript验证工具（<a href="http://www.jslint.com" target="_blank">www.jslint.com</a>），可以扫描JavaScript源代码来查找问题。如果JSLint发现一个问题，JSLint就会显示描述这个问题的消息，并指出错误在源代码中的大致位置。有些编码风格约定可能导致未预见的行为或错误，JSLint除了能指出这些不合理的约定，还能标志出结构方面的问题。尽管JSLint不能保证逻辑一定正确，但确实有助于发现错误，这些错误很可能导致浏览器的JavaScript引擎抛出错误。<br/>JSLint定义了一组编码约定，这比ECMA定义的语言更为严格。这些编码约定汲取了多年来的丰富编码经验，并以一条年代久远的编程原则作为宗旨：能做并不意味着应该做。JSLint会对它认为有风险的编码实践加标志，另外还会指出哪些是明显的错误（见下图），从而促使你养成好的JavaScript编码习惯。<br/><a href="http://www.gaobo.info/attachment/1168741518_0.jpg" target="_blank"><img src="http://www.gaobo.info/attachment/1168741518_0.jpg" class="insertimage" alt="点击在新窗口中浏览此图片" title="点击在新窗口中浏览此图片" border="0"/></a><br/>JSLint可能会把一些结构方面的错误标志为可疑的编码实践，以下列出了其中一部分（完整的列表可以参考JSLint的文档）。<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"> &nbsp; JSLint要求所有代码行都以分号结束。尽管JavaScript确实允许将换行符作为行结束符，但一般认为这种做法是不明确的，而且是不好的编码风格。<br/> &nbsp; 使用if和for的语句必须使用大括号把语句块括起来。<br/> &nbsp; 不同于其他编程语言，在JavaScript中，块不会作为变量的作用域。JavaScript只支持函数级作用域。因此，JSLint只接受作为function、if、switch、while、for、do和try语句一部分的块，其他的块都会标志为错误。<br/> &nbsp; var只能声明一次，而且在使用之前必须声明。<br/> &nbsp; JSLint会把出现在return、break、continue或throw语句后面的代码标志为不可达的代码。这些语句后面必须紧跟一个结束大括号。</div></div><br/>对于JavaScript程序员新手来说，JSLint是一个非常好的工具，因为它会教你一些好的JavaScript编码实践。由于JSLint能把可能导致逻辑错误或其他未预见行为的部分标出来，因此可以减少调试时间。如果你调试一段JavaScript代码时遇到困难，可以试试JSLint。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/jslint/" rel="tag">jslint</a> , <a href="http://www.gaobo.info/go.php/tags/javascript/" rel="tag">javascript</a> , <a href="http://www.gaobo.info/go.php/tags/%25E8%25AF%25AD%25E6%25B3%2595/" rel="tag">语法</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%25A3%2580%25E6%259F%25A5/" rel="tag">检查</a>
]]>
</description>
</item><item>
<link>http://www.gaobo.info/read.php/325.htm</link>
<title><![CDATA[多行文本框内字符换行的办法]]></title> 
<author>Doctor &lt;gregry@cqut.edu.cn&gt;</author>
<category><![CDATA[PHP&amp;DB&amp;...]]></category>
<pubDate>Fri, 12 Jan 2007 07:53:53 +0000</pubDate> 
<guid>http://www.gaobo.info/read.php/325.htm</guid> 
<description>
<![CDATA[ 
	<div class="code">&lt;textarea name=&quot;ry&quot; cols=&quot;60&quot; rows=&quot;4&quot;&gt;<br/>&lt;?=$text?&gt;<br/>&lt;/textarea&gt;</div><br/>如上，如果变量$text中需要换行，怎么办呢？<br/>可以在程序中将$text中需要换行的地方加上html实体“& # 1 3”，即可在输出的时候形成在文本框中换行的结果。<br/>Tags - <a href="http://www.gaobo.info/go.php/tags/php/" rel="tag">php</a> , <a href="http://www.gaobo.info/go.php/tags/html/" rel="tag">html</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25A4%259A%25E8%25A1%258C/" rel="tag">多行</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%2596%2587%25E6%259C%25AC%25E6%25A1%2586/" rel="tag">文本框</a> , <a href="http://www.gaobo.info/go.php/tags/%25E5%25AD%2597%25E7%25AC%25A6/" rel="tag">字符</a> , <a href="http://www.gaobo.info/go.php/tags/%25E6%258D%25A2%25E8%25A1%258C/" rel="tag">换行</a>
]]>
</description>
</item>
</channel>
</rss>