2008年02月 存档

[Python]WSGI, Asynchronous, PEP-333, socket杂博

2008年02月20日,星期三


def demo_app(environ,start_response):
from StringIO import StringIO
stdout = StringIO()
print >>stdout, "Hello world!"
print >>stdout
h = environ.items(); h.sort()
for k,v in h:
print >>stdout, k,'=',`v`
k=start_response("200 OK", [('Content-Type','text/plain')])
for x in range(1, 100):
k(str(x))
time.sleep(1)
return [stdout.getvalue()]

  • print >>stdout, "Hello world!"Python的这种语法非常长见识,很想C++里的语法
  • f1=f2(); f1(); 这种函数式编程风格是相当的囧
  • WSGI要实现异步输出,弄懂了PEP-333还是比较容易的,但是要在服务器端实现间歇性读取POST提交的内容就有点难了。当然这些东西完全超出了WSGI甚至HTTP的 请求 - 响应 模型
  • IE is draconian: Clients can’t make more than two HTTP connections to any box/subdomain (per spec).
  • 目前在HTTP上模拟socket的Python服务端程序有两个库:Athenapython-cometd

微软居然提供GNU、Unix的SDK/工具下载……WTF

2008年02月20日,星期三

网上lurking around的时候发现一个火星帖子:Vista和Server 2008支持Unix子系统……而且貌似是比较完整的。甚至包括一个C shell 和K Shell

Utilities and SDK for Subsystem for UNIX-based Applications in Microsoft Windows Vista RTM/Windows Vista SP1 and Windows Server 2008

Utilities and SDK for UNIX-Based Applications is an add-on to the Subsystem for UNIX-Based Applications (referred to as SUA, hence forth) component that shipped in Microsoft Windows Vista / Windows Server2008 RC1.
This consists of the following components:

- Base Utilities
- SVR-5 Utilities
- Base SDK
- GNU SDK
- GNU Utilities
- UNIX Perl
- Visual Studio Debugger Add-in

This release enables 64-bit application development for SUA. development and porting of custom UNIX applications using the Windows OCI (Oracle Call Interface) and Windows ODBC libraries (collectively referred to as ‘Mixed Mode’ in the rest of the document).

目前支持Windows Vista(请下载不带RC1字样的链接),以及Vista SP1 RC1,Server 2008 RC1(请下载带RC1字样的链接)。

Utilities and SDK for UNIX-based Applications_AMD64.exe 196.3 MB

Utilities and SDK for UNIX-based Applications_AMD64_RC1.exe 251.0 MB

Utilities and SDK for UNIX-based Applications_IA64_RC1.exe 259.8 MB

Utilities and SDK for UNIX-based Applications_X86.exe 193.3 MB

Utilities and SDK for UNIX-based Applications_X86_RC1.exe 248.7 MB

开启方法:

开始菜单 - 控制面板 - 程序和特性 - 打开/关闭Windows特性,勾选Unix子系统应用程序。

看了觉得很囧的请帮我Digg,谢谢!
http://digg.com/microsoft/Microsoft_Provide_GNU_and_Unix_SDK_Utilities_Download_WTF

我的机器被这个IP黑了,哪位能帮忙查出来?

2008年02月19日,星期二

your ip

谢谢大家了 !

Google, Baidu经常抽风

2008年02月18日,星期一

您所请求的网址(URL)无法获取

--------------------------------------------------------------------------------

当尝试读取以下网址(URL)时: http://www.google.com/search?hl=en&q=Applying+background+to+Iframe+for+IE

发生了下列的错误:

无法将您输入的主机名称:www.google.com转换成 IP 地址
域名服务器返回以下讯息:

No DNS records
这表示:

The cache was not able to resolve the hostname presented in the URL.
Check if the address is correct.
缓存服务器无法解析您输入网址(URL)中的主机名称,
请检查该名称是否正确。

本缓存服务器管理员:webmaster@fastcdn.com

--------------------------------------------------------------------------------

Generated Mon, 18 Feb 2008 09:11:05 GMT by CNC-TJTG-182.229.fastcdn.com (squid)

2008-2-18 成都教育网,Google.com和Baidu.com经常出现DNS解析错误。不是ZF在搞鬼就是电信技术人员工资没发够。

查看自己在Google Groups上的发帖/回帖

2008年02月18日,星期一

加入了很多个Google Groups参与了很多讨论,但是并不能随时跟踪相关的条目。这里写一个技巧。随便找到自己在Google Groups上的一个帖子,点击自己名字旁边的View Profile,然后点击最近讨论主题列表下面的Show All>>,把这个地址保存到收藏夹。

小技巧,大家不要鄙视我。

空虚

2008年02月16日,星期六

人人人人人人人人人人人人人人人人人人人人人人人人人人
人                        人
人                        人
人                        人
人                        人
人                        人
人                        人
人                        人
人                        人
人                        人
人           我            人
人                        人
人                        人
人                        人
人                        人
人                        人
人                        人
人                        人
人                        人
人                        人
人                        人
人人人人人人人人人人人人人人人人人人人人人人人人人人

所以很空虚

Bill Gates的Email邮箱

2008年02月16日,星期六

Bill Gates在Facebook上出现过一段时间,好事者把它的页面截了个图

但是Bill Gates的邮箱就暴露了:

billg@microsoft.com

网上搜索了下,发现Bill用这个邮箱很久了,而且每天收到的垃圾邮件是 4 million,400w封!不知道他老人家是不是用Live hotmail来处理的邮件 -_-!

顺便惊讶的发现Bill Gates在多个M$的Newsgroup上面露过面。看来名人也是正常人啊,也要玩USENET、youtube和facebook。不过名人一般都是马甲无数了

不知道Bill在Bill & Melinda Gates Foundation里会不会继续用这个Email地址

Update: 去Digg验证了下,发现这个截图有可能是fake的

首先是拼写错误,Beatles,Bill不会把这个拼错的 -_-!
当然马上有人站出来反驳说:他不会去花赚几千美元的一秒种来改正这个错误 -_-!

解决XP SP2启动时Loader Error 3

2008年02月16日,星期六

一大清早起来,开机,结果Windows XP SP2刚启动就:

Windows could not start because of an error in the software.
please report this problem as:
Loader error 3.
please contact your support person to report this problem

这是非常囧的情况。

安全模式 和 带网络连接的安全模式 可以进入,但是 正常模式 和 最后一次正确的配置 模式都不能进入系统。

想到网上去Google答案,但是在安全模式下不能启动Telephony服务,于是也不能PPPoE上网。万恶的微软设计啊~~~想起了我的Leopard双系统,发现Leopard居然说我网线没插好……而且PPPoE也不能拨号。

系统恢复盘也忘记刻了,所以只有艰苦奋斗双手解决了

发现启动的时候可以带日志启动。启动失败,进入安全模式,找到了这个记录:

12.JPG

事件来源:sptd
驱动程序为 在其数据结构中检测到了一个内部错误。

万分囧的发现是SPTD驱动出错了,SPTD是Daemon Tools的虚拟光驱驱动程序,于是到 system32\drivers 下删除 sptd.sys

重启,OK了。

DaemonTools官方也给出了一个解决方案,懒得看了,直接重装最新版DaemonTools了事

Solution in English:
delete system32\drivers\sptd.sys, reboot & it's OK
Contact Daemon Tools for more information

试玩Renoise

2008年02月15日,星期五

最近……最近非常郁闷。家里一个劲的给我讲形势,叫我考研。弄得我啥子都不想做,到处乱逛,发现了CSKMOD Music一篇介绍贴,有点老了,但是突然引起了我的兴趣,于是wikipedia, Google逛了一圈,开始研究Renoise这个tracker

11.JPG

化了半天研究Renoise文档,基本操作会了。玩起来很high。可怜我音乐细胞不够发达,还不能自己画曲子出来。目前把上学期钢琴课的几首曲子录制成了XRNS格式,不过volume和effects一点都没有调。相信以后一定要MOD一点曲子出来玩玩的。

于是非常想去买一个MIDI键盘(查了下最入门的都1k2多大洋),但是又想买把古典吉他……对于我这种穷人+补考大户,可能最多YY一下,然后用电脑键盘+鼠标消遣了。

Renoise非常容易上手,界面美观,功能非常强大,社区及其活跃。接下来准备把中国古典名曲给track出来。如果有条件的话用actionscript3实现一个XRNS Synthesizer,哇咔咔~~当然这只是一个美好的愿望罢了。还是重修和做Web要紧

Baidu及其丑陋的400页面

2008年02月13日,星期三

http://www.baidu.com/baidu?word=++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

1.png

无意中发现的。只要大于256个字符就行。