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

<channel>
	<title>可可熊的窝</title>
	<atom:link href="http://cocobear.info/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://cocobear.info/blog</link>
	<description>多读、多写</description>
	<pubDate>Thu, 04 Dec 2008 02:01:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>想换一个Linux发型版</title>
		<link>http://cocobear.info/blog/2008/12/04/want-a-new-linux-distribute/</link>
		<comments>http://cocobear.info/blog/2008/12/04/want-a-new-linux-distribute/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 02:01:38 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
		
		<category><![CDATA[Linux]]></category>

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

		<guid isPermaLink="false">http://cocobear.info/blog/?p=406</guid>
		<description><![CDATA[用了Fedora也有不少时间了，总的感觉还不错，但是我想要一个可以掌握在手里的系统，比较干净一些，不想有一些我从来用不到的东西，比如Java，我很讨厌系统里面有这些个东西，Fedora安装下来有不少没用的东西，即使使用很小的安装也得占大概2G的空间。
我希望的这个发型版：
比较干净（没用的东西尽量少，需要的时候才安装）
定制性比较强，安装软件比较容易（但也不可以因为我想听个歌而让我折腾半天的时间去装个播放器，也不可以让我花大量时间去折腾显卡配置等系统问题，我需要专注做事情，而不是折腾系统，系统只是个工具）
很方便使用X，我大部分时间还是需要X的；
比较适合做开发，比如Python，SDL，OpenGL，wxPython&#8230;&#8230;
速度比较快，Fedora开机的时候会加载很多没用的东西，当然这些可以自己手动去掉，俺还是不喜欢；
升级不能太频繁，Fedora从5开始用，现在都10了，才两年多的时间，太快了，虽然系统确实一直在进步，或者至少可以平滑的升级，Fedora在这方面做的不好；
稳定性比较好，说实话用这么长时间Fedora，还是有不少时间莫名的死掉；
暂时就想到这么多，最近把大部份的Linux发型版介绍都看了看，目前觉得以下几个比较合适的我需要：
ArchLinux
Slackware
Gentoo
现在还拿不定主意，路过的给个选择，或者还有别的发型版更合适我？
]]></description>
			<content:encoded><![CDATA[<p>用了<a href="http://cocobear.info/blog/tag/fedora/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Fedora">Fedora</a>也有不少时间了，总的感觉还不错，但是我想要一个可以掌握在手里的系统，比较干净一些，不想有一些我从来用不到的东西，比如Java，我很讨厌系统里面有这些个东西，<a href="http://cocobear.info/blog/tag/fedora/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Fedora">Fedora</a>安装下来有不少没用的东西，即使使用很小的安装也得占大概2G的空间。</p>
<p>我希望的这个发型版：</p>
<li>比较干净（没用的东西尽量少，需要的时候才安装）</li>
<li>定制性比较强，安装软件比较容易（但也不可以因为我想听个歌而让我折腾半天的时间去装个播放器，也不可以让我花大量时间去折腾显卡配置等系统问题，我需要专注做事情，而不是折腾系统，系统只是个工具）</li>
<li>很方便使用X，我大部分时间还是需要X的；</li>
<li>比较适合做开发，比如<a href="http://cocobear.info/blog/tag/python/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Python">Python</a>，SDL，OpenGL，wxPython&#8230;&#8230;</li>
<li>速度比较快，<a href="http://cocobear.info/blog/tag/fedora/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Fedora">Fedora</a>开机的时候会加载很多没用的东西，当然这些可以自己手动去掉，俺还是不喜欢；</li>
<li>升级不能太频繁，<a href="http://cocobear.info/blog/tag/fedora/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Fedora">Fedora</a>从5开始用，现在都10了，才两年多的时间，太快了，虽然系统确实一直在进步，或者至少可以平滑的升级，<a href="http://cocobear.info/blog/tag/fedora/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Fedora">Fedora</a>在这方面做的不好；</li>
<li>稳定性比较好，说实话用这么长时间<a href="http://cocobear.info/blog/tag/fedora/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Fedora">Fedora</a>，还是有不少时间莫名的死掉；</li>
<p>暂时就想到这么多，最近把大部份的<a href="http://cocobear.info/blog/tag/linux/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Linux">Linux</a>发型版介绍都看了看，目前觉得以下几个比较合适的我需要：</p>
<p>ArchLinux<br />
Slackware<br />
Gentoo</p>
<p>现在还拿不定主意，路过的给个选择，或者还有别的发型版更合适我？</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2008/12/04/want-a-new-linux-distribute/feed/</wfw:commentRss>
		</item>
		<item>
		<title>最近用Python写了个Fetion的库</title>
		<link>http://cocobear.info/blog/2008/12/03/write-fetion-with-python-pyfetion/</link>
		<comments>http://cocobear.info/blog/2008/12/03/write-fetion-with-python-pyfetion/#comments</comments>
		<pubDate>Wed, 03 Dec 2008 09:53:30 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
		
		<category><![CDATA[Python]]></category>

		<category><![CDATA[编程相关]]></category>

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

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

		<guid isPermaLink="false">http://cocobear.info/blog/?p=403</guid>
		<description><![CDATA[上周大部分的时间在写这个东西，现在基本上实现了我所需要的功能，网上有一些Fetion的实现，不过都比较凑合，也有一个叫LibFetion的东西，不过不开放源代码，所以就自己写了这个PyFetion的库。
目前这个库有以下功能：
支持飞信2006，2008协议（其实就是分别使用MD5、SHA1算法进行登录认证）；
支持HTTP、TCP方式；
支持给自己手机发短信（这个也是我的主要目的）；
支持直接发送信息到指定手机号（前提是加为好友，好处是直接使用手机号，而不需要知道飞信号）；
支持添加好友
&#8230;&#8230;.
在设计好整个框架以后，再有一些功能添加进来也就比较方便了
特点：
纯Python代码，可以运行到任何地方，只要有Python的地方就有fetion；
封装程度比较高，使用方便；
好的，吹完了。本来还想把这个写成一个完整的飞信客户端，但是觉得没什么必要，已经有Pidgin自带的飞信插件，还有个不开源的LibFetion我再写一个就没什么意义了，而且我这个PyFetion的定位本来也不是做完整的客户端。何况写GUI的程序我想把界面做得漂亮些，我现在也没什么做GUI的经验，wxPython也用的不熟。我还有个想法就是用SDL（Pygame）之类的做一个很炫的客户端，不过这肯定得花不少的时间，最近公司可能要开始忙了，这些还是先放一放吧。
刚公司开了两个多小时会，这会儿都下班好久了，今天就到此结束吧。
]]></description>
			<content:encoded><![CDATA[<p>上周大部分的时间在写这个东西，现在基本上实现了我所需要的功能，网上有一些<a href="http://cocobear.info/blog/tag/fetion/" class="st_tag internal_tag" rel="tag" title="Posts tagged with fetion">Fetion</a>的实现，不过都比较凑合，也有一个叫LibFetion的东西，不过不开放源代码，所以就自己写了这个<a href="http://cocobear.info/blog/tag/pyfetion/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PyFetion">PyFetion</a>的库。</p>
<p>目前这个库有以下<strong>功能</strong>：</p>
<li>支持飞信2006，2008协议（其实就是分别使用MD5、SHA1算法进行登录认证）；</li>
<li>支持HTTP、TCP方式；</li>
<li>支持给自己手机发短信（这个也是我的主要目的）；</li>
<li>支持直接发送信息到指定手机号（前提是加为好友，好处是直接使用手机号，而不需要知道飞信号）；</li>
<li>支持添加好友</li>
<li>&#8230;&#8230;.</li>
<p>在设计好整个框架以后，再有一些功能添加进来也就比较方便了</p>
<p><strong>特点</strong>：</p>
<li>纯<a href="http://cocobear.info/blog/tag/python/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Python">Python</a>代码，可以运行到任何地方，只要有<a href="http://cocobear.info/blog/tag/python/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Python">Python</a>的地方就有<a href="http://cocobear.info/blog/tag/fetion/" class="st_tag internal_tag" rel="tag" title="Posts tagged with fetion">fetion</a>；</li>
<li>封装程度比较高，使用方便；</li>
<p>好的，吹完了。本来还想把这个写成一个完整的飞信客户端，但是觉得没什么必要，已经有Pidgin自带的飞信插件，还有个不开源的LibFetion我再写一个就没什么意义了，而且我这个<a href="http://cocobear.info/blog/tag/pyfetion/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PyFetion">PyFetion</a>的定位本来也不是做完整的客户端。何况写GUI的程序我想把界面做得漂亮些，我现在也没什么做GUI的经验，wxPython也用的不熟。我还有个想法就是用SDL（Pygame）之类的做一个很炫的客户端，不过这肯定得花不少的时间，最近公司可能要开始忙了，这些还是先放一放吧。</p>
<p>刚公司开了两个多小时会，这会儿都下班好久了，今天就到此结束吧。</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2008/12/03/write-fetion-with-python-pyfetion/feed/</wfw:commentRss>
		</item>
		<item>
		<title>代码高亮插件&#8211;使用黑色背景</title>
		<link>http://cocobear.info/blog/2008/11/21/ig_syntax_hilite-use-black-background/</link>
		<comments>http://cocobear.info/blog/2008/11/21/ig_syntax_hilite-use-black-background/#comments</comments>
		<pubDate>Fri, 21 Nov 2008 09:11:56 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
		
		<category><![CDATA[Linux]]></category>

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

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

		<guid isPermaLink="false">http://cocobear.info/blog/?p=398</guid>
		<description><![CDATA[ig_syntax_hilite这个代码高亮的插件默认使用的是白色背景，所以小林子同学说看不清楚代码，俺就试着把ig_syntax_hilite插件所有颜色代码全部反转了一下，例如：
#ffffff黑色转换为#000000
ig_syntax_hilite使用的是geshe，在geshe目录下有很多与语言相关的php加亮文件，颜色代码就在这里生成，使用sed命令进行替换：
 代码一 


BASH:




sed -r '/color *: *#[0-9a-f]{6};/{h;s/.*#([^;]+);.*/\1/;y/0123456789abcdef/fedcba9876543210/;G;s/(.*)\n(.*#)[^;]+(;.*)/\2\1\3/}' urfile







 代码二 


BASH:




find ./ -iname abap.php &#124; &#123; while read i;do sed -rn 'h;s/.*color[ \t]*[=:][ \t]*#([a-fA-F0-9]+).*/\1/;ta;p;d;:a y/0123456789abcdefABCDEF/fedcba9876543210543210/;G;s/(.*)\n(.*color[ \t]*[=:][ \t]*#)([a-fA-F0-9]+)(.*)/\2\1\4/p' $i&#62;/tmp/tmp__;echo fuck;\cp -f /tmp/tmp__ $i;echo fuck;rm -f /tmp/tmp__;done; &#125;







上面的代码不是俺写的，具体可以查看CU论坛
俺什么时候也能把sed用到这种境界也就满足了:-)
上面简单的一句话脚本还是很有用的，上次俺花了一天的时间去修改主题的配色，其实如果要求不高的话用这脚本一下就搞定了:-)
]]></description>
			<content:encoded><![CDATA[<p><a href="http://cocobear.info/blog/tag/ig_syntax_hilite/" class="st_tag internal_tag" rel="tag" title="Posts tagged with ig_syntax_hilite">ig_syntax_hilite</a>这个代码高亮的插件默认使用的是白色背景，所以<a href="http://windflush.cn/blog/">小林子</a>同学说看不清楚代码，俺就试着把<a href="http://cocobear.info/blog/tag/ig_syntax_hilite/" class="st_tag internal_tag" rel="tag" title="Posts tagged with ig_syntax_hilite">ig_syntax_hilite</a>插件所有颜色代码全部反转了一下，例如：<br />
#ffffff黑色转换为#000000</p>
<p><a href="http://cocobear.info/blog/tag/ig_syntax_hilite/" class="st_tag internal_tag" rel="tag" title="Posts tagged with ig_syntax_hilite">ig_syntax_hilite</a>使用的是<a href="http://qbnz.com/highlighter/">geshe</a>，在geshe目录下有很多与语言相关的php加亮文件，颜色代码就在这里生成，使用<a href="http://cocobear.info/blog/tag/sed/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sed">sed</a>命令进行替换：</p>
<p><a href="#" onclick="xcollapse('X5853');return false;"> 代码一 </a><br />
</p>
<div id="X5853" style="display: none; border 1px solid=#0000cc; padding: 10px; background-color: transparent;">
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-3">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3df346; font-weight: bold;"><a href="http://cocobear.info/blog/tag/sed/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sed">sed</a></span> <span style="color: #99ffcc;">-r</span> <span style="color: #00ffff;">'/color *: *#[0-9a-f]{6};/{h;s/.*#([^;]+);.*/\1/;y/0123456789abcdef/fedcba9876543210/;G;s/(.*)\n(.*#)[^;]+(;.*)/\2\1\3/}'</span> urfile</div>
</li>
</ol>
</div>
</div>
</div>
<p>
</div>
<p><a href="#" onclick="xcollapse('X2424');return false;"> 代码二 </a><br />
</p>
<div id="X2424" style="display: none; border 1px solid=#0000cc; padding: 10px; background-color: transparent;">
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-4">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #3df346; font-weight: bold;">find</span> .<span style="color: #ffffff; font-weight: bold;">/</span> <span style="color: #99ffcc;">-iname</span> abap.php <span style="color: #ffffff; font-weight: bold;">|</span> <span style="color: #85f78b; font-weight: bold;">&#123;</span> <span style="color: #ffffff; font-weight: bold;">while</span> <span style="color: #3df346; font-weight: bold;">read</span> i;<span style="color: #ffffff; font-weight: bold;">do</span> <span style="color: #3df346; font-weight: bold;"><a href="http://cocobear.info/blog/tag/sed/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sed">sed</a></span> <span style="color: #99ffcc;">-rn</span> <span style="color: #00ffff;">'h;s/.*color[ \t]*[=:][ \t]*#([a-fA-F0-9]+).*/\1/;ta;p;d;:a y/0123456789abcdefABCDEF/fedcba9876543210543210/;G;s/(.*)\n(.*color[ \t]*[=:][ \t]*#)([a-fA-F0-9]+)(.*)/\2\1\4/p'</span> <span style="color: #ff87ff;">$i</span><span style="color: #ffffff; font-weight: bold;">&gt;/</span>tmp<span style="color: #ffffff; font-weight: bold;">/</span>tmp__;<span style="color: #85f78b; font-weight: bold;">echo</span> fuck;\<span style="color: #3df346; font-weight: bold;">cp</span> <span style="color: #99ffcc;">-f</span> <span style="color: #ffffff; font-weight: bold;">/</span>tmp<span style="color: #ffffff; font-weight: bold;">/</span>tmp__ <span style="color: #ff87ff;">$i</span>;<span style="color: #85f78b; font-weight: bold;">echo</span> fuck;<span style="color: #3df346; font-weight: bold;">rm</span> <span style="color: #99ffcc;">-f</span> <span style="color: #ffffff; font-weight: bold;">/</span>tmp<span style="color: #ffffff; font-weight: bold;">/</span>tmp__;<span style="color: #ffffff; font-weight: bold;">done</span>; <span style="color: #85f78b; font-weight: bold;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
</div>
<p>上面的代码不是俺写的，具体可以查看<a href="http://bbs3.chinaunix.net/thread-1316725-1-1.html">CU论坛</a><br />
俺什么时候也能把<a href="http://cocobear.info/blog/tag/sed/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sed">sed</a>用到这种境界也就满足了:-)</p>
<p>上面简单的一句话脚本还是很有用的，上次俺花了一天的时间去修改主题的配色，其实如果要求不高的话用这脚本一下就搞定了:-)</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2008/11/21/ig_syntax_hilite-use-black-background/feed/</wfw:commentRss>
		</item>
		<item>
		<title>筛选法求质数</title>
		<link>http://cocobear.info/blog/2008/11/18/select-prime-number/</link>
		<comments>http://cocobear.info/blog/2008/11/18/select-prime-number/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 08:59:49 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
		
		<category><![CDATA[C]]></category>

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

		<category><![CDATA[编程相关]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=358</guid>
		<description><![CDATA[在这里看到用Lua和Python写的使用筛选法求质数的代码，俺自己也写了写，Python版用到了上面链接中一位兄弟的tips  
先来C语言版的: 
C:




#include &#60;stdio .h&#62;


#include &#60;math .h&#62;


&#160;


#define NUM 2000000


&#160;


int main&#40;void&#41;


&#123;


&#160; &#160; int primes&#91;NUM&#93;;


&#160; &#160; int i,j;


&#160; &#160; for &#40;i=0;i&#60;num ;i++&#41; &#123;


&#160; &#160; &#160; &#160; primes&#91;i&#93; = 1;


&#160;


&#160; &#160; &#125;


&#160; &#160; primes&#91;0&#93; = 0;


&#160; &#160; primes&#91;1&#93; = 0;


&#160; &#160; for &#40;i=1;i&#60;&#40;long&#41;sqrt&#40;NUM&#41;+1;i++&#41; &#123;


&#160; &#160; &#160; &#160; if &#40;primes&#91;i&#93;&#41; &#123;


&#160; &#160; &#160; &#160; &#160; &#160; for &#40;j=pow&#40;i,2&#41;;j&#60;NUM;j+=i&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>在<a href="http://www.leninlee.cn/?p=774">这里</a>看到用Lua和Python写的使用筛选法求质数的代码，俺自己也写了写，Python版用到了上面链接中一位兄弟的tips <img src='http://cocobear.info/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>先来C语言版的: </p>
<div class="syntax_hilite"><span class="langName">C:</span>
<div id="c-10">
<div class="c" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #cc66cc;">#include &lt;stdio .h&gt;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #cc66cc;">#include &lt;math .h&gt;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #cc66cc;">#define NUM 2000000</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #66cccc;">int</span> main<span style="color: #ff66ff;">&#40;</span><span style="color: #66cccc;">void</span><span style="color: #ff66ff;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff66ff;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #66cccc;">int</span> primes<span style="color: #ff66ff;">&#91;</span>NUM<span style="color: #ff66ff;">&#93;</span><span style="color: #cc66cc;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #66cccc;">int</span> i<span style="color: #cc66cc;">,</span>j<span style="color: #cc66cc;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #4e4eff;">for</span> <span style="color: #ff66ff;">&#40;</span>i<span style="color: #cc66cc;">=</span><span style="color: #ffff22;color:#800000;">0</span><span style="color: #cc66cc;">;</span>i<span style="color: #cc66cc;">&lt;</span>num <span style="color: #cc66cc;">;</span>i<span style="color: #cc66cc;">++</span><span style="color: #ff66ff;">&#41;</span> <span style="color: #ff66ff;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; primes<span style="color: #ff66ff;">&#91;</span>i<span style="color: #ff66ff;">&#93;</span> <span style="color: #cc66cc;">=</span> <span style="color: #ffff22;color:#800000;">1</span><span style="color: #cc66cc;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #ff66ff;">&#125;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; primes<span style="color: #ff66ff;">&#91;</span><span style="color: #ffff22;color:#800000;">0</span><span style="color: #ff66ff;">&#93;</span> <span style="color: #cc66cc;">=</span> <span style="color: #ffff22;color:#800000;">0</span><span style="color: #cc66cc;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; primes<span style="color: #ff66ff;">&#91;</span><span style="color: #ffff22;color:#800000;">1</span><span style="color: #ff66ff;">&#93;</span> <span style="color: #cc66cc;">=</span> <span style="color: #ffff22;color:#800000;">0</span><span style="color: #cc66cc;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #4e4eff;">for</span> <span style="color: #ff66ff;">&#40;</span>i<span style="color: #cc66cc;">=</span><span style="color: #ffff22;color:#800000;">1</span><span style="color: #cc66cc;">;</span>i<span style="color: #cc66cc;">&lt;</span><span style="color: #ff66ff;">&#40;</span><span style="color: #66cccc;">long</span><span style="color: #ff66ff;">&#41;</span>sqrt<span style="color: #ff66ff;">&#40;</span>NUM<span style="color: #ff66ff;">&#41;</span><span style="color: #cc66cc;">+</span><span style="color: #ffff22;color:#800000;">1</span><span style="color: #cc66cc;">;</span>i<span style="color: #cc66cc;">++</span><span style="color: #ff66ff;">&#41;</span> <span style="color: #ff66ff;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #4e4eff;">if</span> <span style="color: #ff66ff;">&#40;</span>primes<span style="color: #ff66ff;">&#91;</span>i<span style="color: #ff66ff;">&#93;</span><span style="color: #ff66ff;">&#41;</span> <span style="color: #ff66ff;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #4e4eff;">for</span> <span style="color: #ff66ff;">&#40;</span>j<span style="color: #cc66cc;">=</span>pow<span style="color: #ff66ff;">&#40;</span>i<span style="color: #cc66cc;">,</span><span style="color: #ffff22;color:#800000;">2</span><span style="color: #ff66ff;">&#41;</span><span style="color: #cc66cc;">;</span>j<span style="color: #cc66cc;">&lt;</span>NUM<span style="color: #cc66cc;">;</span>j<span style="color: #cc66cc;">+=</span>i<span style="color: #ff66ff;">&#41;</span> <span style="color: #ff66ff;">&#123;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; primes<span style="color: #ff66ff;">&#91;</span>j<span style="color: #ff66ff;">&#93;</span> <span style="color: #cc66cc;">=</span> <span style="color: #ffff22;color:#800000;">0</span><span style="color: #cc66cc;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff66ff;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff66ff;">&#125;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #ff66ff;">&#125;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #66cccc;">long</span> sum <span style="color: #cc66cc;">=</span> <span style="color: #ffff22;color:#800000;">0</span><span style="color: #cc66cc;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #4e4eff;">for</span> <span style="color: #ff66ff;">&#40;</span>i<span style="color: #cc66cc;">=</span><span style="color: #ffff22;color:#800000;">0</span><span style="color: #cc66cc;">;</span>i<span style="color: #cc66cc;">&lt;</span>NUM<span style="color: #cc66cc;">;</span>i<span style="color: #cc66cc;">++</span><span style="color: #ff66ff;">&#41;</span> <span style="color: #ff66ff;">&#123;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #4e4eff;">if</span> <span style="color: #ff66ff;">&#40;</span>primes<span style="color: #ff66ff;">&#91;</span>i<span style="color: #ff66ff;">&#93;</span><span style="color: #ff66ff;">&#41;</span> sum<span style="color: #cc66cc;">+=</span>i<span style="color: #cc66cc;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #ff66ff;">&#125;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color: #ffff99;">printf</span></a><span style="color: #ff66ff;">&#40;</span><span style="color: #00ffff;">&quot;%ld<span style="color: #ffff66; font-weight: bold;">\n</span>&quot;</span><span style="color: #cc66cc;">,</span>sum<span style="color: #ff66ff;">&#41;</span><span style="color: #cc66cc;">;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #4e4eff;">return</span> <span style="color: #ffff22;color:#800000;">0</span><span style="color: #cc66cc;">;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff66ff;">&#125;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>计算两百万以内质数和大约0.1秒左右：</p>
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-11">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #85f78b; font-weight: bold;">&#91;</span>cocobear<span style="color: #ffffff; font-weight: bold;">@</span>cocobear wxpython<span style="color: #85f78b; font-weight: bold;">&#93;</span>$ <span style="color: #ffffff; font-weight: bold;">time</span> .<span style="color: #ffffff; font-weight: bold;">/</span>a.out </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ffffff;color:#800000;">142913828922</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">real&nbsp; &nbsp; 0m0.100s</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">user&nbsp; &nbsp; 0m0.088s</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sys 0m0.012s</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p> 接着来可爱的Python版: </p>
<div class="syntax_hilite"><span class="langName">PYTHON:</span>
<div id="python-12">
<div class="python" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0088ff;font-weight:bold;">from</span> <span style="color: #23ebc3;">math</span> <span style="color: #0088ff;font-weight:bold;">import</span> sqrt</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">NUM = <span style="color: #00baff;color:#800000;">2000000</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">prime_num = <span style="color: black;">&#91;</span>i <span style="color: #0088ff;font-weight:bold;">for</span> i <span style="color: #0088ff;font-weight:bold;">in</span> <span style="color: #ff7fff;">xrange</span><span style="color: black;">&#40;</span>NUM+<span style="color: #00baff;color:#800000;">1</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0088ff;font-weight:bold;">for</span> i <span style="color: #0088ff;font-weight:bold;">in</span> <span style="color: #ff7fff;">xrange</span><span style="color: black;">&#40;</span><span style="color: #00baff;color:#800000;">2</span>,<span style="color: #ff7fff;">int</span><span style="color: black;">&#40;</span>sqrt<span style="color: black;">&#40;</span>NUM<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>+<span style="color: #00baff;color:#800000;">1</span><span style="color: black;">&#41;</span>:</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; <span style="color: #0088ff;font-weight:bold;">if</span> prime_num<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>:</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; start = i<span style="color: #993399;">**</span><span style="color: #00baff;color:#800000;">2</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; step &nbsp;= i </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp; &nbsp; &nbsp; &nbsp; prime_num<span style="color: black;">&#91;</span>start::step<span style="color: black;">&#93;</span> = <span style="color: black;">&#40;</span> <span style="color: black;">&#40;</span>NUM - start<span style="color: black;">&#41;</span>/step + <span style="color: #00baff;color:#800000;">1</span><span style="color: black;">&#41;</span><span style="color: #993399;">*</span><span style="color: black;">&#91;</span><span style="color: #00baff;color:#800000;">0</span><span style="color: black;">&#93;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #0088ff;font-weight:bold;">print</span> <span style="color: #ff7fff;">sum</span><span style="color: black;">&#40;</span>prime_num<span style="color: black;">&#41;</span>-<span style="color: #00baff;color:#800000;">1</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>执行时间1秒多点：</p>
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-13">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #85f78b; font-weight: bold;">&#91;</span>cocobear<span style="color: #ffffff; font-weight: bold;">@</span>cocobear wxpython<span style="color: #85f78b; font-weight: bold;">&#93;</span>$ <span style="color: #ffffff; font-weight: bold;">time</span> python prime.py </div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ffffff;color:#800000;">142913828922</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">&nbsp;</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">real&nbsp; &nbsp; 0m1.204s</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">user&nbsp; &nbsp; 0m1.051s</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">sys 0m0.093s</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Python不到10行的代码也有不错的效率:-)<br />
以上测试平台为:</p>
<p>Fedora 9 AMD64 4600+ 4G</p>
<p><a href="#" onclick="xcollapse('X9134');return false;"> 计算5的阶乘<br />
</p>
<div id="X9134" style="display: none; border 1px solid=#0000cc; padding: 10px; background-color: transparent;">
<div class="syntax_hilite"><span class="langName">PYTHON:</span>
<div id="python-14">
<div class="python" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ff7fff;">reduce</span><span style="color: black;">&#40;</span><span style="color: #0088ff;font-weight:bold;">lambda</span> x,y:x<span style="color: #993399;">*</span>y,<span style="color: #ff7fff;">range</span><span style="color: black;">&#40;</span><span style="color: #00baff;color:#800000;">1</span>,<span style="color: #00baff;color:#800000;">5</span>+<span style="color: #00baff;color:#800000;">1</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
</div>
<p></num></math>
<p></stdio></p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2008/11/18/select-prime-number/feed/</wfw:commentRss>
		</item>
		<item>
		<title>GRUB问题</title>
		<link>http://cocobear.info/blog/2008/11/11/grub-no-stage1-exists/</link>
		<comments>http://cocobear.info/blog/2008/11/11/grub-no-stage1-exists/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 02:39:04 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
		
		<category><![CDATA[Linux]]></category>

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

		<guid isPermaLink="false">http://cocobear.info/blog/?p=354</guid>
		<description><![CDATA[昨天在机子上试着装了下RHEL 5.2（在新的分区安装sda3），重新安装了GRUB（安装到了MBR），结果机子上原来的Fedora 9（在sda4分区上）不能启动了，GRUB会提示错误：

setup (hd0,3)
Checking if "/boot/grub/stage1" exists... no
Checking if "/grub/stage1" exists... no 
最后在RHEL 5.2中我把原来Fedora 9分区下/boot/grub/中的所有文件拷到了RHEL 5.2中的/boot/grub/，结果就正常了。不太理解为什么重新安装了GRUB，就无法引导原来的Fedora 9了。
]]></description>
			<content:encoded><![CDATA[<p>昨天在机子上试着装了下RHEL 5.2（在新的分区安装sda3），重新安装了<a href="http://cocobear.info/blog/tag/grub/" class="st_tag internal_tag" rel="tag" title="Posts tagged with grub">GRUB</a>（安装到了MBR），结果机子上原来的<a href="http://cocobear.info/blog/tag/fedora/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Fedora">Fedora</a> 9（在sda4分区上）不能启动了，<a href="http://cocobear.info/blog/tag/grub/" class="st_tag internal_tag" rel="tag" title="Posts tagged with grub">GRUB</a>会提示错误：</p>
<blockquote><p>
setup (hd0,3)<br />
Checking if "/boot/<a href="http://cocobear.info/blog/tag/grub/" class="st_tag internal_tag" rel="tag" title="Posts tagged with grub">grub</a>/stage1" exists... no<br />
Checking if "/<a href="http://cocobear.info/blog/tag/grub/" class="st_tag internal_tag" rel="tag" title="Posts tagged with grub">grub</a>/stage1" exists... no </p></blockquote>
<p>最后在RHEL 5.2中我把原来<a href="http://cocobear.info/blog/tag/fedora/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Fedora">Fedora</a> 9分区下/boot/<a href="http://cocobear.info/blog/tag/grub/" class="st_tag internal_tag" rel="tag" title="Posts tagged with grub">grub</a>/中的所有文件拷到了RHEL 5.2中的/boot/<a href="http://cocobear.info/blog/tag/grub/" class="st_tag internal_tag" rel="tag" title="Posts tagged with grub">grub</a>/，结果就正常了。不太理解为什么重新安装了<a href="http://cocobear.info/blog/tag/grub/" class="st_tag internal_tag" rel="tag" title="Posts tagged with grub">GRUB</a>，就无法引导原来的<a href="http://cocobear.info/blog/tag/fedora/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Fedora">Fedora</a> 9了。</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2008/11/11/grub-no-stage1-exists/feed/</wfw:commentRss>
		</item>
		<item>
		<title>博客换了个主题</title>
		<link>http://cocobear.info/blog/2008/11/06/change-theme-for-blog/</link>
		<comments>http://cocobear.info/blog/2008/11/06/change-theme-for-blog/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 04:27:32 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
		
		<category><![CDATA[Life]]></category>

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

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

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

		<guid isPermaLink="false">http://cocobear.info/blog/?p=345</guid>
		<description><![CDATA[前天上网的时候无意中搜到一个博客，发现那个主题挺不错，很简洁，很符合俺的胃口，于是昨天花了一天的时间去修改这个主题，把它改成了黑色的，其它细节地方也修改了一下，目前的感觉还不错，我测试了Firefox,Opera,IE,基本都没问题，只有IE里面留言时那个"电邮"那一栏的颜色有问题，实在是搞不明白，不管了，还是推荐大家使用Opera/Firefox浏览。
有什么好的建议欢迎提出来，俺再改改。好久没动CSS这东西了，发现改这个东西好痛苦，不仅要考虑显示器的分辨率，还要考虑不同的浏览器，太麻烦了！！
俺博客的新口号：
K.I.S.S Keep It Simple, Stupid.
--------------------简单的分隔线-----------------------------------------------
记个通过使用dreamhost作为加密代理的方法:
首先使用ssh连接dreamhost主机：
ssh -CND 9999 cocobear@cocobear.info
然后在浏览器里设置使用sock5代理，填入127.0.0.0 ,9999。
这样所有的HTTP请求都经过ssh加密了，不怕GFW了，不过速度同时也慢下来了。
详细的内容见这里
]]></description>
			<content:encoded><![CDATA[<p>前天上网的时候无意中搜到一个<a href="http://www.leninlee.cn/">博客</a>，发现那个主题挺不错，很简洁，很符合俺的胃口，于是昨天花了一天的时间去修改这个主题，把它改成了黑色的，其它细节地方也修改了一下，目前的感觉还不错，我测试了Firefox,Opera,IE,基本都没问题，只有IE里面留言时那个"电邮"那一栏的颜色有问题，实在是搞不明白，不管了，还是推荐大家使用Opera/Firefox浏览。</p>
<p>有什么好的建议欢迎提出来，俺再改改。好久没动<a href="http://cocobear.info/blog/tag/css/" class="st_tag internal_tag" rel="tag" title="Posts tagged with css">CSS</a>这东西了，发现改这个东西好痛苦，不仅要考虑显示器的分辨率，还要考虑不同的浏览器，太麻烦了！！</p>
<p>俺博客的新口号：<br />
<strong>K.I.S.S</strong> Keep It Simple, Stupid.</p>
<p>--------------------简单的分隔线-----------------------------------------------<br />
记个通过使用dreamhost作为加密代理的方法:<br />
首先使用ssh连接dreamhost主机：<br />
ssh -CND 9999 cocobear@cocobear.info<br />
然后在浏览器里设置使用sock5代理，填入127.0.0.0 ,9999。<br />
这样所有的HTTP请求都经过ssh加密了，不怕GFW了，不过速度同时也慢下来了。<br />
详细的内容见<a href="http://lifehacker.com/software/ssh/geek-to-live--encrypt-your-web-browsing-session-with-an-ssh-socks-proxy-237227.php">这里</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2008/11/06/change-theme-for-blog/feed/</wfw:commentRss>
		</item>
		<item>
		<title>今晚的小插曲</title>
		<link>http://cocobear.info/blog/2008/11/01/stop-at-bios-logo-by-mp3/</link>
		<comments>http://cocobear.info/blog/2008/11/01/stop-at-bios-logo-by-mp3/#comments</comments>
		<pubDate>Fri, 31 Oct 2008 16:09:52 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
		
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=319</guid>
		<description><![CDATA[拷了几本电子书在MP3上，打算回去拷到俺自己的电脑上，结果开机后就发现一直停在了主板的LOGO上，重启了几次还是那样，正在想怎么回事，大约半分钟终于跳过了LOGO，不过在Windows的启动菜单中又停了半天，好不容易输入了密码结果又卡住了，实在忍不住又重启了电脑试着进Fedora,内核加载的时候也等了好一会儿，后面一切正常。
俺想着这下得去修电脑了!
用手机GOOGLE了下这种情况，看到有人提到开机按TAB看详细情况，于是俺再次重启电脑开机时按TAB，结果发现了下面的字样:
storage DEVICE
这时俺才想起来原来是MP3已经插在了电脑上了，赶快拔掉MP3，机子立刻就跳过了BIOS自检，一切正常了。
真是没想到开机前插了个MP3会有这么大的影响，以前用俺的笔记本事也干过这种事，不过好像没这么大的影响了，郁闷！
]]></description>
			<content:encoded><![CDATA[<p>拷了几本电子书在MP3上，打算回去拷到俺自己的电脑上，结果开机后就发现一直停在了主板的LOGO上，重启了几次还是那样，正在想怎么回事，大约半分钟终于跳过了LOGO，不过在Windows的启动菜单中又停了半天，好不容易输入了密码结果又卡住了，实在忍不住又重启了电脑试着进<a href="http://cocobear.info/blog/tag/fedora/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Fedora">Fedora</a>,内核加载的时候也等了好一会儿，后面一切正常。</p>
<p>俺想着这下得去修电脑了!</p>
<p>用手机GOOGLE了下这种情况，看到有人提到开机按TAB看详细情况，于是俺再次重启电脑开机时按TAB，结果发现了下面的字样:</p>
<p>storage DEVICE</p>
<p>这时俺才想起来原来是MP3已经插在了电脑上了，赶快拔掉MP3，机子立刻就跳过了BIOS自检，一切正常了。</p>
<p>真是没想到开机前插了个MP3会有这么大的影响，以前用俺的笔记本事也干过这种事，不过好像没这么大的影响了，郁闷！</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2008/11/01/stop-at-bios-logo-by-mp3/feed/</wfw:commentRss>
		</item>
		<item>
		<title>今日阅读</title>
		<link>http://cocobear.info/blog/2008/10/24/news-of-today/</link>
		<comments>http://cocobear.info/blog/2008/10/24/news-of-today/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 05:35:09 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
		
		<category><![CDATA[Life]]></category>

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

		<guid isPermaLink="false">http://cocobear.info/blog/?p=318</guid>
		<description><![CDATA[看到一则消息：火车凭什么为日本人临时靠站？
我是看到标题后就想吐了，真的很反胃，我已经忍了很久了，莫再关心这个国家，莫在这里谈这些东西，今天又忍不住了。
中国的经济到底怎么了，本来我是不太关注的，不过google订阅里看到一篇文章，忍不住看完了，这年头能站出来说实话的人太少了:郎咸平: 未来和下一代很悲惨，我都不想讲了
BTW：
加了个在线聊天的JS代码，可以在博客的右下角和我的GTALK聊天，如果我在线的话:-)
]]></description>
			<content:encoded><![CDATA[<p>看到一则消息：<a href="http://www.dapenti.com/blog/more.asp?name=xilei&#038;id=14961">火车凭什么为日本人临时靠站？</a></p>
<p>我是看到标题后就想吐了，真的很反胃，我已经忍了很久了，莫再关心这个国家，莫在这里谈这些东西，今天又忍不住了。</p>
<p>中国的经济到底怎么了，本来我是不太关注的，不过google订阅里看到一篇文章，忍不住看完了，这年头能站出来说实话的人太少了:<a href="http://www.dapenti.com/blog/more.asp?name=xilei&#038;id=14963">郎咸平: 未来和下一代很悲惨，我都不想讲了</a></p>
<p>BTW：<br />
加了个在线聊天的JS代码，可以在博客的右下角和我的GTALK聊天，如果我在线的话:-)</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2008/10/24/news-of-today/feed/</wfw:commentRss>
		</item>
		<item>
		<title>介绍一个WordPress的插件&#8211;Simple Tags</title>
		<link>http://cocobear.info/blog/2008/10/24/wordpress-plugins-simple-tags/</link>
		<comments>http://cocobear.info/blog/2008/10/24/wordpress-plugins-simple-tags/#comments</comments>
		<pubDate>Fri, 24 Oct 2008 01:48:03 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
		
		<category><![CDATA[互联网]]></category>

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

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

		<guid isPermaLink="false">http://cocobear.info/blog/?p=317</guid>
		<description><![CDATA[博客里文章多了以后要找到一篇文章就不太方便了，有时候自己找以前写过的东西还得用google，而且别人看起来也没有清晰的线索。这时候使用Tags就有很大的好处，不过由于以前WordPress写博客的时候还没有Tags，新版本的WordPress才加入了Tags，所以为以前大量没有Tags的文章添加Tags就成为一件极为麻烦的事，今天我手动插了几个就不耐烦了，后来找到一个不错的WordPress插件－－Simple Tags，通过这个插件可以很方便的对Tags进行批量的修改，删除，添加， 还可以为文章自动添加Tags，在你博客内容越来越多的时候这个插件会很大的帮助你。
]]></description>
			<content:encoded><![CDATA[<p>博客里文章多了以后要找到一篇文章就不太方便了，有时候自己找以前写过的东西还得用google，而且别人看起来也没有清晰的线索。这时候使用Tags就有很大的好处，不过由于以前<a href="http://cocobear.info/blog/tag/wordpress/" class="st_tag internal_tag" rel="tag" title="Posts tagged with wordpress">WordPress</a>写博客的时候还没有Tags，新版本的<a href="http://cocobear.info/blog/tag/wordpress/" class="st_tag internal_tag" rel="tag" title="Posts tagged with wordpress">WordPress</a>才加入了Tags，所以为以前大量没有Tags的文章添加Tags就成为一件极为麻烦的事，今天我手动插了几个就不耐烦了，后来找到一个不错的<a href="http://cocobear.info/blog/tag/wordpress/" class="st_tag internal_tag" rel="tag" title="Posts tagged with wordpress">WordPress</a>插件－－<a href="http://www.herewithme.fr/wordpress-plugins/simple-tags">Simple Tags</a>，通过这个插件可以很方便的对Tags进行批量的修改，删除，添加， 还可以为文章自动添加Tags，在你博客内容越来越多的时候这个插件会很大的帮助你。</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2008/10/24/wordpress-plugins-simple-tags/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Fedora 9 通过E680G/I手机实现GPRS上网</title>
		<link>http://cocobear.info/blog/2008/10/16/e680-gprs-linux/</link>
		<comments>http://cocobear.info/blog/2008/10/16/e680-gprs-linux/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 02:43:06 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
		
		<category><![CDATA[Linux]]></category>

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

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

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

		<guid isPermaLink="false">http://cocobear.info/blog/?p=316</guid>
		<description><![CDATA[电脑通过E680G/I手机实现GPRS上网
E680是一款摩托的Linux系统手机，在Windows下可以通过自带的MPT工具包实现与电脑连接的GPRS上网，在Linux下也是比较方便的，以前我也用过，只是没记下来，今天再用的时候还得看别人写的文章，还是自己记一下。
我用的是Fedora 9，一般的Linux系统都应该可以，大同小异。首先是手机端设置连接模式为调制解调器(Modem)，通过数据线连接到电脑后(也可以用蓝牙，我这里没有环境)，Fedora 9会识别到有新的调制解调器：
 发现新硬件: 


BASH:




usb 4-3: new full speed USB device using ohci_hcd and address 2


usb 4-3: configuration #1 chosen from 1 choice


usb 4-3: New USB device found, idVendor=22b8, idProduct=3802


usb 4-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0


usb 4-3: Product: Motorola USB Modem


usb 4-3: Manufacturer: Motorola


cdc_acm 4-3:1.0: ttyACM0: USB ACM device


usbcore: registered new interface driver [...]]]></description>
			<content:encoded><![CDATA[<p><strong>电脑通过E680G/I手机实现<a href="http://cocobear.info/blog/tag/gprs/" class="st_tag internal_tag" rel="tag" title="Posts tagged with GPRS">GPRS</a>上网</strong></p>
<p><a href="http://cocobear.info/blog/tag/e680/" class="st_tag internal_tag" rel="tag" title="Posts tagged with E680">E680</a>是一款摩托的<a href="http://cocobear.info/blog/tag/linux/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Linux">Linux</a>系统手机，在Windows下可以通过自带的MPT工具包实现与电脑连接的<a href="http://cocobear.info/blog/tag/gprs/" class="st_tag internal_tag" rel="tag" title="Posts tagged with GPRS">GPRS</a>上网，在<a href="http://cocobear.info/blog/tag/linux/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Linux">Linux</a>下也是比较方便的，以前我也用过，只是没记下来，今天再用的时候还得看别人写的文章，还是自己记一下。</p>
<p>我用的是<a href="http://cocobear.info/blog/tag/fedora/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Fedora">Fedora</a> 9，一般的<a href="http://cocobear.info/blog/tag/linux/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Linux">Linux</a>系统都应该可以，大同小异。首先是手机端设置连接模式为调制解调器(Modem)，通过数据线连接到电脑后(也可以用蓝牙，我这里没有环境)，<a href="http://cocobear.info/blog/tag/fedora/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Fedora">Fedora</a> 9会识别到有新的调制解调器：</p>
<p><a href="#" onclick="xcollapse('X10973');return false;"> 发现新硬件: </a><br />
</p>
<div id="X10973" style="display: none; border 1px solid=#0000cc; padding: 10px; background-color: transparent;">
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-21">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">usb <span style="color: #ffffff;color:#800000;">4</span>-<span style="color: #ffffff;color:#800000;">3</span>: new full speed USB device using ohci_hcd and address <span style="color: #ffffff;color:#800000;">2</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">usb <span style="color: #ffffff;color:#800000;">4</span>-<span style="color: #ffffff;color:#800000;">3</span>: configuration <span style="color: #999999; font-style: italic;">#1 chosen from 1 choice</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">usb <span style="color: #ffffff;color:#800000;">4</span>-<span style="color: #ffffff;color:#800000;">3</span>: New USB device found, <span style="color: #ff87ff;">idVendor</span>=22b8, <span style="color: #ff87ff;">idProduct</span>=<span style="color: #ffffff;color:#800000;">3802</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">usb <span style="color: #ffffff;color:#800000;">4</span>-<span style="color: #ffffff;color:#800000;">3</span>: New USB device <span style="color: #3df346; font-weight: bold;">strings</span>: <span style="color: #ff87ff;">Mfr</span>=<span style="color: #ffffff;color:#800000;">1</span>, <span style="color: #ff87ff;">Product</span>=<span style="color: #ffffff;color:#800000;">2</span>, <span style="color: #ff87ff;">SerialNumber</span>=<span style="color: #ffffff;color:#800000;">0</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">usb <span style="color: #ffffff;color:#800000;">4</span>-<span style="color: #ffffff;color:#800000;">3</span>: Product: Motorola USB Modem</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">usb <span style="color: #ffffff;color:#800000;">4</span>-<span style="color: #ffffff;color:#800000;">3</span>: Manufacturer: Motorola</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">cdc_acm <span style="color: #ffffff;color:#800000;">4</span>-<span style="color: #ffffff;color:#800000;">3</span>:<span style="color: #ffffff;color:#800000;">1.0</span>: ttyACM0: USB ACM device</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">usbcore: registered new interface driver cdc_acm</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">drivers<span style="color: #ffffff; font-weight: bold;">/</span>usb<span style="color: #ffffff; font-weight: bold;">/</span>class<span style="color: #ffffff; font-weight: bold;">/</span>cdc-acm.<a href="http://cocobear.info/blog/tag/c/" class="st_tag internal_tag" rel="tag" title="Posts tagged with C">c</a>: v0.25:USB Abstract Control Model driver <span style="color: #ffffff; font-weight: bold;">for</span> USB modems and ISDN adapters</div>
</li>
</ol>
</div>
</div>
</div>
<p>
</div>
<p>它对应的设备就是/dev/ttyACM0。接下来用wvdial这个拨号工具，如果没有这个包的话请自行安装，wvdial有一个配置文件/etc/wvdial.conf,(使用root进行下面的操作)编辑这个文件,：</p>
<p><a href="#" onclick="xcollapse('X9261');return false;"> 添加以下内容:</a><br />
</p>
<div id="X9261" style="display: none; border 1px solid=#0000cc; padding: 10px; background-color: transparent;">
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-22">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #85f78b; font-weight: bold;">&#91;</span>Dialer Defaults<span style="color: #85f78b; font-weight: bold;">&#93;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Init1 = at+<span style="color: #ff87ff;">cgdcont</span>=<span style="color: #ffffff;color:#800000;">1</span>,<span style="color: #00ffff;">&quot;ip&quot;</span>,<span style="color: #00ffff;">&quot;cmnet&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Phone = <span style="color: #ffffff; font-weight: bold;">*</span><span style="color: #ffffff;color:#800000;">99</span><span style="color: #ffffff; font-weight: bold;">***</span><span style="color: #ffffff;color:#800000;">1</span><span style="color: #999999; font-style: italic;">#</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Modem = <span style="color: #ffffff; font-weight: bold;">/</span>dev<span style="color: #ffffff; font-weight: bold;">/</span>ttyACM0</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Username = <span style="color: #00ffff;">&quot;cmnet&quot;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Password = <span style="color: #00ffff;">&quot;cmnet&quot;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Carrier Check = no</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Baud = <span style="color: #ffffff;color:#800000;">460800</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Auto DNS = on</div>
</li>
</ol>
</div>
</div>
</div>
<p>
</div>
<p>如果已经有Dialer Defaults这一块则覆盖之。这里要注意使用的是cmnet，最好是手机包月不分cmnet和cmwap那种的，不然收费是很贵的。修改完该文件后还需要对/etc/ppp/options文件进行修改，添加一行：<br />
:192.168.0.254<br />
这个修改比较奇怪，<a href="http://cocobear.info/blog/tag/e680/" class="st_tag internal_tag" rel="tag" title="Posts tagged with E680">E680</a>系列的<a href="http://cocobear.info/blog/tag/linux/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Linux">Linux</a>手机都需要这样:-(，不然用wvdial拨号时会在/var/log/messages中产生下面的错误：</p>
<p><a href="#" onclick="xcollapse('X1923');return false;"> 错误信息：</a><br />
</p>
<div id="X1923" style="display: none; border 1px solid=#0000cc; padding: 10px; background-color: transparent;">
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-23">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Oct <span style="color: #ffffff;color:#800000;">16</span> 09:<span style="color: #ffffff;color:#800000;">56</span>:<span style="color: #ffffff;color:#800000;">25</span> cocobear pppd<span style="color: #85f78b; font-weight: bold;">&#91;</span><span style="color: #ffffff;color:#800000;">18141</span><span style="color: #85f78b; font-weight: bold;">&#93;</span>: pppd 2.4.4 started by root, uid <span style="color: #ffffff;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Oct <span style="color: #ffffff;color:#800000;">16</span> 09:<span style="color: #ffffff;color:#800000;">56</span>:<span style="color: #ffffff;color:#800000;">25</span> cocobear pppd<span style="color: #85f78b; font-weight: bold;">&#91;</span><span style="color: #ffffff;color:#800000;">18141</span><span style="color: #85f78b; font-weight: bold;">&#93;</span>: Using interface ppp0</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Oct <span style="color: #ffffff;color:#800000;">16</span> 09:<span style="color: #ffffff;color:#800000;">56</span>:<span style="color: #ffffff;color:#800000;">25</span> cocobear pppd<span style="color: #85f78b; font-weight: bold;">&#91;</span><span style="color: #ffffff;color:#800000;">18141</span><span style="color: #85f78b; font-weight: bold;">&#93;</span>: Connect: ppp0 <span style="color: #ffffff; font-weight: bold;">&lt;</span>--<span style="color: #ffffff; font-weight: bold;">&gt;</span> <span style="color: #ffffff; font-weight: bold;">/</span>dev<span style="color: #ffffff; font-weight: bold;">/</span>ttyACM0</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Oct <span style="color: #ffffff;color:#800000;">16</span> 09:<span style="color: #ffffff;color:#800000;">56</span>:<span style="color: #ffffff;color:#800000;">36</span> cocobear pppd<span style="color: #85f78b; font-weight: bold;">&#91;</span><span style="color: #ffffff;color:#800000;">18141</span><span style="color: #85f78b; font-weight: bold;">&#93;</span>: Remote message: Welcome to Motorola A760 Software Modem<span style="color: #ffffff; font-weight: bold;">!</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Oct <span style="color: #ffffff;color:#800000;">16</span> 09:<span style="color: #ffffff;color:#800000;">56</span>:<span style="color: #ffffff;color:#800000;">36</span> cocobear pppd<span style="color: #85f78b; font-weight: bold;">&#91;</span><span style="color: #ffffff;color:#800000;">18141</span><span style="color: #85f78b; font-weight: bold;">&#93;</span>: PAP authentication succeeded</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Oct <span style="color: #ffffff;color:#800000;">16</span> 09:<span style="color: #ffffff;color:#800000;">56</span>:<span style="color: #ffffff;color:#800000;">44</span> cocobear pppd<span style="color: #85f78b; font-weight: bold;">&#91;</span><span style="color: #ffffff;color:#800000;">18141</span><span style="color: #85f78b; font-weight: bold;">&#93;</span>: LCP terminated by peer <span style="color: #85f78b; font-weight: bold;">&#40;</span>^<span style="color: #ffffff; font-weight: bold;">@</span>^<span style="color: #ffffff; font-weight: bold;">@</span>^<span style="color: #ffffff; font-weight: bold;">@</span>^<span style="color: #ffffff; font-weight: bold;">@</span>^<span style="color: #ffffff; font-weight: bold;">@</span>^<span style="color: #ffffff; font-weight: bold;">@</span><span style="color: #85f78b; font-weight: bold;">&#41;</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Oct <span style="color: #ffffff;color:#800000;">16</span> 09:<span style="color: #ffffff;color:#800000;">56</span>:<span style="color: #ffffff;color:#800000;">44</span> cocobear pppd<span style="color: #85f78b; font-weight: bold;">&#91;</span><span style="color: #ffffff;color:#800000;">18141</span><span style="color: #85f78b; font-weight: bold;">&#93;</span>: Modem hangup</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Oct <span style="color: #ffffff;color:#800000;">16</span> 09:<span style="color: #ffffff;color:#800000;">56</span>:<span style="color: #ffffff;color:#800000;">44</span> cocobear pppd<span style="color: #85f78b; font-weight: bold;">&#91;</span><span style="color: #ffffff;color:#800000;">18141</span><span style="color: #85f78b; font-weight: bold;">&#93;</span>: Connection terminated.</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">Oct <span style="color: #ffffff;color:#800000;">16</span> 09:<span style="color: #ffffff;color:#800000;">56</span>:<span style="color: #ffffff;color:#800000;">44</span> cocobear pppd<span style="color: #85f78b; font-weight: bold;">&#91;</span><span style="color: #ffffff;color:#800000;">18141</span><span style="color: #85f78b; font-weight: bold;">&#93;</span>: Exit.</div>
</li>
</ol>
</div>
</div>
</div>
<p>
</div>
<p>修改完这个文件后就可以开始拨号了，直接使用wvdial命令:</p>
<p><a href="#" onclick="xcollapse('X771');return false;"> 拨号信息：</a><br />
</p>
<div id="X771" style="display: none; border 1px solid=#0000cc; padding: 10px; background-color: transparent;">
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-24">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #85f78b; font-weight: bold;">&#91;</span>root<span style="color: #ffffff; font-weight: bold;">@</span>cocobear cocobear<span style="color: #85f78b; font-weight: bold;">&#93;</span><span style="color: #999999; font-style: italic;"># vim /etc/wvdial.conf </span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #85f78b; font-weight: bold;">&#91;</span>root<span style="color: #ffffff; font-weight: bold;">@</span>cocobear cocobear<span style="color: #85f78b; font-weight: bold;">&#93;</span><span style="color: #999999; font-style: italic;"># vim /etc/ppp/options </span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #85f78b; font-weight: bold;">&#91;</span>root<span style="color: #ffffff; font-weight: bold;">@</span>cocobear cocobear<span style="color: #85f78b; font-weight: bold;">&#93;</span><span style="color: #999999; font-style: italic;"># wvdial</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> WvDial: Internet dialer version <span style="color: #ffffff;color:#800000;">1.60</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> Cannot get information <span style="color: #ffffff; font-weight: bold;">for</span> serial port.</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> Initializing modem.</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> Sending: at+<span style="color: #ff87ff;">cgdcont</span>=<span style="color: #ffffff;color:#800000;">1</span>,<span style="color: #00ffff;">&quot;ip&quot;</span>,<span style="color: #00ffff;">&quot;cmnet&quot;</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">OK</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> Modem initialized.</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> Sending: ATDT<span style="color: #ffffff; font-weight: bold;">*</span><span style="color: #ffffff;color:#800000;">99</span><span style="color: #ffffff; font-weight: bold;">***</span><span style="color: #ffffff;color:#800000;">1</span><span style="color: #999999; font-style: italic;">#</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> Waiting <span style="color: #ffffff; font-weight: bold;">for</span> carrier.</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">CONNECT</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> Carrier detected. &nbsp;Waiting <span style="color: #ffffff; font-weight: bold;">for</span> prompt.</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">~<span style="color: #85f78b; font-weight: bold;">&#91;</span>7f<span style="color: #85f78b; font-weight: bold;">&#93;</span><span style="color: #85f78b; font-weight: bold;">&#125;</span><span style="color: #999999; font-style: italic;">#@!}!}!} }&lt;}!}$}%\}&quot;}&amp;} } } } }#}$@#}%}&amp;j}?} } }'}&quot;}(}&quot;?}3~</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> PPP negotiation detected.</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> Starting pppd at Thu Oct <span style="color: #ffffff;color:#800000;">16</span> 09:<span style="color: #ffffff;color:#800000;">58</span>:<span style="color: #ffffff;color:#800000;">41</span> <span style="color: #ffffff;color:#800000;">2008</span></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> Pid of pppd: <span style="color: #ffffff;color:#800000;">18959</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> Using interface ppp0</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> <span style="color: #85f78b; font-weight: bold;">local</span> &nbsp;IP address 10.182.237.127</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> remote IP address 192.168.0.254</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> primary &nbsp; DNS address 211.137.130.3</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">--<span style="color: #ffffff; font-weight: bold;">&gt;</span> secondary DNS address 211.137.130.19</div>
</li>
</ol>
</div>
</div>
</div>
<p>
</div>
<p>从上面的信息中可以看出我们成功的拨号上网了，不过这时候我们还需要手动把192.168.0.254添加为默认路由:</p>
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-25">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">route add default gw 192.168.0.254</div>
</li>
</ol>
</div>
</div>
</div>
<p>
ping一个google：</p>
<p><a href="#" onclick="xcollapse('X7787');return false;"> Ping结果：</a><br />
</p>
<div id="X7787" style="display: none; border 1px solid=#0000cc; padding: 10px; background-color: transparent;">
<div class="syntax_hilite"><span class="langName">BASH:</span>
<div id="bash-26">
<div class="bash" style="font-family:monospace;">
<ol>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #85f78b; font-weight: bold;">&#91;</span>cocobear<span style="color: #ffffff; font-weight: bold;">@</span>cocobear ~<span style="color: #85f78b; font-weight: bold;">&#93;</span>$ <span style="color: #3df346; font-weight: bold;">ping</span> www.g.cn</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">PING g.cn <span style="color: #85f78b; font-weight: bold;">&#40;</span>203.208.33.100<span style="color: #85f78b; font-weight: bold;">&#41;</span> <span style="color: #ffffff;color:#800000;">56</span><span style="color: #85f78b; font-weight: bold;">&#40;</span><span style="color: #ffffff;color:#800000;">84</span><span style="color: #85f78b; font-weight: bold;">&#41;</span> bytes of data.</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ffffff;color:#800000;">64</span> bytes from 203.208.33.100: <span style="color: #ff87ff;">icmp_seq</span>=<span style="color: #ffffff;color:#800000;">2</span> <span style="color: #ff87ff;">ttl</span>=<span style="color: #ffffff;color:#800000;">242</span> <span style="color: #ff87ff;"><span style="color: #ffffff; font-weight: bold;">time</span></span>=<span style="color: #ffffff;color:#800000;">709</span> ms</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ffffff;color:#800000;">64</span> bytes from 203.208.33.100: <span style="color: #ff87ff;">icmp_seq</span>=<span style="color: #ffffff;color:#800000;">4</span> <span style="color: #ff87ff;">ttl</span>=<span style="color: #ffffff;color:#800000;">242</span> <span style="color: #ff87ff;"><span style="color: #ffffff; font-weight: bold;">time</span></span>=<span style="color: #ffffff;color:#800000;">1359</span> ms</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ffffff;color:#800000;">64</span> bytes from 203.208.33.100: <span style="color: #ff87ff;">icmp_seq</span>=<span style="color: #ffffff;color:#800000;">5</span> <span style="color: #ff87ff;">ttl</span>=<span style="color: #ffffff;color:#800000;">242</span> <span style="color: #ff87ff;"><span style="color: #ffffff; font-weight: bold;">time</span></span>=<span style="color: #ffffff;color:#800000;">1159</span> ms</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ffffff;color:#800000;">64</span> bytes from 203.208.33.100: <span style="color: #ff87ff;">icmp_seq</span>=<span style="color: #ffffff;color:#800000;">6</span> <span style="color: #ff87ff;">ttl</span>=<span style="color: #ffffff;color:#800000;">242</span> <span style="color: #ff87ff;"><span style="color: #ffffff; font-weight: bold;">time</span></span>=<span style="color: #ffffff;color:#800000;">1021</span> ms</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ffffff;color:#800000;">64</span> bytes from 203.208.33.100: <span style="color: #ff87ff;">icmp_seq</span>=<span style="color: #ffffff;color:#800000;">7</span> <span style="color: #ff87ff;">ttl</span>=<span style="color: #ffffff;color:#800000;">242</span> <span style="color: #ff87ff;"><span style="color: #ffffff; font-weight: bold;">time</span></span>=<span style="color: #ffffff;color:#800000;">617</span> ms</div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">^<a href="http://cocobear.info/blog/tag/c/" class="st_tag internal_tag" rel="tag" title="Posts tagged with C">C</a></div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #99ffcc;">---</span> g.cn <span style="color: #3df346; font-weight: bold;">ping</span> statistics <span style="color: #99ffcc;">---</span></div>
</li>
<li style="font-weight: bold; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;"><span style="color: #ffffff;color:#800000;">8</span> packets transmitted, <span style="color: #ffffff;color:#800000;">5</span> received, <span style="color: #ffffff;color:#800000;">37</span><span style="color: #ffffff; font-weight: bold;">%</span> packet loss, <span style="color: #ffffff; font-weight: bold;">time</span> 13411ms</div>
</li>
<li style="font-weight: normal; vertical-align:top;color:#3A6A8B;">
<div style="font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;">rtt min<span style="color: #ffffff; font-weight: bold;">/</span>avg<span style="color: #ffffff; font-weight: bold;">/</span>max<span style="color: #ffffff; font-weight: bold;">/</span>mdev = <span style="color: #ffffff;color:#800000;">617.708</span><span style="color: #ffffff; font-weight: bold;">/</span><span style="color: #ffffff;color:#800000;">973.500</span><span style="color: #ffffff; font-weight: bold;">/</span><span style="color: #ffffff;color:#800000;">1359.063</span><span style="color: #ffffff; font-weight: bold;">/</span><span style="color: #ffffff;color:#800000;">276.410</span> ms, pipe <span style="color: #ffffff;color:#800000;">2</span></div>
</li>
</ol>
</div>
</div>
</div>
<p>
</div>
<p>好大的延时，还有丢包，没办法了中国移动的<a href="http://cocobear.info/blog/tag/gprs/" class="st_tag internal_tag" rel="tag" title="Posts tagged with GPRS">GPRS</a>就这样了，EDGE在西安只有部分地区覆盖了，而且<a href="http://cocobear.info/blog/tag/e680/" class="st_tag internal_tag" rel="tag" title="Posts tagged with E680">E680</a>手机是不支持的！</p>
<p>终于上来了，搬到新租的房子后还没拉网线，只能先这样了。</p>
<p>羡慕王聪同学的3G上网啊＠_＠</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2008/10/16/e680-gprs-linux/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
