<?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>可可熊的窝</title>
	<atom:link href="http://cocobear.info/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://cocobear.info/blog</link>
	<description>K.I.S.S</description>
	<lastBuildDate>Sun, 31 Jan 2010 14:47:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>推荐一段视频：《网瘾战争》</title>
		<link>http://cocobear.info/blog/2010/01/31/war-of-internet-addiction/</link>
		<comments>http://cocobear.info/blog/2010/01/31/war-of-internet-addiction/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 14:44:24 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=778</guid>
		<description><![CDATA[推荐一段视频：《网瘾战争》
我要说的剧本里面已经说出来了
我们不敢说话，就算我们说了，也会被无视或断章取义。我们曾经和你一样天真，以为这里处处是花园，以为光凭努力就能触及到理想。但抬头仰望金字塔顶的 服务者们，手捧着被赐予的“幸福感”退缩到全世界最自由的无路由网，靠低廉的成本互相沟通，靠游戏来缓解生活的痛苦。仅仅这样，他们为了利益，仍然雁过拔 毛般的想尽办法，我们已经习惯了沉默……但这沉默并不代表奴颜卑膝，这钟声会传给你我们的力量，今天他们能为剥削一个游戏而不择手段……
很庆幸我们还能通过&#8221;正常的&#8221;的途径看到这样的视频，也许你能做到的也仅仅是和更多的人去分享这段视频，让2009年更清晰的刻在历史的车轮上。
电驴地址:
ed2k://&#124;file&#124;%5B%E7%88%B1%E8%80%81%E8%99%8E%E6%B8%B8%E5%88%9B%E4%BD%9C%E5%9B%A2%E9%98%9F%5D%5B%E7%AC%AC3%E4%BD%9C.%E7%BD%91%E7%98%BE%E6%88%98%E4%BA%89%5D%5BGB%5D%5B1024&#215;768.x264.AAC%5D.mp4&#124;784774019&#124;67f298ca261d14367195c922ba49ce66&#124;h=qnckiy5nfnw4qqckc2jtzvi6awhvbnho&#124;
土豆在线:http://www.tudou.com/programs/view/rhxNFUxCzF4/
也许你会想看看关于视频更多的内容:http://docs.google.com/View?docID=0AWO369Kx_1-7ZGMyM2txcnhfMjhjcjM0eHJjbQ&#038;hl=en&#038;pli=1
]]></description>
			<content:encoded><![CDATA[<p>推荐一段视频：《网瘾战争》</p>
<p>我要说的剧本里面已经说出来了</p>
<blockquote><p><strong>我们不敢说话，就算我们说了，也会被无视或断章取义。我们曾经和你一样天真，以为这里处处是花园，以为光凭努力就能触及到理想。但抬头仰望金字塔顶的 服务者们，手捧着被赐予的“幸福感”退缩到全世界最自由的无路由网，靠低廉的成本互相沟通，靠游戏来缓解生活的痛苦。仅仅这样，他们为了利益，仍然雁过拔 毛般的想尽办法，我们已经习惯了沉默……但这沉默并不代表奴颜卑膝，这钟声会传给你我们的力量，今天他们能为剥削一个游戏而不择手段……</strong></p></blockquote>
<p>很庆幸我们还能通过&#8221;正常的&#8221;的途径看到这样的视频，也许你能做到的也仅仅是和更多的人去分享这段视频，让2009年更清晰的刻在历史的车轮上。</p>
<p>电驴地址:</p>
<p><a href="ed2k://|file|%5B%E7%88%B1%E8%80%81%E8%99%8E%E6%B8%B8%E5%88%9B%E4%BD%9C%E5%9B%A2%E9%98%9F%5D%5B%E7%AC%AC3%E4%BD%9C.%E7%BD%91%E7%98%BE%E6%88%98%E4%BA%89%5D%5BGB%5D%5B1024x768.x264.AAC%5D.mp4|784774019|67f298ca261d14367195c922ba49ce66|h=qnckiy5nfnw4qqckc2jtzvi6awhvbnho|">ed2k://|file|%5B%E7%88%B1%E8%80%81%E8%99%8E%E6%B8%B8%E5%88%9B%E4%BD%9C%E5%9B%A2%E9%98%9F%5D%5B%E7%AC%AC3%E4%BD%9C.%E7%BD%91%E7%98%BE%E6%88%98%E4%BA%89%5D%5BGB%5D%5B1024&#215;768.x264.AAC%5D.mp4|784774019|67f298ca261d14367195c922ba49ce66|h=qnckiy5nfnw4qqckc2jtzvi6awhvbnho|</a></p>
<p>土豆在线:<a href="http://www.tudou.com/programs/view/rhxNFUxCzF4/">http://www.tudou.com/programs/view/rhxNFUxCzF4/</a></p>
<p>也许你会想看看关于视频更多的内容:<a href="http://docs.google.com/View?docID=0AWO369Kx_1-7ZGMyM2txcnhfMjhjcjM0eHJjbQ&#038;hl=en&#038;pli=1">http://docs.google.com/View?docID=0AWO369Kx_1-7ZGMyM2txcnhfMjhjcjM0eHJjbQ&#038;hl=en&#038;pli=1</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2010/01/31/war-of-internet-addiction/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>给草儿同学写了个查询系统</title>
		<link>http://cocobear.info/blog/2010/01/13/write-web-query-system/</link>
		<comments>http://cocobear.info/blog/2010/01/13/write-web-query-system/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 09:07:20 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[Js]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=775</guid>
		<description><![CDATA[主要实现查询、添加、修改、删除、导入功能;
可以对Excel文件导出的csv文件直接导入，使用ajax使操作简单化。
用到的技术关键词
PHP MySQL Ajax JavaScript Jquery Vim
共计一个文件600行代码
]]></description>
			<content:encoded><![CDATA[<p>主要实现查询、添加、修改、删除、导入功能;<br />
可以对Excel文件导出的csv文件直接导入，使用ajax使操作简单化。</p>
<p>用到的技术关键词<br />
<a href="http://cocobear.info/blog/tag/php/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PHP">PHP</a> MySQL Ajax JavaScript <a href="http://cocobear.info/blog/tag/jquery/" class="st_tag internal_tag" rel="tag" title="Posts tagged with jquery">Jquery</a> Vim</p>
<p>共计一个文件600行代码</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2010/01/13/write-web-query-system/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>更新百度搜藏导出工具</title>
		<link>http://cocobear.info/blog/2009/12/15/update-cang2html/</link>
		<comments>http://cocobear.info/blog/2009/12/15/update-cang2html/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 14:35:26 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[PyFetion]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/2009/12/15/%e6%9b%b4%e6%96%b0%e7%99%be%e5%ba%a6%e6%90%9c%e8%97%8f%e5%af%bc%e5%87%ba%e5%b7%a5%e5%85%b7/</guid>
		<description><![CDATA[可以支持分类(或者叫标签)的导出了。
PyFetion在google code页面加了一个下载连接，方便没有svn时直接下载代码;使用的是r49的版本
这似乎是一篇微博&#8230;
]]></description>
			<content:encoded><![CDATA[<p>可以支持分类(或者叫标签)的导出了。<br />
PyFetion在google code页面加了一个下载连接，方便没有svn时直接下载代码;使用的是r49的版本</p>
<p>这似乎是一篇微博&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2009/12/15/update-cang2html/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>GAE上使用PyFetion做一个应用</title>
		<link>http://cocobear.info/blog/2009/12/15/app-use-pyfetion-on-gae/</link>
		<comments>http://cocobear.info/blog/2009/12/15/app-use-pyfetion-on-gae/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 06:22:14 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[gae]]></category>
		<category><![CDATA[PyFetion]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=759</guid>
		<description><![CDATA[GAE上有一个cron jobs的功能，类似于Linux下的crontab，可以实现在指定规则的时间里去运行程序。利用这个功能和飞信的短信功能就完成一些简单的小应用，比如天气预报，服务器监控，股票大盘实时行情提醒等等。
拿服务器监控来说，我们先注册一个GAE账户，然后创建一个Application，下载一份GAE 的SDK，接下来就写代码了。
(以上过程请自行google之)
monitor.py:
PYTHON:




#!/usr/bin/env python


# -*- coding: utf-8 -*-


#MIT License


#By : cocobear.cn@gmail.com


#


&#160;


from google.appengine.api import urlfetch


from PyFetion import *


&#160;


def get&#40;&#41;:


&#160; &#160; print&#40;'&#60;html&#62;&#60;body&#62;'&#41;


&#160; &#160; url = 'http://61.236.244.162'


&#160; &#160; result = urlfetch.fetch&#40;url&#41;


&#160; &#160; if result.status_code == 200:


&#160; &#160; &#160; &#160; print&#40;'OK'&#41;


&#160; &#160; else:


&#160; &#160; &#160; &#160; fetion = PyFetion&#40;'136xxxx','123456','HTTP'&#41;


&#160; &#160; &#160; &#160; i = 0


&#160; &#160; &#160; &#160; while [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cocobear.info/blog/tag/gae/" class="st_tag internal_tag" rel="tag" title="Posts tagged with gae">GAE</a>上有一个cron jobs的功能，类似于Linux下的crontab，可以实现在指定规则的时间里去运行程序。利用这个功能和飞信的短信功能就完成一些简单的小应用，比如天气预报，服务器监控，股票大盘实时行情提醒等等。</p>
<p>拿服务器监控来说，我们先注册一个<a href="http://cocobear.info/blog/tag/gae/" class="st_tag internal_tag" rel="tag" title="Posts tagged with gae">GAE</a>账户，然后创建一个Application，下载一份<a href="http://cocobear.info/blog/tag/gae/" class="st_tag internal_tag" rel="tag" title="Posts tagged with gae">GAE</a> 的SDK，接下来就写代码了。<br />
(以上过程请自行google之)</p>
<p>monitor.py:</p>
<div class="syntax_hilite"><span class="langName"><a href="http://cocobear.info/blog/tag/python/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Python">PYTHON</a>:</span>
<div id="python-6">
<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: #7f7f7f; font-style: italic;">#!/usr/bin/env <a href="http://cocobear.info/blog/tag/python/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Python">python</a></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: #7f7f7f; font-style: italic;"># -*- coding: utf-8 -*-</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: #7f7f7f; font-style: italic;">#MIT License</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: #7f7f7f; font-style: italic;">#By : cocobear.cn@gmail.com</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: #7f7f7f; 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;">&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;"><span style="color: #0088ff;font-weight:bold;">from</span> google.<span style="color: white;">appengine</span>.<span style="color: white;">api</span> <span style="color: #0088ff;font-weight:bold;">import</span> urlfetch</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;">from</span> PyFetion <span style="color: #0088ff;font-weight:bold;">import</span> <span style="color: #993399;">*</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: #0088ff;font-weight:bold;">def</span> get<span style="color: white;">&#40;</span><span style="color: white;">&#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;">print</span><span style="color: white;">&#40;</span><span style="color: #b7c274;">'&lt;html&gt;&lt;body&gt;'</span><span style="color: white;">&#41;</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; url = <span style="color: #b7c274;">'http://61.236.244.162'</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; result = urlfetch.<span style="color: white;">fetch</span><span style="color: white;">&#40;</span>url<span style="color: white;">&#41;</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: #0088ff;font-weight:bold;">if</span> result.<span style="color: white;">status_code</span> == <span style="color: #00baff;color:#800000;">200</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: #0088ff;font-weight:bold;">print</span><span style="color: white;">&#40;</span><span style="color: #b7c274;">'OK'</span><span style="color: white;">&#41;</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: #0088ff;font-weight:bold;">else</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; fetion = PyFetion<span style="color: white;">&#40;</span><span style="color: #b7c274;">'136xxxx'</span>,<span style="color: #b7c274;">'123456'</span>,<span style="color: #b7c274;">'HTTP'</span><span style="color: white;">&#41;</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; i = <span style="color: #00baff;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;">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0088ff;font-weight:bold;">while</span> <span style="color: #ff7fff;">True</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: #0088ff;font-weight:bold;">try</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; fetion.<span style="color: white;">login</span><span style="color: white;">&#40;</span>FetionOnline<span style="color: white;">&#41;</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; &nbsp; &nbsp; fetion.<span style="color: white;">send_sms</span><span style="color: white;">&#40;</span><span style="color: #b7c274;">'服务器掉了!'</span><span style="color: white;">&#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; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fetion.<span style="color: white;">logout</span><span style="color: white;">&#40;</span><span style="color: white;">&#41;</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: #0088ff;font-weight:bold;">except</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; <span style="color: #0088ff;font-weight:bold;">if</span> i<span style="color: #993399;">&gt;</span> <span style="color: #00baff;color:#800000;">5</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; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0088ff;font-weight:bold;">break</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; <span style="color: #0088ff;font-weight:bold;">continue</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: #0088ff;font-weight:bold;">print</span><span style="color: white;">&#40;</span><span style="color: #b7c274;">'&lt;/body&gt;&lt;/html&gt;'</span><span style="color: white;">&#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;</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;">if</span> __name__ == <span style="color: #b7c274;">'__main__'</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; get<span style="color: white;">&#40;</span><span style="color: white;">&#41;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>很简单的代码，使用<a href="http://cocobear.info/blog/tag/gae/" class="st_tag internal_tag" rel="tag" title="Posts tagged with gae">GAE</a>的函数urlfetch.fetch来访问这个地址，如果失败调用PyFetion来发短信给自己做通知。</p>
<p>app.yaml:</p>
<div class="syntax_hilite"><span class="langName"><a href="http://cocobear.info/blog/tag/python/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Python">PYTHON</a>:</span>
<div id="python-7">
<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;">application: pythoning</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;">version: <span style="color: #00baff;color:#800000;">1</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;">runtime: <a href="http://cocobear.info/blog/tag/python/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Python">python</a></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;">api_version: <span style="color: #00baff;color:#800000;">1</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;">handlers:</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;">- url: /console/.<span style="color: #993399;">*</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; script: $PYTHON_LIB/google/appengine/ext/admin</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; login: admin</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;">- url: /monitor</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; script: monitor.<span style="color: white;">py</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;">- url: /</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; static_files: index.<span style="color: white;">html</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; upload: index.<span style="color: white;">html</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>这里指定url映射的规则，访问pythoning.appspot.com/monitor就会执行monitor.py脚本。application需要填写你申请<a href="http://cocobear.info/blog/tag/gae/" class="st_tag internal_tag" rel="tag" title="Posts tagged with gae">GAE</a>应用时的名称，也就是这个二级域名pythoning，version：当前代码的版本。</p>
<p>index.html:</p>
<div class="syntax_hilite"><span class="langName"><a href="http://cocobear.info/blog/tag/python/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Python">PYTHON</a>:</span>
<div id="python-8">
<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;">首页你可以做别的事，比如放个人主页，然后把自己域名指过来。</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>cron.yaml:</p>
<div class="syntax_hilite"><span class="langName"><a href="http://cocobear.info/blog/tag/python/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Python">PYTHON</a>:</span>
<div id="python-9">
<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;">cron:</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;">- description: watch http server </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; url: /monitor</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; schedule: every <span style="color: #00baff;color:#800000;">1</span> minutes</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; timezone: Asia/Shanghai</div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>关键的一个文件，对monitor这个url进行定时执行，这里是每分钟执行一次; 如果你是写天气预报，就可以写为 7:00 every day，每天早上7点发一次天气预报。</p>
<p>写完这些以后，运行命令:<br />
ls demos/test<br />
app.yaml cron.yaml index.html monitor.py PyFetion.py<br />
<a href="http://cocobear.info/blog/tag/python/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Python">python</a> appcfg.py update demos/test<br />
把你的代码提交到<a href="http://cocobear.info/blog/tag/gae/" class="st_tag internal_tag" rel="tag" title="Posts tagged with gae">GAE</a>服务器上，你可以在<a href="http://cocobear.info/blog/tag/gae/" class="st_tag internal_tag" rel="tag" title="Posts tagged with gae">GAE</a>的后台Cron Jobs看到：</p>
<blockquote><p>/monitor<br />
watch http server	 every 1 minutes (Asia/Shanghai)<br />
2009/12/15 14:06:50 on time Success
</p></blockquote>
<p>在<a href="http://cocobear.info/blog/tag/gae/" class="st_tag internal_tag" rel="tag" title="Posts tagged with gae">GAE</a>上使用r49版本的PyFetion，请注释掉from select import select,如果只是像上面做提醒的话最后去掉下面的代码(824行):</p>
<div class="syntax_hilite"><span class="langName"><a href="http://cocobear.info/blog/tag/python/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Python">PYTHON</a>:</span>
<div id="python-10">
<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;">self</span>.<span style="color: white;">get_personal_info</span><span style="color: white;">&#40;</span><span style="color: white;">&#41;</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;">if</span> <span style="color: #0088ff;font-weight:bold;">not</span> <span style="color: #ff7fff;">self</span>.<span style="color: white;">get_contactlist</span><span style="color: white;">&#40;</span><span style="color: white;">&#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; d_print<span style="color: white;">&#40;</span><span style="color: #b7c274;">&quot;get contactlist error&quot;</span><span style="color: white;">&#41;</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: #0088ff;font-weight:bold;">return</span> <span style="color: #ff7fff;">False</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: #ff7fff;">self</span>.<span style="color: white;">get</span><span style="color: white;">&#40;</span><span style="color: #b7c274;">&quot;compactlist&quot;</span>,<span style="color: #ff7fff;">self</span>.__uri,<span style="color: #ff7fff;">self</span>.<span style="color: white;">contactlist</span>.<span style="color: white;">keys</span><span style="color: white;">&#40;</span><span style="color: white;">&#41;</span><span style="color: white;">&#41;</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;">response = <span style="color: #ff7fff;">self</span>.<span style="color: white;">send</span><span style="color: white;">&#40;</span><span style="color: white;">&#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: #23ebc3;">code</span> = <span style="color: #ff7fff;">self</span>.<span style="color: white;">get_code</span><span style="color: white;">&#40;</span>response<span style="color: white;">&#41;</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;">if</span> <span style="color: #23ebc3;">code</span> <span style="color: #993399;">!</span>= <span style="color: #00baff;color:#800000;">200</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;">return</span> <span style="color: #ff7fff;">False</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: #7f7f7f; font-style: italic;">#self.get(&quot;PGGetGroupList&quot;,self.__uri)</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: #7f7f7f; font-style: italic;">#response = self.send()</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;"><span style="color: #ff7fff;">self</span>.<span style="color: white;">get_offline_msg</span><span style="color: white;">&#40;</span><span style="color: white;">&#41;</span></div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>这里是获得了好友列表，然后给这些好友发一个上线的通知，如果你不想每次提醒的时飞信上的好友都看到你上线，那么就去掉这些，也会加快发送短信的速度。更进一步的优化，你可以去掉TCP通信的相关代码。</p>
<p>ok, 发挥你的想象力，play with <a href="http://cocobear.info/blog/tag/gae/" class="st_tag internal_tag" rel="tag" title="Posts tagged with gae">GAE</a> and PyFetion</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2009/12/15/app-use-pyfetion-on-gae/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>关闭留言板</title>
		<link>http://cocobear.info/blog/2009/12/13/close-guestbook/</link>
		<comments>http://cocobear.info/blog/2009/12/13/close-guestbook/#comments</comments>
		<pubDate>Sun, 13 Dec 2009 14:39:21 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[pythunder]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=755</guid>
		<description><![CDATA[先要对在我的那个留言板里留言的几位朋友说声：“对不起”，好久都没注意到自己还有个留言板，所以上面的留言一直没有回复，今天都回复了一下，虽然有几个月前的留言，但我还是回复了。
这个留言板也没多大用处，所以就关了它。
这个网站也就剩下博客了，或许我应该把博客也搬走，比如换到GAE上面，这样就全面把自己交给google了，呵呵。
pythunder现在可以在google code里下载了，需要另一个aes.py文件支持。
]]></description>
			<content:encoded><![CDATA[<p>先要对在我的那个留言板里留言的几位朋友说声：“对不起”，好久都没注意到自己还有个留言板，所以上面的留言一直没有回复，今天都回复了一下，虽然有几个月前的留言，但我还是回复了。</p>
<p>这个留言板也没多大用处，所以就关了它。</p>
<p>这个网站也就剩下博客了，或许我应该把博客也搬走，比如换到GAE上面，这样就全面把自己交给google了，呵呵。</p>
<p><a href="http://cocobear.info/blog/tag/pythunder/" class="st_tag internal_tag" rel="tag" title="Posts tagged with pythunder">pythunder</a>现在可以在<a href="http://code.google.com/p/pytool/">google code</a>里下载了，需要另一个aes.py文件支持。</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2009/12/13/close-guestbook/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>PyFetion 0.2 发布</title>
		<link>http://cocobear.info/blog/2009/12/12/pyfetion-02-release/</link>
		<comments>http://cocobear.info/blog/2009/12/12/pyfetion-02-release/#comments</comments>
		<pubDate>Sat, 12 Dec 2009 12:14:05 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[Life]]></category>
		<category><![CDATA[PyFetion]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=743</guid>
		<description><![CDATA[PyFetion 0.2版本发布，协议根据移动09.11.04的飞信版本：Fetion2008 3.5.2(安全加强版) 
http://code.google.com/p/pytool/
更新内容包含：

增加查看飞信好友是否隐身功能
增加登录时状态的选择[隐身 在线 忙碌 离开]
日志改用Python的logging模块
增加对好友状态改变的处理( 如上线等)
重写TCP方式中的底层通信函数
使用对列保存接收到的多余消息( 例如发短信时本来应该返回200 OK 却先来了个BN通知消息，以前这样会出错，现在底层会把BN消息放在队列中，返回200 OK)
修改了一些异常处理方式
增加登出，删除好友函数
改写get_contactlist函数，使用一个dict保存当前的好友列表
增加一个receive函数 做客户端的时候可以在一个线程中主调用该函数，所有的消息都会yield出来(请参考fetion.py)
修正向PC发送消息的命令，飞信新增加了一个CatMsg的命令
增加接收从最新版本PC端发送的消息功能;这个比较麻烦新版本飞信对每一个新会话使用fork出一个线程的方式;
        John先给服务器说我要开个新会话，服务应答一个消息说，你去这个IP吧，带着这个密钥
        于是John就连到了这个IP，并使用这个密钥登录，接着发一个包含Bob的uri的邀请命令;
        服务器把这个通知(包含IP 密钥和邀请者John的uri)给Bob，Bob收到服务器的通知后也用同样的密钥登录该IP
        这时John收到Bob进入会话的消息，他就开始正式发消息了
许多清理了修正
调整类的结构
改用MIT License
增加了一个CLI的飞信客户端 跨平台支持
Fedora8 Python2.5.1测试;Windowx XP Python2.6.4测试;Win7 Python2.6.2测试;Mac 10.5.7 Python2.5.1
我忘记在这里列出来的

./fetion.py
------------------------基于PyFetion的一个CLI飞信客户端-------------------------
  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cocobear.info/blog/tag/pyfetion/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PyFetion">PyFetion</a> 0.2版本发布，协议根据移动09.11.04的飞信版本：Fetion2008 3.5.2(安全加强版) </p>
<p><a href="http://code.google.com/p/pytool/">http://code.google.com/p/pytool/</a><br />
更新内容包含：</p>
<ol>
<li>增加查看飞信好友是否隐身功能</li>
<li>增加登录时状态的选择[隐身 在线 忙碌 离开]</li>
<li>日志改用<a href="http://cocobear.info/blog/tag/python/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Python">Python</a>的logging模块</li>
<li>增加对好友状态改变的处理( 如上线等)</li>
<li>重写TCP方式中的底层通信函数</li>
<li>使用对列保存接收到的多余消息( 例如发短信时本来应该返回200 OK 却先来了个BN通知消息，以前这样会出错，现在底层会把BN消息放在队列中，返回200 OK)</li>
<li>修改了一些异常处理方式</li>
<li>增加登出，删除好友函数</li>
<li>改写get_contactlist函数，使用一个dict保存当前的好友列表</li>
<li>增加一个receive函数 做客户端的时候可以在一个线程中主调用该函数，所有的消息都会yield出来(请参考fetion.py)</li>
<li>修正向PC发送消息的命令，飞信新增加了一个CatMsg的命令</li>
<li>增加接收从最新版本PC端发送的消息功能;这个比较麻烦新版本飞信对每一个新会话使用fork出一个线程的方式;</li>
<p>        John先给服务器说我要开个新会话，服务应答一个消息说，你去这个IP吧，带着这个密钥<br />
        于是John就连到了这个IP，并使用这个密钥登录，接着发一个包含Bob的uri的邀请命令;<br />
        服务器把这个通知(包含IP 密钥和邀请者John的uri)给Bob，Bob收到服务器的通知后也用同样的密钥登录该IP<br />
        这时John收到Bob进入会话的消息，他就开始正式发消息了</p>
<li>许多清理了修正</li>
<li>调整类的结构</li>
<li>改用MIT License</li>
<li>增加了一个CLI的飞信客户端 跨平台支持</li>
<li>Fedora8 Python2.5.1测试;Windowx XP Python2.6.4测试;Win7 Python2.6.2测试;<a href="http://cocobear.info/blog/tag/mac/" class="st_tag internal_tag" rel="tag" title="Posts tagged with MAC">Mac</a> 10.5.7 Python2.5.1</li>
<li>我忘记在这里列出来的</li>
</ol>
<p>./fetion.py<br />
------------------------基于<a href="http://cocobear.info/blog/tag/pyfetion/" class="st_tag internal_tag" rel="tag" title="Posts tagged with PyFetion">PyFetion</a>的一个CLI飞信客户端-------------------------</p>
<p>        命令不区分大小写中括号里为命令的缩写</p>
<p>        help[?]            显示本帮助信息<br />
        ls[l]                列出好友列表<br />
        status[st]        改变飞信状态 参数[0隐身 1离开 2忙碌 3在线]<br />
                             参数为空显示自己的状态<br />
        msg[m]           发送消息 参数为序号或手机号 使用quit退出<br />
        sms[s]            发送短信 参数为序号或手机号 使用quit退出<br />
                             参数为空给自己发短信<br />
        find[f]            查看好友是否隐身 参数为序号或手机号<br />
        add[a]           添加好友 参数为手机号或飞信号<br />
        del[d]            删除好友 参数为手机号或飞信号<br />
        cls[c]            清屏<br />
        quit[q]           退出对话状态<br />
        exit[x]           退出飞信</p>
<p>fetion.py特色:</p>
<ol>
<li>多线程支持，同时收发消息</li>
<li>添加，删除，好友，判断好友是否隐身功能</li>
<li>占用资源少，我正写这博客的时候官方的飞信占我96.8M的内存</li>
<li>跨平台支持</li>
<li>扩展性好，加两行代码就可以实现从手机发命令关机等功能</li>
<li>其它我没发现的</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2009/12/12/pyfetion-02-release/feed/</wfw:commentRss>
		<slash:comments>46</slash:comments>
		</item>
		<item>
		<title>手动生成X509证书</title>
		<link>http://cocobear.info/blog/2009/10/19/make-x509-cert/</link>
		<comments>http://cocobear.info/blog/2009/10/19/make-x509-cert/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 03:24:04 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[编程相关]]></category>
		<category><![CDATA[x509]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=737</guid>
		<description><![CDATA[X509证书的详细描述在rfc2459中。
简单的来说X509证书是这样的：

   Certificate  ::=  SEQUENCE  {
        tbsCertificate       TBSCertificate,
        signatureAlgorithm   AlgorithmIdentifier,
        signatureValue       BIT STRING  }
  [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://cocobear.info/blog/tag/x509/" class="st_tag internal_tag" rel="tag" title="Posts tagged with x509">X509</a>证书的详细描述在<a href="http://www.ietf.org/rfc/rfc2459.txt">rfc2459</a>中。</p>
<p>简单的来说<a href="http://cocobear.info/blog/tag/x509/" class="st_tag internal_tag" rel="tag" title="Posts tagged with x509">X509</a>证书是这样的：</p>
<blockquote><p>
   Certificate  ::=  SEQUENCE  {<br />
        tbsCertificate       TBSCertificate,<br />
        signatureAlgorithm   AlgorithmIdentifier,<br />
        signatureValue       BIT STRING  }</p>
<p>   TBSCertificate  ::=  SEQUENCE  {<br />
        version         [0]  EXPLICIT Version DEFAULT v1,<br />
        serialNumber         CertificateSerialNumber,<br />
        signature            AlgorithmIdentifier,<br />
        issuer               Name,<br />
        validity             Validity,<br />
        subject              Name,<br />
        subjectPublicKeyInfo SubjectPublicKeyInfo,<br />
        issuerUniqueID  [1]  IMPLICIT UniqueIdentifier OPTIONAL,<br />
                             -- If present, version shall be v2 or v3<br />
        subjectUniqueID [2]  IMPLICIT UniqueIdentifier OPTIONAL,<br />
                             -- If present, version shall be v2 or v3<br />
        extensions      [3]  EXPLICIT Extensions OPTIONAL<br />
                             -- If present, version shall be v3<br />
        }</p></blockquote>
<p><a href="http://cocobear.info/blog/tag/x509/" class="st_tag internal_tag" rel="tag" title="Posts tagged with x509">X509</a>由三部分组成，分别是TBSCertificate，AlgorithmIdentifier ，signatureValue 。TBSCertificate包含了证书的详细信息，如证书编号，颁发者，发行者，过期日期等;AlgorithmIdentifier 是指证书自身使用数字签名算法标识，TBSCertificate中也有一个AlgorithmIdentifier，这个是证书可以用作的数字签名算法标识;signatureValue是指使用AlgorithmIdentifier 所指定的算法对整个TBSCertificate签名得到的数字签名。</p>
<p>可以使用openssl命令行工具生成<a href="http://cocobear.info/blog/tag/x509/" class="st_tag internal_tag" rel="tag" title="Posts tagged with x509">X509</a>证书，不过需要用openssl先生成一对RSA密钥对，如果只有公钥需要生产证书，就需要自己通过编程调用openssl函数来生成证书了。openssl自带的例子中有一个生成证书的例子，不过也是先生成一对RSA密钥对。</p>
<p>通过对openssl源代码的分析，可以X509_set_pubkey函数只是用到了RSA结构中的公钥，所以我们可以通过自己创建一个openssl的RSA结构，只设置RSA密钥对中的公钥，来完成证书的生成。</p>
<p><a href="http://code.google.com/p/cocobear/source/browse/trunk/openssl/mkcert.cpp">参考代码</a></p>
<p>该函数入口参数是一个证书的主题名，和128字节的公钥（1024位;RSA中的modulus INTEGER----n），返回一个证书ID，和DER编码的证书，默认使用的publicExponent INTEGER, -- e为65535。</p>
<p>参考：<br />
<a href="http://www.ietf.org/rfc/rfc2459.txt">RFC2459</a><br />
<a href="http://www.rsa.com/rsalabs/node.asp?id=2125">PKCS#1</a><br />
<a href="www.openssl.org/">openssl</a></p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2009/10/19/make-x509-cert/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>在T400上装了MAC</title>
		<link>http://cocobear.info/blog/2009/09/27/install-mac-on-t400/</link>
		<comments>http://cocobear.info/blog/2009/09/27/install-mac-on-t400/#comments</comments>
		<pubDate>Sun, 27 Sep 2009 14:57:20 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[MAC]]></category>
		<category><![CDATA[t400]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=734</guid>
		<description><![CDATA[机器型号:T400-2767CTO
MAC版本:ideneb 1.5.1 mac 10.5.7
使用硬盘安装助手+变色龙(ddmac)从硬盘安装[相关的文章可以G之]
在选择安装包的时候需要注意:
    声卡驱动:选择VoodooHDA
    网卡驱动:选择Intel82566
    芯片驱动:INTEL ICH
    电源驱动:VoodooBattery
独立显卡驱动目前似乎没有;无线网卡也不行
输入法使用FIT
感觉还不错,最好使用硬盘安装,而不是刻碟,我刻碟装时速度慢死了.
]]></description>
			<content:encoded><![CDATA[<p>机器型号:<a href="http://cocobear.info/blog/tag/t400/" class="st_tag internal_tag" rel="tag" title="Posts tagged with t400">T400</a>-2767CTO</p>
<p><a href="http://cocobear.info/blog/tag/mac/" class="st_tag internal_tag" rel="tag" title="Posts tagged with MAC">MAC</a>版本:ideneb 1.5.1 <a href="http://cocobear.info/blog/tag/mac/" class="st_tag internal_tag" rel="tag" title="Posts tagged with MAC">mac</a> 10.5.7</p>
<p>使用硬盘安装助手+变色龙(ddmac)从硬盘安装[相关的文章可以G之]</p>
<p>在选择安装包的时候需要注意:<br />
    声卡驱动:选择VoodooHDA<br />
    网卡驱动:选择Intel82566<br />
    芯片驱动:INTEL ICH<br />
    电源驱动:VoodooBattery</p>
<p>独立显卡驱动目前似乎没有;无线网卡也不行<br />
输入法使用FIT</p>
<p>感觉还不错,最好使用硬盘安装,而不是刻碟,我刻碟装时速度慢死了.</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2009/09/27/install-mac-on-t400/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>网页前端编程</title>
		<link>http://cocobear.info/blog/2009/08/25/web-front-dev/</link>
		<comments>http://cocobear.info/blog/2009/08/25/web-front-dev/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 08:23:17 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[Not Language]]></category>
		<category><![CDATA[Js]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=730</guid>
		<description><![CDATA[IE6竟然不能连接向同一个网页发请求[做个按钮使用ajax请求一个网址 你们在服务器上发现 其实IE6只发了一次 但是ajax返回确是成功的]
IE7对iframe标签的支持竟然有问题-->http://zhengrenchi.blogbus.com/logs/23056446.html
IE6与IE6 div标签的默认值不一样。
JS代码报错的位置竟然不是真正出错的位置！
.......
就这些简单的问题折腾了我好几天。web前端编程太麻烦了，这么痛苦的开发环境，真是受不了。
]]></description>
			<content:encoded><![CDATA[<p>IE6竟然不能连接向同一个网页发请求[做个按钮使用<a href="http://cocobear.info/blog/tag/ajax/" class="st_tag internal_tag" rel="tag" title="Posts tagged with ajax">ajax</a>请求一个网址 你们在服务器上发现 其实IE6只发了一次 但是<a href="http://cocobear.info/blog/tag/ajax/" class="st_tag internal_tag" rel="tag" title="Posts tagged with ajax">ajax</a>返回确是成功的]</p>
<p>IE7对iframe标签的支持竟然有问题--><a href="http://zhengrenchi.blogbus.com/logs/23056446.html">http://zhengrenchi.blogbus.com/logs/23056446.html</a></p>
<p>IE6与IE6 div标签的默认值不一样。</p>
<p><a href="http://cocobear.info/blog/tag/js/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Js">JS</a>代码报错的位置竟然不是真正出错的位置！</p>
<p>.......</p>
<p>就这些简单的问题折腾了我好几天。<a href="http://cocobear.info/blog/tag/web/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Web">web</a>前端编程太麻烦了，这么痛苦的开发环境，真是受不了。</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2009/08/25/web-front-dev/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Google Map</title>
		<link>http://cocobear.info/blog/2009/08/04/google-map/</link>
		<comments>http://cocobear.info/blog/2009/08/04/google-map/#comments</comments>
		<pubDate>Tue, 04 Aug 2009 01:22:56 +0000</pubDate>
		<dc:creator>可可熊</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[map]]></category>

		<guid isPermaLink="false">http://cocobear.info/blog/?p=723</guid>
		<description><![CDATA[Google Map的算法分析见:http://www.codeproject.com/KB/scrapbook/googlemap.aspx
Google Map使用http://mt[0-3].google.cn/mt/v=cn1.11&#038;hl=zh-CN&#038;x=%d&#038;y=%d&#038;z=%d&#038;s=Galile这样的URL来表示一个放大等级中最小的地图分块。
mt0----mt3是四个Google Map的服务器
v=cn1.11 是当前地图的版本 一直在变化中
x,y,z分别代表当前分块所在位置和放大等级，Z=19为最大的放大等级，目前很多城市都可以查看到该等级下的地图
    在某个放大等级z下，整个地球被分成2^z分块
    x,y可以根据经纬度来计算;x的计算比较好理解(longitude->经度)：
    longitude=180+longitude                     #修正经度值到0-360 因为经度的表示是从-180--->180
    longTileSize=360.0/(pow(2,zoom))        #计算每个分块所占的角度数
    [...]]]></description>
			<content:encoded><![CDATA[<p>Google Map的算法分析见:<a href="http://www.codeproject.com/KB/scrapbook/googlemap.aspx">http://www.codeproject.com/KB/scrapbook/googlemap.aspx</a></p>
<p>Google Map使用http://mt[0-3].google.cn/mt/v=cn1.11&#038;hl=zh-CN&#038;x=%d&#038;y=%d&#038;z=%d&#038;s=Galile这样的URL来表示一个放大等级中最小的地图分块。<br />
mt0----mt3是四个Google Map的服务器<br />
v=cn1.11 是当前地图的版本 一直在变化中<br />
x,y,z分别代表当前分块所在位置和放大等级，Z=19为最大的放大等级，目前很多城市都可以查看到该等级下的地图<br />
    在某个放大等级z下，整个地球被分成2^z分块<br />
    x,y可以根据经纬度来计算;x的计算比较好理解(longitude->经度)：<br />
    longitude=180+longitude                     #修正经度值到0-360 因为经度的表示是从-180--->180<br />
    longTileSize=360.0/(pow(2,zoom))        #计算每个分块所占的角度数<br />
    tilex =  longitude/longTileSize               #计算当前经度所在的分块位置</p>
<p>y的计算要牵扯到墨卡托投影这个地图算法，比较麻烦没看懂。不过并不影响使用，相应的代码上面已经给出来了，然后就可以用<a href="http://cocobear.info/blog/tag/python/" class="st_tag internal_tag" rel="tag" title="Posts tagged with Python">Python</a>下载地图分块，使用PIL库把分块合并。</p>
<p>代码见<a href="http://code.google.com/p/pytool/source/browse/trunk/GMap2Png.py">Google Code</a></p>
<p>(这个是西安地图)：<br />
#GMap2Png(108.80824,34.37075,109.10316,34.15366,16)<br />
参数为你需要确定的图片左上角的经纬度和右下角的经纬度 最后一个是放大的等级<br />
使用的时候需要注意如果你选择的经纬度范围较大，那么放大等级就不能太大，不然要生成一个巨大图片，PIL会报MemoryError的错误。</p>
<p>还有些问题我在<a href="https://groups.google.com/group/python-cn/browse_thread/thread/15a19893a7aa503b/b9c8fa6be0056a5f#b9c8fa6be0056a5f">CPyUG</a>记录了下来，不过没使用好的解决方案。</p>
]]></content:encoded>
			<wfw:commentRss>http://cocobear.info/blog/2009/08/04/google-map/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
