<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Becomin&#039; Charles</title>
	<atom:link href="http://sexywp.com/feed" rel="self" type="application/rss+xml" />
	<link>http://sexywp.com</link>
	<description>Building another myself~~</description>
	<lastBuildDate>Sun, 12 Feb 2012 06:15:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Mac OS X Lion 终端快捷键</title>
		<link>http://sexywp.com/mac-os-x-lion-terminal-shortcut.htm</link>
		<comments>http://sexywp.com/mac-os-x-lion-terminal-shortcut.htm#comments</comments>
		<pubDate>Sun, 12 Feb 2012 06:15:33 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[日　　记]]></category>
		<category><![CDATA[Mac terminal shortcut]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=473</guid>
		<description><![CDATA[虽然Mac OS 提供了令人目眩神驰的界面效果，但是，我觉得我的最爱始终是终端，这到不是因为我有什么geek的癖好，而是因为到了*NIX系统上后，使用终端得心应手，就好像使用Windows，你喜欢点开开始菜单，或者习惯性打开资源管理器，是一个道理。

Mac的终端是连接的使系统底层的Unix系统，名字叫Darwin，这个终端也支持许多的快捷键，记录下来，希望对大家有点帮助。



<span class="readmore"><a href="http://sexywp.com/mac-os-x-lion-terminal-shortcut.htm" title="Mac OS X Lion 终端快捷键">Keep Reading --- 323 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="使Mac OS X的终端看起来更舒服" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使Mac OS X的终端看起来更舒服</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Mac OS X上如何实现到Linux主机的ssh免登陆" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Mac上的WordPress客户端MarsEdit" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Mac上的WordPress客户端MarsEdit</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="杭州游（二）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flive-in-hangzhou2.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/07/03/15790859.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">杭州游（二）</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="升级到WordPress2.7版本~~" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fupdate-to-wp27.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/08/30/26374211.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">升级到WordPress2.7版本~~</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>虽然Mac OS 提供了令人目眩神驰的界面效果，但是，我觉得我的最爱始终是终端，这到不是因为我有什么geek的癖好，而是因为到了*NIX系统上后，使用终端得心应手，就好像使用Windows，你喜欢点开开始菜单，或者习惯性打开资源管理器，是一个道理。</p>
<p>Mac的终端是连接的使系统底层的Unix系统，名字叫Darwin，这个终端也支持许多的快捷键，记录下来，希望对大家有点帮助。</p>
<table>
<thead>
<tr>
<th>快捷键</th>
<th>功能</th>
</tr>
</thead>
<tbody>
<tr>
<td>
Ctrl + a
</td>
<td>
移动到开头
</td>
</tr>
<tr>
<td>
Ctrl + e
</td>
<td>
移动到结尾
</td>
</tr>
<tr>
<td>
Ctrl + b
</td>
<td>
向左移动一个字符（助记back）
</td>
</tr>
<tr>
<td>
Ctrl + f
</td>
<td>
向右移动一个字符（助记forward）
</td>
</tr>
<tr>
<td>
Option + Left
</td>
<td>
向左移动一个单词
</td>
</tr>
<tr>
<td>
Option + Right
</td>
<td>
向右移动一个单词
</td>
</tr>
<tr>
<td>
Ctrl + h
</td>
<td>
向左删除一个字符
</td>
</tr>
<tr>
<td>
Ctrl + w
</td>
<td>
向左删除一个单词
</td>
</tr>
<tr>
<td>
Ctrl + k
</td>
<td>
向右删除到行尾
</td>
</tr>
<tr>
<td>
Ctrl + t
</td>
<td>
交换行尾两个字符顺序
</td>
</tr>
<tr>
<td>
Esc + t
</td>
<td>
交换行尾两个单词顺序
</td>
</tr>
<tr>
<td>
Ctrl + l
</td>
<td>
清屏
</td>
</tr>
<tr>
<td>
Ctrl + d
</td>
<td>
相当于退出、logout、exit等命令
</td>
</tr>
<tr>
<td>
Shift + Cmd + 鼠标双击
</td>
<td>
快速选中路径
</td>
</tr>
</tbody>
</table>
<p>还有些别的东西，大家可以看看这个： http://qingbo.net/blog/post438.html</p>
<p>个人觉得set -o vi 是神器</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="使Mac OS X的终端看起来更舒服" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使Mac OS X的终端看起来更舒服</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Mac OS X上如何实现到Linux主机的ssh免登陆" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Mac上的WordPress客户端MarsEdit" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Mac上的WordPress客户端MarsEdit</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="杭州游（二）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flive-in-hangzhou2.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/07/03/15790859.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">杭州游（二）</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="升级到WordPress2.7版本~~" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fupdate-to-wp27.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/08/30/26374211.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">升级到WordPress2.7版本~~</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/mac-terminal-shortcut" title="Mac terminal shortcut" rel="tag">Mac terminal shortcut</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/mac-os-x-lion-terminal-shortcut.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yii框架base包代码分析</title>
		<link>http://sexywp.com/yii-package-base-source-code-analysis.htm</link>
		<comments>http://sexywp.com/yii-package-base-source-code-analysis.htm#comments</comments>
		<pubDate>Sun, 20 Nov 2011 13:46:32 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Yii]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[code reading]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[yii]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=466</guid>
		<description><![CDATA[周日闲来无事，打开Yii的源代码学习一下，今天主要看的代码都是base包里面的，也就是框架根目录下的base目录里的代码。这个目录里的代码不多，但是类很多，而且这些类对整个框架来说至关重要，都是非常基本的组件。老实说，这里面的代码，我已经看了无数次了，但是总觉得常看常新，转念一想，这也实属正常，毕竟这是原作者数年框架开发经验的结晶，岂是我这等工作一两年的菜鸟能随便吃透的？

最近又玩了两次Visual Paradigm这个软件，觉得自己操作水平又有进步，甚感欣喜，所以今天既然分析源代码，就正好再练练手，于是乎，我开始用VP UML开始画base包里的类，得图如下。（说明：这个图是基于Yii的1.1.8版本，另外这里面少了两个类，因为这两个类的功能比较特殊，我没有细看，所以也就没有画在图里，看后面是不是有兴致再来专门画一张，缺失的两个类是CSecurityManager和CStatePersister。）

<span class="readmore"><a href="http://sexywp.com/yii-package-base-source-code-analysis.htm" title="Yii框架base包代码分析">Keep Reading --- 2459 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架中验证器的allowEmpty属性" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架中验证器的allowEmpty属性</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用Gii时出现403错误" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Ferror-403-occured-when-use-gii.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用Gii时出现403错误</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="MVC最佳实践" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC最佳实践</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>周日闲来无事，打开Yii的源代码学习一下，今天主要看的代码都是base包里面的，也就是框架根目录下的base目录里的代码。这个目录里的代码不多，但是类很多，而且这些类对整个框架来说至关重要，都是非常基本的组件。老实说，这里面的代码，我已经看了无数次了，但是总觉得常看常新，转念一想，这也实属正常，毕竟这是原作者数年框架开发经验的结晶，岂是我这等工作一两年的菜鸟能随便吃透的？</p>
<p>最近又玩了两次Visual Paradigm这个软件，觉得自己操作水平又有进步，甚感欣喜，所以今天既然分析源代码，就正好再练练手，于是乎，我开始用VP UML开始画base包里的类，得图如下。（说明：这个图是基于Yii的1.1.8版本，另外这里面少了两个类，因为这两个类的功能比较特殊，我没有细看，所以也就没有画在图里，看后面是不是有兴致再来专门画一张，缺失的两个类是CSecurityManager和CStatePersister。）<span id="more-466"></span></p>
<p><a href="https://picasaweb.google.com/lh/photo/zJ2ZqfcpDfOnu9JobQXA6w?feat=embedwebsite"><img src="https://lh5.googleusercontent.com/-SduLV1_OW1Y/Tsi7h2YNRcI/AAAAAAAAB7U/jSpUIlrODGg/s640/YiiFramework-base.png" height="640" width="545" /></a></p>
<p>从这个图里各个类占的面积里，我们不难看出，最重要的类有四个，CComponent，CModule，CApplication，CModel。事实上，这四个类也贯穿着Yii框架应用开发过程的始终，扮演着至关重要的角色。然而，如果你真的用Yii开发应用，可能一个应用做完了，却又没怎么见过这四个类的踪影，因为他们太基础了，始终处在水面之下，使得你可能根本就忽视了它们的存在。下面，我就一个一个来简单说一下我的学习心得。</p>
<p>CComponent类，是整个Yii框架组件模型的基础，Yii框架内几乎所有的对象都是组件，其基类都是CComponent。细看其方法，我们发现基本上可以归类为三种，一是魔术方法，就是一些双下划线开头的方法，一是跟Behavior有关的方法，最后是跟Event有关的方法。这也就引出了组件的三大主要特性。属性成员，事件驱动和行为。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架中验证器的allowEmpty属性" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架中验证器的allowEmpty属性</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用Gii时出现403错误" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Ferror-403-occured-when-use-gii.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用Gii时出现403错误</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="MVC最佳实践" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC最佳实践</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/analytics" title="analytics" rel="tag">analytics</a>, <a href="http://sexywp.com/tags/code-reading" title="code reading" rel="tag">code reading</a>, <a href="http://sexywp.com/tags/framework" title="framework" rel="tag">framework</a>, <a href="http://sexywp.com/tags/source-code" title="source code" rel="tag">source code</a>, <a href="http://sexywp.com/tags/yii-2" title="yii" rel="tag">yii</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/yii-package-base-source-code-analysis.htm/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>jQuery里面用到“打包盒”</title>
		<link>http://sexywp.com/jquery-wrappers.htm</link>
		<comments>http://sexywp.com/jquery-wrappers.htm#comments</comments>
		<pubDate>Sat, 22 Oct 2011 17:45:43 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[code reading]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=463</guid>
		<description><![CDATA[想学学怎么写jQuery的插件，结果发现举步维艰，于是想通过研究插件代码的案例，来积累经验，结果看到第一行，我就郁闷了，天下间最郁闷的事情莫过于你出门去约会，结果刚打开门，就摔个狗吃屎，现在我就那个感觉。看代码：

&#160;//第一种“包装盒”

&#160;(function($){

<span class="readmore"><a href="http://sexywp.com/jquery-wrappers.htm" title="jQuery里面用到“打包盒”">Keep Reading --- 1034 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fshare-this-jquery.htm&from=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress插件修改：Share This (jQuery)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm&from=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">也说用jQuery改进WP评论表单</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fthickbox-tips.htm&from=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[心得]：在thickbox退出时执行动作</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Finside-wordpress-01.htm&from=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress到底在整啥？—(01)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Finside-wordpress-03.htm&from=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress到底在整啥？—(03)</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>想学学怎么写jQuery的插件，结果发现举步维艰，于是想通过研究插件代码的案例，来积累经验，结果看到第一行，我就郁闷了，天下间最郁闷的事情莫过于你出门去约会，结果刚打开门，就摔个狗吃屎，现在我就那个感觉。看代码：</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: #ffa500;">//</span><span style="color: #ffa500;">第一种“包装盒”</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">(</span><span style="color: Green;">function</span><span style="color: Olive;">(</span><span style="color: Gray;">$</span><span style="color: Olive;">)</span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;"> to do things here, I like use this way</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span><span style="color: Olive;">)</span><span style="color: Olive;">(</span><span style="color: Blue;">jQuery</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">第二种“包装盒”</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">(</span><span style="color: Green;">function</span><span style="color: Olive;">(</span><span style="color: Teal;">window</span><span style="color: Gray;">, </span><span style="color: Blue;">undefined</span><span style="color: Olive;">)</span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;"> this is the wrapper of jquery</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span><span style="color: Olive;">)</span><span style="color: Olive;">(</span><span style="color: Teal;">window</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">第三种“包装盒”</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">(</span><span style="color: Green;">function</span><span style="color: Olive;">(</span><span style="color: Gray;">$, </span><span style="color: Blue;">undefined</span><span style="color: Olive;">)</span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;"> this is the wrapper of jquery ui components</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span><span style="color: Olive;">(</span><span style="color: Blue;">jQuery</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li></ol></div></div>
<p>闭包是个好东西啊，自打初窥门径后，我干什么都喜欢在外面套个闭包，我把这个称为是打包盒，而且这个盒子很神奇，里面看得到外面，但是外面看不到里面。好处很多，比如可以放心大胆地命名变量啊，不用担心污染全局空间，也不用担心被全局空间的其他变量污染，还有像上面片段里，第一种那种写法，可以非常安全地去使用$符号代表的jQuery对象。因为在全局空间里，如果一个页面上引入多个类库的话，$符号很可能代表的不是jQuery对象，而用了第一种写法后，$符号变得很安全了。</p>
<p>翻开jQuery和其各类插件的源代码，你会发现，它们都被安放在一些“打包盒”里面，不禁有种英雄所见略同的感觉，但是不要感觉太好，为什么人家用的，跟我用的不太一样呢？看第二种，是jQuery用的“打包盒”。乍看跟第一种很像，但是那两个形参，简直匪夷所思。第一个是window，这明显是地球人都知道的全局变量啊，第二个是undefined，这更加神了@#$%^&#038;。<a href="http://ued.alipay.com/wd/2010/05/17/using-window-and-undefined-as-parameter-in-closure/">淘宝UED</a>有篇文章解释了这个问题。文章观点大体是，将window由全局变量变为形参，可以在后期代码最小化时候，通过对局部变量名的替换，来大幅度减小代码体积，这算是一个优化吧，undefined那个同理。另一点文中提到的是，undefined可以被重新定义成自定义的值，也即可能被污染，使用这种方式，会得到真正的一个undefined。当然，我的眼光和专业程度也止于此了，但是我还是觉得，还有可能有一些额外的好处，如果看官童鞋你知道，请不吝赐教。</p>
<p>第三种的话，看过了两种，基本上已经有点差不多全懂了，但是仔细一看，还差那么一点的。$形参，和undefined形参不多解释了。请大家关注那个不同点，就是最后一个闭合小括号的位置，发现了吧，最后闭合小括号，为什么是放在最后面了呢？由此我也发现了一个特性，就是在小括号里面的匿名函数，如果在函数结束的大括号后面，直接跟一对小括号的话，会使那个匿名函数立刻执行。如果离开了外面那对小括号，匿名函数是不能生存的，如果是具名函数呢，在闭合大括号后，跟一对小括号，也无法实现对函数的立即调用，反倒会有语法错误。但是还是来看最关键的那个不同，如下：</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: #ffa500;">//</span><span style="color: #ffa500;">写法A</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">(</span><span style="color: Green;">function</span><span style="color: Olive;">(</span><span style="color: Gray;">$, </span><span style="color: Blue;">undefined</span><span style="color: Olive;">)</span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;"> this is the wrapper of jquery ui components</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span><span style="color: Olive;">(</span><span style="color: Blue;">jQuery</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Gray;">; </span></li>
<li><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">写法B</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">(</span><span style="color: Green;">function</span><span style="color: Olive;">(</span><span style="color: Gray;">$, </span><span style="color: Blue;">undefined</span><span style="color: Olive;">)</span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;"> this is the wrapper of jquery ui components</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span><span style="color: Olive;">)</span><span style="color: Olive;">(</span><span style="color: Blue;">jQuery</span><span style="color: Olive;">)</span><span style="color: Gray;">; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">不用找茬了，这行不一样，看“)”的位置</span></li></ol></div></div>
<p>这两种“包装盒”到底有何不同？第一种比第二种有什么特别的好处么？</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fshare-this-jquery.htm&from=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress插件修改：Share This (jQuery)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fprogress-enhancement-of-comment-form.htm&from=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">也说用jQuery改进WP评论表单</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fthickbox-tips.htm&from=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[心得]：在thickbox退出时执行动作</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Finside-wordpress-01.htm&from=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress到底在整啥？—(01)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Finside-wordpress-03.htm&from=http%3A%2F%2Fsexywp.com%2Fjquery-wrappers.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WordPress到底在整啥？—(03)</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/code-reading" title="code reading" rel="tag">code reading</a>, <a href="http://sexywp.com/tags/jquery" title="jQuery" rel="tag">jQuery</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/jquery-wrappers.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>怎么觉得Python这么混乱呢</title>
		<link>http://sexywp.com/why-python-code-mess.htm</link>
		<comments>http://sexywp.com/why-python-code-mess.htm#comments</comments>
		<pubDate>Mon, 03 Oct 2011 16:49:09 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[工作相关]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=461</guid>
		<description><![CDATA[开始学习写Python，写了一两个小脚本后，就产生了非常奇怪的感觉，我怎么觉得Python看着这么混乱呢？

一个是没有大括号了，代码那种段落感没了，第二个是没有分号了，觉得一行总是没完似的。靠缩进来流程控制，觉得非常难受，总是习惯性地搞不清楚一个if和一个for的结束在什么地方，为啥不像pascal和VB那样，加个关闭之类的东西，也让人看着舒服点。代码说完，再说说文档，去官网查文档，感觉那文档视觉效果跟代码一样，没有括号，分号这样分块，断句的地方。那文档就是秘密麻麻一片，从上到下，页面长长的一串，而且还太宽，连个索引也没有，还得不停地ctrl+F来找函数。排版也忒鹾了吧？

<span class="readmore"><a href="http://sexywp.com/why-python-code-mess.htm" title="怎么觉得Python这么混乱呢">Keep Reading --- 296 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm&from=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">如何在Debian上安装PHPUnit</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2F20101103-green-hand-sucks.htm&from=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">20101103 今天犯了好几个严重低级错误</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>开始学习写Python，写了一两个小脚本后，就产生了非常奇怪的感觉，我怎么觉得Python看着这么混乱呢？</p>
<p>一个是没有大括号了，代码那种段落感没了，第二个是没有分号了，觉得一行总是没完似的。靠缩进来流程控制，觉得非常难受，总是习惯性地搞不清楚一个if和一个for的结束在什么地方，为啥不像pascal和VB那样，加个关闭之类的东西，也让人看着舒服点。代码说完，再说说文档，去官网查文档，感觉那文档视觉效果跟代码一样，没有括号，分号这样分块，断句的地方。那文档就是秘密麻麻一片，从上到下，页面长长的一串，而且还太宽，连个索引也没有，还得不停地ctrl+F来找函数。排版也忒鹾了吧？</p>
<p>目前都还只是视觉上的别扭吧。估计Python的粉要来嘲我了。再往后学学吧～</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm&from=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">如何在Debian上安装PHPUnit</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2F20101103-green-hand-sucks.htm&from=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">20101103 今天犯了好几个严重低级错误</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/linux" title="Linux" rel="tag">Linux</a>, <a href="http://sexywp.com/tags/python" title="python" rel="tag">python</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/why-python-code-mess.htm/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>如何配置RHEL的iptables开放端口</title>
		<link>http://sexywp.com/%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%aerhel%e7%9a%84iptables%e5%bc%80%e6%94%be%e7%ab%af%e5%8f%a3.htm</link>
		<comments>http://sexywp.com/%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%aerhel%e7%9a%84iptables%e5%bc%80%e6%94%be%e7%ab%af%e5%8f%a3.htm#comments</comments>
		<pubDate>Sun, 02 Oct 2011 03:53:47 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[rhel]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=460</guid>
		<description><![CDATA[要给一个朋友的服务器上架设ftp，一看，这哥们的服务器装的是RHEL AS4，看到这个发行版的名字，我就发怵了，果不其然，么有包管理器，我简直寸步难行，什么软件都没法装，各种依赖，太难解决了！！

看了一下已经安装的软件列表，发现已经装了vsftpd，就用这个吧，man了半天，最后配好了，但是一连，发现死活连不上，百思不得其解，各种google，各种百度，也不知道过了多少天，才发现问题的症结在iptables，原来，要使用passive mode登陆ftp，必须开一个范围的端口，而系统默认的iptables规则，不允许对这些端口的访问，导致ftp连不上。怎么开放iptables的端口呢？又是各种google，各种百度，搜到一个iptables的tutorial，竟然有290页之厚，太难用了。

<span class="readmore"><a href="http://sexywp.com/%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%aerhel%e7%9a%84iptables%e5%bc%80%e6%94%be%e7%ab%af%e5%8f%a3.htm" title="如何配置RHEL的iptables开放端口">Keep Reading --- 568 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fuse-ftp-in-netbeans.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[WP开发环境]在NetBeans中配置FTP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">怎么觉得Python这么混乱呢</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>要给一个朋友的服务器上架设ftp，一看，这哥们的服务器装的是RHEL AS4，看到这个发行版的名字，我就发怵了，果不其然，么有包管理器，我简直寸步难行，什么软件都没法装，各种依赖，太难解决了！！</p>
<p>看了一下已经安装的软件列表，发现已经装了vsftpd，就用这个吧，man了半天，最后配好了，但是一连，发现死活连不上，百思不得其解，各种google，各种百度，也不知道过了多少天，才发现问题的症结在iptables，原来，要使用passive mode登陆ftp，必须开一个范围的端口，而系统默认的iptables规则，不允许对这些端口的访问，导致ftp连不上。怎么开放iptables的端口呢？又是各种google，各种百度，搜到一个iptables的tutorial，竟然有290页之厚，太难用了。</p>
<p>几经周折又找到了一个图形化系统界面可以配置防火墙规则的，system-config-securitylevel-tui，通过这个东西，很容易就可以开放一个端口，但是这个东西也有问题，我要开10000号段的端口100个，就麻烦了，虽然网上说，用格式形如10000-10100:tcp这样的写法可以开放一个系列的端口，但是实际上，这么写是不管事的，也不知道是不是软件的版本的问题。</p>
<p>最后，知道这个ui界面生成的规则被写到了/etc/sysconfig/iptables文件里面，然后又看了一下man，研究了一下如果手动配置规则的话，端口范围的写法（--dport 10000:10100），先用ui工具生成一条一个端口的规则，然后手动改文件，将端口改成范围，一重启，发现终于一切都按照预期的搞定了，真是累死我了。</p>
<p>在RHEL下面，启动，重启，关闭，查询iptables状态的方法：</p>
<p><a href="http://sexywp.com/tags/usage" class="st_tag internal_tag" rel="tag" title="标签 usage 下的日志">Usage</a>: /etc/init.d/<a href="http://sexywp.com/tags/iptables" class="st_tag internal_tag" rel="tag" title="标签 iptables 下的日志">iptables</a> {start|stop|restart|condrestart|status|panic|save}</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fuse-ftp-in-netbeans.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[WP开发环境]在NetBeans中配置FTP</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwhy-python-code-mess.htm&from=http%3A%2F%2Fsexywp.com%2F%25E5%25A6%2582%25E4%25BD%2595%25E9%2585%258D%25E7%25BD%25AErhel%25E7%259A%2584iptables%25E5%25BC%2580%25E6%2594%25BE%25E7%25AB%25AF%25E5%258F%25A3.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">怎么觉得Python这么混乱呢</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/ftp" title="ftp" rel="tag">ftp</a>, <a href="http://sexywp.com/tags/iptables" title="iptables" rel="tag">iptables</a>, <a href="http://sexywp.com/tags/linux" title="Linux" rel="tag">Linux</a>, <a href="http://sexywp.com/tags/rhel" title="rhel" rel="tag">rhel</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/%e5%a6%82%e4%bd%95%e9%85%8d%e7%bd%aerhel%e7%9a%84iptables%e5%bc%80%e6%94%be%e7%ab%af%e5%8f%a3.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac上的WordPress客户端MarsEdit</title>
		<link>http://sexywp.com/mac%e4%b8%8a%e7%9a%84wordpress%e5%ae%a2%e6%88%b7%e7%ab%afmarsedit.htm</link>
		<comments>http://sexywp.com/mac%e4%b8%8a%e7%9a%84wordpress%e5%ae%a2%e6%88%b7%e7%ab%afmarsedit.htm#comments</comments>
		<pubDate>Fri, 30 Sep 2011 15:59:11 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[blogging]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[MarsEdit]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=459</guid>
		<description><![CDATA[以前写博客，我就喜欢使用客户端，感觉客户端更像是在自己的地盘，用网页界面写博客，就感觉像在论坛发贴一样。少了一种严肃，多了一种随意。后来博客荒废已经多年，今天偶然想起来写一下，还是想用客户端写，于是好奇地在Google上搜了一下，找到了我现在用的这个MarsEdit（火星编辑器？哈哈）

这款客户端软件非常完美地体现了MacOS的设计哲学，高度的用户友好，不把用户不懂的东西暴露给用户。你只需要告诉软件，你的部落格的网址是什么，然后他就帮你做好一切，最多是问你要一下登陆密码，从这点来说，可能比Windows下的Windows Live Writer更加友好。输入完密码，就会使用一个看起来像是Mail的一个界面来展示你部落格的所有文章列表，这是一种体验延续，或者也是一种体验借鉴，因为所有的Mac系统预装Mail，所以，作者恐怕觉得让界面长得像Mail，就能极大地减少教育成本。（我觉得这个设计思路相当值得借鉴，要想你的东西不言自明，一种是让用户不会犯错，无敌简单的UI，比如只有一个按钮，另一种，就是站在巨人肩膀上，重复用户非常熟悉的一种体验）。创建新文章，也像是写一封邮件一样，首先选一个blog（收件人），然后写标题，然后是tags，地下就是正文编辑区域。与Mail不同的是右侧多了分类列表和博文的基本属性。

<span class="readmore"><a href="http://sexywp.com/mac%e4%b8%8a%e7%9a%84wordpress%e5%ae%a2%e6%88%b7%e7%ab%afmarsedit.htm" title="Mac上的WordPress客户端MarsEdit">Keep Reading --- 588 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Mac OS X Lion 终端快捷键" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm&from=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Mac OS X Lion 终端快捷键</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="免费WordPress主题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Ffree-wordpress-themes.htm&from=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/02/10603183.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">免费WordPress主题</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress主题：GoogleCode" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwordpress-theme-googlecode.htm&from=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170670.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题：GoogleCode</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress备份及灾难恢复" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwordpress-backup-restore.htm&from=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress备份及灾难恢复</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress到底在整啥？—Special" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Finside-wordpress-special-01.htm&from=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress到底在整啥？—Special</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>以前写博客，我就喜欢使用客户端，感觉客户端更像是在自己的地盘，用网页界面写博客，就感觉像在论坛发贴一样。少了一种严肃，多了一种随意。后来博客荒废已经多年，今天偶然想起来写一下，还是想用客户端写，于是好奇地在Google上搜了一下，找到了我现在用的这个MarsEdit（火星编辑器？哈哈）</p>
<p>这款客户端软件非常完美地体现了MacOS的设计哲学，高度的用户友好，不把用户不懂的东西暴露给用户。你只需要告诉软件，你的部落格的网址是什么，然后他就帮你做好一切，最多是问你要一下登陆密码，从这点来说，可能比Windows下的Windows Live Writer更加友好。输入完密码，就会使用一个看起来像是Mail的一个界面来展示你部落格的所有文章列表，这是一种体验延续，或者也是一种体验借鉴，因为所有的Mac系统预装Mail，所以，作者恐怕觉得让界面长得像Mail，就能极大地减少教育成本。（我觉得这个设计思路相当值得借鉴，要想你的东西不言自明，一种是让用户不会犯错，无敌简单的UI，比如只有一个按钮，另一种，就是站在巨人肩膀上，重复用户非常熟悉的一种体验）。创建新文章，也像是写一封邮件一样，首先选一个blog（收件人），然后写标题，然后是tags，地下就是正文编辑区域。与Mail不同的是右侧多了分类列表和博文的基本属性。</p>
<p>本文写地有点四不像了，说白了，其实也就是我想借机会测试一下这款客户端编辑器的效果怎么样。结论，东西还不错，比较好用，兼容中文也比较好，支持HTML所见即所得，也支持HTML代码直接编辑。支持预览。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Mac OS X Lion 终端快捷键" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm&from=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Mac OS X Lion 终端快捷键</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="免费WordPress主题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Ffree-wordpress-themes.htm&from=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/02/10603183.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">免费WordPress主题</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress主题：GoogleCode" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwordpress-theme-googlecode.htm&from=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170670.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress主题：GoogleCode</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress备份及灾难恢复" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwordpress-backup-restore.htm&from=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress备份及灾难恢复</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress到底在整啥？—Special" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Finside-wordpress-special-01.htm&from=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress到底在整啥？—Special</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/blogging" title="blogging" rel="tag">blogging</a>, <a href="http://sexywp.com/tags/client" title="client" rel="tag">client</a>, <a href="http://sexywp.com/tags/mac" title="mac" rel="tag">mac</a>, <a href="http://sexywp.com/tags/marsedit" title="MarsEdit" rel="tag">MarsEdit</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/mac%e4%b8%8a%e7%9a%84wordpress%e5%ae%a2%e6%88%b7%e7%ab%afmarsedit.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Mac OS X上如何实现到Linux主机的ssh免登陆</title>
		<link>http://sexywp.com/mac-os-x-ssh-key-pair-login-linux.htm</link>
		<comments>http://sexywp.com/mac-os-x-ssh-key-pair-login-linux.htm#comments</comments>
		<pubDate>Sun, 04 Sep 2011 03:53:53 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[usage]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=458</guid>
		<description><![CDATA[本文要讲的，就是如何简化从Mac登录Linux主机的操作步骤，提高效率。所谓的“免登陆”其实是不存在的，只是说，从验证密码的登录方式，改为公私钥对的登录验证方式。使用后者的方式，每次会由ssh客户端自动发送验证信息，所以就免去了人工输入密码，看起来好像“免登陆”一样。

关于这么做的原理，大家可以自己去Google，关键词是“非对称加密”，“RSA算法”，“基于ssh密钥对的自动登录”，等等，我就不多解释了。我直接说操作步骤吧：



<span class="readmore"><a href="http://sexywp.com/mac-os-x-ssh-key-pair-login-linux.htm" title="Mac OS X上如何实现到Linux主机的ssh免登陆">Keep Reading --- 810 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">VIM常用小窍门收集</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使Mac OS X的终端看起来更舒服</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X Lion 终端快捷键</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>本文要讲的，就是如何简化从Mac登录Linux主机的操作步骤，提高效率。所谓的“免登陆”其实是不存在的，只是说，从验证密码的登录方式，改为公私钥对的登录验证方式。使用后者的方式，每次会由ssh客户端自动发送验证信息，所以就免去了人工输入密码，看起来好像“免登陆”一样。</p>
<p>关于这么做的原理，大家可以自己去Google，关键词是“非对称加密”，“RSA算法”，“基于ssh密钥对的自动登录”，等等，我就不多解释了。我直接说操作步骤吧：</p>
<ol>
<li>生成密钥对</li>
<li>用密码登录远程主机，将公钥拷贝过去</li>
<li>done</li>
</ol>
<p>怎么样，无敌简单吧？</p>
<h2>生成密钥对</h2>
<p>执行命令 <a href="http://sexywp.com/tags/ssh" class="st_tag internal_tag" rel="tag" title="标签 ssh 下的日志">ssh</a>-keygen -t rsa<br />
执行结果如下：</p>
<blockquote><p>
charles@<a href="http://sexywp.com/tags/mac" class="st_tag internal_tag" rel="tag" title="标签 mac 下的日志">mac</a>:~ &gt; ssh-keygen -t rsa<br />
Generating public/private rsa key pair.<br />
Enter file in which to save the key (/Users/charles/.ssh/id_rsa):<br />
Created directory '/Users/charles/.ssh'.<br />
Enter passphrase (empty for no passphrase):<br />
Enter same passphrase again:<br />
Your identification has been saved in /Users/charles/.ssh/id_rsa.<br />
Your public key has been saved in /Users/charles/.ssh/id_rsa.pub.<br />
The key fingerprint is:<br />
c8:4b:85:87:90:7c:1a:67:b6:71:f5:51:0c:9d:a2:89 charles@TCMBP.local<br />
The key's randomart image is:<br />
+--[ RSA 2048]----+<br />
|   ...   .. o=.. |<br />
|    +.*o.  ...+  |<br />
|     Bo+o. o..   |<br />
|    ...+E o      |<br />
|      + S        |<br />
|     . .         |<br />
|      .          |<br />
|                 |<br />
|                 |<br />
+-----------------+
</p></blockquote>
<p>注意：提示enter passphrase的时候，不要输入，因为你本来就想少打一次密码的，这里如果设置了用密码保护私钥，那登录的时候还是要输密码，就白做了。</p>
<p>做完这个步骤后，cd ~/.ssh，你就可以看到你刚才生成的密钥对，id_rsa是私钥，id_rsa.pub是公钥。下一步，就是把公钥拷贝到目标主机上。</p>
<h2>将公钥拷贝到目标主机</h2>
<p>用ssh登录到目标主机，然后cd ~/.ssh目录，如果目录不存在，那么要自己创建mkdir -p ~/.ssh。你今后要用哪个帐户登录主机，就在哪个帐户的home目录下操作，如果要免登陆root，就要去/root下操作。使用~比较好，不用多想了。</p>
<p>有了.ssh目录后，进去，然后把id_rsa.pub传过去，可以用scp命令，这里要做的一个主要操作，就是将id_rsa.pub，的文件内容，写到一个叫authorized_keys的文件中去，如果目标主机的相应用户名下已经有了.ssh目录和authorized_keys文件，那你操作要小心一点，可能别人也做过免登陆的设置，这个时候你要小心不要把别人的设置给覆盖了。如果没有的话，就创建文件touch ~/.ssh/authorized_keys，然后执行cat id_rsa.pub >> authorized_keys，将你的公钥写入到authorized_keys中，公钥文件.pub里面只有一行信息，上面的命令相当于把那一行信息追加到authorized_keys文件最后一行。</p>
<p>如果.ssh目录是你主机刚刚创建的，那么可能还需要改变一下这个目录的权限，将权限放低，chmod -R 0600 ~/.ssh，到此，所有设置就算做完了，你可以退出登录，在自己的主机上试一下了，现在再敲入ssh命令后，不用密码就可以登录主机了。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">VIM常用小窍门收集</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使Mac OS X的终端看起来更舒服</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X Lion 终端快捷键</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/diy" title="DIY" rel="tag">DIY</a>, <a href="http://sexywp.com/tags/linux" title="Linux" rel="tag">Linux</a>, <a href="http://sexywp.com/tags/ssh" title="ssh" rel="tag">ssh</a>, <a href="http://sexywp.com/tags/tips" title="tips" rel="tag">tips</a>, <a href="http://sexywp.com/tags/usage" title="usage" rel="tag">usage</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/mac-os-x-ssh-key-pair-login-linux.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>【边学边用】PHP5函数参数的按引用传递</title>
		<link>http://sexywp.com/php5-pass-param-by-ref.htm</link>
		<comments>http://sexywp.com/php5-pass-param-by-ref.htm#comments</comments>
		<pubDate>Fri, 26 Aug 2011 14:07:14 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[心得体会]]></category>
		<category><![CDATA[basic]]></category>
		<category><![CDATA[usage]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=454</guid>
		<description><![CDATA[PHP是支持引用的，但是关于一个变量什么时候是引用，什么时候是值，我脑子里总是迷迷糊糊的，所以，想用引用的时候，就会不自觉地在所有的地方加上&#038;符号，真的很累赘。为了缓解这个问题，我特意写了下面这个代码片段来增进自己的理解。起初，我对这个东西的理解是，对于对象来说，PHP5就是按照引用传递的。但是我现在想，可能事情不是这么一回事情。下面的代码片段中，$obj其实是A的对象的一个引用，可以理解成一个指针，函数参数$o，其实还是对$obj的拷贝，只是拷贝的是引用本身，也即，$o其实是$obj的拷贝，只是由于其拷贝了$obj，所以，$o也指向A的对象。两个指针指向一个地方，这也是为什么函数changeObj可以改变A的对象的原因。我想，这样大概从技术来说，会更加合理一点。

<span class="readmore"><a href="http://sexywp.com/php5-pass-param-by-ref.htm" title="【边学边用】PHP5函数参数的按引用传递">Keep Reading --- 315 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Dedian 5的PHP包缺少readline支持" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP 5.3.x中弃用的特性 Deprecated" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fdeprecated-features-in-php-5-3.htm&from=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP 5.3.x中弃用的特性 Deprecated</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="工作中常用的Linux命令集锦" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>PHP是支持引用的，但是关于一个变量什么时候是引用，什么时候是值，我脑子里总是迷迷糊糊的，所以，想用引用的时候，就会不自觉地在所有的地方加上&#038;符号，真的很累赘。为了缓解这个问题，我特意写了下面这个代码片段来增进自己的理解。起初，我对这个东西的理解是，对于对象来说，<a href="http://sexywp.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 PHP 下的日志">PHP</a>5就是按照引用传递的。但是我现在想，可能事情不是这么一回事情。下面的代码片段中，$obj其实是A的对象的一个引用，可以理解成一个指针，函数参数$o，其实还是对$obj的拷贝，只是拷贝的是引用本身，也即，$o其实是$obj的拷贝，只是由于其拷贝了$obj，所以，$o也指向A的对象。两个指针指向一个地方，这也是为什么函数changeObj可以改变A的对象的原因。我想，这样大概从技术来说，会更加合理一点。</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Blue;">&lt;?php</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Green;">class</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">A</span><span style="color: Gray;"> </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Green;">public</span><span style="color: Gray;">&nbsp;</span><span style="color: #00008b;">$a</span><span style="color: Gray;">=</span><span style="color: Maroon;">1</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Green;">public</span><span style="color: Gray;">&nbsp;</span><span style="color: #00008b;">$b</span><span style="color: Gray;">=</span><span style="color: Maroon;">1</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: #00008b;">$obj</span><span style="color: Gray;"> = </span><span style="color: Green;">new</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">A</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">var_dump</span><span style="color: Olive;">(</span><span style="color: #00008b;">$obj</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Green;">function</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">changeObj</span><span style="color: Olive;">(</span><span style="color: #00008b;">$o</span><span style="color: Olive;">)</span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #00008b;">$o</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">a</span><span style="color: Gray;"> = </span><span style="color: Maroon;">3</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #00008b;">$o</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">b</span><span style="color: Gray;"> = </span><span style="color: Maroon;">5</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">changeObj</span><span style="color: Olive;">(</span><span style="color: #00008b;">$obj</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">var_dump</span><span style="color: Olive;">(</span><span style="color: #00008b;">$obj</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li></ol></div></div>
<p>执行结果如下：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">object(A)#1 (2) {</li>
<li>&nbsp; [&quot;a&quot;]=&gt;</li>
<li>&nbsp; int(1)</li>
<li>&nbsp; [&quot;b&quot;]=&gt;</li>
<li>&nbsp; int(1)</li>
<li>}</li>
<li>object(A)#1 (2) {</li>
<li>&nbsp; [&quot;a&quot;]=&gt;</li>
<li>&nbsp; int(3)</li>
<li>&nbsp; [&quot;b&quot;]=&gt;</li>
<li>&nbsp; int(5)</li>
<li>}</li></ol></div>
<p>然后再看一个普通变量的引用传递的例子，这个例子里面使用的是原生的整型变量，然后函数changeInt的函数声明里，也用一般方法声明参数，普通的调用，我们发现函数不能改变$x和$y的值，这符合我们的预期，但是第二个形式的调用，就是传参数时候，带上引用标志&#038;，结果我们发现，$x和$y的值也改变了，这是为什么呢，跟上面的例子是一个原因，函数的形式参数a和b其实是$x和$y的引用的拷贝，所以a和b也指向x和y，所以，a和b可以改变x和y的值。再看最下面的一种形式，这种是我认为的真正的按照引用传递参数。非常的绕乎对吧？我也觉得如此，确实太过灵活了。确实不利于学习和理解，代码也不容易维护，如果真的想用引用传递参数，推荐用最底下一种方式，明确告诉调用的人，这里其实是引用，千万别用changeInt(&#038;$x, &#038;$y);这种形式，这个代码散步在各处，将极难定位bug。</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Blue;">&lt;?php</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: #00008b;">$x</span><span style="color: Gray;"> = </span><span style="color: Maroon;">1</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: #00008b;">$y</span><span style="color: Gray;"> = </span><span style="color: Maroon;">2</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Green;">function</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">changeInt</span><span style="color: Olive;">(</span><span style="color: #00008b;">$a</span><span style="color: Gray;">, </span><span style="color: #00008b;">$b</span><span style="color: Olive;">)</span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #00008b;">$a</span><span style="color: Gray;"> = </span><span style="color: Maroon;">3</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #00008b;">$b</span><span style="color: Gray;"> = </span><span style="color: Maroon;">4</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">changeInt</span><span style="color: Olive;">(</span><span style="color: #00008b;">$x</span><span style="color: Gray;">,</span><span style="color: #00008b;">$y</span><span style="color: Olive;">)</span><span style="color: Gray;">; </span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">var_dump</span><span style="color: Olive;">(</span><span style="color: #00008b;">$x</span><span style="color: Gray;">, </span><span style="color: #00008b;">$y</span><span style="color: Olive;">)</span><span style="color: Gray;">; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">$x = 1, $y = 2</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">changeInt</span><span style="color: Olive;">(</span><span style="color: Gray;">&amp;</span><span style="color: #00008b;">$x</span><span style="color: Gray;">, &amp;</span><span style="color: #00008b;">$y</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">var_dump</span><span style="color: Olive;">(</span><span style="color: #00008b;">$x</span><span style="color: Gray;">, </span><span style="color: #00008b;">$y</span><span style="color: Olive;">)</span><span style="color: Gray;">; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">$x = 3, $y = 4</span></li>
<li><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Green;">function</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">changeIntByRef</span><span style="color: Olive;">(</span><span style="color: Gray;">&amp;</span><span style="color: #00008b;">$a</span><span style="color: Gray;">, &amp;</span><span style="color: #00008b;">$b</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #00008b;">$a</span><span style="color: Gray;"> = </span><span style="color: Maroon;">5</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #00008b;">$b</span><span style="color: Gray;"> = </span><span style="color: Maroon;">6</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">changeIntByRef</span><span style="color: Olive;">(</span><span style="color: #00008b;">$x</span><span style="color: Gray;">, </span><span style="color: #00008b;">$y</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">var_dump</span><span style="color: Olive;">(</span><span style="color: #00008b;">$x</span><span style="color: Gray;">, </span><span style="color: #00008b;">$y</span><span style="color: Olive;">)</span><span style="color: Gray;">; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">$x = 5, $y = 6</span></li></ol></div></div>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Dedian 5的PHP包缺少readline支持" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP 5.3.x中弃用的特性 Deprecated" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fdeprecated-features-in-php-5-3.htm&from=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP 5.3.x中弃用的特性 Deprecated</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="工作中常用的Linux命令集锦" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/basic" title="basic" rel="tag">basic</a>, <a href="http://sexywp.com/tags/php" title="PHP" rel="tag">PHP</a>, <a href="http://sexywp.com/tags/usage" title="usage" rel="tag">usage</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/php5-pass-param-by-ref.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ExtJS 4 的MVC</title>
		<link>http://sexywp.com/extjs-4-mvc.htm</link>
		<comments>http://sexywp.com/extjs-4-mvc.htm#comments</comments>
		<pubDate>Sat, 09 Jul 2011 17:39:44 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[ExtJS]]></category>
		<category><![CDATA[心得体会]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[yii]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=445</guid>
		<description><![CDATA[ExtJS是我听说了很久的一个js框架了，但是从来就没有用过，读研期间寝室里有个小哥在用，不过那时候醉心于WordPress开发，也懒得理会了。现在公司里，有个上线系统用到了这个框架中的一个TreePanel组件，整个界面上，就正中间扔了一个tree panel，而且不知道什么原因，CSS还有bug，把按钮都搞破了，弄得丑陋不堪，我于是自告奋勇，仔细调试，终于修复了那个显示上的bug，从此算是初次结识了ExtJS。它真正吸引我的原因是，它能够把富客户端应用的开发，从美工和基础交互中解放出来，只需要专注于业务逻辑开发即可，从而让后台工程师也能够有能力快速开发外观专业的网站应用系统。我觉得这真是功德无量的一个事情。（如果我直觉没错，Flex框架也是这一类东西，这也是我对其有兴趣的原因，当然还没有时间尝试）

<span class="readmore"><a href="http://sexywp.com/extjs-4-mvc.htm" title="ExtJS 4 的MVC">Keep Reading --- 1529 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="MVC最佳实践" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm&from=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC最佳实践</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="MVC就是个选择题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm&from=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC就是个选择题</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="脚本语言的趋势" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Ftrends-of-script-language.htm&from=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/26/9669433.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">脚本语言的趋势</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Micheal Clayton" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmicheal-clayton.htm&from=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/09/05/28376852.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Micheal Clayton</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="参观雪龙号" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fxue-long.htm&from=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/25/9536497.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">参观雪龙号</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>ExtJS是我听说了很久的一个js框架了，但是从来就没有用过，读研期间寝室里有个小哥在用，不过那时候醉心于WordPress开发，也懒得理会了。现在公司里，有个上线系统用到了这个框架中的一个TreePanel组件，整个界面上，就正中间扔了一个tree panel，而且不知道什么原因，CSS还有bug，把按钮都搞破了，弄得丑陋不堪，我于是自告奋勇，仔细调试，终于修复了那个显示上的bug，从此算是初次结识了ExtJS。它真正吸引我的原因是，它能够把富客户端应用的开发，从美工和基础交互中解放出来，只需要专注于业务逻辑开发即可，从而让后台工程师也能够有能力快速开发外观专业的网站应用系统。我觉得这真是功德无量的一个事情。（如果我直觉没错，Flex框架也是这一类东西，这也是我对其有兴趣的原因，当然还没有时间尝试）<span id="more-445"></span></p>
<p><a href="https://picasaweb.google.com/lh/photo/6w-l2AcPyxIcU35pqAdwTA?feat=embedwebsite"><img src="https://lh6.googleusercontent.com/-NjYqHh6WjX0/ThiD-8_-xxI/AAAAAAAAB5w/jjqmfY8JrZE/s800/ExtJS%2525E5%2525AF%2525B9%2525E8%2525B1%2525A1%2525E5%252585%2525B3%2525E7%2525B3%2525BB%2525E5%25259B%2525BE.png" height="310" width="499" alt="ExtJS 4 MVC"/></a></p>
<p>据官网介绍，还有据同事<a href="http://www.showframework.com/" target="_blank">ishow</a>的描述，<a href="http://sexywp.com/tags/extjs-2" class="st_tag internal_tag" rel="tag" title="标签 extjs 下的日志">ExtJS</a> 4.x 是一个变化很大的版本，相比已经应用广泛的 3.x 来说，变了很多、新特性也很多，MVC就是它提供的新特性之一。由于我最近半年都在学习MVC模式（主要是使用Yii框架），所以这个名词更是引起了我浓厚的兴趣，这几天都在官网上看这个框架MVC的例子，直到今天，总算是摸着一点门道，于是画了上面那个图。这个四不像的图，是我个人对框架的理解的第一个具体化产物。</p>
<p>下面简单描述一下这个图。</p>
<p>1. 每个应用都有一个实体，就是Application对象实例，而每个应用同样也采用单一入口结构，有个快捷函数就是Ext.application({config})，创建一个Application对象实例，并且运行它；这里行为表现和Yii框架的Application看起来很像，创建一个实例，然后run；</p>
<p>2. Application在创建之初，会去加载Controller类，加载完毕后，会正式的lunch；</p>
<p>3. Application在lunch的时候，会创建一个Viewport对象实例，这个东西就像一个骨架一样，上面可以拼装各种View，具体说，就是各种布局形式和窗体控件，可以说是应用界面的载体；</p>
<p>4. Controller的角色完全是个粘合剂，它在加载之初，会帮忙加载跟其有关的Model，Store，View类，而其真正的作用，是通过一系列的事件处理函数，确定了每个View上面界面组件对用户交互行为的响应方法，可以说是一堆事件处理器函数的集合；这里面主要通过一个control成员函数来进行事件绑定，通过另一个叫ComponentQuery的组件，使用类似css selector的语法来定位界面上的组件，并为其绑定事件处理器；</p>
<p>5. Model是对抽象数据的具体化，或者可以这么理解，就是数据库里面的一行记录，到底是怎么变成一个对象的，将数据库字段变成了对象的属性的对应关系；而这里比Yii框架MVC模型多出来的东西，就是Store这个东西，在Yii框架里面，有强大的ORM系统，还有强大的AR将Model直接连接到了DB上，数据一出来就直接变成了对象，而在ExtJS框架中，代码全在客户端，势必就出现了透过网络来加载数据需要，而我认为，Store就是对通过网络来加载数据的过程的一个抽象，Store依赖于Model，通过关联的Model对象来获知如何将取回的数据对象化，以方便View展现，所以View是依赖Store对象的；（这里岔开一点，感觉这个Store的设计理念或许可以借鉴，由于某些原因，我们在使用PHP框架的时候，不能让Model直接连接DB，是不是也可以把数据取回最终拼接成Model对象的这个过程给抽象化成类似ExtJS中Store的这套机制呢？）</p>
<p>6. View就纯粹是一个界面组件，或者说窗体控件的集合，通过Store来加载数据并且展现到界面上，界面控件的响应都写在Controller里面，View对Controller的存在全无所知，也没有代码上的依赖；</p>
<p>总结一下，感觉这套系统的好处是在于，将View和Model都给抽象了出来，以至于它们可以更加好地被复用，做好一个面板，所有的地方都可以调用，而真正业务逻辑又被很好的封装在了Controller里面，这样也便于去模块化地开发系统，基本感觉上，是一套非常优秀的框架，由于我对ExtJS 3系列版本，没有任何经验，也就没法做出其相对于先前版本是否有质的飞跃的判断，通过仔细的挖掘，我发现其易用性上确实比我原来想象的要好，开发人员可能没太多必要去纠结于内部原理，只要理解到跟我现在差不多的样子，就可以快速上手去做一些东西出来，当然还是必须看着文档按图索骥的，嘿嘿:)</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="MVC最佳实践" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm&from=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC最佳实践</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="MVC就是个选择题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm&from=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC就是个选择题</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="风鬼！分析用户注意力焦点的人工智能" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Ffeng-gui.htm&from=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/24/9390964.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">风鬼！分析用户注意力焦点的人工智能</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="免费WordPress主题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Ffree-wordpress-themes.htm&from=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/02/10603183.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">免费WordPress主题</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress插件：选项查看器" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fplugin-options-inspector.htm&from=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/31/10319696.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress插件：选项查看器</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/analytics" title="analytics" rel="tag">analytics</a>, <a href="http://sexywp.com/tags/development" title="development" rel="tag">development</a>, <a href="http://sexywp.com/tags/extjs-2" title="extjs" rel="tag">extjs</a>, <a href="http://sexywp.com/tags/mvc" title="MVC" rel="tag">MVC</a>, <a href="http://sexywp.com/tags/yii-2" title="yii" rel="tag">yii</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/extjs-4-mvc.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VIM常用小窍门收集</title>
		<link>http://sexywp.com/vim-tricks-collections.htm</link>
		<comments>http://sexywp.com/vim-tricks-collections.htm#comments</comments>
		<pubDate>Tue, 14 Jun 2011 14:31:30 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[心得体会]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[tricks]]></category>
		<category><![CDATA[usage]]></category>
		<category><![CDATA[vim]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=440</guid>
		<description><![CDATA[vim应该是现在世界上最流行的编辑器，没有之一。就算你千般百般地不喜欢它，掌握它也成了一件必须的事情了。因为日后你如果做程序员，在非Win系列的服务器上搞开发，vim绝对是无法避免的。你日常能接触到的server，emacs可能没装，但是vi不可能没装，就这样。

特意开辟这个文章，用于收藏一些工作中常用的操作，主要有这么几个原则：



<span class="readmore"><a href="http://sexywp.com/vim-tricks-collections.htm" title="VIM常用小窍门收集">Keep Reading --- 615 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fthe-absolute-bare-minimum-vimrc.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Vim最低配置单</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnetbeans-plugins-i-used.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">NetBeans 中我选用的插件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>vim应该是现在世界上最流行的编辑器，没有之一。就算你千般百般地不喜欢它，掌握它也成了一件必须的事情了。因为日后你如果做程序员，在非Win系列的服务器上搞开发，vim绝对是无法避免的。你日常能接触到的server，emacs可能没装，但是vi不可能没装，就这样。</p>
<p>特意开辟这个文章，用于收藏一些工作中常用的操作，主要有这么几个原则：</p>
<ol>
<li>非常有用</li>
<li>不常用</li>
<li>每次用都想不起来应该怎么用</li>
</ol>
<p>不知道大家是不是经常跟我一样有这种感受呢，我会把我遇到的这类操作，都详细写在这里。</p>
<h2>将配置文件中的指定列前面加上注释符号</h2>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">#fastcgi.conf</li>
<li>fastcgi_param&nbsp; GATEWAY_INTERFACE&nbsp; CGI/1.1;</li>
<li>fastcgi_param&nbsp; SERVER_SOFTWARE&nbsp; &nbsp; nginx;</li>
<li>fastcgi_param&nbsp; QUERY_STRING&nbsp; &nbsp; &nbsp; &nbsp;$query_string;</li>
<li>fastcgi_param&nbsp; REQUEST_METHOD&nbsp; &nbsp; &nbsp;$request_method;</li>
<li>fastcgi_param&nbsp; CONTENT_TYPE&nbsp; &nbsp; &nbsp; &nbsp;$content_type;</li>
<li>fastcgi_param&nbsp; CONTENT_LENGTH&nbsp; &nbsp; &nbsp;$content_length;</li>
<li>fastcgi_param&nbsp; SCRIPT_FILENAME&nbsp; &nbsp; $document_root$fastcgi_script_name;</li>
<li>fastcgi_param&nbsp; SCRIPT_NAME&nbsp; &nbsp; &nbsp; &nbsp; $fastcgi_script_name;</li>
<li>fastcgi_param&nbsp; REQUEST_URI&nbsp; &nbsp; &nbsp; &nbsp; $request_uri;</li>
<li>fastcgi_param&nbsp; DOCUMENT_URI&nbsp; &nbsp; &nbsp; &nbsp;$document_uri;</li>
<li>fastcgi_param&nbsp; DOCUMENT_ROOT&nbsp; &nbsp; &nbsp; $document_root;</li></ol></div>
<p>如上代码是一个很常见的配置文件，我现在要给第2-12行前面都加上一个#号，注释掉他们，在EmEditor里面这个事情无敌简单的，但是到了vi里面，你是不是总也想不起来应该怎么弄？</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">:2,12s/^/#/g</li></ol></div>
<p>解释一下，【2,12】在vi中叫range，看帮助的时候，如果看到range，这就是一种写法，表明第2行到12行。<br />
还有一种写法：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">:s/^/#/g 11</li></ol></div>
<p>将光标移动到第二行，然后执行上面的命令，后面的【11】代表，执行这个命令，重复11次。这里一直没解释里面那个至关重要的乱码串，那个就是替换的命令了。下次再说。</p>
<h2>删除的时候使用f和t</h2>
<p>删除是vim里面非常常用的功能，一个一个字幕删除，用x，可以代替del用。整行删除，dd，应该都会了。删除一个单词，用dw。这些都是简单提一下，我主要想两个很好用的功能，就是f和t。</p>
<p>f的本意是行查找，fa，就是从光标当前位置开始，在本行中，找到第一个字母a，和d结合起来以后，就非常方便了，比如：</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Blue;">&lt;?php</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Green;">function</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">test_php</span><span style="color: Olive;">(</span><span style="color: #00008b;">$a</span><span style="color: Gray;">,</span><span style="color: #00008b;">$b</span><span style="color: Gray;">,</span><span style="color: #00008b;">$c</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp;</span><span style="color: Green;">return</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">true</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span></li></ol></div></div>
<p>在这个代码里，你想删掉第一个参数，可以把光标放在(后面的第一个$上，然后按"df,"，就可以把$a连同后面的逗号都删掉，非常方便。当然了，你可以发挥一下，"d2f,"这个按键序列就是把$a和$b都删掉了，但是呢，用数字这种东西，在实际操作中，我感觉大脑经常反应不过来，需要思考，不实用。</p>
<p>在来说一下t，t这个东西，跟f非常像，区别就是t把找光标放到找到的那个字符前面一个位子，比如上面那个例子，我把光标放在第一个$上，然后按下"dt)"这个序列，可以把函数的3个参数都删掉，但是却不会删掉括号，非常舒服，在括号里删东西，我经常用这个功能。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fthe-absolute-bare-minimum-vimrc.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Vim最低配置单</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnetbeans-plugins-i-used.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">NetBeans 中我选用的插件</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/tips" title="tips" rel="tag">tips</a>, <a href="http://sexywp.com/tags/tricks" title="tricks" rel="tag">tricks</a>, <a href="http://sexywp.com/tags/usage" title="usage" rel="tag">usage</a>, <a href="http://sexywp.com/tags/vim" title="vim" rel="tag">vim</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/vim-tricks-collections.htm/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>给SVN客户端配置代理服务器</title>
		<link>http://sexywp.com/use-proxy-in-ur-svn-client.htm</link>
		<comments>http://sexywp.com/use-proxy-in-ur-svn-client.htm#comments</comments>
		<pubDate>Mon, 13 Jun 2011 13:39:47 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[小窍门]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[心得体会]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=439</guid>
		<description><![CDATA[最常见的SVN客户端其实是TortoiseSVN，我一直叫它作乌龟SVN。上班以后，我在办公室使用SVN连接非办公网络的服务器，发现无法连接，原来，是因为大多数办公网络都设置了防火墙，要连接外网的服务器，必须配置代理。如果使用的是TortoiseSVN，那么“右键”-》“Settings”-》“Networking”，就可以找到设置代理的地方：



我自己经常使用的是另一款SVN客户端，不知道国内有多少用户，总之我也提一下吧，下载的网站是这里：http://www.collab.net/，这家公司是SVN的幕后支持公司，他们开发基于命令行的各种操作系统的客户端，基于命令行，所以就非常的轻巧，最关键是装好以后，可以和NetBeans无缝集成，也不会弄一堆花花绿绿的图标在资源管理器里面，让你看了红色惊叹号凭空焦虑。

<span class="readmore"><a href="http://sexywp.com/use-proxy-in-ur-svn-client.htm" title="给SVN客户端配置代理服务器">Keep Reading --- 536 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-make-a-easy-svn-server.htm&from=http%3A%2F%2Fsexywp.com%2Fuse-proxy-in-ur-svn-client.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">在WinXP上搭建自己的SVN服务器</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fuse-proxy-in-ur-svn-client.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm&from=http%3A%2F%2Fsexywp.com%2Fuse-proxy-in-ur-svn-client.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">VIM常用小窍门收集</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fuse-proxy-in-ur-svn-client.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Fuse-proxy-in-ur-svn-client.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>最常见的SVN客户端其实是TortoiseSVN，我一直叫它作乌龟SVN。上班以后，我在办公室使用SVN连接非办公网络的服务器，发现无法连接，原来，是因为大多数办公网络都设置了防火墙，要连接外网的服务器，必须配置代理。如果使用的是TortoiseSVN，那么“右键”-》“Settings”-》“Networking”，就可以找到设置代理的地方：</p>
<p><img src="http://niff.home.xs4all.nl/stuff/tortoiseproxy.png" alt="set proxy in tortoise svn" /></p>
<p>我自己经常使用的是另一款SVN客户端，不知道国内有多少用户，总之我也提一下吧，下载的网站是这里：http://www.collab.net/，这家公司是SVN的幕后支持公司，他们开发基于命令行的各种操作系统的客户端，基于命令行，所以就非常的轻巧，最关键是装好以后，可以和NetBeans无缝集成，也不会弄一堆花花绿绿的图标在资源管理器里面，让你看了红色惊叹号凭空焦虑。</p>
<p>给这个命令行客户端设置代理有点纠结，看不明白的童鞋，自动忽略好了。首先打开CMD，然后键入命令echo %APPDATA%，得到的结果，就是你的配置所在的根目录，进入那个目录，然后进入Subversion子目录，你会看到两个配置文件，一个叫config，一个叫servers，用写字板编辑那个servers的配置文件：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">[global]</li>
<li># http-proxy-exceptions = *.exception.com, www.internal-site.org</li>
<li>http-proxy-host = defaultproxy.whatever.com</li>
<li>http-proxy-port = 7000</li>
<li>http-proxy-username = defaultusername</li>
<li>http-proxy-password = defaultpassword</li></ol></div>
<p>配置好后，就可以实现给SVN客户端挂上了代理，如果只想给特定的域挂代理，就使用另一个section来配置代理：</p>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">[groups]</li>
<li>group1 = *.googlecode.com</li>
<li># othergroup = repository.blarggitywhoomph.com</li>
<li># thirdgroup = *.example.com</li>
<li>&nbsp;</li>
<li>### Information for the first group:</li>
<li>[group1]</li>
<li>http-proxy-host = proxy.myoffice.com</li>
<li>http-proxy-port = 8080</li>
<li># http-proxy-username = blah</li>
<li># http-proxy-password = doubleblah</li>
<li># http-timeout = 60</li></ol></div>
<p>如上只是我的配置的一个节选，是我给googlecode这个域配置了一个代理。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-make-a-easy-svn-server.htm&from=http%3A%2F%2Fsexywp.com%2Fuse-proxy-in-ur-svn-client.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">在WinXP上搭建自己的SVN服务器</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fuse-proxy-in-ur-svn-client.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm&from=http%3A%2F%2Fsexywp.com%2Fuse-proxy-in-ur-svn-client.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">VIM常用小窍门收集</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fuse-proxy-in-ur-svn-client.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Fuse-proxy-in-ur-svn-client.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/proxy" title="proxy" rel="tag">proxy</a>, <a href="http://sexywp.com/tags/subversion" title="subversion" rel="tag">subversion</a>, <a href="http://sexywp.com/tags/svn" title="svn" rel="tag">svn</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/use-proxy-in-ur-svn-client.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yii框架中验证器的allowEmpty属性</title>
		<link>http://sexywp.com/yii-validator-allwoempty-property.htm</link>
		<comments>http://sexywp.com/yii-validator-allwoempty-property.htm#comments</comments>
		<pubDate>Wed, 18 May 2011 08:13:08 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Yii]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[usage]]></category>
		<category><![CDATA[yii]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=435</guid>
		<description><![CDATA[Yii框架自带验证器这个包，提供了一组常见各类属性的验证器。如果使用Gii代码生成工具创建model，会根据数据库字段的属性默认生成一些验证器的配置。在配置验证器的时候，很多验证器都有以后属性叫做allowEmpty，这个属性的真正逻辑却不是看上去的那个意思。

数据库里的字段，有个属性，叫NULL，就是字段是否允许为空值，allowEmpty听起来跟这个NULL的约束是一样的，但是实际看验证器的代码：

&#160;&#160;protected&#160;function validateAttribute($object,$attribute)

<span class="readmore"><a href="http://sexywp.com/yii-validator-allwoempty-property.htm" title="Yii框架中验证器的allowEmpty属性">Keep Reading --- 664 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架base包代码分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/11/20/11182613.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架base包代码分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="MVC最佳实践" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC最佳实践</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="工作中常用的Linux命令集锦" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>Yii框架自带验证器这个包，提供了一组常见各类属性的验证器。如果使用Gii代码生成工具创建model，会根据数据库字段的属性默认生成一些验证器的配置。在配置验证器的时候，很多验证器都有以后属性叫做allowEmpty，这个属性的真正逻辑却不是看上去的那个意思。<span id="more-435"></span></p>
<p>数据库里的字段，有个属性，叫NULL，就是字段是否允许为空值，allowEmpty听起来跟这个NULL的约束是一样的，但是实际看验证器的代码：</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Gray;">&nbsp;</span><span style="color: Green;">protected</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">function</span><span style="color: Gray;"> </span><span style="color: Blue;">validateAttribute</span><span style="color: Olive;">(</span><span style="color: #00008b;">$object</span><span style="color: Gray;">,</span><span style="color: #00008b;">$attribute</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$value</span><span style="color: Gray;">=</span><span style="color: #00008b;">$object</span><span style="color: Gray;">-&gt;</span><span style="color: #00008b;">$attribute</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Olive;">(</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">allowEmpty</span><span style="color: Gray;"> &amp;&amp; </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">isEmpty</span><span style="color: Olive;">(</span><span style="color: #00008b;">$value</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">return</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Olive;">(</span><span style="color: Blue;">function_exists</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">mb_strlen</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;"> &amp;&amp; </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">encoding</span><span style="color: Gray;">!==</span><span style="color: Green;">false</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$length</span><span style="color: Gray;">=</span><span style="color: Blue;">mb_strlen</span><span style="color: Olive;">(</span><span style="color: #00008b;">$value</span><span style="color: Gray;">,</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">encoding</span><span style="color: Gray;"> ? </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">encoding</span><span style="color: Gray;"> : </span><span style="color: Blue;">Yii</span><span style="color: Gray;">::</span><span style="color: Blue;">app</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">charset</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">else</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$length</span><span style="color: Gray;">=</span><span style="color: Blue;">strlen</span><span style="color: Olive;">(</span><span style="color: #00008b;">$value</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Olive;">(</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">min</span><span style="color: Gray;">!==</span><span style="color: Green;">null</span><span style="color: Gray;"> &amp;&amp; </span><span style="color: #00008b;">$length</span><span style="color: Gray;">&lt;</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">min</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$message</span><span style="color: Gray;">=</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">tooShort</span><span style="color: Gray;">!==</span><span style="color: Green;">null</span><span style="color: Gray;">?</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">tooShort</span><span style="color: Gray;">:</span><span style="color: Blue;">Yii</span><span style="color: Gray;">::</span><span style="color: Blue;">t</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">yii</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">{attribute} is too short (minimum is {min} characters).</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">addError</span><span style="color: Olive;">(</span><span style="color: #00008b;">$object</span><span style="color: Gray;">,</span><span style="color: #00008b;">$attribute</span><span style="color: Gray;">,</span><span style="color: #00008b;">$message</span><span style="color: Gray;">,</span><span style="color: Green;">array</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">{min}</span><span style="color: #8b0000;">'</span><span style="color: Gray;">=&gt;</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">min</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Olive;">(</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">max</span><span style="color: Gray;">!==</span><span style="color: Green;">null</span><span style="color: Gray;"> &amp;&amp; </span><span style="color: #00008b;">$length</span><span style="color: Gray;">&gt;</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">max</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$message</span><span style="color: Gray;">=</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">tooLong</span><span style="color: Gray;">!==</span><span style="color: Green;">null</span><span style="color: Gray;">?</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">tooLong</span><span style="color: Gray;">:</span><span style="color: Blue;">Yii</span><span style="color: Gray;">::</span><span style="color: Blue;">t</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">yii</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">{attribute} is too long (maximum is {max} characters).</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">addError</span><span style="color: Olive;">(</span><span style="color: #00008b;">$object</span><span style="color: Gray;">,</span><span style="color: #00008b;">$attribute</span><span style="color: Gray;">,</span><span style="color: #00008b;">$message</span><span style="color: Gray;">,</span><span style="color: Green;">array</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">{max}</span><span style="color: #8b0000;">'</span><span style="color: Gray;">=&gt;</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">max</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Olive;">(</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">is</span><span style="color: Gray;">!==</span><span style="color: Green;">null</span><span style="color: Gray;"> &amp;&amp; </span><span style="color: #00008b;">$length</span><span style="color: Gray;">!==</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">is</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$message</span><span style="color: Gray;">=</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">message</span><span style="color: Gray;">!==</span><span style="color: Green;">null</span><span style="color: Gray;">?</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">message</span><span style="color: Gray;">:</span><span style="color: Blue;">Yii</span><span style="color: Gray;">::</span><span style="color: Blue;">t</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">yii</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #8b0000;">'</span><span style="color: Red;">{attribute} is of the wrong length (should be {length} characters).</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">addError</span><span style="color: Olive;">(</span><span style="color: #00008b;">$object</span><span style="color: Gray;">,</span><span style="color: #00008b;">$attribute</span><span style="color: Gray;">,</span><span style="color: #00008b;">$message</span><span style="color: Gray;">,</span><span style="color: Green;">array</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">{length}</span><span style="color: #8b0000;">'</span><span style="color: Gray;">=&gt;</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">is</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">?&gt;</span></li></ol></div></div>
<p>来看其中一个细节：</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Gray;">&nbsp;</span><span style="color: Green;">if</span><span style="color: Olive;">(</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">allowEmpty</span><span style="color: Gray;"> &amp;&amp; </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">isEmpty</span><span style="color: Olive;">(</span><span style="color: #00008b;">$value</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">return</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">?&gt;</span></li></ol></div></div>
<p>这一行什么意思，如果被验证属性为空，就认为完全合法，立刻返回，但是如果allowEmpty为false的话，就要通过函数后续的所有验证条件。那么对于一个传入的空值来说，allowEmpty无论是true还是false，极有可能都不会报错，上面节选的验证器是StringValidator，如果我没有设定min的值，那么一个空串在allowEmpty为false的情况下，还是不会报任何错误的。</p>
<p>如果希望一个属性值不能为空，最好还是用RequiredValidator来验证，allowEmpty是不靠谱的，建议一般就采取allowEmpty的默认值true，可以节省几次判断。然后不要中了Yii的这个小陷阱噢~~希望Yii的后续版本可以让这个功能显得更加自然一点，不要让我猜谜语。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架base包代码分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/11/20/11182613.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架base包代码分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="MVC最佳实践" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC最佳实践</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="工作中常用的Linux命令集锦" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/usage" title="usage" rel="tag">usage</a>, <a href="http://sexywp.com/tags/yii-2" title="yii" rel="tag">yii</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/yii-validator-allwoempty-property.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>本站首次接入Google Analytics</title>
		<link>http://sexywp.com/first-time-use-google-analytics.htm</link>
		<comments>http://sexywp.com/first-time-use-google-analytics.htm#comments</comments>
		<pubDate>Sat, 14 May 2011 13:28:28 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[analytics]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[statistic]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=432</guid>
		<description><![CDATA[本站创立始于2008年三月，估计最老的一批读者现在几乎已经都不再来了，一开始，我的这个小站就专注于WordPress的周边一些话题，包括主题定制，插件开发，DIY，hacks，插件汉化等等。最早，域名不是现在这个，是charlestang.cn，那是一个在国内注册的域名（你们懂的），后来，随着博客的成长，我发现我的博客主要内容都已经偏向了WordPress，其他技术内容已经非常少了，那个时候，我做出了一次结构的重大调整，就是将跟技术无关的内容都移出了本博客，专门开辟了个人生活内容博客，而这个博客则专注于WordPress相关的内容。

<span class="readmore"><a href="http://sexywp.com/first-time-use-google-analytics.htm" title="本站首次接入Google Analytics">Keep Reading --- 445 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Google可以搜索Twitter的内容了" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fgoogle-search-twitter-content.htm&from=http%3A%2F%2Fsexywp.com%2Ffirst-time-use-google-analytics.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/19/13235107.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Google可以搜索Twitter的内容了</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="为何以及如何整合Google搜索到WP博客" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwhy-and-how-to-integrate-google-to-blog.htm&from=http%3A%2F%2Fsexywp.com%2Ffirst-time-use-google-analytics.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9189497.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">为何以及如何整合Google搜索到WP博客</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="天啊！Google Code中文版……" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fgoogle-code.htm&from=http%3A%2F%2Fsexywp.com%2Ffirst-time-use-google-analytics.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">天啊！Google Code中文版……</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用Google AJAX Libraries API替换WordPress自带的js库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Freplace-the-wp-js-lib-by-googleapi.htm&from=http%3A%2F%2Fsexywp.com%2Ffirst-time-use-google-analytics.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/23/9256004.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用Google AJAX Libraries API替换WordPress自带的js库</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="百度和谷歌的低俗度测评" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fbaidu-google-who-is-disuer.htm&from=http%3A%2F%2Fsexywp.com%2Ffirst-time-use-google-analytics.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">百度和谷歌的低俗度测评</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>本站创立始于2008年三月，估计最老的一批读者现在几乎已经都不再来了，一开始，我的这个小站就专注于WordPress的周边一些话题，包括主题定制，插件开发，<a href="http://sexywp.com/tags/diy" class="st_tag internal_tag" rel="tag" title="标签 DIY 下的日志">DIY</a>，hacks，插件汉化等等。最早，域名不是现在这个，是charlestang.cn，那是一个在国内注册的域名（你们懂的），后来，随着博客的成长，我发现我的博客主要内容都已经偏向了WordPress，其他技术内容已经非常少了，那个时候，我做出了一次结构的重大调整，就是将跟技术无关的内容都移出了本博客，专门开辟了个人生活内容博客，而这个博客则专注于WordPress相关的内容。</p>
<p>在使用原来的域名的时候，曾经接入过一次Google分析，但是感觉拖慢了网站的速度，就弃用了，因为觉得自己的博客反正无法盈利，统计是否强大，完全无所谓，所以那个时候，就使用了站长统计，一直用到今天，现在仍然挂着。随着我毕业走上工作岗位，终于进入了互联网行业，最近正好要研究一些网站统计的相关内容，所以又想起了Google分析，这次，我算是正式给小站挂上了Google分析了。特此写一篇文章，纪念这个时间，希望未来1年，3年，5年的时候，还能从这篇文章的内容，回想起事情的始末。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Google可以搜索Twitter的内容了" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fgoogle-search-twitter-content.htm&from=http%3A%2F%2Fsexywp.com%2Ffirst-time-use-google-analytics.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/19/13235107.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Google可以搜索Twitter的内容了</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="为何以及如何整合Google搜索到WP博客" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwhy-and-how-to-integrate-google-to-blog.htm&from=http%3A%2F%2Fsexywp.com%2Ffirst-time-use-google-analytics.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9189497.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">为何以及如何整合Google搜索到WP博客</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="天啊！Google Code中文版……" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fgoogle-code.htm&from=http%3A%2F%2Fsexywp.com%2Ffirst-time-use-google-analytics.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">天啊！Google Code中文版……</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用Google AJAX Libraries API替换WordPress自带的js库" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Freplace-the-wp-js-lib-by-googleapi.htm&from=http%3A%2F%2Fsexywp.com%2Ffirst-time-use-google-analytics.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/23/9256004.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用Google AJAX Libraries API替换WordPress自带的js库</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="百度和谷歌的低俗度测评" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fbaidu-google-who-is-disuer.htm&from=http%3A%2F%2Fsexywp.com%2Ffirst-time-use-google-analytics.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">百度和谷歌的低俗度测评</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/analytics" title="analytics" rel="tag">analytics</a>, <a href="http://sexywp.com/tags/google" title="google" rel="tag">google</a>, <a href="http://sexywp.com/tags/statistic" title="statistic" rel="tag">statistic</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/first-time-use-google-analytics.htm/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Web开发专用IDE：Aptana Studio 3.0</title>
		<link>http://sexywp.com/web-apps-ide-aptana-studio3.htm</link>
		<comments>http://sexywp.com/web-apps-ide-aptana-studio3.htm#comments</comments>
		<pubDate>Tue, 03 May 2011 01:37:02 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=429</guid>
		<description><![CDATA[Aptana Studio是一款专业的、开源的开发环境，主要用于Web应用开发。该开发环境支持最新的浏览器技术HTML5，CSS3，Javascript，除此之外，对服务器端语言Ruby（对RoR貌似有很好的支持），PHP，Python也有很好的支持。

目前能够在Web开发中对HTML，CSS，和JS同时提供编码帮助的IDE环境极其少见，Dreamweaver是我知道的做得比较好的，但是Dreamweaver对语言的支持只做到了静态语法检查和代码高亮，更进一步则无能为力了，只能算是准IDE，毕竟不是真正的IDE环境，NetBeans在这方面有不俗的表现，正是我选用此款IDE的原因。

<span class="readmore"><a href="http://sexywp.com/web-apps-ide-aptana-studio3.htm" title="Web开发专用IDE：Aptana Studio 3.0">Keep Reading --- 497 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用NetBeans IDE 6.5作为WordPress的开发环境" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fuse-netbeans-to-develop-wp.htm&from=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/02/10636076.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用NetBeans IDE 6.5作为WordPress的开发环境</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="在WinCE上搭建Web服务" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fbuild-web-server-on-wince-platform.htm&from=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">在WinCE上搭建Web服务</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP 5.3.x中弃用的特性 Deprecated" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fdeprecated-features-in-php-5-3.htm&from=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP 5.3.x中弃用的特性 Deprecated</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Web服务器LiteSpeed" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm&from=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Web服务器LiteSpeed</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>Aptana Studio是一款专业的、开源的开发环境，主要用于Web应用开发。该开发环境支持最新的浏览器技术HTML5，CSS3，Javascript，除此之外，对服务器端语言Ruby（对RoR貌似有很好的支持），<a href="http://sexywp.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 PHP 下的日志">PHP</a>，Python也有很好的支持。</p>
<p>目前能够在Web开发中对HTML，CSS，和JS同时提供编码帮助的IDE环境极其少见，Dreamweaver是我知道的做得比较好的，但是Dreamweaver对语言的支持只做到了静态语法检查和代码高亮，更进一步则无能为力了，只能算是准IDE，毕竟不是真正的IDE环境，NetBeans在这方面有不俗的表现，正是我选用此款IDE的原因。</p>
<p>之所以注意到这款IDE，是因为有业内比较资深的工程师提到了这个东西，所以专门了解了一下，这个IDE基于Eclipse框架开发，专门针对Web应用开发领域，尤其强化了对HTML，CSS，JS等语言的支持，对于Server端的语言，选择的也都是专门用于Web开发的语言。本来我对其对PHP开发的支持抱有一定的期待，但是后来听说其将PHP模块从项目中移除，转而投向PDT Project，我就有点失望了，感觉PDT的能力真的只能算一般，不过在不是很了解Aptana的基础上，我还是可以说，那些用普通Eclipse+PDT开发的童鞋，完全可以转头Aptana的怀抱，因为你二者都不会失去，反而可以得到对HTML，CSS，JS的强大支持。使用NetBeans进行Web开发的童鞋，并且平常工作偏重于Server端PHP开发的，可以等待我的进一步体验报告。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用NetBeans IDE 6.5作为WordPress的开发环境" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fuse-netbeans-to-develop-wp.htm&from=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/02/10636076.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用NetBeans IDE 6.5作为WordPress的开发环境</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="在WinCE上搭建Web服务" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fbuild-web-server-on-wince-platform.htm&from=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">在WinCE上搭建Web服务</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="PHP 5.3.x中弃用的特性 Deprecated" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fdeprecated-features-in-php-5-3.htm&from=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">PHP 5.3.x中弃用的特性 Deprecated</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Web服务器LiteSpeed" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm&from=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Web服务器LiteSpeed</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/development" title="development" rel="tag">development</a>, <a href="http://sexywp.com/tags/ide" title="IDE" rel="tag">IDE</a>, <a href="http://sexywp.com/tags/php" title="PHP" rel="tag">PHP</a>, <a href="http://sexywp.com/tags/tools" title="tools" rel="tag">tools</a>, <a href="http://sexywp.com/tags/web" title="web" rel="tag">web</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/web-apps-ide-aptana-studio3.htm/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Google用于提高网站质量的工具：Page Speed工具集</title>
		<link>http://sexywp.com/page-speed-family.htm</link>
		<comments>http://sexywp.com/page-speed-family.htm#comments</comments>
		<pubDate>Mon, 02 May 2011 01:17:01 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[工作相关]]></category>
		<category><![CDATA[add-ons]]></category>
		<category><![CDATA[chrome]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=428</guid>
		<description><![CDATA[应该就是离现在不太远的时候，Google推出了用于提高网页质量的工具集，Page Speed。我最早听说是在若干月前的PHP Classes的news letter上。最近才有时间来仔细看看这个东西。

Page Speed现在的形态是一个工具集，目前提供了客户端和服务器端的两种组件。服务器端提供了Apache服务器的模块mod_pagespeed，该模块可以自动优化网页和资源文件。客户端的工具是一个插件，分别提供了firefox、Chrome的版本，其功能更加类似于Yahoo推出的YSlow，也是真对一个页面进行诊断，给出相应的优化建议，Yahoo提出的东西在业界被称为是14条军规，从Page Speed插件给出的建议来看，基本也没有逃出这14条军规的范畴。除此之外，Google还推出了一个网页版本的Page Speed，只要键入网址，就可以自动分析页面的问题给出建议。

<span class="readmore"><a href="http://sexywp.com/page-speed-family.htm" title="Google用于提高网站质量的工具：Page Speed工具集">Keep Reading --- 308 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Web开发专用IDE：Aptana Studio 3.0" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm&from=http%3A%2F%2Fsexywp.com%2Fpage-speed-family.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Web开发专用IDE：Aptana Studio 3.0</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="为何以及如何整合Google搜索到WP博客" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwhy-and-how-to-integrate-google-to-blog.htm&from=http%3A%2F%2Fsexywp.com%2Fpage-speed-family.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9189497.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">为何以及如何整合Google搜索到WP博客</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="在WinCE上搭建Web服务" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fbuild-web-server-on-wince-platform.htm&from=http%3A%2F%2Fsexywp.com%2Fpage-speed-family.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">在WinCE上搭建Web服务</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Google可以搜索Twitter的内容了" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fgoogle-search-twitter-content.htm&from=http%3A%2F%2Fsexywp.com%2Fpage-speed-family.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/19/13235107.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Google可以搜索Twitter的内容了</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Web服务器LiteSpeed" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm&from=http%3A%2F%2Fsexywp.com%2Fpage-speed-family.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Web服务器LiteSpeed</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>应该就是离现在不太远的时候，Google推出了用于提高网页质量的工具集，Page Speed。我最早听说是在若干月前的PHP Classes的news letter上。最近才有时间来仔细看看这个东西。</p>
<p>Page Speed现在的形态是一个工具集，目前提供了客户端和服务器端的两种组件。服务器端提供了Apache服务器的模块mod_pagespeed，该模块可以自动优化网页和资源文件。客户端的工具是一个插件，分别提供了firefox、Chrome的版本，其功能更加类似于Yahoo推出的YSlow，也是真对一个页面进行诊断，给出相应的优化建议，Yahoo提出的东西在业界被称为是14条军规，从Page Speed插件给出的建议来看，基本也没有逃出这14条军规的范畴。除此之外，Google还推出了一个网页版本的Page Speed，只要键入网址，就可以自动分析页面的问题给出建议。</p>
<p>对于没有使用Apache作为Server的，Page Speed还放出了C++ SDK，支持第三方开发。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Web开发专用IDE：Aptana Studio 3.0" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm&from=http%3A%2F%2Fsexywp.com%2Fpage-speed-family.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Web开发专用IDE：Aptana Studio 3.0</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="为何以及如何整合Google搜索到WP博客" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwhy-and-how-to-integrate-google-to-blog.htm&from=http%3A%2F%2Fsexywp.com%2Fpage-speed-family.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9189497.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">为何以及如何整合Google搜索到WP博客</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="在WinCE上搭建Web服务" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fbuild-web-server-on-wince-platform.htm&from=http%3A%2F%2Fsexywp.com%2Fpage-speed-family.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">在WinCE上搭建Web服务</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Google可以搜索Twitter的内容了" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fgoogle-search-twitter-content.htm&from=http%3A%2F%2Fsexywp.com%2Fpage-speed-family.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/19/13235107.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Google可以搜索Twitter的内容了</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Web服务器LiteSpeed" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm&from=http%3A%2F%2Fsexywp.com%2Fpage-speed-family.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Web服务器LiteSpeed</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/add-ons" title="add-ons" rel="tag">add-ons</a>, <a href="http://sexywp.com/tags/chrome" title="chrome" rel="tag">chrome</a>, <a href="http://sexywp.com/tags/development" title="development" rel="tag">development</a>, <a href="http://sexywp.com/tags/google" title="google" rel="tag">google</a>, <a href="http://sexywp.com/tags/tools" title="tools" rel="tag">tools</a>, <a href="http://sexywp.com/tags/web" title="web" rel="tag">web</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/page-speed-family.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Web服务器LiteSpeed</title>
		<link>http://sexywp.com/litespeed-web-server.htm</link>
		<comments>http://sexywp.com/litespeed-web-server.htm#comments</comments>
		<pubDate>Sun, 01 May 2011 00:31:57 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[工作相关]]></category>
		<category><![CDATA[introduction]]></category>
		<category><![CDATA[Web Server]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=427</guid>
		<description><![CDATA[LiteSpeed Web Server is the leading high-performance, high-scalability web server. It is completely Apache interchangeable so LiteSpeed Web Server can quickly replace a major bottleneck in your existing web delivery platform. With its comprehensive range of features and easy-to-use web administration console, LiteSpeed Web Server can help you conquer the challenges of deploying an effective web serving architecture. 

<span class="readmore"><a href="http://sexywp.com/litespeed-web-server.htm" title="Web服务器LiteSpeed">Keep Reading --- 390 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-make-a-easy-svn-server.htm&from=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">在WinXP上搭建自己的SVN服务器</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm&from=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Web开发专用IDE：Aptana Studio 3.0</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fbuild-web-server-on-wince-platform.htm&from=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">在WinCE上搭建Web服务</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fflash-float-on-topest-layer.htm&from=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">解决Flash内容总是漂浮于页面顶层的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmake-all-my-browsers-tested.htm&from=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">折磨一下浏览器们，哈哈</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>LiteSpeed <a href="http://sexywp.com/tags/web-server" class="st_tag internal_tag" rel="tag" title="标签 Web Server 下的日志">Web Server</a> is the leading high-performance, high-scalability <a href="http://sexywp.com/tags/web-server" class="st_tag internal_tag" rel="tag" title="标签 Web Server 下的日志">web server</a>. It is completely <a href="http://sexywp.com/tags/apache" class="st_tag internal_tag" rel="tag" title="标签 apache 下的日志">Apache</a> interchangeable so LiteSpeed <a href="http://sexywp.com/tags/web-server" class="st_tag internal_tag" rel="tag" title="标签 Web Server 下的日志">Web Server</a> can quickly replace a major bottleneck in your existing <a href="http://sexywp.com/tags/web" class="st_tag internal_tag" rel="tag" title="标签 web 下的日志">web</a> delivery platform. With its comprehensive range of <a href="http://sexywp.com/tags/features" class="st_tag internal_tag" rel="tag" title="标签 features 下的日志">features</a> and easy-to-use web administration console, LiteSpeed Web Server can help you conquer the challenges of deploying an effective web serving architecture. </p>
<p>LiteSpeed是一款先进的高性能，高扩展性Web服务器。它和Apache是完全可互换的，所以，它可以快速替换您Web分发平台的瓶颈。它拥有丰富的特性和易用的Web管理控制台，可以帮助您克服高效部署web服务器架构时的挑战。<span id="more-427"></span></p>
<p>LiteSpeed Web Server has superior performance in terms of both raw speed and scalability. Our benchmarks demonstrate that it is more than 6 times faster than Apache. When serving static content, LiteSpeed surpasses well-respected content accelerators including thttpd, boa and TUX. When it comes to dynamic content, LiteSpeed is more than 50% faster in <a href="http://sexywp.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 PHP 下的日志">PHP</a> content delivery than Apache with mod_<a href="http://sexywp.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 PHP 下的日志">php</a>. </p>
<p>无论是速度还是可扩展性，LiteSpeed有出众的表现。我们的benchmark表明，它比Apache快6倍。当伺服静态内容时，它能超越广受好评的内容加速器包括thttpd，boa和TUX。而处理动态内容时，它处理PHP内容比Apache配合mod_php要快超过50%。</p>
<p>Since its 3.0 release, LiteSpeed Web Server works flawlessly alongside web hosting control panels including cPanel, DirectAdmin, etc. as a drop-in Apache replacement. Easily increase PHP performance and security while doubling server capacity. LiteSpeed is the best choice for shared hosting service providers.</p>
<p>从3.0release开始，LiteSpeed可以与Web托管控制面板如cPanel，DirectAdmin等做到配合无间。它很轻易就可以提高PHP的性能和安全性，同时还能将server的能力扩容到两倍。它尤其适合共享托管服务提供商。</p>
<p>======罪恶分割线======</p>
<p>这是一款不怎么常见的Web服务器，至少我以前没有听说过，不过我发现，现在我的这个博客使用的就是这个Web服务器。<a href="http://www.litespeedtech.com/litespeed-web-server-editions.html">这个服务器是一款商业软件，但是提供免费的标准版</a>，与之相对应的是企业版，能够在高并发的情况下提供<a href="http://www.litespeedtech.com/web-server-performance-comparison-litespeed-2.1-vs.html">两倍左右于Apache的性能</a>。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-make-a-easy-svn-server.htm&from=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">在WinXP上搭建自己的SVN服务器</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fweb-apps-ide-aptana-studio3.htm&from=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Web开发专用IDE：Aptana Studio 3.0</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fbuild-web-server-on-wince-platform.htm&from=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">在WinCE上搭建Web服务</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fflash-float-on-topest-layer.htm&from=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">解决Flash内容总是漂浮于页面顶层的问题</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmake-all-my-browsers-tested.htm&from=http%3A%2F%2Fsexywp.com%2Flitespeed-web-server.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">折磨一下浏览器们，哈哈</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/introduction" title="introduction" rel="tag">introduction</a>, <a href="http://sexywp.com/tags/web-server" title="Web Server" rel="tag">Web Server</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/litespeed-web-server.htm/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Nexus S使用一段时间后的体验</title>
		<link>http://sexywp.com/nexus-s-exp.htm</link>
		<comments>http://sexywp.com/nexus-s-exp.htm#comments</comments>
		<pubDate>Sat, 30 Apr 2011 05:28:11 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[手　　机]]></category>
		<category><![CDATA[nexus s]]></category>
		<category><![CDATA[缺点]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=426</guid>
		<description><![CDATA[使用Nexus S（下面简称NS）已经一段时间了，我看了一下，之前发布的文章《入手Nexus S》，是3月14日，到现在，应该正好是一个半月左右的时间，很多的怨念、新鲜都已经退却，那我就再来谈谈关于这款手机的实际使用体验。

首先说一下价格，我入手NS的时候，在淘宝上买的美国代购，价格是4300元，相对这款手机的实际使用体验来看，这个价格是虚高的，事实是我入手后2天，降价了60块钱，现如今，黑色版iPhone4港行已经4300左右了，那NS应该进一步降价，否则的话，恐怕不是很合算的。iPhone4的使用体验要好太多了。

<span class="readmore"><a href="http://sexywp.com/nexus-s-exp.htm" title="Nexus S使用一段时间后的体验">Keep Reading --- 1724 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">入手Nexus S</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Nexus S上网、彩信设置方法</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fthe-first-expierence-of-latex-2.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LaTeX体验</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fa-bee-movie.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">我是一只小蜜蜂，嗡嗡嗡嗡嗡嗡嗡</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fsoftwares-on-symbian-s60iii.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Nokia E63 使用心得——无限可能性（软件篇）</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>使用Nexus S（下面简称NS）已经一段时间了，我看了一下，之前发布的文章《<a href="http://sexywp.com/nexus-s-sucks.htm">入手Nexus S</a>》，是3月14日，到现在，应该正好是一个半月左右的时间，很多的怨念、新鲜都已经退却，那我就再来谈谈关于这款手机的实际使用体验。</p>
<p>首先说一下价格，我入手NS的时候，在淘宝上买的美国代购，价格是4300元，相对这款手机的实际使用体验来看，这个价格是虚高的，事实是我入手后2天，降价了60块钱，现如今，黑色版iPhone4港行已经4300左右了，那NS应该进一步降价，否则的话，恐怕不是很合算的。iPhone4的使用体验要好太多了。<span id="more-426"></span></p>
<p>然后是这款手机给我的印象，因为第一印象太差，后续手机也没有表现太好，导致我对其整体的印象仍然很差。我这里主要谈一些体验十分让人不满意的地方：</p>
<p>触摸式按键，NS上一共就3个按键，开关和音量，都在两侧，正面面板完全没有按键，而是采用了巧克力那种触摸式按键，这种按键不是说有多么不好，普通来讲，因为没有力反馈和按键边界，基本上按的时候必须眼睛看着才能操作，这给手机使用带来了极大不便。第二个问题是按键排布顺序不合理，最左边按键的功能是“返回”，最右边按键的功能是“显示主屏幕”或者说回到桌面，如果单手操作的话，很容易误操作触碰这两个键，比如玩游戏的时候，无论碰到哪个，都会导致游戏退出。</p>
<p>相机，NS配备了500万以上的摄像头，但是其拍照效果真的差强人意，基本没法超过普通200相机的拍照效果，自动对焦基本上还是无法正确捕获焦点，只能说稍好，然后NS不支持数码变焦，虽然谁都知道那没什么用，但是我的实际感受是没有数码变焦拍照体验很差。另外，手机没有配备快门键，拍照极其不便，前置摄像头很差劲，自拍的时候，大家可能想要用后面摄像头，但是那样的话，你根本按不到快门键，自拍变成一个非常困难和痛苦的事情了，一只手基本没法操作，侥幸按到了也会拍歪，而且快门时间太长，按对了心里也犯嘀咕，整体来说，相机就是悲剧。</p>
<p>扬声器，我不知道为啥，音量无比小，短信基本听不到，电话铃声倒是有，但是音量很不给力，默认铃声穿透力也很差，如果放在包里，那铁定要错过电话了。</p>
<p>信号，相比以上三点，信号可能仍是被我诟病最多的地方了，信号提示符逻辑很奇怪，有白色和绿色两种状态，平时就是白色的3格（满格是5），然后这种状态基本没法发短信，发三次成功一次，在某些情况下，信号提示会变成绿色，这种情况下发短信有较高成功率，但是也不是满格，我至今不知道白色绿色差别。发短信那么高失败率实在是让人困扰，而且菜单里没有重发功能，只能拷贝失败短信，然后黏贴，然后再发，十分不方便，也不支持自动重发。实在太差。</p>
<p>WiFi，也是同样是信号问题，在世纪广场玩轮滑，我朋友用iPhone4搜到了上海科技馆的wlan，但是我根本找不到，还是他告诉我SSID我才能连，连了以后基本没法用，毫无速度可言。在家，我以前是直接用Nokia随便连wifi发微博的，现在我不得不把我的mac设定成临时ap点，来共享网络链接，否则根本搜不到信号。</p>
<p>屏幕，屏幕确实给人以极好的视觉体验，但是我不知道这个屏幕是什么材料，上次滴了一小点方便面的汤，竟然完全擦不掉了，那一小滴汤里的油竟然溶解到屏幕里面去了，在纯黑的情况下，能够清楚的看到痕迹，让我心疼了很久，然后对这个屏幕充满了鄙夷。</p>
<p>系统，我拿到手机的时候，里面装的是Android 2.3.1，然后我开始天天开着WiFi等OTA，结果终于无果，身边N1的同事都OTA 2.3.3了，我的还没反应，最后不得已手动升了2.3.3。系统兼容性相当之差，我装了搜狗输入法，然后每次启动搜狗输入法，导致Android键盘异常退出，然后引发程序启动器异常退出，然后整个系统就会停留在最后开启的那个软件上，进入了一种没法开新程序的状态，基本上要重启了。另外最让人不能忍受的，是系统竟然不能记住我的设置，每次重启都要手动启动输入法，然后手动关闭数据链接。</p>
<p>电池，基本撑不过两天，一天，第二天中午一定要充电。</p>
<p>流量，Android系统是流量大户，开着数据的话，基本上5块30M的套餐，撑不过20号，所以现在只有用网络的时候才开一下数据连接，用完再关掉，变成纯手动的了，太悲剧了，还有就是系统的各类软件都是免费的，但是这些免费软件如果在联网状态下使用，会疯狂下载广告，显示在软件的关键位置，非常烦人，而且狂费流量。</p>
<p>综合来说，这个手机就是一个悲剧，或者说浮云，有个朋友说“跟iPhone4一比，其他手机都是渣”，我应该验证了他的说法。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">入手Nexus S</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Nexus S上网、彩信设置方法</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fthe-first-expierence-of-latex-2.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LaTeX体验</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fa-bee-movie.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">我是一只小蜜蜂，嗡嗡嗡嗡嗡嗡嗡</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fsoftwares-on-symbian-s60iii.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Nokia E63 使用心得——无限可能性（软件篇）</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/nexus-s" title="nexus s" rel="tag">nexus s</a>, <a href="http://sexywp.com/tags/%e7%bc%ba%e7%82%b9" title="缺点" rel="tag">缺点</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/nexus-s-exp.htm/feed</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>工作中常用的Linux命令集锦</title>
		<link>http://sexywp.com/linux-commands-used-when-working.htm</link>
		<comments>http://sexywp.com/linux-commands-used-when-working.htm#comments</comments>
		<pubDate>Tue, 12 Apr 2011 12:37:33 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[心得体会]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[usage]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=419</guid>
		<description><![CDATA[tcpdump —— 打印出通过网口流入流出的数据内容，用于网络协议调试

tcpdump就是大家嘴里常说的抓包工具，在linux命令行下，使用tcpdump，可以查看服务器特定端口进出的数据包内容。

tcpdump -X -s0 -i any udp port 12009

<span class="readmore"><a href="http://sexywp.com/linux-commands-used-when-working.htm" title="工作中常用的Linux命令集锦">Keep Reading --- 1186 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">VIM常用小窍门收集</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnetbeans-plugins-i-used.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">NetBeans 中我选用的插件</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<h3>tcpdump —— 打印出通过网口流入流出的数据内容，用于网络协议调试</h3>
<p>tcpdump就是大家嘴里常说的抓包工具，在linux命令行下，使用tcpdump，可以查看服务器特定端口进出的数据包内容。<br />
<code>tcpdump -X -s0 -i any udp port 12009</code><span id="more-419"></span><br />
上述命令是我在工作中常用的一组参数组合，其含义如下：</p>
<ul>
<li>-X 将每个包打印成16进制形式和ASCII形式，调试新协议的时候非常方便</li>
<li>-sN 每个包显示的（截断）字节数，N代表字节数，填0代表64K，为UDP包最大长度，实际实践中UDP包长1500字节左右，如果调试的协议只关心包头，一般查看前128个字节即可，可以视情况而选择。</li>
<li>-i 代表interface，可以认为是网卡，any代表任意，也可以填eth0，eth1，代表以太网口</li>
<li>udp port 12009是表达式，例子的含义就是UDP协议，12009端口。</li>
</ul>
<p><code>tcpdump [ -adeflnNOpqStvx ] [ -c 数量 ] [ -F 文件名 ][ -i 网络接口 ] [ -r 文件名] [ -s snaplen ][ -T 类型 ] [ -w 文件名 ] [表达式 ]</code></p>
<p>如上是tcpdump命令的完整格式，具体每个参数的含义，可以参看linux的man。</p>
<p>这里简单谈谈最后的那个“表达式”，这个表达式的写法是非常灵活的，使得tcpdump像一个可自由编程的调试工具一样，强大异常。这里可以把表达式理解成是一种编程语言的语句。</p>
<ol>
<li>表达式 = 语句 语句 语句 ……</li>
<li>语句 = 修饰符 | 修饰符 内容</li>
</ol>
<p>不知道我上面的描述方式，是不是说清楚了表达式的结构，表达式是一个又一个原语（primitives）组成的，每个原语又是由修饰符和数据组成。数据可以数字或者id或者ip或者range等。</p>
<p>修饰符有很多种：</p>
<ol>
<li>类型--可以是host（后面跟主机名），net（后面跟ip地址），port（和面跟端口号），如果不指定，默认是host</li>
<li>方向--可以是src，src or dst，src and dst，dst，主要是源端还是目的端，如果不指定，默认是src or dst</li>
<li>协议--就比较多了，常用的就udp和tcp，其他的可以看参考</li>
</ol>
<p>现在再来看看我给的例子，udp port 12009，表示使用UDP协议的，通过12009端口的（进入和出去的）包都显示出来。</p>
<p>tcpdump这个工具还是比较难以记住的，Charels觉得还是要注意理解这个命令的功能和原理，然后在用到的时候，才能快速的找到准确的用法。</p>
<h3>netstat —— 打印网络连接，路由表，网络数据统计等功能</h3>
<p>netstat是Linux服务器上最常用的命令之一，一般我总是用这个命令来诊断一些问题：mysql是否已经成功启动？<a href="http://sexywp.com/tags/web" class="st_tag internal_tag" rel="tag" title="标签 web 下的日志">web</a> server是否已经成功启动？哪些进程在侦听哪些端口，建立了哪些连接？<br />
<code>netstat -npl</code><br />
这是我最常用的参数组合，n代表使用数字，哪个进程在哪个IP上侦听哪个端口，你看到的结果列表里，是192.168.26.128:3306这种形式的，这个例子里是mysql正常启动的状态，一般mysql启动后，会有一个进程侦听在3306端口上，如果不是用n参数，netstat会试图找出主机和程序的名字，会显示成localhost:mysql类似这样。<br />
p代表program，也即程序，到底是哪个程序在侦听端口呢？这个进程的id是多少？就是用这个参数来显示的。所以，np一般一起用，前面用n现实IP，后面用p显示程序的名字。<br />
l代表listen，代表让命令只列出正在侦听端口的进程，对于那些不活跃的则不显示，与l相对应的参数是a，代表all，表示列出所有的socket，不管是在侦听还是没在侦听的。<br />
其他的参数还有很多，比如i可以现实所有的网卡，s可以现实所有包的统计，但是因为使用场景较少，我就不介绍了，大家可以自己去看man，不爽看woman也行:)</p>
<h3>lsof —— 待续</h3>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvim-tricks-collections.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">VIM常用小窍门收集</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnetbeans-plugins-i-used.htm&from=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">NetBeans 中我选用的插件</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/command" title="command" rel="tag">command</a>, <a href="http://sexywp.com/tags/linux" title="Linux" rel="tag">Linux</a>, <a href="http://sexywp.com/tags/tips" title="tips" rel="tag">tips</a>, <a href="http://sexywp.com/tags/usage" title="usage" rel="tag">usage</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/linux-commands-used-when-working.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yii框架的Log系统的分析</title>
		<link>http://sexywp.com/how-to-use-log-in-yii-framework.htm</link>
		<comments>http://sexywp.com/how-to-use-log-in-yii-framework.htm#comments</comments>
		<pubDate>Wed, 30 Mar 2011 17:00:21 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Yii]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[心得体会]]></category>
		<category><![CDATA[日　　记]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[yii]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=418</guid>
		<description><![CDATA[昨天阅读了Yii框架中log部分的源代码，框架提供了灵活、强大的log功能，如果不是非常特殊的需求，框架中自带的类就已经能够满足一般的应用的需求了。实现log功能的源代码被存放在 framework/logging 目录下，这个目录下的代码都包含在包system.logging中。本文简要介绍一下我昨天阅读代码的所得。





<span class="readmore"><a href="http://sexywp.com/how-to-use-log-in-yii-framework.htm" title="Yii框架的Log系统的分析">Keep Reading --- 1988 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架中验证器的allowEmpty属性" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架中验证器的allowEmpty属性</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架base包代码分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/11/20/11182613.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架base包代码分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="MVC最佳实践" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC最佳实践</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用Gii时出现403错误" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Ferror-403-occured-when-use-gii.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用Gii时出现403错误</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>昨天阅读了Yii框架中log部分的源代码，框架提供了灵活、强大的log功能，如果不是非常特殊的需求，框架中自带的类就已经能够满足一般的应用的需求了。实现log功能的源代码被存放在 <a href="http://sexywp.com/tags/framework" class="st_tag internal_tag" rel="tag" title="标签 framework 下的日志">framework</a>/logging 目录下，这个目录下的代码都包含在包system.logging中。本文简要介绍一下我昨天阅读代码的所得。<span id="more-418"></span></p>
<table style="width:auto;">
<tr>
<td><a href="https://picasaweb.google.com/lh/photo/o9iXH2bPs0j6RS1aWaAt5A?feat=embedwebsite"><img src="https://lh5.googleusercontent.com/_QYicOeu89Bk/TZNMKYScKKI/AAAAAAAAB3E/ardNZrMAYFM/s640/class-graph.jpg" height="471" width="640" /></a></td>
</tr>
<tr>
<td style="font-family:arial,sans-serif; font-size:11px; text-align:right"><a href="https://picasaweb.google.com/TangChao.ZJU/Illustration?feat=embedwebsite">system.logging 包类结构图</a></td>
</tr>
</table>
<p>首先，来看一下这个图，这是Charles昨夜工作的结晶，研究了logging目录下一共九个文件中的类的关系。YiiBase，<a href="http://sexywp.com/tags/yii-2" class="st_tag internal_tag" rel="tag" title="标签 yii 下的日志">Yii</a>，CWebApplication不属于logging目录，但是为了说明这些类如何发生作用，也放在了这种图里。我的初衷，是要画一张标准的UML图的，无奈于本科的知识都还给老师了，所以这个图只能算是个四不像，大家凑合看一下，后面我会给自己补补课，后续的文章画得图会趋于规范的。</p>
<p>言归正传，左下角的类CLogger，是在开发过程中，打log时候，真正调用的类，这个类作为所有应用最最基础的组件，被包含在了YiiBase中，任何时候，在代码中调用Yii::getLogger()函数，会得到一个CLogger类的实例，这里用的是一个单件模式（Singleton）。打印log，只要调用其log()方法即可，这个方法有三个参数，第一个是log的内容，第二个是级别（warning，debug，fatal等），第三个category，可以叫类别，也可以视作是一种标识符，可以用于log的过滤。</p>
<div class="hl-surround"><div class="hl-main"><span style="color: Blue;">Yii</span><span style="color: Gray;">::</span><span style="color: Blue;">getLogger</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">log</span><span style="color: Olive;">(</span><span style="color: #8b0000;">&quot;</span><span style="color: Red;">here is a debug info.</span><span style="color: #8b0000;">&quot;</span><span style="color: Gray;">, </span><span style="color: #8b0000;">'</span><span style="color: Red;">debug</span><span style="color: #8b0000;">'</span><span style="color: Gray;">, </span><span style="color: #8b0000;">'</span><span style="color: Red;">app.siteController</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></div></div>
<p>上面的代码片段给出了一个打印log的范例，任何时候想打log，只要这样写就好。从上面的代码片段中，我们看到，log系统的调用接口是极其简单的。接下来分析一下大家非常关心的，log到底会被怎么处理的问题。</p>
<p>在框架中这个log系统里，负责打log，和负责记录log的是两个对象，他们被很好的解耦合了。CLogger扮演了一个专门生产log的角色，其任务就是将用户使用log()函数记录的log放到一个数组里，可以认为是一个内存buffer，长度可配置。在buffer满了的时候，会激发flush（如果配置了autoFlush）的话，flush就是冲掉的意思，如果内存buffer满了，则清空之，继续接受log信息。在清空log buffer之前，这个类对象会触发一个事件，就是onFlush事件，后续其他的类hook到这个onFlush事件上，就可以在log信息被清空之前，有所动作了。</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Gray;">&nbsp;</span><span style="color: Green;">public</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">function</span><span style="color: Gray;"> </span><span style="color: Blue;">log</span><span style="color: Olive;">(</span><span style="color: #00008b;">$message</span><span style="color: Gray;">,</span><span style="color: #00008b;">$level</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Red;">info</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span><span style="color: #00008b;">$category</span><span style="color: Gray;">=</span><span style="color: #8b0000;">'</span><span style="color: Red;">application</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Olive;">{</span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">$this-&gt;_logs就是一个数组，也即存放log信息的内存缓冲，默认10000行</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">_logs</span><span style="color: Olive;">[</span><span style="color: Olive;">]</span><span style="color: Gray;">=</span><span style="color: Green;">array</span><span style="color: Olive;">(</span><span style="color: #00008b;">$message</span><span style="color: Gray;">,</span><span style="color: #00008b;">$level</span><span style="color: Gray;">,</span><span style="color: #00008b;">$category</span><span style="color: Gray;">,</span><span style="color: Blue;">microtime</span><span style="color: Olive;">(</span><span style="color: Green;">true</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">_logCount</span><span style="color: Gray;">++;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Olive;">(</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">autoFlush</span><span style="color: Gray;">&gt;</span><span style="color: Maroon;">0</span><span style="color: Gray;"> &amp;&amp; </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">_logCount</span><span style="color: Gray;">&gt;=</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">autoFlush</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">flush</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;">; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">缓冲满了后，会调用flush</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Green;">public</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">function</span><span style="color: Gray;"> </span><span style="color: Blue;">flush</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">onFlush</span><span style="color: Olive;">(</span><span style="color: Green;">new</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">CEvent</span><span style="color: Olive;">(</span><span style="color: #00008b;">$this</span><span style="color: Olive;">)</span><span style="color: Olive;">)</span><span style="color: Gray;">; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">激发onFlush事件</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">_logs</span><span style="color: Gray;">=</span><span style="color: Green;">array</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;">; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">清空缓冲</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">_logCount</span><span style="color: Gray;">=</span><span style="color: Maroon;">0</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">?&gt;</span></li></ol></div></div>
<p>这是一个生产者与消费者的故事，以上讲述的是生产者的故事。接下来，讲消费者的故事。CLogger已经在内存中生产了log，那么接下来就要来收集，分析，处理这些log，该记录的记录，该抛弃的抛弃，该报警的报警。当然，你可以不给系统提供消费者，那些log产生了，然后消失了，基本不会带来什么负载和泄露，轻轻松松。</p>
<p>log的生产者是系统中必然存在的，但是log的消费者不是，是通过配置文件配置到系统中的，打开位于/protected/config/main.php的配置文件，在components段，我们可以看到关于log组件的配置，如下所示：</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">log</span><span style="color: #8b0000;">'</span><span style="color: Gray;">=&gt;</span><span style="color: Green;">array</span><span style="color: Olive;">(</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #8b0000;">'</span><span style="color: Red;">class</span><span style="color: #8b0000;">'</span><span style="color: Gray;">=&gt;</span><span style="color: #8b0000;">'</span><span style="color: Red;">CLogRouter</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #8b0000;">'</span><span style="color: Red;">routes</span><span style="color: #8b0000;">'</span><span style="color: Gray;">=&gt;</span><span style="color: Green;">array</span><span style="color: Olive;">(</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">array</span><span style="color: Olive;">(</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #8b0000;">'</span><span style="color: Red;">class</span><span style="color: #8b0000;">'</span><span style="color: Gray;">=&gt;</span><span style="color: #8b0000;">'</span><span style="color: Red;">CFileLogRoute</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #8b0000;">'</span><span style="color: Red;">levels</span><span style="color: #8b0000;">'</span><span style="color: Gray;">=&gt;</span><span style="color: #8b0000;">'</span><span style="color: Red;">error, warning</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">)</span><span style="color: Gray;">,</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #ffa500;">//</span><span style="color: #ffa500;"> uncomment the following to show log messages on web pages</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #ffa500;">/*</span></li>
<li><span style="color: #ffa500;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; array(</span></li>
<li><span style="color: #ffa500;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'class'=&gt;'CWebLogRoute',</span></li>
<li><span style="color: #ffa500;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ),</span></li>
<li><span style="color: #ffa500;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #ffa500;">*/</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">)</span><span style="color: Gray;">,</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">)</span><span style="color: Gray;">,</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">?&gt;</span></li></ol></div></div>
<p>负责采集处理log的真正对象，是一组以Route结尾的类，在上面类图中，位于右上角的那5个类。它们各有个的功能，发邮件的，写文件的，写Db的等等。前面也提了，对于一堆log，可能各自要使用不同的方法处理，比如debug信息抛弃，info信息记录在文件，而fatal信息发邮件给管理员，一个系统中很可能有这样那样的需求。所以，被以组件形式装进应用中的，并不是Route，而是类图中叫CLogRouter的对象。</p>
<p>对log的各种处理方法，都继承自一个叫CLogRoute的抽象类，提供了统一的调用接口，CLogRouter就是这些route的管理者，它主要负责的就是在onFlush事件发生的时候，把CLogger生产的log都接过来，然后，逐一地交付给自己旗下的Route们，分别处理。从上面的配置信息里，我们可以看到，LogRouter管理多少个Route也是通过配置文件配置的，也即route是router所依赖的组件。在具体开发过程中，你可以只配置一个，也可以配置一群。这种行为特征，真的有点像路由，怪不得叫router和route，我猜就这么个解释。</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Gray;">&nbsp;</span><span style="color: Green;">public</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">function</span><span style="color: Gray;"> </span><span style="color: Blue;">collectLogs</span><span style="color: Olive;">(</span><span style="color: #00008b;">$event</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$logger</span><span style="color: Gray;">=</span><span style="color: Blue;">Yii</span><span style="color: Gray;">::</span><span style="color: Blue;">getLogger</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">foreach</span><span style="color: Olive;">(</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">_routes</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">as</span><span style="color: Gray;"> </span><span style="color: #00008b;">$route</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">{</span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">Router向每个route分发log，请求处理</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Olive;">(</span><span style="color: #00008b;">$route</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">enabled</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$route</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">collectLogs</span><span style="color: Olive;">(</span><span style="color: #00008b;">$logger</span><span style="color: Gray;">,</span><span style="color: Green;">false</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Green;">public</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">function</span><span style="color: Gray;"> </span><span style="color: Blue;">processLogs</span><span style="color: Olive;">(</span><span style="color: #00008b;">$event</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$logger</span><span style="color: Gray;">=</span><span style="color: Blue;">Yii</span><span style="color: Gray;">::</span><span style="color: Blue;">getLogger</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">foreach</span><span style="color: Olive;">(</span><span style="color: #00008b;">$this</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">_routes</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">as</span><span style="color: Gray;"> </span><span style="color: #00008b;">$route</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">{</span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">Router向每个route分发log，请求处理</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Olive;">(</span><span style="color: #00008b;">$route</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">enabled</span><span style="color: Olive;">)</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: #00008b;">$route</span><span style="color: Gray;">-&gt;</span><span style="color: Blue;">collectLogs</span><span style="color: Olive;">(</span><span style="color: #00008b;">$logger</span><span style="color: Gray;">,</span><span style="color: Green;">true</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">?&gt;</span></li></ol></div></div>
<p>在操作实践中，我们完全可以自己继承CLogRoute，实现collectLogs方法，可以开发譬如名为NetLogRoute的类，将log从网络端口上以UDP包或者通过TCP连接形式发送到网络上专门的log服务器中，也可以开发名为MobileLogRoute的类，用来给管理员发送手机报警短信。</p>
<p>上面一直没有介绍到的Filter，其作用其实可以顾名思义，就是在log处理的时候，过滤用的，可以根据前文提到的category参数来过滤，也可以根据log等级类过滤，等等等等。Filter也是通过参数配置的形式被插入到route中的，完全可以创建自己特有的filter通过配置来替换默认filter，可以说，将灵活性发挥到了极致。不过，灵活还是有牺牲的，比如我就觉得，如果一个router下面挂上N个route之后，每个route都采用特定的filter，则会造成同一批log（10000条）被过滤的N遍。所以，比较好的模式，可能还是一个router，下面一个route，然后可以选择用或者不用filter，挂多个虽然理论可行，但是从实际代码来看，可能有一定性能损耗。</p>
<p>好了，终于啰嗦完了，最后问个问题，整个logging系统的这种结构，到底是哪一种设计模式呢？欢迎交流哈～</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架中验证器的allowEmpty属性" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架中验证器的allowEmpty属性</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架base包代码分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fyii-package-base-source-code-analysis.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/11/20/11182613.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架base包代码分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="MVC最佳实践" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC最佳实践</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用Gii时出现403错误" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Ferror-403-occured-when-use-gii.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用Gii时出现403错误</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/framework" title="framework" rel="tag">framework</a>, <a href="http://sexywp.com/tags/source-code" title="source code" rel="tag">source code</a>, <a href="http://sexywp.com/tags/yii-2" title="yii" rel="tag">yii</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/how-to-use-log-in-yii-framework.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>视频教程：使用Yii框架开发Blog</title>
		<link>http://sexywp.com/video-guide-to-use-yii-framework.htm</link>
		<comments>http://sexywp.com/video-guide-to-use-yii-framework.htm#comments</comments>
		<pubDate>Sun, 20 Mar 2011 06:59:18 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Yii]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[develop]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[yii]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=417</guid>
		<description><![CDATA[Yii框架的官方网站上，有一个教学用demo，就是使用Yii框架开发一个blog。有非常详尽的文字描述，步骤基本也比较清楚。一遍走下来，基本上就差不多都学懂了。

上周正好要在公司做分享，害怕当堂演示会说不好，浪费时间，就在家里自己将blog的开发过程录制成了视频，这是我第一次录制视频，觉得格外新鲜，遂决定在这里分享给大家。大家一起乐一乐，O(∩_∩)O哈哈~

第0集 Blog功能需求及应用骨架搭建

<span class="readmore"><a href="http://sexywp.com/video-guide-to-use-yii-framework.htm" title="视频教程：使用Yii框架开发Blog">Keep Reading --- 303 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm&from=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Yii框架中验证器的allowEmpty属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Ferror-403-occured-when-use-gii.htm&from=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使用Gii时出现403错误</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm&from=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MVC最佳实践</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>Yii框架的官方网站上，有一个教学用demo，就是使用Yii框架开发一个blog。有非常详尽的文字描述，步骤基本也比较清楚。一遍走下来，基本上就差不多都学懂了。</p>
<p>上周正好要在公司做分享，害怕当堂演示会说不好，浪费时间，就在家里自己将blog的开发过程录制成了视频，这是我第一次录制视频，觉得格外新鲜，遂决定在这里分享给大家。大家一起乐一乐，O(∩_∩)O哈哈~<span id="more-417"></span></p>
<p>第0集 Blog功能需求及应用骨架搭建<br />
<embed src="http://player.youku.com/player.php/sid/XMjUyMjIxMDE2/v.swf" quality="high" width="480" height="400" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed></p>
<p>第1集 使用Gii代码生成工具<br />
<embed src="http://player.youku.com/player.php/sid/XMjUyMjI5MTI0/v.swf" quality="high" width="480" height="400" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed></p>
<p>第2集 使用数据库存储的用户信息来验证用户身份<br />
<embed src="http://player.youku.com/player.php/sid/XMjUyMjMzODc2/v.swf" quality="high" width="480" height="400" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed></p>
<p>第3集 Blog文章的创建和发布<br />
<embed src="http://player.youku.com/player.php/sid/XMjczMTc1Nzk2/v.swf" quality="high" width="480" height="400" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed><br />
to be continued...</p>
<p>多谢大家捧场了，欢迎留言告诉我大家是否喜欢这种形式~</p>
<p>最近新录了一个视频，不过不是关于blog demo的，是关于db部分的分析的，也一并放在这里吧，算是借点这里的人气了：）2012-1-27<br />
<embed src='http://player.youku.com/player.php/sid/XMzQ2NDM1NzUy/v.swf' quality='high' width='480' height='400' align='middle' allowScriptAccess='sameDomain' type='application/x-shockwave-flash'></embed></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm&from=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Yii框架中验证器的allowEmpty属性</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Ferror-403-occured-when-use-gii.htm&from=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">使用Gii时出现403错误</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm&from=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">MVC最佳实践</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/develop" title="develop" rel="tag">develop</a>, <a href="http://sexywp.com/tags/framework" title="framework" rel="tag">framework</a>, <a href="http://sexywp.com/tags/php" title="PHP" rel="tag">PHP</a>, <a href="http://sexywp.com/tags/video" title="video" rel="tag">video</a>, <a href="http://sexywp.com/tags/yii-2" title="yii" rel="tag">yii</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/video-guide-to-use-yii-framework.htm/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Nexus S上网、彩信设置方法</title>
		<link>http://sexywp.com/how-to-set-nexus-s-net.htm</link>
		<comments>http://sexywp.com/how-to-set-nexus-s-net.htm#comments</comments>
		<pubDate>Fri, 18 Mar 2011 18:28:17 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[手　　机]]></category>
		<category><![CDATA[nexus s]]></category>
		<category><![CDATA[上网]]></category>
		<category><![CDATA[设置]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=416</guid>
		<description><![CDATA[新拿到手的Nexus S手机到底应该如何设置，才能顺利联网呢？本文详细为您解释，如何正确配置Nexus S手机上网的接入点（APN）配置。<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">入手Nexus S</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Nexus S使用一段时间后的体验</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fset-permanent-links.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">设置永久链接</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-set-up-permalink.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">怎样设置永久链接</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fadd-settings-link-to-ur-plugin.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">在插件管理页面给你的插件添加“设置”链接</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>入手Nexus S一周了，主要感觉还是信号较弱，WiFi比较弱，通信信号也很弱。在室外空旷地稍微好一点，在办公室基本比较悲剧。按照我同事的说法，国外生产的手机，辐射量必须符合他们自己的标准，是考虑了辐射量不会影响身体健康的前提下制定的，所以在中国信号相比国产山寨机要弱。OK，听起来像是个不错的理由。那就这样吧。<span id="more-416"></span></p>
<p>拿到Nexus S，如果是新机器，一开机的话，可能网络是没有设置好的。这个时候，既不能发彩信，也不能上网，但是可以发送普通短信和打电话。</p>
<p>根据我实际使用的经验来看，我用的中国移动，移动的网络是自动向外广播它的网络配置方法的，也就是说，如果刚拿到手机的童鞋，不做任何设置，一段时间后，就会被自动设置好。我是怎么发现的呢，我一拿到，看到有两个配置，但是不怎么对，就按照网上说的改了，勉强改到能上网了，今天本来想彻底重新研究一下这块的配置，重新设置的，就执行了一下“重置为默认设置”，结果一看，已经正确配置好了彩信和网络。</p>
<p>这里还是列举一下配置方法，以供没有自动配成功的童鞋参考：</p>
<p>进入“<a href="http://sexywp.com/tags/%e8%ae%be%e7%bd%ae" class="st_tag internal_tag" rel="tag" title="标签 设置 下的日志">设置</a>-无线和网络-移动网络-接入点名称”，点击菜单按钮，选择“新建APN”，按照如下填写：</p>
<p>1.名称: 中国移动彩信<br />
2.APN: cmwap<br />
3.代理: 10.0.0.172<br />
4.端口: 80<br />
5.用户名:（空着）<br />
6.密码:（空着）<br />
7.服务器:（空着）<br />
8.MMSC: http://mmsc.monternet.com  (记住一定要加上“http://”不然的话只能收不能发)<br />
9.彩信代理: 10.0.0.172<br />
10.彩信端口: 80<br />
12.MCC: 460<br />
13.MNC: 00  (有的机器需要设置00，原生中文版才可以设置02)<br />
14.身份验证类型: CHAP<br />
15.APN类型: mms</p>
<p>保存，以上是发送彩信使用的。然后再创建一个新的APN，按如下配置：</p>
<p>1.名称: 中国移动 GPRS<br />
2.APN: cmnet<br />
3.代理: （空着）<br />
4.端口: （空着）<br />
5.用户名:（空着）<br />
6.密码:（空着）<br />
7.服务器:（空着）<br />
8.MMSC: （空着）<br />
9.彩信代理: （空着）<br />
10.彩信端口: （空着）<br />
12.MCC: 460<br />
13.MNC: 00 (有的机器需要设置00，原生中文版才可以设置02)<br />
14.身份验证类型: CHAP<br />
15.APN类型: default,supl （网上也有人说这里填internet的，如果上不了可以试试）</p>
<p>保存，以上配置是用来上网的，连接的是cmnet。</p>
<p>这里，我报下我手机的系统版本：<br />
<a href="http://sexywp.com/tags/android" class="st_tag internal_tag" rel="tag" title="标签 android 下的日志">Android</a>  版本：2.3.1<br />
基带版本：I9020XXJK8<br />
内核版本：2.6.35.7-g7f1638a</p>
<p>配置保存好网络接入点设置后，单选勾取cmwap，平时发彩信，如果用到网络的话，会自动选择cmnet作为接入点的。我已经实验过了。在外层菜单一定勾选“已启用数据”，否则还是不能上网的。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">入手Nexus S</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Nexus S使用一段时间后的体验</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fset-permanent-links.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">设置永久链接</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-set-up-permalink.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">怎样设置永久链接</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fadd-settings-link-to-ur-plugin.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">在插件管理页面给你的插件添加“设置”链接</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/nexus-s" title="nexus s" rel="tag">nexus s</a>, <a href="http://sexywp.com/tags/%e4%b8%8a%e7%bd%91" title="上网" rel="tag">上网</a>, <a href="http://sexywp.com/tags/%e8%ae%be%e7%bd%ae" title="设置" rel="tag">设置</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/how-to-set-nexus-s-net.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>入手Nexus S</title>
		<link>http://sexywp.com/nexus-s-sucks.htm</link>
		<comments>http://sexywp.com/nexus-s-sucks.htm#comments</comments>
		<pubDate>Mon, 14 Mar 2011 12:11:08 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[手　　机]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[nexus s]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=415</guid>
		<description><![CDATA[移动互联网的飞速发展，真的让我眼热，虽然没哥什么鸟事，但是也还是想快速走入这个领域看看。于是乎，想要一尝Android之鲜。充分分析了现在经济状况，Android系统的相应机型，最终挑选了Google亲历打造的Nexus S。哥玩的就是血统。在辗转反侧想了很多个日夜后，终于出手，并于今天下午拿到了手上。

NS给我的第一印象，就是“差劲”。

装上电池，开机画面还有点小绚丽，但是用惯了iTouch，也不过如此了，没什么震撼的。进入系统后，就让设置google帐户，填好了发现没法联网。先跳过。然后开始研究为什么没法联网，然后网上东翻西找教程，设置了一番，还是不能联网。算求，打电话，拨不出去，短信发不了。奇怪了，折腾了一圈，身旁一兄弟一语点醒我梦中人，没信号。拜托有没搞错，信号都没有，你在搞毛，我想砖块一定向我飞来了吧。但是我平时用Nokia E63，都是在自己的工位上，打电话也好，发短信也好，上QQ也好。谁能知道NS的天线能力如此阳痿。最后跑到楼道上，发现GMail能上了，电话能打了，短信也发出去了。

<span class="readmore"><a href="http://sexywp.com/nexus-s-sucks.htm" title="入手Nexus S">Keep Reading --- 821 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Nexus S使用一段时间后的体验" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Nexus S使用一段时间后的体验</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Nexus S上网、彩信设置方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Nexus S上网、彩信设置方法</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Nokia E63 使用心得——无限可能性（软件篇）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fsoftwares-on-symbian-s60iii.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Nokia E63 使用心得——无限可能性（软件篇）</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Micheal Clayton" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmicheal-clayton.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/09/05/28376852.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Micheal Clayton</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Java的开源XML工具包dom4j" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fdom4j-xml-toolkit-java.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/01/10587680.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Java的开源XML工具包dom4j</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>移动互联网的飞速发展，真的让我眼热，虽然没哥什么鸟事，但是也还是想快速走入这个领域看看。于是乎，想要一尝Android之鲜。充分分析了现在经济状况，Android系统的相应机型，最终挑选了Google亲历打造的Nexus S。哥玩的就是血统。在辗转反侧想了很多个日夜后，终于出手，并于今天下午拿到了手上。<span id="more-415"></span></p>
<p>NS给我的第一印象，就是“差劲”。</p>
<p>装上电池，开机画面还有点小绚丽，但是用惯了iTouch，也不过如此了，没什么震撼的。进入系统后，就让设置google帐户，填好了发现没法联网。先跳过。然后开始研究为什么没法联网，然后网上东翻西找教程，设置了一番，还是不能联网。算求，打电话，拨不出去，短信发不了。奇怪了，折腾了一圈，身旁一兄弟一语点醒我梦中人，没信号。拜托有没搞错，信号都没有，你在搞毛，我想砖块一定向我飞来了吧。但是我平时用Nokia E63，都是在自己的工位上，打电话也好，发短信也好，上QQ也好。谁能知道NS的天线能力如此阳痿。最后跑到楼道上，发现GMail能上了，电话能打了，短信也发出去了。</p>
<p>开机的时候，我选择了中文，结果系统界面是中文的了，但是竟然没有缺省的中文输入法……既然支持一门语言，竟然不支持输入法……好吧。然后我开始折腾着装91助手，最后在旁边兄弟的提点下，才知道开启了USB调试模式，才能连接。装好了中文输入法，开始打字，发现竖屏模式完全无法打字，当我选字上屏的时候，突然系统退出了，手掌估计擦到了Home键。额滴神啊，手长得稍微肉点，也要遭到歧视么？？？</p>
<p>总结一下：<br />
1. 总体来说，天线比较弱智，基本跟Nokia不在一个水平；<br />
2. Home键用按钮可能更好一点，G7我就比较喜欢，基本不会产生我这种误操作；<br />
3. 试了下相机，基本上没什么惊喜，或者说乏善可陈，没比E63强；</p>
<p>当然，这款手机还是被赋予了很多期望值的，对于我来说也是一样，不然我就真的是自己犯贱了，花4000多大洋买个烂货，我这里发发牢骚，只是说这个东西给我的第一印象是sucks，考虑入手的童鞋呢，可以再观望。我还会进一步体验此机，本文虽是负面观点，但是不代表我对此机型的彻底否定。陆续我会继续追加体验心得的。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Nexus S使用一段时间后的体验" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnexus-s-exp.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Nexus S使用一段时间后的体验</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Nexus S上网、彩信设置方法" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-set-nexus-s-net.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Nexus S上网、彩信设置方法</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Nokia E63 使用心得——无限可能性（软件篇）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fsoftwares-on-symbian-s60iii.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Nokia E63 使用心得——无限可能性（软件篇）</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="诺丁山" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnotting-hill.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/08/21/23797535.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">诺丁山</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="我对摆渡真的很无语啊" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fnothing-to-say.htm&from=http%3A%2F%2Fsexywp.com%2Fnexus-s-sucks.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/17/12736661.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">我对摆渡真的很无语啊</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/android" title="android" rel="tag">android</a>, <a href="http://sexywp.com/tags/nexus-s" title="nexus s" rel="tag">nexus s</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/nexus-s-sucks.htm/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>MVC最佳实践</title>
		<link>http://sexywp.com/mvc-best-practice.htm</link>
		<comments>http://sexywp.com/mvc-best-practice.htm#comments</comments>
		<pubDate>Mon, 07 Mar 2011 09:44:39 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Yii]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=414</guid>
		<description><![CDATA[前一段日子，写了一篇《MVC就是一个选择题》，重点描述了我对MVC模式的迷惑。随着我对这个模式应用时间的深入，渐渐感到得心应手，这个模式早在30多年前就已经发明了，确实经受了时间的考验，可以说是千锤百炼。但是，实践过程中，我也发现，更多的时候照猫画虎还是有很多弊端的，想要真正做好MVC的选择题，必须在项目中不断犯错误，不断修正，才能逐渐走上正轨。我参加的项目主要运用了Yii框架，是目前比较流行的一个Web开发框架。随着前不久，1.1.6版本的发布，我发现Yii框架的文档中，多了一篇MVC最佳实践的文章。我想，这个文章对于初学者来说，应该具备相当的指导性，而且指导相当具体。如果也有跟我相同的迷茫，应该好好钻研一下这篇文章，并且身体力行去验证之，这里给出链接。我在这篇文章中，就是概括简述一下那篇文档的内容。

<span class="readmore"><a href="http://sexywp.com/mvc-best-practice.htm" title="MVC最佳实践">Keep Reading --- 1394 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架中验证器的allowEmpty属性" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架中验证器的allowEmpty属性</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="MVC就是个选择题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC就是个选择题</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="ExtJS 4 的MVC" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">ExtJS 4 的MVC</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>前一段日子，写了一篇《<a href="http://sexywp.com/mvc-chose-where-to-put-your-code.htm">MVC就是一个选择题</a>》，重点描述了我对MVC模式的迷惑。随着我对这个模式应用时间的深入，渐渐感到得心应手，这个模式早在30多年前就已经发明了，确实经受了时间的考验，可以说是千锤百炼。但是，实践过程中，我也发现，更多的时候照猫画虎还是有很多弊端的，想要真正做好MVC的选择题，必须在项目中不断犯错误，不断修正，才能逐渐走上正轨。我参加的项目主要运用了Yii框架，是目前比较流行的一个Web开发框架。随着前不久，1.1.6版本的发布，我发现Yii框架的文档中，多了一篇MVC最佳实践的文章。我想，这个文章对于初学者来说，应该具备相当的指导性，而且指导相当具体。如果也有跟我相同的迷茫，应该好好钻研一下这篇文章，并且身体力行去验证之，<a href="http://www.yiiframework.com/doc/guide/1.1/en/basics.best-practices">这里给出链接</a>。我在这篇文章中，就是概括简述一下那篇文档的内容。<span id="more-414"></span></p>
<p>MVC的核心理念是代码的重用和关注点的分离（Separation of concern 我个人对这个理解就是将数据和表现进行分离）。如何正确遵循MVC的原理来编写代码是有一些基本指导原则可以遵循的。为了便于理解后面将要叙述的指导原则，我们这里认为一个典型的Web应用由以下几个子应用（部分）组成：</p>
<ul>
<li>前端——网站界面，面向普通用户</li>
<li>后台——一部分有管理权限的用户用于维护Web应用的正常运转</li>
<li>控制台——在终端中执行的命令，或者是定时任务如cronjob，用于日常运维</li>
<li>API——用于第三方合作，或者二次开发</li>
</ul>
<h3>Model</h3>
<p>模型用于表示底层数据结构，经常在整个应用的不同部分共享，有些模型在前后台、API中都会用到，所以一个模型应该遵循的指导原则有：</p>
<ul>
<li>包含属性用于描述特定的数据</li>
<li>应该包含业务逻辑，以确保数据能够满足表现的需要</li>
<li>应该包含数据操作的代码，比如数据存储、检索</li>
<li>不应该使用$_GET $_POST这样的只有在前端才会出现的数组，在控制台和API用到时候，可能就无法复用了</li>
<li>不应该出现HTML代码，负责表现的代码应该放到view文件中</li>
</ul>
<p>在上述指导原则下，可能会写出非常庞大的Model类（过多数据操作，业务逻辑代码包含其中）。这种情况下，建议进一步抽象，提炼出一个基类，包含最通用的功能，然后前端、后端和API在用到时候，将各个子应用才相关的逻辑放到基类继承出来的子类里面。</p>
<h3>View</h3>
<p>视图主要就用于前端表现的代码。</p>
<ul>
<li>包含HTML，以及所有负责表现的代码，可以出现PHP，但是只用于遍历数据、格式化数据</li>
<li>不应该包含DB请求</li>
<li>不应该出现引用$_GET $_POST这类数组的代码，这应该是Controller的工作。View只是专注于表现，布局等和页面呈现有关的业务，用户的请求数据应该由Controller和Model负责处理</li>
<li>如果必要，可以访问Model和Controller的属性，不过这是为了满足表现的需要</li>
</ul>
<p>可以使用诸如布局、部分视图、HTML Helper类、Widget等框架特性来最大程度重用View的代码。</p>
<h3>Controller</h3>
<p>控制器是将模型、视图和其他组件组装在一起形成一个应用的粘合剂。控制器直接负责处理终端用户的请求。</p>
<ul>
<li>可以访问$_GET $_POST这样的用户请求数组</li>
<li>创建模型，并决定一个模型对象的生命周期</li>
<li>不应该出现SQL语句，数据库请求应该放到Model中</li>
<li>不应该出现HTML代码，而应该将其放入到View中</li>
</ul>
<p>在一个设计良好的MVC应用中，控制器是非常轻量级的，经常只有几十行代码的样子；而Model总是非常复杂而且庞大，包含了所有的用于表现的数据及其操作方法。这是因为由数据结构和业务逻辑组成的模型对每个应用来说，都是独特的，需要大量的定制化工作来满足应用的需求；控制器的逻辑经常遵循一个特定的套路，在各个应用中都差不多，因此可以被框架底层代码极大程度地简化（也就是说不是控制器代码少，而是Web开发框架已经都抽象出来并且都帮你做好了，这也就是框架的价值和能够实现快速开发的原因）。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="视频教程：使用Yii框架开发Blog" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fvideo-guide-to-use-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9170385.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">视频教程：使用Yii框架开发Blog</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架中验证器的allowEmpty属性" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fyii-validator-allwoempty-property.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架中验证器的allowEmpty属性</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="MVC就是个选择题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC就是个选择题</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="ExtJS 4 的MVC" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">ExtJS 4 的MVC</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/development" title="development" rel="tag">development</a>, <a href="http://sexywp.com/tags/mvc" title="MVC" rel="tag">MVC</a>, <a href="http://sexywp.com/tags/programming" title="programming" rel="tag">programming</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/mvc-best-practice.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>［插件开发］获知文章状态变化</title>
		<link>http://sexywp.com/get-updated-when-post-status-changed.htm</link>
		<comments>http://sexywp.com/get-updated-when-post-status-changed.htm#comments</comments>
		<pubDate>Fri, 31 Dec 2010 18:23:47 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Plugins Develop]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[action]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[hooks]]></category>
		<category><![CDATA[plugins]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=413</guid>
		<description><![CDATA[文章（post）是 WordPress 博客的核心价值所在，围绕一篇文章的增、删、改，我们可以开发很多有用的插件。近来，由于维护一款插件的需要，我碰巧研究了一下围绕文章发布流程而设立的一些钩子（hook）。微有所得，记录备查。

事情的起因是插件中的一个函数hook到了一个action上，名字是publish_post，顾名思义，在文章发布时候被激发的。为了要更清楚地掌控这个action，我想在源代码中，把触发点给找出来，这一找，问题来了。理论上，我们hook任何action，WP内部都会有对应的do_action来激发这个钩子，这一次，一搜，根本没有publish_post，那就有点小麻烦，说明具体激发哪个钩子，是运行时决定的，再明白点说吧，这个action的名字，应该使用变量拼出来的，所以我们直接搜publish_post很难找到调用点。

<span class="readmore"><a href="http://sexywp.com/get-updated-when-post-status-changed.htm" title="［插件开发］获知文章状态变化">Keep Reading --- 934 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="插件开发全攻略（08）---构建一个WordPress插件用户面板" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-write-a-wp-plugin-08.htm&from=http%3A%2F%2Fsexywp.com%2Fget-updated-when-post-status-changed.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/26/9637574.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">插件开发全攻略（08）---构建一个WordPress插件用户面板</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress:插件开发API（Plugin API）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwordpress-plugin-api.htm&from=http%3A%2F%2Fsexywp.com%2Fget-updated-when-post-status-changed.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress:插件开发API（Plugin API）</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="插件开发全攻略（12）---发布并推广你的WordPress插件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-write-a-wp-plugin-12.htm&from=http%3A%2F%2Fsexywp.com%2Fget-updated-when-post-status-changed.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">插件开发全攻略（12）---发布并推广你的WordPress插件</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用NetBeans IDE 6.5作为WordPress的开发环境" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fuse-netbeans-to-develop-wp.htm&from=http%3A%2F%2Fsexywp.com%2Fget-updated-when-post-status-changed.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/02/10636076.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用NetBeans IDE 6.5作为WordPress的开发环境</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="插件开发全攻略（03）---怎样获得WordPress插件的创意" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-write-a-wp-plugin-03.htm&from=http%3A%2F%2Fsexywp.com%2Fget-updated-when-post-status-changed.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">插件开发全攻略（03）---怎样获得WordPress插件的创意</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>文章（post）是 <a href="http://sexywp.com/tags/wordpress" class="st_tag internal_tag" rel="tag" title="标签 WordPress 下的日志">WordPress</a> 博客的核心价值所在，围绕一篇文章的增、删、改，我们可以开发很多有用的插件。近来，由于维护一款插件的需要，我碰巧研究了一下围绕文章发布流程而设立的一些钩子（hook）。微有所得，记录备查。<span id="more-413"></span></p>
<p>事情的起因是插件中的一个函数hook到了一个action上，名字是publish_post，顾名思义，在文章发布时候被激发的。为了要更清楚地掌控这个action，我想在源代码中，把触发点给找出来，这一找，问题来了。理论上，我们hook任何action，WP内部都会有对应的do_action来激发这个钩子，这一次，一搜，根本没有publish_post，那就有点小麻烦，说明具体激发哪个钩子，是运行时决定的，再明白点说吧，这个action的名字，应该使用变量拼出来的，所以我们直接搜publish_post很难找到调用点。</p>
<p>具体寻找的过程，我也不想赘述了，无非是查文档，搜代码。这里想要一提的是，我发现一个新的小技巧，给技巧取个名字叫“农村包围城市”，因为一下无法定位到想要找的代码，那么能准确定位其周边代码也是可以的，至少可以缩小查找范围。从文档中我们看到，在publish_post被激发的点附近，应该还有save_post，那么搜一下save_post，乖乖，准确找到了，然后就看到还有wp_insert_post，pre_post_update等等。然后，马上写一个小插件，向4个感兴趣的点hook，然后随便发布一下文章，根据打出的log，基本确定了publish_post就在pre_post_update和save_post中间激发。这时候就剩下80行左右的范围了，那一行行找还是很快的。</p>
<p>最终结果还是比较有意思的，有个函数叫<strong>wp_transition_post_status</strong>，这里面提供了3个hook，也可以说n个吧，因为这里面就看到了那个运行时才决定的hook名称的代码。最后不但搞清楚了publish_post的激发原理，还发现了原来可以随意通过hook监测每篇文章的状态变化。虽然短期内看不出来有啥用，但是以后一定可以想出来一些应用的。</p>
<ul>
<li><strong>transition_post_status</strong> 当一篇文章或者页面状态变化时触发，三个参数，分别是原状态，现在状态，文章对象本身</li>
<li><strong>状态_to_状态</strong> 某个具体的状态流转时候触发，可以是draft_to_pending，private_to_publish等等，只要是合法的status取值，可以随意组合。一个参数是文章对象本身。</li>
<li><strong>状态_类型</strong> 一个状态+一个类型，可以知道publish_post这个钩子，本质上就是这种，真实含义是有一篇类型是post（还可以是page）的文章，状态变成了publish，而不是已开始我理解成的发布一篇文章时候激发。说起来差别不大，但是你对其的理解已经完全变掉了。以此类推，你可以hook到private_post，还可以是draft_page等等。随意组合。</li>
</ul>
<p>通过上述非常灵活的3种钩子，我们就可以随时掌控任何文章的状态变化了。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="插件开发全攻略（08）---构建一个WordPress插件用户面板" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-write-a-wp-plugin-08.htm&from=http%3A%2F%2Fsexywp.com%2Fget-updated-when-post-status-changed.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/26/9637574.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">插件开发全攻略（08）---构建一个WordPress插件用户面板</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress:插件开发API（Plugin API）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwordpress-plugin-api.htm&from=http%3A%2F%2Fsexywp.com%2Fget-updated-when-post-status-changed.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress:插件开发API（Plugin API）</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="插件开发全攻略（12）---发布并推广你的WordPress插件" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-write-a-wp-plugin-12.htm&from=http%3A%2F%2Fsexywp.com%2Fget-updated-when-post-status-changed.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">插件开发全攻略（12）---发布并推广你的WordPress插件</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="使用NetBeans IDE 6.5作为WordPress的开发环境" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fuse-netbeans-to-develop-wp.htm&from=http%3A%2F%2Fsexywp.com%2Fget-updated-when-post-status-changed.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/02/10636076.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">使用NetBeans IDE 6.5作为WordPress的开发环境</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="插件开发全攻略（03）---怎样获得WordPress插件的创意" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-write-a-wp-plugin-03.htm&from=http%3A%2F%2Fsexywp.com%2Fget-updated-when-post-status-changed.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">插件开发全攻略（03）---怎样获得WordPress插件的创意</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/action" title="action" rel="tag">action</a>, <a href="http://sexywp.com/tags/development" title="development" rel="tag">development</a>, <a href="http://sexywp.com/tags/hooks" title="hooks" rel="tag">hooks</a>, <a href="http://sexywp.com/tags/plugins" title="plugins" rel="tag">plugins</a>, <a href="http://sexywp.com/tags/wordpress" title="WordPress" rel="tag">WordPress</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/get-updated-when-post-status-changed.htm/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MVC就是个选择题</title>
		<link>http://sexywp.com/mvc-chose-where-to-put-your-code.htm</link>
		<comments>http://sexywp.com/mvc-chose-where-to-put-your-code.htm#comments</comments>
		<pubDate>Thu, 30 Dec 2010 06:04:28 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[心得体会]]></category>
		<category><![CDATA[design pattern]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=412</guid>
		<description><![CDATA[由于采用了Web开发框架来开发项目，所以我首次在真正的项目中采用MVC的开发模式。随着项目的不断深入，我也在不断反思，MVC设计模式到底给项目带来了什么？成倍的开发时间？复杂无比的目录结构？铺天盖地的文件数量？听起来都很难听对吗，但是确实如此。那么MVC所许诺的那些好处呢？清晰的代码结构，易于维护，易于扩展？真有吗？

当然，我不是在批判MVC，只是觉得，在使用MVC过程中，还是需要投入更深入的思考，到底怎样才能用好这个设计模式。MVC给我的感觉是，要求使用其的开发者有更高的觉悟，来正确选择存放一段代码的地方。从而实现解耦合，代码复用，和易于维护。为什么说使用MVC会有成倍的开发时间，主要就是因为在开发中，我们需要更多的时间去思考，这些代码放在哪里更合理一些。在MVC框架下代码被切割成一个又一个的小文件，分散在复杂的目录树中，那么到底怎样选择把代码写在哪里呢？这道选择题，并非有看起来那么容易。就我个人感受而言，更多的时候，无论将代码放在哪里都可以正确实现你的逻辑，MVC不是什么神兵利器，并不能通过其模式本身的约束，将开发者导入到一个正确的轨道上，反而会因为开发者本身错误的选择而让MVC自己变得一团糟。所以说，当一个团队确定要在一个项目中引入MVC时候，应该思考一下，每个团队成员是不是真的都有能力驾驭，如果没有对应的能力话，是不是要考虑前期对项目成员进行一定的培训。

<span class="readmore"><a href="http://sexywp.com/mvc-chose-where-to-put-your-code.htm" title="MVC就是个选择题">Keep Reading --- 1444 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="MVC最佳实践" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC最佳实践</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="ExtJS 4 的MVC" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">ExtJS 4 的MVC</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="给SVN客户端配置代理服务器" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fuse-proxy-in-ur-svn-client.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/13/12123060.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">给SVN客户端配置代理服务器</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="工作中常用的Linux命令集锦" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>由于采用了Web开发框架来开发项目，所以我首次在真正的项目中采用MVC的开发模式。随着项目的不断深入，我也在不断反思，MVC设计模式到底给项目带来了什么？成倍的开发时间？复杂无比的目录结构？铺天盖地的文件数量？听起来都很难听对吗，但是确实如此。那么MVC所许诺的那些好处呢？清晰的代码结构，易于维护，易于扩展？真有吗？<span id="more-412"></span></p>
<p>当然，我不是在批判MVC，只是觉得，在使用MVC过程中，还是需要投入更深入的思考，到底怎样才能用好这个设计模式。MVC给我的感觉是，要求使用其的开发者有更高的觉悟，来正确选择存放一段代码的地方。从而实现解耦合，代码复用，和易于维护。为什么说使用MVC会有成倍的开发时间，主要就是因为在开发中，我们需要更多的时间去思考，这些代码放在哪里更合理一些。在MVC框架下代码被切割成一个又一个的小文件，分散在复杂的目录树中，那么到底怎样选择把代码写在哪里呢？这道选择题，并非有看起来那么容易。就我个人感受而言，更多的时候，无论将代码放在哪里都可以正确实现你的逻辑，MVC不是什么神兵利器，并不能通过其模式本身的约束，将开发者导入到一个正确的轨道上，反而会因为开发者本身错误的选择而让MVC自己变得一团糟。所以说，当一个团队确定要在一个项目中引入MVC时候，应该思考一下，每个团队成员是不是真的都有能力驾驭，如果没有对应的能力话，是不是要考虑前期对项目成员进行一定的培训。</p>
<p>可能我说得话很装逼，但是我绝对不敢以一个专家的身份站到这里来说话，我只是一个初学者，我要把我的学习感受说出来。现在回归到MVC上，Controller给我的印象是一个协调者的形象，它知道谁能干什么，然后分配任务，构造哪个对象，初始化哪个视图，是Controller应该决定的事情。Model呢，应该是一个实干家的形象，负责所有肮脏而又细致的事情，所以我在编码实践中，将所有的业务逻辑都塞进Model里面，对Controller，提供一个简单接口，对Views，输出纯数据。View则是一个消费者的形象，给其的数据都是纯粹的，直接显示即可以。以上是我对MVC这道选择题给出的一个答案，当然我不是很确定这样做很对。</p>
<p>我在项目中就看到过这样的代码，将Model做成了一个工具箱，实际上是一个有各种方法的对象，每个方法看起来也提供了简单的调用接口，实际跟Controller配合时候呢，由Controller来操纵功能，安排各个方法被调用的顺序。这等于是由Controller来执行业务逻辑，但是却又对其封装了每个步骤的细节。而我个人倾向于连业务逻辑也对Controller封装。这两种选择各有优劣，而实际上从短期也难看出来谁更胜一筹。甚至，等项目上线后，最终也没法发现哪个做法更优一点。</p>
<p>所以说，MVC真的就是一个选择题。你有多重选择来实现同一个目的。我列举的例子只是九牛一毛，在实际项目开发中，还面临着更多的选择问题。我想，到底怎样交出自己的答案，还是应该在实践过程中不断积累，不断优化。我们只要把握好一些原则，就可以让自己不要偏离航向太远。第一，可维护性，代码逻辑一目了然应该是写代码时候的第一追求，因为看别人的代码是非常痛苦的，甚至最后回头来看自己写过的代码可能都会很痛苦，保持代码一目了然才是最重要的，给别人，给自己节省下时间。第二，可复用性，写内聚度高的代码，减少依赖，判定很简单，我写的这个代码，拷贝到别的项目里，是不是直接就能用，时刻问自己这个问题，就能保持代码的高内聚度。第三，封装变化，这个原则总体来说很难把握住，我自己的体会就是尽可能提供一个强大的接口，如果XXX改变了，那么调用我写的函数是不是格式不变？如果你写的函数，一会儿增加个参数，一会减少个参数，那么所有调用的地方都会跟着变化修改。</p>
<p>就到此为止了，一些愚见，请大家指正。</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="MVC最佳实践" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmvc-best-practice.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">MVC最佳实践</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="ExtJS 4 的MVC" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fextjs-4-mvc.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">ExtJS 4 的MVC</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="Yii框架的Log系统的分析" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-use-log-in-yii-framework.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/05/22/9184865.jpg" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Yii框架的Log系统的分析</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="给SVN客户端配置代理服务器" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fuse-proxy-in-ur-svn-client.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/13/12123060.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">给SVN客户端配置代理服务器</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="工作中常用的Linux命令集锦" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fmvc-chose-where-to-put-your-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/design-pattern" title="design pattern" rel="tag">design pattern</a>, <a href="http://sexywp.com/tags/mvc" title="MVC" rel="tag">MVC</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/mvc-chose-where-to-put-your-code.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>逝者如斯夫，不舍昼夜</title>
		<link>http://sexywp.com/time-gone-away.htm</link>
		<comments>http://sexywp.com/time-gone-away.htm#comments</comments>
		<pubDate>Fri, 24 Dec 2010 16:11:56 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[日　　记]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=411</guid>
		<description><![CDATA[这么zhuangbility的标题，其实内容没啥新意的。主要是感慨一下，工作了以后，真的时间如梭。更可怕的是，我觉得我的生活也要被工作吞噬了，即便是这样，仍旧很难看到什么希望。或许呢，我真的太过悲观了也说不定。

好吧，在一个技术博客上，本不该发这些无谓的感慨的。这些年维护博客走过来，互联网上各种新鲜的东西如过眼云烟，微博啦，社区啦，LBS啦等等等等，但是渐渐发觉，真正能够沉淀价值的东西，仍旧只有博客。当然也或许，这是我作为一个书生的癖好或者偏见而已。

无论多么艰难，多么没有时间，我还是决定要在这块自留地上好好种点东西。就一个好，都是自己的。

<span class="readmore"><a href="http://sexywp.com/time-gone-away.htm" title="逝者如斯夫，不舍昼夜">Keep Reading --- 426 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Mac OS X Lion 终端快捷键" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm&from=http%3A%2F%2Fsexywp.com%2Ftime-gone-away.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Mac OS X Lion 终端快捷键</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="升级到WordPress2.7版本~~" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fupdate-to-wp27.htm&from=http%3A%2F%2Fsexywp.com%2Ftime-gone-away.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/08/30/26374211.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">升级到WordPress2.7版本~~</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="汽车画报网Autobild.com.cn" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fsomething-about-auto-bild.htm&from=http%3A%2F%2Fsexywp.com%2Ftime-gone-away.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/14/12174619.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">汽车画报网Autobild.com.cn</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="大连印象（2）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fdalian-02.htm&from=http%3A%2F%2Fsexywp.com%2Ftime-gone-away.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">大连印象（2）</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="告诸位朋友" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fabout-the-tragedy.htm&from=http%3A%2F%2Fsexywp.com%2Ftime-gone-away.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">告诸位朋友</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>这么zhuangbility的标题，其实内容没啥新意的。主要是感慨一下，工作了以后，真的时间如梭。更可怕的是，我觉得我的生活也要被工作吞噬了，即便是这样，仍旧很难看到什么希望。或许呢，我真的太过悲观了也说不定。</p>
<p>好吧，在一个技术博客上，本不该发这些无谓的感慨的。这些年维护博客走过来，互联网上各种新鲜的东西如过眼云烟，微博啦，社区啦，LBS啦等等等等，但是渐渐发觉，真正能够沉淀价值的东西，仍旧只有博客。当然也或许，这是我作为一个书生的癖好或者偏见而已。</p>
<p>无论多么艰难，多么没有时间，我还是决定要在这块自留地上好好种点东西。就一个好，都是自己的。</p>
<p>未来的计划，经常抽点时间出来，更新我以前写的插件，想当初我有无数的插件点子，现如今看来，都没有机会去实践了。我现在只有一个愿望，就是把以前写的东西，都重新写一遍。然后把自己新掌握的知识和本领转化成价值带给大家，也同时为自己沉淀下来。或许这个过程会很长很长，但是只要坚持做事，就会让事情有所进展。</p>
<p>我觉得，大家可以对我有所期许。嘿嘿，谢谢！</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="Mac OS X Lion 终端快捷键" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm&from=http%3A%2F%2Fsexywp.com%2Ftime-gone-away.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">Mac OS X Lion 终端快捷键</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="升级到WordPress2.7版本~~" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fupdate-to-wp27.htm&from=http%3A%2F%2Fsexywp.com%2Ftime-gone-away.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/08/30/26374211.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">升级到WordPress2.7版本~~</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="汽车画报网Autobild.com.cn" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fsomething-about-auto-bild.htm&from=http%3A%2F%2Fsexywp.com%2Ftime-gone-away.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/14/12174619.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">汽车画报网Autobild.com.cn</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="大连印象（2）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fdalian-02.htm&from=http%3A%2F%2Fsexywp.com%2Ftime-gone-away.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">大连印象（2）</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="告诸位朋友" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fabout-the-tragedy.htm&from=http%3A%2F%2Fsexywp.com%2Ftime-gone-away.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">告诸位朋友</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>该日志未加标签。]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/time-gone-away.htm/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>[WordPress Tips] 教你3行代码隐藏Admin Bar</title>
		<link>http://sexywp.com/hide-admin-bar-use-3-line-code.htm</link>
		<comments>http://sexywp.com/hide-admin-bar-use-3-line-code.htm#comments</comments>
		<pubDate>Sun, 28 Nov 2010 07:35:05 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=409</guid>
		<description><![CDATA[从WordPress 3.1开始起，增加了一个新的组件，就是Admin Bar（管理工具条）。如果你登录了自己的博客，在首页上就会看到顶部出现了一个黑色的工具条。里面有一些常用的功能。可以直达后台。虽然说，这是一个很方便的功能，但是我想，并非每个人都会喜欢这样的东西。我就很不喜欢。研究了一下源代码，发现这个功能并不能通过在wp-config.php中使用常量定义禁用。必须使用类似插件的功能才能禁用该功能。不过呢，就像本文标题说的那样，使用插件未免太不值当了，毕竟为了3行代码，写个插件，还是很不划算的。估计等3.1发布后，会有某个同学将这个小功能整合到自己的插件中的。如果等不急或者不希望装太多插件的同学，我这里提供一个轻松挪掉Admin Bar的方法。如下的三行代码，请加入到你使用中的主题的functions.php文件中，如果没有这个文件，那么请自己创建：

<span class="readmore"><a href="http://sexywp.com/hide-admin-bar-use-3-line-code.htm" title="[WordPress Tips] 教你3行代码隐藏Admin Bar">Keep Reading --- 336 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="[新闻]WordPress新特性预览—主题自动安装（多图）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwordpress-new-features-theme-install.htm&from=http%3A%2F%2Fsexywp.com%2Fhide-admin-bar-use-3-line-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/02/10687411.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[新闻]WordPress新特性预览—主题自动安装（多图）</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="免费WordPress主题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Ffree-wordpress-themes.htm&from=http%3A%2F%2Fsexywp.com%2Fhide-admin-bar-use-3-line-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/02/10603183.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">免费WordPress主题</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress到底在整啥？—(05)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Finside-wordpress-05.htm&from=http%3A%2F%2Fsexywp.com%2Fhide-admin-bar-use-3-line-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress到底在整啥？—(05)</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="本地运行WordPress时发生超时错误" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwordpress-timeout-error.htm&from=http%3A%2F%2Fsexywp.com%2Fhide-admin-bar-use-3-line-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">本地运行WordPress时发生超时错误</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="给WordPress增加苹果中的Dock菜单效果" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fadd-dock-menu-to-ur-wordpress.htm&from=http%3A%2F%2Fsexywp.com%2Fhide-admin-bar-use-3-line-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">给WordPress增加苹果中的Dock菜单效果</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>从WordPress 3.1开始起，增加了一个新的组件，就是Admin Bar（管理工具条）。如果你登录了自己的博客，在首页上就会看到顶部出现了一个黑色的工具条。里面有一些常用的功能。可以直达后台。虽然说，这是一个很方便的功能，但是我想，并非每个人都会喜欢这样的东西。我就很不喜欢。研究了一下源代码，发现这个功能并不能通过在wp-config.php中使用常量定义禁用。必须使用类似插件的功能才能禁用该功能。不过呢，就像本文标题说的那样，使用插件未免太不值当了，毕竟为了3行代码，写个插件，还是很不划算的。估计等3.1发布后，会有某个同学将这个小功能整合到自己的插件中的。如果等不急或者不希望装太多插件的同学，我这里提供一个轻松挪掉Admin Bar的方法。如下的三行代码，请加入到你使用中的主题的functions.php文件中，如果没有这个文件，那么请自己创建：</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Gray;">&nbsp;</span><span style="color: Green;">function</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">gc_hide_admin_bar</span><span style="color: Olive;">(</span><span style="color: #00008b;">$flag</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Green;">return</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">false</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">add_filter</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">show_admin_bar</span><span style="color: #8b0000;">'</span><span style="color: Gray;">, </span><span style="color: #8b0000;">'</span><span style="color: Red;">gc_hide_admin_bar</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">?&gt;</span></li></ol></div></div>
<p>OK, well done!</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="[新闻]WordPress新特性预览—主题自动安装（多图）" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwordpress-new-features-theme-install.htm&from=http%3A%2F%2Fsexywp.com%2Fhide-admin-bar-use-3-line-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/02/10687411.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">[新闻]WordPress新特性预览—主题自动安装（多图）</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="免费WordPress主题" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Ffree-wordpress-themes.htm&from=http%3A%2F%2Fsexywp.com%2Fhide-admin-bar-use-3-line-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/site_images/2011/06/02/10603183.png" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">免费WordPress主题</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="WordPress到底在整啥？—(05)" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Finside-wordpress-05.htm&from=http%3A%2F%2Fsexywp.com%2Fhide-admin-bar-use-3-line-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">WordPress到底在整啥？—(05)</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="本地运行WordPress时发生超时错误" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fwordpress-timeout-error.htm&from=http%3A%2F%2Fsexywp.com%2Fhide-admin-bar-use-3-line-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">本地运行WordPress时发生超时错误</font>
                    </a>
                </td>
                <td width="86" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="给WordPress增加苹果中的Dock菜单效果" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fadd-dock-menu-to-ur-wordpress.htm&from=http%3A%2F%2Fsexywp.com%2Fhide-admin-bar-use-3-line-code.htm">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 80px !important; height: 80px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="80px" height="80px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 86px !important; font: 12px/15px arial !important; height: 45px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">给WordPress增加苹果中的Dock菜单效果</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/tips" title="tips" rel="tag">tips</a>, <a href="http://sexywp.com/tags/wordpress" title="WordPress" rel="tag">WordPress</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/hide-admin-bar-use-3-line-code.htm/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>[Tips] PHP中return的用法</title>
		<link>http://sexywp.com/php-return.htm</link>
		<comments>http://sexywp.com/php-return.htm#comments</comments>
		<pubDate>Sat, 27 Nov 2010 03:20:20 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=407</guid>
		<description><![CDATA[这两天，Charles研究Yii框架的使用，注意到Yii的配置文件，采用一种写法。如下：

&#160;&#160;/**

&#160; * 注释若干

<span class="readmore"><a href="http://sexywp.com/php-return.htm" title="[Tips] PHP中return的用法">Keep Reading --- 238 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fphp-return.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhide-admin-bar-use-3-line-code.htm&from=http%3A%2F%2Fsexywp.com%2Fphp-return.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[WordPress Tips] 教你3行代码隐藏Admin Bar</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fdeprecated-features-in-php-5-3.htm&from=http%3A%2F%2Fsexywp.com%2Fphp-return.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 5.3.x中弃用的特性 Deprecated</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2Fphp-return.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Fphp-return.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>这两天，Charles研究Yii框架的使用，注意到Yii的配置文件，采用一种写法。如下：</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Gray;">&nbsp;</span><span style="color: #ffa500;">/*</span><span style="color: #ffa500;">*</span></li>
<li><span style="color: #ffa500;">&nbsp; * 注释若干</span></li>
<li><span style="color: #ffa500;">&nbsp; * 以下是一个格式如config.php的文件</span></li>
<li><span style="color: #ffa500;">&nbsp; </span><span style="color: #ffa500;">*/</span></li>
<li><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Green;">return</span><span style="color: Gray;">&nbsp;</span><span style="color: Green;">array</span><span style="color: Olive;">(</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #8b0000;">'</span><span style="color: Red;">config1</span><span style="color: #8b0000;">'</span><span style="color: Gray;"> =&gt; </span><span style="color: #8b0000;">'</span><span style="color: Red;">some value</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #8b0000;">'</span><span style="color: Red;">config2</span><span style="color: #8b0000;">'</span><span style="color: Gray;"> =&gt; </span><span style="color: #8b0000;">'</span><span style="color: Red;">some value</span><span style="color: #8b0000;">'</span><span style="color: Gray;">,</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">?&gt;</span></li></ol></div></div>
<p>在这个文件中，直接就写了一个return，这个用法又一次突破了我的常识。特意查询了一下文档，里面这样描述的：</p>
<blockquote><p>
<strong>return</strong></p>
<p>If called from within a function, the return() statement immediately ends execution of the current function, and returns its argument as the value of the function call. return() will also end the execution of an eval() statement or script file.</p>
<p>If called from the global scope, then execution of the current script file is ended. If the current script file was include()ed or require()ed, then control is passed back to the calling file. Furthermore, if the current script file was include()ed, then the value given to return() will be returned as the value of the include() call. If return() is called from within the main script file, then script execution ends. If the current script file was named by the auto_prepend_file or auto_append_file <a href="http://sexywp.com/tags/configuration" class="st_tag internal_tag" rel="tag" title="标签 configuration 下的日志">configuration</a> options in <a href="http://sexywp.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 PHP 下的日志">php</a>.ini, then that script file's execution is ended.
</p></blockquote>
<p>return语句可以终止函数执行那自不必说了，这里还提到了可以终止eval过程的进行，并且如果处于被include的文件中，还能使return的值成为include和require函数的返回值。这样写的好处是，一个语句就可以得到配置项的内容了。</p>
<div class="hl-surround"><div class="hl-main"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li>&nbsp;<span style="color: Gray;">&nbsp;</span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">原来这样写</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Green;">require</span><span style="color: Gray;">&nbsp;</span><span style="color: #8b0000;">'</span><span style="color: Red;">./config.php</span><span style="color: #8b0000;">'</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Green;">function</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">test</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Green;">global</span><span style="color: Gray;">&nbsp;</span><span style="color: #00008b;">$config</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">(</span><span style="color: #00008b;">$config</span><span style="color: Olive;">[</span><span style="color: #8b0000;">'</span><span style="color: Red;">a</span><span style="color: #8b0000;">'</span><span style="color: Olive;">]</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">b</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Green;">echo</span><span style="color: Gray;"> </span><span style="color: #8b0000;">'</span><span style="color: Red;">hello</span><span style="color: #8b0000;">'</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp; </span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: #ffa500;">//</span><span style="color: #ffa500;">现在</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Green;">function</span><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">test</span><span style="color: Olive;">(</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Olive;">{</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: #00008b;">$config</span><span style="color: Gray;"> = </span><span style="color: Green;">require</span><span style="color: Olive;">(</span><span style="color: #8b0000;">'</span><span style="color: Red;">./config.php</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;&nbsp; &nbsp; </span><span style="color: Green;">if</span><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">(</span><span style="color: #00008b;">$config</span><span style="color: Olive;">[</span><span style="color: #8b0000;">'</span><span style="color: Red;">a</span><span style="color: #8b0000;">'</span><span style="color: Olive;">]</span><span style="color: Gray;">==</span><span style="color: #8b0000;">'</span><span style="color: Red;">b</span><span style="color: #8b0000;">'</span><span style="color: Olive;">)</span><span style="color: Gray;"> </span><span style="color: Green;">echo</span><span style="color: Gray;"> </span><span style="color: #8b0000;">'</span><span style="color: Red;">hello</span><span style="color: #8b0000;">'</span><span style="color: Gray;">;</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Olive;">}</span></li>
<li><span style="color: Gray;">&nbsp;</span><span style="color: Blue;">?&gt;</span></li></ol></div></div>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fphp-return.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhide-admin-bar-use-3-line-code.htm&from=http%3A%2F%2Fsexywp.com%2Fphp-return.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[WordPress Tips] 教你3行代码隐藏Admin Bar</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fdeprecated-features-in-php-5-3.htm&from=http%3A%2F%2Fsexywp.com%2Fphp-return.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 5.3.x中弃用的特性 Deprecated</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2Fphp-return.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Fphp-return.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/php" title="PHP" rel="tag">PHP</a>, <a href="http://sexywp.com/tags/tips" title="tips" rel="tag">tips</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/php-return.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>使Mac OS X的终端看起来更舒服</title>
		<link>http://sexywp.com/custom-mac-os-x-terminal.htm</link>
		<comments>http://sexywp.com/custom-mac-os-x-terminal.htm#comments</comments>
		<pubDate>Sun, 14 Nov 2010 04:55:49 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[DIY]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=405</guid>
		<description><![CDATA[初次打开Mac OS X的终端，我非常不习惯。以界面优美著称的苹果操作系统，终端竟然如此丑陋，实在是大出我的意料之外。别的我也就不说了，最不能容忍的是两个，一个是没有颜色的ls，还有一个就是那个命令提示符。

实际上，Mac OS X作为一个类Unix系统，或者说根本就是一个Unix系统，而且默认shell已经变更成了bash，那么它理应该可以配置到跟Linux下的表现一样才对。在Linux系统中，ls能呈现多彩的颜色，还需要终端的支持，而Mac OS里的终端显然是支持颜色的，那为什么ls就显示不出来颜色呢？网上有老外说，ls用的不是gnu的core-utils，给了一套更换core-utils的方案，太麻烦我没采纳。今天，静心看了下man，才发现，感情人家根本就是支持彩色的。只是参数变成了-G，而不是我们熟悉的--colors，唉，竟然这么简单。

<span class="readmore"><a href="http://sexywp.com/custom-mac-os-x-terminal.htm" title="使Mac OS X的终端看起来更舒服">Keep Reading --- 408 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X Lion 终端快捷键</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac上的WordPress客户端MarsEdit</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fphp-return.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips] PHP中return的用法</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>初次打开Mac OS X的终端，我非常不习惯。以界面优美著称的苹果操作系统，终端竟然如此丑陋，实在是大出我的意料之外。别的我也就不说了，最不能容忍的是两个，一个是没有颜色的ls，还有一个就是那个命令提示符。</p>
<p>实际上，<a href="http://sexywp.com/tags/mac" class="st_tag internal_tag" rel="tag" title="标签 mac 下的日志">Mac</a> OS X作为一个类Unix系统，或者说根本就是一个Unix系统，而且默认shell已经变更成了bash，那么它理应该可以配置到跟Linux下的表现一样才对。在Linux系统中，ls能呈现多彩的颜色，还需要终端的支持，而Mac OS里的终端显然是支持颜色的，那为什么ls就显示不出来颜色呢？网上有老外说，ls用的不是gnu的core-utils，给了一套更换core-utils的方案，太麻烦我没采纳。今天，静心看了下man，才发现，感情人家根本就是支持彩色的。只是参数变成了-G，而不是我们熟悉的--colors，唉，竟然这么简单。</p>
<p>另外提一点，如果大家想要自定义Mac下的bash的表现的话，那么不要像在Linux中一样使用.bashrc，因为在Mac下起作用的其实是.bash_profile文件。好了，这里把我配置上面说的两个特性的.bash_profile分享一下。</p>
<p><code><br />
export PS1="\u@mac:\w > "<br />
export CLICOLOR="xterm-<a href="http://sexywp.com/tags/color" class="st_tag internal_tag" rel="tag" title="标签 color 下的日志">color</a>"<br />
export LSCOLORS="gxfxcxdxbxegedabagacad"</p>
<p># aliases<br />
alias cd..="cd .."<br />
alias l="ls"<br />
alias ll="ls -l"<br />
alias la="ls -al"<br />
alias mysql='/usr/local/mysql/bin/mysql'<br />
alias mysqladmin='/usr/local/mysql/bin/mysqladmin'<br />
</code></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-lion-terminal-shortcut.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X Lion 终端快捷键</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fword2007-doesnot-show-pics.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips]Word2007中看不到图片</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac%25E4%25B8%258A%25E7%259A%2584wordpress%25E5%25AE%25A2%25E6%2588%25B7%25E7%25AB%25AFmarsedit.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac上的WordPress客户端MarsEdit</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fphp-return.htm&from=http%3A%2F%2Fsexywp.com%2Fcustom-mac-os-x-terminal.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">[Tips] PHP中return的用法</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
	标签：<a href="http://sexywp.com/tags/diy" title="DIY" rel="tag">DIY</a>, <a href="http://sexywp.com/tags/guide" title="guide" rel="tag">guide</a>, <a href="http://sexywp.com/tags/mac" title="mac" rel="tag">mac</a>, <a href="http://sexywp.com/tags/tips" title="tips" rel="tag">tips</a><br />
]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/custom-mac-os-x-terminal.htm/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Dedian 5的PHP包缺少readline支持</title>
		<link>http://sexywp.com/let-php5-support-readline.htm</link>
		<comments>http://sexywp.com/let-php5-support-readline.htm#comments</comments>
		<pubDate>Fri, 12 Nov 2010 06:33:40 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[工作相关]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=404</guid>
		<description><![CDATA[命令行下，PHP有一个很有趣的功能，就是interactive mode，在这种模式下，用户可以使用php shell，很自如的运行各种php函数。只要在shell下执行php -a命令即可。但是这个模式需要readline支持。

在Debian 5下，通过官方源使用apt安装的php5，不支持readline，所以，就无法使用interactive mode了。搜索了下，找到了解决办法。参见：http://www.dotdeb.org/instructions/ 这可能是一个组织，专门支持在Debian下搭建Web服务系统。

<span class="readmore"><a href="http://sexywp.com/let-php5-support-readline.htm" title="Dedian 5的PHP包缺少readline支持">Keep Reading --- 212 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fdeprecated-features-in-php-5-3.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 5.3.x中弃用的特性 Deprecated</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">如何在Debian上安装PHPUnit</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>命令行下，PHP有一个很有趣的功能，就是interactive mode，在这种模式下，用户可以使用php shell，很自如的运行各种php函数。只要在shell下执行php -a命令即可。但是这个模式需要readline支持。</p>
<p>在Debian 5下，通过官方源使用apt安装的php5，不支持readline，所以，就无法使用interactive mode了。搜索了下，找到了解决办法。参见：http://www.dotdeb.org/instructions/ 这可能是一个组织，专门支持在Debian下搭建Web服务系统。</p>
<p>首先打开source.list，添加两个源：</p>
<p>deb http://packages.dotdeb.org stable all<br />
deb-src http://packages.dotdeb.org stable all</p>
<p>然后update，然后safe-upgrade，会发现跟web server相关的软件包都升级了，包括apache， <a href="http://sexywp.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 PHP 下的日志">php</a>，mysql等。升级完成后，再尝试php -a，哈哈，<a href="http://sexywp.com/tags/php" class="st_tag internal_tag" rel="tag" title="标签 PHP 下的日志">php</a> shell出来了！！</p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fdeprecated-features-in-php-5-3.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 5.3.x中弃用的特性 Deprecated</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">如何在Debian上安装PHPUnit</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>该日志未加标签。]]></content:encoded>
			<wfw:commentRss>http://sexywp.com/let-php5-support-readline.htm/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>如何在Debian上安装PHPUnit</title>
		<link>http://sexywp.com/how-to-install-phpunit-on-debian.htm</link>
		<comments>http://sexywp.com/how-to-install-phpunit-on-debian.htm#comments</comments>
		<pubDate>Wed, 10 Nov 2010 09:55:28 +0000</pubDate>
		<dc:creator>Charles</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[工作相关]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[phpunit]]></category>

		<guid isPermaLink="false">http://sexywp.com/?p=403</guid>
		<description><![CDATA[Debian上安装PHPUnit最方便的做法，就是使用apt-get或者aptitude，当然，如果你想安装最新版本的PHPUnit，那又另当别论了。

安装最新版本的PHPUnit，我推荐使用pear来安装，不过前提是首先要安装最新版本的pear，Debian源里的pear，版本低于1.8.1，不能安装最新版的PHPUnit。

好，下面的代码用来安装pear，然后是PHPUnit：

<span class="readmore"><a href="http://sexywp.com/how-to-install-phpunit-on-debian.htm" title="如何在Debian上安装PHPUnit">Keep Reading --- 206 words totally</a></span><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flet-php5-support-readline.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Dedian 5的PHP包缺少readline支持</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fdeprecated-features-in-php-5-3.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">PHP 5.3.x中弃用的特性 Deprecated</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fmac-os-x-ssh-key-pair-login-linux.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Mac OS X上如何实现到Linux主机的ssh免登陆</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Flinux-commands-used-when-working.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">工作中常用的Linux命令集锦</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect?url=http%3A%2F%2Fsexywp.com%2Fphp5-pass-param-by-ref.htm&from=http%3A%2F%2Fsexywp.com%2Fhow-to-install-phpunit-on-debian.htm">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">【边学边用】PHP5函数参数的按引用传递</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>Debian上安装PHPUni
