| Siyao's profile火星猫PhotosBlogLists | Help |
|
October 05 生活应该开始了今天送走了师姐。从coach station出来后,我毫无悬念地迷路了。尽管之前做足了功课,在google map上面查好了从家里到coach station的详细路线,并且截图放在ipod里面,但是,我还是迷路了。走出车站的时候,看到完全陌生的道路,而且脑子里还得多根弦,过马路的时候不能左顾右盼而是右顾左盼,于是开始感到恐慌。一恐慌,就走岔了,完全偏离方向了。于是在这个陌生的城市里面转来转去,凭着一点可怜的方向感,总算是转回了车站,然后再顺着ipod里面地图的指引,回到了家。怀念北京横平竖直的道路,几乎可以通过记忆就找到想去的地方。也许这种随性的城市规划更有魅力吧. 今天一天都是阴的,时不时下一点小雨,让人感觉心情非常的阴沉,在这个阴沉的天,送走了师姐。感谢师姐头两个星期的陪伴,没有你们我会更加的不知所措,感谢你们带我熟悉各个地方,感谢你们每天给我做饭。虽然只有两个星期,但是很怀念每天晚上和你们一起吃饭,然后一起聊天的感觉。在这陌生的地方,让我感觉到了家的温暖. 现在你们走了,我一切都要靠自己了。很佩服你们去年刚来的时候,从西斯罗出来找到coach坐两个多小时大晚上的到达Bristol,开始所有的生活,一切都是从零开始。虽然我这次来比你们幸福多了,在西斯罗T3出口就有人接,还有人开车送我到Bristol的家里,但是还是不能忘记刚开始的那种无助。你们一定比我绝望多了,所以很佩服你们。你们靠自己找到了学校,靠自己找到了超市,慢慢开始了自己的生活,而有了你们,我就便捷多了,没有付出任何努力就把所有生活需要的物资都购置齐全,不用付出任何努力就学会了所有的设施. 突然没有了依靠,什么都要靠自己的时候,又一次感觉无助,当一个人孤零零地走在刮大风还下着小雨的大街上的时候,寂寞的感觉挡都挡不住。回到家里,曾经热闹的garden floor不再热闹,失落感油然而起. 好吧,我应该开始我的新生活了,一切都靠我自己,坚强面对生活的种种困难,去熟悉这个陌生的城市,这个陌生的国家。谢谢师姐的照顾,也为你们的坚强和友谊而感动. 我要收起我的忧伤,积极乐观地面对生活. I have my precious Sunshine supporting me, I will never let you getting disappointed. October 20 爱上图书馆来北京这么久了,新生活也开始这么久了,才写第一篇,不是因为我懒,而是因为我实在没条件,之前一直在教学区上无线,教育网的条件大家也清楚了,几乎无法访问space,现在好了,在宿舍通了宽带。大运村的宽带贵不说,还限流量,共享也麻烦,还要装计费软件什么的,我可爱的ubuntu就不可能共享了。综合考虑,还是办了网通的,虽然是计时,但是有改为包月的趋势,还能用路由器共享,可以在寝室享受wifi了。
图书馆装了一个暑假的空调,终于在这个月的15号开了。除了因为北航超低的办事效率要到11月份才能将一卡通办下来所以我必须每天带着能证明我研究生身份的录取通知书才能进研究生阅览室之外,对于图书馆本身感觉还是蛮好的,因为我需要的书基本都能找到,而且没有人跟我抢原版书:) 更重要的是,还有可爱的阳光。虽然北京的阳光很少见,不是因为天不晴,而是因为环境污染太严重。我真的太喜欢这个季节的阳光了,阳光让我有寄托,有幸福的感觉。“分享阳光,分担风雨”,虽然没有人和我分担风雨,但是独享阳光的感觉还是很温馨的。 August 15 用Python给Gimp写插件原由:好不容易从emule上拖了一本“LaTeX Companion”下来,结果发现排版实在是感觉不爽。下载下来的电子档是扫描版的,但是扫描者似乎为了节省页面,将对开的两页书扫描到一个页面上,所以pdf文档的一个页面就有左右两面书,看起来很不方便,于是想办法把这些页面裁开。不知道有什么pdf工具能完成这样的任务,所以我采用的是比较麻烦的办法。 Linux下暂时没有找到提取pdf文件的工具,所以我先在虚拟机下运行Acrobat Professional,将每一个页面保存为一个jpg文件。这样,下面的任务就是将每一个文件一左一右对半裁成两个文件,一共有280多个这样的页面,几乎是不可能手工完成的,就算可以,也不愿意。原来处理数码照片的时候比较满意一个windows软件“光影魔术手”中的批处理功能,可是遗憾的是这个软件不能按照我需要的方式批量裁减这些文件,所以要另想办法。 回到Linux下,研究传说中Photoshop的替代者Gimp,具有比较合适的裁减功能,但遗憾的是不具有批处理的功能。在菜单里翻来翻去,发现一个叫python-fu的东东,貌似Gimp提供给python的接口。查了相关资料,这是Gimp提供给Python语言写插件的一个接口,功能很全面,而且非常简洁,写插件非常方便。在http://www.gimp.org/docs/python/index.html 有用Python写GImp插件的文档。用下面这些代码就完成了我的需要: #!/usr/bin/env python from gimpfu import * import os def python_batch_clip( xorg = 0, yorg = 0, width = 400, height = 300, directory = "/home", savedirectory = "/home", filename_postfix = ""): for entry in os.listdir(directory): if directory[len(directory)-1] == "/": fullpath = directory + entry else: fullpath = directory + "/" + entry if fullpath[-4:len(fullpath)] == ".jpg": # we assume this is a jpg file print "Processing file ", fullpath image = pdb.file_jpeg_load(fullpath, fullpath) pdb.gimp_image_crop(image, width, height, xorg, yorg) if savedirectory[len(savedirectory)-1] == "/": savepath = savedirectory + entry[:-4] else: savepath = savedirectory + "/" + entry[:-4] if filename_postfix != "": savepath = savepath + "_" + filename_postfix savepath = savepath + ".jpg" print "Saving file ", savepath pdb.file_jpeg_save( image, pdb.gimp_image_get_active_drawable(image), savepath, savepath, 1, 0, 1, 0, "", 0, 0, 0, 0) register( "python_fu_batch_clip", "Crop the jpg files in a directory", "Crop the jpg files in a directory", "Zheng Siyao", "Zheng Siyao", "2006", "<Toolbox>/Python-Fu/zsy/batch_clip", "RGB*, GRAY*", [ (PF_INT, "x_origin", "X origin", 0), (PF_INT, "y_origin", "Y origin", 0), (PF_INT, "width", "Width", 400), (PF_INT, "height", "Height", 300), (PF_FILE, "dir_path", "Directory", "/home"), (PF_FILE, "save_path", "Save to", "/home"), (PF_STRING, "postfix", "Filename Postfix", "") ], [], python_batch_clip) main() python_batch_clip()这个函数遍历目录下所有.jpg结尾的文件,读取每一个文件到image对象中,对每个image对象进行裁减操作,最后将image对象写入文件。 register函数有固定的格式,通过这个函数向Gimp注册插件,最后的main运行插件。Gimp启动的时候会在插件目录下寻找可用的插件,因此在使用之前必须给这个文件添加可执行属性。这个插件不是对一个文件的滤镜,属于一种工具,因此将其规为<Toolbox>类,这样,启动Gimp后,不打开任何文件,就能使用这个插件了。 运行插件的时候如下图所示,可以看出,python-fu还提供了一个输入参数的图形界面,同时,插件运行的进度也反应在这个界面上。当然,也可以用print向终端输出自己需要的信息。 August 10 闪电我比较喜欢拍照,不好意思叫摄影,因为什么也不懂,也只有一个业余的傻瓜T7,看到什么有意思的或者好看的都喜欢抓起相机就拍。前几天晚上,天空闷响,可以看到远处天边在闪,所以就拿起相机来拍了。这个T7只有2s的暴光时间,ISO也比较低,所以夜景不太好拍。我也没有三脚架,相机也不带anti-shake,所以就用最土的办法,把相机放在家里的一个台子上,对着远方,看到快要闪电了,就按下快门等待。运气还不错,守到了一个效果还不错的一闪。后来雷雨区域行进到我家头顶了,又非常走运地在头顶拍到一闪。雨越下越大,雷暴越来越强烈,不敢站在窗口了,收工。 June 22 开始暑期项目毕业论文改来改去终于改完了,迎合不同老师的胃口,做了不少修改,也浪费了不少大树。对于学校的办事规定,都要毕业了,也懒得发太多的牢骚了,反正毕业设计这事过去了就算是一个了解了。优秀也申请了,算是对得住自己一个学期来的辛勤劳动。 SoC已经开始了快一个月了,我才能有时间开始做了,刚开始就得面对Google的Mid-Term Evaluation,看样子有得熬几天才能混过这个evaluation,然后才算是正式开始这个项目。今天准备好了要看的资料,装好了要用的软件,看了看代码,算是开头了。创建了soc专用英文blog,发布了第一篇文章: http://www.planet-soc.com/blog/107 另一个深渊开始了。。。 May 25 Google Soc project accepted!两周前,一个荷兰的网友Mark邀请我参加Google Summer of Code 2006,这是从2005年开始,每年Google 公司为了促进开源事业进行的一项活动,以每个学生$4500的资金资助一些学生在夏季完成和开源有关的一个项目,今年入选的学生有600多名,涉及上百个开源社区。
我的项目属于Python Software Foundation,内容是从内存管理的角度提升一个从Python语言到C++语言的编译器的性能(Shed Skin project)。
申请项目时的Proposal如下:
Name: Zheng Siyao
Email: zhengsyao at gmail.com IM: gtalk: zhengsyao at gmail.com Abstract:
I will extend the Shed Skin compiler, so that memory management of
generated code and hence performance is improved. About Shed Skin: Shed Skin is an experimental Python-to-C++ compiler. It accepts pure,
but implicitly statically typed Python programs, and converts them into optimized equivalent C++ programs. The ultimate goal is to be able to run pure Python programs at the speed of manually written C++, so we can combine the elegance and productivity of Python with the efficiency of C++. For a set of 16 non-trivial test programs, measurements show a typical speedup of 2-40 over Psyco, about 12 on average, and 2-220 over CPython, about 45 on average [1]. Proposal: Shed Skin still misses an important type of optimization. Because the
author has mostly focused on type inference techniques, he has not paid much attention to memory management. However, Python memory management is rather inefficient: every object is allocated on the heap, causing costly (de)allocation and garbage collection overheads. Shed Skin currently does nothing to avoid such heap allocation. To improve the performance of generated C++ code, I will investigate and implement techniques to transform as much heap allocation as possible into stack- and static preallocation. This way, we can bring the performance of generated code even closer to manually written C++ code. Feasibility: It has been shown in the literature (mostly within the context of
Java) that stack- and static preallocation can significantly improve performance. The author of Shed Skin has also shown that a very simple technique to perform stack allocation improves performance by 15% on average, up to 30%, for 6 out of 16 non-trivial benchmarks. Deliverables: 1. Implement a technique to transform heap into stack allocation
2. Implement a technique to transform heap into static preallocation 3. Both techniques should work for all the benchmarks in Dufour's thesis, with performance at least matching his prototype techniques, and superior performance for more extreme demonstration programs Timeline: I'm going to work on the project for at least 12 weeks. Detailed arrangement as follows:
1. 2 weeks to get familiar with necessary theory and Shed Skin and some literature; 2. 4 weeks to implement a stack allocation technique; 3. 4 weeks to implement a static preallocation technique; 4. 2 weeks to fix any remaining problems, and to measure performance for the benchmarks in Dufour's thesis and some more extreme demonstration programs. About me: I am a Chinese undergraduate student majoring in Computer Science. I love my major and have a solid foundation in computer architecture,
programming languages, compiler principles, operating systems and so forth. I was elected to the direct PhD program of another university and will skip a Master's degree to start a PhD course in a few months. I am currently doing my undergraduate project with the topic 'Python Implemented in C++'. I have established a subset of Python with the most important features, and developed a virtual machine based on the subset, as well as a compiler that translates Python source code to bytecode. I have used C++ to implement both. During the project, I have learned a lot about Python internals including its object model, its bytecode, and its running mechanism. I like Python very much because of its compactness and elegance.
Python enables me to write beautiful code and be very productive. Although the authors of Python have put much effort into improving the performance of the Python virtual machine, as an interpreted language it is unavoidably slower than compiled languages. With the success of projects such as Shed Skin, we can fulfill our dream of having elegant code run with very high performance. 经过了两周的漫长等待,google终于在它承诺的时间,太平洋白昼时2006年5月23日的24:03分(实际上到了24号了:) ),发出了announcement。
如果你有时间,如果你有激情,如果你热爱开源,那么请关注Google Soc吧!
March 09 我是火星人研究Python的语言白皮书(其实就是Language Reference,白皮书显得很酷 March 06 python虚拟机毕设能够自己选题真好,于是就选了语言实现作为主题,于是就选了python语言作为一个目标进行实现。为什么选python呢,也许纯粹是因为喜欢,喜欢它的编程的自由,喜欢它的duck typing。按照python主页上的说法,Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python's elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms. 看着多诱人啊,简单易学,功能强大,支持面向对象,弱类型的脚本语言。和现在很多流行的语言一样,Python是跨平台的,运行在虚拟机之上。什么Java啦,C井号啦,VB.NET啦,本质上都被编译成了字节码跑在虚拟机上。所以Python语言的实现的关键就是虚拟机。虚拟机可以分为两大部分,从源代码到字节码的编译器和解释执行字节码的引擎。
总的说来,要实现Python语言,应该有如下理论筹备:1)高级语言编译的基本理论,包括词法分析,语法分析,语义分析和代码生成;2)Python对象模型的实现,要实现OO的重要特性,如继承。在实现过程中,以“一切皆对象”的思路进行,可以使问题得到一定的简化;3)执行引擎的架构。 首先说解释引擎的架构。这个就相当于JVM之类的虚拟机,主要工作就是一条一条地执行字节码。根据字节码的指令需求,进行一切操作,如算术操作,存储器的管理,对象的管理。因此,对象模型的核心部分就实现在虚拟机。要实现Python的动态类型,代价就是会在对象内产生比较多的冗余数据。所有类型的对象都是统一的内存模型,只是根据元数据来区分各个对象,通过统一的指针指向各自的成员列表。当然还有一个重要的参数,就是引用计数,这是垃圾回收的关键。另外,虚拟机还牵涉到一个字节码指令架构的问题。很多跨平台语言的虚拟机采用的都是堆栈架构的指令集,比如说JVM,也就是表达式的运算有点类似于逆波兰表达式的结构,这样的指令比较冗长,因为对内存的访问仅限制于堆栈顶部的几个元素。还有一种架构就是寄存器指令,这种架构的虚拟机理论上有无穷多个寄存器可以使用,这样指令就可以比较简洁灵活,任意一个寄存器都能随意访问,印象中.Net平台的虚拟机是寄存器架构的。Python的字节码规范表明,它的虚拟机也是堆栈架构的。但是我会选择的架构是寄存器架构,因为代码生成比较方便,任何一本教科书都是介绍寄存器代码的生成,所以,这也就意味着字节码的规范需要根据我的需要修改。
编译器部分就是按照龙书的经典描述进行。词法分析和语法分析采用parser generator ANTLR自动生成,在生成规则上需要下很多功夫。剩下的主要难点就在于代码生成了。要根据前面规定的字节码规范进行。由于前面的字节码规范要修改为基于寄存器的规范,所以代码生成也可以按照龙书上面的描述进行。
要做的事情还有很多,有点紧张了。 January 27 无题很久没有更新这个space了,主要原因还是懒,闲来没事,还是写一写.
这几天连着两个聚会,都是高中聚会,见到很多很久没有见过的人.我要去北京了,两位好友却要离开北京了,一个出国,一个工作.我要离开长沙了,一伙人却跑到长沙去深造...
七班的同学聚会让我感到非常陌生,毕竟只待过一年,后来还有很多人是新进去的.这个班很多人都变化非常大,男孩子都变得很帅了!很多人也学会了抽烟喝酒...各个都很"玩的转"的样子,看样子我是落伍了...
贴上一张高中九班聚会的照片.感觉我们高中越来越可怜了,被征了一大块地出去做马路,学生也似乎一届不如一届了... November 26 宏基,宏碁咦,这不是某个电脑的品牌吗?我们在acer的官方网站上看到的是宏碁,在其他地方看到的确实宏基,于是,我们就认为前者是后者的繁体,于是,宏ji这个品牌诞生了。
今天在网上看到一条消息,才发现,acer的创始人郁闷了,告诉大家碁其实不是“基”,而是“棋盘”的“棋”的异体字,所以,也该读“qi”了。
虽然这样也更有意义写,但是总感觉“红旗”没有“宏基”好听了 纠正一个“错误”我们经常说,“在windows下工作”,“在linux下”工作,某某软件是“linux”下的,某某软件是“windows下的”。突然想来,觉得从操作系统的角度说,操作系统只是对硬件的抽象,我们的所有工作都是在操作系统之上的,所以,我们应该说,在xxx上工作,xxx上的软件。
这么说很别扭,权当搞笑了 November 21 What does YAHOO mean?[转载]
Yahoo! The word was invented by Jonathan Swift and used in his book Gulliver's Travels. It represents a person who is repulsive in appearance and action and is barely human. Yahoo! founders Jerry Yang and David Filo selected the name because they considered themselves yahoos. Xerox The Greek root "xer" means dry. The inventor, Chestor Carlson, named his product Xerox as it was dry copying, markedly different from the then prevailing wet copying. Sun Microsystems Founded by four Stanford University buddies, Sun is the acronym for Stanford University Network. Sony From the Latin word 'sonus' meaning sound, and 'sonny' a slang used by Americans to refer to a bright youngster. Sony "Systems, Applications, Products in Data Processing", formed by four ex-IBM employees who used to work in the 'Systems/Applications/Projects' group of IBM. Red Hat Company founder Marc Ewing was given the Cornell lacrosse team cap (with red and white stripes) while at college by his grandfather. He lost it and had to search for it desperately. The manual of the beta version of Red Hat Linux had an appeal to readers to return his Red Hat if found by anyone! Oracle Larry Ellison and Bob Oats were working on a consulting project for the Central Intelligence Agency (CIA). The code name for the project was called Oracle (the CIA saw this as the system to give answers to all questions or something such). Motorola Founder Paul Galvin came up with this name when his company started manufacturing radios for cars. The popular radio company at the time was called Victrola. Microsoft It was coined by Bill Gates to represent the company that was devoted to MICROcomputer SOFTware. Originally christened Micro-Soft, the '-' was removed later on. Lotus Mitch Kapor got the name for his company from the lotus position or 'padmasana.' Kapor used to be a teacher of Transcendental Meditation of Maharishi Mahesh Yogi. Intel Bob Noyce and Gordon Moore wanted to name their new company 'Moore Noyce' but that was already trademarked by a hotel chain, so they had to settle for an acronym of INTegrated ELectronics. Hewlett-Packard Bill Hewlett and Dave Packard tossed a coin to decide whether the company they founded would be called Hewlett-Packard or Packard-Hewlett. Hotmail Founder Jack Smith got the idea of accessing email via the web from a computer anywhere in the world. When Sabeer Bhatia came up with the business plan for the mail service, he tried all kinds of names ending in 'mail' and finally settled for Hotmail as it included the letters "html" - the programming language used to write web pages. It was initially referred to as HoTMaiL with selective upper casings. The name started as a jockey boast about the amount of information the search-engine would be able to search. It was originally named 'Googol', a word for the number represented by 1 followed by 100 zeros. After founders - Stanford graduate students Sergey Brin and Larry Page presented their project to an angel investor, they received a cheque made out to 'Google Cisco The name is not an acronym but an abbreviation of San Francisco. The company's logo reflects its San Francisco name heritage. It represents a stylized Golden Gate Bridge. Apple Computers Favourite fruit of founder Steve Jobs. He was three months late in filing a name for the business, and he threatened to call his company Apple Computers if the other colleagues didn't suggest a better name by 5 o'clock. Apache It got its name because its founders got started by applying patches to code written for NCSA's httpd daemon. The result was 'A PAtCHy' server - thus, the name Apache. Adobe
November 12 封闭zhengsyao@163.com,使用gmail!封闭使用了6年的163的邮箱,使用 zhengsyao@gmail.com
了。原来的那个邮箱容量倒是一直在涨,原来还花了10万个泡币将容量扩充到2G。现在问题来了,发现突然每天100多封的邮件列表突然安静了,又发现原来
什么邮件都收不到了。调查一番,才发现邮件数量限制在5000了,再也不能收邮件了。一气之下,换了gmail,一个字,爽!功能强大,界面清爽,速度也
比较快。强烈推荐! November 04 关爱生命好可怕,这些症状我有好多啊!
November 02 关于找工作又是找工作的热潮,不过我们班找工作的不多,两三个的样子,有人欢喜有人忧。我相信忧的人现在一定很后悔,后悔当初没有打好扎实的基本功。到大四了,有多少人能够说自己在大学的时间过得很充实,能够认认真真实实在在踏踏实实地做了些什么。玩游戏很舒服,只是时间就这么悄悄地流逝了,流走了就没有任何后悔的余地了。
有人说,保研的人过着猪一样的生活。我也想提醒那些保研的兄弟们,三年的时光很快就会流逝掉,你们希望三年后的今天后悔吗?从今天做起吧,做该做的,不给以后留下遗憾。
顺祝小波这次好运,你还需要加油啊! 丑恶的利益之争最近班上有些比较郁闷的事情,也不想具体说是谁谁谁,就转下面这篇文章来抨击一下
|
|
|