Monday, November 12, 2012

Handle ZIP Archives with non-ASCII Filename

The workhorse is lsar/unar from The Unarchiver project.
http://code.google.com/p/theunarchiver/

Installation (Ubuntu 12.04 or above):

sudo apt-get install unar

Usage:

# Try list files first 
# Filename encoding will be automatically detected
lsar foo.zip
# If filename is already correct, unarchive
unar foo.zip

# If automatic detection fails
# Manually specify a encoding and check the result
lsar -e ENC foo.zip
# Once correct encoding is found, unarchive
unar -e ENC foo.zip

Reference: 

http://manpages.ubuntu.com/manpages/precise/en/man1/lsar.1.html
http://manpages.ubuntu.com/manpages/precise/en/man1/unar.1.html

Saturday, November 3, 2012

Install Ubuntu 12.04 on MacBook Pro 8.1

Description:

My origin environment is solely OS X 10.7.
I install Ubuntu 12.04 as another OS, i.e., the result is dual-boot.

Disclaimer:

My MBP has Intel graphic only. If yours has Nvidia graphic, things may be totally different.

Prerequisite:

1. Free space allocated for Ubuntu 12.04.
Disk Utility in OS X 10.7 can help you. Hold option to enable its hidden partition feature.

2. Direct (no VPN, etc.) wired Internet connection.

Procedure:

1. Install rEFIt to OSX:
http://refit.sourceforge.net/

2. Install ELILO
http://sourceforge.net/projects/elilo/
You may follow "Starting Linux with elilo" section below.
http://refit.sourceforge.net/doc/c2s2_startos.html
To be sure, you can reboot and try load ELILO without a elilo.conf, it should show some stupid error messages.

3. Download Ubuntu net install kernel and create elilo.conf
Download the following file:
http://archive.ubuntu.com/ubuntu/dists/precise/main/installer-amd64/current/images/netboot/netboot.tar.gz
And extract "initrd.gz" and "linux" file to the directory where ELILO is installed.
Create elilo.conf like the following:
image=linux
initrd=initrd.gz
label=Ubuntu


4. Reboot and launch Ubuntu 12.04 installer through ELILO
The installation process should be easy to follow.
When asked to partition, choose a option that use all unused space. (The guided option seems to lack the chance of review. If you want to a scheme different from single / and swap, you should use manual. )

5. Install Firmware for WiFi
My WiFi chip is BCM4331, check yours using the following command:
lspci -vvnn | grep 14e4
For BCM4331, "firmware-b43-installer" package won't work since its postinst script is slightly outdated.
http://pad.lv/912941
So we do the following:
Install "b43-fwcutter" package.
Manually  download  and extract firmware following b43 upstream's instruction below:
http://linuxwireless.org/en/users/Drivers/b43#If_you_are_using_the_b43_driver_from_3.2_kernel_or_newer:

6. Re-enable rEFIt
For unknown reasons, GRUB installed by Ubuntu cannot boot Mac OS X correctly. So we need some additional steps:
6.1 Hold option key and power on the MacBook Pro.
6.2 Select the volume different from Recovery
6.3 Select OS X in rEFIt menu
6.4 Open Terminal in OSX and do the following:
cd /efi/refit
./enable.sh
6.5 (Optional) You may want to remove ELILO stuff installed before so it won't pollute your rEFIt menu later.
6.6 (Optional) You may want to remove Mac OS X entries in GRUB's menu, do the following in Ubuntu's Terminal:
sudo chmod -x /etc/grub.d/30_os-prober
sudo update-grub

Optional Steps:

0. As a reminder, two-finger click on Trackpad become right-click.

1. Enable two-finger scrolling
System Settings => Mouse and Touchpad => Touchpad
Change "Scrolling" to "Two-finger scrolling".
The direction seems to opposite to that OS X 10.7's. I don't know whether this is changable.

2. Install Ubuntu Tweak
http://ubuntu-tweak.com/
It contains some tweak options that otherwise require text file editing to change.
( I'm absolutely fine with CLI and text file editing, but a sane GUI environment should not depends on such stuff too much. ) 
It may crash from time to time, just relaunch it.

3. Disable Overlay scrollbars:
If you find overlay scrollbars insane like me, disable it.
Ubuntu Tweak =>
Tweaks =>
Miscellaneous =>
"Overlay scrollbars:" => Off
Better to logout and re-login so all the application would have sane

scrollbars.

4. Install restricted crap, e.g., MP3
As a reminder, MP3 support is needed for Ubuntu One Music Store to work.
"ubuntu-restricted-extras" should be suffice for most cases.
https://help.ubuntu.com/community/RestrictedFormats
I personally don't like Microsoft fonts and Adobe Flash though.
You can avoid Microsoft fonts by reject its EULA.
Adobe Flash can be removed by removing "flashplugin-installer" package.

5. Install Google Chrome
http://www.google.com/chrome/
My favorite browser remains Firefox.
But I use Google Chrome whenever I'm forced to use Adobe Flash.

Sunday, August 12, 2012

香港的自由軟體中文輸入問題

香港主流的中文輸入法是速成和倉頡,這兩種輸入法都是形碼輸入法。

在Windoze下,用家對系統預設的輸入法基本滿意。
在Ubuntu和Fedora下,用家對系統預設的輸入法(基於ibus-table)非常不滿
在Mac OS X,用家對系統預設的輸入法不太滿意,一般換成Yahoo! KeyKey

ibus-table的問題,簡而言之,就是開箱不可用,又基本不能定製(除非hack代碼)。

目前ibus-table計劃在2012年9月1日發佈新版。
我已經標記了部分Open Issue的Priority爲High,這些是我希望在新版發佈前解決的問題。
Type爲Review的是我已經給出了commit,等待測試和評論;而Type爲Enhancement則是我覺得屬於錦上添花,短期內不會解決的問題;其他Type爲Defect的Issue則是中間狀態。
http://code.google.com/p/ibus/issues/list?q=component=ibus-table
對我的標記有意見,歡迎以各種方式向我指出。

ibus-table雖然問題很大,但是因爲其服務的碼表遠不只速成和倉頡兩種,修改起來難免束手束腳,前景不看好。如果推倒重來,未免工作量太大,而且下游發行版還不一定接受。所以我在這裏提出兩種替代方案。

1、幫助完善RIME的速成和倉頡
RIME是喜愛正體字的大陸人士發起的項目,是支持Fcitx/IBus/Mac OS X/Windoze的元引擎,有很強的定製性(但是目前還沒有圖形定製工具)。本文是用RIME的“朙月拼音”方案輸入的。
http://code.google.com/p/rimeime/
RIME預設沒有開啓“速成”方案,開啓後也不是香港用家期待的輸入體驗(候選詞爲5個,空白鍵commit而不是翻頁等等),我暫時只是把候選詞改成9個了(只影響該方案),翻頁等問題仍在研究,到時候會共享配置文件。
RIME還有一個問題是,在Ubuntu和Fedora上仍然需要編譯安裝,還沒有打包好的套件,在Mac OS X和Windoze則有預編譯文件。

2、開發獨立的速成和倉頡lib和對應的Fcitx/IBus/Mac OS X/Windoze引擎。
這個是我覺得比較徹底的方案,只是對這個lib的design還不是很明確。

Wednesday, August 8, 2012

Why I prefer Ubuntu to Fedora (and other distros)

Being a "beginner" is not bad.

Vim and Emacs are awesome. However, why can't I just enjoy Gedit which is much better than TextEdit.app and Notepad? I don't mind people call me beginner because I have very limited Vim knowledge. I change configuration files with Gedit, I program with Gedit, I'm happy with Gedit.

Similar story happens with my selection of distro.

Note: Do be a ninja if you want to contribute to FOSS directly. And a ninja should have experience with multiple distros.

Ubuntu has a friendlier installer.

Ubuntu's installer comes with the desktop CD won't ask questions that only make sense to system administrator. For example, the installer won't ask for root password.

Note: Ubuntu installer would configure selected timezone's country mirror as software source. And it would try to download updates and language packs at the end of installation. This often leads to poor installation experience since country mirrors may not work well. I don't like the concept of language packs itself.


It is easier to install restricted components in Ubuntu.

Jockey in Ubuntu can help users to install restricted drivers. The driver installation experience is even better than Windoze since there is no need to download drivers manually.

"ubuntu-restricted-extras" meta-package covers almost all non-free crap like MP3 and Flash. Most people just need them.

Note: Do avoid non-free stuff whenever possible. And be aware that Jockey may fail on some hardware. Bug reporting should be the best way to help Jockey.


Ubuntu has a Software Center

I think the main reason why Linux desktop fails to gain many users is its complicated software installation process. The huge software repository of Debian/Ubuntu mitigates the problem a lot. However, package is still a concept too advanced. App, on the other hand, is common concept today. Software Center is the easiest portal for normal users.

Note: dpkg/apt, the infrastructure behind Software Center, is not very robust in my opinion, there would be cases where CLI troubleshooting is required. So the experience is not as good as iOS's App Store. The Software Center itself is also somehow buggy. I find myself more convenient with apt-get(8). 

Non-rolling, time-based nature of Ubuntu releases makes sense to most people.

Always having latest version of software is cool. Without smooth upgrading process like that of iOS, however, upgrading becomes really annoying. LTS version of Ubuntu is really fit for people want a stable environment. Ubuntu 10.04 LTS contains GNOME 2 is still supported while Fedora and Arch Linux already forced their users to use GNOME Shell.

Note: Due to the dynamic nature of open source world, important bug fixes only comes to latest version and seldom backported. If you find youself using many PPAs to get latest software, it's a good time to upgrade Ubuntu version or switch to a rolling release distro.

Tuesday, August 7, 2012

《笨兔兔的故事》——软件昵称索引

G大叔——GRUB
查皮——Windoze XP
喂死它——Windoze Vista
温妻——Windoze 7

《笨兔兔的故事》点评——序章

这一章节简介了UNIX、GNU、Linux的发展历史,文笔不错。
但是该章节有些内容有“演义”的味道,想知道历史的详情请参阅其他资料。

《笨兔兔的故事》点评——我的说明

《笨兔兔的故事》是Ubuntu 10.04 LTS的入门书,可以在以下网址免费下载:
http://forum.ubuntu.org.cn/viewtopic.php?t=267518

该书讲的是日常的桌面应用和简单的编程开发,基本不涉及服务器架设的内容。

Ubuntu 10.04 LTS桌面版的官方支持期将在2013年4月结束,从今天(2012年8月7日)开始算还有1年不到。但我依然建议初学者从Ubuntu 10.04 LTS开始尝试GNU/Linux,因为Ubuntu 10.04 LTS包含较为成熟的GNOME 2桌面(Ubuntu从11.04开始转向了还在发展中的Unity桌面)。

想学习Ubuntu 10.04 LTS的朋友,除了可以阅读《笨兔兔的故事》外,还可以参考《Ubuntu桌面培训》:
http://people.ubuntu.com/~happyaron/udc-cn/
其中“Lucid HTML/PDF 版本”是针对Ubuntu 10.04 LTS的,而“Karmic HTML/PDF 版本”则是针对已过时的Ubuntu 9.10的。

《笨兔兔的故事》采用故事的形式解释清楚了从Windoze迁移到Ubuntu所必须了解的许多概念。但我在阅读的过程中,发现部分信息存在过时或失误的问题,所以我打算写一系列博客,指出这些问题。

Monday, August 6, 2012

爲什麼我厭惡Windoze

本文不談Windoze需要花錢購買這個問題,請看官自行選擇。另外,本文只從普通用家角度談。

1、麻煩死的驅動安裝:
登錄N家廠商的官網,搜索自己的硬件的型號,下載,點N個下一部安裝,很費時間的。而且Windoze驅動往往喜歡污染系統的右鍵菜單或者通知區域,實在噁心。Ubuntu運氣好的話,可以開箱即用或者在Jockey的幫助下輕鬆搞定驅動安裝,當然運氣不好確實很折騰。

2、弱爆了的開箱特性:
瀏覽器需要替換(換成Mozilla Firefox或Google Chrome)、文本編輯器需要替換(換成Notepad++或者Vim)、CMD需要替換(裝MinGW或者Cygwin)……在Ubuntu中,這些東西可是裝好就有的。

3、不安全的日常使用:
爲什麼只有Windoze老是受到病毒的青睞?因爲Windoze默認允許所有程式讀寫所有的目錄(除了少數系統關鍵目錄),所以一旦有惡意程式自然破壞力驚人。Windoze沒有包管理或者Bundle系統,安裝卸載軟體很可能造成垃圾殘留。另外,由於Windoze的配置非常非常不透明,給流氓軟體很大機會。