Monday, May 28, 2007

改用Gentoo了

好久没写东西了,这段时间太忙了,但这段时间挺多东西值得记一记的,就慢慢来吧。

现在我开始用gentoo了,也算是早有预谋吧,但主要原因是我把ubuntu搞坏了。
前一阵子在windows下格了一个分区,重启以后居然grub坏了,于是用ubuntu的livecd引导,打算用grub-install恢复。因为不清楚grub-install的参数,就随便试了试,没想到它的杀伤力还挺大,直接把ubuntu的\分区搞坏了。我真是痛心疾首啊,我的ubuntu好不容易才配得让我满意的。现在也没办法了,只好重装,正好我也久闻gentoo大名,最近又出了gentoo 2007.0,于是把心一横,装起gentoo来了。

不得不说gentoo真是太复杂了,光是安装就花了我两个晚上。而且我还不是stage 3安装的,是直接用livecd的installer安装的(也就是非编译安装,直接拷二进制文件)。我直到装完了以后,才认识到gentoo的正统安装方式就是stage 3,基于网络和命令行的安装。这个图形的安装程序真的是非常非常烂(我就没见过这么烂的),不过这也不能怪他,毕竟gentoo的老用户都对这种图形安装没有需求。另外这张livecd也是一张budy cd,费了好大力气才把gentoo装上,一如所料的进不了X,把驱动改成vesa后进去一看,真叫一个丑,其实这就是gnome的标准界面,这时有点怀念ubuntu了,人家确实是花了工夫取悦用户的眼球的,而以gentoo的风格,肯定是不会管这种事情的。

gentoo最大的特点就是它几乎所有的软件都是用源码编译安装的(不开源的当然除外),同时它又有一套相当好的包管理系统——portage,相当于ubuntu的apt。这套系统不但给用户提供了最大的可定制性,而且还帮用户解决了恼人的依赖关系(想想看,源码安装的依赖关系比二进制包的依赖关系更复杂),真的丝毫不比apt逊色。用linux的总是免不了要安装源码,我以前在ubuntu下也装过几个,感觉太繁了,因为ubuntu没有源码管理的东西,安装的时候少了哪个库只能自己从网上找,装这个库的时候可能又少了那个库,如果同时用apt装了一个包,又用源码装同一个包,可能还会出些问题。反正在非源码安装的发行版下安装源码总是不太方便了。gentoo这样完全源码安装的很合我的胃口,虽然编译的时间比较久,但源码安装的好处还是很多的。比如说我编译了一把内核,现在启动速度明显快了很多。

目前还有好些问题没有解决,主要是一些比较底层的问题。比如显卡驱动装不上(直接导致支持不了宽屏),laptop-mode启动不了,声卡驱动没装,字体也不好看。这些问题以后再慢慢搞,现在至少可以在控制台下写程序了。

...
Read More

Friday, May 11, 2007

居然把VS2005搞崩了

学Windows API编程,照书上抄了一个例子,用VS2005,居然一编译就报错(是VS运行错误,不是我的代码编译错误)退出。

后来逐步排除,确定是资源文件中的菜单项名用了宽字符串导致的(L"..."),改成窄字符后正常编译。

目前对windows程序的字符编码不是很了解。在cpp里写的窗口标题什么的都是用宽字符的,为什么在资源文件里就要用窄字符呢?宽字符好像对应的是unicode编码,而窄字符是ascii。

看来VS还是挺多bug的嘛,这么容易就搞崩了。虽说我的代码可能写得有问题,但他应该报错而不是崩掉啊。我的代码作为他编译器的输入,无论写成什么样都不应该让编译器崩掉。不过也可能崩的是IDE而不是编译器,我还没试过命令行编译这个问题代码,也不想试了。

...
Read More

Thursday, May 10, 2007

O(n)时间内查询n*n网格的局部最小值

Source: Homework of Theoretical Computer Science


Description:

Suppose now that you're given an n*n grid graph G. Each node v is labeled by a real number x_v; you may assume that all these labels are distinct. A node v is a local minimum if the label x_v is less than the labels x_w for all nodes w that are joined to v.
You can determine the value x_v by probing the node v. Show how to find a local minimum of G using only O(n) probes to the nodes of G.


Solution:

First let's think about this, we start at an arbitrary grid, if one of its adjacent grid has a smaller label, then we move to this grid, and repeat the same process. Finally we will reach a local minimum grid. We call the path we are walking through a "decreasing path". This is a simple way to find a local minimum, but the probes we need is O(n^2) instead of O(n). However, we will see this idea useful later.

Now let's consider a subgraph of the G, suppose it is an rectangular grid graph, and v is the smallest grid of the grids on the border of this rectangle. Suppose v' is the grid adjacent to v and inside the rectangle, if v' is smaller than v, then we can conclude that there exist a local minimum inside the triangle. This is because if we can alwasy a "decreasing path" starting from v', ending at at local minimum. This decreasing path will not go across the border of the rectangle, since v' is smaller than all the grids on the border. So, base on this conclusion, we can divide and conquer the problem.

We may assume that the outer of the G has a very large label. At the first step we probe all the grids of the column at the very middle of G. The column divides the graph G into two n*(n/2) rectangular subgraphs. Suppose the smallest grid of the column is v_1, then we probe the two neighbors of v_1 which are not in the same column of v_1. If the two grids are all larger than v_1, then v_1 is a local minimum. Otherwise, at least one of the two neigbhbors is smaller than v_1, so we can determine which rectangular subgraph definitely contains a local minimum, ccording the conclusion we just worked out. And at the second step, we probe all the grids of the row at the very middle of the rectangular subgraph, this row divides the subgraph into two (n/2)*(n/2) square subgraphs. Suppose the smallest grid of the row is v_2, if v_2>v_1, then the decreasing path starting at v_1 will not go across the row, so we choose the square subgraph which contains v_1. (At this situation v_1 will not locate at the common corner of the two squares, since v_1's neighbor is smaller than it and v_2 is larger than it.) If v_2<v_1, then we probe the two neighbor's of v_2 which are not at the same row of v_2, and use the same way as we due with v_1, to select one square subgraph, or assert v_2 itself is a local minimum. (At this situation v_2 will not locate at the common corner of the two squares, since v_1 is the smallest grid of the column and v_2<v_1.) Now we have shrunk the graph in to a (n/2)*(n/2) subgraph, with 3n/2+4 probes at most. We can apply the same process to the subgraph and finally we will get a local minimum. So the total number of probes will be T(n)=T(n/2)+3n/2+4=3n+4log(n)=O(n).

...
Read More

Tuesday, May 8, 2007

转一个humor:惊人的“万有斥力规律”

今年59岁的彭大泽在6年以前才刚刚有了一个幸福的家庭。妻子小朱和5岁的女儿彭思宇是他目前全部的精神寄托。“他为人忠厚、善良,而且有很好的学问,讲话幽默,所以我才选择嫁给他。”妻子小朱羞涩地说道,“对于他的"理论研究",我绝对全力支持。” 彭大泽紧紧握着妻子的手,骄傲地说:“在这个领域(指天文及物理),我是专家。” 1979年,32岁的彭大泽还是四川省图书馆的一名普通的图书管理员,因为工作的关系,经常在工作之余看一些科普知识的书。就是在那个时候,彭大泽从书上了解到300年前,世界上有一个名叫牛顿的人,因为被苹果撞到了头,而发现了“万有引力规律”,由此,彭大泽对天文及物理产生了浓厚的兴趣。没有上过正规大学的他,经常从一些科普书籍上学到他想要的知识。
“那年7月28日晚上11点半,那个时间我记得很清楚,并且终身难忘,”彭大泽说,“我天才般地发现了"万有斥力规律"。” 彭大泽介绍说,当天晚上正在播放电视剧《屈原》。从屈原被杀,他联想到了战争,从而又联想到了手榴弹。 “手榴弹为什么能炸死人呢?因为手榴弹会爆炸,爆炸那一瞬间的冲击力很强,所以可以炸死人。”彭大泽扶了一下鼻端的眼镜,双眼迸射出兴奋的光芒,说,“请问,是手榴弹的弹片向人有一个推力,还是人自己将弹片吸引过来炸死自己呢?答案很简单,绝对是手榴弹对人有一个推力,我立刻想到,其实太阳对地球的作用是一样的。”彭认为,太阳就像一个巨大的“手榴弹”,每时每刻都在不断地爆炸,并且发射能量。而我们生活的银河系中有1500亿个太阳,地球要承受来自1500亿颗太阳爆炸时所产生的斥力。“这么多太阳都在爆炸,都在产生斥力,你说,我们人类能不安稳地生活在地球上吗?”彭大泽说,“都说地球有引力,引力来源于地心。可是至今为止科学家都没有发现引力源在哪里,凭什么认为地球有引力呢?况且,地心是一个几何概念,一个小小的点,这样一个小小的点,它有何德何能可以吸引住地球上的土地、人类、水还有天上的空气和飞鸟?所以,我认为地球上根本没有引力,地球上的一切之所以可以存在的原因在于,那么多个太阳爆炸产生的斥力,将这一切压在了地球上。这是我的"万有斥力规律"的核心内容。”
                         
当代的哥白尼
                         
彭大泽在家中的后院搭建了一间小小的储藏室,里面放满了从图书馆里“借”出来的书,有的已经铺满厚厚的灰尘。墙上镜框里镶满了写着英文的各种文件和照片。
 “这些都是国外的专家给我寄来的。” 彭大泽自豪地说,“我当时发现了"万有斥力规律",1980年的时候给中科院的领导写信,可是他们把信还有我准备的资料都给我退回来,那个意思好像认为我是个疯子。没有办法,在那种情况下,我只好给国外的研究学会写信,希望得到他们的认可。”记者在彭的家中看到,包括美国宇航学会、美国阿拉斯加科学院在内的各国各类科学院、研究所都曾给彭大泽回过信。
1982年3月,德国专利局局长访华,受到了当时的国家主席李先念同志的接见。当新闻里的播音员念到这位当时的专利局局长的大名时,彭大泽吃了一惊,原来,自己家里竟然珍藏有一封他给自己写的亲笔回信。信中用英、德两种文字写道:“你的发现是一个有创意的、有趣的见解。”
彭大泽扬了扬已经发黄的信纸说:“外国人说有趣其实就是不赞同的意思,不过,他承认我的见解很有创意,这就足够了。我需要的不是认可,因为真理总是需要时间去证明, 1543年,哥白尼提出日心学说,那么多人认为他是疯子,还受到当时教会的排斥,跟他比起来,我受点冷遇又算什么?要知道,每天跟我在一起进行神交的人都不是现在这些人,都是哥白尼、伽利略、布鲁诺这些人,他们跟我才是一个档次的。” 彭大泽一直将自己自喻为"当代的哥白尼",为了坚持真理,不畏惧受到别人的冷遇。
为了将自己的“万有斥力”理论向世界上更多国家的人进行宣传,彭大泽一直致力于自学英语。记者看到,仅有高中学历的彭大泽不但可以很流利地读出那一页一页发黄的信纸上的英文来信,甚至还用英文在一本名为“University Microfilms International”的学术刊物上发表了几百字的论文。“对别人来说学英语很难,但对我来说,因为学以致用,所以非常容易。除了因为是自学,发音不是很准以外,读写听对我来说都没有问题。”彭大泽自豪地说。
                         
留长发反击歧视
                         
1981年,美国宇航学会给彭大泽寄来了邀请信,请他前去美国参加学术交流会。当时每月工资只有42块钱的彭大泽因为无力支付庞大出国费用,便向他工作的图书馆申请资助,但是却受到了领导的拒绝。无奈之下,彭大泽又写信给联合国教科文组织,希望得到他们的资助。联合国教科文组织同意给他提供前去参加学术交流的路费,但是却需要中国官方提出申请。彭大泽便再次把申请交到了上级领导的手里。
“领导非要我写上,"在他的领导及关怀下",我觉得很奇怪,明明是我自己想出来的东西,为什么要写成在他的关怀下?我坚决不同意,结果,他们不仅不批准我出国,还说我"招摇撞骗,向国外要钱"。” 彭大泽十分愤懑地说,“但是,我有一种强烈的历史责任感,我完全知道我的此举是在为国家做贡献,历史将因我而改变,真理最终会得到人们的承认。但是,当时那种情况下,我无力反抗,我只好用留长头发这样的行为来进行无言的反击。不仅在我们单位,可能在整个成都市,我都是第一个留长发的男人。”
1981年11月,在四川省图书馆的职工大会上,图书馆的领导宣读了当时的四川省省长鲁大东同志的信,信中措辞严厉地指出“四川省图书馆某些同志,不认真工作,甚至还不断向国外写信,到处招摇撞骗,伸手要钱。”当宣读这封信的领导话音一落,彭大泽立刻站起来,向全馆职工说,“同志们,刚才省长那封信里说的人就是我。但是,我觉得省长所说的话不属实,所以,我也给省长写了一封信,以表明我的清白。”
彭大泽在全馆职工诧异的眼神中读完了自己的信,他在信中强调,“我认为我的研究工作是对祖国的有益贡献,我为之付出的劳动应该得到承认和尊重”。念完信之后,全场一片寂静,没有任何一个人发出任何声音,彭大泽扫视全场,再次说,“刚才那一遍我读得有点快,为避免大家没听清楚,我再念一遍!”
说到这里,彭大泽笑了笑,并且承认自己当时是年少冲动的做法。“因为自己是单身汉,没有负担,父母都健在,每个月只需要给他们交纳3块钱,包吃包住。我自己每个月的40多块钱的工资基本上都用来给国外研究学会寄信了。”
基于彭大泽种种"出位"的表现,图书馆的领导在大会上宣布,让馆里的女青年“不要跟他谈恋爱,因为他不安分守纪。”直到1999年,53岁的彭大泽才跟现在的妻子小朱认识,并相爱结婚。
                         
留给时间去"证明"
                         
59岁的彭大泽有一个非常活泼可爱的女儿,名叫彭思宇。他说,跟泸州那位自行研究人体生物磁场的李铁军(见本报第28期报道)一样,他们都有各自的理想。李喜欢研究人体生物磁场,因此给女儿取名叫李婧磁;而他自己因为喜欢研究宇宙,所以为女儿取名为彭思宇,意思是思考宇宙中的问题。同时,他们两人都是在53岁的时候生了一个女儿。
当问及5岁的彭思宇,人类为什么可以在地球上站立行走时,她马上会回答,“是因为星星把人压在了地球上。”一旁的妻子小朱微笑着点点头,然后问女儿,“为什么东西会掉在地上?”小思宇仍然回答绝对的标准答案,“是因为星星压的。”
记者在彭家中看到,冰箱上、柜子上到处贴满了小纸片,而小纸片的背后记载着在女儿小时候他如何教导她学会宇宙中存在的“万有斥力”的故事。
从报上得知泸州纳溪区李铁军为了研究人体生物磁场而在家中的墙壁上画满星座图的故事后,彭大泽深受感动,一次又一次地向李铁军打去电话,询问他的生活及研究情况,并大有惺惺相惜,相逢恨晚的感觉。
“像我们这样散落在民间的科学研究者真的很不容易。中科院那些傲慢的、自诩为科学家的人根本看不起我们,认为我们是疯子。”彭大泽说,“对于我的"万有斥力规律",其实,我相信他们看了以后也会觉得有道理。但是,我认为世界上没有引力,只有绝对的斥力,这违背了恩格斯的辩证法理论;再者,牛顿在人们弄清楚银河系实质的前300年就天才般地算出了g这个物理量,他巨大的光辉使得当代这么多科学家对地球上没有引力这个事实视而不见。我就是要做当代的哥白尼,推翻"万有引力"这个错误的科学概念。”
彭大泽用原德国专利局局长回复他的那封信里的一句话来概括他的“万有斥力理论”,“就让未来和时间去见证一切吧。”尽管到了退休的年纪,但信心十足的彭大泽仍然坚信,真理掌握在少数人手中,“我是惟一正确的人。"

===============以下部分为原创==============
读后感:
这种民科见多了,早就humor不起来了,不过这个人的创意不错,似乎艺术家之类的靠创意吃饭的人神经都不太正常。
这个人又一次证明了:当一个群体的数量足够大时,总会产生各种各样奇妙的个体。

...
Read More

Saturday, May 5, 2007

在latex中插入伪代码

今天写理论作业需要写伪代码,查了一下,有几个名字以algorithm开头的宏包都是干这个的,有algorithm2e,algorithmicx,algorithms。功能都差不多,但好像最后一个最新,我就用它了。

algorithms由需要include两个宏包,分别是algorithm和algorithmic。这两个宏包分别提供两个环境,名字和宏包名一样。这两个环境之间的的关系类似于table和tabular之间的关系。具体细节见帮助文档。

效果图:

...
Read More

Friday, May 4, 2007

关于tab路径补全失效

ubuntu 7.04
路径中带空格的,用sudo就没法tab补全下一级。
比如 sudo cd /media/hda7/Program\ Files/< tab > 无效
但不用sudo则没问题。

解决办法:
把 /etc/bash_completion 中 _command 函数里的

# split current command line tokens into array
COMP_WORDS=( $cline )

改成
# split current command line tokens into array
for (( i=1 ; i<=COMP_CWORD ; i++)); do
    COMP_WORDS[i]=${COMP_WORDS[i+1]}
done

...
Read More

Thursday, May 3, 2007

My 5.1 Vacation

generally i only post tech notes in this blog, but this time i will try to write something else. it's about my life, my notion, and my emotion. seems i've never express myself like this before, and i don't know why i m doing this now. maybe i m just feeling tired and oppressed so that i want to write something down for relaxation and abreaction. since this essay may be somewhat private for me, and i dont want so many people to read it, so i decide to write it in english. i hope my poor english can effectively hinder most unwanted people from reading this essay. if you are not so interested in me, i promise you will find no fun here, and i suggest you leave before wasting you time here.
it's 5.1 festival now, the meaning of this festival is "working people's day". i don't think i'm a "working people", but this festival do bring me a 7-day-vacation. All of my roomates have gone back home or traveling, leaving me alone in the dormitory. sometimes i desire quiet and peace, but this time i feel lonely and anxious. at the very beginning, i decided to study all the 7 days so that i will have no spare time in feeling bad. but such a plan aborted, as usual. actually in the day i really went to my haunt of classroom, but i found the classroom will be closed since May 1st to May 4th. i am so disappointed so i went back to my dormitory. i thought i can also do my job well in the dormitory, but i was wrong. Even when there were nobody else in the dormitory, i still can not concentrate on my work, perhaps that's because it's too comfortable and too silent in the dormitory. All these days i had no efficiency, i just kept sleeping all day. even when i was awake in the noon, i still don't want to get up of my bed. this circumstance is just like the summer holidays and the winter holidays: in the beginning i don't want to be decadent, but at last i am.
other people may expect the 5.1 vacation, but i do not. i'm a guy that like things and environment to be invariable. i just want the tough-study-time to continue during the hole semester, so that i can keep working till the summer vacation, and then have a good rest. while now that i've got a 7-day-vacation, i cannot keep myself from playing and resting during this short vacation, but soon after this vacation i m still facing the tough school work, and even the midterm exam! i can not change my status so rapidly. so during this short vacation, i feel nervious. especially there are still so much homework waiting for me, nearly all the teachers have doubled their homework since the vacation. i have just finished the experiment of THE PRINCIPLE OF COMPILE, but there are still homework of THE THEORETICAL COMPUTER SCIENCE, which is the most troublesome homework and now the quantity of which is doubled. still there are midterm big task of VC waiting for me, and the experiment report of COMPUTER NETWORKS, i don't know how i can cope with these mess. every time i try to start working but i just can't. my spirit is just not the same with which in the study day.
i am not just staying in my dormitory these days. for the purpose of relaxation, i bought myself a pair of roller-skate shoes, and that's the first time i went out of our campus this semester. i m not that like sports, you know, i just want to find myself some interest. i do feel a little bit funny in playing the roller-skate, but after that i feel more tired then funny. of coure, any pleasure would take a cost. i most appreciate the precise of this little mechanism, which is so efficient, make us moving so fast and efficiently. i always believe machines are better then human being, so our job is to make machines work for us, but not to do the work ourselves which machines can do. maybe one day machines can design machines themselves, then it's time for humans to be extinct. who knows, but i m really expecting this day.
people used to think i have some psychological problems, maybe they are right. don't be afraid, i never hurt the others (not physically, at least). i have to say i am somehow different from the ordinary people, but i don't feel wrong with this, since i don't want to be ordinary. whereas when i came to this university, i found everyone is abnormal, nearly all of them are eccentric, so i become ordinary here. i dont know whether this place is good for me, but day after day when i live with these abnormal guys, i feel harder to communicate with those guys outside the campus, i.e., those ordinary guys. here i really met some guys that i admire, they are far more excellent than me. maybe that's why i m feeling so anxcious all the time, but in the other hand, i really feel exciting to meet so many excellent guys. i am paradoxically, am i?
after i came to the university, i've learned lots of things, lots of knowledges, and myself have thought alot. sometimes i like to talk about some philosophy with my roomates. sometimes i feel lucky and proud that i m cleverer than the ordinary people and i have more knowledge. but i find that the more knowledge i gain, the more unhappy i will feel. when i was in the middle school, although the teachers didn't like me, didn't agree with me, and the hole school gave me greate preasure, but i was still optimistic. my thought was so simple then, i believed i am more excellent than the others, and i believed that i will go to the best university in china. now that my dream comes true, but i still feel unsatisfied. especially when i know more about the science, the society, and the world, i find things are not so simple as i used to think. i feel lost, i don't know what shall i do. those uneduated people can live so happily, they never think about the world, they don't know the philosophy, the don't know science, they live in ignorance, but they are happier then me. how ridiculous it is!
now i found my essay is completely out of topic. never mind, as i said, i just want to write some down, randomly. that's all today, maybe i will write another essay some day.

...
Read More

Wednesday, May 2, 2007

原来Ubuntu的源里就有MS的字体

以前我还专门从windows下拷过几个英文字体到ubuntu,没想到ubuntu的源里就有。真想不明白为什么会有这种事,难道这些字体没有版权吗?不管了,反正我是中国人。
这个包叫msttcorefonts,顾名思义,都是ms的truytype英文字体,包括times new roman,courier new等等。

sudo apt-get install msttcorefonts

这个包只有400K好像,但实际上它是装完了再从sourceforge上wget字体文件的,还好我有直通车。

字体装好以后马上就能用了,我试了一下,效果都不错,但AA字体我都不喜欢,因为看起来发虚,容易眼疲劳,因此桌面的英文字体我还是用文泉驿的点阵字,但装了新字体毕竟就多了新的选择,说不准哪天会用上。

而终端下用的等宽字体,以前我一直没找到很满意的,这回有了Courier New,真是亲切呀,这可是经典的编程字体呀。我试了一下,Courier New不如Courier 10 Pitch好看,而Bitstream Vera Sans Mono也挺好看的,这两者挺不好决择的。

对比一下。
这是Bitstream Vera Sans Mono


这是Courier 10 Pitch


最后还是决定用Courier 10 Pitch啦,一是因为它太经典啦,二是因为它看起来一点也不发虚(虽然它也是AA字体),可能是因为字体比较粗的缘故吧。而Sans Mono放桌面上看还不错,但是在终端这种高尚的地方(在终端下coding更是一件神圣的事),不免显得太俗气,难登大雅之堂。

另外就是觉得装完这个包以后各种AA字体都不怎么发虚了,不知道真是这个包的作用,还是心理作用,也可能是看久了习惯了。

...
Read More

Tuesday, May 1, 2007

关于Ubuntu的待机问题

Ubuntu的待机问题好像是个普遍问题,台式机笔记本都无法幸免,好像和显卡有关。而且这方面的问题多种多样,我碰到的有下面两个,这两个应该也是待机问题中最常见的两种了。
一是无法待机(suspend),二是待机了无法唤醒(resume)。

1. 无法suspend的解决办法
这多是由于没有开启laptop_mode造成的。关于如何开启laptop_mode,参见
启用laptop-mode的方法
当然,在这之前最好检查一下acpi是否正确配置。确保 /etc/default/acpi-support 中有下面几条
ACPI_SLEEP=true
ACPI_HIBERNATE=true
ACPI_SLEEP_MODE=mem
我没开laptop_mode时无法待机,开了以后可以待了,但是待完了起不来。解决方法如下。

2. 无法resume的解决办法
我的症状是唤醒的时候屏幕黑屏,按什么键都没用(包括power),但据硬盘灯推测此时系统已经resume了,只是屏幕无显示。这显然跟显卡方面有关,在网上找了一篇解决这个的,主要要干三件事:

  1. In /etc/acpi/sleep.sh, as second line, add the line sudo chvt 1. This forces a switch to the text console before standby.
  2. Likewise, in add to the very end of the file /etc/acpi/resume.sh the line sudo chvt 7.
  3. Finally, the perhaps most important change goes into /etc/default/acpi-support. Change the line POST_VIDEO=true to read POST_VIDEO=. This was the point when it started working on my system.

经我尝试,第3条才是关键,前两条都在我这没必要做。 我把 /etc/default/acpi-support 的 POST_VIDEO=true 的true去掉就可以正常resume了。

附:一些背景知识。
来源:http://kw-gift.com/blog/index.php?entry=entry060928-105807
linux的ACPI定义了不同的睡眠状态,常用的有
S1:STOPGRANT
供给停止,CPU Halts,由CPU停止而引起的相关组件一起停止运作,相当于WINDOWS的Standby[待机]
S2:类似于S3,系统保留状态,当前并没起用此状态。
S3:Suspend to RAM
挂起到内存,相当于WINDOWS的Sleep[睡眠],注S3当前不支持 Kernel 2.4.x。
S4:Suspend to Disk
挂起到硬盘,相当于WINDOWS的Hibernate[休眠],注S3当前不支持 Kernel 2.4.x。
S5:Soft Off
关闭系统,相当于WINDOWS的Shut Down[关机]
关于SlEEP状态 的更多祥情请参况:http://acpi.sourceforge.net/documentation/sleep.html

怎样查看自已的laptop支持那种睡眠状态?
方法1:cat /proc/acpi/sleep(kernel 2.4系列适用)
在我的laptop返回如下结果 :S0 S3 S4 S5
方法2:cat /sys/power/state(kernel 2.4系列适用)
在我的laptop返回如下结果:mem disk
说明我的laptop绝对支持支持S3,S4状态

...
Read More
 
/* google analytics */