<?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://liguangming.com/rss/" rel="self" type="application/rss+xml" /><link>http://liguangming.com</link><description>李光明</description><pubDate>Thu, 11 Mar 2010 08:43:05 +0000</pubDate><generator>http://liguangming.com/</generator><language>zh-cn</language><item><title>一年(1)</title><link>http://liguangming.com/view/784</link><comments>http://liguangming.com/view/784#comments</comments><pubDate>Thu, 18 Feb 2010 10:03:03 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/784</guid><description><![CDATA[又一年，每天是没有新意的生活，想要简单的生活却要被乱七八糟的事情牵绊着。<br /> 最近又不能好好睡眠了，头痛，浑身都好痛，似乎是到达极限了，曾经真切的情感也消失殆尽。<br /> 好想什么也不管的活上一阵子，什么也不想，每天有安心的睡眠，不为什么事而烦恼。
]]></description><wfw:commentRss>http://liguangming.com/feed/784</wfw:commentRss></item><item><title>WordPress插件post-to-qzone-v0.4(14)</title><link>http://liguangming.com/view/783</link><comments>http://liguangming.com/view/783#comments</comments><pubDate>Mon, 01 Jun 2009 22:39:35 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/783</guid><description><![CDATA[支持在使用xmlrpc发布blog的同时将文章同步发布到Qzone空间以及支持邮箱发布的BSP。<br />
需要保存设置你的邮箱帐号和密码.<br />下载地址:<a href="http://qzone.googlecode.com/files/wp-qzone.0.4.php" title="下载Post to Qzone" target="_blank"><s>http://qzone.googlecode.com/files/wp-qzone.0.4.php<br /></s></a><br /><a href="http://vifix.cn/" target="_blank">@vimac</a>修改的版本<br /><a href="http://vifix.cn/blog/wp-content/uploads/2009/06/wp-qzone04-mod.zip" target="_blank">http://vifix.cn/blog/wp-content/uploads/2009/06/wp-qzone04-mod.zip</a><br />]]></description><wfw:commentRss>http://liguangming.com/feed/783</wfw:commentRss></item><item><title>WordPress插件post-to-qzone-v0.3(5)</title><link>http://liguangming.com/view/782</link><comments>http://liguangming.com/view/782#comments</comments><pubDate>Sat, 30 May 2009 22:43:22 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/782</guid><description><![CDATA[<p>1:可以发布到别邮箱，或者是支持邮箱发布的BSP，比如微软的Live Space。<br />
2:增加是否发布成功标记。
</p><p><img src="http://qzone.googlecode.com/files/qzone.png" alt="Post2Qzone Screensnap" width="500" /></p><p>下载地址:<a href="http://qzone.googlecode.com/files/wp-qzone.php" target="_blank">http://qzone.googlecode.com/files/wp-qzone.php</a></p><p>相关介绍：<a href="http://liguangming.com/view/725">http://liguangming.com/view/725<br /></a>相关阅读:<a href="http://blog.xiaoding.org/post/wordpress-sync-with-qzone-live_space.html" target="_blank">xiaoding的文章:Wordpress 与 Qzone 和 Live Space 同步<br /></a><br /></p>]]></description><wfw:commentRss>http://liguangming.com/feed/782</wfw:commentRss></item><item><title>php通过curl多线程抓取网站内容(5)</title><link>http://liguangming.com/view/781</link><comments>http://liguangming.com/view/781#comments</comments><pubDate>Mon, 25 May 2009 17:10:58 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/781</guid><description><![CDATA[自php5.0开始，增加了如下是curl支持多线程的函数
<pre>
curl_multi_init - initialize a new cURL multi handle. 
             It will return the cURL handle on success and FALSE on error.
curl_multi_add_handle — Add a cURL handle to a cURL multi handle.
curl_multi_exec — Runs all the curl handle in the cURL multi handle in parallel.
curl_multi_remove_handle — Removes a cURL handle from a cURL multi handle.
curl_multi_close — close the cURL multi handle.
</pre>
弄了个简单的例子
<pre class="prettyprint">
class MultiHttpRequest{
	public $urls = array();
	public $curlopt_header = 1;
	public $method = "GET";

	function __construct($urls = false)
	{
		$this->urls = $urls;
	}

	function set_urls($urls)
	{
		$this->urls = $urls;
		return $this;
	}

	function is_return_header($b)
	{
		$this->curlopt_header = $b;
		return $this;
	}

	function set_method($m)
	{
		$this->medthod = strtoupper($m);
		return $this;
	}

	function start()
	{
		if(!is_array($this->urls) or count($this->urls) == 0){
			return false;
		}

		$curl = $text = array();

		$handle = curl_multi_init();

		foreach($this->urls as $k=>$v){
			$curl[$k] = $this->add_handle($handle, $v);
		}

		$this->exec_handle($handle);

		foreach($this->urls as $k=>$v){
			$text[$k] =  curl_multi_getcontent ($curl[$k]);
			echo $text[$k], "\n\n";
			curl_multi_remove_handle($handle, $curl[$k]);
		}

		curl_multi_close($handle);
	}


	private function add_handle(&$handle, $url)
	{
		$curl = curl_init();
		curl_setopt($curl, CURLOPT_URL, $url);
		curl_setopt($curl, CURLOPT_HEADER, $this->curlopt_header);
		curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
		curl_multi_add_handle($handle, $curl);
		return $curl;
	}

	private function exec_handle(&$handle)
	{
		$flag = null;
		do {
			curl_multi_exec($handle, $flag);
		} while ($flag > 0);
	}
}

$urls = array("http://baidu.com", "http://dzone.com", "http://www.g.cn");
$mp = new MultiHttpRequest($urls);
$mp->start();
</pre>]]></description><wfw:commentRss>http://liguangming.com/feed/781</wfw:commentRss></item><item><title>Python2.5的SMTPAuthenticationError(334, 'UGFzc3dvcmQ6')(0)</title><link>http://liguangming.com/view/780</link><comments>http://liguangming.com/view/780#comments</comments><pubDate>Wed, 20 May 2009 22:22:44 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/780</guid><description><![CDATA[前段时间突然发现blog的post to qzone的插件不能使用了，返回的异常如下：
<pre class="prettyprint">
File "C:\Python25\lib\smtplib.py", line 591, in login
    raise SMTPAuthenticationError(code, resp)
SMTPAuthenticationError: (334, 'UGFzc3dvcmQ6')
</pre>
通过抓包发现stmtp.qq.com
<pre class="prettyprint">
connect: ('smtp.qq.com', 25)
connect: ('58.251.150.237', 25)
reply: '220 Esmtp QQ Mail Server\r\n'
reply: retcode (220); Msg: Esmtp QQ Mail Server
connect: Esmtp QQ Mail Server
send: 'ehlo [192.168.1.177]\r\n'
reply: '250-esmtp.qq.com\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-SIZE 52428800\r\n'
reply: '250-AUTH LOGIN\r\n'
reply: '250-AUTH=LOGIN\r\n'
reply: '250 8BITMIME\r\n'
reply: retcode (250); Msg: esmtp.qq.com
PIPELINING
SIZE 52428800
AUTH LOGIN
AUTH=LOGIN
8BITMIME
send: 'AUTH LOGIN **********\r\n'
reply: '334 VXNlcm5hbWU6\r\n'
reply: retcode (334); Msg: VXNlcm5hbWU6
send: '*****\r\n'
reply: '334 UGFzc3dvcmQ6\r\n'
reply: retcode (334); Msg: UGFzc3dvcmQ6
</pre>
发现邮件服务器返回的是 AUTH=LOGIN，多了一个'=',打开smtplib.py找到
<pre class="prettyprint">
elif authmethod == AUTH_LOGIN:
    (code, resp) = self.docmd("AUTH",
        "%s %s" % (AUTH_LOGIN, encode_base64(user, eol="")))
    if code != 334:
        raise SMTPAuthenticationError(code, resp)
    (code, resp) = self.docmd(encode_base64(password, eol=""))
</pre>
修改为：
<pre class="prettyprint">
elif authmethod == AUTH_LOGIN:
    # Three stage: 1. sent "AUTH LOGIN"; 2. sent "user name"; 3. sent "password".
    (code, resp) = self.docmd("AUTH", AUTH_LOGIN)
    if code != 334:
        raise SMTPAuthenticationError(code, resp)
    (code, resp) = self.docmd(encode_base64(user, eol=""))
    if code != 334:
        raise SMTPAuthenticationError(code, resp)
    (code, resp) = self.docmd(encode_base64(password, eol=""))
</pre>
找到
<pre class="prettyprint">
if method in authlist:
    authmethod = method
    break
</pre>
修改为：
<pre class="prettyprint">
if method in authlist or ('=%s' % method) in authlist:
    authmethod = method
    break
</pre>
最好是将此文件另存到你的项目文件里调用，这样就不需要换个环境就先要修改smtplib.py.]]></description><wfw:commentRss>http://liguangming.com/feed/780</wfw:commentRss></item><item><title>蛋糕(11)</title><link>http://liguangming.com/view/779</link><comments>http://liguangming.com/view/779#comments</comments><pubDate>Mon, 11 May 2009 21:11:54 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/779</guid><description><![CDATA[上周六<a href="http://www.zhaomingliang.com/" target="_blank">赵处男</a>生日，<a href="http://www.chenxuanwu.com/" target="_blank">小白</a>在好利来定的蛋糕：<br /><img src="http://liguangming.com/wp-content/uploads/2009/05/20090509222206.jpg" alt="生日蛋糕" />]]></description><wfw:commentRss>http://liguangming.com/feed/779</wfw:commentRss></item><item><title>四季之歌-花水木(2)</title><link>http://liguangming.com/view/776</link><comments>http://liguangming.com/view/776#comments</comments><pubDate>Fri, 08 May 2009 16:52:01 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/776</guid><description><![CDATA[<p>花水木在日本是一种常见的行道树,花水木这是直接翻译的名字他的学名是Cornus florida,中文译名叫大花四照花,是一种落叶性的大型乔木,秋季开花,花型4个花办对生,有红色和白色二种花色。象征着人们不变的情谊。
<br />来自<a href="http://www.therainbook.com/" target="_blank">Rain Book(レインブック)</a>的专辑《<a href="http://www.1ting.com/album/4e/album_26713.html" target="_blank">花水木</a>》<br /><img src="http://liguangming.com/wp-content/uploads/2009/05/20090508164716.jpg" alt="花水木.jpg" /><br />包括12首歌曲，收录了在这张专辑发售前的四张以四季为主题的单曲:千本桜,空の华,秋桜～届かない手纸～,雪あかり。<br />封面清新，我是被专辑的封面吸引的，听过后音乐更漂亮，清新自然，婉转动听。
<br />
<a href="http://www.therainbook.com/" target="_blank">Rain Book(レインブック)</a>，是由山本容子和前泽ヒデノリ组成的日本二人组合。</p>]]></description><wfw:commentRss>http://liguangming.com/feed/776</wfw:commentRss></item><item><title>Windows media player 80070057 错误(0)</title><link>http://liguangming.com/view/774</link><comments>http://liguangming.com/view/774#comments</comments><pubDate>Fri, 08 May 2009 13:06:11 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/774</guid><description><![CDATA[在网页中使用windows media player控件的时候，如果页面的location.href的长度大于1023，不能播放文件，会报如下错误：
<pre>
Original Error Code :
	80070057	
Original Error Message:
	One or more arguments are invalid
</pre>
在微软的错误信息帮助<a href="http://www.microsoft.com/windows/windowsmedia/player/webhelp/default.aspx?&mpver=11.0.5721.5260&id=C00D11B1&contextid=66&originalid=80070057" title="详细错误地址-Windows Media Player Error Message Help">Windows Media Player Error Message Help</a>里，并没有列出url长度引起的问题,微软说："<a href="http://support.microsoft.com/kb/208427/zh-cn">Maximum URL length is 2,083 characters in Internet Explorer"</a><br />

<br />附上各浏览器地址栏最大长度<br />
<pre>
1. Firefox 3.03 :最长字长4098
2. IE7.0: 2083
3. Opera 9.60: 4098 
4. google chrome 0.2.149.30: 4098, 与Firefox3.0.3，Opera 9.60相同
</pre>]]></description><wfw:commentRss>http://liguangming.com/feed/774</wfw:commentRss></item><item><title>爬山(2)</title><link>http://liguangming.com/view/769</link><comments>http://liguangming.com/view/769#comments</comments><pubDate>Sun, 03 May 2009 18:20:49 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/769</guid><description><![CDATA[<p>六点多起床，不知道怎么没睡好，昨天打算今天去爬山。洗脸刷牙，打开电脑，又核对了下资料，决定去凤凰岭了。昨天那谁谁谁说去百望山来着，结果临时有事，只好一个人去了。吃了早点，坐了两个小时的公交车，到了，似乎山上的龙泉寺在做什么法式，从进景区大门到龙泉寺，成群结队的善男信女们顶着烈日，三步一跪，在山路上慢慢挪动。似乎为释迦摩尼的庆生。旁边设置了警戒线，交通也管制了，有不少人在维持秩序，大概是为了防止发生意外。<br /><img src="http://liguangming.com/wp-content/uploads/2009/05/20090503182318.jpg" alt="照片_050309_001.jpg" width="500" /><br />看了下指示牌直接往上走，太阳已经很强烈了，没怕多少就开始汗流浃背。当下应该是枯水期，溪流都是光秃秃的石头。<br /><img src="http://liguangming.com/wp-content/uploads/2009/05/20090503182419.jpg" alt="照片_050309_004.jpg" width="500" /><br />刚开始整座山远看上去都是光秃秃的石头，心中难免失望，等到了山上，发现基本都是林荫小路，就是松树太小了，好像没种植几年吧，稀稀落落的。还有不少桃树，树枝上不少拇指大的绿色的桃子。<br /><img src="http://liguangming.com/wp-content/uploads/2009/05/20090503182615.jpg" alt="照片_050309_003.jpg" width="500" /><br />山中一直萦绕着一股香味，不知道什么那种花香，后来发现原来是槐花的香味，还能听到蜜蜂的嗡嗡声，只是看不到踪影。回来时又看到卖蜂蜜的。<br /><img src="http://liguangming.com/wp-content/uploads/2009/05/20090503183414.jpg" /><br />不过印象最深的就是垃圾桶，因为我前面一个小孩子不停的在重复走过多少个垃圾桶了，原来每个上面都边上数字，等过了三百多个垃圾桶，懵然发现一条“欢迎你再来”的牌子。怎么这么点路，后来问下别人才知道跑到南线景区了，还有中线，和北线，快十二点了，肚子也饿了。看到在山脚下不少卖农家小吃的，野菜团子(像包子却没褶皱)，野菜饺子。吃起来不错，也不贵。随后继续爬完了中线，北线。
</p>
<br title="doubanclaimbf3c2f84651cfeb8" />]]></description><wfw:commentRss>http://liguangming.com/feed/769</wfw:commentRss></item><item><title>鱼死  (0)</title><link>http://liguangming.com/view/768</link><comments>http://liguangming.com/view/768#comments</comments><pubDate>Sat, 02 May 2009 00:40:31 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/768</guid><description><![CDATA[早上起床的时候，发现我的金鱼死了一条，也可能是昨天死掉的，只是我今天才发现。
]]></description><wfw:commentRss>http://liguangming.com/feed/768</wfw:commentRss></item><item><title>记忆(1)</title><link>http://liguangming.com/view/766</link><comments>http://liguangming.com/view/766#comments</comments><pubDate>Fri, 01 May 2009 01:16:54 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/766</guid><description><![CDATA[<p><img src="http://liguangming.com/wp-content/uploads/2009/05/20090501012026.jpg" alt="说吧,记忆" /><br />我开始看书，开始读纳博科夫这个老贵族的回忆录《说吧，记忆》，只是感觉自己不在状态，有点陌生却带点似曾相识的感觉。或许现在随便一本书对我来说都一样，打发时间。我反复想这对我来说意味着什么，我在拿过去让我心安理得的习惯来和现在这漫长的无聊的时间较量，就像一只秋风秋雨中的芦苇试图站稳脚步，那么无助。那情形仿佛让我想到小时候在野外迷了路，天已经黑了，远处是星星点点的灯火，却怎么也找不到回家的路，难过的快要哭出声来了。最后好像是月亮出来，我顺着铺满月光的小路终于回到了家。而现在呢，我一直处于迷路之中，似乎这么多年来一直在做梦，不是属于我的梦，那梦里的生活是别人的，我无助的看着他们走来走去，而自己难过的即便是呼吸也那么困难，似乎是在水里，或者是类似的流动的液体里，我挣扎的游啊游，却看不到岸。救救我，就是喊不出声音来。后来从一个空间瞬移到另一个空间，醒来了，在短暂且漫长的黑夜里等着黎明的到来，等着阳光从窗户的缝隙里挤进来，摆着一副胜利者的姿态傲慢的落在凌乱的桌面上。<br /><br />昨晚从公司回来时下起了零星的小雨，这段时间不定期的在下雨，是的，夏天来了，裸露的皮肤，那些隔年的放在衣柜底部虽然熨烫却不能完全消除皱纹的裙摆，又出现在拥挤的地铁里，商场里，电梯里，街道两边的小径上，所有你的目光能触及到的地方，当然，如果你想象力丰富，你能看到的地方也会够远。然而最终的结果依旧是那么索然无味，并不能带来实质上的改变。就像小时候不小心把杯子打破了，在惊慌失措中努力试着让自己镇定下来，对自己说着一切都是幻觉，等睁开眼睛的时候被自己会自己动复原的，然而那杯子依旧是破碎的，一片一片的，那么伤心。现在不应该回忆这些琐事的时候了，是的，这是个需要狂欢的季节，写不下去了，还是睡觉吧......<br /><br /></p>]]></description><wfw:commentRss>http://liguangming.com/feed/766</wfw:commentRss></item><item><title>关于Persevere(1)</title><link>http://liguangming.com/view/765</link><comments>http://liguangming.com/view/765#comments</comments><pubDate>Wed, 22 Apr 2009 16:43:05 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/765</guid><description><![CDATA[Persevere 是针对Javascript设计的基于REST的JSON数据库，分布式计算，持久对象映射的框架，提供独立的web服务器，Persevere Server是一个基于Java/Rhino的对象存储引擎，数据的格式是JSON.具有如下特点：
<ol><li>Create, read, update, and delete access to persistent data through a standard JSON <a href="http://www.ietf.org/rfc/rfc2616.txt" rel="nofollow">HTTP/REST</a> web interface </li><li>Dynamic object persistence - expando objects, arrays, and JavaScript functions can be stored, for extensive JavaScript persistence support </li><li>Remote execution of JavaScript methods on the server through <a href="http://json-rpc.org/" rel="nofollow">JSON-RPC</a> for a consistent client/server language platform </li><li>Flexible and fast indexed query capability through JSONQuery </li><li><a href="http://www.sitepen.com/technology/" rel="nofollow">Comet</a>-based data monitoring capabilities through REST Channels with <a href="http://www.sitepen.com/labs/cometd.php" rel="nofollow">Bayeux</a> transport plugin/negotiation support </li><li>Data-centric capability-based object level security with user management, Persevere is designed to be accessed securely through Ajax with public-facing sites </li><li>Comprehensive referencing capabilities using <a href="http://www.json.com/2007/10/19/json-referencing-proposal-and-library/" rel="nofollow">JSON referencing</a>, including circular, multiple, lazy, non-lazy, cross-data source, and cross-site referencing for a wide variety of object structures </li><li>Data integrity and validation through <a href="http://groups.google.com/group/json-schema" rel="nofollow">JSON Schema</a> </li><li><a href="http://persevere.sitepen.com/#structure" rel="nofollow">Class-based data hierarchy</a> - typed objects can have methods, inheritance, class-based querying </li><li>Pluggable data source architectures - SQL tables, XML files, remote web services can be used as data stores </li><li>Service discovery through Service Mapping Description<br /><br /> </li></ol>
<p>相关资源:<br />
官方站点：<a href="http://www.persvr.org/" target="_blank">http://www.persvr.org/</a><br />
<a href="http://www.sitepen.com/blog/2009/04/20/javascriptdb-perseveres-new-high-performance-storage-engine/" target="_blank">性能比较文章</a><br /><br /></p>]]></description><wfw:commentRss>http://liguangming.com/feed/765</wfw:commentRss></item><item><title>那…今天就要说再见了(1)</title><link>http://liguangming.com/view/764</link><comments>http://liguangming.com/view/764#comments</comments><pubDate>Sat, 18 Apr 2009 14:39:29 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/764</guid><description><![CDATA[早上七点就醒了，起来翻老动画片看，小时候的明理很可爱。<br /><img src="http://liguangming.com/wp-content/uploads/2009/04/20090418143113.jpg" alt="[秒速5厘米].[SumiSora][Byousoku_5_Centimeter][DISC1][X264_AC3][JP_GB_BIG5][MOV](F1102FF7)[(021010)14-25-16].JPG" width="500" />]]></description><wfw:commentRss>http://liguangming.com/feed/764</wfw:commentRss></item><item><title>Firediff-跟踪css和dom变化的Firebug扩展(0)</title><link>http://liguangming.com/view/762</link><comments>http://liguangming.com/view/762#comments</comments><pubDate>Sat, 18 Apr 2009 11:58:52 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/762</guid><description><![CDATA[想知道js对页面的dom的样式(css)做了什么事情吗？现在<a href="http://www.incaseofstairs.com/" target="_blank">Kevin Decker</a>释出一个好用的<a href="http://www.getfirebug.com/" target="_blank">Firebug</a>扩展应用<a href="http://www.incaseofstairs.com/firediff/" target="_blank">Firediff</a>，可以把dom的样式的改变打印在Firebug的控制台。Firediff需要Firebug1.4版本,推荐使用1.4a17或者更高版本。
<br /><br />最新版本下载地址<a href="http://www.incaseofstairs.com/firediff/firediff011/" target="_blank">http://www.incaseofstairs.com/firediff/firediff011/</a><br /><br />截图效果:<br /><img src="http://www.incaseofstairs.com/wp-content/uploads/2009/04/firediff_small.png" alt="Firediff is a Firebug extension that tracks changes to a pages DOM and CSS" /><br /><br />]]></description><wfw:commentRss>http://liguangming.com/feed/762</wfw:commentRss></item><item><title>Google App Engine支持php了?(0)</title><link>http://liguangming.com/view/759</link><comments>http://liguangming.com/view/759#comments</comments><pubDate>Wed, 15 Apr 2009 12:28:37 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/759</guid><description><![CDATA[<img src="http://code.google.com/appengine/images/appengine_lowres.gif" alt="Google App Engine" />
<img src="http://static.php.net/www.php.net/images/php.gif" alt="php" />
<br /><p>这不是官方的消息，在文章里<a href="http://www.webdigi.co.uk/blog/2009/run-php-on-the-google-app-engine/" target="_blank">在Google App Engine上运行php程序</a>里，通过GAE提供的支持java的方法，通过<a href="http://www.caucho.com/resin-3.0/quercus/" target="_blank">Quercus</a>引擎去解析执行php，而不是原生的php引擎，Quercus是一个纯java的php解析引擎。<br /><br />
</p><p><strong>更新：</strong><br /></p>
<a href="http://icyleaf.com/2009/04/14/running-php-on-google-app-engine/" target="_blank">中文的教程 - 如何让PHP在Google App Engine上运行</a><br /><br />]]></description><wfw:commentRss>http://liguangming.com/feed/759</wfw:commentRss></item><item><title>跨浏览器自定义滚动条样式(1)</title><link>http://liguangming.com/view/757</link><comments>http://liguangming.com/view/757#comments</comments><pubDate>Sat, 28 Mar 2009 00:00:59 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/757</guid><description><![CDATA[<p>IE系浏览器可以很方便的通过其<a href="http://msdn.microsoft.com/en-us/library/ms531157(VS.85).aspx" target="_blank">私有css属性</a>改变滚动条的颜色,如果其它浏览器实现这样的效果就要费些周折了，我用js简单实现了下，就是设置div(a)内容滚动，这样可以有效确保鼠标滚轮可以控制内容上下滚动，然后新建一个div(slider)层遮住div(b)的滚动条，然后在这个新建的层里创建一个div(b)，这个div(b)的高度和div(a)的高度一样，scrollHeight也一样，这样就可以是b出现和a一样高度的滚动条，然后设置b完全透明，再通过js绑定二者就可以了。</p>
<p><a href="http://liguangming.com/wp-content/uploads/2009/03/20090327235914.html" target="_blank">demo</a></p>
]]></description><wfw:commentRss>http://liguangming.com/feed/757</wfw:commentRss></item><item><title>Python的@修饰符(0)</title><link>http://liguangming.com/view/755</link><comments>http://liguangming.com/view/755#comments</comments><pubDate>Mon, 23 Mar 2009 17:41:34 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/755</guid><description><![CDATA[<p>@符号用作函数修饰符是python2.4加入的功能,修饰符必须出现在函数定义前一行(当然你也可以空出几行，而不是放在前一行),不允许和函数定义在同一行.也就是说 ＠A def f(): 是非法的.只可以在模块或类定义层内对函数进行修饰,不允许修修饰一个类(Python2.6允许修饰一个类). 一个修饰符就是一个函数,也可是是一个类(利用该类的__call__方法),它将被修饰的函数做为参数,并返回修饰后的同名函数或其它可调用的东西.</p>
<p>以下是使用类作为修饰</p>
<pre class="prettyprint">
#!/usr/bin/env python
# -*- coding: utf-8 -*-
class Accepts(object):
    def __init__(self, *atypes):
        self.atypes = atypes

    def __call__(self, func):
        def _wrapper(*args, **kwargs):
            for (a, t) in zip(args, self.atypes):
                assert isinstance(a, t), \
                       "arg %r does not match %s" % (a,t)
            return func(*args, **kwargs)
        return _wrapper

class Returns(object):
    def __init__(self, rtype):
        self.rtype = rtype

    def __call__(self, func):
        def _wrapper(*args, **kwargs):
            result = func(*args, **kwargs)
            assert isinstance(result, self.rtype), \
                   "return value %r does not match %s" % (result,self.rtype)
            return result
        return _wrapper


@Accepts(int,int)
@Returns(int)
def foobar(a,b):
    return a + b

print foobar(1, 2)
</pre>
<p>
<b>相关资源</b><br />
<a href="http://www.ibm.com/developerworks/cn/linux/l-cpdecor.html">可爱的 Python: Decorator 简化元编程</a><br />
<a href="http://www.python.org/dev/peps/pep-0318/">Decorators for Functions and Methods</a><br />
<a href="http://pypi.python.org/pypi/decorator">Michele Simionato 写的decorator 模块</a><br />
</p>]]></description><wfw:commentRss>http://liguangming.com/feed/755</wfw:commentRss></item><item><title>PyWordPress之XML-RPC(0)</title><link>http://liguangming.com/view/754</link><comments>http://liguangming.com/view/754#comments</comments><pubDate>Sat, 21 Mar 2009 20:52:47 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/754</guid><description><![CDATA[<p>想把PyWordPress加上XML-RPC，看了WordPress的XML-RPC的相关功能调用，简单弄了几个函数做演示，仔细阅读才发现MT空间商的Python(2.4.4 (#3, Jun 28 2007, 13:42:28) \n[GCC 3.3.5 (Debian 1:3.3.5-13)])的xmlrpclib和2.5的xmlrpclib还是有所差别的,我本地弄的，传上去报错了。后来把2.5的xmlrpclib.py直接传上去就可以了。以下是本地的测试脚本。等有时间就慢慢的完善吧。</p>
<pre class="prettyprint">
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from pprint import pprint
import xmlrpclib

server = xmlrpclib.ServerProxy("http://liguangming.com/xmlrpc",verbose = 0)
pprint (server.demo.sayHello())
pprint (server.demo.addTwoNumbers(1, 2))
pprint (server.wp.getComment(1))

</pre>
<pre>
'Hello!'
3
{'comment_ID': 1,
 'comment_agent': '',
 'comment_approved': '1',
 'comment_author': 'cute',
 'comment_author_IP': '',
 'comment_author_email': '',
 'comment_author_url': 'http://liguangming.com/',
 'comment_content': 'Hi, this is a comment....',
 'comment_date': <DateTime '20070925T20:54:55' at b5e058>,
 'comment_date_gmt': <DateTime '20070925T12:54:55' at b5e0d0>,
 'comment_karma': 0,
 'comment_parent': 0,
 'comment_post_ID': 1,
 'comment_type': '',
 'user_id': 1}
</pre>]]></description><wfw:commentRss>http://liguangming.com/feed/754</wfw:commentRss></item><item><title>Python之50个常用的模块(0)</title><link>http://liguangming.com/view/753</link><comments>http://liguangming.com/view/753#comments</comments><pubDate>Sat, 21 Mar 2009 19:27:55 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/753</guid><description><![CDATA[<p>Python是我喜欢的语言之一,以下的列表囊括了数据库,GUI,图像,音频,视频,WEB,系统交互等方面,感谢<a href="http://www.catswhocode.com/blog/python-50-modules-for-all-needs" href="_blank">Jean-Baptiste Jung整理的列表</a>.其中的好几个都试着摆弄过。<p>
<pre>
Graphical interface	wxPython	http://wxpython.org	
Graphical interface	pyGtk	http://www.pygtk.org	
Graphical interface	pyQT	http://www.riverbankcomputing.co.uk/pyqt/	
Graphical interface	Pmw	http://pmw.sourceforge.net/	
Graphical interface	Tkinter 3000	http://effbot.org/zone/wck.htm	
Graphical interface	Tix	http://tix.sourceforge.net/	
			
Database	MySQLdb	http://sourceforge.net/projects/mysql-python	
Database	PyGreSQL	http://www.pygresql.org/	
Database	Gadfly	http://gadfly.sourceforge.net/	
Database	SQLAlchemy	http://www.sqlalchemy.org/	
Database	psycopg	http://www.initd.org/pub/software/psycopg/	
Database	kinterbasdb	http://kinterbasdb.sourceforge.net/	
Database	cx_Oracle	http://www.cxtools.net/default.aspx?nav=downloads	
Database	pySQLite	http://initd.org/tracker/pysqlite	
			
MSN Messenger	msnlib	http://auriga.wearlab.de/~alb/msnlib/	
MSN Messenger	pymsn	http://telepathy.freedesktop.org/wiki/Pymsn	
MSN Messenger	msnp	http://msnp.sourceforge.net/	
Network	Twisted	http://twistedmatrix.com/
	
Images	PIL	http://www.pythonware.com/products/pil/	
Images	gdmodule	http://newcenturycomputers.net/projects/gdmodule.html	
Images	VideoCapture	http://videocapture.sourceforge.net/	
			
Sciences and Maths	scipy	http://www.scipy.org/	
Sciences and Maths	NumPy	http://numpy.scipy.org//	
Sciences and Maths	numarray	http://www.stsci.edu/resources/software_hardware/numarray	
Sciences and Maths	matplotlib	http://matplotlib.sourceforge.net/	
			
Games	Pygame	http://www.pygame.org/news.html	
Games	Pyglet	http://www.pyglet.org/	
Games	PySoy	http://www.pysoy.org/	
Games	pyOpenGL	http://pyopengl.sourceforge.net/	
			
Jabber	jabberpy	http://jabberpy.sourceforge.net/	
			
Web	scrape	http://zesty.ca/python/scrape.html	
Web	Beautiful Soup	http://crummy.com/software/BeautifulSoup	
Web	pythonweb	http://www.pythonweb.org/	
Web	mechanize	http://wwwsearch.sourceforge.net/mechanize/	
			
Localisation	geoname.py	http://www.zindep.com/blog-zindep/Geoname-python/	
			
Serial port	pySerial	http://pyserial.sourceforge.net/	
Serial port	USPP	http://ibarona.googlepages.com/uspp	
			
Parallel Port	pyParallel	http://pyserial.sourceforge.net/pyparallel.html	
			
USB Port	pyUSB	http://bleyer.org/pyusb/	
			
Windows	ctypes	http://starship.python.net/crew/theller/ctypes/	
Windows	pywin32	http://sourceforge.net/projects/pywin32/	
Windows	pywinauto	http://www.openqa.org/pywinauto/	
Windows	pyrtf	http://pyrtf.sourceforge.net/	
Windows	wmi	http://timgolden.me.uk/python/wmi.html	
			
PDA/GSM/Mobiles	pymo	http://www.awaretek.com/pymo.html	
PDA/GSM/Mobiles	pyS60	http://sourceforge.net/projects/pys60	
			
Sound	pySoundic	http://pysonic.sourceforge.net/	
Sound	pyMedia	http://pymedia.org/	
Sound	FMOD	http://www.fmod.org/	
Sound	pyMIDI	http://www.cs.unc.edu/Research/assist/developer.shtml	
			
GMail	libgmail	http://libgmail.sourceforge.net/	
Google	pyGoogle	http://pygoogle.sourceforge.net/	
Expect	pyExpect	http://pexpect.sourceforge.net/	
WordNet	pyWordNet	http://osteele.com/projects/pywordnet/	
Command line	cmd	http://blog.doughellmann.com/2008/05/pymotw-cmd.html	
Compiler backend	llvm-py	http://mdevan.nfshost.com/llvm-py/	
3D	VPython	http://vpython.org
</pre>]]></description><wfw:commentRss>http://liguangming.com/feed/753</wfw:commentRss></item><item><title>使用Python修改你的音乐文件标签(0)</title><link>http://liguangming.com/view/751</link><comments>http://liguangming.com/view/751#comments</comments><pubDate>Thu, 19 Mar 2009 18:34:57 +0000</pubDate><dc:creator>李光明</dc:creator><guid isPermaLink="false">http://liguangming.com/view/751</guid><description><![CDATA[<p>如果要使用Python修改音乐文件(比如mp3,wma.ogg)的标签,需要使用<abbr title="Mutagen tagging library">Mutagen</abbr>。关于Mutagen tagging library</p>
<pre>Mutagen is a Python module to handle audio metadata. 
It supports ASF, FLAC, M4A, Monkey's Audio, MP3, Musepack, Ogg FLAC, Ogg Speex, 
Ogg Theora, Ogg Vorbis, True Audio, WavPack and OptimFROG audio files. 
All versions of ID3v2 are supported, and all standard ID3v2.4 frames are parsed. 
It can read Xing headers to accurately calculate the bitrate and length of MP3s. 
ID3 and APEv2 tags can be edited regardless of audio format. 
It can also manipulate Ogg streams on an individual packet/page level.</pre>
<p>下载地址:<a href="http://quodlibet.googlecode.com/files/mutagen-1.15.tar.gz" target="_blank">http://quodlibet.googlecode.com/files/mutagen-1.15.tar.gz</a></p>
<pre>
$ svn co http://svn.sacredchao.net/svn/quodlibet/trunk/mutagen
</pre>
<p>如下是一个修改wma文件标签的片段,关于中文的标签需要设置系统默认编码.更多<a href="http://svn.sacredchao.net/svn/quodlibet/trunk/mutagen/TUTORIAL" target="_blank">例子</a>,<a href="http://code.google.com/p/quodlibet/wiki/Mutagen" target="_blank">Wiki</a></p>
<pre class="prettyprint">
#!/usr/bin/env python
# -*- coding: utf8 -*-

import sys
from mutagen.asf import ASF

reload(sys)
sys.setdefaultencoding('utf8')

audio = ASF("1.wma")
audio["Title"] = "雕刻时光"
audio["Author"] = "钟立风"
audio["WM/AlbumTitle"] = "雕刻时光"
audio["WM/TrackNumber"] = "1"
audio["WM/Year"] = "2009"
audio["WM/PromotionURL"] = "http://www.1ting.com"
audio["Copyright"] = "合作推广联系promotion at 1ting.com.cn"
audio["Description"] = "一听音乐网提醒您购买高品质正版CD"
ASF.save(audio)

print ASF.pprint(audio).encode('cp936')
</pre>
<p>输出信息</p>
<pre>
Windows Media Audio 64024 bps, 44100 Hz, 2 channels, 266.76 seconds (audio/x-ms-wma)
WM/WMADRCAverageReference=8551
DeviceConformanceTemplate=L1
WM/WMADRCPeakReference=32101
IsVBR=False
Artist=钟立风
WMFSDKVersion=10.00.00.4066
IsVBR=False
WMFSDKNeeded=0.0.0.0000
Rating=
Title=雕刻时光
Author=钟立风
WM/AlbumTitle=雕刻时光
WM/TrackNumber=1
WM/Year=2009
WM/PromotionURL=http://www.1ting.com
Copyright=合作推广联系promotion at 1ting.com.cn
Description=一听音乐网提醒您购买高品质正版CD
</pre>
<p>Python用起来还是很舒服的,哈哈.附上ASF文件的<a href="http://msdn.microsoft.com/en-us/library/aa384495(VS.85).aspx" target="_blank">属性列表</a></p>
<pre>
AcquisitionTime
AlbumID
AlbumIDAlbumArtist
Author
AverageLevel
Bitrate
BuyNow
BuyTickets
Copyright
CurrentBitrate
Duration
FileSize
FileType
Is_Protected
IsVBR
MediaType
MoreInfo
PeakValue
ProviderLogoURL
ProviderURL
RecordingTime
ReleaseDate
RequestState
SourceURL
SyncState
Title
TrackingID
UserCustom1
UserCustom2
UserEffectiveRating
UserLastPlayedTime
UserPlayCount
UserPlaycountAfternoon
UserPlaycountEvening
UserPlaycountMorning
UserPlaycountNight
UserPlaycountWeekday
UserPlaycountWeekend
UserRating
UserServiceRating
WM/AlbumArtist
WM/AlbumTitle
WM/Category
WM/Composer
WM/Conductor
WM/ContentDistributor
WM/ContentGroupDescription
WM/EncodingTime
WM/Genre
WM/GenreID
WM/InitialKey
WM/Language
WM/Lyrics
WM/MCDI
WM/MediaClassPrimaryID
WM/MediaClassSecondaryID
WM/Mood
WM/ParentalRating
WM/Period
WM/ProtectionType
WM/Provider
WM/ProviderRating
WM/ProviderStyle
WM/Publisher
WM/SubscriptionContentID
WM/SubTitle
WM/TrackNumber
WM/UniqueFileIdentifier
WM/WMCollectionGroupID
WM/WMCollectionID
WM/WMContentID
WM/Writer
</pre>]]></description><wfw:commentRss>http://liguangming.com/feed/751</wfw:commentRss></item></channel></rss>