<?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/"
	>

<channel>
	<title>一个程序猿 &#187; 原创技术</title>
	<atom:link href="http://www.sunboyu.cn/category/original/feed" rel="self" type="application/rss+xml" />
	<link>http://www.sunboyu.cn</link>
	<description>时光不会倒流,脚步总要前进</description>
	<pubDate>Tue, 31 Jan 2012 10:50:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tokyo Cabinet table表的jsp接口</title>
		<link>http://www.sunboyu.cn/2011/08/16/tokyo-cabinet-table%e8%a1%a8%e7%9a%84jsp%e6%8e%a5%e5%8f%a3.shtml</link>
		<comments>http://www.sunboyu.cn/2011/08/16/tokyo-cabinet-table%e8%a1%a8%e7%9a%84jsp%e6%8e%a5%e5%8f%a3.shtml#comments</comments>
		<pubDate>Tue, 16 Aug 2011 06:50:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[table表]]></category>

		<category><![CDATA[Tokyo Cabinet]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1436</guid>
		<description><![CDATA[终于完成了Tokyo Cabinet的jsp接口，在tomcat下性能不是那么出众，看来性能还是得用c。
部署方法看上一偏配置说明。
代码 api.tar.gz
信息插入与修改：
$data['database'] = &#34;sunboyudata2&#34;;
$jsondata = array();
while($row = mysql_fetch_array($query,MYSQL_ASSOC)){
	$jsondata[] = $row;
}
$data['jsondata'] = json_encode($jsondata);
$url= http_build_query($data ); 
$postdate = array ( 
	'http' =&#62; array ( 
		'method' =&#62; 'POST', 
		'header'=&#62; &#34;Content-type: application/x-www-form-urlencoded\r\n&#34; . 
		&#34;Content-Length: &#34; . strlen($url) . &#34;\r\n&#34;, 
		'content' =&#62; $url
	), 
);
$postcontent = stream_context_create($postdate); 
$return= file_get_contents('http://192.168.138.29:8080/api.jsp', false, $postcontent );
查询：
http://192.168.138.29:8080/search.jsp?database=sunboyudata2&#038;query=fid:QCNUMEQ:1604&#038;skip=20000&#038;max=10
database:数据库文件名[无扩展名]
query:查询条件 每组查询条件三个部分 字段:规则:值  每组之间用&#124;分割
skip:记录起始
max:返回的记录条数
缺点：在频繁大数据量提交的时候，tomcat总是影响失败。性能没有预期那么好，tc需要优化。
]]></description>
			<content:encoded><![CDATA[<p>终于完成了Tokyo Cabinet的jsp接口，在tomcat下性能不是那么出众，看来性能还是得用c。</p>
<p>部署方法看上一偏配置说明。</p>
<p>代码 <a href='http://www.sunboyu.cn/upfiles/2011/08/apitar.gz'>api.tar.gz</a></p>
<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">$data['database'] = &quot;sunboyudata2&quot;;</li>
<li>$jsondata = array();</li>
<li>while($row = mysql_fetch_array($query,MYSQL_ASSOC)){</li>
<li>	$jsondata[] = $row;</li>
<li>}</li>
<li>$data['jsondata'] = json_encode($jsondata);</li>
<li>$url= http_build_query($data ); </li>
<li>$postdate = array ( </li>
<li>	'http' =&gt; array ( </li>
<li>		'method' =&gt; 'POST', </li>
<li>		'header'=&gt; &quot;Content-type: application/x-www-form-urlencoded\r\n&quot; . </li>
<li>		&quot;Content-Length: &quot; . strlen($url) . &quot;\r\n&quot;, </li>
<li>		'content' =&gt; $url</li>
<li>	), </li>
<li>);</li>
<li>$postcontent = stream_context_create($postdate); </li>
<li>$return= file_get_contents('http://192.168.138.29:8080/api.jsp', false, $postcontent );</li></ol></div>
<p>查询：</p>
<p>http://192.168.138.29:8080/search.jsp?database=sunboyudata2&#038;query=fid:QCNUMEQ:1604&#038;skip=20000&#038;max=10</p>
<p>database:数据库文件名[无扩展名]<br />
query:查询条件 每组查询条件三个部分 字段:规则:值  每组之间用|分割<br />
skip:记录起始<br />
max:返回的记录条数</p>
<p>缺点：在频繁大数据量提交的时候，tomcat总是影响失败。性能没有预期那么好，tc需要优化。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/08/16/tokyo-cabinet-table%e8%a1%a8%e7%9a%84jsp%e6%8e%a5%e5%8f%a3.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>linux下tokyocabinet存储引擎java接口的配置</title>
		<link>http://www.sunboyu.cn/2011/08/12/linux%e4%b8%8btokyocabinet%e5%ad%98%e5%82%a8%e5%bc%95%e6%93%8ejava%e6%8e%a5%e5%8f%a3%e7%9a%84%e9%85%8d%e7%bd%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2011/08/12/linux%e4%b8%8btokyocabinet%e5%ad%98%e5%82%a8%e5%bc%95%e6%93%8ejava%e6%8e%a5%e5%8f%a3%e7%9a%84%e9%85%8d%e7%bd%ae.shtml#comments</comments>
		<pubDate>Fri, 12 Aug 2011 07:01:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[api]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[tokyocabinet]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1432</guid>
		<description><![CDATA[tokyocabinet是一个性能极高的存储引擎，除支持传统的keyvalue存储外，还支持table表的存储，具体可以看这里 http://fallabs.com/tokyocabinet/spex-en.html#tctdbapi
使用tc常用的工具就是作者另外写的一个api：tt http://fallabs.com/tokyotyrant/  兼容memcached协议，非常好用和高效。
但这里我期望使用的是table表，它提供了C的接口，但没有php方便调用的的方式，所以张宴同学做了一个很方便的tcsql  http://blog.s135.com/tcsql/
因为我C的水平问题，一直没有写出稳定的操作接口，并且张宴同学tcsql的设计理念非常好，支持分布式的结构。
因此我改变了设计思路，并且使用我想对熟悉的java接口来做这个事情。
linux下配置过程：
环境装备：标准JDK环境
1、下载java api http://fallabs.com/tokyocabinet/javapkg/
2、解压后进入 tokyocabinet-java-1.24 目录
3、运行 ./configure &#8211;prefix=/opt/tcjava  &#038;&#038; make &#038;&#038; make install
4、环境变量配置：
这里是包含JDK的全部配置

export JAVA_HOME=/opt/jdk
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:/opt/tcjava/lib/tokyocabinet.jar:/opt/tcjava/lib/libjtokyocabinet.so:/opt/tcjava/lib/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/tcjava/lib/
export PATH=$PATH:$JAVA_HOME/bin
export JRE_HOME=$JAVA_HOME/jrei
JAVA_OPTS="-server"
JAVA_OPTS="$JAVA_OPTS -Xms64m -Xmx128m"
JAVA_OPTS="$JAVA_OPTS -D64 -Djava.library.path=/usr/local/lib/"

把以上代码增加到 /etc/profile 文件尾部，而后 source /etc/profile
配置完成，开始测试：
进入 tokyocabinet-java-1.24/example  执行 make
然后运行  java TCTDBEX  如果看到跟代码中预期的结果，则tc的javaapi在此服务器上安装成功。
]]></description>
			<content:encoded><![CDATA[<p>tokyocabinet是一个性能极高的存储引擎，除支持传统的keyvalue存储外，还支持table表的存储，具体可以看这里 http://fallabs.com/tokyocabinet/spex-en.html#tctdbapi</p>
<p>使用tc常用的工具就是作者另外写的一个api：tt http://fallabs.com/tokyotyrant/  兼容memcached协议，非常好用和高效。</p>
<p>但这里我期望使用的是table表，它提供了C的接口，但没有php方便调用的的方式，所以张宴同学做了一个很方便的tcsql  http://blog.s135.com/tcsql/</p>
<p>因为我C的水平问题，一直没有写出稳定的操作接口，并且张宴同学tcsql的设计理念非常好，支持分布式的结构。</p>
<p>因此我改变了设计思路，并且使用我想对熟悉的java接口来做这个事情。</p>
<p>linux下配置过程：</p>
<p>环境装备：标准JDK环境</p>
<p>1、下载java api http://fallabs.com/tokyocabinet/javapkg/</p>
<p>2、解压后进入 tokyocabinet-java-1.24 目录</p>
<p>3、运行 ./configure &#8211;prefix=/opt/tcjava  &#038;&#038; make &#038;&#038; make install</p>
<p>4、环境变量配置：<br />
这里是包含JDK的全部配置<br />
<code><br />
export JAVA_HOME=/opt/jdk<br />
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:/opt/tcjava/lib/tokyocabinet.jar:/opt/tcjava/lib/libjtokyocabinet.so:/opt/tcjava/lib/<br />
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/tcjava/lib/<br />
export PATH=$PATH:$JAVA_HOME/bin<br />
export JRE_HOME=$JAVA_HOME/jrei<br />
JAVA_OPTS="-server"<br />
JAVA_OPTS="$JAVA_OPTS -Xms64m -Xmx128m"<br />
JAVA_OPTS="$JAVA_OPTS -D64 -Djava.library.path=/usr/local/lib/"<br />
</code><br />
把以上代码增加到 /etc/profile 文件尾部，而后 source /etc/profile</p>
<p>配置完成，开始测试：</p>
<p>进入 tokyocabinet-java-1.24/example  执行 make</p>
<p>然后运行  java TCTDBEX  如果看到跟代码中预期的结果，则tc的javaapi在此服务器上安装成功。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/08/12/linux%e4%b8%8btokyocabinet%e5%ad%98%e5%82%a8%e5%bc%95%e6%93%8ejava%e6%8e%a5%e5%8f%a3%e7%9a%84%e9%85%8d%e7%bd%ae.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>使用PHP来生成二维码</title>
		<link>http://www.sunboyu.cn/2011/08/11/%e4%bd%bf%e7%94%a8php%e6%9d%a5%e7%94%9f%e6%88%90%e4%ba%8c%e7%bb%b4%e7%a0%81.shtml</link>
		<comments>http://www.sunboyu.cn/2011/08/11/%e4%bd%bf%e7%94%a8php%e6%9d%a5%e7%94%9f%e6%88%90%e4%ba%8c%e7%bb%b4%e7%a0%81.shtml#comments</comments>
		<pubDate>Thu, 11 Aug 2011 13:55:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[二维码]]></category>

		<category><![CDATA[手机]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1430</guid>
		<description><![CDATA[二维码是什么？
看这里：百度百科：二维码
二维码我用的最多的就是利用android手机的二维码扫描功能扫描网址，当然这种方法还大量应用在货物标签，比如我们去超市结账的条码扫描。
二维码利用近距离的光线进行数据传输，打破了网络数据线的依赖，可以说是一种打破常规的非常方便的应用。尤其在各种设备并不那么兼容的情况下，用二维码交换少量信息是非常便利的。
二维码的算法是通用的，二维码PHP的生成，我发现了以下几种方式：
1、某日本作者写的PHP http://www.swetake.com/qr/qr_cgi.html
2、开源社区上的PHP程序 http://phpqrcode.sourceforge.net/
3、google提供的一个接口  http://code.google.com/intl/zh-CN/apis/chart/
这里我尝试了第二种方法：下载软件包后，使用里边的方法：QRcode::png
我写了个代码是这样：

require_once(APP_PATH.'/include/phpqrcode/qrlib.php');
QRcode::png("http://www.sunboyu.cn");

这样就可以输出二维码图形了，可以用手机尝试一下。
]]></description>
			<content:encoded><![CDATA[<p>二维码是什么？</p>
<p>看这里：<a href="http://baike.baidu.com/view/132241.htm" target="_blank">百度百科：二维码</a></p>
<p>二维码我用的最多的就是利用android手机的二维码扫描功能扫描网址，当然这种方法还大量应用在货物标签，比如我们去超市结账的条码扫描。</p>
<p>二维码利用近距离的光线进行数据传输，打破了网络数据线的依赖，可以说是一种打破常规的非常方便的应用。尤其在各种设备并不那么兼容的情况下，用二维码交换少量信息是非常便利的。</p>
<p>二维码的算法是通用的，二维码PHP的生成，我发现了以下几种方式：<br />
1、某日本作者写的PHP http://www.swetake.com/qr/qr_cgi.html<br />
2、开源社区上的PHP程序 http://phpqrcode.sourceforge.net/<br />
3、google提供的一个接口  http://code.google.com/intl/zh-CN/apis/chart/</p>
<p>这里我尝试了第二种方法：下载软件包后，使用里边的方法：QRcode::png</p>
<p>我写了个代码是这样：<br />
<code><br />
require_once(APP_PATH.'/include/phpqrcode/qrlib.php');<br />
QRcode::png("http://www.sunboyu.cn");<br />
</code><br />
这样就可以输出二维码图形了，可以用手机尝试一下。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/08/11/%e4%bd%bf%e7%94%a8php%e6%9d%a5%e7%94%9f%e6%88%90%e4%ba%8c%e7%bb%b4%e7%a0%81.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>搭建C开发环境的一个小shell，自动，得找软件包和配置文件模板</title>
		<link>http://www.sunboyu.cn/2011/08/06/%e6%90%ad%e5%bb%bac%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83%e7%9a%84%e4%b8%80%e4%b8%aa%e5%b0%8fshell%ef%bc%8c%e8%87%aa%e5%8a%a8%ef%bc%8c%e5%be%97%e6%89%be%e8%bd%af%e4%bb%b6%e5%8c%85%e5%92%8c%e9%85%8d.shtml</link>
		<comments>http://www.sunboyu.cn/2011/08/06/%e6%90%ad%e5%bb%bac%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83%e7%9a%84%e4%b8%80%e4%b8%aa%e5%b0%8fshell%ef%bc%8c%e8%87%aa%e5%8a%a8%ef%bc%8c%e5%be%97%e6%89%be%e8%bd%af%e4%bb%b6%e5%8c%85%e5%92%8c%e9%85%8d.shtml#comments</comments>
		<pubDate>Sat, 06 Aug 2011 07:42:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1426</guid>
		<description><![CDATA[develop
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2011/08/develop.sh">develop</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/08/06/%e6%90%ad%e5%bb%bac%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83%e7%9a%84%e4%b8%80%e4%b8%aa%e5%b0%8fshell%ef%bc%8c%e8%87%aa%e5%8a%a8%ef%bc%8c%e5%be%97%e6%89%be%e8%bd%af%e4%bb%b6%e5%8c%85%e5%92%8c%e9%85%8d.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>android Activity之间传参</title>
		<link>http://www.sunboyu.cn/2011/07/26/android-activity%e4%b9%8b%e9%97%b4%e4%bc%a0%e5%8f%82.shtml</link>
		<comments>http://www.sunboyu.cn/2011/07/26/android-activity%e4%b9%8b%e9%97%b4%e4%bc%a0%e5%8f%82.shtml#comments</comments>
		<pubDate>Tue, 26 Jul 2011 05:40:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[android]]></category>

		<category><![CDATA[传参]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1422</guid>
		<description><![CDATA[貌似跟网页不一样，没有get post了，但提供了这样的传参方式：
前一个页面

Intent intent = new Intent(IndexappActivity.this, LoginappActivity.class);
intent.putExtra("test", "这是来自MainActivity的数据。");
startActivity(intent);

接受页面

Bundle extras = getIntent().getExtras();
String data = null;
if(extras != null)
{
    data  = extras.getString("test");
}
setTitle( data);

还有其他数据格式，不过这种意境够我用了，结贴
]]></description>
			<content:encoded><![CDATA[<p>貌似跟网页不一样，没有get post了，但提供了这样的传参方式：</p>
<p>前一个页面<br />
<code><br />
Intent intent = new Intent(IndexappActivity.this, LoginappActivity.class);<br />
intent.putExtra("test", "这是来自MainActivity的数据。");<br />
startActivity(intent);<br />
</code></p>
<p>接受页面</p>
<p><code><br />
Bundle extras = getIntent().getExtras();<br />
String data = null;<br />
if(extras != null)<br />
{<br />
    data  = extras.getString("test");<br />
}<br />
setTitle( data);<br />
</code></p>
<p>还有其他数据格式，不过这种意境够我用了，结贴</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/07/26/android-activity%e4%b9%8b%e9%97%b4%e4%bc%a0%e5%8f%82.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>常用的Intent的URI及示例 (转)</title>
		<link>http://www.sunboyu.cn/2011/07/25/%e5%b8%b8%e7%94%a8%e7%9a%84intent%e7%9a%84uri%e5%8f%8a%e7%a4%ba%e4%be%8b-%e8%bd%ac.shtml</link>
		<comments>http://www.sunboyu.cn/2011/07/25/%e5%b8%b8%e7%94%a8%e7%9a%84intent%e7%9a%84uri%e5%8f%8a%e7%a4%ba%e4%be%8b-%e8%bd%ac.shtml#comments</comments>
		<pubDate>Mon, 25 Jul 2011 14:20:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[android]]></category>

		<category><![CDATA[intent]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1420</guid>
		<description><![CDATA[以下是常用到的Intent的URI及其示例，包含了大部分应用中用到的共用Intent。
一、打开一个网页，类别是Intent.ACTION_VIEW
Uri uri = Uri.parse(“http://blog.3gstdy.com/”);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
二、打开地图并定位到一个点
Uri uri = Uri.parse(“geo:52.76,-79.0342″);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
三、打开拨号界面 ,类型是Intent.ACTION_DIAL
Uri uri = Uri.parse(“tel:10086″);
Intent intent = new Intent(Intent.ACTION_DIAL, uri);
四、直接拨打电话,与三不同的是，这个直接拨打电话，而不是打开拨号界面
Uri uri = Uri.parse(“tel:10086″);
Intent intent = new Intent(Intent.ACTION_CALL, uri);
五、卸载一个应用，Intent的类别是Intent.ACTION_DELETE
Uri uri = Uri.fromParts(“package”, “xxx”, null);
Intent intent = new Intent(Intent.ACTION_DELETE, uri);
六、安装应用程序,Intent的类别是Intent.ACTION_PACKAGE_ADDED
Uri uri = Uri.fromParts(“package”, “xxx”, null);
Intent intent = new Intent(Intent.ACTION_PACKAGE_ADDED, uri);
七、播放音频文件
Uri uri [...]]]></description>
			<content:encoded><![CDATA[<p>以下是常用到的Intent的URI及其示例，包含了大部分应用中用到的共用Intent。<br />
一、打开一个网页，类别是Intent.ACTION_VIEW<br />
Uri uri = Uri.parse(“http://blog.3gstdy.com/”);<br />
Intent intent = new Intent(Intent.ACTION_VIEW, uri);<br />
二、打开地图并定位到一个点<br />
Uri uri = Uri.parse(“geo:52.76,-79.0342″);<br />
Intent intent = new Intent(Intent.ACTION_VIEW, uri);</p>
<p>三、打开拨号界面 ,类型是Intent.ACTION_DIAL<br />
Uri uri = Uri.parse(“tel:10086″);<br />
Intent intent = new Intent(Intent.ACTION_DIAL, uri);<br />
四、直接拨打电话,与三不同的是，这个直接拨打电话，而不是打开拨号界面<br />
Uri uri = Uri.parse(“tel:10086″);<br />
Intent intent = new Intent(Intent.ACTION_CALL, uri);<br />
五、卸载一个应用，Intent的类别是Intent.ACTION_DELETE<br />
Uri uri = Uri.fromParts(“package”, “xxx”, null);<br />
Intent intent = new Intent(Intent.ACTION_DELETE, uri);<br />
六、安装应用程序,Intent的类别是Intent.ACTION_PACKAGE_ADDED<br />
Uri uri = Uri.fromParts(“package”, “xxx”, null);<br />
Intent intent = new Intent(Intent.ACTION_PACKAGE_ADDED, uri);<br />
七、播放音频文件<br />
Uri uri = Uri.parse(“file:///sdcard/download/everything.mp3″);<br />
Intent intent = new Intent(Intent.ACTION_VIEW, uri);<br />
intent.setType(“audio/mp3″);<br />
八、打开发邮件界面<br />
Uri uri= Uri.parse(“mailto:admin@3gstdy.com”);<br />
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);<br />
九、发邮件,与八不同这里是将邮件发送出去，<br />
Intent intent = new Intent(Intent.ACTION_SEND);<br />
String[] tos = { “admin@3gstdy.com” };<br />
String[] ccs = { “webmaster@3gstdy.com” };<br />
intent.putExtra(Intent.EXTRA_EMAIL, tos);<br />
intent.putExtra(Intent.EXTRA_CC, ccs);<br />
intent.putExtra(Intent.EXTRA_TEXT, “I come from http://blog.3gstdy.com”);<br />
intent.putExtra(Intent.EXTRA_SUBJECT, “http://blog.3gstdy.com”);<br />
intent.setType(“message/rfc882″);<br />
Intent.createChooser(intent, “Choose Email Client”);<br />
//发送带附件的邮件<br />
Intent intent = new Intent(Intent.ACTION_SEND);<br />
intent.putExtra(Intent.EXTRA_SUBJECT, “The email subject text”);<br />
intent.putExtra(Intent.EXTRA_STREAM, “file:///sdcard/mysong.mp3″);<br />
intent.setType(“audio/mp3″);<br />
startActivity(Intent.createChooser(intent, “Choose Email Client”));<br />
十、发短信<br />
Uri uri= Uri.parse(“tel:10086″);<br />
Intent intent = new Intent(Intent.ACTION_VIEW, uri);<br />
intent.putExtra(“sms_body”, “I come from http://blog.3gstdy.com”);<br />
intent.setType(“vnd.android-dir/mms-sms”);<br />
十一、直接发邮件<br />
Uri uri= Uri.parse(“smsto://100861″);<br />
Intent intent = new Intent(Intent.ACTION_SENDTO, uri);<br />
intent.putExtra(“sms_body”, “3g android http://blog.3gstdy.com”);<br />
十二、发彩信<br />
Uri uri= Uri.parse(“content://media/external/images/media/23″);<br />
Intent intent = new Intent(Intent.ACTION_SEND);<br />
intent.putExtra(“sms_body”, “3g android http://blog.3gstdy.com”);<br />
intent.putExtra(Intent.EXTRA_STREAM, uri);<br />
intent.setType(“image/png”);<br />
十三、# Market 相关<br />
1 //寻找某个应用<br />
Uri uri = Uri.parse(“market://search?q=pname:pkg_name”);<br />
Intent it = new Intent(Intent.ACTION_VIEW, uri);<br />
startActivity(it);<br />
//where pkg_name is the full package path for an application<br />
2 //显示某个应用的相关信息<br />
Uri uri = Uri.parse(“market://details?id=app_id”);<br />
Intent it = new Intent(Intent.ACTION_VIEW, uri);<br />
startActivity(it);<br />
//where app_id is the application ID, find the ID<br />
//by clicking on your application on Market home<br />
//page, and notice the ID from the address bar<br />
十四、路径规划<br />
Uri uri = Uri.parse(“http://maps.google.com/maps?f=d&#038;saddr=startLat%20startLng&#038;daddr=endLat%20endLng&#038;hl=en”);<br />
Intent it = new Intent(Intent.ACTION_VIEW, uri);<br />
startActivity(it);</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/07/25/%e5%b8%b8%e7%94%a8%e7%9a%84intent%e7%9a%84uri%e5%8f%8a%e7%a4%ba%e4%be%8b-%e8%bd%ac.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>android点击返回按钮弹出的提示</title>
		<link>http://www.sunboyu.cn/2011/06/28/android%e7%82%b9%e5%87%bb%e8%bf%94%e5%9b%9e%e6%8c%89%e9%92%ae%e5%bc%b9%e5%87%ba%e7%9a%84%e6%8f%90%e7%a4%ba.shtml</link>
		<comments>http://www.sunboyu.cn/2011/06/28/android%e7%82%b9%e5%87%bb%e8%bf%94%e5%9b%9e%e6%8c%89%e9%92%ae%e5%bc%b9%e5%87%ba%e7%9a%84%e6%8f%90%e7%a4%ba.shtml#comments</comments>
		<pubDate>Tue, 28 Jun 2011 03:53:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[alert]]></category>

		<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1418</guid>
		<description><![CDATA[
import android.view.KeyEvent;
import android.app.AlertDialog;
import android.content.DialogInterface;
@Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
           if (keyCode == KeyEvent.KEYCODE_BACK &#038;&#038; event.getRepeatCount() == 0) {
        	   AlertDialog.Builder dlg=new AlertDialog.Builder(this);
       	   [...]]]></description>
			<content:encoded><![CDATA[<p><code><br />
import android.view.KeyEvent;<br />
import android.app.AlertDialog;<br />
import android.content.DialogInterface;<br />
@Override<br />
    public boolean onKeyDown(int keyCode, KeyEvent event) {</p>
<p>           if (keyCode == KeyEvent.KEYCODE_BACK &#038;&#038; event.getRepeatCount() == 0) {<br />
        	   AlertDialog.Builder dlg=new AlertDialog.Builder(this);<br />
       	       dlg.setTitle("Alert");<br />
       	       dlg.setMessage("退出?");<br />
       	       dlg.setPositiveButton("是", new DialogInterface.OnClickListener() {<br />
       	    	   public void onClick(DialogInterface dialog, int whichButton) {<br />
       	    	    setResult(RESULT_OK);<br />
       	    	    finish();<br />
       	    	   }<br />
       	    	});<br />
       	    	dlg.setNegativeButton("不", new DialogInterface.OnClickListener() {<br />
       	    	    public	void onClick(DialogInterface dialog, int whichButton) {</p>
<p>       	    	    }<br />
       	    	});<br />
       	       dlg.show();<br />
           }<br />
           return super.onKeyDown(keyCode, event);<br />
    }<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/06/28/android%e7%82%b9%e5%87%bb%e8%bf%94%e5%9b%9e%e6%8c%89%e9%92%ae%e5%bc%b9%e5%87%ba%e7%9a%84%e6%8f%90%e7%a4%ba.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>php和mysql guid的应用</title>
		<link>http://www.sunboyu.cn/2011/04/24/php%e5%92%8cmysql-guid%e7%9a%84%e5%ba%94%e7%94%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2011/04/24/php%e5%92%8cmysql-guid%e7%9a%84%e5%ba%94%e7%94%a8.shtml#comments</comments>
		<pubDate>Sun, 24 Apr 2011 11:00:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1405</guid>
		<description><![CDATA[
　　GUID： 即Globally Unique Identifier（全球唯一标识符） 也称作 UUID(Universally Unique IDentifier) 。 GUID是一个通过特定算法产生的二进制长度为128位的数字标识符，用于指示产品的唯一性。GUID 主要用于在拥有多个节点、多台计算机的网络或系统中，分配必须具有唯一性的标识符。
　　在 Windows 平台上，GUID 广泛应用于微软的产品中，用于标识如如注册表项、类及接口标识、数据库、系统目录等对象。

php中并没有标准的guid，只是有个函数 uniqid() 生成唯一id。而在mysql中有函数生成guid：SELECT UUID() 
]]></description>
			<content:encoded><![CDATA[<blockquote><p>
　　GUID： 即Globally Unique Identifier（全球唯一标识符） 也称作 UUID(Universally Unique IDentifier) 。 GUID是一个通过特定算法产生的二进制长度为128位的数字标识符，用于指示产品的唯一性。GUID 主要用于在拥有多个节点、多台计算机的网络或系统中，分配必须具有唯一性的标识符。<br />
　　在 Windows 平台上，GUID 广泛应用于微软的产品中，用于标识如如注册表项、类及接口标识、数据库、系统目录等对象。
</p></blockquote>
<p>php中并没有标准的guid，只是有个函数 uniqid() 生成唯一id。而在mysql中有函数生成guid：SELECT UUID() </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/04/24/php%e5%92%8cmysql-guid%e7%9a%84%e5%ba%94%e7%94%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>兼容ie678 ff chrome的浮动层控制</title>
		<link>http://www.sunboyu.cn/2011/04/23/%e5%85%bc%e5%ae%b9ie678-ff-chrome%e7%9a%84%e6%b5%ae%e5%8a%a8%e5%b1%82%e6%8e%a7%e5%88%b6.shtml</link>
		<comments>http://www.sunboyu.cn/2011/04/23/%e5%85%bc%e5%ae%b9ie678-ff-chrome%e7%9a%84%e6%b5%ae%e5%8a%a8%e5%b1%82%e6%8e%a7%e5%88%b6.shtml#comments</comments>
		<pubDate>Sat, 23 Apr 2011 10:38:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1403</guid>
		<description><![CDATA[经过测试组严格测试的，其他浏览器还不清楚,依赖jquery
if(typeof document.all !== &#34;undefined&#34;) {&#160; &#160;//IE
&#160;&#160; &#160;var left&#160; &#160; = document.documentElement.scrollLeft;
&#160;&#160; &#160;var top&#160; &#160; &#160;= document.documentElement.scrollTop;
&#160;&#160; &#160;drag_x = event.clientX;
&#160;&#160; &#160;drag_y = event.clientY
&#160;&#160; &#160;
} else {&#160; &#160; //FF,Chrome,Opera,Safari
&#160;&#160; &#160;var left&#160; &#160; = document.documentElement.offsetLeft;
&#160;&#160; &#160;var top&#160; &#160; &#160;= document.documentElement.offsetTop;
&#160;&#160; &#160;drag_x = e.pageX;
&#160;&#160; &#160;drag_y = e.pageY;
}
var tipsDiv = '&#60;div class=&#34;tipsClass&#34;&#62;&#60;img src=&#34;http://pic.xoyo.com/zt/rt/mapdesign/load.gif&#34; /&#62;&#60;/div&#62;';
$( 'body' ).append( tipsDiv );
$( 'div.tipsClass' ).css({
'top' [...]]]></description>
			<content:encoded><![CDATA[<p>经过测试组严格测试的，其他浏览器还不清楚,依赖jquery</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">if(typeof document.all !== &quot;undefined&quot;) {&nbsp; &nbsp;//IE</li>
<li>&nbsp;&nbsp; &nbsp;var left&nbsp; &nbsp; = document.documentElement.scrollLeft;</li>
<li>&nbsp;&nbsp; &nbsp;var top&nbsp; &nbsp; &nbsp;= document.documentElement.scrollTop;</li>
<li>&nbsp;&nbsp; &nbsp;drag_x = event.clientX;</li>
<li>&nbsp;&nbsp; &nbsp;drag_y = event.clientY</li>
<li>&nbsp;&nbsp; &nbsp;</li>
<li>} else {&nbsp; &nbsp; //FF,Chrome,Opera,Safari</li>
<li>&nbsp;&nbsp; &nbsp;var left&nbsp; &nbsp; = document.documentElement.offsetLeft;</li>
<li>&nbsp;&nbsp; &nbsp;var top&nbsp; &nbsp; &nbsp;= document.documentElement.offsetTop;</li>
<li>&nbsp;&nbsp; &nbsp;drag_x = e.pageX;</li>
<li>&nbsp;&nbsp; &nbsp;drag_y = e.pageY;</li>
<li>}</li>
<li>var tipsDiv = '&lt;div class=&quot;tipsClass&quot;&gt;&lt;img src=&quot;http://pic.xoyo.com/zt/rt/mapdesign/load.gif&quot; /&gt;&lt;/div&gt;';</li>
<li>$( 'body' ).append( tipsDiv );</li>
<li>$( 'div.tipsClass' ).css({</li>
<li>'top' : (top+drag_y) + 'px',</li>
<li>'left' : (left+drag_x) + 'px', </li>
<li>'position' : 'absolute',</li>
<li>'padding' : '3px 5px',</li>
<li>'background': '#8FBC8F',</li>
<li>'font-size' : 12 + 'px',</li>
<li>'margin' : '0 auto',</li>
<li>'text-align': 'center',</li>
<li>'width' : 'auto',</li>
<li>'color' : '#fff',</li>
<li>'opacity' : '0.8'</li>
<li>}).show();</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/04/23/%e5%85%bc%e5%ae%b9ie678-ff-chrome%e7%9a%84%e6%b5%ae%e5%8a%a8%e5%b1%82%e6%8e%a7%e5%88%b6.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>mysql_udf_tc 未测试发布版</title>
		<link>http://www.sunboyu.cn/2011/03/18/mysql_udf_tc-%e6%9c%aa%e6%b5%8b%e8%af%95%e5%8f%91%e5%b8%83%e7%89%88.shtml</link>
		<comments>http://www.sunboyu.cn/2011/03/18/mysql_udf_tc-%e6%9c%aa%e6%b5%8b%e8%af%95%e5%8f%91%e5%b8%83%e7%89%88.shtml#comments</comments>
		<pubDate>Fri, 18 Mar 2011 03:11:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[tc]]></category>

		<category><![CDATA[udf]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1397</guid>
		<description><![CDATA[受伤了，没时间折腾，先发布未测试版，欢迎各种bug提交，康复后继续
mysql数据同步到tc的table表，直接写文件，php读文件查询。
看手册，不解释。
有问题加qq 176300676
#ifdef STANDARD
#include &#60;stdlib .h&#62;
#include &#60;stdio .h&#62;
#include &#60;string .h&#62;
#ifdef __WIN__
typedef unsigned __int64 ulonglong;	/* Microsofts 64 bit types */
typedef __int64 longlong;
#else
typedef unsigned long long ulonglong;
typedef long long longlong;
#endif /*__WIN__*/
#else
#include &#60;my_global .h&#62;
#include &#60;my_sys .h&#62;
#include &#60;m_string .h&#62;
#endif
#include &#60;mysql .h&#62;
#include &#60;ctype .h&#62;
&#160;
#include &#60;float .h&#62;
&#160;
&#160;
#include &#60;tcutil .h&#62;
#include &#60;tctdb .h&#62;
#include &#60;stdlib .h&#62;
#include &#60;stdbool .h&#62;
#include &#60;stdint .h&#62;
&#160;
&#160;
&#160;
#ifdef HAVE_DLOPEN
&#160;
/*&#160; &#160;TC_CREATE&#160; &#160; */
my_bool tc_create_init(UDF_INIT [...]]]></description>
			<content:encoded><![CDATA[<p>受伤了，没时间折腾，先发布未测试版，欢迎各种bug提交，康复后继续</p>
<p>mysql数据同步到tc的table表，直接写文件，php读文件查询。</p>
<p>看手册，不解释。</p>
<p>有问题加qq 176300676</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">#ifdef STANDARD</li>
<li>#include &lt;stdlib .h&gt;</li>
<li>#include &lt;stdio .h&gt;</li>
<li>#include &lt;string .h&gt;</li>
<li>#ifdef __WIN__</li>
<li>typedef unsigned __int64 ulonglong;	/* Microsofts 64 bit types */</li>
<li>typedef __int64 longlong;</li>
<li>#else</li>
<li>typedef unsigned long long ulonglong;</li>
<li>typedef long long longlong;</li>
<li>#endif /*__WIN__*/</li>
<li>#else</li>
<li>#include &lt;my_global .h&gt;</li>
<li>#include &lt;my_sys .h&gt;</li>
<li>#include &lt;m_string .h&gt;</li>
<li>#endif</li>
<li>#include &lt;mysql .h&gt;</li>
<li>#include &lt;ctype .h&gt;</li>
<li>&nbsp;</li>
<li>#include &lt;float .h&gt;</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>#include &lt;tcutil .h&gt;</li>
<li>#include &lt;tctdb .h&gt;</li>
<li>#include &lt;stdlib .h&gt;</li>
<li>#include &lt;stdbool .h&gt;</li>
<li>#include &lt;stdint .h&gt;</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>#ifdef HAVE_DLOPEN</li>
<li>&nbsp;</li>
<li>/*&nbsp; &nbsp;TC_CREATE&nbsp; &nbsp; */</li>
<li>my_bool tc_create_init(UDF_INIT *initid, UDF_ARGS *args, char *message)</li>
<li>{</li>
<li>	return 0;</li>
<li>}</li>
<li>&nbsp;</li>
<li>void tc_create_deinit(UDF_INIT *initid)</li>
<li>{</li>
<li>}</li>
<li>&nbsp;</li>
<li>char * tc_create(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *length, char *is_null, char *error)</li>
<li>{</li>
<li>	TCTDB *tdb;</li>
<li>	int ecode;</li>
<li>&nbsp;&nbsp; &nbsp;char *errormsg;</li>
<li>	char *tcfile;</li>
<li>	tdb = tctdbnew();</li>
<li>&nbsp;</li>
<li>	tcfile = args-&gt;args[0];</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;/* open the database */</li>
<li>&nbsp;&nbsp; &nbsp;if(!tctdbopen(tdb, tcfile, TDBOWRITER | TDBOCREAT))</li>
<li>	{</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ecode = tctdbecode(tdb);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sprintf(errormsg, &quot;error: %s\n&quot;, tctdberrmsg(ecode));</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;}</li>
<li>	else</li>
<li>	{</li>
<li>		sprintf(errormsg, &quot;OK&quot;);</li>
<li>	}</li>
<li>	*length = strlen(errormsg);</li>
<li>	return errormsg;</li>
<li>}</li>
<li>&nbsp;</li>
<li>/*&nbsp; &nbsp;TC_SET&nbsp; &nbsp; */</li>
<li>my_bool tc_set_init(UDF_INIT *initid, UDF_ARGS *args, char *message)</li>
<li>{</li>
<li>&nbsp; if (args-&gt;arg_count &lt; 3)</li>
<li>&nbsp; {</li>
<li>&nbsp;&nbsp; &nbsp;strcpy(message,&quot;Wrong arguments to metaphon;&nbsp; Use the source&quot;);</li>
<li>&nbsp;&nbsp; &nbsp;return 1;</li>
<li>&nbsp; }</li>
<li>&nbsp; return 0;</li>
<li>}</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>void tc_set_deinit(UDF_INIT *initid)</li>
<li>{</li>
<li>}</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>char *tc_set(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *length, char *is_null, char *error)</li>
<li>{	</li>
<li>	char *dbfile,*errormsg,pkbuf[200];</li>
<li>	TCTDB *tdb;</li>
<li>	TCMAP *cols;</li>
<li>	int i = 0;</li>
<li>	int ecode,pksiz;</li>
<li>&nbsp;&nbsp; &nbsp;memcpy(result, &quot;result string&quot;, 13);</li>
<li>&nbsp;&nbsp; &nbsp;*length = 13;</li>
<li>&nbsp;</li>
<li>	dbfile = args-&gt;args[0];</li>
<li>&nbsp;</li>
<li>	tdb = tctdbnew();</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;if(!tctdbopen(tdb, dbfile, TDBOWRITER | TDBOCREAT)){</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ecode = tctdbecode(tdb);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sprintf(errormsg, &quot;open error: %s\n&quot;, tctdberrmsg(ecode));</li>
<li>&nbsp;&nbsp; &nbsp;}</li>
<li>&nbsp;</li>
<li>	cols = tcmapnew();</li>
<li>&nbsp;</li>
<li>	for(i = 2;i&lt;args -&gt;arg_count;i++)</li>
<li>	{</li>
<li>		tcmapput2(cols, args-&gt;attributes[i], args-&gt;args[i]);	</li>
<li>	}</li>
<li>	pksiz = sprintf(pkbuf,&quot;%s&quot;,args-&gt;attributes[1]);</li>
<li>	</li>
<li>	if(!tctdbput(tdb, pkbuf, pksiz, cols)){</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ecode = tctdbecode(tdb);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sprintf(errormsg,&quot;put error: %s\n&quot;, tctdberrmsg(ecode));</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;}</li>
<li>	else</li>
<li>	{</li>
<li>		errormsg = &quot;OK&quot;;</li>
<li>&nbsp;</li>
<li>	}</li>
<li>&nbsp;&nbsp; &nbsp;tcmapdel(cols);</li>
<li>	</li>
<li>&nbsp;</li>
<li>	if(!tctdbclose(tdb)){</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ecode = tctdbecode(tdb);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sprintf(errormsg, &quot;close error: %s\n&quot;, tctdberrmsg(ecode));</li>
<li>&nbsp;&nbsp; &nbsp;}</li>
<li>	*length = strlen(errormsg);</li>
<li>	return errormsg;</li>
<li>}</li>
<li>&nbsp;</li>
<li>/*&nbsp; &nbsp;TC_DEL&nbsp; &nbsp; */</li>
<li>my_bool tc_del_init(UDF_INIT *initid, UDF_ARGS *args, char *message)</li>
<li>{</li>
<li>&nbsp; if (args-&gt;arg_count &lt; 2)</li>
<li>&nbsp; {</li>
<li>&nbsp;&nbsp; &nbsp;strcpy(message,&quot;Wrong arguments to metaphon;&nbsp; Use the source&quot;);</li>
<li>&nbsp;&nbsp; &nbsp;return 1;</li>
<li>&nbsp; }</li>
<li>&nbsp; return 0;</li>
<li>}</li>
<li>void tc_del_deinit(UDF_INIT *initid)</li>
<li>{</li>
<li>}</li>
<li>char * tc_del(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *length, char *is_null, char *error)</li>
<li>{</li>
<li>	TCTDB *tdb;</li>
<li>	char *dbfile,*errormsg,*pkbuf;</li>
<li>	int ecode;</li>
<li>&nbsp;</li>
<li>	dbfile = args-&gt;args[0];</li>
<li>	pkbuf = args-&gt;args[1];</li>
<li>&nbsp;</li>
<li>	tdb = tctdbnew();</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;if(!tctdbopen(tdb, dbfile, TDBOWRITER | TDBOCREAT)){</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ecode = tctdbecode(tdb);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sprintf(errormsg, &quot;open error: %s\n&quot;, tctdberrmsg(ecode));</li>
<li>&nbsp;&nbsp; &nbsp;}</li>
<li>	if(!tctdbout2(tdb,pkbuf))</li>
<li>	{</li>
<li>		ecode = tctdbecode(tdb);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sprintf(errormsg,&quot;delete error: %s\n&quot;, tctdberrmsg(ecode));</li>
<li>	}</li>
<li>	else</li>
<li>	{</li>
<li>		errormsg = &quot;OK&quot;;</li>
<li>	}</li>
<li>	if(!tctdbclose(tdb)){</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ecode = tctdbecode(tdb);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sprintf(errormsg, &quot;close error: %s\n&quot;, tctdberrmsg(ecode));</li>
<li>&nbsp;&nbsp; &nbsp;}</li>
<li>	*length = strlen(errormsg);</li>
<li>	return errormsg;</li>
<li>&nbsp;</li>
<li>}</li>
<li>/*&nbsp; &nbsp;TC_SETINDEX&nbsp; &nbsp; */</li>
<li>my_bool tc_sexindex_init(UDF_INIT *initid, UDF_ARGS *args, char *message)</li>
<li>{</li>
<li>&nbsp; if (args-&gt;arg_count &lt; 2)</li>
<li>&nbsp; {</li>
<li>&nbsp;&nbsp; &nbsp;strcpy(message,&quot;Wrong arguments to metaphon;&nbsp; Use the source&quot;);</li>
<li>&nbsp;&nbsp; &nbsp;return 1;</li>
<li>&nbsp; }</li>
<li>&nbsp; return 0;</li>
<li>}</li>
<li>void tc_sexindex_deinit(UDF_INIT *initid)</li>
<li>{</li>
<li>}</li>
<li>char * tc_sexindex(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *length, char *is_null, char *error)</li>
<li>{</li>
<li>	TCTDB *tdb;</li>
<li>	char *dbfile,*errormsg,*pkname[200];</li>
<li>	int ecode,indextype;</li>
<li>&nbsp;</li>
<li>	dbfile = args-&gt;args[0];</li>
<li>	*pkname = args-&gt;attributes[1];</li>
<li>&nbsp;</li>
<li>	tdb = tctdbnew();</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;if(!tctdbopen(tdb, dbfile, TDBOWRITER | TDBOCREAT)){</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ecode = tctdbecode(tdb);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sprintf(errormsg, &quot;open error: %s\n&quot;, tctdberrmsg(ecode));</li>
<li>&nbsp;&nbsp; &nbsp;}</li>
<li>&nbsp;&nbsp; &nbsp;if(args-&gt;args[2]==&quot;string&quot;)</li>
<li>	{</li>
<li>		indextype = TDBITLEXICAL;</li>
<li>	}</li>
<li>	else if(args-&gt;args[2]==&quot;int&quot;)</li>
<li>	{</li>
<li>		indextype = TDBITDECIMAL;</li>
<li>	}</li>
<li>	if(!tctdbsetindex(tdb,*pkname,indextype))</li>
<li>	{</li>
<li>		ecode = tctdbecode(tdb);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sprintf(errormsg, &quot;setindex error: %s\n&quot;, tctdberrmsg(ecode));</li>
<li>	}</li>
<li>&nbsp;</li>
<li>	if(!tctdbclose(tdb)){</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ecode = tctdbecode(tdb);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;sprintf(errormsg, &quot;close error: %s\n&quot;, tctdberrmsg(ecode));</li>
<li>&nbsp;&nbsp; &nbsp;}</li>
<li>	*length = strlen(errormsg);</li>
<li>	return errormsg;</li>
<li>}</li>
<li>#endif /* HAVE_DLOPEN */</li>
<li>&lt;/args&gt;&lt;/stdint&gt;&lt;/stdbool&gt;&lt;/stdlib&gt;&lt;/tctdb&gt;&lt;/tcutil&gt;&lt;/float&gt;&lt;/ctype&gt;&lt;/mysql&gt;&lt;/m_string&gt;&lt;/my_sys&gt;&lt;/my_global&gt;&lt;/string&gt;&lt;/stdio&gt;&lt;/stdlib&gt;</li></ol></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">#!/bin/sh</li>
<li>gcc -Wall -I/opt/mysql-5.0.22/include/mysql -I/opt/tokyocabinet-1.4.46/include -I. -shared -L/usr/lib -ltokyocabinet -lz -lbz2 -lrt -lpthread -lm -lc&nbsp; udf_tt.c -o lib_mysqludf_tt.so</li>
<li>#gcc -Wall -I/opt/mysql-5.0.22/include/mysql -I. -static udf_tt.c -o lib_mysqludf_tt.so</li>
<li>cp -f ./lib_mysqludf_tt.so /usr/lib/lib_mysqludf_tt.so</li>
<li>service mysqld restart</li></ol></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">drop function tc_create;</li>
<li>create function tc_create returns string soname 'lib_mysqludf_tt.so';</li>
<li>&nbsp;</li>
<li>drop function tc_set;</li>
<li>create function tc_set returns string soname 'lib_mysqludf_tt.so';</li>
<li>&nbsp;</li>
<li>select tc_set(&quot;/home/sunboyu/test&quot;,`User`,`Host`) FROM user limit 1</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/03/18/mysql_udf_tc-%e6%9c%aa%e6%b5%8b%e8%af%95%e5%8f%91%e5%b8%83%e7%89%88.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>谈我喜欢的作家-郑渊洁</title>
		<link>http://www.sunboyu.cn/2011/03/07/zyj.shtml</link>
		<comments>http://www.sunboyu.cn/2011/03/07/zyj.shtml#comments</comments>
		<pubDate>Mon, 07 Mar 2011 15:31:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1389</guid>
		<description><![CDATA[离开校园已经多年，书却一直伴我左右。从《科幻世界》到《飞碟探索》，从教科书到各种工具书；书卖了一批又一批，可办公桌和家里的书箱里总有沉甸甸的一摞书。
社会的竞争是残酷的，我更感觉到了“书到用时方恨少”的涵义。利用业余时间，我又走进了大学校园。令我惊讶的是，计算机专业居然开了语文课，我也碰上了一个国字脸上驾着金丝眼睛、白白净净满腹经纶的大学语文老师。
由于年初的一点意外，我没能赶上第一节课，不过我依然感受到这个老师的渊博-也许更因为我是工科生。
课间与老师攀谈，得知上次课后作业，随课上话题思路，遂写此文。
我喜欢书，毕业后每年买书的花费都近千元。当然大部分是计算机书籍，偶尔也在西三旗桥头买几本二手杂志，怀念一下青春。最近又喜欢上过期期刊，全新杂志但价格却不及全假三分之一。
要说我读过的书，可为杂而又杂：小说故事、杂文、诗歌；王朔的《过把瘾》、琼瑶的《碧云天》、长河落日刀等不知名的武侠故事。
要说我最喜欢那个作家，第一个下意识闪现的人物，就是郑渊洁。
平时我做心理测试，我的心理年龄远远超过了生理年龄：我在小学的时候让父亲带着我到石家庄最大的新华书店：中山路新华书专程去买一本小说：《奔腾验钞机》（后改名《我是钱》）-售货员惊讶，这么小的孩子爱看这种书！
其实爱上郑渊洁正是因为这部小说。当时父亲花几毛钱给我买了一本《童话大王》，里边节选了《奔腾验钞机》50元钞的经历。以一张钱的眼光来看世界，我被这个小说深深吸引了。
随着时光流逝，那本《奔腾验钞机》已经被我翻得惨不忍睹，中学的时候我也曾去书店寻找郑渊洁其他作品，但由于手头的拮据而不得放弃。
大学毕业后，得力于网络的便捷，我几乎阅读了郑渊洁所有的作品，被他的笔锋所深深得震撼。
他的笔法很犀利、尖刻，我总用鲁迅的作品来形容他的作品：他们的作品都是时代的匕首-鲁迅的作品作为一把手术刀在剔出社会的毒瘤，而又以一剂良药来治疗麻木的人；而郑渊洁的作品也非常尖刻得揭露一些社会现象给予讽刺，又赞扬了一些高尚的情操，凸现人性的美好。
《奔腾验钞机》这部作品以钱为第一视角，用其擅长的童话的方式去阐述不同的故事。这些故事深刻批判某些自私贪婪、拜金享乐型人群，这部小说描写人物心理活动比较多，通过人物心理的细腻揣摩和描写，使读者的内心与故事产生共鸣。
《飞马牌汽车》也是我喜欢的一部小说。书中大量夸张的描写批判了官僚主义、教条主义的思想，整部作品夸张让人忍俊不禁、却又阐明了作者此文的主旨。
郑渊洁的人也跟其作品一样：豪放、犀利。他儿子可直呼其名；儿子没有上学却自学成才；愤世嫉俗、远离污秽，为人低调不近商业活动。
也许、我喜欢的就是他的性格；他的书是我们心灵沟通的桥梁。
]]></description>
			<content:encoded><![CDATA[<blockquote><p>离开校园已经多年，书却一直伴我左右。从《科幻世界》到《飞碟探索》，从教科书到各种工具书；书卖了一批又一批，可办公桌和家里的书箱里总有沉甸甸的一摞书。</p>
<p>社会的竞争是残酷的，我更感觉到了“书到用时方恨少”的涵义。利用业余时间，我又走进了大学校园。令我惊讶的是，计算机专业居然开了语文课，我也碰上了一个国字脸上驾着金丝眼睛、白白净净满腹经纶的大学语文老师。</p>
<p>由于年初的一点意外，我没能赶上第一节课，不过我依然感受到这个老师的渊博-也许更因为我是工科生。</p>
<p>课间与老师攀谈，得知上次课后作业，随课上话题思路，遂写此文。</p></blockquote>
<p>我喜欢书，毕业后每年买书的花费都近千元。当然大部分是计算机书籍，偶尔也在西三旗桥头买几本二手杂志，怀念一下青春。最近又喜欢上过期期刊，全新杂志但价格却不及全假三分之一。</p>
<p>要说我读过的书，可为杂而又杂：小说故事、杂文、诗歌；王朔的《过把瘾》、琼瑶的《碧云天》、长河落日刀等不知名的武侠故事。</p>
<p>要说我最喜欢那个作家，第一个下意识闪现的人物，就是郑渊洁。</p>
<p>平时我做心理测试，我的心理年龄远远超过了生理年龄：我在小学的时候让父亲带着我到石家庄最大的新华书店：中山路新华书专程去买一本小说：《奔腾验钞机》（后改名《我是钱》）-售货员惊讶，这么小的孩子爱看这种书！</p>
<p>其实爱上郑渊洁正是因为这部小说。当时父亲花几毛钱给我买了一本《童话大王》，里边节选了《奔腾验钞机》50元钞的经历。以一张钱的眼光来看世界，我被这个小说深深吸引了。</p>
<p>随着时光流逝，那本《奔腾验钞机》已经被我翻得惨不忍睹，中学的时候我也曾去书店寻找郑渊洁其他作品，但由于手头的拮据而不得放弃。</p>
<p>大学毕业后，得力于网络的便捷，我几乎阅读了郑渊洁所有的作品，被他的笔锋所深深得震撼。</p>
<p>他的笔法很犀利、尖刻，我总用鲁迅的作品来形容他的作品：他们的作品都是时代的匕首-鲁迅的作品作为一把手术刀在剔出社会的毒瘤，而又以一剂良药来治疗麻木的人；而郑渊洁的作品也非常尖刻得揭露一些社会现象给予讽刺，又赞扬了一些高尚的情操，凸现人性的美好。</p>
<p>《奔腾验钞机》这部作品以钱为第一视角，用其擅长的童话的方式去阐述不同的故事。这些故事深刻批判某些自私贪婪、拜金享乐型人群，这部小说描写人物心理活动比较多，通过人物心理的细腻揣摩和描写，使读者的内心与故事产生共鸣。</p>
<p>《飞马牌汽车》也是我喜欢的一部小说。书中大量夸张的描写批判了官僚主义、教条主义的思想，整部作品夸张让人忍俊不禁、却又阐明了作者此文的主旨。</p>
<p>郑渊洁的人也跟其作品一样：豪放、犀利。他儿子可直呼其名；儿子没有上学却自学成才；愤世嫉俗、远离污秽，为人低调不近商业活动。</p>
<p>也许、我喜欢的就是他的性格；他的书是我们心灵沟通的桥梁。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/03/07/zyj.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>结合逍遥问问讲解如何利用LoadRunner进行性能测试</title>
		<link>http://www.sunboyu.cn/2011/01/27/%e7%bb%93%e5%90%88%e9%80%8d%e9%81%a5%e9%97%ae%e9%97%ae%e8%ae%b2%e8%a7%a3%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8loadrunner%e8%bf%9b%e8%a1%8c%e6%80%a7%e8%83%bd%e6%b5%8b%e8%af%95.shtml</link>
		<comments>http://www.sunboyu.cn/2011/01/27/%e7%bb%93%e5%90%88%e9%80%8d%e9%81%a5%e9%97%ae%e9%97%ae%e8%ae%b2%e8%a7%a3%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8loadrunner%e8%bf%9b%e8%a1%8c%e6%80%a7%e8%83%bd%e6%b5%8b%e8%af%95.shtml#comments</comments>
		<pubDate>Thu, 27 Jan 2011 02:33:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[loadrunner]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1384</guid>
		<description><![CDATA[最近群里聊到测试，我也拿公司测试部门的一个文档分享。我们测试组4个MM，负责平时的功能测试，性能测试和安全测试。既有很萌的测试主管，又有彪悍的千杯不醉，还有海吃不胖的瘦弱女生，包括由行政转为技术的全才。
PPT主要得靠演讲人的口述才能理解，这里PPT写的也比较详尽，大家可以看出一些功能和流程上的东西。
PPT部分内容删除，包括产品业务流程图，设计敏感账号和我们一些IP信息，不过不影响阅读。
附加一句：得用WPS打开。没装WPS的可以来这里下载 http://www.wps.cn/
顺便宣传我们的产品 逍遥问问
PPT下载
]]></description>
			<content:encoded><![CDATA[<p>最近群里聊到测试，我也拿公司测试部门的一个文档分享。我们测试组4个MM，负责平时的功能测试，性能测试和安全测试。既有很萌的测试主管，又有彪悍的千杯不醉，还有海吃不胖的瘦弱女生，包括由行政转为技术的全才。</p>
<p>PPT主要得靠演讲人的口述才能理解，这里PPT写的也比较详尽，大家可以看出一些功能和流程上的东西。</p>
<p>PPT部分内容删除，包括产品业务流程图，设计敏感账号和我们一些IP信息，不过不影响阅读。</p>
<p>附加一句：得用WPS打开。没装WPS的可以来这里下载 http://www.wps.cn/</p>
<p>顺便宣传我们的产品 <a href="http://ask.xoyo.com">逍遥问问</a></p>
<p><a href='http://www.sunboyu.cn/upfiles/2011/01/e585ace58fb8e5a496e58886e4baabe78988e69cac-e7bb93e59088e9808de981a5e997aee997aee8aeb2e8a7a3e5a682e4bd95e588a9e794a8loadrunnere8bf9be8a18c.rar'>PPT下载</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/01/27/%e7%bb%93%e5%90%88%e9%80%8d%e9%81%a5%e9%97%ae%e9%97%ae%e8%ae%b2%e8%a7%a3%e5%a6%82%e4%bd%95%e5%88%a9%e7%94%a8loadrunner%e8%bf%9b%e8%a1%8c%e6%80%a7%e8%83%bd%e6%b5%8b%e8%af%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>利用udf扩展mysql增加json_object函数</title>
		<link>http://www.sunboyu.cn/2011/01/23/%e5%88%a9%e7%94%a8udf%e6%89%a9%e5%b1%95mysql%e5%a2%9e%e5%8a%a0json_object%e5%87%bd%e6%95%b0.shtml</link>
		<comments>http://www.sunboyu.cn/2011/01/23/%e5%88%a9%e7%94%a8udf%e6%89%a9%e5%b1%95mysql%e5%a2%9e%e5%8a%a0json_object%e5%87%bd%e6%95%b0.shtml#comments</comments>
		<pubDate>Sun, 23 Jan 2011 13:47:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[c]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[udf]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1378</guid>
		<description><![CDATA[其实已经有一个成形的mysql json编码的模块 http://www.mysqludf.org/lib_mysqludf_json/index.php
不过我们在使用的过程中，发现这个函数有版本兼容的问题，后看代码，发现它的json加密规则比较麻烦，没拆出来分析，就自己使用一个json类 http://sourceforge.net/projects/cjson/ 重写了一遍json_object函数。
目前在mysql-5.0.22版本上使用基本没问题，但在mysql5.5以上版本会有问题，udf接口格式好像有了变化。
mysql-5.0.22版本给出的例子是c++的代码。使用了extern语法，为了兼容gcc的语法。而我实际使用纯C环境，就抛弃了extern的语法。
udf_json源码下载
file:udf_json.c
#ifdef STANDARD
#include &#60;stdlib .h&#62;
#include &#60;stdio .h&#62;
#include &#60;string .h&#62;
#ifdef __WIN__
typedef unsigned __int64 ulonglong;	/* Microsofts 64 bit types */
typedef __int64 longlong;
#else
typedef unsigned long long ulonglong;
typedef long long longlong;
#endif /*__WIN__*/
#else
#include &#60;my_global .h&#62;
#include &#60;my_sys .h&#62;
#include &#60;m_string .h&#62;
#endif
#include &#60;mysql .h&#62;
#include &#60;ctype .h&#62;
#include &#60;float .h&#62;
#include &#34;cJSON.h&#34;
#ifdef HAVE_DLOPEN
my_bool json_object_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
&#160; if (args-&#62;arg_count &#60; 1)
&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>其实已经有一个成形的mysql json编码的模块 http://www.mysqludf.org/lib_mysqludf_json/index.php</p>
<p>不过我们在使用的过程中，发现这个函数有版本兼容的问题，后看代码，发现它的json加密规则比较麻烦，没拆出来分析，就自己使用一个json类 http://sourceforge.net/projects/cjson/ 重写了一遍json_object函数。</p>
<p>目前在mysql-5.0.22版本上使用基本没问题，但在mysql5.5以上版本会有问题，udf接口格式好像有了变化。</p>
<p>mysql-5.0.22版本给出的例子是c++的代码。使用了extern语法，为了兼容gcc的语法。而我实际使用纯C环境，就抛弃了extern的语法。</p>
<p><a href='http://www.sunboyu.cn/upfiles/2011/01/udf_json.rar'>udf_json源码下载</a></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">file:udf_json.c</li>
<li>#ifdef STANDARD</li>
<li>#include &lt;stdlib .h&gt;</li>
<li>#include &lt;stdio .h&gt;</li>
<li>#include &lt;string .h&gt;</li>
<li>#ifdef __WIN__</li>
<li>typedef unsigned __int64 ulonglong;	/* Microsofts 64 bit types */</li>
<li>typedef __int64 longlong;</li>
<li>#else</li>
<li>typedef unsigned long long ulonglong;</li>
<li>typedef long long longlong;</li>
<li>#endif /*__WIN__*/</li>
<li>#else</li>
<li>#include &lt;my_global .h&gt;</li>
<li>#include &lt;my_sys .h&gt;</li>
<li>#include &lt;m_string .h&gt;</li>
<li>#endif</li>
<li>#include &lt;mysql .h&gt;</li>
<li>#include &lt;ctype .h&gt;</li>
<li>#include &lt;float .h&gt;</li>
<li>#include &quot;cJSON.h&quot;</li>
<li>#ifdef HAVE_DLOPEN</li>
<li>my_bool json_object_init(UDF_INIT *initid, UDF_ARGS *args, char *message)</li>
<li>{</li>
<li>&nbsp; if (args-&gt;arg_count &lt; 1)</li>
<li>&nbsp; {</li>
<li>&nbsp;&nbsp; &nbsp;strcpy(message,&quot;Wrong arguments to metaphon;&nbsp; Use the source&quot;);</li>
<li>&nbsp;&nbsp; &nbsp;return 1;</li>
<li>&nbsp; }</li>
<li>&nbsp; return 0;</li>
<li>}</li>
<li>void json_object_deinit(UDF_INIT *initid)</li>
<li>{</li>
<li>}</li>
<li>char *json_object(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *length, char *is_null, char *error)</li>
<li>{</li>
<li>	cJSON *root;</li>
<li>	char *out;</li>
<li>	int i = 0;</li>
<li>&nbsp;</li>
<li>	root=cJSON_CreateObject();</li>
<li>	for(i = 0;i&lt;args-&gt;arg_count;i++)</li>
<li>	{</li>
<li>		if(args-&gt;arg_type[i] == STRING_RESULT)</li>
<li>		{</li>
<li>		&nbsp; &nbsp; cJSON_AddStringToObject(root, args-&gt;attributes[i], args-&gt;args[i]);</li>
<li>		}</li>
<li>		else if(args-&gt;arg_type[i] == INT_RESULT)</li>
<li>		{</li>
<li>			cJSON_AddNumberToObject(root, args-&gt;attributes[i], *((int*)args-&gt;args[i])); //函数参数为double型，这里强转int是好使的，纳闷</li>
<li>		}</li>
<li>	}</li>
<li>	out=cJSON_Print(root);</li>
<li>&nbsp;&nbsp; &nbsp;cJSON_Delete(root);</li>
<li>	*length = strlen(out);</li>
<li>	return out;</li>
<li>}</li>
<li>#endif /* HAVE_DLOPEN */</li>
<li>&nbsp;</li>
<li>file:make.sh</li>
<li>#!/bin/sh</li>
<li>gcc -Wall -I/opt/mysql-5.0.22/include/mysql -I. -shared udf_json.c cJSON.c -o lib_mysqludf_json.so</li>
<li>cp -f ./lib_mysqludf_json.so /usr/lib/lib_mysqludf_json.so</li>
<li>service mysqld restart</li>
<li>&lt;/float&gt;&lt;/ctype&gt;&lt;/mysql&gt;&lt;/m_string&gt;&lt;/my_sys&gt;&lt;/my_global&gt;&lt;/string&gt;&lt;/stdio&gt;&lt;/stdlib&gt;</li></ol></div>
<p>编译完成，复制so文件至公共库，然后执行以下语句：</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">drop function json_object;</li>
<li>create function json_object returns string soname 'lib_mysqludf_json.so';</li></ol></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">SELECT json_object(field1,field2……) AS jsdate FROM table;</li></ol></div>
<p>PHP调用：</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">$db = mysql_connect(&quot;127.0.0.1:3306&quot;,&quot;root&quot;,&quot;123456&quot;);</li>
<li>mysql_select_db(&quot;test&quot;);</li>
<li>$query = mysql_query(&quot;SELECT json_object(id,intval,value) FROM test LIMIT 6&quot;);</li>
<li>while($row = mysql_fetch_array($query)){</li>
<li>&nbsp;&nbsp; &nbsp;var_dump(json_decode($row[0],true));</li>
<li>}</li></ol></div>
<p>结果显示：</p>
<blockquote><p>
array(3) {<br />
  ["id"]=><br />
  int(2)<br />
  ["intval"]=><br />
  int(43324)<br />
  ["value"]=><br />
  string(10) &#8220;fdsfdsfdsa&#8221;<br />
}<br />
array(3) {<br />
  ["id"]=><br />
  int(5)<br />
  ["intval"]=><br />
  int(432432432)<br />
  ["value"]=><br />
  string(10) &#8220;fdsafdsasa&#8221;<br />
}</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/01/23/%e5%88%a9%e7%94%a8udf%e6%89%a9%e5%b1%95mysql%e5%a2%9e%e5%8a%a0json_object%e5%87%bd%e6%95%b0.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>mysql5.5.8安装笔记</title>
		<link>http://www.sunboyu.cn/2011/01/19/mysql558%e5%ae%89%e8%a3%85%e7%ac%94%e8%ae%b0.shtml</link>
		<comments>http://www.sunboyu.cn/2011/01/19/mysql558%e5%ae%89%e8%a3%85%e7%ac%94%e8%ae%b0.shtml#comments</comments>
		<pubDate>Wed, 19 Jan 2011 03:46:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[mysql5.5.8]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1374</guid>
		<description><![CDATA[mysql5.5.8对于守旧的人绝对是一种惨无人道的蹂躏。
我开始用mysql5.5.8了，被忽悠得天花乱坠，说性能提升，说主从同步迅速……
不过我是专用udf功能的，因为我常用的mysql稳定版本5.0.22官方说有点小bug，使用udf有点问题，被迫升级了5.5.8版本。
mysql5.5.8抛弃了我们钟爱的configure，而次用了cmake。
当然你要先安装cmake   http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz
cmake安装简单，tar后make &#038;&#038; make install 搞定。
mysql5.5.8到官网下载 http://dev.mysql.com/downloads/mirror.php?id=399302#mirrors
tar出来，就找不到configure了，不过官方提供了高仿configure的转换脚本，不过神马都是浮云，自己折腾脚本吧
cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql-5.5.8 \
&#160;&#160; &#160; &#160;-DMYSQL_DATADIR=/opt/mysql-5.5.8/data \
&#160;&#160; &#160; &#160;-DSYSCONFDIR=/opt/mysql-5.5.8/etc \
&#160;&#160; &#160; &#160;-DINSTALL_PLUGINDIR=dir_name=/opt/mysql-5.5.8/plugin \
&#160;&#160; &#160; &#160;-DWITH_INNOBASE_STORAGE_ENGINE=1 \
&#160;&#160; &#160; &#160;-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
&#160;&#160; &#160; &#160;-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
&#160;&#160; &#160; &#160;-DWITH_FEDERATED_STORAGE_ENGINE=1 \
&#160;&#160; &#160; &#160;-DWITH_PARTITION_STORAGE_ENGINE=1 \
&#160;&#160; &#160; &#160;-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \
&#160;&#160; &#160; &#160;-DMYSQL_TCP_PORT=3306 \
&#160;&#160; &#160; &#160;-DENABLED_LOCAL_INFILE=1 \
&#160;&#160; &#160; &#160;-DEXTRA_CHARSETS=all \
&#160;&#160; &#160; &#160;-DDEFAULT_CHARSET=utf8 \
&#160;&#160; &#160; &#160;-DDEFAULT_COLLATION=utf8-general_ci \
&#160;&#160; &#160; &#160;-DMYSQL_USER=mysql
然后make [...]]]></description>
			<content:encoded><![CDATA[<p>mysql5.5.8对于守旧的人绝对是一种惨无人道的蹂躏。</p>
<p>我开始用mysql5.5.8了，被忽悠得天花乱坠，说性能提升，说主从同步迅速……</p>
<p>不过我是专用udf功能的，因为我常用的mysql稳定版本5.0.22官方说有点小bug，使用udf有点问题，被迫升级了5.5.8版本。</p>
<p>mysql5.5.8抛弃了我们钟爱的configure，而次用了cmake。</p>
<p>当然你要先安装cmake   http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz</p>
<p>cmake安装简单，tar后make &#038;&#038; make install 搞定。</p>
<p>mysql5.5.8到官网下载 http://dev.mysql.com/downloads/mirror.php?id=399302#mirrors</p>
<p>tar出来，就找不到configure了，不过官方提供了高仿configure的转换脚本，不过神马都是浮云，自己折腾脚本吧</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">cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql-5.5.8 \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DMYSQL_DATADIR=/opt/mysql-5.5.8/data \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DSYSCONFDIR=/opt/mysql-5.5.8/etc \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DINSTALL_PLUGINDIR=dir_name=/opt/mysql-5.5.8/plugin \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DWITH_INNOBASE_STORAGE_ENGINE=1 \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DWITH_ARCHIVE_STORAGE_ENGINE=1 \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DWITH_FEDERATED_STORAGE_ENGINE=1 \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DWITH_PARTITION_STORAGE_ENGINE=1 \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DMYSQL_UNIX_ADDR=/tmp/mysqld.sock \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DMYSQL_TCP_PORT=3306 \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DENABLED_LOCAL_INFILE=1 \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DEXTRA_CHARSETS=all \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DDEFAULT_CHARSET=utf8 \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DDEFAULT_COLLATION=utf8-general_ci \</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;-DMYSQL_USER=mysql</li></ol></div>
<p>然后make &#038;&#038; make install就行。</p>
<p>剩下的事情就跟老版本的一样了，不过我编译的时候没有成功安装 mysql_install_db 脚本，自己写了一个，也算成功完成任务了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/01/19/mysql558%e5%ae%89%e8%a3%85%e7%ac%94%e8%ae%b0.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>discuz论坛大表优化</title>
		<link>http://www.sunboyu.cn/2011/01/11/discuz%e8%ae%ba%e5%9d%9b%e5%a4%a7%e8%a1%a8%e4%bc%98%e5%8c%96.shtml</link>
		<comments>http://www.sunboyu.cn/2011/01/11/discuz%e8%ae%ba%e5%9d%9b%e5%a4%a7%e8%a1%a8%e4%bc%98%e5%8c%96.shtml#comments</comments>
		<pubDate>Tue, 11 Jan 2011 15:15:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[discuz]]></category>

		<category><![CDATA[posts]]></category>

		<category><![CDATA[分表]]></category>

		<category><![CDATA[合并表]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1365</guid>
		<description><![CDATA[通过观察，大部分的dz论坛在数据量发展到一定程度，在线人数逐渐提高后，首先锁表的是sessions，这个表我已经写过多种优化的方式，不外乎寻找一些比mysql负载性能好的程序来代替这部分工作。但时间长了，随着在线人数继续增加，那个附加的程序也会面临瓶颈。提高硬件性能和软件性能固然能提高负载，但一旦到瓶颈，必须想其他的方案。
硬件和简约的程序能提高性能，在大数据量下，算法的优势就能体现出来了。
顺便提一下主从：很多人认为主从可以解决问题，其实未必。设想一主多从结构，假如主库写压力很大，那同样压力会同步到从库，会造成N个从库压力同时很大。事实上从库压力会小于主库，因为主库是多进程写，而从库是单进程写， 但总的来说，执行的语句不会少。所以，主从这种结构在一定情况下也就失去了优势。（在硬件资源充裕，压力不是很大的环境下，这种问题发生较少，在硬件条件比较差的一些环境下，这种瓶颈很容易表现出来）
这里拿discuz7的posts表举例，摆脱主从结构，硬件比较差，表很大，10G以上。
一个负载大的dz论坛，在线人数多，又比较活跃，那posts表的压力肯定不会小。在一个回复比较频繁，存储引擎使用myisam的posts表，锁表是经常发生的，我所遇见的问题发生的环境为：数据库单点，无主从，io压力中等。posts表频繁锁表，而造成查询排队，查询速度骤然下降。
在不提升硬件的情况下，要想提速，显然是比较困难的，大量的文本数据装入memcached显然也不合适。所以，这个问题我用优化数据存储的角度对数据表进行了改造。
TIPS：同样100M带宽的集线器和交换机，交换机的吞吐性能远远高于集线器，原因在于：交换机建立专有通道，避免了冲突。
而在mysql中，锁表可以形象描述为冲突了，读写冲突了。但如果我们分表，把读写分散，也许会好点。
分表规则：按照tid进行hash，分散到16个表中。
假设，一读一写，两个操作，同时进行，那么他们撞在一起的几率就是1。如果分为两个表，那么他们撞在一起的几率就是1/2 = 0.5,用一个函数来表示，就是F(x)=1/x ，显然，分的表越多，冲突的机会越小，锁表的几率就越少。即时锁表，影响的也只是1/x的数据，不会对所有的用户造成影响。
数据模型解释：如果是绝对同步发生，几率应该是 F(x)=1/((x-1)*x)，但在计算机里，无论两个操作时间间隔多小，在cpu时间片上都是顺序执行，因为，函数我认定为：F(x)=1/x。
以上用数学的方式解释了算法优化对性能的提升。实际上，通过对逍遥论坛的用户行为统计：posts表95%以上的操作都是在读写，搜索和管理占小部分。
补充一种分表算法：在discuzX里，后台启用了分表，我没有细看，大概是把表按照时间段或者其他条件分开。我猜测，作者本意是拆分老数据，主表只留最新数据和一些命中高的数据。这种方式可以起到一定效果，但根据统计，大部分用户习惯浏览回复最新帖子，因此，大部分的读写还是定位到了一张表，也就是没有彻底解决读写冲突的问题。
还有一个朋友使用的是顺序分表，500w个pid一张表，但这个方法同上个方法，没解决冲突问题。
所以，在他的基础上，我考虑出按照tid进行hash分表的方案。
说到这里，分表又给我们带来了麻烦，有些查询并不能用tid主键进行定位，这里我用了mysql合并表，这个合并表可以合并16个分表，成为一个大表进行查询，而表名依然用原始的表明，这样，dz中原来的功能就不受影响了。
此方案已经实现，我用的新老数据+分别hash的方式，即32张表存储posts数据的方式。但未做压力测试。最近努力学习loadrunner使用，这个压测马上就可以进行了。
]]></description>
			<content:encoded><![CDATA[<p>通过观察，大部分的dz论坛在数据量发展到一定程度，在线人数逐渐提高后，首先锁表的是sessions，这个表我已经写过多种优化的方式，不外乎寻找一些比mysql负载性能好的程序来代替这部分工作。但时间长了，随着在线人数继续增加，那个附加的程序也会面临瓶颈。提高硬件性能和软件性能固然能提高负载，但一旦到瓶颈，必须想其他的方案。</p>
<p>硬件和简约的程序能提高性能，在大数据量下，算法的优势就能体现出来了。</p>
<p>顺便提一下主从：很多人认为主从可以解决问题，其实未必。设想一主多从结构，假如主库写压力很大，那同样压力会同步到从库，会造成N个从库压力同时很大。事实上从库压力会小于主库，因为主库是多进程写，而从库是单进程写， 但总的来说，执行的语句不会少。所以，主从这种结构在一定情况下也就失去了优势。（在硬件资源充裕，压力不是很大的环境下，这种问题发生较少，在硬件条件比较差的一些环境下，这种瓶颈很容易表现出来）</p>
<p>这里拿discuz7的posts表举例，摆脱主从结构，硬件比较差，表很大，10G以上。</p>
<p>一个负载大的dz论坛，在线人数多，又比较活跃，那posts表的压力肯定不会小。在一个回复比较频繁，存储引擎使用myisam的posts表，锁表是经常发生的，我所遇见的问题发生的环境为：数据库单点，无主从，io压力中等。posts表频繁锁表，而造成查询排队，查询速度骤然下降。</p>
<p>在不提升硬件的情况下，要想提速，显然是比较困难的，大量的文本数据装入memcached显然也不合适。所以，这个问题我用优化数据存储的角度对数据表进行了改造。</p>
<p>TIPS：同样100M带宽的集线器和交换机，交换机的吞吐性能远远高于集线器，原因在于：交换机建立专有通道，避免了冲突。</p>
<p>而在mysql中，锁表可以形象描述为冲突了，读写冲突了。但如果我们分表，把读写分散，也许会好点。</p>
<p>分表规则：按照tid进行hash，分散到16个表中。</p>
<p>假设，一读一写，两个操作，同时进行，那么他们撞在一起的几率就是1。如果分为两个表，那么他们撞在一起的几率就是1/2 = 0.5,用一个函数来表示，就是F(x)=1/x ，显然，分的表越多，冲突的机会越小，锁表的几率就越少。即时锁表，影响的也只是1/x的数据，不会对所有的用户造成影响。</p>
<p>数据模型解释：如果是绝对同步发生，几率应该是 F(x)=1/((x-1)*x)，但在计算机里，无论两个操作时间间隔多小，在cpu时间片上都是顺序执行，因为，函数我认定为：F(x)=1/x。</p>
<p>以上用数学的方式解释了算法优化对性能的提升。实际上，通过对逍遥论坛的用户行为统计：posts表95%以上的操作都是在读写，搜索和管理占小部分。</p>
<p>补充一种分表算法：在discuzX里，后台启用了分表，我没有细看，大概是把表按照时间段或者其他条件分开。我猜测，作者本意是拆分老数据，主表只留最新数据和一些命中高的数据。这种方式可以起到一定效果，但根据统计，大部分用户习惯浏览回复最新帖子，因此，大部分的读写还是定位到了一张表，也就是没有彻底解决读写冲突的问题。<br />
还有一个朋友使用的是顺序分表，500w个pid一张表，但这个方法同上个方法，没解决冲突问题。<br />
所以，在他的基础上，我考虑出按照tid进行hash分表的方案。</p>
<p>说到这里，分表又给我们带来了麻烦，有些查询并不能用tid主键进行定位，这里我用了mysql合并表，这个合并表可以合并16个分表，成为一个大表进行查询，而表名依然用原始的表明，这样，dz中原来的功能就不受影响了。</p>
<p>此方案已经实现，我用的新老数据+分别hash的方式，即32张表存储posts数据的方式。但未做压力测试。最近努力学习loadrunner使用，这个压测马上就可以进行了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/01/11/discuz%e8%ae%ba%e5%9d%9b%e5%a4%a7%e8%a1%a8%e4%bc%98%e5%8c%96.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>利用loadrunner做mysql压力测试</title>
		<link>http://www.sunboyu.cn/2011/01/06/%e5%88%a9%e7%94%a8loadrunner%e5%81%9amysql%e5%8e%8b%e5%8a%9b%e6%b5%8b%e8%af%95.shtml</link>
		<comments>http://www.sunboyu.cn/2011/01/06/%e5%88%a9%e7%94%a8loadrunner%e5%81%9amysql%e5%8e%8b%e5%8a%9b%e6%b5%8b%e8%af%95.shtml#comments</comments>
		<pubDate>Thu, 06 Jan 2011 15:05:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[c api]]></category>

		<category><![CDATA[loadrunner]]></category>

		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1354</guid>
		<description><![CDATA[loadrunner下的mysql c api
一个很简单的模拟用户访问论坛帖子的loadrunner测试脚本
最近跟测试组学习loadrunner的使用，测试组的姑娘们习惯用界面进行操作，而习惯linux平台使用的我很多功能都使用代码来实现了。
最近用loadrunner写了一个模拟社区用户压测论坛数据库的一个脚本，进行数据库的压力测试和优化工作。
用户行为分析：
在社区中，看帖的人是发帖人的10倍以上，而看帖人大概80%以上都在看新帖，20以下的用户有挖坟行为。
因此，设定如此的比率：每11个用户，1个发帖，8个看最近30%的帖，两个看老的70%的帖。
我的论坛帖子回复表大概是：973505个帖子的回复，两千多万的回帖。
根据这些数据，配合mysql的c api，写如下脚本:
注：脚本的my_mysql_insert()函数是有问题的，多线程下有一个资源符没处理好，因为还不太了解loadrunner的线程机制，所以留下了一个bug。
在做完这个脚本后，我发现我们测试机性能都不错，很难在一个5G大小的单表上主键查询造成很大的压力，所以，计划把dz论坛架设，用php+mysql真实环境下进行压测，这样可以顺便练习http函数下的loadrunner编程。
globals.h
#ifndef _GLOBALS_H 
#define _GLOBALS_H
#include &#34;lrun.h&#34;
#include &#34;web_api.h&#34;
#include &#34;lrw_custom_body.h&#34;
#include &#34;modal_dialog_callbacks.h&#34;
#define random(x) (rand()%x)
#include &#60;mysql .h&#62;
#include &#60;mysql_com .h&#62;
#include &#60;mysql_time .h&#62;
#include &#60;mysql_version .h&#62;
#include &#60;typelib .h&#62;
#include &#60;my_list .h&#62;
#include &#60;my_alloc .h&#62;
#endif // _GLOBALS_H
&#60;/my_alloc&#62;&#60;/my_list&#62;&#60;/typelib&#62;&#60;/mysql_version&#62;&#60;/mysql_time&#62;&#60;/mysql_com&#62;&#60;/mysql&#62;
vuser_init.c
MYSQL *db;
MYSQL_ROW record;
vuser_init()
{
	char sql[128];
	MYSQL_RES *results1;
&#160;&#160; &#160;lr_load_dll(&#34;libmysql.dll&#34;);
&#160;&#160; &#160;db = mysql_init(NULL);
	mysql_real_connect(db, &#34;192.168.8.32&#34;, &#34;root&#34;, &#34;123456&#34;, &#34;sunboyu_test&#34;, 3311, &#34;/tmp/mysql3311.sock&#34;, 1);
&#160;&#160; &#160;
	sprintf(sql, &#34;show tables&#34;);
	mysql_query(db, sql);
&#160;&#160; &#160;results1 = mysql_store_result(db);
&#160;&#160; &#160;while((record = mysql_fetch_row(results1))) 
	{
	&#160; [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.sunboyu.cn/upfiles/2011/01/loadrunner_mysql.rar'>loadrunner下的mysql c api</a></p>
<p><a href='http://www.sunboyu.cn/upfiles/2011/01/web.rar'>一个很简单的模拟用户访问论坛帖子的loadrunner测试脚本</a></p>
<p>最近跟测试组学习loadrunner的使用，测试组的姑娘们习惯用界面进行操作，而习惯linux平台使用的我很多功能都使用代码来实现了。</p>
<p>最近用loadrunner写了一个模拟社区用户压测论坛数据库的一个脚本，进行数据库的压力测试和优化工作。</p>
<p>用户行为分析：</p>
<p>在社区中，看帖的人是发帖人的10倍以上，而看帖人大概80%以上都在看新帖，20以下的用户有挖坟行为。</p>
<p>因此，设定如此的比率：每11个用户，1个发帖，8个看最近30%的帖，两个看老的70%的帖。</p>
<p>我的论坛帖子回复表大概是：973505个帖子的回复，两千多万的回帖。</p>
<p>根据这些数据，配合mysql的c api，写如下脚本:</p>
<p>注：脚本的my_mysql_insert()函数是有问题的，多线程下有一个资源符没处理好，因为还不太了解loadrunner的线程机制，所以留下了一个bug。</p>
<p>在做完这个脚本后，我发现我们测试机性能都不错，很难在一个5G大小的单表上主键查询造成很大的压力，所以，计划把dz论坛架设，用php+mysql真实环境下进行压测，这样可以顺便练习http函数下的loadrunner编程。</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">globals.h</li>
<li>#ifndef _GLOBALS_H </li>
<li>#define _GLOBALS_H</li>
<li>#include &quot;lrun.h&quot;</li>
<li>#include &quot;web_api.h&quot;</li>
<li>#include &quot;lrw_custom_body.h&quot;</li>
<li>#include &quot;modal_dialog_callbacks.h&quot;</li>
<li>#define random(x) (rand()%x)</li>
<li>#include &lt;mysql .h&gt;</li>
<li>#include &lt;mysql_com .h&gt;</li>
<li>#include &lt;mysql_time .h&gt;</li>
<li>#include &lt;mysql_version .h&gt;</li>
<li>#include &lt;typelib .h&gt;</li>
<li>#include &lt;my_list .h&gt;</li>
<li>#include &lt;my_alloc .h&gt;</li>
<li>#endif // _GLOBALS_H</li>
<li>&lt;/my_alloc&gt;&lt;/my_list&gt;&lt;/typelib&gt;&lt;/mysql_version&gt;&lt;/mysql_time&gt;&lt;/mysql_com&gt;&lt;/mysql&gt;</li></ol></div>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">vuser_init.c</li>
<li>MYSQL *db;</li>
<li>MYSQL_ROW record;</li>
<li>vuser_init()</li>
<li>{</li>
<li>	char sql[128];</li>
<li>	MYSQL_RES *results1;</li>
<li>&nbsp;&nbsp; &nbsp;lr_load_dll(&quot;libmysql.dll&quot;);</li>
<li>&nbsp;&nbsp; &nbsp;db = mysql_init(NULL);</li>
<li>	mysql_real_connect(db, &quot;192.168.8.32&quot;, &quot;root&quot;, &quot;123456&quot;, &quot;sunboyu_test&quot;, 3311, &quot;/tmp/mysql3311.sock&quot;, 1);</li>
<li>&nbsp;&nbsp; &nbsp;</li>
<li>	sprintf(sql, &quot;show tables&quot;);</li>
<li>	mysql_query(db, sql);</li>
<li>&nbsp;&nbsp; &nbsp;results1 = mysql_store_result(db);</li>
<li>&nbsp;&nbsp; &nbsp;while((record = mysql_fetch_row(results1))) </li>
<li>	{</li>
<li>	&nbsp; &nbsp; lr_log_message(&quot;table = %s&quot;, record[0]);</li>
<li>&nbsp;&nbsp; &nbsp; }</li>
<li>	mysql_free_result(results1);</li>
<li>	return 0;</li>
<li>}</li></ol></div>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">vuser_end.c</li>
<li>vuser_end()</li>
<li>{</li>
<li>&nbsp;&nbsp; mysql_close(db);</li>
<li>&nbsp;&nbsp; mysql_server_end();</li>
<li>	return 0;</li>
<li>}</li></ol></div>
<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">Action.c</li>
<li>Action()</li>
<li>{</li>
<li>	int r1 = 0;</li>
<li>	char sql[128];</li>
<li>	r1 = random(11);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //10种用户，8种正常访问，两种在挖坟</li>
<li>	lr_log_message(&quot; %d&quot;, r1);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if(r1==11)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;my_mysql_insert();</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;else</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;my_mysql_query( r1 );</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</li>
<li>	return 0;</li>
<li>}</li>
<li>&nbsp;</li>
<li>int my_mysql_query( int randid )</li>
<li>{</li>
<li>	int r2 = 0;</li>
<li>	int j = 0;</li>
<li>	int count = 0;</li>
<li>	int page = 0;</li>
<li>	char sql[128];</li>
<li>	MYSQL_RES *results2;</li>
<li>	if(randid&amp;lt;2)&nbsp; //老数据，小部分 20%</li>
<li>	{</li>
<li>		r2 = random(700000);</li>
<li>		sprintf(sql, &quot;SELECT COUNT(*) AS count FROM posts_jx3 WHERE tid = %d;&quot;,r2);</li>
<li>		lr_log_message(&quot;%s&quot;,sql);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mysql_query(db, sql);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;results2 = mysql_store_result(db);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;while((record = mysql_fetch_row(results2))) </li>
<li>		{</li>
<li>	&nbsp; &nbsp; &nbsp; &nbsp; lr_log_message(&quot;count = %d&quot;, record[0]);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</li>
<li>		mysql_free_result(results2);</li>
<li>		page = count/10;</li>
<li>		lr_log_message(&quot;page = %d&quot;, page);</li>
<li>		for(j=0;j&lt; =page;j++)</li>
<li>		{</li>
<li>			sprintf(sql, &quot;SELECT *&nbsp; FROM posts_jx3 WHERE tid = %d LIMIT %d,10;&quot;,r2,j);</li>
<li>			mysql_query(db, sql);</li>
<li>			lr_log_message(&quot;%s&quot;, sql);</li>
<li>			if (j&gt;0) {</li>
<li>				&nbsp; results2 = mysql_store_result(db);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;while((record = mysql_fetch_row(results2))) </li>
<li>		&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</li>
<li>	&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lr_log_message(&quot;pid = %d&quot;, record[0]);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</li>
<li>		&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mysql_free_result(results2);</li>
<li>			}</li>
<li>		}</li>
<li>	}</li>
<li>	else //新数据，大部分 80%</li>
<li>	{</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;r2 = random(273505);</li>
<li>		r2 = r2+700000;</li>
<li>		sprintf(sql, &quot;SELECT COUNT(*) AS count FROM posts_jx3 WHERE tid = %d;&quot;,r2);</li>
<li>		lr_log_message(&quot;%s&quot;,sql);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;mysql_query(db, sql);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;results2 = mysql_store_result(db);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;while((record = mysql_fetch_row(results2))) </li>
<li>		{</li>
<li>			lr_log_message(&quot;count = %d&quot;, record[0]);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</li>
<li>		mysql_free_result(results2);</li>
<li>		page = count/10;</li>
<li>		lr_log_message(&quot;page = %d&quot;, page);</li>
<li>&nbsp;</li>
<li>		for(j=0;j&lt; =page;j++)</li>
<li>		{</li>
<li>			sprintf(sql, &quot;SELECT *&nbsp; FROM posts_jx3 WHERE tid = %d LIMIT %d,10;&quot;,r2,j);</li>
<li>			lr_log_message(&quot;%s&quot;, sql);</li>
<li>			mysql_query(db, sql);</li>
<li>			if (j&gt;0) {</li>
<li>				&nbsp; results2 = mysql_store_result(db);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;while((record = mysql_fetch_row(results2))) </li>
<li>		&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</li>
<li>	&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lr_log_message(&quot;pid = %d&quot;, record[0]);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</li>
<li>		&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mysql_free_result(results2);</li>
<li>			}</li>
<li>		}</li>
<li>	}</li>
<li>	mysql_free_result(results2);</li>
<li>	return 0;</li>
<li>}</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>int my_mysql_insert()</li>
<li>{</li>
<li>	int t;</li>
<li>&nbsp;&nbsp; &nbsp;char sql[500];</li>
<li>	MYSQL_RES *results3;</li>
<li>	sprintf(sql,&quot;%s&quot;,&quot;INSERT INTO posts_jx3 ( fid, tid, first, author, authorid, subject, dateline, message, useip, invisible, anonymous, usesig, htmlon, bbcodeoff, smileyoff, parseurloff, attachment, rate, ratetimes, status) VALUES ( 12345, 215053, 0, 'fdsafsdfsd', 2265065, '', 1240535917, 'fdsfsdfdsfd', '118.239.49.229', 0, 0, 0, 0, -1, -1, 0, 0, 0, 0, 0);&quot;);</li>
<li>	lr_log_message(&quot;%s&quot;, sql);</li>
<li>&nbsp;&nbsp; &nbsp;t = mysql_query(db, sql);</li>
<li>	if(t)</li>
<li>	{</li>
<li>		lr_log_message(&quot;%s&quot;, mysql_error(db));</li>
<li>	}</li>
<li>	else</li>
<li>	{</li>
<li>		lr_log_message(&quot;%s&quot;, &quot;suc&quot;);</li>
<li>	}</li>
<li>}</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2011/01/06/%e5%88%a9%e7%94%a8loadrunner%e5%81%9amysql%e5%8e%8b%e5%8a%9b%e6%b5%8b%e8%af%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>linux挂载ntfs分区</title>
		<link>http://www.sunboyu.cn/2010/12/22/linux%e6%8c%82%e8%bd%bdntfs%e5%88%86%e5%8c%ba.shtml</link>
		<comments>http://www.sunboyu.cn/2010/12/22/linux%e6%8c%82%e8%bd%bdntfs%e5%88%86%e5%8c%ba.shtml#comments</comments>
		<pubDate>Wed, 22 Dec 2010 13:54:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[centos]]></category>

		<category><![CDATA[mount]]></category>

		<category><![CDATA[ntfs]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1350</guid>
		<description><![CDATA[最近有点数据需要在linux环境下处理，我用的是centos，最简方式安装，默认不支持ntfs格式。
查资料后，有两种方式可以使centos支持ntfs：1、重新编译内核  2、增加一个插件
重新编译内核成本有点高，而且风险比较大，尝试以下插件后，很好用：
http://tuxera.com/opensource/ntfs-3g-2010.10.2.tgz
下载后，解压，进入目录  ./configure &#038;&#038; make &#038;&#038; make install 即可
然后查看硬盘分区信息：fdisk -l
我的移动硬盘可以显示如下信息：
Device Boot&#160; &#160; &#160; Start&#160; &#160; &#160; &#160; &#160;End&#160; &#160; &#160; Blocks&#160; &#160;Id&#160; System
/dev/sda1&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;2&#160; &#160; &#160; &#160;19457&#160; &#160;156280320&#160; &#160; f&#160; W95 Ext'd (LBA)
/dev/sda5&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;2&#160; &#160; &#160; &#160; 1306&#160; &#160; 10482381&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>最近有点数据需要在linux环境下处理，我用的是centos，最简方式安装，默认不支持ntfs格式。</p>
<p>查资料后，有两种方式可以使centos支持ntfs：1、重新编译内核  2、增加一个插件</p>
<p>重新编译内核成本有点高，而且风险比较大，尝试以下插件后，很好用：</p>
<p>http://tuxera.com/opensource/ntfs-3g-2010.10.2.tgz</p>
<p>下载后，解压，进入目录  ./configure &#038;&#038; make &#038;&#038; make install 即可</p>
<p>然后查看硬盘分区信息：fdisk -l</p>
<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">Device Boot&nbsp; &nbsp; &nbsp; Start&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End&nbsp; &nbsp; &nbsp; Blocks&nbsp; &nbsp;Id&nbsp; System</li>
<li>/dev/sda1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2&nbsp; &nbsp; &nbsp; &nbsp;19457&nbsp; &nbsp;156280320&nbsp; &nbsp; f&nbsp; W95 Ext'd (LBA)</li>
<li>/dev/sda5&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2&nbsp; &nbsp; &nbsp; &nbsp; 1306&nbsp; &nbsp; 10482381&nbsp; &nbsp; 7&nbsp; HPFS/NTFS</li>
<li>/dev/sda6&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 1307&nbsp; &nbsp; &nbsp; &nbsp; 5222&nbsp; &nbsp; 31455238+&nbsp; &nbsp;7&nbsp; HPFS/NTFS</li>
<li>/dev/sda7&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 5223&nbsp; &nbsp; &nbsp; &nbsp;19457&nbsp; &nbsp;114342606&nbsp; &nbsp; 7&nbsp; HPFS/NTFS</li></ol></div>
<p>挂载命令 mount -t ntfs-3g /dev/sda7 /data1</p>
<p>访问 /data1 即可访问/dev/sda7 分区</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/12/22/linux%e6%8c%82%e8%bd%bdntfs%e5%88%86%e5%8c%ba.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>discuz全文检索lucene解决方案图例</title>
		<link>http://www.sunboyu.cn/2010/12/17/discuz%e5%85%a8%e6%96%87%e6%a3%80%e7%b4%a2lucene%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%e5%9b%be%e4%be%8b.shtml</link>
		<comments>http://www.sunboyu.cn/2010/12/17/discuz%e5%85%a8%e6%96%87%e6%a3%80%e7%b4%a2lucene%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%e5%9b%be%e4%be%8b.shtml#comments</comments>
		<pubDate>Fri, 17 Dec 2010 03:17:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[discuz]]></category>

		<category><![CDATA[lucene]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1347</guid>
		<description><![CDATA[
已经全部调试通过，正在往一个线上环境上部署。文档也在敢写之中，谢谢关注。
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2010/12/discuze8aebae59d9be6909clucenee696b9e6a188e88d89e59bbe.jpg"><img src="http://www.sunboyu.cn/upfiles/2010/12/discuze8aebae59d9be6909clucenee696b9e6a188e88d89e59bbe-300x199.jpg" alt="discuz论坛搜索方案" title="discuz论坛搜索方案" width="300" height="199" class="aligncenter size-medium wp-image-1348" /></a></p>
<p>已经全部调试通过，正在往一个线上环境上部署。文档也在敢写之中，谢谢关注。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/12/17/discuz%e5%85%a8%e6%96%87%e6%a3%80%e7%b4%a2lucene%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%e5%9b%be%e4%be%8b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>discuz优化心得</title>
		<link>http://www.sunboyu.cn/2010/12/14/discuz%e4%bc%98%e5%8c%96%e5%bf%83%e5%be%97.shtml</link>
		<comments>http://www.sunboyu.cn/2010/12/14/discuz%e4%bc%98%e5%8c%96%e5%bf%83%e5%be%97.shtml#comments</comments>
		<pubDate>Tue, 14 Dec 2010 07:16:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[技术存档]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1330</guid>
		<description><![CDATA[自从09年10月份接到公司论坛改造升级任务到现在，逍遥论坛 http://bbs.xoyo.com 在性能和负载方面相对稳定,修改了原来的结构，单程序可以支持多论坛(模仿5d6d http://www.5dforum.com/ )。有几个参数可以参考：

平时在线人数：5000~10000人     峰值：50000+（超过5w后，统计表性能明显下降，关闭了统计）

之前每逢峰值论坛常挂，改造之后有充足的预案防止出问题，保证论坛用户能及时在论坛传达必要消息。
在论坛改造过程中，我写了很多文章来表述改造中的一些心得，也认识了很多朋友一起讨论dz的优化。其中最宝贵的经验，是一些无能为力的站长把他们的服务器交给我，让我亲手在一个大负载的服务器上去做优化，在这个过程中学到了很多系统优化方面的知识，更宝贵的是获得了大负载下dz的一些瓶颈点的数据。
由于考虑用户群的问题，很多技术没有办法用开源的软件实现，也无法找到替代品，考虑实际，很多dz站长自己并没有实力去涉入维护一个更改很多的论坛，所以我的方案并没有大量去应用。
在帮朋友优化的过程中，提到更多的是技术实力与维护、需求的增删与性能的平衡。
所以，我得出这样的结论供大家参考：
1、每个功能都会吃系统资源，充分考虑每个功能是否必须，不必须的功能一定要砍。
2、找系统压力点：根据我对逍遥论坛用户日志的分析，90%的压力集中在 forumdisplay.php viewthread.php上，而这些脚本的压力主要体现在表联查而造成的锁表上，最主要的表就是sessions表。sessions表集合了很多用户统计相关功能，因为，优化此表，结合上条原则，合理增删功能，达到压力减小。
3、硬件的优化。硬件优化也是我最近考虑的一个方案，想对于开发人员，硬件的开销还是很小的。合理升级硬件也是一个不错的方案。
以上结论是针对中小型网站已经碰到瓶颈的dz程序做出的建议。
而对于一个负载很大，并且有实力的团队，那在discuz上要做的文章就太多了。
1、拆表是必然的，而对于一些数据量不大但经常变动的表，完全可以全cache。
2、根据需求删改功能。discuz很强大， 但不是每个功能都是你必须使用的。
3、开源产品会给你很多灵感。
推荐的一些开源技术方案：
memcached(不用说了) 
Tokyo Cabinet DBM:性能极佳的持久存储的keyvalue数据库 
mysql udf http http://blog.s135.com/mysql-udf-http/  让tt变成从库？
lucene 必须要替换discuz默认的搜索
你还有什么想法？
一时兴起，写此文。欢迎有兴趣的朋友加 discuz性能优化讨论群 qq:41886598
]]></description>
			<content:encoded><![CDATA[<p>自从09年10月份接到公司论坛改造升级任务到现在，<a href="http://bbs.xoyo.com">逍遥论坛 http://bbs.xoyo.com</a> 在性能和负载方面相对稳定,修改了原来的结构，单程序可以支持多论坛(模仿5d6d http://www.5dforum.com/ )。有几个参数可以参考：</p>
<blockquote><p>
平时在线人数：5000~10000人     峰值：50000+（超过5w后，统计表性能明显下降，关闭了统计）
</p></blockquote>
<p>之前每逢峰值论坛常挂，改造之后有充足的预案防止出问题，保证论坛用户能及时在论坛传达必要消息。</p>
<p>在论坛改造过程中，我写了很多文章来表述改造中的一些心得，也认识了很多朋友一起讨论dz的优化。其中最宝贵的经验，是一些无能为力的站长把他们的服务器交给我，让我亲手在一个大负载的服务器上去做优化，在这个过程中学到了很多系统优化方面的知识，更宝贵的是获得了大负载下dz的一些瓶颈点的数据。</p>
<p>由于考虑用户群的问题，很多技术没有办法用开源的软件实现，也无法找到替代品，考虑实际，很多dz站长自己并没有实力去涉入维护一个更改很多的论坛，所以我的方案并没有大量去应用。</p>
<p>在帮朋友优化的过程中，提到更多的是技术实力与维护、需求的增删与性能的平衡。</p>
<p>所以，我得出这样的结论供大家参考：</p>
<p>1、每个功能都会吃系统资源，充分考虑每个功能是否必须，不必须的功能一定要砍。</p>
<p>2、找系统压力点：根据我对逍遥论坛用户日志的分析，90%的压力集中在 forumdisplay.php viewthread.php上，而这些脚本的压力主要体现在表联查而造成的锁表上，最主要的表就是sessions表。sessions表集合了很多用户统计相关功能，因为，优化此表，结合上条原则，合理增删功能，达到压力减小。</p>
<p>3、硬件的优化。硬件优化也是我最近考虑的一个方案，想对于开发人员，硬件的开销还是很小的。合理升级硬件也是一个不错的方案。</p>
<p>以上结论是针对中小型网站已经碰到瓶颈的dz程序做出的建议。</p>
<p>而对于一个负载很大，并且有实力的团队，那在discuz上要做的文章就太多了。</p>
<p>1、拆表是必然的，而对于一些数据量不大但经常变动的表，完全可以全cache。</p>
<p>2、根据需求删改功能。discuz很强大， 但不是每个功能都是你必须使用的。</p>
<p>3、开源产品会给你很多灵感。</p>
<p>推荐的一些开源技术方案：</p>
<p>memcached(不用说了) </p>
<p>Tokyo Cabinet DBM:性能极佳的持久存储的keyvalue数据库 </p>
<p>mysql udf http http://blog.s135.com/mysql-udf-http/  让tt变成从库？</p>
<p>lucene 必须要替换discuz默认的搜索</p>
<p>你还有什么想法？</p>
<p>一时兴起，写此文。欢迎有兴趣的朋友加 discuz性能优化讨论群 qq:41886598</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/12/14/discuz%e4%bc%98%e5%8c%96%e5%bf%83%e5%be%97.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>使用awstats对nginx的日志进行分析</title>
		<link>http://www.sunboyu.cn/2010/12/10/%e4%bd%bf%e7%94%a8awstats%e5%af%b9nginx%e7%9a%84%e6%97%a5%e5%bf%97%e8%bf%9b%e8%a1%8c%e5%88%86%e6%9e%90.shtml</link>
		<comments>http://www.sunboyu.cn/2010/12/10/%e4%bd%bf%e7%94%a8awstats%e5%af%b9nginx%e7%9a%84%e6%97%a5%e5%bf%97%e8%bf%9b%e8%a1%8c%e5%88%86%e6%9e%90.shtml#comments</comments>
		<pubDate>Fri, 10 Dec 2010 08:13:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[awstats]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1326</guid>
		<description><![CDATA[抛弃apache很长时间了，一直在用nginx，基于第三方的统计系统很多，故很久没有分析过web服务器的日志。最近日志突然暴增，从站长统计无法看出具体暴增的原因，故配置awstats进行分析。
awstats在nginx上运行，这个配置我没做过，所以，我依然使用apache作为awstats的服务器使用。只不过换一个端口而已。
apache配置：安装请看之前的日志，配置文件增加一行配置，具体为
&#60;directory &#34;/opt/httpd-2.2.9/cgi-bin&#34;&#62;
&#160;&#160; &#160;AddHandler cgi-script .pl .cgi&#160; #这行即可
&#160;&#160; &#160;AllowOverride None
&#160;&#160; &#160;Options None
&#160;&#160; &#160;Order allow,deny
&#160;&#160; &#160;Allow from all
&#60;/directory&#62;
配置好，基本就可以启动了。注意端口号，别跟nginx重复了。
下载awstats：http://downloads.sourceforge.net/project/awstats/AWStats/7.0/awstats-7.0.tar.gz?r=http%3A%2F%2Fawstats.sourceforge.net%2F&#038;ts=1291968393&#038;use_mirror=cdnetworks-kr-1
解压后，找到 cgi-bin classes css icon js 这几个文件夹。其中cgi-bin里的文件放到apache的 cgi-bin目录下，其他放到apache的网站根目录。
然后访问 hostname:8080/cgi-bin/awstats.pl 看是不是有结果。
配置站点：
复制 cgi-bin目录下 awstats.model.conf 文件 为 awstats.hostname.conf
修改如下几个关键点
LogFile=&#34;/home/www/log/www.google.com.log&#34; #nginx的日志
SiteDomain=&#34;www.google.com&#34;
HostAliases=&#34;localhost google.com 127.0.0.1 REGEX[myserver\.com$]&#34;
配置完这些， 基本就可以使用了。
另外，还要生成报表：命令为
/opt/httpd-2.2.9/cgi-bin/awstats.pl -update -config=hostname                为了方便，可以加到crontab里。到这里就配置完了。
]]></description>
			<content:encoded><![CDATA[<p>抛弃apache很长时间了，一直在用nginx，基于第三方的统计系统很多，故很久没有分析过web服务器的日志。最近日志突然暴增，从站长统计无法看出具体暴增的原因，故配置awstats进行分析。</p>
<p>awstats在nginx上运行，这个配置我没做过，所以，我依然使用apache作为awstats的服务器使用。只不过换一个端口而已。</p>
<p>apache配置：安装请看之前的日志，配置文件增加一行配置，具体为</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">&lt;directory &quot;/opt/httpd-2.2.9/cgi-bin&quot;&gt;</li>
<li>&nbsp;&nbsp; &nbsp;AddHandler cgi-script .pl .cgi&nbsp; #这行即可</li>
<li>&nbsp;&nbsp; &nbsp;AllowOverride None</li>
<li>&nbsp;&nbsp; &nbsp;Options None</li>
<li>&nbsp;&nbsp; &nbsp;Order allow,deny</li>
<li>&nbsp;&nbsp; &nbsp;Allow from all</li>
<li>&lt;/directory&gt;</li></ol></div>
<p>配置好，基本就可以启动了。注意端口号，别跟nginx重复了。</p>
<p>下载awstats：http://downloads.sourceforge.net/project/awstats/AWStats/7.0/awstats-7.0.tar.gz?r=http%3A%2F%2Fawstats.sourceforge.net%2F&#038;ts=1291968393&#038;use_mirror=cdnetworks-kr-1</p>
<p>解压后，找到 cgi-bin classes css icon js 这几个文件夹。其中cgi-bin里的文件放到apache的 cgi-bin目录下，其他放到apache的网站根目录。</p>
<p>然后访问 hostname:8080/cgi-bin/awstats.pl 看是不是有结果。</p>
<p>配置站点：</p>
<p>复制 cgi-bin目录下 awstats.model.conf 文件 为 awstats.hostname.conf</p>
<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">LogFile=&quot;/home/www/log/www.google.com.log&quot; #nginx的日志</li>
<li>SiteDomain=&quot;www.google.com&quot;</li>
<li>HostAliases=&quot;localhost google.com 127.0.0.1 REGEX[myserver\.com$]&quot;</li></ol></div>
<p>配置完这些， 基本就可以使用了。</p>
<p>另外，还要生成报表：命令为</p>
<p>/opt/httpd-2.2.9/cgi-bin/awstats.pl -update -config=hostname                为了方便，可以加到crontab里。到这里就配置完了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/12/10/%e4%bd%bf%e7%94%a8awstats%e5%af%b9nginx%e7%9a%84%e6%97%a5%e5%bf%97%e8%bf%9b%e8%a1%8c%e5%88%86%e6%9e%90.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>设计模式研究</title>
		<link>http://www.sunboyu.cn/2010/12/02/%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%e7%a0%94%e7%a9%b6.shtml</link>
		<comments>http://www.sunboyu.cn/2010/12/02/%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%e7%a0%94%e7%a9%b6.shtml#comments</comments>
		<pubDate>Thu, 02 Dec 2010 14:47:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[设计模式]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1317</guid>
		<description><![CDATA[研究PHP设计模式其实很久，不过真正在使用上却用的不是很多。但凡设计模式都用在大型负载的商业软件商，而对于web开发，尤其一些短平快的产品，设计模式显得不是那么重要。而只有一些非常核心和通用的部分，我们加以封装，主要是方便复用。
通过最近做一些项目，松散的设计明显不能满足项目的需求，随意的代码虽然能加快项目进度，但也造成很严重的技术透支。
重新认识框架，可以得出以下体会：
框架的确是限制人的，但不是技术的限制，不是思想的限制，而是规范合作的限制。
项目的设计规划人员要付出更多，其设计了框架的核心后，开发人员在你的思路下进行开发，你的一点点错误会在几个人身上得到成倍的放大。
坚持一种设计思路，即使已经走了很多弯路，但起码保证这些弯路要走踏实，而不是一条泥泞的弯路。
一个优化的框架不仅是完成基本功能，更要让开发人员感觉爽，这是最重要的（很难实现）。
最后，继续琢磨我的框架吧。
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-题外话&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
最新学了一段时间的C，包括我以前也提倡，用写C的态度来写PHP。写C语言，每个变量，每块内存都要完全规划在你的脑子里，处理不好，程序是绝对跑不动的。做PHP项目，也要注意这些细节，虽然PHP是弱类型的语言。当然，做一个项目，也要去考虑方方面面。
]]></description>
			<content:encoded><![CDATA[<p>研究PHP设计模式其实很久，不过真正在使用上却用的不是很多。但凡设计模式都用在大型负载的商业软件商，而对于web开发，尤其一些短平快的产品，设计模式显得不是那么重要。而只有一些非常核心和通用的部分，我们加以封装，主要是方便复用。</p>
<p>通过最近做一些项目，松散的设计明显不能满足项目的需求，随意的代码虽然能加快项目进度，但也造成很严重的技术透支。</p>
<p>重新认识框架，可以得出以下体会：</p>
<p>框架的确是限制人的，但不是技术的限制，不是思想的限制，而是规范合作的限制。</p>
<p>项目的设计规划人员要付出更多，其设计了框架的核心后，开发人员在你的思路下进行开发，你的一点点错误会在几个人身上得到成倍的放大。</p>
<p>坚持一种设计思路，即使已经走了很多弯路，但起码保证这些弯路要走踏实，而不是一条泥泞的弯路。</p>
<p>一个优化的框架不仅是完成基本功能，更要让开发人员感觉爽，这是最重要的（很难实现）。</p>
<p>最后，继续琢磨我的框架吧。</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-题外话&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>最新学了一段时间的C，包括我以前也提倡，用写C的态度来写PHP。写C语言，每个变量，每块内存都要完全规划在你的脑子里，处理不好，程序是绝对跑不动的。做PHP项目，也要注意这些细节，虽然PHP是弱类型的语言。当然，做一个项目，也要去考虑方方面面。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/12/02/%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f%e7%a0%94%e7%a9%b6.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>学习PHP开发的一些资源</title>
		<link>http://www.sunboyu.cn/2010/11/09/%e5%ad%a6%e4%b9%a0php%e5%bc%80%e5%8f%91%e7%9a%84%e4%b8%80%e4%ba%9b%e8%b5%84%e6%ba%90.shtml</link>
		<comments>http://www.sunboyu.cn/2010/11/09/%e5%ad%a6%e4%b9%a0php%e5%bc%80%e5%8f%91%e7%9a%84%e4%b8%80%e4%ba%9b%e8%b5%84%e6%ba%90.shtml#comments</comments>
		<pubDate>Tue, 09 Nov 2010 14:42:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[api]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1304</guid>
		<description><![CDATA[http://blog.csdn.net/alexdream/archive/2008/03/24/2213344.aspx
http://devzone.zend.com/node/view/id/1022
http://blog.csdn.net/alin0725/archive/2007/04/08/1556460.aspx
http://devzone.zend.com/article/1024-Extension-Writing-Part-III-Resources       这篇文章不错，讲PHP如果管理连接符
http://www.phpbbchina.com/wiki/index.php/%E7%BC%96%E5%86%99PHP%E6%89%A9%E5%B1%95   中文教程
]]></description>
			<content:encoded><![CDATA[<p>http://blog.csdn.net/alexdream/archive/2008/03/24/2213344.aspx</p>
<p>http://devzone.zend.com/node/view/id/1022</p>
<p>http://blog.csdn.net/alin0725/archive/2007/04/08/1556460.aspx</p>
<p>http://devzone.zend.com/article/1024-Extension-Writing-Part-III-Resources       这篇文章不错，讲PHP如果管理连接符</p>
<p>http://www.phpbbchina.com/wiki/index.php/%E7%BC%96%E5%86%99PHP%E6%89%A9%E5%B1%95   中文教程</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/11/09/%e5%ad%a6%e4%b9%a0php%e5%bc%80%e5%8f%91%e7%9a%84%e4%b8%80%e4%ba%9b%e8%b5%84%e6%ba%90.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>使用MYSQL C api操作mysql</title>
		<link>http://www.sunboyu.cn/2010/10/31/%e4%bd%bf%e7%94%a8mysql-c-api%e6%93%8d%e4%bd%9cmysql.shtml</link>
		<comments>http://www.sunboyu.cn/2010/10/31/%e4%bd%bf%e7%94%a8mysql-c-api%e6%93%8d%e4%bd%9cmysql.shtml#comments</comments>
		<pubDate>Sun, 31 Oct 2010 13:13:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1298</guid>
		<description><![CDATA[
#include 
#include 
#include &#8220;mysql.h&#8221;
int main(int argc, char **argv)
{
	MYSQL mysql, *sock;
	MYSQL_RES *res;
	MYSQL_FIELD *fd;
	MYSQL_ROW row;
	char sql[160];
	char host[20];
	char user[20];
	char pass[20];
	char data[20];
	int i;
	if(argc!=6)
	{
		fprintf(stderr, &#8220;Please input you host, username, password, dbname, sql\n\n&#8221;);
		exit(0);
	}
    sprintf(host, argv[1]);
	sprintf(user, argv[2]);
	sprintf(pass, argv[3]);
	sprintf(data, argv[4]);
	sprintf(sql, argv[5]);
	mysql_init(&#038;mysql);
	if(!(sock=mysql_real_connect(&#038;mysql, host, user, pass, data, 0, NULL, 0)))
	{
		fprintf(stderr, &#8220;Can&#8217;t connect to engine!\n%s\n&#8221;, mysql_error(&#038;mysql));
		perror(&#8221;");
		exit(0);
	}
	if(mysql_query(sock, sql))
	{
		fprintf(stderr, &#8220;Query failed (%s)\n&#8221;, mysql_error(sock));
		exit(1);
	}
	if(!(res=mysql_store_result(sock)))
	{
		fprintf(stderr, &#8220;Couldn`t get [...]]]></description>
			<content:encoded><![CDATA[<p><code><br />
#include <stdio .h><br />
#include <stdlib .h><br />
#include &#8220;mysql.h&#8221;</p>
<p>int main(int argc, char **argv)<br />
{<br />
	MYSQL mysql, *sock;<br />
	MYSQL_RES *res;<br />
	MYSQL_FIELD *fd;<br />
	MYSQL_ROW row;<br />
	char sql[160];<br />
	char host[20];<br />
	char user[20];<br />
	char pass[20];<br />
	char data[20];<br />
	int i;<br />
	if(argc!=6)<br />
	{<br />
		fprintf(stderr, &#8220;Please input you host, username, password, dbname, sql\n\n&#8221;);<br />
		exit(0);<br />
	}<br />
    sprintf(host, argv[1]);<br />
	sprintf(user, argv[2]);<br />
	sprintf(pass, argv[3]);<br />
	sprintf(data, argv[4]);<br />
	sprintf(sql, argv[5]);<br />
	mysql_init(&#038;mysql);<br />
	if(!(sock=mysql_real_connect(&#038;mysql, host, user, pass, data, 0, NULL, 0)))<br />
	{<br />
		fprintf(stderr, &#8220;Can&#8217;t connect to engine!\n%s\n&#8221;, mysql_error(&#038;mysql));<br />
		perror(&#8221;");<br />
		exit(0);<br />
	}<br />
	if(mysql_query(sock, sql))<br />
	{<br />
		fprintf(stderr, &#8220;Query failed (%s)\n&#8221;, mysql_error(sock));<br />
		exit(1);<br />
	}<br />
	if(!(res=mysql_store_result(sock)))<br />
	{<br />
		fprintf(stderr, &#8220;Couldn`t get result from %s\n&#8221;, mysql_error(sock));<br />
		exit(1);<br />
	}<br />
	printf(&#8221;number of fields returned:%d\n&#8221;, mysql_num_fields(res));<br />
	while(row=mysql_fetch_row(res))<br />
	{<br />
		for(i=0;i<mysql_num_fields (res);i++)<br />
		{<br />
			printf("%d:%s   ",i,row[i]);<br />
		}<br />
		printf("\r\n");<br />
	}<br />
	mysql_free_result(res);<br />
	mysql_close(sock);<br />
	exit(0);<br />
	return 0;<br />
}<br />
</code><br />
编译参数：gcc mysql.c -o mysql -I /usr/include/mysql -L /lib/mysql -lmysqlclient</mysql_num_fields></stdlib></stdio></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/10/31/%e4%bd%bf%e7%94%a8mysql-c-api%e6%93%8d%e4%bd%9cmysql.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>缸炉烧饼</title>
		<link>http://www.sunboyu.cn/2010/10/24/%e7%bc%b8%e7%82%89%e7%83%a7%e9%a5%bc.shtml</link>
		<comments>http://www.sunboyu.cn/2010/10/24/%e7%bc%b8%e7%82%89%e7%83%a7%e9%a5%bc.shtml#comments</comments>
		<pubDate>Sun, 24 Oct 2010 08:33:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1293</guid>
		<description><![CDATA[最近做梦，梦见了老家的缸炉烧饼。在北京找了数多地方，没找到卖缸炉烧饼的。流连之际，发现有人跟我一样怀念着家乡不起眼的小吃。遂转载一故乡作家的文章。
土豆网：缸炉烧饼的介绍

　　正如到北京不吃全聚德烤鸭就不算到北京一样，如果到了平山不吃缸炉烧饼，那就不能说到过平山。
　　说起平山，可能没几个人知道这个小小的县城，但说起革命圣地西柏坡，恐怕用如雷贯耳来形容一点儿也不过分，而这个大名鼎鼎的西柏坡，就是平山县的一个小村庄。从1990年离开家乡平山，到今年已经整整二十年了。二十年间，家乡的很多东西都如过眼烟云，并没有在我心中留下多少印象。倒是这缸炉烧饼，总如儿时那样的亲切，以至于每次回老家，都回吃上一次，甚至于有亲戚朋友回去，都委托他们带回来几个尝尝鲜。
　　面食里叫烧饼的并不少，无非是放了油盐，和好面后上面沾上芝麻，用锅烙得金黄。但缸炉烧饼却有它的独特之处，一是方形，据我了解，各地的烧饼样式不少，但大部分是圆的，仅有这缸炉烧饼，便便做成了方形，原因当然不得而知，但这便从形状上与其他的烧饼分开了；二是有细分类，大致可分为；普通、油酥、牛肉罩等；三是制作方式不同，大部分烧饼都是用锅烙，而缸炉烧饼却是像烤红薯一样，做好后放在一个铁筒中烘烤。
　　刚出炉的烧饼，表面焦黄，如上中间有一个山包样的大鼓，上面粘着白白的芝麻，咬一口酥中带脆，满口清香，油酥烧饼，更是酥软可口，至于牛肉罩的，是在烧饼的表面放了一层细如肉松的牛肉粒，一口下去，不仅香气四溢，而且烤牛肉的香味久久不散，晚上连牙都舍不得刷了。
　　记得很小的时候，每到赶集，总是跟在家长后面缠着要去，其实也没什么东西可买，只是为了2分钱一个的烧饼，但因为家里条件实在不好，就是这样的要求一年也只能实现有限的几次。于是又求了家长在家里做，面和油都不错，但就是做不出那个味道，但有总比没有的好，吃不上买的，自己做的也可以解一下馋。每年年底，姥爷都会来家里看看，对于他带来的其他东西，我们一概不问，只是找他书包里的那几个缸炉烧饼。久而久之，姥爷每次来，也总会带一包缸炉烧饼来。
　　后来，缸炉烧饼又长到5分一个，一角一个，两角一个，现在，已经是四角一个了。但我对于缸炉烧饼的情节，不仅没有减退，而是越来越浓重了。
　　四个角的缸炉烧饼就像是一座城，一座建在我心中的城，一座没有城门的城。不论走到哪里，我总也无法突破它，也从来没有想过要突破它。
]]></description>
			<content:encoded><![CDATA[<blockquote><p>最近做梦，梦见了老家的缸炉烧饼。在北京找了数多地方，没找到卖缸炉烧饼的。流连之际，发现有人跟我一样怀念着家乡不起眼的小吃。遂转载一故乡作家的文章。</p></blockquote>
<blockquote><p><a href="http://www.tudou.com/programs/view/fdSpqc--c3o/" target="_blank">土豆网：缸炉烧饼的介绍</a></p></blockquote>
<p><img src="http://www.waywaycn.com/userfiles/acc_img/2/4/1/p_6_602_071213175750.jpg" alt="缸炉烧饼" /></p>
<p>　　正如到北京不吃全聚德烤鸭就不算到北京一样，如果到了平山不吃缸炉烧饼，那就不能说到过平山。</p>
<p>　　说起平山，可能没几个人知道这个小小的县城，但说起革命圣地西柏坡，恐怕用如雷贯耳来形容一点儿也不过分，而这个大名鼎鼎的西柏坡，就是平山县的一个小村庄。从1990年离开家乡平山，到今年已经整整二十年了。二十年间，家乡的很多东西都如过眼烟云，并没有在我心中留下多少印象。倒是这缸炉烧饼，总如儿时那样的亲切，以至于每次回老家，都回吃上一次，甚至于有亲戚朋友回去，都委托他们带回来几个尝尝鲜。</p>
<p>　　面食里叫烧饼的并不少，无非是放了油盐，和好面后上面沾上芝麻，用锅烙得金黄。但缸炉烧饼却有它的独特之处，一是方形，据我了解，各地的烧饼样式不少，但大部分是圆的，仅有这缸炉烧饼，便便做成了方形，原因当然不得而知，但这便从形状上与其他的烧饼分开了；二是有细分类，大致可分为；普通、油酥、牛肉罩等；三是制作方式不同，大部分烧饼都是用锅烙，而缸炉烧饼却是像烤红薯一样，做好后放在一个铁筒中烘烤。</p>
<p>　　刚出炉的烧饼，表面焦黄，如上中间有一个山包样的大鼓，上面粘着白白的芝麻，咬一口酥中带脆，满口清香，油酥烧饼，更是酥软可口，至于牛肉罩的，是在烧饼的表面放了一层细如肉松的牛肉粒，一口下去，不仅香气四溢，而且烤牛肉的香味久久不散，晚上连牙都舍不得刷了。</p>
<p>　　记得很小的时候，每到赶集，总是跟在家长后面缠着要去，其实也没什么东西可买，只是为了2分钱一个的烧饼，但因为家里条件实在不好，就是这样的要求一年也只能实现有限的几次。于是又求了家长在家里做，面和油都不错，但就是做不出那个味道，但有总比没有的好，吃不上买的，自己做的也可以解一下馋。每年年底，姥爷都会来家里看看，对于他带来的其他东西，我们一概不问，只是找他书包里的那几个缸炉烧饼。久而久之，姥爷每次来，也总会带一包缸炉烧饼来。</p>
<p>　　后来，缸炉烧饼又长到5分一个，一角一个，两角一个，现在，已经是四角一个了。但我对于缸炉烧饼的情节，不仅没有减退，而是越来越浓重了。</p>
<p>　　四个角的缸炉烧饼就像是一座城，一座建在我心中的城，一座没有城门的城。不论走到哪里，我总也无法突破它，也从来没有想过要突破它。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/10/24/%e7%bc%b8%e7%82%89%e7%83%a7%e9%a5%bc.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>密码保护：制定新的学习计划</title>
		<link>http://www.sunboyu.cn/2010/10/17/%e5%88%b6%e5%ae%9a%e6%96%b0%e7%9a%84%e5%ad%a6%e4%b9%a0%e8%ae%a1%e5%88%92.shtml</link>
		<comments>http://www.sunboyu.cn/2010/10/17/%e5%88%b6%e5%ae%9a%e6%96%b0%e7%9a%84%e5%ad%a6%e4%b9%a0%e8%ae%a1%e5%88%92.shtml#comments</comments>
		<pubDate>Sun, 17 Oct 2010 14:35:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1282</guid>
		<description><![CDATA[无法提供任何摘要。这是一篇受保护的文章。]]></description>
			<content:encoded><![CDATA[<form action="http://www.sunboyu.cn/wp-pass.php" method="post">
<p>这是一篇受密码保护的文章。您需要提供访问密码：</p>
<p><label for="pwbox-1282">密码：<br />
<input name="post_password" id="pwbox-1282" type="password" size="20" /></label><br />
<input type="submit" name="Submit" value="提交" /></p></form>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/10/17/%e5%88%b6%e5%ae%9a%e6%96%b0%e7%9a%84%e5%ad%a6%e4%b9%a0%e8%ae%a1%e5%88%92.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>使用Lucene 构建强大的discuz 论坛搜索模块</title>
		<link>http://www.sunboyu.cn/2010/07/27/discuz_lucene.shtml</link>
		<comments>http://www.sunboyu.cn/2010/07/27/discuz_lucene.shtml#comments</comments>
		<pubDate>Tue, 27 Jul 2010 06:21:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[discuz]]></category>

		<category><![CDATA[优化]]></category>

		<category><![CDATA[全文]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1263</guid>
		<description><![CDATA[在我搞完公司的论坛优化后，我一直想写一个圈套的dz性能优化的方案。当时的全文检索使用的是公司内部某人开发的检索系统，没有开源，所以我做此方案来实现。
此文刚打完草稿，处于调试通过的状态。没有形成具体可用的用户文档。希望在这个底稿的基础上，朋友能给予测试和支持，以鼓励我做出一套完整的方案。
下载：lucene_dz
欢迎加入QQ讨论群：41886598
]]></description>
			<content:encoded><![CDATA[<p>在我搞完公司的论坛优化后，我一直想写一个圈套的dz性能优化的方案。当时的全文检索使用的是公司内部某人开发的检索系统，没有开源，所以我做此方案来实现。<br />
此文刚打完草稿，处于调试通过的状态。没有形成具体可用的用户文档。希望在这个底稿的基础上，朋友能给予测试和支持，以鼓励我做出一套完整的方案。</p>
<p>下载：<a href='http://www.sunboyu.cn/upfiles/2010/07/lucene_dz.pdf'>lucene_dz</a></p>
<p>欢迎加入QQ讨论群：41886598</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/07/27/discuz_lucene.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>使用XDEBUG进行PHP性能分析</title>
		<link>http://www.sunboyu.cn/2010/07/22/%e4%bd%bf%e7%94%a8xdebug%e8%bf%9b%e8%a1%8cphp%e6%80%a7%e8%83%bd%e5%88%86%e6%9e%90.shtml</link>
		<comments>http://www.sunboyu.cn/2010/07/22/%e4%bd%bf%e7%94%a8xdebug%e8%bf%9b%e8%a1%8cphp%e6%80%a7%e8%83%bd%e5%88%86%e6%9e%90.shtml#comments</comments>
		<pubDate>Thu, 22 Jul 2010 01:47:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[xdebug]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1259</guid>
		<description><![CDATA[最近给论坛做性能优化，写了一个文档，在线编辑器不好用，就写了个wps文档。
文件下载：使用XDEBUG进行PHP性能分析
]]></description>
			<content:encoded><![CDATA[<p>最近给论坛做性能优化，写了一个文档，在线编辑器不好用，就写了个wps文档。</p>
<p>文件下载：<a href='http://www.sunboyu.cn/upfiles/2010/07/使用XDEBUG进行PHP性能分析.wps'>使用XDEBUG进行PHP性能分析</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/07/22/%e4%bd%bf%e7%94%a8xdebug%e8%bf%9b%e8%a1%8cphp%e6%80%a7%e8%83%bd%e5%88%86%e6%9e%90.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>discuz7.2针对session表的分析和优化</title>
		<link>http://www.sunboyu.cn/2010/07/07/discuz7-2%e9%92%88%e5%af%b9session%e8%a1%a8%e7%9a%84%e5%88%86%e6%9e%90%e5%92%8c%e4%bc%98%e5%8c%96.shtml</link>
		<comments>http://www.sunboyu.cn/2010/07/07/discuz7-2%e9%92%88%e5%af%b9session%e8%a1%a8%e7%9a%84%e5%88%86%e6%9e%90%e5%92%8c%e4%bc%98%e5%8c%96.shtml#comments</comments>
		<pubDate>Wed, 07 Jul 2010 09:04:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[discuz]]></category>

		<category><![CDATA[session表]]></category>

		<category><![CDATA[优化]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1245</guid>
		<description><![CDATA[广告时间：新建一个qq群，欢迎大家进来讨论discuz的性能优化  qq群 41886598  接头暗号：dz
引子
最近一个朋友的论坛由discuz转化为phpwind，因为discuz在负载较大的情况下频频当机，但在我观察，瓶颈基本是数据库，并且负载最高的表定位为sessions表。之前我们论坛在进行了大的改进后，除了分表这些基本优化，改动最大的就是sessions表。我们使用张宴写的tcsql来存储用户的session信息，经推算，系统负载应该能支撑10~20w人同时在线。
这个10~20w人只是推测，因为原来我们优化sessions表但没有切换到tcsql的时候，最高支撑到4~6w人-也就是某次游戏临时维护，用户大量涌向论坛，在大概4~6w用户的情况下，论坛崩溃。而tcsq的读写效率远远高于mysql，因此推算tcsql代替sessions表的情况下，论坛至少可以承载10~20w人同时在线。
毕竟tcsql用C进行开发，而且没有开源。去年的文章发表后，一直有朋友在探讨dz的优化问题，但那几个方案都依赖了第三方的应用。这次，我想到的是在不依赖其他应用的前提下，完成dz的sessions表优化。
这里，我对sessions表的访问情况作了一个统计：
一个没访问过的论坛，我作为一个用户：1、进入首页 2、ajax登录 3、进入某板块 4、点击某帖子。4个操作，统计session表的操作：select 5次，insert 2次，delete 2次，update，3次，select联查，4次，一共16次操作。对于一个成熟的网站，大部分用户的操作连起来，统计数据跟我统计的会有区别，但从全局看来，sessions表的确是mysql查询数的一个瓶颈。
以子之矛
对于这个问题，dz程序其实是有解决方案的。
if($pvfrequence &#38;amp;&#38;amp; $discuz_uid) {
if($spageviews &#38;gt;= $pvfrequence) {
$pageviewsadd = ', pageviews=\'0\'';
$db-&#38;gt;query(&#34;UPDATE {$tablepre}members SET pageviews=pageviews+'$spageviews' WHERE uid='$discuz_uid'&#34;, 'UNBUFFERED');
} else {
$pageviewsadd = ', pageviews=pageviews+1';
}
} else {
$pageviewsadd = '';
}
这个功能是统计用户浏览量的一个小东西，$spageviews是保存在用户session表的一个变量，如果每次浏览都更新用户表的浏览数，member表的负担是很大的。dz的程序员就用客户端更新数据这种方式，把数据更新动作放在了session表，每$spageviews个周期更新一次，有效降低了member表压力，而且此配置在网站后台作出了用户接口。
为什么这个问题可以解决，只不过把压力进行了转移，而sessions表的压力为什么不能解决一下呢？我百思不得其解。
攻子之盾
member的压力可以转移到sessions表，当然sessions表的压力就不能再转移给别的表了，这样处理，不管转移到哪里，都是数据库的压力，所以，得想办法转移到数据库之外。
再考虑为什么member的压力可以转移：因为用户浏览数这个统计项，用户每必要也不需要实时看到更新。
而用户的session信息是用户实时要用，并且有部分权限控制方面的东西，是非常必要的，所以，必须实时获取。既然其他表的压力也都来了sessions表，那更新也必然需要在sessions表中做。这个事情，不就是php的session应该做的事情么？
再考虑sessions表除模拟php的session功能外的其他功能：
1、状态传递：需要把用户的当前状态实时传递给其他用户。在线状态、用户所在位置等。
2、统计分析：在dz可以看到当前多少用户在线，对于单纯使用php session功能是无法满足的，故dz采用sessions表来替代这个功能。
现在就设计一个机制，既满足用户session的功能，又满足统计分析的功能。当然，用php+mysql了。需要及时更新的信息存储于php的session，而需要统计的信息分阶段更新到mysql。
流程如此 用户创建一个mysql记录，创建一个session，session的过期机制类似于mysql表。每次访问，取session信息，如果session信息不存在，取sessions表中的信息。像用户浏览次数这类数据，可以每过一段时间更新到mysql中。用户session每次更新，也只是更新session数据，而session机制的并发性和效率，远远高于mysql的。如此解决，既不阉割原有的功能，又不会对环境造成很严重的依赖，只要支持phpsession的环境即可。
总结
在修改完成后，我又进行了测试，这次session表的访问频度已经降到了原来的1/3之下，我想，对于大型的论坛，起码能节约1/3的服务器吧。这样改动也并不是没有缺点的：统计就会有延迟和偏差。因为中间用户突然离开，会损失sessions表更新的及时性甚至会损失这部分数据。如果严重依赖论坛自己某些统计功能的话，那这种方式欠妥，但对于已经使用第三方统计或者对那部分数据不很敏感的论坛用户，这种方案还是非常适合的。
附言：dz的大多数产品设计都采用sessions表这种设计思路，因此，这个思路可以优化几乎所有的dz产品。
tips：如何定位sessions表的负载： 在mysql数据类的query方法里增加如下代码,数据少可以用肉眼数，数据多可以写个脚本去分析
$handle = fopen(&#34;sql.log&#34;,&#34;a+&#34;);
fwrite($handle,str_replace(&#34;\r\n&#34;,&#34;&#34;,$sql).&#34;\r\n&#34;);
fclose($handle);
附上代码：
dz
]]></description>
			<content:encoded><![CDATA[<p>广告时间：新建一个qq群，欢迎大家进来讨论discuz的性能优化  qq群 41886598  接头暗号：dz</p>
<h1>引子</h1>
<p>最近一个朋友的论坛由discuz转化为phpwind，因为discuz在负载较大的情况下频频当机，但在我观察，瓶颈基本是数据库，并且负载最高的表定位为sessions表。之前我们论坛在进行了大的改进后，除了分表这些基本优化，改动最大的就是sessions表。我们使用张宴写的tcsql来存储用户的session信息，经推算，系统负载应该能支撑10~20w人同时在线。</p>
<p>这个10~20w人只是推测，因为原来我们优化sessions表但没有切换到tcsql的时候，最高支撑到4~6w人-也就是某次游戏临时维护，用户大量涌向论坛，在大概4~6w用户的情况下，论坛崩溃。而tcsq的读写效率远远高于mysql，因此推算tcsql代替sessions表的情况下，论坛至少可以承载10~20w人同时在线。<br />
毕竟tcsql用C进行开发，而且没有开源。去年的文章发表后，一直有朋友在探讨dz的优化问题，但那几个方案都依赖了第三方的应用。这次，我想到的是在不依赖其他应用的前提下，完成dz的sessions表优化。</p>
<p>这里，我对sessions表的访问情况作了一个统计：</p>
<p>一个没访问过的论坛，我作为一个用户：1、进入首页 2、ajax登录 3、进入某板块 4、点击某帖子。4个操作，统计session表的操作：select 5次，insert 2次，delete 2次，update，3次，select联查，4次，一共16次操作。对于一个成熟的网站，大部分用户的操作连起来，统计数据跟我统计的会有区别，但从全局看来，sessions表的确是mysql查询数的一个瓶颈。</p>
<h1>以子之矛</h1>
<p>对于这个问题，dz程序其实是有解决方案的。</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">if($pvfrequence &amp;amp;&amp;amp; $discuz_uid) {</li>
<li>if($spageviews &amp;gt;= $pvfrequence) {</li>
<li>$pageviewsadd = ', pageviews=\'0\'';</li>
<li>$db-&amp;gt;query(&quot;UPDATE {$tablepre}members SET pageviews=pageviews+'$spageviews' WHERE uid='$discuz_uid'&quot;, 'UNBUFFERED');</li>
<li>} else {</li>
<li>$pageviewsadd = ', pageviews=pageviews+1';</li>
<li>}</li>
<li>} else {</li>
<li>$pageviewsadd = '';</li>
<li>}</li></ol></div>
<p>这个功能是统计用户浏览量的一个小东西，$spageviews是保存在用户session表的一个变量，如果每次浏览都更新用户表的浏览数，member表的负担是很大的。dz的程序员就用客户端更新数据这种方式，把数据更新动作放在了session表，每$spageviews个周期更新一次，有效降低了member表压力，而且此配置在网站后台作出了用户接口。</p>
<p>为什么这个问题可以解决，只不过把压力进行了转移，而sessions表的压力为什么不能解决一下呢？我百思不得其解。</p>
<h1>攻子之盾</h1>
<p>member的压力可以转移到sessions表，当然sessions表的压力就不能再转移给别的表了，这样处理，不管转移到哪里，都是数据库的压力，所以，得想办法转移到数据库之外。</p>
<p>再考虑为什么member的压力可以转移：因为用户浏览数这个统计项，用户每必要也不需要实时看到更新。</p>
<p>而用户的session信息是用户实时要用，并且有部分权限控制方面的东西，是非常必要的，所以，必须实时获取。既然其他表的压力也都来了sessions表，那更新也必然需要在sessions表中做。这个事情，不就是php的session应该做的事情么？</p>
<p>再考虑sessions表除模拟php的session功能外的其他功能：</p>
<p>1、状态传递：需要把用户的当前状态实时传递给其他用户。在线状态、用户所在位置等。</p>
<p>2、统计分析：在dz可以看到当前多少用户在线，对于单纯使用php session功能是无法满足的，故dz采用sessions表来替代这个功能。</p>
<p>现在就设计一个机制，既满足用户session的功能，又满足统计分析的功能。当然，用php+mysql了。需要及时更新的信息存储于php的session，而需要统计的信息分阶段更新到mysql。</p>
<p>流程如此 用户创建一个mysql记录，创建一个session，session的过期机制类似于mysql表。每次访问，取session信息，如果session信息不存在，取sessions表中的信息。像用户浏览次数这类数据，可以每过一段时间更新到mysql中。用户session每次更新，也只是更新session数据，而session机制的并发性和效率，远远高于mysql的。如此解决，既不阉割原有的功能，又不会对环境造成很严重的依赖，只要支持phpsession的环境即可。</p>
<h1>总结</h1>
<p>在修改完成后，我又进行了测试，这次session表的访问频度已经降到了原来的1/3之下，我想，对于大型的论坛，起码能节约1/3的服务器吧。这样改动也并不是没有缺点的：统计就会有延迟和偏差。因为中间用户突然离开，会损失sessions表更新的及时性甚至会损失这部分数据。如果严重依赖论坛自己某些统计功能的话，那这种方式欠妥，但对于已经使用第三方统计或者对那部分数据不很敏感的论坛用户，这种方案还是非常适合的。</p>
<p>附言：dz的大多数产品设计都采用sessions表这种设计思路，因此，这个思路可以优化几乎所有的dz产品。</p>
<p>tips：如何定位sessions表的负载： 在mysql数据类的query方法里增加如下代码,数据少可以用肉眼数，数据多可以写个脚本去分析</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">$handle = fopen(&quot;sql.log&quot;,&quot;a+&quot;);</li>
<li>fwrite($handle,str_replace(&quot;\r\n&quot;,&quot;&quot;,$sql).&quot;\r\n&quot;);</li>
<li>fclose($handle);</li></ol></div>
<p>附上代码：</p>
<p><a href='http://www.sunboyu.cn/upfiles/2010/07/dz.rar'>dz</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/07/07/discuz7-2%e9%92%88%e5%af%b9session%e8%a1%a8%e7%9a%84%e5%88%86%e6%9e%90%e5%92%8c%e4%bc%98%e5%8c%96.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>最近的感想</title>
		<link>http://www.sunboyu.cn/2010/06/05/%e6%9c%80%e8%bf%91%e7%9a%84%e6%84%9f%e6%83%b3.shtml</link>
		<comments>http://www.sunboyu.cn/2010/06/05/%e6%9c%80%e8%bf%91%e7%9a%84%e6%84%9f%e6%83%b3.shtml#comments</comments>
		<pubDate>Sat, 05 Jun 2010 12:25:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1238</guid>
		<description><![CDATA[1、我总在努力学习，学习技术。技术好有用么？有用。但能干好活么？态度。
2、第二个目标-让自己坚持。坚持自己的技术方向，这个我做到了，在工作中能不能做到，问号？叹号。做得不够。
3、尊重别人的劳动成果。无论是工作中还是生活中。
4、三人行必有我师。高手往往低调。
5、买书是比较廉价的学习方式。
]]></description>
			<content:encoded><![CDATA[<p>1、我总在努力学习，学习技术。技术好有用么？有用。但能干好活么？态度。</p>
<p>2、第二个目标-让自己坚持。坚持自己的技术方向，这个我做到了，在工作中能不能做到，问号？叹号。做得不够。</p>
<p>3、尊重别人的劳动成果。无论是工作中还是生活中。</p>
<p>4、三人行必有我师。高手往往低调。</p>
<p>5、买书是比较廉价的学习方式。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/06/05/%e6%9c%80%e8%bf%91%e7%9a%84%e6%84%9f%e6%83%b3.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>配置php下的mysql连接池-sqlrelay</title>
		<link>http://www.sunboyu.cn/2010/05/20/%e9%85%8d%e7%bd%aephp%e4%b8%8b%e7%9a%84mysql%e8%bf%9e%e6%8e%a5%e6%b1%a0-sqlrelay.shtml</link>
		<comments>http://www.sunboyu.cn/2010/05/20/%e9%85%8d%e7%bd%aephp%e4%b8%8b%e7%9a%84mysql%e8%bf%9e%e6%8e%a5%e6%b1%a0-sqlrelay.shtml#comments</comments>
		<pubDate>Thu, 20 May 2010 14:13:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1225</guid>
		<description><![CDATA[本文主要介绍sqlrelay的配置安装。通过其性能和一些具体环境的测试来帮助开发者应用在相应的场合中去应付大并发的mysql数据库连接。
什么是sqlrelay？
Sqlrelay是一个开源的数据库连接池软件。它可以预建立数据库连接，同时可作为数据库连接代理和负载均衡器使用。
SQL Relay is a persistent database connection pooling, proxying and load balancing system for Unix and Linux.
Sqlrelay项目主页  http://sqlrelay.sourceforge.net/
Sqlrelay源码下载  http://sqlrelay.sourceforge.net/download.html
Sqlrelay原理示意：
连接池示意图：

负载均衡示意图：

1、	sqlrelay的安装
下载源代码（因为不能yum或者apt-get）
#wget http://prdownloads.sourceforge.net/sqlrelay/sqlrelay-0.41.tar.gz?download
解压缩
#tar –zxvf sqlrelay-0.41.tar.gz
配置
#cd sqlrelay-0.41
#./configure &#8211;prefix=/opt/sqlrelay &#8211;with-mysql-prefix=/opt/mysql-5.0.22 &#8211;with-php-prefix=/opt/php-5.2.6 &#8211;disable-python
注释：因为我用的python版本跟sqlrelay版本稍有纠结，所以显式得去声明不增加python下的api。
为啥我软件编译目标路径是/opt，我也不知道，也许第一次看见某人这么做的，我也就一直这么做。大家别问了，没啥道理，其实编译到 /shit 下边，也不影响正常的运行。
查看编译好的文件：
#cd /opt/sqlrelay
#ls
Bin  etc  include  lib  share  var
如果出现下列目录，安装“基本完毕”。
2、	sqlrelay的配置
sqlrelay有个问题，如果指定了prefix，而$prefix/bin/目录如果不在环境变量中，则主进程运行是有问题的。因为，编译完后，我们在/etc/profile中增加一条命令：
PATH=$PATH:/opt/sqlrelay/bin      #此目录就是你prefix的目录
配置文件：
&#60; ?xml version=&#34;1.0&#34;?&#62;
&#60; !DOCTYPE instances SYSTEM &#34;sqlrelay.dtd&#34;&#62;
&#60;instances&#62;
	&#60;instance id=&#34;mysqlpool&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>本文主要介绍sqlrelay的配置安装。通过其性能和一些具体环境的测试来帮助开发者应用在相应的场合中去应付大并发的mysql数据库连接。</p>
<p>什么是sqlrelay？</p>
<p>Sqlrelay是一个开源的数据库连接池软件。它可以预建立数据库连接，同时可作为数据库连接代理和负载均衡器使用。</p>
<blockquote><p>SQL Relay is a persistent database connection pooling, proxying and load balancing system for Unix and Linux.</p></blockquote>
<p>Sqlrelay项目主页  http://sqlrelay.sourceforge.net/<br />
Sqlrelay源码下载  http://sqlrelay.sourceforge.net/download.html</p>
<p>Sqlrelay原理示意：</p>
<p>连接池示意图：</p>
<p><a href="http://www.sunboyu.cn/upfiles/2010/05/2009817122917215.png"><img class="aligncenter size-full wp-image-1227" title="pool" src="http://www.sunboyu.cn/upfiles/2010/05/2009817122917215.png" alt="pool" width="157" height="114" /></a></p>
<p>负载均衡示意图：</p>
<p><a href="http://www.sunboyu.cn/upfiles/2010/05/router.png"><img class="aligncenter size-full wp-image-1228" title="router" src="http://www.sunboyu.cn/upfiles/2010/05/router.png" alt="router" width="208" height="185" /></a></p>
<p>1、	sqlrelay的安装</p>
<p>下载源代码（因为不能yum或者apt-get）<br />
#wget http://prdownloads.sourceforge.net/sqlrelay/sqlrelay-0.41.tar.gz?download<br />
解压缩<br />
#tar –zxvf sqlrelay-0.41.tar.gz<br />
配置<br />
#cd sqlrelay-0.41<br />
#./configure &#8211;prefix=/opt/sqlrelay &#8211;with-mysql-prefix=/opt/mysql-5.0.22 &#8211;with-php-prefix=/opt/php-5.2.6 &#8211;disable-python<br />
注释：因为我用的python版本跟sqlrelay版本稍有纠结，所以显式得去声明不增加python下的api。<br />
为啥我软件编译目标路径是/opt，我也不知道，也许第一次看见某人这么做的，我也就一直这么做。大家别问了，没啥道理，其实编译到 /shit 下边，也不影响正常的运行。<br />
查看编译好的文件：<br />
#cd /opt/sqlrelay<br />
#ls<br />
Bin  etc  include  lib  share  var<br />
如果出现下列目录，安装“基本完毕”。<br />
2、	sqlrelay的配置<br />
sqlrelay有个问题，如果指定了prefix，而$prefix/bin/目录如果不在环境变量中，则主进程运行是有问题的。因为，编译完后，我们在/etc/profile中增加一条命令：<br />
PATH=$PATH:/opt/sqlrelay/bin      #此目录就是你prefix的目录</p>
<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">&lt; ?xml version=&quot;1.0&quot;?&gt;</li>
<li>&lt; !DOCTYPE instances SYSTEM &quot;sqlrelay.dtd&quot;&gt;</li>
<li>&lt;instances&gt;</li>
<li>	&lt;instance id=&quot;mysqlpool&quot; port=&quot;9002&quot; socket=&quot;/tmp/sqlrelay.socket&quot; dbase=&quot;mysql&quot; connections=&quot;20&quot; maxconnections=&quot;50&quot; maxqueuelength=&quot;5&quot; growby=&quot;1&quot; ttl=&quot;60&quot; maxsessioncount=&quot;10&quot; endofsession=&quot;commit&quot; sessiontimeout=&quot;600&quot; runasuser=&quot;nobody&quot; runasgroup=&quot;nobody&quot; cursors=&quot;5&quot; authtier=&quot;listener&quot; handoff=&quot;pass&quot; deniedips=&quot;&quot; allowedips=&quot;&quot; debug=&quot;none&quot; maxquerysize=&quot;65536&quot; maxstringbindvaluelength=&quot;4000&quot; maxlobbindvaluelength=&quot;71680&quot; idleclienttimeout=&quot;-1&quot; maxlisteners=&quot;-1&quot; listenertimeout=&quot;0&quot; reloginatstart=&quot;no&quot; timequeriessec=&quot;-1&quot; timequeriesusec=&quot;-1&quot;&gt;</li>
<li>	&lt;/instance&gt;</li>
<li>&lt;/instances&gt;</li></ol></div>
<p>这样，就配置了一个id为mysqlpool的连接池。<br />
Port=9002  sqlrelay提供服务的端口是 9002<br />
Dbase=mysql 要连接mysql<br />
Connections=20 起始创建20个连接<br />
Maxconnections=50 最大连接数 50<br />
其他参数可以自己琢磨，在具体应用中还需要修改后边的参数，都啥含义，看字面或者看手册皆可。</p>
<p>启动sqlrelay：<br />
#./sqlr-start –id mysqlpool   //启动刚才定义的id为mysqlpool的连接池<br />
关闭sqlrelay<br />
#./sqlr-stop</p>
<p>3、	sqlrelayPHP api的配置</p>
<p>sqlrelay的PHP api扩展在编译的时候已经生成，在php的./lib/php/extensions/no-debug-non-zts-20060613/ 目录下，修改php.ini中extension_dir的值：extension_dir=”/opt/php-5.2.6/lib/php/extensions/no-debug-non-zts-20060613/”<br />
而后增加引用声明：extension=sql_relay.so</p>
<p>重启php，执行 php –m 查看是否有 sql_relay 如果有，则证明配置成功。</p>
<p>4、sqlrelay的使用</p>
<p>$con=sqlrcon_alloc(“mysqlpool”,9002,””,”root”,”123456”,0,1);<br />
Var_dump($con);</p>
<p>这样，利用sqlrelay的phpapi，就可以跟mysql建立链接。</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>另求高并发的测试环境搭建方案，有经验的朋友可以提供相关信息。注：本人只有非常SB的惠普V3000系列高发热强雪花屏笔记本一台做测试环境。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/05/20/%e9%85%8d%e7%bd%aephp%e4%b8%8b%e7%9a%84mysql%e8%bf%9e%e6%8e%a5%e6%b1%a0-sqlrelay.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>iostat安装</title>
		<link>http://www.sunboyu.cn/2010/05/10/iostat%e5%ae%89%e8%a3%85.shtml</link>
		<comments>http://www.sunboyu.cn/2010/05/10/iostat%e5%ae%89%e8%a3%85.shtml#comments</comments>
		<pubDate>Mon, 10 May 2010 02:42:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1220</guid>
		<description><![CDATA[原来一直以为iostat跟iftop一样是独立的安装包，后google发现是一个工具包中的工具，叫systat。
下载地址：http://pagesperso-orange.fr/sebastien.godard/download.html
使用说明书 http://pagesperso-orange.fr/sebastien.godard/man_iostat.html
]]></description>
			<content:encoded><![CDATA[<p>原来一直以为iostat跟iftop一样是独立的安装包，后google发现是一个工具包中的工具，叫systat。</p>
<p>下载地址：<a href="http://pagesperso-orange.fr/sebastien.godard/download.html">http://pagesperso-orange.fr/sebastien.godard/download.html</a></p>
<p>使用说明书 <a href="http://pagesperso-orange.fr/sebastien.godard/man_iostat.html">http://pagesperso-orange.fr/sebastien.godard/man_iostat.html</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/05/10/iostat%e5%ae%89%e8%a3%85.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>samba配置小结</title>
		<link>http://www.sunboyu.cn/2010/05/06/samba%e9%85%8d%e7%bd%ae%e5%b0%8f%e7%bb%93.shtml</link>
		<comments>http://www.sunboyu.cn/2010/05/06/samba%e9%85%8d%e7%bd%ae%e5%b0%8f%e7%bb%93.shtml#comments</comments>
		<pubDate>Thu, 06 May 2010 05:18:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1218</guid>
		<description><![CDATA[最近想把本本彻底改成linux，前期准备就是要适应一切能想到的应用。跟台式的文件交互，ftp、ssh都可以，但还是觉得共享会方便，于是配置了一下samba。
本子上的系统用的是centos5.4 X64，samba软件是使用命令 yum install samba 进行安装。
首先，启动关闭samba命令
service smb start
service smb restart
service smb stop
首先配置一个公共的读写目录
mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
touch /etc/samba/smb.conf
#smb.conf 内容为
[global]
workgroup = home
netbios name = notebook
server string = Samba Server
security = share
[public]
path = /home/public
browseable = yes
writeable = yes
guest ok = yes
public = yes
force user = nobody
force group = nobody
重启samba后，在windows中运行(局域网互联) 敲入 \\ip 则可以看到public共享目录
如果增加权限验证，则需要增加用户信息：samba用以下两个命令来增加用户信息
smbadduser&#160; &#160;//增加用户
mbpasswd&#160; &#160; &#160;//增加密码
配置文件如下
[global]
workgroup = ksgdfa
netbios name = ksgfdsa
server [...]]]></description>
			<content:encoded><![CDATA[<p>最近想把本本彻底改成linux，前期准备就是要适应一切能想到的应用。跟台式的文件交互，ftp、ssh都可以，但还是觉得共享会方便，于是配置了一下samba。</p>
<p>本子上的系统用的是centos5.4 X64，samba软件是使用命令 yum install samba 进行安装。</p>
<p>首先，启动关闭samba命令</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">service smb start</li>
<li>service smb restart</li>
<li>service smb stop</li></ol></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">mv /etc/samba/smb.conf /etc/samba/smb.conf.bak</li>
<li>touch /etc/samba/smb.conf</li>
<li>#smb.conf 内容为</li>
<li>[global]</li>
<li>workgroup = home</li>
<li>netbios name = notebook</li>
<li>server string = Samba Server</li>
<li>security = share</li>
<li>[public]</li>
<li>path = /home/public</li>
<li>browseable = yes</li>
<li>writeable = yes</li>
<li>guest ok = yes</li>
<li>public = yes</li>
<li>force user = nobody</li>
<li>force group = nobody</li></ol></div>
<p>重启samba后，在windows中运行(局域网互联) 敲入 \\ip 则可以看到public共享目录</p>
<p>如果增加权限验证，则需要增加用户信息：samba用以下两个命令来增加用户信息</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">smbadduser&nbsp; &nbsp;//增加用户</li>
<li>mbpasswd&nbsp; &nbsp; &nbsp;//增加密码</li></ol></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">[global]</li>
<li>workgroup = ksgdfa</li>
<li>netbios name = ksgfdsa</li>
<li>server string = Samba Server</li>
<li>security = share</li>
<li>encrypt passwords = yes</li>
<li>smb passwd file = /etc/samba/smbpasswd</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>[public]</li>
<li>path = /home/public</li>
<li>browseable = yes</li>
<li>writeable = yes</li>
<li>guest ok = yes</li>
<li>public = yes</li>
<li>force user = nobody</li>
<li>force group = nobody</li>
<li>&nbsp;</li>
<li>[sunboyu]</li>
<li>path = /opt/samba/sunboyu</li>
<li>browseable = yes</li>
<li>writeable = yes</li></ol></div>
<p>补充：其中，公共目录的权限，用配置成 nobody:nobody  777<br />
而 sunboyu 目录的权限，则配置成 sunboyu:sunboyu 777</p>
<p>tips：如果配置成功后，一直无法写入文件，则检查是否关闭selinux，如果没关闭，关闭即可。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/05/06/samba%e9%85%8d%e7%bd%ae%e5%b0%8f%e7%bb%93.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>rsync使用小结</title>
		<link>http://www.sunboyu.cn/2010/04/17/rsync%e4%bd%bf%e7%94%a8%e5%b0%8f%e7%bb%93.shtml</link>
		<comments>http://www.sunboyu.cn/2010/04/17/rsync%e4%bd%bf%e7%94%a8%e5%b0%8f%e7%bb%93.shtml#comments</comments>
		<pubDate>Sat, 17 Apr 2010 14:28:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1206</guid>
		<description><![CDATA[多台服务器使用，难免用到同步，工作中大量接触的是rsync，简单测试了一下其命令和应用。
rsync官方主页：  http://samba.anu.edu.au/rsync/  下载地址为：http://samba.anu.edu.au/ftp/rsync/rsync-3.0.7.tar.gz
安装：
./configure --prefix=/opt/rsync-3.0.7
make
make install
默认好像没有生成配置文件，创建 
vi /etc/rsync.conf
//填入以下内容
uid=nobody
gid=nobody
max connections=3
use chroot=no
log file=/var/log/rsyncd.log
pid file=/var/run/rsyncd.pid
lock file=/var/run/rsyncd.lock
测试的两台主机：192.168.0.20  192.168.0.30
在192.168.0.30的/etc/rsync.conf下增加以下代码
[test]&#160; &#160; &#160; &#160;//定义一个域
path=/root/test
comment=test folder
uid=root
ignore errors
read only=no
list=no
然后测试两个命令
1、把192.168.0.20上的 /root/source 目录同步到 192.168.0.30 的 /root/test上
/opt/rsync-3.0.7/bin/rsync -vazu &#8211;progress   /root/source 192.168.0.30::test
2、从192.168.0.30 的 /root/test 同步到 192.168.0.20上的/root/test
/opt/rsync-3.0.7/bin/rsync -vzrtopg &#8211;progress  192.168.0.30::test /root/test
配置权限：
在192.168.0.30上vi /etc/rsycnpass 然后 echo test:123456 >> /etc/rsycnpass
配置文件修改为
secrets file = /etc/rsyncpass
[test]&#160; &#160; &#160; &#160;//定义一个域
path=/root/test
comment=test folder
uid=root
ignore [...]]]></description>
			<content:encoded><![CDATA[<p>多台服务器使用，难免用到同步，工作中大量接触的是rsync，简单测试了一下其命令和应用。</p>
<p>rsync官方主页：  http://samba.anu.edu.au/rsync/  下载地址为：http://samba.anu.edu.au/ftp/rsync/rsync-3.0.7.tar.gz</p>
<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">./configure --prefix=/opt/rsync-3.0.7</li>
<li>make</li>
<li>make install</li></ol></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">vi /etc/rsync.conf</li>
<li>//填入以下内容</li>
<li>uid=nobody</li>
<li>gid=nobody</li>
<li>max connections=3</li>
<li>use chroot=no</li>
<li>log file=/var/log/rsyncd.log</li>
<li>pid file=/var/run/rsyncd.pid</li>
<li>lock file=/var/run/rsyncd.lock</li></ol></div>
<p>测试的两台主机：192.168.0.20  192.168.0.30</p>
<p>在192.168.0.30的/etc/rsync.conf下增加以下代码</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">[test]&nbsp; &nbsp; &nbsp; &nbsp;//定义一个域</li>
<li>path=/root/test</li>
<li>comment=test folder</li>
<li>uid=root</li>
<li>ignore errors</li>
<li>read only=no</li>
<li>list=no</li></ol></div>
<p>然后测试两个命令<br />
1、把192.168.0.20上的 /root/source 目录同步到 192.168.0.30 的 /root/test上<br />
/opt/rsync-3.0.7/bin/rsync -vazu &#8211;progress   /root/source 192.168.0.30::test<br />
2、从192.168.0.30 的 /root/test 同步到 192.168.0.20上的/root/test<br />
/opt/rsync-3.0.7/bin/rsync -vzrtopg &#8211;progress  192.168.0.30::test /root/test</p>
<p>配置权限：<br />
在192.168.0.30上vi /etc/rsycnpass 然后 echo test:123456 >> /etc/rsycnpass<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">secrets file = /etc/rsyncpass</li>
<li>[test]&nbsp; &nbsp; &nbsp; &nbsp;//定义一个域</li>
<li>path=/root/test</li>
<li>comment=test folder</li>
<li>uid=root</li>
<li>ignore errors</li>
<li>read only=no</li>
<li>list=no</li>
<li>auth users=test</li></ol></div>
<p>则上边命令1修改为 /opt/rsync-3.0.7/bin/rsync -vazu &#8211;progress   /root/source test@192.168.0.30::test<br />
命令2改为 /opt/rsync-3.0.7/bin/rsync -vzrtopg &#8211;progress  test@192.168.0.30::test /root/test</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/04/17/rsync%e4%bd%bf%e7%94%a8%e5%b0%8f%e7%bb%93.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>关于一些网站登录穿越(账号改变&#124;登录变成他人)的问题研究</title>
		<link>http://www.sunboyu.cn/2010/03/30/discuz%e8%b4%a6%e5%8f%b7%e6%b7%b7%e4%b9%b1%e9%97%ae%e9%a2%98%e7%a0%94%e7%a9%b6.shtml</link>
		<comments>http://www.sunboyu.cn/2010/03/30/discuz%e8%b4%a6%e5%8f%b7%e6%b7%b7%e4%b9%b1%e9%97%ae%e9%a2%98%e7%a0%94%e7%a9%b6.shtml#comments</comments>
		<pubDate>Tue, 30 Mar 2010 06:13:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[相当拍砖]]></category>

		<category><![CDATA[账号改变]]></category>

		<category><![CDATA[账号穿越]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1199</guid>
		<description><![CDATA[最近论坛发生了一些问题，某用户A登录后变成了某用户B。此事在某阶段频繁发生。在排除了账号服务器的问题、程序自身问题后，在网上又发现类似现象：
淘宝账号诡异事件：
http://diybbs.it168.com/viewthread.php?tid=593134&#038;extra=&#038;page=1

我点到我自己的淘宝里面，进入了一个陌生女子的界面
不过这个bug只出现了一次
这个人我已经加上了，是个卖魔方的
卡巴斯基中文官网论坛账号诡异事件：
http://bbs.kaspersky.com.cn/viewthread.php?tid=15891
有登录论坛出现别人信息的会员请进这个问题，论坛上已经有不少会员碰到。管理员正在设法解决这个问题。凡是出现这种情况的，请在下面回帖，向管理员详细说明以下情况，帮助管理员更快解决问题
1、出现问题的频率和条件
2、进入论坛的方式（例如是收藏夹进入、直接输入网址进入……）
3、论坛登录名和密码的保存方式（每次输入，不保存；按照多少时间保存）
4、有无别人和你共用电脑
5、使用的浏览器，及其版本
6、有无采取清除缓存文件，清除Cookies的措施，效果如何？
7、除以上措施外，有没有采取过其他措施，效果如何？
GMAIL账号诡异事件：
http://www.gseeker.com/50226711/aecceaecgmaileaeieie_139265.php

看到这个标题，你可能会认为这是天方夜谭。但事实上，这是完全有可能发生的。某天，你在登录Gmail时，尽管你100%正确地输入了自己的用户名及密码，但出现在你眼前的却是别人的Gmail邮箱。如果你第一时间怀疑自己的眼睛，那你就冤枉它了。因为至少在科威特，部分Gmail用户本周就经历了这样的怪事。

通过这些事件的观察，和对一些论坛账号发生错误的账户主人的询问，基本确定了以下几个可能点：
1、缓存的错误。因为discuz使用cookie进行身份认证，而一些代理缓存了cookie头，造成一个cache多人使用造成的问题。http://bbs.chinaunix.net/viewthread.php?tid=837214
2、依然是缓存的问题。只不过这个缓存可以存在于cn大局域网，或者某些ISP，比如google的例子，或者某些地区的服务商，抑或……
您是通过什么网络上的淘宝，据我所知，移动的浙江固网宽带出现过类似的严重安全隐患。宽带网络运营商的问题很大（强制建立缓存代理服务器，缓存不该缓存的网页），网站的问题是其次的。或者说，在那种情况下，绝大多数网站用户都会出现“穿越”现象。
    如果被你穿越的人和你斗处在同一城市，基本上就是这个原因了。
解决方法，且听下次分解。
如果您的网站出现类似问题，欢迎加我qq176300676一起收集数据样本进行分析
亦可加入msn讨论群 lampper@live.cn
]]></description>
			<content:encoded><![CDATA[<p>最近论坛发生了一些问题，某用户A登录后变成了某用户B。此事在某阶段频繁发生。在排除了账号服务器的问题、程序自身问题后，在网上又发现类似现象：<br />
淘宝账号诡异事件：<br />
http://diybbs.it168.com/viewthread.php?tid=593134&#038;extra=&#038;page=1</p>
<blockquote><p>
我点到我自己的淘宝里面，进入了一个陌生女子的界面<br />
不过这个bug只出现了一次<br />
这个人我已经加上了，是个卖魔方的</p></blockquote>
<p>卡巴斯基中文官网论坛账号诡异事件：<br />
http://bbs.kaspersky.com.cn/viewthread.php?tid=15891</p>
<blockquote><p>有登录论坛出现别人信息的会员请进这个问题，论坛上已经有不少会员碰到。管理员正在设法解决这个问题。凡是出现这种情况的，请在下面回帖，向管理员详细说明以下情况，帮助管理员更快解决问题<br />
1、出现问题的频率和条件<br />
2、进入论坛的方式（例如是收藏夹进入、直接输入网址进入……）<br />
3、论坛登录名和密码的保存方式（每次输入，不保存；按照多少时间保存）<br />
4、有无别人和你共用电脑<br />
5、使用的浏览器，及其版本<br />
6、有无采取清除缓存文件，清除Cookies的措施，效果如何？<br />
7、除以上措施外，有没有采取过其他措施，效果如何？</p></blockquote>
<p>GMAIL账号诡异事件：<br />
http://www.gseeker.com/50226711/aecceaecgmaileaeieie_139265.php</p>
<blockquote><p>
看到这个标题，你可能会认为这是天方夜谭。但事实上，这是完全有可能发生的。某天，你在登录Gmail时，尽管你100%正确地输入了自己的用户名及密码，但出现在你眼前的却是别人的Gmail邮箱。如果你第一时间怀疑自己的眼睛，那你就冤枉它了。因为至少在科威特，部分Gmail用户本周就经历了这样的怪事。
</p></blockquote>
<p>通过这些事件的观察，和对一些论坛账号发生错误的账户主人的询问，基本确定了以下几个可能点：</p>
<p>1、缓存的错误。因为discuz使用cookie进行身份认证，而一些代理缓存了cookie头，造成一个cache多人使用造成的问题。http://bbs.chinaunix.net/viewthread.php?tid=837214</p>
<p>2、依然是缓存的问题。只不过这个缓存可以存在于cn大局域网，或者某些ISP，比如google的例子，或者某些地区的服务商，抑或……</p>
<blockquote><p>您是通过什么网络上的淘宝，据我所知，移动的浙江固网宽带出现过类似的严重安全隐患。宽带网络运营商的问题很大（强制建立缓存代理服务器，缓存不该缓存的网页），网站的问题是其次的。或者说，在那种情况下，绝大多数网站用户都会出现“穿越”现象。<br />
    如果被你穿越的人和你斗处在同一城市，基本上就是这个原因了。</p></blockquote>
<p>解决方法，且听下次分解。</p>
<p>如果您的网站出现类似问题，欢迎加我qq176300676一起收集数据样本进行分析</p>
<p>亦可加入msn讨论群 lampper@live.cn</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/03/30/discuz%e8%b4%a6%e5%8f%b7%e6%b7%b7%e4%b9%b1%e9%97%ae%e9%a2%98%e7%a0%94%e7%a9%b6.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>django&#124;python中图形验证码的实现</title>
		<link>http://www.sunboyu.cn/2010/03/23/djangopython%e4%b8%ad%e5%9b%be%e5%bd%a2%e9%aa%8c%e8%af%81%e7%a0%81%e7%9a%84%e5%ae%9e%e7%8e%b0.shtml</link>
		<comments>http://www.sunboyu.cn/2010/03/23/djangopython%e4%b8%ad%e5%9b%be%e5%bd%a2%e9%aa%8c%e8%af%81%e7%a0%81%e7%9a%84%e5%ae%9e%e7%8e%b0.shtml#comments</comments>
		<pubDate>Tue, 23 Mar 2010 06:01:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1195</guid>
		<description><![CDATA[python自己并没有带图型库，需要借助第三方的图形库来实现。原来习惯的就是php下的gd库，但网上搜索后普遍说gd的python接口不好用，又考虑php也即将抛弃dg，就选择了很多人推荐的 PIL（python image library） 库。
首先是安装此库，http://www.pythonware.com/products/pil/index.htm
选择自己相应版本和平台进行安装，安装文档写的还算清楚。
然后是代码实现：
import Image, ImageDraw, ImageFont, md5, random,cStringIO,util
def show(request):
&#160;&#160; &#160;im = Image.new('RGBA',(52,18),(50,50,50,50))
&#160;&#160; &#160;draw = ImageDraw.Draw(im)
&#160;&#160; &#160;rands = util.rand(4)&#160; //自己写的一个取随机字符串的函数
&#160;&#160; &#160;draw.text((2,0), rands[0], font=ImageFont.truetype(&#34;tahomabd.TTF&#34;, random.randrange(12,18)), fill='white')
&#160;&#160; &#160;draw.text((14,0), rands[1], font=ImageFont.truetype(&#34;tahomabd.TTF&#34;, random.randrange(12,18)), fill='yellow')
&#160;&#160; &#160;draw.text((27,0), rands[2], font=ImageFont.truetype(&#34;tahomabd.TTF&#34;, random.randrange(12,18)), fill='yellow')
&#160;&#160; &#160;draw.text((40,0), rands[3], font=ImageFont.truetype(&#34;tahomabd.TTF&#34;, random.randrange(12,18)), fill='white')&#160; 
&#160;&#160; &#160;del draw
&#160;&#160; &#160;request.session['checkcode'] = rands
&#160;&#160; &#160;buf = cStringIO.StringIO()
&#160;&#160; &#160;im.save(buf, 'gif')
&#160;&#160; &#160;return HttpResponse(buf.getvalue(),'image/gif')
修改urls.py文件
#check code
&#160;&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>python自己并没有带图型库，需要借助第三方的图形库来实现。原来习惯的就是php下的gd库，但网上搜索后普遍说gd的python接口不好用，又考虑php也即将抛弃dg，就选择了很多人推荐的 PIL（python image library） 库。</p>
<p>首先是安装此库，http://www.pythonware.com/products/pil/index.htm</p>
<p>选择自己相应版本和平台进行安装，安装文档写的还算清楚。</p>
<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">import Image, ImageDraw, ImageFont, md5, random,cStringIO,util</li>
<li>def show(request):</li>
<li>&nbsp;&nbsp; &nbsp;im = Image.new('RGBA',(52,18),(50,50,50,50))</li>
<li>&nbsp;&nbsp; &nbsp;draw = ImageDraw.Draw(im)</li>
<li>&nbsp;&nbsp; &nbsp;rands = util.rand(4)&nbsp; //自己写的一个取随机字符串的函数</li>
<li>&nbsp;&nbsp; &nbsp;draw.text((2,0), rands[0], font=ImageFont.truetype(&quot;tahomabd.TTF&quot;, random.randrange(12,18)), fill='white')</li>
<li>&nbsp;&nbsp; &nbsp;draw.text((14,0), rands[1], font=ImageFont.truetype(&quot;tahomabd.TTF&quot;, random.randrange(12,18)), fill='yellow')</li>
<li>&nbsp;&nbsp; &nbsp;draw.text((27,0), rands[2], font=ImageFont.truetype(&quot;tahomabd.TTF&quot;, random.randrange(12,18)), fill='yellow')</li>
<li>&nbsp;&nbsp; &nbsp;draw.text((40,0), rands[3], font=ImageFont.truetype(&quot;tahomabd.TTF&quot;, random.randrange(12,18)), fill='white')&nbsp; </li>
<li>&nbsp;&nbsp; &nbsp;del draw</li>
<li>&nbsp;&nbsp; &nbsp;request.session['checkcode'] = rands</li>
<li>&nbsp;&nbsp; &nbsp;buf = cStringIO.StringIO()</li>
<li>&nbsp;&nbsp; &nbsp;im.save(buf, 'gif')</li>
<li>&nbsp;&nbsp; &nbsp;return HttpResponse(buf.getvalue(),'image/gif')</li></ol></div>
<p>修改urls.py文件</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">#check code</li>
<li>&nbsp;&nbsp; &nbsp;(r'^checkcode/','view.checkcode.show'),</li></ol></div>
<p>再访问 http://127.0.0.1/checkcode/ 既可看到效果。</p>
<p>官方的手册写的比较惨，属于找什么没什么。顺便把网上找到的一个写的不错的文档传送来：http://nadiana.com/pil-tutorial-basic-advanced-drawing</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/03/23/djangopython%e4%b8%ad%e5%9b%be%e5%bd%a2%e9%aa%8c%e8%af%81%e7%a0%81%e7%9a%84%e5%ae%9e%e7%8e%b0.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>django中关于静态文件那些事</title>
		<link>http://www.sunboyu.cn/2010/03/20/django%e4%b8%ad%e5%85%b3%e4%ba%8e%e9%9d%99%e6%80%81%e6%96%87%e4%bb%b6%e9%82%a3%e4%ba%9b%e4%ba%8b.shtml</link>
		<comments>http://www.sunboyu.cn/2010/03/20/django%e4%b8%ad%e5%85%b3%e4%ba%8e%e9%9d%99%e6%80%81%e6%96%87%e4%bb%b6%e9%82%a3%e4%ba%9b%e4%ba%8b.shtml#comments</comments>
		<pubDate>Sat, 20 Mar 2010 09:10:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1191</guid>
		<description><![CDATA[那个500错误快把我整死了，结果才分析可能django把静态文件当脚本处理了。
对于线上部署，完全可以用rewrite的方式进行解决。可本机调试，用的是自带的server，可搞死人了。
不过搜索后发现，django解决这个问题了，使用一个叫做 django.views.static.serve 的方法处理这些静态文件。
实现代码如下:
在/urls.py 文件中
from os import path
底下增加
if settings.DEBUG:
&#160;&#160; &#160;urlpatterns += patterns('', (r'^static/(?P&#60;path&#62;.*)$', 'django.views.static.serve', {'document_root': path.join(path.dirname(__file__),'static')}), )
&#60;/path&#62;
然后，把所有静态文件放到 static 目录下，即可。
不过这种方式只适合开发环境，在线上的时候还是需要把这个问题交给httpserver
]]></description>
			<content:encoded><![CDATA[<p>那个500错误快把我整死了，结果才分析可能django把静态文件当脚本处理了。</p>
<p>对于线上部署，完全可以用rewrite的方式进行解决。可本机调试，用的是自带的server，可搞死人了。</p>
<p>不过搜索后发现，django解决这个问题了，使用一个叫做 django.views.static.serve 的方法处理这些静态文件。</p>
<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">在/urls.py 文件中</li>
<li>from os import path</li>
<li>底下增加</li>
<li>if settings.DEBUG:</li>
<li>&nbsp;&nbsp; &nbsp;urlpatterns += patterns('', (r'^static/(?P&lt;path&gt;.*)$', 'django.views.static.serve', {'document_root': path.join(path.dirname(__file__),'static')}), )</li>
<li>&lt;/path&gt;</li></ol></div>
<p>然后，把所有静态文件放到 static 目录下，即可。</p>
<p>不过这种方式只适合开发环境，在线上的时候还是需要把这个问题交给httpserver</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/03/20/django%e4%b8%ad%e5%85%b3%e4%ba%8e%e9%9d%99%e6%80%81%e6%96%87%e4%bb%b6%e9%82%a3%e4%ba%9b%e4%ba%8b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>mongodb windows平台下的安装和使用</title>
		<link>http://www.sunboyu.cn/2010/03/18/mongodb-windows%e5%b9%b3%e5%8f%b0%e4%b8%8b%e7%9a%84%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2010/03/18/mongodb-windows%e5%b9%b3%e5%8f%b0%e4%b8%8b%e7%9a%84%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8.shtml#comments</comments>
		<pubDate>Thu, 18 Mar 2010 05:47:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[mongodb]]></category>

		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1187</guid>
		<description><![CDATA[平时还是windows用的多，所以很多测试也习惯用windows。
首先下载mongodb的windows编译版本：
http://www.mongodb.org/display/DOCS/Downloads    http://downloads.mongodb.org/win32/mongodb-win32-i386-1.2.4.zip
解压后存放于 D:\mongodb
创建数据存放目录  D:\data
启动数据库  D:\mongodb\bin\mongod &#8211;dbpath D:\data
然后测试连接情况 D:\mongodb\bin\mongo
因为都是使用默认配置，如果出现以下回显，则证明安装成功
MongoDB shell version: 1.2.4
url: test
connecting to: test
type &#34;exit&#34; to exit
type &#34;help&#34; for help
&#62;
进阶：为了平时使用方便，把mongod注册为系统服务
D:\mongodb\bin\mongod &#8211;dbpath D:\data &#8211;install       #注册为系统服务
修改服务的端口  D:\mongodb\bin\mongod &#8211;dbpath D:\data &#8211;port 10001
其他配置 敲 mongod -h 就会出来
]]></description>
			<content:encoded><![CDATA[<p>平时还是windows用的多，所以很多测试也习惯用windows。</p>
<p>首先下载mongodb的windows编译版本：</p>
<p>http://www.mongodb.org/display/DOCS/Downloads    http://downloads.mongodb.org/win32/mongodb-win32-i386-1.2.4.zip</p>
<p>解压后存放于 D:\mongodb</p>
<p>创建数据存放目录  D:\data</p>
<p>启动数据库  D:\mongodb\bin\mongod &#8211;dbpath D:\data</p>
<p>然后测试连接情况 D:\mongodb\bin\mongo</p>
<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">MongoDB shell version: 1.2.4</li>
<li>url: test</li>
<li>connecting to: test</li>
<li>type &quot;exit&quot; to exit</li>
<li>type &quot;help&quot; for help</li>
<li>&gt;</li></ol></div>
<p>进阶：为了平时使用方便，把mongod注册为系统服务</p>
<p>D:\mongodb\bin\mongod &#8211;dbpath D:\data &#8211;install       #注册为系统服务</p>
<p>修改服务的端口  D:\mongodb\bin\mongod &#8211;dbpath D:\data &#8211;port 10001</p>
<p>其他配置 敲 mongod -h 就会出来</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/03/18/mongodb-windows%e5%b9%b3%e5%8f%b0%e4%b8%8b%e7%9a%84%e5%ae%89%e8%a3%85%e5%92%8c%e4%bd%bf%e7%94%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>新年新气象</title>
		<link>http://www.sunboyu.cn/2010/03/02/%e6%96%b0%e5%b9%b4%e6%96%b0%e6%b0%94%e8%b1%a1-2.shtml</link>
		<comments>http://www.sunboyu.cn/2010/03/02/%e6%96%b0%e5%b9%b4%e6%96%b0%e6%b0%94%e8%b1%a1-2.shtml#comments</comments>
		<pubDate>Tue, 02 Mar 2010 15:25:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1174</guid>
		<description><![CDATA[1、千万别碰网游，除非你靠网游吃饭
2、多看书总是有用的，包括闲书
3、多交朋友，多帮助别人。感情是个银行，利息很大
4、学习依然是最重要的
5、虽然很俗，虽然通货膨胀，但人民币是最可爱的东西
]]></description>
			<content:encoded><![CDATA[<p>1、千万别碰网游，除非你靠网游吃饭<br />
2、多看书总是有用的，包括闲书<br />
3、多交朋友，多帮助别人。感情是个银行，利息很大<br />
4、学习依然是最重要的<br />
5、虽然很俗，虽然通货膨胀，但人民币是最可爱的东西</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/03/02/%e6%96%b0%e5%b9%b4%e6%96%b0%e6%b0%94%e8%b1%a1-2.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>头绪与条理</title>
		<link>http://www.sunboyu.cn/2010/01/30/%e5%a4%b4%e7%bb%aa%e4%b8%8e%e6%9d%a1%e7%90%86.shtml</link>
		<comments>http://www.sunboyu.cn/2010/01/30/%e5%a4%b4%e7%bb%aa%e4%b8%8e%e6%9d%a1%e7%90%86.shtml#comments</comments>
		<pubDate>Sat, 30 Jan 2010 03:57:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1172</guid>
		<description><![CDATA[没想到这两个词具体是什么意思，但这肯定是我的缺陷了。
前几天培训，被指出这个毛病，其实仔细回想，工作中何尝不是没有头绪条理，很多事情忙的团团转，搞的一团糟。
改正这个毛病其实用了很长时间，从期初开始做简单的文件记录，到后来大量的纸质手稿，到现在详细的记录和思维软件(mindmanage)的应用，对做事有了很多提高。
昨天晚上加班，自愿加班，去完成一个我所认为半天就能完成的工作，其实用了将近一天，实际工作时间也算半天吧。时间浪费了一大半，是因为以前已经实现的一个冗杂的逻辑又去想了一遍，结果还没想明白。后把之前的逻辑拿来，20分钟顺利结束了战斗。
非常勤恳的工作不是啥好事，漂亮得完成工作并把时间留给自己才是王道。
]]></description>
			<content:encoded><![CDATA[<p>没想到这两个词具体是什么意思，但这肯定是我的缺陷了。</p>
<p>前几天培训，被指出这个毛病，其实仔细回想，工作中何尝不是没有头绪条理，很多事情忙的团团转，搞的一团糟。</p>
<p>改正这个毛病其实用了很长时间，从期初开始做简单的文件记录，到后来大量的纸质手稿，到现在详细的记录和思维软件(mindmanage)的应用，对做事有了很多提高。</p>
<p>昨天晚上加班，自愿加班，去完成一个我所认为半天就能完成的工作，其实用了将近一天，实际工作时间也算半天吧。时间浪费了一大半，是因为以前已经实现的一个冗杂的逻辑又去想了一遍，结果还没想明白。后把之前的逻辑拿来，20分钟顺利结束了战斗。</p>
<p>非常勤恳的工作不是啥好事，漂亮得完成工作并把时间留给自己才是王道。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/01/30/%e5%a4%b4%e7%bb%aa%e4%b8%8e%e6%9d%a1%e7%90%86.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>discuz论坛sessions表最终优化方案</title>
		<link>http://www.sunboyu.cn/2010/01/17/discuz%e8%ae%ba%e5%9d%9bsessions%e8%a1%a8%e6%9c%80%e7%bb%88%e4%bc%98%e5%8c%96%e6%96%b9%e6%a1%88.shtml</link>
		<comments>http://www.sunboyu.cn/2010/01/17/discuz%e8%ae%ba%e5%9d%9bsessions%e8%a1%a8%e6%9c%80%e7%bb%88%e4%bc%98%e5%8c%96%e6%96%b9%e6%a1%88.shtml#comments</comments>
		<pubDate>Sun, 17 Jan 2010 15:00:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[discuz]]></category>

		<category><![CDATA[sessions表]]></category>

		<category><![CDATA[优化]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1163</guid>
		<description><![CDATA[最近一直在折腾dz的sessions表优化。经过某群好友的各种方法提示和一些高数据量用户论坛的鼎力支持，总结以下优化方案。部分方案是在某些论坛正在使用的，部分方案是我发散思维总结的，没有经过大数据量和大负载下的应用，只是作为一个备选的方案，当然欢迎朋友们拿去实践。
1、分库
这个方法至少两三个注册用户百万级至千万级的论坛在使用。实施也比较简单，只需要把sessions表放在其他的库中，跟论坛主库分离，这样，就可以用多台服务器来分担论坛压力。sessions表查询的地方，如果直接查询，则连sessions表所在的库，如果是联查，则分别查询后，合并插叙结果。
2、砍功能
这个方法虽然不实用，但的确有效。仔细看看dz的一些sql语句，就知道砍掉某些功能摆脱sessions表的约束，性能会有多大的提高。砍功能，最终还是为了提升性能。但如果不砍功能又提升性能，才是终极目的。此方法适用于对某些统计功能要求不高的论坛使用。
3、memcached存储sessions，异步统计用户的在线数据
此方法其实还是砍掉了论坛的用户在线统计功能而独立开发一套统计系统。此思路来源于我们的统计服务器。如果统计服务器已经统计了部分信息，就没必要再去耗费大量的sql效率去进行统计。当时我们负责统计的吴同学正好也要开发一套针对不同系统的统计代码，我可以直接把要统计的数据提交给统计服务器，再由统计服务器返回统计结果。以异步的方式来统计，化解dz sessions表的性能瓶颈。而统计信息的异步提交，可以提交到本地数据库，可以提交到第三方统计系统，当然也可以根据需要独立开发一套小型统计系统。
方案3是本人原创方案，方案的修改代码在以下附件中：  异步session统计信息同步，欢迎大家使用。
由于dz的开发考虑的是大众市场，功能冗余代码逻辑复杂。但优化dz并不是那么的困难，而优化的思路，也是跟其他系统优化相似：mysql瓶颈。一个即将崩溃的系统，或者频繁崩溃的系统，是进行优化的最好示例：减少sql查询，提高sql语句查询效率。dz考虑大众市场，为了提高产品兼容性，并没有引入太多的第三方软件：比如memcached，bdb，ttserver等，虽然内部已经为主从预留了接口，但未见很明显的文档支持。
第三个方案优化的思路也很明显，减少sessions表的慢查询而改为memcached高速的数据存储，把统计功能做接口留出，此功能给第三方来做。这样sessions表的瓶颈即可消除。
]]></description>
			<content:encoded><![CDATA[<p>最近一直在折腾dz的sessions表优化。经过某群好友的各种方法提示和一些高数据量用户论坛的鼎力支持，总结以下优化方案。部分方案是在某些论坛正在使用的，部分方案是我发散思维总结的，没有经过大数据量和大负载下的应用，只是作为一个备选的方案，当然欢迎朋友们拿去实践。</p>
<p>1、分库</p>
<p>这个方法至少两三个注册用户百万级至千万级的论坛在使用。实施也比较简单，只需要把sessions表放在其他的库中，跟论坛主库分离，这样，就可以用多台服务器来分担论坛压力。sessions表查询的地方，如果直接查询，则连sessions表所在的库，如果是联查，则分别查询后，合并插叙结果。</p>
<p>2、砍功能</p>
<p>这个方法虽然不实用，但的确有效。仔细看看dz的一些sql语句，就知道砍掉某些功能摆脱sessions表的约束，性能会有多大的提高。砍功能，最终还是为了提升性能。但如果不砍功能又提升性能，才是终极目的。此方法适用于对某些统计功能要求不高的论坛使用。</p>
<p>3、memcached存储sessions，异步统计用户的在线数据</p>
<p>此方法其实还是砍掉了论坛的用户在线统计功能而独立开发一套统计系统。此思路来源于我们的统计服务器。如果统计服务器已经统计了部分信息，就没必要再去耗费大量的sql效率去进行统计。当时我们负责统计的吴同学正好也要开发一套针对不同系统的统计代码，我可以直接把要统计的数据提交给统计服务器，再由统计服务器返回统计结果。以异步的方式来统计，化解dz sessions表的性能瓶颈。而统计信息的异步提交，可以提交到本地数据库，可以提交到第三方统计系统，当然也可以根据需要独立开发一套小型统计系统。</p>
<p>方案3是本人原创方案，方案的修改代码在以下附件中：  <a href='http://www.sunboyu.cn/upfiles/2010/01/异步session统计信息同步.txt'>异步session统计信息同步</a>，欢迎大家使用。</p>
<p>由于dz的开发考虑的是大众市场，功能冗余代码逻辑复杂。但优化dz并不是那么的困难，而优化的思路，也是跟其他系统优化相似：mysql瓶颈。一个即将崩溃的系统，或者频繁崩溃的系统，是进行优化的最好示例：减少sql查询，提高sql语句查询效率。dz考虑大众市场，为了提高产品兼容性，并没有引入太多的第三方软件：比如memcached，bdb，ttserver等，虽然内部已经为主从预留了接口，但未见很明显的文档支持。<br />
第三个方案优化的思路也很明显，减少sessions表的慢查询而改为memcached高速的数据存储，把统计功能做接口留出，此功能给第三方来做。这样sessions表的瓶颈即可消除。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/01/17/discuz%e8%ae%ba%e5%9d%9bsessions%e8%a1%a8%e6%9c%80%e7%bb%88%e4%bc%98%e5%8c%96%e6%96%b9%e6%a1%88.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>撞在墙上的一个思路</title>
		<link>http://www.sunboyu.cn/2010/01/16/%e6%92%9e%e5%9c%a8%e5%a2%99%e4%b8%8a%e7%9a%84%e4%b8%80%e4%b8%aa%e6%80%9d%e8%b7%af.shtml</link>
		<comments>http://www.sunboyu.cn/2010/01/16/%e6%92%9e%e5%9c%a8%e5%a2%99%e4%b8%8a%e7%9a%84%e4%b8%80%e4%b8%aa%e6%80%9d%e8%b7%af.shtml#comments</comments>
		<pubDate>Fri, 15 Jan 2010 16:59:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1159</guid>
		<description><![CDATA[今天一天没干别的，没写程序，没玩游戏，除了中午参加公司的一个吹气球比赛得了第一，获得“**公司第一吹”的称号。
一天都在考虑使用完全开源的方案来解决dz sessions表的性能问题。中午大脑极度紧张，以至于撞在关兄的工位，工位几近散架。
在轻度震荡中想到一个优化方案，就是分离sessions表的一些功能，把sessions会话和统计功能分离，并且统计使用异步提交。
这样，如果sessions会话生存期10分钟的量计算，20万人同时在线，sessions会话存memcached，而统计只用少量字段在独立的表中。因为php的sessions操作速度高，而统计信息调用并不是非常频繁，并且查找也是简单的int型查询，速度快，并且也进行memcached缓存。
下午吴同学详细讲述了我们的统计系统的负载和数据量，在大量实际应用的基础上，我的方案应该能很好的实施。
这样算来，连接瓶颈跟存储瓶颈似乎都能解决。明天集中时间实现这个方案。
]]></description>
			<content:encoded><![CDATA[<p>今天一天没干别的，没写程序，没玩游戏，除了中午参加公司的一个吹气球比赛得了第一，获得“**公司第一吹”的称号。</p>
<p>一天都在考虑使用完全开源的方案来解决dz sessions表的性能问题。中午大脑极度紧张，以至于撞在关兄的工位，工位几近散架。</p>
<p>在轻度震荡中想到一个优化方案，就是分离sessions表的一些功能，把sessions会话和统计功能分离，并且统计使用异步提交。</p>
<p>这样，如果sessions会话生存期10分钟的量计算，20万人同时在线，sessions会话存memcached，而统计只用少量字段在独立的表中。因为php的sessions操作速度高，而统计信息调用并不是非常频繁，并且查找也是简单的int型查询，速度快，并且也进行memcached缓存。</p>
<p>下午吴同学详细讲述了我们的统计系统的负载和数据量，在大量实际应用的基础上，我的方案应该能很好的实施。</p>
<p>这样算来，连接瓶颈跟存储瓶颈似乎都能解决。明天集中时间实现这个方案。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/01/16/%e6%92%9e%e5%9c%a8%e5%a2%99%e4%b8%8a%e7%9a%84%e4%b8%80%e4%b8%aa%e6%80%9d%e8%b7%af.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>关于discuz的优化纠结</title>
		<link>http://www.sunboyu.cn/2010/01/15/%e5%85%b3%e4%ba%8ediscuz%e7%9a%84%e4%bc%98%e5%8c%96%e7%ba%a0%e7%bb%93.shtml</link>
		<comments>http://www.sunboyu.cn/2010/01/15/%e5%85%b3%e4%ba%8ediscuz%e7%9a%84%e4%bc%98%e5%8c%96%e7%ba%a0%e7%bb%93.shtml#comments</comments>
		<pubDate>Fri, 15 Jan 2010 07:23:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1155</guid>
		<description><![CDATA[最近一直在寻找一个开源的方案来解决discuz的性能瓶颈。在做完几个关键表的分表后，sessions表又成了最大的瓶颈。因为页面每次刷新，至少两个sql语句在session表上，究其原因，session表的最大作用在于对用户行为的统计。
曾经尝试过使用php的session，不过支持phpsession的几个sever都不支持条件查询，除非是遍历匹配。这样也不能起到提高性能的作用。
在以上条件下，我寻找了两套方案：ttserver mongodb。
在session表100w数据的测试下，得出以下数据：

连接测试-只测试连接释放
tt:40.0904033184
mysqldb:0.0669066905975
mongodb:226.840053558
mysqldb:0.154407262802
经过一万次的连接测试，同一个脚本中，
ttserver连接耗时 40.09 秒，而mysql连接耗时0.07秒 linux下测试
mongodb 连接耗时 226.8 秒，而mysql连接耗时0.15秒 linux下测试
但是在500次的查询测试中，同一个脚本中，主键查询和索引优化后的复杂查询
mongodb 查询耗时 0.021 秒
mysql   查询耗时 0.123 秒

可以看出，tt和mongo两个功能上完全支持此表优化的数据库，在连接性能上远不如mysql，而web为频繁连接中断的服务，显然并不适合做这项功能。
继续寻找支持此功能的开源方案，欢迎大家提供线索。
]]></description>
			<content:encoded><![CDATA[<p>最近一直在寻找一个开源的方案来解决discuz的性能瓶颈。在做完几个关键表的分表后，sessions表又成了最大的瓶颈。因为页面每次刷新，至少两个sql语句在session表上，究其原因，session表的最大作用在于对用户行为的统计。</p>
<p>曾经尝试过使用php的session，不过支持phpsession的几个sever都不支持条件查询，除非是遍历匹配。这样也不能起到提高性能的作用。</p>
<p>在以上条件下，我寻找了两套方案：ttserver mongodb。</p>
<p>在session表100w数据的测试下，得出以下数据：</p>
<blockquote><p>
连接测试-只测试连接释放<br />
tt:40.0904033184<br />
mysqldb:0.0669066905975</p>
<p>mongodb:226.840053558<br />
mysqldb:0.154407262802</p>
<p>经过一万次的连接测试，同一个脚本中，<br />
ttserver连接耗时 40.09 秒，而mysql连接耗时0.07秒 linux下测试<br />
mongodb 连接耗时 226.8 秒，而mysql连接耗时0.15秒 linux下测试</p>
<p>但是在500次的查询测试中，同一个脚本中，主键查询和索引优化后的复杂查询<br />
mongodb 查询耗时 0.021 秒<br />
mysql   查询耗时 0.123 秒
</p></blockquote>
<p>可以看出，tt和mongo两个功能上完全支持此表优化的数据库，在连接性能上远不如mysql，而web为频繁连接中断的服务，显然并不适合做这项功能。</p>
<p>继续寻找支持此功能的开源方案，欢迎大家提供线索。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/01/15/%e5%85%b3%e4%ba%8ediscuz%e7%9a%84%e4%bc%98%e5%8c%96%e7%ba%a0%e7%bb%93.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>小改EditPlus打造python开发环境</title>
		<link>http://www.sunboyu.cn/2010/01/10/%e5%b0%8f%e6%94%b9editplus%e6%89%93%e9%80%a0python%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83.shtml</link>
		<comments>http://www.sunboyu.cn/2010/01/10/%e5%b0%8f%e6%94%b9editplus%e6%89%93%e9%80%a0python%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83.shtml#comments</comments>
		<pubDate>Sun, 10 Jan 2010 13:00:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<category><![CDATA[原创技术]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1148</guid>
		<description><![CDATA[editplus默认是不支持python开发的，但官方提供了相关的支持：
http://www.editplus.com/dn.cgi?python3.zip
在 菜单->工具选择->语法 中，可以新建语法类型 python,扩展名 py,语法文件为python.stx,自动完成文件为python.acp
即可。
]]></description>
			<content:encoded><![CDATA[<p>editplus默认是不支持python开发的，但官方提供了相关的支持：</p>
<p>http://www.editplus.com/dn.cgi?python3.zip</p>
<p>在 菜单->工具选择->语法 中，可以新建语法类型 python,扩展名 py,语法文件为python.stx,自动完成文件为python.acp</p>
<p>即可。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/01/10/%e5%b0%8f%e6%94%b9editplus%e6%89%93%e9%80%a0python%e5%bc%80%e5%8f%91%e7%8e%af%e5%a2%83.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>在nginx下配置自动虚拟主机</title>
		<link>http://www.sunboyu.cn/2010/01/09/%e5%9c%a8nginx%e4%b8%8b%e9%85%8d%e7%bd%ae%e8%87%aa%e5%8a%a8%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba.shtml</link>
		<comments>http://www.sunboyu.cn/2010/01/09/%e5%9c%a8nginx%e4%b8%8b%e9%85%8d%e7%bd%ae%e8%87%aa%e5%8a%a8%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba.shtml#comments</comments>
		<pubDate>Fri, 08 Jan 2010 16:33:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[虚拟主机]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1143</guid>
		<description><![CDATA[以前用apache，很多虚拟主机的时候，用 mod_vhost_alias 模块去解决。nginx似乎没有这样的功能。
原来为了做这个功能，我用python写了一堆脚本，去自动管理nginx的配置文件，结果还是不理想。频繁重写配置文件，频繁重启，总会出现点问题。
在nginx的0.8.*下，发现了这样的功能：http://wiki.nginx.org/NginxHttpCoreModule

Since nginx 0.8.25 named captures can be used in server_name:
server {
  server_name   ~^(www\.)?(?.+)$;
  location / {
    root  /sites/$domain;
  }
}

大喜，于是乎做出如下配置，实现了nginx下自动虚拟主机的功能：
server {
&#160;&#160; &#160; listen&#160; &#160; &#160; &#160;80;
&#160;&#160; &#160; server_name&#160; ~^(?P&#60;domainname&#62;.+)\.autovhost\.sunboyu\.cn$;
&#160;&#160; &#160; location / {
&#160;&#160; &#160; &#160; &#160; #autoindex&#160; on;
&#160;&#160; &#160; &#160; &#160; root&#160; &#160;/home/vhost/$domainname;
&#160;&#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>以前用apache，很多虚拟主机的时候，用 mod_vhost_alias 模块去解决。nginx似乎没有这样的功能。</p>
<p>原来为了做这个功能，我用python写了一堆脚本，去自动管理nginx的配置文件，结果还是不理想。频繁重写配置文件，频繁重启，总会出现点问题。</p>
<p>在nginx的0.8.*下，发现了这样的功能：http://wiki.nginx.org/NginxHttpCoreModule</p>
<blockquote><p>
Since nginx 0.8.25 named captures can be used in server_name:<br />
server {<br />
  server_name   ~^(www\.)?(?<domain>.+)$;<br />
  location / {<br />
    root  /sites/$domain;<br />
  }<br />
}<br />
</domain></p></blockquote>
<p>大喜，于是乎做出如下配置，实现了nginx下自动虚拟主机的功能：</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">server {</li>
<li>&nbsp;&nbsp; &nbsp; listen&nbsp; &nbsp; &nbsp; &nbsp;80;</li>
<li>&nbsp;&nbsp; &nbsp; server_name&nbsp; ~^(?P&lt;domainname&gt;.+)\.autovhost\.sunboyu\.cn$;</li>
<li>&nbsp;&nbsp; &nbsp; location / {</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; #autoindex&nbsp; on;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; root&nbsp; &nbsp;/home/vhost/$domainname;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; index&nbsp; index.html index.htm;</li>
<li>&nbsp;&nbsp; &nbsp; }</li>
<li>&nbsp;&nbsp; &nbsp; access_log /home/autovhost.sunboyu.cn.log main;</li>
<li>}</li>
<li>&lt;/domainname&gt;</li></ol></div>
<p>测试通过。</p>
<p>我的开源虚拟主机管理系统nginx版本指日可待。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/01/09/%e5%9c%a8nginx%e4%b8%8b%e9%85%8d%e7%bd%ae%e8%87%aa%e5%8a%a8%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>新浪微博短URL的意义和实现</title>
		<link>http://www.sunboyu.cn/2010/01/03/%e6%96%b0%e6%b5%aa%e5%be%ae%e5%8d%9a%e7%9f%adurl%e7%9a%84%e6%84%8f%e4%b9%89%e5%92%8c%e5%ae%9e%e7%8e%b0.shtml</link>
		<comments>http://www.sunboyu.cn/2010/01/03/%e6%96%b0%e6%b5%aa%e5%be%ae%e5%8d%9a%e7%9f%adurl%e7%9a%84%e6%84%8f%e4%b9%89%e5%92%8c%e5%ae%9e%e7%8e%b0.shtml#comments</comments>
		<pubDate>Sat, 02 Jan 2010 16:40:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[微博]]></category>

		<category><![CDATA[新浪]]></category>

		<category><![CDATA[短url]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1141</guid>
		<description><![CDATA[新浪微博，就是迷你博客（废话）。我关心的不是博客，是url。里边的url全部使用了一种很短的url，比如 http://sinaurl.cn/**** 这里猜测了这种url的实现意义：
1：减少url所占的字数，优化排版。微博就是一个小，如果我贴了一个地址就占一半的字数，那作者很不爽，读者很不爽，做页面那哥们(MM)肯定跟不爽。所以，咱弄个短的url，岂不皆大欢喜。
2：排挤灌水广告者。众所周知，很多广告者为了广告，或者为了页面优化，得群发垃圾消息增加反向链接数。而短url跳转这种方式根本无法增加反向链接数。也就是这种方式从根本上掐断了垃圾群发者的命根子，这样也就减少了垃圾信息的量，节约了信息审核的人工成本（这项成本随着严打是越来越高啊）。
3：暂时没想出来。
实现，其实很简单，就是接收个id，然后找到对应记录就行。根据新浪信息的量，不可能用mysql的，成本高（负载和硬件消耗）。不可能用oracle，凭我的了解，不可能用。
新浪在小日本那个ttserver的基础上开发了个支持分布式的key->value型的数据库，这玩意正好用上，支持高并发大负载，逻辑简单还支持分布式，这么实现貌似最好不过。
吃饱没事，大半夜写文章。欢迎大家来讨论。
]]></description>
			<content:encoded><![CDATA[<p>新浪微博，就是迷你博客（废话）。我关心的不是博客，是url。里边的url全部使用了一种很短的url，比如 http://sinaurl.cn/**** 这里猜测了这种url的实现意义：</p>
<p>1：减少url所占的字数，优化排版。微博就是一个小，如果我贴了一个地址就占一半的字数，那作者很不爽，读者很不爽，做页面那哥们(MM)肯定跟不爽。所以，咱弄个短的url，岂不皆大欢喜。</p>
<p>2：排挤灌水广告者。众所周知，很多广告者为了广告，或者为了页面优化，得群发垃圾消息增加反向链接数。而短url跳转这种方式根本无法增加反向链接数。也就是这种方式从根本上掐断了垃圾群发者的命根子，这样也就减少了垃圾信息的量，节约了信息审核的人工成本（这项成本随着严打是越来越高啊）。</p>
<p>3：暂时没想出来。</p>
<p>实现，其实很简单，就是接收个id，然后找到对应记录就行。根据新浪信息的量，不可能用mysql的，成本高（负载和硬件消耗）。不可能用oracle，凭我的了解，不可能用。</p>
<p>新浪在小日本那个ttserver的基础上开发了个支持分布式的key->value型的数据库，这玩意正好用上，支持高并发大负载，逻辑简单还支持分布式，这么实现貌似最好不过。</p>
<p>吃饱没事，大半夜写文章。欢迎大家来讨论。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2010/01/03/%e6%96%b0%e6%b5%aa%e5%be%ae%e5%8d%9a%e7%9f%adurl%e7%9a%84%e6%84%8f%e4%b9%89%e5%92%8c%e5%ae%9e%e7%8e%b0.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>单点登录sso粗解+示例</title>
		<link>http://www.sunboyu.cn/2009/12/31/%e5%8d%95%e7%82%b9%e7%99%bb%e5%bd%95sso%e7%b2%97%e8%a7%a3%e7%a4%ba%e4%be%8b.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/31/%e5%8d%95%e7%82%b9%e7%99%bb%e5%bd%95sso%e7%b2%97%e8%a7%a3%e7%a4%ba%e4%be%8b.shtml#comments</comments>
		<pubDate>Thu, 31 Dec 2009 02:56:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[demo]]></category>

		<category><![CDATA[sso]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1131</guid>
		<description><![CDATA[
用户中心代码 sso
跨域测试脚本 cookie

单点登录，英语为 Single Sign-On，粗俗点讲，就是登录一次，全站适用。
单点登录在应用中的实际意义，就是减少开发量，增强用户体验。
减少开发量，指的是：只要开发一套用户系统， 各个系统统一调用。用户系统尽量优化接口，通用性，安全性，达到一次开发， 全站适用。
增强用户体验，指的是：用户一次登录，全站登录。而不是切换一个模块，就登录一次。
web方面单点登录主要是用cookie传递令牌进行身份认证。简单说下令牌。
我这里用散列值来作为令牌，当然散列值之中有我的的密钥，防止别人伪造我的令牌。
环境：sso.sunboyu.cn 用户中心 vps.sunboyu.cn/cookie.php 跨子域不同脚本访问测试。 令牌密钥: $key
具体规则： sso.sunboyu.cn 用户登录，登录信息写到cookie，cookie做用域为 sunboyu.cn。并且生成令牌sso_key=md5(uid+username+key)。
登陆后，其他子域站点调用此cookie信息，并且验证此令牌是否是合法的令牌，if( md5( cookie[uid]+cookie[username] )==cookie[key] )
这样既可判断，此令牌合法性而确认此用户为登录。
具体demo:http://sso.sunboyu.cn
延伸：一个简单的md5似乎很容易让别人猜解加密的算法，来暴力一翻也不是没有可能，因此，除了加密外，算法的安全性和密钥的安全性也是需要考虑的。
如果安全级别要求高之又高，可以考虑rsa算法，不过速度就是问题了。其中又参考了一些朋友的意见，用对称加密，比如php中的Mcrypt 函数。
扩展开发：对于大多数网站，跨子域的单点登录就能满足应用。但对于一些域名复杂的网站，比如sohu，显然多个域名不能用此方法实现。这时就得搞出跨跨的单点登录系统。等年后继续得瑟。
]]></description>
			<content:encoded><![CDATA[<blockquote><p>
用户中心代码 <a href='http://www.sunboyu.cn/upfiles/2009/12/sso.rar'>sso</a><br />
跨域测试脚本 <a href='http://www.sunboyu.cn/upfiles/2009/12/cookie.rar'>cookie</a>
</p></blockquote>
<p>单点登录，英语为 Single Sign-On，粗俗点讲，就是登录一次，全站适用。</p>
<p>单点登录在应用中的实际意义，就是减少开发量，增强用户体验。</p>
<p>减少开发量，指的是：只要开发一套用户系统， 各个系统统一调用。用户系统尽量优化接口，通用性，安全性，达到一次开发， 全站适用。</p>
<p>增强用户体验，指的是：用户一次登录，全站登录。而不是切换一个模块，就登录一次。</p>
<p>web方面单点登录主要是用cookie传递令牌进行身份认证。简单说下令牌。</p>
<p>我这里用散列值来作为令牌，当然散列值之中有我的的密钥，防止别人伪造我的令牌。</p>
<blockquote><p>环境：sso.sunboyu.cn 用户中心 vps.sunboyu.cn/cookie.php 跨子域不同脚本访问测试。 令牌密钥: $key</p></blockquote>
<p>具体规则： sso.sunboyu.cn 用户登录，登录信息写到cookie，cookie做用域为 sunboyu.cn。并且生成令牌sso_key=md5(uid+username+key)。</p>
<p>登陆后，其他子域站点调用此cookie信息，并且验证此令牌是否是合法的令牌，if( md5( cookie[uid]+cookie[username] )==cookie[key] )</p>
<p>这样既可判断，此令牌合法性而确认此用户为登录。</p>
<p>具体demo:http://sso.sunboyu.cn</p>
<p>延伸：一个简单的md5似乎很容易让别人猜解加密的算法，来暴力一翻也不是没有可能，因此，除了加密外，算法的安全性和密钥的安全性也是需要考虑的。</p>
<p>如果安全级别要求高之又高，可以考虑rsa算法，不过速度就是问题了。其中又参考了一些朋友的意见，用对称加密，比如php中的Mcrypt 函数。</p>
<p>扩展开发：对于大多数网站，跨子域的单点登录就能满足应用。但对于一些域名复杂的网站，比如sohu，显然多个域名不能用此方法实现。这时就得搞出跨跨的单点登录系统。等年后继续得瑟。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/31/%e5%8d%95%e7%82%b9%e7%99%bb%e5%bd%95sso%e7%b2%97%e8%a7%a3%e7%a4%ba%e4%be%8b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>使用无模式数据库来改造dz的session</title>
		<link>http://www.sunboyu.cn/2009/12/29/%e4%bd%bf%e7%94%a8%e6%97%a0%e6%a8%a1%e5%bc%8f%e6%95%b0%e6%8d%ae%e5%ba%93%e6%9d%a5%e6%94%b9%e9%80%a0dz%e7%9a%84session.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/29/%e4%bd%bf%e7%94%a8%e6%97%a0%e6%a8%a1%e5%bc%8f%e6%95%b0%e6%8d%ae%e5%ba%93%e6%9d%a5%e6%94%b9%e9%80%a0dz%e7%9a%84session.shtml#comments</comments>
		<pubDate>Tue, 29 Dec 2009 01:26:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[discuz]]></category>

		<category><![CDATA[session]]></category>

		<category><![CDATA[性能]]></category>

		<category><![CDATA[无模式数据库]]></category>

		<category><![CDATA[瓶颈]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1124</guid>
		<description><![CDATA[前两天还不知道啥是无模式数据库，不过最近迫切需要修改discuz bbs的session表，所以研究了一下相关的资料，发现了无模式这个名字。
具体无模式是啥，这里找了两篇文章：

关系数据库的末日是否已经来临
关系数据库的根本问题分析及数据库革命之走向

关于无模式的应用案例，很典型的一个，就是康盛uchome的feed表。
这里简单介绍几个无模式数据库，供大家参考：
mongodb : http://www.mongodb.org/display/DOCS/Home
mongodb的php扩展 http://www.mongodb.org/display/DOCS/Installing+the+PHP+Driver#InstallingthePHPDriver-PECL
这个数据库已经在淘宝上配合10gen做了云计算的session（名字很操蛋）,具体资料在这里 http://rdc.taobao.com/blog/dw/archives/410。具有了实际应用的东西应该很不错，不过我没尝试过。
Tokyo Tyrant：http://1978th.net/
tt的php扩展 http://www.php.net/manual/en/book.tokyo-tyrant.php
这个大家就比较熟悉了，SB日本鬼子写的东西，应用很广，sina，qq等公司里都在大量应用，sina的研发团队在此基础上还做了个分布式的东东，很是不错。据说这玩意还得到了很多公司的赞助，shit。
TCSQL：张宴基于tt开发的一套东西，内部做了很多算法优化，具体可参考此文章 http://blog.s135.com/tcsql/
总结：康盛使用mysql来存储session，不能说是一种错，但对于dz的负载绝对是第一个瓶颈。用这种方式，在线人数5w对数据库绝对是个坎。很多负载比较大的论坛，都做了此方面的优化，比如，给session表单独一个数据库，或者干脆阉割此功能。不错，独立的session表，或者分库，访问量大的时候，瓶颈依然在mysql上；阉割此功能，有些心疼，而且很多运营数据会丢失。所以，保持原功能而平滑提升性能，是一个不错的解决方向。
]]></description>
			<content:encoded><![CDATA[<p>前两天还不知道啥是无模式数据库，不过最近迫切需要修改discuz bbs的session表，所以研究了一下相关的资料，发现了无模式这个名字。</p>
<p>具体无模式是啥，这里找了两篇文章：</p>
<blockquote><p>
<a href="http://database.51cto.com/art/200903/116752.htm">关系数据库的末日是否已经来临</a><br />
<a href="http://database.51cto.com/art/200908/146424.htm">关系数据库的根本问题分析及数据库革命之走向</a>
</p></blockquote>
<p>关于无模式的应用案例，很典型的一个，就是康盛uchome的feed表。</p>
<p>这里简单介绍几个无模式数据库，供大家参考：</p>
<p>mongodb : http://www.mongodb.org/display/DOCS/Home</p>
<p>mongodb的php扩展 http://www.mongodb.org/display/DOCS/Installing+the+PHP+Driver#InstallingthePHPDriver-PECL</p>
<p>这个数据库已经在淘宝上配合10gen做了云计算的session（名字很操蛋）,具体资料在这里 http://rdc.taobao.com/blog/dw/archives/410。具有了实际应用的东西应该很不错，不过我没尝试过。</p>
<p>Tokyo Tyrant：http://1978th.net/</p>
<p>tt的php扩展 http://www.php.net/manual/en/book.tokyo-tyrant.php</p>
<p>这个大家就比较熟悉了，SB日本鬼子写的东西，应用很广，sina，qq等公司里都在大量应用，sina的研发团队在此基础上还做了个分布式的东东，很是不错。据说这玩意还得到了很多公司的赞助，shit。</p>
<p>TCSQL：张宴基于tt开发的一套东西，内部做了很多算法优化，具体可参考此文章 http://blog.s135.com/tcsql/</p>
<p>总结：康盛使用mysql来存储session，不能说是一种错，但对于dz的负载绝对是第一个瓶颈。用这种方式，在线人数5w对数据库绝对是个坎。很多负载比较大的论坛，都做了此方面的优化，比如，给session表单独一个数据库，或者干脆阉割此功能。不错，独立的session表，或者分库，访问量大的时候，瓶颈依然在mysql上；阉割此功能，有些心疼，而且很多运营数据会丢失。所以，保持原功能而平滑提升性能，是一个不错的解决方向。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/29/%e4%bd%bf%e7%94%a8%e6%97%a0%e6%a8%a1%e5%bc%8f%e6%95%b0%e6%8d%ae%e5%ba%93%e6%9d%a5%e6%94%b9%e9%80%a0dz%e7%9a%84session.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>改变exec的阻塞模式</title>
		<link>http://www.sunboyu.cn/2009/12/25/%e6%94%b9%e5%8f%98exec%e7%9a%84%e9%98%bb%e5%a1%9e%e6%a8%a1%e5%bc%8f.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/25/%e6%94%b9%e5%8f%98exec%e7%9a%84%e9%98%bb%e5%a1%9e%e6%a8%a1%e5%bc%8f.shtml#comments</comments>
		<pubDate>Fri, 25 Dec 2009 02:19:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1118</guid>
		<description><![CDATA[很多操作时间会很长，不能让用户在页面上执行PHP脚本，否则页面会被拖死。
一个不错的方案，就是提交到后台去执行。
linux有个命令 nohup command &#038; 这样就会提交到后台，而终端的用户体会不到程序执行的过程。
原来我使用这种方式 shell_exec( &#8220;nohuo php file.php &#038;&#8221; ) 进行后台提交，后来发现速度依然不快， 还是被挂起了。查看手册，exec函数有如下提示：
Note: 如果用本函数启动一个程序并希望保持在后台运行，必须确保该程序的输出被重定向到一个文件或者其它输出流去，否则 PHP 会在程序执行结束前挂起。
因此，这样修改就达到了目的：
exec( &#8220;nohuo php file.php >> /dev/null &#038;&#8221; ) 
]]></description>
			<content:encoded><![CDATA[<p>很多操作时间会很长，不能让用户在页面上执行PHP脚本，否则页面会被拖死。</p>
<p>一个不错的方案，就是提交到后台去执行。</p>
<p>linux有个命令 nohup command &#038; 这样就会提交到后台，而终端的用户体会不到程序执行的过程。</p>
<p>原来我使用这种方式 shell_exec( &#8220;nohuo php file.php &#038;&#8221; ) 进行后台提交，后来发现速度依然不快， 还是被挂起了。查看手册，exec函数有如下提示：</p>
<blockquote><p>Note: 如果用本函数启动一个程序并希望保持在后台运行，必须确保该程序的输出被重定向到一个文件或者其它输出流去，否则 PHP 会在程序执行结束前挂起。</p></blockquote>
<p>因此，这样修改就达到了目的：</p>
<p>exec( &#8220;nohuo php file.php >> /dev/null &#038;&#8221; ) </p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/25/%e6%94%b9%e5%8f%98exec%e7%9a%84%e9%98%bb%e5%a1%9e%e6%a8%a1%e5%bc%8f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>康盛，这么做是不是有点过火了-2</title>
		<link>http://www.sunboyu.cn/2009/12/24/discuz-hole-2.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/24/discuz-hole-2.shtml#comments</comments>
		<pubDate>Thu, 24 Dec 2009 12:15:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[manyou]]></category>

		<category><![CDATA[ucenter]]></category>

		<category><![CDATA[uchome]]></category>

		<category><![CDATA[康盛]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1113</guid>
		<description><![CDATA[自打上篇文章 康盛，这么做是不是有点过火了发表后，引起很多朋友讨论。有些朋友从技术上抨击了这种做法，有些朋友从商业上去理解这种做法。当然，我们是搞技术的，单纯从程序安全和数据安全上来分析一下。
老样子，后台有个get提交：
http://u.discuz.net/customer/update.php?get=a%3A16%3A%7Bs%3A7%3A%22sitekey%22%3Bs%3A16%3A%22f270e28a8b0Qv1Y8%22%3Bs%3A7%3A%22version%22%3Bs%3A3%3A%222.0%22%3Bs%3A7%3A%22release%22%3Bs%3A8%3A%2220090825%22%3Bs%3A3%3A%22php%22%3Bs%3A5%3A%225.2.6%22%3Bs%3A5%3A%22mysql%22%3Bs%3A6%3A%225.0.22%22%3Bs%3A6%3A%22dbsize%22%3Bi%3A1298163%3Bs%3A7%3A%22charset%22%3Bs%3A5%3A%22utf-8%22%3Bs%3A8%3A%22sitename%22%3Bs%3A12%3A%22%E6%88%91%E7%9A%84%E7%A9%BA%E9%97%B4%22%3Bs%3A7%3A%22feednum%22%3Bs%3A2%3A%2210%22%3Bs%3A7%3A%22blognum%22%3Bs%3A1%3A%220%22%3Bs%3A8%3A%22albumnum%22%3Bs%3A1%3A%220%22%3Bs%3A9%3A%22threadnum%22%3Bs%3A1%3A%220%22%3Bs%3A8%3A%22sharenum%22%3Bs%3A1%3A%220%22%3Bs%3A10%3A%22commentnum%22%3Bs%3A1%3A%220%22%3Bs%3A8%3A%22myappnum%22%3Bs%3A1%3A%224%22%3Bs%3A8%3A%22spacenum%22%3Bs%3A1%3A%223%22%3B%7D&#038;h=aa380aa3
urldecode并且反序列化，得出这么一堆东西
Array
(
&#160;&#160; &#160;[sitekey] =&#62; f270e28a8b0Qv1Y8
&#160;&#160; &#160;[version] =&#62; 2.0
&#160;&#160; &#160;[release] =&#62; 20090825
&#160;&#160; &#160;[php] =&#62; 5.2.6
&#160;&#160; &#160;[mysql] =&#62; 5.0.22
&#160;&#160; &#160;[dbsize] =&#62; 1298163
&#160;&#160; &#160;[charset] =&#62; utf-8
&#160;&#160; &#160;[sitename] =&#62; 我的空间
&#160;&#160; &#160;[feednum] =&#62; 10
&#160;&#160; &#160;[blognum] =&#62; 0
&#160;&#160; &#160;[albumnum] =&#62; 0
&#160;&#160; &#160;[threadnum] =&#62; 0
&#160;&#160; &#160;[sharenum] =&#62; 0
&#160;&#160; &#160;[commentnum] =&#62; 0
&#160;&#160; &#160;[myappnum] =&#62; 4
&#160;&#160; &#160;[spacenum] =&#62; 3
)
sitekey是什么？通过阅读代码，sitekey是pre_config表里一个字段，跟以下代码配合工作
$hash = $_SCONFIG['my_siteid'].'&#124;'.$_SGLOBAL['supe_uid'].'&#124;'.$appid.'&#124;'.$current_url.'&#124;'.$extra.'&#124;'.$timestamp.'&#124;'.$_SCONFIG['my_sitekey'];
它跟manyou服务器配合，才有权从你的服务器上拉取你数据库中的某些信息。
其他字段，我们看字面意思基本也能知道是干啥用的。
继续运行程序，我们看当一个用户第一次安装应用的时候做了什么。
这个信息要从服务器上截取，我是根据nginx日志和程序中截取反馈信息获得的。
服务器日志：
124.238.249.171 - - [24/Dec/2009:20:02:40 [...]]]></description>
			<content:encoded><![CDATA[<p>自打上篇文章 <a href="http://www.sunboyu.cn/2009/12/10/discuz-hole.shtml">康盛，这么做是不是有点过火了</a>发表后，引起很多朋友讨论。有些朋友从技术上抨击了这种做法，有些朋友从商业上去理解这种做法。当然，我们是搞技术的，单纯从程序安全和数据安全上来分析一下。</p>
<p>老样子，后台有个get提交：<br />
http://u.discuz.net/customer/update.php?get=a%3A16%3A%7Bs%3A7%3A%22sitekey%22%3Bs%3A16%3A%22f270e28a8b0Qv1Y8%22%3Bs%3A7%3A%22version%22%3Bs%3A3%3A%222.0%22%3Bs%3A7%3A%22release%22%3Bs%3A8%3A%2220090825%22%3Bs%3A3%3A%22php%22%3Bs%3A5%3A%225.2.6%22%3Bs%3A5%3A%22mysql%22%3Bs%3A6%3A%225.0.22%22%3Bs%3A6%3A%22dbsize%22%3Bi%3A1298163%3Bs%3A7%3A%22charset%22%3Bs%3A5%3A%22utf-8%22%3Bs%3A8%3A%22sitename%22%3Bs%3A12%3A%22%E6%88%91%E7%9A%84%E7%A9%BA%E9%97%B4%22%3Bs%3A7%3A%22feednum%22%3Bs%3A2%3A%2210%22%3Bs%3A7%3A%22blognum%22%3Bs%3A1%3A%220%22%3Bs%3A8%3A%22albumnum%22%3Bs%3A1%3A%220%22%3Bs%3A9%3A%22threadnum%22%3Bs%3A1%3A%220%22%3Bs%3A8%3A%22sharenum%22%3Bs%3A1%3A%220%22%3Bs%3A10%3A%22commentnum%22%3Bs%3A1%3A%220%22%3Bs%3A8%3A%22myappnum%22%3Bs%3A1%3A%224%22%3Bs%3A8%3A%22spacenum%22%3Bs%3A1%3A%223%22%3B%7D&#038;h=aa380aa3</p>
<p>urldecode并且反序列化，得出这么一堆东西</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">Array</li>
<li>(</li>
<li>&nbsp;&nbsp; &nbsp;[sitekey] =&gt; f270e28a8b0Qv1Y8</li>
<li>&nbsp;&nbsp; &nbsp;[version] =&gt; 2.0</li>
<li>&nbsp;&nbsp; &nbsp;[release] =&gt; 20090825</li>
<li>&nbsp;&nbsp; &nbsp;[php] =&gt; 5.2.6</li>
<li>&nbsp;&nbsp; &nbsp;[mysql] =&gt; 5.0.22</li>
<li>&nbsp;&nbsp; &nbsp;[dbsize] =&gt; 1298163</li>
<li>&nbsp;&nbsp; &nbsp;[charset] =&gt; utf-8</li>
<li>&nbsp;&nbsp; &nbsp;[sitename] =&gt; 我的空间</li>
<li>&nbsp;&nbsp; &nbsp;[feednum] =&gt; 10</li>
<li>&nbsp;&nbsp; &nbsp;[blognum] =&gt; 0</li>
<li>&nbsp;&nbsp; &nbsp;[albumnum] =&gt; 0</li>
<li>&nbsp;&nbsp; &nbsp;[threadnum] =&gt; 0</li>
<li>&nbsp;&nbsp; &nbsp;[sharenum] =&gt; 0</li>
<li>&nbsp;&nbsp; &nbsp;[commentnum] =&gt; 0</li>
<li>&nbsp;&nbsp; &nbsp;[myappnum] =&gt; 4</li>
<li>&nbsp;&nbsp; &nbsp;[spacenum] =&gt; 3</li>
<li>)</li></ol></div>
<p>sitekey是什么？通过阅读代码，sitekey是pre_config表里一个字段，跟以下代码配合工作</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">$hash = $_SCONFIG['my_siteid'].'|'.$_SGLOBAL['supe_uid'].'|'.$appid.'|'.$current_url.'|'.$extra.'|'.$timestamp.'|'.$_SCONFIG['my_sitekey'];</li></ol></div>
<p>它跟manyou服务器配合，才有权从你的服务器上拉取你数据库中的某些信息。</p>
<p>其他字段，我们看字面意思基本也能知道是干啥用的。</p>
<p>继续运行程序，我们看当一个用户第一次安装应用的时候做了什么。</p>
<p>这个信息要从服务器上截取，我是根据nginx日志和程序中截取反馈信息获得的。</p>
<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">124.238.249.171 - - [24/Dec/2009:20:02:40 +0800] &quot;POST /uhome/api/my.php HTTP/1.0&quot; 200 192 &quot;-&quot; &quot;myop/1.0&quot; &quot;-&quot;</li></ol></div>
<p>manyou服务器发来post请求。post信息不会在日志里，底下是我抓取来的信息：</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">[post] =&gt; Array</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[module] =&gt; Users</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[method] =&gt; getInfo</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[sign] =&gt; 271ce9942c94fc4f4d39445e133105bc</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[params] =&gt; a:1:{s:4:\&quot;uIds\&quot;;a:1:{i:0;s:1:\&quot;3\&quot;;}}</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)</li></ol></div>
<p>做过sns网站应用开发的应该很容易看懂底大概是什么意思。<br />
看看我们的程序给manyou平台返回了什么信息：</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">[result] =&gt; Array</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[0] =&gt; Array</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[uId] =&gt; 3</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[handle] =&gt; sunboyu1</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[action] =&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[realName] =&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[realNameChecked] =&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[gender] =&gt; unknown</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[email] =&gt; dfafdasf@123.fdsafds</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[qq] =&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[msn] =&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[birthday] =&gt; 0000-00-00</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[bloodType] =&gt; unknown</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[relationshipStatus] =&gt; unknown</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[birthProvince] =&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[birthCity] =&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[resideProvince] =&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[resideCity] =&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[viewNum] =&gt; 0</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[friendNum] =&gt; 0</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[myStatus] =&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[lastActivity] =&gt; 0</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[created] =&gt; 1261655045</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[credit] =&gt; 25</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[isUploadAvatar] =&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[adminLevel] =&gt; none</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[homepagePrivacy] =&gt; public</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[profilePrivacyList] =&gt; Array</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[friendListPrivacy] =&gt; public</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[mode] =&gt;</li></ol></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">[result] =&gt; Array</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[totalNum] =&gt; 0</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[friends] =&gt; Array</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[me] =&gt; Array</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[uId] =&gt; 4</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[handle] =&gt; sunboyu2</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[action] =&gt; </li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[realName] =&gt; 一个程序猿</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[realNameChecked] =&gt; 1</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[gender] =&gt; male</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[email] =&gt; 1231231@fdsfdsa.com</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[qq] =&gt; 176300676</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[msn] =&gt; sunboyu@gmail.com</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[birthday] =&gt; 2004-02-01</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[bloodType] =&gt; B</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[relationshipStatus] =&gt; single</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[birthProvince] =&gt; 北京</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[birthCity] =&gt; 东城</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[resideProvince] =&gt; 黑龙江</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[resideCity] =&gt; 佳木斯</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[viewNum] =&gt; 0</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[friendNum] =&gt; 0</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[myStatus] =&gt; </li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[lastActivity] =&gt; 1261657227</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[created] =&gt; 1261657100</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[credit] =&gt; 40</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[isUploadAvatar] =&gt; 1</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[adminLevel] =&gt; none</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[homepagePrivacy] =&gt; friends</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[profilePrivacyList] =&gt; Array</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[relationshipStatus] =&gt; friends</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[birthday] =&gt; friends</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[bloodType] =&gt; me</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[birthPlace] =&gt; public</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[residePlace] =&gt; public</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[qq] =&gt; me</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[mobile] =&gt; public</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[msn] =&gt; public</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[friendListPrivacy] =&gt; me</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;)</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[mode] =&gt; </li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;)</li></ol></div>
<p>差不多基本资料都过去了。</p>
<p>这样，可以看出，康盛的服务器不断得在抓取用户的信息。这个事情是不是过火，从商业的角度，是应该很过火的。他把用户产品内的账号信息等关键东西都抓走，这些信息到他们手里，难免会交易给竞争对手。<br />
但是，从技术上讲，康盛的manyou服务器还有个缓存的功能。如果拉取用户信息这个请求都放在网站的服务器上，我相信大多数虚拟主机的用户会不堪重负，而康盛其实为这些负载买单了。买单的结果，就是你得把用户的信息提供给康盛。就这么简单。</p>
<p>从程序安全上讲，你的数据库信息，尤其用户信息，在你的网站和manyou之间共享，而康盛没有拉走用户或者管理员资料，也没有发现其他信息的提取，所以，两者之间是安全的。第三方网站是无法获得这些资料的。</p>
<p>但从商业安全上讲，康盛的服务器是否可信？康盛是否会拿这些信息作一些站长不希望做的事情？这个只能由官方来解释了。</p>
<p>睡一觉，研究其他产品去。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/24/discuz-hole-2.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>nginx做反向代理的配置</title>
		<link>http://www.sunboyu.cn/2009/12/16/nginx%e5%81%9a%e5%8f%8d%e5%90%91%e4%bb%a3%e7%90%86%e7%9a%84%e9%85%8d%e7%bd%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/16/nginx%e5%81%9a%e5%8f%8d%e5%90%91%e4%bb%a3%e7%90%86%e7%9a%84%e9%85%8d%e7%bd%ae.shtml#comments</comments>
		<pubDate>Wed, 16 Dec 2009 10:39:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[proxy]]></category>

		<category><![CDATA[反向代理]]></category>

		<category><![CDATA[透明代理]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1101</guid>
		<description><![CDATA[感谢铎哥的配置，感谢宴哥解决ssl连接的问题。
server
&#160;{
&#160;&#160; &#160; &#160; &#160;listen&#160; &#160; &#160; 8181;
&#160;&#160; &#160; &#160; &#160;resolver 202.96.64.68;
&#160;&#160; &#160; &#160; &#160;location /
&#160;&#160; &#160; &#160; &#160;{
&#160;&#160; &#160; &#160; &#160; &#160; &#160;proxy_pass http://$http_host$request_uri;
&#160;&#160; &#160; &#160; &#160; &#160; &#160;proxy_redirect&#160; &#160; &#160; &#160; &#160; off;
&#160;&#160; &#160; &#160; &#160; &#160; &#160;proxy_set_header&#160; &#160; &#160; &#160; Host&#160; &#160; &#160; &#160; &#160; &#160; $host;
&#160;&#160; &#160; &#160; &#160; &#160; &#160;proxy_set_header&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>感谢铎哥的配置，感谢宴哥解决ssl连接的问题。</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">server</li>
<li>&nbsp;{</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;listen&nbsp; &nbsp; &nbsp; 8181;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;resolver 202.96.64.68;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;location /</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_pass http://$http_host$request_uri;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_redirect&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; off;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_set_header&nbsp; &nbsp; &nbsp; &nbsp; Host&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $host;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_set_header&nbsp; &nbsp; &nbsp; &nbsp; X-Real-IP&nbsp; &nbsp; &nbsp; &nbsp;$remote_addr;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_set_header&nbsp; &nbsp; &nbsp; &nbsp; X-Forwarded-For $proxy_add_x_forwarded_for;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;client_max_body_size&nbsp; &nbsp; 10m;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;client_body_buffer_size 128k;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_connect_timeout&nbsp; &nbsp;90;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_send_timeout&nbsp; &nbsp; &nbsp; 90;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_read_timeout&nbsp; &nbsp; &nbsp; 90;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;proxy_buffers&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;32 4k;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;access_log /home/proxy.log;</li>
<li>&nbsp;}</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/16/nginx%e5%81%9a%e5%8f%8d%e5%90%91%e4%bb%a3%e7%90%86%e7%9a%84%e9%85%8d%e7%bd%ae.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>django进程管理器</title>
		<link>http://www.sunboyu.cn/2009/12/16/django%e8%bf%9b%e7%a8%8b%e7%ae%a1%e7%90%86%e5%99%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/16/django%e8%bf%9b%e7%a8%8b%e7%ae%a1%e7%90%86%e5%99%a8.shtml#comments</comments>
		<pubDate>Wed, 16 Dec 2009 08:42:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1099</guid>
		<description><![CDATA[nginx+php，php有个进程管理器，为php-fpm，Django没有，网上大概看了看，找出了几段，小改一下，能用了。
#!/bin/bash
siteroot=&#34;/home/project/sun&#34;
sitename=&#34;http://python.sunboyu.cn&#34;
cd $siteroot
if [ $# -lt 1 ];then
&#160;&#160; &#160;echo &#34;Usages: server.sh [start&#124;stop&#124;restart]&#34;
&#160;&#160; &#160;exit 0
fi
&#160;
if [ $1 = start ];then
&#160;&#160; &#160;isrun=`ps aux&#124;grep &#34;manage.py runfcgi&#34;&#124;grep -v &#34;grep&#34;&#124;wc -l`
&#160;&#160; &#160;if [ $isrun -eq 1 ];then
&#160;&#160; &#160; &#160; &#160;echo $sitename&#34; has running!&#34;
&#160;&#160; &#160; &#160; &#160;exit 0
&#160;&#160; &#160;else
&#160;&#160; &#160; &#160; &#160;python manage.py runfcgi method=threaded host=127.0.0.1 port=8000 --settings=settings
&#160;&#160; &#160; &#160; &#160;echo $sitename&#34;is [...]]]></description>
			<content:encoded><![CDATA[<p>nginx+php，php有个进程管理器，为php-fpm，Django没有，网上大概看了看，找出了几段，小改一下，能用了。</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">#!/bin/bash</li>
<li>siteroot=&quot;/home/project/sun&quot;</li>
<li>sitename=&quot;http://python.sunboyu.cn&quot;</li>
<li>cd $siteroot</li>
<li>if [ $# -lt 1 ];then</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;Usages: server.sh [start|stop|restart]&quot;</li>
<li>&nbsp;&nbsp; &nbsp;exit 0</li>
<li>fi</li>
<li>&nbsp;</li>
<li>if [ $1 = start ];then</li>
<li>&nbsp;&nbsp; &nbsp;isrun=`ps aux|grep &quot;manage.py runfcgi&quot;|grep -v &quot;grep&quot;|wc -l`</li>
<li>&nbsp;&nbsp; &nbsp;if [ $isrun -eq 1 ];then</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo $sitename&quot; has running!&quot;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;exit 0</li>
<li>&nbsp;&nbsp; &nbsp;else</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;python manage.py runfcgi method=threaded host=127.0.0.1 port=8000 --settings=settings</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;echo $sitename&quot;is running!!&quot;</li>
<li>&nbsp;&nbsp; &nbsp;fi</li>
<li>elif [ $1 = stop ];then</li>
<li>&nbsp;&nbsp; &nbsp;djid=`ps aux|grep &quot;manage.py runfcgi&quot;|grep -v &quot;grep&quot;|awk '{print $2}'`</li>
<li>&nbsp;&nbsp; &nbsp;kill -9 $djid</li>
<li>&nbsp;&nbsp; &nbsp;echo $sitename&quot; is stop!&quot;</li>
<li>elif [ $1 = restart ];then</li>
<li>&nbsp;&nbsp; &nbsp;djid=`ps aux|grep &quot;manage.py runfcgi&quot;|grep -v &quot;grep&quot;|awk '{print $2}'`</li>
<li>&nbsp;&nbsp; &nbsp;kill -9 $djid</li>
<li>&nbsp;&nbsp; &nbsp;echo $sitename&quot; is stop!!&quot;</li>
<li>&nbsp;&nbsp; &nbsp;python manage.py runfcgi method=threaded host=127.0.0.1 port=8000 --settings=settings</li>
<li>&nbsp;&nbsp; &nbsp;echo $sitename&quot; is start!!&quot;</li>
<li>else</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;Usages: server.sh [start|stop|restart]&quot;</li>
<li>fi</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/16/django%e8%bf%9b%e7%a8%8b%e7%ae%a1%e7%90%86%e5%99%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>django+nginx的部分配置</title>
		<link>http://www.sunboyu.cn/2009/12/16/djangonginx%e7%9a%84%e9%83%a8%e5%88%86%e9%85%8d%e7%bd%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/16/djangonginx%e7%9a%84%e9%83%a8%e5%88%86%e9%85%8d%e7%bd%ae.shtml#comments</comments>
		<pubDate>Wed, 16 Dec 2009 03:26:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[django]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[配置]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1097</guid>
		<description><![CDATA[nginx的配置，特别感谢爱词霸的吕同学，发扬了开源共享的精神，大大缩短了我的调试成本。
server {
&#160;&#160; &#160;listen 80;
&#160;&#160; &#160;server_name python.sunboyu.cn;
&#160;&#160; &#160;location / {
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_pass 127.0.0.1:8000;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_buffers&#160; &#160; &#160; 16&#160; 128k;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_ignore_client_abort&#160; on;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_read_timeout 60;
&#160;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_param PATH_INFO $fastcgi_script_name;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_param REQUEST_METHOD $request_method;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_param QUERY_STRING $query_string;
&#160;&#160; &#160; &#160; &#160; &#160;fastcgi_param CONTENT_TYPE [...]]]></description>
			<content:encoded><![CDATA[<p>nginx的配置，特别感谢<a href='http://www.iciba.com/' target='_blank'>爱词霸</a>的<a href='http://blog.lvscar.info/' target='_blank'>吕同学</a>，发扬了开源共享的精神，大大缩短了我的调试成本。</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">server {</li>
<li>&nbsp;&nbsp; &nbsp;listen 80;</li>
<li>&nbsp;&nbsp; &nbsp;server_name python.sunboyu.cn;</li>
<li>&nbsp;&nbsp; &nbsp;location / {</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_pass 127.0.0.1:8000;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_buffers&nbsp; &nbsp; &nbsp; 16&nbsp; 128k;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_ignore_client_abort&nbsp; on;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_read_timeout 60;</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param PATH_INFO $fastcgi_script_name;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param REQUEST_METHOD $request_method;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param QUERY_STRING $query_string;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param CONTENT_TYPE $content_type;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param CONTENT_LENGTH $content_length;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param SERVER_PROTOCOL&nbsp; $server_protocol;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param SERVER_PORT&nbsp; &nbsp; &nbsp; $server_port;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_param SERVER_NAME&nbsp; $server_name;</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_pass_header Authorization;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;fastcgi_intercept_errors off;</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;}</li>
<li>}</li></ol></div>
<p>同时附上一个额外的文档，nginx变量跟cgi协议的对应关系。<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">#&nbsp; &nbsp; Fast CGI param reference</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SCRIPT_FILENAME&nbsp; $document_root$fastcgi_script_name;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; QUERY_STRING&nbsp; $query_string;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; REQUEST_METHOD&nbsp; $request_method;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; CONTENT_TYPE&nbsp; $content_type;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; CONTENT_LENGTH&nbsp; $content_length;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; GATEWAY_INTERFACE&nbsp; CGI/1.1;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SERVER_SOFTWARE&nbsp; nginx;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SCRIPT_NAME&nbsp; $fastcgi_script_name;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; REQUEST_URI&nbsp; $request_uri;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; DOCUMENT_URI&nbsp; $document_uri;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; DOCUMENT_ROOT&nbsp; $document_root;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SERVER_PROTOCOL&nbsp; $server_protocol;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; REMOTE_ADDR&nbsp; $remote_addr;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; REMOTE_PORT&nbsp; $remote_port;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SERVER_ADDR&nbsp; $server_addr;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SERVER_PORT&nbsp; $server_port;</li>
<li>#&nbsp; &nbsp; fastcgi_param&nbsp; &nbsp; SERVER_NAME&nbsp; $server_name;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/16/djangonginx%e7%9a%84%e9%83%a8%e5%88%86%e9%85%8d%e7%bd%ae.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>django笔记3-DEMO篇</title>
		<link>http://www.sunboyu.cn/2009/12/15/django%e7%ac%94%e8%ae%b03-demo%e7%af%87.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/15/django%e7%ac%94%e8%ae%b03-demo%e7%af%87.shtml#comments</comments>
		<pubDate>Tue, 15 Dec 2009 13:06:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[demo]]></category>

		<category><![CDATA[django]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1089</guid>
		<description><![CDATA[1、创建一个project（可理解为站点）
django-admin.py startproject project1
发现新建了一个文件夹 project1
2、创建一个app（可理解为一个……）
python manage.py app1
发现多了一个文件夹 app1
3 、vi ./app1/views.py  增加代码
from django.http import HttpResponse
def index(self,request):
&#160;&#160; &#160;return HttpResponse('hello test')
4、vi ./urls.py  增加代码
( r&#8217;^tests/&#8217; , &#8216;project1.app1.views.index&#8217; ),
5、启动服务
python manage.py runserver domain.com:8000
然后在浏览器打 domain.com:8000/tests
如果能看到 hello test则证明配置成功。
如果不成功，看debug信息吧，debug默认是开启的。
另外我自己配置使用fastcgi方式运行python，python manage.py runfcgi host=127.0.0.1 port=8000,然后用nginx代理访问。两种方式还有所不同，具体的不同点暂时还不知道，希望知道这些差别的大大们多加提示，继续研究中。
]]></description>
			<content:encoded><![CDATA[<p>1、创建一个project（可理解为站点）</p>
<p>django-admin.py startproject project1</p>
<p>发现新建了一个文件夹 project1</p>
<p>2、创建一个app（可理解为一个……）</p>
<p>python manage.py app1</p>
<p>发现多了一个文件夹 app1</p>
<p>3 、vi ./app1/views.py  增加代码</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">from django.http import HttpResponse</li>
<li>def index(self,request):</li>
<li>&nbsp;&nbsp; &nbsp;return HttpResponse('hello test')</li></ol></div>
<p>4、vi ./urls.py  增加代码<br />
( r&#8217;^tests/&#8217; , &#8216;project1.app1.views.index&#8217; ),</p>
<p>5、启动服务</p>
<p>python manage.py runserver domain.com:8000</p>
<p>然后在浏览器打 domain.com:8000/tests</p>
<p>如果能看到 hello test则证明配置成功。</p>
<p>如果不成功，看debug信息吧，debug默认是开启的。</p>
<blockquote><p>另外我自己配置使用fastcgi方式运行python，python manage.py runfcgi host=127.0.0.1 port=8000,然后用nginx代理访问。两种方式还有所不同，具体的不同点暂时还不知道，希望知道这些差别的大大们多加提示，继续研究中。</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/15/django%e7%ac%94%e8%ae%b03-demo%e7%af%87.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>django笔记2-配置篇</title>
		<link>http://www.sunboyu.cn/2009/12/15/django%e7%ac%94%e8%ae%b02-%e9%85%8d%e7%bd%ae%e7%af%87.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/15/django%e7%ac%94%e8%ae%b02-%e9%85%8d%e7%bd%ae%e7%af%87.shtml#comments</comments>
		<pubDate>Tue, 15 Dec 2009 12:37:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<category><![CDATA[原创技术]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1086</guid>
		<description><![CDATA[1、升级linux的python为最新版本
ln -s /usr/bin/python /opt/python**{your install path}**/bin/python
2、设置django-admin.py至系统命令
ln -s /opt/python**{your install path}**/lib/python2.5/site-packages/django/bin/django-admin.py  /usr/bin/django-admin.py
然后查看 django-admin.py &#8211;version
回显版本正确，则证明系统配置成功。
]]></description>
			<content:encoded><![CDATA[<p>1、升级linux的python为最新版本</p>
<p>ln -s /usr/bin/python /opt/python**{your install path}**/bin/python</p>
<p>2、设置django-admin.py至系统命令</p>
<p>ln -s /opt/python**{your install path}**/lib/python2.5/site-packages/django/bin/django-admin.py  /usr/bin/django-admin.py</p>
<p>然后查看 django-admin.py &#8211;version</p>
<p>回显版本正确，则证明系统配置成功。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/15/django%e7%ac%94%e8%ae%b02-%e9%85%8d%e7%bd%ae%e7%af%87.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>django笔记1-安装篇</title>
		<link>http://www.sunboyu.cn/2009/12/14/django%e7%ac%94%e8%ae%b01-%e5%ae%89%e8%a3%85%e7%af%87.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/14/django%e7%ac%94%e8%ae%b01-%e5%ae%89%e8%a3%85%e7%af%87.shtml#comments</comments>
		<pubDate>Mon, 14 Dec 2009 11:02:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[django]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1082</guid>
		<description><![CDATA[1、安装django，当然要安装python，我安装的python2.5
./configure &#8211;prefix=你的路径
2、安装mysqldb
这个可以看这篇文章 http://www.sunboyu.cn/2009/04/22/python25mysqldb122%E5%AE%89%E8%A3%85.shtml
3、安装easl_install
http://pypi.python.org/pypi/setuptools  我下的源码，按照提示安装就行
4、使用easl_install安装flup
地址 http://www.saddi.com/software/flup/dist/flup-1.0.2-py2.5.egg
5、安装django1.1
python setup install
到这里大体就算安装完了，底下配置。
]]></description>
			<content:encoded><![CDATA[<p>1、安装django，当然要安装python，我安装的python2.5</p>
<p>./configure &#8211;prefix=你的路径</p>
<p>2、安装mysqldb</p>
<p>这个可以看这篇文章 http://www.sunboyu.cn/2009/04/22/python25mysqldb122%E5%AE%89%E8%A3%85.shtml</p>
<p>3、安装easl_install</p>
<p>http://pypi.python.org/pypi/setuptools  我下的源码，按照提示安装就行</p>
<p>4、使用easl_install安装flup</p>
<p>地址 http://www.saddi.com/software/flup/dist/flup-1.0.2-py2.5.egg</p>
<p>5、安装django1.1</p>
<p>python setup install</p>
<p>到这里大体就算安装完了，底下配置。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/14/django%e7%ac%94%e8%ae%b01-%e5%ae%89%e8%a3%85%e7%af%87.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>完全缓存discuz论坛数据</title>
		<link>http://www.sunboyu.cn/2009/12/06/%e5%ae%8c%e5%85%a8%e7%bc%93%e5%ad%98discuz%e8%ae%ba%e5%9d%9b%e6%95%b0%e6%8d%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2009/12/06/%e5%ae%8c%e5%85%a8%e7%bc%93%e5%ad%98discuz%e8%ae%ba%e5%9d%9b%e6%95%b0%e6%8d%ae.shtml#comments</comments>
		<pubDate>Sun, 06 Dec 2009 14:15:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1072</guid>
		<description><![CDATA[最近一直在琢磨discuz的优化，想出一些数据缓存的策略：
index.php  部分数据已经进行了缓存，但需要全部缓存，只有当 页面刷新数/更新时间 >>>>  发帖数/更新时间 ，则有必要做此缓存，此处缓存更新最为频繁，适合做内存缓存，但 更新时间不宜太久，此时间根据首页更新频度确定。
forumdisplay.php  更新频繁，优化策略同上，只是更新频度略低于首页。
viewthread.php  回复更新频繁，内容更新频度低，适合做硬盘缓存。但分页部分不可做缓存，否则……
space.php  更新不频繁，适合做硬盘缓存。
faq.php  做个静态即可。
以上分析只是根据平时维护总结，临时脑子一蹦，未作具体分析，欢迎广大站长讨论试用。版权所有，欢迎盗版。
]]></description>
			<content:encoded><![CDATA[<p>最近一直在琢磨discuz的优化，想出一些数据缓存的策略：</p>
<p>index.php  部分数据已经进行了缓存，但需要全部缓存，只有当 页面刷新数/更新时间 >>>>  发帖数/更新时间 ，则有必要做此缓存，此处缓存更新最为频繁，适合做内存缓存，但 更新时间不宜太久，此时间根据首页更新频度确定。</p>
<p>forumdisplay.php  更新频繁，优化策略同上，只是更新频度略低于首页。</p>
<p>viewthread.php  回复更新频繁，内容更新频度低，适合做硬盘缓存。但分页部分不可做缓存，否则……</p>
<p>space.php  更新不频繁，适合做硬盘缓存。</p>
<p>faq.php  做个静态即可。</p>
<p>以上分析只是根据平时维护总结，临时脑子一蹦，未作具体分析，欢迎广大站长讨论试用。版权所有，欢迎盗版。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/12/06/%e5%ae%8c%e5%85%a8%e7%bc%93%e5%ad%98discuz%e8%ae%ba%e5%9d%9b%e6%95%b0%e6%8d%ae.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>大话discuz性能优化</title>
		<link>http://www.sunboyu.cn/2009/11/27/%e5%a4%a7%e8%af%9ddiscuz%e6%80%a7%e8%83%bd%e4%bc%98%e5%8c%96.shtml</link>
		<comments>http://www.sunboyu.cn/2009/11/27/%e5%a4%a7%e8%af%9ddiscuz%e6%80%a7%e8%83%bd%e4%bc%98%e5%8c%96.shtml#comments</comments>
		<pubDate>Fri, 27 Nov 2009 15:46:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1065</guid>
		<description><![CDATA[接此篇  http://www.sunboyu.cn/2009/11/05/discuz%E8%AE%BA%E5%9D%9B%E4%BC%98%E5%8C%96.shtml
最近一直在修改discuz，看到了很多问题，在跟系统工程部门合作的时候，也看到了很多比较优秀的解决方案，可以引入到系统中。
底下粗略讲述下已经做过的优化和可以着手进行的优化。
对于一个数据量比较大的论坛，首先是分表。posts表，threads表是必须要分的。可以按照forum表的fid进行分，也可以使用tid进行hash散列分布。分表带来的问题，显然是分页。我们进行排序的时候不可能去进行union查询，否则就失去了分表的意义。在这里，我们使用了一个支持排序的key-value型存储的小型数据库-Tokyo Tyrant（http://1978th.net/tokyotyrant/），用此数据库去同步threads表和posts表的数据，达到高速分页。（附：典型应用可以参见此文章 http://blog.s135.com/tcsql/ ）
随着数据表的膨胀，很多join联查必须进行拆分。分表可能强制我们去拆分联查，另外一些很变动不大的表，比如用户信息表的数据，使用率明显很高，变动不会太大，而使用key-value存储再合适不过。这时候，bdb和memcached是首选，我推荐使用bdb，可以持久存储于硬盘上，由用户更新资料触发更新，不必考虑过期和服务器重启的问题。这样可以减少太多的join联查，而节约数据库服务器的缓存。
随着静态文件的增长和访问量的增长，带宽浪费是一个值得考虑的问题。我们打开discuz的首页，静态文件要比php文件多好几倍，而每个文件都夹带了长长的cookie信息，因此，把这些cookie去掉显然会节约大量的带宽。discuz的文件结构还是很不错的，通常通过一个参数的配置或者全文替换就能完成这项工作。此应用，可以在新浪所有的图片上有所体现。
全文检索是mysql所不擅长的，因此附加一个好的全文检索方案很必须，我熟悉的方案：Lucene，sphinx，whoosh是我喜欢的几个全文检索的工具，对于discuz的负载，我感觉任何一个都能满足应用。在此方案上，设计一个完美的同步触发机制很重要。
还有很多问题，都在待发现中，部分问题已经解决，部分问题可以优化。discuz优化好，其实是个不错的产品。
]]></description>
			<content:encoded><![CDATA[<p>接此篇  http://www.sunboyu.cn/2009/11/05/discuz%E8%AE%BA%E5%9D%9B%E4%BC%98%E5%8C%96.shtml</p>
<p>最近一直在修改discuz，看到了很多问题，在跟系统工程部门合作的时候，也看到了很多比较优秀的解决方案，可以引入到系统中。</p>
<p>底下粗略讲述下已经做过的优化和可以着手进行的优化。</p>
<p>对于一个数据量比较大的论坛，首先是分表。posts表，threads表是必须要分的。可以按照forum表的fid进行分，也可以使用tid进行hash散列分布。分表带来的问题，显然是分页。我们进行排序的时候不可能去进行union查询，否则就失去了分表的意义。在这里，我们使用了一个支持排序的key-value型存储的小型数据库-Tokyo Tyrant（http://1978th.net/tokyotyrant/），用此数据库去同步threads表和posts表的数据，达到高速分页。（附：典型应用可以参见此文章 http://blog.s135.com/tcsql/ ）</p>
<p>随着数据表的膨胀，很多join联查必须进行拆分。分表可能强制我们去拆分联查，另外一些很变动不大的表，比如用户信息表的数据，使用率明显很高，变动不会太大，而使用key-value存储再合适不过。这时候，bdb和memcached是首选，我推荐使用bdb，可以持久存储于硬盘上，由用户更新资料触发更新，不必考虑过期和服务器重启的问题。这样可以减少太多的join联查，而节约数据库服务器的缓存。</p>
<p>随着静态文件的增长和访问量的增长，带宽浪费是一个值得考虑的问题。我们打开discuz的首页，静态文件要比php文件多好几倍，而每个文件都夹带了长长的cookie信息，因此，把这些cookie去掉显然会节约大量的带宽。discuz的文件结构还是很不错的，通常通过一个参数的配置或者全文替换就能完成这项工作。此应用，可以在新浪所有的图片上有所体现。</p>
<p>全文检索是mysql所不擅长的，因此附加一个好的全文检索方案很必须，我熟悉的方案：Lucene，sphinx，whoosh是我喜欢的几个全文检索的工具，对于discuz的负载，我感觉任何一个都能满足应用。在此方案上，设计一个完美的同步触发机制很重要。</p>
<p>还有很多问题，都在待发现中，部分问题已经解决，部分问题可以优化。discuz优化好，其实是个不错的产品。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/11/27/%e5%a4%a7%e8%af%9ddiscuz%e6%80%a7%e8%83%bd%e4%bc%98%e5%8c%96.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>给WordPress加了个每日谚语插件</title>
		<link>http://www.sunboyu.cn/2009/11/23/%e7%bb%99wordpress%e5%8a%a0%e4%ba%86%e4%b8%aa%e6%af%8f%e6%97%a5%e8%b0%9a%e8%af%ad%e6%8f%92%e4%bb%b6.shtml</link>
		<comments>http://www.sunboyu.cn/2009/11/23/%e7%bb%99wordpress%e5%8a%a0%e4%ba%86%e4%b8%aa%e6%af%8f%e6%97%a5%e8%b0%9a%e8%af%ad%e6%8f%92%e4%bb%b6.shtml#comments</comments>
		<pubDate>Mon, 23 Nov 2009 15:04:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1060</guid>
		<description><![CDATA[很久没写点自己的小代码了，感觉手生。
&#60; ?=$voice[rand(0,count($voice)-1)]?&#62;&#160; #加在title的地方，$voice这个数组随便找个地方塞一下就行
]]></description>
			<content:encoded><![CDATA[<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">&lt; ?=$voice[rand(0,count($voice)-1)]?&gt;&nbsp; #加在title的地方，$voice这个数组随便找个地方塞一下就行</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/11/23/%e7%bb%99wordpress%e5%8a%a0%e4%ba%86%e4%b8%aa%e6%af%8f%e6%97%a5%e8%b0%9a%e8%af%ad%e6%8f%92%e4%bb%b6.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>流程的改进和代码控制</title>
		<link>http://www.sunboyu.cn/2009/11/21/%e6%b5%81%e7%a8%8b%e7%9a%84%e6%94%b9%e8%bf%9b%e5%92%8c%e4%bb%a3%e7%a0%81%e6%8e%a7%e5%88%b6.shtml</link>
		<comments>http://www.sunboyu.cn/2009/11/21/%e6%b5%81%e7%a8%8b%e7%9a%84%e6%94%b9%e8%bf%9b%e5%92%8c%e4%bb%a3%e7%a0%81%e6%8e%a7%e5%88%b6.shtml#comments</comments>
		<pubDate>Sat, 21 Nov 2009 01:37:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1055</guid>
		<description><![CDATA[最近一直在修改系统，并无太多原创的代码。其中修改了ucenterhome和discuz两套代码。
ucenterhome原来的队伍进行优化后，我又改进了分享功能。此功能虽然上线，功能也无大碍，但UE方面差强人意，主要是因为年前项目紧张，此项目投入人力并不多的原因。此功能修改，无详细的需求文档，也未进行详细的需求分析和业务逻辑设计，就匆匆开始了编码过程，结果就是：代码比较混乱，结构性比较差，升级和改进的潜力小。如果要改进，面临的结果就是重写。又因为uchome本身的设计结构，无论改写和重写成本都比较高。
因此，前期的规划是比较重要的，前期多想一点，后期就能节约更多的时间和精力。
这种做法马上应用到下一个项目中：discuz论坛的优化和功能改造。
前期对需求做了详细的分析，在中间不断的需求细化和明确，因此，功能和业务逻辑清晰，代码在修改的时候，保留了原来功能，只做了功能的分支。虽然前期的需求交流花费了较多的时间，但编码过程所花费的时间就很小了。
后者的流程才是以后要继续发扬的流程。
]]></description>
			<content:encoded><![CDATA[<p>最近一直在修改系统，并无太多原创的代码。其中修改了ucenterhome和discuz两套代码。</p>
<p>ucenterhome原来的队伍进行优化后，我又改进了分享功能。此功能虽然上线，功能也无大碍，但UE方面差强人意，主要是因为年前项目紧张，此项目投入人力并不多的原因。此功能修改，无详细的需求文档，也未进行详细的需求分析和业务逻辑设计，就匆匆开始了编码过程，结果就是：代码比较混乱，结构性比较差，升级和改进的潜力小。如果要改进，面临的结果就是重写。又因为uchome本身的设计结构，无论改写和重写成本都比较高。</p>
<p>因此，前期的规划是比较重要的，前期多想一点，后期就能节约更多的时间和精力。</p>
<p>这种做法马上应用到下一个项目中：discuz论坛的优化和功能改造。</p>
<p>前期对需求做了详细的分析，在中间不断的需求细化和明确，因此，功能和业务逻辑清晰，代码在修改的时候，保留了原来功能，只做了功能的分支。虽然前期的需求交流花费了较多的时间，但编码过程所花费的时间就很小了。</p>
<p>后者的流程才是以后要继续发扬的流程。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/11/21/%e6%b5%81%e7%a8%8b%e7%9a%84%e6%94%b9%e8%bf%9b%e5%92%8c%e4%bb%a3%e7%a0%81%e6%8e%a7%e5%88%b6.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>一段清理系统垃圾的代码（只用于windows）</title>
		<link>http://www.sunboyu.cn/2009/11/17/%e4%b8%80%e6%ae%b5%e6%b8%85%e7%90%86%e7%b3%bb%e7%bb%9f%e5%9e%83%e5%9c%be%e7%9a%84%e4%bb%a3%e7%a0%81%ef%bc%88%e5%8f%aa%e7%94%a8%e4%ba%8ewindows%ef%bc%89.shtml</link>
		<comments>http://www.sunboyu.cn/2009/11/17/%e4%b8%80%e6%ae%b5%e6%b8%85%e7%90%86%e7%b3%bb%e7%bb%9f%e5%9e%83%e5%9c%be%e7%9a%84%e4%bb%a3%e7%a0%81%ef%bc%88%e5%8f%aa%e7%94%a8%e4%ba%8ewindows%ef%bc%89.shtml#comments</comments>
		<pubDate>Tue, 17 Nov 2009 06:28:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1048</guid>
		<description><![CDATA[clean
]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.sunboyu.cn/upfiles/2009/11/clean.bat'>clean</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/11/17/%e4%b8%80%e6%ae%b5%e6%b8%85%e7%90%86%e7%b3%bb%e7%bb%9f%e5%9e%83%e5%9c%be%e7%9a%84%e4%bb%a3%e7%a0%81%ef%bc%88%e5%8f%aa%e7%94%a8%e4%ba%8ewindows%ef%bc%89.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>phpmyadmin语句定界符的问题</title>
		<link>http://www.sunboyu.cn/2009/11/11/phpmyadmin%e8%af%ad%e5%8f%a5%e5%ae%9a%e7%95%8c%e7%ac%a6%e7%9a%84%e9%97%ae%e9%a2%98.shtml</link>
		<comments>http://www.sunboyu.cn/2009/11/11/phpmyadmin%e8%af%ad%e5%8f%a5%e5%ae%9a%e7%95%8c%e7%ac%a6%e7%9a%84%e9%97%ae%e9%a2%98.shtml#comments</comments>
		<pubDate>Wed, 11 Nov 2009 09:59:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1034</guid>
		<description><![CDATA[用phpmyadmin写触发器的朋友，不知道有没有碰见这个问题：用pma导出的语句，死活倒不进去，mysqldump导出的，也不能用pma倒入。
反正问题多多，很令人头疼。
今天再次碰到这个问题后，偶然发现个问题，就是sql输入框下的一个小的内容：语句定界符。
平时导出sql，语句定界符默认是分号，而编辑触发器的时候，是两个斜杠//。
蹊跷就在这里，导入的时候使用的定界符必须跟倒出时候的定界符保持一致，否则就会出现错误。
问题发现后，老王是相当的高兴啊。
]]></description>
			<content:encoded><![CDATA[<p>用phpmyadmin写触发器的朋友，不知道有没有碰见这个问题：用pma导出的语句，死活倒不进去，mysqldump导出的，也不能用pma倒入。</p>
<p>反正问题多多，很令人头疼。</p>
<p>今天再次碰到这个问题后，偶然发现个问题，就是sql输入框下的一个小的内容：语句定界符。</p>
<p>平时导出sql，语句定界符默认是分号，而编辑触发器的时候，是两个斜杠//。</p>
<p>蹊跷就在这里，导入的时候使用的定界符必须跟倒出时候的定界符保持一致，否则就会出现错误。</p>
<p>问题发现后，老王是相当的高兴啊。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/11/11/phpmyadmin%e8%af%ad%e5%8f%a5%e5%ae%9a%e7%95%8c%e7%ac%a6%e7%9a%84%e9%97%ae%e9%a2%98.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>discuz论坛优化</title>
		<link>http://www.sunboyu.cn/2009/11/05/discuz%e8%ae%ba%e5%9d%9b%e4%bc%98%e5%8c%96.shtml</link>
		<comments>http://www.sunboyu.cn/2009/11/05/discuz%e8%ae%ba%e5%9d%9b%e4%bc%98%e5%8c%96.shtml#comments</comments>
		<pubDate>Thu, 05 Nov 2009 10:19:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[原创技术]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1031</guid>
		<description><![CDATA[discuz论坛在国内非常流行，用户众多。优秀的用户体验和超强的负载，也赢得了众多的好评。
但discuz毕竟是为中小型网站设计，很容易达到性能的瓶颈。在最近对discuz的改造和表结构的分析，做了以下的探讨，来提升论坛的性能。
第一步，当然就是分表。
技术实力不太强的用户（严重依赖mysql的用户），分表是最直接的做法（当然，有些功能会损失）。
分析一个运营两年的discuz数据库，库表大概是十几个G左右，posts数据表已经几个千万。
首先可以拆分的，就是post表了。根据情况，post表可以分10张，百张，规则可以哈希，也可以阶段自增（分表主键使用tid（帖子id））。分完表，可以看到一排post_**的表，每个表的数据量降到百万以下，速度就无太大影响。
第二个可以拆分的，是threads表，此表分表，可以水平分割方式水平的分割，可以根据论坛版块id进行分表，这样可以使每个表的数据量减小，但这样也损失了一个功能：全站标题检索。
通过以上两个表的改造论坛的承载能力能迅速见长。
底下会讨论高级优化改造得方法，且听下次分解。
]]></description>
			<content:encoded><![CDATA[<p>discuz论坛在国内非常流行，用户众多。优秀的用户体验和超强的负载，也赢得了众多的好评。</p>
<p>但discuz毕竟是为中小型网站设计，很容易达到性能的瓶颈。在最近对discuz的改造和表结构的分析，做了以下的探讨，来提升论坛的性能。</p>
<p>第一步，当然就是分表。<br />
技术实力不太强的用户（严重依赖mysql的用户），分表是最直接的做法（当然，有些功能会损失）。</p>
<p>分析一个运营两年的discuz数据库，库表大概是十几个G左右，posts数据表已经几个千万。</p>
<p>首先可以拆分的，就是post表了。根据情况，post表可以分10张，百张，规则可以哈希，也可以阶段自增（分表主键使用tid（帖子id））。分完表，可以看到一排post_**的表，每个表的数据量降到百万以下，速度就无太大影响。</p>
<p>第二个可以拆分的，是threads表，此表分表，可以水平分割方式水平的分割，可以根据论坛版块id进行分表，这样可以使每个表的数据量减小，但这样也损失了一个功能：全站标题检索。</p>
<p>通过以上两个表的改造论坛的承载能力能迅速见长。</p>
<p>底下会讨论高级优化改造得方法，且听下次分解。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/11/05/discuz%e8%ae%ba%e5%9d%9b%e4%bc%98%e5%8c%96.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>mysql触发器管理</title>
		<link>http://www.sunboyu.cn/2009/10/14/mysql%e8%a7%a6%e5%8f%91%e5%99%a8%e7%ae%a1%e7%90%86.shtml</link>
		<comments>http://www.sunboyu.cn/2009/10/14/mysql%e8%a7%a6%e5%8f%91%e5%99%a8%e7%ae%a1%e7%90%86.shtml#comments</comments>
		<pubDate>Wed, 14 Oct 2009 12:45:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1016</guid>
		<description><![CDATA[mysql没有一个像mssql的客户端去管理，所以有了PHPMYADMIN，管理mysql不再单纯依靠命令行，但PHPMYADMIN似乎不是那么万能，偶尔也会耍耍版本细节的脾气。
最近使用mysql触发器，不想使用命令行编辑，但phpmyadmin调试缺比较麻烦，原来想的是先建立一个空的触发器，然后修改，后来发现修改迁移问题多的要死，在老王同学的帮助下，经过几个晚上努力，整理出一些规律。
调试的时候，可以在空的触发器上逐条增加语句，一点一点调试，这样很容易定位问题，迅速修改。
迁移的时候，不能直接编辑触发器拷贝里边的代码，我用的phpmyadmin是2.11.9*版本的，生成的代码虽然他自己认，但一迁移就出了问题，我还没去阅读PHPMYADMIN的代码，不知道代码如何产生，但begin end里的内容大致相同，不同的是两头的辅助语句。
两头的内容跟版本密切相关，用mysqldump导出的语句做模板，把过程添加到里边，基本就没什么问题了。
不同版本的语法稍有出入，没有详细总结，总之掌握了调试的方法，解决问题速度就会提升。
使用触发器后，原来十几次的交互，一次就可以解决。我尝试了下出发器和存储过程，发现开发成本都差不多，复杂度也是类似的，所以没有用存储过程。
]]></description>
			<content:encoded><![CDATA[<p>mysql没有一个像mssql的客户端去管理，所以有了PHPMYADMIN，管理mysql不再单纯依靠命令行，但PHPMYADMIN似乎不是那么万能，偶尔也会耍耍版本细节的脾气。</p>
<p>最近使用mysql触发器，不想使用命令行编辑，但phpmyadmin调试缺比较麻烦，原来想的是先建立一个空的触发器，然后修改，后来发现修改迁移问题多的要死，在老王同学的帮助下，经过几个晚上努力，整理出一些规律。</p>
<p>调试的时候，可以在空的触发器上逐条增加语句，一点一点调试，这样很容易定位问题，迅速修改。</p>
<p>迁移的时候，不能直接编辑触发器拷贝里边的代码，我用的phpmyadmin是2.11.9*版本的，生成的代码虽然他自己认，但一迁移就出了问题，我还没去阅读PHPMYADMIN的代码，不知道代码如何产生，但begin end里的内容大致相同，不同的是两头的辅助语句。</p>
<p>两头的内容跟版本密切相关，用mysqldump导出的语句做模板，把过程添加到里边，基本就没什么问题了。</p>
<p>不同版本的语法稍有出入，没有详细总结，总之掌握了调试的方法，解决问题速度就会提升。</p>
<p>使用触发器后，原来十几次的交互，一次就可以解决。我尝试了下出发器和存储过程，发现开发成本都差不多，复杂度也是类似的，所以没有用存储过程。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/10/14/mysql%e8%a7%a6%e5%8f%91%e5%99%a8%e7%ae%a1%e7%90%86.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>discuz的生存之道</title>
		<link>http://www.sunboyu.cn/2009/09/29/discuz%e7%9a%84%e7%94%9f%e5%ad%98%e4%b9%8b%e9%81%93.shtml</link>
		<comments>http://www.sunboyu.cn/2009/09/29/discuz%e7%9a%84%e7%94%9f%e5%ad%98%e4%b9%8b%e9%81%93.shtml#comments</comments>
		<pubDate>Tue, 29 Sep 2009 07:44:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1013</guid>
		<description><![CDATA[最近修改UCH，改得头大，对他的东西大概也熟悉个七八。
暂且不用说他的代码质量，逻辑或者完善程度，但说这个产品的发展路子，这肯定是个有市场的东西。
UCH是国内最早搞开源sns的了，而且搭配上discuz这个用户量很大的东西，迅速在国内铺开。
当然要说代码质量，那个惨，bug无数。基本做PHP的程序员，死都不愿意改它。
但是很多项目还是拿来了，为啥？因为他适合中国的用户，为啥适合？抄facebook？当然也有一定关系，关键呢，是因为东西出来的早。
产品迅速抢占市场是老戴在discuz闭源收费到开源免费的一个战略性转变，也正是这个转变，让discuz有了更加快速的成长。
bug？功能的欠缺？每天在discuz官方网站上可以看到无数的抱怨。吵得，骂的，一群一群的，但仍然阻止不了新版本接连不断的发布。
用户就是在这样不断的期望失望再期望再失望中逐渐培养出来的。
ecshop，我自认为做的很好，只可惜推出较晚，被南边的大头抢了先机。老戴的产品肯定会发展好的，因为他已经不是一个程序员。
]]></description>
			<content:encoded><![CDATA[<p>最近修改UCH，改得头大，对他的东西大概也熟悉个七八。</p>
<p>暂且不用说他的代码质量，逻辑或者完善程度，但说这个产品的发展路子，这肯定是个有市场的东西。</p>
<p>UCH是国内最早搞开源sns的了，而且搭配上discuz这个用户量很大的东西，迅速在国内铺开。</p>
<p>当然要说代码质量，那个惨，bug无数。基本做PHP的程序员，死都不愿意改它。</p>
<p>但是很多项目还是拿来了，为啥？因为他适合中国的用户，为啥适合？抄facebook？当然也有一定关系，关键呢，是因为东西出来的早。</p>
<p>产品迅速抢占市场是老戴在discuz闭源收费到开源免费的一个战略性转变，也正是这个转变，让discuz有了更加快速的成长。</p>
<p>bug？功能的欠缺？每天在discuz官方网站上可以看到无数的抱怨。吵得，骂的，一群一群的，但仍然阻止不了新版本接连不断的发布。</p>
<p>用户就是在这样不断的期望失望再期望再失望中逐渐培养出来的。</p>
<p>ecshop，我自认为做的很好，只可惜推出较晚，被南边的大头抢了先机。老戴的产品肯定会发展好的，因为他已经不是一个程序员。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/09/29/discuz%e7%9a%84%e7%94%9f%e5%ad%98%e4%b9%8b%e9%81%93.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>php使用header来控制cookie</title>
		<link>http://www.sunboyu.cn/2009/09/28/php%e4%bd%bf%e7%94%a8header%e6%9d%a5%e6%8e%a7%e5%88%b6cookie.shtml</link>
		<comments>http://www.sunboyu.cn/2009/09/28/php%e4%bd%bf%e7%94%a8header%e6%9d%a5%e6%8e%a7%e5%88%b6cookie.shtml#comments</comments>
		<pubDate>Mon, 28 Sep 2009 07:33:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1011</guid>
		<description><![CDATA[php中的setcookie函数是有bug的，bug原理不太明白，不过底下这个方法可以避免这个bug
function setcookies( $name , $value , $expire , $path = &#34;/&#34; , $domain = &#34;&#34; )
{
&#160;&#160; &#160;header(&#34;Set-Cookie: $name=$value; path=$path; domain=$domain; expires=&#34;.gmstrftime(&#34;%A, %d-%b-%Y %H:%M:%S GMT&#34;,$expire));
}
]]></description>
			<content:encoded><![CDATA[<p>php中的setcookie函数是有bug的，bug原理不太明白，不过底下这个方法可以避免这个bug</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">function setcookies( $name , $value , $expire , $path = &quot;/&quot; , $domain = &quot;&quot; )</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;header(&quot;Set-Cookie: $name=$value; path=$path; domain=$domain; expires=&quot;.gmstrftime(&quot;%A, %d-%b-%Y %H:%M:%S GMT&quot;,$expire));</li>
<li>}</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/09/28/php%e4%bd%bf%e7%94%a8header%e6%9d%a5%e6%8e%a7%e5%88%b6cookie.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>网站Cache全分析</title>
		<link>http://www.sunboyu.cn/2009/09/26/%e7%bd%91%e7%ab%99cache%e5%85%a8%e5%88%86%e6%9e%90.shtml</link>
		<comments>http://www.sunboyu.cn/2009/09/26/%e7%bd%91%e7%ab%99cache%e5%85%a8%e5%88%86%e6%9e%90.shtml#comments</comments>
		<pubDate>Sat, 26 Sep 2009 13:44:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=1001</guid>
		<description><![CDATA[
前言：本文经过我对大多数网站的http头分析、自己做网站中的一些缓存设置、服务器的一些配置优化，后又阅读了RFC2616HTTP协议相关内容，以做此文。

原版下载
1、为什么要cache？
	这是个经常提到但很多时候又无法突然准确回答的问题。粗略讲，就是要加速和减压。
	加速：试想中国的网络，网通电信（就不提铁通之类）开创了互联互通新障碍，我们的用户在不多交钱的时候就得忍受奇慢的跨网速度。而作为互联网运营者，我们希望用户获得最好的用户体验，因此我们就要打破这个障碍。
	很多互联网服务商已经用分布cache解决了这个问题，比如sina，把中心服务器的内容分发到各个省市的cache服务器，根据用户所在的网络（ip段）来确定用户拉去最近服务器上的内容，达到访问速度最快。
	对于小型网站，页面静态化也是常用的cache方法，因为web服务器处理静态页面速度优于程序脚本，所以也起到了加速的作用，当然，也为了下一个原因-服务器减压。
	减压：显而易见，动态脚本的输出速度比一个静态的页面要慢的多（解释、执行、数据库数据读取）。因此，如果我们让用户只是读取一个静态文件，那硬件成本就会很低。大量用户访问静态文件而很少访问动态脚本，如何以节约昂贵的硬件资源。
	可以看出，cache还是有二利而无一害的。

2、目前流行的cache模型

可以看到，在数据库、web上，都做了相应的cache。至于生成静态文件，这个技术应该不是一个问题，所以，我在这里主要说一下通用的前端cache。
3、前端cache工作原理（apache mod_cache、squid）
Squid是一个linux下非常流行的代理服务器，当然，这里我们更多的是使用其缓冲（cache）的功能。
Apache mod_cache是从2.0版本开始加入的一个缓存模块，可以作为类似squid的缓存服务，我只尝试过在使用代理模块（mod_proxy）的时候使用，组合作为一个简易版squid，至于其他应用还没有深挖。
这里，首先提几个http协议里的头标志：
Last-Modified 文档最后修改时间，类似于php中的filemtime
Date 文档从服务器端发出的服务器端时间
Expires 文档过期时间
Cache-Control 这个指令我暂时不能用人类的语言表达清楚，大概就是，如果其他域缓存控制有冲突，一切听这个，优先级别比较高。
Pragma 一些特定指令，一般不用，但用的也很多。因为用其他几个参数就能实现目的了。
突然发现语言逻辑出了问题，居然不能表述cache的原理，故底下作图，简单说明。

这样就清楚多了，废话全省了。看不懂者请我吃饭，我给你们当面讲解。
4、实例
现在访问
http://www.sunboyu.cn/wp-content/themes/zen-in-grey-10/images/headerimage.jpg
第一次访问，我们用firebug网络标签查看：200 OK
然后刷新一下再看：304 Not Modified
综合一下其他域，分析为啥会这样
第一次访问：
请求信息
Host	www.sunboyu.cn	
User-Agent	Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)	
Accept	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8	
Accept-Language	zh-cn,zh;q=0.5	
Accept-Encoding	gzip,deflate	
Accept-Charset	GB2312,utf-8;q=0.7,*;q=0.7	
Keep-Alive	300	
Connection	keep-alive	
Referer	http://www.sunboyu.cn/	
Cookie	__utma=100971139.746333267.1249527244.1253502591.1253523523.65; __utmz=100971139.1249527244.1.1.utmcsr=(direct)&#124;utmccn=(direct)&#124;utmcmd=(none); wp-settings-1=editor%3Dhtml%26align%3Dcenter%26m0%3Do%26m1%3Dc%26m2%3Dc%26m3%3Dc%26m4%3Do%26m5%3Do%26m6%3Do%26m7%3Dc%26m8%3Do%26hidetb%3D1%26urlbutton%3Durlfile%26imgsize%3Dlarge%26m9%3Do%26m10%3Do; wp-settings-time-1=1252910178; PHPSESSID=a9af3fbfa19442fe549227e1a355ac52; __utmc=100971139
第一次访问，发送基本的请求信息。
反馈信息：
Date	Mon, 21 Sep 2009 09:09:01 GMT	
Server	Apache/2.2.11 (FreeBSD) mod_ssl/2.2.11 OpenSSL/0.9.8e DAV/2	
Last-Modified	Wed, 22 Jul 2009 08:13:25 GMT	
Etag	&#34;797fe8-45a3-46f46f1fb1340&#34;	
Accept-Ranges	bytes	
Content-Length	17827	
Keep-Alive	timeout=5, max=100	
Connection	Keep-Alive	
Content-Type	image/jpeg
服务器反馈了该文件的信息，其中包括date：反馈的时间；last-modified：最后修改时间；etag：页面的姆印信息。
第二次访问：
请求信息：
Host	www.sunboyu.cn	
User-Agent	Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)	
Accept	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8	
Accept-Language	zh-cn,zh;q=0.5	
Accept-Encoding	gzip,deflate	
Accept-Charset	GB2312,utf-8;q=0.7,*;q=0.7	
Keep-Alive	300	
Connection	keep-alive	
Referer	http://www.sunboyu.cn/	
Cookie	__utma=100971139.746333267.1249527244.1253502591.1253523523.65; [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>
前言：本文经过我对大多数网站的http头分析、自己做网站中的一些缓存设置、服务器的一些配置优化，后又阅读了RFC2616HTTP协议相关内容，以做此文。
</p></blockquote>
<p><a href='http://www.sunboyu.cn/upfiles/2009/09/cache.doc'>原版下载</a></p>
<p><strong>1、为什么要cache？</strong></p>
<p>	这是个经常提到但很多时候又无法突然准确回答的问题。粗略讲，就是要加速和减压。<br />
	加速：试想中国的网络，网通电信（就不提铁通之类）开创了互联互通新障碍，我们的用户在不多交钱的时候就得忍受奇慢的跨网速度。而作为互联网运营者，我们希望用户获得最好的用户体验，因此我们就要打破这个障碍。<br />
	很多互联网服务商已经用分布cache解决了这个问题，比如sina，把中心服务器的内容分发到各个省市的cache服务器，根据用户所在的网络（ip段）来确定用户拉去最近服务器上的内容，达到访问速度最快。<br />
	对于小型网站，页面静态化也是常用的cache方法，因为web服务器处理静态页面速度优于程序脚本，所以也起到了加速的作用，当然，也为了下一个原因-服务器减压。<br />
	减压：显而易见，动态脚本的输出速度比一个静态的页面要慢的多（解释、执行、数据库数据读取）。因此，如果我们让用户只是读取一个静态文件，那硬件成本就会很低。大量用户访问静态文件而很少访问动态脚本，如何以节约昂贵的硬件资源。<br />
	可以看出，cache还是有二利而无一害的。</p>
<p><span id="more-1001"></span></p>
<p><strong>2、目前流行的cache模型</strong></p>
<p><a href="http://www.sunboyu.cn/upfiles/2009/09/lamp-cache.gif"><img src="http://www.sunboyu.cn/upfiles/2009/09/lamp-cache-300x168.gif" alt="lamp cache" title="lamp cache" width="300" height="168" class="aligncenter size-medium wp-image-1003" /></a></p>
<p>可以看到，在数据库、web上，都做了相应的cache。至于生成静态文件，这个技术应该不是一个问题，所以，我在这里主要说一下通用的前端cache。</p>
<p><strong>3、前端cache工作原理（apache mod_cache、squid）</strong></p>
<p>Squid是一个linux下非常流行的代理服务器，当然，这里我们更多的是使用其缓冲（cache）的功能。<br />
Apache mod_cache是从2.0版本开始加入的一个缓存模块，可以作为类似squid的缓存服务，我只尝试过在使用代理模块（mod_proxy）的时候使用，组合作为一个简易版squid，至于其他应用还没有深挖。<br />
这里，首先提几个http协议里的头标志：<br />
Last-Modified 文档最后修改时间，类似于php中的filemtime<br />
Date 文档从服务器端发出的服务器端时间<br />
Expires 文档过期时间<br />
Cache-Control 这个指令我暂时不能用人类的语言表达清楚，大概就是，如果其他域缓存控制有冲突，一切听这个，优先级别比较高。<br />
Pragma 一些特定指令，一般不用，但用的也很多。因为用其他几个参数就能实现目的了。</p>
<p>突然发现语言逻辑出了问题，居然不能表述cache的原理，故底下作图，简单说明。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2009/09/http.gif"><img src="http://www.sunboyu.cn/upfiles/2009/09/http-283x300.gif" alt="http" title="http" width="283" height="300" class="aligncenter size-medium wp-image-1004" /></a></p>
<p>这样就清楚多了，废话全省了。看不懂者请我吃饭，我给你们当面讲解。</p>
<p><strong>4、实例</strong></p>
<p>现在访问<br />
http://www.sunboyu.cn/wp-content/themes/zen-in-grey-10/images/headerimage.jpg<br />
第一次访问，我们用firebug网络标签查看：200 OK<br />
然后刷新一下再看：304 Not Modified<br />
综合一下其他域，分析为啥会这样<br />
第一次访问：<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">Host	www.sunboyu.cn	</li>
<li>User-Agent	Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)	</li>
<li>Accept	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8	</li>
<li>Accept-Language	zh-cn,zh;q=0.5	</li>
<li>Accept-Encoding	gzip,deflate	</li>
<li>Accept-Charset	GB2312,utf-8;q=0.7,*;q=0.7	</li>
<li>Keep-Alive	300	</li>
<li>Connection	keep-alive	</li>
<li>Referer	http://www.sunboyu.cn/	</li>
<li>Cookie	__utma=100971139.746333267.1249527244.1253502591.1253523523.65; __utmz=100971139.1249527244.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); wp-settings-1=editor%3Dhtml%26align%3Dcenter%26m0%3Do%26m1%3Dc%26m2%3Dc%26m3%3Dc%26m4%3Do%26m5%3Do%26m6%3Do%26m7%3Dc%26m8%3Do%26hidetb%3D1%26urlbutton%3Durlfile%26imgsize%3Dlarge%26m9%3Do%26m10%3Do; wp-settings-time-1=1252910178; PHPSESSID=a9af3fbfa19442fe549227e1a355ac52; __utmc=100971139</li></ol></div>
<p>第一次访问，发送基本的请求信息。</p>
<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">Date	Mon, 21 Sep 2009 09:09:01 GMT	</li>
<li>Server	Apache/2.2.11 (FreeBSD) mod_ssl/2.2.11 OpenSSL/0.9.8e DAV/2	</li>
<li>Last-Modified	Wed, 22 Jul 2009 08:13:25 GMT	</li>
<li>Etag	&quot;797fe8-45a3-46f46f1fb1340&quot;	</li>
<li>Accept-Ranges	bytes	</li>
<li>Content-Length	17827	</li>
<li>Keep-Alive	timeout=5, max=100	</li>
<li>Connection	Keep-Alive	</li>
<li>Content-Type	image/jpeg</li></ol></div>
<p>服务器反馈了该文件的信息，其中包括date：反馈的时间；last-modified：最后修改时间；etag：页面的姆印信息。</p>
<p>第二次访问：<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">Host	www.sunboyu.cn	</li>
<li>User-Agent	Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)	</li>
<li>Accept	text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8	</li>
<li>Accept-Language	zh-cn,zh;q=0.5	</li>
<li>Accept-Encoding	gzip,deflate	</li>
<li>Accept-Charset	GB2312,utf-8;q=0.7,*;q=0.7	</li>
<li>Keep-Alive	300	</li>
<li>Connection	keep-alive	</li>
<li>Referer	http://www.sunboyu.cn/	</li>
<li>Cookie	__utma=100971139.746333267.1249527244.1253502591.1253523523.65; __utmz=100971139.1249527244.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); wp-settings-1=editor%3Dhtml%26align%3Dcenter%26m0%3Do%26m1%3Dc%26m2%3Dc%26m3%3Dc%26m4%3Do%26m5%3Do%26m6%3Do%26m7%3Dc%26m8%3Do%26hidetb%3D1%26urlbutton%3Durlfile%26imgsize%3Dlarge%26m9%3Do%26m10%3Do; wp-settings-time-1=1252910178; PHPSESSID=a9af3fbfa19442fe549227e1a355ac52; __utmc=100971139	</li>
<li>If-Modified-Since	Wed, 22 Jul 2009 08:13:25 GMT	</li>
<li>If-None-Match	&quot;797fe8-45a3-46f46f1fb1340&quot;	</li>
<li>Cache-Control	max-age=0</li></ol></div>
<p>由于信息浏览被缓存在浏览器cache中，所以向服务器请求的时候顺便带上了if-modified-sine信息，if-none-match的信息。</p>
<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">Date	Mon, 21 Sep 2009 09:09:33 GMT	</li>
<li>Server	Apache/2.2.11 (FreeBSD) mod_ssl/2.2.11 OpenSSL/0.9.8e DAV/2	</li>
<li>Last-Modified	Wed, 22 Jul 2009 08:13:25 GMT	</li>
<li>Etag	&quot;797fe8-45a3-46f46f1fb1340&quot;	</li>
<li>Accept-Ranges	bytes	</li>
<li>Content-Length	17827	</li>
<li>Content-Type	image/jpeg</li></ol></div>
<p>此次访问，因为etag信息的比较，服务器确定浏览器本地缓存了此文件。并且在浏览器发送的信息 if-modified-since时间后，服务器的文件并没有发生变化，因此，服务器发送304指令使浏览器读取本地缓存，以减少http信息传输量，提高响应速度。</p>
<p><strong>5、进阶（对缓存服务器的控制）</strong></p>
<p>http关于缓存的控制不仅可以控制浏览器，针对代理服务器依然有效。比如我们使用squid进行反向代理服务，我们可以通过调整http头信息而确定用户是否要访问squid的缓存信息，或者不缓存而直接转发服务器的反馈。<br />
假如现在，一台apache的server跑php，主要是cms，由于工期的问题，没工夫做生成静态了，但我们还希望负载不要太大，因此我们在前边加了一台squid服务器，希望能缓存html结果，这样实现项目快速推进。<br />
当然，服务器部署好之后，还需要程序这边做一些配置，就是发送合适的http的头信息，程序做好修改即可。<br />
首先，我们做一个规划：<br />
网站首页希望缓存5分钟，因为不断有新网站发布。<br />
列表页面缓存1小时，因为不断有新的文章发布，但比首页频度还是下降了一些。<br />
文章最终显示页面缓存一天，因为发布要经过多人审核，一般不会修改，但也难免修改一两个字眼。<br />
为了便于演示，我本地架设了apache和squid。当然鄙视一下自己，是用的windows版本，否则就不能玩剑三了。<br />
言归正传，结构如下：</p>
<p><a href="http://www.sunboyu.cn/upfiles/2009/09/demo.gif"><img src="http://www.sunboyu.cn/upfiles/2009/09/demo-300x105.gif" alt="demo" title="demo" width="300" height="105" class="aligncenter size-medium wp-image-1005" /></a></p>
<p>当访问http://127.0.0.1:8888的时候，squid转发请求至http://127.0.0.1:80获取内容，然后反馈给用户，抑或把缓存的内容直接发送给用户。<br />
现在做首页的发布。<br />
首页缓存5分钟，也就是300秒。<br />
从squid访问apache时间算起，过期时间则为 time()+300<br />
用php发送http头 header(&#8221;Expires: &#8221; .gmdate(&#8221;D, d M Y H:i:s&#8221;,time()+300). &#8221; GMT&#8221;);<br />
验证：在仿真环境中模拟，我们用httpwatch来查看squid反馈，根据apache和squid的日志来验证缓存是否生效。<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">&lt; ?php </li>
<li>header(&quot;Expires: &quot; .gmdate(&quot;D, d M Y H:i:s&quot;,time()+300). &quot; GMT&quot;);</li>
<li>echo &quot;Content test!!&quot;;</li>
<li>&nbsp;?&gt;</li></ol></div>
<p>部署完毕后访问 http://127.0.0.1 看是否顺利输出。然后访问 http://127.0.0.1:8888 看是否可以看到预期内容。<br />
如果能顺利输出，则证明squid apache工作皆正常。<br />
现在用httpwatch查看头信息<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">HTTP/1.0 200 OK</li>
<li>Date: Wed, 23 Sep 2009 07:55:42 GMT</li>
<li>Server: Apache/2.2.13 (Win32) PHP/5.2.6</li>
<li>Accept-Ranges: bytes</li>
<li>X-Powered-By: PHP/5.2.6</li>
<li>Expires: Wed, 23 Sep 2009 08:00:42 GMT</li>
<li>Content-Type: text/html</li>
<li>X-Cache: MISS from squid.sunboyu.cn</li>
<li>X-Cache-Lookup: MISS from squid.sunboyu.cn:8888</li>
<li>Via: 1.0 squid.sunboyu.cn (squid/3.0.STABLE13-BZR)</li>
<li>Connection: close</li></ol></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">HTTP/1.0 200 OK</li>
<li>Date: Wed, 23 Sep 2009 07:55:42 GMT</li>
<li>Server: Apache/2.2.13 (Win32) PHP/5.2.6</li>
<li>Accept-Ranges: bytes</li>
<li>X-Powered-By: PHP/5.2.6</li>
<li>Expires: Wed, 23 Sep 2009 08:00:42 GMT</li>
<li>Content-Type: text/html</li>
<li>Age: 28</li>
<li>X-Cache: HIT from squid.sunboyu.cn</li>
<li>X-Cache-Lookup: HIT from squid.sunboyu.cn:8888</li>
<li>Via: 1.0 squid.sunboyu.cn (squid/3.0.STABLE13-BZR)</li>
<li>Connection: close</li></ol></div>
<p>比较两次访问，两次访问时间 07:55:42 相同，过期时间相同 08:00:42，跟之前设置的5分钟相符。第一次X-Cache显示为MISS，因为一次访问，squid缓存中并没有相关信息，所以从apache中获得，第二次缓存中存在缓存信息，直接读取缓存输出，为之“命中”。</p>
<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">&lt; ?php</li>
<li>header(&quot;Expires: &quot; .gmdate(&quot;D, d M Y H:i:s&quot;,time()+3600). &quot; GMT&quot;);</li>
<li>……</li>
<li>?&gt;</li>
<li>&lt; ?php</li>
<li>header(&quot;Expires: &quot; .gmdate(&quot;D, d M Y H:i:s&quot;,time()+86400). &quot; GMT&quot;);</li>
<li>……</li>
<li>?&gt;</li></ol></div>
<p>只需要给页面加上一个过期的http头，即可实现我们的缓存目的。这样做，比生成页面方便多了。当然，如果求seo效果，可以用重写来实现，缓存效果不变。<br />
如何来显示一下缓存后的结果呢？我们可以写一个一般复杂的php脚本，其中运算数据库都使用，直接在apache运行，压力测试一下；然后使用squid访问，访问一次后，关闭apache，然后再压力测试，比较成绩。^_^，因为有了squid，apache跟mysql都不工作了，当然要非常节约资源。<br />
Squid的合理使用，达到了快速网站开发，减轻服务器压力，提高用户影响的目的。<br />
底下分析下squid在分布式加速方面的应用。<br />
分析新浪的一些图片，发现http头中有这样的信息：</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">http://i1.sinaimg.cn/blog/temp/1/2008/0306/U2725P503T1D169F1DT20090701101305.jpg</li>
<li>HTTP/1.0 304 Not Modified</li>
<li>Date: Fri, 28 Aug 2009 22:09:32 GMT</li>
<li>Content-Type: image/jpeg</li>
<li>Expires: Sat, 28 Aug 2010 22:09:32 GMT</li>
<li>Last-Modified: Wed, 01 Jul 2009 02:13:05 GMT</li>
<li>Age: 81943</li>
<li>X-Cache: HIT from zjm-209.sina.com.cn</li>
<li>Connection: keep-alive</li></ol></div>
<p>可以发现是命中了zjm-209.sina.com.cn。<br />
Sina在全国各地有好多服务器，其DNS根据用户访问的ip确定用户需要访问哪台服务器最快，则把请求转发到相应服务器，来提高用户访问速度。<br />
大概结构如下：</p>

<a href='http://www.sunboyu.cn/2009/09/26/%e7%bd%91%e7%ab%99cache%e5%85%a8%e5%88%86%e6%9e%90.shtml/lamp-cache' title='lamp cache'><img src="http://www.sunboyu.cn/upfiles/2009/09/lamp-cache-150x84.gif" width="150" height="84" class="attachment-thumbnail" alt="" /></a>
<a href='http://www.sunboyu.cn/2009/09/26/%e7%bd%91%e7%ab%99cache%e5%85%a8%e5%88%86%e6%9e%90.shtml/http' title='http'><img src="http://www.sunboyu.cn/upfiles/2009/09/http-141x150.gif" width="141" height="150" class="attachment-thumbnail" alt="" /></a>
<a href='http://www.sunboyu.cn/2009/09/26/%e7%bd%91%e7%ab%99cache%e5%85%a8%e5%88%86%e6%9e%90.shtml/demo' title='demo'><img src="http://www.sunboyu.cn/upfiles/2009/09/demo-150x52.gif" width="150" height="52" class="attachment-thumbnail" alt="" /></a>
<a href='http://www.sunboyu.cn/2009/09/26/%e7%bd%91%e7%ab%99cache%e5%85%a8%e5%88%86%e6%9e%90.shtml/sina-cache' title='sina cache'><img src="http://www.sunboyu.cn/upfiles/2009/09/sina-cache-150x84.gif" width="150" height="84" class="attachment-thumbnail" alt="" /></a>

<p>总结<br />
Cache的确是个好东西，使用好了，做事事半功倍。不过很多时候我们得cache和&#8221;非cache&#8221;共用。有些内容需要cache，有些页面却要避免cache。当然squid也给出了接口方面控制每个缓存元素。过度的cache也是不好的，在cache之前，对项目进行严谨的分析和大量的测试是我们创建缓存机制的一个前提。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/09/26/%e7%bd%91%e7%ab%99cache%e5%85%a8%e5%88%86%e6%9e%90.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>firefox的cache和http头信息</title>
		<link>http://www.sunboyu.cn/2009/09/24/firefox%e7%9a%84cache%e5%92%8chttp%e5%a4%b4%e4%bf%a1%e6%81%af.shtml</link>
		<comments>http://www.sunboyu.cn/2009/09/24/firefox%e7%9a%84cache%e5%92%8chttp%e5%a4%b4%e4%bf%a1%e6%81%af.shtml#comments</comments>
		<pubDate>Thu, 24 Sep 2009 03:05:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=999</guid>
		<description><![CDATA[最近调试squid，发现一个很奇异的问题，程序服务器都配置好后，使用ie狂刷，每次都是HIT，而是用firefoxF5狂刷，结果很多都是MISS，google后发现firefox独有的特性：
如果一个页面访问后，在地址栏再次敲入打开，则走cache，而如果点F5，则firefox发送http请求的时候会自动在头上增加 Cache-Control	max-age=0 因此缓存失效。不过正常访问下，还是没有问题的。
原文：
I usually post about problems that I&#8217;ve solved. But every once in a while, for all my digging around and googling, I come up on something that I can&#8217;t solve quickly and thuroughly enough - so I post about it here in the hope someone can help.
To make a long story short - [...]]]></description>
			<content:encoded><![CDATA[<p>最近调试squid，发现一个很奇异的问题，程序服务器都配置好后，使用ie狂刷，每次都是HIT，而是用firefoxF5狂刷，结果很多都是MISS，google后发现firefox独有的特性：</p>
<p>如果一个页面访问后，在地址栏再次敲入打开，则走cache，而如果点F5，则firefox发送http请求的时候会自动在头上增加 Cache-Control	max-age=0 因此缓存失效。不过正常访问下，还是没有问题的。</p>
<p>原文：</p>
<p>I usually post about problems that I&#8217;ve solved. But every once in a while, for all my digging around and googling, I come up on something that I can&#8217;t solve quickly and thuroughly enough - so I post about it here in the hope someone can help.</p>
<p>To make a long story short - I&#8217;ve found out that FireFox 1.5 appends a &#8220;Cache-Control: max-age=0&#8243; HTTP header to requests for ASPX files. This header tells the web server and any proxy servers on the way not to respond with cached version of the requested page and to go and run the actual ASPX instead.</p>
<p>For me, this is a big problem. It renders the NetApp NetCache reverse proxy that I&#8217;m using quite useless and impacts badly on response times for that particular page.</p>
<p>Does anybody know why FireFox adds this header to the request? How can this be circumvented either on the browser&#8217;s side or on the proxy server&#8217;s side?</p>
<p>It took us a bit to work it out.</p>
<p>If you hit refresh, firefox will ask for the latest copy (max-age=0).</p>
<p>If you type the url into the address bar and hit enter, then type it in again, it&#8217;ll cache.</p>
<p>Check it works in about:cache.</p>
<p>See also:</p>
<p>http://developer.mozilla.org/en/docs/Using_Firefox_1.5_caching</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/09/24/firefox%e7%9a%84cache%e5%92%8chttp%e5%a4%b4%e4%bf%a1%e6%81%af.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>squid,nginx,apache几个代理软件的比较</title>
		<link>http://www.sunboyu.cn/2009/09/13/squidnginxapache%e5%87%a0%e4%b8%aa%e4%bb%a3%e7%90%86%e8%bd%af%e4%bb%b6%e7%9a%84%e6%af%94%e8%be%83.shtml</link>
		<comments>http://www.sunboyu.cn/2009/09/13/squidnginxapache%e5%87%a0%e4%b8%aa%e4%bb%a3%e7%90%86%e8%bd%af%e4%bb%b6%e7%9a%84%e6%af%94%e8%be%83.shtml#comments</comments>
		<pubDate>Sun, 13 Sep 2009 03:51:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[LINUX]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=988</guid>
		<description><![CDATA[最近一直在研究代理缓存之类的东东，几个软件一直在瞎鼓捣，没弄出个结果，自己也稀里糊涂，总结一下几天折腾的成绩：
在并发上，nginx无疑是老大，做反向代理的时候，没有发现squid的并发方面介绍，所以暂且认为ngnix是老大，apache的稳定性有目共睹，但在并发方面的确不是很如意。
缓存方面：squid，apache都支持diskcache和memcache，根据http的head头来确定是否缓存，nginx不支持缓存，不过我在google开源上看见了新浪的水杨老大的一个东东，给nginx加上了文件缓存，不过没有大规模使用，暂时不把它当做一种解决方案。
在代理和缓存的规则上，apache很强，很强大的重写功能，尤其是强制修改http规则，不过这个功能我始终没有调试成功，no-cache的页面始终无法去缓存。
如果只是做网站的反向代理，负载均衡，nginx感觉要比squid强，性能强悍，配置方便。
如果是做代理+缓存加速，那squid的功能和稳定性还是很好的，毕竟在互联网上大量应用。
apache呢？好像没它的事情了。当然不是，有些地方可以拿他的功能当中间件使用，这个等下次分解。
]]></description>
			<content:encoded><![CDATA[<p>最近一直在研究代理缓存之类的东东，几个软件一直在瞎鼓捣，没弄出个结果，自己也稀里糊涂，总结一下几天折腾的成绩：</p>
<p>在并发上，nginx无疑是老大，做反向代理的时候，没有发现squid的并发方面介绍，所以暂且认为ngnix是老大，apache的稳定性有目共睹，但在并发方面的确不是很如意。</p>
<p>缓存方面：squid，apache都支持diskcache和memcache，根据http的head头来确定是否缓存，nginx不支持缓存，不过我在google开源上看见了新浪的水杨老大的一个东东，给nginx加上了文件缓存，不过没有大规模使用，暂时不把它当做一种解决方案。</p>
<p>在代理和缓存的规则上，apache很强，很强大的重写功能，尤其是强制修改http规则，不过这个功能我始终没有调试成功，no-cache的页面始终无法去缓存。</p>
<p>如果只是做网站的反向代理，负载均衡，nginx感觉要比squid强，性能强悍，配置方便。</p>
<p>如果是做代理+缓存加速，那squid的功能和稳定性还是很好的，毕竟在互联网上大量应用。</p>
<p>apache呢？好像没它的事情了。当然不是，有些地方可以拿他的功能当中间件使用，这个等下次分解。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/09/13/squidnginxapache%e5%87%a0%e4%b8%aa%e4%bb%a3%e7%90%86%e8%bd%af%e4%bb%b6%e7%9a%84%e6%af%94%e8%be%83.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>给.Net程序加个cache</title>
		<link>http://www.sunboyu.cn/2009/09/06/%e7%bb%99-net%e7%a8%8b%e5%ba%8f%e5%8a%a0%e4%b8%aacache.shtml</link>
		<comments>http://www.sunboyu.cn/2009/09/06/%e7%bb%99-net%e7%a8%8b%e5%ba%8f%e5%8a%a0%e4%b8%aacache.shtml#comments</comments>
		<pubDate>Sun, 06 Sep 2009 14:47:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=984</guid>
		<description><![CDATA[朋友说一个.net的网站总被dos攻击，让给个方案，还不能贵了。听对方描述一番，感觉是iis的垃圾造成连接数的问题。
很少研究iis，但我知道linux下很多软件可以很好的提升并发连接数，于是出一简单方案去尝试。

]]></description>
			<content:encoded><![CDATA[<p>朋友说一个.net的网站总被dos攻击，让给个方案，还不能贵了。听对方描述一番，感觉是iis的垃圾造成连接数的问题。</p>
<p>很少研究iis，但我知道linux下很多软件可以很好的提升并发连接数，于是出一简单方案去尝试。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2009/09/未命名-1.jpg"><img src="http://www.sunboyu.cn/upfiles/2009/09/未命名-1.jpg" alt="未命名-1" title="未命名-1" width="1000" height="684" class="aligncenter size-full wp-image-985" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/09/06/%e7%bb%99-net%e7%a8%8b%e5%ba%8f%e5%8a%a0%e4%b8%aacache.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>mysql5.1触发器小试</title>
		<link>http://www.sunboyu.cn/2009/08/25/mysql5-1%e8%a7%a6%e5%8f%91%e5%99%a8%e5%b0%8f%e8%af%95.shtml</link>
		<comments>http://www.sunboyu.cn/2009/08/25/mysql5-1%e8%a7%a6%e5%8f%91%e5%99%a8%e5%b0%8f%e8%af%95.shtml#comments</comments>
		<pubDate>Tue, 25 Aug 2009 14:51:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=961</guid>
		<description><![CDATA[我一直以为mysql5.0的触发器好似没那么强大，被一个搞mssql的老大给忽悠了，其实mysql触发器从5.0就变得很强大，当然包括5.1。
这里拿一个demo说事：
DROP TRIGGER IF EXISTS `ucenterhome`.`uchome_doing_test`;
DELIMITER //
CREATE TRIGGER `ucenterhome`.`uchome_doing_test` AFTER INSERT ON `ucenterhome`.`uchome_doing`
&#160;FOR EACH ROW BEGIN
&#160;&#160; &#160;INSERT INTO uchome_doing_1 SET doid= NEW.doid+3, uid= NEW.uid , username= NEW.username,`from`=NEW.`from`,dateline=NEW.dateline,message=NEW.message,ip=NEW.ip,replynum = NEW.replynum,mood=NEW.mood;&#160; &#160;
END
//
DELIMITER ;
每向uchome_doing表中插一条数据，就复制到uchome_dong_1表中一条。
有两个关键字：
OLD&#160; NEW
官方的解释：

The OLD and NEW keywords enable you to access columns in the rows affected by a trigger. (OLD and NEW are not case sensitive.) In [...]]]></description>
			<content:encoded><![CDATA[<p>我一直以为mysql5.0的触发器好似没那么强大，被一个搞mssql的老大给忽悠了，其实mysql触发器从5.0就变得很强大，当然包括5.1。</p>
<p>这里拿一个demo说事：</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">DROP TRIGGER IF EXISTS `ucenterhome`.`uchome_doing_test`;</li>
<li>DELIMITER //</li>
<li>CREATE TRIGGER `ucenterhome`.`uchome_doing_test` AFTER INSERT ON `ucenterhome`.`uchome_doing`</li>
<li>&nbsp;FOR EACH ROW BEGIN</li>
<li>&nbsp;&nbsp; &nbsp;INSERT INTO uchome_doing_1 SET doid= NEW.doid+3, uid= NEW.uid , username= NEW.username,`from`=NEW.`from`,dateline=NEW.dateline,message=NEW.message,ip=NEW.ip,replynum = NEW.replynum,mood=NEW.mood;&nbsp; &nbsp;</li>
<li>END</li>
<li>//</li>
<li>DELIMITER ;</li></ol></div>
<p>每向uchome_doing表中插一条数据，就复制到uchome_dong_1表中一条。</p>
<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">OLD&nbsp; NEW</li></ol></div>
<p>官方的解释：</p>
<blockquote><p>
The OLD and NEW keywords enable you to access columns in the rows affected by a trigger. (OLD and NEW are not case sensitive.) In an INSERT trigger, only NEW.col_name can be used; there is no old row. In a DELETE trigger, only OLD.col_name can be used; there is no new row. In an UPDATE trigger, you can use OLD.col_name to refer to the columns of a row before it is updated and NEW.col_name to refer to the columns of the row after it is updated.
</p></blockquote>
<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">BEFORE AFTER</li></ol></div>
<p>官方解释</p>
<blockquote><p>
The keyword BEFORE indicates the trigger action time. In this case, the trigger should activate before each row inserted into the table. The other allowable keyword here is AFTER.
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/08/25/mysql5-1%e8%a7%a6%e5%8f%91%e5%99%a8%e5%b0%8f%e8%af%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>mysql数据抽象层-PDO</title>
		<link>http://www.sunboyu.cn/2009/08/20/mysql%e6%95%b0%e6%8d%ae%e6%8a%bd%e8%b1%a1%e5%b1%82-pdo.shtml</link>
		<comments>http://www.sunboyu.cn/2009/08/20/mysql%e6%95%b0%e6%8d%ae%e6%8a%bd%e8%b1%a1%e5%b1%82-pdo.shtml#comments</comments>
		<pubDate>Thu, 20 Aug 2009 08:02:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=953</guid>
		<description><![CDATA[好久不用PDO了，公司这边有的项目使用PDO，再熟悉一下，继续沿用之前的方法：
没用数据绑定和一些高级的功能，只是实现基础功能。
&#60; ?php
interface DateBaseConnect
{
	#数据库连接
	public function Connect( $host , $user , $pass , $datebase );
	#使用数据库
	public function selectDateBase( $datebase );
	#执行一个查询
	public function query( $sql );
	#取得一行
	public function fetch( $sql );
	#取得所有
	public function fetchAll( $sql );
	#取得影响行数
	public function affectedRow();
	#取得结果行数
	public function recordCount();
	#取得上次插入ID
	public function insertID();
	#释放资源
	public function close();
}
class sPDO implements DateBaseConnect
{
	#连接标识
	public $handle = false;
	#结果标识
	public $query;
	#查询次数
	public $exetime;
	#影响行数
	public $affectedRows;
	#statement
	public $statement;
	#数据库连接
	public function Connect( $host , $user , $pass , [...]]]></description>
			<content:encoded><![CDATA[<p>好久不用PDO了，公司这边有的项目使用PDO，再熟悉一下，继续沿用之前的方法：</p>
<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">&lt; ?php</li>
<li>interface DateBaseConnect</li>
<li>{</li>
<li>	#数据库连接</li>
<li>	public function Connect( $host , $user , $pass , $datebase );</li>
<li>	#使用数据库</li>
<li>	public function selectDateBase( $datebase );</li>
<li>	#执行一个查询</li>
<li>	public function query( $sql );</li>
<li>	#取得一行</li>
<li>	public function fetch( $sql );</li>
<li>	#取得所有</li>
<li>	public function fetchAll( $sql );</li>
<li>	#取得影响行数</li>
<li>	public function affectedRow();</li>
<li>	#取得结果行数</li>
<li>	public function recordCount();</li>
<li>	#取得上次插入ID</li>
<li>	public function insertID();</li>
<li>	#释放资源</li>
<li>	public function close();</li>
<li>}</li>
<li>class sPDO implements DateBaseConnect</li>
<li>{</li>
<li>	#连接标识</li>
<li>	public $handle = false;</li>
<li>	#结果标识</li>
<li>	public $query;</li>
<li>	#查询次数</li>
<li>	public $exetime;</li>
<li>	#影响行数</li>
<li>	public $affectedRows;</li>
<li>	#statement</li>
<li>	public $statement;</li>
<li>	#数据库连接</li>
<li>	public function Connect( $host , $user , $pass , $datebase )</li>
<li>	{</li>
<li>		try</li>
<li>		{</li>
<li>			$this-&gt;handle = new PDO(&quot;mysql:dbname=&quot;.$datebase.&quot;;host=&quot;.$host, $user, $pass);</li>
<li>		}</li>
<li>		catch (PDOException $e)</li>
<li>		{</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;echo 'Connection failed: ' . $e-&gt;getMessage();</li>
<li>		}</li>
<li>		$this-&gt;exetime = 0;</li>
<li>	}</li>
<li>	#选择数据库</li>
<li>	public function selectDateBase( $database )</li>
<li>	{</li>
<li>	&nbsp; &nbsp; return true;</li>
<li>	}</li>
<li>	#执行一个查询</li>
<li>	public function query( $sql )</li>
<li>	{</li>
<li>	&nbsp; &nbsp; $this-&gt;affectedRows = $this-&gt;handle-&gt;exec( $sql );</li>
<li>		$this-&gt;exetime++;</li>
<li>		return true;</li>
<li>	}</li>
<li>	#取得一行</li>
<li>	public function fetch( $sql )</li>
<li>	{</li>
<li>		$this-&gt;statement = $this-&gt;handle-&gt;query( $sql );</li>
<li>		return $this-&gt;statement-&gt;fetch(PDO::FETCH_ASSOC);</li>
<li>	}</li>
<li>	#取得所有</li>
<li>	public function fetchAll( $sql )</li>
<li>	{</li>
<li>		$this-&gt;statement = $this-&gt;handle-&gt;query( $sql );</li>
<li>		return $this-&gt;statement-&gt;fetchAll(PDO::FETCH_ASSOC);</li>
<li>	}</li>
<li>	#取得影响行数</li>
<li>	public function affectedRow()</li>
<li>	{</li>
<li>		return $this-&gt;affectedRows;</li>
<li>	}</li>
<li>	#取得结果行数</li>
<li>	public function recordCount()</li>
<li>	{</li>
<li>		return $this-&gt;statement-&gt;rowCount();</li>
<li>	}</li>
<li>	#取得上次插入ID</li>
<li>	public function insertID()</li>
<li>	{</li>
<li>		$sql = sprintf(&quot;SELECT LAST_INSERT_ID() AS id&quot;);</li>
<li>		$pdostatement = $this-&gt;handle-&gt;query( $sql );</li>
<li>		$rs = $pdostatement-&gt;fetch();</li>
<li>		return $rs['id'];</li>
<li>	}</li>
<li>	#释放资源</li>
<li>	public function close()</li>
<li>	{</li>
<li>		unset($this-&gt;handle);</li>
<li>	}</li>
<li>	#析构函数</li>
<li>	function __destruct()</li>
<li>	{</li>
<li>		$this-&gt;close();</li>
<li>	}</li>
<li>}</li>
<li>#Demo</li>
<li>$db = new sPDO;</li>
<li>$db-&gt;Connect( 'localhost' , 'root' , '123456' , 'ucenterhome' );</li>
<li>$rs = $db-&gt;fetchAll( &quot;SELECT * FROM uchome_blogfield&quot; );</li>
<li>print_r( $rs );</li>
<li>?&gt;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/08/20/mysql%e6%95%b0%e6%8d%ae%e6%8a%bd%e8%b1%a1%e5%b1%82-pdo.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>对UCenter Home的一点看法</title>
		<link>http://www.sunboyu.cn/2009/08/17/%e5%af%b9ucenter-home%e7%9a%84%e4%b8%80%e7%82%b9%e7%9c%8b%e6%b3%95.shtml</link>
		<comments>http://www.sunboyu.cn/2009/08/17/%e5%af%b9ucenter-home%e7%9a%84%e4%b8%80%e7%82%b9%e7%9c%8b%e6%b3%95.shtml#comments</comments>
		<pubDate>Mon, 17 Aug 2009 14:27:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=950</guid>
		<description><![CDATA[最近改了改UCenter Home，发现，这的确是个不错的产品，但不能算一个成熟的程序。
产品看法：
这个产品主要是服务一些个人站长和小型站点，功能模仿一些成熟的sns系统，模仿比较到位，而且功能上尽可能大的去完善，让管理员可以方便进行比较系统全面的管理。而从产品的设计体验上，也能适应中国大多数的用户。
所以，这个产品在国内算一套非常不错的sns建站系统。
编码方面：
要说代码，我相信阅读过代码的人一定很头疼，从discuz的bbs就这样。
代码只是面向过程，这个，在discuz方面，我估计是累积开发造成的，一个个版本升级，变化不能太大，如果变化真的太大，会失去一些开发者。另外，他自己升级也是个问题。
不过uch这个产品也开发成了这样。代码结构我倒挺喜欢，之前我写那个架子也是这样。优点：结构规范，适合多人协作。缺点，面向对象性，代码复用差。这个结构，我估计是公司某元老折腾的，然后有几个小弟进行模块开发。
为什么这么说，是有原因的，因为遍历整个代码，起码有两种以上的代码风格，而且人员之间沟通配合也造成了一些错误，虽然不是bug，但看得出来项目进行的仓促。不过这也是公司的一个战略措施，小戴同学总是及时放出产品来打压竞争对手。
再说负载，其实这个问题就不用说，从大量的垃圾sql语句就能看出，这个产品不能支持较大的负载。
再说最后一点，如果你想去优化改善，彻底改善，放弃吧。重写。
我看的只是uch2.0的预览版，估计正式版放出的时候，这些问题会有所改善。
]]></description>
			<content:encoded><![CDATA[<p>最近改了改UCenter Home，发现，这的确是个不错的产品，但不能算一个成熟的程序。</p>
<p>产品看法：</p>
<p>这个产品主要是服务一些个人站长和小型站点，功能模仿一些成熟的sns系统，模仿比较到位，而且功能上尽可能大的去完善，让管理员可以方便进行比较系统全面的管理。而从产品的设计体验上，也能适应中国大多数的用户。</p>
<p>所以，这个产品在国内算一套非常不错的sns建站系统。</p>
<p>编码方面：</p>
<p>要说代码，我相信阅读过代码的人一定很头疼，从discuz的bbs就这样。</p>
<p>代码只是面向过程，这个，在discuz方面，我估计是累积开发造成的，一个个版本升级，变化不能太大，如果变化真的太大，会失去一些开发者。另外，他自己升级也是个问题。</p>
<p>不过uch这个产品也开发成了这样。代码结构我倒挺喜欢，之前我写那个架子也是这样。优点：结构规范，适合多人协作。缺点，面向对象性，代码复用差。这个结构，我估计是公司某元老折腾的，然后有几个小弟进行模块开发。</p>
<p>为什么这么说，是有原因的，因为遍历整个代码，起码有两种以上的代码风格，而且人员之间沟通配合也造成了一些错误，虽然不是bug，但看得出来项目进行的仓促。不过这也是公司的一个战略措施，小戴同学总是及时放出产品来打压竞争对手。</p>
<p>再说负载，其实这个问题就不用说，从大量的垃圾sql语句就能看出，这个产品不能支持较大的负载。</p>
<p>再说最后一点，如果你想去优化改善，彻底改善，放弃吧。重写。</p>
<p>我看的只是uch2.0的预览版，估计正式版放出的时候，这些问题会有所改善。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/08/17/%e5%af%b9ucenter-home%e7%9a%84%e4%b8%80%e7%82%b9%e7%9c%8b%e6%b3%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>最近的总结</title>
		<link>http://www.sunboyu.cn/2009/08/13/%e6%9c%80%e8%bf%91%e7%9a%84%e6%80%bb%e7%bb%93.shtml</link>
		<comments>http://www.sunboyu.cn/2009/08/13/%e6%9c%80%e8%bf%91%e7%9a%84%e6%80%bb%e7%bb%93.shtml#comments</comments>
		<pubDate>Thu, 13 Aug 2009 14:04:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=945</guid>
		<description><![CDATA[1、相信团队的力量是无穷的，就好像组队打怪升级快。
2、不提倡个人英雄主义，一个人打boss一般的结果是over
3、分工合作，发挥长处。
4、集中精力做事情，稳下心来，事半功倍。
5、相信自己的实力，勇敢向前。
6、人都是善良的，世界多么美好。
7、同一个事情，同一个梦想。
8、大鱼大肉会长小肚子。
9、运动得坚持，人的耐性其实是表现在各个方面，坚持运动，还得坚持学习。
10、还有很多，因为数据库很贵，不多浪费。
11、做事想周全。
]]></description>
			<content:encoded><![CDATA[<p>1、相信团队的力量是无穷的，就好像组队打怪升级快。</p>
<p>2、不提倡个人英雄主义，一个人打boss一般的结果是over</p>
<p>3、分工合作，发挥长处。</p>
<p>4、集中精力做事情，稳下心来，事半功倍。</p>
<p>5、相信自己的实力，勇敢向前。</p>
<p>6、人都是善良的，世界多么美好。</p>
<p>7、同一个事情，同一个梦想。</p>
<p>8、大鱼大肉会长小肚子。</p>
<p>9、运动得坚持，人的耐性其实是表现在各个方面，坚持运动，还得坚持学习。</p>
<p>10、还有很多，因为数据库很贵，不多浪费。</p>
<p>11、做事想周全。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/08/13/%e6%9c%80%e8%bf%91%e7%9a%84%e6%80%bb%e7%bb%93.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Discuz一些乱码错误的总结</title>
		<link>http://www.sunboyu.cn/2009/08/03/discuz%e4%b8%80%e4%ba%9b%e4%b9%b1%e7%a0%81%e9%94%99%e8%af%af%e7%9a%84%e6%80%bb%e7%bb%93.shtml</link>
		<comments>http://www.sunboyu.cn/2009/08/03/discuz%e4%b8%80%e4%ba%9b%e4%b9%b1%e7%a0%81%e9%94%99%e8%af%af%e7%9a%84%e6%80%bb%e7%bb%93.shtml#comments</comments>
		<pubDate>Mon, 03 Aug 2009 14:19:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/2009/08/03/discuz%e4%b8%80%e4%ba%9b%e4%b9%b1%e7%a0%81%e9%94%99%e8%af%af%e7%9a%84%e6%80%bb%e7%bb%93.shtml</guid>
		<description><![CDATA[最近用Discuz6.0，在用到分类信息功能的时候，自建模板总是出现错误，仔细跟踪，发现是个别模板编码错误。我用的UTF-8版本，有不少文件里用了中文字符，而且是gbk编码，造成了这种错误。
我google此类信息，有不少问题都出现在了编码上，建议网友在使用的时候，发现编码错误，仔细跟踪一下，找出模板。大部分的问题基本能以此方式解决。
]]></description>
			<content:encoded><![CDATA[<p>最近用Discuz6.0，在用到分类信息功能的时候，自建模板总是出现错误，仔细跟踪，发现是个别模板编码错误。我用的UTF-8版本，有不少文件里用了中文字符，而且是gbk编码，造成了这种错误。</p>
<p>我google此类信息，有不少问题都出现在了编码上，建议网友在使用的时候，发现编码错误，仔细跟踪一下，找出模板。大部分的问题基本能以此方式解决。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/08/03/discuz%e4%b8%80%e4%ba%9b%e4%b9%b1%e7%a0%81%e9%94%99%e8%af%af%e7%9a%84%e6%80%bb%e7%bb%93.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>一个备份mysql的脚本，很简单</title>
		<link>http://www.sunboyu.cn/2009/07/29/%e4%b8%80%e4%b8%aa%e5%a4%87%e4%bb%bdmysql%e7%9a%84%e8%84%9a%e6%9c%ac%ef%bc%8c%e5%be%88%e7%ae%80%e5%8d%95.shtml</link>
		<comments>http://www.sunboyu.cn/2009/07/29/%e4%b8%80%e4%b8%aa%e5%a4%87%e4%bb%bdmysql%e7%9a%84%e8%84%9a%e6%9c%ac%ef%bc%8c%e5%be%88%e7%ae%80%e5%8d%95.shtml#comments</comments>
		<pubDate>Wed, 29 Jul 2009 13:43:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[备份]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=927</guid>
		<description><![CDATA[帮朋友维护服务器的时候，习惯性得检查各项服务和维护，偶然间发现了这个脚本，冒着被BS的风险分享给大家，希望大家捧个钱场，施舍给老衲几万块钱买套房。
@echo off
C:
CD &#34;C:\Program Files\WinRAR&#34;
&#160;
net stop Mysql
winrar.exe a -ag&#34;-[YYYY-MM-DD-HH-MM-SS]&#34; -k -r -s -ibck -inul &#34;D:\MYSQL备份生成的文件.rar&#34; &#34;E:\bak\data\*.*&#34;
net start Mysql
]]></description>
			<content:encoded><![CDATA[<p>帮朋友维护服务器的时候，习惯性得检查各项服务和维护，偶然间发现了这个脚本，冒着被BS的风险分享给大家，希望大家捧个钱场，施舍给老衲几万块钱买套房。</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">@echo off</li>
<li>C:</li>
<li>CD &quot;C:\Program Files\WinRAR&quot;</li>
<li>&nbsp;</li>
<li>net stop Mysql</li>
<li>winrar.exe a -ag&quot;-[YYYY-MM-DD-HH-MM-SS]&quot; -k -r -s -ibck -inul &quot;D:\MYSQL备份生成的文件.rar&quot; &quot;E:\bak\data\*.*&quot;</li>
<li>net start Mysql</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/07/29/%e4%b8%80%e4%b8%aa%e5%a4%87%e4%bb%bdmysql%e7%9a%84%e8%84%9a%e6%9c%ac%ef%bc%8c%e5%be%88%e7%ae%80%e5%8d%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>如何选择一个称心的IDC</title>
		<link>http://www.sunboyu.cn/2009/07/28/%e5%a6%82%e4%bd%95%e9%80%89%e6%8b%a9%e4%b8%80%e4%b8%aa%e7%a7%b0%e5%bf%83%e7%9a%84idc.shtml</link>
		<comments>http://www.sunboyu.cn/2009/07/28/%e5%a6%82%e4%bd%95%e9%80%89%e6%8b%a9%e4%b8%80%e4%b8%aa%e7%a7%b0%e5%bf%83%e7%9a%84idc.shtml#comments</comments>
		<pubDate>Tue, 28 Jul 2009 03:07:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[IDC]]></category>

		<category><![CDATA[选购]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=914</guid>
		<description><![CDATA[最近跟我那个成都的某个IDC机房扯皮，扯得我是下三滥的手段都想用了，不过看在还混在这个圈子的面子上，没跟他们使损招。我最看不惯的就是那些销售，以为技术人员都是木头，都是榆木疙瘩。凭借一张三寸不烂之舌就想敷衍了事。套用一句流行语：咱民工玩的是风度，不是阴沟。
其实自打毕业干IT这行，从买51.net的虚拟主机到现在，接触的IDC是不下几十家，出入过的机房也有十几个之多，当然碰到的一些扯皮的事情当然就更多了。写这篇文章，就是把一些细节纰漏出来。不针对某个无良IDC，当然也不是给哪个IDC做广告，都是自己经验之谈。也许有理解和认识的错误，欢迎朋友和同行们指正。
因为虚拟主机已经不常用，我说的主要是服务器托管租用方面，我的经历主要是北京范围内。
首先是如何找一个优秀的IDC。IDC分一线二线三线，就好像买车分几个系列一样。如果你想拥有军用悍马的性能，那十个奥拓的价格也不行。如果你真买了10万以下的车，那半路抛锚或者高速上被车皮挤死也别太抱怨。一线IDC主要集中了国内顶尖的网络公司：腾讯，搜狐，新浪，盛大，完美之类的大客户。他们的价格绝对让你乍舌，但质量也能有你想象那么高。你上这几家的网站，有几次断网，有几次感觉速度慢了。而二线的IDC就有大多数也许是发展中的网站，比较拮据的，或者一些知名客户但需要价格比比较高的流量的。三线的IDC，就难说了，小的不能再小的公司，一些个人网站，垃圾站，或者，就是皮包公司。
所以，寻找IDC，先问问销售，贵机房有什么知名的大客户，给个ip或者地址看看（当然，要说是搜狐的某个分站，不用他说，你自己就找到了）。这时，你可以根据销售提供的客户的质量来评价这个机房的档次。
当你选定一个机房后，测试是必须的——三天最少。当你的机器上架后，首先要做的，就是测试带宽，探测网络结构，测试稳定性，甚至网管反应（有点破坏性测试）。测试带宽，要测试上行和下行的带宽，是否能跑足。如果没有从三层以下限速，你尝试持续高带宽，网管有没有反应。（不要期望你能跑那么大的带宽，你跑的大，别的客户也能跑那么大，抢来抢去，自己正常业务也就受损了）。探测下你ip段的网络拓扑，是否划分vlan，你的vlan里有没有windows机器（防止arp，我一般用linux）。最后关机，你看网管是否有反应。我曾经用过一线IDC的带宽，但是网关配置出错，造成流量为0，结果我们刚出机房，网管就打来了电话。这样的服务，你能不感动么。
合同：不管什么业务，合同是要签的。这方面我很无奈，我可以直言不讳得说，做这行的都是流氓，因为合同上基本都是霸王条款。非可控的意外，他们基本都不赔偿。可以说，基本出现的故障，都是他们不可控的：大网出现意外，比如光纤让铲车铲了，或者市电被掐了。当然他们不可控。不过一定要记住，机房设计是必须把意外情况设计进去的，UPS、柴油发电机组是机房必须的设备，这也是你服务的一部分，如果这些都没有，那机房的价值就很低（带宽，电力只是成本的一部分，一部分成本用在了对于意外情况的冗余上）。所以，最好能让他们补充：何种电力冗余，何种网络冗余，意外故障如何赔偿。
实地勘察：光有合同不行，最近我碰到的事情很生气。机房电力出了问题（他们居然走普通市电而没有备用电力），UPS是有，没接到你机器上。结果断电，造成我mysql故障而无法恢复，我正在跟他们交涉。记得问问现场网管的情况，说两个比较常见的问题咨询一下。另外问问他们的收入情况。别小看这些细节：我的linux系统，让网管给关系，网管居然说不会linux。汗得我差点从自行车上载下来。去机房，多看看设备：电力，空调，防火，还有就是机房是否整齐，管理是否到位。看看机房后边的线是否都清晰（曾经在丰台一个机房，一下子就把邻居的电源拔了……）。
好的机房，不仅是硬件资源好，软件也不可缺的。当然软件不是指安装的软件，而是机房的配套设施。去的时候，网管都会自带工具软件。测试的时候建议让机房去做，比如，借一个移动光驱，借一张光盘，下载一个iso去刻盘，打一颗网线，让现场的技术给帮忙之类的事情。别怕机房的人BS你，这只是去感觉一下你应该有的服务。
补充1：上文所说测试上下行带宽问题，事出有因：大部分的专业idc，上下行给的都是一致的，但个别的idc，把下行带宽克扣出来，去给一些小区或者单位做接入，这样达到了更高的利润，但这样给一些下行需求高的客户带来了问题。所以我提到了这点。（学过通讯技术的应该都知道带宽复用这么一个技术，大家可以google一下。）
说了半天，这些经验的确都是自己交学费的成果，希望把这些细节分享给大家，欢迎大家交流，可以加我的qq  176300676  或者msn sunboyu@gmail.com
当然也可以加入lamp大家庭  msn用户加  lamper@live.cn 为好友
本文为作者原创，转载须注明出处。  http://www.sunboyu.cn/2009/07/28/%E5%A6%82%E4%BD%95%E9%80%89%E6%8B%A9%E4%B8%80%E4%B8%AA%E7%A7%B0%E5%BF%83%E7%9A%84idc.shtml
]]></description>
			<content:encoded><![CDATA[<p>最近跟我那个成都的某个IDC机房扯皮，扯得我是下三滥的手段都想用了，不过看在还混在这个圈子的面子上，没跟他们使损招。我最看不惯的就是那些销售，以为技术人员都是木头，都是榆木疙瘩。凭借一张三寸不烂之舌就想敷衍了事。套用一句流行语：咱民工玩的是风度，不是阴沟。</p>
<p>其实自打毕业干IT这行，从买51.net的虚拟主机到现在，接触的IDC是不下几十家，出入过的机房也有十几个之多，当然碰到的一些扯皮的事情当然就更多了。写这篇文章，就是把一些细节纰漏出来。不针对某个无良IDC，当然也不是给哪个IDC做广告，都是自己经验之谈。也许有理解和认识的错误，欢迎朋友和同行们指正。</p>
<p>因为虚拟主机已经不常用，我说的主要是服务器托管租用方面，我的经历主要是北京范围内。</p>
<p>首先是如何找一个优秀的IDC。IDC分一线二线三线，就好像买车分几个系列一样。如果你想拥有军用悍马的性能，那十个奥拓的价格也不行。如果你真买了10万以下的车，那半路抛锚或者高速上被车皮挤死也别太抱怨。一线IDC主要集中了国内顶尖的网络公司：腾讯，搜狐，新浪，盛大，完美之类的大客户。他们的价格绝对让你乍舌，但质量也能有你想象那么高。你上这几家的网站，有几次断网，有几次感觉速度慢了。而二线的IDC就有大多数也许是发展中的网站，比较拮据的，或者一些知名客户但需要价格比比较高的流量的。三线的IDC，就难说了，小的不能再小的公司，一些个人网站，垃圾站，或者，就是皮包公司。</p>
<p>所以，寻找IDC，先问问销售，贵机房有什么知名的大客户，给个ip或者地址看看（当然，要说是搜狐的某个分站，不用他说，你自己就找到了）。这时，你可以根据销售提供的客户的质量来评价这个机房的档次。</p>
<p>当你选定一个机房后，测试是必须的——三天最少。当你的机器上架后，首先要做的，就是测试带宽，探测网络结构，测试稳定性，甚至网管反应（有点破坏性测试）。测试带宽，要测试上行和下行的带宽，是否能跑足。如果没有从三层以下限速，你尝试持续高带宽，网管有没有反应。（不要期望你能跑那么大的带宽，你跑的大，别的客户也能跑那么大，抢来抢去，自己正常业务也就受损了）。探测下你ip段的网络拓扑，是否划分vlan，你的vlan里有没有windows机器（防止arp，我一般用linux）。最后关机，你看网管是否有反应。我曾经用过一线IDC的带宽，但是网关配置出错，造成流量为0，结果我们刚出机房，网管就打来了电话。这样的服务，你能不感动么。</p>
<p>合同：不管什么业务，合同是要签的。这方面我很无奈，我可以直言不讳得说，做这行的都是流氓，因为合同上基本都是霸王条款。非可控的意外，他们基本都不赔偿。可以说，基本出现的故障，都是他们不可控的：大网出现意外，比如光纤让铲车铲了，或者市电被掐了。当然他们不可控。不过一定要记住，机房设计是必须把意外情况设计进去的，UPS、柴油发电机组是机房必须的设备，这也是你服务的一部分，如果这些都没有，那机房的价值就很低（带宽，电力只是成本的一部分，一部分成本用在了对于意外情况的冗余上）。所以，最好能让他们补充：何种电力冗余，何种网络冗余，意外故障如何赔偿。</p>
<p>实地勘察：光有合同不行，最近我碰到的事情很生气。机房电力出了问题（他们居然走普通市电而没有备用电力），UPS是有，没接到你机器上。结果断电，造成我mysql故障而无法恢复，我正在跟他们交涉。记得问问现场网管的情况，说两个比较常见的问题咨询一下。另外问问他们的收入情况。别小看这些细节：我的linux系统，让网管给关系，网管居然说不会linux。汗得我差点从自行车上载下来。去机房，多看看设备：电力，空调，防火，还有就是机房是否整齐，管理是否到位。看看机房后边的线是否都清晰（曾经在丰台一个机房，一下子就把邻居的电源拔了……）。</p>
<p>好的机房，不仅是硬件资源好，软件也不可缺的。当然软件不是指安装的软件，而是机房的配套设施。去的时候，网管都会自带工具软件。测试的时候建议让机房去做，比如，借一个移动光驱，借一张光盘，下载一个iso去刻盘，打一颗网线，让现场的技术给帮忙之类的事情。别怕机房的人BS你，这只是去感觉一下你应该有的服务。</p>
<p>补充1：上文所说测试上下行带宽问题，事出有因：大部分的专业idc，上下行给的都是一致的，但个别的idc，把下行带宽克扣出来，去给一些小区或者单位做接入，这样达到了更高的利润，但这样给一些下行需求高的客户带来了问题。所以我提到了这点。（学过通讯技术的应该都知道带宽复用这么一个技术，大家可以google一下。）</p>
<p>说了半天，这些经验的确都是自己交学费的成果，希望把这些细节分享给大家，欢迎大家交流，可以加我的qq  176300676  或者msn sunboyu@gmail.com</p>
<p>当然也可以加入lamp大家庭  msn用户加  lamper@live.cn 为好友</p>
<p>本文为作者原创，转载须注明出处。  http://www.sunboyu.cn/2009/07/28/%E5%A6%82%E4%BD%95%E9%80%89%E6%8B%A9%E4%B8%80%E4%B8%AA%E7%A7%B0%E5%BF%83%E7%9A%84idc.shtml</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/07/28/%e5%a6%82%e4%bd%95%e9%80%89%e6%8b%a9%e4%b8%80%e4%b8%aa%e7%a7%b0%e5%bf%83%e7%9a%84idc.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>smarty分页程序，模板小改进</title>
		<link>http://www.sunboyu.cn/2009/07/27/smarty%e5%88%86%e9%a1%b5%e7%a8%8b%e5%ba%8f%ef%bc%8c%e6%a8%a1%e6%9d%bf%e5%b0%8f%e6%94%b9%e8%bf%9b.shtml</link>
		<comments>http://www.sunboyu.cn/2009/07/27/smarty%e5%88%86%e9%a1%b5%e7%a8%8b%e5%ba%8f%ef%bc%8c%e6%a8%a1%e6%9d%bf%e5%b0%8f%e6%94%b9%e8%bf%9b.shtml#comments</comments>
		<pubDate>Mon, 27 Jul 2009 07:11:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[smarty]]></category>

		<category><![CDATA[分页]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=899</guid>
		<description><![CDATA[增加了：跳转到第几页的功能
模板部分
&#60;div id=&#34;page&#34;&#62;
&#60;table&#62;
&#160;&#160; &#160;&#60;tr&#62;
	&#160; &#160; &#60;td&#62;
		共{{$page.count}}条数据 每页{{$page.pagesize}}条&#160; 共{{$page.pagecount}}页 当前第{{$page.page}}页
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#60;!-- 新加的跳转功能&#160; start --&#62;
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;跳转到第 
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#60;select onchange=&#34;window.location.href='{{$page.baseurl}}&#38;page='+this.options[this.selectedIndex].value&#34;&#62;
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;{{section name=pagejump loop=4 start=0 step=1 max=4}}
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;&#60;option value=&#34;{{$smarty.section.pagejump.index+1}}&#34;&#62;{{$smarty.section.pagejump.index+1}}&#60;/option&#62;
&#160;&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>增加了：跳转到第几页的功能</p>
<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">&lt;div id=&quot;page&quot;&gt;</li>
<li>&lt;table&gt;</li>
<li>&nbsp;&nbsp; &nbsp;&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td&gt;</li>
<li>		共{{$page.count}}条数据 每页{{$page.pagesize}}条&nbsp; 共{{$page.pagecount}}页 当前第{{$page.page}}页</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;!-- 新加的跳转功能&nbsp; start --&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;跳转到第 </li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;select onchange=&quot;window.location.href='{{$page.baseurl}}&amp;page='+this.options[this.selectedIndex].value&quot;&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{{section name=pagejump loop=4 start=0 step=1 max=4}}</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;option value=&quot;{{$smarty.section.pagejump.index+1}}&quot;&gt;{{$smarty.section.pagejump.index+1}}&lt;/option&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{{/section}}</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/select&gt; 页</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;!-- 新加的跳转功能&nbsp; start --&gt;</li>
<li>		&lt;/td&gt;</li>
<li>		&lt;td&gt;</li>
<li>		{{if $page.pagecount&gt;1}}</li>
<li>		{{if $page.first eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl}}&quot;&gt;首页&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		首页</li>
<li>		{{/if}}</li>
<li>		{{if $page.pre eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl}}&amp;page={{$page.page-1}}&quot;&gt;上一页&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		上一页</li>
<li>		{{/if}}</li>
<li>		{{foreach from=$page.pagelist item=vols}}</li>
<li>		&nbsp; &nbsp; {{if ($vols.page &gt; 0 ) &amp;&amp; ($vols.page &lt; = $page.pagecount) }}</li>
<li>				{{if $vols.link eq 1}}</li>
<li>				&lt;a href=&quot;{{$page.baseurl}}&amp;page={{$vols.page}}&quot;&gt;[{{$vols.page}}]</li>
<li>				{{else}}</li>
<li>				[{{$vols.page}}]</li>
<li>				{{/if}}</li>
<li>			{{/if}}</li>
<li>		{{/foreach}}</li>
<li>		{{if $page.next eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl|default:&quot;?&quot;}}&amp;page={{$page.page+1}}&quot;&gt;下一页&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		下一页</li>
<li>		{{/if}}</li>
<li>		{{if $page.last eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl|default:&quot;?&quot;}}&amp;page={{$page.pagecount}}&quot;&gt;尾页&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		尾页</li>
<li>		{{/if}}</li>
<li>		{{/if}}</li>
<li>		&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>&lt;/table&gt;</li>
<li>&lt;/div&gt;</li></ol></div>
<p>其实我在做的时候又出现个问题，如果是url重写了，如何来做这个baseurl变量。问题解决方法是，把url当做模板，比如/blog/index/%d</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/07/27/smarty%e5%88%86%e9%a1%b5%e7%a8%8b%e5%ba%8f%ef%bc%8c%e6%a8%a1%e6%9d%bf%e5%b0%8f%e6%94%b9%e8%bf%9b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>使用成语的文字验证码</title>
		<link>http://www.sunboyu.cn/2009/07/24/%e4%bd%bf%e7%94%a8%e6%88%90%e8%af%ad%e7%9a%84%e6%96%87%e5%ad%97%e9%aa%8c%e8%af%81%e7%a0%81.shtml</link>
		<comments>http://www.sunboyu.cn/2009/07/24/%e4%bd%bf%e7%94%a8%e6%88%90%e8%af%ad%e7%9a%84%e6%96%87%e5%ad%97%e9%aa%8c%e8%af%81%e7%a0%81.shtml#comments</comments>
		<pubDate>Fri, 24 Jul 2009 13:48:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[成语]]></category>

		<category><![CDATA[文字验证码]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=897</guid>
		<description><![CDATA[上次写的nb验证码程序，遭到了大部分人的唾弃，因为我使用了中国汉字全集，而大部分中国人对汉字了解还只能占其一半，也就是四个汉字中经常出现生僻字，造成无法使用。
这次使用成语作为汉字验证码（其实已经发现其他网站再用），则中文用户识别的几率就大得多。
demo:
程序下载:点击下载
]]></description>
			<content:encoded><![CDATA[<p>上次写的nb验证码程序，遭到了大部分人的唾弃，因为我使用了中国汉字全集，而大部分中国人对汉字了解还只能占其一半，也就是四个汉字中经常出现生僻字，造成无法使用。</p>
<p>这次使用成语作为汉字验证码（其实已经发现其他网站再用），则中文用户识别的几率就大得多。</p>
<p>demo:<img class="alignnone" src="http://www.sunboyu.cn/php/wordcode.php" alt="" width="67" height="18" /></p>
<p>程序下载:<a href="/php/nbcodev2.rar">点击下载</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/07/24/%e4%bd%bf%e7%94%a8%e6%88%90%e8%af%ad%e7%9a%84%e6%96%87%e5%ad%97%e9%aa%8c%e8%af%81%e7%a0%81.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>apache自动生成目录文件列表配置</title>
		<link>http://www.sunboyu.cn/2009/07/22/apache%e8%87%aa%e5%8a%a8%e7%94%9f%e6%88%90%e7%9b%ae%e5%bd%95%e6%96%87%e4%bb%b6%e5%88%97%e8%a1%a8%e9%85%8d%e7%bd%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2009/07/22/apache%e8%87%aa%e5%8a%a8%e7%94%9f%e6%88%90%e7%9b%ae%e5%bd%95%e6%96%87%e4%bb%b6%e5%88%97%e8%a1%a8%e9%85%8d%e7%bd%ae.shtml#comments</comments>
		<pubDate>Wed, 22 Jul 2009 11:13:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[apache列目录]]></category>

		<category><![CDATA[配置]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=880</guid>
		<description><![CDATA[由于种种原因，服务器给卖掉了，因此，我做的源码目录也就没了。这里把该目录的配置属性介绍一下：
&#60;directory /home/sunboyu/www_source.sunboyu.cn&#62;
&#160;&#160; &#160; &#160; &#160;MaxConnPerIP 1
&#160;&#160; &#160; &#160; &#160;ReadmeName foot.html&#160; &#160; &#160; &#160; #页面的头
&#160;&#160; &#160; &#160; &#160;HeaderName top.html&#160; &#160; &#160; &#160; &#160; #页面的脚
&#160;&#160; &#160; &#160; &#160;IndexIgnore top.html foot.html&#160; &#160; #列目录的时候，忽略这些文件
&#160;&#160; &#160; &#160; &#160;ServerSignature Off&#160; &#160; &#160; &#160;#关闭服务器标志
&#160;&#160; &#160; &#160; &#160;IndexOptions FancyIndexing VersionSort FoldersFirst SuppressLastModified NameWidth=* Charset=UTF-8
&#160;&#160; &#160; &#160; &#160;Options FollowSymLinks
&#160;&#160; &#160; &#160; &#160;Options +Indexes
&#160;&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<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">&lt;directory /home/sunboyu/www_source.sunboyu.cn&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;MaxConnPerIP 1</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ReadmeName foot.html&nbsp; &nbsp; &nbsp; &nbsp; #页面的头</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;HeaderName top.html&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #页面的脚</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;IndexIgnore top.html foot.html&nbsp; &nbsp; #列目录的时候，忽略这些文件</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;ServerSignature Off&nbsp; &nbsp; &nbsp; &nbsp;#关闭服务器标志</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;IndexOptions FancyIndexing VersionSort FoldersFirst SuppressLastModified NameWidth=* Charset=UTF-8</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Options FollowSymLinks</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Options +Indexes</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;AllowOverride all</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Order deny,allow</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Allow from all</li>
<li>&nbsp;&lt;/directory&gt;</li></ol></div>
<p>FancyIndexing 打开列表功能</p>
<p>VersionSort 同一文件不同版本分类列出</p>
<p>FoldersFirst 文件夹优先</p>
<p>SuppressLastModified 禁止列出最后修改时间</p>
<p>NameWidth=* 文件名长度 *当然是全部显示</p>
<p>Charset=UTF-8 页面输出编码</p>
<p>AddIcon /other/icons/exe.gif .bin .exe  给exe bin扩展名添加exe.gif图标</p>
<p>ScanHTMLTitles 如果有html文件，则度html的title为描述</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/07/22/apache%e8%87%aa%e5%8a%a8%e7%94%9f%e6%88%90%e7%9b%ae%e5%bd%95%e6%96%87%e4%bb%b6%e5%88%97%e8%a1%a8%e9%85%8d%e7%bd%ae.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>图片动态缩放PHP与JS算法</title>
		<link>http://www.sunboyu.cn/2009/07/20/%e5%9b%be%e7%89%87%e5%8a%a8%e6%80%81%e7%bc%a9%e6%94%bephp%e4%b8%8ejs%e7%ae%97%e6%b3%95.shtml</link>
		<comments>http://www.sunboyu.cn/2009/07/20/%e5%9b%be%e7%89%87%e5%8a%a8%e6%80%81%e7%bc%a9%e6%94%bephp%e4%b8%8ejs%e7%ae%97%e6%b3%95.shtml#comments</comments>
		<pubDate>Mon, 20 Jul 2009 00:19:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[GD]]></category>

		<category><![CDATA[JS]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[图片缩放]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=875</guid>
		<description><![CDATA[这个算法写好多次了，虽然简单，但每次都得想一次，这里做个备份。
因为GD函数进行缩放，必须有宽和高，而在浏览器中，会自动按照比率调整宽高，所以两个函数稍有区别。
#PHP版
# $s_width&#160; 原图宽
# $s_height 原图高
# $t_width&#160; 目标文件最大宽
# $t_height 目标文件最大高
function ReSizePic( $s_width , $s_height , $t_width , $t_height)
{
	if( $s_width / $s_height &#62; $t_width / $t_height &#38;&#38; $s_width &#62; $t_width)
	{
		$t_height = $s_height * $t_width / $s_width;
		$t_width = $t_width;
	}
	else if( $s_width / $s_height &#62; $t_width / $t_height &#38;&#38; $s_width &#60; = $t_width)
	{
		$t_height = $s_height;
		$t_width&#160; = $s_width;
	}
	else if( $s_width [...]]]></description>
			<content:encoded><![CDATA[<p>这个算法写好多次了，虽然简单，但每次都得想一次，这里做个备份。</p>
<p>因为GD函数进行缩放，必须有宽和高，而在浏览器中，会自动按照比率调整宽高，所以两个函数稍有区别。</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">#PHP版</li>
<li># $s_width&nbsp; 原图宽</li>
<li># $s_height 原图高</li>
<li># $t_width&nbsp; 目标文件最大宽</li>
<li># $t_height 目标文件最大高</li>
<li>function ReSizePic( $s_width , $s_height , $t_width , $t_height)</li>
<li>{</li>
<li>	if( $s_width / $s_height &gt; $t_width / $t_height &amp;&amp; $s_width &gt; $t_width)</li>
<li>	{</li>
<li>		$t_height = $s_height * $t_width / $s_width;</li>
<li>		$t_width = $t_width;</li>
<li>	}</li>
<li>	else if( $s_width / $s_height &gt; $t_width / $t_height &amp;&amp; $s_width &lt; = $t_width)</li>
<li>	{</li>
<li>		$t_height = $s_height;</li>
<li>		$t_width&nbsp; = $s_width;</li>
<li>	}</li>
<li>	else if( $s_width / $s_height &lt; $t_width / $t_height &amp;&amp; $s_height &gt; $t_height)</li>
<li>	{</li>
<li>		$t_width = $s_width*$t_height/$s_height;</li>
<li>		$t_height = $t_height;</li>
<li>	}</li>
<li>	else if( $s_width / $s_height &lt; $t_width / $t_height &amp;&amp; $s_height &lt;= $t_height)</li>
<li>	{</li>
<li>		$t_height = $s_height;</li>
<li>		$t_width&nbsp; = $s_width;</li>
<li>	}</li>
<li>	return array( &quot;width&quot; =&gt; $t_width , &quot;height&quot; =&gt; $t_height );</li>
<li>}</li>
<li>#JS版</li>
<li># obj 图片对象</li>
<li># maxWidth 显示最大宽</li>
<li># maxHeight 显示最大高</li>
<li>function ReSizePic( obj , maxWidth , maxHeight )</li>
<li>{</li>
<li>	if( ( obj.width/obj.height &gt;= maxWidth/maxHeight ) &amp;&amp; obj.width &gt; maxWidth )</li>
<li>	{</li>
<li>		obj.width = maxWidth;</li>
<li>	}</li>
<li>	else if( ( obj.width/obj.height &lt; maxWidth/maxHeight ) &amp;&amp; obj.height &gt; maxHeight )</li>
<li>	{</li>
<li>		obj.height = maxHeight;</li>
<li>	}</li>
<li>}</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/07/20/%e5%9b%be%e7%89%87%e5%8a%a8%e6%80%81%e7%bc%a9%e6%94%bephp%e4%b8%8ejs%e7%ae%97%e6%b3%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>智联招聘的个人评测系统</title>
		<link>http://www.sunboyu.cn/2009/07/16/%e6%99%ba%e8%81%94%e6%8b%9b%e8%81%98%e7%9a%84%e4%b8%aa%e4%ba%ba%e8%af%84%e6%b5%8b%e7%b3%bb%e7%bb%9f.shtml</link>
		<comments>http://www.sunboyu.cn/2009/07/16/%e6%99%ba%e8%81%94%e6%8b%9b%e8%81%98%e7%9a%84%e4%b8%aa%e4%ba%ba%e8%af%84%e6%b5%8b%e7%b3%bb%e7%bb%9f.shtml#comments</comments>
		<pubDate>Wed, 15 Jul 2009 20:56:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[个人评测系统]]></category>

		<category><![CDATA[智联]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=860</guid>
		<description><![CDATA[朋友发给我智联招聘一个个人评测系统，进行了职业兴趣，IQ,EQ的测试，经过一中午的测试，我发现这个测试还是蛮有道理的，对我的分析大体如下：
职业兴趣：研究型、社会型。   从小不喜欢学习，但喜欢玩弄点高深的东西，让只看分数的老师们头疼不已。分数不高，难题倒解得非常出色，让我想起了爱因斯坦（狂晕）。中学往后一直在学校担任领导干部，估计是社会型性格的由来。
智商102，平均水平。看来真是一般人。其中对数字的敏感很强，排到了82%，估计我天生是搞计算机的命。不过我更喜欢研究hack。
情商不高，不喜欢研究人，估计长期跟计算机打交道的结构。不过沟通能力语言能力情绪控制能力挺强。在情商分支看来我也偏科。我是很理智的人。
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
人的发展还是取决于个人和环境，测试权当一参考。
]]></description>
			<content:encoded><![CDATA[<p>朋友发给我智联招聘一个个人评测系统，进行了职业兴趣，IQ,EQ的测试，经过一中午的测试，我发现这个测试还是蛮有道理的，对我的分析大体如下：</p>
<p>职业兴趣：研究型、社会型。   从小不喜欢学习，但喜欢玩弄点高深的东西，让只看分数的老师们头疼不已。分数不高，难题倒解得非常出色，让我想起了爱因斯坦（狂晕）。中学往后一直在学校担任领导干部，估计是社会型性格的由来。</p>
<p>智商102，平均水平。看来真是一般人。其中对数字的敏感很强，排到了82%，估计我天生是搞计算机的命。不过我更喜欢研究hack。</p>
<p>情商不高，不喜欢研究人，估计长期跟计算机打交道的结构。不过沟通能力语言能力情绪控制能力挺强。在情商分支看来我也偏科。我是很理智的人。</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>人的发展还是取决于个人和环境，测试权当一参考。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/07/16/%e6%99%ba%e8%81%94%e6%8b%9b%e8%81%98%e7%9a%84%e4%b8%aa%e4%ba%ba%e8%af%84%e6%b5%8b%e7%b3%bb%e7%bb%9f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>为FCKEditor增加图片附件管理功能</title>
		<link>http://www.sunboyu.cn/2009/07/15/%e4%b8%bafckeditor%e5%a2%9e%e5%8a%a0%e5%9b%be%e7%89%87%e9%99%84%e4%bb%b6%e7%ae%a1%e7%90%86%e5%8a%9f%e8%83%bd.shtml</link>
		<comments>http://www.sunboyu.cn/2009/07/15/%e4%b8%bafckeditor%e5%a2%9e%e5%8a%a0%e5%9b%be%e7%89%87%e9%99%84%e4%bb%b6%e7%ae%a1%e7%90%86%e5%8a%9f%e8%83%bd.shtml#comments</comments>
		<pubDate>Wed, 15 Jul 2009 05:38:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[fckeditor]]></category>

		<category><![CDATA[附件数据库]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=858</guid>
		<description><![CDATA[其实好久没用过FCKEeditor了，因为将近两年没写过CMS，今天突然人品大爆发，想起了这个问题。
fckeditor是一个非常棒的所见即所得在线编辑器，包括一些门户网站都在使用。fckeditor有个问题，就是上传图片默认为一个文件夹，当然这个问题早已经解决，我们可以用cookie或者session的方式给参数 $Config['UserFilesPath'] 就可以定制上传路径。而后在文章保存的过程中即可保存图片地址。
然后在使用过程中又出现一个问题，虽然我们知道图片在哪个文件夹，但我们却不能动态的去知道具体文件夹内有哪几个图片，预览是什么。而且，我们在写CMS的时候经常需要调用其中一张图片做封面，原来的机制显然无法去满足这些需求（当然你也可以查看编辑器内的源代码来查看图片地址，不过对于外行似乎有点困难）。
突然看到了discuz的附件机制，相出这么个损招：每张图片上传都给他存储在数据库中，打上guid（或者唯一的地址）进行标识，当我们保存的时候，图片会跟文章关联，在使用之前还可以用ajax动态调用预览，可谓一举两得。
文章保存后，图片进入数据库，另外还可以方便找出编辑遗留的垃圾，因为很多时候一个已经传了文章的草稿没有保存，而遗留很多的临时文件。
最近的fck版本好像升级了，配置文件放从根目录迁移了，不过fck代码非常规整，做这么个改造不是很难，就没写demo。
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
文章很冗余，骗稿费?
]]></description>
			<content:encoded><![CDATA[<p>其实好久没用过FCKEeditor了，因为将近两年没写过CMS，今天突然人品大爆发，想起了这个问题。</p>
<p>fckeditor是一个非常棒的所见即所得在线编辑器，包括一些门户网站都在使用。fckeditor有个问题，就是上传图片默认为一个文件夹，当然这个问题早已经解决，我们可以用cookie或者session的方式给参数 $Config['UserFilesPath'] 就可以定制上传路径。而后在文章保存的过程中即可保存图片地址。</p>
<p>然后在使用过程中又出现一个问题，虽然我们知道图片在哪个文件夹，但我们却不能动态的去知道具体文件夹内有哪几个图片，预览是什么。而且，我们在写CMS的时候经常需要调用其中一张图片做封面，原来的机制显然无法去满足这些需求（当然你也可以查看编辑器内的源代码来查看图片地址，不过对于外行似乎有点困难）。</p>
<p>突然看到了discuz的附件机制，相出这么个损招：每张图片上传都给他存储在数据库中，打上guid（或者唯一的地址）进行标识，当我们保存的时候，图片会跟文章关联，在使用之前还可以用ajax动态调用预览，可谓一举两得。</p>
<p>文章保存后，图片进入数据库，另外还可以方便找出编辑遗留的垃圾，因为很多时候一个已经传了文章的草稿没有保存，而遗留很多的临时文件。</p>
<p>最近的fck版本好像升级了，配置文件放从根目录迁移了，不过fck代码非常规整，做这么个改造不是很难，就没写demo。</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>文章很冗余，骗稿费?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/07/15/%e4%b8%bafckeditor%e5%a2%9e%e5%8a%a0%e5%9b%be%e7%89%87%e9%99%84%e4%bb%b6%e7%ae%a1%e7%90%86%e5%8a%9f%e8%83%bd.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Linux配置几个关键点需要注意</title>
		<link>http://www.sunboyu.cn/2009/07/15/linux%e9%85%8d%e7%bd%ae%e5%87%a0%e4%b8%aa%e5%85%b3%e9%94%ae%e7%82%b9%e9%9c%80%e8%a6%81%e6%b3%a8%e6%84%8f.shtml</link>
		<comments>http://www.sunboyu.cn/2009/07/15/linux%e9%85%8d%e7%bd%ae%e5%87%a0%e4%b8%aa%e5%85%b3%e9%94%ae%e7%82%b9%e9%9c%80%e8%a6%81%e6%b3%a8%e6%84%8f.shtml#comments</comments>
		<pubDate>Tue, 14 Jul 2009 20:30:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[centos]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[机房]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=856</guid>
		<description><![CDATA[前两天机房断电，弄得兄弟我太郁闷。机房网管居然直接硬关机，这么来回弄了两三次，问技术，不是那一拨，问销售，没啥解释，人家说不知道……
一分钱一分货有道理，结果我机器挂了，机房那边说linux启动，中间卡死了。因为那个机房没有懂linux的网管，所以，我开车（捷安特）去了机房。
后发现，其实没什么问题，卡在了一个依赖python的启动进程上，另外mysql貌似也没有启动。
我用ubuntu live版的cd进入系统（有点像win下的PE的思路），修改了python设置：
原来python默认是2.3版本，我升级到了2.5，默认关联的是2.5版的，但这样会有一些问题，比如yum对版本依赖性很强，修改后则其不工作，所以我修改了yum的配置，让其寻找2.3版本。而另一下对python有依赖的模块我却没有发现，造成down机后无法启动。
mysql无法自启动，没找出是哪的问题，不过，我在ubuntu下加载了原来的分区，修改了rc.local配置,灭了mysql，系统顺利启动。
总结：ubuntu live cd的作用跟我修理xp时候的pe功能相似，系统挂掉的时候修改个配置啥的还是很好用的。
除非很了解软件之间的依赖性，否则不要随意修改那些配置，否则会造成依赖性问题。
事发现场图片

]]></description>
			<content:encoded><![CDATA[<p>前两天机房断电，弄得兄弟我太郁闷。机房网管居然直接硬关机，这么来回弄了两三次，问技术，不是那一拨，问销售，没啥解释，人家说不知道……</p>
<p>一分钱一分货有道理，结果我机器挂了，机房那边说linux启动，中间卡死了。因为那个机房没有懂linux的网管，所以，我开车（捷安特）去了机房。</p>
<p>后发现，其实没什么问题，卡在了一个依赖python的启动进程上，另外mysql貌似也没有启动。</p>
<p>我用ubuntu live版的cd进入系统（有点像win下的PE的思路），修改了python设置：</p>
<p>原来python默认是2.3版本，我升级到了2.5，默认关联的是2.5版的，但这样会有一些问题，比如yum对版本依赖性很强，修改后则其不工作，所以我修改了yum的配置，让其寻找2.3版本。而另一下对python有依赖的模块我却没有发现，造成down机后无法启动。</p>
<p>mysql无法自启动，没找出是哪的问题，不过，我在ubuntu下加载了原来的分区，修改了rc.local配置,灭了mysql，系统顺利启动。</p>
<p>总结：ubuntu live cd的作用跟我修理xp时候的pe功能相似，系统挂掉的时候修改个配置啥的还是很好用的。</p>
<p>除非很了解软件之间的依赖性，否则不要随意修改那些配置，否则会造成依赖性问题。</p>
<p>事发现场图片</p>
<p><a href="http://www.sunboyu.cn/upfiles/2009/07/server-mysql.jpg"><img class="aligncenter size-full wp-image-872" title="server-mysql" src="http://www.sunboyu.cn/upfiles/2009/07/server-mysql.jpg" alt="server-mysql" width="800" height="591" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/07/15/linux%e9%85%8d%e7%bd%ae%e5%87%a0%e4%b8%aa%e5%85%b3%e9%94%ae%e7%82%b9%e9%9c%80%e8%a6%81%e6%b3%a8%e6%84%8f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP开发的一个pureftpd管理工具</title>
		<link>http://www.sunboyu.cn/2009/07/10/php%e5%bc%80%e5%8f%91%e7%9a%84%e4%b8%80%e4%b8%aapureftpd%e7%ae%a1%e7%90%86%e5%b7%a5%e5%85%b7.shtml</link>
		<comments>http://www.sunboyu.cn/2009/07/10/php%e5%bc%80%e5%8f%91%e7%9a%84%e4%b8%80%e4%b8%aapureftpd%e7%ae%a1%e7%90%86%e5%b7%a5%e5%85%b7.shtml#comments</comments>
		<pubDate>Fri, 10 Jul 2009 08:49:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[manager]]></category>

		<category><![CDATA[pureftpd]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=850</guid>
		<description><![CDATA[用过pureftpd manager，虽然功能足够，但很多bug，无法使用，而pureftpd功能简单，写个管理工具也没多复杂，于是乎，花两个晚上写了个简单的管理脚本，分享给大家。不过没来得及写注释，回头会把注释补上。
分流下载 http://down.chinaz.com/soft/26439.htm
点击下载
&#60; ?php
error_reporting(2047);
header(&#34;Content-Type: text/html; charset=utf-8&#34;);
header(&#34;Cache-Control: no-cache, must-revalidate&#34;); // HTTP/1.1
header(&#34;Expires: Mon, 26 Jul 1997 05:00:00 GMT&#34;); // 过去的时间
define(&#34;FILENAME&#34;,$_SERVER['PHP_SELF']);
$adminuser = &#34;admin&#34;;
$adminpass = &#34;admin&#34;;
&#160;
$servtype = 'mysql';
$hostname = 'localhost';
$username = 'root';
$password = '123456';
$datebase = 'pure-ftpd';
$table&#160; &#160; = &#34;users&#34;;
$charset&#160; = 'utf8';
$crypt&#160; &#160; = &#34;MD5&#34;;
&#160;
session_start();
#session_destroy();
$action = isset($_GET['action']) ? $_GET['action'] : &#34;index&#34;;
&#160;
&#160;
switch( $action )
{
&#160;&#160; &#160;case &#34;index&#34;:
	&#160; &#160; checklogin();
		func_html( 0 );
		switch($_SESSION['user'])
		{
		&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>用过pureftpd manager，虽然功能足够，但很多bug，无法使用，而pureftpd功能简单，写个管理工具也没多复杂，于是乎，花两个晚上写了个简单的管理脚本，分享给大家。不过没来得及写注释，回头会把注释补上。</p>
<p>分流下载 http://down.chinaz.com/soft/26439.htm</p>
<p><a href='http://www.sunboyu.cn/upfiles/2009/07/ftp.rar'>点击下载</a></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">&lt; ?php</li>
<li>error_reporting(2047);</li>
<li>header(&quot;Content-Type: text/html; charset=utf-8&quot;);</li>
<li>header(&quot;Cache-Control: no-cache, must-revalidate&quot;); // HTTP/1.1</li>
<li>header(&quot;Expires: Mon, 26 Jul 1997 05:00:00 GMT&quot;); // 过去的时间</li>
<li>define(&quot;FILENAME&quot;,$_SERVER['PHP_SELF']);</li>
<li>$adminuser = &quot;admin&quot;;</li>
<li>$adminpass = &quot;admin&quot;;</li>
<li>&nbsp;</li>
<li>$servtype = 'mysql';</li>
<li>$hostname = 'localhost';</li>
<li>$username = 'root';</li>
<li>$password = '123456';</li>
<li>$datebase = 'pure-ftpd';</li>
<li>$table&nbsp; &nbsp; = &quot;users&quot;;</li>
<li>$charset&nbsp; = 'utf8';</li>
<li>$crypt&nbsp; &nbsp; = &quot;MD5&quot;;</li>
<li>&nbsp;</li>
<li>session_start();</li>
<li>#session_destroy();</li>
<li>$action = isset($_GET['action']) ? $_GET['action'] : &quot;index&quot;;</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>switch( $action )</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;case &quot;index&quot;:</li>
<li>	&nbsp; &nbsp; checklogin();</li>
<li>		func_html( 0 );</li>
<li>		switch($_SESSION['user'])</li>
<li>		{</li>
<li>		&nbsp; &nbsp; case $adminuser:</li>
<li>			&nbsp; &nbsp; func_admin_index();</li>
<li>			break;</li>
<li>			default:</li>
<li>			&nbsp; &nbsp; func_user_index();</li>
<li>			break;</li>
<li>		}</li>
<li>		func_html( 1 );</li>
<li>	break;</li>
<li>&nbsp;&nbsp; &nbsp;case &quot;userlogin&quot;:</li>
<li>	case &quot;adminlogin&quot;:</li>
<li>	&nbsp; &nbsp; func_html( 0 );</li>
<li>	&nbsp; &nbsp; func_userlogin();</li>
<li>		func_html( 1 );</li>
<li>	break;</li>
<li>	case &quot;userloginaction&quot;:</li>
<li>	&nbsp; &nbsp; func_userloginaction( $_POST['username'] , $_POST['password'] , $_POST['logintype'] );</li>
<li>	break;</li>
<li>	case &quot;userpasswordchang&quot;:</li>
<li>	&nbsp; &nbsp; checklogin();</li>
<li>		user_password_chang( $_POST['password'] );</li>
<li>	break;</li>
<li>	case &quot;adminchangeuserpassword&quot;:</li>
<li>	case &quot;useradd&quot;:</li>
<li>	&nbsp; &nbsp; checklogin(true);</li>
<li>		func_admin_user_edit( isset($_GET['user']) ? $_GET['user'] : false );</li>
<li>	break;</li>
<li>	case &quot;userinfoac&quot;:</li>
<li>	&nbsp; &nbsp; checklogin(true);</li>
<li>		switch($_POST['action'])</li>
<li>		{</li>
<li>		&nbsp; &nbsp; case &quot;edit&quot;:</li>
<li>			&nbsp; &nbsp; func_admin_useredit();</li>
<li>			break;</li>
<li>			case &quot;add&quot;:</li>
<li>			&nbsp; &nbsp; func_admin_useradd();</li>
<li>			break;</li>
<li>		}</li>
<li>	break;</li>
<li>	case &quot;adminuserdel&quot;:</li>
<li>	&nbsp; &nbsp; func_user_del( $_GET['user'] );</li>
<li>	break;</li>
<li>	case &quot;logout&quot;:</li>
<li>	&nbsp; &nbsp; func_logout();</li>
<li>	break;</li>
<li>}</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>function func_html( $position = 0 )</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;switch( $position )</li>
<li>	{</li>
<li>	&nbsp; &nbsp; case 0:</li>
<li>		&nbsp; &nbsp; echo &quot;&lt;!DOCTYPE html PUBLIC \&quot;-//W3C//DTD XHTML 1.0 Transitional//EN\&quot; \&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\&quot;&gt;</li>
<li>&lt;html xmlns=\&quot;http://www.w3.org/1999/xhtml\&quot;&gt;</li>
<li>&lt;head&gt;</li>
<li>&lt;meta http-equiv=\&quot;Content-Type\&quot; content=\&quot;text/html; charset=utf-8\&quot; /&gt;</li>
<li>&lt;title&gt;PURE-FTPD简易管理系统&lt;/title&gt;</li>
<li>&lt;style type=\&quot;text/css\&quot;&gt;</li>
<li>td</li>
<li>{</li>
<li>	padding:4px;</li>
<li>}</li>
<li>.bar</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;width:80%;</li>
<li>	border-bottom:dotted 1px #aaa;</li>
<li>	margin-bottom:20px;</li>
<li>	padding:10px;</li>
<li>}</li>
<li>&lt;/style&gt;</li>
<li>&lt;/head&gt;</li>
<li>&lt;body&gt;</li>
<li>&lt;div class=\&quot;bar\&quot;&gt;PURE-FTPD简易管理工具 &amp;nbsp; 孙博宇 &amp;nbsp; http://www.sunboyu.cn &amp;nbsp; QQ:176300676 &amp;nbsp; MSN:sunboyu@gmail.com&nbsp; &amp;nbsp; &quot;;</li>
<li>if(isset($_SESSION['user']))</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;input type=\&quot;button\&quot; name=\&quot;logout\&quot; id=\&quot;logout\&quot; value=\&quot;退出\&quot;&nbsp; onclick=\&quot;window.location.href='?action=logout'\&quot; /&gt;&quot;;</li>
<li>}</li>
<li>echo &quot;&lt;/div&gt;&quot;;</li>
<li>		break;</li>
<li>		case 1:</li>
<li>		&nbsp; &nbsp; echo &quot;&lt;/body&gt;</li>
<li>&lt;/html&gt;</li>
<li>			&quot;;</li>
<li>		break;</li>
<li>	}</li>
<li>&nbsp;&nbsp; &nbsp;</li>
<li>}</li>
<li>function checklogin( $type = false )</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;global $adminuser;</li>
<li>&nbsp;&nbsp; &nbsp;if(!isset($_SESSION['user']))</li>
<li>	{</li>
<li>		header(&quot;Location:&quot;.FILENAME.&quot;?action=userlogin&quot;);</li>
<li>	}</li>
<li>	if($type&amp;&amp;$_SESSION['user']!=$adminuser)</li>
<li>	{</li>
<li>	&nbsp; &nbsp; header(&quot;Location:&quot;.FILENAME.&quot;?action=adminlogin&quot;);</li>
<li>	}</li>
<li>}</li>
<li>&nbsp;</li>
<li>function func_userlogin( )</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;form name=\&quot;loginform\&quot; id=\&quot;loginform\&quot; action=\&quot;?action=userloginaction\&quot; method=\&quot;post\&quot;&gt;</li>
<li>&lt;table cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; border=\&quot;0\&quot; style=\&quot;margin:0px;\&quot;&gt;</li>
<li>	&lt;tr&gt;</li>
<li>		&lt;td colspan=\&quot;2\&quot; align=\&quot;center\&quot;&gt;用户登录&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>		&lt;td width=\&quot;60\&quot; align=\&quot;right\&quot;&gt;用户名&lt;/td&gt;&lt;td width=\&quot;200\&quot;&gt;&lt;input type=\&quot;text\&quot; name=\&quot;username\&quot; id=\&quot;username\&quot; /&gt;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>		&lt;td align=\&quot;right\&quot;&gt;密码&lt;/td&gt;&lt;td&gt;&lt;input type=\&quot;password\&quot; name=\&quot;password\&quot; id=\&quot;password\&quot; /&gt;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>		&lt;td align=\&quot;center\&quot; colspan=\&quot;2\&quot;&gt;&lt;input type=\&quot;submit\&quot; name=\&quot;submit\&quot; id=\&quot;submit\&quot; value=\&quot;登录\&quot; /&gt;&lt;input type=\&quot;hidden\&quot; name=\&quot;logintype\&quot; id=\&quot;logintype\&quot; value=\&quot;{$_GET['action']}\&quot; /&gt; &amp;nbsp; &quot;;</li>
<li>		if($_GET['action']==&quot;userlogin&quot;)</li>
<li>		{</li>
<li>		&nbsp; &nbsp; echo &quot;&lt;a href=\&quot;?action=adminlogin\&quot;&gt;管理员登录&lt;/a&gt;&quot;;</li>
<li>		}</li>
<li>		else</li>
<li>		{</li>
<li>		&nbsp; &nbsp; echo &quot;&lt;a href=\&quot;?action=userlogin\&quot;&gt;用户登录&lt;/a&gt;&quot;;</li>
<li>		}</li>
<li>		echo &quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>		&lt;td align=\&quot;center\&quot; colspan=\&quot;2\&quot;&gt;&quot;.(isset($_GET['error']) ? $_GET['error'] : &quot;&quot;).&quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>&lt;/table&gt;</li>
<li>&lt;/form&gt;</li>
<li>	&quot;;</li>
<li>}</li>
<li>&nbsp;</li>
<li>function func_getdb()</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;global $hostname,$username,$password,$datebase,$charset;</li>
<li>	$handle = @mysql_connect( $hostname , $username , $password , false ) or die(&quot;Can't connetc to the DateBse.&quot;.mysql_error());</li>
<li>	@mysql_select_db( $datebase , $handle ) or die(&quot;Can't select the DateBase&quot;.mysql_error());</li>
<li>	mysql_query( &quot;SET NAMES '{$charset}'&quot; , $handle );</li>
<li>	return $handle;</li>
<li>}</li>
<li>&nbsp;</li>
<li>function func_userloginaction( $usernames , $passwords , $logintype )</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;switch( $logintype )</li>
<li>	{</li>
<li>	&nbsp; &nbsp; case &quot;userlogin&quot;:</li>
<li>		&nbsp; &nbsp; global $table,$username,$password,$crypt;</li>
<li>			$handle = func_getdb();</li>
<li>			#echo &quot;SELECT COUNT(*) AS count FROM {$table} WHERE User = '{$usernames}' AND Password = &quot;.$crypt.&quot;('&quot;.$passwords.&quot;')&quot;;</li>
<li>			$query = mysql_query(&quot;SELECT COUNT(*) AS count FROM {$table} WHERE User = '{$usernames}' AND Password = &quot;.$crypt.&quot;('&quot;.$passwords.&quot;')&quot; , $handle);</li>
<li>			$row = mysql_fetch_array( $query, MYSQL_ASSOC );</li>
<li>			if($row['count']==1)</li>
<li>			{</li>
<li>				$_SESSION['user'] = $usernames;</li>
<li>				echo &quot;登录成功，跳转中……&quot;;</li>
<li>				echo &quot;&lt;meta http-equiv=\&quot;Refresh\&quot; content=\&quot;1; url=&quot;.FILENAME.&quot;?action=index\&quot;&gt;&quot;;</li>
<li>			}</li>
<li>			else</li>
<li>			{</li>
<li>				header(&quot;Location:&quot;.FILENAME.&quot;?action=userlogin&amp;error=&quot;.urlencode(&quot;用户名或者密码错误！&quot;));</li>
<li>			}</li>
<li>		break;</li>
<li>		case &quot;adminlogin&quot;:</li>
<li>		&nbsp; &nbsp; global $adminuser,$adminpass;</li>
<li>		&nbsp; &nbsp; if($adminuser==$usernames&amp;&amp;$adminpass==$passwords)</li>
<li>			{</li>
<li>			&nbsp; &nbsp; $_SESSION['user'] = $usernames;</li>
<li>				echo &quot;登录成功，跳转中……&quot;;</li>
<li>				echo &quot;&lt;/meta&gt;&lt;meta http-equiv=\&quot;Refresh\&quot; content=\&quot;1; url=&quot;.FILENAME.&quot;?action=index\&quot;&gt;&quot;;</li>
<li>			}</li>
<li>			else</li>
<li>			{</li>
<li>			&nbsp; &nbsp; header(&quot;Location:&quot;.FILENAME.&quot;?action=adminlogin&amp;error=&quot;.urlencode(&quot;用户名或者密码错误！&quot;));</li>
<li>			}</li>
<li>		break;</li>
<li>	}</li>
<li>}</li>
<li>&nbsp;</li>
<li>function func_user_index()</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;global $table,$username,$password,$crypt;</li>
<li>	$handle = func_getdb();</li>
<li>	$query = mysql_query(&quot;SELECT * FROM {$table} WHERE User = '{$_SESSION['user']}'&quot; , $handle);</li>
<li>	$row = mysql_fetch_array( $query, MYSQL_ASSOC );</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;form name=\&quot;userpassword\&quot; id=\&quot;userpassword\&quot; method=\&quot;post\&quot; action=\&quot;?action=userpasswordchang\&quot;&gt;</li>
<li>	&lt;table cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; border=\&quot;1\&quot;&gt;</li>
<li>&nbsp;&nbsp; &nbsp;&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td colspan=\&quot;2\&quot; align=\&quot;center\&quot;&gt;服务器信息&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>&nbsp;&nbsp; &nbsp;&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;ip&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&quot;.gethostbyname($_SERVER['SERVER_NAME']).&quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td colspan=\&quot;2\&quot; align=\&quot;center\&quot;&gt;账户信息&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;用户名&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&quot;.$row['User'].&quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;修改密码&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&lt;input type=\&quot;password\&quot; name=\&quot;password\&quot; id=\&quot;password\&quot; /&gt; &amp;nbsp; &lt;input type=\&quot;submit\&quot; name=\&quot;submit\&quot; id=\&quot;submit\&quot; value=\&quot;修改\&quot; /&gt;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;Uid&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&quot;.$row['Uid'].&quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;Gid&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&quot;.$row['Gid'].&quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;Status&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&quot;.$row['status'].&quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;Dir&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&quot;.$row['Dir'].&quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;ULBandwidth&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&quot;.$row['ULBandwidth'].&quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;DLBandwidth&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&quot;.$row['DLBandwidth'].&quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;ipaccess&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&quot;.$row['ipaccess'].&quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;QuotaSize&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&quot;.$row['QuotaSize'].&quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;QuotaFiles&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&quot;.$row['QuotaFiles'].&quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>&lt;/table&gt;</li>
<li>&lt;/form&gt;</li>
<li>	&quot;;</li>
<li>}</li>
<li>&nbsp;</li>
<li>function user_password_chang( $password )</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;global $crypt,$table;</li>
<li>&nbsp;&nbsp; &nbsp;if(empty($password))</li>
<li>	{</li>
<li>	&nbsp; &nbsp; echo &quot;密码不能为空，修改失败……&quot;;</li>
<li>		echo &quot;&lt;/meta&gt;&lt;meta http-equiv=\&quot;Refresh\&quot; content=\&quot;1; url=&quot;.FILENAME.&quot;?action=index\&quot;&gt;&quot;;</li>
<li>	}</li>
<li>	else</li>
<li>	{</li>
<li>		$handle = func_getdb();</li>
<li>		$query = mysql_query(&quot;UPDATE {$table} SET Password = &quot;.$crypt.&quot;('&quot;.$password.&quot;') WHERE User = '{$_SESSION['user']}'&quot; , $handle);</li>
<li>		session_destroy();</li>
<li>		echo &quot;修改成功，请重新登录。如果新的密码不能登录，请尝试使用旧密码进行登录……&quot;;</li>
<li>		echo &quot;&lt;/meta&gt;&lt;meta http-equiv=\&quot;Refresh\&quot; content=\&quot;1; url=&quot;.FILENAME.&quot;?action=userlogin\&quot;&gt;&quot;;</li>
<li>	}</li>
<li>}</li>
<li>&nbsp;</li>
<li>function func_admin_index()</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;global $table,$username,$password,$crypt;</li>
<li>	$handle = func_getdb();</li>
<li>	$query = mysql_query(&quot;SELECT * FROM {$table} ORDER BY User ASC&quot; , $handle);</li>
<li>	echo &quot;&lt;script language=\&quot;javascript\&quot;&gt;</li>
<li>function del( username )</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;if(confirm('确认删除 '+username+'?'))</li>
<li>	{</li>
<li>	&nbsp; &nbsp; window.location.href=\&quot;?action=adminuserdel&amp;user=\&quot;+username;</li>
<li>	}</li>
<li>	else</li>
<li>	{</li>
<li>	&nbsp; &nbsp; return false;</li>
<li>	}</li>
<li>}</li>
<li>&lt;/script&gt;&lt;table cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; border=\&quot;1\&quot;&gt;</li>
<li>&lt;tr&gt;</li>
<li>	&lt;td colspan=\&quot;4\&quot; align=\&quot;center\&quot;&gt;用户列表&lt;/td&gt;</li>
<li>	&lt;td align=\&quot;right\&quot;&gt;&lt;input type=\&quot;button\&quot; name=\&quot;add\&quot; id=\&quot;add\&quot; value=\&quot;添加账户\&quot; onclick=\&quot;window.location.href='?action=useradd'\&quot; /&gt;&lt;/td&gt;</li>
<li>&lt;/tr&gt;</li>
<li>&lt;tr&gt;</li>
<li>	&lt;td align=\&quot;center\&quot;&gt;账号&lt;/td&gt;</li>
<li>	&lt;td align=\&quot;center\&quot;&gt;Uid&lt;/td&gt;</li>
<li>	&lt;td align=\&quot;center\&quot;&gt;Gid&lt;/td&gt;</li>
<li>	&lt;td align=\&quot;center\&quot;&gt;Dir&lt;/td&gt;</li>
<li>	&lt;td align=\&quot;center\&quot;&gt;操作&lt;/td&gt;&nbsp; &nbsp;	 	</li>
<li>&lt;/tr&gt;&quot;;</li>
<li>	while( $row = mysql_fetch_array( $query, MYSQL_ASSOC ) )</li>
<li>	{</li>
<li>	&nbsp; &nbsp; echo &quot;&lt;tr&gt;</li>
<li>	&lt;td&gt;&quot;.$row['User'].&quot;&lt;/td&gt;</li>
<li>	&lt;td align=\&quot;center\&quot;&gt;&quot;.$row['Uid'].&quot;&lt;/td&gt;</li>
<li>	&lt;td align=\&quot;center\&quot;&gt;&quot;.$row['Gid'].&quot;&lt;/td&gt;</li>
<li>	&lt;td&gt;&quot;.$row['Dir'].&quot;&lt;/td&gt;</li>
<li>	&lt;td align=\&quot;center\&quot;&gt;&lt;input type=\&quot;button\&quot; name=\&quot;button\&quot; id=\&quot;button\&quot; value=\&quot;修改\&quot; onclick=\&quot;window.location.href='?action=adminchangeuserpassword&amp;user=&quot;.$row['User'].&quot;'\&quot; /&gt;</li>
<li>	&lt;input type=\&quot;button\&quot; name=\&quot;del\&quot; id=\&quot;del\&quot; value=\&quot;删除\&quot; onclick=\&quot;del('&quot;.$row['User'].&quot;')\&quot; /&gt;&lt;/td&gt;&nbsp; &nbsp;	 	</li>
<li>&lt;/tr&gt;&quot;;</li>
<li>	}</li>
<li>echo &quot;&lt;/table&gt;&quot;;</li>
<li>}</li>
<li>&nbsp;</li>
<li>function func_admin_user_edit( $user = false )</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;if($user)</li>
<li>	{</li>
<li>	&nbsp; &nbsp; global $table,$crypt;</li>
<li>		$handle = func_getdb();</li>
<li>		$query = mysql_query(&quot;SELECT * FROM {$table} WHERE User = '&quot;.$user.&quot;'&quot; , $handle);</li>
<li>		$row = mysql_fetch_array( $query, MYSQL_ASSOC );</li>
<li>		if($row==false)</li>
<li>		{</li>
<li>		&nbsp; &nbsp; echo &quot;不存在这个用户……&quot;;</li>
<li>		&nbsp; &nbsp; echo &quot;&lt;/meta&gt;&lt;meta http-equiv=\&quot;Refresh\&quot; content=\&quot;1; url=&quot;.FILENAME.&quot;?action=index\&quot;&gt;&quot;;</li>
<li>			exit();</li>
<li>		}</li>
<li>		$action = &quot;edit&quot;;</li>
<li>	}</li>
<li>	else</li>
<li>	{</li>
<li>	&nbsp; &nbsp; $row[&quot;User&quot;] = &quot;&quot;;</li>
<li>		$row['Uid'] = &quot;&quot;;</li>
<li>		$row['Gid'] = &quot;&quot;;</li>
<li>		$row['status'] = 0;</li>
<li>		$row['Dir'] = &quot;&quot;;</li>
<li>		$row['ULBandwidth'] = 0;</li>
<li>		$row['DLBandwidth'] = 0;</li>
<li>		$row['ipaccess'] = &quot;*&quot;;</li>
<li>		$row['QuotaSize'] = 0;</li>
<li>		$row['QuotaFiles'] = 0;</li>
<li>		$action = &quot;add&quot;;</li>
<li>	}</li>
<li>echo &quot;&lt;form name=\&quot;userpassword\&quot; id=\&quot;userpassword\&quot; method=\&quot;post\&quot; action=\&quot;?action=userinfoac\&quot;&gt;</li>
<li>&lt;table cellpadding=\&quot;0\&quot; cellspacing=\&quot;0\&quot; border=\&quot;1\&quot;&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td colspan=\&quot;2\&quot; align=\&quot;center\&quot;&gt;账户信息&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;用户名&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&quot;;</li>
<li>		if($action==&quot;add&quot;)</li>
<li>		{</li>
<li>		&nbsp; &nbsp; echo&nbsp; &quot;&lt;input type=\&quot;text\&quot; name=\&quot;User\&quot; id=\&quot;User\&quot; value=\&quot;&quot;.$row['User'].&quot;\&quot; /&gt;&quot;;</li>
<li>		}</li>
<li>		else</li>
<li>		{</li>
<li>		&nbsp; &nbsp; echo&nbsp; $row['User'].&quot;&lt;input type=\&quot;hidden\&quot; name=\&quot;User\&quot; id=\&quot;User\&quot; value=\&quot;&quot;.$row['User'].&quot;\&quot; /&gt;&quot;;</li>
<li>		}</li>
<li>		echo &quot;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;密码&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt;&lt;input type=\&quot;password\&quot; name=\&quot;password\&quot; id=\&quot;password\&quot; /&gt; &lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;Uid&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt; &lt;input type=\&quot;text\&quot; name=\&quot;Uid\&quot; id=\&quot;Uid\&quot; value=\&quot;&quot;.$row['Uid'].&quot;\&quot; /&gt;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;Gid&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt; &lt;input type=\&quot;text\&quot; name=\&quot;Gid\&quot; id=\&quot;Gid\&quot; value=\&quot;&quot;.$row['Gid'].&quot;\&quot; /&gt;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;Status&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt; &lt;input type=\&quot;text\&quot; name=\&quot;status\&quot; id=\&quot;status\&quot; value=\&quot;&quot;.$row['status'].&quot;\&quot; /&gt;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;Dir&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt; &lt;input type=\&quot;text\&quot; name=\&quot;Dir\&quot; id=\&quot;Dir\&quot; value=\&quot;&quot;.$row['Dir'].&quot;\&quot; /&gt;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;ULBandwidth&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt; &lt;input type=\&quot;text\&quot; name=\&quot;ULBandwidth\&quot; id=\&quot;ULBandwidth\&quot; value=\&quot;&quot;.$row['ULBandwidth'].&quot;\&quot; /&gt;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;DLBandwidth&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt; &lt;input type=\&quot;text\&quot; name=\&quot;DLBandwidth\&quot; id=\&quot;DLBandwidth\&quot; value=\&quot;&quot;.$row['DLBandwidth'].&quot;\&quot; /&gt;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;ipaccess&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt; &lt;input type=\&quot;text\&quot; name=\&quot;ipaccess\&quot; id=\&quot;ipaccess\&quot; value=\&quot;&quot;.$row['ipaccess'].&quot;\&quot; /&gt;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;QuotaSize&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt; &lt;input type=\&quot;text\&quot; name=\&quot;QuotaSize\&quot; id=\&quot;QuotaSize\&quot; value=\&quot;&quot;.$row['QuotaSize'].&quot;\&quot; /&gt;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td width=\&quot;100\&quot; align=\&quot;right\&quot;&gt;QuotaFiles&lt;/td&gt;&lt;td width=\&quot;500\&quot;&gt; &lt;input type=\&quot;text\&quot; name=\&quot;QuotaFiles\&quot; id=\&quot;QuotaFiles\&quot; value=\&quot;&quot;.$row['QuotaFiles'].&quot;\&quot; /&gt;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>	&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td align=\&quot;center\&quot; colspan=\&quot;2\&quot;&gt;&lt;input type=\&quot;submit\&quot; name=\&quot;submit\&quot; id=\&quot;submit\&quot; value=\&quot;提交\&quot; /&gt; &lt;input type=\&quot;button\&quot; name=\&quot;back\&quot; id=\&quot;back\&quot; onclick=\&quot;window.history.go(-1)\&quot; value=\&quot;返回\&quot; /&gt; &lt;input type=\&quot;hidden\&quot; name=\&quot;action\&quot; id=\&quot;action\&quot; value=\&quot;&quot;.$action.&quot;\&quot; /&gt;&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>&lt;/table&gt;</li>
<li>&lt;/form&gt;&quot;;</li>
<li>}</li>
<li>&nbsp;</li>
<li>function func_admin_useredit()</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;global $table,$crypt;</li>
<li>	$handle = func_getdb();</li>
<li>	$query = mysql_query(&quot;SELECT * FROM {$table} WHERE User = '&quot;.$_POST['User'].&quot;'&quot; , $handle);</li>
<li>	$row = mysql_fetch_array( $query, MYSQL_ASSOC );</li>
<li>	if($row==false)</li>
<li>	{</li>
<li>		echo &quot;不存在这个用户……&quot;;</li>
<li>		echo &quot;&lt;/meta&gt;&lt;meta http-equiv=\&quot;Refresh\&quot; content=\&quot;1; url=&quot;.FILENAME.&quot;?action=index\&quot;&gt;&quot;;</li>
<li>		exit();</li>
<li>	}</li>
<li>	$query = mysql_query(&quot;UPDATE {$table} SET password = &quot;.$crypt.&quot;('&quot;.$_POST['password'].&quot;') , Uid = {$_POST['Uid']} , Gid = {$_POST['Gid']} , status = '{$_POST['status']}' , Dir = '{$_POST['Dir']}' , ULBandwidth = {$_POST['ULBandwidth']} , DLBandwidth = {$_POST['DLBandwidth']} , ipaccess = '{$_POST['ipaccess']}' , QuotaSize = {$_POST['QuotaSize']} , QuotaFiles = {$_POST['QuotaFiles']} WHERE User = '{$_POST['User']}'&quot;);</li>
<li>	if($query)</li>
<li>	{</li>
<li>	&nbsp; &nbsp; echo &quot;修改成功，稍后返回……&quot;;</li>
<li>	}</li>
<li>	else</li>
<li>	{</li>
<li>	&nbsp; &nbsp; echo &quot;修改失败，请仔细检查每个参数……&quot;;</li>
<li>	}</li>
<li>	echo &quot;&lt;/meta&gt;&lt;meta http-equiv=\&quot;Refresh\&quot; content=\&quot;1; url=&quot;.FILENAME.&quot;?action=index\&quot;&gt;&quot;;</li>
<li>	exit();</li>
<li>}</li>
<li>&nbsp;</li>
<li>function func_admin_useradd()</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;global $table,$crypt;</li>
<li>	$handle = func_getdb();</li>
<li>	$query = mysql_query(&quot;SELECT * FROM {$table} WHERE User = '&quot;.$_POST['User'].&quot;'&quot; , $handle);</li>
<li>	$row = mysql_fetch_array( $query, MYSQL_ASSOC );</li>
<li>	if($row)</li>
<li>	{</li>
<li>		echo &quot;用户已经存在……&quot;;</li>
<li>		echo &quot;&lt;/meta&gt;&lt;meta http-equiv=\&quot;Refresh\&quot; content=\&quot;1; url=&quot;.FILENAME.&quot;?action=index\&quot;&gt;&quot;;</li>
<li>		exit();</li>
<li>	}</li>
<li>	$query = mysql_query(&quot;INSERT INTO {$table} SET password = &quot;.$crypt.&quot;('&quot;.$_POST['password'].&quot;') , Uid = {$_POST['Uid']} , Gid = {$_POST['Gid']} , status = '{$_POST['status']}' , Dir = '{$_POST['Dir']}' , ULBandwidth = {$_POST['ULBandwidth']} , DLBandwidth = {$_POST['DLBandwidth']} , ipaccess = '{$_POST['ipaccess']}' , QuotaSize = {$_POST['QuotaSize']} , QuotaFiles = {$_POST['QuotaFiles']} , User = '{$_POST['User']}' , comment = ''&quot;);</li>
<li>	if($query)</li>
<li>	{</li>
<li>	&nbsp; &nbsp; echo &quot;添加成功，稍后返回……&quot;;</li>
<li>	}</li>
<li>	else</li>
<li>	{</li>
<li>	&nbsp; &nbsp; echo &quot;添加失败，请仔细检查每个参数……&quot;;</li>
<li>	}</li>
<li>	echo &quot;&lt;/meta&gt;&lt;meta http-equiv=\&quot;Refresh\&quot; content=\&quot;1; url=&quot;.FILENAME.&quot;?action=index\&quot;&gt;&quot;;</li>
<li>	exit();</li>
<li>}</li>
<li>&nbsp;</li>
<li>function func_user_del( $user )</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;global $table;</li>
<li>	$handle = func_getdb();</li>
<li>	$query = mysql_query(&quot;DELETE FROM {$table} WHERE User = '{$user}'&quot; , $handle);</li>
<li>	if($query)</li>
<li>	{</li>
<li>	&nbsp; &nbsp; echo &quot;删除成功，稍后返回……&quot;;</li>
<li>	}</li>
<li>	else</li>
<li>	{</li>
<li>	&nbsp; &nbsp; echo &quot;删除失败，稍后返回……&quot;;</li>
<li>	}</li>
<li>	echo &quot;&lt;/meta&gt;&lt;meta http-equiv=\&quot;Refresh\&quot; content=\&quot;1; url=&quot;.FILENAME.&quot;?action=index\&quot;&gt;&quot;;</li>
<li>}</li>
<li>&nbsp;</li>
<li>function func_logout()</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;session_destroy();</li>
<li>	echo &quot;退出成功……&quot;;</li>
<li>	echo &quot;&lt;/meta&gt;&lt;meta http-equiv=\&quot;Refresh\&quot; content=\&quot;1; url=&quot;.FILENAME.&quot;?action=userlogin\&quot;&gt;&quot;;</li>
<li>}</li>
<li>?&gt;</li>
<li>&lt;/meta&gt;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/07/10/php%e5%bc%80%e5%8f%91%e7%9a%84%e4%b8%80%e4%b8%aapureftpd%e7%ae%a1%e7%90%86%e5%b7%a5%e5%85%b7.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>故地重游，不一样的感觉</title>
		<link>http://www.sunboyu.cn/2009/07/08/%e6%95%85%e5%9c%b0%e9%87%8d%e6%b8%b8%ef%bc%8c%e4%b8%8d%e4%b8%80%e6%a0%b7%e7%9a%84%e6%84%9f%e8%a7%89.shtml</link>
		<comments>http://www.sunboyu.cn/2009/07/08/%e6%95%85%e5%9c%b0%e9%87%8d%e6%b8%b8%ef%bc%8c%e4%b8%8d%e4%b8%80%e6%a0%b7%e7%9a%84%e6%84%9f%e8%a7%89.shtml#comments</comments>
		<pubDate>Wed, 08 Jul 2009 06:10:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[服务]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=846</guid>
		<description><![CDATA[帮一个朋友搞点东西，发现，他居然跟我的老东家合作的。呵呵，如果我在老东家那里继续任职，这个客户就是我的客户。
登陆原来公司的服务器，很有重归故里的感觉，可现在，我成了局外人。
公司做大了，服务反而差了，这另我很失望。一个优秀的公司不断发展，对外的服务也必须提升，这样才能良性的循环。
就算站最后的局外岗，服务做好！
]]></description>
			<content:encoded><![CDATA[<p>帮一个朋友搞点东西，发现，他居然跟我的老东家合作的。呵呵，如果我在老东家那里继续任职，这个客户就是我的客户。</p>
<p>登陆原来公司的服务器，很有重归故里的感觉，可现在，我成了局外人。</p>
<p>公司做大了，服务反而差了，这另我很失望。一个优秀的公司不断发展，对外的服务也必须提升，这样才能良性的循环。</p>
<p>就算站最后的局外岗，服务做好！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/07/08/%e6%95%85%e5%9c%b0%e9%87%8d%e6%b8%b8%ef%bc%8c%e4%b8%8d%e4%b8%80%e6%a0%b7%e7%9a%84%e6%84%9f%e8%a7%89.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>RSS解析类-SimplePie</title>
		<link>http://www.sunboyu.cn/2009/07/08/rss%e8%a7%a3%e6%9e%90%e7%b1%bb-simplepie.shtml</link>
		<comments>http://www.sunboyu.cn/2009/07/08/rss%e8%a7%a3%e6%9e%90%e7%b1%bb-simplepie.shtml#comments</comments>
		<pubDate>Wed, 08 Jul 2009 01:31:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[rss]]></category>

		<category><![CDATA[simplepie]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=844</guid>
		<description><![CDATA[最近做一个RSS解析调用的东东，研究了rss2.0的协议，发现自己去写解析程序会要命的，于是找了个开源的php rss解析类，发现完全可以满足需求，故推荐给大家。虽然有一些bug，但是可以绕过，不影响主要字段显示，先这么用着。底下写了个demo：
$this-&#62;load(&#34;SimplePie&#34;,&#34;http://www.sunboyu.cn/feed&#34;);&#160; &#160;#自己写的框架，load是加载类的方法，可根据自己的情况进行修改 new Simplepie()
$this-&#62;SimplePie-&#62;strip_comments(true);
$this-&#62;SimplePie-&#62;enable_xml_dump( false );
$this-&#62;SimplePie-&#62;init();
$this-&#62;SimplePie-&#62;handle_content_type();
&#160;
foreach( $r as $item ):
&#160;&#160; &#160;echo &#34;&#60;font color=\&#34;red\&#34;&#62;标题&#60;/font&#62;&#160; &#34;.$item-&#62;get_title();
&#160;&#160; &#160;echo &#34;&#60;br /&#62;&#34;;
&#160;&#160; &#160;echo &#34;&#60;font color=\&#34;red\&#34;&#62;链接&#60;/font&#62;&#160; &#34;.$item-&#62;get_link();
&#160;&#160; &#160;echo &#34;&#60;br /&#62;&#34;;
&#160;&#160; &#160;echo &#34;&#60;font color=\&#34;red\&#34;&#62;链接&#60;/font&#62;&#160; &#34;.$item-&#62;get_id();
&#160;&#160; &#160;echo &#34;&#60;br /&#62;&#34;;
&#160;&#160; &#160;echo &#34;&#60;font color=\&#34;red\&#34;&#62;更新时间&#60;/font&#62;&#160; &#34;.strtotime($item-&#62;get_date());
&#160;&#160; &#160;echo &#34;&#60;br /&#62;&#34;;
&#160;&#160; &#160;$authors = $item-&#62;get_authors();
&#160;&#160; &#160;echo &#34;&#60;font color=\&#34;red\&#34;&#62;作者&#60;/font&#62;&#160; &#34;.$authors[0]-&#62;name;
&#160;&#160; &#160;echo &#34;&#60;br /&#62;&#34;;
&#160;&#160; &#160;echo &#34;&#60;font color=\&#34;red\&#34;&#62;描述&#60;/font&#62;&#160; &#34;.$item-&#62;get_description();
&#160;&#160; &#160;echo &#34;&#60;br [...]]]></description>
			<content:encoded><![CDATA[<p>最近做一个RSS解析调用的东东，研究了rss2.0的协议，发现自己去写解析程序会要命的，于是找了个开源的php rss解析类，发现完全可以满足需求，故推荐给大家。虽然有一些bug，但是可以绕过，不影响主要字段显示，先这么用着。底下写了个demo：</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">$this-&gt;load(&quot;SimplePie&quot;,&quot;http://www.sunboyu.cn/feed&quot;);&nbsp; &nbsp;#自己写的框架，load是加载类的方法，可根据自己的情况进行修改 new Simplepie()</li>
<li>$this-&gt;SimplePie-&gt;strip_comments(true);</li>
<li>$this-&gt;SimplePie-&gt;enable_xml_dump( false );</li>
<li>$this-&gt;SimplePie-&gt;init();</li>
<li>$this-&gt;SimplePie-&gt;handle_content_type();</li>
<li>&nbsp;</li>
<li>foreach( $r as $item ):</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;font color=\&quot;red\&quot;&gt;标题&lt;/font&gt;&nbsp; &quot;.$item-&gt;get_title();</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;br /&gt;&quot;;</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;font color=\&quot;red\&quot;&gt;链接&lt;/font&gt;&nbsp; &quot;.$item-&gt;get_link();</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;br /&gt;&quot;;</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;font color=\&quot;red\&quot;&gt;链接&lt;/font&gt;&nbsp; &quot;.$item-&gt;get_id();</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;br /&gt;&quot;;</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;font color=\&quot;red\&quot;&gt;更新时间&lt;/font&gt;&nbsp; &quot;.strtotime($item-&gt;get_date());</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;br /&gt;&quot;;</li>
<li>&nbsp;&nbsp; &nbsp;$authors = $item-&gt;get_authors();</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;font color=\&quot;red\&quot;&gt;作者&lt;/font&gt;&nbsp; &quot;.$authors[0]-&gt;name;</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;br /&gt;&quot;;</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;font color=\&quot;red\&quot;&gt;描述&lt;/font&gt;&nbsp; &quot;.$item-&gt;get_description();</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;br /&gt;&quot;;</li>
<li>&nbsp;&nbsp; &nbsp;echo $item-&gt;get_local_date();</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;br /&gt;&quot;;</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;font color=\&quot;red\&quot;&gt;正文&lt;/font&gt;&nbsp; &quot;.$item-&gt;get_content();</li>
<li>&nbsp;&nbsp; &nbsp;echo &quot;&lt;br /&gt;&lt;br /&gt;&quot;;</li>
<li>foreachend;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/07/08/rss%e8%a7%a3%e6%9e%90%e7%b1%bb-simplepie.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>初创公司的运维应该怎么做（lamp架构）2</title>
		<link>http://www.sunboyu.cn/2009/06/24/%e5%88%9d%e5%88%9b%e5%85%ac%e5%8f%b8%e7%9a%84%e8%bf%90%e7%bb%b4%e5%ba%94%e8%af%a5%e6%80%8e%e4%b9%88%e5%81%9a%ef%bc%88lamp%e6%9e%b6%e6%9e%84%ef%bc%892.shtml</link>
		<comments>http://www.sunboyu.cn/2009/06/24/%e5%88%9d%e5%88%9b%e5%85%ac%e5%8f%b8%e7%9a%84%e8%bf%90%e7%bb%b4%e5%ba%94%e8%af%a5%e6%80%8e%e4%b9%88%e5%81%9a%ef%bc%88lamp%e6%9e%b6%e6%9e%84%ef%bc%892.shtml#comments</comments>
		<pubDate>Wed, 24 Jun 2009 10:08:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[初创公司]]></category>

		<category><![CDATA[运维]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=815</guid>
		<description><![CDATA[今天活进度不错，闲下来再扯几句，接上篇： 初创公司的运维应该怎么做（lamp架构）
事情总得发展，一不小心就会发展到两台以上的服务器。
这时候，如何部署就是问题了，既要节约硬件带宽资源，省钱，又要充分发挥我们硬件的特性。
1、数据库，总得做个热备吧，主从复制，两个服务器就足够，当然更多的话，你可以多个从数据库。这时候主服务器挂了，备份的数据库可以立马变成主数据库进行工作，而主数据库又变成从的，这样达到无缝的切换。数据库多了，写压力集中在主数据库，而从数据库就可以分担读的压力。一般系统读压力大大高于写压力（特殊的系统除外），这样我们把其他服务器的CPU还能合理利用上。
2、如果但是数据库分到其他服务器上，CPU看似是充分利用了，带宽也得去利用。mysql同步走内网流量，自己用switch相连，而其他服务器同样可以分担http的负载。这时候，我们要考虑如何把原来独立服务器的http流量分布到其他新服务器上。直接做个nfs，把附件图片等分布到新服务器上是个最简单最懒的方式，也是短期最有效的，因为我们可以更换一个变量名就把url指向另外的服务器。
3、分频道也是办法之一，我们把一个大网站拆成几个小网站，分散到几个服务器，包括代码、数据、数据库，不过这种方法对小网站是费力不讨好，分开了，还整合不？分频道之外，还可以分功能，可以把email单独拿出来，也可以把一些消耗资源的功能单独拿出来。
4、最合理的，还是要综合考虑当前的服务，压力所在。把CPU、存储，带宽资源需求的模块都列出来，然后平均分布，再寻找平均分配资源的部署方式，这样是最优化的，但也对开发人员提出了更高的要求。程序代码的模块化、可零活配置、可迁移、可扩展是进行优化的前提。所以，在网站建设初期，最好考虑如何去扩展站点。
－－－－－－－－－－－－－－－－－－－－－
貌似运维跟程序又掺合到一起了，当然，好的项目是需要各部门合作的，团队力量总是大的，所谓：瘦死的骆驼比狗大。
]]></description>
			<content:encoded><![CDATA[<p>今天活进度不错，闲下来再扯几句，接上篇： <a href="http://www.sunboyu.cn/2009/06/22/%E5%88%9D%E5%88%9B%E5%85%AC%E5%8F%B8%E7%9A%84%E8%BF%90%E7%BB%B4%E5%BA%94%E8%AF%A5%E6%80%8E%E4%B9%88%E5%81%9A%EF%BC%88lamp%E6%9E%B6%E6%9E%84%EF%BC%89.shtml">初创公司的运维应该怎么做（lamp架构）</a></p>
<p>事情总得发展，一不小心就会发展到两台以上的服务器。</p>
<p>这时候，如何部署就是问题了，既要节约硬件带宽资源，省钱，又要充分发挥我们硬件的特性。</p>
<p>1、数据库，总得做个热备吧，主从复制，两个服务器就足够，当然更多的话，你可以多个从数据库。这时候主服务器挂了，备份的数据库可以立马变成主数据库进行工作，而主数据库又变成从的，这样达到无缝的切换。数据库多了，写压力集中在主数据库，而从数据库就可以分担读的压力。一般系统读压力大大高于写压力（特殊的系统除外），这样我们把其他服务器的CPU还能合理利用上。</p>
<p>2、如果但是数据库分到其他服务器上，CPU看似是充分利用了，带宽也得去利用。mysql同步走内网流量，自己用switch相连，而其他服务器同样可以分担http的负载。这时候，我们要考虑如何把原来独立服务器的http流量分布到其他新服务器上。直接做个nfs，把附件图片等分布到新服务器上是个最简单最懒的方式，也是短期最有效的，因为我们可以更换一个变量名就把url指向另外的服务器。</p>
<p>3、分频道也是办法之一，我们把一个大网站拆成几个小网站，分散到几个服务器，包括代码、数据、数据库，不过这种方法对小网站是费力不讨好，分开了，还整合不？分频道之外，还可以分功能，可以把email单独拿出来，也可以把一些消耗资源的功能单独拿出来。</p>
<p>4、最合理的，还是要综合考虑当前的服务，压力所在。把CPU、存储，带宽资源需求的模块都列出来，然后平均分布，再寻找平均分配资源的部署方式，这样是最优化的，但也对开发人员提出了更高的要求。程序代码的模块化、可零活配置、可迁移、可扩展是进行优化的前提。所以，在网站建设初期，最好考虑如何去扩展站点。</p>
<p>－－－－－－－－－－－－－－－－－－－－－</p>
<p>貌似运维跟程序又掺合到一起了，当然，好的项目是需要各部门合作的，团队力量总是大的，所谓：瘦死的骆驼比狗大。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/06/24/%e5%88%9d%e5%88%9b%e5%85%ac%e5%8f%b8%e7%9a%84%e8%bf%90%e7%bb%b4%e5%ba%94%e8%af%a5%e6%80%8e%e4%b9%88%e5%81%9a%ef%bc%88lamp%e6%9e%b6%e6%9e%84%ef%bc%892.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>初创公司的运维应该怎么做（lamp架构）</title>
		<link>http://www.sunboyu.cn/2009/06/22/%e5%88%9d%e5%88%9b%e5%85%ac%e5%8f%b8%e7%9a%84%e8%bf%90%e7%bb%b4%e5%ba%94%e8%af%a5%e6%80%8e%e4%b9%88%e5%81%9a%ef%bc%88lamp%e6%9e%b6%e6%9e%84%ef%bc%89.shtml</link>
		<comments>http://www.sunboyu.cn/2009/06/22/%e5%88%9d%e5%88%9b%e5%85%ac%e5%8f%b8%e7%9a%84%e8%bf%90%e7%bb%b4%e5%ba%94%e8%af%a5%e6%80%8e%e4%b9%88%e5%81%9a%ef%bc%88lamp%e6%9e%b6%e6%9e%84%ef%bc%89.shtml#comments</comments>
		<pubDate>Mon, 22 Jun 2009 05:23:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[初创公司]]></category>

		<category><![CDATA[运维]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=808</guid>
		<description><![CDATA[这里说的初创公司，也包括一些小型的网络公司，运维是很头疼的事情。
初创公司，包括一些现金有问题的公司，资金紧张，买不起大量的设备，用不起高级的运维人员，财政捉襟见肘。
这种公司一个很重要的问题，就是要充分利用现有的资源，把每一分钱的效益都充分榨出来。
从技术上讲，大部分瓶颈都发生在带宽上，而大部分的灾难都发生在数据丢失上，底下，从以下两个问题来描述如何去搭建高效安全的小企业级应用系统。
单台服务器方案：
这样的公司实在是穷疯了，只有一台服务器，一个百兆共享。
配置：linux nginx mysql php 这是标配。单台服务器就别考虑负载均衡之类的东西了，只要保证http服务够快，充分去利用idc的带宽，跑高跑满是前期要做的。
如果只是网站，没有下载之类的，nginx是最佳的选择（做虚拟主机安全性太差）。这个时候，优化好mysql，搭配nginx优秀的性能，一般瓶颈优先出现在带宽上。
不建议把带宽跑得很满，因为idc一般都会在交换上限制流量，所以，不要等到相应很迟缓的时候再考虑增加带宽，如果带宽实在闲着没用，开个ftp，给员工做文档备份，装个邮件服务器，解决了内部沟通的问题。
数据安全，是一定要做的。mysql前期可以每天全备份，找个本地的机器每天下载备份，虽然浪费点人工，但不失为最安全的备份。如果本地都能搞丢……就拿块硬盘自己拍自己。
网站程序建议用svn版本控制发布，这样，就有了源码、svn库、本地开发三个以上的备份。而网站的附件，在程序编写前就得考虑增量备份的方式，合理设计存储结构，每天增量备份（因为附件多的话，每天全备压力会大）。而每天的增量，设计一个全备，一旦出现数据问题，有前边的全备，当日的增量，这样会把损风险和失降低到最低。
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
临时撰写，想哪里写哪里。希望有经验的一起交流。
]]></description>
			<content:encoded><![CDATA[<p>这里说的初创公司，也包括一些小型的网络公司，运维是很头疼的事情。</p>
<p>初创公司，包括一些现金有问题的公司，资金紧张，买不起大量的设备，用不起高级的运维人员，财政捉襟见肘。</p>
<p>这种公司一个很重要的问题，就是要充分利用现有的资源，把每一分钱的效益都充分榨出来。</p>
<p>从技术上讲，大部分瓶颈都发生在带宽上，而大部分的灾难都发生在数据丢失上，底下，从以下两个问题来描述如何去搭建高效安全的小企业级应用系统。</p>
<p>单台服务器方案：</p>
<p>这样的公司实在是穷疯了，只有一台服务器，一个百兆共享。</p>
<p>配置：linux nginx mysql php 这是标配。单台服务器就别考虑负载均衡之类的东西了，只要保证http服务够快，充分去利用idc的带宽，跑高跑满是前期要做的。</p>
<p>如果只是网站，没有下载之类的，nginx是最佳的选择（做虚拟主机安全性太差）。这个时候，优化好mysql，搭配nginx优秀的性能，一般瓶颈优先出现在带宽上。</p>
<p>不建议把带宽跑得很满，因为idc一般都会在交换上限制流量，所以，不要等到相应很迟缓的时候再考虑增加带宽，如果带宽实在闲着没用，开个ftp，给员工做文档备份，装个邮件服务器，解决了内部沟通的问题。</p>
<p>数据安全，是一定要做的。mysql前期可以每天全备份，找个本地的机器每天下载备份，虽然浪费点人工，但不失为最安全的备份。如果本地都能搞丢……就拿块硬盘自己拍自己。</p>
<p>网站程序建议用svn版本控制发布，这样，就有了源码、svn库、本地开发三个以上的备份。而网站的附件，在程序编写前就得考虑增量备份的方式，合理设计存储结构，每天增量备份（因为附件多的话，每天全备压力会大）。而每天的增量，设计一个全备，一旦出现数据问题，有前边的全备，当日的增量，这样会把损风险和失降低到最低。</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>临时撰写，想哪里写哪里。希望有经验的一起交流。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/06/22/%e5%88%9d%e5%88%9b%e5%85%ac%e5%8f%b8%e7%9a%84%e8%bf%90%e7%bb%b4%e5%ba%94%e8%af%a5%e6%80%8e%e4%b9%88%e5%81%9a%ef%bc%88lamp%e6%9e%b6%e6%9e%84%ef%bc%89.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>在windows下玩apache php不能不知的几个小设置</title>
		<link>http://www.sunboyu.cn/2009/06/10/%e5%9c%a8windows%e4%b8%8b%e7%8e%a9apache-php%e4%b8%8d%e8%83%bd%e4%b8%8d%e7%9f%a5%e7%9a%84%e5%87%a0%e4%b8%aa%e5%b0%8f%e8%ae%be%e7%bd%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2009/06/10/%e5%9c%a8windows%e4%b8%8b%e7%8e%a9apache-php%e4%b8%8d%e8%83%bd%e4%b8%8d%e7%9f%a5%e7%9a%84%e5%87%a0%e4%b8%aa%e5%b0%8f%e8%ae%be%e7%bd%ae.shtml#comments</comments>
		<pubDate>Wed, 10 Jun 2009 09:09:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=779</guid>
		<description><![CDATA[1、PHPIniDir &#8220;D:\PHP5&#8243;
这样不用每次都把php.ini拷贝到C:\Windows下
2、set Path=D:\PHP5;D:\PHP5\ext;%Path%
这样不用每次把那些dll拷贝到C:\Windows\system32下
]]></description>
			<content:encoded><![CDATA[<p>1、PHPIniDir &#8220;D:\PHP5&#8243;</p>
<p>这样不用每次都把php.ini拷贝到C:\Windows下</p>
<p>2、set Path=D:\PHP5;D:\PHP5\ext;%Path%</p>
<p>这样不用每次把那些dll拷贝到C:\Windows\system32下</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/06/10/%e5%9c%a8windows%e4%b8%8b%e7%8e%a9apache-php%e4%b8%8d%e8%83%bd%e4%b8%8d%e7%9f%a5%e7%9a%84%e5%87%a0%e4%b8%aa%e5%b0%8f%e8%ae%be%e7%bd%ae.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Centos4.7（Linux）下架设BT服务器</title>
		<link>http://www.sunboyu.cn/2009/06/09/centos47%ef%bc%88linux%ef%bc%89%e4%b8%8b%e6%9e%b6%e8%ae%bebt%e6%9c%8d%e5%8a%a1%e5%99%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2009/06/09/centos47%ef%bc%88linux%ef%bc%89%e4%b8%8b%e6%9e%b6%e8%ae%bebt%e6%9c%8d%e5%8a%a1%e5%99%a8.shtml#comments</comments>
		<pubDate>Tue, 09 Jun 2009 05:21:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[bittorrent]]></category>

		<category><![CDATA[bt]]></category>

		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=768</guid>
		<description><![CDATA[穷人，就得想穷人的办法，带宽被坑，严重缩水，为了分享大量资源，最终决定使用bt发布一些大资源。
网上找了很多BitTorrent架设btserver的教程，不是版本不对，就是安装复杂，所以，我找了个比较老的版本，一次装上调通。
我使用了BitTorrent-3.9.1，官方下载地址为 http://download.bittorrent.com/dl/archive/BitTorrent-3.9.1.tar.gz
防止墙，我传到本地 bittorrent-3.9.1.tar.gz
首先你服务器要预装python，centos4.7预装python2.3，我预留，但服务器环境python使用了2.5版，2.3不能删，yum对版本依赖性比较强，还得预留。
解压 BitTorrent-3.9.1.tar.gz 后进入文件夹，按照说明进行安装：
python setup.py install
即可安装。当然中间会遇到各种问题，大部分是关于python版本或者依赖的，错误可以跟帖发一下，一起解决。
好了，首先启动服务器：
python bttrack.py --port 6969 --dfile dfile.log
其中port参数是服务的端口（一定记得调一下防火墙），dfile是日志
然后打开 http://ip:6969/  如果显示
BitTorrent download info
    * tracker version: 3.9.1
    * server time: 2009-06-09 05:12 UTC
则证明服务启动成功。
下面创建一个种子文件
btmaketorrent.py http://bt.sunboyu.cn:6969/announce /root/soft/xmlrpc-epi-0.54.tar.gz
这样，就针对 /root/soft/xmlrpc-epi-0.54.tar.gz 文件创建了一个种子文件，使用的track地址是 http://bt.sunboyu.cn:6969
生成的种子位置，是这样:如果针对一个文件，则在文件同一文件夹下，如果针对文件夹，则在文件夹同级目录。
然后发布一个种子（很多人可能对种子这个概念不了解，可以查看资料，关于bt协议的）
btdownloadheadless.py /root/soft/xmlrpc-epi-0.54.tar.gz.torrent --save_as /root/soft/xmlrpc-epi-0.54.tar.gz
发布种子有很多参数要限制，可以看命令具体参数，比如占用的端口跟限速等。
我测试了一下，linux发布的文件，就可以下载了。这只是服务器建立的阶段，要管理，还得写好多管理脚本，否则文件多的话，手工可受不了。
另外还有好多的开源web监控、管理、发布的系统，大家可以下来搭建尝试。欢迎交流。
相关资料 http://zh.wikipedia.org/wiki/BitTorrent
]]></description>
			<content:encoded><![CDATA[<p>穷人，就得想穷人的办法，带宽被坑，严重缩水，为了分享大量资源，最终决定使用bt发布一些大资源。</p>
<p>网上找了很多BitTorrent架设btserver的教程，不是版本不对，就是安装复杂，所以，我找了个比较老的版本，一次装上调通。</p>
<p>我使用了BitTorrent-3.9.1，官方下载地址为 http://download.bittorrent.com/dl/archive/BitTorrent-3.9.1.tar.gz</p>
<p>防止墙，我传到本地 <a href='http://www.sunboyu.cn/upfiles/2009/06/bittorrent-391tar.gz'>bittorrent-3.9.1.tar.gz</a></p>
<p>首先你服务器要预装python，centos4.7预装python2.3，我预留，但服务器环境python使用了2.5版，2.3不能删，yum对版本依赖性比较强，还得预留。</p>
<p>解压 BitTorrent-3.9.1.tar.gz 后进入文件夹，按照说明进行安装：</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">python setup.py install</li></ol></div>
<p>即可安装。当然中间会遇到各种问题，大部分是关于python版本或者依赖的，错误可以跟帖发一下，一起解决。</p>
<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">python bttrack.py --port 6969 --dfile dfile.log</li></ol></div>
<p>其中port参数是服务的端口（一定记得调一下防火墙），dfile是日志</p>
<p>然后打开 http://ip:6969/  如果显示</p>
<p>BitTorrent download info</p>
<p>    * tracker version: 3.9.1<br />
    * server time: 2009-06-09 05:12 UTC</p>
<p>则证明服务启动成功。</p>
<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">btmaketorrent.py http://bt.sunboyu.cn:6969/announce /root/soft/xmlrpc-epi-0.54.tar.gz</li></ol></div>
<p>这样，就针对 /root/soft/xmlrpc-epi-0.54.tar.gz 文件创建了一个种子文件，使用的track地址是 http://bt.sunboyu.cn:6969<br />
生成的种子位置，是这样:如果针对一个文件，则在文件同一文件夹下，如果针对文件夹，则在文件夹同级目录。</p>
<p>然后发布一个种子（很多人可能对种子这个概念不了解，可以查看资料，关于bt协议的）</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">btdownloadheadless.py /root/soft/xmlrpc-epi-0.54.tar.gz.torrent --save_as /root/soft/xmlrpc-epi-0.54.tar.gz</li></ol></div>
<p>发布种子有很多参数要限制，可以看命令具体参数，比如占用的端口跟限速等。</p>
<p>我测试了一下，linux发布的文件，就可以下载了。这只是服务器建立的阶段，要管理，还得写好多管理脚本，否则文件多的话，手工可受不了。</p>
<p>另外还有好多的开源web监控、管理、发布的系统，大家可以下来搭建尝试。欢迎交流。</p>
<p>相关资料 http://zh.wikipedia.org/wiki/BitTorrent</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/06/09/centos47%ef%bc%88linux%ef%bc%89%e4%b8%8b%e6%9e%b6%e8%ae%bebt%e6%9c%8d%e5%8a%a1%e5%99%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>脱裤子放屁典范程序</title>
		<link>http://www.sunboyu.cn/2009/06/05/%e8%84%b1%e8%a3%a4%e5%ad%90%e6%94%be%e5%b1%81%e5%85%b8%e8%8c%83%e7%a8%8b%e5%ba%8f.shtml</link>
		<comments>http://www.sunboyu.cn/2009/06/05/%e8%84%b1%e8%a3%a4%e5%ad%90%e6%94%be%e5%b1%81%e5%85%b8%e8%8c%83%e7%a8%8b%e5%ba%8f.shtml#comments</comments>
		<pubDate>Fri, 05 Jun 2009 02:25:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[代码冗余]]></category>

		<category><![CDATA[康盛]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=766</guid>
		<description><![CDATA[最近搞一个单点登录的东东，研究了下康盛的ucenterhome产品，在研究cookie的时候发现这么一段处理程序：
$prelength = strlen($_SC['cookiepre']);
foreach($_COOKIE as $key =&#62; $val) {
	if(substr($key, 0, $prelength) == $_SC['cookiepre']) {
		$_SCOOKIE[(substr($key, $prelength))] = empty($magic_quote) ? saddslashes($val) : $val;
	}
}
其目的是把合法的cookie拿出来防到一个全局变量里去用。
cookie本身就是一个挺好的全局变量，而康盛又把这个变量拿出来去用，为什么？
或者，为了方便管理变量，但判断函数判断自定义全局变量跟判断cookie全局变量成本相同；
或者，为了让开发者必须彻底明白业务逻辑才能修改，提高竞争对手抄袭门槛或者提高二次开发门槛而给项目部带来更高的收入？
这样的代码里边很多，也许只有他们自己才能了解最终目的。
]]></description>
			<content:encoded><![CDATA[<p>最近搞一个单点登录的东东，研究了下康盛的ucenterhome产品，在研究cookie的时候发现这么一段处理程序：</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">$prelength = strlen($_SC['cookiepre']);</li>
<li>foreach($_COOKIE as $key =&gt; $val) {</li>
<li>	if(substr($key, 0, $prelength) == $_SC['cookiepre']) {</li>
<li>		$_SCOOKIE[(substr($key, $prelength))] = empty($magic_quote) ? saddslashes($val) : $val;</li>
<li>	}</li>
<li>}</li></ol></div>
<p>其目的是把合法的cookie拿出来防到一个全局变量里去用。</p>
<p>cookie本身就是一个挺好的全局变量，而康盛又把这个变量拿出来去用，为什么？</p>
<p>或者，为了方便管理变量，但判断函数判断自定义全局变量跟判断cookie全局变量成本相同；</p>
<p>或者，为了让开发者必须彻底明白业务逻辑才能修改，提高竞争对手抄袭门槛或者提高二次开发门槛而给项目部带来更高的收入？</p>
<p>这样的代码里边很多，也许只有他们自己才能了解最终目的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/06/05/%e8%84%b1%e8%a3%a4%e5%ad%90%e6%94%be%e5%b1%81%e5%85%b8%e8%8c%83%e7%a8%8b%e5%ba%8f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>xml与array互转函数</title>
		<link>http://www.sunboyu.cn/2009/05/31/xml%e4%b8%8earray%e4%ba%92%e8%bd%ac%e5%87%bd%e6%95%b0.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/31/xml%e4%b8%8earray%e4%ba%92%e8%bd%ac%e5%87%bd%e6%95%b0.shtml#comments</comments>
		<pubDate>Sun, 31 May 2009 10:42:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[array]]></category>

		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=741</guid>
		<description><![CDATA[突然发现写程序不像原来思路那么清晰了，一个递归居然想了半天，不过还是凑合着写了一个简单的xml与array互转的函数，来实现跟其他系统的对接。
原来一直用的是拼凑的方式生成xml，这次使用了DOMDocument对象。不知道这个类是否有非法字符的问题，待测试一下便知。
class AXML
{
	var $dom = '';
	#&#160; &#160; array to xml&#160; &#160; &#160; &#160;###########################################
&#160;&#160; &#160;#array to xml
	function array2xml( $array )
	{
		$this-&#62;dom = new DOMDocument('1.0', 'utf-8');
		$this-&#62;dom-&#62;formatOutput = true;
		$this-&#62;_array( array( 'root' =&#62; $array ) , $this-&#62;dom );
		echo $this-&#62;dom-&#62;saveXML();
	}
&#160;
	#array to dom
	function _array( $array = array() , $dom )
	{
		$i = 0;
		foreach( $array as $key =&#62; $value )
		{
			if( is_array( $value ) )
			{
				//遍历
				$node[$i] = [...]]]></description>
			<content:encoded><![CDATA[<p>突然发现写程序不像原来思路那么清晰了，一个递归居然想了半天，不过还是凑合着写了一个简单的xml与array互转的函数，来实现跟其他系统的对接。</p>
<p>原来一直用的是拼凑的方式生成xml，这次使用了DOMDocument对象。不知道这个类是否有非法字符的问题，待测试一下便知。</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">class AXML</li>
<li>{</li>
<li>	var $dom = '';</li>
<li>	#&nbsp; &nbsp; array to xml&nbsp; &nbsp; &nbsp; &nbsp;###########################################</li>
<li>&nbsp;&nbsp; &nbsp;#array to xml</li>
<li>	function array2xml( $array )</li>
<li>	{</li>
<li>		$this-&gt;dom = new DOMDocument('1.0', 'utf-8');</li>
<li>		$this-&gt;dom-&gt;formatOutput = true;</li>
<li>		$this-&gt;_array( array( 'root' =&gt; $array ) , $this-&gt;dom );</li>
<li>		echo $this-&gt;dom-&gt;saveXML();</li>
<li>	}</li>
<li>&nbsp;</li>
<li>	#array to dom</li>
<li>	function _array( $array = array() , $dom )</li>
<li>	{</li>
<li>		$i = 0;</li>
<li>		foreach( $array as $key =&gt; $value )</li>
<li>		{</li>
<li>			if( is_array( $value ) )</li>
<li>			{</li>
<li>				//遍历</li>
<li>				$node[$i] = $this-&gt;dom-&gt;createElement( $key );</li>
<li>				$dom-&gt;appendChild( $node[$i] );</li>
<li>				$this-&gt;_array( $value , $node[$i] );</li>
<li>			}</li>
<li>			else</li>
<li>			{</li>
<li>				$node[$i] = $this-&gt;dom-&gt;createElement( $key , $value );</li>
<li>				$dom-&gt;appendChild( $node[$i] );</li>
<li>			}</li>
<li>			$i++;</li>
<li>		}</li>
<li>	}</li>
<li>	#&nbsp; &nbsp;xml&nbsp; to array&nbsp; &nbsp; &nbsp; &nbsp;###########################################</li>
<li>	#xml to array</li>
<li>	function xml2array( $xmls )</li>
<li>	{</li>
<li>		$array = array();</li>
<li>		$this-&gt;dom = new SimpleXMLElement( $xmls );</li>
<li>		print_r( $this-&gt;_object( $this-&gt;dom ) );</li>
<li>	}</li>
<li>	#object to array</li>
<li>	function _object( $object )</li>
<li>	{</li>
<li>		$array = array();</li>
<li>		$t = get_object_vars( $object );</li>
<li>		$i = 0;</li>
<li>		foreach( $t as $key =&gt; $value )</li>
<li>		{</li>
<li>			if(is_object($value))</li>
<li>			{</li>
<li>				$array[$key] = $this-&gt;_object( $value );</li>
<li>			}</li>
<li>			else</li>
<li>			{</li>
<li>				$array[$key] = $value;</li>
<li>			}</li>
<li>			$i++;</li>
<li>		}</li>
<li>		return $array;</li>
<li>	}</li>
<li>}</li>
<li>$xml = new AXML();</li>
<li>$xml-&gt;array2xml( $array );</li>
<li>$xml-&gt;xml2array( $xml_string );</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/31/xml%e4%b8%8earray%e4%ba%92%e8%bd%ac%e5%87%bd%e6%95%b0.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>限制apache http线程的带宽</title>
		<link>http://www.sunboyu.cn/2009/05/29/%e9%99%90%e5%88%b6apache-http%e7%ba%bf%e7%a8%8b%e7%9a%84%e5%b8%a6%e5%ae%bd.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/29/%e9%99%90%e5%88%b6apache-http%e7%ba%bf%e7%a8%8b%e7%9a%84%e5%b8%a6%e5%ae%bd.shtml#comments</comments>
		<pubDate>Fri, 29 May 2009 04:09:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[mod_bandwidth]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=736</guid>
		<description><![CDATA[最近带宽告急，原因是我做了几个开源软件的下载，结果带宽持续飙升，已经到了IDC给我的限度，所以在apache上增加了mod_bw模块(mod_bandwidth).
下载 mod_bw 的源代码 http://www.ivn.cl/apache/files/source/mod_bw-0.8.tgz
解压后，执行 apxs -i -a -c mod_bw.c
貌似自动就加到httpd.conf文件里。
如果不是自动的，就手工拷贝 mod_bw.so 到 apache module目录，httpd.conf 里增加 LoadModule bw_module modules/mod_bw.so
在虚拟主机里增加如下配置文件
BandWidthModule On&#160; &#160; &#160; &#160; &#160; &#160; &#160;#打开带宽限制功能
ForceBandWidthModule On&#160; &#160; &#160;#强制带宽限制
BandWidth all 102400&#160; &#160; &#160; &#160; &#160; &#160; #强制100KB
MinBandWidth all -1
具体的配置文档可以看这里
mod_bw-08
]]></description>
			<content:encoded><![CDATA[<p>最近带宽告急，原因是我做了几个开源软件的下载，结果带宽持续飙升，已经到了IDC给我的限度，所以在apache上增加了mod_bw模块(mod_bandwidth).</p>
<p>下载 mod_bw 的源代码 http://www.ivn.cl/apache/files/source/mod_bw-0.8.tgz</p>
<p>解压后，执行 apxs -i -a -c mod_bw.c</p>
<p>貌似自动就加到httpd.conf文件里。</p>
<p>如果不是自动的，就手工拷贝 mod_bw.so 到 apache module目录，httpd.conf 里增加 LoadModule bw_module modules/mod_bw.so</p>
<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">BandWidthModule On&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#打开带宽限制功能</li>
<li>ForceBandWidthModule On&nbsp; &nbsp; &nbsp;#强制带宽限制</li>
<li>BandWidth all 102400&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #强制100KB</li>
<li>MinBandWidth all -1</li></ol></div>
<p>具体的配置文档可以看这里</p>
<p><a href='http://www.sunboyu.cn/upfiles/2009/05/mod_bw-08.txt'>mod_bw-08</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/29/%e9%99%90%e5%88%b6apache-http%e7%ba%bf%e7%a8%8b%e7%9a%84%e5%b8%a6%e5%ae%bd.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>我的apache配置-mpm</title>
		<link>http://www.sunboyu.cn/2009/05/28/%e6%88%91%e7%9a%84apache%e9%85%8d%e7%bd%ae-mpm.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/28/%e6%88%91%e7%9a%84apache%e9%85%8d%e7%bd%ae-mpm.shtml#comments</comments>
		<pubDate>Thu, 28 May 2009 15:13:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[fork]]></category>

		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=734</guid>
		<description><![CDATA[&#60;ifmodule mpm_prefork_module&#62;
&#160;&#160; &#160;StartServers&#160; &#160; &#160; &#160; &#160; &#160; &#160; 2
&#160;&#160; &#160;MinSpareServers&#160; &#160; &#160; &#160; &#160;5
&#160;&#160; &#160;MaxSpareServers&#160; &#160; &#160; &#160; 10
&#160;&#160; &#160;MaxClients&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;128
&#160;&#160; &#160;MaxRequestsPerChild&#160; &#160; 5000
&#60;/ifmodule&#62;
这个配置基本支撑http的访问，几个博客，一个论坛，还有一个哥们很大的静态并发。
以前使用的是work方式，因为不太了解，经常造成进程崩溃，又切换到了prefork方式，这次调整的比较稳定了。
]]></description>
			<content:encoded><![CDATA[<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">&lt;ifmodule mpm_prefork_module&gt;</li>
<li>&nbsp;&nbsp; &nbsp;StartServers&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2</li>
<li>&nbsp;&nbsp; &nbsp;MinSpareServers&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;5</li>
<li>&nbsp;&nbsp; &nbsp;MaxSpareServers&nbsp; &nbsp; &nbsp; &nbsp; 10</li>
<li>&nbsp;&nbsp; &nbsp;MaxClients&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;128</li>
<li>&nbsp;&nbsp; &nbsp;MaxRequestsPerChild&nbsp; &nbsp; 5000</li>
<li>&lt;/ifmodule&gt;</li></ol></div>
<p>这个配置基本支撑http的访问，几个博客，一个论坛，还有一个哥们很大的静态并发。</p>
<p>以前使用的是work方式，因为不太了解，经常造成进程崩溃，又切换到了prefork方式，这次调整的比较稳定了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/28/%e6%88%91%e7%9a%84apache%e9%85%8d%e7%bd%ae-mpm.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Linux下APACHE MYSQL PHP FCgid Suexec 配置文档V1.0</title>
		<link>http://www.sunboyu.cn/2009/05/22/linux%e4%b8%8bapache-mysql-php-fcgid-suexec-%e9%85%8d%e7%bd%ae%e6%96%87%e6%a1%a3v10.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/22/linux%e4%b8%8bapache-mysql-php-fcgid-suexec-%e9%85%8d%e7%bd%ae%e6%96%87%e6%a1%a3v10.shtml#comments</comments>
		<pubDate>Fri, 22 May 2009 03:14:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[centos]]></category>

		<category><![CDATA[LAMP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=716</guid>
		<description><![CDATA[文档版本：V1.0
启动撰写时间: 2009年05月20日
目的：全面详细介绍LAMP fastcgi方式配置细节,基于之前的自动配置脚本，目的是把更多的细节转达给大家。
需要软件源码：
CentOS4.7
http://centos.ustc.edu.cn/centos/4.7/isos/i386/CentOS-4.7.ServerCD-i386.iso
http://centos.ustc.edu.cn/centos/4.7/isos/x86_64/CentOS-4.7.ServerCD-x86_64.iso
Apache-2.2.9
http://archive.apache.org/dist/httpd/httpd-2.2.9.tar.gz
MYSQL-5.2.6
http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.22.tar.gz
PHP-5.2.6
http://museum.php.net/php5/php-5.2.6.tar.gz
FCGID
http://ncu.dl.sourceforge.net/sourceforge/mod-fcgid/mod_fcgid.2.2.tgz
安装：
第一步：Linux系统安装,同时可以参照我原来的文档
http://www.sunboyu.cn/2008/06/13/centos5%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97%EF%BC%88%E7%AE%80%E5%8D%95%E7%AF%87%EF%BC%89.shtml

视频。我按照最小化进行安装。最后ping百度不通，是因为没有重启，重启后是正常的。从过程可疑看出，我用的vmware进行安装，所以，要根据你实际的网络情况进行调整配置。
Linux Centos 4.7 安装视频（下载）(关闭)

第二步：系统更新，组件安装。
首先更新一下yum源，具体查看这篇日志 http://www.sunboyu.cn/2009/01/07/centos4%E5%88%9D%E5%A7%8B%E5%8C%96%E7%9A%84%E4%B8%80%E4%BA%9B%E8%84%9A%E6%9C%AC.shtml
升级一下系统：
yum upgrade
安装一些必要的组件：
yum install gcc gcc-c++ gcc4-c++ autoconf gd gd-devel libxml2 libxml2-devel zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel expat expat-devel sqlite sqlite-devel png-devel jpeg-devel libtool libjpeg* libpng* freetype-devel
安装MYSQL-5.0.22
解压mysql
#tar -zxvf mysql-5.0.22.tar.gz
#cd cd mysql-5.0.22
#groupadd mysql
#useradd -g mysql mysql
#./configure &#8211;prefix=/opt/mysql-5.0.22 [...]]]></description>
			<content:encoded><![CDATA[<p>文档版本：V1.0</p>
<p>启动撰写时间: 2009年05月20日</p>
<p>目的：全面详细介绍LAMP fastcgi方式配置细节,基于之前的自动配置脚本，目的是把更多的细节转达给大家。</p>
<p>需要软件源码：</p>
<p>CentOS4.7</p>
<p>http://centos.ustc.edu.cn/centos/4.7/isos/i386/CentOS-4.7.ServerCD-i386.iso</p>
<p>http://centos.ustc.edu.cn/centos/4.7/isos/x86_64/CentOS-4.7.ServerCD-x86_64.iso</p>
<p>Apache-2.2.9</p>
<p>http://archive.apache.org/dist/httpd/httpd-2.2.9.tar.gz</p>
<p>MYSQL-5.2.6</p>
<p>http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.22.tar.gz</p>
<p>PHP-5.2.6</p>
<p>http://museum.php.net/php5/php-5.2.6.tar.gz</p>
<p>FCGID</p>
<p>http://ncu.dl.sourceforge.net/sourceforge/mod-fcgid/mod_fcgid.2.2.tgz</p>
<p>安装：</p>
<p>第一步：Linux系统安装,同时可以参照我原来的文档</p>
<p>http://www.sunboyu.cn/2008/06/13/centos5%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97%EF%BC%88%E7%AE%80%E5%8D%95%E7%AF%87%EF%BC%89.shtml</p>
<p><span id="more-716"></span></p>
<p>视频。我按照最小化进行安装。最后ping百度不通，是因为没有重启，重启后是正常的。从过程可疑看出，我用的vmware进行安装，所以，要根据你实际的网络情况进行调整配置。</p>
<p><a href="http://www.sunboyu.cn/upfiles/v/lamp.avi">Linux Centos 4.7 安装视频（下载）</a>(关闭)</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="353" height="291" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://player.youku.com/player.php/sid/XMTExMTU3NzE2/v.swf" /><embed type="application/x-shockwave-flash" width="353" height="291" src="http://player.youku.com/player.php/sid/XMTExMTU3NzE2/v.swf"></embed></object></p>
<p>第二步：系统更新，组件安装。</p>
<p>首先更新一下yum源，具体查看这篇日志 http://www.sunboyu.cn/2009/01/07/centos4%E5%88%9D%E5%A7%8B%E5%8C%96%E7%9A%84%E4%B8%80%E4%BA%9B%E8%84%9A%E6%9C%AC.shtml</p>
<p>升级一下系统：</p>
<p>yum upgrade</p>
<p>安装一些必要的组件：</p>
<p>yum install gcc gcc-c++ gcc4-c++ autoconf gd gd-devel libxml2 libxml2-devel zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel expat expat-devel sqlite sqlite-devel png-devel jpeg-devel libtool libjpeg* libpng* freetype-devel</p>
<p>安装MYSQL-5.0.22</p>
<p>解压mysql</p>
<p>#tar -zxvf mysql-5.0.22.tar.gz</p>
<p>#cd cd mysql-5.0.22</p>
<p>#groupadd mysql</p>
<p>#useradd -g mysql mysql</p>
<p>#./configure &#8211;prefix=/opt/mysql-5.0.22 \<br />
&#8211;without-debug \<br />
&#8211;enable-thread-safe-client \<br />
&#8211;with-client-ldflags=-all-static \<br />
&#8211;with-mysqld-ldflags=-all-static \<br />
&#8211;enable-local-infile \<br />
&#8211;enable-largefile \<br />
&#8211;with-charset=utf8 \<br />
&#8211;with-collation=utf8_unicode_ci \<br />
&#8211;with-extra-charsets=complex \<br />
&#8211;with-pic \<br />
&#8211;with-mysqld-libs \<br />
&#8211;with-comment \<br />
&#8211;with-query-cache \<br />
&#8211;with-bench \<br />
&#8211;with-big-tables \<br />
&#8211;with-innodb \<br />
&#8211;with-mysqld-use=mysql</p>
<p>#make</p>
<p>#make install</p>
<p>#cp ./support-files/my-medium.cnf /etc/my.cnf</p>
<p>#cp ./support-files/mysql.server /etc/init.d/mysqld</p>
<p>#chmod 755 /etc/init.d/mysqld</p>
<p>#/opt/mysql-5.0.22/bin/mysql_install_db &#8211;user=mysql &amp;</p>
<p>#echo &#8220;/opt/mysql-5.0.22/bin/mysqld_safe &#8211;user=mysql &amp;&#8221;&gt;&gt;/etc/rc.local</p>
<p>#service mysqld start</p>
<p>#/opt/mysql-5.0.22/bin/mysqladmin -u root password &#8216;123456&#8242;</p>
<p>#cd ..</p>
<p>安装APACHE</p>
<p>#groupadd apache</p>
<p>#useradd -g apache apache</p>
<p>#tar -zxvf httpd-2.2.9.tar.gz</p>
<p>#cd httpd-2.2.9</p>
<p>#./configure &#8211;prefix=/opt/httpd-2.2.9 \<br />
&#8211;enable-dav \<br />
&#8211;enable-dav-fs \<br />
&#8211;enable-modules=all \<br />
&#8211;enable-mods-shared=all \<br />
&#8211;disable-auth-basic \<br />
&#8211;enable-include \<br />
&#8211;enable-substitute \<br />
&#8211;enable-authz-dbm \<br />
&#8211;enable-log-config \<br />
&#8211;enable-headers \<br />
&#8211;enable-setenvif \<br />
&#8211;with-ssl \<br />
&#8211;enable-static-ab \<br />
&#8211;enable-http \<br />
&#8211;enable-mime \<br />
&#8211;enable-status \<br />
&#8211;enable-isapi \<br />
&#8211;enable-imagemap \<br />
&#8211;enable-actions \<br />
&#8211;enable-speling \<br />
&#8211;enable-userdir \<br />
&#8211;enable-alias \<br />
&#8211;enable-vhost-alias \<br />
&#8211;enable-dir \<br />
&#8211;enable-rewrite \<br />
&#8211;enable-dumpio \<br />
&#8211;enable-echo \<br />
&#8211;enable-so \<br />
&#8211;enable-example \<br />
&#8211;enable-case-filter \<br />
&#8211;enable-substitute \<br />
&#8211;enable-log-config \<br />
&#8211;enable-logio \<br />
&#8211;enable-env \<br />
&#8211;with-mpm=worker \<br />
&#8211;with-included-apr \<br />
&#8211;with-apr \<br />
&#8211;with-apr-util \<br />
&#8211;with-z \<br />
&#8211;enable-proxy \<br />
&#8211;enable-proxy-connect \<br />
&#8211;enable-proxy-ftp \<br />
&#8211;enable-proxy-http \<br />
&#8211;enable-proxy-ajp \<br />
&#8211;enable-proxy-balancer \<br />
&#8211;enable-suexec \<br />
&#8211;with-suexec-caller=apache \<br />
&#8211;with-suexec-userdir=www \<br />
&#8211;with-suexec-docroot=/home \<br />
&#8211;with-suexec-uidmin=100 \<br />
&#8211;with-suexec-gidmin=100 \<br />
&#8211;with-suexec-logfile=/var/log/suexec_log</p>
<p>#make</p>
<p>#make install</p>
<p>#ln -s /opt/httpd-2.2.9/bin/apachectl /etc/init.d/httpd</p>
<p>#cd ..</p>
<p>修改apache配置文件 /opt/httpd-2.2.9/conf/httpd.conf</p>
<p>找到</p>
<p>User daemon<br />
Group daemon</p>
<p>修改为</p>
<p>User apache<br />
Group apache</p>
<p>安装 fcgid</p>
<p>#tar -zxvf mod_fcgid.2.2.tgz</p>
<p>#cd mod_fcgid.2.2</p>
<p>修改Makefile</p>
<p>top_dir = /usr/local/apache2 为 top_dir = /opt/httpd-2.2.9</p>
<p>#make</p>
<p>#make install</p>
<p>#cd ..</p>
<p>修改apache配置文件 httpd.conf</p>
<p>增加 LoadModule fcgid_module modules/mod_fcgid.so</p>
<p>安装PHP，记得增加cgi支持</p>
<p>#tar -zxvf php-5.2.6.tar.gz</p>
<p>#cd php-5.2.6</p>
<p>#./configure &#8211;prefix=/opt/php-5.2.6 &#8211;with-libxml-dir &#8211;enable-cli &#8211;enable-cgi &#8211;enable-fastcgi &#8211;enable-bcmath &#8211;enable-force-cgi-redirect &#8211;enable-discard-path &#8211;enable-path-info-check &#8211;with-openssl &#8211;with-pcre-regex &#8211;enable-calendar &#8211;enable-dom &#8211;enable-ftp &#8211;with-openssl-dir=/usr/local/ssl &#8211;enable-gd-jis-conv &#8211;enable-hash &#8211;with-iconv &#8211;enable-json &#8211;enable-mbstring &#8211;enable-mbregex &#8211;enable-pdo &#8211;enable-posix &#8211;enable-libxml &#8211;enable-simplexml &#8211;with-sqlite &#8211;enable-tokenizer &#8211;enable-xmlreader &#8211;enable-xmlwriter &#8211;enable-sockets &#8211;with-zlib &#8211;with-freetype-dir &#8211;with-gd &#8211;with-jpeg-dir=/usr/lib &#8211;with-png-dir=/usr/lib &#8211;with-mime-magic &#8211;with-mysql=/opt/mysql-5.0.22 &#8211;with-zlib-dir=/usr/lib/libz.so &#8211;with-pdo-mysql=/opt/mysql-5.0.22 &#8211;with-pdo-sqlite &#8211;enable-posix &#8211;enable-soap</p>
<p>#make</p>
<p>#make install</p>
<p>修改apache配置文件httpd.conf</p>
<p>找到</p>
<p># Virtual hosts<br />
#Include conf/extra/httpd-vhosts.conf</p>
<p>修改为</p>
<p># Virtual hosts<br />
Include conf/extra/httpd-vhosts.conf</p>
<p>修改apache配置文件 conf/extra/httpd-vhosts.conf</p>
<p>删除所有的虚拟主机</p>
<p>现在配置虚拟主机：</p>
<p>所有虚拟主机的组为 vhost</p>
<p>增加一个用户名为sunboyu的虚拟主机</p>
<p>#groupadd vhost</p>
<p>#useradd -g vhost sunboyu</p>
<p>用户主目录默认为 /home/sunboyu</p>
<p>增加两个目录</p>
<p>#mkdir /home/sunboyu/www</p>
<p>#mkdir /home/sunboyu/logs</p>
<p>增加虚拟主机配置文件</p>
<p>SuexecUserGroup sunboyu vhost<br />
ServerAdmin sunboyu@gmail.com<br />
DocumentRoot &#8220;/home/sunboyu/www&#8221;<br />
ServerName 192.168.0.4<br />
ServerAlias sunboyu.cn<br />
ErrorLog &#8220;/home/sunboyu/logs/error_log&#8221;<br />
CustomLog &#8220;|/opt/httpd-2.2.9/bin/rotatelogs /home/sunboyu/logs/%Y_%m_%d_log 86400 +480&#8243; common</p>
<p>AddHandler fcgid-script .php<br />
#AddHandler cgi-script .pl .cgi<br />
FCGIWrapper /home/sunboyu/php-cgi .php<br />
Options ExecCGI FollowSymLinks<br />
AllowOverride all<br />
Order deny,allow<br />
Allow from all</p>
<p>创建文件 /home/sunboyu/php-cgi 文件内容为</p>
<p>#!/bin/sh<br />
export PHPRC=/home/sunboyu<br />
export PHP_FCGI_CHILDREN=4<br />
export PHP_FCGI_MAX_REQUESTS=5000<br />
exec /opt/php-5.2.6/bin/php-cgi &#8220;$@&#8221;</p>
<p>#chmod 755 -R /home/sunboyu</p>
<p>#chown sunboyu:vhost -R /home/sunboyu</p>
<p>配置到现在，重启apache</p>
<p>#service httpd restart</p>
<p>在虚拟目录根下 /home/sunboyu/www 下写文件 info.php 内容为 phpinfo() 修改权限为755 用户组为 sunboyu:vhost</p>
<p>现在访问应该是phpinfo的信息。</p>
<p>在写这篇文档的时候，基本是按照数续依次安装。</p>
<p>如果有问题，希望帮忙，请提前修改你服务器root密码，我们可以一起调试。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/22/linux%e4%b8%8bapache-mysql-php-fcgid-suexec-%e9%85%8d%e7%bd%ae%e6%96%87%e6%a1%a3v10.shtml/feed</wfw:commentRss>
<enclosure url="http://www.sunboyu.cn/upfiles/v/lamp.avi" length="17880876" type="video/x-msvideo" />
		</item>
		<item>
		<title>设计标准的通讯协议</title>
		<link>http://www.sunboyu.cn/2009/05/17/%e8%ae%be%e8%ae%a1%e6%a0%87%e5%87%86%e7%9a%84%e9%80%9a%e8%ae%af%e5%8d%8f%e8%ae%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/17/%e8%ae%be%e8%ae%a1%e6%a0%87%e5%87%86%e7%9a%84%e9%80%9a%e8%ae%af%e5%8d%8f%e8%ae%ae.shtml#comments</comments>
		<pubDate>Sun, 17 May 2009 15:48:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[协议]]></category>

		<category><![CDATA[虚拟主机]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=710</guid>
		<description><![CDATA[当然不会是底层通讯协议，因为TCP/IP已经为我们准备好了足够完善的通讯机制确保稳定安全。
此协议为七层应用协议，跟http ftp是平级的，使用socket进行通讯，可以兼容php、python、java、c等语言。
协议开源，使用点对点信息校验，满足普通应用。
协议模拟tcp封包过程，进行数据封装。
协议内容：(伪代码)
struct vhost
{
&#160;&#160; &#160;Head varchar(10),&#160; &#160; &#160; &#160; &#160; &#160; //协议头
&#160;&#160; &#160;Version int(5),&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;//版本
&#160;&#160; &#160;Timestamp int(5),&#160; &#160; &#160; &#160; &#160; &#160; //时间戳
&#160;&#160; &#160;Length int(10),&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; //包长度
&#160;&#160; &#160;Signature varchar(10),&#160; &#160; &#160; //签名
&#160;&#160; &#160;Date varchar(500)&#160; &#160; &#160; &#160; &#160; &#160; //数据 
}
协议包包括了协议头，版本，时间戳，包长度、签名（防止数据篡改和伪造）,数据。基本能满足应用。
控制端数据打包发送后，受控端只需返回接受成功即可，以便客户端及时作出判断。
底下针对此包做PHP版本的封包和python的解包部分。
注释：原来使用问答的方式进行通讯，需要多次数据的应答，而此次的修改只需一次即可完成，而打包封包在一端完成，这样对网络稳定性的依赖就会降低。
]]></description>
			<content:encoded><![CDATA[<p>当然不会是底层通讯协议，因为TCP/IP已经为我们准备好了足够完善的通讯机制确保稳定安全。</p>
<p>此协议为七层应用协议，跟http ftp是平级的，使用socket进行通讯，可以兼容php、python、java、c等语言。</p>
<p>协议开源，使用点对点信息校验，满足普通应用。</p>
<p>协议模拟tcp封包过程，进行数据封装。</p>
<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">struct vhost</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;Head varchar(10),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //协议头</li>
<li>&nbsp;&nbsp; &nbsp;Version int(5),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;//版本</li>
<li>&nbsp;&nbsp; &nbsp;Timestamp int(5),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //时间戳</li>
<li>&nbsp;&nbsp; &nbsp;Length int(10),&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //包长度</li>
<li>&nbsp;&nbsp; &nbsp;Signature varchar(10),&nbsp; &nbsp; &nbsp; //签名</li>
<li>&nbsp;&nbsp; &nbsp;Date varchar(500)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //数据 </li>
<li>}</li></ol></div>
<p>协议包包括了协议头，版本，时间戳，包长度、签名（防止数据篡改和伪造）,数据。基本能满足应用。</p>
<p>控制端数据打包发送后，受控端只需返回接受成功即可，以便客户端及时作出判断。</p>
<p>底下针对此包做PHP版本的封包和python的解包部分。</p>
<p>注释：原来使用问答的方式进行通讯，需要多次数据的应答，而此次的修改只需一次即可完成，而打包封包在一端完成，这样对网络稳定性的依赖就会降低。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/17/%e8%ae%be%e8%ae%a1%e6%a0%87%e5%87%86%e7%9a%84%e9%80%9a%e8%ae%af%e5%8d%8f%e8%ae%ae.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>做开源的虚拟主机管理系统</title>
		<link>http://www.sunboyu.cn/2009/05/15/%e5%81%9a%e5%bc%80%e6%ba%90%e7%9a%84%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e7%ae%a1%e7%90%86%e7%b3%bb%e7%bb%9f.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/15/%e5%81%9a%e5%bc%80%e6%ba%90%e7%9a%84%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e7%ae%a1%e7%90%86%e7%b3%bb%e7%bb%9f.shtml#comments</comments>
		<pubDate>Thu, 14 May 2009 21:47:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[虚拟主机管理]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=707</guid>
		<description><![CDATA[经过痛苦的削减，我把我预想中的虚拟主机管理系统功能裁到了最小 － 标准的单机lamp虚拟主机管理系统。
这个过程是很痛苦的。在软件设计的时候，我参考了好多成型的虚拟主机管理系统，包括蓝芒，webmin，还有德国等几个虚拟主机管理。不过在做的过程中发现了各自的优缺点，做了取并集综合的方法，整理出一个无比强大的功能设计文档。另外，根据国情，设计了完善的业务流程和各种接口。
不过在做的过程才发现，庞大的系统我根本不可能去实现。另外在做的时候的确卡在了一些技术细节上，python的使用毕竟不如php熟练，另外socket通讯在不同语言上有很多细节的区别，还得一一去测试突破。
基于以上原因，我把设计文档一再精简，到了目前仅适合我使用的程度：
1、开设虚拟主机，mysql数据库，并开ftp帐号。
2、用户可以修改mysql数据库密码。
3、用户可以修改ftp帐号密码。
如此以来，我项目可以继续进行了。因为足够简单。另外之前的折腾并不是白做，因为好多问题悬在了心中。因为之前的鸿鹄大志，导致我现在设计的结构可扩展性比较强，程序功能模块也都进行了合理规划。
希望在半个月后能出第一版程序，届时会开源公测。 希望对此有兴趣的同学加入我们（其实是我）。
]]></description>
			<content:encoded><![CDATA[<p>经过痛苦的削减，我把我预想中的虚拟主机管理系统功能裁到了最小 － 标准的单机lamp虚拟主机管理系统。</p>
<p>这个过程是很痛苦的。在软件设计的时候，我参考了好多成型的虚拟主机管理系统，包括蓝芒，webmin，还有德国等几个虚拟主机管理。不过在做的过程中发现了各自的优缺点，做了取并集综合的方法，整理出一个无比强大的功能设计文档。另外，根据国情，设计了完善的业务流程和各种接口。</p>
<p>不过在做的过程才发现，庞大的系统我根本不可能去实现。另外在做的时候的确卡在了一些技术细节上，python的使用毕竟不如php熟练，另外socket通讯在不同语言上有很多细节的区别，还得一一去测试突破。</p>
<p>基于以上原因，我把设计文档一再精简，到了目前仅适合我使用的程度：</p>
<p>1、开设虚拟主机，mysql数据库，并开ftp帐号。</p>
<p>2、用户可以修改mysql数据库密码。</p>
<p>3、用户可以修改ftp帐号密码。</p>
<p>如此以来，我项目可以继续进行了。因为足够简单。另外之前的折腾并不是白做，因为好多问题悬在了心中。因为之前的鸿鹄大志，导致我现在设计的结构可扩展性比较强，程序功能模块也都进行了合理规划。</p>
<p>希望在半个月后能出第一版程序，届时会开源公测。 希望对此有兴趣的同学加入我们（其实是我）。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/15/%e5%81%9a%e5%bc%80%e6%ba%90%e7%9a%84%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e7%ae%a1%e7%90%86%e7%b3%bb%e7%bb%9f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>如何才能作出一款好的游戏</title>
		<link>http://www.sunboyu.cn/2009/05/13/%e5%a6%82%e4%bd%95%e6%89%8d%e8%83%bd%e4%bd%9c%e5%87%ba%e4%b8%80%e6%ac%be%e5%a5%bd%e7%9a%84%e6%b8%b8%e6%88%8f.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/13/%e5%a6%82%e4%bd%95%e6%89%8d%e8%83%bd%e4%bd%9c%e5%87%ba%e4%b8%80%e6%ac%be%e5%a5%bd%e7%9a%84%e6%b8%b8%e6%88%8f.shtml#comments</comments>
		<pubDate>Tue, 12 May 2009 19:42:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[webgame]]></category>

		<category><![CDATA[游戏]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=703</guid>
		<description><![CDATA[貌似我也进入了如火如荼的webgame领域。虽然鄙人玩游戏很少，不过本着发展社会主义建设、全民奔小康的目的，还是要把这个东西搞好。
游戏的一些细节，我还是门外汉，仅总结一下游戏的几个要点：
    背景，剧情。
游戏的背景和剧情是游戏的一个重头戏。纵观国内国外游戏，无一不建立在一个有鲜明背景的基础上。魔兽世界讲的希腊神话的故事，剑侠情缘讲的是古代武林故事，劲舞团把迪厅搬到了家里，CS让你在家里就可以与敌方激战。任何一个好的游戏都无法摆脱一个主线，就像一个电影的剧情，一本小说的线索。而只是打怪升级的游戏显然已经失去了原有的魅力，动人的故事背景是吸引玩家的一个先决条件，流畅的剧情是黏合用户的必要条件。
    完善的程序架构
一直很讨厌提架构这个词，因为到现在我也不知道啥是架构，架构师依然是神秘的东西。我所谓的架构，是要作出一套程序，而程序可伸缩，可扩展，灵活自由，不会因为一点小的改动而逼疯程序员，更不会因为编码人员的牢骚而影响游戏的运营。程序要兼顾开发，策划，运营，运维多个部门，总之一句话：大家好才是真的好。
    强大的运营支持系统
    公司总是要盈利的，而且，不管做任何项目之前都得把这个事情想在前头。记住：老板得养活一个公司的人，投资人需要高额的利润。别听那帮人瞎扯：当时我们只想做用户，没想挣钱！那些人智商都不低，不用怀疑。任何事情都要提前想到，运营系统虽然是游戏内测公测很久才用得着的，但一定要在前期考虑进去。虽然收费系统，支付系统是无用的，但行为分析，数据分析，bug跟踪，用户反馈，推广系统，这些系统在游戏测试的时候既能发挥起作用，在数据基础上的数据挖掘更是游戏发展的风向标。
    团队
    没有一个人的英雄，尤其在IT这个圈子。
]]></description>
			<content:encoded><![CDATA[<p>貌似我也进入了如火如荼的webgame领域。虽然鄙人玩游戏很少，不过本着发展社会主义建设、全民奔小康的目的，还是要把这个东西搞好。</p>
<p>游戏的一些细节，我还是门外汉，仅总结一下游戏的几个要点：</p>
<p>    背景，剧情。</p>
<p>游戏的背景和剧情是游戏的一个重头戏。纵观国内国外游戏，无一不建立在一个有鲜明背景的基础上。魔兽世界讲的希腊神话的故事，剑侠情缘讲的是古代武林故事，劲舞团把迪厅搬到了家里，CS让你在家里就可以与敌方激战。任何一个好的游戏都无法摆脱一个主线，就像一个电影的剧情，一本小说的线索。而只是打怪升级的游戏显然已经失去了原有的魅力，动人的故事背景是吸引玩家的一个先决条件，流畅的剧情是黏合用户的必要条件。</p>
<p>    完善的程序架构</p>
<p>一直很讨厌提架构这个词，因为到现在我也不知道啥是架构，架构师依然是神秘的东西。我所谓的架构，是要作出一套程序，而程序可伸缩，可扩展，灵活自由，不会因为一点小的改动而逼疯程序员，更不会因为编码人员的牢骚而影响游戏的运营。程序要兼顾开发，策划，运营，运维多个部门，总之一句话：大家好才是真的好。</p>
<p>    强大的运营支持系统</p>
<p>    公司总是要盈利的，而且，不管做任何项目之前都得把这个事情想在前头。记住：老板得养活一个公司的人，投资人需要高额的利润。别听那帮人瞎扯：当时我们只想做用户，没想挣钱！那些人智商都不低，不用怀疑。任何事情都要提前想到，运营系统虽然是游戏内测公测很久才用得着的，但一定要在前期考虑进去。虽然收费系统，支付系统是无用的，但行为分析，数据分析，bug跟踪，用户反馈，推广系统，这些系统在游戏测试的时候既能发挥起作用，在数据基础上的数据挖掘更是游戏发展的风向标。</p>
<p>    团队</p>
<p>    没有一个人的英雄，尤其在IT这个圈子。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/13/%e5%a6%82%e4%bd%95%e6%89%8d%e8%83%bd%e4%bd%9c%e5%87%ba%e4%b8%80%e6%ac%be%e5%a5%bd%e7%9a%84%e6%b8%b8%e6%88%8f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>陪大亮加班之所想</title>
		<link>http://www.sunboyu.cn/2009/05/09/%e9%99%aa%e5%a4%a7%e4%ba%ae%e5%8a%a0%e7%8f%ad%e4%b9%8b%e6%89%80%e6%83%b3.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/09/%e9%99%aa%e5%a4%a7%e4%ba%ae%e5%8a%a0%e7%8f%ad%e4%b9%8b%e6%89%80%e6%83%b3.shtml#comments</comments>
		<pubDate>Sat, 09 May 2009 00:37:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[时间]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=697</guid>
		<description><![CDATA[大亮又在加班，看来无双休还是小事，这么下去人的肉身能不能保全都是问题。
问题不大，琐碎的JS问题，不能算新手，但js的确是让人头疼的问题，何况人家是javaer。
想起了我刚毕业那股松散浪荡劲，后悔我的时间，我的青春。
客户给钱就能当大爷，老板给钱就能当黄世仁。这是千古不变的道理。
Business is business-抛开这些来讲，就是纯扯淡了。
耽误了两个小时的思考时间。一会要补上。
再也不敢浪费时间了。
]]></description>
			<content:encoded><![CDATA[<p>大亮又在加班，看来无双休还是小事，这么下去人的肉身能不能保全都是问题。</p>
<p>问题不大，琐碎的JS问题，不能算新手，但js的确是让人头疼的问题，何况人家是javaer。</p>
<p>想起了我刚毕业那股松散浪荡劲，后悔我的时间，我的青春。</p>
<p>客户给钱就能当大爷，老板给钱就能当黄世仁。这是千古不变的道理。</p>
<p>Business is business-抛开这些来讲，就是纯扯淡了。</p>
<p>耽误了两个小时的思考时间。一会要补上。</p>
<p>再也不敢浪费时间了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/09/%e9%99%aa%e5%a4%a7%e4%ba%ae%e5%8a%a0%e7%8f%ad%e4%b9%8b%e6%89%80%e6%83%b3.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Smarty分页类修正版</title>
		<link>http://www.sunboyu.cn/2009/05/08/smarty%e5%88%86%e9%a1%b5%e7%b1%bb%e4%bf%ae%e6%ad%a3%e7%89%88.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/08/smarty%e5%88%86%e9%a1%b5%e7%b1%bb%e4%bf%ae%e6%ad%a3%e7%89%88.shtml#comments</comments>
		<pubDate>Thu, 07 May 2009 19:59:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[smarty]]></category>

		<category><![CDATA[分页]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=691</guid>
		<description><![CDATA[原来写的分页类有问题，经过排查，发现一个变量用错了，修改之
效果,很简单，黑白配，有心的人可以自己修改一下风格，欢迎共享

PHP部分
&#60; ?php
/*&#160; Page.Class.php
&#160;*&#160; Page
&#160;*&#160; @link&#160; &#160; &#160; &#160; http://www.sunboyu.cn
&#160;*&#160; @package&#160; &#160; &#160;OA
&#160;*&#160; @version&#160; &#160; &#160;V1.0
&#160;*
&#160;*&#160; 2009 05 07&#160; sunboyu@gmail.com
&#160;*&#160; Demo
	$page = new Page( 1 , 'v_user' , '*' , '' );
	$rs = $page-&#62;__getlist();
	$smarty-&#62;assign(&#34;page&#34;,$page-&#62;__getpagelist());
&#160;*/
&#160;class Page
&#160;{
	 public $count;&#160; &#160; &#160; #结果总数
	 public $page;&#160; &#160; &#160; &#160;#当前页
	 public $pagesize;&#160; &#160;#每页结果数
	 public $pagecount;&#160; #翻页数
	 public $baseurl;&#160; &#160; #url
	 public [...]]]></description>
			<content:encoded><![CDATA[<p>原来写的分页类有问题，经过排查，发现一个变量用错了，修改之</p>
<p>效果,很简单，黑白配，有心的人可以自己修改一下风格，欢迎共享</p>
<p><a href="http://www.sunboyu.cn/upfiles/2009/05/e69caae591bde5908d-1.jpg"><img src="http://www.sunboyu.cn/upfiles/2009/05/e69caae591bde5908d-1.jpg" alt="e69caae591bde5908d-1" title="e69caae591bde5908d-1" width="589" height="77" class="aligncenter size-full wp-image-695" /></a></p>
<p>PHP部分</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">&lt; ?php</li>
<li>/*&nbsp; Page.Class.php</li>
<li>&nbsp;*&nbsp; Page</li>
<li>&nbsp;*&nbsp; @link&nbsp; &nbsp; &nbsp; &nbsp; http://www.sunboyu.cn</li>
<li>&nbsp;*&nbsp; @package&nbsp; &nbsp; &nbsp;OA</li>
<li>&nbsp;*&nbsp; @version&nbsp; &nbsp; &nbsp;V1.0</li>
<li>&nbsp;*</li>
<li>&nbsp;*&nbsp; 2009 05 07&nbsp; sunboyu@gmail.com</li>
<li>&nbsp;*&nbsp; Demo</li>
<li>	$page = new Page( 1 , 'v_user' , '*' , '' );</li>
<li>	$rs = $page-&gt;__getlist();</li>
<li>	$smarty-&gt;assign(&quot;page&quot;,$page-&gt;__getpagelist());</li>
<li>&nbsp;*/</li>
<li>&nbsp;class Page</li>
<li>&nbsp;{</li>
<li>	 public $count;&nbsp; &nbsp; &nbsp; #结果总数</li>
<li>	 public $page;&nbsp; &nbsp; &nbsp; &nbsp;#当前页</li>
<li>	 public $pagesize;&nbsp; &nbsp;#每页结果数</li>
<li>	 public $pagecount;&nbsp; #翻页数</li>
<li>	 public $baseurl;&nbsp; &nbsp; #url</li>
<li>	 public $result;&nbsp; &nbsp; &nbsp;#结果数组集</li>
<li>	 public $pagelist;&nbsp; &nbsp;#每翻页数</li>
<li>	 public $db;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#数据库连接</li>
<li>	 public $table;&nbsp; &nbsp; &nbsp; #要查询的表</li>
<li>	 public $fileds;&nbsp; &nbsp; &nbsp;#要返回的字段</li>
<li>	 public $where;&nbsp; &nbsp; &nbsp; #where条件</li>
<li>&nbsp;</li>
<li>	 #构造函数，初始化变量</li>
<li>	 function __construct( $page , $table , $fields = '*' , $where = false , $baseurl = false )</li>
<li>	 {</li>
<li>	&nbsp; &nbsp; &nbsp;global $_CFG,$db;</li>
<li>		 $this-&gt;db&nbsp; &nbsp; &nbsp; &nbsp; = $db;</li>
<li>		 $this-&gt;table&nbsp; &nbsp; &nbsp;= $table;</li>
<li>		 $this-&gt;page&nbsp; &nbsp; &nbsp; = isset($page) ? intval($page) : 1;</li>
<li>		 $this-&gt;fileds&nbsp; &nbsp; = $fields;</li>
<li>		 $this-&gt;pagesize&nbsp; = $_CFG['pagesize'];</li>
<li>		 $this-&gt;baseurl&nbsp; &nbsp;= ($baseurl!=false) ? $baseurl : $this-&gt;__geturl();</li>
<li>		 $this-&gt;pagelist&nbsp; = $_CFG['pagelist'];</li>
<li>		 $this-&gt;where&nbsp; &nbsp; &nbsp;= $where;</li>
<li>	 }</li>
<li>&nbsp;</li>
<li>	 #获得当前url</li>
<li>	 function __geturl()</li>
<li>	 {</li>
<li>		parse_str($_SERVER['QUERY_STRING'],$str);</li>
<li>		if(isset($str['page']))</li>
<li>		{</li>
<li>			unset($str['page']);</li>
<li>		}</li>
<li>		return count($str) &gt; 0 ? &quot;?&quot;.http_build_query($str) : &quot;?&quot;;</li>
<li>	 }</li>
<li>&nbsp;</li>
<li>	 #获得记录集</li>
<li>	 function __getlist()</li>
<li>	 {</li>
<li>	&nbsp; &nbsp; &nbsp;#获得count记录</li>
<li>		 $sql = sprintf(&quot;SELECT COUNT(*) AS table_count FROM %s %s&quot;,$this-&gt;table,(($this-&gt;where!=false) ? &quot; WHERE &quot;.$this-&gt;where : ''));</li>
<li>		 $rs = $this-&gt;db-&gt;fetch( $sql );</li>
<li>		 $this-&gt;count = $rs['table_count'];</li>
<li>	&nbsp; &nbsp; &nbsp;$offset = ($this-&gt;page-1)*$this-&gt;pagesize-1;</li>
<li>	&nbsp; &nbsp; &nbsp;$sql = sprintf(&quot;SELECT %s FROM %s %s LIMIT %d,%d&quot;,$this-&gt;fileds,$this-&gt;table,(($this-&gt;where!=false) ? &quot; WHERE &quot;.$this-&gt;where : ''),$this-&gt;pagesize*($this-&gt;page-1),$this-&gt;pagesize);</li>
<li>		 #echo $sql;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; $list = $this-&gt;db-&gt;fetchAll( $sql );</li>
<li>		 return $list;</li>
<li>	 }</li>
<li>&nbsp;</li>
<li>	 #获得分页列表</li>
<li>	 function __getpagelist()</li>
<li>	 {</li>
<li>		 $this-&gt;result['count'] = $this-&gt;count;</li>
<li>		 $this-&gt;result['page'] = $this-&gt;page;</li>
<li>		 $this-&gt;result['pagesize'] = $this-&gt;pagesize;</li>
<li>		 $this-&gt;result['pagecount'] = ceil($this-&gt;count/$this-&gt;pagesize);</li>
<li>		 if($this-&gt;result['pagecount']&lt; =1) //只有一页以下</li>
<li>		 {</li>
<li>			 $this-&gt;result['pagelist'] = 0;</li>
<li>		 }</li>
<li>		 else //一页以上</li>
<li>		 {</li>
<li>			 #前一页，第一页的算法</li>
<li>			 $this-&gt;result['first'] = ($this-&gt;page == 1) ? 0 : 1;</li>
<li>			 $this-&gt;result['pre'] = ($this-&gt;page == 1) ? 0 : 1;</li>
<li>			 #后一页，最后一页的算法</li>
<li>			 $this-&gt;result['next'] = ($this-&gt;page == $this-&gt;result['pagecount'] ) ? 0 : 1;</li>
<li>			 $this-&gt;result['last'] = ($this-&gt;page == $this-&gt;result['pagecount'] ) ? 0 : 1;</li>
<li>&nbsp;</li>
<li>			 #起始</li>
<li>			 $pagearray = array();</li>
<li>			 $start = floor(($this-&gt;page-1)/10)*10+1;</li>
<li>			 for($i=0;$i&amp;lt;10;$i++)</li>
<li>			 {</li>
<li>			&nbsp; &nbsp; &nbsp;if( ($start+$i) &lt; = $this-&gt;result['pagecount'])</li>
<li>				 {</li>
<li>				&nbsp; &nbsp; &nbsp;$pagearray[$i]['page'] = $start+$i; </li>
<li>				 }</li>
<li>				 if( ($start+$i) != $this-&gt;page )</li>
<li>				 {</li>
<li>				&nbsp; &nbsp; &nbsp;$pagearray[$i]['link'] = 1; </li>
<li>				 }</li>
<li>			 }</li>
<li>			 #分页导航列表</li>
<li>			 $this-&gt;result['pagelist'] = $pagearray;</li>
<li>			 $this-&gt;result['baseurl'] = $this-&gt;baseurl;</li>
<li>		 }</li>
<li>		 return $this-&gt;result;</li>
<li>	 }</li>
<li>}</li>
<li>?&gt;</li></ol></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">&lt;div id=&quot;page&quot;&gt;</li>
<li>&lt;table&gt;</li>
<li>&nbsp;&nbsp; &nbsp;&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td&gt;</li>
<li>		共{{$page.count}}条数据 每页{{$page.pagesize}}条&nbsp; 共{{$page.pagecount}}页 当前第{{$page.page}}页</li>
<li>		&lt;/td&gt;</li>
<li>		&lt;td&gt;</li>
<li>		{{if $page.pagecount&gt;1}}</li>
<li>		{{if $page.first eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl}}&quot;&gt;首页&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		首页</li>
<li>		{{/if}}</li>
<li>		{{if $page.pre eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl}}&amp;page={{$page.page-1}}&quot;&gt;上一页&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		上一页</li>
<li>		{{/if}}</li>
<li>		{{foreach from=$page.pagelist item=vols}}</li>
<li>		&nbsp; &nbsp; {{if ($vols.page &gt; 0 ) &amp;&amp; ($vols.page &lt; = $page.pagecount) }}</li>
<li>				{{if $vols.link eq 1}}</li>
<li>				&lt;a href=&quot;{{$page.baseurl}}&amp;page={{$vols.page}}&quot;&gt;[{{$vols.page}}]</li>
<li>				{{else}}</li>
<li>				[{{$vols.page}}]</li>
<li>				{{/if}}</li>
<li>			{{/if}}</li>
<li>		{{/foreach}}</li>
<li>		{{if $page.next eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl|default:&quot;?&quot;}}&amp;page={{$page.page+1}}&quot;&gt;下一页&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		下一页</li>
<li>		{{/if}}</li>
<li>		{{if $page.last eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl|default:&quot;?&quot;}}&amp;page={{$page.pagecount}}&quot;&gt;尾页&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		尾页</li>
<li>		{{/if}}</li>
<li>		{{/if}}</li>
<li>		&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>&lt;/table&gt;</li>
<li>&lt;/div&gt;</li></ol></div>
<p>补充一个demo</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">#PHP部分</li>
<li>$page = new Page( $page , $this-&gt;area_table , $fields = '*' , $where);</li>
<li>$result['rs'] = $page-&gt;__getlist();</li>
<li>$result['page'] = $page-&gt;__getpagelist();</li>
<li>$smarty-&gt;assign(&quot;list&quot;,$result['rs']);</li>
<li>$smarty-&gt;assign(&quot;page&quot;,$result['page']);</li>
<li>$smarty-&gt;display('list.tpl');</li>
<li>#模板里边只要引用这个分页模板即可</li>
<li>{{include file=$smarty.const.Tpl|cat:&quot;/Page.tpl&quot;}}</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/08/smarty%e5%88%86%e9%a1%b5%e7%b1%bb%e4%bf%ae%e6%ad%a3%e7%89%88.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>我的框架依然有人记得</title>
		<link>http://www.sunboyu.cn/2009/05/05/%e6%88%91%e7%9a%84%e6%a1%86%e6%9e%b6%e4%be%9d%e7%84%b6%e6%9c%89%e4%ba%ba%e8%ae%b0%e5%be%97.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/05/%e6%88%91%e7%9a%84%e6%a1%86%e6%9e%b6%e4%be%9d%e7%84%b6%e6%9c%89%e4%ba%ba%e8%ae%b0%e5%be%97.shtml#comments</comments>
		<pubDate>Tue, 05 May 2009 11:59:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[框架]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=687</guid>
		<description><![CDATA[去年尝试开发了一个框架，开发了一半。或者说第一阶段开发完成。
为了开发这个框架，阅读了大量框架代码，框架思想，然后精心去调试了自己的框架。
在框架完成后，我并没有去使用。
框架的初衷是为了性能跟开发规范，而我在这个框架下兼职无法写代码，无法发挥。自从学写PHP，我从来没受什么规矩约束过，向来是自由度很高。而规则则是多年编程留下的一些经验。后来发现我的风格实在无法用框架来约束，所以放弃使用这个框架，依然按照自己的风格进行开发。
但反思，为什么有很多的框架在项目中应用－那就是规范。不成规矩，不成方圆。尤其在团队合作开发过程中，团队利益就高于个体利益。如果每个人能损失一点个人利益，那团队就可能拥有至高的利益。
因此，我又尝试开发了一套闭源自用的框架。其既集成了框架的一些模块化，规范化的理念，又适合程序员在小范围内自由发挥。后来我又加上了一些管理功能，通用模块系统，现在我可以在这个上边快速开发，又可以很轻松得把模块拆离重组。
内心我并没有把他当作框架，叫做程序“模子”会更好，感谢lamp群友给这么个名字。
]]></description>
			<content:encoded><![CDATA[<p>去年尝试开发了一个框架，开发了一半。或者说第一阶段开发完成。</p>
<p>为了开发这个框架，阅读了大量框架代码，框架思想，然后精心去调试了自己的框架。</p>
<p>在框架完成后，我并没有去使用。</p>
<p>框架的初衷是为了性能跟开发规范，而我在这个框架下兼职无法写代码，无法发挥。自从学写PHP，我从来没受什么规矩约束过，向来是自由度很高。而规则则是多年编程留下的一些经验。后来发现我的风格实在无法用框架来约束，所以放弃使用这个框架，依然按照自己的风格进行开发。</p>
<p>但反思，为什么有很多的框架在项目中应用－那就是规范。不成规矩，不成方圆。尤其在团队合作开发过程中，团队利益就高于个体利益。如果每个人能损失一点个人利益，那团队就可能拥有至高的利益。</p>
<p>因此，我又尝试开发了一套闭源自用的框架。其既集成了框架的一些模块化，规范化的理念，又适合程序员在小范围内自由发挥。后来我又加上了一些管理功能，通用模块系统，现在我可以在这个上边快速开发，又可以很轻松得把模块拆离重组。</p>
<p>内心我并没有把他当作框架，叫做程序“模子”会更好，感谢lamp群友给这么个名字。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/05/%e6%88%91%e7%9a%84%e6%a1%86%e6%9e%b6%e4%be%9d%e7%84%b6%e6%9c%89%e4%ba%ba%e8%ae%b0%e5%be%97.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>蓝芒主机管理系统简析</title>
		<link>http://www.sunboyu.cn/2009/05/02/%e8%93%9d%e8%8a%92%e4%b8%bb%e6%9c%ba%e7%ae%a1%e7%90%86%e7%b3%bb%e7%bb%9f%e7%ae%80%e6%9e%90.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/02/%e8%93%9d%e8%8a%92%e4%b8%bb%e6%9c%ba%e7%ae%a1%e7%90%86%e7%b3%bb%e7%bb%9f%e7%ae%80%e6%9e%90.shtml#comments</comments>
		<pubDate>Sat, 02 May 2009 12:24:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[蓝芒]]></category>

		<category><![CDATA[虚拟主机管理]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=684</guid>
		<description><![CDATA[最近问了下蓝芒的销售，一套全功能的主机管理系统网络版是5000来块，而且现在可以打8折，也就是4000。
蓝芒的软件可以说是国内拔尖的，论技术，可能仅次于创值立信。这个价格多少对我写自己的主机管理系统有点打击。如果只是为了完善我的主机业务，买一套软件比我写可划算的多，而且他们有现成的售后队伍。
不过我还是网上google了一套破解的系统先看看。
昨天的帖子也说了，我弄了PHP DeZend系统去反解他们代码，很顺利，整套代码跃然呈现出来，最新版。5.0，程序注释都是5.1，估计是最新版。
能反解的，只是他的主控端，集成了业务系统。而被控端是一个windows的被控程序，没有反解，因为我没那个能耐。
下边是我阅读代码后分析的其软件架构：

主控端可以看出集成了业务平台，管理平台，代理平台等应用，而被控端可以是windows或者linux等操作系统。
主控端无需考虑操作系统，只需要销售产品，而被控端根据主控端传来的参数执行指令，生成产品。
这里蓝芒设计比较巧妙的，就是对windows和linux的一些相似业务做了规整，作出了通用的控制接口，可无缝去对接w或l的操作系统。
经过考虑，我决定还是购买一套蓝芒的系统，不过，我自己的系统依然准备进行开源开发，重新整合。
]]></description>
			<content:encoded><![CDATA[<p>最近问了下蓝芒的销售，一套全功能的主机管理系统网络版是5000来块，而且现在可以打8折，也就是4000。</p>
<p>蓝芒的软件可以说是国内拔尖的，论技术，可能仅次于创值立信。这个价格多少对我写自己的主机管理系统有点打击。如果只是为了完善我的主机业务，买一套软件比我写可划算的多，而且他们有现成的售后队伍。</p>
<p>不过我还是网上google了一套破解的系统先看看。</p>
<p>昨天的帖子也说了，我弄了PHP DeZend系统去反解他们代码，很顺利，整套代码跃然呈现出来，最新版。5.0，程序注释都是5.1，估计是最新版。</p>
<p>能反解的，只是他的主控端，集成了业务系统。而被控端是一个windows的被控程序，没有反解，因为我没那个能耐。</p>
<p>下边是我阅读代码后分析的其软件架构：</p>
<p><a href="http://www.sunboyu.cn/upfiles/2009/05/e8939de88a92.jpg"><img class="aligncenter size-full wp-image-685" title="e8939de88a92" src="http://www.sunboyu.cn/upfiles/2009/05/e8939de88a92.jpg" alt="e8939de88a92" width="800" height="486" /></a></p>
<p>主控端可以看出集成了业务平台，管理平台，代理平台等应用，而被控端可以是windows或者linux等操作系统。</p>
<p>主控端无需考虑操作系统，只需要销售产品，而被控端根据主控端传来的参数执行指令，生成产品。</p>
<p>这里蓝芒设计比较巧妙的，就是对windows和linux的一些相似业务做了规整，作出了通用的控制接口，可无缝去对接w或l的操作系统。</p>
<p>经过考虑，我决定还是购买一套蓝芒的系统，不过，我自己的系统依然准备进行开源开发，重新整合。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/02/%e8%93%9d%e8%8a%92%e4%b8%bb%e6%9c%ba%e7%ae%a1%e7%90%86%e7%b3%bb%e7%bb%9f%e7%ae%80%e6%9e%90.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP DeZend真的很爽</title>
		<link>http://www.sunboyu.cn/2009/05/02/php-dezend%e7%9c%9f%e7%9a%84%e5%be%88%e7%88%bd.shtml</link>
		<comments>http://www.sunboyu.cn/2009/05/02/php-dezend%e7%9c%9f%e7%9a%84%e5%be%88%e7%88%bd.shtml#comments</comments>
		<pubDate>Fri, 01 May 2009 16:19:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[dezend]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=681</guid>
		<description><![CDATA[突然在网上发现一套我渴望已久的IDC管理软件，下载下来，除用vb之类的加密外，其源代码是用zend加密过的PHP代码。大喜，网上找到这个工具，然后迅速反接后，看到所有源代码。开始研究。
PHP DeZend
]]></description>
			<content:encoded><![CDATA[<p>突然在网上发现一套我渴望已久的IDC管理软件，下载下来，除用vb之类的加密外，其源代码是用zend加密过的PHP代码。大喜，网上找到这个工具，然后迅速反接后，看到所有源代码。开始研究。</p>
<p><a href='http://www.sunboyu.cn/upfiles/2009/05/phpe7a0b4e8a7a3dezender5.rar'>PHP DeZend</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/05/02/php-dezend%e7%9c%9f%e7%9a%84%e5%be%88%e7%88%bd.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>SVN两个小命令</title>
		<link>http://www.sunboyu.cn/2009/04/30/svn%e4%b8%a4%e4%b8%aa%e5%b0%8f%e5%91%bd%e4%bb%a4.shtml</link>
		<comments>http://www.sunboyu.cn/2009/04/30/svn%e4%b8%a4%e4%b8%aa%e5%b0%8f%e5%91%bd%e4%bb%a4.shtml#comments</comments>
		<pubDate>Wed, 29 Apr 2009 17:04:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[svn]]></category>

		<category><![CDATA[创建]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=678</guid>
		<description><![CDATA[./svnadmin create /home/sunboyu/svndata/bj1998
./svnserve -d &#8211;listen-port 端口号 -r /home/sunboyu/svndata/
 /var/opt/subversion-1.4.3/bin/svn checkout  svn://localhost:20002/tools ./ &#8211;username sun &#8211;password sun
]]></description>
			<content:encoded><![CDATA[<p>./svnadmin create /home/sunboyu/svndata/bj1998</p>
<p>./svnserve -d &#8211;listen-port 端口号 -r /home/sunboyu/svndata/</p>
<p> /var/opt/subversion-1.4.3/bin/svn checkout  svn://localhost:20002/tools ./ &#8211;username sun &#8211;password sun</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/04/30/svn%e4%b8%a4%e4%b8%aa%e5%b0%8f%e5%91%bd%e4%bb%a4.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>市场驱动产品与产品驱动销售</title>
		<link>http://www.sunboyu.cn/2009/04/29/%e5%b8%82%e5%9c%ba%e9%a9%b1%e5%8a%a8%e4%ba%a7%e5%93%81%e4%b8%8e%e4%ba%a7%e5%93%81%e9%a9%b1%e5%8a%a8%e9%94%80%e5%94%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2009/04/29/%e5%b8%82%e5%9c%ba%e9%a9%b1%e5%8a%a8%e4%ba%a7%e5%93%81%e4%b8%8e%e4%ba%a7%e5%93%81%e9%a9%b1%e5%8a%a8%e9%94%80%e5%94%ae.shtml#comments</comments>
		<pubDate>Tue, 28 Apr 2009 20:59:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[市场]]></category>

		<category><![CDATA[销售]]></category>

		<category><![CDATA[驱动]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=673</guid>
		<description><![CDATA[貌似两个紧密相连的概念，可在做事上，是迥然不同的两种表现。
销售出身的人，总能把破烂给折腾出去，他们不在乎技术有多好，产品有多烂，反正他们的任务就是把客户拉来，让钱爬在自己的账户上。
这样苦不堪言的是那些苦命攒代码的人，不得不迎合销售千变万化的销售策略和肆意夸大而进行的承诺。
当然对于技术出身的销售来说，在面对客户相对谨慎，在对产品的把握上显得拘谨，但这样做下来的方案变故会比纯销售做事稳当得多。
对于一个公司，无论是谁来驱动谁，总得有一个原始动力，原始动力丢失的时候，公司就会陷入浑沌状态。
这个动力一般是市场来驱动，对于创业者，更多的动力是那股原始的冲劲。
最近看了一本书，大概悟出这些道理。通过最近做产品，发现自己弱点很明显，还不能从大局去考虑事情，看技术之外的事情肤浅。
从今天作为一个起点，努力客服。
]]></description>
			<content:encoded><![CDATA[<p>貌似两个紧密相连的概念，可在做事上，是迥然不同的两种表现。</p>
<p>销售出身的人，总能把破烂给折腾出去，他们不在乎技术有多好，产品有多烂，反正他们的任务就是把客户拉来，让钱爬在自己的账户上。</p>
<p>这样苦不堪言的是那些苦命攒代码的人，不得不迎合销售千变万化的销售策略和肆意夸大而进行的承诺。</p>
<p>当然对于技术出身的销售来说，在面对客户相对谨慎，在对产品的把握上显得拘谨，但这样做下来的方案变故会比纯销售做事稳当得多。</p>
<p>对于一个公司，无论是谁来驱动谁，总得有一个原始动力，原始动力丢失的时候，公司就会陷入浑沌状态。</p>
<p>这个动力一般是市场来驱动，对于创业者，更多的动力是那股原始的冲劲。</p>
<p>最近看了一本书，大概悟出这些道理。通过最近做产品，发现自己弱点很明显，还不能从大局去考虑事情，看技术之外的事情肤浅。</p>
<p>从今天作为一个起点，努力客服。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/04/29/%e5%b8%82%e5%9c%ba%e9%a9%b1%e5%8a%a8%e4%ba%a7%e5%93%81%e4%b8%8e%e4%ba%a7%e5%93%81%e9%a9%b1%e5%8a%a8%e9%94%80%e5%94%ae.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>产品需要灵魂</title>
		<link>http://www.sunboyu.cn/2009/04/28/%e4%ba%a7%e5%93%81%e9%9c%80%e8%a6%81%e7%81%b5%e9%ad%82.shtml</link>
		<comments>http://www.sunboyu.cn/2009/04/28/%e4%ba%a7%e5%93%81%e9%9c%80%e8%a6%81%e7%81%b5%e9%ad%82.shtml#comments</comments>
		<pubDate>Mon, 27 Apr 2009 21:52:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[产品]]></category>

		<category><![CDATA[灵魂]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=671</guid>
		<description><![CDATA[http://www.sunboyu.cn/2008/11/10/%E7%BD%91%E7%AB%99%E7%9A%84%E7%94%9F%E5%91%BD%E4%B8%8E%E7%81%B5%E9%AD%82.shtml
这是我去年写的一个日志。网站，需要灵魂。
岂止是网站，任何一款产品，都需要他的灵魂。
今天的产品设计方案被上边否定了，仔细琢磨，原来我在做产品，虽然是一个技术可行的产品，但没有灵魂。没有人会对一具僵尸有感情，没有用户会对一个没有灵魂的产品感兴趣。
下午匆匆给产品附加了灵魂，勉强被通过。
底下还要继续给产品人性化，这个项目我吃定了。
]]></description>
			<content:encoded><![CDATA[<p>http://www.sunboyu.cn/2008/11/10/%E7%BD%91%E7%AB%99%E7%9A%84%E7%94%9F%E5%91%BD%E4%B8%8E%E7%81%B5%E9%AD%82.shtml</p>
<p>这是我去年写的一个日志。网站，需要灵魂。</p>
<p>岂止是网站，任何一款产品，都需要他的灵魂。</p>
<p>今天的产品设计方案被上边否定了，仔细琢磨，原来我在做产品，虽然是一个技术可行的产品，但没有灵魂。没有人会对一具僵尸有感情，没有用户会对一个没有灵魂的产品感兴趣。</p>
<p>下午匆匆给产品附加了灵魂，勉强被通过。</p>
<p>底下还要继续给产品人性化，这个项目我吃定了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/04/28/%e4%ba%a7%e5%93%81%e9%9c%80%e8%a6%81%e7%81%b5%e9%ad%82.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Python写的数据库备份程序</title>
		<link>http://www.sunboyu.cn/2009/04/22/python%e5%86%99%e7%9a%84%e6%95%b0%e6%8d%ae%e5%ba%93%e5%a4%87%e4%bb%bd%e7%a8%8b%e5%ba%8f.shtml</link>
		<comments>http://www.sunboyu.cn/2009/04/22/python%e5%86%99%e7%9a%84%e6%95%b0%e6%8d%ae%e5%ba%93%e5%a4%87%e4%bb%bd%e7%a8%8b%e5%ba%8f.shtml#comments</comments>
		<pubDate>Tue, 21 Apr 2009 17:55:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[mysqldump]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=664</guid>
		<description><![CDATA[下载地址:mysqlbak
#!/var/opt/python-2.5/bin/python
import os
import time
import MySQLdb
&#160;
&#160;
CFG = {}
CFG['root'] = {}
CFG['root']['hostname'] = 'localhost'
CFG['root']['username'] = 'root'
CFG['root']['password'] = 'test'
&#160;
&#160;
CFG['mysqldump'] = '/opt/mysql-5.0.22/bin/mysqldump'
&#160;
CFG['time'] = time.strftime(&#34;%Y-%m-%d&#34;, time.localtime(time.time()) ) 
&#160;
CFG['bakpath'] = '/tmp/' + CFG['time']
CFG['mainbak'] = '/home/sunboyu/databak/' + CFG['time']
&#160;
&#160;
if os.path.exists( CFG['bakpath'] ) == False:
&#160;&#160; &#160;os.mkdir( CFG['bakpath'] )
if os.path.exists( CFG['mainbak'] ) == False:
&#160;&#160; &#160;os.mkdir( CFG['mainbak'] )
&#160;
def mysql_database_bak( database ):
&#160;&#160; &#160;global CFG
&#160;&#160; &#160;DIR = CFG['bakpath'] + &#34;/&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>下载地址:<a href='http://www.sunboyu.cn/upfiles/2009/04/mysqlbak.rar'>mysqlbak</a></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">#!/var/opt/python-2.5/bin/python</li>
<li>import os</li>
<li>import time</li>
<li>import MySQLdb</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>CFG = {}</li>
<li>CFG['root'] = {}</li>
<li>CFG['root']['hostname'] = 'localhost'</li>
<li>CFG['root']['username'] = 'root'</li>
<li>CFG['root']['password'] = 'test'</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>CFG['mysqldump'] = '/opt/mysql-5.0.22/bin/mysqldump'</li>
<li>&nbsp;</li>
<li>CFG['time'] = time.strftime(&quot;%Y-%m-%d&quot;, time.localtime(time.time()) ) </li>
<li>&nbsp;</li>
<li>CFG['bakpath'] = '/tmp/' + CFG['time']</li>
<li>CFG['mainbak'] = '/home/sunboyu/databak/' + CFG['time']</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>if os.path.exists( CFG['bakpath'] ) == False:</li>
<li>&nbsp;&nbsp; &nbsp;os.mkdir( CFG['bakpath'] )</li>
<li>if os.path.exists( CFG['mainbak'] ) == False:</li>
<li>&nbsp;&nbsp; &nbsp;os.mkdir( CFG['mainbak'] )</li>
<li>&nbsp;</li>
<li>def mysql_database_bak( database ):</li>
<li>&nbsp;&nbsp; &nbsp;global CFG</li>
<li>&nbsp;&nbsp; &nbsp;DIR = CFG['bakpath'] + &quot;/&quot; + database</li>
<li>&nbsp;&nbsp; &nbsp;if os.path.exists( DIR )==False:</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;os.mkdir( DIR )</li>
<li>&nbsp;&nbsp; &nbsp;conn = MySQLdb.connect( host = CFG['root']['hostname'] , user = CFG['root']['username'] , passwd = CFG['root']['password'] , db = database )</li>
<li>&nbsp;&nbsp; &nbsp;db = conn.cursor()</li>
<li>&nbsp;&nbsp; &nbsp;sql = &quot;show tables&quot;;</li>
<li>&nbsp;&nbsp; &nbsp;db.execute( sql )</li>
<li>&nbsp;&nbsp; &nbsp;result = {}</li>
<li>&nbsp;&nbsp; &nbsp;for recordline in db.fetchall():</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;os.system( CFG['mysqldump'] + &quot; --opt&nbsp; &quot; + database + &quot; &quot; + recordline[0] + &quot; -u&quot; + CFG['root']['username'] + &quot; -p&quot; + CFG['root']['password'] + &quot; &gt; &quot; + DIR + &quot;/&quot; + database + &quot;_&quot; + recordline[0] + &quot;.sql&quot; )</li>
<li>&nbsp;&nbsp; &nbsp;os.system( &quot;tar cvf &quot; + CFG['bakpath'] + &quot;/&quot; + database + &quot;.tar.gz &quot; +&nbsp; CFG['bakpath'] + &quot;/&quot; + database )</li>
<li>&nbsp;&nbsp; &nbsp;os.system( &quot;mv &quot; + CFG['bakpath'] + &quot;/&quot; + database + &quot;.tar.gz &quot; + CFG['mainbak'] + '/' )</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>conn = MySQLdb.connect( host = CFG['root']['hostname'] , user = CFG['root']['username'] , passwd = CFG['root']['password'] , db = 'test' )</li>
<li>sql = &quot;show databases&quot;;</li>
<li>db = conn.cursor()</li>
<li>db.execute( sql )</li>
<li>result = {}</li>
<li>bigcount = 0</li>
<li>for recordline in db.fetchall():</li>
<li>	littlecount = 0</li>
<li>	result[bigcount] = {}</li>
<li>	for colnum in db.description:</li>
<li>	&nbsp; &nbsp; result[bigcount][colnum[0]] = recordline[littlecount]</li>
<li>	&nbsp; &nbsp; littlecount += 1</li>
<li>	bigcount += 1</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>for tables in result:</li>
<li>&nbsp;&nbsp; &nbsp;mysql_database_bak( result[tables]['Database'] )</li>
<li>&nbsp;</li>
<li>os.system( &quot;rm -rf /tmp/&quot; + CFG['time'] )&nbsp; #警告 rm -rf 这个命令相当危险，使用一定要谨慎</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/04/22/python%e5%86%99%e7%9a%84%e6%95%b0%e6%8d%ae%e5%ba%93%e5%a4%87%e4%bb%bd%e7%a8%8b%e5%ba%8f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>python2.5+MySQLdb1.2.2安装</title>
		<link>http://www.sunboyu.cn/2009/04/22/python25mysqldb122%e5%ae%89%e8%a3%85.shtml</link>
		<comments>http://www.sunboyu.cn/2009/04/22/python25mysqldb122%e5%ae%89%e8%a3%85.shtml#comments</comments>
		<pubDate>Tue, 21 Apr 2009 16:04:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[MySQLdb]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=662</guid>
		<description><![CDATA[最近比较喜欢用python写一些shell，又因为要跟mysql交互，所以安装python2.5＋MySQLdb1.2.2。
选择python而没有选择perl，c之类，是因为python语法相对简单，适合我。其实php也可以，但linux默认安装python并大量使用，而并不默认安装PHP。
在安装过程中遇到很多问题，暂不罗列，google是半万能的，多尝试。
使用这两个版本，是因为在编译过程中的问题，逼我仔细阅读了产品稳当，发现版本依赖性很强，最终选择的这两个。
python编译很简单 ./configure &#8211;prefix=/*****  就OK了。
MySQLdb的安装也很简单,但首先要修改site.cfg的参数，其中threadsafe和mysql_config的值要根据情况修改。
python setup.py build
（如果必要，中间运行这个  ln -s /opt/mysql-5.0.22/lib/libmysqlclient.a ./build/lib.linux-x86_64-2.4/_mysql.so 路径自己调整）
python setup.py install
]]></description>
			<content:encoded><![CDATA[<p>最近比较喜欢用python写一些shell，又因为要跟mysql交互，所以安装python2.5＋MySQLdb1.2.2。</p>
<p>选择python而没有选择perl，c之类，是因为python语法相对简单，适合我。其实php也可以，但linux默认安装python并大量使用，而并不默认安装PHP。</p>
<p>在安装过程中遇到很多问题，暂不罗列，google是半万能的，多尝试。</p>
<p>使用这两个版本，是因为在编译过程中的问题，逼我仔细阅读了产品稳当，发现版本依赖性很强，最终选择的这两个。</p>
<p>python编译很简单 ./configure &#8211;prefix=/*****  就OK了。</p>
<p>MySQLdb的安装也很简单,但首先要修改site.cfg的参数，其中threadsafe和mysql_config的值要根据情况修改。</p>
<p>python setup.py build<br />
（如果必要，中间运行这个  ln -s /opt/mysql-5.0.22/lib/libmysqlclient.a ./build/lib.linux-x86_64-2.4/_mysql.so 路径自己调整）<br />
python setup.py install</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/04/22/python25mysqldb122%e5%ae%89%e8%a3%85.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>三维仿真技术的发展和应用</title>
		<link>http://www.sunboyu.cn/2009/04/21/%e4%b8%89%e7%bb%b4%e4%bb%bf%e7%9c%9f%e6%8a%80%e6%9c%af%e7%9a%84%e5%8f%91%e5%b1%95%e5%92%8c%e5%ba%94%e7%94%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2009/04/21/%e4%b8%89%e7%bb%b4%e4%bb%bf%e7%9c%9f%e6%8a%80%e6%9c%af%e7%9a%84%e5%8f%91%e5%b1%95%e5%92%8c%e5%ba%94%e7%94%a8.shtml#comments</comments>
		<pubDate>Mon, 20 Apr 2009 21:41:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[三维]]></category>

		<category><![CDATA[仿真]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=660</guid>
		<description><![CDATA[每天下班，我都能骑上自行车顺利回家，但那拥堵的道路却让我不堪忍受。于是，放下自行车，从车库里开出我那辆三菱跑车，飞奔在高速公路上。
我开到220KM/Hour，路上遇到一个山西的好友，打招呼之间，撞上了一辆的士。我的车翻滚了两圈，我居然又稳稳得跑了起来，而人毫发无损。
警车追来，可惜他的车远不如我，结果被我甩下。半个小时后，我又回到了家。
当然，这也许是做梦，但却不是梦。我在玩《极品飞车》游戏，计算机仿真的技术让我在忙碌一天后彻底放松。
仿真的汽车，高现实的场景模拟，给人心理无限愉悦，而这一些，仅需要一根网线和一台电脑。
尖端技术一般都用在军事，仿真模拟技术也一样，从最早的军用模拟，到高科技实验室，再到现在的大众消费，仅仅几十年。在大众消费领域，仿真技术广泛应用在娱乐休闲领域，如电脑游戏，各种游艺机设备。
平面模拟的效果终究是差的，于是出现立体模拟。
我见过最早的立体模拟设备也许就是街边的游艺厅了，两个牌就可以开一圈的赛车，还可以拿上强去剿匪。现在各种外设逐渐走向人们家庭。
罗技方向盘＋3D视频眼睛，能给你视觉，触觉上的高度仿真（当然没有那种摇晃的力学作用）。而一些实验室，已经开发出高度模拟特定环境的系统，如神洲飞船的模拟训练仓，海员训练的模拟水仓。
尖端技术向民用发展，不会是很长的，而在电脑技术和网络如此发达的今天，这些技术的整合，将给人们的生活带来惊人的变化。
也许游戏里发生那些，明天就走向了真实。
是期待，还是恐惧？
]]></description>
			<content:encoded><![CDATA[<p>每天下班，我都能骑上自行车顺利回家，但那拥堵的道路却让我不堪忍受。于是，放下自行车，从车库里开出我那辆三菱跑车，飞奔在高速公路上。</p>
<p>我开到220KM/Hour，路上遇到一个山西的好友，打招呼之间，撞上了一辆的士。我的车翻滚了两圈，我居然又稳稳得跑了起来，而人毫发无损。</p>
<p>警车追来，可惜他的车远不如我，结果被我甩下。半个小时后，我又回到了家。</p>
<p>当然，这也许是做梦，但却不是梦。我在玩《极品飞车》游戏，计算机仿真的技术让我在忙碌一天后彻底放松。</p>
<p>仿真的汽车，高现实的场景模拟，给人心理无限愉悦，而这一些，仅需要一根网线和一台电脑。</p>
<p>尖端技术一般都用在军事，仿真模拟技术也一样，从最早的军用模拟，到高科技实验室，再到现在的大众消费，仅仅几十年。在大众消费领域，仿真技术广泛应用在娱乐休闲领域，如电脑游戏，各种游艺机设备。</p>
<p>平面模拟的效果终究是差的，于是出现立体模拟。</p>
<p>我见过最早的立体模拟设备也许就是街边的游艺厅了，两个牌就可以开一圈的赛车，还可以拿上强去剿匪。现在各种外设逐渐走向人们家庭。</p>
<p>罗技方向盘＋3D视频眼睛，能给你视觉，触觉上的高度仿真（当然没有那种摇晃的力学作用）。而一些实验室，已经开发出高度模拟特定环境的系统，如神洲飞船的模拟训练仓，海员训练的模拟水仓。</p>
<p>尖端技术向民用发展，不会是很长的，而在电脑技术和网络如此发达的今天，这些技术的整合，将给人们的生活带来惊人的变化。</p>
<p>也许游戏里发生那些，明天就走向了真实。</p>
<p>是期待，还是恐惧？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/04/21/%e4%b8%89%e7%bb%b4%e4%bb%bf%e7%9c%9f%e6%8a%80%e6%9c%af%e7%9a%84%e5%8f%91%e5%b1%95%e5%92%8c%e5%ba%94%e7%94%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>iftop来查看linux的即时流量</title>
		<link>http://www.sunboyu.cn/2009/04/18/iftop%e6%9d%a5%e6%9f%a5%e7%9c%8blinux%e7%9a%84%e5%8d%b3%e6%97%b6%e6%b5%81%e9%87%8f.shtml</link>
		<comments>http://www.sunboyu.cn/2009/04/18/iftop%e6%9d%a5%e6%9f%a5%e7%9c%8blinux%e7%9a%84%e5%8d%b3%e6%97%b6%e6%b5%81%e9%87%8f.shtml#comments</comments>
		<pubDate>Sat, 18 Apr 2009 00:59:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[iftop]]></category>

		<category><![CDATA[流量]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=658</guid>
		<description><![CDATA[http://ex-parrot.com/~pdw/iftop/download/?D=A
我也就纳闷，直接make &#038;&#038; make install就好了。
如此简单的东西，iftop就可以查看了。
yum install *pcap*
]]></description>
			<content:encoded><![CDATA[<p>http://ex-parrot.com/~pdw/iftop/download/?D=A</p>
<p>我也就纳闷，直接make &#038;&#038; make install就好了。</p>
<p>如此简单的东西，iftop就可以查看了。</p>
<p>yum install *pcap*</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/04/18/iftop%e6%9d%a5%e6%9f%a5%e7%9c%8blinux%e7%9a%84%e5%8d%b3%e6%97%b6%e6%b5%81%e9%87%8f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>话说备份</title>
		<link>http://www.sunboyu.cn/2009/04/18/%e8%af%9d%e8%af%b4%e5%a4%87%e4%bb%bd.shtml</link>
		<comments>http://www.sunboyu.cn/2009/04/18/%e8%af%9d%e8%af%b4%e5%a4%87%e4%bb%bd.shtml#comments</comments>
		<pubDate>Sat, 18 Apr 2009 00:39:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[灾难备份]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=654</guid>
		<description><![CDATA[最近服务器down了几次，频繁装了几次系统，可谓筋疲力尽，最后一次面对IBM的机器，对柜发誓：机器再down，这辈子不摸服务器。
话是这么说，服务真down了还的去管。
不过管之前，有些臭事还是要做－灾难备份。
首先是什么需要备份：数据库当然要备份，文件当然要备份。貌似所有的企业都在备份这些。
熟悉windows2003的网管都知道，2003提供了方便的配置文件备份，这个貌似是linux所没有的。打上标记。
用户需要备份么，我指linux系统帐号。备份一下吧，如果你有依赖系统账户的程序。
应用软件的配置文件是否要备份？如果你的配置很专业复杂个性，备份一下吧，省得都在黑白屏上VI，我双飞燕的键盘不好使，不想多敲几个字母。
源码的编译参数需要备份么？我有AMP自动安装脚本，很好很强大！
最近的一个小目标：linux灾难备份的脚本。
下一个就是：linux灾难恢复的脚本。
]]></description>
			<content:encoded><![CDATA[<p>最近服务器down了几次，频繁装了几次系统，可谓筋疲力尽，最后一次面对IBM的机器，对柜发誓：机器再down，这辈子不摸服务器。</p>
<p>话是这么说，服务真down了还的去管。</p>
<p>不过管之前，有些臭事还是要做－灾难备份。</p>
<p>首先是什么需要备份：数据库当然要备份，文件当然要备份。貌似所有的企业都在备份这些。</p>
<p>熟悉windows2003的网管都知道，2003提供了方便的配置文件备份，这个貌似是linux所没有的。打上标记。</p>
<p>用户需要备份么，我指linux系统帐号。备份一下吧，如果你有依赖系统账户的程序。</p>
<p>应用软件的配置文件是否要备份？如果你的配置很专业复杂个性，备份一下吧，省得都在黑白屏上VI，我双飞燕的键盘不好使，不想多敲几个字母。</p>
<p>源码的编译参数需要备份么？我有AMP自动安装脚本，很好很强大！</p>
<p>最近的一个小目标：linux灾难备份的脚本。</p>
<p>下一个就是：linux灾难恢复的脚本。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/04/18/%e8%af%9d%e8%af%b4%e5%a4%87%e4%bb%bd.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>linux下杀死某用户的所有进程</title>
		<link>http://www.sunboyu.cn/2009/04/08/linux%e4%b8%8b%e6%9d%80%e6%ad%bb%e6%9f%90%e7%94%a8%e6%88%b7%e7%9a%84%e6%89%80%e6%9c%89%e8%bf%9b%e7%a8%8b.shtml</link>
		<comments>http://www.sunboyu.cn/2009/04/08/linux%e4%b8%8b%e6%9d%80%e6%ad%bb%e6%9f%90%e7%94%a8%e6%88%b7%e7%9a%84%e6%89%80%e6%9c%89%e8%bf%9b%e7%a8%8b.shtml#comments</comments>
		<pubDate>Wed, 08 Apr 2009 15:53:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=648</guid>
		<description><![CDATA[kill -9 $(ps -fu  &#124; awk &#8216;{ print $2 }&#8217;)
该死的桶桶，给你开了几百个php-cgi进程，把服务器搞死了！
]]></description>
			<content:encoded><![CDATA[<p>kill -9 $(ps -fu <username> | awk &#8216;{ print $2 }&#8217;)</p>
<p>该死的桶桶，给你开了几百个php-cgi进程，把服务器搞死了！</username></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/04/08/linux%e4%b8%8b%e6%9d%80%e6%ad%bb%e6%9f%90%e7%94%a8%e6%88%b7%e7%9a%84%e6%89%80%e6%9c%89%e8%bf%9b%e7%a8%8b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>linux内存释放</title>
		<link>http://www.sunboyu.cn/2009/04/07/linux%e5%86%85%e5%ad%98%e9%87%8a%e6%94%be.shtml</link>
		<comments>http://www.sunboyu.cn/2009/04/07/linux%e5%86%85%e5%ad%98%e9%87%8a%e6%94%be.shtml#comments</comments>
		<pubDate>Tue, 07 Apr 2009 14:32:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[内存]]></category>

		<category><![CDATA[释放]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=646</guid>
		<description><![CDATA[echo 1 &#62; /proc/sys/vm/drop_caches; #释放页面缓存 
echo 2 &#62; /proc/sys/vm/drop_caches; #释放dentries和inodes
echo 3 &#62; /proc/sys/vm/drop_caches; #释放1＋2
]]></description>
			<content:encoded><![CDATA[<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">echo 1 &gt; /proc/sys/vm/drop_caches; #释放页面缓存 </li>
<li>echo 2 &gt; /proc/sys/vm/drop_caches; #释放dentries和inodes</li>
<li>echo 3 &gt; /proc/sys/vm/drop_caches; #释放1＋2</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/04/07/linux%e5%86%85%e5%ad%98%e9%87%8a%e6%94%be.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>wordpress在不同webserver下的重写规则和配置</title>
		<link>http://www.sunboyu.cn/2009/04/07/wordpress%e5%9c%a8%e4%b8%8d%e5%90%8cwebserver%e4%b8%8b%e7%9a%84%e9%87%8d%e5%86%99%e8%a7%84%e5%88%99%e5%92%8c%e9%85%8d%e7%bd%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2009/04/07/wordpress%e5%9c%a8%e4%b8%8d%e5%90%8cwebserver%e4%b8%8b%e7%9a%84%e9%87%8d%e5%86%99%e8%a7%84%e5%88%99%e5%92%8c%e9%85%8d%e7%bd%ae.shtml#comments</comments>
		<pubDate>Tue, 07 Apr 2009 13:22:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[wordpress]]></category>

		<category><![CDATA[重写]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=644</guid>
		<description><![CDATA[apache下
#.htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
#httpd.conf
Options ExecCGI FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
nginx下
#nginx.conf
location / {
&#160;&#160; &#160; &#160; &#160;if (!-f $request_filename){
&#160;&#160; &#160; &#160; &#160; &#160; &#160;rewrite (.*) /index.php;
&#160;&#160; &#160; &#160; &#160;}
&#160;&#160; &#160;}
]]></description>
			<content:encoded><![CDATA[<p>apache下</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">#.htaccess</li>
<li>RewriteEngine On</li>
<li>RewriteBase /</li>
<li>RewriteCond %{REQUEST_FILENAME} !-f</li>
<li>RewriteCond %{REQUEST_FILENAME} !-d</li>
<li>RewriteRule . /index.php [L]</li>
<li>#httpd.conf</li>
<li>Options ExecCGI FollowSymLinks</li>
<li>AllowOverride All</li>
<li>Order allow,deny</li>
<li>allow from all</li></ol></div>
<p>nginx下</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">#nginx.conf</li>
<li>location / {</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if (!-f $request_filename){</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rewrite (.*) /index.php;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</li>
<li>&nbsp;&nbsp; &nbsp;}</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/04/07/wordpress%e5%9c%a8%e4%b8%8d%e5%90%8cwebserver%e4%b8%8b%e7%9a%84%e9%87%8d%e5%86%99%e8%a7%84%e5%88%99%e5%92%8c%e9%85%8d%e7%bd%ae.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>还是Nginx对抗负载的能力强</title>
		<link>http://www.sunboyu.cn/2009/04/07/%e8%bf%98%e6%98%afnginx%e5%af%b9%e6%8a%97%e8%b4%9f%e8%bd%bd%e7%9a%84%e8%83%bd%e5%8a%9b%e5%bc%ba.shtml</link>
		<comments>http://www.sunboyu.cn/2009/04/07/%e8%bf%98%e6%98%afnginx%e5%af%b9%e6%8a%97%e8%b4%9f%e8%bd%bd%e7%9a%84%e8%83%bd%e5%8a%9b%e5%bc%ba.shtml#comments</comments>
		<pubDate>Tue, 07 Apr 2009 06:45:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=640</guid>
		<description><![CDATA[编译了老半天的apache，又做了很多调整和优化，依然抗不住死机，其实负载也不是很大，但内存CPU就是出奇的高，无奈，装上nginx，负载一下子下来了。
顺便提一下，我PC级的服务器。
感谢  http://www.51fit.com/ 友情提供测试数据
计划重新部署apache，调整工作模式。
]]></description>
			<content:encoded><![CDATA[<p>编译了老半天的apache，又做了很多调整和优化，依然抗不住死机，其实负载也不是很大，但内存CPU就是出奇的高，无奈，装上nginx，负载一下子下来了。</p>
<p>顺便提一下，我PC级的服务器。</p>
<p>感谢  http://www.51fit.com/ 友情提供测试数据</p>
<p>计划重新部署apache，调整工作模式。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/04/07/%e8%bf%98%e6%98%afnginx%e5%af%b9%e6%8a%97%e8%b4%9f%e8%bd%bd%e7%9a%84%e8%83%bd%e5%8a%9b%e5%bc%ba.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>虚拟化产品市场分析</title>
		<link>http://www.sunboyu.cn/2009/04/04/%e8%99%9a%e6%8b%9f%e5%8c%96%e4%ba%a7%e5%93%81%e5%b8%82%e5%9c%ba%e5%88%86%e6%9e%90.shtml</link>
		<comments>http://www.sunboyu.cn/2009/04/04/%e8%99%9a%e6%8b%9f%e5%8c%96%e4%ba%a7%e5%93%81%e5%b8%82%e5%9c%ba%e5%88%86%e6%9e%90.shtml#comments</comments>
		<pubDate>Sat, 04 Apr 2009 05:13:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[管理软件]]></category>

		<category><![CDATA[虚拟主机]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=626</guid>
		<description><![CDATA[我这里分析的虚拟化产品，主要是和IDC相关的一些虚拟产品。
我们常见的产品，比如虚拟主机（空间），VPS，服务器合租等。这类产品目前在市场上发展比较成熟，而且随着互联网发展，这类产品市场前景逐渐看好。
这点，从万网的发展路线就可以看出，中小企业越来越重视自己信息化的建设，而从百度的销售业绩也能看出，企业的投入逐渐从传统媒体转向了互联网。另外，各大IDC机房内，也有相当的托管机器是用在中小网站上。
而这些产品的基础构建，管理，对于不管是企业还是个人，都是一个问题。对于国内做虚拟主机产品的老大们，万网，新网都有自己的管理系统，而对于一些小型用户，一些开源的管理软件足矣，无非是增加点人力。
目前虚拟主机应用主流平台就是windows，linux，freebsd，windows系统首先有自己完善的管理机制和可供开发人员使用的API，对于unix相关系统，开源界更是提供了数不尽的资源。而这些产品更大的问题就是：他们只考虑了去如何管理一个系统，而并没有更多的考虑如何去运营这个系统，如何把产品更快投入商业生产中。
我熟知的成熟商业系统主要有cpanel系统，在整个产业都很出名的，因为美国很多主流虚拟主机提供商都使用这个系统。国内很出名的是创值立信,他们的产品可以算上国内老大了，据说他们的开发团队是从万网跑出来的一伙人，所以在经验和技术积累上很成熟。
但这两个系统都有致命的缺点，就是高昂的价格，不能被大众尤其是中小型的客户甚至个人所接受。
再说其他的一些产品。国产的蓝芒主机管理系统，也是行业内的佼佼者，它们的系统支持国内完善的业务流管理，跨平台的系统支持，可谓非常完善的产品。而再有一些小型的产品，基本都工作在windows下，而无法实现对windows/*nix混合集群的支持，这样就造成了部分客户的流失。
而一些开源的虚拟主机管理，其功能之强令人震撼，比如webmin主机管理平台，还有一些windows下的免费软件基本能实现对整个操作系统虚拟化的管理，但一旦涉及商用，就有很大的问题，其欠缺的不仅是支付，业务流，财务等，更难以实现的是对整个运营流程的管理。
而目前国内此市场上，或者产品功能的欠缺，或者价格的昂贵，对于一些初创的公司或者个人都是一个门槛，无法达到成本低廉化。
所以，我认为国内此类虚拟化管理软件还有很大的市场潜力，只要是能够适应市场的产品，会在如此大的市场份额中再分一杯羹。
]]></description>
			<content:encoded><![CDATA[<p>我这里分析的虚拟化产品，主要是和IDC相关的一些虚拟产品。</p>
<p>我们常见的产品，比如虚拟主机（空间），VPS，服务器合租等。这类产品目前在市场上发展比较成熟，而且随着互联网发展，这类产品市场前景逐渐看好。</p>
<p>这点，从万网的发展路线就可以看出，中小企业越来越重视自己信息化的建设，而从百度的销售业绩也能看出，企业的投入逐渐从传统媒体转向了互联网。另外，各大IDC机房内，也有相当的托管机器是用在中小网站上。</p>
<p>而这些产品的基础构建，管理，对于不管是企业还是个人，都是一个问题。对于国内做虚拟主机产品的老大们，万网，新网都有自己的管理系统，而对于一些小型用户，一些开源的管理软件足矣，无非是增加点人力。</p>
<p>目前虚拟主机应用主流平台就是windows，linux，freebsd，windows系统首先有自己完善的管理机制和可供开发人员使用的API，对于unix相关系统，开源界更是提供了数不尽的资源。而这些产品更大的问题就是：他们只考虑了去如何管理一个系统，而并没有更多的考虑如何去运营这个系统，如何把产品更快投入商业生产中。</p>
<p>我熟知的成熟商业系统主要有cpanel系统，在整个产业都很出名的，因为美国很多主流虚拟主机提供商都使用这个系统。国内很出名的是创值立信,他们的产品可以算上国内老大了，据说他们的开发团队是从万网跑出来的一伙人，所以在经验和技术积累上很成熟。</p>
<p>但这两个系统都有致命的缺点，就是高昂的价格，不能被大众尤其是中小型的客户甚至个人所接受。</p>
<p>再说其他的一些产品。国产的蓝芒主机管理系统，也是行业内的佼佼者，它们的系统支持国内完善的业务流管理，跨平台的系统支持，可谓非常完善的产品。而再有一些小型的产品，基本都工作在windows下，而无法实现对windows/*nix混合集群的支持，这样就造成了部分客户的流失。</p>
<p>而一些开源的虚拟主机管理，其功能之强令人震撼，比如webmin主机管理平台，还有一些windows下的免费软件基本能实现对整个操作系统虚拟化的管理，但一旦涉及商用，就有很大的问题，其欠缺的不仅是支付，业务流，财务等，更难以实现的是对整个运营流程的管理。</p>
<p>而目前国内此市场上，或者产品功能的欠缺，或者价格的昂贵，对于一些初创的公司或者个人都是一个门槛，无法达到成本低廉化。</p>
<p>所以，我认为国内此类虚拟化管理软件还有很大的市场潜力，只要是能够适应市场的产品，会在如此大的市场份额中再分一杯羹。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/04/04/%e8%99%9a%e6%8b%9f%e5%8c%96%e4%ba%a7%e5%93%81%e5%b8%82%e5%9c%ba%e5%88%86%e6%9e%90.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Python写的数据抽象层</title>
		<link>http://www.sunboyu.cn/2009/03/30/python%e5%86%99%e7%9a%84%e6%95%b0%e6%8d%ae%e6%8a%bd%e8%b1%a1%e5%b1%82.shtml</link>
		<comments>http://www.sunboyu.cn/2009/03/30/python%e5%86%99%e7%9a%84%e6%95%b0%e6%8d%ae%e6%8a%bd%e8%b1%a1%e5%b1%82.shtml#comments</comments>
		<pubDate>Mon, 30 Mar 2009 03:26:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=622</guid>
		<description><![CDATA[python本身没有对mysql的支持，得依赖附加的库 http://mysql-python.sourceforge.net 。很多框架采用了这个库，比如adodb，django等。不过我倾向于自己写这些东西，所以小研究了一下。 mysql-python 有两个对象 MySQLdb _mysql 这里是介绍http://mysql-python.sourceforge.net/MySQLdb.html,我使用的是 MySQLdb 对象
#!/D:\python25\python.exe
import MySQLdb
&#160;
class Mysql(object):
&#160;&#160; &#160;handle = ''
&#160;&#160; &#160;query = ''
&#160;&#160; &#160;exectime = 0
&#160;&#160; &#160;effected = 0
&#160;
&#160;&#160; &#160;def __init__( self , hostname , username , password , database ):
&#160;&#160; &#160; &#160; &#160;db = MySQLdb.connect( host = hostname , user = username , passwd = password , db = [...]]]></description>
			<content:encoded><![CDATA[<p>python本身没有对mysql的支持，得依赖附加的库 http://mysql-python.sourceforge.net 。很多框架采用了这个库，比如adodb，django等。不过我倾向于自己写这些东西，所以小研究了一下。 mysql-python 有两个对象 MySQLdb _mysql 这里是介绍http://mysql-python.sourceforge.net/MySQLdb.html,我使用的是 MySQLdb 对象</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">#!/D:\python25\python.exe</li>
<li>import MySQLdb</li>
<li>&nbsp;</li>
<li>class Mysql(object):</li>
<li>&nbsp;&nbsp; &nbsp;handle = ''</li>
<li>&nbsp;&nbsp; &nbsp;query = ''</li>
<li>&nbsp;&nbsp; &nbsp;exectime = 0</li>
<li>&nbsp;&nbsp; &nbsp;effected = 0</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;def __init__( self , hostname , username , password , database ):</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;db = MySQLdb.connect( host = hostname , user = username , passwd = password , db = database )</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;self.handle = db.cursor()</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;def query( self , sql = '' ):</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return self.handle.execute( sql )</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;def fetch( self , sql = '' ):</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;self.handle.execute( sql )</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;rs = self.handle.fetchone()</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;count = 0</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;result = {}</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for colnum in self.handle.description:</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;result[colnum[0]] = rs[count]</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;count += 1</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return result</li>
<li>&nbsp;&nbsp; &nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;def fetchAll( self , sql = '' ):</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;self.handle.execute( sql )</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;result = {}</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;bigcount = 0</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;for recordline in self.handle.fetchall():</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;littlecount = 0</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;result[bigcount] = {}</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for colnum in self.handle.description:</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;result[bigcount][colnum[0]] = recordline[littlecount]</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;littlecount += 1</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;bigcount += 1</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return result</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;def insertID( self ):</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.handle.execute(&quot;SELECT LAST_INSERT_ID() AS lid&quot;)</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rs = self.handle.fetchone()</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return rs[0]</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;def close( self ):</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;self.handle.close()</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pass</li>
<li>#DEMO</li>
<li>db = Mysql('localhost','root','123456','frame')</li>
<li>db.fetchAll('select * from user')</li>
<li>#rs = db.fetchAll('select * from user')</li>
<li>#sql = &quot;INSERT INTO tags (module,fid,name,note,`order`) VALUE ('test',1,'fd','ds',1)&quot;</li>
<li>#db.query(sql)</li>
<li>#print db.insertID()</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/03/30/python%e5%86%99%e7%9a%84%e6%95%b0%e6%8d%ae%e6%8a%bd%e8%b1%a1%e5%b1%82.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>几个画蛇添足的函数，出自我手</title>
		<link>http://www.sunboyu.cn/2009/03/18/%e5%87%a0%e4%b8%aa%e7%94%bb%e8%9b%87%e6%b7%bb%e8%b6%b3%e7%9a%84%e5%87%bd%e6%95%b0%ef%bc%8c%e5%87%ba%e8%87%aa%e6%88%91%e6%89%8b.shtml</link>
		<comments>http://www.sunboyu.cn/2009/03/18/%e5%87%a0%e4%b8%aa%e7%94%bb%e8%9b%87%e6%b7%bb%e8%b6%b3%e7%9a%84%e5%87%bd%e6%95%b0%ef%bc%8c%e5%87%ba%e8%87%aa%e6%88%91%e6%89%8b.shtml#comments</comments>
		<pubDate>Tue, 17 Mar 2009 17:20:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[http_build_query]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=608</guid>
		<description><![CDATA[翻看自己以前的代码，发现自己的一些搞笑的函数,列一个
function func_arrtoQuerystring($array)&#160; &#160; &#160; &#160; &#160; &#160; &#160;#其实就是http_build_query
{
&#160;&#160; &#160;$string = '?';
&#160;&#160; &#160;foreach($array as $key=&#62;$value)
	{
	&#160; &#160; $string .= $key.&#34;,&#34;.$value.&#34;;&#34;;
	}
	$string = substr($string,0,substr($string)-1);
	$string .= &#34;.html&#34;;
	return $string;
}
回头多找几个这样的，自勉
]]></description>
			<content:encoded><![CDATA[<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">function func_arrtoQuerystring($array)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#其实就是http_build_query</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;$string = '?';</li>
<li>&nbsp;&nbsp; &nbsp;foreach($array as $key=&gt;$value)</li>
<li>	{</li>
<li>	&nbsp; &nbsp; $string .= $key.&quot;,&quot;.$value.&quot;;&quot;;</li>
<li>	}</li>
<li>	$string = substr($string,0,substr($string)-1);</li>
<li>	$string .= &quot;.html&quot;;</li>
<li>	return $string;</li>
<li>}</li></ol></div>
<p>回头多找几个这样的，自勉</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/03/18/%e5%87%a0%e4%b8%aa%e7%94%bb%e8%9b%87%e6%b7%bb%e8%b6%b3%e7%9a%84%e5%87%bd%e6%95%b0%ef%bc%8c%e5%87%ba%e8%87%aa%e6%88%91%e6%89%8b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>SVN自动提交那个钩子</title>
		<link>http://www.sunboyu.cn/2009/03/17/svn%e8%87%aa%e5%8a%a8%e6%8f%90%e4%ba%a4%e9%82%a3%e4%b8%aa%e9%92%a9%e5%ad%90.shtml</link>
		<comments>http://www.sunboyu.cn/2009/03/17/svn%e8%87%aa%e5%8a%a8%e6%8f%90%e4%ba%a4%e9%82%a3%e4%b8%aa%e9%92%a9%e5%ad%90.shtml#comments</comments>
		<pubDate>Tue, 17 Mar 2009 10:30:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=606</guid>
		<description><![CDATA[首先那个版本得检出一下 /opt/subversion-1.4.3/bin/svn checkout svn://svn.sunboyu.cn:**/python/sso /home/project/sso
export LANG=zh_CN.UTF-8&#160; &#160;#中文支持
REPOS=&#34;$1&#34;
REV=&#34;$2&#34;
SVN=/opt/subversion-1.4.3/bin/svn&#160; #svn的地址
DIR=/home/main&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;#目标地址
/opt/subversion-1.4.3/bin/svn update /home/main&#160; &#160; &#160; &#160;#执行
]]></description>
			<content:encoded><![CDATA[<p>首先那个版本得检出一下 /opt/subversion-1.4.3/bin/svn checkout svn://svn.sunboyu.cn:**/python/sso /home/project/sso</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">export LANG=zh_CN.UTF-8&nbsp; &nbsp;#中文支持</li>
<li>REPOS=&quot;$1&quot;</li>
<li>REV=&quot;$2&quot;</li>
<li>SVN=/opt/subversion-1.4.3/bin/svn&nbsp; #svn的地址</li>
<li>DIR=/home/main&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#目标地址</li>
<li>/opt/subversion-1.4.3/bin/svn update /home/main&nbsp; &nbsp; &nbsp; &nbsp;#执行</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/03/17/svn%e8%87%aa%e5%8a%a8%e6%8f%90%e4%ba%a4%e9%82%a3%e4%b8%aa%e9%92%a9%e5%ad%90.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>file_get_contents函数使用post方法</title>
		<link>http://www.sunboyu.cn/2009/03/16/file_get_contents%e5%87%bd%e6%95%b0%e4%bd%bf%e7%94%a8post%e6%96%b9%e6%b3%95.shtml</link>
		<comments>http://www.sunboyu.cn/2009/03/16/file_get_contents%e5%87%bd%e6%95%b0%e4%bd%bf%e7%94%a8post%e6%96%b9%e6%b3%95.shtml#comments</comments>
		<pubDate>Mon, 16 Mar 2009 04:27:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=602</guid>
		<description><![CDATA[以前总用socket的方式发送接收http的包，结果收到的包也有一堆http的协议头信息。
处理这些信息还挺费劲的。
然后想到了file_get_contents($url)方法，可以得到纯净的http包的正文。但这种方式默认是get的方式，后查手册和搜索，得到了post的方法。
这种方式基本跟socket的方式相同，包头构建好即可。
$array = array ('a' =&#62; 'b','c'=&#62;'d'); 
$url= http_build_query($array ); 
$postdate = array ( 
&#160;&#160; &#160;'http' =&#62; array ( 
&#160;&#160; &#160; &#160; &#160;'method' =&#62; 'POST', 
&#160;&#160; &#160; &#160; &#160;'header'=&#62; &#34;Content-type: application/x-www-form-urlencoded\r\n&#34; . 
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#34;Content-Length: &#34; . strlen($url) . &#34;\r\n&#34;, 
&#160;&#160; &#160; &#160; &#160;'content' =&#62; $url
&#160;&#160; &#160;), 
); 
$postcontent [...]]]></description>
			<content:encoded><![CDATA[<p>以前总用socket的方式发送接收http的包，结果收到的包也有一堆http的协议头信息。<br />
处理这些信息还挺费劲的。</p>
<p>然后想到了file_get_contents($url)方法，可以得到纯净的http包的正文。但这种方式默认是get的方式，后查手册和搜索，得到了post的方法。</p>
<p>这种方式基本跟socket的方式相同，包头构建好即可。</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">$array = array ('a' =&gt; 'b','c'=&gt;'d'); </li>
<li>$url= http_build_query($array ); </li>
<li>$postdate = array ( </li>
<li>&nbsp;&nbsp; &nbsp;'http' =&gt; array ( </li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;'method' =&gt; 'POST', </li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;'header'=&gt; &quot;Content-type: application/x-www-form-urlencoded\r\n&quot; . </li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;Content-Length: &quot; . strlen($url) . &quot;\r\n&quot;, </li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;'content' =&gt; $url</li>
<li>&nbsp;&nbsp; &nbsp;), </li>
<li>); </li>
<li>$postcontent = stream_context_create($postdate ); </li>
<li>$return= file_get_contents('http://www.sunboyu.cn', false, $postcontent );&nbsp; </li>
<li>echo $return;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/03/16/file_get_contents%e5%87%bd%e6%95%b0%e4%bd%bf%e7%94%a8post%e6%96%b9%e6%b3%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>解决了该死的权限问题，是否真的有效</title>
		<link>http://www.sunboyu.cn/2009/03/12/%e8%a7%a3%e5%86%b3%e4%ba%86%e8%af%a5%e6%ad%bb%e7%9a%84%e6%9d%83%e9%99%90%e9%97%ae%e9%a2%98%ef%bc%8c%e6%98%af%e5%90%a6%e7%9c%9f%e7%9a%84%e6%9c%89%e6%95%88.shtml</link>
		<comments>http://www.sunboyu.cn/2009/03/12/%e8%a7%a3%e5%86%b3%e4%ba%86%e8%af%a5%e6%ad%bb%e7%9a%84%e6%9d%83%e9%99%90%e9%97%ae%e9%a2%98%ef%bc%8c%e6%98%af%e5%90%a6%e7%9c%9f%e7%9a%84%e6%9c%89%e6%95%88.shtml#comments</comments>
		<pubDate>Thu, 12 Mar 2009 15:43:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[Python]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=600</guid>
		<description><![CDATA[我的apache＋php权限是配置的最为严格的，当然，在用的时候难免伴随着混乱的账户情况，linux的权限机制也是很让人头疼的，终于，还是在风平浪静种碰到了麻烦。
我不认为PHP很强，因为它只是一个面向Web的脚本语言，而PHP的开发者却赋予了它太多，让人去用，有人也滥用。
当然，一门语言能解决N多问题是好的，比如汇编，C，但终究PHP有它跨不过的坎。毕竟它只是web脚本语言。
权限出现很大的问题，至今没有搞透，说白了对linux还是一知半解，使用python写了个第三方的东西，很完美得跳跃了权限的问题。至于效率，python肯定要比php强的，起码PHP作为服务器端程序运行，PHP还没有线程和进程的控制（一直没有发现），python有完善的线程进程的库。在权限管理上，python没细看，PHP在linux下有posix函数库，我一直也没有用过。
在没有更好的解决方案前，我依然用PHP做服务器端程序，python作为一些补充。也许，全部切换过去。
]]></description>
			<content:encoded><![CDATA[<p>我的apache＋php权限是配置的最为严格的，当然，在用的时候难免伴随着混乱的账户情况，linux的权限机制也是很让人头疼的，终于，还是在风平浪静种碰到了麻烦。</p>
<p>我不认为PHP很强，因为它只是一个面向Web的脚本语言，而PHP的开发者却赋予了它太多，让人去用，有人也滥用。</p>
<p>当然，一门语言能解决N多问题是好的，比如汇编，C，但终究PHP有它跨不过的坎。毕竟它只是web脚本语言。</p>
<p>权限出现很大的问题，至今没有搞透，说白了对linux还是一知半解，使用python写了个第三方的东西，很完美得跳跃了权限的问题。至于效率，python肯定要比php强的，起码PHP作为服务器端程序运行，PHP还没有线程和进程的控制（一直没有发现），python有完善的线程进程的库。在权限管理上，python没细看，PHP在linux下有posix函数库，我一直也没有用过。</p>
<p>在没有更好的解决方案前，我依然用PHP做服务器端程序，python作为一些补充。也许，全部切换过去。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/03/12/%e8%a7%a3%e5%86%b3%e4%ba%86%e8%af%a5%e6%ad%bb%e7%9a%84%e6%9d%83%e9%99%90%e9%97%ae%e9%a2%98%ef%bc%8c%e6%98%af%e5%90%a6%e7%9c%9f%e7%9a%84%e6%9c%89%e6%95%88.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>做完数据库抽象层，可能要做一个通用的缓存层</title>
		<link>http://www.sunboyu.cn/2009/03/07/%e5%81%9a%e5%ae%8c%e6%95%b0%e6%8d%ae%e5%ba%93%e6%8a%bd%e8%b1%a1%e5%b1%82%ef%bc%8c%e5%8f%af%e8%83%bd%e8%a6%81%e5%81%9a%e4%b8%80%e4%b8%aa%e9%80%9a%e7%94%a8%e7%9a%84%e7%bc%93%e5%ad%98%e5%b1%82.shtml</link>
		<comments>http://www.sunboyu.cn/2009/03/07/%e5%81%9a%e5%ae%8c%e6%95%b0%e6%8d%ae%e5%ba%93%e6%8a%bd%e8%b1%a1%e5%b1%82%ef%bc%8c%e5%8f%af%e8%83%bd%e8%a6%81%e5%81%9a%e4%b8%80%e4%b8%aa%e9%80%9a%e7%94%a8%e7%9a%84%e7%bc%93%e5%ad%98%e5%b1%82.shtml#comments</comments>
		<pubDate>Sat, 07 Mar 2009 06:17:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[bdb]]></category>

		<category><![CDATA[memcache]]></category>

		<category><![CDATA[缓存]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=598</guid>
		<description><![CDATA[数据抽象层实现了Mysql和SQLite的兼容，基本也就够用了，基本所有的PHP环境现在都支持sqlite(起码我配的环境是)，而且扩展的过程证明了这个规则是可以通用的。
低下要做个通用的缓存层，基本就是 key value 这种简单映射的就足够。这种缓存目前实现主要有本地文本，bdb，memcache几大系列。本地文本异常灵活，方便迁移，不依赖其他组件，直接用PHP的文件读写函数就可以。缺点是，未有大规模系统使用，因为PHP本身效率问题。小的应用还是可以使用的，phpx上也有个三德子写的通用文本缓存类。
bdb就非常不错了，嵌入式的数据库，支持简单的key value模式，而且本身非常小，但效率高，支撑非常大的数据量。
memcache就不用说了，太通用了，很多大型的系统都在应用，优缺点不再重复。
抽象层兼容这几个就行了，能实现无缝迁移即可。
计划下周末开工。
]]></description>
			<content:encoded><![CDATA[<p>数据抽象层实现了Mysql和SQLite的兼容，基本也就够用了，基本所有的PHP环境现在都支持sqlite(起码我配的环境是)，而且扩展的过程证明了这个规则是可以通用的。</p>
<p>低下要做个通用的缓存层，基本就是 key value 这种简单映射的就足够。这种缓存目前实现主要有本地文本，bdb，memcache几大系列。本地文本异常灵活，方便迁移，不依赖其他组件，直接用PHP的文件读写函数就可以。缺点是，未有大规模系统使用，因为PHP本身效率问题。小的应用还是可以使用的，phpx上也有个三德子写的通用文本缓存类。</p>
<p>bdb就非常不错了，嵌入式的数据库，支持简单的key value模式，而且本身非常小，但效率高，支撑非常大的数据量。</p>
<p>memcache就不用说了，太通用了，很多大型的系统都在应用，优缺点不再重复。</p>
<p>抽象层兼容这几个就行了，能实现无缝迁移即可。</p>
<p>计划下周末开工。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/03/07/%e5%81%9a%e5%ae%8c%e6%95%b0%e6%8d%ae%e5%ba%93%e6%8a%bd%e8%b1%a1%e5%b1%82%ef%bc%8c%e5%8f%af%e8%83%bd%e8%a6%81%e5%81%9a%e4%b8%80%e4%b8%aa%e9%80%9a%e7%94%a8%e7%9a%84%e7%bc%93%e5%ad%98%e5%b1%82.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>SQLite牛刀小试</title>
		<link>http://www.sunboyu.cn/2009/03/07/sqlite%e7%89%9b%e5%88%80%e5%b0%8f%e8%af%95.shtml</link>
		<comments>http://www.sunboyu.cn/2009/03/07/sqlite%e7%89%9b%e5%88%80%e5%b0%8f%e8%af%95.shtml#comments</comments>
		<pubDate>Fri, 06 Mar 2009 18:07:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[sqlite]]></category>

		<category><![CDATA[sqlitemanager]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=594</guid>
		<description><![CDATA[这玩意据说跟bdb一样，嵌入式数据库，正好嵌到了PHP上边，因为写框架，框架里新添加了一个功能，就是管理模块的一个模块，本想用mysql来做，又一想，用mysql，那迁移起来可麻烦了，不运行一个install就没法部署了，不如把功能直接镶嵌，直接使用。
SQLite跟mysql一样，是关系型数据库，而且功能都类似，我直接使用原来的接口，写了一个数据抽象层，直接挂接到原框架里，很好用。
SQLite管理，我还找了两个工具，一个桌面版的，类似mysql front ，一个web版的，看来就像phpmyadmin了。
413 Request Entity Too Large
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
nginx/0.5.34
FUCK Nginx HOST
那个sqlitemanager  http://www.sqlitemanager.org/
代码如下，因为使用不多，临时用一下，所以细节没怎么处理，待出问题的时候再来修改。
&#60; ?php
/*&#160; DB.SQLite.Class.php
&#160;*&#160; SQLite
&#160;*&#160; @link&#160; &#160; &#160; &#160; http://www.sunboyu.cn
&#160;*&#160; @package&#160; &#160; &#160;OA
&#160;*&#160; @version&#160; &#160; &#160;V1.0
&#160;*
&#160;*&#160; 2009 03 07&#160; sunboyu@gmail.com
&#160;*&#160; Demo
&#160;*/
require_once(ROOT.&#34;/Include/Class/DB.InterFace.php&#34;);
class SQLite implements DateBaseConnect
{
	#连接标识
	public $handle = false;
	#结果标识
	public $query;
	#查询次数
	public $exetime;
	#数据库连接
&#160;&#160; &#160;public function Connect( $argvs )
	{
		$this-&#62;handle = @sqlite_open( $argvs['hostname'].'/'.$argvs['datebase'] , $argvs['mode'] , $sqliteerror );
		if(!$this-&#62;handle)
		{
			die(&#34;Can't connect to the datebase [...]]]></description>
			<content:encoded><![CDATA[<p>这玩意据说跟bdb一样，嵌入式数据库，正好嵌到了PHP上边，因为写框架，框架里新添加了一个功能，就是管理模块的一个模块，本想用mysql来做，又一想，用mysql，那迁移起来可麻烦了，不运行一个install就没法部署了，不如把功能直接镶嵌，直接使用。<br />
SQLite跟mysql一样，是关系型数据库，而且功能都类似，我直接使用原来的接口，写了一个数据抽象层，直接挂接到原框架里，很好用。<br />
SQLite管理，我还找了两个工具，一个桌面版的，类似mysql front ，一个web版的，看来就像phpmyadmin了。</p>
<p>413 Request Entity Too Large</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p>
<p>nginx/0.5.34</p>
<p>FUCK Nginx HOST</p>
<p>那个sqlitemanager  http://www.sqlitemanager.org/</p>
<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">&lt; ?php</li>
<li>/*&nbsp; DB.SQLite.Class.php</li>
<li>&nbsp;*&nbsp; SQLite</li>
<li>&nbsp;*&nbsp; @link&nbsp; &nbsp; &nbsp; &nbsp; http://www.sunboyu.cn</li>
<li>&nbsp;*&nbsp; @package&nbsp; &nbsp; &nbsp;OA</li>
<li>&nbsp;*&nbsp; @version&nbsp; &nbsp; &nbsp;V1.0</li>
<li>&nbsp;*</li>
<li>&nbsp;*&nbsp; 2009 03 07&nbsp; sunboyu@gmail.com</li>
<li>&nbsp;*&nbsp; Demo</li>
<li>&nbsp;*/</li>
<li>require_once(ROOT.&quot;/Include/Class/DB.InterFace.php&quot;);</li>
<li>class SQLite implements DateBaseConnect</li>
<li>{</li>
<li>	#连接标识</li>
<li>	public $handle = false;</li>
<li>	#结果标识</li>
<li>	public $query;</li>
<li>	#查询次数</li>
<li>	public $exetime;</li>
<li>	#数据库连接</li>
<li>&nbsp;&nbsp; &nbsp;public function Connect( $argvs )</li>
<li>	{</li>
<li>		$this-&gt;handle = @sqlite_open( $argvs['hostname'].'/'.$argvs['datebase'] , $argvs['mode'] , $sqliteerror );</li>
<li>		if(!$this-&gt;handle)</li>
<li>		{</li>
<li>			die(&quot;Can't connect to the datebase &quot;.$argvs['datebase']);</li>
<li>		}</li>
<li>		$this-&gt;exetime = 0;</li>
<li>	}</li>
<li>	#使用数据库</li>
<li>	public function selectDateBase( $datebase )</li>
<li>	{</li>
<li>		#此方法无用</li>
<li>		return true;</li>
<li>	}</li>
<li>	#执行一个查询</li>
<li>	public function query( $sql )</li>
<li>	{</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;#echo $sql;</li>
<li>		$this-&gt;query = sqlite_query( $sql , $this-&gt;handle ) or die(&quot;query error&quot;.sqlite_last_error( $this-&gt;handle ));</li>
<li>		$this-&gt;exetime++;</li>
<li>		return true;</li>
<li>	}</li>
<li>	#取得一行</li>
<li>	public function fetch( $sql )</li>
<li>	{</li>
<li>		$this-&gt;query( $sql );</li>
<li>		while( $row = mysql_fetch_array( $this-&gt;query, MYSQL_ASSOC ) )</li>
<li>		{</li>
<li>			return $row;</li>
<li>	&nbsp; &nbsp; }</li>
<li>		return false;</li>
<li>	}</li>
<li>	#取得所有</li>
<li>	public function fetchAll( $sql )</li>
<li>	{</li>
<li>		$this-&gt;query( $sql );</li>
<li>		return sqlite_fetch_all( $this-&gt;query );</li>
<li>	}</li>
<li>	#取得影响行数</li>
<li>	public function affectedRow()</li>
<li>	{</li>
<li>		return true;</li>
<li>	}</li>
<li>	#取得结果行数</li>
<li>	public function recordCount()</li>
<li>	{</li>
<li>		return sqlite_num_rows( $this-&gt;query );</li>
<li>	}</li>
<li>	#取得上次插入ID</li>
<li>	public function insertID()</li>
<li>	{</li>
<li>		return false;</li>
<li>	}</li>
<li>	#释放资源</li>
<li>	public function close()</li>
<li>	{</li>
<li>		unset( $this-&gt;handle );</li>
<li>	}</li>
<li>	#析构函数</li>
<li>	/*</li>
<li>	function __destruct()</li>
<li>	{</li>
<li>		$this-&gt;close();</li>
<li>	}</li>
<li>	*/</li>
<li>}</li>
<li>?&gt;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/03/07/sqlite%e7%89%9b%e5%88%80%e5%b0%8f%e8%af%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>给代码打上版本号</title>
		<link>http://www.sunboyu.cn/2009/03/03/%e7%bb%99%e4%bb%a3%e7%a0%81%e6%89%93%e4%b8%8a%e7%89%88%e6%9c%ac%e5%8f%b7.shtml</link>
		<comments>http://www.sunboyu.cn/2009/03/03/%e7%bb%99%e4%bb%a3%e7%a0%81%e6%89%93%e4%b8%8a%e7%89%88%e6%9c%ac%e5%8f%b7.shtml#comments</comments>
		<pubDate>Tue, 03 Mar 2009 15:55:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[版本]]></category>

		<category><![CDATA[耦合]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=591</guid>
		<description><![CDATA[这个版本号，当然不是svn的版本号。
写程序再多，很多情况还是考虑不清楚。有时候代码耦合度并不能合理权衡，一旦升级某项功能，大改一下也是难免。但大换血式的更改代码是很忌讳的，尤其是运行很稳定的程序。
迫不得已，流程要修改，而且可能是截断了某个流程，创建分支，这时候，如果有一个版本的控制，那只需要更新特定的版本文件，即可实现无缝升级。当然，如果不稳定，可以迅速实现代码版本的回滚。
不过这种情况要求程序模块松散耦合，当你有紧耦合代码需要调整的时候，可以享受版本切换带来的享受。
]]></description>
			<content:encoded><![CDATA[<p>这个版本号，当然不是svn的版本号。</p>
<p>写程序再多，很多情况还是考虑不清楚。有时候代码耦合度并不能合理权衡，一旦升级某项功能，大改一下也是难免。但大换血式的更改代码是很忌讳的，尤其是运行很稳定的程序。</p>
<p>迫不得已，流程要修改，而且可能是截断了某个流程，创建分支，这时候，如果有一个版本的控制，那只需要更新特定的版本文件，即可实现无缝升级。当然，如果不稳定，可以迅速实现代码版本的回滚。</p>
<p>不过这种情况要求程序模块松散耦合，当你有紧耦合代码需要调整的时候，可以享受版本切换带来的享受。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/03/03/%e7%bb%99%e4%bb%a3%e7%a0%81%e6%89%93%e4%b8%8a%e7%89%88%e6%9c%ac%e5%8f%b7.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>重写框架</title>
		<link>http://www.sunboyu.cn/2009/03/01/%e9%87%8d%e5%86%99%e6%a1%86%e6%9e%b6.shtml</link>
		<comments>http://www.sunboyu.cn/2009/03/01/%e9%87%8d%e5%86%99%e6%a1%86%e6%9e%b6.shtml#comments</comments>
		<pubDate>Sun, 01 Mar 2009 04:06:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[框架]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=585</guid>
		<description><![CDATA[其实我有两个框架，一个是比较简单的框架，适用于多人生产，只是拿出了框架的一些基本特性，便于由程序员自由发挥，又不缺乏一个基本的规则。
另一个是cakephp的“高仿版”，虽然是一个完整的框架，但学习成本高，另外扼杀了程序员的天性，所以，不再更新。
这次更新的是第一个框架，因为投入了生产，暴露了很多问题，这次的目标，首先是一个完善的框架系统，另外继承很多的应用实例。
另外一些LAMP应用脚本也会适当集成，当然得是拥有root的人才能使用这些功能。
主框架依然是PHP类库，路由，JS库（考虑是否集成JQUERY）
]]></description>
			<content:encoded><![CDATA[<p>其实我有两个框架，一个是比较简单的框架，适用于多人生产，只是拿出了框架的一些基本特性，便于由程序员自由发挥，又不缺乏一个基本的规则。</p>
<p>另一个是cakephp的“高仿版”，虽然是一个完整的框架，但学习成本高，另外扼杀了程序员的天性，所以，不再更新。</p>
<p>这次更新的是第一个框架，因为投入了生产，暴露了很多问题，这次的目标，首先是一个完善的框架系统，另外继承很多的应用实例。</p>
<p>另外一些LAMP应用脚本也会适当集成，当然得是拥有root的人才能使用这些功能。</p>
<p>主框架依然是PHP类库，路由，JS库（考虑是否集成JQUERY）</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/03/01/%e9%87%8d%e5%86%99%e6%a1%86%e6%9e%b6.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>使用PYTHON小提apache下的PHP执行权限</title>
		<link>http://www.sunboyu.cn/2009/02/28/%e4%bd%bf%e7%94%a8python%e5%b0%8f%e6%8f%90apache%e4%b8%8b%e7%9a%84php%e6%89%a7%e8%a1%8c%e6%9d%83%e9%99%90.shtml</link>
		<comments>http://www.sunboyu.cn/2009/02/28/%e4%bd%bf%e7%94%a8python%e5%b0%8f%e6%8f%90apache%e4%b8%8b%e7%9a%84php%e6%89%a7%e8%a1%8c%e6%9d%83%e9%99%90.shtml#comments</comments>
		<pubDate>Sat, 28 Feb 2009 15:15:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=583</guid>
		<description><![CDATA[绕了个圈，权限彻底上去了，中间用socket通讯方式解决。
代码暂时还不安全，等拿出安全的方案后公布
]]></description>
			<content:encoded><![CDATA[<p>绕了个圈，权限彻底上去了，中间用socket通讯方式解决。<br />
代码暂时还不安全，等拿出安全的方案后公布</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/02/28/%e4%bd%bf%e7%94%a8python%e5%b0%8f%e6%8f%90apache%e4%b8%8b%e7%9a%84php%e6%89%a7%e8%a1%8c%e6%9d%83%e9%99%90.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>AS4中jdk的配置问题</title>
		<link>http://www.sunboyu.cn/2009/02/24/as4%e4%b8%adjdk%e7%9a%84%e9%85%8d%e7%bd%ae%e9%97%ae%e9%a2%98.shtml</link>
		<comments>http://www.sunboyu.cn/2009/02/24/as4%e4%b8%adjdk%e7%9a%84%e9%85%8d%e7%bd%ae%e9%97%ae%e9%a2%98.shtml#comments</comments>
		<pubDate>Tue, 24 Feb 2009 06:10:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[as4]]></category>

		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=581</guid>
		<description><![CDATA[AS4中默认安装了jdk1.3.×
在安装jdk1.6.0后，设置了环境变量，可默认还是显示java1.3.×
后发现，在/usr/bin 下有java这个文件，默认关联的是1.3的，删除掉后，发现一切正常
]]></description>
			<content:encoded><![CDATA[<p>AS4中默认安装了jdk1.3.×<br />
在安装jdk1.6.0后，设置了环境变量，可默认还是显示java1.3.×<br />
后发现，在/usr/bin 下有java这个文件，默认关联的是1.3的，删除掉后，发现一切正常</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/02/24/as4%e4%b8%adjdk%e7%9a%84%e9%85%8d%e7%bd%ae%e9%97%ae%e9%a2%98.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>购买新书两本</title>
		<link>http://www.sunboyu.cn/2009/02/22/%e8%b4%ad%e4%b9%b0%e6%96%b0%e4%b9%a6%e4%b8%a4%e6%9c%ac.shtml</link>
		<comments>http://www.sunboyu.cn/2009/02/22/%e8%b4%ad%e4%b9%b0%e6%96%b0%e4%b9%a6%e4%b8%a4%e6%9c%ac.shtml#comments</comments>
		<pubDate>Sun, 22 Feb 2009 12:02:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[linux系统安全]]></category>

		<category><![CDATA[密码传奇]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=575</guid>
		<description><![CDATA[http://www.douban.com/subject/2171797/

http://www.douban.com/subject/3024665/

]]></description>
			<content:encoded><![CDATA[<p>http://www.douban.com/subject/2171797/</p>
<p><a href="http://www.sunboyu.cn/upfiles/2009/02/s3069021.jpg"><img src="http://www.sunboyu.cn/upfiles/2009/02/s3069021.jpg" alt="s3069021" title="s3069021" width="102" height="145" class="aligncenter size-full wp-image-576" /></a></p>
<p>http://www.douban.com/subject/3024665/</p>
<p><a href="http://www.sunboyu.cn/upfiles/2009/02/s30690211.jpg"><img src="http://www.sunboyu.cn/upfiles/2009/02/s30690211.jpg" alt="s30690211" title="s30690211" width="200" height="285" class="aligncenter size-full wp-image-577" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/02/22/%e8%b4%ad%e4%b9%b0%e6%96%b0%e4%b9%a6%e4%b8%a4%e6%9c%ac.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Python编译参数</title>
		<link>http://www.sunboyu.cn/2009/02/21/python%e7%bc%96%e8%af%91%e5%8f%82%e6%95%b0.shtml</link>
		<comments>http://www.sunboyu.cn/2009/02/21/python%e7%bc%96%e8%af%91%e5%8f%82%e6%95%b0.shtml#comments</comments>
		<pubDate>Sat, 21 Feb 2009 15:38:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<category><![CDATA[mod_python]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=573</guid>
		<description><![CDATA[python2.6.1和mod_python的编译参数
#python编译参数
./configure --prefix=/opt/python-2.6.1 \
--enable-shared \
--enable-profiling \
--with-gcc \
--with-pydebug \
--with-system-ffi \
--with-signal-module \
--with-dec-threads \
--with-threads \
--with-thread \
--with-pth \
--with-doc-strings \
--with-tsc \
--with-pymalloc \
--with-fpectl
&#160;
#python_mod编译参数
./configure --with-apxs=/opt/httpd-2.2.9 \
--with-python=/opt/python-2.6.1
]]></description>
			<content:encoded><![CDATA[<p>python2.6.1和mod_python的编译参数</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">#python编译参数</li>
<li>./configure --prefix=/opt/python-2.6.1 \</li>
<li>--enable-shared \</li>
<li>--enable-profiling \</li>
<li>--with-gcc \</li>
<li>--with-pydebug \</li>
<li>--with-system-ffi \</li>
<li>--with-signal-module \</li>
<li>--with-dec-threads \</li>
<li>--with-threads \</li>
<li>--with-thread \</li>
<li>--with-pth \</li>
<li>--with-doc-strings \</li>
<li>--with-tsc \</li>
<li>--with-pymalloc \</li>
<li>--with-fpectl</li>
<li>&nbsp;</li>
<li>#python_mod编译参数</li>
<li>./configure --with-apxs=/opt/httpd-2.2.9 \</li>
<li>--with-python=/opt/python-2.6.1</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/02/21/python%e7%bc%96%e8%af%91%e5%8f%82%e6%95%b0.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>值得程序员们看的一段对话</title>
		<link>http://www.sunboyu.cn/2009/02/16/%e5%80%bc%e5%be%97%e7%a8%8b%e5%ba%8f%e5%91%98%e4%bb%ac%e7%9c%8b%e7%9a%84%e4%b8%80%e6%ae%b5%e5%af%b9%e8%af%9d.shtml</link>
		<comments>http://www.sunboyu.cn/2009/02/16/%e5%80%bc%e5%be%97%e7%a8%8b%e5%ba%8f%e5%91%98%e4%bb%ac%e7%9c%8b%e7%9a%84%e4%b8%80%e6%ae%b5%e5%af%b9%e8%af%9d.shtml#comments</comments>
		<pubDate>Mon, 16 Feb 2009 14:29:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[对话]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=571</guid>
		<description><![CDATA[新年期许
三炮 
今天晚上和七夜吃饭去了，吃饭的时候聊到了程序员年龄的问题，回来的路上聊到了如何奔小康的问题。
三德子27了，已经开始因为年龄的缘故在做程序员这个问题上开始上下摇晃了，因为在中国，程序员就是苦力，是年轻而且精力智力好的人做的，可在我的眼里，三德子经验老到，丰富，很喜欢听三德子讲东西。
再过两年我也得27了，看着身边圈子里的一个个朋友有的有所成了，有的碌碌无为混到了大龄阶层。我觉得自己现在正在站在这个人生的分岔路上，如果再不加把劲，就危险了。
想起了长辰科技解散的时候邹总说过的话：“希望你们大家离开长辰科技，能做到一件事，每天看半小时的书，我的要求不高，就半小时，半年后，你们谁做到了，发短信告诉我！我相信你们不一定都能做到，单我希望你们能够做到！”，想起这句话至今感动着我，鼓舞着我。
    在2009年这一年，我要放下心中的包袱，愉快的上路，不再压抑，沉重，在2010年的时候，踏上一个更高的台阶！
孙小贰
我跟三德子一样，都是大龄程序员了，压力只能在有压力的地方获得。
我在朗玛9个月，每天看书半小时，我做到了(经常是半天)。
每天写程序，去做调试，我做到了。
经常写一些新鲜东西，我做到了。
每天写东西，后来做不到了，因为研究的东西深了，不是一天两天了。
但我有点崩溃了，虽然得到了一些东西，但也失去了一些东西。
我从有压力的地方走出来，希望能平衡自己的生活，真正去做适合自己的事情。 
三炮:相信你的这段辛苦的日子是值得的，我正在踏着你们老一辈做过的路迷茫的前行 删除
]]></description>
			<content:encoded><![CDATA[<p>新年期许</p>
<p>三炮 </p>
<p>今天晚上和七夜吃饭去了，吃饭的时候聊到了程序员年龄的问题，回来的路上聊到了如何奔小康的问题。<br />
三德子27了，已经开始因为年龄的缘故在做程序员这个问题上开始上下摇晃了，因为在中国，程序员就是苦力，是年轻而且精力智力好的人做的，可在我的眼里，三德子经验老到，丰富，很喜欢听三德子讲东西。<br />
再过两年我也得27了，看着身边圈子里的一个个朋友有的有所成了，有的碌碌无为混到了大龄阶层。我觉得自己现在正在站在这个人生的分岔路上，如果再不加把劲，就危险了。<br />
想起了长辰科技解散的时候邹总说过的话：“希望你们大家离开长辰科技，能做到一件事，每天看半小时的书，我的要求不高，就半小时，半年后，你们谁做到了，发短信告诉我！我相信你们不一定都能做到，单我希望你们能够做到！”，想起这句话至今感动着我，鼓舞着我。<br />
    在2009年这一年，我要放下心中的包袱，愉快的上路，不再压抑，沉重，在2010年的时候，踏上一个更高的台阶！</p>
<p>孙小贰</p>
<p>我跟三德子一样，都是大龄程序员了，压力只能在有压力的地方获得。<br />
我在朗玛9个月，每天看书半小时，我做到了(经常是半天)。<br />
每天写程序，去做调试，我做到了。<br />
经常写一些新鲜东西，我做到了。<br />
每天写东西，后来做不到了，因为研究的东西深了，不是一天两天了。<br />
但我有点崩溃了，虽然得到了一些东西，但也失去了一些东西。<br />
我从有压力的地方走出来，希望能平衡自己的生活，真正去做适合自己的事情。 </p>
<p>三炮:相信你的这段辛苦的日子是值得的，我正在踏着你们老一辈做过的路迷茫的前行 删除</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/02/16/%e5%80%bc%e5%be%97%e7%a8%8b%e5%ba%8f%e5%91%98%e4%bb%ac%e7%9c%8b%e7%9a%84%e4%b8%80%e6%ae%b5%e5%af%b9%e8%af%9d.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>mysql索引优化</title>
		<link>http://www.sunboyu.cn/2009/02/15/mysql%e7%b4%a2%e5%bc%95%e4%bc%98%e5%8c%96.shtml</link>
		<comments>http://www.sunboyu.cn/2009/02/15/mysql%e7%b4%a2%e5%bc%95%e4%bc%98%e5%8c%96.shtml#comments</comments>
		<pubDate>Sun, 15 Feb 2009 06:01:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[优化]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=568</guid>
		<description><![CDATA[做复杂的数据报表经常要很多sql语句连续执行，不是超时就是把mysql跑挂。不过现在硬件廉价，这些软件完美得兼容了多核多线程，虽然一个mysql进程负载高，但只占用一个内核，其他的查询依然可以使用其他的内核进行运算，服务器不会整体挂掉。
mysql优化，主要是索引，大量消耗资源的查询一定要做相关索引优化，具体优化思想我是阅读的这本书－http://www.douban.com/subject/3039216/ 里边mysql优化部分讲得非常简洁明了。而对于cpu的优化，就是尽力把整体时间拉开，cpu会比较平稳。具体做法是用sleep把sql语句分隔，这样用时间换取了稳定。当然，有些报表数据一旦作出就不会再变，这时最好把这些数据文本缓存，以后查询只读取文本即可。
]]></description>
			<content:encoded><![CDATA[<p>做复杂的数据报表经常要很多sql语句连续执行，不是超时就是把mysql跑挂。不过现在硬件廉价，这些软件完美得兼容了多核多线程，虽然一个mysql进程负载高，但只占用一个内核，其他的查询依然可以使用其他的内核进行运算，服务器不会整体挂掉。</p>
<p>mysql优化，主要是索引，大量消耗资源的查询一定要做相关索引优化，具体优化思想我是阅读的这本书－http://www.douban.com/subject/3039216/ 里边mysql优化部分讲得非常简洁明了。而对于cpu的优化，就是尽力把整体时间拉开，cpu会比较平稳。具体做法是用sleep把sql语句分隔，这样用时间换取了稳定。当然，有些报表数据一旦作出就不会再变，这时最好把这些数据文本缓存，以后查询只读取文本即可。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/02/15/mysql%e7%b4%a2%e5%bc%95%e4%bc%98%e5%8c%96.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>centos折腾记录</title>
		<link>http://www.sunboyu.cn/2009/02/10/centos%e6%8a%98%e8%85%be%e8%ae%b0%e5%bd%95.shtml</link>
		<comments>http://www.sunboyu.cn/2009/02/10/centos%e6%8a%98%e8%85%be%e8%ae%b0%e5%bd%95.shtml#comments</comments>
		<pubDate>Tue, 10 Feb 2009 03:47:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=561</guid>
		<description><![CDATA[安装gmone图形界面
yum &#8211;exclude=nautilus-sendto groupinstall gnome-desktop
安装vnc
yum install vnc
vncserver start
vi xstartup
#xterm -geometry 80&#215;24+10+10 -ls -title &#8220;$VNCDESKTOP Desktop&#8221; &#038;
gnome-session
就OK了
安装中文-得给不会命令行的大哥们用
yum groupinstall &#8220;Chinese Support&#8221;
另外编辑/etc/sysconfig/i18n成下面这个样子：
LANG=&#8221;zh_CN.GB18030&#8243;
SUPPORTED=&#8221;zh_CN.GB18030:zh_CN:zh:zh_TW.Big5:zh_TW:zh:en_US.iso885915:en_US:en&#8221;
SYSFONT=&#8221;lat0-sun16&#8243;
SYSFONTACM=&#8221;iso15&#8243;
reboot
另外，我想centos4.7直接yum成centos5.2，暂时不折腾
]]></description>
			<content:encoded><![CDATA[<p>安装gmone图形界面</p>
<p>yum &#8211;exclude=nautilus-sendto groupinstall gnome-desktop</p>
<p>安装vnc</p>
<p>yum install vnc</p>
<p>vncserver start</p>
<p>vi xstartup<br />
#xterm -geometry 80&#215;24+10+10 -ls -title &#8220;$VNCDESKTOP Desktop&#8221; &#038;<br />
gnome-session</p>
<p>就OK了</p>
<p>安装中文-得给不会命令行的大哥们用</p>
<p>yum groupinstall &#8220;Chinese Support&#8221;</p>
<p>另外编辑/etc/sysconfig/i18n成下面这个样子：<br />
LANG=&#8221;zh_CN.GB18030&#8243;<br />
SUPPORTED=&#8221;zh_CN.GB18030:zh_CN:zh:zh_TW.Big5:zh_TW:zh:en_US.iso885915:en_US:en&#8221;<br />
SYSFONT=&#8221;lat0-sun16&#8243;<br />
SYSFONTACM=&#8221;iso15&#8243;</p>
<p>reboot</p>
<p>另外，我想centos4.7直接yum成centos5.2，暂时不折腾</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/02/10/centos%e6%8a%98%e8%85%be%e8%ae%b0%e5%bd%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>nagios学习笔记－安装篇</title>
		<link>http://www.sunboyu.cn/2009/02/04/nagios%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%8d%e5%ae%89%e8%a3%85%e7%af%87.shtml</link>
		<comments>http://www.sunboyu.cn/2009/02/04/nagios%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%8d%e5%ae%89%e8%a3%85%e7%af%87.shtml#comments</comments>
		<pubDate>Wed, 04 Feb 2009 09:49:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[nagios]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=554</guid>
		<description><![CDATA[服务器和网络总搞的人疲惫，有不少商用的服务器监视工具，但价格都太贵，自己写，太费劲，而且要监控的服务也很多，不近要监控可用性，还要监控性能。
后在CU论坛看到nagios功能强大，尝试安装了一下。
首先到 http://www.nagios.org/ 下载 nagios-3.0.6.tar.gz  nagios-plugins-1.4.13.tar.gz  两个程序，两个必须安装，否则不工作。
nagios主程序安装非常简单，暂时没有看configure参数，直接加了个 &#8211;prefix就OK了。那个plugins也一样，但nagios主程序在configure &#8211;prefix &#038;&#038; make all &#038;&#038; make install 之后,还要运行 make install-commandmode &#038;&#038; make install-config &#038;&#038; make install-init &#038;&#038; make install-webconf  但是最后一个 make install-webconf 可能会报错，无法找到apache配置文件目录，手工拷贝 nagios.conf 到apache配置文件目录，在主配置文件引用就可以了。
这样安装就完成了，可以访问 localhost/nagios
但没有配置，无法完成监控报表的功能，因为刚学习，也没找到中文文档，待研究后继续……
]]></description>
			<content:encoded><![CDATA[<p>服务器和网络总搞的人疲惫，有不少商用的服务器监视工具，但价格都太贵，自己写，太费劲，而且要监控的服务也很多，不近要监控可用性，还要监控性能。</p>
<p>后在CU论坛看到nagios功能强大，尝试安装了一下。</p>
<p>首先到 http://www.nagios.org/ 下载 nagios-3.0.6.tar.gz  nagios-plugins-1.4.13.tar.gz  两个程序，两个必须安装，否则不工作。</p>
<p>nagios主程序安装非常简单，暂时没有看configure参数，直接加了个 &#8211;prefix就OK了。那个plugins也一样，但nagios主程序在configure &#8211;prefix &#038;&#038; make all &#038;&#038; make install 之后,还要运行 make install-commandmode &#038;&#038; make install-config &#038;&#038; make install-init &#038;&#038; make install-webconf  但是最后一个 make install-webconf 可能会报错，无法找到apache配置文件目录，手工拷贝 nagios.conf 到apache配置文件目录，在主配置文件引用就可以了。</p>
<p>这样安装就完成了，可以访问 localhost/nagios</p>
<p>但没有配置，无法完成监控报表的功能，因为刚学习，也没找到中文文档，待研究后继续……</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/02/04/nagios%e5%ad%a6%e4%b9%a0%e7%ac%94%e8%ae%b0%ef%bc%8d%e5%ae%89%e8%a3%85%e7%af%87.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>使用APACHE代理功能加速网通电信互联收看《丑女无敌》</title>
		<link>http://www.sunboyu.cn/2009/02/02/%e4%bd%bf%e7%94%a8apache%e4%bb%a3%e7%90%86%e5%8a%9f%e8%83%bd%e5%8a%a0%e9%80%9f%e7%bd%91%e9%80%9a%e7%94%b5%e4%bf%a1%e4%ba%92%e8%81%94%e6%94%b6%e7%9c%8b%e3%80%8a%e4%b8%91%e5%a5%b3%e6%97%a0%e6%95%8c.shtml</link>
		<comments>http://www.sunboyu.cn/2009/02/02/%e4%bd%bf%e7%94%a8apache%e4%bb%a3%e7%90%86%e5%8a%9f%e8%83%bd%e5%8a%a0%e9%80%9f%e7%bd%91%e9%80%9a%e7%94%b5%e4%bf%a1%e4%ba%92%e8%81%94%e6%94%b6%e7%9c%8b%e3%80%8a%e4%b8%91%e5%a5%b3%e6%97%a0%e6%95%8c.shtml#comments</comments>
		<pubDate>Mon, 02 Feb 2009 15:26:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[proxy]]></category>

		<category><![CDATA[丑女无敌]]></category>

		<category><![CDATA[代理]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=550</guid>
		<description><![CDATA[内人要看金鹰网的《丑女无敌》，无奈其服务器为电信线路，我们北京网通线路浏览非常慢，肉眼就能看见侦数。
起初想做个vpn，登陆到服务器上，走电信网关，但linux在配置vpn时候内核编译死活不能成功，暂时放弃这个计划，想其他方法。
本以为web播放走流媒体的相关协议，后尝试使用流媒体下载工具，始终没能把文件扒下来，后被逼急，又想入侵其服务器。
扫描了端口，发现其服务器只开21 80端口了，非常诡异，正常的流媒体不走这两个端口的，后抓包发现，web播放器中请求服务器其实是走的HTTP协议
GET /HttpServer/jinying/电视剧下载/丑女无敌第二季/第四集.wmv?SessionID=75440406108580700-17&#38;ServerIP=222.246.135.168&#38;ServiceType=1&#38;ContentID=6754 HTTP/1.1
Host:222.246.135.168
Accept:*/*
User-Agent:Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)
Connection:close
Range:bytes=5444743-5969030&#160; &#160; &#160; &#160; &#160;#524287
ConnectId:22455
CheckTag:34275a1d57f84c60b5ccf8519cad6908
UserAgent:PowerStream 1.0.5.5507
页面每隔一段时间去请求一段数据，然后浏览器中的播放器去处理这些数据，转换为影音。
既然是走http，那可以直接用apache做一个代理，我直接把本地的http请求通过亦庄网通的服务器转发，而亦庄虽然是网通机房，但访问电信的速度确比我高的多，这样就实现了网通高速收看电信的节目。
虽然稍卡（码率比较大），但基本达到了顺利观看的水平。
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2009/02/e4b891e5a5b3e697a0e6958ce7acac2e5ada3-1.jpg"><img src="http://www.sunboyu.cn/upfiles/2009/02/e4b891e5a5b3e697a0e6958ce7acac2e5ada3-1.jpg" alt="e4b891e5a5b3e697a0e6958ce7acac2e5ada3-1" title="e4b891e5a5b3e697a0e6958ce7acac2e5ada3-1" width="264" height="198" class="aligncenter size-full wp-image-552" /></a>内人要看金鹰网的《丑女无敌》，无奈其服务器为电信线路，我们北京网通线路浏览非常慢，肉眼就能看见侦数。</p>
<p>起初想做个vpn，登陆到服务器上，走电信网关，但linux在配置vpn时候内核编译死活不能成功，暂时放弃这个计划，想其他方法。</p>
<p>本以为web播放走流媒体的相关协议，后尝试使用流媒体下载工具，始终没能把文件扒下来，后被逼急，又想入侵其服务器。</p>
<p>扫描了端口，发现其服务器只开21 80端口了，非常诡异，正常的流媒体不走这两个端口的，后抓包发现，web播放器中请求服务器其实是走的HTTP协议</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">GET /HttpServer/jinying/电视剧下载/丑女无敌第二季/第四集.wmv?SessionID=75440406108580700-17&amp;ServerIP=222.246.135.168&amp;ServiceType=1&amp;ContentID=6754 HTTP/1.1</li>
<li>Host:222.246.135.168</li>
<li>Accept:*/*</li>
<li>User-Agent:Mozilla/4.0 (compatible; MSIE 5.00; Windows 98)</li>
<li>Connection:close</li>
<li>Range:bytes=5444743-5969030&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#524287</li>
<li>ConnectId:22455</li>
<li>CheckTag:34275a1d57f84c60b5ccf8519cad6908</li>
<li>UserAgent:PowerStream 1.0.5.5507</li></ol></div>
<p>页面每隔一段时间去请求一段数据，然后浏览器中的播放器去处理这些数据，转换为影音。</p>
<p>既然是走http，那可以直接用apache做一个代理，我直接把本地的http请求通过亦庄网通的服务器转发，而亦庄虽然是网通机房，但访问电信的速度确比我高的多，这样就实现了网通高速收看电信的节目。</p>
<p>虽然稍卡（码率比较大），但基本达到了顺利观看的水平。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/02/02/%e4%bd%bf%e7%94%a8apache%e4%bb%a3%e7%90%86%e5%8a%9f%e8%83%bd%e5%8a%a0%e9%80%9f%e7%bd%91%e9%80%9a%e7%94%b5%e4%bf%a1%e4%ba%92%e8%81%94%e6%94%b6%e7%9c%8b%e3%80%8a%e4%b8%91%e5%a5%b3%e6%97%a0%e6%95%8c.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>发现问题，PHP中时间的一些细节</title>
		<link>http://www.sunboyu.cn/2009/02/01/%e5%8f%91%e7%8e%b0%e9%97%ae%e9%a2%98%ef%bc%8cphp%e4%b8%ad%e6%97%b6%e9%97%b4%e7%9a%84%e4%b8%80%e4%ba%9b%e7%bb%86%e8%8a%82.shtml</link>
		<comments>http://www.sunboyu.cn/2009/02/01/%e5%8f%91%e7%8e%b0%e9%97%ae%e9%a2%98%ef%bc%8cphp%e4%b8%ad%e6%97%b6%e9%97%b4%e7%9a%84%e4%b8%80%e4%ba%9b%e7%bb%86%e8%8a%82.shtml#comments</comments>
		<pubDate>Sun, 01 Feb 2009 13:53:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[date]]></category>

		<category><![CDATA[time]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=548</guid>
		<description><![CDATA[php中，时间戳和date取得的时间是不同的。
时间戳是时间段，不受时区影响，无论哪个时区，取得都是格林威治的时间段。
date，是取得的系统时间，也就是加了时区的。
为了保持一致，php的头文件应该首先声明时区。
犯个错误，还得导数据库……
]]></description>
			<content:encoded><![CDATA[<p>php中，时间戳和date取得的时间是不同的。</p>
<p>时间戳是时间段，不受时区影响，无论哪个时区，取得都是格林威治的时间段。</p>
<p>date，是取得的系统时间，也就是加了时区的。</p>
<p>为了保持一致，php的头文件应该首先声明时区。</p>
<p>犯个错误，还得导数据库……</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/02/01/%e5%8f%91%e7%8e%b0%e9%97%ae%e9%a2%98%ef%bc%8cphp%e4%b8%ad%e6%97%b6%e9%97%b4%e7%9a%84%e4%b8%80%e4%ba%9b%e7%bb%86%e8%8a%82.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Linux时间同步大法</title>
		<link>http://www.sunboyu.cn/2009/02/01/linux%e6%97%b6%e9%97%b4%e5%90%8c%e6%ad%a5%e5%a4%a7%e6%b3%95.shtml</link>
		<comments>http://www.sunboyu.cn/2009/02/01/linux%e6%97%b6%e9%97%b4%e5%90%8c%e6%ad%a5%e5%a4%a7%e6%b3%95.shtml#comments</comments>
		<pubDate>Sun, 01 Feb 2009 04:11:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[rdate]]></category>

		<category><![CDATA[时间同步]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=546</guid>
		<description><![CDATA[linux时间不同步，很郁闷，装了个ntp之类的东西，还是不好使
其实使用rdate就可以，但死活不成功。
又考虑，时间协议也许不是走80端口，查看/etc/service 果然，service iptables stop, 重新运行
rdate -s time.nist.gov
果然同步成功。
本机设置为上海时间，一切OK。
]]></description>
			<content:encoded><![CDATA[<p>linux时间不同步，很郁闷，装了个ntp之类的东西，还是不好使</p>
<p>其实使用rdate就可以，但死活不成功。</p>
<p>又考虑，时间协议也许不是走80端口，查看/etc/service 果然，service iptables stop, 重新运行</p>
<p>rdate -s time.nist.gov</p>
<p>果然同步成功。</p>
<p>本机设置为上海时间，一切OK。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/02/01/linux%e6%97%b6%e9%97%b4%e5%90%8c%e6%ad%a5%e5%a4%a7%e6%b3%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>我们应该信任谁</title>
		<link>http://www.sunboyu.cn/2009/01/22/%e6%88%91%e4%bb%ac%e5%ba%94%e8%af%a5%e4%bf%a1%e4%bb%bb%e8%b0%81.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/22/%e6%88%91%e4%bb%ac%e5%ba%94%e8%af%a5%e4%bf%a1%e4%bb%bb%e8%b0%81.shtml#comments</comments>
		<pubDate>Thu, 22 Jan 2009 03:03:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[带宽]]></category>

		<category><![CDATA[链路]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=514</guid>
		<description><![CDATA[最近几个服务器频频出事，虽然不是自己的服务器，经验还是值得学习的。
在做高可靠性方案的时候，我们应该信任谁，是个问题。
首先是域名。一般域名都是委托给idc，或者专业做dns的，作为网站的入口，交给他们就等于绝对的信任他们，没有备份方案。如果带有些许的不信任，可以设置备用dns为自己的dns服务器。dns一般没太大的问题，但一旦有问题就是大问题，万网新网好像都发生过dns服务器大规模故障，全国各地大面积瘫痪，不能不说，对域名的信任存在问题。
链路，说到链路，这是个大问题，也许也包含了域名的问题。
从dns，网关，路由，响应，各个节点负载，都需要经过详细测试。
一般销售推销带宽，只是简单让测试ping值，但实际是不科学的，因为在用的时候，我选择的带宽ping值的确很好，但实际应用效果缺不理想，没有那个系统是靠ping值来保障的，域名服务器，网关速度，交换，路由的处理能力都是硬指标。很多服务器ping值好，但数据一流起来可就没那么好了。承诺给你大的带宽，可带宽要局限在一个固定的环境中，无异于局域网应用。
我们需要的是优秀的广域网应用，所以，最好的测试还是把服务架上，实际去跑一阵应用服务，才能最终确定带宽和链路的质量。
中间跳了很多环境，涉及了宽带提供商，运营商，代理，现场技术，用户等很多环节，保证每个环境的通路才是最终的通路。任何一个环节都可能成为瓶颈和以后应用的隐患。
但在中国的网络环境中，我们应该信任谁？
]]></description>
			<content:encoded><![CDATA[<p>最近几个服务器频频出事，虽然不是自己的服务器，经验还是值得学习的。</p>
<p>在做高可靠性方案的时候，我们应该信任谁，是个问题。</p>
<p>首先是域名。一般域名都是委托给idc，或者专业做dns的，作为网站的入口，交给他们就等于绝对的信任他们，没有备份方案。如果带有些许的不信任，可以设置备用dns为自己的dns服务器。dns一般没太大的问题，但一旦有问题就是大问题，万网新网好像都发生过dns服务器大规模故障，全国各地大面积瘫痪，不能不说，对域名的信任存在问题。</p>
<p>链路，说到链路，这是个大问题，也许也包含了域名的问题。</p>
<p>从dns，网关，路由，响应，各个节点负载，都需要经过详细测试。</p>
<p>一般销售推销带宽，只是简单让测试ping值，但实际是不科学的，因为在用的时候，我选择的带宽ping值的确很好，但实际应用效果缺不理想，没有那个系统是靠ping值来保障的，域名服务器，网关速度，交换，路由的处理能力都是硬指标。很多服务器ping值好，但数据一流起来可就没那么好了。承诺给你大的带宽，可带宽要局限在一个固定的环境中，无异于局域网应用。</p>
<p>我们需要的是优秀的广域网应用，所以，最好的测试还是把服务架上，实际去跑一阵应用服务，才能最终确定带宽和链路的质量。</p>
<p>中间跳了很多环境，涉及了宽带提供商，运营商，代理，现场技术，用户等很多环节，保证每个环境的通路才是最终的通路。任何一个环节都可能成为瓶颈和以后应用的隐患。</p>
<p>但在中国的网络环境中，我们应该信任谁？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/22/%e6%88%91%e4%bb%ac%e5%ba%94%e8%af%a5%e4%bf%a1%e4%bb%bb%e8%b0%81.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>sunboyu-amp-fastcgi-suexec-v23-alpha</title>
		<link>http://www.sunboyu.cn/2009/01/21/sunboyu-amp-fastcgi-suexec-v23-alpha.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/21/sunboyu-amp-fastcgi-suexec-v23-alpha.shtml#comments</comments>
		<pubDate>Wed, 21 Jan 2009 03:10:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[amp]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=516</guid>
		<description><![CDATA[Linux下APACHE MYSQL PHP FCgid Suexec 自动安装脚本V2.3
1、补全了支持的字符集，默认为utf8
sunboyu-amp-fastcgi-suexec-v23-alpha
]]></description>
			<content:encoded><![CDATA[<p>Linux下APACHE MYSQL PHP FCgid Suexec 自动安装脚本V2.3</p>
<p>1、补全了支持的字符集，默认为utf8</p>
<p><a href='http://www.sunboyu.cn/upfiles/2009/01/sunboyu-amp-fastcgi-suexec-v23-alpha.txt'>sunboyu-amp-fastcgi-suexec-v23-alpha</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/21/sunboyu-amp-fastcgi-suexec-v23-alpha.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>倒霉的网管</title>
		<link>http://www.sunboyu.cn/2009/01/19/%e5%80%92%e9%9c%89%e7%9a%84%e7%bd%91%e7%ae%a1.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/19/%e5%80%92%e9%9c%89%e7%9a%84%e7%bd%91%e7%ae%a1.shtml#comments</comments>
		<pubDate>Mon, 19 Jan 2009 12:40:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[故障]]></category>

		<category><![CDATA[网管]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=507</guid>
		<description><![CDATA[ping的通，连不上]]></description>
			<content:encoded><![CDATA[<p>该死的网管，昨天就发现网络不正常，没注意，以为是机房不稳定，可这种状态持续到了今天。话说这状态非常诡异，可以ping通，很快，偶尔也能应用一些服务，httpd，ftp，ssh，但有时候任何服务都中断，只是ping的通。</p>
<p>但是如果ssh一直保持会话，突然中断后，ssh还能顺利跟服务器通讯。</p>
<p>这可难坏了我这个牛叉的系统工程师和一个CCIE级大哥，我又发挥流氓黑客的精神，彻底扫描了服务器端口和一些数据包，发现几个疑点：</p>
<p>1、服务器通讯正常的时候，所有端口的包数据都是正常的，是我自己服务的标志。</p>
<p>2、服务器通讯异常的时候，服务端口有变，并且出现异常数据。</p>
<p>疯狂google后发现，有这么几个可能性：</p>
<p>1、dell的网卡驱动没有装好，会产生MAC地址跳跃（mac地址都是写在芯片里的，汗！）。</p>
<p>2、ip地址被盗用了。</p>
<p>第一条已经排除，下载dell网卡驱动后，重装后也正常。问题依然存在。</p>
<p>第二，我跟那边网管要了个新的ip，一切正常。</p>
<p>比较一下两个服务器的几个协议的头,上边是我的，下边是异常的</p>
<p>1、ftp</p>
<p>我牛叉的Pure-FTPd,mysql动态控制的</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">220---------- 欢迎来到 Pure-FTPd ----------</li>
<li>220-您是第 1 个使用者，最多可达 50 个连接</li>
<li>220-现在本地时间是 15:21。服务器端口： 21。</li>
<li>220-这部主机也欢迎IPv6的连接</li>
<li>220 在 15 分钟内没有活动，您被会断线。</li></ol></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">220 211.99.3.121 pSOSystem FTP server (NTL386/1.0.4) ready.</li></ol></div>
<p>他的其他端口<br />
特征码出来了，CTerminalSocket，google一下原来是作voip电话的服务器，逮着了，回头砸他服务器去！</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">Connect</li>
<li>Remote Command:</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;MCMS VERSION 7.5.0.173&nbsp; &nbsp;Operating System : PSOS</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;+</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 19/01/09 15:32:40:590 N</li>
<li>:0000133853 T:0c610000 L:10 S:0585d800 CTerminalSocket</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;****************&nbsp; &nbsp;EXCEPTI</li>
<li>ON&nbsp; *****************</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/19/%e5%80%92%e9%9c%89%e7%9a%84%e7%bd%91%e7%ae%a1.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>累……疯狂的配置</title>
		<link>http://www.sunboyu.cn/2009/01/18/%e7%b4%af%e2%80%a6%e2%80%a6%e7%96%af%e7%8b%82%e7%9a%84%e9%85%8d%e7%bd%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/18/%e7%b4%af%e2%80%a6%e2%80%a6%e7%96%af%e7%8b%82%e7%9a%84%e9%85%8d%e7%bd%ae.shtml#comments</comments>
		<pubDate>Sun, 18 Jan 2009 14:16:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[centos]]></category>

		<category><![CDATA[dell]]></category>

		<category><![CDATA[优化]]></category>

		<category><![CDATA[精简]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=503</guid>
		<description><![CDATA[Dell1950终于上架了，又一个牛叉的系统，我把CentOS精简到了我能想象到的极致（当然跟gentoo还不能媲美），在AMP(apache,php,mysql)都启动空负载的状态下，内存占用降到了128M以下。
top - 16:54:16 up&#160; 3:42,&#160; 1 user,&#160; load average: 0.00, 0.00, 0.00
Tasks:&#160; 83 total,&#160; &#160;1 running,&#160; 82 sleeping,&#160; &#160;0 stopped,&#160; &#160;0 zombie
Cpu(s):&#160; 0.0% us,&#160; 0.0% sy,&#160; 0.0% ni, 99.9% id,&#160; 0.1% wa,&#160; 0.0% hi,&#160; 0.0% si
Mem:&#160; &#160;4042344k total,&#160; &#160;125040k used,&#160; 3917304k free,&#160; &#160; 11136k buffers
Swap:&#160; 6094840k total,&#160; &#160; &#160; &#160; 0k used,&#160; 6094840k free,&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<p>Dell1950终于上架了，又一个牛叉的系统，我把CentOS精简到了我能想象到的极致（当然跟gentoo还不能媲美），在AMP(apache,php,mysql)都启动空负载的状态下，内存占用降到了128M以下。</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">top - 16:54:16 up&nbsp; 3:42,&nbsp; 1 user,&nbsp; load average: 0.00, 0.00, 0.00</li>
<li>Tasks:&nbsp; 83 total,&nbsp; &nbsp;1 running,&nbsp; 82 sleeping,&nbsp; &nbsp;0 stopped,&nbsp; &nbsp;0 zombie</li>
<li>Cpu(s):&nbsp; 0.0% us,&nbsp; 0.0% sy,&nbsp; 0.0% ni, 99.9% id,&nbsp; 0.1% wa,&nbsp; 0.0% hi,&nbsp; 0.0% si</li>
<li>Mem:&nbsp; &nbsp;4042344k total,&nbsp; &nbsp;125040k used,&nbsp; 3917304k free,&nbsp; &nbsp; 11136k buffers</li>
<li>Swap:&nbsp; 6094840k total,&nbsp; &nbsp; &nbsp; &nbsp; 0k used,&nbsp; 6094840k free,&nbsp; &nbsp; 47004k cached</li></ol></div>
<p>一些内核级补丁没有打，估计了解这类漏洞入侵的人，我暂时也招架不住，现在只是为了服务器的稳定。apache＋php＋mysql＋ftp＋ssh之类的账户权限作了详细的统筹，对外服务权限尤其作了限制，尽量达到最优。PHP是用developer模式进行编译安装，没有考虑实际应用，只是把功能尽量多的增加（这些操作会稍微影响性能，但相对128M，是可以忽略的），但很重要的opcode缓冲加上了，Centos用最小安装，以来的一些组件和库分别安装，决不多余。尽量在硬盘基础占用上也降至最小。硬盘分区使用了LVM，偷懒了，虽然这样会有很大的问题，但手工分区还不是很熟悉，而且在管理存储上我功力还不够，以后进行改善。</p>
<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">[root@localhost ~]# df</li>
<li>Filesystem&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1K-blocks&nbsp; &nbsp; &nbsp; Used Available Use% Mounted on</li>
<li>/dev/mapper/VolGroup00-LogVol00</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 134980848&nbsp; &nbsp;1214972 126909172&nbsp; &nbsp;1% /</li>
<li>/dev/sda1&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;101086&nbsp; &nbsp; &nbsp;14864&nbsp; &nbsp; &nbsp;81003&nbsp; 16% /boot</li>
<li>none&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2021172&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0&nbsp; &nbsp;2021172&nbsp; &nbsp;0% /dev/shm</li></ol></div>
<p>很成功的系统，但管理软件我一直没功夫去写，待写完后就是一个完整的初始系统＋管理套件</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/18/%e7%b4%af%e2%80%a6%e2%80%a6%e7%96%af%e7%8b%82%e7%9a%84%e9%85%8d%e7%bd%ae.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Dell1950安装Centos4.7 ServerCD</title>
		<link>http://www.sunboyu.cn/2009/01/18/dell1950%e5%ae%89%e8%a3%85centos47-servercd.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/18/dell1950%e5%ae%89%e8%a3%85centos47-servercd.shtml#comments</comments>
		<pubDate>Sun, 18 Jan 2009 03:11:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[centos]]></category>

		<category><![CDATA[centos4.7]]></category>

		<category><![CDATA[dell1950]]></category>

		<category><![CDATA[servercd]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=501</guid>
		<description><![CDATA[朋友弄来一台Dell1950，至强E5405，单颗CPU4核，4G内存，一块136Gsas硬盘，因原来的双CPU的机器利用率太差，好说歹说才降级改成单CPU。
原以为DELL对linux支持很好，可我的centos4.7servercd 并没有直接就能装上，估计是不认sas硬盘，没有继承sas硬盘的驱动，翻出机器自带的引导光盘，默认引导一遍，把驱动拷贝到硬盘上，可所支持的操作系统只有windows和redhat的as系统，我的CentosCD并不认，逼我重启，再用CentosCD引导，顺利安装。
这机器就是比我本本上的虚拟机快－－&#124;&#124;几乎是闪装系统，闪编译，而最大的瓶颈却是我家里1M的adsl带宽，因为我是从我 sunboyu.cn 的源里下载软件，其实当时应该配置成局域网源的，忘了，不过也就这样了，速度飞快，而且我那个脚本基本无人职守，跑上，我就喝茶去了……
顺便也写了本篇日志
]]></description>
			<content:encoded><![CDATA[<p>朋友弄来一台Dell1950，至强E5405，单颗CPU4核，4G内存，一块136Gsas硬盘，因原来的双CPU的机器利用率太差，好说歹说才降级改成单CPU。</p>
<p>原以为DELL对linux支持很好，可我的centos4.7servercd 并没有直接就能装上，估计是不认sas硬盘，没有继承sas硬盘的驱动，翻出机器自带的引导光盘，默认引导一遍，把驱动拷贝到硬盘上，可所支持的操作系统只有windows和redhat的as系统，我的CentosCD并不认，逼我重启，再用CentosCD引导，顺利安装。</p>
<p>这机器就是比我本本上的虚拟机快－－||几乎是闪装系统，闪编译，而最大的瓶颈却是我家里1M的adsl带宽，因为我是从我 sunboyu.cn 的源里下载软件，其实当时应该配置成局域网源的，忘了，不过也就这样了，速度飞快，而且我那个脚本基本无人职守，跑上，我就喝茶去了……</p>
<p>顺便也写了本篇日志</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/18/dell1950%e5%ae%89%e8%a3%85centos47-servercd.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>gentoo初体验</title>
		<link>http://www.sunboyu.cn/2009/01/17/gentoo%e5%88%9d%e4%bd%93%e9%aa%8c.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/17/gentoo%e5%88%9d%e4%bd%93%e9%aa%8c.shtml#comments</comments>
		<pubDate>Sat, 17 Jan 2009 06:37:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[GenToo]]></category>

		<category><![CDATA[gentoo]]></category>

		<category><![CDATA[安装]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=495</guid>
		<description><![CDATA[使用的是 install-x86-minimal-2008.0.iso 这张盘，在vmware6中进行安装。
初次安装异常辛苦，想起了刚买电脑装98那架势。自己格盘，配置文件系统，然后安装，然后％……※×……×（※（
反正很有乐趣。
底下是初次使用常用命令，打包收集一下
passwd  #修改root密码
net-setup eth0   #修改网卡信息
/etc/init.d/sshd start  #启动sshd服务  底下就可以用ssh登录了
磁盘分区，我习惯用lvm，虽说安全和管理上是偷懒的行为，不过方便么。
fdisk不好用，我用cfdisk，很OK。
创建文件系统的命令



文件系统
创建命令


ext2
mke2fs


ext3
mke2fs -j


reiserfs
mkreiserfs


xfs
mkfs.xfs


jfs
mkfs.jfs



创建swap分区  mkswap /dev/hda2
激活swap分区  swapon /dev/hda2
然后挂载文件，具体看手册  http://gentoo.linuxsir.org/doc/cn/handbook/hb_part1_chap5.html
以后按照手册，我基本建立起了这个系统，而且portage成功。
]]></description>
			<content:encoded><![CDATA[<p>使用的是 install-x86-minimal-2008.0.iso 这张盘，在vmware6中进行安装。</p>
<p>初次安装异常辛苦，想起了刚买电脑装98那架势。自己格盘，配置文件系统，然后安装，然后％……※×……×（※（</p>
<p>反正很有乐趣。</p>
<p>底下是初次使用常用命令，打包收集一下<br />
passwd  #修改root密码<br />
net-setup eth0   #修改网卡信息<br />
/etc/init.d/sshd start  #启动sshd服务  底下就可以用ssh登录了</p>
<p>磁盘分区，我习惯用lvm，虽说安全和管理上是偷懒的行为，不过方便么。<br />
fdisk不好用，我用cfdisk，很OK。</p>
<p>创建文件系统的命令</p>
<table border="0">
<tbody>
<tr>
<td bgcolor="#7a5ada"><strong>文件系统</strong></td>
<td bgcolor="#7a5ada"><strong>创建命令</strong></td>
</tr>
<tr>
<td bgcolor="#ddddff">ext2</td>
<td bgcolor="#ddddff"><span class="code">mke2fs</span></td>
</tr>
<tr>
<td bgcolor="#ddddff">ext3</td>
<td bgcolor="#ddddff"><span class="code">mke2fs -j</span></td>
</tr>
<tr>
<td bgcolor="#ddddff">reiserfs</td>
<td bgcolor="#ddddff"><span class="code">mkreiserfs</span></td>
</tr>
<tr>
<td bgcolor="#ddddff">xfs</td>
<td bgcolor="#ddddff"><span class="code">mkfs.xfs</span></td>
</tr>
<tr>
<td bgcolor="#ddddff">jfs</td>
<td bgcolor="#ddddff"><span class="code">mkfs.jfs</span></td>
</tr>
</tbody>
</table>
<p>创建swap分区  mkswap /dev/hda2</p>
<p>激活swap分区  swapon /dev/hda2</p>
<p>然后挂载文件，具体看手册  http://gentoo.linuxsir.org/doc/cn/handbook/hb_part1_chap5.html</p>
<p>以后按照手册，我基本建立起了这个系统，而且portage成功。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/17/gentoo%e5%88%9d%e4%bd%93%e9%aa%8c.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>明确了方向,Gentoo,Python</title>
		<link>http://www.sunboyu.cn/2009/01/17/%e6%98%8e%e7%a1%ae%e4%ba%86%e6%96%b9%e5%90%91gentoopython.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/17/%e6%98%8e%e7%a1%ae%e4%ba%86%e6%96%b9%e5%90%91gentoopython.shtml#comments</comments>
		<pubDate>Fri, 16 Jan 2009 16:03:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[gentoo]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=493</guid>
		<description><![CDATA[晚上收拾东西，翻出了很多的Linux发行版，Ubuntu，SuseLinux，红旗，Fedora等。不过我最终还是留下了Centos的几个版本。
Fedora5是我的第一个实际应用的发行版，因为公司当时从win迁移linux平台，红帽是我曾经听说过的系统，简单实践过，就硬上了，好在有yum这东西，很端的时间把服务都配起来，还真跑起来了。
不过Fedora在DELL1950的机器上有个硬伤，就是对双网卡的支持不好，只能支持一块网卡，后来迫不得已，找到了Centos，果然很爽，就一直在用了。
以后，基本一直在研究和优化linux下的Web相关服务。不断优化，改进，定制。
终于发现在发行版的基础上优化和精简，逐渐有了障碍，我需要研究linux的各种服务的原理，与其去分析每个服务，不如从零配置一个服务。两个方案，LFS和gentoo。
LFS似乎是个很神秘的东西，其实现在的资料很全，而且很多高手给出了详细的流程。但我选择了gentoo，因为gentoo是完全根据用户定制进行安装，是在一个稳定的基础上进行定制，定制的产品也许稳定性和效率会很高。而LFS，如果我对linux的理解不是太深，也许作出来的版本也是不能进行生产的，只能算个实验室产品。
因此，本着劳以致用的原则，我开始对gentoo系统的研究，另外继续发展熟悉的CentOS4.7Server版本用作生产。
希望下年我能完全切换到gentoo环境＋python开发。
注：转移到python，是因为最近我被一个PHP进程效率问题折腾的焦头烂额，而在linux上实现多个php进程调度的困难和效率的损失让我彻底对PHP失去了信心，因为PHP就是一个面向Web的开发语言，用迷信崇拜的思想往其他领域迁移实在是难受，因此用python去解决多进程的问题再好不好，python的解释型语言和面向对象特性跟PHP很是相似，但相关的类库却接近于底层，又没有c的完全面向底层。python也许又是我下一个迷信的东西。
]]></description>
			<content:encoded><![CDATA[<p>晚上收拾东西，翻出了很多的Linux发行版，Ubuntu，SuseLinux，红旗，Fedora等。不过我最终还是留下了Centos的几个版本。</p>
<p>Fedora5是我的第一个实际应用的发行版，因为公司当时从win迁移linux平台，红帽是我曾经听说过的系统，简单实践过，就硬上了，好在有yum这东西，很端的时间把服务都配起来，还真跑起来了。</p>
<p>不过Fedora在DELL1950的机器上有个硬伤，就是对双网卡的支持不好，只能支持一块网卡，后来迫不得已，找到了Centos，果然很爽，就一直在用了。</p>
<p>以后，基本一直在研究和优化linux下的Web相关服务。不断优化，改进，定制。</p>
<p>终于发现在发行版的基础上优化和精简，逐渐有了障碍，我需要研究linux的各种服务的原理，与其去分析每个服务，不如从零配置一个服务。两个方案，LFS和gentoo。</p>
<p>LFS似乎是个很神秘的东西，其实现在的资料很全，而且很多高手给出了详细的流程。但我选择了gentoo，因为gentoo是完全根据用户定制进行安装，是在一个稳定的基础上进行定制，定制的产品也许稳定性和效率会很高。而LFS，如果我对linux的理解不是太深，也许作出来的版本也是不能进行生产的，只能算个实验室产品。</p>
<p>因此，本着劳以致用的原则，我开始对gentoo系统的研究，另外继续发展熟悉的CentOS4.7Server版本用作生产。</p>
<p>希望下年我能完全切换到gentoo环境＋python开发。</p>
<p>注：转移到python，是因为最近我被一个PHP进程效率问题折腾的焦头烂额，而在linux上实现多个php进程调度的困难和效率的损失让我彻底对PHP失去了信心，因为PHP就是一个面向Web的开发语言，用迷信崇拜的思想往其他领域迁移实在是难受，因此用python去解决多进程的问题再好不好，python的解释型语言和面向对象特性跟PHP很是相似，但相关的类库却接近于底层，又没有c的完全面向底层。python也许又是我下一个迷信的东西。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/17/%e6%98%8e%e7%a1%ae%e4%ba%86%e6%96%b9%e5%90%91gentoopython.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>服务器性能负载记录工具</title>
		<link>http://www.sunboyu.cn/2009/01/14/%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%80%a7%e8%83%bd%e8%b4%9f%e8%bd%bd%e8%ae%b0%e5%bd%95%e5%b7%a5%e5%85%b7.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/14/%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%80%a7%e8%83%bd%e8%b4%9f%e8%bd%bd%e8%ae%b0%e5%bd%95%e5%b7%a5%e5%85%b7.shtml#comments</comments>
		<pubDate>Wed, 14 Jan 2009 09:15:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[工具]]></category>

		<category><![CDATA[日志]]></category>

		<category><![CDATA[负载]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=486</guid>
		<description><![CDATA[服务器突然发生了崩溃，老板开始找我了。
找了半天居然没找到问题在哪里，一咬牙，写了个性能和负载的记录工具，再出事我可有记录了－,－&#124;&#124;
备注：只能在linux下用。
&#60; ?php
date_default_timezone_set('Asia/Shanghai');
define('SLEEPTIME',10);&#160; &#160; &#160; &#160;//10秒记录一次
$memfile&#160; = &#34;/proc/meminfo&#34;;
$loadfile = &#34;/proc/loadavg&#34;;
$logfile&#160; = sprintf(&#34;/var/www/html/log/%s.log&#34;,date('Y-m-d'));
while(1)
{
	$log = getload();
	$log .= getmem();
	$log .= mymem();
	$log .= &#34;\n\r&#34;.date(&#34;Y-m-d H:i:s&#34;);
	$log .= &#34;\n\r\n\r&#34;;
	$handle = fopen($logfile,'a');
	fwrite($handle,$log);
	fclose($handle);
	sleep(SLEEPTIME);
}
&#160;
function getload()&#160; &#160; &#160; //获得负载
{
	global $loadfile;
	return file_get_contents($loadfile);
}
function getmem()&#160; &#160; &#160; //获得内存占用
{
	global $memfile;
	$mem = file($memfile);
	return $mem[0];
}
function mymem()&#160; &#160; &#160; &#160;//程序本身内存占用
{
	$pid = getmypid();
	exec(&#34;ps -eo%mem,rss,pid &#124; grep $pid&#34;, $output);
&#160;&#160; &#160; &#160; &#160;$output = explode(&#34; &#34;, [...]]]></description>
			<content:encoded><![CDATA[<p>服务器突然发生了崩溃，老板开始找我了。</p>
<p>找了半天居然没找到问题在哪里，一咬牙，写了个性能和负载的记录工具，再出事我可有记录了－,－||</p>
<p>备注：只能在linux下用。</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">&lt; ?php</li>
<li>date_default_timezone_set('Asia/Shanghai');</li>
<li>define('SLEEPTIME',10);&nbsp; &nbsp; &nbsp; &nbsp;//10秒记录一次</li>
<li>$memfile&nbsp; = &quot;/proc/meminfo&quot;;</li>
<li>$loadfile = &quot;/proc/loadavg&quot;;</li>
<li>$logfile&nbsp; = sprintf(&quot;/var/www/html/log/%s.log&quot;,date('Y-m-d'));</li>
<li>while(1)</li>
<li>{</li>
<li>	$log = getload();</li>
<li>	$log .= getmem();</li>
<li>	$log .= mymem();</li>
<li>	$log .= &quot;\n\r&quot;.date(&quot;Y-m-d H:i:s&quot;);</li>
<li>	$log .= &quot;\n\r\n\r&quot;;</li>
<li>	$handle = fopen($logfile,'a');</li>
<li>	fwrite($handle,$log);</li>
<li>	fclose($handle);</li>
<li>	sleep(SLEEPTIME);</li>
<li>}</li>
<li>&nbsp;</li>
<li>function getload()&nbsp; &nbsp; &nbsp; //获得负载</li>
<li>{</li>
<li>	global $loadfile;</li>
<li>	return file_get_contents($loadfile);</li>
<li>}</li>
<li>function getmem()&nbsp; &nbsp; &nbsp; //获得内存占用</li>
<li>{</li>
<li>	global $memfile;</li>
<li>	$mem = file($memfile);</li>
<li>	return $mem[0];</li>
<li>}</li>
<li>function mymem()&nbsp; &nbsp; &nbsp; &nbsp;//程序本身内存占用</li>
<li>{</li>
<li>	$pid = getmypid();</li>
<li>	exec(&quot;ps -eo%mem,rss,pid | grep $pid&quot;, $output);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$output = explode(&quot; &quot;, $output[0]);</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return $output[1] * 1024;</li>
<li>}</li>
<li>?&gt;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/14/%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%80%a7%e8%83%bd%e8%b4%9f%e8%bd%bd%e8%ae%b0%e5%bd%95%e5%b7%a5%e5%85%b7.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP开发中，框架(frame)、脚手架(scaffolding)、应用资源包(application package)详解</title>
		<link>http://www.sunboyu.cn/2009/01/11/php%e5%bc%80%e5%8f%91%e4%b8%ad%ef%bc%8c%e6%a1%86%e6%9e%b6frame%e3%80%81%e8%84%9a%e6%89%8b%e6%9e%b6scaffolding%e3%80%81%e5%ba%94%e7%94%a8%e8%b5%84%e6%ba%90%e5%8c%85application-package%e8%af%a6.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/11/php%e5%bc%80%e5%8f%91%e4%b8%ad%ef%bc%8c%e6%a1%86%e6%9e%b6frame%e3%80%81%e8%84%9a%e6%89%8b%e6%9e%b6scaffolding%e3%80%81%e5%ba%94%e7%94%a8%e8%b5%84%e6%ba%90%e5%8c%85application-package%e8%af%a6.shtml#comments</comments>
		<pubDate>Sun, 11 Jan 2009 10:34:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[应用资源包]]></category>

		<category><![CDATA[框架]]></category>

		<category><![CDATA[脚手架]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=473</guid>
		<description><![CDATA[什么是框架：字典中框架指架构，骨架结构，框子，底座等，从字面意思，不难理解，框架指一个基础，而在程序开发中，框架指基于底层语言而逐步向上层应用进行的一些功能实现。其并没有实现具体的功能，而是简化了开发过程，任何模块中常用的功能都被框架进行封装或者扩充，给开发人员以最简的操作实现。
常用的PHP框架：Cakephp Flexphp Thinkphp
什么是脚手架：脚手架通常使用在框架的数据抽象层，数据脚手架可以很直观得给开发者或者使用者数据结构的表现。脚手架同样可以表现在一些具体应用上。但脚手架的功能只是把数据或者应用的最终结果能用简单的方式表现，但并没有达到最终的应用效果，常用在建模或结构设计的初期。脚手架的优势就是给最终用户一个直观的产品但中间并没有经过大量的开发，以减少需求变更所带来的反复开发。
常用脚手架：CI框架中数据脚手架
什么是应用资源包：应用资源包就是具体的应用了，比如bbs，blog，用户管理，资源管理等一些具体的应用。应用资源包侧重完成了一个完整的功能，而面向开发的应用资源包又提高了可迁移性，使一些项目的功能模块直接修改应用资源包的接口而达到快速开发。
常用案例：xoops中功能模块包。
]]></description>
			<content:encoded><![CDATA[<p>什么是框架：字典中框架指架构，骨架结构，框子，底座等，从字面意思，不难理解，框架指一个基础，而在程序开发中，框架指基于底层语言而逐步向上层应用进行的一些功能实现。其并没有实现具体的功能，而是简化了开发过程，任何模块中常用的功能都被框架进行封装或者扩充，给开发人员以最简的操作实现。</p>
<p>常用的PHP框架：Cakephp Flexphp Thinkphp</p>
<p>什么是脚手架：脚手架通常使用在框架的数据抽象层，数据脚手架可以很直观得给开发者或者使用者数据结构的表现。脚手架同样可以表现在一些具体应用上。但脚手架的功能只是把数据或者应用的最终结果能用简单的方式表现，但并没有达到最终的应用效果，常用在建模或结构设计的初期。脚手架的优势就是给最终用户一个直观的产品但中间并没有经过大量的开发，以减少需求变更所带来的反复开发。</p>
<p>常用脚手架：CI框架中数据脚手架</p>
<p>什么是应用资源包：应用资源包就是具体的应用了，比如bbs，blog，用户管理，资源管理等一些具体的应用。应用资源包侧重完成了一个完整的功能，而面向开发的应用资源包又提高了可迁移性，使一些项目的功能模块直接修改应用资源包的接口而达到快速开发。</p>
<p>常用案例：xoops中功能模块包。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/11/php%e5%bc%80%e5%8f%91%e4%b8%ad%ef%bc%8c%e6%a1%86%e6%9e%b6frame%e3%80%81%e8%84%9a%e6%89%8b%e6%9e%b6scaffolding%e3%80%81%e5%ba%94%e7%94%a8%e8%b5%84%e6%ba%90%e5%8c%85application-package%e8%af%a6.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Centos4初始化的一些脚本</title>
		<link>http://www.sunboyu.cn/2009/01/07/centos4%e5%88%9d%e5%a7%8b%e5%8c%96%e7%9a%84%e4%b8%80%e4%ba%9b%e8%84%9a%e6%9c%ac.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/07/centos4%e5%88%9d%e5%a7%8b%e5%8c%96%e7%9a%84%e4%b8%80%e4%ba%9b%e8%84%9a%e6%9c%ac.shtml#comments</comments>
		<pubDate>Wed, 07 Jan 2009 01:27:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[centos4]]></category>

		<category><![CDATA[yum]]></category>

		<category><![CDATA[源]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=465</guid>
		<description><![CDATA[#!/bin/sh
cd /etc/yum.repos.d
mv CentOS-Base.repo&#160; CentOS-Base.repo.save
wget http://centos.ustc.edu.cn/CentOS-Base.repo
yum install gcc4-c++
中国科技大学的源挺快的，因为是高校，所以比较稳定，一些其他服务器的过一段时间也许就消失了，所以不建议
网易的源  http://mirrors.163.com/.help/CentOS-Base-163.repo
搜狐的源 http://mirrors.sohu.com/help/CentOS-Base-sohu.repo
]]></description>
			<content:encoded><![CDATA[<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">#!/bin/sh</li>
<li>cd /etc/yum.repos.d</li>
<li>mv CentOS-Base.repo&nbsp; CentOS-Base.repo.save</li>
<li>wget http://centos.ustc.edu.cn/CentOS-Base.repo</li>
<li>yum install gcc4-c++</li></ol></div>
<p>中国科技大学的源挺快的，因为是高校，所以比较稳定，一些其他服务器的过一段时间也许就消失了，所以不建议</p>
<p>网易的源  http://mirrors.163.com/.help/CentOS-Base-163.repo</p>
<p>搜狐的源 http://mirrors.sohu.com/help/CentOS-Base-sohu.repo</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/07/centos4%e5%88%9d%e5%a7%8b%e5%8c%96%e7%9a%84%e4%b8%80%e4%ba%9b%e8%84%9a%e6%9c%ac.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>揭发一个写程序以来自己常犯的错误</title>
		<link>http://www.sunboyu.cn/2009/01/06/%e6%8f%ad%e5%8f%91%e4%b8%80%e4%b8%aa%e5%86%99%e7%a8%8b%e5%ba%8f%e4%bb%a5%e6%9d%a5%e8%87%aa%e5%b7%b1%e5%b8%b8%e7%8a%af%e7%9a%84%e9%94%99%e8%af%af.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/06/%e6%8f%ad%e5%8f%91%e4%b8%80%e4%b8%aa%e5%86%99%e7%a8%8b%e5%ba%8f%e4%bb%a5%e6%9d%a5%e8%87%aa%e5%b7%b1%e5%b8%b8%e7%8a%af%e7%9a%84%e9%94%99%e8%af%af.shtml#comments</comments>
		<pubDate>Tue, 06 Jan 2009 15:05:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[时间戳]]></category>

		<category><![CDATA[时间段]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=460</guid>
		<description><![CDATA[从来没发现这个错误，今天突然想到。
数据库中时间，我习惯使用时间戳来保存，取某天或者某小时的数据时，采用 sql 的 between and 方法。
&#60; ?php
#某天的数据
$time[0] = strtotime(date('Y-m-d'));
$time[1] = $time[0]+86400;
$sql = &#34;SELECT * FROM TABLE WHERE TIME BETWEEN $time[0] AND $time[1]&#34;&#160; //伪代码
?&#62;
乍看这样是没有什么问题的，取某天的时间段。实践证明，在数据时间的分布比较疏松的时候，的确没什么问题，但如果数据分布十分密集，每秒都有若干数据的时候，问题就出来了。根据between的规则，实际的时间就是 $time[1]-$time[0]+1 = 86401
每条语句多算了一秒……汗
解决方案，时间段的计算一律 $time[0] + 60*60*24*x -1
]]></description>
			<content:encoded><![CDATA[<p>从来没发现这个错误，今天突然想到。</p>
<p>数据库中时间，我习惯使用时间戳来保存，取某天或者某小时的数据时，采用 sql 的 between and 方法。</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">&lt; ?php</li>
<li>#某天的数据</li>
<li>$time[0] = strtotime(date('Y-m-d'));</li>
<li>$time[1] = $time[0]+86400;</li>
<li>$sql = &quot;SELECT * FROM TABLE WHERE TIME BETWEEN $time[0] AND $time[1]&quot;&nbsp; //伪代码</li>
<li>?&gt;</li></ol></div>
<p>乍看这样是没有什么问题的，取某天的时间段。实践证明，在数据时间的分布比较疏松的时候，的确没什么问题，但如果数据分布十分密集，每秒都有若干数据的时候，问题就出来了。根据between的规则，实际的时间就是 $time[1]-$time[0]+1 = 86401</p>
<p>每条语句多算了一秒……汗</p>
<p>解决方案，时间段的计算一律 $time[0] + 60*60*24*x -1</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/06/%e6%8f%ad%e5%8f%91%e4%b8%80%e4%b8%aa%e5%86%99%e7%a8%8b%e5%ba%8f%e4%bb%a5%e6%9d%a5%e8%87%aa%e5%b7%b1%e5%b8%b8%e7%8a%af%e7%9a%84%e9%94%99%e8%af%af.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>wordpress评论验证码插件安装成功</title>
		<link>http://www.sunboyu.cn/2009/01/02/wordpress%e8%af%84%e8%ae%ba%e9%aa%8c%e8%af%81%e7%a0%81%e6%8f%92%e4%bb%b6%e5%ae%89%e8%a3%85%e6%88%90%e5%8a%9f.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/02/wordpress%e8%af%84%e8%ae%ba%e9%aa%8c%e8%af%81%e7%a0%81%e6%8f%92%e4%bb%b6%e5%ae%89%e8%a3%85%e6%88%90%e5%8a%9f.shtml#comments</comments>
		<pubDate>Fri, 02 Jan 2009 03:51:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[wordpress插件]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/2009/01/02/wordpress%e8%af%84%e8%ae%ba%e9%aa%8c%e8%af%81%e7%a0%81%e6%8f%92%e4%bb%b6%e5%ae%89%e8%a3%85%e6%88%90%e5%8a%9f.shtml</guid>
		<description><![CDATA[wp-imgcode
在适当的地方增加这句话就可以了
< ?php do_action(’comment_form’, $post->ID); ?>
]]></description>
			<content:encoded><![CDATA[<p>wp-imgcode<br />
在适当的地方增加这句话就可以了<br />
< ?php do_action(’comment_form’, $post->ID); ?></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/02/wordpress%e8%af%84%e8%ae%ba%e9%aa%8c%e8%af%81%e7%a0%81%e6%8f%92%e4%bb%b6%e5%ae%89%e8%a3%85%e6%88%90%e5%8a%9f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>新年第一帖</title>
		<link>http://www.sunboyu.cn/2009/01/01/%e6%96%b0%e5%b9%b4%e7%ac%ac%e4%b8%80%e5%b8%96.shtml</link>
		<comments>http://www.sunboyu.cn/2009/01/01/%e6%96%b0%e5%b9%b4%e7%ac%ac%e4%b8%80%e5%b8%96.shtml#comments</comments>
		<pubDate>Wed, 31 Dec 2008 16:31:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[新年]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=440</guid>
		<description><![CDATA[其实，这个时候我在想一个问题，我的技术应该超哪个方向发展。
这是个干炸带鱼和烧熊掌之间的选择，不过我还是比较贪心，选择了“熊掌罩烧带鱼段”。
其实为了做这道菜，我寻找了大半年，对于一个厨子，没有什么不可能。
这道菜也许我做上半年，也许一年，最终会端到你的餐桌上。
请等待……开源会打击敌人，免费会拖垮敌人，超强的开发进度会让敌人措手不及！
]]></description>
			<content:encoded><![CDATA[<p>其实，这个时候我在想一个问题，我的技术应该超哪个方向发展。<br />
这是个干炸带鱼和烧熊掌之间的选择，不过我还是比较贪心，选择了“熊掌罩烧带鱼段”。<br />
其实为了做这道菜，我寻找了大半年，对于一个厨子，没有什么不可能。<br />
这道菜也许我做上半年，也许一年，最终会端到你的餐桌上。<br />
请等待……开源会打击敌人，免费会拖垮敌人，超强的开发进度会让敌人措手不及！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2009/01/01/%e6%96%b0%e5%b9%b4%e7%ac%ac%e4%b8%80%e5%b8%96.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>2008的最后一天</title>
		<link>http://www.sunboyu.cn/2008/12/31/2008%e7%9a%84%e6%9c%80%e5%90%8e%e4%b8%80%e5%a4%a9.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/31/2008%e7%9a%84%e6%9c%80%e5%90%8e%e4%b8%80%e5%a4%a9.shtml#comments</comments>
		<pubDate>Wed, 31 Dec 2008 14:35:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[年终总结]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=439</guid>
		<description><![CDATA[下午腐败了一场，幸好没喝多少，躲过一劫。
总结今年，收获不少，尤其加入朗玛，更是在项目经验上积累不少心得。
技术方面，自5月份加入朗玛，有了突飞猛进的发展，不仅在代码方面，linux系统长进不少，在程序架构和代码风格上也有了很大的提高。
细节：mysql优化，索引，搜索引擎基础，lucene，linux系统管理，apache优化设置，PHP优化，系统安全，权限，都有了一个不小的进步。前端方面，http优化，js编程，也有一定的提高。
其实学的挺杂，但心中终于有了一个目标，并且为了这个目标努力了，前进了，而且落实到代码字符上了。
2008是个不错的年景，有了很大的收获，2009要再接再厉。
]]></description>
			<content:encoded><![CDATA[<p>下午腐败了一场，幸好没喝多少，躲过一劫。<br />
总结今年，收获不少，尤其加入朗玛，更是在项目经验上积累不少心得。<br />
技术方面，自5月份加入朗玛，有了突飞猛进的发展，不仅在代码方面，linux系统长进不少，在程序架构和代码风格上也有了很大的提高。<br />
细节：mysql优化，索引，搜索引擎基础，lucene，linux系统管理，apache优化设置，PHP优化，系统安全，权限，都有了一个不小的进步。前端方面，http优化，js编程，也有一定的提高。<br />
其实学的挺杂，但心中终于有了一个目标，并且为了这个目标努力了，前进了，而且落实到代码字符上了。<br />
2008是个不错的年景，有了很大的收获，2009要再接再厉。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/31/2008%e7%9a%84%e6%9c%80%e5%90%8e%e4%b8%80%e5%a4%a9.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>传说中的千万数据量优化</title>
		<link>http://www.sunboyu.cn/2008/12/30/%e4%bc%a0%e8%af%b4%e4%b8%ad%e7%9a%84%e5%8d%83%e4%b8%87%e6%95%b0%e6%8d%ae%e9%87%8f%e4%bc%98%e5%8c%96.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/30/%e4%bc%a0%e8%af%b4%e4%b8%ad%e7%9a%84%e5%8d%83%e4%b8%87%e6%95%b0%e6%8d%ae%e9%87%8f%e4%bc%98%e5%8c%96.shtml#comments</comments>
		<pubDate>Tue, 30 Dec 2008 14:10:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[sql]]></category>

		<category><![CDATA[优化]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=438</guid>
		<description><![CDATA[平时看别人招聘，动不动来个“有千万数据量优化经验”。我还的确没有这个经验，中小网站来个几万几十万的数据就了不得，一些涉及数据多的顶多也来个百万，因为超百万我就分表了，而且设计的时候尽量使用主键索引，避免使用模糊搜索和一些复杂的搜索。
基本百万数量级以下的简单应用，一般的服务器没什么问题，只要程序够不垃圾就行。
今天突然奇想，尝试下千万数据什么样子，花半个小时生成了一堆随机的数字，一千万整，当然还有其他的一些数据，主要测试从千万级的数据中捞少量数据是什么样子。
我用的MSSQL2005，使用存储过程生成数据，半个小时，Mysql没实验过。结果，从千万数据用where捞几万条数据，用单一的where条件，果然很慢，能达到20几秒。后仔细查看索引和语句，发现没有很好的索引供sql语句使用，根据where语句建立索引，速度提升到10秒左右。因为只是取出几个字段，后又想使用覆盖索引，加上那几个字段，速度大为提高。
经过跟踪测试，在覆盖索引的使用后，取数据已经达到了相当迅速，但大量的时间消耗在了数据库连接和数据的传输上。因为本系统必须操作大量数据，而拆分数据后又增加了创建数据库连接的成本，速度反而变慢。其实，只要php不超时，已经达到了可用的程度。
总结：索引这玩意真的不错，但设计数据表要尽量简单，简单不是指字段简单，而是使sql语句取数据简单，必要时中间要增加矢量的冗余数据，用空间换取时间。
]]></description>
			<content:encoded><![CDATA[<p>平时看别人招聘，动不动来个“有千万数据量优化经验”。我还的确没有这个经验，中小网站来个几万几十万的数据就了不得，一些涉及数据多的顶多也来个百万，因为超百万我就分表了，而且设计的时候尽量使用主键索引，避免使用模糊搜索和一些复杂的搜索。<br />
基本百万数量级以下的简单应用，一般的服务器没什么问题，只要程序够不垃圾就行。<br />
今天突然奇想，尝试下千万数据什么样子，花半个小时生成了一堆随机的数字，一千万整，当然还有其他的一些数据，主要测试从千万级的数据中捞少量数据是什么样子。<br />
我用的MSSQL2005，使用存储过程生成数据，半个小时，Mysql没实验过。结果，从千万数据用where捞几万条数据，用单一的where条件，果然很慢，能达到20几秒。后仔细查看索引和语句，发现没有很好的索引供sql语句使用，根据where语句建立索引，速度提升到10秒左右。因为只是取出几个字段，后又想使用覆盖索引，加上那几个字段，速度大为提高。<br />
经过跟踪测试，在覆盖索引的使用后，取数据已经达到了相当迅速，但大量的时间消耗在了数据库连接和数据的传输上。因为本系统必须操作大量数据，而拆分数据后又增加了创建数据库连接的成本，速度反而变慢。其实，只要php不超时，已经达到了可用的程度。<br />
总结：索引这玩意真的不错，但设计数据表要尽量简单，简单不是指字段简单，而是使sql语句取数据简单，必要时中间要增加矢量的冗余数据，用空间换取时间。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/30/%e4%bc%a0%e8%af%b4%e4%b8%ad%e7%9a%84%e5%8d%83%e4%b8%87%e6%95%b0%e6%8d%ae%e9%87%8f%e4%bc%98%e5%8c%96.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>使用linux进程来分布PHP的压力，构造高负载多并发的系统</title>
		<link>http://www.sunboyu.cn/2008/12/25/%e4%bd%bf%e7%94%a8linux%e8%bf%9b%e7%a8%8b%e6%9d%a5%e5%88%86%e5%b8%83php%e7%9a%84%e5%8e%8b%e5%8a%9b%ef%bc%8c%e6%9e%84%e9%80%a0%e9%ab%98%e8%b4%9f%e8%bd%bd%e5%a4%9a%e5%b9%b6%e5%8f%91%e7%9a%84%e7%b3%bb.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/25/%e4%bd%bf%e7%94%a8linux%e8%bf%9b%e7%a8%8b%e6%9d%a5%e5%88%86%e5%b8%83php%e7%9a%84%e5%8e%8b%e5%8a%9b%ef%bc%8c%e6%9e%84%e9%80%a0%e9%ab%98%e8%b4%9f%e8%bd%bd%e5%a4%9a%e5%b9%b6%e5%8f%91%e7%9a%84%e7%b3%bb.shtml#comments</comments>
		<pubDate>Thu, 25 Dec 2008 07:42:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[压力，进程]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=437</guid>
		<description><![CDATA[最近又跟P友讨论PHP的多进程问题，解决的方案，一般都是建立新的系统进程去处理，而linux的nohup命令可以创建新的进程，如果主程序需要处理很多数据，比如一个队列，把这些记录分布开，可以提高主程序的响应，能更快的使主程序结束。
这个方案最早出现在这哥们的博客里，大家可以参考 http://blog.s135.com/read.php/311.htm
而我处理，基本基于PHP的cli模式，使用$argv传递参数而非url，在一些涉及轮询的程序中，可以尽快得把负载分散，使单一的轮询程序来处理下一次的轮询。
]]></description>
			<content:encoded><![CDATA[<p>最近又跟P友讨论PHP的多进程问题，解决的方案，一般都是建立新的系统进程去处理，而linux的nohup命令可以创建新的进程，如果主程序需要处理很多数据，比如一个队列，把这些记录分布开，可以提高主程序的响应，能更快的使主程序结束。</p>
<p>这个方案最早出现在这哥们的博客里，大家可以参考 http://blog.s135.com/read.php/311.htm</p>
<p>而我处理，基本基于PHP的cli模式，使用$argv传递参数而非url，在一些涉及轮询的程序中，可以尽快得把负载分散，使单一的轮询程序来处理下一次的轮询。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/25/%e4%bd%bf%e7%94%a8linux%e8%bf%9b%e7%a8%8b%e6%9d%a5%e5%88%86%e5%b8%83php%e7%9a%84%e5%8e%8b%e5%8a%9b%ef%bc%8c%e6%9e%84%e9%80%a0%e9%ab%98%e8%b4%9f%e8%bd%bd%e5%a4%9a%e5%b9%b6%e5%8f%91%e7%9a%84%e7%b3%bb.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>修改Linux用户登录的默认语言设置</title>
		<link>http://www.sunboyu.cn/2008/12/20/%e4%bf%ae%e6%94%b9linux%e7%94%a8%e6%88%b7%e7%99%bb%e5%bd%95%e7%9a%84%e9%bb%98%e8%ae%a4%e8%af%ad%e8%a8%80%e8%ae%be%e7%bd%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/20/%e4%bf%ae%e6%94%b9linux%e7%94%a8%e6%88%b7%e7%99%bb%e5%bd%95%e7%9a%84%e9%bb%98%e8%ae%a4%e8%af%ad%e8%a8%80%e8%ae%be%e7%bd%ae.shtml#comments</comments>
		<pubDate>Sat, 20 Dec 2008 08:47:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[终端编码]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=436</guid>
		<description><![CDATA[进入linux中断，查看自己的设置，可以看下 env命令的回显
默认都是us_EN.UTF-8
有一些字符出来全是乱码，尝试修改一下
修改用户主目录下 .bash_profile 文件，增加一行 export LANG=zh_CN.gbk
然后logout，再重新登录，部分字符显示正常。
]]></description>
			<content:encoded><![CDATA[<p>进入linux中断，查看自己的设置，可以看下 env命令的回显</p>
<p>默认都是us_EN.UTF-8</p>
<p>有一些字符出来全是乱码，尝试修改一下</p>
<p>修改用户主目录下 .bash_profile 文件，增加一行 export LANG=zh_CN.gbk</p>
<p>然后logout，再重新登录，部分字符显示正常。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/20/%e4%bf%ae%e6%94%b9linux%e7%94%a8%e6%88%b7%e7%99%bb%e5%bd%95%e7%9a%84%e9%bb%98%e8%ae%a4%e8%af%ad%e8%a8%80%e8%ae%be%e7%bd%ae.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>sunboyu-amp-fastcgi-suexec-v22-alpha 发布</title>
		<link>http://www.sunboyu.cn/2008/12/20/sunboyu-amp-fastcgi-suexec-v22-alpha-%e5%8f%91%e5%b8%83.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/20/sunboyu-amp-fastcgi-suexec-v22-alpha-%e5%8f%91%e5%b8%83.shtml#comments</comments>
		<pubDate>Sat, 20 Dec 2008 07:06:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[amp]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=434</guid>
		<description><![CDATA[Linux下APACHE MYSQL PHP FCgid Suexec 自动安装脚本V2.2
1、增加了m4-1.4.9
2、增加了autoconf-2.62
这两个包在安装eaccelerator-0.9.5.2的时候使用
3、增加了PHP &#8211;with-mcrypt 参数
4、增加了PHP &#8211;enable-sockets 参数
sunboyu-amp-fastcgi-suexec-v22-alpha
]]></description>
			<content:encoded><![CDATA[<p>Linux下APACHE MYSQL PHP FCgid Suexec 自动安装脚本V2.2</p>
<p>1、增加了m4-1.4.9</p>
<p>2、增加了autoconf-2.62</p>
<p>这两个包在安装eaccelerator-0.9.5.2的时候使用</p>
<p>3、增加了PHP &#8211;with-mcrypt 参数</p>
<p>4、增加了PHP &#8211;enable-sockets 参数</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/12/sunboyu-amp-fastcgi-suexec-v22-alpha.txt">sunboyu-amp-fastcgi-suexec-v22-alpha</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/20/sunboyu-amp-fastcgi-suexec-v22-alpha-%e5%8f%91%e5%b8%83.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>纯属扯淡</title>
		<link>http://www.sunboyu.cn/2008/12/19/%e7%ba%af%e5%b1%9e%e6%89%af%e6%b7%a1.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/19/%e7%ba%af%e5%b1%9e%e6%89%af%e6%b7%a1.shtml#comments</comments>
		<pubDate>Fri, 19 Dec 2008 03:09:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[备份]]></category>

		<category><![CDATA[扯淡]]></category>

		<category><![CDATA[集中存储]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=433</guid>
		<description><![CDATA[老久没写日志，手痒痒，扯一篇。
前两天公司服务器总出点不大不小的故障，让人头疼，虽然我不是网管，但积极想几个解决方案还是应该的。
我提出了集中的备份存储，这种分布式的实时云备份（概念词语，扯淡）应该是最为有效的，能保证高冗余高可靠高安全，但实际是不现实的，一直在跟群里的高人们扯这个事。做技术的一般都考虑如何做到更安全更可靠，可这种安全可靠的代价是高的，不管从老板还是从项目，在一个写web的小组里做这种事情纯属烧包，集中存储＋实时的工作备份，软件硬件成本远远高于找几个IT民工的价钱。钱摆在这里，兄弟们就别意淫了，老老实实手工备份是正道，谁丢数据了，自己加班补去吧，申请个加班工作餐也没几个钱。
最近把LAMP一套基础的东西都配置了一圈，基本能组成一个工作中高可用性高易用性的网络，不过这种配置离不了我这个网络高手，要想移植，得摸清所有的东西，其实更多的是我们这群民工的工作流程和工作习惯，有可移植性，也有不可移植性。代码易抄，精髓难学。
我在考虑是不是有必要把全套的东西详细整理一遍。
]]></description>
			<content:encoded><![CDATA[<p>老久没写日志，手痒痒，扯一篇。</p>
<p>前两天公司服务器总出点不大不小的故障，让人头疼，虽然我不是网管，但积极想几个解决方案还是应该的。</p>
<p>我提出了集中的备份存储，这种分布式的实时云备份（概念词语，扯淡）应该是最为有效的，能保证高冗余高可靠高安全，但实际是不现实的，一直在跟群里的高人们扯这个事。做技术的一般都考虑如何做到更安全更可靠，可这种安全可靠的代价是高的，不管从老板还是从项目，在一个写web的小组里做这种事情纯属烧包，集中存储＋实时的工作备份，软件硬件成本远远高于找几个IT民工的价钱。钱摆在这里，兄弟们就别意淫了，老老实实手工备份是正道，谁丢数据了，自己加班补去吧，申请个加班工作餐也没几个钱。</p>
<p>最近把LAMP一套基础的东西都配置了一圈，基本能组成一个工作中高可用性高易用性的网络，不过这种配置离不了我这个网络高手，要想移植，得摸清所有的东西，其实更多的是我们这群民工的工作流程和工作习惯，有可移植性，也有不可移植性。代码易抄，精髓难学。</p>
<p>我在考虑是不是有必要把全套的东西详细整理一遍。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/19/%e7%ba%af%e5%b1%9e%e6%89%af%e6%b7%a1.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Pure-ftpd安装配置草稿－补充完全</title>
		<link>http://www.sunboyu.cn/2008/12/18/pure-ftpd%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e8%8d%89%e7%a8%bf%ef%bc%8d%e8%a1%a5%e5%85%85%e5%ae%8c%e5%85%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/18/pure-ftpd%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e8%8d%89%e7%a8%bf%ef%bc%8d%e8%a1%a5%e5%85%85%e5%ae%8c%e5%85%a8.shtml#comments</comments>
		<pubDate>Thu, 18 Dec 2008 01:47:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[pure-ftpd]]></category>

		<category><![CDATA[草稿]]></category>

		<category><![CDATA[配置]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=431</guid>
		<description><![CDATA[cp /opt/mysql-5.0.22/lib/mysql/* /usr/lib&#160; &#160; &#160; &#160; &#160; #解决编译依赖库问题
./configure --prefix=/opt/pure-ftpd \
--with-mysql=/opt/mysql-5.0.22 \
--with-rfc2640 \
--with-language=simplified-chinese \
--with-peruserlimits \
--with-diraliases \
--with-virtualchroot \
--with-virtualhosts \
--with-welcomemsg \
--with-ftpwho \
--with-quotas \
--with-throttling \
--with-cookie \
--with-extauth \
--with-puredb \
--with-altlog \
--with-sysquotas \
--with-paranoidmsg \
--with-ascii \
--with-inetd
&#160;
cp  $install_dir/pureftpd-mysql.conf /opt/pure-ftpd/
cp  $install_dir/configuration-file/pure-config.pl pure-ftpd.conf /opt/pure-ftpd/
启动服务  /opt/pure-ftpd/pure-config.pl pure-ftpd.conf
这里补充完整：
安装完后，很多配置文件还在原来的安装包里，并没有部署到prefix目标文件夹下，需要手工复制过去，就是上边那两个，一个启动脚本，pure-config.pl 还有性能监控工具，统计工具等。
另外一个经常出现的问题：(为了重现，还得修改成错误的)
 421 配置错误: 无效的SQL配置文件: /opt/pure-ftpd/etc/pureftpd-mysql.conf
这个问题网上很多问的，但解释不到位，这里详细解释一下：我们在编译的时候选择了好多参数，部分参数跟配置是对应的，只有编译相关模块，才能打开相关配置，否则是不行的，会报错，但这个软件报错不报错误行数，所以调试起来比较费劲，我是一个个配置行进行开关才发现这个问题的，比如，我开启了这行，MySQLGetRatioDL SELECT DLRatio FROM users WHERE User=&#8221;\L&#8221; 但我编译的时候未加 ratio这个参数，就报错了，所以在调试的时候一定要对照一下编译时候的参数。
mysql中，密码我用的encryt加密，调试记得打开防火墙，其他没什么需要注意的。
]]></description>
			<content:encoded><![CDATA[<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">cp /opt/mysql-5.0.22/lib/mysql/* /usr/lib&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; #解决编译依赖库问题</li>
<li>./configure --prefix=/opt/pure-ftpd \</li>
<li>--with-mysql=/opt/mysql-5.0.22 \</li>
<li>--with-rfc2640 \</li>
<li>--with-language=simplified-chinese \</li>
<li>--with-peruserlimits \</li>
<li>--with-diraliases \</li>
<li>--with-virtualchroot \</li>
<li>--with-virtualhosts \</li>
<li>--with-welcomemsg \</li>
<li>--with-ftpwho \</li>
<li>--with-quotas \</li>
<li>--with-throttling \</li>
<li>--with-cookie \</li>
<li>--with-extauth \</li>
<li>--with-puredb \</li>
<li>--with-altlog \</li>
<li>--with-sysquotas \</li>
<li>--with-paranoidmsg \</li>
<li>--with-ascii \</li>
<li>--with-inetd</li>
<li>&nbsp;</li>
<li>cp  $install_dir/pureftpd-mysql.conf /opt/pure-ftpd/</li>
<li>cp  $install_dir/configuration-file/pure-config.pl pure-ftpd.conf /opt/pure-ftpd/</li></ol></div>
<p>启动服务  /opt/pure-ftpd/pure-config.pl pure-ftpd.conf</p>
<p>这里补充完整：<br />
安装完后，很多配置文件还在原来的安装包里，并没有部署到prefix目标文件夹下，需要手工复制过去，就是上边那两个，一个启动脚本，pure-config.pl 还有性能监控工具，统计工具等。<br />
另外一个经常出现的问题：(为了重现，还得修改成错误的)<br />
 421 配置错误: 无效的SQL配置文件: /opt/pure-ftpd/etc/pureftpd-mysql.conf<br />
这个问题网上很多问的，但解释不到位，这里详细解释一下：我们在编译的时候选择了好多参数，部分参数跟配置是对应的，只有编译相关模块，才能打开相关配置，否则是不行的，会报错，但这个软件报错不报错误行数，所以调试起来比较费劲，我是一个个配置行进行开关才发现这个问题的，比如，我开启了这行，MySQLGetRatioDL SELECT DLRatio FROM users WHERE User=&#8221;\L&#8221; 但我编译的时候未加 ratio这个参数，就报错了，所以在调试的时候一定要对照一下编译时候的参数。<br />
mysql中，密码我用的encryt加密，调试记得打开防火墙，其他没什么需要注意的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/18/pure-ftpd%e5%ae%89%e8%a3%85%e9%85%8d%e7%bd%ae%e8%8d%89%e7%a8%bf%ef%bc%8d%e8%a1%a5%e5%85%85%e5%ae%8c%e5%85%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>sunboyu-amp-fastcgi-suexec-v21-alpha 发布</title>
		<link>http://www.sunboyu.cn/2008/12/15/sunboyu-amp-fastcgi-suexec-v21-alpha-%e5%8f%91%e5%b8%83.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/15/sunboyu-amp-fastcgi-suexec-v21-alpha-%e5%8f%91%e5%b8%83.shtml#comments</comments>
		<pubDate>Mon, 15 Dec 2008 13:58:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[fastcgi]]></category>

		<category><![CDATA[LAMP]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[suexec]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=428</guid>
		<description><![CDATA[Linux下APACHE MYSQL PHP FCgid Suexec 自动安装脚本V2.1
1、增加了PHP &#8211;enable-bcmath 参数，支持高精度函数库
2、增加了ncurses MYSQL的一个依赖库
3、增加了apache &#8211;enable-so 参数
sunboyu-amp-fastcgi-suexec-v21-alpha
此脚本在Centos4.7ServerCD 最小安装，root账户下执行完全正常。
]]></description>
			<content:encoded><![CDATA[<p>Linux下APACHE MYSQL PHP FCgid Suexec 自动安装脚本V2.1<br />
1、增加了PHP &#8211;enable-bcmath 参数，支持高精度函数库<br />
2、增加了ncurses MYSQL的一个依赖库<br />
3、增加了apache &#8211;enable-so 参数</p>
<p><a href='http://www.sunboyu.cn/upfiles/2008/12/sunboyu-amp-fastcgi-suexec-v21-alpha.txt'>sunboyu-amp-fastcgi-suexec-v21-alpha</a></p>
<p>此脚本在Centos4.7ServerCD 最小安装，root账户下执行完全正常。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/15/sunboyu-amp-fastcgi-suexec-v21-alpha-%e5%8f%91%e5%b8%83.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>全面切换到CentOS-4.7.ServerCD</title>
		<link>http://www.sunboyu.cn/2008/12/14/%e5%85%a8%e9%9d%a2%e5%88%87%e6%8d%a2%e5%88%b0centos-47servercd.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/14/%e5%85%a8%e9%9d%a2%e5%88%87%e6%8d%a2%e5%88%b0centos-47servercd.shtml#comments</comments>
		<pubDate>Sun, 14 Dec 2008 14:24:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[4.7]]></category>

		<category><![CDATA[centos]]></category>

		<category><![CDATA[servercd]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=427</guid>
		<description><![CDATA[下载地址 http://centos.ustc.edu.cn/centos/4.7/isos/x86_64/CentOS-4.7.ServerCD-x86_64.iso
注：根据需要下载x86_64或者i386版本
一般x86_64跑服务器或者64位CPU上，家用台式一般用i386，不过现在比较好的家用cpu也64位，我的就比较落后了……
安装还是老一套，我用vmware模拟的scis硬盘安装，选择的定制安全，选择组件那步直接选择mini安装即可。
因为5一直没有servercd，而发行版又太大，3个多G，所以还是选择这个精简的服务器版本。
]]></description>
			<content:encoded><![CDATA[<p>下载地址 http://centos.ustc.edu.cn/centos/4.7/isos/x86_64/CentOS-4.7.ServerCD-x86_64.iso<br />
注：根据需要下载x86_64或者i386版本<br />
一般x86_64跑服务器或者64位CPU上，家用台式一般用i386，不过现在比较好的家用cpu也64位，我的就比较落后了……</p>
<p>安装还是老一套，我用vmware模拟的scis硬盘安装，选择的定制安全，选择组件那步直接选择mini安装即可。</p>
<p>因为5一直没有servercd，而发行版又太大，3个多G，所以还是选择这个精简的服务器版本。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/14/%e5%85%a8%e9%9d%a2%e5%88%87%e6%8d%a2%e5%88%b0centos-47servercd.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP引用机制和垃圾回收机制详解</title>
		<link>http://www.sunboyu.cn/2008/12/12/php%e5%bc%95%e7%94%a8%e6%9c%ba%e5%88%b6%e5%92%8c%e5%9e%83%e5%9c%be%e5%9b%9e%e6%94%b6%e6%9c%ba%e5%88%b6%e8%af%a6%e8%a7%a3.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/12/php%e5%bc%95%e7%94%a8%e6%9c%ba%e5%88%b6%e5%92%8c%e5%9e%83%e5%9c%be%e5%9b%9e%e6%94%b6%e6%9c%ba%e5%88%b6%e8%af%a6%e8%a7%a3.shtml#comments</comments>
		<pubDate>Fri, 12 Dec 2008 14:16:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[垃圾回收]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=426</guid>
		<description><![CDATA[PHP对变量的跟踪，其实是采用引用，比如 $a = &#8220;test&#8221; 那么就是在内存中开辟一个存储区，保存 test，$a 做为test的引用。
同时我们可以 $b = &#38;$a,$b作为 $a的引用，他们同时指向test存储空间。
在文章  http://www.sunboyu.cn/2008/11/19/php%E4%B8%AD%E5%8F%98%E9%87%8F%E5%BC%95%E7%94%A8%E8%AF%A6%E8%A7%A3.shtml    中，我们做了一个应用的测试，当删除一个引用后，变量并不消失，是因为PHP使用一个引用计数的东东。当$a=&#8221;test&#8221;建立后，test的引用计数就是1，建立 $b=&#38;$a后，test的引用计数就是2，删除任何一个引用后，引用计数为1.
只要是引用计数不为0的数据，则为当前有效的数据。然而，当数据的引用计数为0的时候，系统就会识别此数据为垃圾数据，需要回收，这也就形成了PHP的垃圾回收机制。
]]></description>
			<content:encoded><![CDATA[<p>PHP对变量的跟踪，其实是采用引用，比如 $a = &#8220;test&#8221; 那么就是在内存中开辟一个存储区，保存 test，$a 做为test的引用。</p>
<p>同时我们可以 $b = &amp;$a,$b作为 $a的引用，他们同时指向test存储空间。</p>
<p>在文章  http://www.sunboyu.cn/2008/11/19/php%E4%B8%AD%E5%8F%98%E9%87%8F%E5%BC%95%E7%94%A8%E8%AF%A6%E8%A7%A3.shtml    中，我们做了一个应用的测试，当删除一个引用后，变量并不消失，是因为PHP使用一个引用计数的东东。当$a=&#8221;test&#8221;建立后，test的引用计数就是1，建立 $b=&amp;$a后，test的引用计数就是2，删除任何一个引用后，引用计数为1.</p>
<p>只要是引用计数不为0的数据，则为当前有效的数据。然而，当数据的引用计数为0的时候，系统就会识别此数据为垃圾数据，需要回收，这也就形成了PHP的垃圾回收机制。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/12/php%e5%bc%95%e7%94%a8%e6%9c%ba%e5%88%b6%e5%92%8c%e5%9e%83%e5%9c%be%e5%9b%9e%e6%94%b6%e6%9c%ba%e5%88%b6%e8%af%a6%e8%a7%a3.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>互联网的浮躁</title>
		<link>http://www.sunboyu.cn/2008/12/12/%e4%ba%92%e8%81%94%e7%bd%91%e7%9a%84%e6%b5%ae%e8%ba%81.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/12/%e4%ba%92%e8%81%94%e7%bd%91%e7%9a%84%e6%b5%ae%e8%ba%81.shtml#comments</comments>
		<pubDate>Fri, 12 Dec 2008 09:07:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[相当拍砖]]></category>

		<category><![CDATA[互联网]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=425</guid>
		<description><![CDATA[前几天，QQ上有个哥们问我做个网站多少钱，这类问题我还是仔细得回答了，虽然很烦：按照网站复杂度定价格，你们详细规划网站了么？
兄弟很羞涩得说，他在创业，没钱，没技术，想用Discuz的产品做一个简单的网站去运营。
不排除可能成功，因为目前我知道很多网站就是用这么简单的一个东西做大的，比如chinaunix，55bbs，所以，我没资格说你这么做不行，扯淡，或者是把希望留给了有梦想的人。
目前一些人，在做视频，在做webgame（sns）。这两个行当是不是真有公司挣钱了，我不知道，反正我知道做这个烧钱厉害，而且很多人在继续做。
纵观互联网格局，俨然不是90年代初的股市，只要进钱就是翻。中国互联网起步阶段，网易靠提供电子邮件和虚拟主机发家了，王志东靠写汉卡成功了，戴志康写了个discuz成功了（虽然前期版本有抄袭嫌疑），有人从高丽棒子那弄个传奇，也挣得盆满钵满。
看现在，一个个新生事情的出现，然后又蹦出无数的追随者：youtobe出售，国内一堆搞视频网站的；化工网上市，行业门户林立而起（个人感觉行业门户比较靠普，毕竟是靠近实业），facebook卖了点钱，开心啥啥都起来，暂且不说做得好与否，国内这些创业者的思维的确不敢恭维。没有创新，只有盲从。做事情没有具体的目标，有的干脆只有－上市，收购。
我曾经住在林大旁边，方兴东的办公室就在附近，而今天每次路过，我都在心里暗笑，曾经一个多么伟大的人，带着多么伟大的思想，居然被新浪一棒子打死，连气都没有喘一口。
其实，作为一个打工者，看不惯只知道天天意淫的老板混日子。很多时候，我相信我是肤浅的，作为一个晚辈，我不懂互联网。但我也相信，今天的互联网是浮躁的，也许这次经济的浪潮能冲垮一部分人的梦想，洗清头脑，为行业带来新生。
]]></description>
			<content:encoded><![CDATA[<p>前几天，QQ上有个哥们问我做个网站多少钱，这类问题我还是仔细得回答了，虽然很烦：按照网站复杂度定价格，你们详细规划网站了么？</p>
<p>兄弟很羞涩得说，他在创业，没钱，没技术，想用Discuz的产品做一个简单的网站去运营。</p>
<p>不排除可能成功，因为目前我知道很多网站就是用这么简单的一个东西做大的，比如chinaunix，55bbs，所以，我没资格说你这么做不行，扯淡，或者是把希望留给了有梦想的人。</p>
<p>目前一些人，在做视频，在做webgame（sns）。这两个行当是不是真有公司挣钱了，我不知道，反正我知道做这个烧钱厉害，而且很多人在继续做。</p>
<p>纵观互联网格局，俨然不是90年代初的股市，只要进钱就是翻。中国互联网起步阶段，网易靠提供电子邮件和虚拟主机发家了，王志东靠写汉卡成功了，戴志康写了个discuz成功了（虽然前期版本有抄袭嫌疑），有人从高丽棒子那弄个传奇，也挣得盆满钵满。</p>
<p>看现在，一个个新生事情的出现，然后又蹦出无数的追随者：youtobe出售，国内一堆搞视频网站的；化工网上市，行业门户林立而起（个人感觉行业门户比较靠普，毕竟是靠近实业），facebook卖了点钱，开心啥啥都起来，暂且不说做得好与否，国内这些创业者的思维的确不敢恭维。没有创新，只有盲从。做事情没有具体的目标，有的干脆只有－上市，收购。</p>
<p>我曾经住在林大旁边，方兴东的办公室就在附近，而今天每次路过，我都在心里暗笑，曾经一个多么伟大的人，带着多么伟大的思想，居然被新浪一棒子打死，连气都没有喘一口。</p>
<p>其实，作为一个打工者，看不惯只知道天天意淫的老板混日子。很多时候，我相信我是肤浅的，作为一个晚辈，我不懂互联网。但我也相信，今天的互联网是浮躁的，也许这次经济的浪潮能冲垮一部分人的梦想，洗清头脑，为行业带来新生。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/12/%e4%ba%92%e8%81%94%e7%bd%91%e7%9a%84%e6%b5%ae%e8%ba%81.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>新书，不是一般的新</title>
		<link>http://www.sunboyu.cn/2008/12/12/%e6%96%b0%e4%b9%a6%ef%bc%8c%e4%b8%8d%e6%98%af%e4%b8%80%e8%88%ac%e7%9a%84%e6%96%b0.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/12/%e6%96%b0%e4%b9%a6%ef%bc%8c%e4%b8%8d%e6%98%af%e4%b8%80%e8%88%ac%e7%9a%84%e6%96%b0.shtml#comments</comments>
		<pubDate>Fri, 12 Dec 2008 03:34:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=423</guid>
		<description><![CDATA[
中午到中关村图书大厦购得，不错。
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2008/12/s3140466.jpg"><img class="aligncenter size-full wp-image-424" title="s3140466" src="http://www.sunboyu.cn/upfiles/2008/12/s3140466.jpg" alt="" width="125" height="180" /></a></p>
<p>中午到中关村图书大厦购得，不错。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/12/%e6%96%b0%e4%b9%a6%ef%bc%8c%e4%b8%8d%e6%98%af%e4%b8%80%e8%88%ac%e7%9a%84%e6%96%b0.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>unix不是个简单的玩意，人要知道谦虚</title>
		<link>http://www.sunboyu.cn/2008/12/09/unix%e4%b8%8d%e6%98%af%e4%b8%aa%e7%ae%80%e5%8d%95%e7%9a%84%e7%8e%a9%e6%84%8f%ef%bc%8c%e4%ba%ba%e8%a6%81%e7%9f%a5%e9%81%93%e8%b0%a6%e8%99%9a.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/09/unix%e4%b8%8d%e6%98%af%e4%b8%aa%e7%ae%80%e5%8d%95%e7%9a%84%e7%8e%a9%e6%84%8f%ef%bc%8c%e4%ba%ba%e8%a6%81%e7%9f%a5%e9%81%93%e8%b0%a6%e8%99%9a.shtml#comments</comments>
		<pubDate>Tue, 09 Dec 2008 14:36:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[日记]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=418</guid>
		<description><![CDATA[提醒自己一下，踏踏实实学基础。
周末继续买书去。
]]></description>
			<content:encoded><![CDATA[<p>提醒自己一下，踏踏实实学基础。<br />
周末继续买书去。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/09/unix%e4%b8%8d%e6%98%af%e4%b8%aa%e7%ae%80%e5%8d%95%e7%9a%84%e7%8e%a9%e6%84%8f%ef%bc%8c%e4%ba%ba%e8%a6%81%e7%9f%a5%e9%81%93%e8%b0%a6%e8%99%9a.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>购得一本新书：《Python网络编程基础》</title>
		<link>http://www.sunboyu.cn/2008/12/08/%e8%b4%ad%e5%be%97%e4%b8%80%e6%9c%ac%e6%96%b0%e4%b9%a6%ef%bc%9a%e3%80%8apython%e7%bd%91%e7%bb%9c%e7%bc%96%e7%a8%8b%e5%9f%ba%e7%a1%80%e3%80%8b.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/08/%e8%b4%ad%e5%be%97%e4%b8%80%e6%9c%ac%e6%96%b0%e4%b9%a6%ef%bc%9a%e3%80%8apython%e7%bd%91%e7%bb%9c%e7%bc%96%e7%a8%8b%e5%9f%ba%e7%a1%80%e3%80%8b.shtml#comments</comments>
		<pubDate>Mon, 08 Dec 2008 15:04:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=416</guid>
		<description><![CDATA[过分迷信PHP是不行的，做事还得找专长

]]></description>
			<content:encoded><![CDATA[<p>过分迷信PHP是不行的，做事还得找专长<br />
<a href='http://www.sunboyu.cn/upfiles/2008/12/s2604186.jpg'><img src="http://www.sunboyu.cn/upfiles/2008/12/s2604186.jpg" alt="" title="s2604186" width="105" height="140" class="aligncenter size-full wp-image-417" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/08/%e8%b4%ad%e5%be%97%e4%b8%80%e6%9c%ac%e6%96%b0%e4%b9%a6%ef%bc%9a%e3%80%8apython%e7%bd%91%e7%bb%9c%e7%bc%96%e7%a8%8b%e5%9f%ba%e7%a1%80%e3%80%8b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>解决php模块ssh2的编译问题</title>
		<link>http://www.sunboyu.cn/2008/12/07/%e8%a7%a3%e5%86%b3php%e6%a8%a1%e5%9d%97ssh2%e7%9a%84%e7%bc%96%e8%af%91%e9%97%ae%e9%a2%98.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/07/%e8%a7%a3%e5%86%b3php%e6%a8%a1%e5%9d%97ssh2%e7%9a%84%e7%bc%96%e8%af%91%e9%97%ae%e9%a2%98.shtml#comments</comments>
		<pubDate>Sun, 07 Dec 2008 13:50:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[ssh2]]></category>

		<category><![CDATA[编译]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=415</guid>
		<description><![CDATA[这个问题一google就出来了，官方给出的解决方案，
在config.h里加上一个宏定义 #define LIBSSH2_APINO 200412301450,哇塞，一切OK
http://pecl.php.net/bugs/bug.php?id=9656
/root/ssh2-0.10/ssh2.c: In function 'zif_ssh2_methods_negotiated':
/root/ssh2-0.10/ssh2.c:483: warning: assignment discards qualifiers from pointer target type
/root/ssh2-0.10/ssh2.c:484: warning: assignment discards qualifiers from pointer target type
/root/ssh2-0.10/ssh2.c:485: warning: assignment discards qualifiers from pointer target type
/root/ssh2-0.10/ssh2.c:486: warning: assignment discards qualifiers from pointer target type
/root/ssh2-0.10/ssh2.c:487: warning: assignment discards qualifiers from pointer target type
/root/ssh2-0.10/ssh2.c:488: warning: assignment discards qualifiers from pointer target type
/root/ssh2-0.10/ssh2.c:489: [...]]]></description>
			<content:encoded><![CDATA[<p>这个问题一google就出来了，官方给出的解决方案，<br />
在config.h里加上一个宏定义 #define LIBSSH2_APINO 200412301450,哇塞，一切OK<br />
http://pecl.php.net/bugs/bug.php?id=9656</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">/root/ssh2-0.10/ssh2.c: In function 'zif_ssh2_methods_negotiated':</li>
<li>/root/ssh2-0.10/ssh2.c:483: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:484: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:485: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:486: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:487: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:488: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:489: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:490: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:491: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:492: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c: In function 'zif_ssh2_fingerprint':</li>
<li>/root/ssh2-0.10/ssh2.c:536: warning: assignment discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c: In function 'zif_ssh2_publickey_add':</li>
<li>/root/ssh2-0.10/ssh2.c:1038: warning: passing argument 1 of '_efree' discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c: In function 'zif_ssh2_publickey_list':</li>
<li>/root/ssh2-0.10/ssh2.c:1097: warning: passing argument 4 of 'add_assoc_stringl_ex' discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:1098: warning: passing argument 4 of 'add_assoc_stringl_ex' discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:1106: warning: initialization discards qualifiers from pointer target type</li>
<li>/root/ssh2-0.10/ssh2.c:1107: warning: passing argument 2 of '_zend_hash_add_or_update' discards qualifiers from pointer target type</li>
<li>/bin/sh /root/ssh2-0.10/libtool --mode=compile gcc&nbsp; -I. -I</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/07/%e8%a7%a3%e5%86%b3php%e6%a8%a1%e5%9d%97ssh2%e7%9a%84%e7%bc%96%e8%af%91%e9%97%ae%e9%a2%98.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>山穷水复疑无路，柳暗花明又一村</title>
		<link>http://www.sunboyu.cn/2008/12/07/%e5%b1%b1%e7%a9%b7%e6%b0%b4%e5%a4%8d%e7%96%91%e6%97%a0%e8%b7%af%ef%bc%8c%e6%9f%b3%e6%9a%97%e8%8a%b1%e6%98%8e%e5%8f%88%e4%b8%80%e6%9d%91.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/07/%e5%b1%b1%e7%a9%b7%e6%b0%b4%e5%a4%8d%e7%96%91%e6%97%a0%e8%b7%af%ef%bc%8c%e6%9f%b3%e6%9a%97%e8%8a%b1%e6%98%8e%e5%8f%88%e4%b8%80%e6%9d%91.shtml#comments</comments>
		<pubDate>Sat, 06 Dec 2008 16:13:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[ssh2]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=413</guid>
		<description><![CDATA[学习就是这样，突然发现了PHP居然有ssh2的模块，这样远程连接linux服务器就很容易，我正头疼用socket写个ssh2的连接类，突然就发现了这个玩意。手册看得还是少，罚吃巧克力一块。
官方文档:http://www.php.net/manual/en/book.ssh2.php
]]></description>
			<content:encoded><![CDATA[<p>学习就是这样，突然发现了PHP居然有ssh2的模块，这样远程连接linux服务器就很容易，我正头疼用socket写个ssh2的连接类，突然就发现了这个玩意。手册看得还是少，罚吃巧克力一块。<br />
官方文档:http://www.php.net/manual/en/book.ssh2.php</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/07/%e5%b1%b1%e7%a9%b7%e6%b0%b4%e5%a4%8d%e7%96%91%e6%97%a0%e8%b7%af%ef%bc%8c%e6%9f%b3%e6%9a%97%e8%8a%b1%e6%98%8e%e5%8f%88%e4%b8%80%e6%9d%91.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>CentPHP V1.0 release</title>
		<link>http://www.sunboyu.cn/2008/12/05/centphp-v10-release.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/05/centphp-v10-release.shtml#comments</comments>
		<pubDate>Fri, 05 Dec 2008 14:06:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[CentPHP]]></category>

		<category><![CDATA[php框架]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=412</guid>
		<description><![CDATA[1.0不发布，1.1就不会出来，折腾了半月，终于写了个简单的框架，虽然只有简单的几个类，但基本实现了全OOP的操作。这个归功于网上众多的开源软件，没有这些资源的帮助，就不会有我的进步。
取名CentPHP，是因为我希望它像CentPHP一样强大稳定，而且免费开源。
最终把session的数据库保存方式给去了，因为太麻烦，模板引擎基本没什么功能，只有传值和显示，虽然进行了一些优化，但没有彻底跟踪排查资源调用情况，这个在以后版本要逐渐修正。
下边是相关文件列表，源码～～～～～～～～～等实现完一个项目后放出……
F:.
│  Index.php
│
├─lib
│  └─kernel
│          CentPHP.php
│          Class.Controller.php
│          Class.CP.php
│          Class.Mysql.php
│          Class.Router.php
│ [...]]]></description>
			<content:encoded><![CDATA[<p>1.0不发布，1.1就不会出来，折腾了半月，终于写了个简单的框架，虽然只有简单的几个类，但基本实现了全OOP的操作。这个归功于网上众多的开源软件，没有这些资源的帮助，就不会有我的进步。</p>
<p>取名CentPHP，是因为我希望它像CentPHP一样强大稳定，而且免费开源。</p>
<p>最终把session的数据库保存方式给去了，因为太麻烦，模板引擎基本没什么功能，只有传值和显示，虽然进行了一些优化，但没有彻底跟踪排查资源调用情况，这个在以后版本要逐渐修正。<br />
下边是相关文件列表，源码～～～～～～～～～等实现完一个项目后放出……</p>
<p>F:.<br />
│  Index.php<br />
│<br />
├─lib<br />
│  └─kernel<br />
│          CentPHP.php<br />
│          Class.Controller.php<br />
│          Class.CP.php<br />
│          Class.Mysql.php<br />
│          Class.Router.php<br />
│          Class.URI.php<br />
│          Class.View.php<br />
│          Common.php<br />
│<br />
├─usr<br />
│  ├─config<br />
│  │      Config.Mysql.php<br />
│  │      Config.View.php<br />
│  │<br />
│  ├─controllers<br />
│  │      welcome.php<br />
│  │<br />
│  ├─lib<br />
│  │      Class.Session.php<br />
│  │<br />
│  └─views<br />
│          welcome.php<br />
│<br />
└─var</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/05/centphp-v10-release.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Session处理，比较怪异的应用</title>
		<link>http://www.sunboyu.cn/2008/12/04/session%e5%a4%84%e7%90%86%ef%bc%8c%e6%af%94%e8%be%83%e6%80%aa%e5%bc%82%e7%9a%84%e5%ba%94%e7%94%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/04/session%e5%a4%84%e7%90%86%ef%bc%8c%e6%af%94%e8%be%83%e6%80%aa%e5%bc%82%e7%9a%84%e5%ba%94%e7%94%a8.shtml#comments</comments>
		<pubDate>Thu, 04 Dec 2008 15:47:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[session]]></category>

		<category><![CDATA[钩子]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=411</guid>
		<description><![CDATA[其实我很不喜欢把session放在数据库中处理，不过公司一直这么用，就先这么写，更倒霉的是，花了老大力气集成在一个不适合大项目的小框架里。
session本来是用URI类统一处理，过滤全局变量中的不安全因素，这样依赖，因为要重写session的几个方法，把原来的流程整得乱七八糟。
我正在想，是不是要把他做成一个钩子，钩挂在原来系统中，通过命令的方式开关，这样貌似是个不错的办法，不过，得把钩子的类写好……
补充：session放到数据库中的好处：可以即时得查看在新的用户（当然不是非常准确），可以踢人，如果是有登录认证的话。缺点：速度贼拉得慢，不如放到内存中。操作一次内存，得反复读写数据库，且不说硬盘，网络传输就是不消的消耗。
]]></description>
			<content:encoded><![CDATA[<p>其实我很不喜欢把session放在数据库中处理，不过公司一直这么用，就先这么写，更倒霉的是，花了老大力气集成在一个不适合大项目的小框架里。<br />
session本来是用URI类统一处理，过滤全局变量中的不安全因素，这样依赖，因为要重写session的几个方法，把原来的流程整得乱七八糟。<br />
我正在想，是不是要把他做成一个钩子，钩挂在原来系统中，通过命令的方式开关，这样貌似是个不错的办法，不过，得把钩子的类写好……</p>
<p>补充：session放到数据库中的好处：可以即时得查看在新的用户（当然不是非常准确），可以踢人，如果是有登录认证的话。缺点：速度贼拉得慢，不如放到内存中。操作一次内存，得反复读写数据库，且不说硬盘，网络传输就是不消的消耗。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/04/session%e5%a4%84%e7%90%86%ef%bc%8c%e6%af%94%e8%be%83%e6%80%aa%e5%bc%82%e7%9a%84%e5%ba%94%e7%94%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP5.2.7RC版本发布</title>
		<link>http://www.sunboyu.cn/2008/12/04/php527rc%e7%89%88%e6%9c%ac%e5%8f%91%e5%b8%83.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/04/php527rc%e7%89%88%e6%9c%ac%e5%8f%91%e5%b8%83.shtml#comments</comments>
		<pubDate>Thu, 04 Dec 2008 04:01:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[php5.2.7]]></category>

		<category><![CDATA[发布]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=410</guid>
		<description><![CDATA[官方地址 http://qa.php.net/
下载地址 http://downloads.php.net/ilia/php-5.2.7RC5.tar.gz
]]></description>
			<content:encoded><![CDATA[<p>官方地址 http://qa.php.net/</p>
<p>下载地址 http://downloads.php.net/ilia/php-5.2.7RC5.tar.gz</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/04/php527rc%e7%89%88%e6%9c%ac%e5%8f%91%e5%b8%83.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Windows下安装Apache，Mysql，PHP过程详解</title>
		<link>http://www.sunboyu.cn/2008/12/04/windows%e4%b8%8b%e5%ae%89%e8%a3%85apache%ef%bc%8cmysql%ef%bc%8cphp%e8%bf%87%e7%a8%8b%e8%af%a6%e8%a7%a3.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/04/windows%e4%b8%8b%e5%ae%89%e8%a3%85apache%ef%bc%8cmysql%ef%bc%8cphp%e8%bf%87%e7%a8%8b%e8%af%a6%e8%a7%a3.shtml#comments</comments>
		<pubDate>Thu, 04 Dec 2008 01:40:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[wamp]]></category>

		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=409</guid>
		<description><![CDATA[原则：使用官方程序，完全自己配置，不使用其他辅助工具套件等。
准备：
apache2.2.*   http://httpd.apache.org/download.cgi   如果有stable版本，最好用stable版，其实最新版作为调试也不错
PHP5.2.*  http://www.php.net/downloads.php  目前是5.2.6
mysql5.1  http://dev.mysql.com/downloads/mysql/5.1.html  下载windows安装版本
1、安装Apache，安装路径随意，默认即可，手工管理更好，建议放到 d:\Apache 放D盘是为了以后重装的话，所有的配置文件都还在（备份不仅要备份数据，还要备份不起眼的配置文件）
2、安装Mysql，同上，安装到 D:\Mysql  理由同上
3、解压PHP5.2.×至目录 D:\PHP5 理由还是同上
4、配置环境变量：在桌面上找到“我的电脑”，右键点击“我的电脑”，选择“属性”里的“高级”标签，点击“环境变量”，在“系统变量”里找到“Path”，点击“编辑”按钮，在“变量值”后面加上“;D:\PHP5\;D:\PHP5\ext”，然后点“确定”退出。环境变量配置完成。（windows下Path环境变量是做什么用，google一下先，这样设置后，系统会自动搜索PHP目录里的可执行文件和加载类库）
5、进入PHP5目录下，找到php.ini-dist文件，将其复制到C盘的WINDOWS目录下，并将其文件名修改为“php.ini”。（php会默认从这个路径找php.ini这个文件，当然也可以手工指定这个目录，修改apache的配置文件即可）
6、再次进入PHP5目录下，将以下文件复制到C盘的WINDOWS目录下的System32里：（原因，我也不太清楚，但貌似可以设置一个环境变量指向这个路径就ok，那个方法一直没找到，也没理解）
fdftk.dll
gds32.dll
libeay32.dll
libmcrypt.dll
libmhash.dll
libmysql.dll
msql.dll
news.txt
ntwdblib.dll
7、打开Apache的主目录，进入conf文件夹，找到“httpd.conf”文件，为操作方便起见，建议使用Dreamweaver打开它。打开后在第126行左右找到 LoadModule vhost_alias_module modules/mod_vhost_alias.so，在后面添加以下语句：
LoadModule php5_module &#8220;D:/PHP5/php5apache2_2_filter.dll
&#8220;AddType application/x-httpd-php .php
添加完成后保存文件。
8、在apache主目录下htdocs下创建index.php文件，内容为&#60;?php phpinfo(); ?&#62;保存。
9、在浏览器的地址栏里输入http://127.0.0.1/index.php。即可打开显示PHP信息的页面。配置成功。
]]></description>
			<content:encoded><![CDATA[<p>原则：使用官方程序，完全自己配置，不使用其他辅助工具套件等。</p>
<p>准备：</p>
<p>apache2.2.*   http://httpd.apache.org/download.cgi   如果有stable版本，最好用stable版，其实最新版作为调试也不错</p>
<p>PHP5.2.*  http://www.php.net/downloads.php  目前是5.2.6</p>
<p>mysql5.1  http://dev.mysql.com/downloads/mysql/5.1.html  下载windows安装版本</p>
<p>1、安装Apache，安装路径随意，默认即可，手工管理更好，建议放到 d:\Apache 放D盘是为了以后重装的话，所有的配置文件都还在（备份不仅要备份数据，还要备份不起眼的配置文件）</p>
<p>2、安装Mysql，同上，安装到 D:\Mysql  理由同上</p>
<p>3、解压PHP5.2.×至目录 D:\PHP5 理由还是同上</p>
<p>4、配置环境变量：在桌面上找到“我的电脑”，右键点击“我的电脑”，选择“属性”里的“高级”标签，点击“环境变量”，在“系统变量”里找到“Path”，点击“编辑”按钮，在“变量值”后面加上“;D:\PHP5\;D:\PHP5\ext”，然后点“确定”退出。环境变量配置完成。（windows下Path环境变量是做什么用，google一下先，这样设置后，系统会自动搜索PHP目录里的可执行文件和加载类库）</p>
<p>5、进入PHP5目录下，找到php.ini-dist文件，将其复制到C盘的WINDOWS目录下，并将其文件名修改为“php.ini”。（php会默认从这个路径找php.ini这个文件，当然也可以手工指定这个目录，修改apache的配置文件即可）</p>
<p>6、再次进入PHP5目录下，将以下文件复制到C盘的WINDOWS目录下的System32里：（原因，我也不太清楚，但貌似可以设置一个环境变量指向这个路径就ok，那个方法一直没找到，也没理解）<br />
fdftk.dll<br />
gds32.dll<br />
libeay32.dll<br />
libmcrypt.dll<br />
libmhash.dll<br />
libmysql.dll<br />
msql.dll<br />
news.txt<br />
ntwdblib.dll</p>
<p>7、打开Apache的主目录，进入conf文件夹，找到“httpd.conf”文件，为操作方便起见，建议使用Dreamweaver打开它。打开后在第126行左右找到 LoadModule vhost_alias_module modules/mod_vhost_alias.so，在后面添加以下语句：<br />
LoadModule php5_module &#8220;D:/PHP5/php5apache2_2_filter.dll<br />
&#8220;AddType application/x-httpd-php .php<br />
添加完成后保存文件。</p>
<p>8、在apache主目录下htdocs下创建index.php文件，内容为&lt;?php phpinfo(); ?&gt;保存。</p>
<p>9、在浏览器的地址栏里输入http://127.0.0.1/index.php。即可打开显示PHP信息的页面。配置成功。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/04/windows%e4%b8%8b%e5%ae%89%e8%a3%85apache%ef%bc%8cmysql%ef%bc%8cphp%e8%bf%87%e7%a8%8b%e8%af%a6%e8%a7%a3.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>框架资源消耗分析</title>
		<link>http://www.sunboyu.cn/2008/12/03/%e6%a1%86%e6%9e%b6%e8%b5%84%e6%ba%90%e6%b6%88%e8%80%97%e5%88%86%e6%9e%90.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/03/%e6%a1%86%e6%9e%b6%e8%b5%84%e6%ba%90%e6%b6%88%e8%80%97%e5%88%86%e6%9e%90.shtml#comments</comments>
		<pubDate>Wed, 03 Dec 2008 14:42:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[效率]]></category>

		<category><![CDATA[框架]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=408</guid>
		<description><![CDATA[简单使用了下CI框架，发现了不少技巧：在 Controller类中实例化了好多的类
function _ci_initialize()
	{
		// Assign all the class objects that were instantiated by the
		// front controller to local class variables so that CI can be
		// run as one big super object.
		$classes = array(
							'config'	=&#62; 'Config',
							'input'		=&#62; 'Input',
							'benchmark'	=&#62; 'Benchmark',
							'uri'		=&#62; 'URI',
							'output'	=&#62; 'Output',
							'lang'		=&#62; 'Language',
							'router'	=&#62; 'Router'
							);
		
		foreach ($classes as $var =&#62; $class)
		{
			$this-&#62;$var =&#38; load_class($class);
		}
&#160;
		// In PHP 5 the Loader class is run as [...]]]></description>
			<content:encoded><![CDATA[<p>简单使用了下CI框架，发现了不少技巧：在 Controller类中实例化了好多的类</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">function _ci_initialize()</li>
<li>	{</li>
<li>		// Assign all the class objects that were instantiated by the</li>
<li>		// front controller to local class variables so that CI can be</li>
<li>		// run as one big super object.</li>
<li>		$classes = array(</li>
<li>							'config'	=&gt; 'Config',</li>
<li>							'input'		=&gt; 'Input',</li>
<li>							'benchmark'	=&gt; 'Benchmark',</li>
<li>							'uri'		=&gt; 'URI',</li>
<li>							'output'	=&gt; 'Output',</li>
<li>							'lang'		=&gt; 'Language',</li>
<li>							'router'	=&gt; 'Router'</li>
<li>							);</li>
<li>		</li>
<li>		foreach ($classes as $var =&gt; $class)</li>
<li>		{</li>
<li>			$this-&gt;$var =&amp; load_class($class);</li>
<li>		}</li>
<li>&nbsp;</li>
<li>		// In PHP 5 the Loader class is run as a discreet</li>
<li>		// class.&nbsp; In PHP 4 it extends the Controller</li>
<li>		if (floor(phpversion()) &gt;= 5)</li>
<li>		{</li>
<li>			$this-&gt;load =&amp; load_class('Loader');</li>
<li>			$this-&gt;load-&gt;_ci_autoloader();</li>
<li>		}</li>
<li>		else</li>
<li>		{</li>
<li>			$this-&gt;_ci_autoloader();</li>
<li>			</li>
<li>			// sync up the objects since PHP4 was working from a copy</li>
<li>			foreach (array_keys(get_object_vars($this)) as $attribute)</li>
<li>			{</li>
<li>				if (is_object($this-&gt;$attribute))</li>
<li>				{</li>
<li>					$this-&gt;load-&gt;$attribute =&amp; $this-&gt;$attribute;</li>
<li>				}</li>
<li>			}</li>
<li>		}</li></ol></div>
<p>然后在默认welcome的模型里print_r($this),那是一个密密麻麻阿，无数的实例化数据摆在这里，估计内存CPU消耗也是惊人。<br />
当然，作者并不是没有解决这些问题，所有的类在实例化之后使用static的方式常驻内存中，在第一次加载后，响应时间明显缩短，我本地测试是否默认实例化如此多的对象速度没有明显的差别。<br />
对于原来我写程序，其实是有洁癖的，或者是心理障碍，就是像写C一样仔细考虑每个变量和每个方法，计算操作复杂度，其实对于整个系统开发和PHP这们语言来说，这么开发其实是杞人忧天，因为PHP本身就可以处理这些问题，比如static方法，一些缓存。<br />
在进行各种测试之后，我的类库居然也默认加载了一些方法，只是应用在小网站中。<br />
对于大型网站，还是要充分考虑效率性能的问题。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/03/%e6%a1%86%e6%9e%b6%e8%b5%84%e6%ba%90%e6%b6%88%e8%80%97%e5%88%86%e6%9e%90.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>在懒惰中发展</title>
		<link>http://www.sunboyu.cn/2008/12/02/%e5%9c%a8%e6%87%92%e6%83%b0%e4%b8%ad%e5%8f%91%e5%b1%95.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/02/%e5%9c%a8%e6%87%92%e6%83%b0%e4%b8%ad%e5%8f%91%e5%b1%95.shtml#comments</comments>
		<pubDate>Tue, 02 Dec 2008 14:39:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[危机]]></category>

		<category><![CDATA[发展]]></category>

		<category><![CDATA[学习]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=407</guid>
		<description><![CDATA[最近写代码总有疲倦的感觉，可能是快过年了，心思全在年关上。
期望中的框架也许全是OOP+非常规范的结构，其实未必是最合理的，为了偷懒，部分操作还是用函数来实现，然后通过引用把函数附给类的方法，其实这样解决了很多问题，可以在类中直接调用，也可以作为类的一个方法。这样节约了代码，节约了操作。
本想买本SOA的书看看，最终还是没走到书店，跟上半年学习的激情相差老远。经济危机，多少会优点压力，工作的压力是一部分，社会给予的无形压力最能压人，社会是真正的敌人。记得中学老师总说大学是半个社会，现在真走到社会上，才发现那些老师其实混得比我惨多了，他们压力更大。他们能顶住，我为何不能。
今天去了一个车行买了点配件，把车装修一下，车老板是个女孩，正在考研，她老公帮她打理店铺。其实这是我简单的目标，有自己的一个小店，也需收入不是多么丰厚，但一定要留出自己发展的道路。
保证每天翻书，一定得坚持，即使一天一页。
]]></description>
			<content:encoded><![CDATA[<p>最近写代码总有疲倦的感觉，可能是快过年了，心思全在年关上。</p>
<p>期望中的框架也许全是OOP+非常规范的结构，其实未必是最合理的，为了偷懒，部分操作还是用函数来实现，然后通过引用把函数附给类的方法，其实这样解决了很多问题，可以在类中直接调用，也可以作为类的一个方法。这样节约了代码，节约了操作。</p>
<p>本想买本SOA的书看看，最终还是没走到书店，跟上半年学习的激情相差老远。经济危机，多少会优点压力，工作的压力是一部分，社会给予的无形压力最能压人，社会是真正的敌人。记得中学老师总说大学是半个社会，现在真走到社会上，才发现那些老师其实混得比我惨多了，他们压力更大。他们能顶住，我为何不能。</p>
<p>今天去了一个车行买了点配件，把车装修一下，车老板是个女孩，正在考研，她老公帮她打理店铺。其实这是我简单的目标，有自己的一个小店，也需收入不是多么丰厚，但一定要留出自己发展的道路。</p>
<p>保证每天翻书，一定得坚持，即使一天一页。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/02/%e5%9c%a8%e6%87%92%e6%83%b0%e4%b8%ad%e5%8f%91%e5%b1%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>框架开发的两个主方向</title>
		<link>http://www.sunboyu.cn/2008/12/02/%e6%a1%86%e6%9e%b6%e5%bc%80%e5%8f%91%e7%9a%84%e4%b8%a4%e4%b8%aa%e4%b8%bb%e6%96%b9%e5%90%91.shtml</link>
		<comments>http://www.sunboyu.cn/2008/12/02/%e6%a1%86%e6%9e%b6%e5%bc%80%e5%8f%91%e7%9a%84%e4%b8%a4%e4%b8%aa%e4%b8%bb%e6%96%b9%e5%90%91.shtml#comments</comments>
		<pubDate>Tue, 02 Dec 2008 05:50:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[内存消耗]]></category>

		<category><![CDATA[效率]]></category>

		<category><![CDATA[框架]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=406</guid>
		<description><![CDATA[最近一直在研究框架，翻阅了各大框架结构，最后总结出两点：性能和接口规范。
1、接口规范
框架的一大意义在于整合类库和资源，使用统一的接口和统一的方式进行调用，统一的接口又更加方便其他资源的整合，模块化的管理更容易对代码进行管理。这样，可以使得不同的开发人员形成一致的风格进行分工协作。
2、效率
框架在整合类库，判断路由的时候，毕竟消耗很多冗余操作。太多的类库加载也将耗费很多的内存和CPU，因此，框架开发的另一个要点就是要降低操作复杂性，降低内存消耗，在这个基础上有可优化性。
总结到这里，晚上继续玩命……
]]></description>
			<content:encoded><![CDATA[<p>最近一直在研究框架，翻阅了各大框架结构，最后总结出两点：性能和接口规范。<br />
1、接口规范<br />
框架的一大意义在于整合类库和资源，使用统一的接口和统一的方式进行调用，统一的接口又更加方便其他资源的整合，模块化的管理更容易对代码进行管理。这样，可以使得不同的开发人员形成一致的风格进行分工协作。<br />
2、效率<br />
框架在整合类库，判断路由的时候，毕竟消耗很多冗余操作。太多的类库加载也将耗费很多的内存和CPU，因此，框架开发的另一个要点就是要降低操作复杂性，降低内存消耗，在这个基础上有可优化性。</p>
<p>总结到这里，晚上继续玩命……</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/12/02/%e6%a1%86%e6%9e%b6%e5%bc%80%e5%8f%91%e7%9a%84%e4%b8%a4%e4%b8%aa%e4%b8%bb%e6%96%b9%e5%90%91.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>框架学习之起步阶段：罗马的出发</title>
		<link>http://www.sunboyu.cn/2008/11/27/%e6%a1%86%e6%9e%b6%e5%ad%a6%e4%b9%a0%e4%b9%8b%e8%b5%b7%e6%ad%a5%e9%98%b6%e6%ae%b5%ef%bc%9a%e7%bd%97%e9%a9%ac%e7%9a%84%e5%87%ba%e5%8f%91.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/27/%e6%a1%86%e6%9e%b6%e5%ad%a6%e4%b9%a0%e4%b9%8b%e8%b5%b7%e6%ad%a5%e9%98%b6%e6%ae%b5%ef%bc%9a%e7%bd%97%e9%a9%ac%e7%9a%84%e5%87%ba%e5%8f%91.shtml#comments</comments>
		<pubDate>Thu, 27 Nov 2008 14:11:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[url路由]]></category>

		<category><![CDATA[框架]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=403</guid>
		<description><![CDATA[罗马真的不是一天建成的，不能不承认，那些框架作者在此花费的精力。我的框架只写了一个说明，两个函数，就已经尽兴不下去了，当然跟这几天的感冒有关，不过，更多的是我没有理清框架应该有的结构。
一个优秀的框架除了规范化大部分操作外，其在效率和性能损耗上做了进步一的改进，从而能够高效处理复杂的操作。
第一个自动加载类的函数，参考了下PHP手册关于引用部分，才发现自己原来写类的方法，是如何的消耗内存和CPU，任何一个方法的诞生都是有其目的的，不能认为PHP是神，但PHP毕竟比我强，因此我还是要相信这些我不熟悉的操作是有用武之地的。
第二个方法，是要定义URI路由，URI路由我会尽量使用逐一匹配的方式进行解析，但有些操作不确定变量数量的时候，简单使用正则。我正则不很强，但也对着手册也可以写，但我总感觉这玩意太费劲，大脑想着费劲，电脑做着肯定费劲。有简单的方式，为何用难的，难道只是为了省点代码空间么，没必要的。
不过说到底，正则这东西还是很有用，不能因为效率差而失去，计划写个分支，把简单的用模板匹配，复杂的用正则，皆大欢喜。
不过写之前，还是要大量翻看别人的东西。
]]></description>
			<content:encoded><![CDATA[<p>罗马真的不是一天建成的，不能不承认，那些框架作者在此花费的精力。我的框架只写了一个说明，两个函数，就已经尽兴不下去了，当然跟这几天的感冒有关，不过，更多的是我没有理清框架应该有的结构。</p>
<p>一个优秀的框架除了规范化大部分操作外，其在效率和性能损耗上做了进步一的改进，从而能够高效处理复杂的操作。</p>
<p>第一个自动加载类的函数，参考了下PHP手册关于引用部分，才发现自己原来写类的方法，是如何的消耗内存和CPU，任何一个方法的诞生都是有其目的的，不能认为PHP是神，但PHP毕竟比我强，因此我还是要相信这些我不熟悉的操作是有用武之地的。</p>
<p>第二个方法，是要定义URI路由，URI路由我会尽量使用逐一匹配的方式进行解析，但有些操作不确定变量数量的时候，简单使用正则。我正则不很强，但也对着手册也可以写，但我总感觉这玩意太费劲，大脑想着费劲，电脑做着肯定费劲。有简单的方式，为何用难的，难道只是为了省点代码空间么，没必要的。</p>
<p>不过说到底，正则这东西还是很有用，不能因为效率差而失去，计划写个分支，把简单的用模板匹配，复杂的用正则，皆大欢喜。</p>
<p>不过写之前，还是要大量翻看别人的东西。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/27/%e6%a1%86%e6%9e%b6%e5%ad%a6%e4%b9%a0%e4%b9%8b%e8%b5%b7%e6%ad%a5%e9%98%b6%e6%ae%b5%ef%bc%9a%e7%bd%97%e9%a9%ac%e7%9a%84%e5%87%ba%e5%8f%91.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>我的一个虚拟主机配置，支持suexec+fastcgi+php+perl</title>
		<link>http://www.sunboyu.cn/2008/11/22/%e6%88%91%e7%9a%84%e4%b8%80%e4%b8%aa%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%ae%ef%bc%8c%e6%94%af%e6%8c%81suexecfastcgiphpperl.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/22/%e6%88%91%e7%9a%84%e4%b8%80%e4%b8%aa%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%ae%ef%bc%8c%e6%94%af%e6%8c%81suexecfastcgiphpperl.shtml#comments</comments>
		<pubDate>Sat, 22 Nov 2008 05:36:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[虚拟主机]]></category>

		<category><![CDATA[配置]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=392</guid>
		<description><![CDATA[&#60;virtualhost *:80&#62;
&#160;&#160; &#160;SuexecUserGroup www www
&#160;&#160; &#160;ServerAdmin webmaster@dummy-host.example.com
&#160;&#160; &#160;DocumentRoot &#34;/home/www/php&#34;
&#160;&#160; &#160;ServerName 192.168.43.129
&#160;&#160; &#160;ServerAlias www.dummy-host.example.com
&#160;&#160; &#160;ErrorLog &#34;logs/dummy-host.example.com-error_log&#34;
&#160;&#160; &#160;CustomLog &#34;logs/dummy-host.example.com-access_log&#34; combined
&#160;&#160; &#160;&#60;directory /home/www/php&#62;
&#160;&#160; &#160; &#160; &#160;AddHandler fcgid-script .php
&#160;&#160; &#160; &#160; &#160;AddHandler perl-script .pl .cgi
&#160;&#160; &#160; &#160; &#160;PerlResponseHandler ModPerl::Registry
&#160;&#160; &#160; &#160; &#160;PerlOptions +ParseHeaders
&#160;&#160; &#160; &#160; &#160;PerlOptions +SetupEnv
&#160;&#160; &#160; &#160; &#160;FCGIWrapper /home/www/php-cgi .php
&#160;&#160; &#160; &#160; &#160;Options ExecCGI +FollowSymLinks SymLinksIfOwnerMatch
&#160;&#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">&lt;virtualhost *:80&gt;</li>
<li>&nbsp;&nbsp; &nbsp;SuexecUserGroup www www</li>
<li>&nbsp;&nbsp; &nbsp;ServerAdmin webmaster@dummy-host.example.com</li>
<li>&nbsp;&nbsp; &nbsp;DocumentRoot &quot;/home/www/php&quot;</li>
<li>&nbsp;&nbsp; &nbsp;ServerName 192.168.43.129</li>
<li>&nbsp;&nbsp; &nbsp;ServerAlias www.dummy-host.example.com</li>
<li>&nbsp;&nbsp; &nbsp;ErrorLog &quot;logs/dummy-host.example.com-error_log&quot;</li>
<li>&nbsp;&nbsp; &nbsp;CustomLog &quot;logs/dummy-host.example.com-access_log&quot; combined</li>
<li>&nbsp;&nbsp; &nbsp;&lt;directory /home/www/php&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;AddHandler fcgid-script .php</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;AddHandler perl-script .pl .cgi</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;PerlResponseHandler ModPerl::Registry</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;PerlOptions +ParseHeaders</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;PerlOptions +SetupEnv</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;FCGIWrapper /home/www/php-cgi .php</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Options ExecCGI +FollowSymLinks SymLinksIfOwnerMatch</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;allow from all</li>
<li>&nbsp;&nbsp; &nbsp;&lt;/directory&gt;</li>
<li>&lt;/virtualhost&gt;</li></ol></div>
<p>老一套，要注意的是各种脚本的映射，容器的合理使用。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/22/%e6%88%91%e7%9a%84%e4%b8%80%e4%b8%aa%e8%99%9a%e6%8b%9f%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%ae%ef%bc%8c%e6%94%af%e6%8c%81suexecfastcgiphpperl.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>给APACHE增加mod_perl,使其支持perl脚本编写的程序</title>
		<link>http://www.sunboyu.cn/2008/11/21/%e7%bb%99apache%e5%a2%9e%e5%8a%a0mod_perl%e4%bd%bf%e5%85%b6%e6%94%af%e6%8c%81perl%e8%84%9a%e6%9c%ac%e7%bc%96%e5%86%99%e7%9a%84%e7%a8%8b%e5%ba%8f.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/21/%e7%bb%99apache%e5%a2%9e%e5%8a%a0mod_perl%e4%bd%bf%e5%85%b6%e6%94%af%e6%8c%81perl%e8%84%9a%e6%9c%ac%e7%bc%96%e5%86%99%e7%9a%84%e7%a8%8b%e5%ba%8f.shtml#comments</comments>
		<pubDate>Fri, 21 Nov 2008 08:59:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[cgi]]></category>

		<category><![CDATA[mod_perl]]></category>

		<category><![CDATA[perl]]></category>

		<category><![CDATA[pl]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=391</guid>
		<description><![CDATA[老样子，下载 perl-5.8.8.tar.gz mod_perl-2.0-current.tar.gz perlinfo.zip
wget http://www.sunboyu.cn/sourse/perl-5.8.8.tar.gz
wget http://www.sunboyu.cn/sourse/mod_perl-2.0-current.tar.gz
wget http://www.sunboyu.cn/sourse/perlinfo.zip
tar -zxvf perl-5.8.8.tar.gz
tar -zxvf mod_perl-2.0-current.tar.gz
tar -zxvf perl-5.8.8.tar.gz
先安装perl ./Configure -h  看帮助吧，忘了
在安装 mod_perl  #perl Makefile.PL WITH_APXS=/opt/httpd-2.2.9/bin/apxs
如果报错，看看帮助，得加几个参数
然后修改 httpd.conf ,增加 LoadModule perl_module modules/mod_perl.so
最后在虚拟目录里增加
&#60;location /cgi-bin&#62;
&#160; SetHandler perl-script
&#160; PerlResponseHandler ModPerl::Registry
&#160; Options +ExecCGI
&#160; PerlOptions +ParseHeaders
&#160; PerlOptions +SetupEnv
&#60;/location&#62;
然后把perlinfo.zip里那个探针放在cgi-bin目录下，访问一下，如果显示相关信息，证明配置成功。
费了半天劲，就为了用一个awstats。
突发奇想，是不是把python和ruby也配置上？
]]></description>
			<content:encoded><![CDATA[<p>老样子，下载 perl-5.8.8.tar.gz mod_perl-2.0-current.tar.gz perlinfo.zip<br />
wget http://www.sunboyu.cn/sourse/perl-5.8.8.tar.gz<br />
wget http://www.sunboyu.cn/sourse/mod_perl-2.0-current.tar.gz<br />
wget http://www.sunboyu.cn/sourse/perlinfo.zip</p>
<p>tar -zxvf perl-5.8.8.tar.gz<br />
tar -zxvf mod_perl-2.0-current.tar.gz<br />
tar -zxvf perl-5.8.8.tar.gz</p>
<p>先安装perl ./Configure -h  看帮助吧，忘了<br />
在安装 mod_perl  #perl Makefile.PL WITH_APXS=/opt/httpd-2.2.9/bin/apxs<br />
如果报错，看看帮助，得加几个参数<br />
然后修改 httpd.conf ,增加 LoadModule perl_module modules/mod_perl.so<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">&lt;location /cgi-bin&gt;</li>
<li>&nbsp; SetHandler perl-script</li>
<li>&nbsp; PerlResponseHandler ModPerl::Registry</li>
<li>&nbsp; Options +ExecCGI</li>
<li>&nbsp; PerlOptions +ParseHeaders</li>
<li>&nbsp; PerlOptions +SetupEnv</li>
<li>&lt;/location&gt;</li></ol></div>
<p>然后把perlinfo.zip里那个探针放在cgi-bin目录下，访问一下，如果显示相关信息，证明配置成功。<br />
费了半天劲，就为了用一个awstats。<br />
突发奇想，是不是把python和ruby也配置上？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/21/%e7%bb%99apache%e5%a2%9e%e5%8a%a0mod_perl%e4%bd%bf%e5%85%b6%e6%94%af%e6%8c%81perl%e8%84%9a%e6%9c%ac%e7%bc%96%e5%86%99%e7%9a%84%e7%a8%8b%e5%ba%8f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP中引用返回的用法</title>
		<link>http://www.sunboyu.cn/2008/11/21/php%e4%b8%ad%e5%bc%95%e7%94%a8%e8%bf%94%e5%9b%9e%e7%9a%84%e7%94%a8%e6%b3%95.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/21/php%e4%b8%ad%e5%bc%95%e7%94%a8%e8%bf%94%e5%9b%9e%e7%9a%84%e7%94%a8%e6%b3%95.shtml#comments</comments>
		<pubDate>Fri, 21 Nov 2008 02:49:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=390</guid>
		<description><![CDATA[先看个例子
function &#38;new_class( $classname )
{
&#160;&#160; &#160; &#160; &#160;static $object = array();
&#160;&#160; &#160; &#160; &#160;if(isset( $object[$classname] ))
&#160;&#160; &#160; &#160; &#160;{
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;return $object[$classname];
&#160;&#160; &#160; &#160; &#160;}
&#160;&#160; &#160; &#160; &#160;$object[$classname] = &#38; new $classname();
&#160;&#160; &#160; &#160; &#160;return $object[$classname];
}
class abc
{
	public $a;
	public $b;
	function abc()
	{
		$this-&#62;a = 1;
		$this-&#62;b = 2;
	}
}
class test
{
}
&#160;
$a = new test();
$a-&#62;abc = &#38; new_class( [...]]]></description>
			<content:encoded><![CDATA[<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">function &amp;new_class( $classname )</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;static $object = array();</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;if(isset( $object[$classname] ))</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;return $object[$classname];</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;$object[$classname] = &amp; new $classname();</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;return $object[$classname];</li>
<li>}</li>
<li>class abc</li>
<li>{</li>
<li>	public $a;</li>
<li>	public $b;</li>
<li>	function abc()</li>
<li>	{</li>
<li>		$this-&gt;a = 1;</li>
<li>		$this-&gt;b = 2;</li>
<li>	}</li>
<li>}</li>
<li>class test</li>
<li>{</li>
<li>}</li>
<li>&nbsp;</li>
<li>$a = new test();</li>
<li>$a-&gt;abc = &amp; new_class( 'abc' );</li>
<li>print_r($a);</li></ol></div>
<p>很显然，这样做的好处是减少了实例化对象的复制，直接绑定了对象。这样减少了内存的消耗和操作的复杂。但实际上官方又说了这么一句，很是纳闷：<br />
Do not use return-by-reference to increase performance, the engine is smart enough to optimize this on its own.<br />
不要尝试用引用返回提高性能，因为PHP引擎足够聪明，自己会解决。<br />
闷中</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/21/php%e4%b8%ad%e5%bc%95%e7%94%a8%e8%bf%94%e5%9b%9e%e7%9a%84%e7%94%a8%e6%b3%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP中变量引用详解</title>
		<link>http://www.sunboyu.cn/2008/11/19/php%e4%b8%ad%e5%8f%98%e9%87%8f%e5%bc%95%e7%94%a8%e8%af%a6%e8%a7%a3.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/19/php%e4%b8%ad%e5%8f%98%e9%87%8f%e5%bc%95%e7%94%a8%e8%af%a6%e8%a7%a3.shtml#comments</comments>
		<pubDate>Wed, 19 Nov 2008 13:37:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=388</guid>
		<description><![CDATA[PHP中，引用就是用另一个变量是访问一个变量的值。但是跟C中指针不通。这里做几个测试，以说明：
$a = &#34;date&#34;;
$b = &#38;amp;$a;
echo $a; // date
echo $b; // date
$b = &#34;date1&#34;;
echo $a; // date1
echo $b; // date1
unset($a);
echo $b; // date1

可以看出，引用其实就是给一个变量增加了一个别名，而对于有别名的变量，删除这个变量只是删除了这个变量的名字，而变量的内容不变，同时，使用任何一个函数名操作一个变量，都是操作了值，值的结果可以使用任何一个别名访问。
]]></description>
			<content:encoded><![CDATA[<p>PHP中，引用就是用另一个变量是访问一个变量的值。但是跟C中指针不通。这里做几个测试，以说明：</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">$a = &quot;date&quot;;</li>
<li>$b = &amp;amp;$a;</li>
<li>echo $a; // date</li>
<li>echo $b; // date</li>
<li>$b = &quot;date1&quot;;</li>
<li>echo $a; // date1</li>
<li>echo $b; // date1</li>
<li>unset($a);</li>
<li>echo $b; // date1</li></ol></div>
<p><a href='http://www.sunboyu.cn/upfiles/2008/11/e69caae591bde5908d-1.jpg'><img src="http://www.sunboyu.cn/upfiles/2008/11/e69caae591bde5908d-1.jpg" alt="" title="e69caae591bde5908d-1" width="500" height="308" class="aligncenter size-full wp-image-389" /></a><br />
可以看出，引用其实就是给一个变量增加了一个别名，而对于有别名的变量，删除这个变量只是删除了这个变量的名字，而变量的内容不变，同时，使用任何一个函数名操作一个变量，都是操作了值，值的结果可以使用任何一个别名访问。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/19/php%e4%b8%ad%e5%8f%98%e9%87%8f%e5%bc%95%e7%94%a8%e8%af%a6%e8%a7%a3.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>励志博客</title>
		<link>http://www.sunboyu.cn/2008/11/18/%e5%8a%b1%e5%bf%97%e5%8d%9a%e5%ae%a2.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/18/%e5%8a%b1%e5%bf%97%e5%8d%9a%e5%ae%a2.shtml#comments</comments>
		<pubDate>Tue, 18 Nov 2008 13:50:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[励志]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=387</guid>
		<description><![CDATA[好多天不学习了，新的框架也迟迟没有动工，不断在看别人的东西是不错，但主要原因还是懒。最近拼命学习山地车知识，因为下年准备购置一台入门级山地车，开始加强锻炼。搞IT的人没有一个好的身体不行，作为一个男人，身体不好更不行。
经济危机，虽说跟个人离的不远，但那种无形的压力却在时时考验我们的忍受力。好多同行的公司都倒闭了，中关村做硬件的更是亏的一塌糊涂。
以前听某个励志讲座，道：人感觉通货膨胀，物价上涨，感觉到压力，其实是自身的发展滞后于社会的发展而带来的压力。如果个体的发展速度高于通货膨胀的速度，那基本是没有什么压力，而且能保持比较舒畅的生活。
总结现在，貌似发展不是太理想，只能勉强达到与经济发展持平的状态。不管做什么，保持快乐的心情是必要的，保持持续的斗志是必须的。年底，不知道如何激起斗志，也许更多的精力要放在考虑如何度过这个年关。
原公司的同事走得都差不多了，技术部第一批第二批人都走了，真正让我失落的，是自己未完成的项目，程序就跟自己的孩子一样，就那么死掉总是感觉心寒。总是想不明白，为什么公司的发展总是伴随着残忍。公司，家庭，都是社会的一部分，商跟家两个字即使写在一起，也无法体会家的温暖。
2008马上过去了，大概还有两个月的时间，两个月，六分之一年，还是值得抓住的。下一年，精力可能会分散在学历考试上一部分，时间的紧迫让人窒息。总之，自己日程表上的事情还要完成。
]]></description>
			<content:encoded><![CDATA[<p>好多天不学习了，新的框架也迟迟没有动工，不断在看别人的东西是不错，但主要原因还是懒。最近拼命学习山地车知识，因为下年准备购置一台入门级山地车，开始加强锻炼。搞IT的人没有一个好的身体不行，作为一个男人，身体不好更不行。</p>
<p>经济危机，虽说跟个人离的不远，但那种无形的压力却在时时考验我们的忍受力。好多同行的公司都倒闭了，中关村做硬件的更是亏的一塌糊涂。</p>
<p>以前听某个励志讲座，道：人感觉通货膨胀，物价上涨，感觉到压力，其实是自身的发展滞后于社会的发展而带来的压力。如果个体的发展速度高于通货膨胀的速度，那基本是没有什么压力，而且能保持比较舒畅的生活。</p>
<p>总结现在，貌似发展不是太理想，只能勉强达到与经济发展持平的状态。不管做什么，保持快乐的心情是必要的，保持持续的斗志是必须的。年底，不知道如何激起斗志，也许更多的精力要放在考虑如何度过这个年关。</p>
<p>原公司的同事走得都差不多了，技术部第一批第二批人都走了，真正让我失落的，是自己未完成的项目，程序就跟自己的孩子一样，就那么死掉总是感觉心寒。总是想不明白，为什么公司的发展总是伴随着残忍。公司，家庭，都是社会的一部分，商跟家两个字即使写在一起，也无法体会家的温暖。</p>
<p>2008马上过去了，大概还有两个月的时间，两个月，六分之一年，还是值得抓住的。下一年，精力可能会分散在学历考试上一部分，时间的紧迫让人窒息。总之，自己日程表上的事情还要完成。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/18/%e5%8a%b1%e5%bf%97%e5%8d%9a%e5%ae%a2.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>MYSQL5新特性，分区表</title>
		<link>http://www.sunboyu.cn/2008/11/15/mysql5%e6%96%b0%e7%89%b9%e6%80%a7%ef%bc%8c%e5%88%86%e5%8c%ba%e8%a1%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/15/mysql5%e6%96%b0%e7%89%b9%e6%80%a7%ef%bc%8c%e5%88%86%e5%8c%ba%e8%a1%a8.shtml#comments</comments>
		<pubDate>Sat, 15 Nov 2008 09:57:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[分区]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=385</guid>
		<description><![CDATA[CU上看了一个介绍mysql5分区表的帖子，很感兴趣，如果有了分区的应用，那么设计数据库结构可以更加紧凑，而在应用上更加灵活，减少了一些不必要的视图，而在速度上也很好的提升。
分区的好处是，在物理上根据规则对表进行分离。
水平分区其实是B树索引物理上又增加了一级，当然要提高检索速度了，因为又多了一个手工索引。
垂直分区，在一些应用上会更加方便，比如discuz程序，帖子标题跟正文都是分离的，目的是降低单表容量，而有了垂直分区，可以在物理上对字段进行分离，而访问的时候又是类似视图的访问，无比爽也！！
目前还没测试分区到底有多少性能潜力可开发，回头用大的数据查询测试一下。
相关资料：http://dev.mysql.com/doc/refman/5.1/zh/partitioning.html
]]></description>
			<content:encoded><![CDATA[<p>CU上看了一个介绍mysql5分区表的帖子，很感兴趣，如果有了分区的应用，那么设计数据库结构可以更加紧凑，而在应用上更加灵活，减少了一些不必要的视图，而在速度上也很好的提升。<br />
分区的好处是，在物理上根据规则对表进行分离。<br />
水平分区其实是B树索引物理上又增加了一级，当然要提高检索速度了，因为又多了一个手工索引。<br />
垂直分区，在一些应用上会更加方便，比如discuz程序，帖子标题跟正文都是分离的，目的是降低单表容量，而有了垂直分区，可以在物理上对字段进行分离，而访问的时候又是类似视图的访问，无比爽也！！<br />
目前还没测试分区到底有多少性能潜力可开发，回头用大的数据查询测试一下。<br />
相关资料：http://dev.mysql.com/doc/refman/5.1/zh/partitioning.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/15/mysql5%e6%96%b0%e7%89%b9%e6%80%a7%ef%bc%8c%e5%88%86%e5%8c%ba%e8%a1%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>框架之争</title>
		<link>http://www.sunboyu.cn/2008/11/13/%e6%a1%86%e6%9e%b6%e4%b9%8b%e4%ba%89.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/13/%e6%a1%86%e6%9e%b6%e4%b9%8b%e4%ba%89.shtml#comments</comments>
		<pubDate>Thu, 13 Nov 2008 13:36:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[框架]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=383</guid>
		<description><![CDATA[最近在看一些框架，从zendframework，cakephp，IC，都大概了解了一下，因为以前习惯全部手工代码，但后来发现这种方式过于松散，松散到不能管理，因为类，函数，虽然有自己的方式整理，但每次开展项目的时候都得重新整理，重新配置接口，过于麻烦，于是想到了框架。
框架，其实是用程序管理类库的一种方式，采用统一的接口，统一的调用风格进行操作，对于团队合作中代码可读性提供了便利。但框架也有很严重的问题，就是效率。
框架大都采用了单点的入口，然后提供url的路由功能进行解析，另外，类的调用也大都采取__autoload进行寻找，大大降低了程序的效率。
后又看了奶瓶老仙的BSMlite，深有感触。
其实，使用框架完全可以应付中小型项目，至于效率，也可以在完工后进行优化再发布，这样就会达到两全其美的效果。
]]></description>
			<content:encoded><![CDATA[<p>最近在看一些框架，从zendframework，cakephp，IC，都大概了解了一下，因为以前习惯全部手工代码，但后来发现这种方式过于松散，松散到不能管理，因为类，函数，虽然有自己的方式整理，但每次开展项目的时候都得重新整理，重新配置接口，过于麻烦，于是想到了框架。</p>
<p>框架，其实是用程序管理类库的一种方式，采用统一的接口，统一的调用风格进行操作，对于团队合作中代码可读性提供了便利。但框架也有很严重的问题，就是效率。</p>
<p>框架大都采用了单点的入口，然后提供url的路由功能进行解析，另外，类的调用也大都采取__autoload进行寻找，大大降低了程序的效率。</p>
<p>后又看了奶瓶老仙的BSMlite，深有感触。</p>
<p>其实，使用框架完全可以应付中小型项目，至于效率，也可以在完工后进行优化再发布，这样就会达到两全其美的效果。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/13/%e6%a1%86%e6%9e%b6%e4%b9%8b%e4%ba%89.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP版DES加密解密</title>
		<link>http://www.sunboyu.cn/2008/11/12/php%e7%89%88des%e5%8a%a0%e5%af%86%e8%a7%a3%e5%af%86.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/12/php%e7%89%88des%e5%8a%a0%e5%af%86%e8%a7%a3%e5%af%86.shtml#comments</comments>
		<pubDate>Wed, 12 Nov 2008 05:31:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[des]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=382</guid>
		<description><![CDATA[&#60; ?php
class DES
{
	public $key = '';
	public $iv = '';
	public $td = '';
	public $ks = '';
	//构造函数
	public function __construct( $key )
	{
		$this-&#62;td = mcrypt_module_open('rijndael-256', '', 'ofb', '');
		$this-&#62;iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($this-&#62;td), (substr(PHP_OS,0,3)=='WIN' ? MCRYPT_RAND : MCRYPT_DEV_RANDOM));
		$this-&#62;ks = mcrypt_enc_get_key_size($this-&#62;td);
		$this-&#62;key = substr(md5($key), 0, $this-&#62;ks);
	}
	//加密函数
	function encrypt( $value )
&#160;&#160; &#160;{
		mcrypt_generic_init($this-&#62;td, $this-&#62;key, $this-&#62;iv);
		$r = mcrypt_generic( $this-&#62;td , $value );
		mcrypt_generic_deinit($this-&#62;td);
		return $r;
&#160;&#160; &#160;}
	//解密函数
	function decrypt( $value )
&#160;&#160; &#160;{
		mcrypt_generic_init($this-&#62;td, [...]]]></description>
			<content:encoded><![CDATA[<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">&lt; ?php</li>
<li>class DES</li>
<li>{</li>
<li>	public $key = '';</li>
<li>	public $iv = '';</li>
<li>	public $td = '';</li>
<li>	public $ks = '';</li>
<li>	//构造函数</li>
<li>	public function __construct( $key )</li>
<li>	{</li>
<li>		$this-&gt;td = mcrypt_module_open('rijndael-256', '', 'ofb', '');</li>
<li>		$this-&gt;iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($this-&gt;td), (substr(PHP_OS,0,3)=='WIN' ? MCRYPT_RAND : MCRYPT_DEV_RANDOM));</li>
<li>		$this-&gt;ks = mcrypt_enc_get_key_size($this-&gt;td);</li>
<li>		$this-&gt;key = substr(md5($key), 0, $this-&gt;ks);</li>
<li>	}</li>
<li>	//加密函数</li>
<li>	function encrypt( $value )</li>
<li>&nbsp;&nbsp; &nbsp;{</li>
<li>		mcrypt_generic_init($this-&gt;td, $this-&gt;key, $this-&gt;iv);</li>
<li>		$r = mcrypt_generic( $this-&gt;td , $value );</li>
<li>		mcrypt_generic_deinit($this-&gt;td);</li>
<li>		return $r;</li>
<li>&nbsp;&nbsp; &nbsp;}</li>
<li>	//解密函数</li>
<li>	function decrypt( $value )</li>
<li>&nbsp;&nbsp; &nbsp;{</li>
<li>		mcrypt_generic_init($this-&gt;td, $this-&gt;key, $this-&gt;iv);</li>
<li>		$r = mdecrypt_generic($this-&gt;td, $value);</li>
<li>		mcrypt_generic_deinit($this-&gt;td);</li>
<li>		return $r;</li>
<li>&nbsp;&nbsp; &nbsp;}</li>
<li>	//西沟函数</li>
<li>	function __destruct()</li>
<li>	{</li>
<li>		mcrypt_module_close($this-&gt;td);</li>
<li>	}</li>
<li>}</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>$des = new DES('FDASFDAS');</li>
<li>$content = file_get_contents('example.php');</li>
<li>echo $content;</li>
<li>echo &quot;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&quot;;</li>
<li>$encode = $des-&gt;encrypt( $content );</li>
<li>echo $encode;</li>
<li>echo &quot;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&quot;;</li>
<li>$decode = $des-&gt;decrypt($encode);</li>
<li>echo $decode;</li>
<li>?&gt;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/12/php%e7%89%88des%e5%8a%a0%e5%af%86%e8%a7%a3%e5%af%86.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>网站的生命与灵魂</title>
		<link>http://www.sunboyu.cn/2008/11/10/%e7%bd%91%e7%ab%99%e7%9a%84%e7%94%9f%e5%91%bd%e4%b8%8e%e7%81%b5%e9%ad%82.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/10/%e7%bd%91%e7%ab%99%e7%9a%84%e7%94%9f%e5%91%bd%e4%b8%8e%e7%81%b5%e9%ad%82.shtml#comments</comments>
		<pubDate>Mon, 10 Nov 2008 14:33:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[垂直网站]]></category>

		<category><![CDATA[灵魂]]></category>

		<category><![CDATA[生命]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=380</guid>
		<description><![CDATA[今日跟一行业垂直网站站长探讨网站内容的问题，直言其网站为垃圾网站风格，后其站长，美工，程序，我，召开了小型四人会议，共同探讨。
网站之生命，网站之灵魂，是今年网站发展重点。简言之，即用户使用其意图，意义，感受，体验。
用户至某网站，其一是想得其所得，为网站之内容。其二，用户想再次到来，得到最新内容，为网站之更新。用户既得内容，又想发布己见，为止交互。用户感觉网站甚好，赞而传之，为之用户群的扩大。网站发展，其路大体相近。
－－－－－－－－－－－－－看了会历史，就成这样了，下边说人话－－－－－－－－－－－－－－－－－
好的网站，首先内容是要吸引人的，否则用户不会过来。
一个全新的网站，在建立初期可能要进行大量的内容摘抄，甚至使用一些采集工具进行采集。对于刚发展的小网站，这种做法是事半功倍的，但是，我绝对不赞成使用采集器进行采集入库，原因有三：1、采集不容易控制html标签，很容易造成页面排版跟实际风格不符，造成用户阅读困难；2、采集不容易控制内容的归类准确性，任何一个网站的分类都没有完全相同的；3、采集的网站，搜索引擎不易收录，而且排名很低，不利于推广。
解决这个问题，我建议使用手工采集的方式，按照自己网站的标准重新排版，而且加以整理，最好自己总结摘要和关键词，这样，既满足了内容充实的低成本，又以比较匹配的分类给用户好的阅读体验。
其次，行业网站的内容相对集中，但又有其占有的分类形势，因此，一个非常符合行业习惯的分类形式很有必要。好的分类，就是一个好的索引，好的导航，更容易把用户粘滞在网站上。
再之，网站初期不就建议构建在通用的CMS系统上。因为这些CMS虽然成熟，但灵活性欠佳，难以满足复杂的内容需求，而且，很容易让人认为是个垃圾站，所以，独立开发，而且作出自己的风格是必要的，这样能减少不必要的二次开发。
然后：不断的更新，意味着网站的生命，没人希望在首页看到一年前的文章。
网站的灵魂，体现在活生生的个体，不仅是活的，而且要是鲜活，有蓬勃生命力的。生命是有对外界刺激的反映的，也就是交互性。
交互性，比较容易，现在最流行的就是bbs，blog，space，sns貌似也将成标配。
现在说灵魂，灵魂是个看不见摸不着的东西，但的确能感受到。
灵魂，用在网站上更多的就是网站的文化氛围和主题，比如上mop的就是扯淡美女意淫，上天涯的就是讨论一些事情，年龄偏长。上csdn的windows环境工程师多，chinaunix上都是钟情开源的。提到这些网站的时候，我们就能感受到一种灵魂，不论是好的还是坏的，起码能让我们神经一动。一个网站能做到这种程度，才算是有了灵魂。
&#8212;&#8212;&#8212;&#8212;&#8212;题外话：关于编程语言&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;
主旨是：不管用什么语言，你要保证有能力去开发维护下去，并且拥有和掌控源代码。
当你拿着一个没有源代码的网站又要改造的时候，你郁闷去吧……
]]></description>
			<content:encoded><![CDATA[<p>今日跟一行业垂直网站站长探讨网站内容的问题，直言其网站为垃圾网站风格，后其站长，美工，程序，我，召开了小型四人会议，共同探讨。</p>
<p>网站之生命，网站之灵魂，是今年网站发展重点。简言之，即用户使用其意图，意义，感受，体验。</p>
<p>用户至某网站，其一是想得其所得，为网站之内容。其二，用户想再次到来，得到最新内容，为网站之更新。用户既得内容，又想发布己见，为止交互。用户感觉网站甚好，赞而传之，为之用户群的扩大。网站发展，其路大体相近。</p>
<p>－－－－－－－－－－－－－看了会历史，就成这样了，下边说人话－－－－－－－－－－－－－－－－－</p>
<p>好的网站，首先内容是要吸引人的，否则用户不会过来。</p>
<p>一个全新的网站，在建立初期可能要进行大量的内容摘抄，甚至使用一些采集工具进行采集。对于刚发展的小网站，这种做法是事半功倍的，但是，我绝对不赞成使用采集器进行采集入库，原因有三：1、采集不容易控制html标签，很容易造成页面排版跟实际风格不符，造成用户阅读困难；2、采集不容易控制内容的归类准确性，任何一个网站的分类都没有完全相同的；3、采集的网站，搜索引擎不易收录，而且排名很低，不利于推广。</p>
<p>解决这个问题，我建议使用手工采集的方式，按照自己网站的标准重新排版，而且加以整理，最好自己总结摘要和关键词，这样，既满足了内容充实的低成本，又以比较匹配的分类给用户好的阅读体验。</p>
<p>其次，行业网站的内容相对集中，但又有其占有的分类形势，因此，一个非常符合行业习惯的分类形式很有必要。好的分类，就是一个好的索引，好的导航，更容易把用户粘滞在网站上。</p>
<p>再之，网站初期不就建议构建在通用的CMS系统上。因为这些CMS虽然成熟，但灵活性欠佳，难以满足复杂的内容需求，而且，很容易让人认为是个垃圾站，所以，独立开发，而且作出自己的风格是必要的，这样能减少不必要的二次开发。</p>
<p>然后：不断的更新，意味着网站的生命，没人希望在首页看到一年前的文章。</p>
<p>网站的灵魂，体现在活生生的个体，不仅是活的，而且要是鲜活，有蓬勃生命力的。生命是有对外界刺激的反映的，也就是交互性。</p>
<p>交互性，比较容易，现在最流行的就是bbs，blog，space，sns貌似也将成标配。</p>
<p>现在说灵魂，灵魂是个看不见摸不着的东西，但的确能感受到。</p>
<p>灵魂，用在网站上更多的就是网站的文化氛围和主题，比如上mop的就是扯淡美女意淫，上天涯的就是讨论一些事情，年龄偏长。上csdn的windows环境工程师多，chinaunix上都是钟情开源的。提到这些网站的时候，我们就能感受到一种灵魂，不论是好的还是坏的，起码能让我们神经一动。一个网站能做到这种程度，才算是有了灵魂。</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;题外话：关于编程语言&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>主旨是：不管用什么语言，你要保证有能力去开发维护下去，并且拥有和掌控源代码。</p>
<p>当你拿着一个没有源代码的网站又要改造的时候，你郁闷去吧……</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/10/%e7%bd%91%e7%ab%99%e7%9a%84%e7%94%9f%e5%91%bd%e4%b8%8e%e7%81%b5%e9%ad%82.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Ubuntu系统同步跟进</title>
		<link>http://www.sunboyu.cn/2008/11/09/ubuntu%e7%b3%bb%e7%bb%9f%e5%90%8c%e6%ad%a5%e8%b7%9f%e8%bf%9b.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/09/ubuntu%e7%b3%bb%e7%bb%9f%e5%90%8c%e6%ad%a5%e8%b7%9f%e8%bf%9b.shtml#comments</comments>
		<pubDate>Sun, 09 Nov 2008 06:18:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[ubuntu8.10]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=378</guid>
		<description><![CDATA[Ubuntu8.10在2008年10月30日终于到来，跟官方所要了两张作为纪念，同时刻了一张进行试用。
新版的跟8.04没看出太大的区别，对于那个立方体效果，我也没有试用。系统是让用的，不是用来玩的，关闭所有的特效，能顺利工作才是。
我用的惠普康柏 V3729 系列，系统安装后，自动识别无线网卡，这是首要的，拉线的感觉可不好。官方发布后，国内的更新源也同步更新了，cn99的不太好用，我用的lupaworld的源,比较快
deb http://mirror.lupaworld.com/ubuntu intrepid main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu intrepid-security main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu intrepid-updates main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu intrepid-backports main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu intrepid-proposed main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu intrepid main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu intrepid-security main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu intrepid-updates main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu intrepid-backports main restricted [...]]]></description>
			<content:encoded><![CDATA[<p>Ubuntu8.10在2008年10月30日终于到来，跟官方所要了两张作为纪念，同时刻了一张进行试用。<br />
新版的跟8.04没看出太大的区别，对于那个立方体效果，我也没有试用。系统是让用的，不是用来玩的，关闭所有的特效，能顺利工作才是。<br />
我用的惠普康柏 V3729 系列，系统安装后，自动识别无线网卡，这是首要的，拉线的感觉可不好。官方发布后，国内的更新源也同步更新了，cn99的不太好用，我用的lupaworld的源,比较快</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">deb http://mirror.lupaworld.com/ubuntu intrepid main restricted universe multiverse</li>
<li>deb http://mirror.lupaworld.com/ubuntu intrepid-security main restricted universe multiverse</li>
<li>deb http://mirror.lupaworld.com/ubuntu intrepid-updates main restricted universe multiverse</li>
<li>deb http://mirror.lupaworld.com/ubuntu intrepid-backports main restricted universe multiverse</li>
<li>deb http://mirror.lupaworld.com/ubuntu intrepid-proposed main restricted universe multiverse</li>
<li>deb-src http://mirror.lupaworld.com/ubuntu intrepid main restricted universe multiverse</li>
<li>deb-src http://mirror.lupaworld.com/ubuntu intrepid-security main restricted universe multiverse</li>
<li>deb-src http://mirror.lupaworld.com/ubuntu intrepid-updates main restricted universe multiverse</li>
<li>deb-src http://mirror.lupaworld.com/ubuntu intrepid-backports main restricted universe multiverse</li>
<li>deb-src http://mirror.lupaworld.com/ubuntu intrepid-proposed main restricted universe multiverse</li></ol></div>
<p>我的机器是 NVIDIA GeForce 7150M的显卡，默认是不支持的，但 apt-get upgrade后，可以用新力德自动安装显卡驱动。为这驱动我费了不少劲，官方的下载了不少，也没装上。<br />
整体装完后，更新了mplayer，可以播放mp3，但rmvb的不能播放，下载了realplaylinux版，只有图像没有声音。<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">sudo apt-get install gstreamer0.10-pitfdll gstreamer0.10-ffmpeg gstreamer0.10-plugins-bad gstreamer0.10-plugins-bad-multiverse gstreamer0.10-plugins-ugly gstreamer0.10-plugins-ugly-multiverse </li>
<li>sudo apt-get install libxine-extracodecs totem-xine ffmpeg lame faad sox mjpegtools libxine-main1</li></ol></div>
<p>后，realplay运行正常。msn用Pidgin,qq使用官方的ubuntu版本，很流畅，不过还不能看迅雷看看，回头装wine试试。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/09/ubuntu%e7%b3%bb%e7%bb%9f%e5%90%8c%e6%ad%a5%e8%b7%9f%e8%bf%9b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>linux_apache_php_mysql_fcgid_suexec_高效安全的主机配置方案</title>
		<link>http://www.sunboyu.cn/2008/11/08/linux_apache_php_mysql_fcgid_suexec_%e9%ab%98%e6%95%88%e5%ae%89%e5%85%a8%e7%9a%84%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%ae%e6%96%b9%e6%a1%88.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/08/linux_apache_php_mysql_fcgid_suexec_%e9%ab%98%e6%95%88%e5%ae%89%e5%85%a8%e7%9a%84%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%ae%e6%96%b9%e6%a1%88.shtml#comments</comments>
		<pubDate>Sat, 08 Nov 2008 14:35:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[fastcgi]]></category>

		<category><![CDATA[fcgid]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[suexec]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=376</guid>
		<description><![CDATA[linux+apache+php+mysql+fcgid+suexec 高效安全主机配置
最近一直在研究web服务器的配置和安全配置，基本搞完了
window2003下
iis+php(isapi)
apache+php(mod)
linux下
apache+php(mod)
apache+php(fastcgi)
四种安装方式的安全设置。其中涉及一些性能方面的调整，但没有实际的环境来测试，所以只涉及方法，不涉及具体的应用，而在安全方面下了很大的功夫。
底下我针对比较复杂的一种安装模式apache+php(fastcgi)进行详细讲解，来介绍如何配置一个安全的虚拟主机系统。
调试环境：
CentOS5
Apache2.2.9
Mysql5.0.22
PHP5.2.6
Fcgid2.4.6
需要的脚本  sunboyu-amp-fastcgi-suexec-v20-alpha
首先用脚本 unboyu-amp-fastcgi-v20-fcgid-suexec-alpha.txt 进行安装。
注：我在我的服务器上做了一个源，如果你感觉较慢的话，可以先吧软件下载到本地，然后修改一下脚本进行安装。
整体运行完后，apache是能成功运行的，但访问的话显示权限错误，底下主要是配置权限
过程用命令来显示，比较符合技术人员的习惯
1、vi /opt/httpd-2.2.9/conf/httpd.conf
修改 User daemon
Group daemon
为 User apache
Group apache
去掉 #Include conf/extra/httpd-vhosts.conf 前边的#，使其生效
2、增加一个虚拟站点的账户
groupadd www
useradd -g www www
现在应该有个目录 /home/www
3、vi /opt/httpd-2.2.9/conf/extra/httpd-vhost.conf
屏蔽或直接删除原来的站点信息
SuexecUserGroup www www #这里一定要弄清楚是做什么用的
ServerAdmin sunboyu@gmail.com
DocumentRoot &#8220;/home/www/php-cgi&#8221;
ServerName 192.168.0.5 #我测试的ip是这个，实际应该为你的域名
ServerAlias www.dummy-host.example.com #别名
ErrorLog &#8220;logs/dummy-host.example.com-error_log&#8221; #日志，用独立的名字
CustomLog &#8220;logs/dummy-host.example.com-access_log&#8221; common
SetHandler fcgid-script #我在编译完apache，附加了两个模块，fastcgi和fcgid，后一个是国人开发的，比fastcgi更稳定和易用
FCGIWrapper /home/www/php/php-cgi .php # php-cgi 是站点下的一个文件，下边建立
Options ExecCGI
allow from all
然后: x 即可
4、建立脚本 /home/www/php/php-cgi
vi /home/www/php/php-cgi
内容为
#!/bin/sh
export PHPRC=/home/www/php-cgi
export PHP_FCGI_CHILDREN=5 #创建的fcgi进程
export PHP_FCGI_MAX_REQUESTS=5000 #最大连接数
/opt/php-5.2.6/bin/php-cgi #php-cgi程序的位置
: x
5、创建独立的php.ini配置文件
cp [...]]]></description>
			<content:encoded><![CDATA[<p>linux+apache+php+mysql+fcgid+suexec 高效安全主机配置</p>
<p>最近一直在研究web服务器的配置和安全配置，基本搞完了<br />
window2003下<br />
iis+php(isapi)<br />
apache+php(mod)<br />
linux下<br />
apache+php(mod)<br />
apache+php(fastcgi)<br />
四种安装方式的安全设置。其中涉及一些性能方面的调整，但没有实际的环境来测试，所以只涉及方法，不涉及具体的应用，而在安全方面下了很大的功夫。<br />
底下我针对比较复杂的一种安装模式apache+php(fastcgi)进行详细讲解，来介绍如何配置一个安全的虚拟主机系统。</p>
<p>调试环境：</p>
<p>CentOS5<br />
Apache2.2.9<br />
Mysql5.0.22<br />
PHP5.2.6<br />
Fcgid2.4.6</p>
<p>需要的脚本  <a href='http://www.sunboyu.cn/upfiles/2008/12/sunboyu-amp-fastcgi-suexec-v20-alpha.txt'>sunboyu-amp-fastcgi-suexec-v20-alpha</a></p>
<p>首先用脚本 unboyu-amp-fastcgi-v20-fcgid-suexec-alpha.txt 进行安装。<br />
注：我在我的服务器上做了一个源，如果你感觉较慢的话，可以先吧软件下载到本地，然后修改一下脚本进行安装。</p>
<p>整体运行完后，apache是能成功运行的，但访问的话显示权限错误，底下主要是配置权限<br />
过程用命令来显示，比较符合技术人员的习惯<br />
1、vi /opt/httpd-2.2.9/conf/httpd.conf</p>
<p>修改 User daemon<br />
Group daemon<br />
为 User apache<br />
Group apache</p>
<p>去掉 #Include conf/extra/httpd-vhosts.conf 前边的#，使其生效</p>
<p>2、增加一个虚拟站点的账户</p>
<p>groupadd www<br />
useradd -g www www</p>
<p>现在应该有个目录 /home/www</p>
<p>3、vi /opt/httpd-2.2.9/conf/extra/httpd-vhost.conf</p>
<p>屏蔽或直接删除原来的站点信息<br />
SuexecUserGroup www www #这里一定要弄清楚是做什么用的<br />
ServerAdmin sunboyu@gmail.com<br />
DocumentRoot &#8220;/home/www/php-cgi&#8221;<br />
ServerName 192.168.0.5 #我测试的ip是这个，实际应该为你的域名<br />
ServerAlias www.dummy-host.example.com #别名<br />
ErrorLog &#8220;logs/dummy-host.example.com-error_log&#8221; #日志，用独立的名字<br />
CustomLog &#8220;logs/dummy-host.example.com-access_log&#8221; common</p>
<p>SetHandler fcgid-script #我在编译完apache，附加了两个模块，fastcgi和fcgid，后一个是国人开发的，比fastcgi更稳定和易用<br />
FCGIWrapper /home/www/php/php-cgi .php # php-cgi 是站点下的一个文件，下边建立<br />
Options ExecCGI<br />
allow from all<br />
然后: x 即可</p>
<p>4、建立脚本 /home/www/php/php-cgi</p>
<p>vi /home/www/php/php-cgi<br />
内容为<br />
#!/bin/sh<br />
export PHPRC=/home/www/php-cgi<br />
export PHP_FCGI_CHILDREN=5 #创建的fcgi进程<br />
export PHP_FCGI_MAX_REQUESTS=5000 #最大连接数<br />
/opt/php-5.2.6/bin/php-cgi #php-cgi程序的位置</p>
<p>: x</p>
<p>5、创建独立的php.ini配置文件<br />
cp /opt/php-5.2.6/lib/php.ini /home/www/php-cgi/php.ini</p>
<p>6、修改PHP的open_basedir</p>
<p>在/home/www/php-cgi/php.ini中找到<br />
open_basedir , 修改为<br />
open_basedir = /home/www/php<br />
注：safe_mode_exec_dir 之类的参数如果从比较变态的安全设置来说，也是应该来设定的，但我还不变态</p>
<p>7、配置权限<br />
chgrp root /opt/httpd-2.2.9/bin/suexec<br />
chmod 4751 /opt/httpd-2.2.9/bin/suexec<br />
chown www:www -R /home/www<br />
chmod 755 -R /home/www<br />
chmod 700 -R /home/www/php-cgi/php-cgi</p>
<p>8、重启<br />
server httpd restart</p>
<p>9、如果你能看到成功页面，然后就传一个PHP木马上去测试一下权限和安全的问题.<br />
如果连启动都启动不了，那就得查httpd的error_log ，suexec_log，然后去google一下，看看是哪的权限问题。</p>
<p>总结：本人教懒，整个过程调通后，也没写文档，但看到网上此类资料不多，而且有一些都没有命中要害，比如一些权限的配置和相对详尽的说明。我的注释只是把一些网上没有的解释而我弄明白后的理解写在了上边，但真正要想明白，估计还得搬着手册和google去一条条查。而且，我不是边做边写的，而是根据原来的配置盲写了一遍，估计会不少错误，总比没有强。如果有谁发现这个安全依然有问题，可以帮我提出，因为在安全方面我对自己要求很高。<br />
如果有什么需要讨论的，可以加入这个MSN群 lampper@live.cn （加为msn好友即可）</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/08/linux_apache_php_mysql_fcgid_suexec_%e9%ab%98%e6%95%88%e5%ae%89%e5%85%a8%e7%9a%84%e4%b8%bb%e6%9c%ba%e9%85%8d%e7%bd%ae%e6%96%b9%e6%a1%88.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>一生的创业</title>
		<link>http://www.sunboyu.cn/2008/11/07/%e4%b8%80%e7%94%9f%e7%9a%84%e5%88%9b%e4%b8%9a.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/07/%e4%b8%80%e7%94%9f%e7%9a%84%e5%88%9b%e4%b8%9a.shtml#comments</comments>
		<pubDate>Fri, 07 Nov 2008 12:48:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[创业]]></category>

		<category><![CDATA[大学生]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=374</guid>
		<description><![CDATA[创业这个词其实前几年并不常用，但随着高校扩招，大量毕业生难以就业，上边为了稳定人心，解决这些问题，开始提倡创业这个事情。
随着社会的开放，大学生意识的提高，有不少的大学生和毕业生确实以自己的能力开创了自己的一片天地。然而在我们讨论大学生是不是应该去做这些事情的时候，媒体却在大肆宣传大学生的创业成果，好像在全国学子的心上挠痒痒。
在媒体上，我们看到大量大学生创业的成功案例，包括类似比尔盖茨之类，但他们宣传的大都是一个人得到一个某某机会，然后如何如何成功，殊不知，创业成功毕竟是少数，太多的人处于创业萌芽或者无准备状态的创业。
这里，暂且不去分析他们为何成功和为何失败，有创业的心，固然是好事，值得我们提倡，但在创业背后，我们需要什么，如何创业，却值得我们深思。
我身边很多人在创业，当然，也有成功的，很多人属于破釜沉舟式的创业，我很敬佩这种精神，还有一些是摸着石头过河型的，这样的人就比较危险了，因为在当今市场上，失败的几率要大。
我感觉，创业是一辈子的事情，人自己，是业的一个重要组成部分，我们自己的健康，我们的自身素质，我们在这个社会中的适应能力，都将是我们发展的一些重要因素。创业成功，首先是个体的成功，然后是团队的成功，集体的成功。因此，创业是一生的创业。
]]></description>
			<content:encoded><![CDATA[<p>创业这个词其实前几年并不常用，但随着高校扩招，大量毕业生难以就业，上边为了稳定人心，解决这些问题，开始提倡创业这个事情。</p>
<p>随着社会的开放，大学生意识的提高，有不少的大学生和毕业生确实以自己的能力开创了自己的一片天地。然而在我们讨论大学生是不是应该去做这些事情的时候，媒体却在大肆宣传大学生的创业成果，好像在全国学子的心上挠痒痒。</p>
<p>在媒体上，我们看到大量大学生创业的成功案例，包括类似比尔盖茨之类，但他们宣传的大都是一个人得到一个某某机会，然后如何如何成功，殊不知，创业成功毕竟是少数，太多的人处于创业萌芽或者无准备状态的创业。</p>
<p>这里，暂且不去分析他们为何成功和为何失败，有创业的心，固然是好事，值得我们提倡，但在创业背后，我们需要什么，如何创业，却值得我们深思。</p>
<p>我身边很多人在创业，当然，也有成功的，很多人属于破釜沉舟式的创业，我很敬佩这种精神，还有一些是摸着石头过河型的，这样的人就比较危险了，因为在当今市场上，失败的几率要大。</p>
<p>我感觉，创业是一辈子的事情，人自己，是业的一个重要组成部分，我们自己的健康，我们的自身素质，我们在这个社会中的适应能力，都将是我们发展的一些重要因素。创业成功，首先是个体的成功，然后是团队的成功，集体的成功。因此，创业是一生的创业。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/07/%e4%b8%80%e7%94%9f%e7%9a%84%e5%88%9b%e4%b8%9a.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>伟大的进步</title>
		<link>http://www.sunboyu.cn/2008/11/05/%e4%bc%9f%e5%a4%a7%e7%9a%84%e8%bf%9b%e6%ad%a5.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/05/%e4%bc%9f%e5%a4%a7%e7%9a%84%e8%bf%9b%e6%ad%a5.shtml#comments</comments>
		<pubDate>Wed, 05 Nov 2008 14:09:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[安全]]></category>

		<category><![CDATA[虚拟主机]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=373</guid>
		<description><![CDATA[博客很久没更新，导致alexa排名暴跌，因为最近在研究linux下apache＋php的系统安全问题，这个问题困扰了好久。因为配置iis（之前有此文章）的时候，我设置了非常安全的iis站点用户和权限的隔离，但在linux下，总没有找到好的方法。
最近查阅了大量的资料，主要是了解apache的账户机制，suexec的工作原理，然后又翻看了大量的资料，终于搞清楚了一套完整的安全的lamp虚拟主机配置方法，能达到站点的权限隔离，进程账户的相对独立，以及对性能的控制。
在学习的过程中，常犯的错误，就是轻敌。总感觉这事不难，一会就搞定。但实际头疼了半个月。另外就是不看日志。到最后两天，大量的调试是在对比日志和理解日志的涵义，针对日志去进行配置。从我学linux的过程来看，看手册，翻日志，分析别人的案例，是学习的最佳途径。
关于安全配置linux虚拟主机的过程，我将另写文章。
]]></description>
			<content:encoded><![CDATA[<p>博客很久没更新，导致alexa排名暴跌，因为最近在研究linux下apache＋php的系统安全问题，这个问题困扰了好久。因为配置iis（之前有此文章）的时候，我设置了非常安全的iis站点用户和权限的隔离，但在linux下，总没有找到好的方法。</p>
<p>最近查阅了大量的资料，主要是了解apache的账户机制，suexec的工作原理，然后又翻看了大量的资料，终于搞清楚了一套完整的安全的lamp虚拟主机配置方法，能达到站点的权限隔离，进程账户的相对独立，以及对性能的控制。</p>
<p>在学习的过程中，常犯的错误，就是轻敌。总感觉这事不难，一会就搞定。但实际头疼了半个月。另外就是不看日志。到最后两天，大量的调试是在对比日志和理解日志的涵义，针对日志去进行配置。从我学linux的过程来看，看手册，翻日志，分析别人的案例，是学习的最佳途径。</p>
<p>关于安全配置linux虚拟主机的过程，我将另写文章。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/05/%e4%bc%9f%e5%a4%a7%e7%9a%84%e8%bf%9b%e6%ad%a5.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>IIS安全机制详解</title>
		<link>http://www.sunboyu.cn/2008/11/04/iis%e5%ae%89%e5%85%a8%e6%9c%ba%e5%88%b6%e8%af%a6%e8%a7%a3.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/04/iis%e5%ae%89%e5%85%a8%e6%9c%ba%e5%88%b6%e8%af%a6%e8%a7%a3.shtml#comments</comments>
		<pubDate>Tue, 04 Nov 2008 10:11:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[iis]]></category>

		<category><![CDATA[权限]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=371</guid>
		<description><![CDATA[2005年前后曾经风靡过一阵旁注入侵，其利用的原理是所有的iis站点使用了统一的进程账户，而对所有站点设置了同样的权限，因此，当你有一个站点的权限的时候，就等于拥有了所有站点的权限。
在虚拟主机上，这么设置，那生意真的是没法做了，因此，基于iis的虚拟主机都用了独立的iis进程账户进行权限的隔离。
现简述安全原理：
现有 site1，site2，site3 三个站点，三个站点目录结构如下
D:\WWW\site1  D:\WWW\site2   D:\WWW\site3
默认会使用 IUSR_SUN 这个账户作为Internet来宾账户，而 IIS_WPG作为IIS工作进程组。那么会在D:\WWW 这个文件夹上使IUSR_SUN有用读写执行脚本的权限，而三个站点的的匿名访问用户均为IUSR_SUN。这样，虽然脚本（asp，php等）运行在D:\WWW\site1目录下，但对D:\WWW\site2   D:\WWW\site3都是有读写权限的。
如果服务器上的站点是一个公司的，那样还好，如果是给不同的用户来用，问题不言而喻。
因此，我们要用独立的账户和权限来运行三个站点。
我们设置三个用户  IUSR_SUN_1  IUSR_SUN_2   IUSR_SUN_3 ,只归入guests组（如果属于多个组，windows会按照权限的交集来计算）三个用户分别作为 D:\WWW\site1  D:\WWW\site2   D:\WWW\site3的匿名访问用户。然后分别给 D:\WWW\site1  IUSR_SUN_1用户读写等权限，依次设置。
这样，每个网站的用户权限被禁锢在自己的文件夹（站点）下，就保证了站点权限的隔离。
－－－－－－附录－－－－－－
在设置一个站点的时候，我按照最严格的权限进行设定，但发现一个问题，有些PHP的脚本不能执行。后来发现，当使用require(&#8221;./a.php&#8221;)，这种linux风格的路径的时候，会出问题。后查资料发现，这样访问的时候，脚本需要对本层目录的上一层拥有读的权限，所以，我们在独立设置对上层有个读的权限，这样问题就可以解决。
这个问题发生在ThinkSNS程序中，他们大量使用了linux风格的路径包含方式，因此在权限严格的iis上就跑不动了。而discuz的程序大都不使用这种方式，在兼容性上下了很大功夫。
]]></description>
			<content:encoded><![CDATA[<p>2005年前后曾经风靡过一阵旁注入侵，其利用的原理是所有的iis站点使用了统一的进程账户，而对所有站点设置了同样的权限，因此，当你有一个站点的权限的时候，就等于拥有了所有站点的权限。</p>
<p>在虚拟主机上，这么设置，那生意真的是没法做了，因此，基于iis的虚拟主机都用了独立的iis进程账户进行权限的隔离。</p>
<p>现简述安全原理：</p>
<p>现有 site1，site2，site3 三个站点，三个站点目录结构如下</p>
<p>D:\WWW\site1  D:\WWW\site2   D:\WWW\site3</p>
<p>默认会使用 IUSR_SUN 这个账户作为Internet来宾账户，而 IIS_WPG作为IIS工作进程组。那么会在D:\WWW 这个文件夹上使IUSR_SUN有用读写执行脚本的权限，而三个站点的的匿名访问用户均为IUSR_SUN。这样，虽然脚本（asp，php等）运行在D:\WWW\site1目录下，但对D:\WWW\site2   D:\WWW\site3都是有读写权限的。</p>
<p>如果服务器上的站点是一个公司的，那样还好，如果是给不同的用户来用，问题不言而喻。</p>
<p>因此，我们要用独立的账户和权限来运行三个站点。</p>
<p>我们设置三个用户  IUSR_SUN_1  IUSR_SUN_2   IUSR_SUN_3 ,只归入guests组（如果属于多个组，windows会按照权限的交集来计算）三个用户分别作为 D:\WWW\site1  D:\WWW\site2   D:\WWW\site3的匿名访问用户。然后分别给 D:\WWW\site1  IUSR_SUN_1用户读写等权限，依次设置。</p>
<p>这样，每个网站的用户权限被禁锢在自己的文件夹（站点）下，就保证了站点权限的隔离。</p>
<p>－－－－－－附录－－－－－－</p>
<p>在设置一个站点的时候，我按照最严格的权限进行设定，但发现一个问题，有些PHP的脚本不能执行。后来发现，当使用require(&#8221;./a.php&#8221;)，这种linux风格的路径的时候，会出问题。后查资料发现，这样访问的时候，脚本需要对本层目录的上一层拥有读的权限，所以，我们在独立设置对上层有个读的权限，这样问题就可以解决。</p>
<p>这个问题发生在ThinkSNS程序中，他们大量使用了linux风格的路径包含方式，因此在权限严格的iis上就跑不动了。而discuz的程序大都不使用这种方式，在兼容性上下了很大功夫。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/04/iis%e5%ae%89%e5%85%a8%e6%9c%ba%e5%88%b6%e8%af%a6%e8%a7%a3.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Amp Linux自动安装脚本（FastCgi）2.0发布</title>
		<link>http://www.sunboyu.cn/2008/11/03/amp-linux%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac%ef%bc%88fastcgi%ef%bc%8920%e5%8f%91%e5%b8%83.shtml</link>
		<comments>http://www.sunboyu.cn/2008/11/03/amp-linux%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac%ef%bc%88fastcgi%ef%bc%8920%e5%8f%91%e5%b8%83.shtml#comments</comments>
		<pubDate>Mon, 03 Nov 2008 09:51:03 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=369</guid>
		<description><![CDATA[sunboyu-amp-fastcgi-v20-alpha
本来模块方式跟fastcgi方式的版本可以同步发布的，单由于不争气的hp本本，推迟N天发布。
目前本版本可以安装使用，但由于启用了suexec的安全方式，在虚拟主机下还不能应用，因为linux权限系统很严格，目前还没有彻底搞透suexec的权限机制。
估计以下的几天都得搞这个问题了。我从google上搜索了不少的文章，可惜权限细节配置的方面不多，即使有详细的，也没有说明白原理，所以还是得自己来搞了。
这个版本的更新，跟模块方式编译的类似，如下：
1、增加 OSSP mm 库，PHP可以在此库的支持下保存session到内存 http://www.ossp.org/pkg/lib/mm/
2、增加eaccelerator-0.9.5.2 opcode缓存  http://eaccelerator.net/
3、Apache开启status模块
4、增加了suexec安全访问方式的配置（研究调试中）。
欢迎大家加入LAMPer msn群 lampper@live.cn 加这个号为msn好友即可
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2008/11/sunboyu-amp-fastcgi-v20-alpha.txt">sunboyu-amp-fastcgi-v20-alpha</a></p>
<p>本来模块方式跟fastcgi方式的版本可以同步发布的，单由于不争气的hp本本，推迟N天发布。</p>
<p>目前本版本可以安装使用，但由于启用了suexec的安全方式，在虚拟主机下还不能应用，因为linux权限系统很严格，目前还没有彻底搞透suexec的权限机制。</p>
<p>估计以下的几天都得搞这个问题了。我从google上搜索了不少的文章，可惜权限细节配置的方面不多，即使有详细的，也没有说明白原理，所以还是得自己来搞了。</p>
<p>这个版本的更新，跟模块方式编译的类似，如下：</p>
<p>1、增加 OSSP mm 库，PHP可以在此库的支持下保存session到内存 http://www.ossp.org/pkg/lib/mm/</p>
<p>2、增加eaccelerator-0.9.5.2 opcode缓存  http://eaccelerator.net/</p>
<p>3、Apache开启status模块</p>
<p>4、增加了suexec安全访问方式的配置（研究调试中）。</p>
<p>欢迎大家加入LAMPer msn群 lampper@live.cn 加这个号为msn好友即可</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/11/03/amp-linux%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac%ef%bc%88fastcgi%ef%bc%8920%e5%8f%91%e5%b8%83.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Apache开启Gzip压缩</title>
		<link>http://www.sunboyu.cn/2008/10/28/apache%e5%bc%80%e5%90%afgzip%e5%8e%8b%e7%bc%a9.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/28/apache%e5%bc%80%e5%90%afgzip%e5%8e%8b%e7%bc%a9.shtml#comments</comments>
		<pubDate>Tue, 28 Oct 2008 05:57:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[deflate]]></category>

		<category><![CDATA[mod_gzip]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=366</guid>
		<description><![CDATA[文档位置 http://lamp.linux.gov.cn/Apache/ApacheMenu/mod/mod_deflate.html
Apache2中的实时压缩解压的模块编译在mod_deflate模块中，替换了原来的mod_gzip模块。
编译apache的时候 &#8211;enable-deflate  这个参数是默认开启的，编译完会有mod_deflate模块。
配置站点：
如果我们想使一个文件传输的时候进行加密，我们在站点配置文件里增加这样的配置
&#60;Location /&#62;
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \
\.(?:gif&#124;jpe?g&#124;png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
&#60;/Location&#62;
这样，/opt/httpd-2.2.9/htdocs目录下的所有mime类型为text/html的文件就可以启用
未压缩的http头



Date
Tue, 28 Oct 2008 13:04:15 GMT


Server
Apache/2.2.9 (Unix) DAV/2 PHP/5.2.6


Last-Modified
Tue, 28 Oct 2008 12:51:52 GMT


Etag
&#8220;30623-55fda-45a4fb62a8a00&#8243;


Accept-Ranges
bytes


Content-Length
352218


Content-Type
text/html


Vary
Accept-Encoding,User-Agent



压缩后的http头



Date
Tue, 28 Oct 2008 13:07:39 GMT


Server
Apache/2.2.9 (Unix) DAV/2 PHP/5.2.6


Last-Modified
Tue, 28 Oct 2008 12:51:52 GMT


Etag
&#8220;30623-55fda-45a4fb62a8a00&#8243;-gzip


Accept-Ranges
bytes


Vary
Accept-Encoding,User-Agent


Content-Encoding
gzip


Content-Length
2778


Keep-Alive
timeout=5, max=100


Connection
Keep-Alive


Content-Type
text/html



原来length为352218，压缩后为2778，效果还是很明显的。
不过对于length很小的文件，是不进行压缩的。
具体的一些调整的细节，可以看原apache手册。
]]></description>
			<content:encoded><![CDATA[<p>文档位置 http://lamp.linux.gov.cn/Apache/ApacheMenu/mod/mod_deflate.html</p>
<p>Apache2中的实时压缩解压的模块编译在mod_deflate模块中，替换了原来的mod_gzip模块。</p>
<p>编译apache的时候 &#8211;enable-deflate  这个参数是默认开启的，编译完会有mod_deflate模块。</p>
<p>配置站点：</p>
<p>如果我们想使一个文件传输的时候进行加密，我们在站点配置文件里增加这样的配置</p>
<p>&lt;Location /&gt;<br />
SetOutputFilter DEFLATE<br />
BrowserMatch ^Mozilla/4 gzip-only-text/html<br />
BrowserMatch ^Mozilla/4\.0[678] no-gzip<br />
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html<br />
SetEnvIfNoCase Request_URI \<br />
\.(?:gif|jpe?g|png)$ no-gzip dont-vary<br />
Header append Vary User-Agent env=!dont-vary<br />
&lt;/Location&gt;<br />
这样，/opt/httpd-2.2.9/htdocs目录下的所有mime类型为text/html的文件就可以启用</p>
<p>未压缩的http头</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="netInfoParamName">Date</td>
<td class="netInfoParamValue">Tue, 28 Oct 2008 13:04:15 GMT</td>
</tr>
<tr>
<td class="netInfoParamName">Server</td>
<td class="netInfoParamValue">Apache/2.2.9 (Unix) DAV/2 PHP/5.2.6</td>
</tr>
<tr>
<td class="netInfoParamName">Last-Modified</td>
<td class="netInfoParamValue">Tue, 28 Oct 2008 12:51:52 GMT</td>
</tr>
<tr>
<td class="netInfoParamName">Etag</td>
<td class="netInfoParamValue">&#8220;30623-55fda-45a4fb62a8a00&#8243;</td>
</tr>
<tr>
<td class="netInfoParamName">Accept-Ranges</td>
<td class="netInfoParamValue">bytes</td>
</tr>
<tr>
<td class="netInfoParamName">Content-Length</td>
<td class="netInfoParamValue">352218</td>
</tr>
<tr>
<td class="netInfoParamName">Content-Type</td>
<td class="netInfoParamValue">text/html</td>
</tr>
<tr>
<td class="netInfoParamName">Vary</td>
<td class="netInfoParamValue">Accept-Encoding,User-Agent</td>
</tr>
</tbody>
</table>
<p>压缩后的http头</p>
<table border="1" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="netInfoParamName">Date</td>
<td class="netInfoParamValue">Tue, 28 Oct 2008 13:07:39 GMT</td>
</tr>
<tr>
<td class="netInfoParamName">Server</td>
<td class="netInfoParamValue">Apache/2.2.9 (Unix) DAV/2 PHP/5.2.6</td>
</tr>
<tr>
<td class="netInfoParamName">Last-Modified</td>
<td class="netInfoParamValue">Tue, 28 Oct 2008 12:51:52 GMT</td>
</tr>
<tr>
<td class="netInfoParamName">Etag</td>
<td class="netInfoParamValue">&#8220;30623-55fda-45a4fb62a8a00&#8243;-gzip</td>
</tr>
<tr>
<td class="netInfoParamName">Accept-Ranges</td>
<td class="netInfoParamValue">bytes</td>
</tr>
<tr>
<td class="netInfoParamName">Vary</td>
<td class="netInfoParamValue">Accept-Encoding,User-Agent</td>
</tr>
<tr>
<td class="netInfoParamName">Content-Encoding</td>
<td class="netInfoParamValue">gzip</td>
</tr>
<tr>
<td class="netInfoParamName">Content-Length</td>
<td class="netInfoParamValue">2778</td>
</tr>
<tr>
<td class="netInfoParamName">Keep-Alive</td>
<td class="netInfoParamValue">timeout=5, max=100</td>
</tr>
<tr>
<td class="netInfoParamName">Connection</td>
<td class="netInfoParamValue">Keep-Alive</td>
</tr>
<tr>
<td class="netInfoParamName">Content-Type</td>
<td class="netInfoParamValue">text/html</td>
</tr>
</tbody>
</table>
<p>原来length为352218，压缩后为2778，效果还是很明显的。</p>
<p>不过对于length很小的文件，是不进行压缩的。</p>
<p>具体的一些调整的细节，可以看原apache手册。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/28/apache%e5%bc%80%e5%90%afgzip%e5%8e%8b%e7%bc%a9.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Amp Linux自动安装脚本（模块方式安装）2.0发布</title>
		<link>http://www.sunboyu.cn/2008/10/27/amp-linux%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac%ef%bc%88%e6%a8%a1%e5%9d%97%e6%96%b9%e5%bc%8f%e5%ae%89%e8%a3%85%ef%bc%8920%e5%8f%91%e5%b8%83.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/27/amp-linux%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac%ef%bc%88%e6%a8%a1%e5%9d%97%e6%96%b9%e5%bc%8f%e5%ae%89%e8%a3%85%ef%bc%8920%e5%8f%91%e5%b8%83.shtml#comments</comments>
		<pubDate>Mon, 27 Oct 2008 02:44:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[amp]]></category>

		<category><![CDATA[mod]]></category>

		<category><![CDATA[v2.0]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=364</guid>
		<description><![CDATA[sunboyu-amp-mod-v20-alpha
更改记录：
1、增加 OSSP mm 库，PHP可以在此库的支持下保存session到内存 http://www.ossp.org/pkg/lib/mm/
2、增加eaccelerator-0.9.5.2 opcode缓存  http://eaccelerator.net/
3、Apache开启status模块
本软件无stable版本，因为脚本并不是一个兼容各个linux系统的脚本，而是我在平时使用时做个一个简单批处理，来简化服务器配置的繁琐过程.
我使用的环境是Centos5.0，使用的定制安装，安装尽量最小化（本人有系统洁癖），以后系统还会更简化，我会尽量得使用编译的方式安装所有的软件，并不是说自己编译的就肯定比别人编译的好，参数更优化，而是通过这些繁琐的东西来提高对服务器性能跟参数之间关系的认识。
建议网友在做服务器的时候，不要按照我的默认脚本安装，因为这个脚本只注重了功能的大而全而并未关注性能和稳定，所以，本脚本只适合大家去研究，或者学习这个过程。
以后的版本会逐渐把一些优化的思想加入，但终归是个人的一些思想，不一定适合所有人，而且，这只是一个单机服务器的配置过程，对于大型系统是不适合的。
欢迎大家加入LAMP MSN 群交流 ( 加 lampper@live.cn 为msn好友)
顺便BS一下惠普笔记本V3000系列＋宇瞻内存，太不兼容了，以至我调试脚本的时候不断死机（调试一遍得一小时呢－－&#124;）
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2008/10/sunboyu-amp-mod-v20-alpha.txt">sunboyu-amp-mod-v20-alpha</a></p>
<p>更改记录：</p>
<p>1、增加 OSSP mm 库，PHP可以在此库的支持下保存session到内存 http://www.ossp.org/pkg/lib/mm/</p>
<p>2、增加eaccelerator-0.9.5.2 opcode缓存  http://eaccelerator.net/</p>
<p>3、Apache开启status模块</p>
<p>本软件无stable版本，因为脚本并不是一个兼容各个linux系统的脚本，而是我在平时使用时做个一个简单批处理，来简化服务器配置的繁琐过程.</p>
<p>我使用的环境是Centos5.0，使用的定制安装，安装尽量最小化（本人有系统洁癖），以后系统还会更简化，我会尽量得使用编译的方式安装所有的软件，并不是说自己编译的就肯定比别人编译的好，参数更优化，而是通过这些繁琐的东西来提高对服务器性能跟参数之间关系的认识。</p>
<p>建议网友在做服务器的时候，不要按照我的默认脚本安装，因为这个脚本只注重了功能的大而全而并未关注性能和稳定，所以，本脚本只适合大家去研究，或者学习这个过程。</p>
<p>以后的版本会逐渐把一些优化的思想加入，但终归是个人的一些思想，不一定适合所有人，而且，这只是一个单机服务器的配置过程，对于大型系统是不适合的。</p>
<p>欢迎大家加入LAMP MSN 群交流 ( 加 lampper@live.cn 为msn好友)</p>
<p>顺便BS一下惠普笔记本V3000系列＋宇瞻内存，太不兼容了，以至我调试脚本的时候不断死机（调试一遍得一小时呢－－|）</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/27/amp-linux%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac%ef%bc%88%e6%a8%a1%e5%9d%97%e6%96%b9%e5%bc%8f%e5%ae%89%e8%a3%85%ef%bc%8920%e5%8f%91%e5%b8%83.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>jar命令的一些应用</title>
		<link>http://www.sunboyu.cn/2008/10/21/jar%e5%91%bd%e4%bb%a4%e7%9a%84%e4%b8%80%e4%ba%9b%e5%ba%94%e7%94%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/21/jar%e5%91%bd%e4%bb%a4%e7%9a%84%e4%b8%80%e4%ba%9b%e5%ba%94%e7%94%a8.shtml#comments</comments>
		<pubDate>Tue, 21 Oct 2008 08:29:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[jar]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=358</guid>
		<description><![CDATA[对于我，最常用的两个功能，就是打包类库，创建可执行的JAR。
打包文件，可以看下边的功能呢个表：



功能
命令


用一个单独的文件创建一个 JAR 文件
jar cf jar-file input-file&#8230;


用一个目录创建一个 JAR 文件
jar cf jar-file dir-name


创建一个未压缩的 JAR 文件
jar cf0 jar-file dir-name


更新一个 JAR 文件
jar uf jar-file input-file&#8230;


查看一个 JAR 文件的内容
jar tf jar-file


提取一个 JAR 文件的内容
jar xf jar-file


从一个 JAR 文件中提取特定的文件
jar xf jar-file archived-file&#8230;


运行一个打包为可执行 JAR 文件的应用程序
java -jar app.jar



创建一个可执行 JAR 很容易。首先将所有应用程序代码放到一个目录中。假设应用程序中的主类是 com.mycompany.myapp.Sample 。您要创建一个包含应用程序代码的 JAR 文件并标识出主类。为此，在某个位置(不是在应用程序目录中)创建一个名为  manifest 的文件，并在其中加入以下一行： Main-Class: com.mycompany.myapp.Sample
引用地址:http://www-128.ibm.com/developerworks/cn/java/j-jar/index.html
]]></description>
			<content:encoded><![CDATA[<p>对于我，最常用的两个功能，就是打包类库，创建可执行的JAR。</p>
<p>打包文件，可以看下边的功能呢个表：</p>
<table border="1" cellspacing="0" cellpadding="3" width="80%">
<tbody>
<tr>
<td><strong>功能</strong></td>
<td><strong>命令</strong></td>
</tr>
<tr>
<td>用一个单独的文件创建一个 JAR 文件</td>
<td>jar cf jar-file input-file&#8230;</td>
</tr>
<tr>
<td>用一个目录创建一个 JAR 文件</td>
<td>jar cf jar-file dir-name</td>
</tr>
<tr>
<td>创建一个未压缩的 JAR 文件</td>
<td>jar cf0 jar-file dir-name</td>
</tr>
<tr>
<td>更新一个 JAR 文件</td>
<td>jar uf jar-file input-file&#8230;</td>
</tr>
<tr>
<td>查看一个 JAR 文件的内容</td>
<td>jar tf jar-file</td>
</tr>
<tr>
<td>提取一个 JAR 文件的内容</td>
<td>jar xf jar-file</td>
</tr>
<tr>
<td>从一个 JAR 文件中提取特定的文件</td>
<td>jar xf jar-file archived-file&#8230;</td>
</tr>
<tr>
<td>运行一个打包为可执行 JAR 文件的应用程序</td>
<td>java -jar app.jar</td>
</tr>
</tbody>
</table>
<p>创建一个可执行 JAR 很容易。首先将所有应用程序代码放到一个目录中。假设应用程序中的主类是 com.mycompany.myapp.Sample 。您要创建一个包含应用程序代码的 JAR 文件并标识出主类。为此，在某个位置(不是在应用程序目录中)创建一个名为  manifest 的文件，并在其中加入以下一行： Main-Class: com.mycompany.myapp.Sample</p>
<p>引用地址:http://www-128.ibm.com/developerworks/cn/java/j-jar/index.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/21/jar%e5%91%bd%e4%bb%a4%e7%9a%84%e4%b8%80%e4%ba%9b%e5%ba%94%e7%94%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>UML2.0学习指南</title>
		<link>http://www.sunboyu.cn/2008/10/21/uml20%e5%ad%a6%e4%b9%a0%e6%8c%87%e5%8d%97.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/21/uml20%e5%ad%a6%e4%b9%a0%e6%8c%87%e5%8d%97.shtml#comments</comments>
		<pubDate>Tue, 21 Oct 2008 01:11:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[uml]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=356</guid>
		<description><![CDATA[
书还不错，虽然有点看不懂。中小型公司很少有做项目前期建模的，我来试试。
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2008/10/s2253303.jpg"><img class="aligncenter size-full wp-image-357" title="s2253303" src="http://www.sunboyu.cn/upfiles/2008/10/s2253303.jpg" alt="" width="200" height="261" /></a></p>
<p>书还不错，虽然有点看不懂。中小型公司很少有做项目前期建模的，我来试试。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/21/uml20%e5%ad%a6%e4%b9%a0%e6%8c%87%e5%8d%97.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>WordPress使用Lucene进行搜索</title>
		<link>http://www.sunboyu.cn/2008/10/18/wordpress%e4%bd%bf%e7%94%a8lucene%e8%bf%9b%e8%a1%8c%e6%90%9c%e7%b4%a2.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/18/wordpress%e4%bd%bf%e7%94%a8lucene%e8%bf%9b%e8%a1%8c%e6%90%9c%e7%b4%a2.shtml#comments</comments>
		<pubDate>Sat, 18 Oct 2008 05:52:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[lucene]]></category>

		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=354</guid>
		<description><![CDATA[接上篇，我们使用Lucene Document Field IndexWrite 等方法创建了索引，现在，使用内建的搜索的方法进行检索。
代码如下：
import java.io.*;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.analysis.*;
import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.*;
&#160;
public class Search
{
public static void main( String argv[] ) throws Exception
{
IndexReader reader = IndexReader.open(&#34;./index&#34;);
Searcher searcher = new IndexSearcher(reader);
SimpleAnalyzeranalyzer = new SimpleAnalyzer();
QueryParser parser = new QueryParser(&#34;post_content&#34;, analyzer);
Query query = parser.parse( argv[0] );
Hits hits = searcher.search(query);
System.out.println(hits.length() + &#34;个结果&#34;);
for(int i=0;i
{
System.out.println(hits.doc(i).get(&#34;guid&#34;));
}
}
}
编译后，我们在命令行进行查询：
E:\java>java Search php
40个结果
http://www.sunboyu.cn/?p=332
http://www.sunboyu.cn/?p=164
http://www.sunboyu.cn/?p=213
http://www.sunboyu.cn/?p=123
http://www.sunboyu.cn/?p=124
http://www.sunboyu.cn/?p=180
http://www.sunboyu.cn/?p=283
http://www.sunboyu.cn/?p=282
http://www.sunboyu.cn/?p=234
http://www.sunboyu.cn/?p=53
http://www.sunboyu.cn/?p=159
http://www.sunboyu.cn/?p=235
http://www.sunboyu.cn/?p=221
http://www.sunboyu.cn/?p=73
http://www.sunboyu.cn/?p=11
http://www.sunboyu.cn/?p=51
http://www.sunboyu.cn/?p=240
http://www.sunboyu.cn/?p=196
http://www.sunboyu.cn/?p=52
http://www.sunboyu.cn/?p=308
http://www.sunboyu.cn/?p=298
http://www.sunboyu.cn/?p=9
http://www.sunboyu.cn/?page_id=38
http://www.sunboyu.cn/?p=236
http://www.sunboyu.cn/?p=320
http://www.sunboyu.cn/?p=141
http://www.sunboyu.cn/?p=78
http://www.sunboyu.cn/?p=291
http://www.sunboyu.cn/?p=218
http://www.sunboyu.cn/?p=154
http://www.sunboyu.cn/?p=121
http://www.sunboyu.cn/?p=200
http://www.sunboyu.cn/?p=244
http://www.sunboyu.cn/?p=280
http://www.sunboyu.cn/?page_id=112
http://www.sunboyu.cn/?p=288
http://www.sunboyu.cn/?p=292
http://www.sunboyu.cn/?p=20
http://www.sunboyu.cn/?p=130
http://www.sunboyu.cn/?p=87
E:\java>
可以看到，当我们搜索关键词“php”，返回了所有存在php关键词的链接。
当然，这个只是个简单的演示，在创建索引的时候，我们使用了SimpleAnalyzer的方法，这个方法对中文，其实就是基于单字的分词，对于中文信息检索基本是没有意义的。Lucene提供了开发的源代码，因为，我们可以很方便得为其附加我们自己的中文分词方法。
]]></description>
			<content:encoded><![CDATA[<p>接上篇，我们使用Lucene Document Field IndexWrite 等方法创建了索引，现在，使用内建的搜索的方法进行检索。<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">import java.io.*;</li>
<li>import org.apache.lucene.index.Term;</li>
<li>import org.apache.lucene.index.IndexReader;</li>
<li>import org.apache.lucene.analysis.*;</li>
<li>import org.apache.lucene.queryParser.QueryParser;</li>
<li>import org.apache.lucene.search.*;</li>
<li>&nbsp;</li>
<li>public class Search</li>
<li>{</li>
<li>public static void main( String argv[] ) throws Exception</li>
<li>{</li>
<li>IndexReader reader = IndexReader.open(&quot;./index&quot;);</li>
<li>Searcher searcher = new IndexSearcher(reader);</li>
<li>SimpleAnalyzeranalyzer = new SimpleAnalyzer();</li>
<li>QueryParser parser = new QueryParser(&quot;post_content&quot;, analyzer);</li>
<li>Query query = parser.parse( argv[0] );</li>
<li>Hits hits = searcher.search(query);</li>
<li>System.out.println(hits.length() + &quot;个结果&quot;);</li>
<li>for(int i=0;i</li>
<li>{</li>
<li>System.out.println(hits.doc(i).get(&quot;guid&quot;));</li>
<li>}</li>
<li>}</li>
<li>}</li></ol></div>
<p>编译后，我们在命令行进行查询：</p>
<p>E:\java>java Search php<br />
40个结果<br />
http://www.sunboyu.cn/?p=332<br />
http://www.sunboyu.cn/?p=164<br />
http://www.sunboyu.cn/?p=213<br />
http://www.sunboyu.cn/?p=123<br />
http://www.sunboyu.cn/?p=124<br />
http://www.sunboyu.cn/?p=180<br />
http://www.sunboyu.cn/?p=283<br />
http://www.sunboyu.cn/?p=282<br />
http://www.sunboyu.cn/?p=234<br />
http://www.sunboyu.cn/?p=53<br />
http://www.sunboyu.cn/?p=159<br />
http://www.sunboyu.cn/?p=235<br />
http://www.sunboyu.cn/?p=221<br />
http://www.sunboyu.cn/?p=73<br />
http://www.sunboyu.cn/?p=11<br />
http://www.sunboyu.cn/?p=51<br />
http://www.sunboyu.cn/?p=240<br />
http://www.sunboyu.cn/?p=196<br />
http://www.sunboyu.cn/?p=52<br />
http://www.sunboyu.cn/?p=308<br />
http://www.sunboyu.cn/?p=298<br />
http://www.sunboyu.cn/?p=9<br />
http://www.sunboyu.cn/?page_id=38<br />
http://www.sunboyu.cn/?p=236<br />
http://www.sunboyu.cn/?p=320<br />
http://www.sunboyu.cn/?p=141<br />
http://www.sunboyu.cn/?p=78<br />
http://www.sunboyu.cn/?p=291<br />
http://www.sunboyu.cn/?p=218<br />
http://www.sunboyu.cn/?p=154<br />
http://www.sunboyu.cn/?p=121<br />
http://www.sunboyu.cn/?p=200<br />
http://www.sunboyu.cn/?p=244<br />
http://www.sunboyu.cn/?p=280<br />
http://www.sunboyu.cn/?page_id=112<br />
http://www.sunboyu.cn/?p=288<br />
http://www.sunboyu.cn/?p=292<br />
http://www.sunboyu.cn/?p=20<br />
http://www.sunboyu.cn/?p=130<br />
http://www.sunboyu.cn/?p=87</p>
<p>E:\java><br />
可以看到，当我们搜索关键词“php”，返回了所有存在php关键词的链接。</p>
<p>当然，这个只是个简单的演示，在创建索引的时候，我们使用了SimpleAnalyzer的方法，这个方法对中文，其实就是基于单字的分词，对于中文信息检索基本是没有意义的。Lucene提供了开发的源代码，因为，我们可以很方便得为其附加我们自己的中文分词方法。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/18/wordpress%e4%bd%bf%e7%94%a8lucene%e8%bf%9b%e8%a1%8c%e6%90%9c%e7%b4%a2.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>流程化管理与技术文档对企业的重要性分析</title>
		<link>http://www.sunboyu.cn/2008/10/17/%e6%b5%81%e7%a8%8b%e5%8c%96%e7%ae%a1%e7%90%86%e4%b8%8e%e6%8a%80%e6%9c%af%e6%96%87%e6%a1%a3%e5%af%b9%e4%bc%81%e4%b8%9a%e7%9a%84%e9%87%8d%e8%a6%81%e6%80%a7%e5%88%86%e6%9e%90.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/17/%e6%b5%81%e7%a8%8b%e5%8c%96%e7%ae%a1%e7%90%86%e4%b8%8e%e6%8a%80%e6%9c%af%e6%96%87%e6%a1%a3%e5%af%b9%e4%bc%81%e4%b8%9a%e7%9a%84%e9%87%8d%e8%a6%81%e6%80%a7%e5%88%86%e6%9e%90.shtml#comments</comments>
		<pubDate>Fri, 17 Oct 2008 02:52:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[公司管理]]></category>

		<category><![CDATA[项目管理]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=353</guid>
		<description><![CDATA[原公司的系统，也就是本猿的开山作，也是本猿的败笔作，在我接班人的手上又出现了同样的问题，bug，严重的bug，足矣让老板杀人的bug。
这个bug曾经在公司技术上闹过很大的风波，虽然简单，但造成的影响是客户丢失，职员被辞，甚至更大（至于由于老板上火而造成的其他家庭社会影响暂时不计）。损失，不单是一行程序bug所能描述的。
其实问题发生，是不能简单追究责任的，因为此问题并非第一次造成，而且之前惨重的损失，并不能说不是一个教训。一个问题在同一个人身上发生，是不应该的，同样在一个公司内发生，这是有问题的。
制度，管理，流程，文档，知识库，这些都是公司在发展中逐步积累的无形财富。知识产品的产生，有前人的经验，很多问题都可以直接避免，新人进行开发，必然要熟悉公司的一些制度，规范性流程，这个过程更多的是对公司历史和现有产品的熟悉了解。
如果没有这个过程，新人可能还会从零考虑这个事情，而不是在一个阶段的基础上进行开发，而重复的事情降低了公司的效率和发展速度，人工开支过多产品进度缓慢造成投入产出比失调。
制度，流程化管理，产品文档化，在大型公司会非常完善，他们的每件作品都会是个产品，按照产品的标准来实行。而在中小企业，这方面是很弱化的。随着企业发展，小型公司也将会向中大型公司发展，规模的扩大，这方面问题会体现得非常突出。因为，当务之急，是知道在适当的时候做适当的事情。
]]></description>
			<content:encoded><![CDATA[<p>原公司的系统，也就是本猿的开山作，也是本猿的败笔作，在我接班人的手上又出现了同样的问题，bug，严重的bug，足矣让老板杀人的bug。</p>
<p>这个bug曾经在公司技术上闹过很大的风波，虽然简单，但造成的影响是客户丢失，职员被辞，甚至更大（至于由于老板上火而造成的其他家庭社会影响暂时不计）。损失，不单是一行程序bug所能描述的。</p>
<p>其实问题发生，是不能简单追究责任的，因为此问题并非第一次造成，而且之前惨重的损失，并不能说不是一个教训。一个问题在同一个人身上发生，是不应该的，同样在一个公司内发生，这是有问题的。</p>
<p>制度，管理，流程，文档，知识库，这些都是公司在发展中逐步积累的无形财富。知识产品的产生，有前人的经验，很多问题都可以直接避免，新人进行开发，必然要熟悉公司的一些制度，规范性流程，这个过程更多的是对公司历史和现有产品的熟悉了解。</p>
<p>如果没有这个过程，新人可能还会从零考虑这个事情，而不是在一个阶段的基础上进行开发，而重复的事情降低了公司的效率和发展速度，人工开支过多产品进度缓慢造成投入产出比失调。</p>
<p>制度，流程化管理，产品文档化，在大型公司会非常完善，他们的每件作品都会是个产品，按照产品的标准来实行。而在中小企业，这方面是很弱化的。随着企业发展，小型公司也将会向中大型公司发展，规模的扩大，这方面问题会体现得非常突出。因为，当务之急，是知道在适当的时候做适当的事情。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/17/%e6%b5%81%e7%a8%8b%e5%8c%96%e7%ae%a1%e7%90%86%e4%b8%8e%e6%8a%80%e6%9c%af%e6%96%87%e6%a1%a3%e5%af%b9%e4%bc%81%e4%b8%9a%e7%9a%84%e9%87%8d%e8%a6%81%e6%80%a7%e5%88%86%e6%9e%90.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>使用Lucene为WordPress创建索引</title>
		<link>http://www.sunboyu.cn/2008/10/15/%e4%bd%bf%e7%94%a8lucene%e4%b8%bawordpress%e5%88%9b%e5%bb%ba%e7%b4%a2%e5%bc%95.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/15/%e4%bd%bf%e7%94%a8lucene%e4%b8%bawordpress%e5%88%9b%e5%bb%ba%e7%b4%a2%e5%bc%95.shtml#comments</comments>
		<pubDate>Wed, 15 Oct 2008 07:41:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[lucence]]></category>

		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=346</guid>
		<description><![CDATA[上次说到Lucene的Document模型，现在，我们使用WordPress为例，为其创建索引。
分析wordpress数据库结构，我们只需要为标题内容，即主要的文本内容创建索引即可。
具体语句为:  SELECT ID,post_title,post_content,guid FROM wp_posts ORDER BY ID DESC
如下代码，mysql连接类用的上文的mysql类，代码风格还是很PHP。生成的索引全保存在当前的index文件夹下
E:\java\index 的目录
2008-10-16  14:40
.
2008-10-16  14:40              ..
2008-10-16  14:40                20 segments.gen
2008-10-16  14:40       [...]]]></description>
			<content:encoded><![CDATA[<p>上次说到Lucene的Document模型，现在，我们使用WordPress为例，为其创建索引。</p>
<p>分析wordpress数据库结构，我们只需要为标题内容，即主要的文本内容创建索引即可。</p>
<p>具体语句为:  SELECT ID,post_title,post_content,guid FROM wp_posts ORDER BY ID DESC</p>
<p>如下代码，mysql连接类用的上文的mysql类，代码风格还是很PHP。生成的索引全保存在当前的index文件夹下</p>
<p>E:\java\index 的目录</p>
<p>2008-10-16  14:40</p>
<p>.<br />
2008-10-16  14:40              ..<br />
2008-10-16  14:40                20 segments.gen<br />
2008-10-16  14:40                98 segments_a4<br />
2008-10-16  14:40           268,174 _a0.fdt<br />
2008-10-16  14:40             2,600 _a0.fdx<br />
2008-10-16  14:40                37 _a0.fnm<br />
2008-10-16  14:40            20,990 _a0.frq<br />
2008-10-16  14:40             1,304 _a0.nrm<br />
2008-10-16  14:40            27,210 _a0.prx<br />
2008-10-16  14:40             1,281 _a0.tii<br />
2008-10-16  14:40           130,051 _a0.tis<br />
2008-10-16  14:40               356 _a1.fdt<br />
<span id="more-346"></span><br />
2008-10-16  14:40                 8 _a1.fdx<br />
2008-10-16  14:40                37 _a1.fnm<br />
2008-10-16  14:40                23 _a1.frq<br />
2008-10-16  14:40                 8 _a1.nrm<br />
2008-10-16  14:40                23 _a1.prx<br />
2008-10-16  14:40                35 _a1.tii<br />
2008-10-16  14:40               413 _a1.tis<br />
2008-10-16  14:40             1,362 _a2.fdt<br />
2008-10-16  14:40                 8 _a2.fdx<br />
2008-10-16  14:40                37 _a2.fnm<br />
2008-10-16  14:40                74 _a2.frq<br />
2008-10-16  14:40                 8 _a2.nrm<br />
2008-10-16  14:40                87 _a2.prx<br />
2008-10-16  14:40                35 _a2.tii<br />
2008-10-16  14:40             1,348 _a2.tis<br />
26 个文件        455,627 字节<br />
2 个目录 30,843,887,616 可用字节</p>
<p>E:\java\index</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">import java.io.*;</li>
<li>import org.apache.lucene.document.Document;</li>
<li>import org.apache.lucene.document.Field;</li>
<li>import org.apache.lucene.index.IndexWriter;</li>
<li>import org.apache.lucene.analysis.SimpleAnalyzer;</li>
<li>import org.apache.lucene.analysis.Analyzer;</li>
<li>public class Index</li>
<li>{</li>
<li>private MysqlConn Db = null;</li>
<li>//构造函数</li>
<li>public void Index()</li>
<li>{</li>
<li>}</li>
<li>//建立mysql连接</li>
<li>public void getConn( String conndsn )</li>
<li>{</li>
<li>this.Db = new MysqlConn();</li>
<li>this.Db.SetDsn( conndsn );</li>
<li>}</li>
<li>public static void main( String args[] )</li>
<li>{</li>
<li>Index index = new Index();</li>
<li>index.getConn( &quot;jdbc:mysql://localhost:3306/wp&quot; );</li>
<li>index.Db.SetUserPass( &quot;root&quot; , &quot;123456&quot; );</li>
<li>index.Db.Conn();</li>
<li>String sql = &quot;SELECT ID,post_title,post_content,guid FROM wp_posts ORDER BY ID DESC&quot;;</li>
<li>index.Db.sqlQuery( sql );</li>
<li>try</li>
<li>{</li>
<li>while( index.Db.rs.next() )</li>
<li>{</li>
<li>String ID = index.Db.rs.getString( &quot;ID&quot; );</li>
<li>String post_title = index.Db.rs.getString( &quot;post_title&quot; );</li>
<li>String post_content = index.Db.rs.getString( &quot;post_content&quot; );</li>
<li>String guid = index.Db.rs.getString( &quot;guid&quot; );</li>
<li>Document doc = new Document();</li>
<li>//注释1</li>
<li>Field f1 = new Field(&quot;ID&quot;,ID,Field.Store.YES,Field.Index.TOKENIZED);</li>
<li>Field f2 = new Field(&quot;post_title&quot;,post_title,Field.Store.YES,Field.Index.TOKENIZED);</li>
<li>Field f3 = new Field(&quot;post_content&quot;,post_content,Field.Store.YES,Field.Index.TOKENIZED);</li>
<li>Field f4 = new Field(&quot;guid&quot;,guid,Field.Store.YES,Field.Index.TOKENIZED);</li>
<li>doc.add( f1 );</li>
<li>doc.add( f2 );</li>
<li>doc.add( f3 );</li>
<li>doc.add( f4 );</li>
<li>System.out.println( ID );</li>
<li>try</li>
<li>{</li>
<li>IndexWriter writer = new IndexWriter( &quot;./index&quot; , new SimpleAnalyzer() );</li>
<li>writer.setUseCompoundFile(false);</li>
<li>writer.addDocument( doc );</li>
<li>writer.close();</li>
<li>}</li>
<li>catch (Exception e)</li>
<li>{</li>
<li>System.out.println(&quot;Error : &quot; + e.toString());</li>
<li>}</li>
<li>}</li>
<li>}</li>
<li>catch(Exception e)</li>
<li>{</li>
<li>System.out.println(&quot;Error : &quot; + e.toString());</li>
<li>}</li>
<li>&nbsp;</li>
<li>}</li>
<li>}</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/15/%e4%bd%bf%e7%94%a8lucene%e4%b8%bawordpress%e5%88%9b%e5%bb%ba%e7%b4%a2%e5%bc%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>无级分类算法的实现与其可用性</title>
		<link>http://www.sunboyu.cn/2008/10/14/%e6%97%a0%e7%ba%a7%e5%88%86%e7%b1%bb%e7%ae%97%e6%b3%95%e7%9a%84%e5%ae%9e%e7%8e%b0%e4%b8%8e%e5%85%b6%e5%8f%af%e7%94%a8%e6%80%a7.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/14/%e6%97%a0%e7%ba%a7%e5%88%86%e7%b1%bb%e7%ae%97%e6%b3%95%e7%9a%84%e5%ae%9e%e7%8e%b0%e4%b8%8e%e5%85%b6%e5%8f%af%e7%94%a8%e6%80%a7.shtml#comments</comments>
		<pubDate>Tue, 14 Oct 2008 14:27:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[无级分类算法]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=343</guid>
		<description><![CDATA[根据动易ASP CMS的算法，简单实现了无级分类的算法，不过根据系统易用性原则，这种无级的分类很难在实际的CMS系统中应用，因此，这种算法在中小型信息管理系统中是不需要的，而大型的信息管理系统也要尽量避免分类深度过高而造成的系统效率问题。总结下来，这只能算自己连手的一个作品。

]]></description>
			<content:encoded><![CDATA[<p>根据动易ASP CMS的算法，简单实现了无级分类的算法，不过根据系统易用性原则，这种无级的分类很难在实际的CMS系统中应用，因此，这种算法在中小型信息管理系统中是不需要的，而大型的信息管理系统也要尽量避免分类深度过高而造成的系统效率问题。总结下来，这只能算自己连手的一个作品。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/10/e69caae591bde5908d-1.jpg"><img class="aligncenter size-full wp-image-345" title="e69caae591bde5908d-1" src="http://www.sunboyu.cn/upfiles/2008/10/e69caae591bde5908d-1.jpg" alt="" width="500" height="274" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/14/%e6%97%a0%e7%ba%a7%e5%88%86%e7%b1%bb%e7%ae%97%e6%b3%95%e7%9a%84%e5%ae%9e%e7%8e%b0%e4%b8%8e%e5%85%b6%e5%8f%af%e7%94%a8%e6%80%a7.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>《构建可扩展的Web站点》有感</title>
		<link>http://www.sunboyu.cn/2008/10/12/%e3%80%8a%e6%9e%84%e5%bb%ba%e5%8f%af%e6%89%a9%e5%b1%95%e7%9a%84web%e7%ab%99%e7%82%b9%e3%80%8b%e6%9c%89%e6%84%9f.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/12/%e3%80%8a%e6%9e%84%e5%bb%ba%e5%8f%af%e6%89%a9%e5%b1%95%e7%9a%84web%e7%ab%99%e7%82%b9%e3%80%8b%e6%9c%89%e6%84%9f.shtml#comments</comments>
		<pubDate>Sun, 12 Oct 2008 01:23:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[LAMP]]></category>

		<category><![CDATA[读后感]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=340</guid>
		<description><![CDATA[草草读完了这本书，写下此文。
本书并不是某项技术的速成，或者一门语言的工具书，而是完全从一个项目管理者和设计者的角度来阐述一个大型项目的架构和技术实现。
作者以通俗手法介绍了一个大型网站从规划，设计，实现等角度，又细数了开发的环境，服务器搭建，开发过程中的一些跟踪调试，代码，数据完整性一致性，运营后的一些bug追踪，负载解决，idc方面的问题，以及一些预警等问题。
这里，作者没有从具体的技术入手，而是抓住了不同环节的一些典型应用，作为抛砖，给读者充分的空间去转移运用这些思路，进行架构的设计。
作者的系统构建在LAMP平台上，因此，非常推荐LAMPer和相关的技术经理来阅读，但作者更侧重于用此平台的一些经验来传达一种设计理念，因此，也推荐其他方面的设计者来学习。
希望大家读后多交流，同时希望更多有项目经验的开发者和设计者，管理者加入我们的LAMP msn群( lampper@live.cn )。
]]></description>
			<content:encoded><![CDATA[<p>草草读完了这本书，写下此文。</p>
<p>本书并不是某项技术的速成，或者一门语言的工具书，而是完全从一个项目管理者和设计者的角度来阐述一个大型项目的架构和技术实现。</p>
<p>作者以通俗手法介绍了一个大型网站从规划，设计，实现等角度，又细数了开发的环境，服务器搭建，开发过程中的一些跟踪调试，代码，数据完整性一致性，运营后的一些bug追踪，负载解决，idc方面的问题，以及一些预警等问题。</p>
<p>这里，作者没有从具体的技术入手，而是抓住了不同环节的一些典型应用，作为抛砖，给读者充分的空间去转移运用这些思路，进行架构的设计。</p>
<p>作者的系统构建在LAMP平台上，因此，非常推荐LAMPer和相关的技术经理来阅读，但作者更侧重于用此平台的一些经验来传达一种设计理念，因此，也推荐其他方面的设计者来学习。</p>
<p>希望大家读后多交流，同时希望更多有项目经验的开发者和设计者，管理者加入我们的LAMP msn群( lampper@live.cn )。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/12/%e3%80%8a%e6%9e%84%e5%bb%ba%e5%8f%af%e6%89%a9%e5%b1%95%e7%9a%84web%e7%ab%99%e7%82%b9%e3%80%8b%e6%9c%89%e6%84%9f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>再议个人作品跟商业软件产品的价值区别</title>
		<link>http://www.sunboyu.cn/2008/10/10/%e5%86%8d%e8%ae%ae%e4%b8%aa%e4%ba%ba%e4%bd%9c%e5%93%81%e8%b7%9f%e5%95%86%e4%b8%9a%e8%bd%af%e4%bb%b6%e4%ba%a7%e5%93%81%e7%9a%84%e4%bb%b7%e5%80%bc%e5%8c%ba%e5%88%ab.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/10/%e5%86%8d%e8%ae%ae%e4%b8%aa%e4%ba%ba%e4%bd%9c%e5%93%81%e8%b7%9f%e5%95%86%e4%b8%9a%e8%bd%af%e4%bb%b6%e4%ba%a7%e5%93%81%e7%9a%84%e4%bb%b7%e5%80%bc%e5%8c%ba%e5%88%ab.shtml#comments</comments>
		<pubDate>Fri, 10 Oct 2008 12:51:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[个人开发]]></category>

		<category><![CDATA[商业软件]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=339</guid>
		<description><![CDATA[很多时候，我们在讨论个人作品跟商业软件产品的区别。
至于这两种方式如何来运用，对一些计划采购的人们是个头疼的事情。
很多人崇尚量身定制，这类人大多是开发狂，或者被商业软件搞得头大的人。因为作为开发者，量身定制能满足个人开发欲，满足个人的成就感，而且，定制软件要比在一些开源上二次开发收费要高。作为这种选择的使用者，一般是没有找到适合自己的商业软件，种种原因，商业软件太贵，业务跟软件不能结合，导致软件屡屡的失败，从而要选择定制开发，而大公司的报价是基本不用考虑的，只能选择一些个人来开发。
对于一些简单的业务，个人开发的作品完全能满足业务的需求，但为什么还有价格高昂的商业开发队伍？
1、个人开发无法进行持续的维护。这里指大多数情况。很多人在一个阶段开发完成后，付款验收后就脱离了合作关系，甚至一些部署和初始化服务都没有，而使用者未必懂这些，造成使用成本的增加。
2、个人开发很少有文档的支持。这对一个需要发展的使用者来说是致命的隐患。业务的扩大，一定需要二次的开发，即使是重新开发，起码也得有个数据库说明文档，方便数据的迁移。再有的隐患，就是数据一旦出现问题，无从查起。
3、个人（也包括小团队）无法保证软件跟业务的紧密结合。一旦业务发展到一定阶段，软件更多的是根据业务的改变，个人很难在一个简单的应用上考虑大规模的业务压力，因此，软件是无法跟商业软件相比拟的。
以上是个人作品跟商业软件的区别。
其实个人作为也并非无益处。
1、个人用户能满足微小的业务需求，在一些应用极小的场合，个人开发的性价比是远远高于商业开发的。
2、个人开发能减少探索性发展前期的成本。
3、个人开发比较灵活，能满足一定规模内的定制。
……还有很多优势，暂不一一列举。
在项目中，选择哪种方式，还要根据情况进行深入的讨论，评估。不过要有这么强的评估团队，估计也有能力建立自己的开发队伍。
]]></description>
			<content:encoded><![CDATA[<p>很多时候，我们在讨论个人作品跟商业软件产品的区别。</p>
<p>至于这两种方式如何来运用，对一些计划采购的人们是个头疼的事情。</p>
<p>很多人崇尚量身定制，这类人大多是开发狂，或者被商业软件搞得头大的人。因为作为开发者，量身定制能满足个人开发欲，满足个人的成就感，而且，定制软件要比在一些开源上二次开发收费要高。作为这种选择的使用者，一般是没有找到适合自己的商业软件，种种原因，商业软件太贵，业务跟软件不能结合，导致软件屡屡的失败，从而要选择定制开发，而大公司的报价是基本不用考虑的，只能选择一些个人来开发。</p>
<p>对于一些简单的业务，个人开发的作品完全能满足业务的需求，但为什么还有价格高昂的商业开发队伍？</p>
<p>1、个人开发无法进行持续的维护。这里指大多数情况。很多人在一个阶段开发完成后，付款验收后就脱离了合作关系，甚至一些部署和初始化服务都没有，而使用者未必懂这些，造成使用成本的增加。</p>
<p>2、个人开发很少有文档的支持。这对一个需要发展的使用者来说是致命的隐患。业务的扩大，一定需要二次的开发，即使是重新开发，起码也得有个数据库说明文档，方便数据的迁移。再有的隐患，就是数据一旦出现问题，无从查起。</p>
<p>3、个人（也包括小团队）无法保证软件跟业务的紧密结合。一旦业务发展到一定阶段，软件更多的是根据业务的改变，个人很难在一个简单的应用上考虑大规模的业务压力，因此，软件是无法跟商业软件相比拟的。</p>
<p>以上是个人作品跟商业软件的区别。</p>
<p>其实个人作为也并非无益处。</p>
<p>1、个人用户能满足微小的业务需求，在一些应用极小的场合，个人开发的性价比是远远高于商业开发的。</p>
<p>2、个人开发能减少探索性发展前期的成本。</p>
<p>3、个人开发比较灵活，能满足一定规模内的定制。</p>
<p>……还有很多优势，暂不一一列举。</p>
<p>在项目中，选择哪种方式，还要根据情况进行深入的讨论，评估。不过要有这么强的评估团队，估计也有能力建立自己的开发队伍。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/10/%e5%86%8d%e8%ae%ae%e4%b8%aa%e4%ba%ba%e4%bd%9c%e5%93%81%e8%b7%9f%e5%95%86%e4%b8%9a%e8%bd%af%e4%bb%b6%e4%ba%a7%e5%93%81%e7%9a%84%e4%bb%b7%e5%80%bc%e5%8c%ba%e5%88%ab.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Lucene创建Document代码部分-循序渐进学Lucene</title>
		<link>http://www.sunboyu.cn/2008/10/08/lucene%e5%88%9b%e5%bb%badocument%e4%bb%a3%e7%a0%81%e9%83%a8%e5%88%86-%e5%be%aa%e5%ba%8f%e6%b8%90%e8%bf%9b%e5%ad%a6lucene.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/08/lucene%e5%88%9b%e5%bb%badocument%e4%bb%a3%e7%a0%81%e9%83%a8%e5%88%86-%e5%be%aa%e5%ba%8f%e6%b8%90%e8%bf%9b%e5%ad%a6lucene.shtml#comments</comments>
		<pubDate>Wed, 08 Oct 2008 10:47:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[document]]></category>

		<category><![CDATA[lucene]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=337</guid>
		<description><![CDATA[import java.io.*;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.analysis.SimpleAnalyzer;
public class Index
{
	public static void main( String args[] )
	{
		Document doc = new Document();
		//注释1
		Field f1 = new Field(&#34;name1&#34;,&#34;value1&#34;,Field.Store.YES,Field.Index.TOKENIZED);
		Field f2 = new Field(&#34;name2&#34;,&#34;value2&#34;,Field.Store.YES,Field.Index.TOKENIZED);
		doc.add( f1 );
		doc.add( f2 );
		try
		{
			IndexWriter writer = new IndexWriter( &#34;./&#34; , new SimpleAnalyzer() , true );
			writer.addDocument( doc );
			writer.close();
		}
		catch (Exception e)
		{
&#160;&#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; [...]]]></description>
			<content:encoded><![CDATA[<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">import java.io.*;</li>
<li>import org.apache.lucene.document.Document;</li>
<li>import org.apache.lucene.document.Field;</li>
<li>import org.apache.lucene.index.IndexWriter;</li>
<li>import org.apache.lucene.analysis.SimpleAnalyzer;</li>
<li>public class Index</li>
<li>{</li>
<li>	public static void main( String args[] )</li>
<li>	{</li>
<li>		Document doc = new Document();</li>
<li>		//注释1</li>
<li>		Field f1 = new Field(&quot;name1&quot;,&quot;value1&quot;,Field.Store.YES,Field.Index.TOKENIZED);</li>
<li>		Field f2 = new Field(&quot;name2&quot;,&quot;value2&quot;,Field.Store.YES,Field.Index.TOKENIZED);</li>
<li>		doc.add( f1 );</li>
<li>		doc.add( f2 );</li>
<li>		try</li>
<li>		{</li>
<li>			IndexWriter writer = new IndexWriter( &quot;./&quot; , new SimpleAnalyzer() , true );</li>
<li>			writer.addDocument( doc );</li>
<li>			writer.close();</li>
<li>		}</li>
<li>		catch (Exception e)</li>
<li>		{</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.printStackTrace(); </li>
<li>		}</li>
<li>	}</li>
<li>}</li></ol></div>
<p>注释1：Field方法的在2.0.0版本中有5种方法，在2.3.2中增加到了7种，详细用法请参阅官方文档<br />
http://lucene.apache.org/java/2_0_0/api/org/apache/lucene/document/Field.html<br />
http://lucene.apache.org/java/2_3_2/api/org/apache/lucene/document/Field.html</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/08/lucene%e5%88%9b%e5%bb%badocument%e4%bb%a3%e7%a0%81%e9%83%a8%e5%88%86-%e5%be%aa%e5%ba%8f%e6%b8%90%e8%bf%9b%e5%ad%a6lucene.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>JS:setAttribute() getAttribute() 使用总结</title>
		<link>http://www.sunboyu.cn/2008/10/07/jssetattribute-getattribute-%e4%bd%bf%e7%94%a8%e6%80%bb%e7%bb%93.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/07/jssetattribute-getattribute-%e4%bd%bf%e7%94%a8%e6%80%bb%e7%bb%93.shtml#comments</comments>
		<pubDate>Tue, 07 Oct 2008 15:53:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[dom属性]]></category>

		<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=336</guid>
		<description><![CDATA[setAttribute() getAttribute() 两个函数分别是设置DOM节点属性设置和修改的函数，比如
var a=document.getElementById(&#8217;link&#8217;);
a.setAttribute(&#8217;class&#8217;) = &#8216;mylinkstyle&#8217;;
可以设置一个元素的属性
同样，我们可以自定义元素的属性，比如 &#60;a href=&#8221;#&#8221; tips=&#8221;tipscontet&#8221; title=&#8221;testtitle&#8221;&#62;test&#60;/a&#62;
如此，给a标签增加一个新的属性，tips。而tips的值可以用getAttribute()获取。
]]></description>
			<content:encoded><![CDATA[<p>setAttribute() getAttribute() 两个函数分别是设置DOM节点属性设置和修改的函数，比如</p>
<p>var a=document.getElementById(&#8217;link&#8217;);</p>
<p>a.setAttribute(&#8217;class&#8217;) = &#8216;mylinkstyle&#8217;;</p>
<p>可以设置一个元素的属性</p>
<p>同样，我们可以自定义元素的属性，比如 &lt;a href=&#8221;#&#8221; tips=&#8221;tipscontet&#8221; title=&#8221;testtitle&#8221;&gt;test&lt;/a&gt;</p>
<p>如此，给a标签增加一个新的属性，tips。而tips的值可以用getAttribute()获取。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/07/jssetattribute-getattribute-%e4%bd%bf%e7%94%a8%e6%80%bb%e7%bb%93.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Lucene文档模型(Document)简解</title>
		<link>http://www.sunboyu.cn/2008/10/04/lucene%e6%96%87%e6%a1%a3%e6%a8%a1%e5%9e%8bdocument%e7%ae%80%e8%a7%a3.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/04/lucene%e6%96%87%e6%a1%a3%e6%a8%a1%e5%9e%8bdocument%e7%ae%80%e8%a7%a3.shtml#comments</comments>
		<pubDate>Sat, 04 Oct 2008 03:39:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[lucene]]></category>

		<category><![CDATA[简介]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=334</guid>
		<description><![CDATA[最近仔细研究了Lucene的文档模式，现用通俗语言来解释。
Lucene的索引，基本结构为 Index-&#62;Document-&#62;Field 这样可以构建一个非关系型二维结构，由不同field构成的一个Document，由不同的Document构成的Index。
Lucene的Field方法很丰富，在2.0版本以后，由三种Field类型增加到了5种，支持三种数据流的传入方式（字符串，读取，二进制传入），支持数据的存储，索引，分词。
而我们使用Lucene的主要功能在于分词和生成索引。具体应用待详细使用后介绍。
]]></description>
			<content:encoded><![CDATA[<p>最近仔细研究了Lucene的文档模式，现用通俗语言来解释。</p>
<p>Lucene的索引，基本结构为 Index-&gt;Document-&gt;Field 这样可以构建一个非关系型二维结构，由不同field构成的一个Document，由不同的Document构成的Index。</p>
<p>Lucene的Field方法很丰富，在2.0版本以后，由三种Field类型增加到了5种，支持三种数据流的传入方式（字符串，读取，二进制传入），支持数据的存储，索引，分词。</p>
<p>而我们使用Lucene的主要功能在于分词和生成索引。具体应用待详细使用后介绍。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/04/lucene%e6%96%87%e6%a1%a3%e6%a8%a1%e5%9e%8bdocument%e7%ae%80%e8%a7%a3.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>我的一个Java程序</title>
		<link>http://www.sunboyu.cn/2008/10/03/%e6%88%91%e7%9a%84%e4%b8%80%e4%b8%aajava%e7%a8%8b%e5%ba%8f.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/03/%e6%88%91%e7%9a%84%e4%b8%80%e4%b8%aajava%e7%a8%8b%e5%ba%8f.shtml#comments</comments>
		<pubDate>Fri, 03 Oct 2008 09:42:56 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[mysql连接]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=333</guid>
		<description><![CDATA[PHP总有其局限性，比如解释型语言在速度上的弱点，制约了它在效率方面的发挥。facebook开放了源代码，其底层大都是c来编写，而我现在计划用Java为一些服务写后台，这是我的第一个Java程序，希望大家多批评，虽然上边依然有太多php的影子。
import java.sql.*;
/*
&#160;*&#160; Java Mysql数据库连接类
&#160;*&#160; 我的第一个java程序
&#160;*/
public class MysqlConn
{
	private String dsn = &#34;jdbc:mysql://localhost:3306/test&#34;;
	private String username = &#34;root&#34;;
	private String password = &#34;123456&#34;;
&#160;
	private Connection conn = null;
	private Statement stmt = null;
	private ResultSet rs = null;
&#160;
&#160;
&#160;
&#160;
&#160;&#160; &#160;public void MysqlConn()
	{
	}
&#160;&#160; &#160;//初始化连接参数
	public void SetDsn( String Dsn )
	{
		this.dsn = Dsn;
	}
	//初始化用户名密码
	public void SetUserPass( String Username , String Password )
	{
		this.username = Username;
		this.password = Password;
	}
	//连接函数
	public void [...]]]></description>
			<content:encoded><![CDATA[<p>PHP总有其局限性，比如解释型语言在速度上的弱点，制约了它在效率方面的发挥。facebook开放了源代码，其底层大都是c来编写，而我现在计划用Java为一些服务写后台，这是我的第一个Java程序，希望大家多批评，虽然上边依然有太多php的影子。</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">import java.sql.*;</li>
<li>/*</li>
<li>&nbsp;*&nbsp; Java Mysql数据库连接类</li>
<li>&nbsp;*&nbsp; 我的第一个java程序</li>
<li>&nbsp;*/</li>
<li>public class MysqlConn</li>
<li>{</li>
<li>	private String dsn = &quot;jdbc:mysql://localhost:3306/test&quot;;</li>
<li>	private String username = &quot;root&quot;;</li>
<li>	private String password = &quot;123456&quot;;</li>
<li>&nbsp;</li>
<li>	private Connection conn = null;</li>
<li>	private Statement stmt = null;</li>
<li>	private ResultSet rs = null;</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;public void MysqlConn()</li>
<li>	{</li>
<li>	}</li>
<li>&nbsp;&nbsp; &nbsp;//初始化连接参数</li>
<li>	public void SetDsn( String Dsn )</li>
<li>	{</li>
<li>		this.dsn = Dsn;</li>
<li>	}</li>
<li>	//初始化用户名密码</li>
<li>	public void SetUserPass( String Username , String Password )</li>
<li>	{</li>
<li>		this.username = Username;</li>
<li>		this.password = Password;</li>
<li>	}</li>
<li>	//连接函数</li>
<li>	public void Conn()</li>
<li>	{</li>
<li>		try</li>
<li>		{</li>
<li>			//加载Connetc/J驱动</li>
<li>			//Class.forName(&quot;com.mysql.jdbc.Driver&quot;);</li>
<li>			Class.forName(&quot;org.gjt.mm.mysql.Driver&quot;);</li>
<li>			//开始连接</li>
<li>			this.conn = DriverManager.getConnection( this.dsn , this.username , this.password );</li>
<li>			this.stmt = this.conn.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE , ResultSet.CONCUR_UPDATABLE );</li>
<li>		}</li>
<li>		catch(SQLException ex)</li>
<li>		{</li>
<li>			System.out.println(&quot;Error : &quot; + ex.toString());</li>
<li>			System.out.println(&quot;没有找到JDBC/ODBC驱动程序！&quot;);</li>
<li>			System.exit(0);</li>
<li>		}</li>
<li>		catch(Exception e)</li>
<li>		{</li>
<li>			System.out.println(&quot;Errors: &quot; + e.toString());</li>
<li>			System.exit(0);</li>
<li>		}</li>
<li>		</li>
<li>	}</li>
<li>&nbsp;&nbsp; &nbsp;//返回结果集</li>
<li>	public ResultSet sqlQuery( String sql )</li>
<li>	{</li>
<li>		try</li>
<li>		{</li>
<li>			this.rs = this.stmt.executeQuery( sql );</li>
<li>		}</li>
<li>		catch (SQLException ex)</li>
<li>		{</li>
<li>			System.out.println(&quot;Error : &quot; + ex.toString());</li>
<li>			System.exit(0);</li>
<li>		}</li>
<li>		catch (Exception ex)</li>
<li>		{</li>
<li>			System.out.println(&quot;Error : &quot; + ex.toString());</li>
<li>			System.exit(0);</li>
<li>		}</li>
<li>		return rs;</li>
<li>	}</li>
<li>	//执行 update,insert之类</li>
<li>	public void Exec( String sql )</li>
<li>	{</li>
<li>		try</li>
<li>		{</li>
<li>			this.stmt.executeUpdate( sql )</li>
<li>		}</li>
<li>		catch (SQLException ex)</li>
<li>		{</li>
<li>			System.out.println(&quot;Error : &quot; + ex.toString());</li>
<li>			System.exit(0);</li>
<li>		}</li>
<li>		catch (Exception ex)</li>
<li>		{</li>
<li>			System.out.println(&quot;Error : &quot; + ex.toString());</li>
<li>			System.exit(0);</li>
<li>		}</li>
<li>	}</li>
<li>&nbsp;</li>
<li>}</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/03/%e6%88%91%e7%9a%84%e4%b8%80%e4%b8%aajava%e7%a8%8b%e5%ba%8f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP缓存组件APC简介</title>
		<link>http://www.sunboyu.cn/2008/10/03/php%e7%bc%93%e5%ad%98%e7%bb%84%e4%bb%b6apc%e7%ae%80%e4%bb%8b.shtml</link>
		<comments>http://www.sunboyu.cn/2008/10/03/php%e7%bc%93%e5%ad%98%e7%bb%84%e4%bb%b6apc%e7%ae%80%e4%bb%8b.shtml#comments</comments>
		<pubDate>Fri, 03 Oct 2008 02:55:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[apc]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=332</guid>
		<description><![CDATA[php是解释型语言,比起编译型语言,速度自然会慢.每种语言基本都是 1、源代码-&#62;编译成二进制机器码 2、编译成二进制机器码-&#62;执行 编译型语言（如c，java）在执行一次步骤1后，多次执行步骤2，而asp，php之类的解释型语言每次访问，都重复步骤1，2，故效率低下。
PHP官方提供了一个编译php为二进制码的工具，Zend，价格昂贵，今天讨论免费的APC。
APC组件下载地址：http://pecl4win.php.net/ext.php/php_apc.dll  http://pecl.php.net/package/apc  根据自己的操作系统版本来下载安装。我这里使用的是windows系统，直接把php_apc.dll放在扩展文件路径里，在php.ini里增加extension=php_apc.dll，再查看phpinfo(),可看到apc安装成功的信息。具体配置信息在这里  http://cn2.php.net/manual/en/apc.configuration.php
其中的参数可以设定是否缓存php的编译文件，还有一些常用的限制。
除此之外，还有很多opcode缓存组件，如accelerator,xcache之类，详情可参见这里 http://en.wikipedia.org/wiki/Alternative_PHP_Cache#Alternative_PHP_Cache
]]></description>
			<content:encoded><![CDATA[<p>php是解释型语言,比起编译型语言,速度自然会慢.每种语言基本都是 1、源代码-&gt;编译成二进制机器码 2、编译成二进制机器码-&gt;执行 编译型语言（如c，java）在执行一次步骤1后，多次执行步骤2，而asp，php之类的解释型语言每次访问，都重复步骤1，2，故效率低下。</p>
<p>PHP官方提供了一个编译php为二进制码的工具，Zend，价格昂贵，今天讨论免费的APC。</p>
<p>APC组件下载地址：http://pecl4win.php.net/ext.php/php_apc.dll  http://pecl.php.net/package/apc  根据自己的操作系统版本来下载安装。我这里使用的是windows系统，直接把php_apc.dll放在扩展文件路径里，在php.ini里增加extension=php_apc.dll，再查看phpinfo(),可看到apc安装成功的信息。具体配置信息在这里  http://cn2.php.net/manual/en/apc.configuration.php</p>
<p>其中的参数可以设定是否缓存php的编译文件，还有一些常用的限制。</p>
<p>除此之外，还有很多opcode缓存组件，如accelerator,xcache之类，详情可参见这里 http://en.wikipedia.org/wiki/Alternative_PHP_Cache#Alternative_PHP_Cache</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/10/03/php%e7%bc%93%e5%ad%98%e7%bb%84%e4%bb%b6apc%e7%ae%80%e4%bb%8b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Linux提交命令至后台运行</title>
		<link>http://www.sunboyu.cn/2008/09/27/linux%e6%8f%90%e4%ba%a4%e5%91%bd%e4%bb%a4%e8%87%b3%e5%90%8e%e5%8f%b0%e8%bf%90%e8%a1%8c.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/27/linux%e6%8f%90%e4%ba%a4%e5%91%bd%e4%bb%a4%e8%87%b3%e5%90%8e%e5%8f%b0%e8%bf%90%e8%a1%8c.shtml#comments</comments>
		<pubDate>Sat, 27 Sep 2008 15:01:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[shell]]></category>

		<category><![CDATA[后台执行]]></category>

		<category><![CDATA[后台运行]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=330</guid>
		<description><![CDATA[我经常在putty里工作,有时候如果一个命令执行太长,不得已,我得开两个窗口,如果事情再多,可能开四个五个,不过有的ssh登陆工具可以开多个窗口,但难免会出点乱子.那么我们可以把命令隐藏再后台执行,使用linux下命令  &#8220;&#38;&#8221;  这个倒霉的符号.
比如我们要执行一个命令,(暂时没想到执行时间N长的命令,假设一个shell) test.sh , 现在提交并隐藏在后台
$./test.sh &#62;&#62; test.log &#38;
意思是,执行test.sh 反馈的结构输送至 test.log , &#38;表示这个命令提交至后台执行.
执行后,返回一个进程号,可以用ps来查看.
这样,我们可以连续在同一个终端窗口上运行多个持续的命令.
然后,问题又来.我们运行这些命令至后台后,如果想退出终端窗口,那么后台的命令也随之中断.我们得想办法让进程持续运行.这里得使用此命令 nohup
重新执行上边的操作,那么我们应该这样执行
$nohup ./test.sh &#62;&#62; test.log
然后敲logout,放心,再登陆试试ps,进程依然存在!
]]></description>
			<content:encoded><![CDATA[<p>我经常在putty里工作,有时候如果一个命令执行太长,不得已,我得开两个窗口,如果事情再多,可能开四个五个,不过有的ssh登陆工具可以开多个窗口,但难免会出点乱子.那么我们可以把命令隐藏再后台执行,使用linux下命令  &#8220;&amp;&#8221;  这个倒霉的符号.</p>
<p>比如我们要执行一个命令,(暂时没想到执行时间N长的命令,假设一个shell) test.sh , 现在提交并隐藏在后台</p>
<p>$./test.sh &gt;&gt; test.log &amp;</p>
<p>意思是,执行test.sh 反馈的结构输送至 test.log , &amp;表示这个命令提交至后台执行.</p>
<p>执行后,返回一个进程号,可以用ps来查看.</p>
<p>这样,我们可以连续在同一个终端窗口上运行多个持续的命令.</p>
<p>然后,问题又来.我们运行这些命令至后台后,如果想退出终端窗口,那么后台的命令也随之中断.我们得想办法让进程持续运行.这里得使用此命令 nohup</p>
<p>重新执行上边的操作,那么我们应该这样执行</p>
<p>$nohup ./test.sh &gt;&gt; test.log</p>
<p>然后敲logout,放心,再登陆试试ps,进程依然存在!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/27/linux%e6%8f%90%e4%ba%a4%e5%91%bd%e4%bb%a4%e8%87%b3%e5%90%8e%e5%8f%b0%e8%bf%90%e8%a1%8c.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>逃离海内</title>
		<link>http://www.sunboyu.cn/2008/09/26/%e9%80%83%e7%a6%bb%e6%b5%b7%e5%86%85.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/26/%e9%80%83%e7%a6%bb%e6%b5%b7%e5%86%85.shtml#comments</comments>
		<pubDate>Fri, 26 Sep 2008 14:21:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[海内]]></category>

		<category><![CDATA[退出]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=329</guid>
		<description><![CDATA[突然发现海内今天改版了,我依然玩我的挣车位和好友买卖.看着我那一排轿车,其中还有一台宝马S600,突然有种失落:多日的努力其实只换来一种虚无缥缈的虚荣.虽然同事们都在开心网上玩得不亦乐乎,校内也有大量webgame,我依然坚守在海内.不是因为海内有多优秀,因为曾经我的简历连个简单的邮件回复都没有.最终我想知道这家公司究竟有着怎样的前途.海内终究没有留住我,因为没有什么理由能让我再留恋.汽车就先摆着,我开始上鲜果网,习惯了RSS,这是我上海内唯一的收获了.
我不知道国内sns都有什么样的前景,但我努力留恋的网站始终没有留住我.也许这是国内做服务的网站们始终在研究的一个问题.
]]></description>
			<content:encoded><![CDATA[<p>突然发现海内今天改版了,我依然玩我的挣车位和好友买卖.看着我那一排轿车,其中还有一台宝马S600,突然有种失落:多日的努力其实只换来一种虚无缥缈的虚荣.虽然同事们都在开心网上玩得不亦乐乎,校内也有大量webgame,我依然坚守在海内.不是因为海内有多优秀,因为曾经我的简历连个简单的邮件回复都没有.最终我想知道这家公司究竟有着怎样的前途.海内终究没有留住我,因为没有什么理由能让我再留恋.汽车就先摆着,我开始上鲜果网,习惯了RSS,这是我上海内唯一的收获了.</p>
<p>我不知道国内sns都有什么样的前景,但我努力留恋的网站始终没有留住我.也许这是国内做服务的网站们始终在研究的一个问题.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/26/%e9%80%83%e7%a6%bb%e6%b5%b7%e5%86%85.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>由三鹿的三聚氢胺事件想到的</title>
		<link>http://www.sunboyu.cn/2008/09/25/%e7%94%b1%e4%b8%89%e9%b9%bf%e7%9a%84%e4%b8%89%e8%81%9a%e6%b0%a2%e8%83%ba%e4%ba%8b%e4%bb%b6%e6%83%b3%e5%88%b0%e7%9a%84.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/25/%e7%94%b1%e4%b8%89%e9%b9%bf%e7%9a%84%e4%b8%89%e8%81%9a%e6%b0%a2%e8%83%ba%e4%ba%8b%e4%bb%b6%e6%83%b3%e5%88%b0%e7%9a%84.shtml#comments</comments>
		<pubDate>Thu, 25 Sep 2008 13:02:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[IT环境]]></category>

		<category><![CDATA[市场培养]]></category>

		<category><![CDATA[捷安特]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=328</guid>
		<description><![CDATA[三鹿元气大伤,短期内难以恢复,结论不好下,我感觉这个牌子是保不住了,结果只有申请破产,或直接被其他品牌收购,给其做代工.最难堪的不是三鹿,而是中国的整个乳品业,犹如多米诺骨牌一样,一个接一个得被拉下水.中国乳品业的动荡不亚于金融危机的来势.
每天我骑车,都经过学院路上北航对门的一个捷安特自行车店,跟其他行业一样,所有的捷安特自行车,不管是哪里卖出去的,只要是此品牌,皆可免费服务,而且小伙子对所有顾客一视同仁,而最让我钦佩的是,其他品牌的自行车到这里,也享受着跟本品牌一样的服务.后我又发现,阿米尼,美利达的服务也是如此.
他们的品牌能持续的发展,在于他们都在培养一个共同的市场,这些品牌在发展市场,并不是靠排挤或降价,而是靠优质的服务来培养了他们的客户,而客户的口碑效应又为他们带来更大的市场.有了一个良好的市场,他们才能得以生存.
而今,我们的互联网环境依然如此,同样的服务,每家都想制定标准,抢占市场.而大量的资金在抢夺资源的时候,是不是考虑,如果共同来培养中国的互联网用户,效果是不是会更好.
值得深思.
]]></description>
			<content:encoded><![CDATA[<p>三鹿元气大伤,短期内难以恢复,结论不好下,我感觉这个牌子是保不住了,结果只有申请破产,或直接被其他品牌收购,给其做代工.最难堪的不是三鹿,而是中国的整个乳品业,犹如多米诺骨牌一样,一个接一个得被拉下水.中国乳品业的动荡不亚于金融危机的来势.</p>
<p>每天我骑车,都经过学院路上北航对门的一个捷安特自行车店,跟其他行业一样,所有的捷安特自行车,不管是哪里卖出去的,只要是此品牌,皆可免费服务,而且小伙子对所有顾客一视同仁,而最让我钦佩的是,其他品牌的自行车到这里,也享受着跟本品牌一样的服务.后我又发现,阿米尼,美利达的服务也是如此.</p>
<p>他们的品牌能持续的发展,在于他们都在培养一个共同的市场,这些品牌在发展市场,并不是靠排挤或降价,而是靠优质的服务来培养了他们的客户,而客户的口碑效应又为他们带来更大的市场.有了一个良好的市场,他们才能得以生存.</p>
<p>而今,我们的互联网环境依然如此,同样的服务,每家都想制定标准,抢占市场.而大量的资金在抢夺资源的时候,是不是考虑,如果共同来培养中国的互联网用户,效果是不是会更好.</p>
<p>值得深思.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/25/%e7%94%b1%e4%b8%89%e9%b9%bf%e7%9a%84%e4%b8%89%e8%81%9a%e6%b0%a2%e8%83%ba%e4%ba%8b%e4%bb%b6%e6%83%b3%e5%88%b0%e7%9a%84.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>网站站内搜索解决方案集锦</title>
		<link>http://www.sunboyu.cn/2008/09/24/%e7%bd%91%e7%ab%99%e7%ab%99%e5%86%85%e6%90%9c%e7%b4%a2%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%e9%9b%86%e9%94%a6.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/24/%e7%bd%91%e7%ab%99%e7%ab%99%e5%86%85%e6%90%9c%e7%b4%a2%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%e9%9b%86%e9%94%a6.shtml#comments</comments>
		<pubDate>Wed, 24 Sep 2008 01:40:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[分词]]></category>

		<category><![CDATA[搜索]]></category>

		<category><![CDATA[方案]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=327</guid>
		<description><![CDATA[1、小型网站：小的不能再小的，就是数据量很小的，使用select足矣。小网站流量不大，用户不多，数据库搜索是最简洁方便的模式。
2、中型网站：中型网站数据量不小，数据库规模在百万～千万级别，select显然不能应付，如果用数据库搜索，模糊检索是万万不能使用的，效率会很差。标签检索是个不错的方式，但这种方式需要编辑手工得添加标签，工作量巨大，非常浪费人工。使用一个小型的数据库爬虫进行分词检索是正道。推荐分词工具：lucene，ICTCLAS
3、大型网站：把大于千万数据级别的网站统归大型网站。这种网站必须提供非常好的分词与模糊查找机制，在速度，检索的准确度和相关度上都要有可使用性。在处理数据库信息上，使用数据库爬虫依然是不错的办法，而对于大量的文件，文件爬虫也相当重要。在这个级别的网站，推荐使用比较专业的商业软件，比如海量分词，或者一些专业的搜索解决方案。
]]></description>
			<content:encoded><![CDATA[<p>1、小型网站：小的不能再小的，就是数据量很小的，使用select足矣。小网站流量不大，用户不多，数据库搜索是最简洁方便的模式。</p>
<p>2、中型网站：中型网站数据量不小，数据库规模在百万～千万级别，select显然不能应付，如果用数据库搜索，模糊检索是万万不能使用的，效率会很差。标签检索是个不错的方式，但这种方式需要编辑手工得添加标签，工作量巨大，非常浪费人工。使用一个小型的数据库爬虫进行分词检索是正道。推荐分词工具：lucene，ICTCLAS</p>
<p>3、大型网站：把大于千万数据级别的网站统归大型网站。这种网站必须提供非常好的分词与模糊查找机制，在速度，检索的准确度和相关度上都要有可使用性。在处理数据库信息上，使用数据库爬虫依然是不错的办法，而对于大量的文件，文件爬虫也相当重要。在这个级别的网站，推荐使用比较专业的商业软件，比如海量分词，或者一些专业的搜索解决方案。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/24/%e7%bd%91%e7%ab%99%e7%ab%99%e5%86%85%e6%90%9c%e7%b4%a2%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%e9%9b%86%e9%94%a6.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Nutch配置指南</title>
		<link>http://www.sunboyu.cn/2008/09/22/nutch%e9%85%8d%e7%bd%ae%e6%8c%87%e5%8d%97.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/22/nutch%e9%85%8d%e7%bd%ae%e6%8c%87%e5%8d%97.shtml#comments</comments>
		<pubDate>Mon, 22 Sep 2008 09:56:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=325</guid>
		<description><![CDATA[//fuck这个破鼠标，写了半天，还没报错，页面就被跳没了！！
重写：
首先，下载相关软件
tomcat   http://archive.apache.org/dist/tomcat/tomcat-4/v4.1.37/bin/apache-tomcat-4.1.37.tar.gz
nutch  http://apache.mirror.phpchina.com/lucene/nutch/nutch-0.7.2.tar.gz
jdk的配置，看这篇文章 http://www.sunboyu.cn/2008/09/20/centos5%E4%B8%8B%E9%85%8D%E7%BD%AEjdk%E7%8E%AF%E5%A2%83.shtml
顺便写了个脚本
# author:sunboyu@gmail.com
# qq:176300676 msn:sunboyu@gmail.com
# http://www.sunboyu.cn
&#160;
#!/bin/sh
export JAVA_HOME=/opt/jdk1.6.0
export CLASSPATH=.:/opt/jdk1.6.0/lib/tools.jar:/opt/jdk1.6.0/lib/dt.jar:/opt/jdk1.6.0
export PATH=$PATH:/opt/jdk1.6.0/bin
export JRE_HOME=/opt/jdk1.6.0
&#160;
export CATALINA_BASE=/opt/tomcat
export CATALINA_HOME=/opt/tomcat
export CATALINA_TMPDIR=/opt/tomcat/temp
把nutch目录下的nutch-0.7.2.war配置为tomcat下的默认站点
修改tomcat下webapps/ROOT/WEB-INF/classes/nutch-site.xml
增加以下配置
&#60;property&#62;
&#160;&#160; &#160; &#160;&#60;name&#62;searcher.dir&#60;/name&#62;
&#160;&#160; &#160; &#160;&#60;value&#62;/local/nutch/crawl&#60;/value&#62;
&#160;&#160; &#60;/property&#62;
启动tomcat!
运行以下nutch命令
bin/nutch crawl urls -dir /test -depth 5 -topN 1000 -threads 5
则可以在/test目录中创建抓取的索引。
然后在tomcat服务中测试下搜索效果！
]]></description>
			<content:encoded><![CDATA[<p>//fuck这个破鼠标，写了半天，还没报错，页面就被跳没了！！<br />
重写：<br />
首先，下载相关软件<br />
tomcat   http://archive.apache.org/dist/tomcat/tomcat-4/v4.1.37/bin/apache-tomcat-4.1.37.tar.gz<br />
nutch  http://apache.mirror.phpchina.com/lucene/nutch/nutch-0.7.2.tar.gz<br />
jdk的配置，看这篇文章 http://www.sunboyu.cn/2008/09/20/centos5%E4%B8%8B%E9%85%8D%E7%BD%AEjdk%E7%8E%AF%E5%A2%83.shtml<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"># author:sunboyu@gmail.com</li>
<li># qq:176300676 msn:sunboyu@gmail.com</li>
<li># http://www.sunboyu.cn</li>
<li>&nbsp;</li>
<li>#!/bin/sh</li>
<li>export JAVA_HOME=/opt/jdk1.6.0</li>
<li>export CLASSPATH=.:/opt/jdk1.6.0/lib/tools.jar:/opt/jdk1.6.0/lib/dt.jar:/opt/jdk1.6.0</li>
<li>export PATH=$PATH:/opt/jdk1.6.0/bin</li>
<li>export JRE_HOME=/opt/jdk1.6.0</li>
<li>&nbsp;</li>
<li>export CATALINA_BASE=/opt/tomcat</li>
<li>export CATALINA_HOME=/opt/tomcat</li>
<li>export CATALINA_TMPDIR=/opt/tomcat/temp</li></ol></div>
<p>把nutch目录下的nutch-0.7.2.war配置为tomcat下的默认站点<br />
修改tomcat下webapps/ROOT/WEB-INF/classes/nutch-site.xml<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">&lt;property&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;&lt;name&gt;searcher.dir&lt;/name&gt;</li>
<li>&nbsp;&nbsp; &nbsp; &nbsp;&lt;value&gt;/local/nutch/crawl&lt;/value&gt;</li>
<li>&nbsp;&nbsp; &lt;/property&gt;</li></ol></div>
<p>启动tomcat!<br />
运行以下nutch命令<br />
bin/nutch crawl urls -dir /test -depth 5 -topN 1000 -threads 5<br />
则可以在/test目录中创建抓取的索引。<br />
然后在tomcat服务中测试下搜索效果！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/22/nutch%e9%85%8d%e7%bd%ae%e6%8c%87%e5%8d%97.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Nutch开源爬虫＋Lucene开源分词工具</title>
		<link>http://www.sunboyu.cn/2008/09/21/nutch%e5%bc%80%e6%ba%90%e7%88%ac%e8%99%ab%ef%bc%8blucene%e5%bc%80%e6%ba%90%e5%88%86%e8%af%8d%e5%b7%a5%e5%85%b7.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/21/nutch%e5%bc%80%e6%ba%90%e7%88%ac%e8%99%ab%ef%bc%8blucene%e5%bc%80%e6%ba%90%e5%88%86%e8%af%8d%e5%b7%a5%e5%85%b7.shtml#comments</comments>
		<pubDate>Sun, 21 Sep 2008 11:25:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[lucene]]></category>

		<category><![CDATA[nutch]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=324</guid>
		<description><![CDATA[Lucene是一个java写的开源分词工具，官方主页 http://lucene.apache.org/ 是apache下边的一个项目。
Lucene主要应用为分词并创建索引，提供高速的搜索服务，能讲海量的数据进行分词整理并生成轻量的数据包进行索引存储。
Lucene不是一个搜索引擎，但Lucene项目下有个子项目,Nutch爬虫。Nutch同样是基于Java的一个开源的爬虫，配合Lucene的分词索引功能，构建一个强大的开源搜索引擎。
官方Lucene已经更新到2.3.2版本http://svn.apache.org/repos/asf/lucene/java/tags/lucene_2_3_2/CHANGES.txt，Nutch已经更新到了0.9版本http://www.apache.org/dist/lucene/nutch/CHANGES-0.9.txt。
在测试中，我使用了Nutch0.7.2 http://apache.mirror.phpchina.com/lucene/nutch/nutch-0.7.2.tar.gz,比较稳定，而且对中文分词的效果也不错，能达到使用的水平，因为没有服务，只在本机做了简单测试，没有对效率进行评估，若哪位达人有闲置服务器，可借老朽一用。
]]></description>
			<content:encoded><![CDATA[<p>Lucene是一个java写的开源分词工具，官方主页 http://lucene.apache.org/ 是apache下边的一个项目。</p>
<p>Lucene主要应用为分词并创建索引，提供高速的搜索服务，能讲海量的数据进行分词整理并生成轻量的数据包进行索引存储。</p>
<p>Lucene不是一个搜索引擎，但Lucene项目下有个子项目,Nutch爬虫。Nutch同样是基于Java的一个开源的爬虫，配合Lucene的分词索引功能，构建一个强大的开源搜索引擎。</p>
<p>官方Lucene已经更新到2.3.2版本http://svn.apache.org/repos/asf/lucene/java/tags/lucene_2_3_2/CHANGES.txt，Nutch已经更新到了0.9版本http://www.apache.org/dist/lucene/nutch/CHANGES-0.9.txt。</p>
<p>在测试中，我使用了Nutch0.7.2 http://apache.mirror.phpchina.com/lucene/nutch/nutch-0.7.2.tar.gz,比较稳定，而且对中文分词的效果也不错，能达到使用的水平，因为没有服务，只在本机做了简单测试，没有对效率进行评估，若哪位达人有闲置服务器，可借老朽一用。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/21/nutch%e5%bc%80%e6%ba%90%e7%88%ac%e8%99%ab%ef%bc%8blucene%e5%bc%80%e6%ba%90%e5%88%86%e8%af%8d%e5%b7%a5%e5%85%b7.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>CentOS5下配置JDK环境</title>
		<link>http://www.sunboyu.cn/2008/09/20/centos5%e4%b8%8b%e9%85%8d%e7%bd%aejdk%e7%8e%af%e5%a2%83.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/20/centos5%e4%b8%8b%e9%85%8d%e7%bd%aejdk%e7%8e%af%e5%a2%83.shtml#comments</comments>
		<pubDate>Sat, 20 Sep 2008 07:25:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[jdk]]></category>

		<category><![CDATA[环境]]></category>

		<category><![CDATA[配置]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=323</guid>
		<description><![CDATA[下载jdk安装包 http://www.java.net/download/jdk6/6u10/promoted/b32/binaries/jdk-6u10-rc2-bin-b32-linux-i586-12_sep_2008.bin
编辑/etc/profile
export JAVA_HOME=/opt/jdk1.6.0
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
export JRE_HOME=$JAVA_HOME/jre
保存加载配置 ： source /etc/profile
然后终端用echo $PATH 监测是否成功。
最后监测 java -version
如果回显出现
java version &#8220;1.6.0_10-rc2&#8243;
Java(TM) SE Runtime Environment (build 1.6.0_10-rc2-b32)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)
则证明安装成功
]]></description>
			<content:encoded><![CDATA[<p>下载jdk安装包 http://www.java.net/download/jdk6/6u10/promoted/b32/binaries/jdk-6u10-rc2-bin-b32-linux-i586-12_sep_2008.bin</p>
<p>编辑/etc/profile</p>
<p>export JAVA_HOME=/opt/jdk1.6.0<br />
export CLASSPATH=.:$CLASSPATH:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar<br />
export PATH=$PATH:$JAVA_HOME/bin<br />
export JRE_HOME=$JAVA_HOME/jre</p>
<p>保存加载配置 ： source /etc/profile</p>
<p>然后终端用echo $PATH 监测是否成功。</p>
<p>最后监测 java -version</p>
<p>如果回显出现</p>
<p>java version &#8220;1.6.0_10-rc2&#8243;<br />
Java(TM) SE Runtime Environment (build 1.6.0_10-rc2-b32)<br />
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)<br />
则证明安装成功</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/20/centos5%e4%b8%8b%e9%85%8d%e7%bd%aejdk%e7%8e%af%e5%a2%83.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>LAMP进阶计划</title>
		<link>http://www.sunboyu.cn/2008/09/16/lamp%e8%bf%9b%e9%98%b6%e8%ae%a1%e5%88%92.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/16/lamp%e8%bf%9b%e9%98%b6%e8%ae%a1%e5%88%92.shtml#comments</comments>
		<pubDate>Tue, 16 Sep 2008 15:35:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[LAMP]]></category>

		<category><![CDATA[进阶]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=316</guid>
		<description><![CDATA[lamp进阶计划
1、Linux,Apache,Mysql,PHP最新集成安装脚本，新增优化项
eAccelerator缓冲集成
PHP的SESSION由文件切入内存
DSO模式编译php至Apache
2、PHP代码优化
OOP核心类库完善
通用功能模块的开发
]]></description>
			<content:encoded><![CDATA[<p>lamp进阶计划</p>
<p>1、Linux,Apache,Mysql,PHP最新集成安装脚本，新增优化项</p>
<p>eAccelerator缓冲集成</p>
<p>PHP的SESSION由文件切入内存</p>
<p>DSO模式编译php至Apache</p>
<p>2、PHP代码优化</p>
<p>OOP核心类库完善</p>
<p>通用功能模块的开发</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/16/lamp%e8%bf%9b%e9%98%b6%e8%ae%a1%e5%88%92.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>发现一本好书《构建可扩展得Web站点》</title>
		<link>http://www.sunboyu.cn/2008/09/11/%e5%8f%91%e7%8e%b0%e4%b8%80%e6%9c%ac%e5%a5%bd%e4%b9%a6%e3%80%8a%e6%9e%84%e5%bb%ba%e5%8f%af%e6%89%a9%e5%b1%95%e5%be%97web%e7%ab%99%e7%82%b9%e3%80%8b.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/11/%e5%8f%91%e7%8e%b0%e4%b8%80%e6%9c%ac%e5%a5%bd%e4%b9%a6%e3%80%8a%e6%9e%84%e5%bb%ba%e5%8f%af%e6%89%a9%e5%b1%95%e5%be%97web%e7%ab%99%e7%82%b9%e3%80%8b.shtml#comments</comments>
		<pubDate>Thu, 11 Sep 2008 12:22:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[WEB]]></category>

		<category><![CDATA[书评]]></category>

		<category><![CDATA[扩展]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=310</guid>
		<description><![CDATA[今天在网上搜到一本好书，发现一本好书《构建可扩展得Web站点》，下班急赶中关村书店购得。
本书为 flickr.com得架构师所作，从目录和书的页数来看，这不是关于技术的描述和教授类书籍，而是关于一些技术实现的笔记跟心得。大略一番，好多知识值得程序员去思考。
底下会仔细阅读，榨取其净化。
]]></description>
			<content:encoded><![CDATA[<p>今天在网上搜到一本好书，发现一本好书《构建可扩展得Web站点》，下班急赶中关村书店购得。</p>
<p>本书为 flickr.com得架构师所作，从目录和书的页数来看，这不是关于技术的描述和教授类书籍，而是关于一些技术实现的笔记跟心得。大略一番，好多知识值得程序员去思考。</p>
<p>底下会仔细阅读，榨取其净化。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/11/%e5%8f%91%e7%8e%b0%e4%b8%80%e6%9c%ac%e5%a5%bd%e4%b9%a6%e3%80%8a%e6%9e%84%e5%bb%ba%e5%8f%af%e6%89%a9%e5%b1%95%e5%be%97web%e7%ab%99%e7%82%b9%e3%80%8b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Mysql数据库抽象层操作类</title>
		<link>http://www.sunboyu.cn/2008/09/08/mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e6%8a%bd%e8%b1%a1%e5%b1%82%e6%93%8d%e4%bd%9c%e7%b1%bb.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/08/mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e6%8a%bd%e8%b1%a1%e5%b1%82%e6%93%8d%e4%bd%9c%e7%b1%bb.shtml#comments</comments>
		<pubDate>Mon, 08 Sep 2008 06:26:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[抽象层]]></category>

		<category><![CDATA[类]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=308</guid>
		<description><![CDATA[DB.InterFace.php
&#60;?php
/*&#160; DB.InterFace.php
&#160;*&#160; DB
&#160;*&#160; @link&#160; &#160; &#160; &#160; http://www.sunboyu.cn
&#160;*&#160; @package&#160; &#160; &#160;OA
&#160;*&#160; @version&#160; &#160; &#160;V1.0
&#160;*
&#160;*&#160; 2008 08 28&#160; sunboyu@gmail.com
&#160;*&#160; Demo
&#160;*/
interface DateBaseConnect
{
&#160;&#160; &#160;#数据库连接
&#160;&#160; &#160;public function Connect( $host , $user , $pass , $datebase );
	#使用数据库
	public function selectDateBase( $datebase );
	#执行一个查询
	public function Query( $sql );
	#取得一行
	public function fetchRow( $sql );
	#取得所有
	public function fetchAll( $sql );
	#取得影响行数
	public function affectedRow();
	#取得结果行数
	public function recordCount();
	#取得上次插入ID
	public function insertID();
	#释放资源
	public function [...]]]></description>
			<content:encoded><![CDATA[<p>DB.InterFace.php</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">&lt;?php</li>
<li>/*&nbsp; DB.InterFace.php</li>
<li>&nbsp;*&nbsp; DB</li>
<li>&nbsp;*&nbsp; @link&nbsp; &nbsp; &nbsp; &nbsp; http://www.sunboyu.cn</li>
<li>&nbsp;*&nbsp; @package&nbsp; &nbsp; &nbsp;OA</li>
<li>&nbsp;*&nbsp; @version&nbsp; &nbsp; &nbsp;V1.0</li>
<li>&nbsp;*</li>
<li>&nbsp;*&nbsp; 2008 08 28&nbsp; sunboyu@gmail.com</li>
<li>&nbsp;*&nbsp; Demo</li>
<li>&nbsp;*/</li>
<li>interface DateBaseConnect</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;#数据库连接</li>
<li>&nbsp;&nbsp; &nbsp;public function Connect( $host , $user , $pass , $datebase );</li>
<li>	#使用数据库</li>
<li>	public function selectDateBase( $datebase );</li>
<li>	#执行一个查询</li>
<li>	public function Query( $sql );</li>
<li>	#取得一行</li>
<li>	public function fetchRow( $sql );</li>
<li>	#取得所有</li>
<li>	public function fetchAll( $sql );</li>
<li>	#取得影响行数</li>
<li>	public function affectedRow();</li>
<li>	#取得结果行数</li>
<li>	public function recordCount();</li>
<li>	#取得上次插入ID</li>
<li>	public function insertID();</li>
<li>	#释放资源</li>
<li>	public function close();</li>
<li>}</li>
<li>?&gt;</li></ol></div>
<p><span id="more-308"></span><br />
DB.Mysql.Class.php</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">&lt;?php</li>
<li>/*&nbsp; DB.Mysql.Class.php</li>
<li>&nbsp;*&nbsp; Mysql</li>
<li>&nbsp;*&nbsp; @link&nbsp; &nbsp; &nbsp; &nbsp; http://www.sunboyu.cn</li>
<li>&nbsp;*&nbsp; @package&nbsp; &nbsp; &nbsp;OA</li>
<li>&nbsp;*&nbsp; @version&nbsp; &nbsp; &nbsp;V1.0</li>
<li>&nbsp;*</li>
<li>&nbsp;*&nbsp; 2008 08 28&nbsp; sunboyu@gmail.com</li>
<li>&nbsp;*&nbsp; Demo</li>
<li>&nbsp;*/</li>
<li>require_once(ROOT.&quot;/Include/Class/DB.InterFace.php&quot;);</li>
<li>class Mysql implements DateBaseConnect</li>
<li>{</li>
<li>	#连接标识</li>
<li>	public $handle = false;</li>
<li>	#结果标识</li>
<li>	public $query;</li>
<li>	#查询次数</li>
<li>	public $exetime;</li>
<li>	#数据库连接</li>
<li>&nbsp;&nbsp; &nbsp;public function Connect( $host , $user , $pass , $datebase )</li>
<li>	{</li>
<li>		$this-&gt;handle = @mysql_connect( $host , $user , $pass , false ) or die(&quot;Can't connetc to the DateBse.&quot;.mysql_error());</li>
<li>		$this-&gt;selectDateBase( $datebase );</li>
<li>		$this-&gt;exetime = 0;</li>
<li>	}</li>
<li>	#使用数据库</li>
<li>	public function selectDateBase( $datebase )</li>
<li>	{</li>
<li>		@mysql_select_db( $datebase , $this-&gt;handle ) or die(&quot;Can't select the DateBase&quot;.mysql_error());</li>
<li>	}</li>
<li>	#执行一个查询</li>
<li>	public function Query( $sql )</li>
<li>	{</li>
<li>		$this-&gt;query = mysql_query( $sql , $this-&gt;handle ) or die(&quot;query error&quot;.mysql_error());</li>
<li>		$this-&gt;exetime++;</li>
<li>		return true;</li>
<li>	}</li>
<li>	#取得一行</li>
<li>	public function fetchRow( $sql )</li>
<li>	{</li>
<li>		$this-&gt;Query( $sql );</li>
<li>		while( $row = mysql_fetch_array( $this-&gt;query, MYSQL_ASSOC ) )</li>
<li>		{</li>
<li>			return $row;</li>
<li>	&nbsp; &nbsp; }</li>
<li>		return false;</li>
<li>	}</li>
<li>	#取得所有</li>
<li>	public function fetchAll( $sql )</li>
<li>	{</li>
<li>		$this-&gt;Query( $sql );</li>
<li>		$rows = false;</li>
<li>		while( $rs = mysql_fetch_array( $this-&gt;query, MYSQL_ASSOC ) )</li>
<li>		{</li>
<li>			$rows[] = $rs;</li>
<li>		}</li>
<li>		return $rows;</li>
<li>	}</li>
<li>	#取得影响行数</li>
<li>	public function affectedRow()</li>
<li>	{</li>
<li>		return mysql_affected_rows( $this-&gt;query );</li>
<li>	}</li>
<li>	#取得结果行数</li>
<li>	public function recordCount()</li>
<li>	{</li>
<li>		return mysql_num_rows( $this-&gt;query );</li>
<li>	}</li>
<li>	#取得上次插入ID</li>
<li>	public function insertID()</li>
<li>	{</li>
<li>		return (mysql_insert_id()&gt;0) ? mysql_insert_id() : false;</li>
<li>	}</li>
<li>	#释放资源</li>
<li>	public function close()</li>
<li>	{</li>
<li>		@mysql_close( $this-&gt;handle );</li>
<li>	}</li>
<li>	#析构函数</li>
<li>	/*</li>
<li>	function __destruct()</li>
<li>	{</li>
<li>		$this-&gt;close();</li>
<li>	}</li>
<li>	*/</li>
<li>}</li>
<li>?&gt;</li></ol></div>
<p>DB.Mysql.Fact.Class.php</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">&lt;?php</li>
<li>/*&nbsp; DB.Mysql.Fact.Class.php</li>
<li>&nbsp;*&nbsp; Mysql</li>
<li>&nbsp;*&nbsp; @link&nbsp; &nbsp; &nbsp; &nbsp; http://www.sunboyu.cn</li>
<li>&nbsp;*&nbsp; @package&nbsp; &nbsp; &nbsp;OA</li>
<li>&nbsp;*&nbsp; @version&nbsp; &nbsp; &nbsp;V1.0</li>
<li>&nbsp;*</li>
<li>&nbsp;*&nbsp; 2008 08 28&nbsp; sunboyu@gmail.com</li>
<li>&nbsp;*&nbsp; Demo</li>
<li>&nbsp;*/</li>
<li>require_once(ROOT.&quot;/Include/Class/DB.Mysql.Class.php&quot;);</li>
<li>class DB extends Mysql</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;#插入操作</li>
<li>	/*</li>
<li>	$array = array(</li>
<li>	&nbsp; &nbsp; 'name' = &quot;sunboyu&quot;,</li>
<li>		'pass' = &quot;123456&quot;</li>
<li>	);</li>
<li>	*/</li>
<li>	function __insert( $array , $table )</li>
<li>	{</li>
<li>	&nbsp; &nbsp; $sql = &quot;INSERT INTO {$table} (&quot;;</li>
<li>	&nbsp; &nbsp; if(!is_array($array))</li>
<li>		{</li>
<li>		&nbsp; &nbsp; die('the array is not a array!');</li>
<li>		}</li>
<li>		$keys = array_keys( $array );</li>
<li>		$sql .= implode( ',' , $keys );</li>
<li>		$sql .= &quot;) VALUES (&quot;;</li>
<li>		foreach( $array as $key=&gt;$value )</li>
<li>		{</li>
<li>		&nbsp; &nbsp; if(is_int( $array[$key] ))</li>
<li>			{</li>
<li>			&nbsp; &nbsp; $sql .= $array[$key];</li>
<li>			}</li>
<li>			else if(is_string( $array[$key] ))</li>
<li>			{</li>
<li>			&nbsp; &nbsp; $sql .= &quot;'{$array[$key]}'&quot;;</li>
<li>			}</li>
<li>			$sql .= &quot;,&quot;;</li>
<li>		}</li>
<li>		$sql = substr_replace( $sql , &quot;&quot; , -1 );</li>
<li>		$sql .= &quot;)&quot;;</li>
<li>		return $this-&gt;Query( $sql );</li>
<li>	}</li>
<li>	</li>
<li>}</li>
<li>?&gt;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/08/mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e6%8a%bd%e8%b1%a1%e5%b1%82%e6%93%8d%e4%bd%9c%e7%b1%bb.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>倒霉的ADODB，折腾死了</title>
		<link>http://www.sunboyu.cn/2008/09/05/%e5%80%92%e9%9c%89%e7%9a%84adodb%ef%bc%8c%e6%8a%98%e8%85%be%e6%ad%bb%e4%ba%86.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/05/%e5%80%92%e9%9c%89%e7%9a%84adodb%ef%bc%8c%e6%8a%98%e8%85%be%e6%ad%bb%e4%ba%86.shtml#comments</comments>
		<pubDate>Fri, 05 Sep 2008 08:56:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[adodb]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=305</guid>
		<description><![CDATA[突然发现ADODB_lite很多方法跟以前不一样了，变了好多，所以，一气之下决定放弃adodb，自己写个数据抽象层的类。
用别人的东西总是有很多的局限，如果去修改，工作量又很大。其实我们使用的也就是那么点功能，这样我们去完成自己的类工作量并不大，而且能根据自己的需求不断改进。
]]></description>
			<content:encoded><![CDATA[<p>突然发现ADODB_lite很多方法跟以前不一样了，变了好多，所以，一气之下决定放弃adodb，自己写个数据抽象层的类。</p>
<p>用别人的东西总是有很多的局限，如果去修改，工作量又很大。其实我们使用的也就是那么点功能，这样我们去完成自己的类工作量并不大，而且能根据自己的需求不断改进。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/05/%e5%80%92%e9%9c%89%e7%9a%84adodb%ef%bc%8c%e6%8a%98%e8%85%be%e6%ad%bb%e4%ba%86.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>OA UI设计之我所见</title>
		<link>http://www.sunboyu.cn/2008/09/03/oa-ui%e8%ae%be%e8%ae%a1%e4%b9%8b%e6%88%91%e6%89%80%e8%a7%81.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/03/oa-ui%e8%ae%be%e8%ae%a1%e4%b9%8b%e6%88%91%e6%89%80%e8%a7%81.shtml#comments</comments>
		<pubDate>Wed, 03 Sep 2008 15:05:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[OA]]></category>

		<category><![CDATA[UI]]></category>

		<category><![CDATA[设计]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=297</guid>
		<description><![CDATA[OA之中UI设计尤为重要,在本系统编写以及朋友体验的过程中,总结出以下观点,即开发前需要进行需求分析的一些要点，我的开发目标是针对一个用户群，即中小企业：
1、用户群的计算机水平。给IT公司用的系统我认为比较好作，但也难伺候。好作的原因是，那帮人在没有说明书的情况下熟练应用。难伺候的就是，每天他们都提很多建议，bug，恨不得自己马上跳槽到OA公司帮他们开发，如果达不到满足，就去找麻烦，让开发者很是头疼。而对于一些“电脑白痴”用户来说，则要注重易用性，简便性，给他们找更多便于理解的图标，增加更加详尽的帮助提示是重头戏，而功能的重要性则排在其后。
2、用户群公司的软硬件情况。当然我的系统不是太浪费资源，而是查看下用户所有的显示器大小，操作系统和浏览器状况。如果软件针对一个特性公司特定人群，而这帮人的软硬件情况基本一致的话，浏览器兼容性基本就可以不考虑了。因为网管不会闲着没事去装各个版本的浏览器。
3、用户群的年龄和工作习惯。这个问题我一直考虑，就是正文使用9pt和10.5pt的问题。目前老外网站基本都是9pt左右的字号，尤其英文，很小，但这并不符合我们的国情。最近sina等门户网站首页也都使用了10.5pt/14px大小的字体，完全是为了照顾读者的眼睛。自己看看那些常年在电脑前的人们，基本都架着“望远镜”看电脑。再则，如果客户群都是一些中老年人，建议字号再加大。至于老外的眼睛，不敢说都好，但人家大号显示器的价格都高，这点是真的。
其他想起来再写。
如果一个系统仅针对一个特性的公司，那么调查好以上的情况，对系统开发的设计，速度都有很大提高。
]]></description>
			<content:encoded><![CDATA[<p>OA之中UI设计尤为重要,在本系统编写以及朋友体验的过程中,总结出以下观点,即开发前需要进行需求分析的一些要点，我的开发目标是针对一个用户群，即中小企业：</p>
<p>1、用户群的计算机水平。给IT公司用的系统我认为比较好作，但也难伺候。好作的原因是，那帮人在没有说明书的情况下熟练应用。难伺候的就是，每天他们都提很多建议，bug，恨不得自己马上跳槽到OA公司帮他们开发，如果达不到满足，就去找麻烦，让开发者很是头疼。而对于一些“电脑白痴”用户来说，则要注重易用性，简便性，给他们找更多便于理解的图标，增加更加详尽的帮助提示是重头戏，而功能的重要性则排在其后。</p>
<p>2、用户群公司的软硬件情况。当然我的系统不是太浪费资源，而是查看下用户所有的显示器大小，操作系统和浏览器状况。如果软件针对一个特性公司特定人群，而这帮人的软硬件情况基本一致的话，浏览器兼容性基本就可以不考虑了。因为网管不会闲着没事去装各个版本的浏览器。</p>
<p>3、用户群的年龄和工作习惯。这个问题我一直考虑，就是正文使用9pt和10.5pt的问题。目前老外网站基本都是9pt左右的字号，尤其英文，很小，但这并不符合我们的国情。最近sina等门户网站首页也都使用了10.5pt/14px大小的字体，完全是为了照顾读者的眼睛。自己看看那些常年在电脑前的人们，基本都架着“望远镜”看电脑。再则，如果客户群都是一些中老年人，建议字号再加大。至于老外的眼睛，不敢说都好，但人家大号显示器的价格都高，这点是真的。</p>
<p>其他想起来再写。</p>
<p>如果一个系统仅针对一个特性的公司，那么调查好以上的情况，对系统开发的设计，速度都有很大提高。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/03/oa-ui%e8%ae%be%e8%ae%a1%e4%b9%8b%e6%88%91%e6%89%80%e8%a7%81.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>google 谷歌浏览器 Chrome 预览</title>
		<link>http://www.sunboyu.cn/2008/09/03/google-%e8%b0%b7%e6%ad%8c%e6%b5%8f%e8%a7%88%e5%99%a8-chrome-%e9%a2%84%e8%a7%88.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/03/google-%e8%b0%b7%e6%ad%8c%e6%b5%8f%e8%a7%88%e5%99%a8-chrome-%e9%a2%84%e8%a7%88.shtml#comments</comments>
		<pubDate>Wed, 03 Sep 2008 01:55:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[Chrome]]></category>

		<category><![CDATA[google]]></category>

		<category><![CDATA[浏览器]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=295</guid>
		<description><![CDATA[
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13
那个标好像腾讯,总得来说，美工还是可以，跟firefox操作差不多。
下载地址 http://www.sunboyu.cn/sourse/ChromeSetup.exe
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2008/09/e69caae591bde5908d.jpg"><img class="aligncenter size-full wp-image-296" title="e69caae591bde5908d" src="http://www.sunboyu.cn/upfiles/2008/09/e69caae591bde5908d.jpg" alt="" width="500" height="372" /></a></p>
<p><span class="Apple-style-span" style="border-collapse: separate; color: #000000; font-family: -webkit-monospace; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px;">Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.27 Safari/525.13</span></p>
<p>那个标好像腾讯,总得来说，美工还是可以，跟firefox操作差不多。</p>
<p>下载地址 http://www.sunboyu.cn/sourse/ChromeSetup.exe</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/03/google-%e8%b0%b7%e6%ad%8c%e6%b5%8f%e8%a7%88%e5%99%a8-chrome-%e9%a2%84%e8%a7%88.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>松散耦合与紧密耦合</title>
		<link>http://www.sunboyu.cn/2008/09/03/%e6%9d%be%e6%95%a3%e8%80%a6%e5%90%88%e4%b8%8e%e7%b4%a7%e5%af%86%e8%80%a6%e5%90%88.shtml</link>
		<comments>http://www.sunboyu.cn/2008/09/03/%e6%9d%be%e6%95%a3%e8%80%a6%e5%90%88%e4%b8%8e%e7%b4%a7%e5%af%86%e8%80%a6%e5%90%88.shtml#comments</comments>
		<pubDate>Wed, 03 Sep 2008 01:04:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[感悟]]></category>

		<category><![CDATA[耦合]]></category>

		<category><![CDATA[软件工程]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=294</guid>
		<description><![CDATA[松散耦合的好处，是对模块更加灵活的控制。随意得增删，修改部分功能，而不至于牵一发而动全身。以前项目我们曾经追求过紧密耦合，结构是每个人都很痛苦。
紧凑的耦合并非无利处，一些资源利润率可以放到最低。从OpenOA开发中，第30个版本和70个版本左右的区别，能看出数据库模块的耦合。
]]></description>
			<content:encoded><![CDATA[<p>松散耦合的好处，是对模块更加灵活的控制。随意得增删，修改部分功能，而不至于牵一发而动全身。以前项目我们曾经追求过紧密耦合，结构是每个人都很痛苦。</p>
<p>紧凑的耦合并非无利处，一些资源利润率可以放到最低。从OpenOA开发中，第30个版本和70个版本左右的区别，能看出数据库模块的耦合。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/09/03/%e6%9d%be%e6%95%a3%e8%80%a6%e5%90%88%e4%b8%8e%e7%b4%a7%e5%af%86%e8%80%a6%e5%90%88.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>简单分页程序,adodb+smarty</title>
		<link>http://www.sunboyu.cn/2008/08/31/%e7%ae%80%e5%8d%95%e5%88%86%e9%a1%b5%e7%a8%8b%e5%ba%8fadodbsmarty.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/31/%e7%ae%80%e5%8d%95%e5%88%86%e9%a1%b5%e7%a8%8b%e5%ba%8fadodbsmarty.shtml#comments</comments>
		<pubDate>Sun, 31 Aug 2008 09:56:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[adodb]]></category>

		<category><![CDATA[smarty]]></category>

		<category><![CDATA[分页]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=292</guid>
		<description><![CDATA[分页类
&#60;?php
/*&#160; Page.Class.php
&#160;*&#160; Page
&#160;*&#160; @link&#160; &#160; &#160; &#160; http://www.sunboyu.cn
&#160;*&#160; @package&#160; &#160; &#160;OA
&#160;*&#160; @version&#160; &#160; &#160;V1.0
&#160;*
&#160;*&#160; 2008 08 28&#160; sunboyu@gmail.com
&#160;*&#160; Demo
	$page = new Page( 1 , 'v_user' , '*' , '' );
	$rs = $page-&#62;__getlist();
	$smarty-&#62;assign(&#34;page&#34;,$page-&#62;__getpagelist());
&#160;*/
&#160;class Page
&#160;{
	 public $count;&#160; &#160; &#160; #结果总数
	 public $page;&#160; &#160; &#160; &#160;#当前页
	 public $pagesize;&#160; &#160;#每页结果数
	 public $pagecount;&#160; #翻页数
	 public $baseurl;&#160; &#160; #url
	 public $result;&#160; [...]]]></description>
			<content:encoded><![CDATA[<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">&lt;?php</li>
<li>/*&nbsp; Page.Class.php</li>
<li>&nbsp;*&nbsp; Page</li>
<li>&nbsp;*&nbsp; @link&nbsp; &nbsp; &nbsp; &nbsp; http://www.sunboyu.cn</li>
<li>&nbsp;*&nbsp; @package&nbsp; &nbsp; &nbsp;OA</li>
<li>&nbsp;*&nbsp; @version&nbsp; &nbsp; &nbsp;V1.0</li>
<li>&nbsp;*</li>
<li>&nbsp;*&nbsp; 2008 08 28&nbsp; sunboyu@gmail.com</li>
<li>&nbsp;*&nbsp; Demo</li>
<li>	$page = new Page( 1 , 'v_user' , '*' , '' );</li>
<li>	$rs = $page-&gt;__getlist();</li>
<li>	$smarty-&gt;assign(&quot;page&quot;,$page-&gt;__getpagelist());</li>
<li>&nbsp;*/</li>
<li>&nbsp;class Page</li>
<li>&nbsp;{</li>
<li>	 public $count;&nbsp; &nbsp; &nbsp; #结果总数</li>
<li>	 public $page;&nbsp; &nbsp; &nbsp; &nbsp;#当前页</li>
<li>	 public $pagesize;&nbsp; &nbsp;#每页结果数</li>
<li>	 public $pagecount;&nbsp; #翻页数</li>
<li>	 public $baseurl;&nbsp; &nbsp; #url</li>
<li>	 public $result;&nbsp; &nbsp; &nbsp;#结果数组集</li>
<li>	 public $pagelist;&nbsp; &nbsp;#每翻页数</li>
<li>	 </li>
<li>	 public $db;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#数据库连接</li>
<li>	 public $table;&nbsp; &nbsp; &nbsp; #要查询的表</li>
<li>	 public $fileds;&nbsp; &nbsp; &nbsp;#要返回的字段</li>
<li>	 public $where;&nbsp; &nbsp; &nbsp; #where条件</li>
<li>&nbsp;</li>
<li>	 #构造函数，初始化变量</li>
<li>	 function __construct( $page , $table , $fields = '*' , $where = false , $baseurl = false )</li>
<li>	 {</li>
<li>	&nbsp; &nbsp; &nbsp;global $_CFG;</li>
<li>		 $this-&gt;db&nbsp; &nbsp; &nbsp; &nbsp; = GetDB();</li>
<li>		 $this-&gt;count&nbsp; &nbsp; &nbsp;= $count;</li>
<li>		 $this-&gt;table&nbsp; &nbsp; &nbsp;= $table;</li>
<li>		 $this-&gt;page&nbsp; &nbsp; &nbsp; = isset($page) ? intval($_GET['page']) : 1;</li>
<li>		 $this-&gt;fileds&nbsp; &nbsp; = $fields;</li>
<li>		 $this-&gt;pagesize&nbsp; = $_CFG['pagesize'];</li>
<li>		 $this-&gt;baseurl&nbsp; &nbsp;= ($baseurl!=false) ? $baseurl : $this-&gt;__geturl();</li>
<li>		 $this-&gt;pagelist&nbsp; = $_CFG['pagelist'];</li>
<li>		 $this-&gt;where&nbsp; &nbsp; &nbsp;= $where;</li>
<li>	 }</li>
<li>&nbsp;</li>
<li>	 #获得当前url</li>
<li>	 function __geturl()</li>
<li>	 {</li>
<li>		$str = ereg_replace(sprintf(&quot;(^|&amp;)page=%d&quot;,$this-&gt;page),&quot;&quot;,$_SERVER['QUERY_STRING']);</li>
<li>		return $str==&quot;&quot; ? '?' : $str;</li>
<li>	 }</li>
<li>	 </li>
<li>	 #获得记录集</li>
<li>	 function __getlist()</li>
<li>	 {</li>
<li>	&nbsp; &nbsp; &nbsp;#获得count记录</li>
<li>		 $sql = sprintf(&quot;SELECT COUNT(0) AS table_count FROM %s&quot;,$this-&gt;table);</li>
<li>		 $rs = $this-&gt;db-&gt;Execute( $sql );</li>
<li>		 $this-&gt;count = $rs-&gt;fields['table_count'];</li>
<li>	&nbsp; &nbsp; &nbsp;$offset = ($this-&gt;page-1)*$this-&gt;pagesize-1;</li>
<li>	&nbsp; &nbsp; &nbsp;$sql = sprintf(&quot;SELECT %s FROM %s %s&quot;,$this-&gt;fileds,$this-&gt;table,(($this-&gt;where!=false) ? &quot; WHERE &quot;.$this-&gt;where : ''));</li>
<li>		 $rs = $this-&gt;db-&gt;SelectLimit( $sql , $this-&gt;pagesize , $offset );</li>
<li>		 $list = false;</li>
<li>		 while(!$rs-&gt;EOF)</li>
<li>		 {</li>
<li>		&nbsp; &nbsp; &nbsp;$list[] = $rs-&gt;fields;</li>
<li>			 $rs-&gt;MoveNext();</li>
<li>		 }</li>
<li>		 return $list;</li>
<li>	 }</li>
<li>&nbsp;</li>
<li>	 #获得分页列表</li>
<li>	 function __getpagelist()</li>
<li>	 {</li>
<li>		 $this-&gt;result['count'] = $this-&gt;count;</li>
<li>		 $this-&gt;result['page'] = $this-&gt;page;</li>
<li>		 $this-&gt;result['pagesize'] = $this-&gt;pagesize;</li>
<li>		 $this-&gt;result['pagecount'] = ceil($this-&gt;count/$this-&gt;pagesize);</li>
<li>		 if($this-&gt;result['pagecount']&lt;=1) //只有一页以下</li>
<li>		 {</li>
<li>			 $this-&gt;result['pagelist'] = 0;</li>
<li>		 }</li>
<li>		 else //一页以上</li>
<li>		 {</li>
<li>			 #前一页，第一页的算法</li>
<li>			 $this-&gt;result['first'] = ($this-&gt;page == 1) ? 0 : 1;</li>
<li>			 $this-&gt;result['pre'] = ($this-&gt;page == 1) ? 0 : 1;</li>
<li>			 #后一页，最后一页的算法</li>
<li>			 $this-&gt;result['next'] = ($this-&gt;page == $this-&gt;pagecount ) ? 0 : 1;</li>
<li>			 $this-&gt;result['last'] = ($this-&gt;page == $this-&gt;pagecount ) ? 0 : 1;</li>
<li>&nbsp;</li>
<li>			 </li>
<li>&nbsp;</li>
<li>			 #起始</li>
<li>			 $pagearray = array();</li>
<li>			 $start = floor(($this-&gt;page-1)/10)*10+1;</li>
<li>			 for($i=0;$i&lt;10;$i++)</li>
<li>			 {</li>
<li>			&nbsp; &nbsp; &nbsp;if( ($start+$i) &lt;= $this-&gt;result['pagecount'])</li>
<li>				 {</li>
<li>				&nbsp; &nbsp; &nbsp;$pagearray[$i]['page'] = $start+$i; </li>
<li>				 }</li>
<li>				 if( ($start+$i) != $this-&gt;page )</li>
<li>				 {</li>
<li>				&nbsp; &nbsp; &nbsp;$pagearray[$i]['link'] = 1; </li>
<li>				 }</li>
<li>			 }</li>
<li>			 #分页导航列表</li>
<li>			 $this-&gt;result['pagelist'] = $pagearray;</li>
<li>			 $this-&gt;result['baseurl'] = $this-&gt;baseurl;</li>
<li>		 }</li>
<li>		 return $this-&gt;result;</li>
<li>	 }</li>
<li>}</li>
<li>?&gt;</li></ol></div>
<p>smarty模版</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">{{config_load file=&quot;Lang.Page.$lang.conf&quot;}}&lt;div id=&quot;page&quot;&gt;</li>
<li>&lt;table&gt;</li>
<li>&nbsp;&nbsp; &nbsp;&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td&gt;</li>
<li>		{{#gongs#}}{{$page.count}}{{#pagecountend#}} {{#pagepagesizeper#}}{{$page.pagesize}}{{#pagepagelistper#}}{{#tiao#}}&nbsp; {{#gongs#}}{{$page.pagecount}}{{#page#}} {{#pagepage#}}{{$page.page+1}}{{#page#}}</li>
<li>		&lt;/td&gt;</li>
<li>		&lt;td&gt;</li>
<li>		{{if $page.pagecount&gt;1}}</li>
<li>		{{if $page.first eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl}}&quot;&gt;{{#pagefirst#}}&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		{{#pagefirst#}}</li>
<li>		{{/if}}</li>
<li>		{{if $page.pre eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl}}&amp;page={{$page.page-1}}&quot;&gt;{{#pagepre#}}&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		{{#pagepre#}}</li>
<li>		{{/if}}</li>
<li>		{{foreach from=$page.pagelist item=vols}}</li>
<li>		&nbsp; &nbsp; {{if $vols.link eq 1}}</li>
<li>			&lt;a href=&quot;{{$page.baseurl}}&amp;page={{$vols.page}}&quot;&gt;[{{$vols.page}}]&lt;/a&gt;</li>
<li>			{{else}}</li>
<li>			[{{$vols.page}}]</li>
<li>			{{/if}}</li>
<li>		{{/foreach}}</li>
<li>		{{if $page.next eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl|default:&quot;?&quot;}}&amp;page={{$page.page+1}}&quot;&gt;{{#pagenext#}}&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		{{#pagenext#}}</li>
<li>		{{/if}}</li>
<li>		{{if $page.last eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl|default:&quot;?&quot;}}&amp;page={{$page.pagecount}}&quot;&gt;{{#pageend#}}&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		{{#pagelast#}}</li>
<li>		{{/if}}</li>
<li>		{{/if}}</li>
<li>		&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>&lt;/table&gt;</li>
<li>&lt;/div&gt;</li></ol></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">pagecountend&nbsp; &nbsp; &nbsp; = &quot;条数据&quot;</li>
<li>pagepagesizeper&nbsp; &nbsp;= &quot;每页&quot;</li>
<li>pagepagesizeend&nbsp; &nbsp;= &quot;条&quot;</li>
<li>page&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = &quot;页&quot;</li>
<li>tiao&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = &quot;条&quot;</li>
<li>pagepage&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = &quot;当前第&quot;</li>
<li>pagefirst&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= &quot;首页&quot;</li>
<li>pagepre&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= &quot;上一页&quot;</li>
<li>pagenext&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = &quot;下一页&quot;</li>
<li>pagelast&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; = &quot;尾页&quot;</li>
<li>gongs&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= &quot;共&quot;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/31/%e7%ae%80%e5%8d%95%e5%88%86%e9%a1%b5%e7%a8%8b%e5%ba%8fadodbsmarty.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>简单的PHP+SMARTY分页类</title>
		<link>http://www.sunboyu.cn/2008/08/29/%e7%ae%80%e5%8d%95%e7%9a%84phpsmarty%e5%88%86%e9%a1%b5%e7%b1%bb.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/29/%e7%ae%80%e5%8d%95%e7%9a%84phpsmarty%e5%88%86%e9%a1%b5%e7%b1%bb.shtml#comments</comments>
		<pubDate>Fri, 29 Aug 2008 15:21:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[page]]></category>

		<category><![CDATA[smarty]]></category>

		<category><![CDATA[分页]]></category>

		<category><![CDATA[类]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=291</guid>
		<description><![CDATA[类的代码
&#60;?php
/*&#160; Page.Class.php
&#160;*&#160; Page
&#160;*&#160; @link&#160; &#160; &#160; &#160; http://www.sunboyu.cn
&#160;*&#160; @package&#160; &#160; &#160;OA
&#160;*&#160; @version&#160; &#160; &#160;V1.0
&#160;*
&#160;*&#160; 2008 08 28&#160; sunboyu@gmail.com
&#160;*/
&#160;class Page
&#160;{
	 public $count;&#160; &#160; &#160; #结果总数
	 public $page;&#160; &#160; &#160; &#160;#当前页
	 public $pagesize;&#160; &#160;#每页结果数
	 public $pagecount;&#160; #翻页数
	 public $baseurl;&#160; &#160; #url
	 public $result;&#160; &#160; &#160;#结果数组集
	 public $pagelist;&#160; &#160;#每翻页数
&#160;
	 #构造函数，初始化变量
	 function __construct( $count , $page , $pagesize , [...]]]></description>
			<content:encoded><![CDATA[<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">&lt;?php</li>
<li>/*&nbsp; Page.Class.php</li>
<li>&nbsp;*&nbsp; Page</li>
<li>&nbsp;*&nbsp; @link&nbsp; &nbsp; &nbsp; &nbsp; http://www.sunboyu.cn</li>
<li>&nbsp;*&nbsp; @package&nbsp; &nbsp; &nbsp;OA</li>
<li>&nbsp;*&nbsp; @version&nbsp; &nbsp; &nbsp;V1.0</li>
<li>&nbsp;*</li>
<li>&nbsp;*&nbsp; 2008 08 28&nbsp; sunboyu@gmail.com</li>
<li>&nbsp;*/</li>
<li>&nbsp;class Page</li>
<li>&nbsp;{</li>
<li>	 public $count;&nbsp; &nbsp; &nbsp; #结果总数</li>
<li>	 public $page;&nbsp; &nbsp; &nbsp; &nbsp;#当前页</li>
<li>	 public $pagesize;&nbsp; &nbsp;#每页结果数</li>
<li>	 public $pagecount;&nbsp; #翻页数</li>
<li>	 public $baseurl;&nbsp; &nbsp; #url</li>
<li>	 public $result;&nbsp; &nbsp; &nbsp;#结果数组集</li>
<li>	 public $pagelist;&nbsp; &nbsp;#每翻页数</li>
<li>&nbsp;</li>
<li>	 #构造函数，初始化变量</li>
<li>	 function __construct( $count , $page , $pagesize , $pagelist , $baseurl = false )</li>
<li>	 {</li>
<li>		 $this-&gt;count&nbsp; &nbsp; &nbsp;= $count;</li>
<li>		 $this-&gt;page&nbsp; &nbsp; &nbsp; = $page;</li>
<li>		 $this-&gt;pagesize&nbsp; = $pagesize;</li>
<li>		 $this-&gt;baseurl&nbsp; &nbsp;= isset($baseurl) ? $baseurl : $this-&gt;__geturl();</li>
<li>		 $this-&gt;pagelist = $pagelist;</li>
<li>	 }</li>
<li>&nbsp;</li>
<li>	 #获得当前url</li>
<li>	 function __geturl()</li>
<li>	 {</li>
<li>		return ereg_replace(&quot;(^|&amp;)page={$page}&quot;,&quot;&quot;,$_SERVER['QUERY_STRING']);</li>
<li>	 }</li>
<li>&nbsp;</li>
<li>	 #获得分页列表</li>
<li>	 function __getpagelist()</li>
<li>	 {</li>
<li>		 $this-&gt;result['count'] = $this-&gt;count;</li>
<li>		 $this-&gt;result['page'] = $this-&gt;page;</li>
<li>		 $this-&gt;result['pagesize'] = $this-&gt;pagesize;</li>
<li>		 $this-&gt;result['pagecount'] = ceil($this-&gt;count/$this-&gt;pagesize);</li>
<li>		 if($this-&gt;result['pagecount']&lt;=1) //只有一页以下</li>
<li>		 {</li>
<li>			 $this-&gt;result['pagelist'] = 0;</li>
<li>		 }</li>
<li>		 else //一页以上</li>
<li>		 {</li>
<li>			 #前一页，第一页的算法</li>
<li>			 $this-&gt;result['first'] = ($this-&gt;page == 1) ? 0 : 1;</li>
<li>			 $this-&gt;result['pre'] = ($this-&gt;page == 1) ? 0 : 1;</li>
<li>			 #后一页，最后一页的算法</li>
<li>			 $this-&gt;result['next'] = ($this-&gt;page == $this-&gt;pagecount ) ? 0 : 1;</li>
<li>			 $this-&gt;result['last'] = ($this-&gt;page == $this-&gt;pagecount ) ? 0 : 1;</li>
<li>&nbsp;</li>
<li>			 </li>
<li>&nbsp;</li>
<li>			 #起始</li>
<li>			 $pagearray = array();</li>
<li>			 $start = floor(($this-&gt;page-1)/10)*10+1;</li>
<li>			 for($i=0;$i&lt;10;$i++)</li>
<li>			 {</li>
<li>			&nbsp; &nbsp; &nbsp;if( ($start+$i) &lt;= $this-&gt;result['pagecount'])</li>
<li>				 {</li>
<li>				&nbsp; &nbsp; &nbsp;$pagearray[$i]['page'] = $start+$i; </li>
<li>				 }</li>
<li>				 if( ($start+$i) != $this-&gt;page )</li>
<li>				 {</li>
<li>				&nbsp; &nbsp; &nbsp;$pagearray[$i]['link'] = 1; </li>
<li>				 }</li>
<li>			 }</li>
<li>			 #分页导航列表</li>
<li>			 $this-&gt;result['pagelist'] = $pagearray;</li>
<li>			 $this-&gt;result['baseurl'] = $this-&gt;baseurl;</li>
<li>		 }</li>
<li>	 }</li>
<li>}</li>
<li>?&gt;</li></ol></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">&lt;table&gt;</li>
<li>&nbsp;&nbsp; &nbsp;&lt;tr&gt;</li>
<li>	&nbsp; &nbsp; &lt;td&gt;</li>
<li>		共{{$page.count}}条数据 每页{{$page.pagesize}}条 共{{$page.pagecount}}页 当前第{{$page.page}}页</li>
<li>		&lt;/td&gt;</li>
<li>		&lt;td&gt;</li>
<li>		{{if $page.first eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl}}&quot;&gt;首页&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		首页</li>
<li>		{{/if}}</li>
<li>		{{if $page.pre eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl}}&amp;page={{$page.page-1}}&quot;&gt;上一页&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		上一页</li>
<li>		{{/if}}</li>
<li>		{{foreach from=$page.pagelist item=vols}}</li>
<li>		&nbsp; &nbsp; {{if $vols.link eq 1}}</li>
<li>			&lt;a href=&quot;{{$page.baseurl}}&amp;page={{$vols.page}}&quot;&gt;[{{$vols.page}}]&lt;/a&gt;</li>
<li>			{{else}}</li>
<li>			[{{$vols.page}}]</li>
<li>			{{/if}}</li>
<li>		{{/foreach}}</li>
<li>		{{if $page.next eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl}}&amp;page={{$page.page-1}}&quot;&gt;下一页&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		下一页</li>
<li>		{{/if}}</li>
<li>		{{if $page.last eq 1}}</li>
<li>		&lt;a href=&quot;{{$page.baseurl}}&amp;page={{$page.pagecount}}&quot;&gt;尾页&lt;/a&gt;</li>
<li>		{{else}}</li>
<li>		尾页</li>
<li>		{{/if}}</li>
<li>		&lt;/td&gt;</li>
<li>	&lt;/tr&gt;</li>
<li>&lt;/table&gt;</li></ol></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">&lt;?php</li>
<li>require_once('Include/Init.inc.php');</li>
<li>require_once('Include/Class/Page.Class.php');</li>
<li>$page = new Page( 999 , 12 , 10 , 6 , '?' );</li>
<li>$page-&gt;__getpagelist();</li>
<li>$smarty-&gt;assign(&quot;page&quot;,$page-&gt;result);</li>
<li>$smarty-&gt;display(&quot;page.html&quot;);</li>
<li>?&gt;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/29/%e7%ae%80%e5%8d%95%e7%9a%84phpsmarty%e5%88%86%e9%a1%b5%e7%b1%bb.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Mysql视图应用</title>
		<link>http://www.sunboyu.cn/2008/08/28/mysql%e8%a7%86%e5%9b%be%e5%ba%94%e7%94%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/28/mysql%e8%a7%86%e5%9b%be%e5%ba%94%e7%94%a8.shtml#comments</comments>
		<pubDate>Thu, 28 Aug 2008 12:55:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[view]]></category>

		<category><![CDATA[视图]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=290</guid>
		<description><![CDATA[mysql视图创建方法，以我的OpenOA为例，创建user表left jion user_info表的视图
CREATE VIEW v_user AS SELECT * FROM user LEFT JOIN user_info ON (user.id = user_info.user_id)
然后查看
mysql&#62;use oa
mysql&#62;show tables
结果显示，v_user是库oa中的一个表。因此我们使用的时候，可以直接使用语句 SELECT * FROM v_user
而这句也就等于 SELECT * FROM user LEFT JOIN user_info ON (user.id = user_info.user_id)
而实习在系统中，v_user 只有这么一个文件v_user.frm  也就是只有结构，没有数据和索引.打开后，可以看到详细的存储的内容
TYPE=VIEW
query=select `oa`.`user`.`id` AS `id`,`oa`.`user`.`username` AS `username`,`oa`.`user`.`nickname` AS `nickname`,`oa`.`user`.`password` AS `password`,`oa`.`user`.`lastlogintime` AS `lastlogintime`,`oa`.`user`.`lastloginip` AS `lastloginip`,`oa`.`user`.`loginrand` AS `loginrand`,`oa`.`user_info`.`user_id` AS `user_id`,`oa`.`user_info`.`user_realname` AS `user_realname`,`oa`.`user_info`.`user_sex` [...]]]></description>
			<content:encoded><![CDATA[<p>mysql视图创建方法，以我的OpenOA为例，创建user表left jion user_info表的视图</p>
<p>CREATE VIEW v_user AS SELECT * FROM user LEFT JOIN user_info ON (user.id = user_info.user_id)</p>
<p>然后查看</p>
<p>mysql&gt;use oa</p>
<p>mysql&gt;show tables</p>
<p>结果显示，v_user是库oa中的一个表。因此我们使用的时候，可以直接使用语句 SELECT * FROM v_user</p>
<p>而这句也就等于 SELECT * FROM user LEFT JOIN user_info ON (user.id = user_info.user_id)</p>
<p>而实习在系统中，v_user 只有这么一个文件v_user.frm  也就是只有结构，没有数据和索引.打开后，可以看到详细的存储的内容</p>
<p>TYPE=VIEW<br />
query=select `oa`.`user`.`id` AS `id`,`oa`.`user`.`username` AS `username`,`oa`.`user`.`nickname` AS `nickname`,`oa`.`user`.`password` AS `password`,`oa`.`user`.`lastlogintime` AS `lastlogintime`,`oa`.`user`.`lastloginip` AS `lastloginip`,`oa`.`user`.`loginrand` AS `loginrand`,`oa`.`user_info`.`user_id` AS `user_id`,`oa`.`user_info`.`user_realname` AS `user_realname`,`oa`.`user_info`.`user_sex` AS `user_sex`,`oa`.`user_info`.`user_age` AS `user_age`,`oa`.`user_info`.`user_birthplace` AS `user_birthplace`,`oa`.`user_info`.`user_homeaddress` AS `user_homeaddress`,`oa`.`user_info`.`user_idcard` AS `user_idcard`,`oa`.`user_info`.`user_graduateschool` AS `user_graduateschool`,`oa`.`user_info`.`user_educational` AS `user_educational`,`oa`.`user_info`.`user_graduatetime` AS `user_graduatetime`,`oa`.`user_info`.`user_homephone` AS `user_homephone`,`oa`.`user_info`.`user_cellphone` AS `user_cellphone`,`oa`.`user_info`.`user_workphone` AS `user_workphone`,`oa`.`user_info`.`user_fax` AS `user_fax`,`oa`.`user_info`.`user_email` AS `user_email`,`oa`.`user_info`.`user_oicq` AS `user_oicq`,`oa`.`user_info`.`user_msn` AS `user_msn` from (`oa`.`user` left join `oa`.`user_info` on((`oa`.`user`.`id` = `oa`.`user_info`.`user_id`)))<br />
md5=19f7a28463ad7447c3b4cc5428888fa6<br />
updatable=0<br />
algorithm=0<br />
definer_user=root<br />
definer_host=localhost<br />
suid=1<br />
with_check_option=0<br />
revision=1<br />
timestamp=2008-08-28 11:58:17<br />
create-version=1<br />
source=SELECT * FROM user LEFT JOIN user_info ON ( user.id = user_info.user_id )</p>
<p>都是啥意思，没有深究，只是能根据字面猜出来，如果只是用，到此位置即可。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/28/mysql%e8%a7%86%e5%9b%be%e5%ba%94%e7%94%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>CSS注释兼容性测试</title>
		<link>http://www.sunboyu.cn/2008/08/28/css%e6%b3%a8%e9%87%8a%e5%85%bc%e5%ae%b9%e6%80%a7%e6%b5%8b%e8%af%95.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/28/css%e6%b3%a8%e9%87%8a%e5%85%bc%e5%ae%b9%e6%80%a7%e6%b5%8b%e8%af%95.shtml#comments</comments>
		<pubDate>Wed, 27 Aug 2008 16:21:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[css]]></category>

		<category><![CDATA[兼容]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=289</guid>
		<description><![CDATA[调试CSS差点调吐了，ff说啥都不认。后来起到html注释有兼容性，进行了一下测试。
风格1:手误的一种注释  &#60;!&#8211; *** &#8211;&#62;这本是html的注释，一不小心写了出来，结果，firefox不认，差点没调吐。
风格2:标准的注释 /* &#38;&#38;&#38;&#38;&#38;   */ ie6，firefox都兼容的。
另外写注释，注释跟两边边界空出一点，会好点，降低错误率。
]]></description>
			<content:encoded><![CDATA[<p>调试CSS差点调吐了，ff说啥都不认。后来起到html注释有兼容性，进行了一下测试。</p>
<p>风格1:手误的一种注释  &lt;!&#8211; *** &#8211;&gt;这本是html的注释，一不小心写了出来，结果，firefox不认，差点没调吐。</p>
<p>风格2:标准的注释 /* &amp;&amp;&amp;&amp;&amp;   */ ie6，firefox都兼容的。</p>
<p>另外写注释，注释跟两边边界空出一点，会好点，降低错误率。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/28/css%e6%b3%a8%e9%87%8a%e5%85%bc%e5%ae%b9%e6%80%a7%e6%b5%8b%e8%af%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP中FTP模块的一些应用</title>
		<link>http://www.sunboyu.cn/2008/08/27/php%e4%b8%adftp%e6%a8%a1%e5%9d%97%e7%9a%84%e4%b8%80%e4%ba%9b%e5%ba%94%e7%94%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/27/php%e4%b8%adftp%e6%a8%a1%e5%9d%97%e7%9a%84%e4%b8%80%e4%ba%9b%e5%ba%94%e7%94%a8.shtml#comments</comments>
		<pubDate>Wed, 27 Aug 2008 02:20:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[ftp]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=288</guid>
		<description><![CDATA[&#60;?php
class ftp
{
	//connect id
	var $ftp;
	//remote dir
	var $remotedir = '/';
	//local dir
	var $localdir = './';
	//write log
	var $writelog = false;
	//log file
	var $logfile = 'ftp_log.txt';
	//print log
	var $printlog = false;
	//session time
	var $timeout = 60;
	//construct connetc
	function __construct( $host , $user , $pass )
	{
		$this-&#62;ftp = @ftp_connect( $host );
		ftp_login( $this-&#62;ftp, $user , $pass );
		//ftp_set_option( $this-&#62;ftp , FTP_TIMEOUT_SEC , $this-&#62;timeout );
	}
	//list sub files
	function __list( $dir [...]]]></description>
			<content:encoded><![CDATA[<div class="hl-surround"><ol class="hl-main ln-show" title="Double click to hide line number." ondblclick = "linenumber(this)"><li class="hl-firstline">&lt;?php</li>
<li>class ftp</li>
<li>{</li>
<li>	//connect id</li>
<li>	var $ftp;</li>
<li>	//remote dir</li>
<li>	var $remotedir = '/';</li>
<li>	//local dir</li>
<li>	var $localdir = './';</li>
<li>	//write log</li>
<li>	var $writelog = false;</li>
<li>	//log file</li>
<li>	var $logfile = 'ftp_log.txt';</li>
<li>	//print log</li>
<li>	var $printlog = false;</li>
<li>	//session time</li>
<li>	var $timeout = 60;</li>
<li>	//construct connetc</li>
<li>	function __construct( $host , $user , $pass )</li>
<li>	{</li>
<li>		$this-&gt;ftp = @ftp_connect( $host );</li>
<li>		ftp_login( $this-&gt;ftp, $user , $pass );</li>
<li>		//ftp_set_option( $this-&gt;ftp , FTP_TIMEOUT_SEC , $this-&gt;timeout );</li>
<li>	}</li>
<li>	//list sub files</li>
<li>	function __list( $dir = false , $subtree = false )</li>
<li>	{</li>
<li>		$rlist = array();</li>
<li>		if(!$dir)</li>
<li>		{</li>
<li>			$dir = $this-&gt;remotedir;</li>
<li>		}</li>
<li>		$list = ftp_rawlist($this-&gt;ftp,$dir,TRUE);</li>
<li>		if(is_array($list))</li>
<li>		{</li>
<li>			foreach( $list as $key =&gt; $value )</li>
<li>			{</li>
<li>				$tmp = explode( ' ' , $value );</li>
<li>				$rlist[$key] = end($tmp);</li>
<li>				if(@ftp_chdir($this-&gt;ftp,$dir.$rlist[$key].'/'))</li>
<li>				{</li>
<li>					$rlist[$rlist[$key]] = $this-&gt;__list( $dir.$rlist[$key].'/' );</li>
<li>					unset($rlist[$key]);</li>
<li>				}</li>
<li>				unset($tmp);</li>
<li>			}</li>
<li>		}</li>
<li>		return $rlist;</li>
<li>	}</li>
<li>	//change dir&nbsp; $isabs = false,use rela dir default</li>
<li>	function __chdir( $dir , $isabs = false )</li>
<li>	{</li>
<li>		if(!$isabs)</li>
<li>		{</li>
<li>			$nextdir = $this-&gt;remotedir.$dir.'/';</li>
<li>		}</li>
<li>		else</li>
<li>		{</li>
<li>			$nextdir = $dir;</li>
<li>		}</li>
<li>		if(ftp_chdir($this-&gt;ftp,$nextdir))</li>
<li>		{</li>
<li>			$this-&gt;remotedir = $nextdir;</li>
<li>			return true;</li>
<li>		}</li>
<li>		else</li>
<li>		{</li>
<li>			return false;</li>
<li>		}</li>
<li>	}</li>
<li>	//close connect</li>
<li>	function __close()</li>
<li>	{</li>
<li>		@ftp_close($this-&gt;ftp);</li>
<li>	}</li>
<li>}</li>
<li>$ftp = new ftp( 'www.sunboyu.cn' , '**', '***' );</li>
<li>$ftp-&gt;__chdir('website',0);</li>
<li>$list = $ftp-&gt;__list('/');</li>
<li>echo $a = time();</li>
<li>print_r($list);</li>
<li>echo time() - $a;</li>
<li>?&gt;</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/27/php%e4%b8%adftp%e6%a8%a1%e5%9d%97%e7%9a%84%e4%b8%80%e4%ba%9b%e5%ba%94%e7%94%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>放弃ADODB_lite数据字典功能</title>
		<link>http://www.sunboyu.cn/2008/08/26/%e6%94%be%e5%bc%83adodb_lite%e6%95%b0%e6%8d%ae%e5%ad%97%e5%85%b8%e5%8a%9f%e8%83%bd.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/26/%e6%94%be%e5%bc%83adodb_lite%e6%95%b0%e6%8d%ae%e5%ad%97%e5%85%b8%e5%8a%9f%e8%83%bd.shtml#comments</comments>
		<pubDate>Tue, 26 Aug 2008 15:33:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[adodblite]]></category>

		<category><![CDATA[数据字典]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=287</guid>
		<description><![CDATA[对adodb_lite的数据字典功能进行测试使用后，发现这玩意是一块鸡肋。其优秀之处在于多种数据库的无缝切换，当使用范围扩大的时候，弊端随之暴露：
1：对字段类型的支持不够完全，比如enum类型
2：不支持存储过程触发器之类
而一个项目中，存储过程触发器之类使用很多，没有这些，但出写表的数据字典感觉意义不大，不过简单的表还是会用这种方式，其他的就爹生成sql语句了
]]></description>
			<content:encoded><![CDATA[<p>对adodb_lite的数据字典功能进行测试使用后，发现这玩意是一块鸡肋。其优秀之处在于多种数据库的无缝切换，当使用范围扩大的时候，弊端随之暴露：</p>
<p>1：对字段类型的支持不够完全，比如enum类型</p>
<p>2：不支持存储过程触发器之类</p>
<p>而一个项目中，存储过程触发器之类使用很多，没有这些，但出写表的数据字典感觉意义不大，不过简单的表还是会用这种方式，其他的就爹生成sql语句了</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/26/%e6%94%be%e5%bc%83adodb_lite%e6%95%b0%e6%8d%ae%e5%ad%97%e5%85%b8%e5%8a%9f%e8%83%bd.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>小一探针</title>
		<link>http://www.sunboyu.cn/2008/08/21/%e5%b0%8f%e4%b8%80%e6%8e%a2%e9%92%88.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/21/%e5%b0%8f%e4%b8%80%e6%8e%a2%e9%92%88.shtml#comments</comments>
		<pubDate>Thu, 21 Aug 2008 03:26:28 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[php探针]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=283</guid>
		<description><![CDATA[闲来没事，突然想写个探针
http://www.sunboyu.cn/info.php
难点很多，逐一突破。写这么个东西对PHP和系统的认识提高很快。
]]></description>
			<content:encoded><![CDATA[<p>闲来没事，突然想写个探针<br />
http://www.sunboyu.cn/info.php<br />
难点很多，逐一突破。写这么个东西对PHP和系统的认识提高很快。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/21/%e5%b0%8f%e4%b8%80%e6%8e%a2%e9%92%88.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>史上最牛的中文验证码，2过腾讯！</title>
		<link>http://www.sunboyu.cn/2008/08/18/%e5%8f%b2%e4%b8%8a%e6%9c%80%e7%89%9b%e7%9a%84%e4%b8%ad%e6%96%87%e9%aa%8c%e8%af%81%e7%a0%81%ef%bc%8c2%e8%bf%87%e8%85%be%e8%ae%af%ef%bc%81.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/18/%e5%8f%b2%e4%b8%8a%e6%9c%80%e7%89%9b%e7%9a%84%e4%b8%ad%e6%96%87%e9%aa%8c%e8%af%81%e7%a0%81%ef%bc%8c2%e8%bf%87%e8%85%be%e8%ae%af%ef%bc%81.shtml#comments</comments>
		<pubDate>Mon, 18 Aug 2008 15:39:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[验证码]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=282</guid>
		<description><![CDATA[测试地址 http://www.sunboyu.cn/sourse/nbcode.php
下载地址 http://www.sunboyu.cn/sourse/nbcode.rar
]]></description>
			<content:encoded><![CDATA[<p>测试地址 http://www.sunboyu.cn/sourse/nbcode.php</p>
<p>下载地址 http://www.sunboyu.cn/sourse/nbcode.rar</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/18/%e5%8f%b2%e4%b8%8a%e6%9c%80%e7%89%9b%e7%9a%84%e4%b8%ad%e6%96%87%e9%aa%8c%e8%af%81%e7%a0%81%ef%bc%8c2%e8%bf%87%e8%85%be%e8%ae%af%ef%bc%81.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>使用mysql保存session，并建立在线用户列表</title>
		<link>http://www.sunboyu.cn/2008/08/15/%e4%bd%bf%e7%94%a8mysql%e4%bf%9d%e5%ad%98session%ef%bc%8c%e5%b9%b6%e5%bb%ba%e7%ab%8b%e5%9c%a8%e7%ba%bf%e7%94%a8%e6%88%b7%e5%88%97%e8%a1%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/15/%e4%bd%bf%e7%94%a8mysql%e4%bf%9d%e5%ad%98session%ef%bc%8c%e5%b9%b6%e5%bb%ba%e7%ab%8b%e5%9c%a8%e7%ba%bf%e7%94%a8%e6%88%b7%e5%88%97%e8%a1%a8.shtml#comments</comments>
		<pubDate>Fri, 15 Aug 2008 15:02:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[list]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=280</guid>
		<description><![CDATA[写OA，使用mysql存储session，这样，是为了获得在线用户的列表，为做一个web im做准备。
首先创建表,注，这里使用了adodb中数据字典的描述方法：
$Session_Fields = &#34;
session_id VARCHAR(100) NOTNULL,
session_value X DEFAULT '',
session_expires I(10) DEFAULT NULL,
userid I(5) DEFAULT NULL
&#34;;
$Session_Tables = array('mysql' =&#62; &#34;ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci COMMENT = 'session表'&#34;);
$dict = NewDataDictionary(GetDB());
$sqlarray = $dict-&#62;CreateTableSQL($_CFG['table']['session'], $Session_Fields, $Session_Tables);
$dict-&#62;ExecuteSQLArray($sqlarray);
然后session类:
&#60;?php
/*&#160; Session.Class.php
&#160;*&#160; Session Manager
&#160;*&#160; @link&#160; &#160; &#160; &#160; http://www.sunboyu.cn
&#160;*&#160; @package&#160; &#160; &#160;OA
&#160;*&#160; @version&#160; &#160; &#160;V1.0
&#160;*
&#160;*&#160; 2008 08 14&#160; sunboyu@gmail.com
&#160;*/
class Session
{
	var $lifetime;
	var [...]]]></description>
			<content:encoded><![CDATA[<p>写OA，使用mysql存储session，这样，是为了获得在线用户的列表，为做一个web im做准备。</p>
<p>首先创建表,注，这里使用了adodb中数据字典的描述方法：</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">$Session_Fields = &quot;</li>
<li>session_id VARCHAR(100) NOTNULL,</li>
<li>session_value X DEFAULT '',</li>
<li>session_expires I(10) DEFAULT NULL,</li>
<li>userid I(5) DEFAULT NULL</li>
<li>&quot;;</li>
<li>$Session_Tables = array('mysql' =&gt; &quot;ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci COMMENT = 'session表'&quot;);</li>
<li>$dict = NewDataDictionary(GetDB());</li>
<li>$sqlarray = $dict-&gt;CreateTableSQL($_CFG['table']['session'], $Session_Fields, $Session_Tables);</li>
<li>$dict-&gt;ExecuteSQLArray($sqlarray);</li></ol></div>
<p>然后session类:</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">&lt;?php</li>
<li>/*&nbsp; Session.Class.php</li>
<li>&nbsp;*&nbsp; Session Manager</li>
<li>&nbsp;*&nbsp; @link&nbsp; &nbsp; &nbsp; &nbsp; http://www.sunboyu.cn</li>
<li>&nbsp;*&nbsp; @package&nbsp; &nbsp; &nbsp;OA</li>
<li>&nbsp;*&nbsp; @version&nbsp; &nbsp; &nbsp;V1.0</li>
<li>&nbsp;*</li>
<li>&nbsp;*&nbsp; 2008 08 14&nbsp; sunboyu@gmail.com</li>
<li>&nbsp;*/</li>
<li>class Session</li>
<li>{</li>
<li>	var $lifetime;</li>
<li>	var $db = null;</li>
<li>	function __construct()</li>
<li>	{	</li>
<li>		#return adodb lite connetction</li>
<li>		$this-&gt;db = GetDB();</li>
<li>	}</li>
<li>	#open</li>
<li>	function open( $savepath , $session_name )</li>
<li>	{</li>
<li>		$this-&gt;lifetime =&nbsp; get_cfg_var(&quot;session.gc_maxlifetime&quot;);</li>
<li>		return true;</li>
<li>	}</li>
<li>	#close</li>
<li>	function close()</li>
<li>	{</li>
<li>		return true;</li>
<li>	}</li>
<li>	#read</li>
<li>	function read( $session_id )</li>
<li>	{</li>
<li>		global $_CFG;</li>
<li>		$sql = sprintf(&quot;SELECT * FROM %s WHERE session_id = %s&quot;,$_CFG['table']['session'],GetSqlString( $session_id ));</li>
<li>		$rs = $this-&gt;db-&gt;Execute( $sql );</li>
<li>		if($rs-&gt;RecordCount()&gt;0)</li>
<li>		{</li>
<li>			$result = $rs-&gt;fields;</li>
<li>			</li>
<li>			return $result['session_value'];</li>
<li>		}</li>
<li>		else</li>
<li>		{</li>
<li>			return null;</li>
<li>		}</li>
<li>	}</li>
<li>	#write</li>
<li>	function write( $session_id , $session_value )</li>
<li>	{</li>
<li>		global $_CFG;</li>
<li>		$sql = sprintf(&quot;SELECT session_id FROM %s WHERE session_id = %s&quot;,$_CFG['table']['session'],GetSqlString( $session_id ));</li>
<li>		$rs = $this-&gt;db-&gt;Execute( $sql );</li>
<li>		if($rs-&gt;RecordCount()==0)</li>
<li>		{</li>
<li>			$newsql = sprintf(&quot;INSERT INTO %s SET session_id = %s , session_value = %s , session_expires = %d&quot;,</li>
<li>				$_CFG['table']['session'],</li>
<li>				GetSqlString( $session_id ),</li>
<li>				GetSqlString( $session_value ),</li>
<li>				GetSqlString( $this-&gt;lifetime+time() , &quot;int&quot; ));</li>
<li>		}</li>
<li>		else</li>
<li>		{</li>
<li>			$newsql = sprintf(&quot;UPDATE %s SET session_value = %s , session_expires = %d WHERE session_id = %s&quot;,</li>
<li>				$_CFG['table']['session'],</li>
<li>				GetSqlString( $session_value ),</li>
<li>				GetSqlString( $this-&gt;lifetime+time() , &quot;int&quot; ),</li>
<li>				GetSqlString( $session_id ));</li>
<li>		}</li>
<li>		return $this-&gt;db-&gt;Execute( $newsql );</li>
<li>	}</li>
<li>	#destroy</li>
<li>	function destroy( $session_id )</li>
<li>	{	</li>
<li>		global $_CFG;</li>
<li>		$delsql = sprintf(&quot;DELETE FROM %s WHERE session_id = %s&quot;,$_CFG['table']['session'],GetSqlString( $session_id ));</li>
<li>		return $this-&gt;db-&gt;Execute( $delsql );</li>
<li>	}</li>
<li>	#gc</li>
<li>	function gc()</li>
<li>	{</li>
<li>		 global $_CFG;</li>
<li>		 $gcsql = sprintf(&quot;DELETE FROM %s WHERE session_expires &lt; %d&quot;,$_CFG['table']['session'],time());</li>
<li>		 return $this-&gt;db-&gt;Execute( $gcsql );</li>
<li>	}</li>
<li>}</li>
<li>?&gt;</li></ol></div>
<p>session机制，之前已经介绍，实现代码如下</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">$session = new Session();</li>
<li>	session_set_save_handler(array(&amp;$session,&quot;open&quot;),</li>
<li>							 array(&amp;$session,&quot;close&quot;),</li>
<li>							 array(&amp;$session,&quot;read&quot;),</li>
<li>							 array(&amp;$session,&quot;write&quot;),</li>
<li>							 array(&amp;$session,&quot;destroy&quot;),</li>
<li>							 array(&amp;$session,&quot;gc&quot;));</li>
<li>	session_start();</li></ol></div>
<p>把session与用户id对应，使用以下语句即可</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">sprintf(&quot;UPDATE %s SET userid = %d WHERE session_id = %s&quot;,$_CFG['table']['session'],GetSqlString($rs['id'],'int'),GetSqlString(session_id(),'text'))</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/15/%e4%bd%bf%e7%94%a8mysql%e4%bf%9d%e5%ad%98session%ef%bc%8c%e5%b9%b6%e5%bb%ba%e7%ab%8b%e5%9c%a8%e7%ba%bf%e7%94%a8%e6%88%b7%e5%88%97%e8%a1%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>静态分页算法解决方案收集</title>
		<link>http://www.sunboyu.cn/2008/08/14/%e9%9d%99%e6%80%81%e5%88%86%e9%a1%b5%e7%ae%97%e6%b3%95%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%e6%94%b6%e9%9b%86.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/14/%e9%9d%99%e6%80%81%e5%88%86%e9%a1%b5%e7%ae%97%e6%b3%95%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%e6%94%b6%e9%9b%86.shtml#comments</comments>
		<pubDate>Thu, 14 Aug 2008 03:36:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[分页]]></category>

		<category><![CDATA[静态]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=278</guid>
		<description><![CDATA[曾经看过动易CMS的代码，曾经在官方论坛上也讨论过分页算法的问题。主要的瓶颈在于，如果一个分类页数过多，那么每更新一个文件，需要生成 count/pagesize 个静态页面，这样再算上分发的话，消耗了大量的cpu，io，带宽。因此门户级的网站，设计一个好的分页算法或者说新闻组织结构是非常必要的。
这里考虑的是全静态网站，并且使用分发形式更新的，也就是在前端只有html静态文件。首页，板块首页，分类首页，这样当然就是由编辑即时更新并且分发。
而子分类，无下级的时候，就得考虑分页，对照以下门户级网站，看他们如何解决。
http://news.sina.com.cn/china/gd/2008-08-13/index.html
可以看出，新浪按照每天的新闻为一页，分页自然容易解决，使用天做为页数，这是天然纯净的算法。另外新浪新闻的实时性比较好，流量集中在当天新闻，这样也比较容易做负载的均衡和过期资源的回收。
http://news.163.com/special/00011SG2/shList.html
网易的每个分类只显示10页，这样就不会有大量分页列表的问题，顶多10页，我感觉比新浪少次。
http://news.cctv.com/china/index.shtml
cctv用的是TurboCMS，这个分页挺有意思，一个模板，但从数据库取500条记录，生成静态。因为记录只是一个标题，一个链接，字节数不会太大，那么用js去用这个大数组进行分页，貌似不错。很节约带宽的做法。赞一个！
sohu的100个分页，暂没看出他怎么做的，反正sohu有钱，大不了加机器。
]]></description>
			<content:encoded><![CDATA[<p>曾经看过动易CMS的代码，曾经在官方论坛上也讨论过分页算法的问题。主要的瓶颈在于，如果一个分类页数过多，那么每更新一个文件，需要生成 count/pagesize 个静态页面，这样再算上分发的话，消耗了大量的cpu，io，带宽。因此门户级的网站，设计一个好的分页算法或者说新闻组织结构是非常必要的。</p>
<p>这里考虑的是全静态网站，并且使用分发形式更新的，也就是在前端只有html静态文件。首页，板块首页，分类首页，这样当然就是由编辑即时更新并且分发。</p>
<p>而子分类，无下级的时候，就得考虑分页，对照以下门户级网站，看他们如何解决。</p>
<p>http://news.sina.com.cn/china/gd/2008-08-13/index.html</p>
<p>可以看出，新浪按照每天的新闻为一页，分页自然容易解决，使用天做为页数，这是天然纯净的算法。另外新浪新闻的实时性比较好，流量集中在当天新闻，这样也比较容易做负载的均衡和过期资源的回收。</p>
<p>http://news.163.com/special/00011SG2/shList.html</p>
<p>网易的每个分类只显示10页，这样就不会有大量分页列表的问题，顶多10页，我感觉比新浪少次。</p>
<p>http://news.cctv.com/china/index.shtml</p>
<p>cctv用的是TurboCMS，这个分页挺有意思，一个模板，但从数据库取500条记录，生成静态。因为记录只是一个标题，一个链接，字节数不会太大，那么用js去用这个大数组进行分页，貌似不错。很节约带宽的做法。赞一个！</p>
<p>sohu的100个分页，暂没看出他怎么做的，反正sohu有钱，大不了加机器。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/14/%e9%9d%99%e6%80%81%e5%88%86%e9%a1%b5%e7%ae%97%e6%b3%95%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%e6%94%b6%e9%9b%86.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>常见文件http中content-type头值－(MIME类型)</title>
		<link>http://www.sunboyu.cn/2008/08/12/%e5%b8%b8%e8%a7%81%e6%96%87%e4%bb%b6http%e4%b8%adcontent-type%e5%a4%b4%e5%80%bc%ef%bc%8dmime%e7%b1%bb%e5%9e%8b.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/12/%e5%b8%b8%e8%a7%81%e6%96%87%e4%bb%b6http%e4%b8%adcontent-type%e5%a4%b4%e5%80%bc%ef%bc%8dmime%e7%b1%bb%e5%9e%8b.shtml#comments</comments>
		<pubDate>Tue, 12 Aug 2008 05:37:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[content-type]]></category>

		<category><![CDATA[mime]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=276</guid>
		<description><![CDATA[.ppt - application/mspowerpoint
.ai - application/postscript
.aif - audio/x-aiff
.aifc - audio/x-aiff
.aiff - audio/x-aiff
.asc - text/plain
.au - audio/basic
.avi - video/x-msvideo
.bcpio - application/x-bcpio
.bin - application/octet-stream
.c - text/plain
.cc - text/plain

.ccad - application/clariscad
.cdf - application/x-netcdf
.class - application/octet-stream
.cpio - application/x-cpio
.cpt - application/mac-compactpro
.csh - application/x-csh
.css - text/css
.dcr - application/x-director
.dir - application/x-director
.dms - application/octet-stream
.doc - application/msword
.drw - application/drafting
.dvi - application/x-dvi
.dwg - application/acad
.dxf - application/dxf
.dxr [...]]]></description>
			<content:encoded><![CDATA[<p>.ppt - application/mspowerpoint<br />
.ai - application/postscript<br />
.aif - audio/x-aiff<br />
.aifc - audio/x-aiff<br />
.aiff - audio/x-aiff<br />
.asc - text/plain<br />
.au - audio/basic<br />
.avi - video/x-msvideo<br />
.bcpio - application/x-bcpio<br />
.bin - application/octet-stream<br />
.c - text/plain<br />
.cc - text/plain</p>
<p><span id="more-276"></span><br />
.ccad - application/clariscad<br />
.cdf - application/x-netcdf<br />
.class - application/octet-stream<br />
.cpio - application/x-cpio<br />
.cpt - application/mac-compactpro<br />
.csh - application/x-csh<br />
.css - text/css<br />
.dcr - application/x-director<br />
.dir - application/x-director<br />
.dms - application/octet-stream<br />
.doc - application/msword<br />
.drw - application/drafting<br />
.dvi - application/x-dvi<br />
.dwg - application/acad<br />
.dxf - application/dxf<br />
.dxr - application/x-director<br />
.eps - application/postscript<br />
.etx - text/x-setext<br />
.exe - application/octet-stream<br />
.ez - application/andrew-inset<br />
.f - text/plain<br />
.f90 - text/plain<br />
.fli - video/x-fli<br />
.gif - image/gif<br />
.gtar - application/x-gtar<br />
.gz - application/x-gzip<br />
.h - text/plain<br />
.hdf - application/x-hdf<br />
.hh - text/plain<br />
.hqx - application/mac-binhex40<br />
.htm - text/html<br />
.html - text/html<br />
.ice - x-conference/x-cooltalk<br />
.ief - image/ief<br />
.iges - model/iges<br />
.igs - model/iges<br />
.ips - application/x-ipscript<br />
.ipx - application/x-ipix<br />
.jpe - image/jpeg<br />
.jpeg - image/jpeg<br />
.jpg - image/jpeg<br />
.js - application/x-javascript<br />
.kar - audio/midi<br />
.latex - application/x-latex<br />
.lha - application/octet-stream<br />
.lsp - application/x-lisp<br />
.lzh - application/octet-stream<br />
.m - text/plain<br />
.man - application/x-troff-man<br />
.me - application/x-troff-me<br />
.mesh - model/mesh<br />
.mid - audio/midi<br />
.midi - audio/midi<br />
.mif - application/vnd.mif<br />
.mime - www/mime<br />
.mov - video/quicktime<br />
.movie - video/x-sgi-movie<br />
.mp2 - audio/mpeg<br />
.mp3 - audio/mpeg<br />
.mpe - video/mpeg<br />
.mpeg - video/mpeg<br />
.mpg - video/mpeg<br />
.mpga - audio/mpeg<br />
.ms - application/x-troff-ms<br />
.msh - model/mesh<br />
.nc - application/x-netcdf<br />
.oda - application/oda<br />
.pbm - image/x-portable-bitmap<br />
.pdb - chemical/x-pdb<br />
.pdf - application/pdf<br />
.pgm - image/x-portable-graymap<br />
.pgn - application/x-chess-pgn<br />
.png - image/png<br />
.pnm - image/x-portable-anymap<br />
.pot - application/mspowerpoint<br />
.ppm - image/x-portable-pixmap<br />
.pps - application/mspowerpoint<br />
.ppt - application/mspowerpoint<br />
.ppz - application/mspowerpoint<br />
.pre - application/x-freelance<br />
.prt - application/pro_eng<br />
.ps - application/postscript<br />
.qt - video/quicktime<br />
.ra - audio/x-realaudio<br />
.ram - audio/x-pn-realaudio<br />
.ras - image/cmu-raster<br />
.rgb - image/x-rgb<br />
.rm - audio/x-pn-realaudio<br />
.roff - application/x-troff<br />
.rpm - audio/x-pn-realaudio-plugin<br />
.rtf - text/rtf<br />
.rtx - text/richtext<br />
.scm - application/x-lotusscreencam<br />
.set - application/set<br />
.sgm - text/sgml<br />
.sgml - text/sgml<br />
.sh - application/x-sh<br />
.shar - application/x-shar<br />
.silo - model/mesh<br />
.sit - application/x-stuffit<br />
.skd - application/x-koan<br />
.skm - application/x-koan<br />
.skp - application/x-koan<br />
.skt - application/x-koan<br />
.smi - application/smil<br />
.smil - application/smil<br />
.snd - audio/basic<br />
.sol - application/solids<br />
.spl - application/x-futuresplash<br />
.src - application/x-wais-source<br />
.step - application/STEP<br />
.stl - application/SLA<br />
.stp - application/STEP<br />
.sv4cpio - application/x-sv4cpio<br />
.sv4crc - application/x-sv4crc<br />
.swf - application/x-shockwave-flash<br />
.t - application/x-troff<br />
.tar - application/x-tar<br />
.tcl - application/x-tcl<br />
.tex - application/x-tex<br />
.texi - application/x-texinfo<br />
.texinfo - application/x-texinfo<br />
.tif - image/tiff<br />
.tiff - image/tiff<br />
.tr - application/x-troff<br />
.tsi - audio/TSP-audio<br />
.tsp - application/dsptype<br />
.tsv - text/tab-separated-values<br />
.txt - text/plain<br />
.unv - application/i-deas<br />
.ustar - application/x-ustar<br />
.vcd - application/x-cdlink<br />
.vda - application/vda<br />
.viv - video/vnd.vivo<br />
.vivo - video/vnd.vivo<br />
.vrml - model/vrml<br />
.wav - audio/x-wav<br />
.wrl - model/vrml<br />
.xbm - image/x-xbitmap<br />
.xlc - application/vnd.ms-excel<br />
.xll - application/vnd.ms-excel<br />
.xlm - application/vnd.ms-excel<br />
.xls - application/vnd.ms-excel<br />
.xlw - application/vnd.ms-excel<br />
.xml - text/xml<br />
.xpm - image/x-xpixmap<br />
.xwd - image/x-xwindowdump<br />
.xyz - chemical/x-pdb<br />
.zip - application/zip</p>
<p>够全的，以后就用这个了</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/12/%e5%b8%b8%e8%a7%81%e6%96%87%e4%bb%b6http%e4%b8%adcontent-type%e5%a4%b4%e5%80%bc%ef%bc%8dmime%e7%b1%bb%e5%9e%8b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Linux下与WinRar兼容的程序，rarlinux</title>
		<link>http://www.sunboyu.cn/2008/08/11/linux%e4%b8%8b%e4%b8%8ewinrar%e5%85%bc%e5%ae%b9%e7%9a%84%e7%a8%8b%e5%ba%8f%ef%bc%8crarlinux.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/11/linux%e4%b8%8b%e4%b8%8ewinrar%e5%85%bc%e5%ae%b9%e7%9a%84%e7%a8%8b%e5%ba%8f%ef%bc%8crarlinux.shtml#comments</comments>
		<pubDate>Mon, 11 Aug 2008 09:52:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[rar]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=275</guid>
		<description><![CDATA[要做个linux下与windows兼容的加密压包与解包工具，选择了rarlinux。
从这里下载 http://www.rarlab.com/rar/rarbsd-3.8.b4.tar.gz
下载后，直接tar解压，make安装，如果想自定义安装位置，可以修改Makefile文件。如果是自定义路径，那么把路径加入到PATH中。PATH=$PATH:/path export PATH
然后可以敲命令 rar,查看帮助。
查看压缩文件列表  rar l file.rar
解压缩一个文件 rar e file.tat
压缩一个文件 rar a target.rar soursefile
压缩一个文件并且加密码 tar a -p[password] target.rar soursefile
]]></description>
			<content:encoded><![CDATA[<p>要做个linux下与windows兼容的加密压包与解包工具，选择了rarlinux。</p>
<p>从这里下载 http://www.rarlab.com/rar/rarbsd-3.8.b4.tar.gz</p>
<p>下载后，直接tar解压，make安装，如果想自定义安装位置，可以修改Makefile文件。如果是自定义路径，那么把路径加入到PATH中。PATH=$PATH:/path export PATH</p>
<p>然后可以敲命令 rar,查看帮助。</p>
<p>查看压缩文件列表  rar l file.rar</p>
<p>解压缩一个文件 rar e file.tat</p>
<p>压缩一个文件 rar a target.rar soursefile</p>
<p>压缩一个文件并且加密码 tar a -p[password] target.rar soursefile</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/11/linux%e4%b8%8b%e4%b8%8ewinrar%e5%85%bc%e5%ae%b9%e7%9a%84%e7%a8%8b%e5%ba%8f%ef%bc%8crarlinux.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>SVN配置使用</title>
		<link>http://www.sunboyu.cn/2008/08/09/svn%e9%85%8d%e7%bd%ae%e4%bd%bf%e7%94%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/09/svn%e9%85%8d%e7%bd%ae%e4%bd%bf%e7%94%a8.shtml#comments</comments>
		<pubDate>Sat, 09 Aug 2008 08:16:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[svn]]></category>

		<category><![CDATA[配置]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=260</guid>
		<description><![CDATA[接这个 http://www.sunboyu.cn/2008/07/26/subversion-150-%E7%BC%96%E8%AF%91%E5%8F%82%E6%95%B0.shtml
安装完成后，可以建立仓库  svnadmin create /opt/$path
配置apache
&#60;Location /svn&#62;
DAV svn
SVNParentPath /opt/httpd-2.2.9/htdocs/repos
SVNListParentPath on
AuthzSVNAccessFile /opt/httpd-2.2.9/htdocs/repos/accessfile
Require valid-user
AuthType Basic
AuthName &#8220;Svn&#8221;
AuthUserFile /opt/httpd-2.2.9/htdocs/repos/passwordfile
&#60;/Location&#62;
生成password的方法 htpasswd -s /$file username
这样就可以建立一个密码文件，在httpd中调用。在调试的时候，权限是大事
]]></description>
			<content:encoded><![CDATA[<p>接这个 http://www.sunboyu.cn/2008/07/26/subversion-150-%E7%BC%96%E8%AF%91%E5%8F%82%E6%95%B0.shtml</p>
<p>安装完成后，可以建立仓库  svnadmin create /opt/$path</p>
<p>配置apache</p>
<p>&lt;Location /svn&gt;<br />
DAV svn<br />
SVNParentPath /opt/httpd-2.2.9/htdocs/repos<br />
SVNListParentPath on<br />
AuthzSVNAccessFile /opt/httpd-2.2.9/htdocs/repos/accessfile<br />
Require valid-user<br />
AuthType Basic<br />
AuthName &#8220;Svn&#8221;<br />
AuthUserFile /opt/httpd-2.2.9/htdocs/repos/passwordfile<br />
&lt;/Location&gt;</p>
<p>生成password的方法 htpasswd -s /$file username</p>
<p>这样就可以建立一个密码文件，在httpd中调用。在调试的时候，权限是大事</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/09/svn%e9%85%8d%e7%bd%ae%e4%bd%bf%e7%94%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>简单的div页面拖动效果</title>
		<link>http://www.sunboyu.cn/2008/08/07/%e7%ae%80%e5%8d%95%e7%9a%84div%e9%a1%b5%e9%9d%a2%e6%8b%96%e5%8a%a8%e6%95%88%e6%9e%9c.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/07/%e7%ae%80%e5%8d%95%e7%9a%84div%e9%a1%b5%e9%9d%a2%e6%8b%96%e5%8a%a8%e6%95%88%e6%9e%9c.shtml#comments</comments>
		<pubDate>Thu, 07 Aug 2008 15:33:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[JS]]></category>

		<category><![CDATA[拖动]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=250</guid>
		<description><![CDATA[这里主要是一些元素坐标的计算，不过我写这个东西不很兼容firefox，正在查找原因。
index
]]></description>
			<content:encoded><![CDATA[<p>这里主要是一些元素坐标的计算，不过我写这个东西不很兼容firefox，正在查找原因。<br />
<a href='http://www.sunboyu.cn/upfiles/2008/08/index.html'>index</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/07/%e7%ae%80%e5%8d%95%e7%9a%84div%e9%a1%b5%e9%9d%a2%e6%8b%96%e5%8a%a8%e6%95%88%e6%9e%9c.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>兼容ie，firefox的页面事件监听函数</title>
		<link>http://www.sunboyu.cn/2008/08/07/%e5%85%bc%e5%ae%b9ie%ef%bc%8cfirefox%e7%9a%84%e9%a1%b5%e9%9d%a2%e4%ba%8b%e4%bb%b6%e7%9b%91%e5%90%ac%e5%87%bd%e6%95%b0.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/07/%e5%85%bc%e5%ae%b9ie%ef%bc%8cfirefox%e7%9a%84%e9%a1%b5%e9%9d%a2%e4%ba%8b%e4%bb%b6%e7%9b%91%e5%90%ac%e5%87%bd%e6%95%b0.shtml#comments</comments>
		<pubDate>Thu, 07 Aug 2008 14:01:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[javescript]]></category>

		<category><![CDATA[JS]]></category>

		<category><![CDATA[监听]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=248</guid>
		<description><![CDATA[listenerevent
//for ff
if(document.addEventListener)
{	 
&#160;&#160; &#160;function __Eventadd ( element , eventType , handle )
	{
	&#160; &#160; element.addEventListener( eventType , handle , false );
	}
	function __Eventremove ( element , eventType , handle )
	{
	&#160; &#160; element.removeEventListener( eventType , handle , false );
	}
}
//for ie
else if(document.attachEvent)
{
&#160;&#160; &#160;function __Eventadd ( element , eventType , handle )
	{
	&#160; &#160; element.attachEvent( 'on'+eventType , handle );
	}
	function __Eventremove ( [...]]]></description>
			<content:encoded><![CDATA[<p><a href='http://www.sunboyu.cn/upfiles/2008/08/listenerevent.js'>listenerevent</a></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">//for ff</li>
<li>if(document.addEventListener)</li>
<li>{	 </li>
<li>&nbsp;&nbsp; &nbsp;function __Eventadd ( element , eventType , handle )</li>
<li>	{</li>
<li>	&nbsp; &nbsp; element.addEventListener( eventType , handle , false );</li>
<li>	}</li>
<li>	function __Eventremove ( element , eventType , handle )</li>
<li>	{</li>
<li>	&nbsp; &nbsp; element.removeEventListener( eventType , handle , false );</li>
<li>	}</li>
<li>}</li>
<li>//for ie</li>
<li>else if(document.attachEvent)</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;function __Eventadd ( element , eventType , handle )</li>
<li>	{</li>
<li>	&nbsp; &nbsp; element.attachEvent( 'on'+eventType , handle );</li>
<li>	}</li>
<li>	function __Eventremove ( element , eventType , handle )</li>
<li>	{</li>
<li>	&nbsp; &nbsp; element.detachEvent( 'on'+eventType , handle );</li>
<li>	}</li>
<li>}</li></ol></div>
<p>实际上，真正完全兼容还要很复杂的一个过程，这里也是简化到了只是能用的程度。具体请查看《JavaScript权威指南》第五版 414页</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/07/%e5%85%bc%e5%ae%b9ie%ef%bc%8cfirefox%e7%9a%84%e9%a1%b5%e9%9d%a2%e4%ba%8b%e4%bb%b6%e7%9b%91%e5%90%ac%e5%87%bd%e6%95%b0.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>完美的用户登录验证流程</title>
		<link>http://www.sunboyu.cn/2008/08/07/%e5%ae%8c%e7%be%8e%e7%9a%84%e7%94%a8%e6%88%b7%e7%99%bb%e5%bd%95%e9%aa%8c%e8%af%81%e6%b5%81%e7%a8%8b.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/07/%e5%ae%8c%e7%be%8e%e7%9a%84%e7%94%a8%e6%88%b7%e7%99%bb%e5%bd%95%e9%aa%8c%e8%af%81%e6%b5%81%e7%a8%8b.shtml#comments</comments>
		<pubDate>Thu, 07 Aug 2008 04:52:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[cookie]]></category>

		<category><![CDATA[session]]></category>

		<category><![CDATA[登录]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=246</guid>
		<description><![CDATA[
登  录  ────────── →  多域
↓
写 session  ────────── →  写cookie
↓                                          ＼
用户session列表  →  在线用户列表      cookie登录
＼  在线踢人
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2008/08/e69caae591bde5908d-1.gif"><img class="aligncenter size-full wp-image-247" title="登录验证控制流程" src="http://www.sunboyu.cn/upfiles/2008/08/e69caae591bde5908d-1.gif" alt="" width="434" height="118" /></a><br />
登  录  ────────── →  多域<br />
↓<br />
写 session  ────────── →  写cookie<br />
↓                                          ＼<br />
用户session列表  →  在线用户列表      cookie登录<br />
＼  在线踢人</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/07/%e5%ae%8c%e7%be%8e%e7%9a%84%e7%94%a8%e6%88%b7%e7%99%bb%e5%bd%95%e9%aa%8c%e8%af%81%e6%b5%81%e7%a8%8b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>几个JS函数，自家用，共享之</title>
		<link>http://www.sunboyu.cn/2008/08/04/%e5%87%a0%e4%b8%aajs%e5%87%bd%e6%95%b0%ef%bc%8c%e8%87%aa%e5%ae%b6%e7%94%a8%ef%bc%8c%e5%85%b1%e4%ba%ab%e4%b9%8b.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/04/%e5%87%a0%e4%b8%aajs%e5%87%bd%e6%95%b0%ef%bc%8c%e8%87%aa%e5%ae%b6%e7%94%a8%ef%bc%8c%e5%85%b1%e4%ba%ab%e4%b9%8b.shtml#comments</comments>
		<pubDate>Mon, 04 Aug 2008 10:45:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[JS]]></category>

		<category><![CDATA[window]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=243</guid>
		<description><![CDATA[检测浏览器类型，主要根据 userAgent关键字来确定
function __navigator()
{
&#160;&#160; &#160;this.value = false;&#160; &#160;//返回值&#160; ie 0 firefox 1 other 2
	this.useragent =&#160; navigator['userAgent'];
	if(this.useragent.indexOf('MSIE')&#62;0)
	{
	&#160; &#160; this.value = 0;
	}
	else if(this.useragent.indexOf('Firefox')&#62;0)
	{
	&#160; &#160; this.value = 1;
	}
	else
	{
	&#160; &#160; this.value = 2;
	}
}
获得浏览器相关信息
function __window()
{
&#160;&#160; &#160;this.innerwidth = 0;&#160; &#160;//document width
	this.innerheight = 0;	 //document height
&#160;
	this.outerwidth = 0;&#160; &#160;//browser width
	this.outerwidth = 0;&#160; &#160;//browser height
&#160;
	this.screenx = 0;&#160; &#160; &#160;//browser position x
	this.screeny = 0;	&#160; //browser [...]]]></description>
			<content:encoded><![CDATA[<p>检测浏览器类型，主要根据 userAgent关键字来确定</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">function __navigator()</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;this.value = false;&nbsp; &nbsp;//返回值&nbsp; ie 0 firefox 1 other 2</li>
<li>	this.useragent =&nbsp; navigator['userAgent'];</li>
<li>	if(this.useragent.indexOf('MSIE')&gt;0)</li>
<li>	{</li>
<li>	&nbsp; &nbsp; this.value = 0;</li>
<li>	}</li>
<li>	else if(this.useragent.indexOf('Firefox')&gt;0)</li>
<li>	{</li>
<li>	&nbsp; &nbsp; this.value = 1;</li>
<li>	}</li>
<li>	else</li>
<li>	{</li>
<li>	&nbsp; &nbsp; this.value = 2;</li>
<li>	}</li>
<li>}</li></ol></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">function __window()</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;this.innerwidth = 0;&nbsp; &nbsp;//document width</li>
<li>	this.innerheight = 0;	 //document height</li>
<li>&nbsp;</li>
<li>	this.outerwidth = 0;&nbsp; &nbsp;//browser width</li>
<li>	this.outerwidth = 0;&nbsp; &nbsp;//browser height</li>
<li>&nbsp;</li>
<li>	this.screenx = 0;&nbsp; &nbsp; &nbsp;//browser position x</li>
<li>	this.screeny = 0;	&nbsp; //browser position y</li>
<li>&nbsp;</li>
<li>&nbsp;&nbsp; &nbsp;/*@cc_on</li>
<li>	&nbsp; @if(@_jscript)</li>
<li>&nbsp;</li>
<li>	&nbsp; this.innerwidth = document.body.clientWidth;</li>
<li>	&nbsp; this.innerheight = document.body.clientHeight;</li>
<li>&nbsp;</li>
<li>	&nbsp; this.outerwidth = document.documentElement.clientWidth;</li>
<li>	&nbsp; this.outerheight = document.documentElement.clientHeight;</li>
<li>	&nbsp; </li>
<li>	&nbsp; this.screenx = window.screenLeft;</li>
<li>	&nbsp; this.screeny = window.screenTop;</li>
<li>&nbsp;</li>
<li>	&nbsp; @else*/</li>
<li>&nbsp;</li>
<li>	&nbsp; this.innerwidth = window.innerWidth;</li>
<li>	&nbsp; this.innerheight = window.innerHeight;</li>
<li>&nbsp;</li>
<li>	&nbsp; this.outerwidth = window.outerWidth;</li>
<li>	&nbsp; this.outerheight = window.outerHeight;</li>
<li>&nbsp;</li>
<li>	&nbsp; this.screenx = window.screenX;</li>
<li>	&nbsp; this.screeny = window.screenY;</li>
<li>	/*@end</li>
<li>	&nbsp; @*/</li>
<li>}</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/04/%e5%87%a0%e4%b8%aajs%e5%87%bd%e6%95%b0%ef%bc%8c%e8%87%aa%e5%ae%b6%e7%94%a8%ef%bc%8c%e5%85%b1%e4%ba%ab%e4%b9%8b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>JavaScript跨浏览器兼容代码</title>
		<link>http://www.sunboyu.cn/2008/08/03/javascript%e8%b7%a8%e6%b5%8f%e8%a7%88%e5%99%a8%e5%85%bc%e5%ae%b9%e4%bb%a3%e7%a0%81.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/03/javascript%e8%b7%a8%e6%b5%8f%e8%a7%88%e5%99%a8%e5%85%bc%e5%ae%b9%e4%bb%a3%e7%a0%81.shtml#comments</comments>
		<pubDate>Sun, 03 Aug 2008 14:58:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[JS]]></category>

		<category><![CDATA[兼容性]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=242</guid>
		<description><![CDATA[方法1：检测浏览器关键字
function __navigator()
{
&#160;&#160; &#160;this.value = false;&#160; &#160;//返回值&#160; ie 0 firefox 1 other 2
	this.useragent =&#160; navigator['userAgent'];
	if(this.useragent.indexOf('MSIE')&#62;0)
	{
	&#160; &#160; this.value = 0;
	}
	else if(this.useragent.indexOf('Firefox')&#62;0)
	{
	&#160; &#160; this.value = 1;
	}
	else
	{
	&#160; &#160; this.value = 2;
	}
}
方法2：
if(document.all)
&#160; ie
else
&#160; other
方法3：
&#60;!--[if IE]&#62;
&#160;&#160; &#160;js for ie
&#60;![endif]--&#62;
&#60;!--[if !IE]&#62;
&#160;&#160; &#160;js for !ie
&#60;![endif]--&#62;
方法4:
/*@cc_on
	&#160; @if(@_jscript)
	&#160; is for ie
	&#160; @else*/
	&#160; js for !ie
	/*@end
	&#160; @*/
]]></description>
			<content:encoded><![CDATA[<p>方法1：检测浏览器关键字</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">function __navigator()</li>
<li>{</li>
<li>&nbsp;&nbsp; &nbsp;this.value = false;&nbsp; &nbsp;//返回值&nbsp; ie 0 firefox 1 other 2</li>
<li>	this.useragent =&nbsp; navigator['userAgent'];</li>
<li>	if(this.useragent.indexOf('MSIE')&gt;0)</li>
<li>	{</li>
<li>	&nbsp; &nbsp; this.value = 0;</li>
<li>	}</li>
<li>	else if(this.useragent.indexOf('Firefox')&gt;0)</li>
<li>	{</li>
<li>	&nbsp; &nbsp; this.value = 1;</li>
<li>	}</li>
<li>	else</li>
<li>	{</li>
<li>	&nbsp; &nbsp; this.value = 2;</li>
<li>	}</li>
<li>}</li></ol></div>
<p>方法2：</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">if(document.all)</li>
<li>&nbsp; ie</li>
<li>else</li>
<li>&nbsp; other</li></ol></div>
<p>方法3：</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">&lt;!--[if IE]&gt;</li>
<li>&nbsp;&nbsp; &nbsp;js for ie</li>
<li>&lt;![endif]--&gt;</li>
<li>&lt;!--[if !IE]&gt;</li>
<li>&nbsp;&nbsp; &nbsp;js for !ie</li>
<li>&lt;![endif]--&gt;</li></ol></div>
<p>方法4:</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">/*@cc_on</li>
<li>	&nbsp; @if(@_jscript)</li>
<li>	&nbsp; is for ie</li>
<li>	&nbsp; @else*/</li>
<li>	&nbsp; js for !ie</li>
<li>	/*@end</li>
<li>	&nbsp; @*/</li></ol></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/03/javascript%e8%b7%a8%e6%b5%8f%e8%a7%88%e5%99%a8%e5%85%bc%e5%ae%b9%e4%bb%a3%e7%a0%81.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>VIM安装使用</title>
		<link>http://www.sunboyu.cn/2008/08/03/vim%e5%ae%89%e8%a3%85%e4%bd%bf%e7%94%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/08/03/vim%e5%ae%89%e8%a3%85%e4%bd%bf%e7%94%a8.shtml#comments</comments>
		<pubDate>Sun, 03 Aug 2008 07:37:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[vim]]></category>

		<category><![CDATA[安装]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=240</guid>
		<description><![CDATA[http://www.vim.org/
VIM，不错的编辑器，安装试试
http://www.vim.org/download.php
下载解压， tar -jxvf **.tar.bz2
./configure &#8211;with-tlib=ncurses  安装
如果报错，需要补充一个库  yum install ncurses ncurses-devel
vim手册  http://vcd.gro.clinux.org/
安装后，可以直接使用命令 vim
vim大体上跟vi编辑器一样，但增加了好多命令。
我比较喜欢的是高亮功能。
]]></description>
			<content:encoded><![CDATA[<p>http://www.vim.org/<br />
VIM，不错的编辑器，安装试试<br />
http://www.vim.org/download.php<br />
下载解压， tar -jxvf **.tar.bz2</p>
<p>./configure &#8211;with-tlib=ncurses  安装</p>
<p>如果报错，需要补充一个库  yum install ncurses ncurses-devel</p>
<p>vim手册  http://vcd.gro.clinux.org/</p>
<p>安装后，可以直接使用命令 vim</p>
<p>vim大体上跟vi编辑器一样，但增加了好多命令。</p>
<p>我比较喜欢的是高亮功能。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/08/03/vim%e5%ae%89%e8%a3%85%e4%bd%bf%e7%94%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>使用Mysql来存储Session</title>
		<link>http://www.sunboyu.cn/2008/07/31/%e4%bd%bf%e7%94%a8mysql%e6%9d%a5%e5%ad%98%e5%82%a8session.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/31/%e4%bd%bf%e7%94%a8mysql%e6%9d%a5%e5%ad%98%e5%82%a8session.shtml#comments</comments>
		<pubDate>Thu, 31 Jul 2008 14:39:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=236</guid>
		<description><![CDATA[接上篇，我们已经知道session的具体存储机制，我们来尝试修改一下这个机制，让数据存储在mysql数据库中。
mysql有三部分的内容，session session_data session_expires分别为session的id session的内容，session的过期时间。
创建这样一个数据库
CREATE TABLE IF NOT EXISTS `sessions` (
  `session` varchar(255) character set utf8 collate utf8_bin NOT NULL,
  `session_expires` int(10) unsigned NOT NULL default &#8216;0&#8242;,
  `session_data` mediumtext collate utf8_unicode_ci,
  KEY `session` (`session`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
相对于文件方式的session存储，这两个函数是不用动的
function open($save_path, $session_name)
{
  global $sess_save_path;
  $sess_save_path = $save_path;
  return(true);
}
function close()
{
  return(true);
}
而需要修改的是读，写，删，过期操作的函数
读的操作，很简单，只是从数据库中，根据sessionid，读出date字段中的内容
function [...]]]></description>
			<content:encoded><![CDATA[<p>接上篇，我们已经知道session的具体存储机制，我们来尝试修改一下这个机制，让数据存储在mysql数据库中。</p>
<p>mysql有三部分的内容，session session_data session_expires分别为session的id session的内容，session的过期时间。</p>
<p>创建这样一个数据库</p>
<p>CREATE TABLE IF NOT EXISTS `sessions` (<br />
  `session` varchar(255) character set utf8 collate utf8_bin NOT NULL,<br />
  `session_expires` int(10) unsigned NOT NULL default &#8216;0&#8242;,<br />
  `session_data` mediumtext collate utf8_unicode_ci,<br />
  KEY `session` (`session`)<br />
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;</p>
<p>相对于文件方式的session存储，这两个函数是不用动的<br />
function open($save_path, $session_name)<br />
{<br />
  global $sess_save_path;</p>
<p>  $sess_save_path = $save_path;<br />
  return(true);<br />
}</p>
<p>function close()<br />
{<br />
  return(true);<br />
}<br />
而需要修改的是读，写，删，过期操作的函数</p>
<p>读的操作，很简单，只是从数据库中，根据sessionid，读出date字段中的内容<br />
function read($sessID) {<br />
        global $php_errormsg;<br />
        // fetch session-data<br />
        $query = &#8221;<br />
            SELECT session_data FROM sessions<br />
            WHERE session = &#8216;$sessID&#8217;<br />
            AND session_expires ><br />
        &#8220;.time();<br />
        $result = $this->mdb2->query($query);<br />
        // return data or an empty string at failure<br />
        if (MDB2::isError($result)) {<br />
            $php_errormsg .= $result->getMessage();<br />
            $php_errormsg .= $result->getDebugInfo ();<br />
            return false;<br />
        }<br />
        list($value)=@$result->fetchrow();<br />
        return $value;<br />
    }<br />
同理，写的操作就是update数据，destory的操作为删除session的记录，另外有个gc的操作是删除过期的session。<br />
具体的代码没有去实现，但在PHP手册上都有。同时手册还介绍了memcache储存的方式，效率应该会不错的。</p>
<p>这是本月最后一篇日志，也算为下月找个题。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/31/%e4%bd%bf%e7%94%a8mysql%e6%9d%a5%e5%ad%98%e5%82%a8session.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP session机制详解</title>
		<link>http://www.sunboyu.cn/2008/07/31/php-session%e6%9c%ba%e5%88%b6%e8%af%a6%e8%a7%a3.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/31/php-session%e6%9c%ba%e5%88%b6%e8%af%a6%e8%a7%a3.shtml#comments</comments>
		<pubDate>Thu, 31 Jul 2008 12:27:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[session]]></category>

		<category><![CDATA[底层机制]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=235</guid>
		<description><![CDATA[http://cn.php.net/manual/en/function.session-set-save-handler.php
php的session函数非常好用，使用非常简单，$_SESSION[$name] = **  直接写session，而$_SESSION[$name]就可以直接读session。现在剖析一下简单背后，php是如何工作的。看上边的链接，
bool session_set_save_handler ( callback $open , callback $close , callback $read , callback $write , callback $destroy , callback $gc )
此函数有六个动作，关于session的初始化，结束，读，写，删，和超时处理。
open：初始化session存储路径信息。
close：关闭session。
read：读session的内容
write：写session的内容
destroy：删除session内容
gc：删除过期session
可以看这些函数实现，使用了file操作，在服务端写数据保存session。而这些数据以session专有的格式进行存储，类似cookie的，大家可以试着分解一下。
我找了个session，在editplus下打开 是这样的：
UserID&#124;s:1:&#8221;1&#8243;;UserName&#124;s:5:&#8221;admin&#8221;;
]]></description>
			<content:encoded><![CDATA[<p><a href="http://cn.php.net/manual/en/function.session-set-save-handler.php">http://cn.php.net/manual/en/function.session-set-save-handler.php</a></p>
<p>php的session函数非常好用，使用非常简单，$_SESSION[$name] = **  直接写session，而$_SESSION[$name]就可以直接读session。现在剖析一下简单背后，php是如何工作的。看上边的链接，</p>
<p><span class="type">bool</span> <span class="methodname"><strong><strong>session_set_save_handler</strong></strong></span> ( <span class="methodparam"><span class="type"><a class="type callback" href="http://cn.php.net/manual/en/language.pseudo-types.php#language.types.callback">callback</a></span> <tt class="parameter">$open</tt></span> , <span class="methodparam"><span class="type"><a class="type callback" href="http://cn.php.net/manual/en/language.pseudo-types.php#language.types.callback">callback</a></span> <tt class="parameter">$close</tt></span> , <span class="methodparam"><span class="type"><a class="type callback" href="http://cn.php.net/manual/en/language.pseudo-types.php#language.types.callback">callback</a></span> <tt class="parameter">$read</tt></span> , <span class="methodparam"><span class="type"><a class="type callback" href="http://cn.php.net/manual/en/language.pseudo-types.php#language.types.callback">callback</a></span> <tt class="parameter">$write</tt></span> , <span class="methodparam"><span class="type"><a class="type callback" href="http://cn.php.net/manual/en/language.pseudo-types.php#language.types.callback">callback</a></span> <tt class="parameter">$destroy</tt></span> , <span class="methodparam"><span class="type"><a class="type callback" href="http://cn.php.net/manual/en/language.pseudo-types.php#language.types.callback">callback</a></span> <tt class="parameter">$gc</tt></span> )</p>
<p>此函数有六个动作，关于session的初始化，结束，读，写，删，和超时处理。</p>
<p>open：初始化session存储路径信息。</p>
<p>close：关闭session。</p>
<p>read：读session的内容</p>
<p>write：写session的内容</p>
<p>destroy：删除session内容</p>
<p>gc：删除过期session</p>
<p>可以看这些函数实现，使用了file操作，在服务端写数据保存session。而这些数据以session专有的格式进行存储，类似cookie的，大家可以试着分解一下。</p>
<p>我找了个session，在editplus下打开 是这样的：</p>
<p>UserID|s:1:&#8221;1&#8243;;UserName|s:5:&#8221;admin&#8221;;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/31/php-session%e6%9c%ba%e5%88%b6%e8%af%a6%e8%a7%a3.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>一个操作Cookie的小程序</title>
		<link>http://www.sunboyu.cn/2008/07/30/%e4%b8%80%e4%b8%aa%e6%93%8d%e4%bd%9ccookie%e7%9a%84%e5%b0%8f%e7%a8%8b%e5%ba%8f.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/30/%e4%b8%80%e4%b8%aa%e6%93%8d%e4%bd%9ccookie%e7%9a%84%e5%b0%8f%e7%a8%8b%e5%ba%8f.shtml#comments</comments>
		<pubDate>Wed, 30 Jul 2008 14:57:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[cookie]]></category>

		<category><![CDATA[JS]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=231</guid>
		<description><![CDATA[simplecookie
&#60;br /&#62;
/*&#60;br /&#62;
&#160;&#160; &#160;一个简单的cookie操作函数，自家用&#60;br /&#62;
*/&#60;br /&#62;
function SetCookie()&#60;br /&#62;
{&#60;br /&#62;
&#160;&#160; &#160;var name = arguments[0];&#60;br /&#62;
	var value = arguments[1];&#60;br /&#62;
	//初始化默认存储时间&#60;br /&#62;
	var time = 3600;&#60;br /&#62;
	if(arguments[2]!=undefined)&#60;br /&#62;
	{&#60;br /&#62;
	&#160; &#160; time = arguments[2]&#60;br /&#62;
	}&#60;br /&#62;
	if(arguments[0]==undefined&#124;&#124;arguments[0]==undefined)&#60;br /&#62;
	{&#60;br /&#62;
	&#160; &#160; alert(&#34;SetCookie Has ERROR Agruments&#34;);&#60;br /&#62;
	}&#60;br /&#62;
	document.cookie = name+&#34;=&#34;+escape(value)+&#34; ; expires=&#34;+GetTime(time);&#60;br /&#62;
}&#60;br /&#62;
function GetCookie( name )&#60;br /&#62;
{&#60;br /&#62;
&#160;&#160; &#160;var arr = document.cookie.match(new [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2008/07/simplecookie.js">simplecookie</a></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">&lt;br /&gt;</li>
<li>/*&lt;br /&gt;</li>
<li>&nbsp;&nbsp; &nbsp;一个简单的cookie操作函数，自家用&lt;br /&gt;</li>
<li>*/&lt;br /&gt;</li>
<li>function SetCookie()&lt;br /&gt;</li>
<li>{&lt;br /&gt;</li>
<li>&nbsp;&nbsp; &nbsp;var name = arguments[0];&lt;br /&gt;</li>
<li>	var value = arguments[1];&lt;br /&gt;</li>
<li>	//初始化默认存储时间&lt;br /&gt;</li>
<li>	var time = 3600;&lt;br /&gt;</li>
<li>	if(arguments[2]!=undefined)&lt;br /&gt;</li>
<li>	{&lt;br /&gt;</li>
<li>	&nbsp; &nbsp; time = arguments[2]&lt;br /&gt;</li>
<li>	}&lt;br /&gt;</li>
<li>	if(arguments[0]==undefined||arguments[0]==undefined)&lt;br /&gt;</li>
<li>	{&lt;br /&gt;</li>
<li>	&nbsp; &nbsp; alert(&quot;SetCookie Has ERROR Agruments&quot;);&lt;br /&gt;</li>
<li>	}&lt;br /&gt;</li>
<li>	document.cookie = name+&quot;=&quot;+escape(value)+&quot; ; expires=&quot;+GetTime(time);&lt;br /&gt;</li>
<li>}&lt;br /&gt;</li>
<li>function GetCookie( name )&lt;br /&gt;</li>
<li>{&lt;br /&gt;</li>
<li>&nbsp;&nbsp; &nbsp;var arr = document.cookie.match(new RegExp(&quot;(^|)&quot;+name+&quot;=([^;]*)(;|$)&quot;));&lt;br /&gt;</li>
<li>	if(arr!=null)&lt;br /&gt;</li>
<li>	{&lt;br /&gt;</li>
<li>	&nbsp; &nbsp; return unescape(arr[2]);&lt;br /&gt;</li>
<li>	}&lt;br /&gt;</li>
<li>	else&lt;br /&gt;</li>
<li>	{&lt;br /&gt;</li>
<li>	&nbsp; &nbsp; return null;&lt;br /&gt;</li>
<li>	}&lt;br /&gt;</li>
<li>}&lt;br /&gt;</li>
<li>function DelCookie( name )&lt;br /&gt;</li>
<li>{&lt;br /&gt;</li>
<li>&nbsp;&nbsp; &nbsp;var value = GetCookie( name );&lt;br /&gt;</li>
<li>	if(value!=null)&lt;br /&gt;</li>
<li>	{&lt;br /&gt;</li>
<li>	&nbsp; &nbsp; document.cookie = name+&quot;=&quot;+escape(value)+&quot; ; expires=&quot;+GetTime( 0 );&lt;br /&gt;</li>
<li>	}&lt;br /&gt;</li>
<li>}&lt;br /&gt;</li>
<li>function GetTime( time )&lt;br /&gt;</li>
<li>{&lt;br /&gt;</li>
<li>&nbsp;&nbsp; &nbsp;var exp = new Date();&lt;br /&gt;</li>
<li>	exp.setTime( exp.getTime()+time*1000 );&lt;br /&gt;</li>
<li>	return exp.toGMTString();&lt;br /&gt;</li>
<li>}&lt;br /&gt;</li></ol></div></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/30/%e4%b8%80%e4%b8%aa%e6%93%8d%e4%bd%9ccookie%e7%9a%84%e5%b0%8f%e7%a8%8b%e5%ba%8f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>用户行为状态的持久化</title>
		<link>http://www.sunboyu.cn/2008/07/30/%e7%94%a8%e6%88%b7%e8%a1%8c%e4%b8%ba%e7%8a%b6%e6%80%81%e7%9a%84%e6%8c%81%e4%b9%85%e5%8c%96.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/30/%e7%94%a8%e6%88%b7%e8%a1%8c%e4%b8%ba%e7%8a%b6%e6%80%81%e7%9a%84%e6%8c%81%e4%b9%85%e5%8c%96.shtml#comments</comments>
		<pubDate>Wed, 30 Jul 2008 04:41:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[JS]]></category>

		<category><![CDATA[持久]]></category>

		<category><![CDATA[行为]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=230</guid>
		<description><![CDATA[用持久化这个词，有点拽文的意思，但必须找出一个形象的词汇来描述，暂且这么用。
用户行为持久，主要指保留用户行为状态，比如保存用户的登录信息，可以让用户不必每次输入密码。保留用户当前打开的页面，当前对客户端的操作等。
用户登录状态，主要应用cookie的方式把一些认证信息保存在本地，而其他信息的保留，同样可以使用cookie保存，比如框架的一些状态。
http://openoa.sunboyu.cn   这个网站中，可以看一下对用户行为持久的一些操作。首先是框架左侧菜单显示的控制。这个控制可以在刷新的时候保持用户的折叠状态，而不用每次刷新，都去折叠菜单。这个控制用cookie保存数据。
还有个操作，就是曾经另我很头疼的，大框架每刷新一次，主框架都会恢复默认的链接，也就是中间打开的页面会丢失。最近用js解决了这个问题，每次点击左侧菜单链接的时候，使用锚点标记的方式把链接写在url中，再次刷新的时候，根据url中的锚点确认主框架的链接。
这两个功能都完成了，用着还不错。
]]></description>
			<content:encoded><![CDATA[<p>用持久化这个词，有点拽文的意思，但必须找出一个形象的词汇来描述，暂且这么用。</p>
<p>用户行为持久，主要指保留用户行为状态，比如保存用户的登录信息，可以让用户不必每次输入密码。保留用户当前打开的页面，当前对客户端的操作等。</p>
<p>用户登录状态，主要应用cookie的方式把一些认证信息保存在本地，而其他信息的保留，同样可以使用cookie保存，比如框架的一些状态。</p>
<p>http://openoa.sunboyu.cn   这个网站中，可以看一下对用户行为持久的一些操作。首先是框架左侧菜单显示的控制。这个控制可以在刷新的时候保持用户的折叠状态，而不用每次刷新，都去折叠菜单。这个控制用cookie保存数据。</p>
<p>还有个操作，就是曾经另我很头疼的，大框架每刷新一次，主框架都会恢复默认的链接，也就是中间打开的页面会丢失。最近用js解决了这个问题，每次点击左侧菜单链接的时候，使用锚点标记的方式把链接写在url中，再次刷新的时候，根据url中的锚点确认主框架的链接。</p>
<p>这两个功能都完成了，用着还不错。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/30/%e7%94%a8%e6%88%b7%e8%a1%8c%e4%b8%ba%e7%8a%b6%e6%80%81%e7%9a%84%e6%8c%81%e4%b9%85%e5%8c%96.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>subversion-1.5.0 编译参数</title>
		<link>http://www.sunboyu.cn/2008/07/26/subversion-150-%e7%bc%96%e8%af%91%e5%8f%82%e6%95%b0.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/26/subversion-150-%e7%bc%96%e8%af%91%e5%8f%82%e6%95%b0.shtml#comments</comments>
		<pubDate>Sat, 26 Jul 2008 05:39:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[subversion]]></category>

		<category><![CDATA[svn]]></category>

		<category><![CDATA[参数]]></category>

		<category><![CDATA[编译]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=224</guid>
		<description><![CDATA[./configure &#8211;prefix=/opt/subversion &#8211;disable-all-static &#8211;with-apxs=/opt/httpd-2.2.9/bin/apxs &#8211;with-apr=/opt/httpd-2.2.9/bin/apr-1-config &#8211;with-apr-util=/opt/httpd-2.2.9/bin/apu-1-config &#8211;with-serf=/opt/httpd-2.2.9 &#8211;with-ssl &#8211;with-zlib=/usr/local &#8211;enable-dso &#8211;enable-mod-activation
如果编译不能通过，可能要安装 expat-1.95.8-8.2.1.i386.rpm expat-devel-1.95.8-8.2.1.i386.rpm 偷懒，直接rpm了
还有，dlname的问题，装这个 http://ftp.gnu.org/gnu/libtool/libtool-2.2.tar.gz
更正版 subversion1.5.0版本测试
./configure &#8211;prefix=/opt/subversion &#8211;disable-all-static &#8211;with-apxs=/opt/httpd-2.2.9/bin/apxs &#8211;with-apr=/opt/httpd-2.2.9/bin/apr-1-config &#8211;with-apr-util=/opt/httpd-2.2.9/bin/apu-1-config &#8211;with-serf=/opt/httpd-2.2.9 &#8211;with-ssl &#8211;with-zlib=/usr/local &#8211;enable-mod-activation &#8211;enable-runtime-module-search
./configure &#8211;prefix=/opt/subversion &#8211;disable-all-static &#8211;with-apxs=/opt/httpd-2.2.9/bin/apxs &#8211;with-apr=/opt/httpd-2.2.9/bin/apr-1-config &#8211;with-apr-util=/opt/httpd-2.2.9/bin/apu-1-config &#8211;with-serf=/opt/httpd-2.2.9 &#8211;with-ssl &#8211;with-zlib=/usr/local &#8211;enable-mod-activation &#8211;enable-runtime-module-search &#8211;enable-subdir-config &#8211;enable-experimental-libtool &#8211;enable-fast-install
]]></description>
			<content:encoded><![CDATA[<p>./configure &#8211;prefix=/opt/subversion &#8211;disable-all-static &#8211;with-apxs=/opt/httpd-2.2.9/bin/apxs &#8211;with-apr=/opt/httpd-2.2.9/bin/apr-1-config &#8211;with-apr-util=/opt/httpd-2.2.9/bin/apu-1-config &#8211;with-serf=/opt/httpd-2.2.9 &#8211;with-ssl &#8211;with-zlib=/usr/local &#8211;enable-dso &#8211;enable-mod-activation</p>
<p>如果编译不能通过，可能要安装 expat-1.95.8-8.2.1.i386.rpm expat-devel-1.95.8-8.2.1.i386.rpm 偷懒，直接rpm了</p>
<p>还有，dlname的问题，装这个 http://ftp.gnu.org/gnu/libtool/libtool-2.2.tar.gz<br />
更正版 subversion1.5.0版本测试<br />
./configure &#8211;prefix=/opt/subversion &#8211;disable-all-static &#8211;with-apxs=/opt/httpd-2.2.9/bin/apxs &#8211;with-apr=/opt/httpd-2.2.9/bin/apr-1-config &#8211;with-apr-util=/opt/httpd-2.2.9/bin/apu-1-config &#8211;with-serf=/opt/httpd-2.2.9 &#8211;with-ssl &#8211;with-zlib=/usr/local &#8211;enable-mod-activation &#8211;enable-runtime-module-search</p>
<p>./configure &#8211;prefix=/opt/subversion &#8211;disable-all-static &#8211;with-apxs=/opt/httpd-2.2.9/bin/apxs &#8211;with-apr=/opt/httpd-2.2.9/bin/apr-1-config &#8211;with-apr-util=/opt/httpd-2.2.9/bin/apu-1-config &#8211;with-serf=/opt/httpd-2.2.9 &#8211;with-ssl &#8211;with-zlib=/usr/local &#8211;enable-mod-activation &#8211;enable-runtime-module-search &#8211;enable-subdir-config &#8211;enable-experimental-libtool &#8211;enable-fast-install</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/26/subversion-150-%e7%bc%96%e8%af%91%e5%8f%82%e6%95%b0.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>sunboyu-amp-mod-V1.0 alpha</title>
		<link>http://www.sunboyu.cn/2008/07/26/sunboyu-amp-mod-v10-alpha.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/26/sunboyu-amp-mod-v10-alpha.shtml#comments</comments>
		<pubDate>Sat, 26 Jul 2008 05:37:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[amp]]></category>

		<category><![CDATA[mod]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=222</guid>
		<description><![CDATA[重新做了个模块版的，这次apache使用动态编译
sunboyu-amp-isapi-v10-alpha
]]></description>
			<content:encoded><![CDATA[<p>重新做了个模块版的，这次apache使用动态编译</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/07/sunboyu-amp-isapi-v10-alpha.txt">sunboyu-amp-isapi-v10-alpha</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/26/sunboyu-amp-mod-v10-alpha.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>sunboyu-amp-fastcgi-V1.0 Alpha版本发布</title>
		<link>http://www.sunboyu.cn/2008/07/24/sunboyu-amp-fastcgi-v10-alpha%e7%89%88%e6%9c%ac%e5%8f%91%e5%b8%83.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/24/sunboyu-amp-fastcgi-v10-alpha%e7%89%88%e6%9c%ac%e5%8f%91%e5%b8%83.shtml#comments</comments>
		<pubDate>Thu, 24 Jul 2008 06:04:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[alpha]]></category>

		<category><![CDATA[amp]]></category>

		<category><![CDATA[fastcgi]]></category>

		<category><![CDATA[LAMP]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=218</guid>
		<description><![CDATA[sunboyu-amp-fastcgi-v10-alpha
基本都配置完毕了，但整体流程没有彻底自动化，适当的时候会作出stable版本。
# author:sunboyu@gmail.com
# qq:176300676 msn:sunboyu@gmail.com
# http://www.sunboyu.cn
#!/bin/sh
h_path = &#8220;/root/&#8221;
url=&#8221;http://www.sunboyu.cn/sourse/&#8221;
install_dir=&#8221;/opt/&#8221;
mkdir $install_dir
termcap_sourse_name=&#8221;termcap-1.3.1&#8243;
mysql_sourse_name=&#8221;mysql-5.0.22&#8243;
mysql_install_dir=$install_dir$mysql_sourse_name
openssl_sourse_name=&#8221;openssl-0.9.8g&#8221;
openssl_install_dir=$install_dir$openssl_sourse_name
httpd_sourse_name=&#8221;httpd-2.2.9&#8243;
httpd_install_dir=$install_dir$httpd_sourse_name
fastcgi_sourse_name=&#8221;mod_fastcgi-2.4.6&#8243;
fastcgi_install_dir=$install_dir$fastcgi_sourse_name
fcgid_sourse_name=&#8221;mod_fcgid.2.2&#8243;
libxml2_sourse_name=&#8221;libxml2-2.6.30&#8243;
libxml2_install_dir=$install_dir$libxml2_sourse_name
zlib_sourse_name=&#8221;zlib-1.2.3&#8243;
jpeg_sourse_name=&#8221;jpegsrc.v6b&#8221;
jpeg_install_dir=$install_dir$jpeg_sourse_name
libpng_sourse_name=&#8221;libpng-1.2.29&#8243;
libpng_install_dir=$install_dir$libpng_sourse_name
freetype_sourse_name=&#8221;freetype-2.3.7&#8243;
freetype_install_dir=$install_dir$freetype_sourse_name
php_sourse_name=&#8221;php-5.2.6&#8243;
php_install_dir=$install_dir$php_sourse_name
gd_sourse_name=&#8221;gd-2.0.36RC1&#8243;
gd_install_dir=$install_dir$gd_sourse_name
###MYSQL依赖库
wget ${url}${termcap_sourse_name}&#8221;.tar.gz&#8221;
tar -zxvf $termcap_sourse_name&#8221;.tar.gz&#8221;
cd $termcap_sourse_name
./configure
make &#38;&#38; make install
cd ..
#rm -rf ${termcap_sourse_name}*
###openssl
wget ${url}${openssl_sourse_name}&#8221;.tar.gz&#8221;
tar -zxvf $openssl_sourse_name&#8221;.tar.gz&#8221;
cd $openssl_sourse_name
./Configure &#8211;prefix=$openssl_install_dir
make &#38;&#38; make install
cd ..
#rm -rf ${openssl_sourse_name}*
###libxml
wget ${url}${libxml2_sourse_name}&#8221;.tar.gz&#8221;
tar -zxvf $libxml2_sourse_name&#8221;.tar.gz&#8221;
cd $libxml2_sourse_name
./configure &#8211;prefix=$libxml2_install_dir
make &#38;&#38; make install
cd ..
#rm -rf ${libxml2_sourse_name}*
###zlib
wget ${url}${zlib_sourse_name}&#8221;.tar.gz&#8221;
tar -zxvf $zlib_sourse_name&#8221;.tar.gz&#8221;
cd $zlib_sourse_name
./configure
make &#38;&#38; make install
cd ..
cp /usr/lib/libz.so.1 /usr/lib/libz.so
#rm -rf ${zlib_sourse_name}*
###jpeg
wget ${url}${jpeg_sourse_name}&#8221;.tar.gz&#8221;
tar -zxvf $jpeg_sourse_name&#8221;.tar.gz&#8221;
cd [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2008/07/sunboyu-amp-fastcgi-v10-alpha.txt">sunboyu-amp-fastcgi-v10-alpha</a></p>
<p>基本都配置完毕了，但整体流程没有彻底自动化，适当的时候会作出stable版本。<br />
# author:sunboyu@gmail.com<br />
# qq:176300676 msn:sunboyu@gmail.com<br />
# http://www.sunboyu.cn</p>
<p>#!/bin/sh<br />
h_path = &#8220;/root/&#8221;<br />
url=&#8221;http://www.sunboyu.cn/sourse/&#8221;<br />
install_dir=&#8221;/opt/&#8221;<br />
mkdir $install_dir</p>
<p>termcap_sourse_name=&#8221;termcap-1.3.1&#8243;</p>
<p>mysql_sourse_name=&#8221;mysql-5.0.22&#8243;<br />
mysql_install_dir=$install_dir$mysql_sourse_name</p>
<p>openssl_sourse_name=&#8221;openssl-0.9.8g&#8221;<br />
openssl_install_dir=$install_dir$openssl_sourse_name</p>
<p>httpd_sourse_name=&#8221;httpd-2.2.9&#8243;<br />
httpd_install_dir=$install_dir$httpd_sourse_name</p>
<p>fastcgi_sourse_name=&#8221;mod_fastcgi-2.4.6&#8243;<br />
fastcgi_install_dir=$install_dir$fastcgi_sourse_name</p>
<p>fcgid_sourse_name=&#8221;mod_fcgid.2.2&#8243;</p>
<p>libxml2_sourse_name=&#8221;libxml2-2.6.30&#8243;<br />
libxml2_install_dir=$install_dir$libxml2_sourse_name</p>
<p>zlib_sourse_name=&#8221;zlib-1.2.3&#8243;</p>
<p>jpeg_sourse_name=&#8221;jpegsrc.v6b&#8221;<br />
jpeg_install_dir=$install_dir$jpeg_sourse_name</p>
<p>libpng_sourse_name=&#8221;libpng-1.2.29&#8243;<br />
libpng_install_dir=$install_dir$libpng_sourse_name</p>
<p>freetype_sourse_name=&#8221;freetype-2.3.7&#8243;<br />
freetype_install_dir=$install_dir$freetype_sourse_name</p>
<p>php_sourse_name=&#8221;php-5.2.6&#8243;<br />
php_install_dir=$install_dir$php_sourse_name</p>
<p>gd_sourse_name=&#8221;gd-2.0.36RC1&#8243;<br />
gd_install_dir=$install_dir$gd_sourse_name</p>
<p>###MYSQL依赖库<br />
wget ${url}${termcap_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $termcap_sourse_name&#8221;.tar.gz&#8221;<br />
cd $termcap_sourse_name<br />
./configure<br />
make &amp;&amp; make install<br />
cd ..<br />
#rm -rf ${termcap_sourse_name}*<br />
###openssl<br />
wget ${url}${openssl_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $openssl_sourse_name&#8221;.tar.gz&#8221;<br />
cd $openssl_sourse_name<br />
./Configure &#8211;prefix=$openssl_install_dir<br />
make &amp;&amp; make install<br />
cd ..<br />
#rm -rf ${openssl_sourse_name}*<br />
###libxml<br />
wget ${url}${libxml2_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $libxml2_sourse_name&#8221;.tar.gz&#8221;<br />
cd $libxml2_sourse_name<br />
./configure &#8211;prefix=$libxml2_install_dir<br />
make &amp;&amp; make install<br />
cd ..<br />
#rm -rf ${libxml2_sourse_name}*<br />
###zlib<br />
wget ${url}${zlib_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $zlib_sourse_name&#8221;.tar.gz&#8221;<br />
cd $zlib_sourse_name<br />
./configure<br />
make &amp;&amp; make install<br />
cd ..<br />
cp /usr/lib/libz.so.1 /usr/lib/libz.so<br />
#rm -rf ${zlib_sourse_name}*<br />
###jpeg<br />
wget ${url}${jpeg_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $jpeg_sourse_name&#8221;.tar.gz&#8221;<br />
cd jpeg-6b<br />
./configure<br />
mkdir /usr/local/man/<br />
mkdir /usr/local/man/man1/<br />
mkdir /usr/local/man/man1/cjpeg/<br />
make &amp;&amp; make install<br />
cp /usr/lib/libjpeg.so.62 /usr/lib/libjpeg.so<br />
cp jpeglib.h /usr/include/jpeglib.h<br />
cp jconfig.h /usr/include/jconfig.h<br />
cp jmorecfg.h /usr/include/jmorecfg.h<br />
cp jerror.h /usr/include/jerror.h<br />
cd ..<br />
#rm -rf ${jpeg_sourse_name}.tar.gz<br />
#rm -rf jpeg-6b<br />
###png<br />
wget ${url}${libpng_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $libpng_sourse_name&#8221;.tar.gz&#8221;<br />
cd $libpng_sourse_name<br />
./configure &#8211;prefix=$libpng_install_dir<br />
make &amp;&amp; make install<br />
cp png* /usr/include/<br />
cd ..<br />
#rm -rf ${libpng_sourse_name}*<br />
###freetype<br />
wget ${url}${freetype_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $freetype_sourse_name&#8221;.tar.gz&#8221;<br />
cd $freetype_sourse_name<br />
./configure &#8211;prefix=$freetype_install_dir<br />
make &amp;&amp; make install<br />
cd ..<br />
#rm -rf ${freetype_sourse_name}*<br />
###GD2<br />
wget ${url}${gd_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $gd_sourse_name&#8221;.tar.gz&#8221;<br />
cd $gd_sourse_name<br />
./configure &#8211;prefix=$gd_install_dir &#8211;with-png=/opt/libpng-1.2.29 &#8211;with-freetype=/opt/freetype-2.3.7 &#8211;with-jpeg=/usr/lib/libjpeg.so<br />
make &amp;&amp; make install<br />
cd ..<br />
#rm -rf ${gd_sourse_name}*<br />
###MYSQL<br />
groupadd mysql<br />
useradd -g mysql mysql<br />
wget ${url}${mysql_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $mysql_sourse_name&#8221;.tar.gz&#8221;<br />
cd $mysql_sourse_name<br />
./configure &#8211;prefix=$mysql_install_dir &#8211;without-debug &#8211;with-unix-socket-path=/tmp/mysql.sock &#8211;with-client-ldflags=-all-static &#8211;with-mysqld-ldflags=-all-static &#8211;enable-local-infile &#8211;enable-largefile &#8211;with-charset=utf8 &#8211;with-pic &#8211;with-mysqld-libs &#8211;with-comment &#8211;with-query-cache &#8211;with-bench &#8211;with-big-tables &#8211;with-innodb &#8211;with-mysqld-use=mysql<br />
make &amp;&amp; make install<br />
cp ./support-files/my-medium.cnf /etc/my.cnf<br />
cp ./support-files/mysql.server /etc/init.d/mysqld<br />
cd ..<br />
#mkdir $mysql_install_dir/var/<br />
#$mysql_install_dir/bin/mysql_install_db &#8211;user=mysql &amp;<br />
#$mysql_install_dir/bin/mysqld_safe &#8211;user=mysql &amp;</p>
<p>echo ${mysql_install_dir}&#8221;/bin/mysqld_safe &#8211;user=mysql &amp;&#8221;&gt;&gt;/etc/rc.local<br />
#rm -rf ${mysql_sourse_name}*<br />
###APACHE<br />
wget ${url}${httpd_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $httpd_sourse_name&#8221;.tar.gz&#8221;<br />
cd $httpd_sourse_name<br />
./configure &#8211;prefix=$httpd_install_dir &#8211;enable-authz-dbm &#8211;enable-log-config &#8211;enable-headers &#8211;enable-setenvif &#8211;with-ssl=$openssl_install_dir &#8211;enable-static-ab &#8211;enable-http &#8211;enable-mime &#8211;enable-status &#8211;enable-suexec &#8211;enable-vhost-alias &#8211;enable-dir &#8211;enable-rewrite &#8211;with-mpm=worker<br />
make &amp;&amp; make install<br />
cd ..<br />
ln -s $httpd_install_dir/bin/apachectl /etc/init.d/httpd<br />
echo $httpd_install_dir/bin/apachectl start&gt;&gt;/etc/rc.local<br />
chkconfig &#8211;level 345 httpd on<br />
#rm -rf ${httpd_sourse_name}*<br />
###fastcgi<br />
wget ${url}${fastcgi_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $fastcgi_sourse_name&#8221;.tar.gz&#8221;<br />
cd $fastcgi_sourse_name<br />
sed &#8217;s/\/usr\/local\/apache2/\/opt\/httpd-2.2.9\//g&#8217; Makefile.AP2 &gt; Makefile<br />
make &amp;&amp; make install<br />
cd ..<br />
###fcgid<br />
wget ${url}${fcgid_sourse_name}&#8221;.tgz&#8221;<br />
tar -zxvf $fcgid_sourse_name&#8221;.tgz&#8221;<br />
cd $fcgid_sourse_name<br />
mv Makefile Makefile.AP2<br />
sed &#8217;s/\/usr\/local\/apache2/\/opt\/httpd-2.2.9\//g&#8217; Makefile.AP2 &gt; Makefile<br />
make &amp;&amp; make install<br />
cd ..<br />
echo LoadModule fcgid_module modules/mod_fcgid.so&gt;&gt;$httpd_install_dir/conf/httpd.conf<br />
echo AddHandler fcgid-script .php&gt;&gt;$httpd_install_dir/conf/httpd.conf<br />
echo &#8220;FCGIWrapper &#8220;${php_install_dir}&#8221;/bin/php-cgi .php&#8221;&gt;&gt;$httpd_install_dir/conf/httpd.conf<br />
#rm -rf ${fastcgi_sourse_name}*<br />
###PHP<br />
wget ${url}${php_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $php_sourse_name&#8221;.tar.gz&#8221;<br />
cd $php_sourse_name<br />
cp php.ini-dist php.ini<br />
./configure &#8211;prefix=$php_install_dir &#8211;with-libxml-dir=$libxml2_install_dir &#8211;enable-cli &#8211;enable-cgi &#8211;enable-fastcgi &#8211;enable-force-cgi-redirect &#8211;enable-discard-path &#8211;enable-path-info-check &#8211;with-openssl &#8211;with-pcre-regex &#8211;enable-calendar &#8211;enable-dom &#8211;enable-ftp &#8211;with-openssl-dir=/usr/local/ssl &#8211;enable-gd-jis-conv &#8211;enable-hash &#8211;with-iconv &#8211;enable-json &#8211;enable-mbstring &#8211;enable-mbregex &#8211;enable-pdo &#8211;enable-posix &#8211;enable-libxml=$xml2_install_dir &#8211;enable-simplexml &#8211;with-sqlite &#8211;enable-tokenizer &#8211;enable-xmlreader &#8211;enable-xmlwriter &#8211;with-zlib &#8211;with-freetype-dir=$freetype_install_dir &#8211;with-gd=$gd_install_dir &#8211;with-jpeg-dir=/usr/lib/libjpeg.so &#8211;with-libpng-dir=/opt/libpng-1.2.29/lib/libpng12.so &#8211;with-zlib-dir=/usr/lib/libz.so &#8211;with-mime-magic &#8211;with-mysql=$mysql_install_dir &#8211;with-zlib-dir=/usr/lib/libz.so &#8211;with-pdo-mysql=$mysql_install_dir &#8211;with-pdo-sqlite &#8211;enable-posix &#8211;enable-soap<br />
make &amp;&amp; make install<br />
cp php.ini $php_install_dir/lib/<br />
cd ..<br />
$mysql_install_dir/bin/mysql_install_db &#8211;user=mysql &amp;</p>
<p>service httpd start<br />
service mysqld start</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/24/sunboyu-amp-fastcgi-v10-alpha%e7%89%88%e6%9c%ac%e5%8f%91%e5%b8%83.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>amp-fastcgi版本基本完成，部分配置未做兼容性测试</title>
		<link>http://www.sunboyu.cn/2008/07/23/amp-fastcgi%e7%89%88%e6%9c%ac%e5%9f%ba%e6%9c%ac%e5%ae%8c%e6%88%90%ef%bc%8c%e9%83%a8%e5%88%86%e9%85%8d%e7%bd%ae%e6%9c%aa%e5%81%9a%e5%85%bc%e5%ae%b9%e6%80%a7%e6%b5%8b%e8%af%95.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/23/amp-fastcgi%e7%89%88%e6%9c%ac%e5%9f%ba%e6%9c%ac%e5%ae%8c%e6%88%90%ef%bc%8c%e9%83%a8%e5%88%86%e9%85%8d%e7%bd%ae%e6%9c%aa%e5%81%9a%e5%85%bc%e5%ae%b9%e6%80%a7%e6%b5%8b%e8%af%95.shtml#comments</comments>
		<pubDate>Wed, 23 Jul 2008 15:23:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[amp]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=214</guid>
		<description><![CDATA[autoamp-fastcgi
底下要做一个模块安装php的版本
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2008/07/autoamp-fastcgi.rar">autoamp-fastcgi</a></p>
<p>底下要做一个模块安装php的版本</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/23/amp-fastcgi%e7%89%88%e6%9c%ac%e5%9f%ba%e6%9c%ac%e5%ae%8c%e6%88%90%ef%bc%8c%e9%83%a8%e5%88%86%e9%85%8d%e7%bd%ae%e6%9c%aa%e5%81%9a%e5%85%bc%e5%ae%b9%e6%80%a7%e6%b5%8b%e8%af%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Apache2 PHP5 FastCgi配置终于完成</title>
		<link>http://www.sunboyu.cn/2008/07/23/apache2-php5-fastcgi%e9%85%8d%e7%bd%ae%e7%bb%88%e4%ba%8e%e5%ae%8c%e6%88%90.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/23/apache2-php5-fastcgi%e9%85%8d%e7%bd%ae%e7%bb%88%e4%ba%8e%e5%ae%8c%e6%88%90.shtml#comments</comments>
		<pubDate>Wed, 23 Jul 2008 14:12:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[fastcgi]]></category>

		<category><![CDATA[fcgid]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=213</guid>
		<description><![CDATA[这次是使用的mod_fastcgi的一个替代品：fcgid http://fastcgi.coremail.cn/ 在功能上完全可以取代fastcgi,在性能和稳定性上还优于fastcgi（据说），不过配置起来也比fastcgi的简单，只需要加上 loadmodule fcgid_module SetHandler fcgid-script
FCGIWrapper /usr/local/bin/php-cgi .php 即可。
权限方面，呵呵，还没有测试。留档，加到我的amp的shell里。
LoadModule fcgid_module modules/mod_fcgid.so
AddHandler fcgid-script .php
FCGIWrapper /opt/php5/bin/php-cgi .php
]]></description>
			<content:encoded><![CDATA[<p>这次是使用的mod_fastcgi的一个替代品：fcgid http://fastcgi.coremail.cn/ 在功能上完全可以取代fastcgi,在性能和稳定性上还优于fastcgi（据说），不过配置起来也比fastcgi的简单，只需要加上 loadmodule fcgid_module SetHandler fcgid-script<br />
FCGIWrapper /usr/local/bin/php-cgi .php 即可。<br />
权限方面，呵呵，还没有测试。留档，加到我的amp的shell里。</p>
<p>LoadModule fcgid_module modules/mod_fcgid.so<br />
AddHandler fcgid-script .php<br />
FCGIWrapper /opt/php5/bin/php-cgi .php</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/23/apache2-php5-fastcgi%e9%85%8d%e7%bd%ae%e7%bb%88%e4%ba%8e%e5%ae%8c%e6%88%90.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>在windows在安装FreeTDS，让mssql支持UTF-8</title>
		<link>http://www.sunboyu.cn/2008/07/22/%e5%9c%a8windows%e5%9c%a8%e5%ae%89%e8%a3%85freetds%ef%bc%8c%e8%ae%a9mssql%e6%94%af%e6%8c%81utf-8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/22/%e5%9c%a8windows%e5%9c%a8%e5%ae%89%e8%a3%85freetds%ef%bc%8c%e8%ae%a9mssql%e6%94%af%e6%8c%81utf-8.shtml#comments</comments>
		<pubDate>Tue, 22 Jul 2008 07:27:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[freetds]]></category>

		<category><![CDATA[mssql]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[utf-8]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=209</guid>
		<description><![CDATA[本人有个项目使用php+mssql，而mssql只支持gb2312和utf-16编码，而php又要求使用utf-8编码，想到了freetds.而freetds是个在unix下开发的工具，我下载freetds最新版后，发现里边有windows下的编译脚本，在DEV-C++里进行编译后，不支持，后又从鬼子论坛里找到达人编译好的组件，安装配置后，正常，大喜。
; Specify client character set.
; If empty or not set the client charset from freetds.comf is used
; This is only used when compiled with FreeTDS
mssql.charset = &#8220;UTF-8&#8243;
在php.ini里设置这里，即可让FreeTDS生效。This is only used when compiled with FreeTDS。mssql默认是不支持设置字符集的，只有安装freetds的时候才能生效。
其实，PHP官方早就在系统里留出了freetds的接口，windows下的PHP.INI文件就为freetds留出接口参数。
在linux下，编译php的时候，有这样的日志
configure:68696: checking whether to enable pcntl support
configure:69264: checking whether to enable PDO support
configure:69689: checking for PDO_DBLIB support via FreeTDS
configure:70399: checking for Firebird [...]]]></description>
			<content:encoded><![CDATA[<p>本人有个项目使用php+mssql，而mssql只支持gb2312和utf-16编码，而php又要求使用utf-8编码，想到了freetds.而freetds是个在unix下开发的工具，我下载freetds最新版后，发现里边有windows下的编译脚本，在DEV-C++里进行编译后，不支持，后又从鬼子论坛里找到达人编译好的组件，安装配置后，正常，大喜。</p>
<p>; Specify client character set.<br />
; If empty or not set the client charset from freetds.comf is used<br />
; This is only used when compiled with FreeTDS<br />
mssql.charset = &#8220;UTF-8&#8243;</p>
<p>在php.ini里设置这里，即可让FreeTDS生效。This is only used when compiled with FreeTDS。mssql默认是不支持设置字符集的，只有安装freetds的时候才能生效。</p>
<p>其实，PHP官方早就在系统里留出了freetds的接口，windows下的PHP.INI文件就为freetds留出接口参数。</p>
<p>在linux下，编译php的时候，有这样的日志</p>
<p>configure:68696: checking whether to enable pcntl support<br />
configure:69264: checking whether to enable PDO support<br />
configure:69689: checking for PDO_DBLIB support via FreeTDS<br />
configure:70399: checking for Firebird support for PDO</p>
<p>在linux下，同样为php留出了接口</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/22/%e5%9c%a8windows%e5%9c%a8%e5%ae%89%e8%a3%85freetds%ef%bc%8c%e8%ae%a9mssql%e6%94%af%e6%8c%81utf-8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>amp自动安装脚本安装部分已经完成</title>
		<link>http://www.sunboyu.cn/2008/07/22/amp%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac%e5%ae%89%e8%a3%85%e9%83%a8%e5%88%86%e5%b7%b2%e7%bb%8f%e5%ae%8c%e6%88%90.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/22/amp%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac%e5%ae%89%e8%a3%85%e9%83%a8%e5%88%86%e5%b7%b2%e7%bb%8f%e5%ae%8c%e6%88%90.shtml#comments</comments>
		<pubDate>Tue, 22 Jul 2008 04:04:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[apm]]></category>

		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=207</guid>
		<description><![CDATA[做个版本存档
myshell_demo
]]></description>
			<content:encoded><![CDATA[<p>做个版本存档</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/07/myshell_demo1e5ae8ce7be8ee78988.rar">myshell_demo</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/22/amp%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac%e5%ae%89%e8%a3%85%e9%83%a8%e5%88%86%e5%b7%b2%e7%bb%8f%e5%ae%8c%e6%88%90.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>gd库的编译配置－临时笔记</title>
		<link>http://www.sunboyu.cn/2008/07/18/gd%e5%ba%93%e7%9a%84%e7%bc%96%e8%af%91%e9%85%8d%e7%bd%ae%ef%bc%8d%e4%b8%b4%e6%97%b6%e7%ac%94%e8%ae%b0.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/18/gd%e5%ba%93%e7%9a%84%e7%bc%96%e8%af%91%e9%85%8d%e7%bd%ae%ef%bc%8d%e4%b8%b4%e6%97%b6%e7%ac%94%e8%ae%b0.shtml#comments</comments>
		<pubDate>Fri, 18 Jul 2008 02:23:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=201</guid>
		<description><![CDATA[./configure &#8211;with-jpeg-dir=/usr/lib/libjpeg.so -with-png=/usr/lib/libpng.so &#8211;with-freetype=/opt/freetype-2.3.7
前提 cp jpeglib.h /usr/include/jpeglib.h
[root@localhost jpeg-6b]# cp jconfig.h /usr/include/jconfig.h
[root@localhost jpeg-6b]# cp jmorecfg.h /usr/include/jmorecfg.h
[root@localhost jpeg-6b]# cp jerror.h /usr/include/jerror.h
cp png* /usr/include/
网上看了好多，结果都不对，倒是一个写python的哥们的笔记提醒了我。
那些缺失的库其实都在源码包里，只不过安装的时候没有复制到系统库目录下，手工拷贝过去就可以了。
检查一下configure，是不是有参数，指定是否拷贝.
]]></description>
			<content:encoded><![CDATA[<p>./configure &#8211;with-jpeg-dir=/usr/lib/libjpeg.so -with-png=/usr/lib/libpng.so &#8211;with-freetype=/opt/freetype-2.3.7</p>
<p>前提 cp jpeglib.h /usr/include/jpeglib.h<br />
[root@localhost jpeg-6b]# cp jconfig.h /usr/include/jconfig.h<br />
[root@localhost jpeg-6b]# cp jmorecfg.h /usr/include/jmorecfg.h<br />
[root@localhost jpeg-6b]# cp jerror.h /usr/include/jerror.h</p>
<p>cp png* /usr/include/</p>
<p>网上看了好多，结果都不对，倒是一个写python的哥们的笔记提醒了我。<br />
那些缺失的库其实都在源码包里，只不过安装的时候没有复制到系统库目录下，手工拷贝过去就可以了。<br />
检查一下configure，是不是有参数，指定是否拷贝.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/18/gd%e5%ba%93%e7%9a%84%e7%bc%96%e8%af%91%e9%85%8d%e7%bd%ae%ef%bc%8d%e4%b8%b4%e6%97%b6%e7%ac%94%e8%ae%b0.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>LAMP自动安装脚本</title>
		<link>http://www.sunboyu.cn/2008/07/15/lamp%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/15/lamp%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac.shtml#comments</comments>
		<pubDate>Tue, 15 Jul 2008 15:08:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[LAMP]]></category>

		<category><![CDATA[shell]]></category>

		<category><![CDATA[自动脚本]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=200</guid>
		<description><![CDATA[mysql，apache的基本搞定了，php的还有很多问题，先放出这些代码，方便自己操作。PHP部分正在调试。
#!/bin/sh
h_path = &#8220;/root/&#8221;
url=&#8221;http://www.sunboyu.cn/sourse/&#8221;
install_dir=&#8221;/opt/&#8221;
mkdir $install_dir
termcap_sourse_name=&#8221;termcap-1.3.1&#8243;
mysql_sourse_name=&#8221;mysql-5.0.22&#8243;
mysql_install_dir=$install_dir$mysql_sourse_name
openssl_sourse_name=&#8221;openssl-0.9.8g&#8221;
openssl_install_dir=$install_dir$openssl_sourse_name
httpd_sourse_name=&#8221;httpd-2.2.9&#8243;
httpd_install_dir=$install_dir$httpd_sourse_name
fastcgi_sourse_name=&#8221;mod_fastcgi-2.4.6&#8243;
fastcgi_install_dir=$install_dir$fastcgi_sourse_name
libxml2_sourse_name=&#8221;libxml2-2.6.30&#8243;
libxml2_install_dir=$install_dir$libxml2_sourse_name
zlib_sourse_name=&#8221;zlib-1.2.3&#8243;
zlib_install_dir=$install_dir$zlib_sourse_name
jpeg_sourse_name=&#8221;jpegsrc.v6b&#8221;
jpeg_install_dir=$install_dir$jpeg_sourse_name
libpng_sourse_name=&#8221;libpng-1.2.29&#8243;
libpng_install_dir=$install_dir$libpng_sourse_name
freetype_sourse_name=&#8221;freetype-2.3.7&#8243;
freetype_install_dir=$install_dir$freetype_sourse_name
php_sourse_name=&#8221;php-5.2.6&#8243;
php_install_dir=$install_dir$php_sourse_name
###MYSQL
wget ${url}${termcap_sourse_name}&#8221;.tar.gz&#8221;
tar -zxvf $termcap_sourse_name&#8221;.tar.gz&#8221;
cd $termcap_sourse_name
./configure
make &#38;&#38; make install
cd ..
rm -rf ${termcap_sourse_name}*
groupadd mysql
useradd -g mysql mysql
wget ${url}${mysql_sourse_name}&#8221;.tar.gz&#8221;
tar -zxvf $mysql_sourse_name&#8221;.tar.gz&#8221;
cd $mysql_sourse_name
./configure &#8211;prefix=$mysql_install_dir &#8211;enable-thread-safe-client &#8211;enable-local-infile &#8211;enable-largefile &#8211;with-charset=utf8 &#8211;with-uca &#8211;with-gnu-ld &#8211;with-pic &#8211;with-mysqld-libs &#8211;with-comment &#8211;with-query-cache &#8211;with-bench &#8211;with-big-tables &#8211;with-innodb &#8211;with-mysqld-use=mysql
make &#38;&#38; make install
cd ..
rm -rf ${mysql_sourse_name}*
###APACHE
wget ${url}${openssl_sourse_name}&#8221;.tar.gz&#8221;
tar -zxvf $openssl_sourse_name&#8221;.tar.gz&#8221;
cd $openssl_sourse_name
./configure &#8211;prefix=$openssl_install_dir
make &#38;&#38; make install
cd ..
rm -rf ${openssl_sourse_name}*
wget ${url}${httpd_sourse_name}&#8221;.tar.gz&#8221;
tar [...]]]></description>
			<content:encoded><![CDATA[<p>mysql，apache的基本搞定了，php的还有很多问题，先放出这些代码，方便自己操作。PHP部分正在调试。</p>
<p>#!/bin/sh<br />
h_path = &#8220;/root/&#8221;<br />
url=&#8221;http://www.sunboyu.cn/sourse/&#8221;<br />
install_dir=&#8221;/opt/&#8221;<br />
mkdir $install_dir</p>
<p>termcap_sourse_name=&#8221;termcap-1.3.1&#8243;</p>
<p>mysql_sourse_name=&#8221;mysql-5.0.22&#8243;<br />
mysql_install_dir=$install_dir$mysql_sourse_name</p>
<p>openssl_sourse_name=&#8221;openssl-0.9.8g&#8221;<br />
openssl_install_dir=$install_dir$openssl_sourse_name</p>
<p>httpd_sourse_name=&#8221;httpd-2.2.9&#8243;<br />
httpd_install_dir=$install_dir$httpd_sourse_name</p>
<p>fastcgi_sourse_name=&#8221;mod_fastcgi-2.4.6&#8243;<br />
fastcgi_install_dir=$install_dir$fastcgi_sourse_name</p>
<p>libxml2_sourse_name=&#8221;libxml2-2.6.30&#8243;<br />
libxml2_install_dir=$install_dir$libxml2_sourse_name</p>
<p>zlib_sourse_name=&#8221;zlib-1.2.3&#8243;<br />
zlib_install_dir=$install_dir$zlib_sourse_name</p>
<p>jpeg_sourse_name=&#8221;jpegsrc.v6b&#8221;<br />
jpeg_install_dir=$install_dir$jpeg_sourse_name</p>
<p>libpng_sourse_name=&#8221;libpng-1.2.29&#8243;<br />
libpng_install_dir=$install_dir$libpng_sourse_name</p>
<p>freetype_sourse_name=&#8221;freetype-2.3.7&#8243;<br />
freetype_install_dir=$install_dir$freetype_sourse_name</p>
<p>php_sourse_name=&#8221;php-5.2.6&#8243;<br />
php_install_dir=$install_dir$php_sourse_name</p>
<p>###MYSQL<br />
wget ${url}${termcap_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $termcap_sourse_name&#8221;.tar.gz&#8221;<br />
cd $termcap_sourse_name<br />
./configure<br />
make &amp;&amp; make install<br />
cd ..<br />
rm -rf ${termcap_sourse_name}*</p>
<p>groupadd mysql<br />
useradd -g mysql mysql</p>
<p>wget ${url}${mysql_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $mysql_sourse_name&#8221;.tar.gz&#8221;<br />
cd $mysql_sourse_name<br />
./configure &#8211;prefix=$mysql_install_dir &#8211;enable-thread-safe-client &#8211;enable-local-infile &#8211;enable-largefile &#8211;with-charset=utf8 &#8211;with-uca &#8211;with-gnu-ld &#8211;with-pic &#8211;with-mysqld-libs &#8211;with-comment &#8211;with-query-cache &#8211;with-bench &#8211;with-big-tables &#8211;with-innodb &#8211;with-mysqld-use=mysql<br />
make &amp;&amp; make install<br />
cd ..<br />
rm -rf ${mysql_sourse_name}*</p>
<p>###APACHE</p>
<p>wget ${url}${openssl_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $openssl_sourse_name&#8221;.tar.gz&#8221;<br />
cd $openssl_sourse_name<br />
./configure &#8211;prefix=$openssl_install_dir<br />
make &amp;&amp; make install<br />
cd ..<br />
rm -rf ${openssl_sourse_name}*</p>
<p>wget ${url}${httpd_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $httpd_sourse_name&#8221;.tar.gz&#8221;<br />
cd $httpd_sourse_name<br />
./configure &#8211;prefix=$httpd_install_dir &#8211;enable-authz-dbm &#8211;enable-log-config &#8211;enable-headers &#8211;enable-setenvif &#8211;with-ssl=$openssl_install_dir &#8211;enable-static-ab &#8211;enable-http &#8211;enable-mime &#8211;enable-status &#8211;enable-suexec &#8211;enable-vhost-alias &#8211;enable-dir &#8211;enable-rewrite &#8211;with-mpm=worker<br />
make &amp;&amp; make install<br />
cd ..<br />
rm -rf ${httpd_sourse_name}*</p>
<p>wget ${url}${fastcgi_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $fastcgi_sourse_name&#8221;.tar.gz&#8221;<br />
cd $fastcgi_sourse_name<br />
sed &#8217;s/\/usr\/local\/apache2/\/opt\/httpd-2.2.9\//g&#8217; Makefile.AP2 &gt; Makefile<br />
make &amp;&amp; make install<br />
cd ..<br />
rm -rf ${fastcgi_sourse_name}*</p>
<p>###PHP<br />
wget ${url}${libxml2_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $libxml2_sourse_name&#8221;.tar.gz&#8221;<br />
cd $libxml2_sourse_name<br />
./configure &#8211;prefix=$libxml2_install_dir<br />
make &amp;&amp; make install<br />
cd ..<br />
rm -rf ${libxml2_sourse_name}*</p>
<p>wget ${url}${zlib_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $zlib_sourse_name&#8221;.tar.gz&#8221;<br />
cd $zlib_sourse_name<br />
./configure &#8211;prefix=$zlib_install_dir<br />
make &amp;&amp; make install<br />
cd ..<br />
rm -rf ${zlib_sourse_name}*</p>
<p>wget ${url}${jpeg_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $jpeg_sourse_name&#8221;.tar.gz&#8221;<br />
cd $jpeg_sourse_name<br />
cp makefile.unix Makefile<br />
make &amp;&amp; make install<br />
cd ..<br />
rm -rf ${jpeg_sourse_name}*</p>
<p>wget ${url}${libpng_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $libpng_sourse_name&#8221;.tar.gz&#8221;<br />
cd $libpng_sourse_name<br />
./configure &#8211;prefix=$libpng_install_dir<br />
make &amp;&amp; make install<br />
cd ..<br />
rm -rf ${libpng_sourse_name}*</p>
<p>wget ${url}${freetype_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $freetype_sourse_name&#8221;.tar.gz&#8221;<br />
cd $freetype_sourse_name<br />
./configure &#8211;prefix=$freetype_install_dir<br />
make &amp;&amp; make install<br />
cd ..<br />
rm -rf ${freetype_sourse_name}*</p>
<p>wget ${url}${php_sourse_name}&#8221;.tar.gz&#8221;<br />
tar -zxvf $php_sourse_name&#8221;.tar.gz&#8221;<br />
./php-5.2.6/configure &#8211;enable-cli &#8211;enable-cgi &#8211;enable-fastcgi &#8211;enable-force-cgi-redirect &#8211;enable-discard-path &#8211;enable-path-info-check &#8211;with-openssl &#8211;with-pcre-regex &#8211;enable-calendar &#8211;enable-dom &#8211;enable-ftp &#8211;with-openssl-dir=/usr/local/openssl &#8211;enable-gd-jis-conv &#8211;enable-hash &#8211;with-iconv &#8211;enable-json &#8211;enable-mbstring &#8211;enable-mbregex &#8211;enable-pdo &#8211;enable-posix &#8211;enable-libxml &#8211;enable-simplexml &#8211;with-sqlite &#8211;enable-tokenizer &#8211;enable-xmlreader &#8211;enable-xmlwriter &#8211;with-zlib=/usr/local/zlib &#8211;with-freetype-dir=/usr/local/freetype &#8211;with-gd &#8211;with-jpeg-dir=/usr/lib/libjpeg.so.62.0.0</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/15/lamp%e8%87%aa%e5%8a%a8%e5%ae%89%e8%a3%85%e8%84%9a%e6%9c%ac.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>打造全能优化的Linux+Apache+PHP+Mysql服务器（3）</title>
		<link>http://www.sunboyu.cn/2008/07/15/%e6%89%93%e9%80%a0%e5%85%a8%e8%83%bd%e4%bc%98%e5%8c%96%e7%9a%84linuxapachephpmysql%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%883%ef%bc%89.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/15/%e6%89%93%e9%80%a0%e5%85%a8%e8%83%bd%e4%bc%98%e5%8c%96%e7%9a%84linuxapachephpmysql%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%883%ef%bc%89.shtml#comments</comments>
		<pubDate>Tue, 15 Jul 2008 06:30:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[fastcgi]]></category>

		<category><![CDATA[openssl]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=199</guid>
		<description><![CDATA[apache部分
先安装openssl
./configure &#8211;enable-authz-dbm &#8211;enable-log-config &#8211;enable-headers &#8211;enable-setenvif &#8211;with-ssl=/usr/local/ssl  &#8211;enable-static-ab &#8211;enable-http &#8211;enable-mime &#8211;enable-status &#8211;enable-suexec &#8211;enable-vhost-alias &#8211;enable-dir &#8211;enable-rewrite &#8211;with-mpm=worker
fastcgi
cp Makefile.AP2 Makefile
make make install
]]></description>
			<content:encoded><![CDATA[<p>apache部分</p>
<p>先安装openssl</p>
<p>./configure &#8211;enable-authz-dbm &#8211;enable-log-config &#8211;enable-headers &#8211;enable-setenvif &#8211;with-ssl=/usr/local/ssl  &#8211;enable-static-ab &#8211;enable-http &#8211;enable-mime &#8211;enable-status &#8211;enable-suexec &#8211;enable-vhost-alias &#8211;enable-dir &#8211;enable-rewrite &#8211;with-mpm=worker</p>
<p>fastcgi</p>
<p>cp Makefile.AP2 Makefile<br />
make make install</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/15/%e6%89%93%e9%80%a0%e5%85%a8%e8%83%bd%e4%bc%98%e5%8c%96%e7%9a%84linuxapachephpmysql%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%883%ef%bc%89.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>打造全能优化的Linux+Apache+PHP+Mysql服务器（2）</title>
		<link>http://www.sunboyu.cn/2008/07/15/%e6%89%93%e9%80%a0%e5%85%a8%e8%83%bd%e4%bc%98%e5%8c%96%e7%9a%84linuxapachephpmysql%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%882%ef%bc%89.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/15/%e6%89%93%e9%80%a0%e5%85%a8%e8%83%bd%e4%bc%98%e5%8c%96%e7%9a%84linuxapachephpmysql%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%882%ef%bc%89.shtml#comments</comments>
		<pubDate>Tue, 15 Jul 2008 03:33:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[安装]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=197</guid>
		<description><![CDATA[MYsql的安装
mysql 编译参数
./configure &#8211;enable-thread-safe-client &#8211;enable-local-infile &#8211;enable-largefile &#8211;with-charset=utf8  &#8211;with-uca &#8211;with-gnu-ld &#8211;with-pic &#8211;with-mysqld-libs &#8211;with-comment &#8211;with-query-cache &#8211;with-bench &#8211;with-big-tables &#8211;with-innodb &#8211;with-mysqld-use=mysql
/usr/local/bin/mysql_install_db
/usr/local/bin/mysqld_safe  &#8211;user mysql
如果安装时候有错误提示，也许是缺少这个组件  http://www.sunboyu.cn/sourse/termcap-1.3.1.tar.gz
]]></description>
			<content:encoded><![CDATA[<p>MYsql的安装</p>
<p>mysql 编译参数<br />
./configure &#8211;enable-thread-safe-client &#8211;enable-local-infile &#8211;enable-largefile &#8211;with-charset=utf8  &#8211;with-uca &#8211;with-gnu-ld &#8211;with-pic &#8211;with-mysqld-libs &#8211;with-comment &#8211;with-query-cache &#8211;with-bench &#8211;with-big-tables &#8211;with-innodb &#8211;with-mysqld-use=mysql</p>
<p>/usr/local/bin/mysql_install_db</p>
<p>/usr/local/bin/mysqld_safe  &#8211;user mysql</p>
<p>如果安装时候有错误提示，也许是缺少这个组件  http://www.sunboyu.cn/sourse/termcap-1.3.1.tar.gz</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/15/%e6%89%93%e9%80%a0%e5%85%a8%e8%83%bd%e4%bc%98%e5%8c%96%e7%9a%84linuxapachephpmysql%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%882%ef%bc%89.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>打造全能优化的Linux+Apache+PHP+Mysql服务器（1）</title>
		<link>http://www.sunboyu.cn/2008/07/13/%e6%89%93%e9%80%a0%e5%85%a8%e8%83%bd%e4%bc%98%e5%8c%96%e7%9a%84linuxapachephpmysql%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%881%ef%bc%89.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/13/%e6%89%93%e9%80%a0%e5%85%a8%e8%83%bd%e4%bc%98%e5%8c%96%e7%9a%84linuxapachephpmysql%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%881%ef%bc%89.shtml#comments</comments>
		<pubDate>Sun, 13 Jul 2008 13:05:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[服务器]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=196</guid>
		<description><![CDATA[fastcgi   http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz
apache2   http://apache.mirror.phpchina.com/httpd/httpd-2.2.9.tar.gz
mysql5    http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.51b.tar.gz/from/http://mysql.mirrors.arminco.com/
php5      http://cn2.php.net/distributions/php-5.2.6.tar.gz
libxml2
gd-jpeg   ftp://192.48.96.9/graphics/jpeg/jpegsrc.v6b.tar.gz
freetype  http://voxel.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.7.tar.gz
libpng    http://voxel.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.29.tar.gz
zend      http://www.zend.com/download/55
memcached  http://www.danga.com/memcached/dist/memcached-1.2.5.tar.gz
memcache   http://pecl.php.net/get/memcache-3.0.1.tgz
libevent   http://www.monkey.org/~provos/libevent-1.2a.tar.gz
目前想到的功能大概有这些，想到再加。
目前正在研究每一个组件的性能和参数。
]]></description>
			<content:encoded><![CDATA[<p>fastcgi   http://www.fastcgi.com/dist/mod_fastcgi-2.4.6.tar.gz<br />
apache2   http://apache.mirror.phpchina.com/httpd/httpd-2.2.9.tar.gz<br />
mysql5    http://dev.mysql.com/get/Downloads/MySQL-5.0/mysql-5.0.51b.tar.gz/from/http://mysql.mirrors.arminco.com/<br />
php5      http://cn2.php.net/distributions/php-5.2.6.tar.gz<br />
libxml2<br />
gd-jpeg   ftp://192.48.96.9/graphics/jpeg/jpegsrc.v6b.tar.gz<br />
freetype  http://voxel.dl.sourceforge.net/sourceforge/freetype/freetype-2.3.7.tar.gz<br />
libpng    http://voxel.dl.sourceforge.net/sourceforge/libpng/libpng-1.2.29.tar.gz<br />
zend      http://www.zend.com/download/55</p>
<p>memcached  http://www.danga.com/memcached/dist/memcached-1.2.5.tar.gz<br />
memcache   http://pecl.php.net/get/memcache-3.0.1.tgz<br />
libevent   http://www.monkey.org/~provos/libevent-1.2a.tar.gz</p>
<p>目前想到的功能大概有这些，想到再加。</p>
<p>目前正在研究每一个组件的性能和参数。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/13/%e6%89%93%e9%80%a0%e5%85%a8%e8%83%bd%e4%bc%98%e5%8c%96%e7%9a%84linuxapachephpmysql%e6%9c%8d%e5%8a%a1%e5%99%a8%ef%bc%881%ef%bc%89.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Zeus适用体会</title>
		<link>http://www.sunboyu.cn/2008/07/11/zeus%e9%80%82%e7%94%a8%e4%bd%93%e4%bc%9a.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/11/zeus%e9%80%82%e7%94%a8%e4%bd%93%e4%bc%9a.shtml#comments</comments>
		<pubDate>Fri, 11 Jul 2008 14:21:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[技术存档]]></category>

		<category><![CDATA[Zeus]]></category>

		<category><![CDATA[体验]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=195</guid>
		<description><![CDATA[本来以为linux的软件安装会很麻烦，没想到安装Zeus如此的简单，一路next或者yes/no即可安装。系统有完善的后台管理界面，图形化的日志报表。
相比apache，功能没有显少，但效率和负载却很强。Zeus支持FastCGI的方式来运行PHP，这样LZMP的架构的确也很强。
唯一的缺点，Zeus收费。
]]></description>
			<content:encoded><![CDATA[<p>本来以为linux的软件安装会很麻烦，没想到安装Zeus如此的简单，一路next或者yes/no即可安装。系统有完善的后台管理界面，图形化的日志报表。</p>
<p>相比apache，功能没有显少，但效率和负载却很强。Zeus支持FastCGI的方式来运行PHP，这样LZMP的架构的确也很强。</p>
<p>唯一的缺点，Zeus收费。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/11/zeus%e9%80%82%e7%94%a8%e4%bd%93%e4%bc%9a.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>软件公司的部门协作（爆笑）</title>
		<link>http://www.sunboyu.cn/2008/07/11/%e8%bd%af%e4%bb%b6%e5%85%ac%e5%8f%b8%e7%9a%84%e9%83%a8%e9%97%a8%e5%8d%8f%e4%bd%9c%ef%bc%88%e7%88%86%e7%ac%91%ef%bc%89.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/11/%e8%bd%af%e4%bb%b6%e5%85%ac%e5%8f%b8%e7%9a%84%e9%83%a8%e9%97%a8%e5%8d%8f%e4%bd%9c%ef%bc%88%e7%88%86%e7%ac%91%ef%bc%89.shtml#comments</comments>
		<pubDate>Fri, 11 Jul 2008 03:50:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[协作]]></category>

		<category><![CDATA[设计图]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=193</guid>
		<description><![CDATA[冷笑一个，其实很多公司都这样。

]]></description>
			<content:encoded><![CDATA[<p>冷笑一个，其实很多公司都这样。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/07/c7_fcfd9u9eqr2sqddl.jpg"><img class="aligncenter size-full wp-image-194" title="c7_fcfd9u9eqr2sqddl" src="http://www.sunboyu.cn/upfiles/2008/07/c7_fcfd9u9eqr2sqddl.jpg" alt="" width="500" height="375" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/11/%e8%bd%af%e4%bb%b6%e5%85%ac%e5%8f%b8%e7%9a%84%e9%83%a8%e9%97%a8%e5%8d%8f%e4%bd%9c%ef%bc%88%e7%88%86%e7%ac%91%ef%bc%89.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>一个里程的结束，总结经验</title>
		<link>http://www.sunboyu.cn/2008/07/10/%e4%b8%80%e4%b8%aa%e9%87%8c%e7%a8%8b%e7%9a%84%e7%bb%93%e6%9d%9f%ef%bc%8c%e6%80%bb%e7%bb%93%e7%bb%8f%e9%aa%8c.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/10/%e4%b8%80%e4%b8%aa%e9%87%8c%e7%a8%8b%e7%9a%84%e7%bb%93%e6%9d%9f%ef%bc%8c%e6%80%bb%e7%bb%93%e7%bb%8f%e9%aa%8c.shtml#comments</comments>
		<pubDate>Thu, 10 Jul 2008 12:26:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[安全]]></category>

		<category><![CDATA[架构]]></category>

		<category><![CDATA[设计方案]]></category>

		<category><![CDATA[负载均衡]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=190</guid>
		<description><![CDATA[今天终于把流程走通，整理出模块结构。需求分析-&#62;逻辑流程-&#62;架构设计-&#62;安全解决-&#62;负载均衡，一路走来，从稀里糊涂到逐渐清晰，经历了从死到生。这里总结一下经验总结：
1 需求分析。其他部门的需求，未必是合理正确的。做设计的一般不是技术出身，市场，亦或其他。因此，很多流程和功能是很难实现的，就需要我们协调这些细节，尽量用简单的方式满足原始的需求。在冲突无法简单解决的时候，可以沟通，或者寻求适中的解决方案。
2 架构设计。硬件平台是不用考虑的，公司经济实力还是有的。但我尽量设计成了可伸缩的架构。简单的服务器可以支撑，当然也可以分布为多台集群。在程序结构上，采用我最喜欢的松散设计，这样可以随时增加模块，与更多的其他系统进行接口的对接。
3 安全解决。系统的模块多了，中间传递信息，服务器之间的通讯，与外界的数据传输，都可能造成信息被窃取，通道被阻塞等。设计的时候分等级对安全性和重要性进行评估，对模块进行加固。
4 负载均衡。负载均衡是可伸缩架构的一部分。主要目的是应付日后业务的飞涨。
]]></description>
			<content:encoded><![CDATA[<p>今天终于把流程走通，整理出模块结构。需求分析-&gt;逻辑流程-&gt;架构设计-&gt;安全解决-&gt;负载均衡，一路走来，从稀里糊涂到逐渐清晰，经历了从死到生。这里总结一下经验总结：</p>
<p>1 需求分析。其他部门的需求，未必是合理正确的。做设计的一般不是技术出身，市场，亦或其他。因此，很多流程和功能是很难实现的，就需要我们协调这些细节，尽量用简单的方式满足原始的需求。在冲突无法简单解决的时候，可以沟通，或者寻求适中的解决方案。</p>
<p>2 架构设计。硬件平台是不用考虑的，公司经济实力还是有的。但我尽量设计成了可伸缩的架构。简单的服务器可以支撑，当然也可以分布为多台集群。在程序结构上，采用我最喜欢的松散设计，这样可以随时增加模块，与更多的其他系统进行接口的对接。</p>
<p>3 安全解决。系统的模块多了，中间传递信息，服务器之间的通讯，与外界的数据传输，都可能造成信息被窃取，通道被阻塞等。设计的时候分等级对安全性和重要性进行评估，对模块进行加固。</p>
<p>4 负载均衡。负载均衡是可伸缩架构的一部分。主要目的是应付日后业务的飞涨。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/10/%e4%b8%80%e4%b8%aa%e9%87%8c%e7%a8%8b%e7%9a%84%e7%bb%93%e6%9d%9f%ef%bc%8c%e6%80%bb%e7%bb%93%e7%bb%8f%e9%aa%8c.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>学编程，重在基本素质</title>
		<link>http://www.sunboyu.cn/2008/07/10/%e5%ad%a6%e7%bc%96%e7%a8%8b%ef%bc%8c%e9%87%8d%e5%9c%a8%e5%9f%ba%e6%9c%ac%e7%b4%a0%e8%b4%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/10/%e5%ad%a6%e7%bc%96%e7%a8%8b%ef%bc%8c%e9%87%8d%e5%9c%a8%e5%9f%ba%e6%9c%ac%e7%b4%a0%e8%b4%a8.shtml#comments</comments>
		<pubDate>Thu, 10 Jul 2008 01:30:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[学习]]></category>

		<category><![CDATA[方法]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=188</guid>
		<description><![CDATA[最近总有朋友问我，国内有什么比较简单的PHP书籍，怎么学习PHP，有啥捷径，还有的说，二哥，给个小程序学学……
我一般都会说，没捷径，没好书，想学程序，去下一些外国的开源，比我的好得多。
其实，我也是从问那些问题过来的，不过，我还是想把我的经验分享给大家，希望大家别绕弯子，能走捷径。
学PHP，建议还是有点编程基础，不管是C,VB,VFP。懂点语言基础，就说明能理解一些基本概念。一些函数，变量，逻辑分支，这些是最基础的。有这些基础，再了解B/S结构工作原理，就可以写WEB程序了。
书，我一般当工具书，讲案例的不多，杜江老师那本书凑合，对我来说已经足够，能知道PHP都能干什么，其他的，你可以买本圣经当手册，也可以下个电子版。
程序，建议到站长网或者开源社区下一些小的，学就要学好的，看就要看规范的，看我的只能把你们带坏。先学着改人家的程序，可以改改DEDEcms，可以改一下ECSHOP，可以改改论坛，看看discuz，做个模板等。
看差不多了，可以自己写简单的程序，一般都是留言本（我最近才写过），写个简单的文章发布，足以。
这些都差不多了，可以看一些别人的类库，框架，看看人家是怎么封装一些逻辑过程。
这些你都学差不多了，其实找工作就不难了。别嫌工资少，找个项目，最好能有个好的大哥，拼一段，能力会有很大提高。
作项目，不是单纯做程序，要把一些程序之外的东西揉到程序里，这时候，才是一个有实用价值的程序员。
至于如何提高，我没有啥好的方法。我也不认为我提高多快。我的方法只是：不断敲代码，天天敲代码。
要有高人有啥好的方法，有啥好的课题，可以一起研究。
]]></description>
			<content:encoded><![CDATA[<p>最近总有朋友问我，国内有什么比较简单的PHP书籍，怎么学习PHP，有啥捷径，还有的说，二哥，给个小程序学学……</p>
<p>我一般都会说，没捷径，没好书，想学程序，去下一些外国的开源，比我的好得多。</p>
<p>其实，我也是从问那些问题过来的，不过，我还是想把我的经验分享给大家，希望大家别绕弯子，能走捷径。</p>
<p>学PHP，建议还是有点编程基础，不管是C,VB,VFP。懂点语言基础，就说明能理解一些基本概念。一些函数，变量，逻辑分支，这些是最基础的。有这些基础，再了解B/S结构工作原理，就可以写WEB程序了。</p>
<p>书，我一般当工具书，讲案例的不多，杜江老师那本书凑合，对我来说已经足够，能知道PHP都能干什么，其他的，你可以买本圣经当手册，也可以下个电子版。</p>
<p>程序，建议到站长网或者开源社区下一些小的，学就要学好的，看就要看规范的，看我的只能把你们带坏。先学着改人家的程序，可以改改DEDEcms，可以改一下ECSHOP，可以改改论坛，看看discuz，做个模板等。</p>
<p>看差不多了，可以自己写简单的程序，一般都是留言本（我最近才写过），写个简单的文章发布，足以。</p>
<p>这些都差不多了，可以看一些别人的类库，框架，看看人家是怎么封装一些逻辑过程。</p>
<p>这些你都学差不多了，其实找工作就不难了。别嫌工资少，找个项目，最好能有个好的大哥，拼一段，能力会有很大提高。</p>
<p>作项目，不是单纯做程序，要把一些程序之外的东西揉到程序里，这时候，才是一个有实用价值的程序员。</p>
<p>至于如何提高，我没有啥好的方法。我也不认为我提高多快。我的方法只是：不断敲代码，天天敲代码。</p>
<p>要有高人有啥好的方法，有啥好的课题，可以一起研究。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/10/%e5%ad%a6%e7%bc%96%e7%a8%8b%ef%bc%8c%e9%87%8d%e5%9c%a8%e5%9f%ba%e6%9c%ac%e7%b4%a0%e8%b4%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>程序调式N多招</title>
		<link>http://www.sunboyu.cn/2008/07/08/%e7%a8%8b%e5%ba%8f%e8%b0%83%e5%bc%8fn%e5%a4%9a%e6%8b%9b.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/08/%e7%a8%8b%e5%ba%8f%e8%b0%83%e5%bc%8fn%e5%a4%9a%e6%8b%9b.shtml#comments</comments>
		<pubDate>Tue, 08 Jul 2008 12:00:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[debug]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[调试]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=184</guid>
		<description><![CDATA[最近在群里扯淡，好多小鸟提的问题其实很简单，程序本身的报错机制就能告诉你错误。现在列出所有能给你提示的方法.

打开PHP的报错。在php.ini(win下)中，寻找  error_reporting   ,设置 error_reporting  =  E_ALL &#38; ~E_NOTICE，好像默认就是这个。
如果还是找不到，那么在你程序的头上加上:error_reporting(2047),这样错误也都会出来。

这两条是程序有硬伤的时候，直接报出来。如果逻辑上的错误，咋调呢？我的方法比较奔，但的确有效。

输入echo &#8220;aaa&#8221;;break; 这样，可以判断出程序是哪里出问题而中断了。
print_r($var);这样去跟踪你认为出错的数据，用肉眼监视＋大脑计算，去对比程序的计算，只要涉及变量值可能改变的地方，都得去对比。

这是程序差错的方法。mysql就更简单了，把你认为有错误的sql语句echo出来，放到phpmyadmin里去执行，看那个报错就行了。
最后一点：下载个星际译王，当然是指英文不太利索的。
]]></description>
			<content:encoded><![CDATA[<p>最近在群里扯淡，好多小鸟提的问题其实很简单，程序本身的报错机制就能告诉你错误。现在列出所有能给你提示的方法.</p>
<ol>
<li>打开PHP的报错。在php.ini(win下)中，寻找  error_reporting   ,设置 error_reporting  =  E_ALL &amp; ~E_NOTICE，好像默认就是这个。</li>
<li>如果还是找不到，那么在你程序的头上加上:error_reporting(2047),这样错误也都会出来。</li>
</ol>
<p>这两条是程序有硬伤的时候，直接报出来。如果逻辑上的错误，咋调呢？我的方法比较奔，但的确有效。</p>
<ol>
<li>输入echo &#8220;aaa&#8221;;break; 这样，可以判断出程序是哪里出问题而中断了。</li>
<li>print_r($var);这样去跟踪你认为出错的数据，用肉眼监视＋大脑计算，去对比程序的计算，只要涉及变量值可能改变的地方，都得去对比。</li>
</ol>
<p>这是程序差错的方法。mysql就更简单了，把你认为有错误的sql语句echo出来，放到phpmyadmin里去执行，看那个报错就行了。</p>
<p>最后一点：下载个星际译王，当然是指英文不太利索的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/08/%e7%a8%8b%e5%ba%8f%e8%b0%83%e5%bc%8fn%e5%a4%9a%e6%8b%9b.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Web Service来做简单认证服务器</title>
		<link>http://www.sunboyu.cn/2008/07/08/web-service%e6%9d%a5%e5%81%9a%e7%ae%80%e5%8d%95%e8%ae%a4%e8%af%81%e6%9c%8d%e5%8a%a1%e5%99%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/08/web-service%e6%9d%a5%e5%81%9a%e7%ae%80%e5%8d%95%e8%ae%a4%e8%af%81%e6%9c%8d%e5%8a%a1%e5%99%a8.shtml#comments</comments>
		<pubDate>Tue, 08 Jul 2008 03:21:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[APACHE]]></category>

		<category><![CDATA[技术存档]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[Web Service]]></category>

		<category><![CDATA[认证]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=183</guid>
		<description><![CDATA[Web Service简介
Web Service主要是为了使原来各孤立的站点之间的信息能够相互通信、共享而提出的一种接口。 Web Service所使用的是Internet上统一、开放的标准，如HTTP、XML、SOAP（简单对象访问协议）、WSDL等，所以Web Service可以在任何支持这些标准的环境（Windows,Linux）中使用。注：SOAP协议（Simple Object Access Protocal,简单对象访问协议）,它是一个用于分散和分布式环境下网络信息交换的基于XML的通讯协议。在此协议下，软件组件或应用程序能够通过标准的HTTP协议进行通讯。它的设计目标就是简单性和扩展性，这有助于大量异构程序和平台之间的互操作性，从而使存在的应用程序能够被广泛的用户访问。
最近写一个认证服务器，需要进行不同程序，不同数据库之间的数据交换，认证服务器提供认证功能，而客户端可能是多种语言开发的。如果实用传统的方式，比如C，或者java开发一个稳定的服务端，人力精力都是问题，只能寻求一种简单的方式进行过渡。
这里我选择了Web Service这种方式，但这种方式也存在一定问题：速度。网上普遍反映速度是问题，soap的方式本身负载是问题，实用xmlrpc，http方式，瓶颈在于webserver的负载能力。但是项目发展初期，此方式完全能满足一段时间，而这段时间我们也能平滑过渡，留出时间进行更深层次的研究。
]]></description>
			<content:encoded><![CDATA[<p>Web Service简介</p>
<div style="border:dotted 1px;padding:5px">Web Service主要是为了使原来各孤立的站点之间的信息能够相互通信、共享而提出的一种接口。 Web Service所使用的是Internet上统一、开放的标准，如HTTP、XML、SOAP（简单对象访问协议）、WSDL等，所以Web Service可以在任何支持这些标准的环境（Windows,Linux）中使用。注：SOAP协议（Simple Object Access Protocal,简单对象访问协议）,它是一个用于分散和分布式环境下网络信息交换的基于XML的通讯协议。在此协议下，软件组件或应用程序能够通过标准的HTTP协议进行通讯。它的设计目标就是简单性和扩展性，这有助于大量异构程序和平台之间的互操作性，从而使存在的应用程序能够被广泛的用户访问。</div>
<p>最近写一个认证服务器，需要进行不同程序，不同数据库之间的数据交换，认证服务器提供认证功能，而客户端可能是多种语言开发的。如果实用传统的方式，比如C，或者java开发一个稳定的服务端，人力精力都是问题，只能寻求一种简单的方式进行过渡。</p>
<p>这里我选择了Web Service这种方式，但这种方式也存在一定问题：速度。网上普遍反映速度是问题，soap的方式本身负载是问题，实用xmlrpc，http方式，瓶颈在于webserver的负载能力。但是项目发展初期，此方式完全能满足一段时间，而这段时间我们也能平滑过渡，留出时间进行更深层次的研究。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/08/web-service%e6%9d%a5%e5%81%9a%e7%ae%80%e5%8d%95%e8%ae%a4%e8%af%81%e6%9c%8d%e5%8a%a1%e5%99%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>ADODB数据字典的应用</title>
		<link>http://www.sunboyu.cn/2008/07/06/adodb%e6%95%b0%e6%8d%ae%e5%ad%97%e5%85%b8%e7%9a%84%e5%ba%94%e7%94%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/06/adodb%e6%95%b0%e6%8d%ae%e5%ad%97%e5%85%b8%e7%9a%84%e5%ba%94%e7%94%a8.shtml#comments</comments>
		<pubDate>Sun, 06 Jul 2008 14:14:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[adodb]]></category>

		<category><![CDATA[数据字典]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=182</guid>
		<description><![CDATA[我已经很久没有用adodb了，这次用的adodb lite，除了在查询中多了好多方法外，还发现了数据字典这个功能。
因为adodb是兼容多种数据库的，我们切换数据库的时候当然不想去另一个数据库上去重新简表，但mysql,mssql,sqlite这些库好像都不能互转。
而adodb建立数据字典后，可根据你当前的数据库类型生成相应的sql语句，然后创建数据表，而当我们切换数据库的时候，直接修改数据库类型，然后修改一些关键参数即可实现数据库的切换。
方便的很。
]]></description>
			<content:encoded><![CDATA[<p>我已经很久没有用adodb了，这次用的adodb lite，除了在查询中多了好多方法外，还发现了数据字典这个功能。</p>
<p>因为adodb是兼容多种数据库的，我们切换数据库的时候当然不想去另一个数据库上去重新简表，但mysql,mssql,sqlite这些库好像都不能互转。</p>
<p>而adodb建立数据字典后，可根据你当前的数据库类型生成相应的sql语句，然后创建数据表，而当我们切换数据库的时候，直接修改数据库类型，然后修改一些关键参数即可实现数据库的切换。</p>
<p>方便的很。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/06/adodb%e6%95%b0%e6%8d%ae%e5%ad%97%e5%85%b8%e7%9a%84%e5%ba%94%e7%94%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>多语言风格网站的语言模块处理</title>
		<link>http://www.sunboyu.cn/2008/07/05/%e5%a4%9a%e8%af%ad%e8%a8%80%e9%a3%8e%e6%a0%bc%e7%bd%91%e7%ab%99%e7%9a%84%e8%af%ad%e8%a8%80%e6%a8%a1%e5%9d%97%e5%a4%84%e7%90%86.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/05/%e5%a4%9a%e8%af%ad%e8%a8%80%e9%a3%8e%e6%a0%bc%e7%bd%91%e7%ab%99%e7%9a%84%e8%af%ad%e8%a8%80%e6%a8%a1%e5%9d%97%e5%a4%84%e7%90%86.shtml#comments</comments>
		<pubDate>Sat, 05 Jul 2008 14:57:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[gettext]]></category>

		<category><![CDATA[smarty]]></category>

		<category><![CDATA[语言包]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=181</guid>
		<description><![CDATA[奥运来了，流行国际化，网站也趋向于国际化。多语言网站成了流行，这里，我总结了一下多语言网站的设计。
首先，要设计多个语言包，打个比方，一个cn的，代表汉语，一个en的，代表英语。然后建立一个映射关系。比如，helloword，你好世界，英文，中文，我们给这个短句定一个ID，ID=&#8217;HW&#8217;,在英文语言包里，HW=&#8217;helloword&#8217;,在汉语语言包里，HW=&#8217;你好世界&#8217;。以此类推，语言包就做好了。
然后，我们要确定当前页面是调用哪个语言包。可以由读者去确定，比如，默认是英文，然后用户可以手工设置为汉语。可以通过session来设定一个变量，进行控制，但大多数是通过cookie。也可以根据域名，比如 http://cn.sunboyu.cn ，解析主机名，cn 即为汉语。  得到了客户端语言的标志，我们就可以确定调用哪个语言包。
最后说一下实现机制。最简单的方式，就是定义成数据，比如 $Lang['cn']['HW']=&#8217;你好世界&#8217;  $Lang['en']['HW'] ,这样，通过数据二级的键值就可以取出值。Smarty支持一个功能，就是config_load的功能，只要模板里有个语言种类变量，就可以动态调用语言包。还有，就是php的gettext扩展，都是一样的道理，只是存储不同。
做好你的语言包，做好语言选择控制，多语言网站就可以出炉了。
]]></description>
			<content:encoded><![CDATA[<p>奥运来了，流行国际化，网站也趋向于国际化。多语言网站成了流行，这里，我总结了一下多语言网站的设计。</p>
<p>首先，要设计多个语言包，打个比方，一个cn的，代表汉语，一个en的，代表英语。然后建立一个映射关系。比如，helloword，你好世界，英文，中文，我们给这个短句定一个ID，ID=&#8217;HW&#8217;,在英文语言包里，HW=&#8217;helloword&#8217;,在汉语语言包里，HW=&#8217;你好世界&#8217;。以此类推，语言包就做好了。</p>
<p>然后，我们要确定当前页面是调用哪个语言包。可以由读者去确定，比如，默认是英文，然后用户可以手工设置为汉语。可以通过session来设定一个变量，进行控制，但大多数是通过cookie。也可以根据域名，比如 http://cn.sunboyu.cn ，解析主机名，cn 即为汉语。  得到了客户端语言的标志，我们就可以确定调用哪个语言包。</p>
<p>最后说一下实现机制。最简单的方式，就是定义成数据，比如 $Lang['cn']['HW']=&#8217;你好世界&#8217;  $Lang['en']['HW'] ,这样，通过数据二级的键值就可以取出值。Smarty支持一个功能，就是config_load的功能，只要模板里有个语言种类变量，就可以动态调用语言包。还有，就是php的gettext扩展，都是一样的道理，只是存储不同。</p>
<p>做好你的语言包，做好语言选择控制，多语言网站就可以出炉了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/05/%e5%a4%9a%e8%af%ad%e8%a8%80%e9%a3%8e%e6%a0%bc%e7%bd%91%e7%ab%99%e7%9a%84%e8%af%ad%e8%a8%80%e6%a8%a1%e5%9d%97%e5%a4%84%e7%90%86.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>赶鸭子上架，我顶一段需求分析和产品设计</title>
		<link>http://www.sunboyu.cn/2008/07/04/%e8%b5%b6%e9%b8%ad%e5%ad%90%e4%b8%8a%e6%9e%b6%ef%bc%8c%e6%88%91%e9%a1%b6%e4%b8%80%e6%ae%b5%e9%9c%80%e6%b1%82%e5%88%86%e6%9e%90%e5%92%8c%e4%ba%a7%e5%93%81%e8%ae%be%e8%ae%a1.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/04/%e8%b5%b6%e9%b8%ad%e5%ad%90%e4%b8%8a%e6%9e%b6%ef%bc%8c%e6%88%91%e9%a1%b6%e4%b8%80%e6%ae%b5%e9%9c%80%e6%b1%82%e5%88%86%e6%9e%90%e5%92%8c%e4%ba%a7%e5%93%81%e8%ae%be%e8%ae%a1.shtml#comments</comments>
		<pubDate>Fri, 04 Jul 2008 14:46:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[纯属蛋疼]]></category>

		<category><![CDATA[产品]]></category>

		<category><![CDATA[需求]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=179</guid>
		<description><![CDATA[公司要招人，结果还没过来，我只好先入为主，先顶上去。
一个项目啥都不知道，只有个概念，还真是赶鸭子上架。只知道这是个类似支付宝之类还有用户帐号货币管理之类的概念产品。其实市面上很多这样的产品，只是把他们的模块拿出来拼凑，形成我们自己的产品。产品为其他模块服务，产品自己不挣钱，这是最郁闷的地方。这就意味着我必须按照其他部门的需求来做，而难以设计自己的想法。
我这个人比较贪财，设计系统以盈利为准，看来这次是不行了。
分析了网上流行的支付系统和管理系统，大概的框架就出来，底下看我能走到哪一步。希望新人能赶紧过来。
]]></description>
			<content:encoded><![CDATA[<p>公司要招人，结果还没过来，我只好先入为主，先顶上去。</p>
<p>一个项目啥都不知道，只有个概念，还真是赶鸭子上架。只知道这是个类似支付宝之类还有用户帐号货币管理之类的概念产品。其实市面上很多这样的产品，只是把他们的模块拿出来拼凑，形成我们自己的产品。产品为其他模块服务，产品自己不挣钱，这是最郁闷的地方。这就意味着我必须按照其他部门的需求来做，而难以设计自己的想法。</p>
<p>我这个人比较贪财，设计系统以盈利为准，看来这次是不行了。</p>
<p>分析了网上流行的支付系统和管理系统，大概的框架就出来，底下看我能走到哪一步。希望新人能赶紧过来。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/04/%e8%b5%b6%e9%b8%ad%e5%ad%90%e4%b8%8a%e6%9e%b6%ef%bc%8c%e6%88%91%e9%a1%b6%e4%b8%80%e6%ae%b5%e9%9c%80%e6%b1%82%e5%88%86%e6%9e%90%e5%92%8c%e4%ba%a7%e5%93%81%e8%ae%be%e8%ae%a1.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>ADODB Lite-adodb轻量应用</title>
		<link>http://www.sunboyu.cn/2008/07/02/adodb-lite-adodb%e8%bd%bb%e9%87%8f%e5%ba%94%e7%94%a8.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/02/adodb-lite-adodb%e8%bd%bb%e9%87%8f%e5%ba%94%e7%94%a8.shtml#comments</comments>
		<pubDate>Wed, 02 Jul 2008 15:25:11 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[adodb]]></category>

		<category><![CDATA[adodblite]]></category>

		<category><![CDATA[lite]]></category>

		<category><![CDATA[smarty]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=175</guid>
		<description><![CDATA[原来用ADODB进行开发，效率一直是个不小的问题。虽然他可以兼容多个数据库，但在实际开发中几乎没什么用处。小型项目不会去频繁切换数据库，中大的项目也不会忍受它的速度。
突然发现还有个mini版本的adodb lite，官方这样说的：
A small, fast replacement for ADODB that uses 1/6th of the memory and upto 300% faster while being compatible with ADODB using a subset of the most often used ADODB commands.. Supports Frontbase, MaxDB, MiniSql, MSSQL, MySql, Postgres, SqLite and Sybase.
最近做个小程序，正好用上试试，希望不让我失望。
]]></description>
			<content:encoded><![CDATA[<p>原来用ADODB进行开发，效率一直是个不小的问题。虽然他可以兼容多个数据库，但在实际开发中几乎没什么用处。小型项目不会去频繁切换数据库，中大的项目也不会忍受它的速度。</p>
<p>突然发现还有个mini版本的adodb lite，官方这样说的：</p>
<div style="border:1px solid;padding:10px">A small, fast replacement for ADODB that uses 1/6th of the memory and upto 300% faster while being compatible with ADODB using a subset of the most often used ADODB commands.. Supports Frontbase, MaxDB, MiniSql, MSSQL, MySql, Postgres, SqLite and Sybase.</div>
<p>最近做个小程序，正好用上试试，希望不让我失望。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/02/adodb-lite-adodb%e8%bd%bb%e9%87%8f%e5%ba%94%e7%94%a8.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>mysql连接机制笔记</title>
		<link>http://www.sunboyu.cn/2008/07/01/mysql%e8%bf%9e%e6%8e%a5%e6%9c%ba%e5%88%b6%e7%ac%94%e8%ae%b0.shtml</link>
		<comments>http://www.sunboyu.cn/2008/07/01/mysql%e8%bf%9e%e6%8e%a5%e6%9c%ba%e5%88%b6%e7%ac%94%e8%ae%b0.shtml#comments</comments>
		<pubDate>Tue, 01 Jul 2008 02:20:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[技术存档]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[socket]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=167</guid>
		<description><![CDATA[php连接mysql是通过socket进行连接。mysql没有连接池，很郁闷的事情。
连接分 pconnect connect，connect是每次查询都新建一个连接。pconnect是在同一页面中，所有查询都使用一个连接。
]]></description>
			<content:encoded><![CDATA[<p>php连接mysql是通过socket进行连接。mysql没有连接池，很郁闷的事情。</p>
<p>连接分 pconnect connect，connect是每次查询都新建一个连接。pconnect是在同一页面中，所有查询都使用一个连接。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/07/01/mysql%e8%bf%9e%e6%8e%a5%e6%9c%ba%e5%88%b6%e7%ac%94%e8%ae%b0.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>mysqli学习中</title>
		<link>http://www.sunboyu.cn/2008/06/28/mysqli%e5%ad%a6%e4%b9%a0%e4%b8%ad.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/28/mysqli%e5%ad%a6%e4%b9%a0%e4%b8%ad.shtml#comments</comments>
		<pubDate>Sat, 28 Jun 2008 13:47:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[技术存档]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=164</guid>
		<description><![CDATA[任何系统中，数据库连接都是核心的一个操作。
听说mysqli这个组件不错，学习一下，果然发现不少优秀的地方。
http://www.php.net/manual/zh/ref.mysqli.php
这是官方的手册，做个标记，继续学习。
]]></description>
			<content:encoded><![CDATA[<p>任何系统中，数据库连接都是核心的一个操作。</p>
<p>听说mysqli这个组件不错，学习一下，果然发现不少优秀的地方。</p>
<p>http://www.php.net/manual/zh/ref.mysqli.php</p>
<p>这是官方的手册，做个标记，继续学习。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/28/mysqli%e5%ad%a6%e4%b9%a0%e4%b8%ad.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>死苛正则表达式</title>
		<link>http://www.sunboyu.cn/2008/06/27/%e6%ad%bb%e8%8b%9b%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/27/%e6%ad%bb%e8%8b%9b%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f.shtml#comments</comments>
		<pubDate>Fri, 27 Jun 2008 04:57:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[JS]]></category>

		<category><![CDATA[正则]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=160</guid>
		<description><![CDATA[犀牛书买来后，先看的正则。
正则就是一堆逻辑规则的集合，没啥难的，类似语句中的if else foreach等，只是把语句换乘符号了。
首先得会拆解逻辑，而后用那些乱七八糟的符号去描述这些逻辑。
规则是人家定的，没办法，只好用这些东西。
进步很快，希望能称谓正则高手。
]]></description>
			<content:encoded><![CDATA[<p>犀牛书买来后，先看的正则。</p>
<p>正则就是一堆逻辑规则的集合，没啥难的，类似语句中的if else foreach等，只是把语句换乘符号了。</p>
<p>首先得会拆解逻辑，而后用那些乱七八糟的符号去描述这些逻辑。</p>
<p>规则是人家定的，没办法，只好用这些东西。</p>
<p>进步很快，希望能称谓正则高手。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/27/%e6%ad%bb%e8%8b%9b%e6%ad%a3%e5%88%99%e8%a1%a8%e8%be%be%e5%bc%8f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>WEB开发中分层的概念</title>
		<link>http://www.sunboyu.cn/2008/06/26/web%e5%bc%80%e5%8f%91%e4%b8%ad%e5%88%86%e5%b1%82%e7%9a%84%e6%a6%82%e5%bf%b5.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/26/web%e5%bc%80%e5%8f%91%e4%b8%ad%e5%88%86%e5%b1%82%e7%9a%84%e6%a6%82%e5%bf%b5.shtml#comments</comments>
		<pubDate>Thu, 26 Jun 2008 06:24:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[分层]]></category>

		<category><![CDATA[结构]]></category>

		<category><![CDATA[设计模式]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=154</guid>
		<description><![CDATA[这些日子一直在分析刚完工的项目，总得来说，能交付测试。但离产品阶段，还是差很差一截。
产品化，即一个项目可以轻松复制，交付给不同用户。
产品化的软件一个关键是不是可以轻松迁移，而轻松迁移就取决于迁移需要修改的参数接口是不是更加灵活。这在于我们在设计产品之前有没有合理开发一些关键参数，进行迁移。
在这个层面上说的分层，可理解为软件主题跟用户接口的分层。我们把软件－接口＝开发者－用户这样的结构理解为两层。
程序层面上的分层，看此篇   PHP工厂方式的三层结构
另一个产品化的标识，就是方便修改，主要是风格方面。因此，在程序前端部分，需要合理设计我们的VIEW层代码。
VIEW层分层，主要是分成HTML(DIV)＋CSS,CSS决定页面的风格，这样，只要重新CSS就能快速修改页面风格。
JS分层。如果是试用标准的xhtml标准或者DOM格式的代码，那可以方便得把事件和函数写在附加的js文件中。
]]></description>
			<content:encoded><![CDATA[<p>这些日子一直在分析刚完工的项目，总得来说，能交付测试。但离产品阶段，还是差很差一截。</p>
<p>产品化，即一个项目可以轻松复制，交付给不同用户。</p>
<p>产品化的软件一个关键是不是可以轻松迁移，而轻松迁移就取决于迁移需要修改的参数接口是不是更加灵活。这在于我们在设计产品之前有没有合理开发一些关键参数，进行迁移。</p>
<p>在这个层面上说的分层，可理解为软件主题跟用户接口的分层。我们把软件－接口＝开发者－用户这样的结构理解为两层。</p>
<p>程序层面上的分层，看此篇   <a href="http://www.sunboyu.cn/2008/06/14/php%E4%B8%AD%E5%B7%A5%E5%8E%82%E6%96%B9%E5%BC%8F%E7%9A%84%E4%B8%89%E5%B1%82%E7%BB%93%E6%9E%84.shtml" target="_blank">PHP工厂方式的三层结构</a></p>
<p>另一个产品化的标识，就是方便修改，主要是风格方面。因此，在程序前端部分，需要合理设计我们的VIEW层代码。</p>
<p>VIEW层分层，主要是分成HTML(DIV)＋CSS,CSS决定页面的风格，这样，只要重新CSS就能快速修改页面风格。</p>
<p>JS分层。如果是试用标准的xhtml标准或者DOM格式的代码，那可以方便得把事件和函数写在附加的js文件中。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/26/web%e5%bc%80%e5%8f%91%e4%b8%ad%e5%88%86%e5%b1%82%e7%9a%84%e6%a6%82%e5%bf%b5.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>项目管理中，关于成本核算中的人力成本核算</title>
		<link>http://www.sunboyu.cn/2008/06/26/%e9%a1%b9%e7%9b%ae%e7%ae%a1%e7%90%86%e4%b8%ad%ef%bc%8c%e5%85%b3%e4%ba%8e%e6%88%90%e6%9c%ac%e6%a0%b8%e7%ae%97%e4%b8%ad%e7%9a%84%e4%ba%ba%e5%8a%9b%e6%88%90%e6%9c%ac%e6%a0%b8%e7%ae%97.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/26/%e9%a1%b9%e7%9b%ae%e7%ae%a1%e7%90%86%e4%b8%ad%ef%bc%8c%e5%85%b3%e4%ba%8e%e6%88%90%e6%9c%ac%e6%a0%b8%e7%ae%97%e4%b8%ad%e7%9a%84%e4%ba%ba%e5%8a%9b%e6%88%90%e6%9c%ac%e6%a0%b8%e7%ae%97.shtml#comments</comments>
		<pubDate>Thu, 26 Jun 2008 05:33:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[人力成本]]></category>

		<category><![CDATA[项目管理]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=153</guid>
		<description><![CDATA[对于大公司（千人～万人的开发团队），一般写代码的人最少，前边搞需求分析和系统规划，后边搞测试，两头人多。而小公司结构一般就比较随意，根据项目情况，去合理安排结构。而开发一些很小的项目，比如几个人的团队，成本核算就不那么容易了。
人多，不等于效率高。在开发这个领域 1×5 != 5×1 。说通俗点，一个老程序员10天一个人能开发完的，并不等于10个同等水平的人一天能干完。
这个事情其实还是好解决的，我们可以把项目分解出来，模拟一个模块开发流程的时间表。这时，我们就能知道，为什么10个人不能一天完成，模块是有先后关联的。
再说人力消耗，如果多人协作，人力成本会更加微妙，这多少跟程序员的心态有关。老程序员能解决大部分难题，并且有能力完成整个项目，但有些模块也是不愿意去做的，因为他会考虑一个性价比的问题。而新手程序员，未必不能解决一些基本的模块，他们更加关心这个过程中知识方面的提升。
因此，把项目分拆，设计好开发流程，合理分配不同的内容给不同的人，是这件事情的核心。
至于程序员的薪酬，不加考虑。其实如果考虑薪酬，考虑开发进度，就可以用最优的价格，最短的开发周期去完成一个项目。
]]></description>
			<content:encoded><![CDATA[<p>对于大公司（千人～万人的开发团队），一般写代码的人最少，前边搞需求分析和系统规划，后边搞测试，两头人多。而小公司结构一般就比较随意，根据项目情况，去合理安排结构。而开发一些很小的项目，比如几个人的团队，成本核算就不那么容易了。</p>
<p>人多，不等于效率高。在开发这个领域 1×5 != 5×1 。说通俗点，一个老程序员10天一个人能开发完的，并不等于10个同等水平的人一天能干完。</p>
<p>这个事情其实还是好解决的，我们可以把项目分解出来，模拟一个模块开发流程的时间表。这时，我们就能知道，为什么10个人不能一天完成，模块是有先后关联的。</p>
<p>再说人力消耗，如果多人协作，人力成本会更加微妙，这多少跟程序员的心态有关。老程序员能解决大部分难题，并且有能力完成整个项目，但有些模块也是不愿意去做的，因为他会考虑一个性价比的问题。而新手程序员，未必不能解决一些基本的模块，他们更加关心这个过程中知识方面的提升。</p>
<p>因此，把项目分拆，设计好开发流程，合理分配不同的内容给不同的人，是这件事情的核心。</p>
<p>至于程序员的薪酬，不加考虑。其实如果考虑薪酬，考虑开发进度，就可以用最优的价格，最短的开发周期去完成一个项目。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/26/%e9%a1%b9%e7%9b%ae%e7%ae%a1%e7%90%86%e4%b8%ad%ef%bc%8c%e5%85%b3%e4%ba%8e%e6%88%90%e6%9c%ac%e6%a0%b8%e7%ae%97%e4%b8%ad%e7%9a%84%e4%ba%ba%e5%8a%9b%e6%88%90%e6%9c%ac%e6%a0%b8%e7%ae%97.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>网吧菜鸟入门秘籍 (本文发于杂志)-老帖新发</title>
		<link>http://www.sunboyu.cn/2008/06/24/%e7%bd%91%e5%90%a7%e8%8f%9c%e9%b8%9f%e5%85%a5%e9%97%a8%e7%a7%98%e7%b1%8d-%e6%9c%ac%e6%96%87%e5%8f%91%e4%ba%8e%e6%9d%82%e5%bf%97-%e8%80%81%e5%b8%96%e6%96%b0%e5%8f%91.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/24/%e7%bd%91%e5%90%a7%e8%8f%9c%e9%b8%9f%e5%85%a5%e9%97%a8%e7%a7%98%e7%b1%8d-%e6%9c%ac%e6%96%87%e5%8f%91%e4%ba%8e%e6%9d%82%e5%bf%97-%e8%80%81%e5%b8%96%e6%96%b0%e5%8f%91.shtml#comments</comments>
		<pubDate>Tue, 24 Jun 2008 13:46:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[感悟]]></category>

		<category><![CDATA[网吧]]></category>

		<category><![CDATA[菜鸟]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=145</guid>
		<description><![CDATA[前言：托wtf的福，我的名字出现在《黑客在线》最后一页的左上角上！虽然QQ后边注释：帅哥勿加，可是一个找俺的MM都没有，到招来了一帮的大鸟小鸟。天下网民是一家，统统加上，有问题的，一起讨论解决。 不过《黑防》的读者里有很多都挣扎在水深火热的网吧里，看来还是穷人多啊！因为网吧里没有光驱，u盘软盘基本上也都没有，而大部分又装上了还原卡，使用工具相当不方便，因此小弟在此写下了这篇文章，送给网吧中苦苦求学的菜鸟们！ 工具篇：首先，准备一些工具吧，反正都不是能临时编工具的牛人，得养成收集高手工具的习惯。现在把我所收集的几样常用工具都列出来，供大家参考。 Nbsi&#38;绝世猜解:不用说了吧，大虾小虾都明白的，sql注入相当方便！因为绝世猜解我最早用的它，一只恋恋不舍~不过有时候在nbsi中特征字符如果寻找不当的时候，绝世猜解有时候能办到，为什么，我不知道，可能是对语句处理方式不同吧。   md5暴力破解:md5：目前最流行的认证方法，一个好的md5爆破工具必不可少。我习惯用啊呆的，简单快速，不过也最好准备几个好的dos下的工具和几本好的字典。 access密码查看器:有时候取得的数据库加上了密码，不知谁发明的这个工具，正好用上！ Pcanywherepwd:如果拿到了pcanywhere的密码文件*.cif，用这个工具直接就可以读出用户名密码（我认为以后赛门铁克可能要改用非对称加密技术了）。 海洋  icefox微型:总得用几个webshell吧，几种后门各有所长，文件不大，最好都准备上。 radmin:权限上去了，继续提升，这个工具真的是不错。 x-scan:探测主机，扫描端口，性能在国内勘称一流！ Nc:去年炒得沸沸扬扬的上传漏洞利用工具，对大多数的上传组件有效。 Dvbbsupfile:网上大多少论坛系统用的动网的，当然没有及时升级的也不少，贮备一个，肯定有用！ 老兵通用上传:只要是有上传功能，这个工具就可能能起到作用！ Ultraedit  WsockExpert:配合nc，抓包，修改提交一条龙，轻松取得webshell！ Iecv:Cookis欺骗，非常好的工具 老兵domain:旁注入侵，04流行风 serv-u溢出工具:取得webshell后进一步提升权限的工具 老兵数据库管理工具:如果没有安装office-access，这个可以很轻松读取数据库。 QQ(或uc)号码一个&#38;电子邮箱若干（反正是免费的）：聊天乎？否也：用来存储我们所需要的工具！ 准 备篇：工具都有了，现在解决的一个问题是如何在网吧中使用。首先得有一个QQ（做个广告：要是没有的话，找我，10元一个，9位的）。目前腾讯公司提供 QQ（非会员）免费16m的网络u盘功能（俺也套不起那每月10块的大洋,uc提供64m，但不如Q利用率高，存不常用的工具），我算了下，我的工具一个 是10m,足够一次存下，想办法把这些工具上传到QQ里，以后就可以随时使用 了当然第一次你得找个有光驱的机器进行操作。 当你的QQ里有了那些工具的时候，就得想办法突破种种封锁下载使用它 另一个问题是目前网吧一般都用s/c结构的管理软件，禁止使用桌面，禁止浏览硬盘和cmd等功能，即使下载了这些工具也不方便使用，首先解除这些束缚。现在主要针对我们这里比较流行的万象管理系统进行说明。 万象软件手头没有破解的，只好临时用其他系统描述一下。当登陆后，实际看到的是一个虚拟的桌面，只有几个应用程序的图标，这个恢复桌面的图标变成暗灰色，如图  1所指的菜单完全是网管所设定的，无法调用内部的程序，2所指的图标要不看不见，要不设为禁用，不过，凭我的经验，下边这个动作一般能解除他的屏蔽：如图  在任务栏的空白处用右键菜单调出工具栏的下级菜单，把钩去掉，然后重复这个动作，再把钩加上，显示桌面的图标是不是变成了彩色？反正我所见到的万象系统似乎都没有屏蔽这个动作，因此当显示桌面图标有效的时候，你就可以轻松调出真正的桌面，访问硬盘了。 当然还有好多的方法，比如可以在浏览器里直接敲路径，设置安全级别低的网吧一般都能实现直接访问；还可以使用一些网站提供的在线工具，可以方便突破这些封 锁，好象黑防的盘里还赠送过一个工具，专门网吧用的，可以调用几乎所有的功能。这样的工具很多，方法也很多，多动手就行，没有绝对完美的系统！ 实 战之钓鱼：很多小鸟问我怎么找肉鸡那么快！看2005第一期的杂志，介绍有关google钓鱼式攻击的文章，其实在很早偶就用这种方法钓得无数的 dvbbs、bbsxp、动力系统和很多文章系统！当然还有其他系统，不过成功几率总不如这几个流行的高！因为这几个系统总用固定的数据库，而且扩展名默 认为*.mdb,可以直接下载！不用再说了吧，搜索他们的关键字分别为：***然后下载他的数据库，然后……看你造化了，反正10个里我总能碰见一个有这 个漏洞的。还有一个钓鱼的方式可能用的少点，就是利用网站制作人员的弱点去钓鱼，往往只关心程序的编写而忽略了最简单的安全问题，比如数据库扩展名的保 护，数据库路径的修改，弱口令的登陆，添加一个admin:admin的用户等，我成功进入这样的网站后，都会看看是哪个公司做的网站，然后看看这个公司 的所有客户:好象都有这样的毛病，然后再……呵呵，别让人家盯上你了！这也算是我一个“肉鸡成群”计吧^_^ 实战之cookies欺骗：下载了数 据库，如果你的机器上有office软件，那就打开数据库细分析了，如果没有，别着急，老兵的数据库管理工具就派上用场了！直接找到数据库路径就可以打开 浏览了！首先找到管理员的id（这里用动网7.0是sp2的数据库演示），从dv_user的userclass就能看出用户是不是管理员，然后到 dv_admin表中找到后台的登陆用户名密码！其中的adduser是他的前台登陆名，一定不能弄错！好，现在开始：如果你脑子中清楚的记得象 admin,admin888,123456,111111 ……之类的弱口令，那直接就冲吧！如果不认识，赶紧启动md5crack工具吧，不过话又说回来，网吧的机器能好到哪里？况且一般用的98，估计即使爆出 来，也得花费你很多银子。不用着急，后台的登陆密码一般从这里dv_log这个表的l_content字段能找到，看这句： username2=source&#38; amp;password2=source888&#38;username1=source&#38;Submit=%CC%ED+%BC%D3意思是 [...]]]></description>
			<content:encoded><![CDATA[<p>前言：托wtf的福，我的名字出现在《黑客在线》最后一页的左上角上！虽然QQ后边注释：帅哥勿加，可是一个找俺的MM都没有，到招来了一帮的大鸟小鸟。天下网民是一家，统统加上，有问题的，一起讨论解决。 不过《黑防》的读者里有很多都挣扎在水深火热的网吧里，看来还是穷人多啊！因为网吧里没有光驱，u盘软盘基本上也都没有，而大部分又装上了还原卡，使用工具相当不方便，因此小弟在此写下了这篇文章，送给网吧中苦苦求学的菜鸟们！ 工具篇：首先，准备一些工具吧，反正都不是能临时编工具的牛人，得养成收集高手工具的习惯。现在把我所收集的几样常用工具都列出来，供大家参考。 Nbsi&amp;绝世猜解:不用说了吧，大虾小虾都明白的，sql注入相当方便！因为绝世猜解我最早用的它，一只恋恋不舍~不过有时候在nbsi中特征字符如果寻找不当的时候，绝世猜解有时候能办到，为什么，我不知道，可能是对语句处理方式不同吧。  <span id="more-145"></span> md5暴力破解:md5：目前最流行的认证方法，一个好的md5爆破工具必不可少。我习惯用啊呆的，简单快速，不过也最好准备几个好的dos下的工具和几本好的字典。 access密码查看器:有时候取得的数据库加上了密码，不知谁发明的这个工具，正好用上！ Pcanywherepwd:如果拿到了pcanywhere的密码文件*.cif，用这个工具直接就可以读出用户名密码（我认为以后赛门铁克可能要改用非对称加密技术了）。 海洋  icefox微型:总得用几个webshell吧，几种后门各有所长，文件不大，最好都准备上。 radmin:权限上去了，继续提升，这个工具真的是不错。 x-scan:探测主机，扫描端口，性能在国内勘称一流！ Nc:去年炒得沸沸扬扬的上传漏洞利用工具，对大多数的上传组件有效。 Dvbbsupfile:网上大多少论坛系统用的动网的，当然没有及时升级的也不少，贮备一个，肯定有用！ 老兵通用上传:只要是有上传功能，这个工具就可能能起到作用！ Ultraedit  WsockExpert:配合nc，抓包，修改提交一条龙，轻松取得webshell！ Iecv:Cookis欺骗，非常好的工具 老兵domain:旁注入侵，04流行风 serv-u溢出工具:取得webshell后进一步提升权限的工具 老兵数据库管理工具:如果没有安装office-access，这个可以很轻松读取数据库。 QQ(或uc)号码一个&amp;电子邮箱若干（反正是免费的）：聊天乎？否也：用来存储我们所需要的工具！ 准 备篇：工具都有了，现在解决的一个问题是如何在网吧中使用。首先得有一个QQ（做个广告：要是没有的话，找我，10元一个，9位的）。目前腾讯公司提供 QQ（非会员）免费16m的网络u盘功能（俺也套不起那每月10块的大洋,uc提供64m，但不如Q利用率高，存不常用的工具），我算了下，我的工具一个 是10m,足够一次存下，想办法把这些工具上传到QQ里，以后就可以随时使用 了当然第一次你得找个有光驱的机器进行操作。 当你的QQ里有了那些工具的时候，就得想办法突破种种封锁下载使用它 另一个问题是目前网吧一般都用s/c结构的管理软件，禁止使用桌面，禁止浏览硬盘和cmd等功能，即使下载了这些工具也不方便使用，首先解除这些束缚。现在主要针对我们这里比较流行的万象管理系统进行说明。 万象软件手头没有破解的，只好临时用其他系统描述一下。当登陆后，实际看到的是一个虚拟的桌面，只有几个应用程序的图标，这个恢复桌面的图标变成暗灰色，如图  1所指的菜单完全是网管所设定的，无法调用内部的程序，2所指的图标要不看不见，要不设为禁用，不过，凭我的经验，下边这个动作一般能解除他的屏蔽：如图  在任务栏的空白处用右键菜单调出工具栏的下级菜单，把钩去掉，然后重复这个动作，再把钩加上，显示桌面的图标是不是变成了彩色？反正我所见到的万象系统似乎都没有屏蔽这个动作，因此当显示桌面图标有效的时候，你就可以轻松调出真正的桌面，访问硬盘了。 当然还有好多的方法，比如可以在浏览器里直接敲路径，设置安全级别低的网吧一般都能实现直接访问；还可以使用一些网站提供的在线工具，可以方便突破这些封 锁，好象黑防的盘里还赠送过一个工具，专门网吧用的，可以调用几乎所有的功能。这样的工具很多，方法也很多，多动手就行，没有绝对完美的系统！ 实 战之钓鱼：很多小鸟问我怎么找肉鸡那么快！看2005第一期的杂志，介绍有关google钓鱼式攻击的文章，其实在很早偶就用这种方法钓得无数的 dvbbs、bbsxp、动力系统和很多文章系统！当然还有其他系统，不过成功几率总不如这几个流行的高！因为这几个系统总用固定的数据库，而且扩展名默 认为*.mdb,可以直接下载！不用再说了吧，搜索他们的关键字分别为：***然后下载他的数据库，然后……看你造化了，反正10个里我总能碰见一个有这 个漏洞的。还有一个钓鱼的方式可能用的少点，就是利用网站制作人员的弱点去钓鱼，往往只关心程序的编写而忽略了最简单的安全问题，比如数据库扩展名的保 护，数据库路径的修改，弱口令的登陆，添加一个admin:admin的用户等，我成功进入这样的网站后，都会看看是哪个公司做的网站，然后看看这个公司 的所有客户:好象都有这样的毛病，然后再……呵呵，别让人家盯上你了！这也算是我一个“肉鸡成群”计吧^_^ 实战之cookies欺骗：下载了数 据库，如果你的机器上有office软件，那就打开数据库细分析了，如果没有，别着急，老兵的数据库管理工具就派上用场了！直接找到数据库路径就可以打开 浏览了！首先找到管理员的id（这里用动网7.0是sp2的数据库演示），从dv_user的userclass就能看出用户是不是管理员，然后到 dv_admin表中找到后台的登陆用户名密码！其中的adduser是他的前台登陆名，一定不能弄错！好，现在开始：如果你脑子中清楚的记得象 admin,admin888,123456,111111 ……之类的弱口令，那直接就冲吧！如果不认识，赶紧启动md5crack工具吧，不过话又说回来，网吧的机器能好到哪里？况且一般用的98，估计即使爆出 来，也得花费你很多银子。不用着急，后台的登陆密码一般从这里dv_log这个表的l_content字段能找到，看这句： username2=source&amp; amp;password2=source888&amp;username1=source&amp;Submit=%CC%ED+%BC%D3意思是 一个用户的用户名密码已经编辑修改，这样可以直接找到后台的用户名密码。前台登陆信息因为没有日志，所以是找不到的，而你又爆破不出来，急德满头大汉的时 候，别着急：用iecv就能解决这个问题-cookies欺骗！ 首先注册一个用户名密码都为hacker的id，然后登陆，记得，在登陆的时候一定要选择保存cookies,然后关闭浏览器，打开iecv，如图：  注：因为是本机上进行操作，所以域名显示是localhost，如果是其他的网站，应该显示是他实际的域名。 然后在底下相应的记录上右键菜单中选择“编辑cookie的内容”，打开，如图：  在编辑cookie内容的窗口里修改这样几项：userid  userclass  username  password依次修改为管理员前台的id，用户名和密码，“新手上路”改为“管理员”，最后点击更改cookie就可以。 再次打开论坛，看是不是变成管理员的id登陆了，菜单里也出现了“管理”，然后就登陆后台吧，如果看到有“备份数据库”或“恢复数据库”的链接，那说明你基本成功了，用这个功能就可以获得一个webshell了！  不过有的时候论坛管理员的操作日志如果已经清除，找不到后台密码的话，那还是多烧几柱香吧，试试暴力破解吧！因为后台是用session认证的，目前欺骗不了的！ 实战之远程控制：当你有了一个webshell的时候，你就可以控制整个网站了。目标仅仅于此吗？狭隘-整个服务器！首先看看他的服务器安装了什么软件：  呵呵，典型的serv-u+pcanywhere标准配置，大干一场吧！ 首先查看下访问权限，如果没有c盘的访问权限，最好先查看下serv-u的版本，在任何一个ftp软件中只输入ip，进行下连接，虽然连不上，但可查看下返回信息，一般都能得到其版本号（中国的网管一般比较懒）（如图）  然后用前面准备的溢出工具进行溢出。然后试着访问c盘，当溢出成功的时候，可以找这个路径下的文件：（如图）  在C:Documents and SettingsAll UsersApplication DataSymantecpcAnywhere 下有扩展名为cif的文件，恭喜你，你找到了！赶紧把他下载下来吧！顺便加一点：看到这个文件名了吧，中间有一个#号，当你下载的时候，看看：  是否想到了数据库中#号的作用！对，防止用正常的方式下载！当然我们可以用不正常的方式了：把地址中的#替换成%23，看是不是和数据库一样就能顺利下载了~~  然后用我们的Pcanywherepwd解出密码  知道了这个，底下该干什么，不用我说了吧！ 后记：本来要写的东西还多，最近忙考试，而且本人的机器配置已严重落伍，很多功能无法演示，网吧的机器确实限制了很多的功能，不方便做记录。其实很多好的工具都需要好好去琢磨，合理利用其功能，很多系统不可能没有漏洞，只要你去用心发觉。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/24/%e7%bd%91%e5%90%a7%e8%8f%9c%e9%b8%9f%e5%85%a5%e9%97%a8%e7%a7%98%e7%b1%8d-%e6%9c%ac%e6%96%87%e5%8f%91%e4%ba%8e%e6%9d%82%e5%bf%97-%e8%80%81%e5%b8%96%e6%96%b0%e5%8f%91.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>动网7.0sp2 cookie欺骗原理 (本文发于杂志)－老帖新发</title>
		<link>http://www.sunboyu.cn/2008/06/24/%e5%8a%a8%e7%bd%9170sp2-cookie%e6%ac%ba%e9%aa%97%e5%8e%9f%e7%90%86-%e6%9c%ac%e6%96%87%e5%8f%91%e4%ba%8e%e6%9d%82%e5%bf%97%ef%bc%8d%e8%80%81%e5%b8%96%e6%96%b0%e5%8f%91.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/24/%e5%8a%a8%e7%bd%9170sp2-cookie%e6%ac%ba%e9%aa%97%e5%8e%9f%e7%90%86-%e6%9c%ac%e6%96%87%e5%8f%91%e4%ba%8e%e6%9d%82%e5%bf%97%ef%bc%8d%e8%80%81%e5%b8%96%e6%96%b0%e5%8f%91.shtml#comments</comments>
		<pubDate>Tue, 24 Jun 2008 13:44:59 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[dvbbs]]></category>

		<category><![CDATA[漏洞]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=144</guid>
		<description><![CDATA[似乎近年来asp脚本的漏洞都来自动网，从sql注入到cookie欺骗，动网无一不首当其冲。树大招风，无不为奇，但在严酷的磨练下，动网最新的版本似乎无懈可击。但网上关于动网入侵的案例不少，总结起来，其实并非动网本身问题，而属论坛配置或管理不当。

动网论坛目前最新版本sql注入似乎不太可能了，而md5加密的16位密码如果设置比较合理的话，暴力破解也非其对手。
目前直接入侵动网无非找一些管理上的不当入侵，比如默认的管理员用户名密码，根据默认的数据库路径盗得数据库等。当有了数据库而无法暴力破解管理员密码的话，cookie欺骗就能大展身手！
然 而在多次cookie欺骗得手而要对动网下黑手时候，问题出现了，在cookie其中几个值进行修改欺骗并不成功，仔细研究后发现，其中password 字段并非md5加密的密文，一般的md5密文均为数字加小写字母或数字加大写字母的形式，大写字母和小写字母放在一起，一定是利用了另外的算法处 理了密码。
打开动网的源代码，从index.asp文件中跟踪到inc/Dv_ClsMain.asp，发现这样几个函数：
If checkStr(Trim(Request.Cookies(Forum_sn)(&#8221;password&#8221;)))=TruePassWord Then
Execute(&#8221;UpDate [Dv_user] Set TruePassWord=&#8217;&#8221;&#38;TruePassWord&#38;&#8221;&#8216; where UserID=&#8221;&#38;UserID)
MemberWord = TruePassWord
Dim iUserInfo
iUserInfo = Session(CacheName &#38; &#8220;UserID&#8221;)
iUserInfo(35) = TruePassWord
Session(CacheName &#38; &#8220;UserID&#8221;) = iUserInfo
End If
第 一句校验如果用户cookie中的password字段值等于数据库中truepassword的值，等会，truepassword，这是什么意思？打 开动网的数据库，果然在dv-user字段中发现userpassword和truepassword两个字段，那这个truepassword是做什么 用的呢？
继续跟踪这个函数：
Public Sub NewPassword0()
If UserID=0 Then Exit Sub
If Not Response.IsClientConnected Then
Exit Sub
End If
Dim TruePassWord,usercookies
usercookies=Request.Cookies(Dvbbs.Forum_sn)(&#8221;usercookies&#8221;)
TruePassWord=Createpass
If (Isnull(usercookies) or usercookies=&#8221;") And Not Isnumeric(usercookies) Then usercookies=0
Select Case Cint(usercookies)
Case 0
Response.Cookies(Forum_sn)(&#8221;usercookies&#8221;) = usercookies
Case 1
Response.Cookies(Forum_sn).Expires=Date+1
Response.Cookies(Forum_sn)(&#8221;usercookies&#8221;) = [...]]]></description>
			<content:encoded><![CDATA[<p>似乎近年来asp脚本的漏洞都来自动网，从sql注入到cookie欺骗，动网无一不首当其冲。树大招风，无不为奇，但在严酷的磨练下，动网最新的版本似乎无懈可击。但网上关于动网入侵的案例不少，总结起来，其实并非动网本身问题，而属论坛配置或管理不当。</p>
<p><span id="more-144"></span><br />
动网论坛目前最新版本sql注入似乎不太可能了，而md5加密的16位密码如果设置比较合理的话，暴力破解也非其对手。<br />
目前直接入侵动网无非找一些管理上的不当入侵，比如默认的管理员用户名密码，根据默认的数据库路径盗得数据库等。当有了数据库而无法暴力破解管理员密码的话，cookie欺骗就能大展身手！<br />
然 而在多次cookie欺骗得手而要对动网下黑手时候，问题出现了，在cookie其中几个值进行修改欺骗并不成功，仔细研究后发现，其中password 字段并非md5加密的密文，一般的md5密文均为数字加小写字母或数字加大写字母的形式，大写字母和小写字母放在一起，一定是利用了另外的算法处 理了密码。<br />
打开动网的源代码，从index.asp文件中跟踪到inc/Dv_ClsMain.asp，发现这样几个函数：<br />
If checkStr(Trim(Request.Cookies(Forum_sn)(&#8221;password&#8221;)))=TruePassWord Then<br />
Execute(&#8221;UpDate [Dv_user] Set TruePassWord=&#8217;&#8221;&amp;TruePassWord&amp;&#8221;&#8216; where UserID=&#8221;&amp;UserID)<br />
MemberWord = TruePassWord<br />
Dim iUserInfo<br />
iUserInfo = Session(CacheName &amp; &#8220;UserID&#8221;)<br />
iUserInfo(35) = TruePassWord<br />
Session(CacheName &amp; &#8220;UserID&#8221;) = iUserInfo<br />
End If<br />
第 一句校验如果用户cookie中的password字段值等于数据库中truepassword的值，等会，truepassword，这是什么意思？打 开动网的数据库，果然在dv-user字段中发现userpassword和truepassword两个字段，那这个truepassword是做什么 用的呢？<br />
继续跟踪这个函数：<br />
Public Sub NewPassword0()<br />
If UserID=0 Then Exit Sub<br />
If Not Response.IsClientConnected Then<br />
Exit Sub<br />
End If<br />
Dim TruePassWord,usercookies<br />
usercookies=Request.Cookies(Dvbbs.Forum_sn)(&#8221;usercookies&#8221;)<br />
TruePassWord=Createpass<br />
If (Isnull(usercookies) or usercookies=&#8221;") And Not Isnumeric(usercookies) Then usercookies=0<br />
Select Case Cint(usercookies)<br />
Case 0<br />
Response.Cookies(Forum_sn)(&#8221;usercookies&#8221;) = usercookies<br />
Case 1<br />
Response.Cookies(Forum_sn).Expires=Date+1<br />
Response.Cookies(Forum_sn)(&#8221;usercookies&#8221;) = usercookies<br />
Case 2<br />
Response.Cookies(Forum_sn).Expires=Date+31<br />
Response.Cookies(Forum_sn)(&#8221;usercookies&#8221;) = usercookies<br />
Case 3<br />
Response.Cookies(Forum_sn).Expires=Date+365<br />
Response.Cookies(Forum_sn)(&#8221;usercookies&#8221;) = usercookies<br />
End Select<br />
Response.Cookies(Forum_sn).path=cookiepath<br />
Response.Cookies(Forum_sn)(&#8221;username&#8221;) = MemberName<br />
Response.Cookies(Forum_sn)(&#8221;UserID&#8221;) = UserID<br />
Response.Cookies(Forum_sn)(&#8221;userclass&#8221;) = checkStr(Request.Cookies(Forum_sn)(&#8221;userclass&#8221;))<br />
Response.Cookies(Forum_sn)(&#8221;userhidden&#8221;) = UserHidden<br />
Response.Cookies(Forum_sn)(&#8221;password&#8221;) = TruePassWord<br />
&#8216;检查写入是否成功如果成功则更新数据<br />
If checkStr(Trim(Request.Cookies(Forum_sn)(&#8221;password&#8221;)))=TruePassWord Then<br />
Execute(&#8221;UpDate [Dv_user] Set TruePassWord=&#8217;&#8221;&amp;TruePassWord&amp;&#8221;&#8216; where UserID=&#8221;&amp;UserID)<br />
MemberWord = TruePassWord<br />
Dim iUserInfo<br />
iUserInfo = Session(CacheName &amp; &#8220;UserID&#8221;)<br />
iUserInfo(35) = TruePassWord<br />
Session(CacheName &amp; &#8220;UserID&#8221;) = iUserInfo<br />
End If<br />
End Sub<br />
可以看出，论坛在对用户的cookie进行校验的时候，其中的密码项是用一个truepassword进行对照的，而在这个函数中，truepassword定义后赋值的时候给的是这个值：TruePassWord=Createpass，查看createpass函数，<br />
Public Function Createpass()<br />
Dim Ran,i,LengthNum<br />
LengthNum=16<br />
Createpass=&#8221;"<br />
For i=1 To LengthNum<br />
Randomize<br />
Ran = CInt(Rnd * 2)<br />
Randomize<br />
If Ran = 0 Then<br />
Ran = CInt(Rnd * 25) + 97<br />
Createpass =Createpass&amp; UCase(Chr(Ran))<br />
ElseIf Ran = 1 Then<br />
Ran = CInt(Rnd * 9)<br />
Createpass = Createpass &amp; Ran<br />
ElseIf Ran = 2 Then<br />
Ran = CInt(Rnd * 25) + 97<br />
Createpass =Createpass&amp; Chr(Ran)<br />
End If<br />
Next<br />
End Function<br />
这是一个系统分配随机密码的函数，通过跟踪下边这个函数：<br />
Public Sub NewPassword()<br />
If UserID=0 Then Exit Sub<br />
Response.Write &#8220;&lt;i fr-ame width=&#8221;"0&#8243;&#8221; height=&#8221;"0&#8243;&#8221; src=&#8221;"newpass.asp&#8221;" name=&#8221;"Dvnewpass&#8221;"&gt;&lt;/if-rame&gt;&#8221;<br />
End Sub<br />
可 以得出结论：动网在用户打开页面的时候，通过cookie检查用户的信息，然后进行密码校验的时候并不是通过用户的真实password，而是通过一个 truepassword进行验证，如果验证通过，则重新分配一个随机密码createpass，刷新数据库中truepassword的值为 createpass，然后用户登陆信息写入服务器端session；当cookie校验不能通过的时候，显示登陆错误信息，调用登陆页面，提示用户登 陆，当用户输入正确的用户名密码的时候（这次的验证在login.asp页面中的Dvbbs_ChkLogin函数中），用户正确登陆，系统仍然分配一个 随机的密码储存在truepassword字段中，供下次登陆校验用。<br />
可以看出，动网论坛在防止cookie欺骗上确实下了一番工夫，是不是这样 就不能进行欺骗了呢？不是：当你要进行对动网的欺骗的时候，只要把cookie中password中的值替换成数据库中truepassword的值就可 以，但要注意：从你盗得数据库到你进行欺骗的中间，你要使用的帐户不能再登陆，否则数据库中的truepassword值又会更新，那你那时候肯定是欺骗 不成功的！<br />
可以看出，动网论坛在各个地方考虑都是很周到的，虽然cookie验证的代码增加了好多，但为了安全性的提高降低了程序的效率，也是有必要的，这样一来，动网的安全性才能在磨练中不断提升！<br />
通过这次分析，初学者应该学会对程序的跟踪和分析，其实也是每个学编程的必须掌握的知识。在碰到这类问题的时候，拿出程序的代码仔细分析，你肯定会有新的发现，可能下一个首发漏洞的发现者就是你！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/24/%e5%8a%a8%e7%bd%9170sp2-cookie%e6%ac%ba%e9%aa%97%e5%8e%9f%e7%90%86-%e6%9c%ac%e6%96%87%e5%8f%91%e4%ba%8e%e6%9d%82%e5%bf%97%ef%bc%8d%e8%80%81%e5%b8%96%e6%96%b0%e5%8f%91.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>白盒测试与黑盒测试</title>
		<link>http://www.sunboyu.cn/2008/06/24/%e7%99%bd%e7%9b%92%e6%b5%8b%e8%af%95%e4%b8%8e%e9%bb%91%e7%9b%92%e6%b5%8b%e8%af%95.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/24/%e7%99%bd%e7%9b%92%e6%b5%8b%e8%af%95%e4%b8%8e%e9%bb%91%e7%9b%92%e6%b5%8b%e8%af%95.shtml#comments</comments>
		<pubDate>Tue, 24 Jun 2008 13:34:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[其他]]></category>

		<category><![CDATA[白盒测试]]></category>

		<category><![CDATA[软件工程]]></category>

		<category><![CDATA[黑盒测试]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=142</guid>
		<description><![CDATA[所谓白盒，指透明的盒子，你知道盒子里的内容，可以针对具体的内容进行测试。
黑盒，就是封闭的盒子，你不知道盒子的内容，只能知道这是个盒子，我只能猜测，或者根据盒子的外形，特征，去研究我该怎么用它。
程序开发中，白盒测试，一般是根据程序的功能进行有针对性的测试。
针对具体功能模块进行测试。首先，软件基本完成后，程序不能有研究bug，就是功能性的缺陷，这是必须的。
针对一些逻辑进行测试。程序走通后，针对不同的逻辑进行测试。尽量去测试逻辑的每一个分支，比如，用户上，测试管理员跟普通用户的不同权限下程序的使用。
数据准确性的测试。数据在程序中经过重重计算，输入数据跟最终表现数据未必是一致。这样就得测试数据在各个环节进行传递是否正确。
数据合法性测试。合法性主要在于各个模块中数据输入的合法性。比如数据类型，字段长度，范围等。
而黑盒，一般是指功能基本完成后，交付给测试部门进行业务的测试。测试人员不知道程序是如何构建，而只是根据功能说明或者一些模块测试说明书进行测试。黑盒测试人员要求对业务比较熟练，能够考虑多种实际发生的业务数据进行测试。
]]></description>
			<content:encoded><![CDATA[<p>所谓白盒，指透明的盒子，你知道盒子里的内容，可以针对具体的内容进行测试。</p>
<p>黑盒，就是封闭的盒子，你不知道盒子的内容，只能知道这是个盒子，我只能猜测，或者根据盒子的外形，特征，去研究我该怎么用它。</p>
<p>程序开发中，白盒测试，一般是根据程序的功能进行有针对性的测试。</p>
<p>针对具体功能模块进行测试。首先，软件基本完成后，程序不能有研究bug，就是功能性的缺陷，这是必须的。</p>
<p>针对一些逻辑进行测试。程序走通后，针对不同的逻辑进行测试。尽量去测试逻辑的每一个分支，比如，用户上，测试管理员跟普通用户的不同权限下程序的使用。</p>
<p>数据准确性的测试。数据在程序中经过重重计算，输入数据跟最终表现数据未必是一致。这样就得测试数据在各个环节进行传递是否正确。</p>
<p>数据合法性测试。合法性主要在于各个模块中数据输入的合法性。比如数据类型，字段长度，范围等。</p>
<p>而黑盒，一般是指功能基本完成后，交付给测试部门进行业务的测试。测试人员不知道程序是如何构建，而只是根据功能说明或者一些模块测试说明书进行测试。黑盒测试人员要求对业务比较熟练，能够考虑多种实际发生的业务数据进行测试。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/24/%e7%99%bd%e7%9b%92%e6%b5%8b%e8%af%95%e4%b8%8e%e9%bb%91%e7%9b%92%e6%b5%8b%e8%af%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Linux安装FMS2</title>
		<link>http://www.sunboyu.cn/2008/06/23/linux%e5%ae%89%e8%a3%85fms2.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/23/linux%e5%ae%89%e8%a3%85fms2.shtml#comments</comments>
		<pubDate>Mon, 23 Jun 2008 07:01:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[FMS2]]></category>

		<category><![CDATA[安装]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=134</guid>
		<description><![CDATA[首先下载 FlashMediaServer2.tar.gz  http://aw.awflasher.com/FMS2/FlashMediaServer2.tar.gz
解压后，检测组件是否完全
#ldd fmscore
[root@localhost FMS_2_0_3_r68_linux]# ldd fmscore
linux-gate.so.1 =&#62;  (0&#215;0032b000)
libssl.so.4 =&#62; not found
libpthread.so.0 =&#62; /lib/libpthread.so.0 (0&#215;007f7000)
libnspr4.so =&#62; /usr/lib/libnspr4.so (0&#215;00b24000)
libplc4.so =&#62; /usr/lib/libplc4.so (0&#215;0020c000)
libplds4.so =&#62; /usr/lib/libplds4.so (0&#215;00198000)
librt.so.1 =&#62; /lib/librt.so.1 (0&#215;002f4000)
libdl.so.2 =&#62; /lib/libdl.so.2 (0&#215;001d2000)
libstdc++.so.5 =&#62; not found
libm.so.6 =&#62; /lib/libm.so.6 (0&#215;009c0000)
libgcc_s.so.1 =&#62; /lib/libgcc_s.so.1 (0&#215;001f1000)
libc.so.6 =&#62; /lib/libc.so.6 (0&#215;003c6000)
/lib/ld-linux.so.2 (0&#215;0090e000)
libcrypto.so.4 =&#62; not found
[root@localhost FMS_2_0_3_r68_linux]#
缺少 libssl.so.4  libstdc++.so.5 libcrypto.so.4
其实这些库是有的，只是名字不是，或者版本比较高，建立一个链接就行
ln -s /usr/lib/libssl.so /usr/lib/libssl.so.4
其他也这样就行。
./installFMS
如果总是提示出错(./installFMS -platformWarnOnly)
这样即可。低下按照提示一步步来就行。
./fmsmgr list   [...]]]></description>
			<content:encoded><![CDATA[<p>首先下载 FlashMediaServer2.tar.gz  http://aw.awflasher.com/FMS2/FlashMediaServer2.tar.gz</p>
<p>解压后，检测组件是否完全</p>
<p>#ldd fmscore</p>
<p>[root@localhost FMS_2_0_3_r68_linux]# ldd fmscore<br />
linux-gate.so.1 =&gt;  (0&#215;0032b000)<br />
libssl.so.4 =&gt; not found<br />
libpthread.so.0 =&gt; /lib/libpthread.so.0 (0&#215;007f7000)<br />
libnspr4.so =&gt; /usr/lib/libnspr4.so (0&#215;00b24000)<br />
libplc4.so =&gt; /usr/lib/libplc4.so (0&#215;0020c000)<br />
libplds4.so =&gt; /usr/lib/libplds4.so (0&#215;00198000)<br />
librt.so.1 =&gt; /lib/librt.so.1 (0&#215;002f4000)<br />
libdl.so.2 =&gt; /lib/libdl.so.2 (0&#215;001d2000)<br />
libstdc++.so.5 =&gt; not found<br />
libm.so.6 =&gt; /lib/libm.so.6 (0&#215;009c0000)<br />
libgcc_s.so.1 =&gt; /lib/libgcc_s.so.1 (0&#215;001f1000)<br />
libc.so.6 =&gt; /lib/libc.so.6 (0&#215;003c6000)<br />
/lib/ld-linux.so.2 (0&#215;0090e000)<br />
libcrypto.so.4 =&gt; not found<br />
[root@localhost FMS_2_0_3_r68_linux]#</p>
<p>缺少 libssl.so.4  libstdc++.so.5 libcrypto.so.4</p>
<p>其实这些库是有的，只是名字不是，或者版本比较高，建立一个链接就行</p>
<p>ln -s /usr/lib/libssl.so /usr/lib/libssl.so.4</p>
<p>其他也这样就行。</p>
<p>./installFMS<br />
如果总是提示出错(./installFMS -platformWarnOnly)</p>
<p>这样即可。低下按照提示一步步来就行。</p>
<p>./fmsmgr list   可以查看运行的状态</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/23/linux%e5%ae%89%e8%a3%85fms2.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>视频网站通用结构图</title>
		<link>http://www.sunboyu.cn/2008/06/22/%e8%a7%86%e9%a2%91%e7%bd%91%e7%ab%99%e9%80%9a%e7%94%a8%e7%bb%93%e6%9e%84%e5%9b%be.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/22/%e8%a7%86%e9%a2%91%e7%bd%91%e7%ab%99%e9%80%9a%e7%94%a8%e7%bb%93%e6%9e%84%e5%9b%be.shtml#comments</comments>
		<pubDate>Sun, 22 Jun 2008 12:16:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[结构]]></category>

		<category><![CDATA[视频网站]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=132</guid>
		<description><![CDATA[
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2008/06/e8a786e9a291e7bd91e7ab99e7bb93e69e84e8aebee8aea1.jpg"><img src="http://www.sunboyu.cn/upfiles/2008/06/e8a786e9a291e7bd91e7ab99e7bb93e69e84e8aebee8aea1.jpg" border="0" alt="" width="630" height="372" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/22/%e8%a7%86%e9%a2%91%e7%bd%91%e7%ab%99%e9%80%9a%e7%94%a8%e7%bb%93%e6%9e%84%e5%9b%be.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Mysql备份SHELL v1.0demo版问世</title>
		<link>http://www.sunboyu.cn/2008/06/22/mysql%e5%a4%87%e4%bb%bdshell-v10demo%e7%89%88%e9%97%ae%e4%b8%96.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/22/mysql%e5%a4%87%e4%bb%bdshell-v10demo%e7%89%88%e9%97%ae%e4%b8%96.shtml#comments</comments>
		<pubDate>Sat, 21 Jun 2008 20:57:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[cli.phpshell]]></category>

		<category><![CDATA[shell]]></category>

		<category><![CDATA[杜江]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=130</guid>
		<description><![CDATA[虽然功能不是很完善，应该很不完善，但还是放出来让大家批评一下。
感谢PHP开源支持者的鼓励，感谢杜江老师的鼓励。mysqldump v1.0 demo 下载 版权所有，欢迎盗版！
源代码

#!/usr/local/bin/php -q
# mysql cron manager system
# sunboyu@gmail.com
# v1.0
define(&#8217;SUN_FILE_NAME&#8217;,'bak.sh&#8217;);
define(&#8217;SUN_BAK_PATH&#8217;,&#8217;./&#8217;); #bak path
define(&#8217;SUN_CFG_PATH&#8217;,&#8217;./&#8217;); #config file path
define(&#8217;SUN_LOG_PATH&#8217;,&#8217;./&#8217;); #log file path
define(&#8217;SUN_DATABASE_CHARACTER&#8217;,'UTF-8&#8242;); #mysql character
define(&#8217;SUN_SHELL_EXEC&#8217;,&#8221;system&#8221;);
define(&#8217;SUN_IS_TAR&#8217;,0);
#save temp argv in session
session_start();
Main::mains();
class Main
{
//main()
public static function mains()
{
KernelInfo::version();
self::getUserInput();
}
//for user&#8217;s inpyt
public function getUserInput()
{
while(($u_char = KernelBase::cgetchar(&#8217;shell&#8217;))&#38;&#38;($u_char != &#8216;quit&#8217;))
{
switch($u_char)
{
case &#8220;&#8211;help&#8221;:
KernelInfo::help();
break;
case &#8220;&#8211;version&#8221;:
KernelInfo::version();
break;
case &#8220;&#8211;check&#8221;:
KernelInfo::checksystem();
break;
case &#8220;&#8211;mysqldump&#8221;:
Mysql::MysqlGuide();
break;
default:
print(&#8221;error input!\n&#8221;);
break;
}
}
}
}
class KernelBase
{
//get input string
public function cgetchar( $cue = false )
{
if( $cue )
{
print($cue.&#8221;:&#8221;);
}
$string = [...]]]></description>
			<content:encoded><![CDATA[<p>虽然功能不是很完善，应该很不完善，但还是放出来让大家批评一下。</p>
<p>感谢PHP开源支持者的鼓励，感谢杜江老师的鼓励。<a href="http://www.sunboyu.cn/upfiles/2008/06/mysqldump.sh">mysqldump v1.0 demo 下载</a> 版权所有，欢迎盗版！</p>
<p>源代码</p>
<p><span id="more-130"></span></p>
<p>#!/usr/local/bin/php -q<br />
<!--p<br--># mysql cron manager system<br />
# sunboyu@gmail.com<br />
# v1.0<br />
define(&#8217;SUN_FILE_NAME&#8217;,'bak.sh&#8217;);<br />
define(&#8217;SUN_BAK_PATH&#8217;,&#8217;./&#8217;); #bak path<br />
define(&#8217;SUN_CFG_PATH&#8217;,&#8217;./&#8217;); #config file path<br />
define(&#8217;SUN_LOG_PATH&#8217;,&#8217;./&#8217;); #log file path<br />
define(&#8217;SUN_DATABASE_CHARACTER&#8217;,'UTF-8&#8242;); #mysql character<br />
define(&#8217;SUN_SHELL_EXEC&#8217;,&#8221;system&#8221;);<br />
define(&#8217;SUN_IS_TAR&#8217;,0);<br />
#save temp argv in session<br />
session_start();</p>
<p>Main::mains();</p>
<p>class Main<br />
{<br />
//main()<br />
public static function mains()<br />
{<br />
KernelInfo::version();<br />
self::getUserInput();<br />
}<br />
//for user&#8217;s inpyt<br />
public function getUserInput()<br />
{<br />
while(($u_char = KernelBase::cgetchar(&#8217;shell&#8217;))&amp;&amp;($u_char != &#8216;quit&#8217;))<br />
{<br />
switch($u_char)<br />
{<br />
case &#8220;&#8211;help&#8221;:<br />
KernelInfo::help();<br />
break;<br />
case &#8220;&#8211;version&#8221;:<br />
KernelInfo::version();<br />
break;<br />
case &#8220;&#8211;check&#8221;:<br />
KernelInfo::checksystem();<br />
break;<br />
case &#8220;&#8211;mysqldump&#8221;:<br />
Mysql::MysqlGuide();<br />
break;<br />
default:<br />
print(&#8221;error input!\n&#8221;);<br />
break;<br />
}<br />
}<br />
}<br />
}</p>
<p>class KernelBase<br />
{<br />
//get input string<br />
public function cgetchar( $cue = false )<br />
{<br />
if( $cue )<br />
{<br />
print($cue.&#8221;:&#8221;);<br />
}<br />
$string = trim(fgets(STDIN));<br />
return $string;<br />
}<br />
//get argvs<br />
public function cgetargv( $string )<br />
{<br />
if(!empty($string))<br />
{<br />
$argvs = explode( &#8221; &#8221; , $string );<br />
$reargvs = false;<br />
for( $i = 0; $i &lt; count($argvs) ; $i++ )<br />
{<br />
if( $argvs[$i][0]==&#8217;-&#8217; &amp;&amp; $argvs[$i][1]==&#8217;-&#8217; )<br />
{<br />
$reargvs[$argvs[$i]] = true;<br />
$x++;<br />
}<br />
else if( $argvs[$i][0]==&#8217;-&#8217; &amp;&amp; $argvs[$i][1]!=&#8217;-&#8217; )<br />
{<br />
$reargvs[$argvs[$i]] = isset($argvs[($i+1)])&amp;&amp;($argvs[($i+1)][0]!=&#8217;-')&amp;&amp;($argvs[($i+1)][0]!=&#8221;) ? $argvs[($i+1)] : &#8221;;<br />
isset($argvs[($i+1)])&amp;&amp;($argvs[($i+1)][0]!=&#8217;-')&amp;&amp;($argvs[($i+1)][0]!=&#8221;) ? $i++ : &#8221;;<br />
}<br />
}<br />
return $reargvs;<br />
}<br />
else<br />
{<br />
return false;<br />
}<br />
}<br />
}</p>
<p>class KernelIO<br />
{<br />
//write file<br />
public function write_file( $filename , $content )<br />
{<br />
$handle = fopen( $filename );<br />
fwrite( $handle , $content );<br />
fclose( $handle );<br />
}<br />
}<br />
class KernelInfo<br />
{<br />
//show version<br />
public function version()<br />
{<br />
print(&#8221;##################################\n&#8221;);<br />
print(&#8221;# Mysql Back Cron Manage Shell #\n&#8221;);<br />
print(&#8221;# Auth: sunboyu #\n&#8221;);<br />
print(&#8221;# Version: v1.0 #\n&#8221;);<br />
print(&#8221;##################################\n&#8221;);<br />
}<br />
//show help<br />
public function help()<br />
{<br />
print(sprintf(&#8221;%s [--version] [--help] [--check]\n&#8221;,SUN_FILE_NAME));<br />
print(&#8221; &#8211;version Show\n&#8221;);<br />
print(&#8221; &#8211;help This Help\n&#8221;);<br />
print(&#8221; &#8211;check This Help\n&#8221;);<br />
}<br />
//check system info<br />
public function checksystem()<br />
{<br />
print(&#8221;System:&#8221;.$_GLOBAL['System'].&#8221;\n&#8221;);<br />
$check_dir = array( SUN_BAK_PATH , SUN_CFG_PATH , SUN_LOG_PATH );<br />
foreach($check_dir as $key =&gt; $value)<br />
{<br />
if(is_writable($value))<br />
{<br />
print(&#8221;The dir &#8216;&#8221;.$value.&#8221;&#8216; is writable!\n&#8221;);<br />
}<br />
else<br />
{<br />
print(&#8221;The dir &#8216;&#8221;.$value.&#8221;&#8216; is unwritable.Please check the power!\n&#8221;);<br />
print(&#8221;The shell is stop!&#8221;);<br />
exit();<br />
}<br />
}<br />
$shell_exec = SUN_SHELL_EXEC;<br />
if($shell_exec(&#8217;ls&#8217;))<br />
{<br />
print(&#8221;The shell can execute &#8220;.SUN_SHELL_EXEC.&#8221;;\n&#8221;);<br />
}<br />
else<br />
{<br />
print(&#8221;The shell can&#8217;t execute &#8220;.SUN_SHELL_EXEC.&#8221;;\n&#8221;);<br />
print(&#8221;The shell is stop!&#8221;);<br />
exit();<br />
}<br />
print(&#8221;The Shell can work in this system!\n&#8221;);<br />
}<br />
//check is writeable the dir<br />
public function is_writeable( $dir )<br />
{<br />
return @is_writable( $dir );<br />
}<br />
}</p>
<p>#Mysql Dump<br />
class Mysql<br />
{<br />
function MysqlGuide()<br />
{<br />
$mysqlargv = array(<br />
&#8216;-host&#8217; =&gt; false,<br />
&#8216;-username&#8217; =&gt; false,<br />
&#8216;-password&#8217; =&gt; false,<br />
&#8216;-datebase&#8217; =&gt; false,<br />
&#8216;-otherargv&#8217; =&gt; false<br />
);<br />
$argvs = KernelBase::cgetargv(KernelBase::cgetchar(&#8221;input argv&#8221;));<br />
foreach($argvs as $key =&gt; $value)<br />
{<br />
$mysqlargv[$key] = empty($value) ? &#8221; : $value;<br />
}<br />
if($mysqlargv['-host']&amp;&amp;$mysqlargv['-username']&amp;&amp;$mysqlargv['-datebase'])<br />
{<br />
self::Mysqldump( $mysqlargv['-host'] , $mysqlargv['-username'] , $mysqlargv['-password'] , $mysqlargv['-datebase'] , $mysqlargv['-otherargv'] );<br />
}<br />
else<br />
{<br />
print(&#8221;error vars!\n&#8221;);<br />
}<br />
}<br />
function Mysqldump( $host = false , $username = false , $password = &#8221; , $datebase = false , $otherargv = false )<br />
{<br />
$shell_exec = SUN_SHELL_EXEC;<br />
if($host&amp;&amp;$username&amp;&amp;$datebase)<br />
{<br />
$command = &#8220;mysqldump &#8211;opt &#8220;.$datebase.&#8221; -u&#8221;.$datebase.&#8221; -p&#8221;.$db_password.( $otherargv ? $otherargv : &#8221; ).&#8221; &gt; &#8220;.SUN_BAK_PATH.&#8221;db_bak.sql&#8221;;<br />
$feedback = $shell_exec( $command );<br />
print($feedback.&#8221;\n&#8221;);<br />
}<br />
}<br />
}</p>
<p>?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/22/mysql%e5%a4%87%e4%bb%bdshell-v10demo%e7%89%88%e9%97%ae%e4%b8%96.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>关于产品设计的一点感想</title>
		<link>http://www.sunboyu.cn/2008/06/21/%e5%85%b3%e4%ba%8e%e4%ba%a7%e5%93%81%e8%ae%be%e8%ae%a1%e7%9a%84%e4%b8%80%e7%82%b9%e6%84%9f%e6%83%b3.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/21/%e5%85%b3%e4%ba%8e%e4%ba%a7%e5%93%81%e8%ae%be%e8%ae%a1%e7%9a%84%e4%b8%80%e7%82%b9%e6%84%9f%e6%83%b3.shtml#comments</comments>
		<pubDate>Sat, 21 Jun 2008 15:36:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[软件工程]]></category>

		<category><![CDATA[软件设计]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=129</guid>
		<description><![CDATA[虽然不是高手，但我是那种软件兼施的人，从程序设计，排页面，到服务器，虽然水平跟高手没法去比，但也能搞出个七上八下。
上篇日志开始了我的一个软件产品，设计的过程中遇见了我预料中的问题。
1、通用性：windows?linux?你真的不知道用户会在什么平台下用啊。幸亏我这个就专为linux定制！摆脱了平台兼容的问题。
2、接口：把什么接口留给用户，把哪些设置开放给用户，是个头疼的问题。留得接口太多了，一些初级菜鸟该骂娘了，接口少了，人家会认为你的东西没啥可用的东西，太死板。
3、用户接口：以前在web中设计用户的操作流程，现在用命令行，幸亏大学中C是基础课，能勉强解决。
4、界面：尽量仿一些通用的操作系统，尽量友好的反馈。
做，跟让别人做，还是两个不同的概念。实现跟帮助别人实现，本身就不是一个层次的问题。
]]></description>
			<content:encoded><![CDATA[<p>虽然不是高手，但我是那种软件兼施的人，从程序设计，排页面，到服务器，虽然水平跟高手没法去比，但也能搞出个七上八下。</p>
<p>上篇日志开始了我的一个软件产品，设计的过程中遇见了我预料中的问题。</p>
<p>1、通用性：windows?linux?你真的不知道用户会在什么平台下用啊。幸亏我这个就专为linux定制！摆脱了平台兼容的问题。</p>
<p>2、接口：把什么接口留给用户，把哪些设置开放给用户，是个头疼的问题。留得接口太多了，一些初级菜鸟该骂娘了，接口少了，人家会认为你的东西没啥可用的东西，太死板。</p>
<p>3、用户接口：以前在web中设计用户的操作流程，现在用命令行，幸亏大学中C是基础课，能勉强解决。</p>
<p>4、界面：尽量仿一些通用的操作系统，尽量友好的反馈。</p>
<p>做，跟让别人做，还是两个不同的概念。实现跟帮助别人实现，本身就不是一个层次的问题。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/21/%e5%85%b3%e4%ba%8e%e4%ba%a7%e5%93%81%e8%ae%be%e8%ae%a1%e7%9a%84%e4%b8%80%e7%82%b9%e6%84%9f%e6%83%b3.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>基于PHP-CLI的数据库备份管理软件今日奠基</title>
		<link>http://www.sunboyu.cn/2008/06/20/%e5%9f%ba%e4%ba%8ephp-cli%e7%9a%84%e6%95%b0%e6%8d%ae%e5%ba%93%e5%a4%87%e4%bb%bd%e7%ae%a1%e7%90%86%e8%bd%af%e4%bb%b6%e4%bb%8a%e6%97%a5%e5%a5%a0%e5%9f%ba.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/20/%e5%9f%ba%e4%ba%8ephp-cli%e7%9a%84%e6%95%b0%e6%8d%ae%e5%ba%93%e5%a4%87%e4%bb%bd%e7%ae%a1%e7%90%86%e8%bd%af%e4%bb%b6%e4%bb%8a%e6%97%a5%e5%a5%a0%e5%9f%ba.shtml#comments</comments>
		<pubDate>Fri, 20 Jun 2008 15:37:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[PHP]]></category>

		<category><![CDATA[dump]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[软件]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=128</guid>
		<description><![CDATA[确定了基本的功能

创建任务mysql数据库备份任务
管理cron任务跟备份任务的结合
任务管理

基本能满足一个网管备份mysql的日常操作。
由于是第一个版本，没做太多的功能，实现再说。
这个东东也是展示下PHP功能的强大。PHP代替Perl也不是不可能的。
]]></description>
			<content:encoded><![CDATA[<p>确定了基本的功能</p>
<ul>
<li>创建任务mysql数据库备份任务</li>
<li>管理cron任务跟备份任务的结合</li>
<li>任务管理</li>
</ul>
<p>基本能满足一个网管备份mysql的日常操作。</p>
<p>由于是第一个版本，没做太多的功能，实现再说。</p>
<p>这个东东也是展示下PHP功能的强大。PHP代替Perl也不是不可能的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/20/%e5%9f%ba%e4%ba%8ephp-cli%e7%9a%84%e6%95%b0%e6%8d%ae%e5%ba%93%e5%a4%87%e4%bb%bd%e7%ae%a1%e7%90%86%e8%bd%af%e4%bb%b6%e4%bb%8a%e6%97%a5%e5%a5%a0%e5%9f%ba.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>像写C一样写PHP</title>
		<link>http://www.sunboyu.cn/2008/06/19/%e5%83%8f%e5%86%99c%e4%b8%80%e6%a0%b7%e5%86%99php.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/19/%e5%83%8f%e5%86%99c%e4%b8%80%e6%a0%b7%e5%86%99php.shtml#comments</comments>
		<pubDate>Thu, 19 Jun 2008 15:31:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[感悟]]></category>

		<category><![CDATA[PHPer]]></category>

		<category><![CDATA[效率]]></category>

		<category><![CDATA[编码]]></category>

		<category><![CDATA[草根]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=126</guid>
		<description><![CDATA[除了咱写PHP的，好多程序员还是或多或少看不起PHPer，php的优点就是随意，因此，一个稍有编程基础的人也能很快上手去写一些应用模块。
php的随意更体现在它本身为弱类型的语言，加上php核心的智能处理很很好的报错机制，一些随手写出的程序也能但当一部分任务。
时间长了，好像人们都养成了这种习惯，过多得依赖了php本身的优点，使得程序员自身一些习惯退化，而真正变成的‘代码工人’。
而科班出身的程序员，基本都学习过c语言编程，软件工程，数据结构之类的课程。回过头来看看我自己写的代码，那些基本的东西已经抛弃大多，而PHP作为草根语言，无章法，随意，也被我体现得淋漓尽致。
看看我自己程序暴露的问题：结构混乱，难读，效率低下，冗余，这些都是自身对PHP认识问题而造成。php本身创建了优秀的容错机制，然而并不是说我们必须依赖这些机制。而我们同样可以像写C一样来写PHP，从每个变量的初始化，数据类型的定义，变量用完后的注销，类的优化，算法的优化，都可以体现在PHP上。
再说效率，很多人说PHP效率不行，我认为这纯属认识问题。在处理大量数据的时候，PHP优点力不从心，但这样只是从片面考虑，从PHP的接口来看，PHP很容易跟其他语言进行对接，C,C++,JAVA……，当然，在一些复杂运算上，我们完全可以交给其他语言来做，通过丰富的接口来传递数据。
任何语言都不是完美的，我们只是在最能体现它优势的地方来用他。PHP的优势在于快速构建WEB应用系统，简单，上手，如果我们能把写C的习惯应用到做PHP上，那PHPer绝对不能成为草根。
]]></description>
			<content:encoded><![CDATA[<p>除了咱写PHP的，好多程序员还是或多或少看不起PHPer，php的优点就是随意，因此，一个稍有编程基础的人也能很快上手去写一些应用模块。<br />
php的随意更体现在它本身为弱类型的语言，加上php核心的智能处理很很好的报错机制，一些随手写出的程序也能但当一部分任务。<br />
时间长了，好像人们都养成了这种习惯，过多得依赖了php本身的优点，使得程序员自身一些习惯退化，而真正变成的‘代码工人’。<br />
而科班出身的程序员，基本都学习过c语言编程，软件工程，数据结构之类的课程。回过头来看看我自己写的代码，那些基本的东西已经抛弃大多，而PHP作为草根语言，无章法，随意，也被我体现得淋漓尽致。<br />
看看我自己程序暴露的问题：结构混乱，难读，效率低下，冗余，这些都是自身对PHP认识问题而造成。php本身创建了优秀的容错机制，然而并不是说我们必须依赖这些机制。而我们同样可以像写C一样来写PHP，从每个变量的初始化，数据类型的定义，变量用完后的注销，类的优化，算法的优化，都可以体现在PHP上。<br />
再说效率，很多人说PHP效率不行，我认为这纯属认识问题。在处理大量数据的时候，PHP优点力不从心，但这样只是从片面考虑，从PHP的接口来看，PHP很容易跟其他语言进行对接，C,C++,JAVA……，当然，在一些复杂运算上，我们完全可以交给其他语言来做，通过丰富的接口来传递数据。<br />
任何语言都不是完美的，我们只是在最能体现它优势的地方来用他。PHP的优势在于快速构建WEB应用系统，简单，上手，如果我们能把写C的习惯应用到做PHP上，那PHPer绝对不能成为草根。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/19/%e5%83%8f%e5%86%99c%e4%b8%80%e6%a0%b7%e5%86%99php.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>继续努力！</title>
		<link>http://www.sunboyu.cn/2008/06/19/%e7%bb%a7%e7%bb%ad%e5%8a%aa%e5%8a%9b%ef%bc%81.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/19/%e7%bb%a7%e7%bb%ad%e5%8a%aa%e5%8a%9b%ef%bc%81.shtml#comments</comments>
		<pubDate>Thu, 19 Jun 2008 13:07:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=125</guid>
		<description><![CDATA[下午完成了网站错误日志的跟踪系统，我发现我写代码效率还挺高的，赞一个!
]]></description>
			<content:encoded><![CDATA[<p>下午完成了网站错误日志的跟踪系统，我发现我写代码效率还挺高的，赞一个!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/19/%e7%bb%a7%e7%bb%ad%e5%8a%aa%e5%8a%9b%ef%bc%81.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>被困难压住了！</title>
		<link>http://www.sunboyu.cn/2008/06/18/%e8%a2%ab%e5%9b%b0%e9%9a%be%e5%8e%8b%e4%bd%8f%e4%ba%86%ef%bc%81.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/18/%e8%a2%ab%e5%9b%b0%e9%9a%be%e5%8e%8b%e4%bd%8f%e4%ba%86%ef%bc%81.shtml#comments</comments>
		<pubDate>Wed, 18 Jun 2008 15:45:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[cli]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=124</guid>
		<description><![CDATA[最近一直在研究php中CLI的应用，可最近两天晚上配置调试环境却遇到了很大的问题。
原来在写shell中 php -q参数居然不那么好用了，我用的php5.2.6，编译的时间加上了&#8211;enable-cli 参数，而查看帮助后 php -v,挨个试了相关参数，发现用 php -c 居然可以通过，而同一个命令，在php5.1.2版本下跟php5.2.6又不同。
询问了专家级人物奶瓶，解释亦不同。
怀疑是编译的时候少了什么参数，于是用yum install php进行安装，测试
]]></description>
			<content:encoded><![CDATA[<p>最近一直在研究php中CLI的应用，可最近两天晚上配置调试环境却遇到了很大的问题。<br />
原来在写shell中 php -q参数居然不那么好用了，我用的php5.2.6，编译的时间加上了&#8211;enable-cli 参数，而查看帮助后 php -v,挨个试了相关参数，发现用 php -c 居然可以通过，而同一个命令，在php5.1.2版本下跟php5.2.6又不同。<br />
询问了专家级人物奶瓶，解释亦不同。<br />
怀疑是编译的时候少了什么参数，于是用yum install php进行安装，测试</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/18/%e8%a2%ab%e5%9b%b0%e9%9a%be%e5%8e%8b%e4%bd%8f%e4%ba%86%ef%bc%81.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>关于require和require_once的研究</title>
		<link>http://www.sunboyu.cn/2008/06/16/%e5%85%b3%e4%ba%8erequire%e5%92%8crequire_once%e7%9a%84%e7%a0%94%e7%a9%b6.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/16/%e5%85%b3%e4%ba%8erequire%e5%92%8crequire_once%e7%9a%84%e7%a0%94%e7%a9%b6.shtml#comments</comments>
		<pubDate>Mon, 16 Jun 2008 15:12:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[require]]></category>

		<category><![CDATA[require_once]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=123</guid>
		<description><![CDATA[前几天写程序蹦出个问题，研究一下。
先创建文件 a.php
&#60;?php
$a = &#8220;test&#8221;;
?&#62;
再创建 b.php

&#60;?php
function a()
{
require_once(&#8221;a.php&#8221;);
echo $a;
echo &#8220;-&#8221;;
}
function b()
{
require_once(&#8221;a.php&#8221;);
echo $a;
echo &#8220;-&#8221;;
}
a();
b();
?&#62;
运行结果是  test&#8211;
然后修改为
&#60;?php
function a()
{
require(&#8221;a.php&#8221;);
echo $a;
echo &#8220;-&#8221;;
}
function b()
{
require(&#8221;a.php&#8221;);
echo $a;
echo &#8220;-&#8221;;
}
a();
b();
?&#62;
则执行结果是 test-test-
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;
结论：require_once这个动作，加载一次是相对于一个页面，在函数a中包含一次，a.php中变量$a的作用域只是函数a()的内部，而无法在b()中使用，而b()虽然require_once(&#8217;a.php&#8217;),但由于页面中a()中先包含了一次，而在b()中却不再执行包含操作。
因此，当两个函数内部都需要使用调用页面的变量时，要不调用在函数外，global的方式调用，或者使用require()多次调用。
不错推荐第一种方式
]]></description>
			<content:encoded><![CDATA[<p>前几天写程序蹦出个问题，研究一下。</p>
<p>先创建文件 a.php</p>
<p>&lt;?php<br />
$a = &#8220;test&#8221;;<br />
?&gt;</p>
<p>再创建 b.php</p>
<p><span id="more-123"></span></p>
<p>&lt;?php<br />
function a()<br />
{<br />
require_once(&#8221;a.php&#8221;);<br />
echo $a;<br />
echo &#8220;-&#8221;;<br />
}<br />
function b()<br />
{<br />
require_once(&#8221;a.php&#8221;);<br />
echo $a;<br />
echo &#8220;-&#8221;;<br />
}<br />
a();<br />
b();<br />
?&gt;</p>
<p>运行结果是  test&#8211;</p>
<p>然后修改为</p>
<p>&lt;?php<br />
function a()<br />
{<br />
require(&#8221;a.php&#8221;);<br />
echo $a;<br />
echo &#8220;-&#8221;;<br />
}<br />
function b()<br />
{<br />
require(&#8221;a.php&#8221;);<br />
echo $a;<br />
echo &#8220;-&#8221;;<br />
}<br />
a();<br />
b();<br />
?&gt;</p>
<p>则执行结果是 test-test-</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p>结论：require_once这个动作，加载一次是相对于一个页面，在函数a中包含一次，a.php中变量$a的作用域只是函数a()的内部，而无法在b()中使用，而b()虽然require_once(&#8217;a.php&#8217;),但由于页面中a()中先包含了一次，而在b()中却不再执行包含操作。</p>
<p>因此，当两个函数内部都需要使用调用页面的变量时，要不调用在函数外，global的方式调用，或者使用require()多次调用。</p>
<p>不错推荐第一种方式</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/16/%e5%85%b3%e4%ba%8erequire%e5%92%8crequire_once%e7%9a%84%e7%a0%94%e7%a9%b6.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP＋MYSQL循环插入1W条记录测试</title>
		<link>http://www.sunboyu.cn/2008/06/16/php%ef%bc%8bmysql%e5%be%aa%e7%8e%af%e6%8f%92%e5%85%a51w%e6%9d%a1%e8%ae%b0%e5%bd%95%e6%b5%8b%e8%af%95.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/16/php%ef%bc%8bmysql%e5%be%aa%e7%8e%af%e6%8f%92%e5%85%a51w%e6%9d%a1%e8%ae%b0%e5%bd%95%e6%b5%8b%e8%af%95.shtml#comments</comments>
		<pubDate>Mon, 16 Jun 2008 14:55:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[MYSQL]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[主键]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=122</guid>
		<description><![CDATA[表test，字段 id,content
当id没有设置主键的时候，运行时间为 37.186923027
当id设置成主键的时候，运行时间为 44.7759540081
结论……该睡觉了
有点闲着慌
]]></description>
			<content:encoded><![CDATA[<p>表test，字段 id,content<br />
当id没有设置主键的时候，运行时间为 37.186923027<br />
当id设置成主键的时候，运行时间为 44.7759540081<br />
结论……该睡觉了<br />
有点闲着慌</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/16/php%ef%bc%8bmysql%e5%be%aa%e7%8e%af%e6%8f%92%e5%85%a51w%e6%9d%a1%e8%ae%b0%e5%bd%95%e6%b5%8b%e8%af%95.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP error_reporting()研究</title>
		<link>http://www.sunboyu.cn/2008/06/16/php-error_reporting%e7%a0%94%e7%a9%b6.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/16/php-error_reporting%e7%a0%94%e7%a9%b6.shtml#comments</comments>
		<pubDate>Mon, 16 Jun 2008 13:40:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[error_reporrting]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=121</guid>
		<description><![CDATA[PHP错误处理与反馈机制，是使用set_error_handler(&#8221;myErrorHandler&#8221;); 使程序出错时调用此函数。
此函数有4个参数，myErrorHandler($errno, $errstr, $errfile, $errline)，$error－错误号，$errstr－错误描述，$errfile－错误文件，$errline－出错的行号。
用此方法，可以捕捉并记录详细的错误信息，可以根据项目需求进行错误级别评定。
WordPress的报错声明
// Add define(&#8217;WP_DEBUG&#8217;,true); to wp-config.php to enable display of notices during development.
if (defined(&#8217;WP_DEBUG&#8217;) and WP_DEBUG == true) {
error_reporting(E_ALL);
} else {
error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
}
插件的报错
error_reporting( E_ALL ^ E_NOTICE );
升级程序的报错
error_reporting( E_ALL ^ E_NOTICE );
]]></description>
			<content:encoded><![CDATA[<p>PHP错误处理与反馈机制，是使用set_error_handler(&#8221;myErrorHandler&#8221;); 使程序出错时调用此函数。</p>
<p>此函数有4个参数，myErrorHandler($errno, $errstr, $errfile, $errline)，$error－错误号，$errstr－错误描述，$errfile－错误文件，$errline－出错的行号。<br />
用此方法，可以捕捉并记录详细的错误信息，可以根据项目需求进行错误级别评定。</p>
<p>WordPress的报错声明<br />
// Add define(&#8217;WP_DEBUG&#8217;,true); to wp-config.php to enable display of notices during development.<br />
if (defined(&#8217;WP_DEBUG&#8217;) and WP_DEBUG == true) {<br />
error_reporting(E_ALL);<br />
} else {<br />
error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);<br />
}</p>
<p>插件的报错<br />
error_reporting( E_ALL ^ E_NOTICE );</p>
<p>升级程序的报错<br />
error_reporting( E_ALL ^ E_NOTICE );</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/16/php-error_reporting%e7%a0%94%e7%a9%b6.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP中工厂方式的三层结构</title>
		<link>http://www.sunboyu.cn/2008/06/14/php%e4%b8%ad%e5%b7%a5%e5%8e%82%e6%96%b9%e5%bc%8f%e7%9a%84%e4%b8%89%e5%b1%82%e7%bb%93%e6%9e%84.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/14/php%e4%b8%ad%e5%b7%a5%e5%8e%82%e6%96%b9%e5%bc%8f%e7%9a%84%e4%b8%89%e5%b1%82%e7%bb%93%e6%9e%84.shtml#comments</comments>
		<pubDate>Sat, 14 Jun 2008 14:38:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[工厂模式]]></category>

		<category><![CDATA[设计模式]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=114</guid>
		<description><![CDATA[项目即将收尾，但有些代码乱七八糟，不少东西是为了赶时间而写成了流水程序。功能出来了，但代码可读性和可维护性却相当差。当然拿出少量时间给代码排个版是很有必要的，这里我一直主张工厂模式三层结构的方法。

网站基本是传统的机构，数据库，web，在这里，我们只讨论web中程序的结构。

三层，主要是指子类，抽象工厂方法，业务逻辑处理。
子类：子类是所有跟程序之外对象进行交互的类，包括跟数据库，磁盘存储，xml等的处理。子类有个特征，就是可以迁移到任意的项目中进行复用，也就是整个项目中最底层的一些操作。
工厂方法：工厂方法就是使用子类提供的功能进行整合，构造出能够满足一些业务具体功能的方法。
业务处理：业务处理主要是UI部分，根据用户的请求来选择合适的工厂方法，把工厂方法的返回产品数据输出给用户。
]]></description>
			<content:encoded><![CDATA[<p>项目即将收尾，但有些代码乱七八糟，不少东西是为了赶时间而写成了流水程序。功能出来了，但代码可读性和可维护性却相当差。当然拿出少量时间给代码排个版是很有必要的，这里我一直主张工厂模式三层结构的方法。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/e69caae591bde5908d-1.jpg"><img class="alignnone size-full wp-image-115" title="e69caae591bde5908d-1" src="http://www.sunboyu.cn/upfiles/2008/06/e69caae591bde5908d-1.jpg" alt="" width="500" height="167" /></a></p>
<p>网站基本是传统的机构，数据库，web，在这里，我们只讨论web中程序的结构。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/phpe7a88be5ba8fe8aebee8aea1e7bb93e69e84e59bbe.jpg"><img class="alignnone size-full wp-image-116" title="phpe7a88be5ba8fe8aebee8aea1e7bb93e69e84e59bbe" src="http://www.sunboyu.cn/upfiles/2008/06/phpe7a88be5ba8fe8aebee8aea1e7bb93e69e84e59bbe.jpg" alt="" width="500" height="167" /></a></p>
<h2><span style="color: #000080;"><strong>三层，主要是指子类，抽象工厂方法，业务逻辑处理。</strong></span></h2>
<p><span style="text-decoration: underline;"><strong>子类：</strong></span>子类是所有跟程序之外对象进行交互的类，包括跟数据库，磁盘存储，xml等的处理。子类有个特征，就是可以迁移到任意的项目中进行复用，也就是整个项目中最底层的一些操作。</p>
<p><strong><span style="text-decoration: underline;">工厂方法：</span></strong>工厂方法就是使用子类提供的功能进行整合，构造出能够满足一些业务具体功能的方法。</p>
<p><strong><span style="text-decoration: underline;">业务处理：</span></strong>业务处理主要是UI部分，根据用户的请求来选择合适的工厂方法，把工厂方法的返回产品数据输出给用户。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/14/php%e4%b8%ad%e5%b7%a5%e5%8e%82%e6%96%b9%e5%bc%8f%e7%9a%84%e4%b8%89%e5%b1%82%e7%bb%93%e6%9e%84.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP中数据有效性验证</title>
		<link>http://www.sunboyu.cn/2008/06/14/php%e4%b8%ad%e6%95%b0%e6%8d%ae%e6%9c%89%e6%95%88%e6%80%a7%e9%aa%8c%e8%af%81.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/14/php%e4%b8%ad%e6%95%b0%e6%8d%ae%e6%9c%89%e6%95%88%e6%80%a7%e9%aa%8c%e8%af%81.shtml#comments</comments>
		<pubDate>Sat, 14 Jun 2008 12:54:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[c]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[变量]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=113</guid>
		<description><![CDATA[在php的开发过程中，我们的error_reporting()开到最严格，2047，因此，好多php本身可避免的报错也都会出来，就跟C一样让在在强类型状态下工作。
为了尽量使程序兼容，我们对每个变量的有效性进行严格判断。
我一般使用 isset($a) ? $a : &#8221;;这种方式对变量进行判断，如果变量不存在的话初始化变量。
当然在其他的地方也可以使用该方法检验变量有效性。
底下是大部分进行验证的函数。
检测变量状态： isset()   empty()
检测变量类型 is_array() is_double() is_float() is_real()  is_long() is_int() is_integer() is_string() is_object()
具体使用可以查下手册
PHP并不比C或者其他语言差，关键在于你编程的态度.
]]></description>
			<content:encoded><![CDATA[<p>在php的开发过程中，我们的error_reporting()开到最严格，2047，因此，好多php本身可避免的报错也都会出来，就跟C一样让在在强类型状态下工作。</p>
<p>为了尽量使程序兼容，我们对每个变量的有效性进行严格判断。</p>
<p>我一般使用 isset($a) ? $a : &#8221;;这种方式对变量进行判断，如果变量不存在的话初始化变量。</p>
<p>当然在其他的地方也可以使用该方法检验变量有效性。</p>
<p>底下是大部分进行验证的函数。</p>
<p>检测变量状态： isset()   empty()</p>
<p>检测变量类型 is_array() is_double() is_float() is_real()  is_long() is_int() is_integer() is_string() is_object()</p>
<p>具体使用可以查下手册</p>
<p>PHP并不比C或者其他语言差，关键在于你编程的态度.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/14/php%e4%b8%ad%e6%95%b0%e6%8d%ae%e6%9c%89%e6%95%88%e6%80%a7%e9%aa%8c%e8%af%81.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>centos5安装指南（简单篇）</title>
		<link>http://www.sunboyu.cn/2008/06/13/centos5%e5%ae%89%e8%a3%85%e6%8c%87%e5%8d%97%ef%bc%88%e7%ae%80%e5%8d%95%e7%af%87%ef%bc%89.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/13/centos5%e5%ae%89%e8%a3%85%e6%8c%87%e5%8d%97%ef%bc%88%e7%ae%80%e5%8d%95%e7%af%87%ef%bc%89.shtml#comments</comments>
		<pubDate>Fri, 13 Jun 2008 13:50:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[LINUX]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[centos]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[图形]]></category>

		<category><![CDATA[教程]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=87</guid>
		<description><![CDATA[
进入默认页面，直接回车即可

测试光盘文件的完整性，我一般都跳过


直接下一步

我一般都选择英文，因为命令行里好像不很支持中文

格盘，yes即可。注意：这里是在虚拟机或者一个空机器上进行安装，如果你在其他操作系统上安装双系统，此操作危险！

NEXT，使用默认的即可

YES,继续

分配IP地址，或者使用dhcp，此知识点不懂的话，不归本文管。

设置系统时区，一般用UTC，虽然有时候会用东八区。

设置root帐号的密码

选择定制安装或者是定制安装，当然我们要定制安装。

选择Development中的Development Libraries,Development Tools

选择Base System中的Base和Legacy Software Support
选择这四个，其他的就都不要选了，需要的话再慢慢装。

NEXT开始安装

装完，重启

root登录

这样安装AMP(APACHE MYSQL PHP)即可
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.sunboyu.cn/upfiles/2008/06/1.jpg"><img class="alignnone size-medium wp-image-91" title="1" src="http://www.sunboyu.cn/upfiles/2008/06/1-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>进入默认页面，直接回车即可</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/2.jpg"><img class="alignnone size-medium wp-image-92" title="2" src="http://www.sunboyu.cn/upfiles/2008/06/2-300x166.jpg" alt="" width="300" height="166" /></a></p>
<p>测试光盘文件的完整性，我一般都跳过</p>
<p><span id="more-87"></span></p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/3.jpg"><img class="alignnone size-medium wp-image-93" title="3" src="http://www.sunboyu.cn/upfiles/2008/06/3-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>直接下一步</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/4.jpg"><img class="alignnone size-medium wp-image-94" title="4" src="http://www.sunboyu.cn/upfiles/2008/06/4-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>我一般都选择英文，因为命令行里好像不很支持中文</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/6.jpg"><img class="alignnone size-medium wp-image-96" title="6" src="http://www.sunboyu.cn/upfiles/2008/06/6-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>格盘，yes即可。注意：这里是在虚拟机或者一个空机器上进行安装，如果你在其他操作系统上安装双系统，此操作危险！</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/7.jpg"><img class="alignnone size-medium wp-image-97" title="7" src="http://www.sunboyu.cn/upfiles/2008/06/7-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>NEXT，使用默认的即可</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/8.jpg"><img class="alignnone size-medium wp-image-98" title="8" src="http://www.sunboyu.cn/upfiles/2008/06/8-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>YES,继续</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/9.jpg"><img class="alignnone size-medium wp-image-99" title="9" src="http://www.sunboyu.cn/upfiles/2008/06/9-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>分配IP地址，或者使用dhcp，此知识点不懂的话，不归本文管。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/10.jpg"><img class="alignnone size-medium wp-image-100" title="10" src="http://www.sunboyu.cn/upfiles/2008/06/10-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>设置系统时区，一般用UTC，虽然有时候会用东八区。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/11.jpg"><img class="alignnone size-medium wp-image-101" title="11" src="http://www.sunboyu.cn/upfiles/2008/06/11-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>设置root帐号的密码</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/12.jpg"><img class="alignnone size-medium wp-image-102" title="12" src="http://www.sunboyu.cn/upfiles/2008/06/12-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>选择定制安装或者是定制安装，当然我们要定制安装。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/13.jpg"><img class="alignnone size-medium wp-image-103" title="13" src="http://www.sunboyu.cn/upfiles/2008/06/13-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>选择Development中的Development Libraries,Development Tools</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/14.jpg"><img class="alignnone size-medium wp-image-104" title="14" src="http://www.sunboyu.cn/upfiles/2008/06/14-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>选择Base System中的Base和Legacy Software Support</p>
<p>选择这四个，其他的就都不要选了，需要的话再慢慢装。</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/15.jpg"><img class="alignnone size-medium wp-image-105" title="15" src="http://www.sunboyu.cn/upfiles/2008/06/15-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>NEXT开始安装</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/17.jpg"><img class="alignnone size-medium wp-image-107" title="17" src="http://www.sunboyu.cn/upfiles/2008/06/17-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>装完，重启</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/18.jpg"><img class="alignnone size-medium wp-image-108" title="18" src="http://www.sunboyu.cn/upfiles/2008/06/18-300x166.jpg" alt="" width="300" height="166" /></a></p>
<p>root登录</p>
<p><a href="http://www.sunboyu.cn/upfiles/2008/06/19.jpg"><img class="alignnone size-medium wp-image-109" title="19" src="http://www.sunboyu.cn/upfiles/2008/06/19-300x166.jpg" alt="" width="300" height="166" /></a></p>
<p>这样安装AMP(APACHE MYSQL PHP)即可</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/13/centos5%e5%ae%89%e8%a3%85%e6%8c%87%e5%8d%97%ef%bc%88%e7%ae%80%e5%8d%95%e7%af%87%ef%bc%89.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>关于bugfree中解决方案的英文解释</title>
		<link>http://www.sunboyu.cn/2008/06/10/%e5%85%b3%e4%ba%8ebugfree%e4%b8%ad%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%e7%9a%84%e8%8b%b1%e6%96%87%e8%a7%a3%e9%87%8a.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/10/%e5%85%b3%e4%ba%8ebugfree%e4%b8%ad%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%e7%9a%84%e8%8b%b1%e6%96%87%e8%a7%a3%e9%87%8a.shtml#comments</comments>
		<pubDate>Tue, 10 Jun 2008 07:00:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[bugfree]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=74</guid>
		<description><![CDATA[o    By Design - 就是这么设计的，无效的Bug
o    Duplicate - 这个问题别人已经发现了，重复的Bug
o    External - 是个外部因素(比如浏览器、操作系统、其他第3方软件)造成的问题
o    Fixed - 问题被修理掉了。Tester要尽可能找到这种Bug
o    Not Repro - 无法复现你这个问题，无效的Bug
o    Postponed - 是个问题，但是目前不必修理了，推迟到以后再解
o    Won&#8217;t Fix - 是个问题，但是不值得修理了，不管它吧
]]></description>
			<content:encoded><![CDATA[<p>o    By Design - 就是这么设计的，无效的Bug<br />
o    Duplicate - 这个问题别人已经发现了，重复的Bug<br />
o    External - 是个外部因素(比如浏览器、操作系统、其他第3方软件)造成的问题<br />
o    Fixed - 问题被修理掉了。Tester要尽可能找到这种Bug<br />
o    Not Repro - 无法复现你这个问题，无效的Bug<br />
o    Postponed - 是个问题，但是目前不必修理了，推迟到以后再解<br />
o    Won&#8217;t Fix - 是个问题，但是不值得修理了，不管它吧</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/10/%e5%85%b3%e4%ba%8ebugfree%e4%b8%ad%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88%e7%9a%84%e8%8b%b1%e6%96%87%e8%a7%a3%e9%87%8a.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>今天加班了……</title>
		<link>http://www.sunboyu.cn/2008/06/02/%e4%bb%8a%e5%a4%a9%e5%8a%a0%e7%8f%ad%e4%ba%86%e2%80%a6%e2%80%a6.shtml</link>
		<comments>http://www.sunboyu.cn/2008/06/02/%e4%bb%8a%e5%a4%a9%e5%8a%a0%e7%8f%ad%e4%ba%86%e2%80%a6%e2%80%a6.shtml#comments</comments>
		<pubDate>Mon, 02 Jun 2008 11:52:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[便当]]></category>

		<category><![CDATA[加班]]></category>

		<category><![CDATA[宝盛里]]></category>

		<category><![CDATA[租房]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=64</guid>
		<description><![CDATA[活终于忙得受不了了，刚忙完租房的事情，家里也差不多了，赶紧加个班，赶赶。最近家里不能上网，有点郁闷。
下午吃了个东池便当，勉强有点感觉，那种盒子的饭我感觉吃5份才能顶饱，可惜公司只能给一份。
里边咸菜做得挺不错。顺便提下宝盛里旁边一个新疆餐厅，我居然爱上那个大爷的咸菜了。
]]></description>
			<content:encoded><![CDATA[<p>活终于忙得受不了了，刚忙完租房的事情，家里也差不多了，赶紧加个班，赶赶。最近家里不能上网，有点郁闷。</p>
<p>下午吃了个东池便当，勉强有点感觉，那种盒子的饭我感觉吃5份才能顶饱，可惜公司只能给一份。</p>
<p>里边咸菜做得挺不错。顺便提下宝盛里旁边一个新疆餐厅，我居然爱上那个大爷的咸菜了。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/06/02/%e4%bb%8a%e5%a4%a9%e5%8a%a0%e7%8f%ad%e4%ba%86%e2%80%a6%e2%80%a6.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>WEB工程师应该了解的领域</title>
		<link>http://www.sunboyu.cn/2008/05/29/web%e5%b7%a5%e7%a8%8b%e5%b8%88%e5%ba%94%e8%af%a5%e4%ba%86%e8%a7%a3%e7%9a%84%e9%a2%86%e5%9f%9f.shtml</link>
		<comments>http://www.sunboyu.cn/2008/05/29/web%e5%b7%a5%e7%a8%8b%e5%b8%88%e5%ba%94%e8%af%a5%e4%ba%86%e8%a7%a3%e7%9a%84%e9%a2%86%e5%9f%9f.shtml#comments</comments>
		<pubDate>Thu, 29 May 2008 13:15:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[WEB]]></category>

		<category><![CDATA[工程师]]></category>

		<category><![CDATA[领域]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=61</guid>
		<description><![CDATA[不管做什么，总应该专注。专注一门，在一个团体内可以独当一面，体现价值。
除非做到很专，或者到一定层次，那作为一个普通的web工程师，还是应该了解很多知识的。
做程序员时间不长，说下自己的看法：
程序，代码，html，css这些就不说了，不能精通，起码能看懂，会抄，简单问题能解决，这应该是基本的。
数据库，基本所有的web系统不能脱离数据库，起码的使用必须得会，一些基本语法，几个标准。再深则设计，优化，备份等，也都是必备的一些知识。
SEO，做网站的没有不想做好的，尤其是google baidu搜索引擎流行的今天。
服务器：自己配置开发环境是基础，但也要有能力去做一台服务器，也许不是太优化，不是太商业化，会点，也是有必要的。
英语：论技术，老外还是牛。想学他们，必须得会英语，我天天用星际译王。
沟通：东西毕竟是让外行用的，得作出适合他们的东西。
其实这些也正式我现在努力学习的。
]]></description>
			<content:encoded><![CDATA[<p>不管做什么，总应该专注。专注一门，在一个团体内可以独当一面，体现价值。</p>
<p>除非做到很专，或者到一定层次，那作为一个普通的web工程师，还是应该了解很多知识的。</p>
<p>做程序员时间不长，说下自己的看法：</p>
<p>程序，代码，html，css这些就不说了，不能精通，起码能看懂，会抄，简单问题能解决，这应该是基本的。</p>
<p>数据库，基本所有的web系统不能脱离数据库，起码的使用必须得会，一些基本语法，几个标准。再深则设计，优化，备份等，也都是必备的一些知识。</p>
<p>SEO，做网站的没有不想做好的，尤其是google baidu搜索引擎流行的今天。</p>
<p>服务器：自己配置开发环境是基础，但也要有能力去做一台服务器，也许不是太优化，不是太商业化，会点，也是有必要的。</p>
<p>英语：论技术，老外还是牛。想学他们，必须得会英语，我天天用星际译王。</p>
<p>沟通：东西毕竟是让外行用的，得作出适合他们的东西。</p>
<p>其实这些也正式我现在努力学习的。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/05/29/web%e5%b7%a5%e7%a8%8b%e5%b8%88%e5%ba%94%e8%af%a5%e4%ba%86%e8%a7%a3%e7%9a%84%e9%a2%86%e5%9f%9f.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP Shell初体验</title>
		<link>http://www.sunboyu.cn/2008/05/25/php-shell%e5%88%9d%e4%bd%93%e9%aa%8c.shtml</link>
		<comments>http://www.sunboyu.cn/2008/05/25/php-shell%e5%88%9d%e4%bd%93%e9%aa%8c.shtml#comments</comments>
		<pubDate>Sun, 25 May 2008 08:59:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[cli]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=53</guid>
		<description><![CDATA[在linux（centos5）上编译安装 php-5.2.6.tar.gz ,configure参数一定要带上 &#8211;enable-cli
完成后，php所在目录 /usr/local/bin/php
运营  ./php -v  显示php版本信息，证明安装成功
编写我的第一个php shell脚本
#!/usr/local/bin/php -q
echo &#8220;Hello World!&#8221;;
?&#62;
保存为 test.sh
运行，屏幕会 回显 Hello World!
在命令行下，不会存在get post之类的动作，除非参数写到页面内，而php恰巧提供了这样的命令行参数接口，$argv
修改test.sh
#!/usr/local/bin/php -q
print_r($argv);
?&#62;
加参数运行  ./test.sh  t1 t2   ，回显为
Array
(
[0] =&#62; ./test.sh
[1] =&#62; t1
[2] =&#62; t2
)
]]></description>
			<content:encoded><![CDATA[<p>在linux（centos5）上编译安装 php-5.2.6.tar.gz ,configure参数一定要带上 &#8211;enable-cli</p>
<p>完成后，php所在目录 /usr/local/bin/php</p>
<p>运营  ./php -v  显示php版本信息，证明安装成功</p>
<p>编写我的第一个php shell脚本<br />
#!/usr/local/bin/php -q<br />
echo &#8220;Hello World!&#8221;;<br />
?&gt;</p>
<p>保存为 test.sh<br />
运行，屏幕会 回显 Hello World!</p>
<p>在命令行下，不会存在get post之类的动作，除非参数写到页面内，而php恰巧提供了这样的命令行参数接口，$argv<br />
修改test.sh<br />
#!/usr/local/bin/php -q<br />
print_r($argv);<br />
?&gt;</p>
<p>加参数运行  ./test.sh  t1 t2   ，回显为</p>
<p>Array<br />
(<br />
[0] =&gt; ./test.sh<br />
[1] =&gt; t1<br />
[2] =&gt; t2<br />
)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/05/25/php-shell%e5%88%9d%e4%bd%93%e9%aa%8c.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>PHP SHELL，用php来代替bash</title>
		<link>http://www.sunboyu.cn/2008/05/24/php-shell%ef%bc%8c%e7%94%a8php%e6%9d%a5%e4%bb%a3%e6%9b%bfbash.shtml</link>
		<comments>http://www.sunboyu.cn/2008/05/24/php-shell%ef%bc%8c%e7%94%a8php%e6%9d%a5%e4%bb%a3%e6%9b%bfbash.shtml#comments</comments>
		<pubDate>Sat, 24 May 2008 15:50:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[bash]]></category>

		<category><![CDATA[cli]]></category>

		<category><![CDATA[eefocus]]></category>

		<category><![CDATA[php]]></category>

		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=52</guid>
		<description><![CDATA[总看到招聘php程序员的帖子说要求php程序员熟练运用linux,shell,我估计熟悉LAMP配置，在这个架构下开发php的人不在少数，但说到SHELL，估计有一批人一冒一身的冷汗。
c shell，bash shell的确用的少，但php shell你说不懂，就该左右开弓一百八十个大嘴巴。
php本身就是一种shell，在php4之后，php编译有个 &#8211;enable-cli 参数，php5之后这个参数几乎成了标配参数。php一样可以作为shell脚本运行在装有php环境的服务器上。
而在phpchina.com phpx.com总多bbs的招聘上，居然没有哪个php程序员拿出php shell这个技能去跟他们交涉。而实际上，phpshell的功能根本不比bash弱，而且在LAMP环境中，php shell比bashshell有诸多的优点。
下边是我在与非门科技工作时候的几个php shell应用，抛砖引玉，希望大家能学会这些简单但又适用的技能。
$root = &#8220;/var/www/&#8221;;
$bakdir = &#8220;/var/wwwbak/&#8221;.date(&#8221;Y-m-d&#8221;);
$dir = array(&#8221;***.eefocus.com&#8221;,&#8221;***.eefocus.com&#8221;);
if(!is_dir($bakdir)){
mkdir($bakdir);
}
foreach($dir as $key=&#62;$value)
{
exec(&#8221;tar zcf &#8220;.$bakdir.&#8221;/&#8221;.$value.&#8221;.tar.gz /var/www/&#8221;.$value);
#echo &#8220;tar zcf &#8220;.$bakdir.&#8221;/&#8221;.$value.&#8221;.tar.gz /var/www/&#8221;.$value.&#8221;
&#8220;;
}
?&#62;
这是一个简单的网站目录备份程序，使用cron每天执行，自动tar压包备份网站。虽然很笨的方法，但网站安全系数提高了，这个过程也不用写啥bash去解决。
其实在php执行shell的时候，已经支持命令行参数了，这些应用下次分解。
参考网站：
http://www.phpbuilder.com/columns/darrell20000319.php3
http://www.php-cli.com/
]]></description>
			<content:encoded><![CDATA[<p>总看到招聘php程序员的帖子说要求php程序员熟练运用linux,shell,我估计熟悉LAMP配置，在这个架构下开发php的人不在少数，但说到SHELL，估计有一批人一冒一身的冷汗。<br />
c shell，bash shell的确用的少，但php shell你说不懂，就该左右开弓一百八十个大嘴巴。<br />
php本身就是一种shell，在php4之后，php编译有个 &#8211;enable-cli 参数，php5之后这个参数几乎成了标配参数。php一样可以作为shell脚本运行在装有php环境的服务器上。<br />
而在phpchina.com phpx.com总多bbs的招聘上，居然没有哪个php程序员拿出php shell这个技能去跟他们交涉。而实际上，phpshell的功能根本不比bash弱，而且在LAMP环境中，php shell比bashshell有诸多的优点。</p>
<p>下边是我在<a href="http://www.eefocus.com" target="_blank">与非门科技</a><img src="http://www.eefocus.com/images/logo.gif" alt="" width="73" height="21" />工作时候的几个php shell应用，抛砖引玉，希望大家能学会这些简单但又适用的技能。</p>
<p>$root = &#8220;/var/www/&#8221;;<br />
$bakdir = &#8220;/var/wwwbak/&#8221;.date(&#8221;Y-m-d&#8221;);<br />
$dir = array(&#8221;***.eefocus.com&#8221;,&#8221;***.eefocus.com&#8221;);<br />
if(!is_dir($bakdir)){<br />
mkdir($bakdir);<br />
}<br />
foreach($dir as $key=&gt;$value)<br />
{<br />
exec(&#8221;tar zcf &#8220;.$bakdir.&#8221;/&#8221;.$value.&#8221;.tar.gz /var/www/&#8221;.$value);<br />
#echo &#8220;tar zcf &#8220;.$bakdir.&#8221;/&#8221;.$value.&#8221;.tar.gz /var/www/&#8221;.$value.&#8221;<br />
&#8220;;<br />
}<br />
?&gt;</p>
<p>这是一个简单的网站目录备份程序，使用cron每天执行，自动tar压包备份网站。虽然很笨的方法，但网站安全系数提高了，这个过程也不用写啥bash去解决。</p>
<p>其实在php执行shell的时候，已经支持命令行参数了，这些应用下次分解。</p>
<p>参考网站：</p>
<p>http://www.phpbuilder.com/columns/darrell20000319.php3</p>
<p>http://www.php-cli.com/</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/05/24/php-shell%ef%bc%8c%e7%94%a8php%e6%9d%a5%e4%bb%a3%e6%9b%bfbash.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>今天加班,继续翻译文档</title>
		<link>http://www.sunboyu.cn/2008/05/19/%e4%bb%8a%e5%a4%a9%e5%8a%a0%e7%8f%ad%e7%bb%a7%e7%bb%ad%e7%bf%bb%e8%af%91%e6%96%87%e6%a1%a3.shtml</link>
		<comments>http://www.sunboyu.cn/2008/05/19/%e4%bb%8a%e5%a4%a9%e5%8a%a0%e7%8f%ad%e7%bb%a7%e7%bb%ad%e7%bf%bb%e8%af%91%e6%96%87%e6%a1%a3.shtml#comments</comments>
		<pubDate>Mon, 19 May 2008 13:19:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[纯属蛋疼]]></category>

		<category><![CDATA[加班]]></category>

		<category><![CDATA[翻译]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=23</guid>
		<description><![CDATA[人总是懒的,一不注意就会放弃,再加把油,翻译完一页,希望大家支持.
http://www.sunboyu.cn/JsPlayer/Supported_Playlists.html
翻译到播放列表了
]]></description>
			<content:encoded><![CDATA[<p>人总是懒的,一不注意就会放弃,再加把油,翻译完一页,希望大家支持.</p>
<p>http://www.sunboyu.cn/JsPlayer/Supported_Playlists.html</p>
<p>翻译到播放列表了</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/05/19/%e4%bb%8a%e5%a4%a9%e5%8a%a0%e7%8f%ad%e7%bb%a7%e7%bb%ad%e7%bf%bb%e8%af%91%e6%96%87%e6%a1%a3.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>天际网邮件系统统计代码分析</title>
		<link>http://www.sunboyu.cn/2008/05/19/%e5%a4%a9%e9%99%85%e7%bd%91%e9%82%ae%e4%bb%b6%e7%b3%bb%e7%bb%9f%e7%bb%9f%e8%ae%a1%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90.shtml</link>
		<comments>http://www.sunboyu.cn/2008/05/19/%e5%a4%a9%e9%99%85%e7%bd%91%e9%82%ae%e4%bb%b6%e7%b3%bb%e7%bb%9f%e7%bb%9f%e8%ae%a1%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90.shtml#comments</comments>
		<pubDate>Mon, 19 May 2008 02:48:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[反馈]]></category>

		<category><![CDATA[天际]]></category>

		<category><![CDATA[邮件]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=21</guid>
		<description><![CDATA[?tj_stat=NjQ5MDI4Ny1DTi8xMS8/Py1udWxsLTEwMi1udWxsLW51bGw=
貌似base64编码,decode一下,发现这样的信息:6490287-CN/11/??-null-102-null-null
果然是邮箱统计.
前边的id,果然是我的user  id
http://profile.tianji.com/Network/View?userid=6490287
后边好多参数,可以统计更多的信息.
低下干什么,不说了.
]]></description>
			<content:encoded><![CDATA[<p>?tj_stat=NjQ5MDI4Ny1DTi8xMS8/Py1udWxsLTEwMi1udWxsLW51bGw=<br />
貌似base64编码,decode一下,发现这样的信息:6490287-CN/11/??-null-102-null-null<br />
果然是邮箱统计.<br />
前边的id,果然是我的user  id<br />
http://profile.tianji.com/Network/View?userid=6490287<br />
后边好多参数,可以统计更多的信息.</p>
<p>低下干什么,不说了.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/05/19/%e5%a4%a9%e9%99%85%e7%bd%91%e9%82%ae%e4%bb%b6%e7%b3%bb%e7%bb%9f%e7%bb%9f%e8%ae%a1%e4%bb%a3%e7%a0%81%e5%88%86%e6%9e%90.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>memcache安装与配置详解</title>
		<link>http://www.sunboyu.cn/2008/05/19/memcache%e5%ae%89%e8%a3%85%e4%b8%8e%e9%85%8d%e7%bd%ae%e8%af%a6%e8%a7%a3.shtml</link>
		<comments>http://www.sunboyu.cn/2008/05/19/memcache%e5%ae%89%e8%a3%85%e4%b8%8e%e9%85%8d%e7%bd%ae%e8%af%a6%e8%a7%a3.shtml#comments</comments>
		<pubDate>Mon, 19 May 2008 02:44:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[memcache]]></category>

		<category><![CDATA[安装]]></category>

		<category><![CDATA[配置]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=20</guid>
		<description><![CDATA[libevent-1.2.tar.gz
memcache-3.0.1.tgz
memcached-1.2.0.tar.gz
安装 libevent-1.2.tar.gz
./configure
make &#38;&#38; make install
chmod 644 /usr/local/lib/libevent.a
PATH=&#8221;$PATH:/sbin&#8221; ldconfig -n /usr/local/lib
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR&#8217;
flag during linking and do at least one of the following:
- add [...]]]></description>
			<content:encoded><![CDATA[<div style="overflow: hidden; width: 500px;">libevent-1.2.tar.gz<br />
memcache-3.0.1.tgz<br />
memcached-1.2.0.tar.gz</p>
<p>安装 libevent-1.2.tar.gz<br />
./configure<br />
make &amp;&amp; make install</p>
<p>chmod 644 /usr/local/lib/libevent.a<br />
PATH=&#8221;$PATH:/sbin&#8221; ldconfig -n /usr/local/lib<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Libraries have been installed in:<br />
/usr/local/lib<br />
If you ever happen to want to link against installed libraries<br />
in a given directory, LIBDIR, you must either use libtool, and<br />
specify the full pathname of the library, or use the `-LLIBDIR&#8217;<br />
flag during linking and do at least one of the following:<br />
- add LIBDIR to the `LD_LIBRARY_PATH&#8217; environment variable<br />
during execution<br />
- add LIBDIR to the `LD_RUN_PATH&#8217; environment variable<br />
during linking<br />
- use the `-Wl,&#8211;rpath -Wl,LIBDIR&#8217; linker flag<br />
- have your system administrator add LIBDIR to `/etc/ld.so.conf&#8217;<br />
See any operating system documentation about shared libraries for<br />
more information, such as the ld(1) and ld.so(8) manual pages.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
test -z &#8220;/usr/local/include&#8221; || mkdir -p &#8212; . &#8220;/usr/local/include&#8221;<br />
/usr/bin/install -c -m 644 &#8216;event.h&#8217; &#8216;/usr/local/include/event.h&#8217;<br />
/usr/bin/install -c -m 644 &#8216;evhttp.h&#8217; &#8216;/usr/local/include/evhttp.h&#8217;<br />
/usr/bin/install -c -m 644 &#8216;evdns.h&#8217; &#8216;/usr/local/include/evdns.h&#8217;<br />
test -z &#8220;/usr/local/man/man3&#8243; || mkdir -p &#8212; . &#8220;/usr/local/man/man3&#8243;<br />
/usr/bin/install -c -m 644 &#8216;./event.3&#8242; &#8216;/usr/local/man/man3/event.3&#8242;<br />
/usr/bin/install -c -m 644 &#8216;./evdns.3&#8242; &#8216;/usr/local/man/man3/evdns.3&#8242;</p>
<p>安装 memcached-1.2.0.tar.gz<br />
./configure<br />
make &amp;&amp; make install</p>
<p>Making install in doc<br />
make[1]: Entering directory `/root/memcached-1.2.0/doc&#8217;<br />
make[2]: Entering directory `/root/memcached-1.2.0/doc&#8217;<br />
make[2]: Nothing to be done for `install-exec-am&#8217;.<br />
/bin/sh ../mkinstalldirs /usr/local/man/man1<br />
/usr/bin/install -c -m 644 ./memcached.1 /usr/local/man/man1/memcached.1<br />
make[2]: Leaving directory `/root/memcached-1.2.0/doc&#8217;<br />
make[1]: Leaving directory `/root/memcached-1.2.0/doc&#8217;<br />
make[1]: Entering directory `/root/memcached-1.2.0&#8242;<br />
make[2]: Entering directory `/root/memcached-1.2.0&#8242;<br />
/bin/sh ./mkinstalldirs /usr/local/bin<br />
/usr/bin/install -c memcached /usr/local/bin/memcached<br />
/usr/bin/install -c memcached-debug /usr/local/bin/memcached-debug</p>
<p>启动 -d守护进程 -m内存分配 -u 用户 -l监听地址 -p 端口 -P pid文件<br />
memcached -d -m 100 -u root -l 127.0.0.1 -p 8000 -P /tmp/mem.pid</p>
<p>安装 memcache-3.0.1.tgz<br />
phpize<br />
./configure<br />
make &amp;&amp; make install</p>
<p>gcc -shared  .libs/memcache.o .libs/memcache_pool.o .libs/memcache_queue.o .libs/memcache_ascii_protocol.o .libs/memcache_binary_protocol.o .libs/memcache_standard_hash.o .libs/memcache_consistent_hash.o .libs/memcache_session.o   -Wl,-soname -Wl,memcache.so -o .libs/memcache.so<br />
creating memcache.la<br />
(cd .libs &amp;&amp; rm -f memcache.la &amp;&amp; ln -s ../memcache.la memcache.la)<br />
/bin/sh /root/memcache-3.0.1/libtool &#8211;mode=install cp ./memcache.la /root/memcache-3.0.1/modules<br />
cp ./.libs/memcache.so /root/memcache-3.0.1/modules/memcache.so<br />
cp ./.libs/memcache.lai /root/memcache-3.0.1/modules/memcache.la<br />
PATH=&#8221;$PATH:/sbin&#8221; ldconfig -n /root/memcache-3.0.1/modules<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Libraries have been installed in:<br />
/root/memcache-3.0.1/modules<br />
If you ever happen to want to link against installed libraries<br />
in a given directory, LIBDIR, you must either use libtool, and<br />
specify the full pathname of the library, or use the `-LLIBDIR&#8217;<br />
flag during linking and do at least one of the following:<br />
- add LIBDIR to the `LD_LIBRARY_PATH&#8217; environment variable<br />
during execution<br />
- add LIBDIR to the `LD_RUN_PATH&#8217; environment variable<br />
during linking<br />
- use the `-Wl,&#8211;rpath -Wl,LIBDIR&#8217; linker flag<br />
- have your system administrator add LIBDIR to `/etc/ld.so.conf&#8217;<br />
See any operating system documentation about shared libraries for<br />
more information, such as the ld(1) and ld.so(8) manual pages.<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
Build complete.<br />
Don&#8217;t forget to run &#8216;make test&#8217;.<br />
Installing shared extensions:     /usr/local/lib/php/extensions/no-debug-non-zts-20060613/</p>
<p>php.ini  extent 加载 memcache.so<br />
重启使其生效即可</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/05/19/memcache%e5%ae%89%e8%a3%85%e4%b8%8e%e9%85%8d%e7%bd%ae%e8%af%a6%e8%a7%a3.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>试用webmin来管理nginx</title>
		<link>http://www.sunboyu.cn/2008/05/18/%e8%af%95%e7%94%a8webmin%e6%9d%a5%e7%ae%a1%e7%90%86nginx.shtml</link>
		<comments>http://www.sunboyu.cn/2008/05/18/%e8%af%95%e7%94%a8webmin%e6%9d%a5%e7%ae%a1%e7%90%86nginx.shtml#comments</comments>
		<pubDate>Sun, 18 May 2008 04:30:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[webmin]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=10</guid>
		<description><![CDATA[webmin没有nginx的管理模块,可以使用自定义命令来实现
关闭nginx:killall nginx 使用root执行
启动nginx:/usr/local/nginx/sbin/nginx
重启:两个命令连起来就可以,也可以写个简单shell
编辑配置文件:增加编辑文件命令   /usr/local/nginx/conf/**.conf
用着还挺爽的,简单方便
]]></description>
			<content:encoded><![CDATA[<p>webmin没有nginx的管理模块,可以使用自定义命令来实现</p>
<p>关闭nginx:killall nginx 使用root执行</p>
<p>启动nginx:/usr/local/nginx/sbin/nginx</p>
<p>重启:两个命令连起来就可以,也可以写个简单shell</p>
<p>编辑配置文件:增加编辑文件命令   /usr/local/nginx/conf/**.conf</p>
<p>用着还挺爽的,简单方便</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/05/18/%e8%af%95%e7%94%a8webmin%e6%9d%a5%e7%ae%a1%e7%90%86nginx.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>Nginx下WordPress的重写配置</title>
		<link>http://www.sunboyu.cn/2008/05/18/nginx%e4%b8%8bwordpress%e7%9a%84%e9%87%8d%e5%86%99%e9%85%8d%e7%bd%ae.shtml</link>
		<comments>http://www.sunboyu.cn/2008/05/18/nginx%e4%b8%8bwordpress%e7%9a%84%e9%87%8d%e5%86%99%e9%85%8d%e7%bd%ae.shtml#comments</comments>
		<pubDate>Sun, 18 May 2008 04:30:14 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[wordpress]]></category>

		<category><![CDATA[重写]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=11</guid>
		<description><![CDATA[nginx居然不兼容apache的.htaccess文件,无奈在配置文件中修改.
server
{
listen  80;
location / {
if (!-f $request_filename){
rewrite (.*) /index.php;
}
}
server_name sunboyu.cn www.sunboyu.cn *.sunboyu.cn somecode.cn www.somecode.cn *.somecode.cn;
index   index.html index.htm index.php;
root    /***/;
access_log  /***/host.access.log;
}
这样即可
]]></description>
			<content:encoded><![CDATA[<p>nginx居然不兼容apache的.htaccess文件,无奈在配置文件中修改.</p>
<p>server<br />
{<br />
listen  80;</p>
<p>location / {<br />
if (!-f $request_filename){<br />
rewrite (.*) /index.php;<br />
}<br />
}</p>
<p>server_name sunboyu.cn www.sunboyu.cn *.sunboyu.cn somecode.cn www.somecode.cn *.somecode.cn;<br />
index   index.html index.htm index.php;<br />
root    /***/;<br />
access_log  /***/host.access.log;<br />
}</p>
<p>这样即可</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/05/18/nginx%e4%b8%8bwordpress%e7%9a%84%e9%87%8d%e5%86%99%e9%85%8d%e7%bd%ae.shtml/feed</wfw:commentRss>
		</item>
		<item>
		<title>centos5安装nginx＋mysql＋php fastcgi模式</title>
		<link>http://www.sunboyu.cn/2008/05/18/centos5%e5%ae%89%e8%a3%85nginx%ef%bc%8bmysql%ef%bc%8bphp-fastcgi%e6%a8%a1%e5%bc%8f.shtml</link>
		<comments>http://www.sunboyu.cn/2008/05/18/centos5%e5%ae%89%e8%a3%85nginx%ef%bc%8bmysql%ef%bc%8bphp-fastcgi%e6%a8%a1%e5%bc%8f.shtml#comments</comments>
		<pubDate>Sun, 18 May 2008 04:20:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[原创技术]]></category>

		<category><![CDATA[centos5]]></category>

		<category><![CDATA[fastcgi]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[nginx]]></category>

		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.sunboyu.cn/?p=9</guid>
		<description><![CDATA[原教程 http://blog.s135.com/read.php/314.htm
安装环境：centos5.0 基本系统＋开发工具
安装xml组件
yum install libxml2  libxml2-devel
编译安装 php
./configure  &#8211;enable-fastcgi  &#8211;enable-force-cgi-redirect
make &#38;&#38; make install
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;
[root@localhost php-5.2.5]# make install
Installing PHP SAPI  module:       cgi
Installing PHP CGI binary:        /usr/local/bin/
Installing PHP CLI binary:        /usr/local/bin/
Installing PHP CLI man  [...]]]></description>
			<content:encoded><![CDATA[<div id="blogContainer">原教程 <a onclick="showLinkBubble(this);return false" href="http://blog.s135.com/read.php/314.htm" target="_blank">http://blog.s135.com/read.php/314.htm</a></p>
<p>安装环境：centos5.0 基本系统＋开发工具</p>
<p>安装xml组件<br />
yum install libxml2  libxml2-devel</p>
<p>编译安装 php<br />
./configure  &#8211;enable-fastcgi  &#8211;enable-force-cgi-redirect<br />
make &amp;&amp; make install<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
[root@localhost php-5.2.5]# make install<br />
Installing PHP SAPI  module:       cgi<br />
Installing PHP CGI binary:        /usr/local/bin/<br />
Installing PHP CLI binary:        /usr/local/bin/<br />
Installing PHP CLI man  page:      /usr/local/man/man1/<br />
Installing build environment:      /usr/local/lib/php/build/<br />
Installing header  files:          /usr/local/include/php/<br />
Installing helper programs:        /usr/local/bin/<br />
program: phpize<br />
program: php-config<br />
Installing  man pages:             /usr/local/man/man1/<br />
page: phpize.1<br />
page:  php-config.1<br />
Installing PEAR environment:      /usr/local/lib/php/<br />
[PEAR] Console_Getopt - installed: 1.2.3<br />
[PEAR] Archive_Tar    -  installed: 1.3.2<br />
[PEAR] Structures_Graph- installed: 1.0.2<br />
pear/PEAR can  optionally use package &#8220;pear/XML_RPC&#8221; (version &gt;= 1.4.0)<br />
[PEAR]  PEAR           - installed: 1.6.1<br />
Wrote PEAR system config file at:  /usr/local/etc/pear.conf<br />
You may want to add: /usr/local/lib/php to your  php.ini include_path<br />
Installing PDO  headers:          /usr/local/include/php/ext/pdo/<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
make test</p>
<p>yum安装mysql<br />
yum install mysql mysql-devel mysql-server</p>
<p>复制spawn-fcgi 至 /usr/local/bin/<br />
chmod +x spawn-fcgi</p>
<p>/usr/sbin/groupadd www -g 48<br />
/usr/sbin/useradd -u 48 -g www www<br />
使用spawn-fcgi监听127.0.0.1的10080端口 进程10 用户www<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
[root@localhost bin]# spawn-fcgi -a 127.0.0.1 -p 10080 -C 10 -u www -f  php-cgi<br />
X-Powered-By: PHP/5.2.5<br />
Content-type: text/html<br />
spawn-fcgi.c.211: child exited with: 0, Success<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
[root@localhost bin]# spawn-fcgi -a 127.0.0.1 -p 10080 -C 10 -u www -f  php-cgi<br />
spawn-fcgi.c.190: child spawned successfully: PID: 27936<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
安装pcre<br />
yum install pcre pcre-devel<br />
编译安装 nginx<br />
./configure  &#8211;user=www &#8211;group=www<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Configuration summary<br />
+ threads are not used<br />
+ using system PCRE  library<br />
+ OpenSSL library is not used<br />
+ md5 library is not used<br />
+ sha1 library is not used<br />
+ using system zlib library<br />
nginx  path prefix: &#8220;/usr/local/nginx&#8221;<br />
nginx binary file:  &#8220;/usr/local/nginx/sbin/nginx&#8221;<br />
nginx configuration file:  &#8220;/usr/local/nginx/conf/nginx.conf&#8221;<br />
nginx pid file:  &#8220;/usr/local/nginx/logs/nginx.pid&#8221;<br />
nginx error log file:  &#8220;/usr/local/nginx/logs/error.log&#8221;<br />
nginx http access log file:  &#8220;/usr/local/nginx/logs/access.log&#8221;<br />
nginx http client request body  temporary files: &#8220;/usr/local/nginx/client_body_temp&#8221;<br />
nginx http proxy  temporary files: &#8220;/usr/local/nginx/proxy_temp&#8221;<br />
nginx http fastcgi  temporary files: &#8220;/usr/local/nginx/fastcgi_temp&#8221;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
make &amp;&amp; make install</p>
<p>touche /usr/local/nginx/conf/fcgi.conf<br />
内容为<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;<br />
fastcgi_param  SERVER_SOFTWARE    nginx;<br />
fastcgi_param  QUERY_STRING       $query_string;<br />
fastcgi_param  REQUEST_METHOD     $request_method;<br />
fastcgi_param  CONTENT_TYPE       $content_type;<br />
fastcgi_param  CONTENT_LENGTH     $content_length;<br />
fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;<br />
fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;<br />
fastcgi_param  REQUEST_URI        $request_uri;<br />
fastcgi_param  DOCUMENT_URI       $document_uri;<br />
fastcgi_param  DOCUMENT_ROOT      $document_root;<br />
fastcgi_param  SERVER_PROTOCOL    $server_protocol;<br />
fastcgi_param  REMOTE_ADDR        $remote_addr;<br />
fastcgi_param  REMOTE_PORT        $remote_port;<br />
fastcgi_param  SERVER_ADDR        $server_addr;<br />
fastcgi_param  SERVER_PORT        $server_port;<br />
fastcgi_param  SERVER_NAME        $server_name;<br />
# PHP only, required if  PHP was built with &#8211;enable-force-cgi-redirect<br />
#fastcgi_param  REDIRECT_STATUS    200;<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
启动 nginx<br />
ulimit -SHn 51200<br />
/usr/local/nginx/sbin/nginx -c  /usr/local/nginx/conf/nginx.conf</p>
<p>配置开机自动启动Nginx + PHP<br />
vi  /etc/rc.local<br />
在末尾增加以下内容：<br />
ulimit -SHn 51200<br />
/usr/local/bin/spawn-fcgi  -a 127.0.0.1 -p 10080 -C 64 -u www -f /usr/local/bin/php-cgi<br />
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf</p>
<p>优化Linux内核参数<br />
vi /etc/sysctl.conf<br />
在末尾增加以下内容：<br />
net.ipv4.tcp_fin_timeout = 30<br />
net.ipv4.tcp_keepalive_time = 300<br />
net.ipv4.tcp_syncookies = 1<br />
net.ipv4.tcp_tw_reuse = 1<br />
net.ipv4.tcp_tw_recycle = 1<br />
net.ipv4.ip_local_port_range = 5000    65000</p>
<p>使配置立即生效：<br />
/sbin/sysctl -p<br />
在不停止Nginx服务的情况下平滑变更Nginx配置<br />
修改/usr/local/nginx/conf/nginx.conf配置文件后，请执行以下命令检查配置文件是否正确：<br />
/usr/local/webserver/nginx/sbin/nginx -t</p>
<p>这时，输入以下命令查看Nginx主进程号：<br />
ps -ef | grep &#8220;nginx: master process&#8221; | grep -v &#8220;grep&#8221; | awk -F &#8216; &#8216; &#8216;{print  $2}&#8217;</p>
<p>至于日常维护，还不太清楚，咱们下次分解</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
Nginx的编译参数如下：<br />
[root@localhost]#./configure &#8211;prefix=/usr/local/server/nginx  &#8211;with-openssl=/usr/include \<br />
&#8211;with-pcre=/usr/include/pcre/  &#8211;with-http_stub_status_module &#8211;without-http_memcached_module \<br />
&#8211;without-http_fastcgi_module &#8211;without-http_rewrite_module  &#8211;without-http_map_module \<br />
&#8211;without-http_geo_module  &#8211;without-http_autoindex_module</p>
</div>
<p><img id="paperPicArea1" style="display: none; position: relative;" src="http://imgcache.qq.com/ac/qzone_v4/b.gif" alt="" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.sunboyu.cn/2008/05/18/centos5%e5%ae%89%e8%a3%85nginx%ef%bc%8bmysql%ef%bc%8bphp-fastcgi%e6%a8%a1%e5%bc%8f.shtml/feed</wfw:commentRss>
		</item>
	</channel>
</rss>

