Linux下使用并口游戏手柄

February 25, 2006

在Linux下使用并口的游戏手柄很容易,首先保证lp模块不在内存中:
lsmod | grep parport
> arport_pc 35236 1
> parport 35912 1 parport_pc

载入gamecon模块:
sudo modprobe gamecon map=0, 7, 0, 0, 7
注意这里的map参数,第一个0表示使用第一个并口(parport0),后面四个数字分别对应四个手柄的类型,我使用的是PS手柄(7),N64手柄是6,超任手柄是1,0表示无手柄,注意这里我指定了第一和第四个手柄,是对应我的双打手柄试出来的,不同的手柄可能不同。
驱动装好的,先测试一下,安装joytest包,
jstest /dev/input/js0
jstest /dev/input/js1

测试完成,可以爽了,我在snes9x, zsnes, epsxe中都实验成功了。


TeX->Html转换

February 24, 2006

试过不少TeX->Html转换的工具,各有千秋:

  • TexToWebPublishing(ttwp):每一页都是一个图片文件(目录页有连接),实际上是latex在后台生成ps,然后变成png,好处在于这样只要latex能处理的文件都能接受,但问题在于文件之内的链接就无效了,像引用,www地址等等。
  • TtH: 可以转换tex为纯html,但数学公式是借助特殊字体(symbol8859)显示的文本,不能保证在所有机器上都能看到,而且即使有这种字体,显示质量比TeX生成的Pdf还是差一个档次。
  • Tex2Web:看介绍相当不错,结果也很漂亮,高度可定制,支持CSS,但是,好像不支持AMS-Math,这样对于数学公式比较多的文件就不太适用了。
  • Latex2Html:元老级的转换器,曾经是唯一的选择,转换公式为图片,生成的html比较简单,或者说很“朴素”。
  • tex4ht:TexLive里有, 暂时没有测试。

相关网页:
http://hutchinson.belmont.ma.us/tth/webmath.html


Linux命令行小窍门

February 24, 2006
  • Wget a website:
    wget -rEKk http://www.pjprimer.com
  • Bash history: ctrl-r, ctrl-s: incremental search in history (reverse, forward)
  • Screen multiuser:
    user1 runs screen; runs command “ctrl-A: multiuser on”; then “ctrl-A: acladd user2″
    user2 then runs screen -x user1

这里也有不少:
Linux.com CLI series


Bash提示符

February 24, 2006

曾经研究过如何设置Bash Shell的提示符,是从这里开始的。

Escape Sequence(逃逸序列?):
\a an ASCII bell character (07)
\d the date in “Weekday Month Date” format (e.g., “Tue May 26″)
\e an ASCII escape character (33)
\h the hostname up to the first ‘.’
\H the hostname
\j the number of jobs currently managed by the shell
\l the basename of the shell’s terminal device name
\n newline
\r carriage return
\s the name of the shell, the basename of $0 (the portion following the final slash)
\t the current time in 24-hour HH:MM:SS format
\T the current time in 12-hour HH:MM:SS format
\@ the current time in 12-hour am/pm format
\u the username of the current user
\v the version of bash (e.g., 2.00)
\V the release of bash, version + patchlevel (e.g., 2.00.0)
\w the current working directory
\W the basename of the current working directory
\! the history number of this command
\# the command number of this command
\$ if the effective UID is 0, a #, otherwise a $
\nnn the character corresponding to the octal number nnn
\\ a backslash
\[ begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt
\] end a sequence of non-printing characters

颜色代码:
Color 字符 背景
Black 30 40
Red 31 41
Green 32 42
Yellow 33 43
Blue 34 44
Magenta 35 45
Cyan 36 46
White 37 47
根据以上信息设计好你的提示符之后,在~/.bashrc(我用Bash)加入:
export PS1="\[\e[33m\]{\u@\h}\[\e[m\]\w\$"
就大功告成。

至于要改变Xterm的标题栏,看http://www.tldp.org/HOWTO/Xterm-Title.html
xterm预定义了以下escape sequences:
0: /* new icon name and title*/
1: /* new icon name only */
2: /* new title only */
例子:
PS1='\[\e]1;My Desk\a\e]2;${PWD}\a\]\[\u@ME \w]\n \#\$ '


German Accent Codes

February 2, 2006

German HTML Codes(remove “_”):
Ä &_Auml; (196)
ä &_auml; (228)
Ö &_Ouml; (214)
ö &_ouml; (246)
Ü &_Uuml; (220)
ü &_uuml; (252)
ß &_szlig; (223)
€ &_euro;

German Alt Codes
Ä ALT+0196
ä ALT+0228
Ö ALT+0214
ö ALT+0246
Ü ALT+0220
ü ALT+0252
ß ALT+0223
€ ALT+0128