Saturday, July 02, 2011

修复 ubuntu 11.04 亮度调节组合键功能

安装N卡驱动之后,Thinkpad的Fn+Home调节亮度的组合键失效。
修改/etc/X11/xorg.conf 文件,加入Option那一行,重启生效。


Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "NVS 3100M"
Option "RegistryDwords" "EnableBrightnessControl=1"
EndSection

IDE aptana menu problem in ubuntu 11.04


#!/bin/bash
export UBUNTU_MENUPROXY=0
/path/to/AptanaStudio3

Modifying the Query String In mod_rewrite of Apache2

RewriteRule backreferences: These are backreferences of the form $N (0 <= N <= 9), which provide access to the grouped parts (in parentheses) of the pattern, from the RewriteRule which is subject to the current set of RewriteCond conditions..
RewriteCond backreferences: These are backreferences of the form %N (1 <= N <= 9), which provide access to the grouped parts (again, in parentheses) of the pattern, from the last matched RewriteCond in the current set of conditions.

By default, the query string is passed through unchanged. You can, however, create URLs in the substitution string containing a query string part. Simply use a question mark inside the substitution string to indicate that the following text should be re-injected into the query string. When you want to erase an existing query string, end the substitution string with just a question mark. To combine new and old query strings, use the [QSA] flag.


# rewrite without old query string
RewriteCond %{QUERY_STRING} ^page_id=(.*)$
RewriteRule ^index.php$ /index/%1.php? [R=301,L]

# rewrite with new query string
RewriteCond %{QUERY_STRING} ^page_id=(.*)$
RewriteRule ^index.php$ /index/%1.php\?test=1 [R=301,L]

# rewrite with combined old query string
RewriteCond %{QUERY_STRING} ^page_id=(.*)$
RewriteRule ^index.php$ /index/%1.php\?test=1 [QSA,R=301,L]