2005年4月30日星期六

唉,又参加不了DebianHK的聚会了

一月份的时候就想去,结果临时有事情,没去成
三月份等了很久,却没有聚会(真的没有?抑或只是我没有收到邮件?因为那时刚把很多订阅的邮件转到gmail上)
刚刚收到5月2号的通知,我的港澳证又恰好在重新签注(以为会照惯例定在月底的,经验主义害死人啊)。
本来别的地方不熟悉,九龙塘又一城还是知道的。
:-(

Friends剧本CHM版本

应朋友们要求,将输出上载到主页空间了,点击这里下载(Friends.chm)
不一定能够长期保留,要下载趁早。



是用脚本转的(见前面的帖子I, II, III),当初学习Dive Into Python里面HTML Processing一章练手写的,(原来的Word文档)

p.s Part II的脚本有点问题,因为后来发现后面有些episode不是<hr>分隔的,改用"End"和"The End"划分准确性大一点,但还是有几个需要手工分割。脚本已经更新到下载区friends-split2.py

2005年4月29日星期五

GtkList/GtkListView的查找快捷键

一直以来,对于Gtk程序中的列表(GtkList, GtkCList或者GtkListView),总是不能通过按首字母跳转到相应项目上去,很是不爽。今天无意中敲到了Ctrl+F,发现居然有个小搜索框。

记得当初gtk-2.4要添加GtkFileChooser时,FootNotes上 对于界面原型中"用Ctrl-L打开一个路径输入框"这点争论了半天(但我找不到具体的URL了,也许是这个)。反对者的意见是这样不直观,不看文档的话谁会知道这个 快捷键呢,用户要跳转到某个目录只能一层一层地点; 支持者的意见是这样界面比较简洁,“我们为什么要做得象Windows一样呢?" 对于这个问题,我的意见是反对不显示出来。

回到刚才说的Ctrl+F,好在这个搜索框是直接现在在窗口上,不是一个模态的,还算好用(Firefox后来也改成了这样,而不是原来的Windows风格的对话框。这个搜索框的模态问题其实Jef Raskin在The Humane Interface里特别讲到过)。

P.S. 我将键盘上所有字母键和Ctrl的组合都按了一遍,想看看还有没有别的什么(答案是没有)。

又: 当初别人说KDE比GNOME好(至少是好用),我还跟他们争论一番,最近似乎没有太多底气了,尤其是放弃维护Cygwin GNOME 2.x以及前两天Slackware宣布移除GNOME之后。

2005年4月27日星期三

也开始玩玩博弈论

想是受了zhaoway前面帖子的影响,前两天电视里面又重新在放A Beautiful Mind, 又恰好在小书店里见到这本《博弈游戏》,于是就买了。

回来按习惯先草草翻了一下,里面一些有意思的故事先看了看,不求甚解,倒也都挺有意思。战争、经济、教育等等方面的例子都有,囚徒困境、大小猪争食、美女与老虎等常常在其他地方看到的例子也有。

唯一的缺点似乎倒是这本书讲得太通俗^_^,几个概念没有讲明白。比如我仔细看了前面引入“纳什均衡”这个概念的地方,但还是有点晕。再看zhaoway当初的帖子,就更晕了,怎么下面这个博弈的均衡是左下角那个呢?

(1,0) (3,2)
(2,1) (4,0)

我的理解倒是应该是有(3,2)和(4,0)这两个均衡才是。不行,再仔细看看。

备忘: 升级到fontconfig后为啥字体难看了

自从升级到 fontconfig 2.3 之后,很多网页上的英文就变得非常难看。今天终于在 Planet Debian 上找到了原因:新版 fontconfig 所带的 /etc/fonts.conf 将 Helvetica, Times, Courier 指向了 Nimbus 系列字体,而旧版本由于没有这个设置,所以多半会直接使用 Vera 字体。前后字型比较可以看 kov 的 贴文

2005年4月26日星期二

郁闷,帮朋友整FC3没有搞定

一个朋友开始玩Linux,装了个FC3,结果碰到安装后WinXP无法启动的问题,让我去帮忙看看。

我折腾了半天,也没有搞定。恢复了grub, winxp就无法起来;用fdisk /mbr可以让winxp起来,linux又无法进去了。

记得以前在网上看到关于这个问题的讨论(我记得是FC2的,怎么在FC3里面还有),但我自从RH7后就没有再用过RedHat了,在Debian和Mandrake上没有碰到这个问题,也就没有仔细看。
大 概记得是FC的安装程序在分区时(是不是不用它分区就没有这个问题了?)修改了主引导记录(MBR)里面的LBA信息,但没有同步更新CHS信息(因为 Linux是不用老式的CHS信息的),而Windows启动时是要检查CHS与LBA是否一致的,虽然启动后也不用CHS信息(DOS却是只用 CHS)。
如果真是这样的话,我没有碰到这个问题可能主要还是因为我从来都是先用PQMagic之类的分好了区再安装。

也不知道给他装个grub for DOS是否可以解决(当时时间不多,也没法慢慢来试验各种方法)。

BTW: 我实在没有觉得RedHat有什么好的,不知道怎么那么多人喜欢用。如果没有安装图形界面(或者X服务器还没有配置好),基本上就没法进行系统管理了,它 似乎所有的系统管理工具都在图形界面里面。而且rpm在没有apt-get这样的前端的情况下实在是难用啊,我安装CD3上一个包a,说是需要CD1上的 一个包b,我放入CD1,执行rpm -i b.rpm,说又需要CD2上的一个包c... 记得后来apt-get也有针对rpm的移植版,但FC里面自己不带么?(Mandrake倒是很早就有了一个urpm了)

2005年4月24日星期日

expocity = metacity + expose

看见阿当的blogExpose for Linux,想起原来移植Cygwin GNOME 2.x的时候接触过一个叫做expocity的wm, 就是对metacity做了一点修改,添加了类似Expose的功能。

我记得当初我还编译了cygwin的版本,只是cygwin在windows上,Alt+Tab之类的用不了(当时忙得一塌糊涂,也懒得来改)。

但作者对这个东西似乎只是偶一为之,就那么一个版本,并没有跟随metacity更新。另外看一些评论说是速度上面

相关的链接:
FootNotes上的讨论
一段中文介绍(by Yuren)

2005年4月22日星期五

总算找到《麦兜II: 菠萝油王子》的电影原声带

在无忧音乐网上可以下载,不过是wma格式的,

http://www.51y.com/Musiclist/4418.htm

反正外面市场上我是没有看见有卖的。

原来我最喜欢的那段是14: Mahler, 第一交响乐第三乐章,但听起来怎么跟别的版本差别很大?
还有《悠悠的风》和这个版本的《我的心里没有他》我也很喜欢。
至于那首得了最佳原创歌曲奖的《咁咁咁》昨日看见歌词才知道唱的是些什么(粤语讲快点我就听不明白了)

2005年4月18日星期一

How to disable beeping in console?

8.6.7 禁用声音(响铃)

最直接的方法是拔掉PC喇叭;-),对于Bash shell可执行:

     echo "set bell-style none">> ~/.inputrc

8.6.7 Disable sound (beep)

One can always unplug the PC speaker. ;-) For the Bash shell:

echo "set bell-style none">> ~/.inputrc

转: X下屏幕刷新率的解决办法

原文出处: 黄嘴企鹅论坛(linuxsir.org) Debian版
URL: http://www.linuxsir.org/bbs/showthread.php?t=156025
作者: moke33

注: 回头看了一下Knoppix中设置VSync的方法,很简单,就是将下面VertRefresh中后面的数字(它将缺省设置成了76.0)换成指定的数值
Section "Monitor"
Identifier "Monitor0"
ModelName "Old Monitor (no DDC)"
# HorizSync 28.0 - 78.0 # Warning: This may fry very old Monitors
HorizSync 28.0 - 96.0 # Warning: This may fry old Monitors
VertRefresh 50.0 - 76.0 # Very conservative. May flicker.
Modeline ...
Modeline ...
EndSeciton

但我记得有一个给朋友设置时,这个方法并不起作用
[@more@] 虽然我的三星显示器的刷新率没有问题,但是看到网上好多网友因为搞不定X下的刷新率问题而放弃了linux,心理感觉到很不舒服,而且并不是所有的人的问
题我都能解答,我力所能及的就是我们教研室里面的这几位兄弟,所以把最终解决办法写出来,这个办法不依赖任何gnome或者是kde,你在命令行下面就就
能解决,适用于任何窗口管理器,我用的是Icewm,当然没有问题,呵呵,下面的就是具体解决办法首先在终端下面运行你gtf命令,参数是你想要的分辨率和刷新率,比如我的分辨率为1024x768,刷新率想要85,那么我就可以这样用:
$ gtf 1024 768 85

# 1024x768 @ 85.00 Hz (GTF) hsync: 68.60 kHz; pclk: 94.39 MHz
Modeline "1024x768_85.00" 94.39 1024 1088 1200 1376 768 769 772 807 -HSync +Vsync

这样你就可以修改你的/etc/X11/XF86Config-4的显示器部分为:
Section "Monitor"
Identifier "Generic Monitor"
# 1024x768 @ 75.00 Hz (GTF) hsync: 60.15 kHz; pclk: 81.80 MHz
Modeline "1024x768_85.00" 94.39 1024 1088 1200 1376 768 769 772 807 -HSync +Vsync
Option "DPMS"
EndSection

启动X,你就可以看到效果了,如果X启动不了,查看一下原因,有可能是你的分辨率或刷新率调的太高了
另外在X下你也可以通过xvidtune来进行微调

2005年4月14日星期四

终极编程语言: C-omega (玩笑)

http://www.csdn.net/news/newstopic/20/20503.shtml:

Cω自去年7月份就要微软研究院的网页上公布出来,但C#的光芒完全把这门语言掩盖住了,近期在微软的官方站点上又刊登了一些有关Cω的文章,不知它是否会如当年C#的出现一样再次吸引住开发者的眼球,再次带来生产力的突破?
......

DarkSchneider:
其实,微软的“下一代”语言真正的含义是:“C oh my god!“ (2005.04.13)

2005年4月10日星期日

周末去肇庆玩了两天

虽然原来都去过,但“反正闲着也是闲着”。

感觉玩得还挺开心。真是“心若改变,一切均改变”。

肇庆七星岩 七星岩

肇庆鼎湖山,宝鼎园 鼎湖山宝鼎园(我又胖了 :-))

2005年4月8日星期五

Convert CHM contents to normal HTML contents

What do I want?

I have some eBooks (CHM format or SRM format). Now I want to copy them to my cellphone. As CHM or SRM format could not be supported, thus I choose PalmDoc (.pdb) format.

Yes,I can convert a pack of HTML files into one PDB file. But:
1) Some CHM books don't have a content page. They use the CHM contents. With a content page, browsing the result PDB file would be not a happy experience.
2) SRM books could be exported as CHM files. All of them
don't have a content page either.

Then came this simple recipe.

I remember two or three years ago, I used to do these things in Perl. Perl's regex feature is so powerful. The only problem is that after a few days, the script seems to be unreadable. :-(
Python is differenent than Perl. This recipe is so simple, isn't it?

#!env python

from sgmllib import SGMLParser
import htmlentitydefs

from chmmaker import HHCWriter
import os

class SiteMapParser(SGMLParser):
def reset(self):
SGMLParser.reset(self)
# some temp variables
self.level = 0
self.link_url = ""
self.link_title = ""

def start_ul(self, attrs):
self.on_section_starts()

def end_ul(self):
self.on_section_ends()

def start_param(self, attrs):
if len(attrs)&gt;1:
if attrs[0][0]=='name':
if attrs[0][1]=='Name':
self.link_title=attrs[1][1]
elif attrs[0][1]=="Local":
self.link_url=attrs[1][1]

def start_object(self, attrs):
self.link_title = ""
self.link_url = ""

def end_object(self):
self.on_link_found(self.link_title, self.link_url)

def on_section_starts(self):
self.level = self.level + 1

def on_section_ends(self):
self.level = self.level - 1

def on_link_found(self, title, url):
# you can override this
if title and url:
print " " * self.level + "%s [%s]" % (title, url)

class ContentParser(SiteMapParser):
""" A simple class to convert CHM contents (foo.hhc) to a normal HTML contents """
def reset(self):
print "&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;"
SiteMapParser.reset(self)

def on_section_starts(self):
print "&lt;ul&gt;"

def on_section_ends(self):
print "&lt;/ul&gt;"

def on_link_found(self, title, url):
print '&lt;li&gt;&lt;a href="%s"&gt;%s&lt;/a&gt;&lt;/li&gt;' % (url, title)

if __name__=='__main__':
import sys
if len(sys.argv)&lt;2:
print "Usage: %s foo.hhc" % sys.argv[0]
sys.exit()

trans=ContentParser()
fh=open(sys.argv[1], "r")
try:
trans.feed(fh.read())
except:
pass
trans.close()
fh.close()
# vim:expandtab softtabstop=4


Powered by ScribeFire.

Win2000如何设置应用程序兼容模式

How to Enable Application Compatibility-Mode Technology in Windows 2000?

TIM3(The Incredible Machine 3)好像是在windows 3.1时代写的,在win2000和winxp上都不能直接跑不起来(在win98上面倒是没有问题),但winxp上可以设置兼容模式,设置到 win95兼容模式就可以跑了。但win2000上怎么设置兼容模式呢?

在google上搜了一下,得到如下结果
1. 前提是必须有SP2以上的补丁
regsvr32 %systemroot%\apppatch\slayerui.dll
然后对要在兼容模式下运行的程序创建快捷方式,在快捷方式的属性中可以见到新的一页“兼容性”,选择一个即可
2. 在win2000的安装盘上有一个apcompat.exe,运行它,它可以允许你选择兼容模式,还有几个选项

不过都没用,这个游戏还是不能跑起来(Damned M$!),我只能玩TIM-Toon或者玩DOS版本的v1, v2了 :-(

链接:
Description of the Application Compatibility Tool
http://support.microsoft.com/?kbid=251062

How To Enable Application Compatibility-Mode Technology in Windows 2000 SP2 and SP3
http://support.microsoft.com/default.aspx?scid=kb;en-us;279792

Windows 2000 Compatibility Mode
http://www.windowsitpro.com/Windows/Article/ArticleID/43388/43388.html

How to Enable Application Compatibility-Mode Technology in Windows 2000 Service Pack 2
http://activewin.com/tips/win2000/1/2000_tips_43.shtml

2005年4月7日星期四

最佳原创电影歌曲: 《咁咁咁》

没想到这次的香港电影金像奖最佳原创电影歌曲居然是《麦兜II》里面的一首插曲,《咁咁咁》在线收听)。



其 实我倒喜欢当中那一大段音乐(不知道什么名字,就是麦炳自己痛苦地一个人过着,然后有一天又路过算命先生,后者再也没有惊奇地喊道“原来你出生帝王家”, 麦炳被编进“时空机器”,却又失望的走了出来,那时方体会到一切再也不能回头的那段)。在我看来,这个关于成长、关于失落的故事是《麦兜II》里面的主要 故事。



原来听说了《麦兜II》有了电影原声带,到处去找,却没有找到,在网上也没有找到。
[@more@]
文摘: 就那么看了一眼

所有奖项最令我微笑的是“最佳原创电影歌曲 ?????? - 《麦兜菠萝油王子》 ”,Dejay坦言听说新晋导演奖的奖金是十万块非常羡慕,并希望大家还是多多购买她的唱碟,并强调不会因为得奖而涨价。爽朗之处令我感到只有这样的声音才能唱出属于麦兜的歌。

不过顺便一提,强烈提醒不要看《麦兜菠萝油王子》,实在是太令人忧伤的片子,不过,我也知道,其实我想让更多的人尝尝那也许世界上只有香港特产的“菠萝油”。

2005年4月5日星期二

总算将python.cn邮件列表设成了digest模式

python.cn
的邮件列表(python-chinese@lists.python.cn)水贴(可能说垃圾邮件更贴切)真是多得要命,每天有好几十封邮件,有价值的
估计只有三分之一。偏偏又离不开它,它的人气在所有python社区里面算是比较旺的,很多问题在这里有人能解答。我原来退订过,但后来还是想没事翻翻,
又订阅了。

偏偏网站上提供的mailman设置页面又缺少“提交"(submit)按钮(也不知道管理员哪里去了,这事反映过但总没有消
息),没法将其设置为文摘模式。不过这个困扰我大半年的问题总算解决了:发送一封邮件到python-chinese-
request@lists.python.cn,主题空白,内容如下:
set authenticate password &lt;address=xxxx&gt; set digest mime
address项在用其他邮件帐号发邮件更改设置时有用。

应该mailman管理的邮件列表都有这个功能。如果不清楚具体用法,发送主题为help的邮件给foo-bar-request@some.where就可以了。



Usage:

set help
Show this detailed help.

set show [address=
]
View your current option settings. If you're posting from an address
other than your membership address, specify your membership address
with `address=
' (no brackets around the email address, and no
quotes!).

set authenticate [address=
]
To set any of your options, you must include this command first, along
with your membership password. If you're posting from an address
other than your membership address, specify your membership address
with `address=
' (no brackets around the email address, and no
quotes!).

set ack on
set ack off
When the `ack' option is turned on, you will receive an
acknowledgement message whenever you post a message to the list.

set digest plain
set digest mime
set digest off
When the `digest' option is turned off, you will receive postings
immediately when they are posted. Use `set digest plain' if instead
you want to receive postings bundled into a plain text digest
(i.e. RFC 1153 digest). Use `set digest mime' if instead you want to
receive postings bundled together into a MIME digest.

set delivery on
set delivery off
Turn delivery on or off. This does not unsubscribe you, but instead
tells Mailman not to deliver messages to you for now. This is useful
if you're going on vacation. Be sure to use `set delivery on' when
you return from vacation!

set myposts on
set myposts off
Use `set myposts off' to not receive copies of messages you post to
the list. This has no effect if you're receiving digests.

set hide on
set hide off
Use `set hide on' to conceal your email address when people request
the membership list.

set duplicates on
set duplicates off
Use `set duplicates off' if you want Mailman to not send you messages
if your address is explicitly mentioned in the To: or Cc: fields of
the message. This can reduce the number of duplicate postings you
will receive.

set reminders on
set reminders off
Use `set reminders off' if you want to disable the monthly password
reminder for this mailing list.

2005年4月4日星期一

Cygwin port of sylpheed-claws-gtk2-1.9.6cvs1

Here come the cygwin port sylpheed-claws-gtk2-1.9.6cvs1.

Only source patch available. Due to bandwidth limit, I can't upload the binary to my repository
now (Due to this reason I haven't updated it for serveral months :-(.
Now I have a lot of pending packages: xfce-4.2.0, rox-2.2, etc).

This patch was based on the source package provided by debian (experimental) , for its convenience, as it was preprocessed with autoconf/automake.

Usage:
$ tar zxvf sylpheed-claws-gtk2_1.0.1cvs1_orig.tar.gz $ patch -p1 -b &lt; sylpheed-claws-gtk2-1.0.1cvs1-1.diff $ ./sylpheed-claws-gtk2-1.0.1cvs1-1.sh mkdirs patch config make install package

And I also uploaded the source patch for gtk1 version of 1.0.1.

不可思议的机器(The Incredible Machine)系列游戏

工作后常常想起读书那会儿大家凑在一起玩TIM(不可思议的机器),于是想去找这个游戏,却找了好久一直找不到,没想到今天在eDonkey里面搜到了.

这是个解谜类游戏,目标是选用一定的工具,通过多米诺效应完成某一特定任务。譬如说,你可以通过巧妙安排,使用蜡烛、放大镜和电筒来点燃炸弹。

这是The Incredible Toon Machine,是个卡通版,比较搞笑。因为是win3.1程序,估计是在TIM3和TIM4之间推出的。
The Incredible Toon Machine (TIM卡通版)


放了前面几个小的版本在主页空间上。v1, v2是DOS版; v3是win3.1程序,在xp下可以用win98兼容模式,在win2000下不能跑。
可惜后面的几个版本太大了,Even More有近60M, TIM4近200M, Return of TIM则270M, 有兴趣的自己在eDonkey或者BT里找吧。

手机上本来有个Amazing World游戏,算是TIM的手机版本。可惜只有试用版,找不到破解版。(演示)

2005年4月3日星期日

去香港晃了一圈

本来是打算过去买个笔记本的,但在深水?豆淞艘蝗Γ?看见都是水货,不敢买。
结果基本是什么都没有买。买了份《明报》,回来还给海关没收了。:-(

香港,维多利亚港,会展中心 维港 香港维多利亚港,金紫荆广场金紫荆广场

不过基本上搞清楚了尖沙嘴、旺角、中环、上环、九龙城,湾仔这些常常在电影电视里听见的地名的位置。
照片是用手机拍的,效果不可能好。

2005年4月2日星期六

Firefox extension: Scrapbook

ScrapBook is a Firefox extension, which helps you to save Web pages and easily manage collections. Major features are:

  • Save Web page
  • Save snippet of Web page
  • Save Web page including linked files
  • Organize the collection in the same way as Bookmarks tree
  • Full text search of the collection

[@more@]是在debian-chinese群组里面看见有朋友推荐这个:

>>firefox里面不知道还有什么好一些的插件,前面有位朋友推荐的那个scrapbook好像是
>>用来做笔记用的?做note用的?不太会用:)不过还是谢谢了,感觉这些extensions真是强大,
>>就100多k,就增加了好多有用的功能
>>
>scrapbook类似于 “网文快捕?”吧,比如说在网上看见一段中意的话或网页,选中
>了点击右键就可以选择保存下来。尤其是对我等常在网上晃,想找曾经看到过的东
>西却往往忘了在哪儿看到的比较合适。
>
>做笔记的插件好像也是有的,不过不是scrapbook。:)

感觉有点像我在Windows下常用的"资料收藏大师"(原来叫"电子书库", 并且是开发源代码的,后来就变成共享软件了)。
至少可以让我在Linux下玩时有了个搜集网页内容的方法了。

foo_pod: iPod interface for Foobar2000

foo_pod is a interface between an Apple iPod and Foobar2000 version 0.8.

http://www.hydrogenaudio.org/forums/index.php?showtopic=19156

2005年4月1日星期五

cygwin port of xffm-4.2 almost done

Today:
- Removed the stupid cygwin handling in fstab_module.c. Now you can also visit your DOS drives in the Fstab branch.
- Fixed the window title when goto a network share folder (in cygwin, //machine/service always works even without smb module)
- Now all fixes could be done via automake
- Now xffm seems to be much more stable

Some problems:
- When traversing on the main menu, gtk always complains "assertion `GTK_IS_CHECK_MENU_ITEM (check_menu_item)' failed"
- I can't bookmark a directory in network share folder (dnd.c? or is it also a problem in the upstream?)

About xffm itself:
- The usability is much better than 4.0
- Some UI parts are not instinctive. For example, the sidebars, I lost it by accident. But if I didn't check the manual, I couldn't know how to get it back.



Source patches are here(xffm-4.2.1-cygwin-patch.tar.gz).

Usage:
xffm-4.2.1-cygwin-automake.patch is for those who have automake installed.
$ tar zxf xffm-4.2.1.tar.gz # unpack source
$ cd xffm-4.2.1
$ patch -p1 -b <>
$ CFLAGS=-O2 ./configure --prefix=/opt/xfce4
$ /usr/autotool/devel/bin/automake-1.9
$ make
$ make install

xffm-4.2.1-cygwin.patch is for those who don't have automake.
$ tar zxf xffm-4.2.1.tar.gz # unpack source
$ cd xffm-4.2.1
$ patch -p1 -b <>
$ CFLAGS=-O2 ./configure --prefix=/opt/xfce4
$ make
$ make install

The -automake patch is smaller, which makes the patch maintainable.

Note:
If you want to build in a directory other than the source directory (e.g. xffm-4.2.1/.build, ) via "./configure --srcdir=/path/to/source/dir", remember to copy the faked src/libxffm.la to $(top_builddir)/src/.