goddamn del!

经过几天奋战,终于把调度部分差不多搞定了.正在十分放松的时候,我想删除一些零时的输出文件,类似于residual?.res。

结果我使用的命令是del res*,郁闷的事情发生了。Windows并不区分大小写,源文件中有一个Registquest.java,活活也被删除了。

当场就急了,这可是我自己写的类啊,世界上独一无二的!没办法,到ark上下载几个恢复软件,什么EasyRecovery、EasyUndelete…

但是还是没有找到那个文件,只是找到了一个不久之前的版本。没办法了,只能凭印象添加代码了。还好,这几天对这个类添加的代码并不多,一会儿就搞定了。汗……

今后应该写一个工具,在eclipse编译的时候,直接就cvs上去,这样每次都不会错了。

patching…

改人家的代码真是不容易!

毕设的任务是将一个差不多完成的项目中的一个功能用一个算法重新实现。基本上要对50%的代码进行重写。

最可恶的是需要对原来的功能进行扩展。添加好多数据结构和处理方法,放到现有的类中,实在放不进去的话只有新建一个类,搞得现在整个系统很难看。

现在编代码就像在给一个人贴创口贴,这里一个,那里一个,太e心了。自己先吐一个先!

java域名解析导致的神奇现象

一个程序,要求获得本地IP地址:

[coolcode lang=”java”]
import java.net.InetAddress;
import java.net.UnknownHostException;
public class NsLookup {
static public void main(String[] args) {
try {
InetAddress address = InetAddress.getLocalHost();
System.out.println(address.toString().split(“/”)[1].toString());
String name = address.getHostName();
System.out.println(name);
InetAddress[] addresses = InetAddress.getAllByName(name);
for(int i=0;i<addresses.length;i++){

System.out.println(addresses[i].toString().split(“/”)[1].toString());
}
catch(UnknownHostException uhe) {
System.err.println(“Unable to find IP”);
}
}
}
[/coolcode]
在windows下很正常:
173.26.100.174
ibmtc-marvel
173.26.100.174
192.168.0.1

linux下出现问题:
46和18的结果为:
127.0.0.1
ftp.cs.hit.edu.cn/ibmtc
127.0.0.1
即只获得了本地的环回地址,而没有获得其他的IP

而19更加神奇:
202.118.250.20
dns.cs.hit.edu.cn
202.118.250.20
出来的IP地址是另外一台机器的,不是何故

这个问题似乎与一台机器的IP个数无关,单IP和多IP的主机都会出现这个问题.有没 有兄弟懂这个的?

硬盘安装FreeBSD

经过一顿奋战,终于搞定了。

这次用的不是纯的grub引导,而是用了一个网友做的工具。感觉挺不错的。

只不过是FreeBSD的安装比较另类,特别在分区那里停了好久。Linux和Windows的分区只有一步,但是FreeBSD却有两步,一步分区,一步定义label。具体的作用好象是前者是划分可用的空间,后者是在这些可用的空间中定义系统的不同挂载点。

之后就比较简单了,一路安装下来就基本成功了。

硬盘装debian

今天在实验室里在一台机器上装debian。原来的安装盘已经读不出来了,实验室里的又是很老的版本,实在是没办法了,只能试一试试用硬盘安装了。

从梁英那里要了一个grub for dos(已经放到ibmtc@46:/tools/linux下了,如果校外的朋友可以给我发邮件,网上应该也有。) 那个版本不错,直接将所有的文件复制过去就可以用了。

主要文件有bootgrub、grldr、initrd.gz和vmlinuz。

先将bootgrub、grldr 复制到C盘即可。之后修改一下系统盘的boot.ini 添加c:bootgrub=”Grub for DOS”
还有两个引导文件initrd.gz和vmlinuz,但是这两个文件不要从debian的安装iso文件中获得,它们好像引导不起来。 将这两个文件复制到FAT格式的分区中,NTFS的ms访问不了。在这里,我假定放在D:boot目录下了。

当然别忘了将debian的安装iso文件复制过去,我放在了D盘的根目录下。
之后,重启机器。出现Windows的启动菜单 ,选择“Grub for DOS”。此时进入了Grub了。我们输入

grub>kernel (hd0,4)/boot/vmlinuz root=/dev/ram ramdisk_size=20000 devfs=mount,dall
grub>initrd (hd0,4)/boot/initrd.gz
grub>boot

这样就启动了,之后,启动的系统会寻找硬盘上的iso文件,由于之前我们存放了iso文件,于是就直接进入了安装界面了。具体安装步骤就不说了,一路平安。

但是装完重启之后就进不去X了,当时就郁闷了。日志说是

(**) Option “Device” “/dev/mouse”
(EE) xf86OpenSerial: Cannot open device /dev/mouse
No such device.
(EE) Generic Mouse: cannot open input device
(EE) PreInit failed for input device “Generic Mouse”
(II) UnloadModule: “mouse”
(WW) No core pointer registered
(II) XINPUT: Adding extended input device “Generic Keyboard” (type: KEYBOARD)
No core pointer

改了好几次,/dev/psaux,/dev/mouse,dev/input/mice都试过了,其他安装xorg的机器的配置文件拿来看,结果一点问题都没有。

搞得有点莫名其妙了,最后,发现机器太新了,IBM的机器的鼠标都是USB的,没有PS2的。而且启动的时候有一个warning,由于kernel是2.6.8,所以udev没有启动,而很可能是因为udev所以系统没有识别usb鼠标。

于是我决定重新编译内核,在这个决定作出后的第三秒,我欣喜的发现,我用的是testing源,并且testing中有2.6.15-1的现成内核。说实话,从这一点,我就没有理由不爱debian。

apt install一下,一切OK,又见到了那可爱的Gnome。明天看看能不能硬盘装一个FreeBSD 🙂

A Saint in Computer Science

If you ask me if I am religious, I’d say yes. I believe in Church of Emacs, a church exists in the Computer Science.

Two years ago, I desperately fell in love, with GNU/Linux. That is not a girl’s name, but an Operation System. Maybe that is why I am still single.

Like most computer science student, I don’t like Microsoft and its highly-cost, unstable, dangerous product – Windows. How many of you can afford 900$ for a Genuine Windows and Office? How many of you have ever pressed Ctrl + Alt + Del after your Windows fails to response?

In our mind, Bill Gates is a greedy, rude king in the computer world. As a result, when we talk about Microsoft, we use the abbreviation M$ instead of MS because they think about money all day. And we love the phrase “Kill Bill”, the name of a movie.

However, Richard Stallman, a genius from Harvard and once working at an Artificial Intelligence Lab in MIT, doesn’t want to kill Bill, he does it in a noble way. In 1984 he set up the GNU project, a project of a collection of free software.

In Stallman’s vocabulary, ”Free software” is a matter of liberty, not price. To understand the concept, you should think of ”free” as in ”free speech,” not as in ”free beer.” Hard to understand, isn’t it? That’s why we call it GNU philosophy. But one thing is clear that Stallman is a warrior for freedom, like Wallace in the movie Brave Heart. But I guess Stallman could not shout the word “Freedom” as loudly as Wallace did.

I think Stallman is a missionary spreading the faith of freedom all over the world more than a hero fighting against the evil Microsoft Empire. He calls himself Saint IGNUcius — a saint in the Church of Emacs. Emacs is the most famous free software developed by Stallman.

As a saint, Stallman often gives speeches to his believer, like students, professors, engineers and his friends. Look at the photo, once he put on a black robe made by a plastic grocery bag and placed a yellow computer disk on his head.

“I am St. Ignucius of the Church of Emacs,” said Stallman, raising his right hand in mock-blessing. “I bless your computer, my child.”

The audiences’ laughter turned into applause after a few seconds.

Then he continued, “Emacs was initially a text editor; eventually it became a way of life for many and a religion for some. We call this religion the Church of Emacs. To join the Church of Emacs, you need only say the Confession of the Faith three times:

    There is no system but GNU, and Linux is one of its kernels.

To be a member in the Church of Emacs doesn’t require more than a life of moral purity. Get rid of the evil Windows from your computer and then install a wholly free operating system. And then you must install only free software on top of that. If you live by it, then you will be a saint in the Church of Emacs.

Soon the free software movement booms all over the world, volunteers devote themselves to the great project to build the church of Emacs. Everyday Stallman has to read dozens of letters about release news, bug reports and progress of some software.

After I read the story of St. Patrick, I was always wondering, was Stallman doing the same thing like St. Patrick. Stallman just does it in an electronic way. He is a scientist, hacker, philosopher, and saint. He does research in Artificial Intelligence Area. He is the leader of hundreds of thousands engineers. He creates and spreads the GNU philosophy all over the world. He’s been to China, Brazil, Singapore, Switzerland and many other places.

So what would you say? Oh my God? Yeah, he is my god, too: The godfather in the church of Emacs.

St. Ignucius

LFS on iPod

1G的iPod的确有点大,呵呵.My Music总共才1G多一点.基本上全放进去了.前几天看到了有人把Linux装到了ipod上,的确很爽啊.

我在想我也搞一个系统,但是不同的是,我的系统是一个启动系统,其实就是一个LFS 。(谁叫我的shuffle没有屏幕呢,不然的话也装一个嵌入式系统,呵呵)

于是,就看起一些LFS的资料来了。原来想象做一个启动系统挺简单的,无非就是编译一个内核,再加上一个根文件系统。以前Linux0.11就是这样搞的,只不过当时需要将内核放在磁盘的开始位置,所以比较麻烦,但是现在好办了,直接用grub设置一下就OK了。

但是现在真的做的时候发现有点麻烦,由于每一个命令(如ls,bash等)都是静态链接的,所以需要重新编译一下。Juses,好多文件啊!

慢慢来,今天先编译内核,明天编译工具。 争取早日完成我的LFS on iPod Shuffle!

菜鸟的痛

在linux论坛上逛,老是看到新手发文章求救。例如,我的X进不去了,我的软件XX不能用了,诸如此类。结果回帖的不是让他回去看README和INSTALL,就是说google XX。

没看到这种回帖,都不禁想对那个人说,你说的不是废话吗?排除灌水的可能,那么回这种帖的原因就是这个人以前看过,却不记得了;或者就是根本不知道。

有人说,我回这种帖是因为我是菜鸟的时候别人也是这么回我的。这就太可悲了,我想到了古代农民起义。农民造反是因为统治者压迫的太厉害了,结果胜利了,自己成了统治者,又开始来压迫别的农民了,你说他们可不可悲?举这个例子不太合适,自由社区没有统治和被统治的人,但是表达的意思却是一样的。己所不欲,勿施于人。自己受够了师傅体罚的苦,回头当了师傅,又开始体罚徒弟了。难道除了让菜鸟们经受九九八十一难才能用上一个操作系统或一个软件吗?没必要,Linus都说了,Just for fun。使用自由软件在于享受,在于兄弟们的互相帮忙,而不是在于别人冷冷的一句“google it”。
有人说,这是一种自由的精神。自己探索,自己解决。但是别忘了,在社区中,帮助别人才是最大的精神。 不是每一个人都要成为hacker的,很多人是抱着好奇的心理来用的,如果你给出这种态度,人家不都被你吓跑了吗?
谁都知道装软件要看INSTALL和README,也都是到google总能找到一点出错的线索。但是问题是INSTALL和README读起来不是那么容易的,正解可能在google 的top 100之后,代价是你花了一个下午,经历无比的郁闷,终于搞定了。当然很可能并不知道是为什么,自己只是按别人说的改了一段代码。更糟的情况就是根本无解,或者没有找到答案。

时间就是生命,效率就是金钱。如果只是为了一个影响较小的问题花费大量的时间,甚至成为一个瓶颈,那就太得不偿失了。

Linux 已经不是当初那个hacker的玩具了,现在已经开始大众化了。IBM可能会全面使用linux,政府机构也开始使用linux。所以Linux抗衡Windows的很重要的一点就是它的可用性和易用性。用户如果为了要解决一个问题而花去一小时、一个下午甚至使一个月,谁还会来用你的东西?

现在Ubuntu很火,你只要用一下就知道为什么了。以前Linux下的字体汉化、输入法scim和fcix、xmms等这些老大难问题,在Ubuntu中都得到了很好的解决。为什么?你只要看看他们的官方网站就明白了,如果你的发型版的帮助能做成那样,那你的用户明显就会增加。

我认为Linux推广的下一步,重点不是在功能、性能的增强上,而是应该在用户体验上。用户能在最短的时间内,能够使用并熟悉你的系统。当然,考虑到软件开发的分布合作的困难性以及测试工作的贫乏,做到真正傻瓜、简单并且强壮可能并不简单,但是毕竟Ubuntu已经走出了一步,我们没有理由不相信它会做得更好。

真想对那些回帖的人说 ,下次你回帖的时候,能不能言简意赅的点出问题所在,说google it的时候,你能不能先google一下,顺便给出一个好用的url。这样,自由社区才能越聚越大,希望Linux不仅是资深黑客的乐土,也能成为居家人士的工具。

ad for gmail

刚才在用gmail的时候,无意中发现了界面右边的广告好像与邮件的题目有关.试了几次,果然如此.

比如,题目是”祝XX生日快乐”,广告就是送花之类的.如果题目是linux内核之类的,那广告就变成了一些关于linux的技术文章.

看来传说中的google 针对不同用户投放的不同广告还真的很不错.当然也有失效的时候,例如题目是星座的话,广告好像是一些无关的了.哈哈

扫盲:-zilla的来源

如果你上过网,你应该知道mozilla。代表作为mozilla firefox。
如果你开发过比较大的系统,应该知道bugzilla

诸如此类,很多软件以zilla结尾。你知道这个东东是哪里来的吗?

其实这是起源于电影。1954年,日本第一部哥斯拉(Godzilla)电影诞生。从此作为一种经典的类型片——怪兽(Monster)片而成为热潮。 随着时间的推移,这种小成本低制作的的电影非但没有被观众厌倦,反而是借着电视机的普及进入了大众的荧屏。第一部哥斯拉与其说是怪兽片,不如说是灾难片更为合适。对人们恐慌心理的深入刻画也博得了诸多好评。而之后的哥斯拉电影逐渐陷入程式化,但却越来越大的扩展了它的影响。最后,飘洋过海,到了USA。

Godzilla

也许美国人对卡通娱乐之类的感兴趣吧(Debian的各个发布版的代号sarge,woody都是来自Pixar的电影“Toy Story”)。所以,这头怪兽Godzilla就成了好多人的宠物。

因而,像mozilla就是用了怪兽的形象,哈哈。这回知道了为什么mozilla的主题是一头大恐龙了吧