SWT 程序必写代码

   public static void main (String [] args) {
      Display display = new Display ();
      Shell shell = new Shell (display);
      shell.open ();
      // start the event loop. We stop when the user has done
      // something to dispose our window.
      while (!shell.isDisposed ()) {
         if (!display.readAndDispatch ())
            display.sleep ();
      }
      display.dispose ();
   }

解释(来自eclipse api):
当小物件被创建且shell被打开后,程序不断读入和切换来自操作系统队列的事件,直到shell窗口被释放(dispose)。
如果队列里没有可用事件(display.readAndDispatch() == false),我们让display休眠,给其他程序执行的机会。
July 8th, 2008 • log111 • Eclipse No Comments »

Dear child, if you can be alive, please remember I love you

The monther was dead, with a three month aged baby sleeping soundly under her body, and a message in her mobile:”Dear child, if you can be alive, please remember that I love you”…

This is an affecting scene found in searching survivors in ruins caused by the recently earthquak disaster in Sichuan province, China. I think the best thing I can do is bless the monther’s soul peace and her child good luck…

May 23rd, 2008 • log111 • Feelings 1 Comment »

开始使用新手机 ;-)

5月19日,心血来潮要去中关村买手机,同学推荐黑莓。到了鼎好电子商城B1,逛了一圈,想入手一部8100,终究因为是水货不放心,不愿意花千把钱买个麻烦。但是还是想尝试黑莓,我就买了个7290。买的时候测试了收发短信和电话,想测接口,但是嫌麻烦就算了。结果拿回去一用,发现充电不能,和电脑联机时机器会死掉:-( 。有同学告诉我国内没有新的黑莓机子,都是二手的。我一想估计这机器是usb-pin接口坏了。5月20日去换手机,拿回一款7290,接口是好的,又不想详细测试。结果拿回来,打电话发现话筒是坏的!而且机器接收无线信号诡异,不但信号在三格之下无法电话和短信,而且有时会莫名重启!我无法忍受了!我打算再去一次,直接换个Nokia的。5月21日第三次拜访,女老板让手下mm拿款好的,mm就离开了柜台。不一会,这个活泼的mm拿回一个7290,我决定细心测试。一开机,发现和前两次有些不同,怎么系统中有“中国移动”的说明?而且不像前两次电话本里还有一堆电话(可以打通,我试过;-)),这次的系统及其干净,估计这机子刷的系统不错。然后我把短信功能、电话功能和联机功能都测试了一遍,一切正常。:-)
黑莓作为中国移动的服务,不单卖手机,而是买服务送手机。服务好贵啊!希望哪天成为成功人士,用用行货黑莓和它的邮件服务:-)

May 22nd, 2008 • log111 • Uncategorized No Comments »

又一个openSUSE的教育网镜像

http://mirror.lupaworld.com/suse/

安装源和更新源。当然要想安装更多软件,这是远远不够的。:-( 不知道什么时候教育网里会有openSUSE的build-service服务,那样软件就全了。

May 22nd, 2008 • log111 • Uncategorized No Comments »

为四川地震默哀

2008年春节的冻灾,2008年5月四川的地震。。。奥运年的坎坷,中国要挺住啊!

May 15th, 2008 • log111 • Feelings No Comments »

《北京2008年奥运会歌曲专辑》到手了!

2008年4月30日发布的第一张为北京2008奥运造势的官方歌曲专辑。这张专辑大腕云集,收集了为北京奥运而谱写的24首歌曲,还附送一张为火炬传递谱写的歌曲cd,总共3张cd。虽然45¥是贵了一些,但是作为奥运年的纪念,还是值了!里面每首歌都很动听啊:-D

May 15th, 2008 • log111 • Feelings 2 Comments »

openSUSE的教育网源!

sjtu的openSUSE完整镜像(有10.3和11.0的,这里是10.3的,11的就替换一下10.3就行了):

安装源有两个:

http://ftp.sjtu.edu.cn/opensuse/distribution/10.3/repo/oss/

http://ftp.sjtu.edu.cn/opensuse/distribution/10.3/repo/non-oss/

更新源一个:

http://ftp.sjtu.edu.cn/opensuse/update/10.3/

不知道是什么缘故,openSUSE在教育网的源变少了。原来清华有镜像,我的10.2的5张安装cd和2张附加cd还是在上面下载的。后来估计是觉的Novell走的和微软过近还是什么的,反正是不喜欢Novell的发展策略,openSUSE从清华镜像里消失了。中科大也没有suse的源。找来找去,还是上海交大的源最全,一直保留着suse的镜像,包括suselinux和openSUSE(suselinux和openSUSE分家还是版本10.1以后的事情)。现在甚至一直更新着最新的openSUSE 11.0 beta!我个人觉得openSUSE的kde挺好看的,就一直用着,从10.2到10.3(当然中间有玩ubuntu和fedora :-D)。当然,openSUSE的安装源里的软件包向来是比较滞后的,软件版本低;更新源纯粹用来给系统打补丁。要在openSUSE里用多媒体,或者是想使用更多更新的软件,还是要用Novell的build-service服务。Novell的build-service其实就是第三方维护的软件源。只不过该服务不仅仅允许公司创建自己的软件源,个人也可以。不仅针对openSUSE和suselinux,现在该服务试图面向所有的linux发行版。

May 14th, 2008 • log111 • Linux No Comments »

Switch static ip in openSUSE10.3

In openSUSE10.3 kde, knetworkmanager cannot switch static ip. I want some tool to let me switch fixed ip for I can only use fixed ip to surf the internet either in my dormitory or in my lab. I am not willing to always open the YsST and configure the network card settings when I change working place. I just want a applet in the kicker(just a menu bar :-) ), and when I want to switch fixed ips, I can finish through clicks as few as possible.

Yes, I find a way-maybe an only way. openSUSE has a tool called “scpm”, which allow users to store, restore and switch their system-wise configurations. Scpm is intended for notebook users like me, who may often change their fixed ips and printers’ settings when they go to different working places. Yeah!!! That’s what I need! But it has no applet. :-( It’s integrated to YaST to be a module, which is called “简报管理器” in chinese. I then find a front-end for it- sumf. Not enough, I need a applet called “Profile Chooser”, who can reside in the kicker and call sumf to give users a GUI for scpm.

Profile chooser has no help for using sumf? Does sumf have for itself? No, the help of sumf just guide you to reference the help contents of scpm! Where to find the help of scpm? You must run a konsole(a console in kde) and using the following commands:

  • Use “man scpm” to read a brief introduction. (Maybe too brief for scpm newbies)
  • Use “info scpm” to read a complete help.

I first use “man scpm” and find it useless for me. Then I use “info scpm” and find it too long to read! I just want to switch fixed ips, why should I must learn how to store and restore the whole system configurations? So I decide to hack the sumf directly. I do the following:

  1. Right-click the profile chooser and select “运行简报管理器(sumf)”.
  2. Sumf opens. Select “简报/profile”->“添加/add”, and input any name you want.
  3. Your current configurations of the whole system is store as a profile.

I change my fixed ip to the one using in my dormitory, and do as above. Then I change the fixed ip to the one using in my lab, and do the same. Now I have two profile named “Dormitory” and “Lab”, which ones are differ in the network settings. Don’t forget to do the following to avoid input root password every time you want to switch your profiles:

  1. Right-click the profile chooser and select “配置简报选择器/configure the profile chooser”.
  2. Check “允许非root用户…/allowing non-root user to…”.

Now I achieve my aim!

May 6th, 2008 • log111 • Linux No Comments »

Chinese locale, use UTF-8!

Since openSUSE10.3 use zh_CN as its default chinese locale, I didn’t know which charset it actually used. I used to think openSUSE prefer utf-8 from gb2312/gbk. Until I used man pages in my konsole and found the chinese contents could not be displayed correctly three days ago did I find I were wrong for long. I checked in my kwrite and find I were using gb2312 as my charset. So all my chinese materials were encoded in gb2312!

As I knew, ubuntu was always using utf-8. In Taiwan, big5 is less popular than utf-8, since big5 is not so well designed as zh_tw.utf-8. For gb2312/gbk is well designed, chinese version of windows use gbk as default, so as many chinese websites.

So should I keep using gb2312/gbk? In linux world the magjority prefer utf-8 for convinence for communication. In Taiwan, most people use zh_tw.utf8, and in HongKong is zh_hk.utf8, then why not use zh_CN.utf8 in mainland? Honestly I had not many chinese materials to transfer from gb2312 to utf8 except some chinese songs, since most of my documents were PDF. After changing my locale to zh_CN.utf8, I found the man pages could be shown correctly!

Today, when I try to use my vfat partitions in my usbdisk I find all my chinese files can show their names correctly! In gb2312 I just could not seen them properly though I had tried to mount vaft partitions using gb2312 or utf-8. It seems that in linux world utf8 is more welcome then gbk!

May 2nd, 2008 • log111 • Linux No Comments »

中文界面,字体先行!(1)

虽然说我使用了很久linux,但是一直都在忍受极差的中文界面。界面这种东西着实是个麻烦,因为在技术上可能没有什么难点,但是一定是编写和配置起来 及其麻烦。我们平时使用电脑,用的就是它的界面。界面好不好看,最重要的是它的字体,其次才是好用的软件。linux的桌面系统,不论是kde还是 gnome,好用的软件一直在增加,但好看的字体确没有多少。很难想象当你打开一个浏览器,看到网页上乱七八糟、粗细不允的中文和英文字,你会有什么心情 继续往上冲浪。

我现在在用的是openSUSE,默认的中文字体也就是文鼎和方正的,没一个令人满意。好在文泉驿(http://wqy.sourceforge.net/cgi-bin/index.cgi)一直矢志不渝地在做免费中文字体。最近出了正黑,全得真是令人惊讶。从他们网页上摘了简介:

文泉驿正黑体是一个”自由字体“。该字体包含了所有常用简体中文、繁体中文所需要的汉字(最新版本包含超过20924个汉字,完整覆盖GB2312/Big5以及GBK标准字符集)。该字体同时还包含了日文、韩文和其他几十种语言符号。除此以外,该字体还嵌入了最新版本的文泉驿点阵宋体的中英文点阵,使得屏幕汉字显示清晰锐利,易于阅读。

有了字体,还要有好的配置文件。所谓配置文件,其实就是fontconfig的配置文件。kde和gnome现在都是基于fontconfig来选择字体。要学习fontconfig,首先要弄懂一些基本的概念。最近从网上看到一个介绍,还是很不错的:

“在西方国家罗马字母阵营中,字体分为两大种类:Sans Serif和 Serif,打字机体虽然也属于 Sans Serif,但由于是等宽字体,所以另外独立出 Monospace 这一种类,例如在Web中,表示代码时常常要使用等宽字体。Serif的意思是,在字的笔画开始及結束的地方有额外的装饰,而且笔画的粗细会因直橫的不同而有不同。相反的,Sans Serif则沒有这些额外的装饰,笔画粗细大致差不多。如下图:
820063114365.gif
可以看出,我们平时所用的Georgia、Times New Roman等就属于Serif字体,而Arial、Tahoma、Verdana等则属于Sans Serif字体。对中文而言,同样存在这两大种类,很明显,宋体、细明体(繁体中常用)等就属于Serif,而黑体、幼圆等则属于Sans Serif。

Serif 和 Sans Serif 的一般比较
Serif的字体容易辨认,因此易读性较高。反之Sans Serif 则较醒目,但在行文阅读的情況下,Sans Serif 容易造成字母辨认的困扰,常会有来回重读及上下行错乱的情形。

Serif 强调了字母笔画的开始及结束,因此较易前后连续性的辨识。

Serif 强调一个word,而非单一的字母,反之Sans Serif则强调个别字母。

在小字体的场合,通常Sans Serif比Serif更清晰。

适用用途:

通常文章的內文、正文使用的是易读性较佳的 Serif 字体,这可增加易读性,而且长时间阅读下因为会以word为单位来阅读,较不容易疲倦。而标题、表格內用字则采用较醒目的Sans Serif字体,它需要显著、醒目,但不必长时间盯著这些字来阅读。

像宣传品、海报类,为求醒目,它的短篇的段落也会采用Sans Serif字体。但在书籍、报刊杂志,正文有相当篇幅的情形下,则应采用Serif字体来减轻读者阅读上的负担。在Web设计及浏览器设置中也应遵循此原则为是。

适用用途:

通常文章的內文、正文使用的是易读性较佳的 Serif 字体,这可增加易读性,而且长时间阅读下因为会以word为单位来阅读,较不容易疲倦。而标题、表格內用字则采用较醒目的Sans Serif字体,它需要显著、醒目,但不必长时间盯著这些字来阅读。

像宣传品、海报类,为求醒目,它的短篇的段落也会采用Sans Serif字体。但在书籍、报刊杂志,正文有相当篇幅的情形下,则应采用Serif字体来减轻读者阅读上的负担。在Web设计及浏览器设置中也应遵循此原则为是。”

说到这,得提一下:Serif就是“衬线”,SansSerif就是“非衬线”。在中文中,无衬线的字体通常称为黑体,这时这个词的范畴和SansSerif字体是类似的;而衬线字体有宋体、楷体等等。

May 2nd, 2008 • log111 • Linux No Comments »

« Previous Entries

Next Page »

© 2008 Dreaming beside the sea - Theme Design