Monday, April 27, 2009

近期的一些杂感

由于这几周都在忙着做事, 有好几篇blog想发却一直搁置着, 今天就把它们都写到一起吧.

先说攻防吧, 最近又出新题了还没去看, 对于注入这种层次的题目暂时不想了, 其它的什么编程题还能应付下, 无奈比例不大, 不能让队伍再靠前一点. 因为某题需要用到PHP的编程, 于是在重拾Emacs时发现默认是不支持PHP的高亮的, 这种事情肯定有人想到并解决了的, 安装php-mode就行了, Ubuntu可以直接apt-get install php-mode, 也可以自己到SF上去下载, 然后修改.emacs:
;; PHP mode for Emacs.
(require 'php-mode)
(add-hook 'php-mode-user-hook 'turn-on-font-lock)

以前的文章[参加三叶草Linux方向考核的一些总结]中介绍了一个叫做template的Emacs插件, 可以实现新建特定扩展名的文件时自动加载模板的功能, 像现在的某些IDE一样. SHE同学前段时间因为用Vim写汇编时必须重复地输入那些又长又难记的SEGMENT而苦恼, 问我Vim是否能自动加载模板. 查了一下, 还挺简单的, 这个不需要任何插件就能实现了. 修改.vimrc:
" Template for Vim.
autocmd BufNewFile *.asm 0r ~/.vim/templates/template.asm
注意中间那个是数字0, 而不是字母o. 把你的模板放在相应的文件里, 如果需要其它类型的模板修改扩展名就行了. 以上方法来自LinuxSir.Org.

由于最近需要经常测试网页, 愈发觉得用当前的Firefox调试很麻烦. 最让人痛苦的一点就是如果调试页面崩溃了, 还要连带影响我的正常浏览页面, 不得不一次又一次地重启. 实在是忍受不了之后 (看来我还是一个很能忍的人), 决定来一个专业一点的调试方法. 来自Mozilla的一篇文章:
Setting up an extension development environment
介绍了如何利用Firefox打造调试环境, 解决我前面那个问题的方法就是使用多用户配置文件, 实话说, 用了这么久Firefox还真不知道可以多用户运行的... 使用如下命令启动Firefox:
$ firefox -no-remote -P dev
这时应该会弹一个选择用户配置文件的窗口, 因为以前没有dev这个配置文件, 需要新建一个才行. 建好以后再用上面的命令运行的时候就会使用dev, 而不是默认的default了, 这样新开的浏览器与我之前打开的就不会相互影响了. 那篇文章还介绍了Firefox的一些配置调整以适应调试的需求和一些有用的调试插件, 这里强烈推荐Firebug, 看网页结构那叫一个爽.

最后, 那天看到一个很搞的命令: vrms. 为什么说它搞呢? 先看看这个缩写的全称吧: Virtual Richard M. Stallman. 那这个命令是用来干什么的呢? 号称可以找出你电脑上所有的非自由 (non-free) 软件, 晒下我的结果, ORZ... 内核也算?
                Non-free packages installed on LAN

fglrx-amdcccle Catalyst Control Center for the ATI graphics accelerat
fglrx-kernel-source Kernel module source for the ATI graphics accelerators
fglrx-modaliases Identifiers supported by the ATI graphics driver
human-icon-theme Human Icon theme
linux-generic Complete Generic Linux kernel
linux-restricted-modules- Non-free Linux 2.6.27 modules helper script
linux-restricted-modules- Restricted Linux modules for generic kernels
nvidia-173-modaliases Modaliases for the NVIDIA binary X.Org driver
nvidia-177-modaliases Modaliases for the NVIDIA binary X.Org driver
nvidia-71-modaliases Modaliases for the NVIDIA binary X.Org driver
nvidia-96-modaliases Modaliases for the NVIDIA binary X.Org driver
rar Archiver for .rar files
tangerine-icon-theme Tangerine Icon theme
tango-icon-theme Tango Icon theme
Reason: Creative Commons Attribution-ShareAlike 2.5 License
xorg-driver-fglrx Video driver for the ATI graphics accelerators

Contrib packages installed on LAN

msttcorefonts Installer for Microsoft TrueType core fonts
nvidia-common Find obsolete NVIDIA drivers

15 non-free packages, 0.9% of 1628 installed packages.
2 contrib packages, 0.1% of 1628 installed packages.

No comments:

Post a Comment