Kanru’s 探險日誌

當發現美好的事物時,所要做的第一件事,就是把它分享給所有人

Archive for the ‘爬網探險’ Category

Current state of Debian Chinese translations

with one comment

整理一下目前 Debian 各部份的中文翻譯狀況:

transgraph

收錄於 Debian 中的軟體的翻譯

這裡大部分是各種有收錄在 Debian 中的軟體的 PO 檔的翻譯,不是 Debian 特有的,主要協調者是 Zh-l10n。

參考:

Debian 套件設定樣板的翻譯

也就是 po-debconf 的翻譯,這些翻譯會出現在安裝套件後的設定畫面。目前有翻譯的還不多,想要進行翻譯的可以參考 popcon 分數決定要先從哪個套件開始。

可以使用這隻 script 來幫助翻譯:

  • 取得 po 檔
    • transhelp get abook
  • 編輯
    • edit abook/zh_TW.po
  • 檢查翻譯結果
    • transhelp check abook
  • 模擬顯示結果
    • transhelp display abook
  • 提交
    • transhelp send abook

transhelp 只是簡化翻譯的流程,真正要翻譯前請先參考 README-trans

Debian 套件描述的翻譯

套件描述的翻譯,這些翻譯會出現在套件管理軟體中 (如 aptitude) 或是 packages.debian.org 網站上。

無論你是要翻譯或是要 review,都可以透過網頁介面進行。

參考摩托學園:DDTSS翻譯 Debian 套件訊息

Debian 網站的翻譯

目前最重要的頁面都已經是最新了,其他常用頁面以及一些曾經翻譯過的頁面也在陸續整理中。我用 graphviz 畫了一張目前翻譯狀況的圖示,紅色代表目錄中有未翻譯網頁,綠色代表網頁已經跟原文同步。

想要參與翻譯的可以參考這裡這裡

Debian Installer 的翻譯

這裡整理了 Debian Installer 會用到的套件的翻譯,目前只剩下少數還未更新。

Lenny Release Note 的翻譯

很早就開始進行了,就我所知 Tetralet 已經翻譯了一部分。想要幫忙的可以聯絡他。

Lenny Install Manual 的翻譯

之前是 dreamcryer 翻譯的,現在聯絡不到人。簡體中文版已經翻譯的差不多了,想幫忙的人可以由此下手。

Debian Wiki 的翻譯:

不知道,Wiki 變化太快也許不適合進行翻譯。

其他

歡迎提供其他相關訊息 m(_ _)m

TODO: 整理到 Wiki 上

參考網站:http://www.debian.org/international/l10n/

Written by Kanru Chen

December 18th, 2008 at 1:33 am

Posted in Debian, 小工具, 爬網探險

Tagged with ,

Git branch in bash prompt

leave comments »

之前提過 zsh 有支援在 prompt 上顯示多種 VCS 資訊的功能,不知道 bash 上是否有人寫好同樣支援這麼多種 VCS 的 library,不過目前 git 附帶的 bash completion script 中有提供自訂 PS1 的函式。

只要呼叫 __git_ps1 即可得到目前的 git branch 的格式化輸出,可以自訂 prompt 如下


GITPS1='$(__git_ps1 ":%s ")'
export PS1="\w ${GITPS1}\$ "

就會顯示如


/usr/src/awesome :next $

這樣的 prompt

Written by Kanru Chen

December 13th, 2008 at 8:47 pm

Posted in 小工具, 爬網探險

Tagged with , , ,

Pdnsd - cache your DNS query

leave comments »

pdnsd 是一個小型的 proxy DNS server,主要功能就是 proxy 與 cache,而不是像 bind9 那樣的完整 DNS server。

雖然 DNS 通常不是網路延遲的主因,但有時候就是很慢,使用 pdnsd 前後可以差非常多。


% time host blog.kanru.info 168.95.1.1
0.00s user 0.01s system 0% cpu 0.963 total
% time host blog.kanru.info 127.0.0.1
0.00s user 0.00s system 65% cpu 0.011 total

在 Debian 系統上,如果你原本就有使用 resolvconf 的話,那麼只要在 configure 時選擇使用 resolvconf 就會動態的把 resolv.conf 內的 DNS server 包含,而 resolv.conf 只會剩下 127.0.0.1,如:


% /usr/sbin/pdnsd-ctl status
...
label: resolvconf
ip: 168.95.1.1
server assumed available: yes
ip: 192.168.1.1
server assumed available: yes
port: 53
...
% cat /etc/resolv.conf
nameserver 127.0.0.1

apt-get install pdnsd 完全零設定 ;-)

Written by Kanru Chen

December 8th, 2008 at 3:13 pm

Posted in Debian, 小工具, 爬網探險

Tagged with , , ,

Strange slowness and the reason

leave comments »

最近系統在開啟 firefox 後常常會使得整個系統越來越慢,一開始以為是因為我用 minefield 的關係。到 bugzilla 搜尋了半天只發現跟啟用 jemalloc 會拖慢系統的相關問題,我以為就是這個原因,因為有一次我 /tmp 開不夠大,結果被 jemalloc 的 mmap 檔塞爆了。但是調整 jemalloc 相關參數之後仍不見起色。

於是我換回預設的 iceweasel 3.0.3,但情況還是一樣。只要開啟 firefox 之後系統就會明顯變慢,但是看記憶體用量也不會越變越多,是正常範圍。越來越覺得可能不是 firefox 的錯,不然 bugzilla 與 web 上早就叫苦連天了。

今天突然想到我在編譯 kernel 的時候有加入 CONFIG_HIGHPTE 選項,以為是因此拖慢系統,又認為可能是因為開啟 CONFIG_HIGHMEM4G 所以又增加額外 overhead,於是開始研究解決方法。

開啟 CONFIG_HIGHMEM4G 是因為我總共有 1.25 G 的記憶體可以用,但是 Linux 預設只能使用實體記憶體 9xx MB 的大小,不得已只好開啟 CONFIG_HIGHMEM4G,可以參考 Kernel Trap 這篇。

搜尋一下在 2004 年與 2006 年都有把 2G memory split 選項加入的討論,但是目前編譯 2.6.28-rc7 時還是要先開啟 EMBEDDED 才能選 VMSPLIT_2G…

總之編譯了 kernel 重開機測試,打開 htop 監看記憶體用量與 CPU 用量,突然發現我所有的 process 都是 nice 5,想起 awesome 有個 bug report 就是一樣的問題,因為某一次的修改讓 awesome 會用 SHELL 環境變數裡面的 shell 來執行程式,而有問題的是 zsh,因為 zsh 預設會給 background process 比較高的 nice 值,而我只有瞄過這個 bug report 沒有多想…

我使用 cpufreq 的 ondemand governor,如果 process 的 nice 值大於零則不會替該 process 調高 CPU 速度,因此很有可能這樣才讓系統顯得緩慢 (永遠都是 798 MHz),從 .xsession 把 SHELL 指定為 /bin/sh 之後 nice 值都正常了,直到現在系統都沒有變慢的情形。

令人好奇的是,究竟是因為我改了 kernel 參數而變好的,還是改了 SHELL 才變好的呢… 我猜大概是後者影響比較多吧。

Written by Kanru Chen

December 7th, 2008 at 7:37 pm

Posted in Linux, 爬網探險

Tagged with , , , ,

為什麼 Git 比 X 好?

with one comment

當初一看到這個標題心裡想的是 Git 怎麼拿來跟 X 比?原來這個 X 是指其他 SCM…

http://whygitisbetterthanx.com/

很多人都注意到了,但是現在有

http://zh-tw.whygitisbetterthanx.com/

囉,小小替 Git 宣傳一下 :p

Written by Kanru Chen

December 6th, 2008 at 8:40 am

Posted in Programming, 小工具, 爬網探險

Tagged with ,

Vim - 以游標位置為基礎捲動螢幕

with 2 comments

不是人人都有大螢幕可以一次容納幾百行程式碼,且看文件時我們常會希望可以從頭看到尾,或者是寫文章時我們會希望可以從螢幕的最上頭開新段落然後一次寫一整個螢幕。

如果不熟悉以下命令,你可能常常要用 hjkl 或方向鍵去移動游標,調整顯示的範圍。但是,其實不用這麼辛苦。

zt 把游標下這行放到螢幕最上方

zz 放到中間

zb 放到最後

比如說,要開始寫新段落我只要 L 移動游標到最後,然後 zt ,我就會有一整頁空白的空間可以開始揮灑 :)

Written by Kanru Chen

December 1st, 2008 at 11:40 pm

Posted in Programming, 小工具, 爬網探險

Tagged with

Vim - 檔名太長怎麼辦

leave comments »

這是 vim 的一個小技巧,考慮以下情境:

  1. 我現在在 ~/ 目錄
  2. 因為某個原因我打開 vim 編輯 /usr/src/foodir/src/bardoor.c
  3. 看了看,發現需要參考同目錄下的 bardoor.h,於是打入命令 :tabe
  4. 接下來怎麼辦?因為目前工作目錄是 ~/,如果要用 vim 的 tab 補完的話還是需要把路徑再打一次
  5. 想一想再看答案 :)

    Read the rest of this entry »

Written by Kanru Chen

November 30th, 2008 at 7:25 pm

Posted in Programming, 小工具, 爬網探險

Tagged with

Abook Tags Support

leave comments »

Abook 是一個文字模式的通訊錄軟體,可以跟 mutt 搭配使用。

功能很齊全,就是沒有群組的功能…這個 patch 新增一個 tags 欄位,讓 abook 在搜尋的時候會搜尋 NAME, NICK, EMAIL, TAGS 四個項目,模擬群組的功能。

不知道若原作者看到這種 patch 會做何感想 XD

Written by Kanru Chen

November 23rd, 2008 at 9:49 pm

Posted in Programming, 小工具, 爬網探險

Tagged with , ,

使用 git-svn 整合 git 與 svn

leave comments »

git 是目前最紅的分散式 VCS 之一,我很喜歡用 git 因為他預設就有許多方便的特性如:

  • git log/diff/help 都有彩色的 pager 可用,不用再自己 pipe 到 less
  • git log 的格式一目了然,清晰易懂
  • git bisect/format-patch/shortlog/stash… 等趁手工具一堆
  • 速度快

而 git 不僅僅是 git,他分成高階的命令如 pull/commit 等,還有低階的命令可以直接操作 ref/object,因此有一些 VCS 就是建立在 git 的檔案系統上,運作起來跟 git 截然不同。

git-svn 是一個可以把 svn 當 git 用的工具,就算專案還在用 svn 也可以享受到 git 的便利。以下簡介一下 git-svn 的使用流程。

首先創造一個實驗用的 svn repository:


bob % cd /tmp/test
bob % svnadmin create hello
bob % svn co file:///tmp/test/hello hello-svn
bob % cd hello-svn
bob % svn mkdir branches tags trunk
bob % svn ci -m'Initial dir setup'

現在我們有一個傳統的 svn repository 了,加點東西進去吧:


bob % cd trunk
bob % echo "printf("hello\n");" > hello.c
bob % svn add hello.c
bob % svn ci -m'My first program :D'
bob % cd ..
bob % svn cp trunk tags/v0.1
bob % svn ci -m'tag v0.1'

這時候 Bob 已經建好他的程式 v0.1 版,Alice 知道了他的計劃也想加入,於是她用 git-svn 來取出 repository


alice % git svn clone --stdlayout file:///tmp/test/hello hello-git
Initialized empty Git repository in /tmp/test/hello-git/.git/
r1 = 80a0fc18653e8bc7d3784567b1b7024b20fd8c11 (trunk)
    A   hello.c
r2 = 4a80acebb6a41c208f3427498225f829950ee39e (trunk)
Found possible branch point: file:///tmp/test/hello/trunk => file:///tmp/test/hello/tags/v0.1, 1
Found branch parent: (tags/v0.1) 80a0fc18653e8bc7d3784567b1b7024b20fd8c11
Following parent with do_switch
    A   hello.c
Successfully followed parent
r3 = 24ca9410e9ca78ffa3bffa1c9ef574068d128935 (tags/v0.1)
Checked out HEAD:
  file:///tmp/test/hello/tags/v0.1 r3
alice % git reset --hard remotes/trunk

因為是使用 stdlayout,所以 tag/branch 等會自動對應到 remote branch


alice % cd hello-git
alice % git branch -r
  tags/v0.1
  trunk

Alice 發現 Bob 原本的程式無法 compile,因此開始修改,改完之後用 git add -p 挑選要 commit 的部份,然後把剩下的部份 stash 起來,最後用 git svn dcommit 提交給 Bob 的 svn repository


alice % edit hello.c
alice % git add -p
alice % git commit -m'Fix everything'
alice % git stash
alice % git svn dcommit

隔了幾天,Alice 發現 Bob 有更新,因此開始做同步。同時,因為她有一個 local branch,所以在更新完 master 之後,還需要把 fancy branch 跟 master rebase。


alice % git svn fetch
    M   hello.c
r6 = c43134a98f43dc6507deaa7495bfcd2c906aaa30 (trunk)
alice % git svn rebase
First, rewinding head to replay your work on top of it...
Fast-forwarded master to refs/remotes/trunk.
alice % git checkout fancy
alice % git rebase master
First, rewinding head to replay your work on top of it...
Applying: Inital fancy output branch

以上就是使用 git-svn 時會用到的大部分指令,其餘的就跟操作一般 git 一樣。

各命令的詳細說明可以參考 git-svn(1)

Written by Kanru Chen

November 23rd, 2008 at 6:03 pm

Posted in 小工具, 爬網探險

Tagged with ,

在隨身碟上用 LVM

leave comments »

要移除隨身碟之前,除了要 umount 外,記得要先用 vgchange 把 VolumeGroup 關掉,不然會在 /dev 殘留不能用的 vg/map。


vgchange -a n extdrive

這是一篇筆記。

Written by Kanru Chen

November 19th, 2008 at 12:39 pm

Posted in Linux, 小工具, 爬網探險

Tagged with