        <?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title type="html"><![CDATA[Claymore's blog]]></title>
<subtitle type="html"><![CDATA[生活就是胡说八道加胡思乱想，所以简单生活要求不胡说八道加少胡思乱想。]]></subtitle>
<id>http://www.claymorephp.com/</id>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/" /> 
<link rel="self" type="application/atom+xml" href="http://www.claymorephp.com//atom.php" /> 
<generator uri="http://www.claymorephp.com/" version="2.8">PHPBlog Beta 1.0.1</generator> 
<updated>2009-01-08 19:38:33</updated><entry>
<title type="html"><![CDATA[jQuery实现图层居中]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=225</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Programming" label="Programming" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Javascript" label="Javascript" /> 
<updated>2008-12-28 13:58:11</updated>
<published>2008-12-28 13:58:11</published>
<summary type="html"><![CDATA[<div><DIV class=UBBPanel><DIV class=UBBTitle><img src='images/code.gif' style='margin:0px 2px -3px 0px' alt='程序代码'/> 程序代码</DIV><DIV class=UBBContent>&lt;script&gt;<br>        $("#chatbox").each(function(i,o){<br>         $(o).css("left",(($(document).width())/2-(parseInt($(o).width())/2))+"px");<br>         $(o).css("top",(($(document).height())/2-(parseInt($(o).height())/2))+"px");<br>        })<br>&lt;/script&gt;<br><br>&lt;div id="chatbox" style="position:absolute;z-index:100;background-color:red;"&gt;&lt;/div&gt;</DIV></DIV><BR></div>]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=225" /> 
<id>http://www.claymorephp.com/?article_id=225</id>
</entry>	<entry>
<title type="html"><![CDATA[jQuery使用手册 ]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=224</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Programming" label="Programming" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Javascript" label="Javascript" /> 
<updated>2008-12-26 22:36:05</updated>
<published>2008-12-26 22:36:05</published>
<summary type="html"><![CDATA[<SPAN style="FONT-SIZE: 10pt">翻译整理：Young.J<BR>官方网站：</SPAN><A href="http://jquery.com/" target="_blank"><SPAN style="FONT-SIZE: 10pt"><FONT color=#1d58d1>http://jquery.com</FONT></SPAN></A><BR><BR><SPAN style="FONT-SIZE: 10pt">&nbsp;&nbsp;&nbsp; jQuery是一款同prototype一样优秀js开发库类，特别是对css和XPath的支持，使我们写js变得更加方便！如果你不是个js高手又想写出优 秀的js效果，jQuery可以帮你达到目的！<BR>&nbsp;&nbsp; 下载地址：Starterkit （</SPAN><A href="http://jquery.bassistance.de/jquery-starterkit.zip" target="_blank"><SPAN style="FONT-SIZE: 10pt"><FONT color=#1d58d1>http://jquery.bassistance.de/jquery-starterkit.zip</FONT></SPAN></A><SPAN style="FONT-SIZE: 10pt">）<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; jQuery Downloads （</SPAN><A href="http://jquery.com/src/" target="_blank"><SPAN style="FONT-SIZE: 10pt"><FONT color=#1d58d1>http://jquery.com/src/</FONT></SPAN></A><SPAN style="FONT-SIZE: 10pt">）</SPAN> 
]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=224" /> 
<id>http://www.claymorephp.com/?article_id=224</id>
</entry>	<entry>
<title type="html"><![CDATA[smarty与MVC模式]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=222</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Programming" label="Programming" /> 
<category term="" scheme="http://www.claymorephp.com/?category=PHP" label="PHP" /> 
<updated>2008-12-03 21:20:52</updated>
<published>2008-12-03 21:20:52</published>
<summary type="html"><![CDATA[<div>一、什么是smarty?</div>
<div>smarty是一个使用PHP写出来的模板PHP模板引擎，它提供了逻辑与外在内容的分离，简单的讲，目的就是要使用PHP程序员同美工分离,使用的程序员改变程序的逻辑内容不会影响到美工的页面设计，美工重新修改页面不会影响到程序的程序逻辑，这在多人合作的项目中显的尤为重要。</div>
<BR>
<div>二、smarty优点：</div>
<BR>
<div>1. 速度：采用smarty编写的程序可以获得最大速度的提高，这一点是相对于其它的模板引擎技术而言的。</div>
<BR>
<div>2. 编译型：采用smarty编写的程序在运行时要编译成一个非模板技术的PHP文件，这个文件采用了PHP与HTML混合的方式，在下一次访问模板时将WEB请求直接转换到这个文件中，而不再进行模板重新编译（在源程序没有改动的情况下） </div>
<BR>
<div>3. 缓存技术：smarty选用的一种缓存技术，它可以将用户最终看到的HTML文件缓存成一个静态的HTML页，当设定smarty的cache属性为true时，在smarty设定的cachetime期内将用户的WEB请求直接转换到这个静态的HTML文件中来，这相当于调用一个静态的HTML文件。</div>
<BR>
]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=222" /> 
<id>http://www.claymorephp.com/?article_id=222</id>
</entry>	<entry>
<title type="html"><![CDATA[PHP中通过Web执行C/C++应用程序]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=220</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Programming" label="Programming" /> 
<category term="" scheme="http://www.claymorephp.com/?category=PHP" label="PHP" /> 
<updated>2008-11-15 12:30:50</updated>
<published>2008-11-15 12:30:50</published>
<summary type="html"><![CDATA[<div>　　一、简介<BR>　　<BR>　　如果你对Unix/Linux有所了解的话，你应该知道他们大都自带了C和C++的编译器，分别是GCC和G++。Unix在程序安装及Make等许多地方使用到了这些编译器。利用一些控制台命令，C++和PHP, 我将向你介绍怎样生成一个完整的C++程序例子，他可以在用PHP程序来执行，并能获得相应的输出结果。我将先生成C++程序代码，并编译它，谈后讨论我们将如果通过使用PHP的函数passthru来执行这个程序。从某种意义上来说，这边文章给我们提供一种通过Web页面来访问一般程序的方法。<BR>　　<BR>　　为了能更好的理解这篇文章，你应该有一台运行着apache和最新版本php的unix/Linux服务器。同时也应该掌握C++, unix控制台命令，当然一些PHP的编程经验也是必需的。<BR>　　<BR>　　二、编写一个C++程序<BR>　　<BR>　　例如，我们可以写一个能够通过命令行还接收参数的C++ 简单程序，并命名为Sampleapp.然后我们能够按照下面的方式给他传递三个不同的参数 ：<BR>　　<BR>　　Sampleapp ?参数一 ?参数二 ?参数三<BR>　　<BR>　　这个程序的功能是能输出传递给他的参数的个数和每个参数的值，然后我们可以用PHP脚本程序来执行编译好的C++程序。<BR>　　<BR>　　利用你习惯的文本编辑器，新建一个名为Sampleapp.cpp 的文件，再此文件中输入如下的代码:<BR>　　<BR>　　#include &lt;iostream.h&gt;<BR>　　<BR>　　int main(int argc, char* argv[])<BR>　　{<BR>　　cout &lt;&lt; endl &lt;&lt; "You passed " &lt;&lt; argc-1 &lt;&lt; " arguement"<BR>　　&lt;&lt; (argc-1 == 1 ? "" : "s") &lt;&lt; "." &lt;&lt; endl;<BR>　　<BR>　　cout &lt;&lt; (argc-1 == 1 ? "This" : "These")<BR>　　&lt;&lt; " arguement" &lt;&lt; (argc-1 == 1 ? "" : "s") &lt;&lt; " "<BR>　　&lt;&lt; (argc-1 == 1 ? "is" : "are") &lt;&lt; ": " &lt;&lt; endl &lt;&lt; endl;<BR>　　<BR>　　for(int i = 1; i &lt; argc; i++)<BR>　　cout &lt;&lt; "[" &lt;&lt; i &lt;&lt; "] " &lt;&lt; argv &lt;&lt; endl;<BR>　　<BR>　　return 0;<BR>　　} </div>
<BR>
<BR>
]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=220" /> 
<id>http://www.claymorephp.com/?article_id=220</id>
</entry>	<entry>
<title type="html"><![CDATA[13个不同类型网页菜单源代码和在线例子]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=219</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Cybernet" label="Cybernet" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Web相关" label="Web相关" /> 
<updated>2008-11-13 09:49:51</updated>
<published>2008-11-13 09:49:51</published>
<summary type="html"><![CDATA[<H3 class=title>1. 垂直菜单</H3>
<H3 class=sub-title>1. <A href="http://woork.blogspot.com/2008/04/nice-animated-menu-using-css-and.html" target="_blank"><FONT color=#006699>Nice animated menu using CSS and Mootools</FONT></A></H3>
<DIV class=img-post><FONT color=#006699><IMG alt="animated menu" src="http://devsnippets.com/img/animated-menus1.png" _counted="undefined"></FONT></DIV>
<div><FONT color=#006699></FONT>&nbsp;</div>
<DIV class=download><A href="http://www.box.net/shared/t7fd9t8kk8" target="_blank"><FONT color=#006699>下载代码Download {Code}</FONT></A>| <A href="http://woork.bravehost.com/mefmoo/index.html" target="_blank"><FONT color=#006699>在线例子Live Demo</FONT></A> </DIV>
<DIV class=download>&nbsp;</DIV>
<DIV class=download>&nbsp;</DIV>
<H3 class=sub-title>2. <A href="http://www.filamentgroup.com/lab/jquery_ipod_style_drilldown_menu" target="_blank"><FONT color=#006699>jQuery iPod-风格菜单</FONT></A></H3>
<DIV class=img-post><FONT color=#006699><IMG alt="jQuery Plugins" src="http://devsnippets.com/img/jquery7.jpg" _counted="undefined"></FONT></DIV>
]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=219" /> 
<id>http://www.claymorephp.com/?article_id=219</id>
</entry>	<entry>
<title type="html"><![CDATA[16个漂亮的CSS模板]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=218</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Cybernet" label="Cybernet" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Web相关" label="Web相关" /> 
<updated>2008-11-13 09:45:24</updated>
<published>2008-11-13 09:45:24</published>
<summary type="html"><![CDATA[<DIV><STRONG><A href="http://www.freecsstemplates.org/download/zip/blackberry" target= "_blank"><FONT color=#006699>Black Berry</FONT></A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="http://www.freecsstemplates.org/preview/blackberry" target= "_blank"><FONT color=#006699>Demo</FONT></A> </STRONG><BR><IMG src="http://farm4.static.flickr.com/3198/2962622557_f2d1b0d9fe.jpg" _counted="undefined"> </DIV>
<DIV>&nbsp;</DIV>
<DIV><BR><BR><BR><STRONG><A href="http://csscreme.com/tpsaveas.php?tp=business_company_blue.zip" target= "_blank"><FONT color=#006699>Business Company Blue</FONT></A>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A href="http://csscreme.com/freetemplates/business_company_blue/" target= "_blank"><FONT color=#006699>Demo</FONT></A></STRONG> <BR><IMG src="http://farm3.static.flickr.com/2093/2962622683_14145334ee.jpg" _counted="undefined"> </DIV>
]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=218" /> 
<id>http://www.claymorephp.com/?article_id=218</id>
</entry>	<entry>
<title type="html"><![CDATA[近50个最好的而且免费Ajax 例子]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=217</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Programming" label="Programming" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Ajax" label="Ajax" /> 
<updated>2008-11-13 09:41:19</updated>
<published>2008-11-13 09:41:19</published>
<summary type="html"><![CDATA[<DIV>Web应用程序已经取得了跨越式的发展，我们要感谢下Ajax 技术。<BR>以下是我们提供的最好的而且免费提供的脚本，这些例子中使用了jQuery, Mootools, Prototype 和script.aculo.us ，不妨尝试一下！<BR><BR>Ajax Forms</DIV>
<UL>
<LI><A href="http://www.codegobbler.com/one-form-many-uses-server-side-jquery-jaxer" target= "_blank">Server side jQuery with Jaxer</A> 
<LI><A href="http://joeabiraad.com/ajax/ajax-login-form-php-javascript/89" target= "_blank">Ajax login form (PHP &amp; Javascript)</A> 
<LI><A href="http://malsup.com/jquery/form/" target= "_blank">Form Plugin</A> </LI></UL>
<DIV>ShoutBox</DIV>
<UL>
<LI><A href="http://spacegirlpippa.co.uk/" target= "_blank">wTag (Ajax shoutbox)</A> 
<LI><A href="http://webscripts.softpedia.com/script/Chat-Scripts/Shoutbox-Ajax-39032.html" target= "_blank">Shoutbox Ajax</A> </LI></UL><BR>
<DIV>Validate a Username AJAX</DIV>
<UL>
<LI><A href="http://joeabiraad.com/ajax/validate-a-username-using-javascript-and-php-ajax/54" target= "_blank">Validate a username using Javascript and PHP ( AJAX )</A> </LI></UL><BR>
]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=217" /> 
<id>http://www.claymorephp.com/?article_id=217</id>
</entry>	<entry>
<title type="html"><![CDATA[前端开发必备工具]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=216</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Cybernet" label="Cybernet" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Web相关" label="Web相关" /> 
<updated>2008-11-10 09:58:31</updated>
<published>2008-11-10 09:58:31</published>
<summary type="html"><![CDATA[<div>=================================2008年9月4日更新==========================<BR></div>
<div>介绍2款前端小工具【取色工具和量距离工具】<BR>1.取色工具——TakeColor<BR><BR>先看看这个工具的界面<BR><A href="http://www.css88.com/attachments/month_0808/b200886215222.jpg" target= "_blank"><IMG src="http://www.css88.com/attachments/month_0808/b200886215222.jpg" onload="attachimg(this, 'load');" border=0></A><BR><BR>你可以选择色彩的模式，可以取到屏幕上任意一点的颜色值，并直接复制；<BR>取色的快捷键您可以自己设置，点击菜单中“设置”-“热键设置”,默认是Alt+c;<BR><IMG src="http://www.css88.com/attachments/month_0808/s200886215638.jpg" onload="attachimg(this, 'load');" border=0><BR><BR><BR><BR><A href="http://www.css88.com/attachments/month_0808/a20088622959.rar" target= "_blank"><IMG src="http://www.css88.com/images/download.gif" onload="attachimg(this, 'load');" border=0>点击下载此文件</A></div>]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=216" /> 
<id>http://www.claymorephp.com/?article_id=216</id>
</entry>	<entry>
<title type="html"><![CDATA[Javascrīpt开发工具大集合]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=215</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Programming" label="Programming" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Javascript" label="Javascript" /> 
<updated>2008-11-10 09:54:59</updated>
<published>2008-11-10 09:54:59</published>
<summary type="html"><![CDATA[<div><A href="http://bbs.51js.com/forum-24-1.html" target="_blank">http://bbs.51js.com/forum-24-1.html</A> 无忧脚本</div>
<div>&nbsp;<A href="http://www.w3schools.com/js/default.asp" target="_blank">http://www.w3schools.com/js/default.asp</A> W3英文学校</div>
<div><A href="http://www.8esky.com/handbook/Javascrīpt/contents.htm" target="_blank">http://www.8esky.com/handbook/Javascrīpt/contents.htm</A> Javascrīpt 参考</div>
<BR>
<div>(1)调试javascrīpt的好方法： <BR>修改IE的设置：<BR>IE的“选项－高级”，有两个选项默认是钩选的：<BR>Disable scrīpt Debugging(Internet Explorer)<BR>Disable scrīpt Debugging(Other)<BR>中文可能是“禁用脚本调试”，去掉这两项的钩选。</div>
<div>在VS2005“工具－选项－调试－实时”，选中脚本调试。</div>
<div>在需要调试的地方加上debugger;例如：<BR>&lt;scrīpt language=javascrīpt&gt;<BR>..<BR>debugger；<BR>..<BR>&lt;/scrīpt&gt;<BR>打开或刷新一下页面就进入断点了。</div>
<BR>
<BR>
]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=215" /> 
<id>http://www.claymorephp.com/?article_id=215</id>
</entry>	<entry>
<title type="html"><![CDATA[关于表单输入域长度的问题]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=214</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Cybernet" label="Cybernet" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Web相关" label="Web相关" /> 
<updated>2008-11-06 19:40:39</updated>
<published>2008-11-06 19:40:39</published>
<summary type="html"><![CDATA[<DIV>今天发现在LINUX使用FIREFOX浏览网站时，出现了表单的input和textarea比较长的情况，网页结构被整了乱七八糟的。</DIV>
<DIV>然而在WINDOWS下使用IE或者FIREFOX浏览却没有那种情况，而且好好的，挺喜欢的<IMG src="http://www.claymorephp.com/editors/smiles/142.gif">。</DIV>
<DIV>后来经过反复测试发现原来在LINUX下和WINDOWS下对网页的表单输入域的长度是不一致的(恩，应该是这样，我是这么对自己解释的).</DIV>
<DIV>比如说input的size="50"，在WINDOWS下只占估计250像素的长度，然而在LINUX下几乎占了整个页面的长度<IMG src="http://www.claymorephp.com/editors/smiles/27.gif">。</DIV>
<DIV>这是一种比较夸张和超出逻辑的情况，我不知道这个差别是怎么出现的，总之我是找到了解决的办法，也就是在控制表单的输入域长度的时候尽量使用CSS，而不要使用SIZE属性，使用CSS使网页布局更加一致。</DIV>
]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=214" /> 
<id>http://www.claymorephp.com/?article_id=214</id>
</entry>	<entry>
<title type="html"><![CDATA[不要使用opendir,readdir,closedir]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=213</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Programming" label="Programming" /> 
<category term="" scheme="http://www.claymorephp.com/?category=PHP" label="PHP" /> 
<updated>2008-11-06 19:26:39</updated>
<published>2008-11-06 19:26:39</published>
<summary type="html"><![CDATA[<DIV>上次写代码的时候发现了一个问题。</DIV>
<DIV>关于目录的访问我一般使用的结构是</DIV>
<DIV><DIV class=UBBPanel><DIV class=UBBTitle><img src='images/code.gif' style='margin:0px 2px -3px 0px' alt='程序代码'/> 程序代码</DIV><DIV class=UBBContent>$dir_res=opendir($dir);<br>while($file=readdir($dir_res))<br>{<br>...<br>}<br>closedir($dir_res);</DIV></DIV><BR>但是当文件/目录名比较特殊时，比如说是0，这样$file的值为0，虽然它表示文件名，并不表示其他含义，但是程序可不认，它把它作为false离开了这次循环，所以当文件/目录名在boolean语法中表示false的意思时，这个访问结构是不成立的。(虽然我只对文件/目录名为0的情况进行了测试不成功，天知道还有什么其他的情况<IMG src="http://www.claymorephp.com/editors/smiles/50.gif">)</DIV><BR>
<DIV>所以，应该使用scandir函数来访问目录，该结构可为:</DIV>
<DIV><DIV class=UBBPanel><DIV class=UBBTitle><img src='images/code.gif' style='margin:0px 2px -3px 0px' alt='程序代码'/> 程序代码</DIV><DIV class=UBBContent>$files=scandir($dir);</div></div></div>]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=213" /> 
<id>http://www.claymorephp.com/?article_id=213</id>
</entry>	<entry>
<title type="html"><![CDATA[escape,encodeURI,encodeURIComponent函数比较]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=212</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Programming" label="Programming" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Javascript" label="Javascript" /> 
<updated>2008-11-04 15:37:05</updated>
<published>2008-11-04 15:37:05</published>
<summary type="html"><![CDATA[<DIV>js对文字进行编码涉及3个函数：escape,encodeURI,encodeURIComponent，相应3个解码函数：unescape,decodeURI,decodeURIComponent</DIV><BR>
<DIV>1、&nbsp; 传递参数时需要使用encodeURIComponent，这样组合的url才不会被#等特殊字符截断。&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV>
<DIV>例如：</DIV>
<DIV>&lt;script language="javascript"&gt;document.write('&lt;a href="http://passport.baidu.com/?logout&amp;aid=7&amp;u='+encodeURIComponent("http://cang.baidu.com/bruce42")+'"&gt;退出&lt;/a&gt;');&lt;/script&gt;</DIV>
<DIV><BR>2、&nbsp; 进行url跳转时可以整体使用encodeURI</DIV>
<DIV>例如： Location.href=encodeURI(http://cang.baidu.com/do/s?word=中国asp之家&amp;ct=21);</DIV>
<DIV><BR>3、&nbsp; js使用数据时可以使用escape</DIV>
<DIV>例如：搜藏中history纪录。</DIV><BR>
<DIV>4、&nbsp; escape对0-255以外的unicode值进行编码时输出%u****格式，其它情况下escape，encodeURI，encodeURIComponent编码结果相同。</DIV><BR>
]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=212" /> 
<id>http://www.claymorephp.com/?article_id=212</id>
</entry>	<entry>
<title type="html"><![CDATA[Apache2 使用 mod_gzip 增进传输效能]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=211</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Cybernet" label="Cybernet" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Web相关" label="Web相关" /> 
<updated>2008-11-03 10:20:42</updated>
<published>2008-11-03 10:20:42</published>
<summary type="html"><![CDATA[<div>要加快网页传输的速度，一个方法是增加网络的频宽，另一个方法是降低数据量，这是大家都知道的道理. HTTP 通讯协议基本上就是 server 接受 client 的 request (GET) 然后送出被要求的资料，如果 server 端可以送出一份压缩过的数据而可以被 client 端接受，那么虽然是传送相同的资料，但是经过压缩就可以有效的降低数据量.</div>
<div>本站使用 Win32 的 Apache 2.0.54，如果想要达成上面讲的机制，要另加一个 gzip 的模块 mod_gzip，这里可以下载 mod_gzip 预先编译好的版本 mod_gzip-2.0.53-w32.zip，用在 Apache 2.0.54 没问题. 用法如下：<BR>在 httpd.conf 加上</div>
<div><BR>LoadModule gzip_module modules/mod_gzip.so<BR>&lt;ifmodule mod_gzip.c&gt;<BR>mod_gzip_on Yes<BR>mod_gzip_compression_level 9<BR>mod_gzip_item_include file \.css$<BR>mod_gzip_item_include file \.js$<BR>mod_gzip_item_include mime text/.*<BR>&lt;/ifmodule&gt;</div>
<div><BR>其中 mod_gzip_compression_level 9 是最高压缩，mod_gzip_item_include 是设定什么样的数据文件要压缩，上例中 *.css 及 *.js 会被压缩传送. 图档如 .jpg, .png，或音乐 .mp3 等，则不宜再压缩，因为档案本身就已经是压缩过的.<BR>修改完后要 restart Apache. Apache 如果接到 browser 送来的 Accept-Encoding 含有 gzip 就会以 gzip 压缩再传送(Accept-Encoding: gzip,deflate )，现在新的 browser 都已经支持. 如果 browser 没有送来支持的讯息，server 端就会以不压缩的原数据传送.</div>
]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=211" /> 
<id>http://www.claymorephp.com/?article_id=211</id>
</entry>	<entry>
<title type="html"><![CDATA[Apache2 使用 mod_deflate 增进传输效能]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=210</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Cybernet" label="Cybernet" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Web相关" label="Web相关" /> 
<updated>2008-11-03 10:18:15</updated>
<published>2008-11-03 10:18:15</published>
<summary type="html"><![CDATA[<div>在前篇提过使用 mod_gzip 增进传输效能，但似乎有些地方有问题，如果加上mod_gzip_item_include mime application/x-httpd-php，照理说应该会把 php 的输出压缩传出，但是在 browser 看到的是空白一片. 只好试试 Apache2 官方包装内的 mod_deflate，结果没有出现同样的问题，官方版还是比较有保障.</div>
<div>用法如下:<BR>在 httpd.conf 加上</div>
<div><BR>LoadModule deflate_module modules/mod_deflate.so<BR>&lt;ifmodule mod_deflate.c&gt;<BR>DeflateCompressionLevel 9<BR>AddOutputFilterByType DEFLATE text/html text/plain text/xml application/x-httpd-php<BR>AddOutputFilter DEFLATE css js<BR>&lt;/ifmodule&gt;</div>
<div><BR>其中 DeflateCompressionLevel 9 是最高压缩，经实验证明，压缩能力跟 mod_gzip 是一样的，style.css 12911 bytes，压缩传送同样是 3342 bytes.<BR>Apache2 还是推荐使用 mod_deflate 较好.</div>]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=210" /> 
<id>http://www.claymorephp.com/?article_id=210</id>
</entry>	<entry>
<title type="html"><![CDATA[使用Apache2的mod_deflate模块]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=209</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Cybernet" label="Cybernet" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Web相关" label="Web相关" /> 
<updated>2008-11-03 10:13:38</updated>
<published>2008-11-03 10:13:38</published>
<summary type="html"><![CDATA[<DIV class=entry-content>今天看了<A href="http://ying.homedns.org/wp/" target="_blank">精神奕奕</A>的两篇文章：<A name=baidusnap2 target="_blank"></A><A href="http://ying.homedns.org/wp/archives/2005/08/13/12/46/48/" target="_blank">《Apache2 使用 mod_gzip 增进传输效能》</A>和<A href="http://ying.homedns.org/wp/archives/2005/08/13/21/28/00/" target="_blank">《Apache2 使用 mod_deflate 增进传输效能》</A>。看起来这是位WordPress前辈啊，05年初就开始接触了WordPress。</DIV>
<DIV class=entry-content>文章介绍了使用mod_gzip模块和mod_deflate模块压缩传输数据，提供传输性能的方法。WordPress本身支持gzip压缩输入，不过仅限于WordPress输出的页面，比如Blog页面以及WordPress后台页面等等。而其他地方，比如模版的js文件和CSS文件，因为这些文件不用被PHP引擎执行，没经过WordPress的处理，所以没有压缩。不过，K2模版的几个js是特例，因为他们都是做成PHP文件，包含了wp-blog-header.php文件，并在文件启动了gzip压缩。</div>]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=209" /> 
<id>http://www.claymorephp.com/?article_id=209</id>
</entry>	<entry>
<title type="html"><![CDATA[服务器网页缓存的深入分析]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=208</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Cybernet" label="Cybernet" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Web相关" label="Web相关" /> 
<updated>2008-11-02 22:11:06</updated>
<published>2008-11-02 22:11:06</published>
<summary type="html"><![CDATA[<div>Expires、Cache-Control、Last-Modified、ETag是RFC 2616（HTTP/1.1）协议中和网页缓存相关的几个字段。前两个用来控制缓存的失效日期，后两个用来验证网页的有效性。要注意的是， HTTP/1.0有一个功能比较弱的缓存控制机制：Pragma，使用HTTP/1.0的缓存将忽略Expires和Cache-Control头。我们 这里以Apache2.0服务器为例，只讨论HTTP/1.1协议。</div>
<div><BR>Expires<BR>&nbsp;&nbsp;&nbsp; Expires字段声明了一个网页或URL地址不再被浏览器缓存的时间，一旦超过了这个时间，浏览器都应该联系原始服务器。RFC告诉我们：“由于推断的失效时间也许会降低语义透明度，应该被谨慎使用，同时我们鼓励原始服务器尽可能提供确切的失效时间。”</div>
<div><BR>&nbsp;&nbsp;&nbsp; 对于一般的纯静态页面，如html、gif、jpg、css、js，默认安装的Apache服务器，不会在响应头添加这个字段。Firefox浏览器接受 到相应后，如果发现没有Expires字段，浏览器根据文件的类型和“Last-Modified”字段来推断出一个合适的失效时间，并存储在客户端。推 测出的时间一般是接受到响应时间后的三天左右。</div>
]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=208" /> 
<id>http://www.claymorephp.com/?article_id=208</id>
</entry>	<entry>
<title type="html"><![CDATA[Apache mod_expires]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=207</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Cybernet" label="Cybernet" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Web相关" label="Web相关" /> 
<updated>2008-11-02 22:03:49</updated>
<published>2008-11-02 22:03:49</published>
<summary type="html"><![CDATA[<DIV>可用的指令如下：</DIV>
<DIV><BR>ExpiresActive on|off<BR>ExpiresDefault &lt;code&gt;&lt;seconds&gt;<BR>ExpiresByType type/encoding &lt;code&gt;&lt;seconds&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>1.其中&lt;code&gt;为M或者A<BR>M =&gt;&nbsp; Expires Header显示文件将在此文件的修改时间+&lt;seconds&gt;后超时<BR>A =&gt;&nbsp; Expires Header显示文件将在此文件的访问时间+&lt;seconds&gt;后超时</DIV>
<DIV>&nbsp;</DIV>
<DIV>2.&lt;seconds&gt;必须为一整数</DIV>
<DIV>例如：对于每小时自动生成的文件来说可以设置1小时过期<BR>ExpiresDefault M3600&nbsp;&nbsp;&nbsp; </DIV>
<DIV>例如：根据类型设定不同的过期时间<BR>ExpiresByType text/html A604800&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # 1周<BR>ExpiresByType image/gif A2592000&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # 一个月</DIV>
<DIV>ExpiresActive On|Off可以在.htaccess中设置来针对某目录进行开启|关闭。</DIV>
<DIV>还有更人性化一点的写法：<BR>ExpiresDefault "&lt;base&gt; [plus] {&lt;num&gt; &lt;type&gt;}*"<BR>ExpiresByTypeDefault&nbsp; type/encoding "&lt;base&gt; [plus] {&lt;num&gt; &lt;type&gt;}*"<BR>其中</DIV>
]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=207" /> 
<id>http://www.claymorephp.com/?article_id=207</id>
</entry>	<entry>
<title type="html"><![CDATA[如何提高Web页面的性能]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=206</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Cybernet" label="Cybernet" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Web相关" label="Web相关" /> 
<updated>2008-11-02 21:38:05</updated>
<published>2008-11-02 21:38:05</published>
<summary type="html"><![CDATA[1. 尽可能的减少 HTTP 的请求数 [content] <BR>2. 使用 CDN（Content Delivery Network） [server] <BR>3. 添加 Expires 头(或者 Cache-control ) [server] <BR>4. Gzip 组件 [server] <BR>5. 将 CSS 样式放在页面的上方 [css] <BR>6. 将脚本移动到底部（包括内联的） [javascript] <BR>7. 避免使用 CSS 中的 Expressions [css] <BR>8. 将 JavaScript 和 CSS 独立成外部文件 [javascript] [css] <BR>9. 减少 DNS 查询 [content] <BR>10. 压缩 JavaScript 和 CSS (包括内联的) [javascript] [css] <BR>11. 避免重定向 [server] <BR>12. 移除重复的脚本 [javascript] <BR>13. 配置实体标签（ETags） [css] <BR>14. 使 AJAX 缓存 [content]<BR>15. 尽早清除缓冲区 [server] <BR>16. AJAX 请求使用“GET”方法 [server] <BR>17. 延迟加载组件 [content] <BR>18. 预加载组件 [content] <BR>19. 减少 DOM 元素的数量 [content] <BR>20. 跨域分离组件 [content] <BR>21. 减少 iframes 的数量 [content] <BR>22. 不出现 404 [content] ]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=206" /> 
<id>http://www.claymorephp.com/?article_id=206</id>
</entry>	<entry>
<title type="html"><![CDATA[面向站长和网站管理员的Web缓存加速指南]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=205</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Cybernet" label="Cybernet" /> 
<category term="" scheme="http://www.claymorephp.com/?category=Web相关" label="Web相关" /> 
<updated>2008-11-02 18:33:36</updated>
<published>2008-11-02 18:33:36</published>
<summary type="html"><![CDATA[<DIV>
<DIV>这是一篇知识性的文档，主要目的是为了让Web缓存相关概念更容易被开发者理解并应用于实际的应用环境中。为了简要起见，某些实现方面的细节被简化或省略了。如果你更关心细节实现则完全不必耐心看完本文，后面参考文档和更多深入阅读部分可能是你更需要的内容。</DIV>
<OL>
<LI>什么是Web缓存，为什么要使用它？ 
<LI>缓存的类型： 
<OL>
<LI>浏览器缓存； 
<LI>代理服务器缓存；</LI></OL>
<LI>Web缓存无害吗？为什么要鼓励缓存？ 
<LI>Web缓存如何工作： 
<LI>如何控制（控制不）缓存： 
<OL>
<LI>HTML Meta标签 vs. HTTP头信息； 
<LI>Pragma HTTP头信息（为什么不起作用）； 
<LI>使用Expires（过期时间）HTTP头信息控制保鲜期； 
<LI>Cache-Control（缓存控制） HTTP头信息； 
<LI>校验参数和校验；</LI></OL>
<LI>创建利于缓存网站的窍门； 
<LI>编写利于缓存的脚本； 
<LI>常见问题解答； 
<LI>缓存机制的实现：Web服务器端配置； 
<LI>缓存机制的实现：服务器端脚本； 
<LI>参考文档和深入阅读； 
<LI>关于本文档；</LI></OL>
</div>]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=205" /> 
<id>http://www.claymorephp.com/?article_id=205</id>
</entry>	<entry>
<title type="html"><![CDATA[PHP与浏览器缓存]]></title>
<author>
	<name>claymore</name>
	<uri>http://www.claymorephp.com/?article_id=204</uri>
	<email>claymore1986@yahoo.cn</email>
</author>
<maincategory term="" scheme="http://www.claymorephp.com/?maincategory=Programming" label="Programming" /> 
<category term="" scheme="http://www.claymorephp.com/?category=PHP" label="PHP" /> 
<updated>2008-11-02 16:29:31</updated>
<published>2008-11-02 16:29:31</published>
<summary type="html"><![CDATA[<DIV>我们往往在服务器上对缓存设置进行各种优化方案，但是我们却很少注意到客户端缓存，准确的说是浏览器的缓存机制。</DIV><BR>
<DIV>其实每种浏览器都有缓存策略，会暂时将每一个浏览过的文件缓存在一个特殊的文件夹里。我们就可以在用户重复提交页面请求的时候，告诉用户这个页面没有改变，可以调用缓存。 那我们怎么知道用户有没有这个页面的缓存数据呢？ 其实浏览器在发送请求的时候会先发送http头，一般象这样： </DIV><BR>
<DIV>Date: Sun, 30 Jul 2006 09:18:11 GMT <BR>Content-Type: image/gif <BR>Last-Modified: Wed, 19 Jul 2006 07:40:06 GMT <BR>ETag: "8c55da8d6abc61:2327" <BR>Content-Length: 14757</DIV>
<DIV><BR>其中</DIV><BR>
<DIV>Last-Modified: Wed, 19 Jul 2006 07:40:06 GMT <BR>ETag: "8c55da8d6abc61:2327"</DIV><BR>
<DIV>就是有关页面的缓存信息的。然后如果服务器返回的响应代码不是HTTP 200 (OK)，而是 304的话，浏览器就会从缓存中读取数据。&nbsp;</DIV>
]]></summary>
<link rel="alternate" type="text/html" href="http://www.claymorephp.com/?article_id=204" /> 
<id>http://www.claymorephp.com/?article_id=204</id>
</entry>	</feed>