2011年6月25日 星期六

Firefox 終極加速

使用環境:
1. ArchLinux x86_64
2. AMD Phenom II X2 550 + 8G RAM + Radeon HD 5670 1G Gddr5
3. Firefox v5.0

參考:http://www.verot.net/firefox_tmpfs.htm?
基本上述英文網址應該淺顯易懂,如有不了解的地方請留言,此方法可加速 firefox 的啟動速度,
效果非常明顯,甚至超越 chromium(chrome),只是需關閉 SafeBrowsing(安全性瀏覽),無此需求者倒可嘗試。


再來是網路上常見的調校,個人建議(about:config):
1. network.http.pipelining > true
2. network.http.pipelining.maxrequests > 16
3. network.http.pipelining.ssl > true
4. network.dns.disableIPv6 > true (目前 IPV6 還不盛行)

建議搭配 dnsmasq(DNS 快取),將常用的網域名稱->IP 儲存至記憶體,可降低 DNS 查詢時間:
pacman -S dnsmasq
編輯 /etc/dnsmasq.conf
listen-address 127.0.0.1
bind-interfaces
cache-size=1000

系統使用的 DNS Server,個人使用這些:
/etc/resolv.conf
nameserver 127.0.0.1
nameserver 61.31.233.3
nameserver 61.63.0.67
nameserver 8.8.4.4

2011年6月22日 星期三

Java 亂碼

修正 Oracle JRE(Java Runtime Environment) v1.6.0_26 中文亂碼問題(方框字):

1. 中文字型
 mkdir -p /opt/java/jre/lib/fonts/fallback
cp 中文字型檔至上述目錄,或是連結也可以(ln)

2. 控制台
執行 jcontrol > Java > 檢視
Runtime 參數:-Dfile.encoding=big5

重新啟動瀏覽器。

2011年6月6日 星期一

kernel-ck-bfs-bfq

先說明一下其效率表現,播放 H.264 Mpeg4 AVC 影音檔,CPU 使用率竟然只有 5~6 %,
而之前使用 kernel-2.6.39 未 patch 前都要 10% 左右(與 Windows 7 差不多),
相關硬體配備:
AMD Phenom(tm) II 550 (開核變成 X4 B50)
Radeon HD 5670 1G GDDR5

ArchLinux 的 AUR 來源還只有 kernel-2.6.38,於是自己編輯 PKGBUILD 來套用,
Linux 上要能硬解 HD 影音檔,ATI 系列顯示卡除了須安裝官方的 Catalyst Driver 外,
還另須二個軟體:

(AMDs XvBA backend for VA-API, hardware video acceleration on RadeonHD cards)

2. libva (Extra 套件庫)
(Video Acceleration (VA) API for Linux)

安裝完成後檢查上述二個軟體是否正常:
請執行 vainfo,正常輸出像這樣:
libva: libva version 0.32.0
Xlib:  extension "XFree86-DRI" missing on display ":0.0".
libva: va_getDriverName() returns 0
libva: Trying to open /usr/lib/dri/fglrx_drv_video.so
libva: va_openDriver() returns 0
vainfo: VA API version: 0.32
vainfo: Driver version: Splitted-Desktop Systems XvBA backend for VA-API - 0.7.8
vainfo: Supported profile and entrypoints
      VAProfileH264High               : VAEntrypointVLD
      VAProfileVC1Advanced            : VAEntrypointVLD

播放程式建議使用 vlc,版本 1.1.9 已支援硬體加速,而 mplayer 有時會無法播放某種格式,
CPU 使用率也比較高,也可使用 vlc-mini 較精簡。

我的 kernel26-2.6.39-ck-bfs-bfq 修改自 kernel26-ck 2.6.38.7,剛剛才發現 AUR 已有  kernel26-ck 2.6.39-10,但無 bfs patch,可自行加入 bfs patch


2011年5月30日 星期一

開機時自動掛載分割區與USB週邊

因 Ubuntu 11.04 開機時不會自動掛載硬碟的其他分割區與USB週邊,有需要的人請參考:
sudo nano /etc/udev/rules.d/11-media-by-label-auto-mount.rules
內容:

KERNEL!="sd[a-z]*|mmcblk[0-9]p[0-9]", GOTO="media_by_label_auto_mount_end"
ACTION=="add", PROGRAM!="/sbin/blkid %N", GOTO="media_by_label_auto_mount_end"
# Do not mount devices on boot because otherwise fsck may fail
ACTION=="add", PROGRAM!="/bin/grep ' / / rw[, ]' /proc/self/mountinfo", GOTO="media_by_label_auto_mount_end"

# Global mount options
ACTION=="add", ENV{mount_options}="noatime,users"
# Filesystem specific options
ACTION=="add", PROGRAM=="/sbin/blkid -o value -s TYPE %E{device}", RESULT=="vfat|ntfs", ENV{mount_options}="%E{mount_options},utf8,gid=100,umask=002"

# Get label
ACTION=="add", PROGRAM=="/sbin/blkid -o value -s LABEL %N", ENV{dir_name}="%c"
# Use basename to correctly handle labels such as ../mnt/foo
ACTION=="add", PROGRAM=="/usr/bin/basename '%E{dir_name}'", ENV{dir_name}="%c"
ACTION=="add", ENV{dir_name}!="?*", ENV{dir_name}="usbhd-%k"

ACTION=="add", ENV{dir_name}=="?*", RUN+="/bin/mkdir -p '/media/%E{dir_name}'", RUN+="/bin/mount -o %E{mount_options} /dev/%k '/media/%E{dir_name}'"
ACTION=="remove", ENV{dir_name}=="?*", RUN+="/bin/umount -l '/media/%E{dir_name}'"
ACTION=="remove", ENV{dir_name}=="?*", RUN+="/bin/rmdir '/media/%E{dir_name}'"
LABEL="media_by_label_auto_mount_end"

重新載入 udev rules:
udevadm control reload

資料來源:
http://plugapps.com/index.php5?title=PlugBox:Auto_mounting_USB_devices_and_SD_cards_with_UDEV

2011年5月28日 星期六

ATI 顯示卡硬體播放(硬解) for Ubuntu Linux

測試環境:
系統:XUbuntu x64 11.04 + ATI HD 5670 (1G GDDR5)

一、首先必須安裝官方的 fglrx 版本(目前是 11.5)才支援硬解,請新增下列來源套件庫:
新增檔案:/etc/apt/sources.list.d/ubuntu-x-swat-x-updates-natty.list
內容:
deb http://ppa.launchpad.net/ubuntu-x-swat/x-updates/ubuntu natty main
更新套件庫:
sudo apt-get update
安裝下列檔案:
sudo apt-get install fglrx-installer
(fglrx 裝好後必須重開機才能生效)

二、再來裝 libva1 (Video Acceleration (VA) API for Linux):
sudo apt-get install libva

三、然後裝 xvba-video ( XvBA-based backend for VA-API):
http://www.splitted-desktop.com/~gbeauchesne/xvba-video/
請選擇 i386 or amd64 (前者是 x86 版本,後者是 x64 版本)

四、最後裝 vlc (目前最新版是 v1.1.9,支援 VA-API 亦即"硬解"):
sudo apt-get install vlc

五、vlc 硬解設定:
工具 - 偏好設定 - 視訊 - Accelerated Video output (Overlay) [請打勾]


全部步驟如上,播放 1080p 影片的 CPU 使用率低於 10% 喔!

Google Earth 6 中文問題

官方的版本安裝好後選單文字都是方框字,解決方法如下:
下載 replacement.7z:
https://docs.google.com/leaf?id=0B2iTttURwOa1YzM3YmE2MjgtYWMxNS00ZTQwLWFlZWMtMjRmMmU3OGNjMTMx&authkey=CIHT1OkH&pli=1

解壓縮至某個目錄,將其下的 replacement 目錄下所有的檔案覆蓋至 /opt/google/earth/free 目錄即可,
中文輸入法也沒問題(我使用 gcin 1.6.x)。