<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6613449007994858413</id><updated>2025-04-05T16:44:53.077+08:00</updated><category term="linux"/><category term="gentoo"/><category term="blog"/><category term="programming"/><category term="emacs"/><category term="chess"/><category term="colinux"/><category term="lisp"/><category term="arch"/><category term="gadget"/><category term="sbcl"/><category term="stumpwm"/><category term="adb"/><category term="android"/><category term="bash"/><category term="busybox"/><category term="camcorder"/><category term="erlang"/><category term="firefox"/><category term="gnuplot"/><category term="html"/><category term="hv30"/><category term="imagemagick"/><category term="javascript"/><category term="maxima"/><category term="mid"/><category term="photo"/><category term="prolog"/><category term="sgs2"/><category term="sicp"/><category term="texlive"/><category term="virtualbox"/><category term="web"/><title type='text'>Thoughts in Air</title><subtitle type='html'>Thoughts on programming, gadgets, and more...</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>47</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-4099929131536584624</id><published>2012-01-31T21:33:00.002+08:00</published><updated>2012-01-31T21:33:29.677+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arch"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><title type='text'>The Headache of a Separate /usr Partition</title><content type='html'>&lt;p&gt;I installed Arch Linux inside a VirtualBox. Originally I made a bad
decision and only allocated 20 GB for the whole Linux hard disk, among
which root partition occupies 8.3 GB. Later on, I found that I need to
squeeze disk spaces since the root partition is quickly occupied by
ever increasing packages. Then I decided that I need to add another
disk to balance the load of root partition. Which directory shall I
put on the separate partition? After looking at the disk usage, /usr
seems a nice candidate. So I created another virtual disk, moved all
/usr content to that disk, and mount it as /usr. There were problems
in this process since /usr contains many important binaries, but I
overcome these issues. Finally I have enough space in my root
partition, although everytime Arch Linux boot process complains
that separate /usr partition is not supported. I didn&#39;t care since
everything went fine.&lt;/p&gt;

&lt;p&gt;Yesterday I rebooted Linux. During boot process, Linux complained
that &lt;q&gt;/dev/sdb1 is mounted. e2fsck: Cannot continue, aboring.&lt;/q&gt; I
was given a typical panic screen to either enter root password and fix
the problem, or hit Control-D to continue. /dev/sdb1 is where my
current /usr partition. So I knew that I was finally hit by the
separate /usr partition problem.&lt;/p&gt;

&lt;p&gt;How to solve the problem? After Googling around, the solution is to
disable boot time disk checking, as discussed &lt;a
href=&quot;https://bbs.archlinux.org/viewtopic.php?id=51163&quot;&gt;here&lt;/a&gt;. So I
entered root password, and mounted root partition as writable by
typing &lt;kbd&gt;mount -o remount,rw /&lt;/kbd&gt;. Then I edit /etc/fstab. The
trick here is to change the last parameter (pass) to 0 for partition
/dev/sdb1. The line&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
UUID=adbe588d-fd82-4ab1-b935-5ea245cf89fa /usr ext4 defaults,noatime,nodiratime 0 &lt;span style=&quot;color:red&quot;&gt;2&lt;/span&gt;
&lt;/pre&gt;

is changed to
&lt;pre class=&quot;code&quot;&gt;
UUID=adbe588d-fd82-4ab1-b935-5ea245cf89fa /usr ext4 defaults,noatime,nodiratime 0 &lt;span style=&quot;color:red&quot;&gt;0&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;There are issues with such solution though. Boot time disk checking
is useful to ensure data consistency. The solution bypasses such
safety guard. But currently I cannot find any other solutions to boot
the Linux box. Since I cannot check the partition after booting (since
/usr is busy), I may need other ways to check the partition (maybe
boot via CD-ROM and check the partition manually). The lesson here is
that a small decision error at the beginning may have large
implications at the end.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/4099929131536584624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2012/01/headache-of-separate-usr-partition.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/4099929131536584624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/4099929131536584624'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2012/01/headache-of-separate-usr-partition.html' title='The Headache of a Separate /usr Partition'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-1565437592078473695</id><published>2011-11-07T21:08:00.000+08:00</published><updated>2011-11-07T21:12:42.381+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="adb"/><category scheme="http://www.blogger.com/atom/ns#" term="android"/><category scheme="http://www.blogger.com/atom/ns#" term="busybox"/><category scheme="http://www.blogger.com/atom/ns#" term="emacs"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="sgs2"/><title type='text'>Displaying ANSI Escape Sequences in Windows</title><content type='html'>&lt;p&gt;I installed Busybox on my Samsung Galaxy S II to enjoy the &lt;a
href=&quot;http://www.busybox.net/downloads/BusyBox.html&quot;&gt;Swiss Army Knife
of Embedded Linux&lt;/a&gt;. When I want to look at my phone SD card
content, I often use &lt;a
href=&quot;http://en.wikipedia.org/wiki/Android_Debug_Bridge&quot;&gt;adb&lt;/a&gt; if
the phone is connected with my laptop. So I typed the following
command at Windows command prompt:
&lt;/p&gt;

&lt;p class=&quot;code&quot;&gt;
adb shell ls /sdcard
&lt;/p&gt;

&lt;p&gt;What I got is somehow scary as shown below (only first line is shown):&lt;/p&gt;

&lt;p class=&quot;code&quot;&gt;
←[1;34mAndroid←[0m               ←[1;34mTitaniumBackup←[0m
&lt;/p&gt;

&lt;p&gt;After a while, I realized that what is shown is actually &lt;a
href=&quot;http://en.wikipedia.org/wiki/ANSI_escape_code&quot;&gt;ANSI escape
codes&lt;/a&gt;. The &lt;em&gt;ls&lt;/em&gt; command provided by Busybox is actually
showing color codes by default.&lt;/p&gt;

&lt;p&gt;So what shall I do? I know option &lt;em&gt;--color=never&lt;/em&gt; can
suppress ANSI escape sequences but I don&#39;t like typing such long
keystrokes. On the other hand, getting useful information out of those
ANSI codes is very difficult. My first reaction is trying to see
whether Windows shell can show those ANSI codes. I remember my old
friend DOS can display ANSI codes, so a modern Windows 7 should be
able to do so. But I cannot find relevant configuration in
&lt;em&gt;Properties&lt;/em&gt; dialog of command prompt. After reading Wikipedia
page on &lt;a href=&quot;http://en.wikipedia.org/wiki/ANSI_escape_code&quot;&gt;ANSI
escape codes&lt;/a&gt;, I found the following sentence &lt;em&gt;Console windows
in all versions of Windows do not support ANSI escape sequences at
all&lt;/em&gt;. Therefore the only solution is to find some console
replacements which can show ANSI codes.&lt;/p&gt;

&lt;p&gt;I do found some by Googling. But before trying one, I asked myself
why I should install one software for just such a trivial task? I
suddenly thought: how about Emacs shell? Maybe Emacs folks have
already solved this issue? So I fired up Emacs, typed &lt;kbd&gt;M-x
shell&lt;/kbd&gt;, and typed &lt;kbd&gt;adb shell ls /sdcard&lt;/kbd&gt; in Emacs
shell. Bingo! All ANSI color codes are correctly shown, just as in an
Linux box when typing &lt;kbd&gt;ls --color&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Ubiquitous Emacs to the rescue again.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/1565437592078473695/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2011/11/displaying-ansi-escape-sequences-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/1565437592078473695'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/1565437592078473695'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2011/11/displaying-ansi-escape-sequences-in.html' title='Displaying ANSI Escape Sequences in Windows'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-28273126832771571</id><published>2011-09-10T10:10:00.000+08:00</published><updated>2011-09-10T10:11:32.027+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="chess"/><title type='text'>Mobilizing All Forces</title><content type='html'>&lt;p&gt;Recently I played &lt;a
href=&quot;http://www.chess.com/echess/game.html?id=47176279&quot;&gt;a
corresponding game&lt;/a&gt; at chess.com. It is one of the games I played
in 16th Chess.com Tournament.  It is an interesting demo on how Black
can attack the King sides in King&#39;s Indian Defense. Below is the PGN
and an embedded PDF analyzing the game.&lt;/p&gt;

&lt;pre&gt;
[Event &quot;16th Chess.com Tournament (1801-2000) - Round 1&quot;]
[Site &quot;Chess.com&quot;]
[Date &quot;2011.09.01&quot;]
[White &quot;ismail231&quot;]
[Black &quot;whily&quot;]
[Result &quot;0-1&quot;]
[WhiteElo &quot;1810&quot;]
[BlackElo &quot;1873&quot;]
[TimeControl &quot;1 in 3 days&quot;]
[Termination &quot;whily won by resignation&quot;]

1.d4 Nf6 2.c4 g6 3.Nc3 Bg7 4.Nf3 O-O 5.e4 d6 6.Be2 e5 7.O-O Nc6 8.d5
Ne7 9.b4 Nh5 10.Re1 f5 11.Ng5 Nf6 12.f3 Kh8 13.Be3 Bh6 14.Nf7+ Rxf7
15.Bxh6 f4 16.Rf1 Neg8 17.Bg5 h6 18.Bh4 g5 19.Bf2 Rg7 20.c5 g4 21.fxg4
Nxg4 22.Kh1 Qg5 23.Bf3 N8f6 24.Qe2 Nxf2+ 25.Rxf2 Bg4 26.Nb5 Bxf3
27.gxf3 Rag8 28.h3 Nh5 29.Qc2 Qg3 0-1
&lt;/pre&gt;

&lt;object data=&quot;https://sites.google.com/site/yujianzhang/2011-09-01-ismail231-vs-whily-kid.pdf&quot; type=&quot;application/pdf&quot; width=&quot;100%&quot; height=&quot;660&quot;&gt;
  alt : &lt;a
  href=&quot;https://sites.google.com/site/yujianzhang/2011-09-01-ismail231-vs-whily-kid.pdf&quot;&gt;2011-09-01-ismail231-vs-whily-kid.pdf&lt;/a&gt;
&lt;/object&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/28273126832771571/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2011/09/mobilizing-all-forces.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/28273126832771571'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/28273126832771571'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2011/09/mobilizing-all-forces.html' title='Mobilizing All Forces'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-6658180925573126467</id><published>2011-08-26T15:55:00.000+08:00</published><updated>2011-08-26T15:57:27.429+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="chess"/><title type='text'>The Power of Two Bishops</title><content type='html'>&lt;p&gt;Recently I played &lt;a
href=&quot;http://www.chess.com/echess/game.html?id=46563101&quot;&gt;a
corresponding game&lt;/a&gt; at chess.com. It is one of the games I played
in a Semi Slav thematic tournament.  At the end of the game, my two
bishops completely dominates the board. Below is the PGN and an
embedded PDF analyzing the game.&lt;/p&gt;

&lt;pre&gt;
[Event &quot;12th Chess.com Thematic Tournament - Semi Slav (1801-2000) - Round 1&quot;]
[Site &quot;Chess.com&quot;]
[Date &quot;2011.08.01&quot;]
[White &quot;BennyNevis&quot;]
[Black &quot;whily&quot;]
[Result &quot;0-1&quot;]
[WhiteElo &quot;1768&quot;]
[BlackElo &quot;1876&quot;]
[TimeControl &quot;1 in 3 days&quot;]
[Termination &quot;whily won by resignation&quot;]

1.d4 d5 2.c4 e6 3.Nc3 Nf6 4.Nf3 c6 {Thematic Game - This is the starting position.} 
 5.e3 Nbd7 6.Bd3 dxc4 7.Bxc4 b5 8.Bd3 Bb7 9.a3 Bd6 10.O-O O-O
 11.b4 a5 12.Rb1 axb4 13.axb4 Qe7 14.Qb3 Nd5 15.Nxd5 exd5 16.Bd2 Nf6 17.Ra1 Ne4 18.Bc3 Nxc3 
 19.Qxc3 Bxb4 20.Qc2 g6 21.g3 Bd6 22.Kg2 f6 23.Nd2 c5 24.dxc5 Bxc5 25.Bxb5 d4+ 26.Kg1 dxe3 
 27.fxe3 Qxe3+ 0-1
&lt;/pre&gt;

&lt;object data=&quot;https://sites.google.com/site/yujianzhang/2011-08-01-bennynevis-vs-whily-semi-slav.pdf&quot; type=&quot;application/pdf&quot; width=&quot;100%&quot; height=&quot;660&quot;&gt;
  alt : &lt;a
  href=&quot;https://sites.google.com/site/yujianzhang/2011-08-01-bennynevis-vs-whily-semi-slav.pdf&quot;&gt;2011-08-01-bennynevis-vs-whily-semi-slav.pdf&lt;/a&gt;
&lt;/object&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/6658180925573126467/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2011/08/power-of-two-bishops.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/6658180925573126467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/6658180925573126467'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2011/08/power-of-two-bishops.html' title='The Power of Two Bishops'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-4125442855623688392</id><published>2011-08-19T19:19:00.001+08:00</published><updated>2011-08-19T19:24:56.966+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="chess"/><title type='text'>Transition from Attack to Defense</title><content type='html'>&lt;p&gt;Recently I played &lt;a
href=&quot;http://www.chess.com/echess/game.html?id=46421550&quot;&gt;a
corresponding game&lt;/a&gt; at chess.com. It is one of the games I played
in a Ruy Lopez thematic tournament.  I attacked first, but later on
have to defense and lost the game quickly (as I thought). Below is the PGN and an
embedded PDF analyzing the game.&lt;/p&gt;

&lt;pre&gt;
[Event &quot;Ruy Lopez - Round 1&quot;]
[Site &quot;Chess.com&quot;]
[Date &quot;2011.07.25&quot;]
[White &quot;nadreck&quot;]
[Black &quot;whily&quot;]
[Result &quot;1-0&quot;]
[WhiteElo &quot;2022&quot;]
[BlackElo &quot;1882&quot;]
[TimeControl &quot;1 in 5 days&quot;]
[Termination &quot;nadreck won by resignation&quot;]

1.e4 e5 2.Nf3 Nc6 3.Bb5 {Thematic Game - This is the starting
position.}  Nf6 4.O-O Nxe4 5.Re1 Nd6 6.Bxc6 dxc6 7.Nxe5 Be7 8.d4 Be6
9.Bf4 O-O 10.c3 Nf5 11.Nd2 c5 12.g4 Nh4 13.dxc5 Bxc5 14.Ne4 Bd6
15.Nxd6 cxd6 16.Nd3 Qd7 17.f3 Qc6 18.Re3 Bxg4 19.Nb4 Nxf3+ 20.Kh1 Qd7
21.Rxf3 Bxf3+ 22.Qxf3 Rfe8 23.Rg1 Re6 24.Nd5 Rae8 25.Qg4 1-0
&lt;/pre&gt;

&lt;object data=&quot;https://sites.google.com/site/yujianzhang/2011-07-25-nadreck-vs-whily-ruy-lopez.pdf&quot; type=&quot;application/pdf&quot; width=&quot;100%&quot; height=&quot;660&quot;&gt;
  alt : &lt;a
  href=&quot;https://sites.google.com/site/yujianzhang/2011-07-25-nadreck-vs-whily-ruy-lopez.pdf&quot;&gt;2011-07-25-nadreck-vs-whily-ruy-lopez.pdf&lt;/a&gt;
&lt;/object&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/4125442855623688392/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2011/08/transition-from-attack-to-defense.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/4125442855623688392'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/4125442855623688392'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2011/08/transition-from-attack-to-defense.html' title='Transition from Attack to Defense'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-7101857529418761639</id><published>2011-08-02T22:16:00.002+08:00</published><updated>2011-08-02T22:22:24.074+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="chess"/><title type='text'>Wild King&#39;s Gambit</title><content type='html'>&lt;p&gt;Recently I played &lt;a
href=&quot;http://www.chess.com/echess/game.html?id=46350790&quot;&gt;a
corresponding game&lt;/a&gt; at chess.com. I played King&#39;s gambit, and the
game went wild as what usually happens in this opening. Both white and
black kept making tactical blunders and I won the game although I just
intended to draw the game at the critical moment. Below is the PGN and
an embedded PDF analyzing the game.&lt;/p&gt;

&lt;pre&gt;
[Event &quot;The super wally&#39;s that will crush YOU!!! - Board 36&quot;]
[Site &quot;Chess.com&quot;]
[Date &quot;2011.07.22&quot;]
[White &quot;whily&quot;]
[Black &quot;graywyvern&quot;]
[Result &quot;1-0&quot;]
[WhiteElo &quot;1896&quot;]
[BlackElo &quot;1822&quot;]
[TimeControl &quot;1 in 5 days&quot;]
[Termination &quot;whily won by resignation&quot;]

1.e4 e5 2.f4 exf4 3.Nf3 g5 4.h4 g4 5.Ne5 Nf6 6.Bc4 d5 7.exd5 Bd6 8.d4
 f3 9.O-O fxg2 10.Kxg2 h6 11.Nc3 Nbd7 12.Bf4 Nb6 13.Qe2 Qe7 14.Rae1
 Kf8 15.Nb5 Qd8 16.Nxd6 cxd6 17.Ng6+ fxg6 18.Bxd6+ Kg8 19.Rxf6 1-0
&lt;/pre&gt;

&lt;object data=&quot;https://sites.google.com/site/yujianzhang/2011-07-22-whily-vs-graywyvern-kga.pdf&quot; type=&quot;application/pdf&quot; width=&quot;100%&quot; height=&quot;660&quot;&gt;
  alt : &lt;a
  href=&quot;https://sites.google.com/site/yujianzhang/2011-07-22-whily-vs-graywyvern-kga.pdf&quot;&gt;2011-07-22-whily-vs-graywyvern-kga.pdf&lt;/a&gt;
&lt;/object&gt;

&lt;p&gt;One technical note: I generated the PDF file by using LaTeX package
xskak, which is great for chess articles/books.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/7101857529418761639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2011/08/wild-kings-gambit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/7101857529418761639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/7101857529418761639'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2011/08/wild-kings-gambit.html' title='Wild King&#39;s Gambit'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-7510729857870477905</id><published>2010-12-25T22:40:00.006+08:00</published><updated>2013-12-02T07:35:29.413+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arch"/><category scheme="http://www.blogger.com/atom/ns#" term="emacs"/><category scheme="http://www.blogger.com/atom/ns#" term="gentoo"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="lisp"/><title type='text'>Switching From Gentoo Linux to Arch Linux</title><content type='html'>&lt;h1&gt;Introduction&lt;/h1&gt;

&lt;p&gt;Although I have been using Gentoo Linux for several years, I
started to consider switching to other Linux distributions. The main
drawback of Gentoo is that too much time is spent on compiling. It is
really cool to build a cutting-edge system, however the time spent on
building it and maintaining it is enormous. Therefore I am searching a
minimalist&#39;s Linux distribution with binary packages. Arch Linux seems
to be quite good. I gave it a try under VirtualBox 4.0. The reference
I used was &lt;a
href=&quot;http://wiki.archlinux.org/index.php/Beginners_Guide&quot;&gt;Beginner&#39;s
Guide&lt;/a&gt;.&lt;/p&gt;

&lt;hr/&gt;

&lt;h1&gt;Install the base system&lt;/h1&gt;

&lt;p&gt;The overall installation steps are quite similar to Gentoo: you
need to configure many things by hand. The difference is that the
installation is significantly faster.&lt;/p&gt;

&lt;p&gt;If possible, one should select the fastest mirror since downloading
time is the most significant component of installing Arch Linux
packages. For me, I select the mirror listed &lt;a
href=&quot;http://www.archlinux.org/mirrors/status&quot;&gt;here&lt;/a&gt; with the best
score for my location. After determining the mirror, you can download
the ISO image from that mirror, and add it to your
&lt;em&gt;/etc/pacman.conf&lt;/em&gt; after installation. For example by adding
&lt;em&gt;Server = http://mirror.url/archlinux/$repo/os/x86_64&lt;/em&gt; under
the repo names, or uncomment preferred mirros in
/etc/pacman.d/mirrorlist (which is preferred). As an alternative, one may also
try &lt;a href=&quot;http://wiki.archlinux.org/index.php/Reflector&quot;&gt;reflector&lt;/a&gt;
after installing Arch Linux. Yet another option (I&#39;m currently using)
is to rely on script &lt;em&gt;rankmirrors&lt;/em&gt; (according
to &lt;a href=&quot;https://wiki.archlinux.org/index.php/Mirrors&quot;&gt;here&lt;/a&gt;) to
select the fastest mirrors. Note that for rankmirrors option, file
&lt;em&gt;/etc/pacman.conf&lt;/em&gt; needs one line &lt;em&gt;Architecture =
x86_64&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;To enable the compatibility with 32-bit legacy programs (like
Android emulator), multilib should be enabled in pacman.conf as
below:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
[multilib]
Include = /etc/pacman.d/mirrorlist
&lt;/pre&gt;

&lt;p&gt;Simply download the latest ISO image. I used &quot;core&quot; image since it
contains all the base packages for installation. The latest version as
writing is &lt;em&gt;archlinux-2011.08.19-core-x86_64.iso&lt;/em&gt;. Download and
mount it under VirtualBox. Then boot the virtual machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For help&lt;/strong&gt;, open a virtual terminal (by
typing &lt;kbd&gt;Alt+F2&lt;/kbd&gt;) and type &lt;kbd&gt;less
/arch/beginnersguide.txt&lt;/kbd&gt;&lt;/p&gt;

&lt;p&gt;The installation steps are as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Login as root.&lt;/li&gt; 
&lt;li&gt;Type &lt;kbd&gt;/arch/setup&lt;/kbd&gt; to start the installer.&lt;/li&gt;  
&lt;li&gt;Select the source as &quot;core-local&quot;.&lt;/li&gt;
&lt;li&gt;Select Editor according to your taste.&lt;/li&gt;
&lt;li&gt;Set the clock by selecting region and timezone according to your
location. You should know whether your hardware clock is UTC or local
(my settings in VirtualBox is UTC). The recommended setting is
UTC.&lt;/li&gt;
&lt;li&gt;For &quot;Prepare Hard Drive(s)&quot;, firslty I choose &quot;Manually Partition
  Hard Drives&quot; and then &quot;Manually Configure block devices, file
  systems and mount points.&quot;. I only setup two partitions, /boot
  partition (200 MB, ext2), and root partition (remaining disk,
  ext4.)&quot;.
  For menu &quot;Partition Access Method&quot;, select &quot;uuid&quot;.
&lt;li&gt;After completing partitioning, go back to main menu and select
&quot;Select Packages. For bootloaders, choose &quot;grub&quot;. Then for package,
select &quot;base-devel&quot; meta-package as well, and select following
packages in addition: gpm, inetutils, linux-header, mlocate, ncurses,
openssh, pacman-mirrorlist, readline, sqlite3, sqlite3-doc, sudo,
xinetd.&lt;/li&gt;
&lt;li&gt;Select &quot;Install Packages&quot; from main menu. Select &quot;Yes&quot; to
keep packages in pacman cache.&lt;/li&gt;
&lt;li&gt;Select &quot;Configure the System&quot; from main menu.
  &lt;ul&gt;
    &lt;li&gt;Modify /etc/rc.conf. Change &quot;foo&quot; to your desired host name.
&lt;pre class=&quot;code&quot;&gt;
&lt;span class=&quot;comment-delimiter&quot;&gt;# &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;NETWORKING
&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;interface&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;eth0&lt;/span&gt;
&lt;/pre&gt;
    I also removed netfs from DAEMONS line.&lt;/li&gt;
    &lt;li&gt;Write your desired host name to /etc/hostname.&lt;/li&gt;
    &lt;li&gt;Modify /etc/fstab by adding options noatime and nodiratime to
    partition /.&lt;/li&gt;
    &lt;li&gt;Modify /etc/locale.gen by uncommenting the lines starting as
    &quot;zh_CN&quot; since I&#39;m a Chinese.&lt;/li&gt;
    &lt;li&gt;Modify /etc/pacman.conf by uncommenting the Xfercommand line in
    /etc/pacman.conf for wget.&lt;/li&gt;
    &lt;li&gt;Modify /etc/pacman.d/mirrorlist by uncomment your preferred
    mirrors as discussed above.&lt;/li&gt;
    &lt;li&gt;Change root password.&lt;/li&gt;
  &lt;/ul&gt;
&lt;/li&gt;

&lt;li&gt;Back to main menu, select &quot;Install Boot loader&quot;. Add option
&quot;vga=0x360&quot; for customed VESA mode provided by VirtualBox (as
discussed below). Install the bootloader to master boot record (sda in
my case).&lt;/li&gt;

&lt;li&gt;Finally, select &quot;Exit Install&quot; and type &lt;kbd&gt;reboot&lt;/kbd&gt; to turn
on the new system.&lt;/li&gt;

&lt;/ol&gt;

&lt;hr/&gt;

&lt;h1&gt;Configuration and Graphics User Interface&lt;/h1&gt;

&lt;p&gt;This section documents further installation and customization I
made.&lt;/p&gt;

&lt;h2&gt;VirtualBox related settings&lt;/h2&gt;

&lt;p&gt;Install custom VESA mode to support your PC/Laptop&#39;s screen
resolution according to VirtualBox manual, if necessary.&lt;/p&gt;

&lt;p&gt;Install VirtualBox guest additions as shown below (note that we
need to install kernel headers first to compile the additions). Reboot
is needed to make additions work. Note that if you want to install
Xorg, you can run VBoxLinuxAdditions.run after completing &lt;kbd&gt;pacman
-S xorg&lt;/kbd&gt;. Optionally package &lt;em&gt;xorg-xinit&lt;/em&gt; can be
  installed for script &lt;em&gt;startx&lt;/em&gt; and
  package &lt;em&gt;rxvt-unicode&lt;/em&gt; for a nice terminal.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# mkdir /mnt/cdrom
# mount -t iso9660 /dev/cdrom /mnt/cdrom
# &lt;span class=&quot;builtin&quot;&gt;cd&lt;/span&gt; /mnt/cdrom
# ./VBoxLinuxAdditions.run
# reboot
&lt;/pre&gt;

&lt;p&gt;Proxy: for proxy, add export http_proxy=proxy.url to .bashrc of
root. If subversion was later installed, oen need to modifiy
~/.subversion/servers for lines containing http-proxy-host and
http-proxy-port. When using sudo to update pacman, one need to add the
following line after typing &lt;kbd&gt;visudo&lt;/kbd&gt;: Defaults env_keep +=
&quot;http_proxy https_proxy&quot;.
&lt;/p&gt;

&lt;p&gt;To share folders between host and Linux guest, one need to first
setup the sharing in VirtualBox GUI. Then after installing Guest
Additions as discussed above, the sharing can be enabled like below
(assuming the shared folder name is bar and you want to mount it in
your Linux guest directory /mnt/bar):&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# mkdir /mnt/bar
# mount -t vboxsf bar /mnt/bar
&lt;/pre&gt;

&lt;h2&gt;Add additional user&lt;/h2&gt;

&lt;pre class=&quot;code&quot;&gt;
# useradd -m -G audio,optical,storage,video,wheel foo
# passwd foo
&lt;/pre&gt;

&lt;p&gt;Change foo to your desired name.&lt;/p&gt;

&lt;p&gt;Run &lt;kbd&gt;visudo&lt;/kbd&gt; to edit file /etc/sudoers. Uncomment the 1st
line containing wheel to enable running root commands from wheel
group. One may add lines like &lt;em&gt;Defaults env_keep +=
&quot;http_proxy&quot;&lt;/em&gt; to pass environment variables.&lt;/p&gt;

&lt;h2&gt;Handling of security&lt;/h2&gt;

&lt;p&gt;Ru nthe following command: &lt;kbd&gt;cp /etc/pacman.conf.pacnew
    /etc/pacman.conf&lt;/kbd&gt;. Apply all previously mentioned changes to
    /etc/pacman.conf to the overwrittine file. Then uncomment
    following line:&lt;/p&gt;
&lt;pre&gt;
SigLevel = Optional TrustAll
&lt;/pre&gt;

&lt;p&gt;Run &lt;kbd&gt;pacman-key --init&lt;/kbd&gt; to initialize keyrings.&lt;/p&gt;

&lt;h2&gt;Cleanup unused packages&lt;/h2&gt;

&lt;p&gt;Since some packages are not useful to me, I remove them to avoid
future waste of time and bandwidth to update them. Note that you may
use &lt;kbd&gt;pacman -Qe&lt;/kbd&gt; to list the explicitly installed
packages. &lt;strong&gt;Warning&lt;/strong&gt;: please make sure you do understand
what you&#39;re doing: removing important system packages may break your
system. As shown below, I only remove those packages related to file
systems I&#39;m not using.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# pacman -Rsn jfsutils reiserfsprogs xfsprogs
&lt;/pre&gt;

&lt;h2&gt;ABS&lt;/h2&gt;

&lt;p&gt;Run the following command:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# pacman -S abs
&lt;/pre&gt;

&lt;p&gt;Edit /etc/abs.conf, For REPOS line, add ! before testing.&lt;/p&gt;

&lt;h2&gt;AUR helper&lt;/h2&gt;

&lt;p&gt;There are lots of &lt;a
href=&quot;https://wiki.archlinux.org/index.php/AUR_Helpers&quot;&gt;AUR
helpers&lt;/a&gt;, and I chose &lt;a
href=&quot;https://github.com/Spyhawk/pacaur&quot;&gt;pacaur&lt;/a&gt; after trying
various helpers (e.g. pacaur support proxy seamlessly pacman). To
install pacaur, one needs to first install yajl and expac using
pacman, then install cower and pacaur by running the following
command.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
$ sudo pacman -S yajl
$ wget http://aur.archlinux.org/packages/co/cower/PKGBUILD ; makepkg -si
$ wget http://aur.archlinux.org/packages/pa/pacaur/PKGBUILD ; makepkg -si
&lt;/pre&gt;

&lt;p&gt;To install packages from AUR, simply run &lt;kbd&gt;pacaur -S
pkg&lt;/kbd&gt;.&lt;/p&gt;

&lt;h2&gt;SSHD&lt;/h2&gt;

&lt;p&gt;If one want to run SSHD server, one need to add sshd to DAEMON line
of /etc/rc.conf. One may modify /etc/hosts.allow and/or
/etc/hosts.deny. Default is that all connections are denied.&lt;/p&gt;

&lt;h2&gt;Xorg&lt;/h2&gt;

&lt;p&gt;Install Xorg by simply running &lt;kbd&gt;pacman -S xorg&lt;/kbd&gt;. Accept
the default (although there are many drivers not needed). Afterward,
one need to install VirtualBox Guest Addition for video drivers, as
discussed above.&lt;/p&gt;

&lt;p&gt;Generally, there is no need to modify /etc/X11/xorg.conf since
VirtualBox can handle the file for you when installing Guest
additions. There is no need to specify screen resolutions since
VirtualBox can seamless adjust it according to host
resolution. However, if one wants to restrict available resolutions
(e.g. to use StumpWM which is not compatible with VirtualBox&#39;s
seamleass operation), one can add the following line in Section
Screen, Subsection Display. Below example sets up two resolutions with
60 Hz refresh rate.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
  Modes &quot;1680x1050_60.00&quot; &quot;1440x900_60.00&quot;
&lt;/pre&gt;

&lt;p&gt;One may install package &lt;em&gt;mesa-demos&lt;/em&gt; to benchmark OpenGL
performance with &lt;em&gt;glxgears&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;For better font rendering, one may install
&lt;em&gt;freetype2-infinality&lt;/em&gt;, &lt;em&gt;fontconfig-infinality&lt;/em&gt;,
&lt;em&gt;ttf-google-webfonts&lt;/em&gt;, and &lt;em&gt;libxft-lcd&lt;/em&gt; from AUR.&lt;/p&gt;

&lt;h2&gt;GNOME&lt;/h2&gt;

&lt;p&gt;Install GNOME by typing the command &lt;kbd&gt;pacman -S gnome&lt;/kbd&gt;. Then
add dbus to DAEMONS array in /etc/rc.conf.&lt;/p&gt;

&lt;p&gt;Add the following line to ~/.xinitrc:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
&lt;span class=&quot;comment-delimiter&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;!/bin/&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;sh&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;
&lt;/span&gt;
&lt;span class=&quot;comment-delimiter&quot;&gt;# &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;Make sure it is at the beginnig of the file, especially before &quot;exec gnome-session&quot;
&lt;/span&gt;[ -f /etc/xprofile ] &amp;amp;&amp;amp; . /etc/profile
[ -f ~/.xprofile ] &amp;amp;&amp;amp; . ~/.xprofile
&lt;span class=&quot;keyword&quot;&gt;exec&lt;/span&gt; gnome-session
&lt;/pre&gt;

&lt;p&gt;For VirtualBox, type the following to use GNOME 3:&lt;/p&gt;

&lt;pre&gt;
# ln -s /usr/lib/xorg/modules/dri/vboxvideo_dri.so /usr/lib/dri
# pacman -S libltdl # Such reinstallation is needed.
$ gnome-shell --replace
&lt;/pre&gt;

&lt;p&gt;To start GNOME, simply type &lt;kbd&gt;startx&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;I installed following packages in addition:&lt;/p&gt;

&lt;dl&gt;
  &lt;dt&gt;gconf-editor&lt;/dt&gt;&lt;dd&gt;- Edit GNOME settings&lt;/dd&gt;
  &lt;dt&gt;gnome-system-tools&lt;/dt&gt;&lt;dd&gt;- contains GNOME admin tools&lt;/dd&gt;
  &lt;dt&gt;gksu&lt;/dt&gt;&lt;dd&gt;- allows normal user to use system tools&lt;/dd&gt;
  &lt;dt&gt;gamin&lt;/dt&gt;&lt;dd&gt;- allows changes to files and directories to be
  detected immediately.&lt;/dd&gt;
  &lt;dt&gt;gnome-media-pulse&lt;/dt&gt;&lt;dd&gt;- enables volume control as tray notification&lt;/dd&gt;
  &lt;dt&gt;faenza-icon-theme&lt;/dt&gt;&lt;dd&gt;- cool icon theme&lt;/dd&gt;
  &lt;dt&gt;baobab&lt;/dt&gt;&lt;dd&gt;- disk usage&lt;/dd&gt;
&lt;/dl&gt;

&lt;p&gt;To select fonts suitable for LCD display, right click mouse on
desktop, then select &lt;em&gt;Change Desktop Background -&gt; Font&lt;/em&gt;,
select &quot;Subpixel smoothing (LCDs)&quot; for Rendering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; (2011-05-03): I installed login manager
GDM by typing &lt;kbd&gt;pacman -S gdm&lt;/kbd&gt;, and perform following
changes to &lt;em&gt;/etc/inittab&lt;/em&gt;:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;comment line &lt;em&gt;id:3:initdefault:&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;uncomment line &lt;em&gt;id:5:initdefault:&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;comment line &lt;em&gt;x:5:respawn:/usr/bin/xdm -nodaemon&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;uncomment line &lt;em&gt;x:5:respawn:/usr/sbin/gdm -nodaemon&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Audio&lt;/h2&gt;

&lt;p&gt;In VirtualBox settings for Audio Controller, I select Intel HD
Audio. The sound car can be automatically detected by udev. So what
needs to be done is to unmute some channels and let alsa store and
restore mixer settings.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# pacman -S alsa-utils
# amixer set Master 90% unmute
# amixer set PCM 85% unmute
# aplay /usr/share/sounds/alsa/Front_Center.wav
# alsactl -f /var/lib/alsa/asound.state store
&lt;/pre&gt;

&lt;p&gt;Finally, edit /etc/rc.conf and add &quot;alsa&quot; to DAEMONS array to store
on shutdown and restore mixer settings on boot.&lt;/p&gt;

&lt;hr/&gt;

&lt;h1&gt;Customization and Applications&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: this part is quite personal. The purpose I
wrote it is mainly for documenting the steps so I myself may use it
later.&lt;/p&gt;

&lt;h2&gt;Applications&lt;/h2&gt;

&lt;p&gt;Following is a list of applications installed by category. Some
packages are only available from AUR and are marked by suffix [A].&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Development tools: gdb, strace, cmake, valgrind,
  gprof2dot-git[A], bochs, qemu, mmixware [A], ghc, cabal-install,
  sbcl, racket, fluxus-git[A], squeak-vm[A], squeak-image[A], ruby,
  python, ipython, ipython2, pylint, pychecker, pyflakes, pep8[A],
  scipy, python2-pybrain [A], python2-nltk, wxpython, python-httplib2,
  python-pygame, ropemacs[A], matplotlib, libgnomeui, python2-pandas, django,
  nginx, gunicorn[A], postgresql, python2-psycopg2, auto-complete[A],
  jdk7-openjdk, visualvm[A], eclipse, eclipse-findbugs[A], android-sdk[A],
  android-ndk[A], android-sdk-platform-tools[A], emacs-android-git[A],
  scala, scala-docs, scala-sources, sbt, r, emacs-ess-svn[A], nasm, clojure,
  subversion, rapidsvn, ctags, git, perl-term-readkey, tig, tk,
  perl-libwww, mercurial, darcs[A], xmlstarlet, cconv[A],
  emacs-markdown-mode-git[A]&lt;/li&gt;
  &lt;li&gt;Documentation: texlive-most, pdftk[A], aspell-en, multimarkdown-git&lt;/li&gt;
  &lt;li&gt;Font: ttf-dejavu, ttf-inconsolata, terminus-font,
  wqy-bitmapfont, wqy-zenhei, wqy-microhei[A], ttf-arphic-uming,
  ttf-ms-fonts[A], ttf-vista-fonts[A], ttf-ms-fonts-zh_cn[A]&lt;/li&gt;
  &lt;li&gt;Multimedia: mplayer, mencoder, ffmpeg, codecs, cdparanoia, lame,
  cuetools, flac, shntool, wavpack, mac, mp3info, vorbis-tools&lt;/li&gt;
  &lt;li&gt;Web: lynx, chromium, flashplugin-prerelease, w3m, curl, amule&lt;/li&gt;
  &lt;li&gt;Utilities: gnupg, unzip, zip, p7zip&lt;/li&gt;
  &lt;li&gt;Graphics: gnuplot, inkscape, processing, graphviz, gimp, blender, imagemagick, darktable&lt;/li&gt;
  &lt;li&gt;Reader: djview4 , evince, kchmviewer, fbreader, calibre,
  pdf2djvu, catdoc, tesseract, tesseract-data-eng&lt;/li&gt;
  &lt;li&gt;Network: whois, nfs-utils, xinetd&lt;/li&gt;
  &lt;li&gt;Mathematics: maxima&lt;/li&gt;
  &lt;li&gt;Education: timidity++, solfege&lt;/li&gt;
  &lt;li&gt;X: xscreensaver&lt;/li&gt;
  &lt;li&gt;Fun: povray&lt;/li&gt;
  &lt;li&gt;Libraries: gsl, atlas-lapack[A], libmtp&lt;/li&gt;
  &lt;li&gt;Science: pymol, biopython, stellarium, celestia&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Chinese Input&lt;/h2&gt;

&lt;p&gt;I install ibus as below:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# pacman -S ibus ibus-pinyin
&lt;/pre&gt;

&lt;p&gt;Then add the following lines into ~/.xprofile:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
export XMODIFIERS=@im=ibus
export GTK_IM_MODULE=ibus
export QT_IM_MODULE=ibus
ibus-daemon -d -x
&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; (2011-01-06): switch from SCIM to ibus.&lt;/p&gt;

&lt;h2&gt;Emacs&lt;/h2&gt;

&lt;p&gt;For Emacs package management, el-get is interesting to try. The
installation method is very unique and there is no need for an
ArchLinux package.&lt;/p&gt;

&lt;p&gt;Install scala-mode as below:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
$ cd ~/.emacs.d/plugins
$ svn co http://lampsvn.epfl.ch/svn-repos/scala/scala-tool-support/trunk/src/emacs/ scala-mode
&lt;/pre&gt;

&lt;p&gt;Get anything.el by &lt;kbd&gt;wget http://www.emacswiki.org/emacs/download/anything.el&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Install following packages: auctex, slime-cvs, emacs-w3m-cvs, pymacs.&lt;/p&gt;

&lt;p&gt;Install clojure related modes.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
$ cd ~/.emacs.d/plugins
$ git clone https://github.com/technomancy/clojure-mode.git clojure-mode
$ git clone https://github.com/technomancy/swank-clojure.git
$ mkdir ~/.swank-clojure
$ cd ~/.swank-clojure
## Get three jars in https://github.com/technomancy/swank-clojure/blog/master/swank-clojure.el manually.
&lt;/pre&gt;
 
&lt;h2&gt;Install Hyperspec for Common Lisp&lt;/h2&gt;

&lt;p&gt;Run the following commands:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# wget ftp://ftp.lispworks.com/pub/software_tools/reference/HyperSpec-7-0.tar.gz
# tar xzvf HyperSpec-7-0.tar.gz
# mkdir /usr/share/doc/hyperspec
# mv HyperSpec !$
&lt;/pre&gt;
 
&lt;h2&gt;Stumpwm&lt;/h2&gt;

&lt;p&gt;First invoke &lt;kbd&gt;sbcl&lt;/kbd&gt;, then type the following into
REPL. Note that ASDF install is used other than AUR. Note that
installation of trivial-gray-streams, flexi-streams, and cl-unicode
might not be needed.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
(&lt;span class=&quot;keyword&quot;&gt;require&lt;/span&gt; &#39;&lt;span class=&quot;constant&quot;&gt;asdf&lt;/span&gt;)
(&lt;span class=&quot;keyword&quot;&gt;require&lt;/span&gt; &#39;&lt;span class=&quot;constant&quot;&gt;asdf-install&lt;/span&gt;)
(asdf-install:install &lt;span class=&quot;string&quot;&gt;&quot;http://common-lisp.net/project/cl-plus-ssl/download/trivial-gray-streams.tar.gz&quot;&lt;/span&gt;)
(asdf-install:install &lt;span class=&quot;string&quot;&gt;&quot;http://weitz.de/files/flexi-streams.tar.gz&quot;&lt;/span&gt;)
(asdf-install:install &lt;span class=&quot;string&quot;&gt;&quot;http://weitz.de/files/cl-unicode.tar.gz&quot;&lt;/span&gt;)
(asdf-install:install &#39;clx)
(asdf-install:install &#39;cl-ppcre)
&lt;/pre&gt;

&lt;p&gt;When prompted by &quot;Install where&quot;, it is recommended to select
&quot;Personal Installation&quot; since it does not require root privilege. Note
that some packages do not have GPG signature, so if SBCL drops you
into debugger, simply select skip GPG check. If SBCL complaints and
exited (due to in --disable-debugger mode), type the following after
enter sbcl &lt;kbd&gt;(sb-ext:enable-debugger)&lt;/kbd&gt; or add it to
/etc/sbclrc as system initialize file for SBCL.&lt;/p&gt;

&lt;p&gt;After installation of the dependencies, quit SBCL by type
&lt;kbd&gt;(sb-ext:quit)&lt;/kbd&gt; and run the following at CLI:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
$ git clone http://git.sv.gnu.org/r/stumpwm.git stumpwm
$ cd stumpwm
$ ./autogen.sh
$ ./configure
$ make
&lt;/pre&gt;

&lt;p&gt;After copy stumpwm to a directory in PATH, one can add &quot;exec
stumpwm&quot; at the end of ~/.xinitrc. Then typing &lt;kbd&gt;startx&lt;/kbd&gt; will
bring up Stumpwm. Since I installed both GNOME and StumpWM, I decides
to write two scrips to automate the changes to .~/.xinitrc. With these
scripts, I can type &lt;kbd&gt;startg&lt;/kbd&gt; for GNOME or &lt;kbd&gt;starts&lt;/kbd&gt;
for StumpWM.&lt;/p&gt;

&lt;p&gt;Contents of script startg:&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
&lt;span class=&quot;comment-delimiter&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;!/usr/bin/&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt; bash
&lt;/span&gt;sed -e &lt;span class=&quot;string&quot;&gt;&#39;s/exec.*$/exec gnome-session/&#39;&lt;/span&gt; -i ~/.xinitrc
startx
&lt;/pre&gt;

&lt;p&gt;Contents of script starts:&lt;/p&gt;
&lt;pre class=&quot;code&quot;&gt;
&lt;span class=&quot;comment-delimiter&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;!/usr/bin/&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt; bash
&lt;/span&gt;&lt;span class=&quot;builtin&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;string&quot;&gt;&quot;exec stumpwm&quot;&lt;/span&gt; &amp;gt; ~/.xinitrc
startx
&lt;/pre&gt;

&lt;h2&gt;Miscellaneous&lt;/h2&gt;

For root, add one line in ~/.bash_profile to enable .bashrc

&lt;pre class=&quot;code&quot;&gt;
. $HOME/.bashrc
&lt;/pre&gt;

&lt;p&gt;To run indexing daily, run &lt;kbd&gt;crontab -e&lt;/kbd&gt; to add the
following line (&lt;strong&gt;Update&lt;/strong&gt; (2010-12-28): this step is not
needed since updatedb is already added in /etc/cron.daily during
installation of mlocate):&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
11 11 * * * updatedb
&lt;/pre&gt;

&lt;p&gt;To keep boot messages on tty1 instead of clearing screen, add
option for tty1 in &lt;em&gt;/etc/inittab&lt;/em&gt; like below:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
c1:2345:respawn:/sbin/agetty -i -8 38400 tty1 linux
&lt;/pre&gt;

&lt;h1&gt;Conclusion&lt;/h1&gt;

&lt;p&gt;After using Arch Linux for a long time, I have to say that I&#39;m
extremely satisfied. Your system may not be extremely fast as Gentoo
boxes, but what you gain is significant: invaluable time.&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/7510729857870477905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2010/12/switching-from-gentoo-linux-to-arch.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/7510729857870477905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/7510729857870477905'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2010/12/switching-from-gentoo-linux-to-arch.html' title='Switching From Gentoo Linux to Arch Linux'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-7426935331413370858</id><published>2010-03-13T11:39:00.003+08:00</published><updated>2010-03-13T11:39:55.378+08:00</updated><title type='text'>My List of Android Apps</title><content type='html'>&lt;p&gt;I have been using HTC magic for 5 months. Although apps installed
on top of cyanogenmod change week by week (if not day by day), I&#39;d
like to take a snapshot as shown below.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;3banana&lt;/strong&gt;: take quick notes. I sometimes use it
  to draft tweets which are sent out later when network connection is
  available.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Aldiko&lt;/strong&gt;: ebook reader (specifically, an ePub
  reader). The builtin support of Feedbook catalog is fantastic.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Amazon&lt;/strong&gt;: for quick lookup of prices.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;APNdroid&lt;/strong&gt;: control GPRS/EDGE/3G traffic.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;ASTRO&lt;/strong&gt;: file manager. Can also manage apps, show
  SD card usage, and display running processes/services.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Barcode Scanner&lt;/strong&gt;: scan various codes. Good to
  scan QR code in Web to install apps.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Battery Monitor&lt;/strong&gt;: show remaining battery
  percentage in notification area.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Bible KJV&lt;/strong&gt;: the Bible.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;CalWidget&lt;/strong&gt;: highly customizable calendar
  widget. I just places one 4x4 widget at my left home screen. Much
  better than default widget.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Cavedroid&lt;/strong&gt;: one addictive small 3D game.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;EasyMoney&lt;/strong&gt;: financial status manager.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;FlipSilent&lt;/strong&gt;: simply flip your phone to mute all sounds.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Google Pinyin&lt;/strong&gt;: input method for Chinese.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Google Sky Map&lt;/strong&gt;: cool app to view stars.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Google Voice&lt;/strong&gt;: free SMS (English text only to non-GV users).&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;GPS Status&lt;/strong&gt;: show GPS information as well as a compass.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;handyCalc&lt;/strong&gt;: a very powerful calculator. Serve as
  unit/currency converter as well.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;HiDict&lt;/strong&gt;: support offline dictionary.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;iReader&lt;/strong&gt;: I mainly use it to read transcripts
  (plain text format) of Tell Me More from NPR News.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Kids Paint&lt;/strong&gt;: free drawing on screen. My daughter likes it.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Listen&lt;/strong&gt;: podcast client. Integrate subscriptions
  with Google Reader now.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;MarketEnabler&lt;/strong&gt;: for rooted phone only. Useful
  for purchasing apps when your country is not in official support
  list.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;My Tracks&lt;/strong&gt;: I mainly use it for geotagging now.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;NetCounter&lt;/strong&gt;: look up data plan consumption
  instantly.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;NewsRob&lt;/strong&gt;: two-way synchronization with Google
  Reader. Grab contents for offline consumptions.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Places Directory&lt;/strong&gt;: convenient to search nearby
  restaurants, banks etc.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Real Blackjack&lt;/strong&gt;: try this one if you want to
  practice card counting...&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;RMaps&lt;/strong&gt;: view maps offline.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Secrets&lt;/strong&gt;: store your various passwords, account
  information here. Have strong security protection.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Shopper&lt;/strong&gt;: shopping program from Google.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Shuffle&lt;/strong&gt;: GTD tool.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Sipdroid&lt;/strong&gt;: SIP client. Can be combined with
  Google Voice for free calls to US numbers.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;SpacePhysics&lt;/strong&gt;: challenging 2D physics
  game.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Swype&lt;/strong&gt;: fantastic English input method.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Twidroid&lt;/strong&gt;: Twitter client. Supports proxy
  API.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;World Weather Clock&lt;/strong&gt;: I now place two widgets on
  my home screen: one for home city, another for the destination I&#39;m
  going to travel.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are many cool apps that I installed and uninstalled later,
because I seldom used them although they are awesome. For example,
Layar, Shazam and Google Goggles are just some of them.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/7426935331413370858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2010/03/my-list-of-android-apps.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/7426935331413370858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/7426935331413370858'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2010/03/my-list-of-android-apps.html' title='My List of Android Apps'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-2279269894005734058</id><published>2009-01-01T21:31:00.003+08:00</published><updated>2009-02-11T13:55:35.493+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="sbcl"/><category scheme="http://www.blogger.com/atom/ns#" term="stumpwm"/><title type='text'>Upgrading SBCL</title><content type='html'>&lt;p&gt;Recently I upgraded SBCL from version 1.0.22 to
1.0.23. Then my window
manager, &lt;a href=&quot;http://yujianzhang.blogspot.com/2008/07/experiencing-stumpwm.html&quot;&gt;Stumpwm&lt;/a&gt;
refused to start. I have to solve the issue, otherwise I will start
using console exclusively starting from 2009.&lt;/p&gt;

&lt;p&gt;My first reaction was to reinstall stumpwm package. But when
compiling, SBCL is complaining that there are version mismatch for
stumpwm dependencies. I tried to solve the issue by reinstalling that
package, but I met the same problem for its dependencies. I realized
that I just stumbled upon dependency hell. I don&#39;t want to go through
the same process of installing every CL package when I upgrade
SBCL. So I need to find one simple solution. Indeed it exists: just
delete all *.fasl files in SBCL&#39;s site directory (which
is &lt;em&gt;/usr/lib/sbcl/site&lt;/em&gt; under Arch Linux.), and then SBCL will
rebuild all the installed packages. So the following command just
solves the problem (assuming Arch Linux).&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
find /usr/lib/sbcl/site -name &lt;span class=&quot;string&quot;&gt;&quot;*.fasl&quot;&lt;/span&gt; -delete
&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt; (2009-2-11): do &lt;strong&gt;NOT&lt;/strong&gt; run above command on the parent
directory &lt;em&gt;/usr/lib/sbcl&lt;/em&gt;, otherwise the fasl files bundled with SBCL will be deleted 
and many functionalities (e.g. ASDF) will break.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/2279269894005734058/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2009/01/upgrading-sbcl.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/2279269894005734058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/2279269894005734058'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2009/01/upgrading-sbcl.html' title='Upgrading SBCL'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-3043190908786333499</id><published>2008-12-24T20:37:00.001+08:00</published><updated>2008-12-29T08:13:11.431+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="imagemagick"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="photo"/><title type='text'>Adjusting Photos for Web Albums in Batch Mode</title><content type='html'>&lt;p&gt;I use Picasa Web Album to
store &lt;a href=&quot;http://picasaweb.google.com/yujian.zhang&quot;&gt;my photos
online&lt;/a&gt;. To save the precious storage at server, I have to change
jpeg files before uploading them even for those taken by my old
PowerShot S30 (which outputs photos with resolution 2048x1536, which
is beyond the display capacity of most monitors today). To reduce file
size, one normally need to reduce both resolution and image
quality.&lt;/p&gt;

&lt;p&gt;So how to adjust images in batch mode? There are various solutions
of course. The one I take is to use the combination of
find/xargs/mogrify (Note that &lt;em&gt;mogrify&lt;/em&gt; modifies files in
place. Therefore one may use &lt;em&gt;convert&lt;/em&gt; instead of
&lt;em&gt;mogrify&lt;/em&gt; to preserve original files.) in Linux. Note that
mogrify is one of ImageMagick utilities and may need separate
installation depending on distribution. Following is my work flow when
publishing images online.&lt;/p&gt;

&lt;p&gt;Firstly, I select images with my preferred viewer
&lt;em&gt;gthumb&lt;/em&gt;. Images are rotated if necessary. During browsing, I
copy the chosen files to another folder and run the following command
in that folder:&lt;/p&gt;

&lt;kbd&gt;find . -iname &quot;*.jpg&quot; | xargs mogrify -resize
&lt;em&gt;resize-option&lt;/em&gt; -quality &lt;em&gt;quality-option&lt;/em&gt;&lt;/kbd&gt;

&lt;p&gt;(I find the above command from &lt;a
href=&quot;http://www.perturb.org/display/entry/632/&quot;&gt;here&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;Several notes regarding the above command:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;em&gt;resize-option&lt;/em&gt; could be either absolute (e.g. &lt;em&gt;800x600&lt;/em&gt;)
  or relative (e.g. &lt;em&gt;50%&lt;/em&gt;). For my S30, I use the latter which
  reduce the photo resolution to 1/4 of its original size.
  &lt;/li&gt;
  &lt;li&gt;&lt;em&gt;quality-option&lt;/em&gt; is JPEG compression level. The larger
  the value, the better the quality, but the larger the file size. I often
  set the value as &lt;em&gt;60&lt;/em&gt; to save space.
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So for photos from my S30, I use the following command:&lt;/p&gt;

&lt;kbd&gt;find . -iname &quot;*.jpg&quot; | xargs mogrify -resize 50%
-quality 60&lt;/kbd&gt;

&lt;p&gt;After running above command, photo file size can be reduced around 10
times. This means that I can put more images into my web album.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/3043190908786333499/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/12/adjusting-photos-for-web-albums-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/3043190908786333499'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/3043190908786333499'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/12/adjusting-photos-for-web-albums-in.html' title='Adjusting Photos for Web Albums in Batch Mode'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-8412210122565372639</id><published>2008-08-20T20:25:00.000+08:00</published><updated>2008-08-20T20:26:33.746+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gentoo"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="virtualbox"/><title type='text'>W(S)XGA+ Resolution in VirtualBox</title><content type='html'>&lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: this post is related to a workaround for one
specific problem encountered by the author.&lt;/p&gt;

&lt;p&gt;Recently I switched from coLinux to VirtualBox. VirtualBox provides
guest addition which includes enhanced support for Video. Originally
it worked fine for me. Due to unknown reason, the problem arises: I
could not use resolution 1440x900 (WXGA+) or 1680x1050 (WSXGA+) any
more. WXGA+ is the native resolution of my laptop, while WSXGA+ is the
resolution of the external LCD when the laptop is placed in a
dock. After tweaking for a long time, following is the solution I
found so far (I installed Gentoo Linux as guest OS).&lt;/p&gt;

&lt;h4&gt;1. Revert video driver from VirtualBox to Vesa&lt;/h4&gt;

&lt;p&gt;This is done by editing &lt;em&gt;/etc/X11/xorg.conf&lt;/em&gt;, change one
line in Section &lt;em&gt;Device&lt;/em&gt; from &lt;code&gt;Driver &quot;vboxvideo&quot;&lt;/code&gt;
to &lt;code&gt;Driver &quot;vesa&quot;.&lt;/p&gt;

&lt;h4&gt;2. Install support of 1440x900 and 1680x1050 to VESA BIOS&lt;/h4&gt;

&lt;p&gt;Add parameter &lt;code&gt;vga=864&lt;/code&gt; as Linux bootup parameter
(e.g. in &lt;em&gt;/boot/grub/grub.conf&lt;/em&gt;) for resolution 1440x900,
or &lt;code&gt;vga=865&lt;/code&gt; for 1680x1050.&lt;/p&gt;

&lt;p&gt;When Virtual machine is turned off, run the following two commands
at Windows command line prompt, assuming virtual machine is named
&quot;Gentoo&quot;:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
VBoxManage setextradata &quot;Gentoo&quot; &quot;CustomeVideoMode1&quot; &quot;1440x900x24&quot;
VBoxManage setextradata &quot;Gentoo&quot; &quot;CustomeVideoMode2&quot; &quot;1680x1050x24&quot;
&lt;/pre&gt;

&lt;p&gt;Start virtual machine, select resolution 1440x900 or 1680x1050 for
console display. Note that the resolution for console is not
necessarily the same resolution for X, i.e. you can use 1440x900 for
console, and 1680x1050 for X.&lt;/p&gt;

&lt;h4&gt;3. Add modelines for resolution 1440x900 and 1680x1050.&lt;/h4&gt;

&lt;p&gt;I use &lt;em&gt;gtf&lt;/em&gt; to generate needed modelines. For example for
resolution 1440x900 with 60 Hz refresh rate, I use the following
command:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
$ gtf 1440 900 60
&lt;/pre&gt;

&lt;p&gt;which give the following line:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
  Modeline &quot;1440x900_60.00&quot;  106.47  1440 1520 1672 1904  900 901 904 932  -HSync +Vsync
&lt;/pre&gt;

&lt;p&gt;I do not like the suffix &lt;em&gt;_60.00&lt;/em&gt;, therefore what finally
end up in section &lt;em&gt;Monitor&lt;/em&gt; of &lt;em&gt;/etc/X11/xorg.conf&lt;/em&gt; is
(with addition of modeline for 1680x1050):&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
 modeline &quot;1440x900&quot; 106.47 1440 1520 1672 1904 900 901 904 932 -HSync +Vsync
 modeline  &quot;1680x1050&quot;  147.14  1680 1784 1968 2256  1050 1051 1054 1087  -HSync +Vsync
&lt;/pre&gt;

&lt;p&gt;In addition, the two modes should be added in
section &lt;em&gt;Screen&lt;/em&gt; of &lt;em&gt;/etc/X11/xorg.conf&lt;/em&gt; as well, my
current setting is:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
Section &quot;Screen&quot;
 Identifier &quot;Screen0&quot;
 Device     &quot;Card0&quot;
 Monitor    &quot;Monitor0&quot;
 DefaultDepth     24
 SubSection &quot;Display&quot;
  Viewport   0 0
  Depth     24
  Modes    &quot;1680x1050&quot; &quot;1440x900&quot;
 EndSubSection
EndSection
&lt;/pre&gt;

&lt;h4&gt;4. Select the resolution&lt;/h4&gt;

&lt;p&gt;Now the toughest part. You may have noticed that in
section &lt;em&gt;Monitor&lt;/em&gt;, there are two lines about &lt;em&gt;HorizSync&lt;/em&gt;
and &lt;em&gt;VertRefresh&lt;/em&gt;. After experimenting, my conclusion is that
one should comment out them when using 1680x1050 while enable them for
1440x900. Weird.&lt;/p&gt;

&lt;p&gt;Since I need to switch between these two resolutions frequently,
manually editing file &lt;em&gt;/etc/X11/xorg.conf&lt;/em&gt; is boring. Therefore
I write one script to automate the task. I named the script
as &lt;em&gt;xres&lt;/em&gt; and invoke it as &lt;kbd&gt;sudo xres 1440&lt;/kbd&gt; for resolution
1440x900 and &lt;kbd&gt;sudo xres 1680&lt;/kbd&gt; for 1680x1050. Following is its
content:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
&lt;span class=&quot;comment-delimiter&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;!/bin/&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;bash&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;
&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;case&lt;/span&gt; $&lt;span class=&quot;variable-name&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt; in&lt;/span&gt;
    1440)
        sed -i &lt;span class=&quot;string&quot;&gt;&#39;s/^#    HorizSync    31.5 - 64.3/       HorizSync    31.5 - 64.3/&#39;&lt;/span&gt; /etc/X11/xorg.conf
        sed -i &lt;span class=&quot;string&quot;&gt;&#39;s/^#    VertRefresh  50.0 - 70.0/       VertRefresh  50.0 - 70.0/&#39;&lt;/span&gt; /etc/X11/xorg.conf
        ;;
    1680)
        sed -i &lt;span class=&quot;string&quot;&gt;&#39;s/^     HorizSync    31.5 - 64.3/#      HorizSync    31.5 - 64.3/&#39;&lt;/span&gt; /etc/X11/xorg.conf
        sed -i &lt;span class=&quot;string&quot;&gt;&#39;s/^     VertRefresh  50.0 - 70.0/#      VertRefresh  50.0 - 70.0/&#39;&lt;/span&gt; /etc/X11/xorg.conf
        ;;
    *)
        &lt;span class=&quot;builtin&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;string&quot;&gt;&quot;Supported horizontal resolution: 1440 and 1680.&quot;&lt;/span&gt;
        &lt;span class=&quot;keyword&quot;&gt;exit&lt;/span&gt;
        ;;
&lt;span class=&quot;keyword&quot;&gt;esac&lt;/span&gt;
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/8412210122565372639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/08/wsxga-resolution-in-virtualbox.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/8412210122565372639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/8412210122565372639'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/08/wsxga-resolution-in-virtualbox.html' title='W(S)XGA+ Resolution in VirtualBox'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-4078904903330752470</id><published>2008-07-24T00:43:00.003+08:00</published><updated>2010-02-09T23:44:52.262+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gentoo"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="stumpwm"/><title type='text'>Experiencing Stumpwm</title><content type='html'>&lt;blockquote&gt;What Emacs is to editors, Stumpwm is to window managers.
&lt;br/&gt; --Bill Clementson (&lt;a
href=&quot;http://bc.tech.coop/blog/080429.html&quot;&gt;link&lt;/a&gt;)&lt;/blockquote&gt;

&lt;h2&gt;Introduction&lt;/h2&gt;

&lt;p&gt;Recently I switched from GNOME to &lt;a
href=&quot;http://www.nongnu.org/stumpwm/&quot;&gt;Stumpwm&lt;/a&gt; (&lt;a
href=&quot;http://en.wikipedia.org/wiki/Stumpwm&quot;&gt;wiki&lt;/a&gt;), which means
that I jumped out of a desktop environment to a simple window manager.
So far, I&#39;m very satisfied with such a change and never looked back.
Stumpwm, as its website says, &lt;q&gt;is a tiling, keyboard driven X11
Window Manager written entirely in Common Lisp&lt;/q&gt;. This definition
summarizes the reasons why Stumpwm is so suitable for me.&lt;/p&gt;

&lt;p&gt;First, Stumpwm is a &lt;strong&gt;tiling, keyboard driven&lt;/strong&gt; window
manager. This is very useful to boost productivity. When working, it
is desirable to minimize context switching. Tilting combined with
keyboard driven enables working with several applications
simultaneously as if your are dealing with one single program. Let me
give an example. As described in &lt;a
href=&quot;http://yujianzhang.blogspot.com/2007/11/emacs-firefox-as-blog-development.html&quot;&gt;previous
post&lt;/a&gt;, with Emacs as development environment, it is easy to fire up
one browser within Emacs itself to preview blog post. However it is
painful to switch between Emacs and browser. Before using Stumpwm, I
am considering ways to integrate Emacs and Firefox together. With
Stumpwm, such &lt;em&gt;dream&lt;/em&gt; is just trivial to fulfill: one can show
Emacs and browser side by side, with a few keystrokes to switch
between them. Everytime you make changes in Emacs and request the
results to be shown in Firefox, they are shown simultaneously. No more
need to leave your hand for mouse to click back and forth between
Emacs and Firefox. This gives you the feeling of &lt;em&gt;integrated&lt;/em&gt;
environment. Note that I just use Emacs and Firefox as an example, and
such convenience is applicable for every application. Currently, the
problem is that I&#39;m so accustomed to Stumpwm keystrokes that I somehow
confused the keystrokes of switching between windows in Stumpwm and
Emacs!&lt;/p&gt;

&lt;p&gt;Second, Stumpwm is &lt;strong&gt;written in Common Lisp&lt;/strong&gt;.  which
means that you can build Stumpwm with your favorite CL implementation
and you have a Lisp runtime when you work under Stumpwm. A powerful
programming language is just embedded within your window manager and
you can invoke it at any time. The other benefit is that you can
configure your window manager as you like, even when it is
running!&lt;/p&gt;

&lt;p&gt;You may get a feeling on how Stumpwm works by watching this nice &lt;a
href=&quot;http://www.archive.org/details/TheStumpWMExperience&quot;&gt;video&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Installation&lt;/h2&gt;

&lt;p&gt;Given the above lengthy introduction of Stumpwm, you may wonder how
to install this gem. Here we assume that you have some knowledge about
Common Lisp. Basically, installing Stumpwm is to compile it with your
preferred CL implementation, and tell your system to run Stumpwm as
your window manager.&lt;/p&gt;

&lt;p&gt;Installing Stumpwm on Gentoo Linux is straightforward. Throughout
this section, we will assume that SBCL is the CL
implementation. Stumpwm website suggests turn off threading support in
SBCL (disable USE flag &lt;em&gt;threads&lt;/em&gt;) for better performance. To
install, simply type &lt;kbd&gt;emerge stumpwm&lt;/kbd&gt;. Note
that at the time of writing, there is also an ebuild called
stumpwm-cvs. Simply ignore it since it is actually a very old version,
not the bleeding edge version suggested by its name. Advanced users
might consider to get git version for latest cool features. &lt;/p&gt;

&lt;p&gt;There are mainly two ways to invoke Stumpwm. One is to run it by
calling SBCL, the other is to dump a core image containing Stumpwm
within SBCL and invoke that image. We will take the latter
approach. To proceed, first start SBCL by typing &lt;kbd&gt;sbcl&lt;/kbd&gt;. Next
issue the following in REPL sequentially:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
(asdf:oos &#39;asdf:load-op &lt;span class=&quot;builtin&quot;&gt;:stumpwm&lt;/span&gt;)
(sb-ext:save-lisp-and-die &lt;span class=&quot;string&quot;&gt;&quot;stumpwm&quot;&lt;/span&gt; &lt;span
class=&quot;builtin&quot;&gt;:executable&lt;/span&gt; t
                          &lt;span class=&quot;builtin&quot;&gt;:toplevel&lt;/span&gt; #&#39;(&lt;span class=&quot;keyword&quot;&gt;lambda&lt;/span&gt; () (stumpwm:stumpwm &lt;span class=&quot;string&quot;&gt;&quot;:0&quot;&lt;/span&gt;)))
&lt;/pre&gt;

&lt;p&gt;Next, put the generated executable &lt;em&gt;stumpwm&lt;/em&gt; somewhere in
PATH (I put it under /usr/local/bin). Since I always start X Window by
typing &lt;kbd&gt;startx&lt;/kbd&gt;, following command is used to use Stumpwm as
my window manager:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
$ echo &quot;exec stumpwm&quot; &gt;&gt; ~/.xinitrc
&lt;/pre&gt;

&lt;h2&gt;Using Stumpwm&lt;/h2&gt;

&lt;h3&gt;Configuration&lt;/h3&gt;

&lt;p&gt;All stumpwm configurations are stored in
file &lt;em&gt;~/.stumpwmrc&lt;/em&gt;, which is written in Common Lisp. Just
like &lt;em&gt;.emacs&lt;/em&gt;, this file allows you to fully customize
Stumpwm. Following is my current configuration:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
&lt;span class=&quot;comment-delimiter&quot;&gt;;;;; &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;-*- Mode: Lisp -*-
&lt;/span&gt;
(&lt;span class=&quot;keyword&quot;&gt;in-package&lt;/span&gt; &lt;span class=&quot;builtin&quot;&gt;:stumpwm&lt;/span&gt;)

&lt;span class=&quot;comment-delimiter&quot;&gt;;; &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;Load swank.
&lt;/span&gt;(load &lt;span class=&quot;string&quot;&gt;&quot;/usr/share/emacs/site-lisp/slime/swank-loader.lisp&quot;&lt;/span&gt;)
(swank-loader:init)
(define-stumpwm-command &lt;span class=&quot;string&quot;&gt;&quot;swank&quot;&lt;/span&gt; ()
  (setf stumpwm:*top-level-error-action* &lt;span class=&quot;builtin&quot;&gt;:break&lt;/span&gt;)
  (swank:create-server &lt;span class=&quot;builtin&quot;&gt;:port&lt;/span&gt; 4005
                       &lt;span class=&quot;builtin&quot;&gt;:style&lt;/span&gt; swank:*communication-style*
                       &lt;span class=&quot;builtin&quot;&gt;:dont-close&lt;/span&gt; t)
  (echo-string (current-screen) &lt;span class=&quot;string&quot;&gt;&quot;Starting swank.&quot;&lt;/span&gt;))
(define-key *root-map* (kbd &lt;span class=&quot;string&quot;&gt;&quot;C-s&quot;&lt;/span&gt;) &lt;span class=&quot;string&quot;&gt;&quot;swank&quot;&lt;/span&gt;)       

&lt;span class=&quot;comment-delimiter&quot;&gt;;; &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;Customize bars and modeline.
&lt;/span&gt;(setf *message-window-gravity* &lt;span class=&quot;builtin&quot;&gt;:center&lt;/span&gt;)
(setf *input-window-gravity* &lt;span class=&quot;builtin&quot;&gt;:center&lt;/span&gt;)
&lt;span class=&quot;comment-delimiter&quot;&gt;;; &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;Turn on mode line.
&lt;/span&gt;(toggle-mode-line (current-screen) (current-head))
(setf *screen-mode-line-format* 
      (list &lt;span class=&quot;string&quot;&gt;&quot;%w | &quot;&lt;/span&gt;
            &#39;(&lt;span class=&quot;builtin&quot;&gt;:eval&lt;/span&gt; (run-shell-command &lt;span class=&quot;string&quot;&gt;&quot;date | tr -d &#39;[:cntrl:]&#39;&quot;&lt;/span&gt; t))))

(set-prefix-key (kbd &lt;span class=&quot;string&quot;&gt;&quot;C-i&quot;&lt;/span&gt;))
(define-key *root-map* (kbd &lt;span class=&quot;string&quot;&gt;&quot;c&quot;&lt;/span&gt;) 
  &lt;span class=&quot;string&quot;&gt;&quot;exec urxvt +sb -fn \&quot;xft:Bitstream Vera Sans Mono:&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&lt;span class=&quot;flyspell-incorrect&quot;&gt;pixelsize&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;=20\&quot;&quot;&lt;/span&gt;)

(define-stumpwm-command &lt;span class=&quot;string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&lt;span class=&quot;flyspell-duplicate&quot;&gt;firefox&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;&lt;/span&gt; ()
  &lt;span class=&quot;string&quot;&gt;&quot;Run or switch to firefox.&quot;&lt;/span&gt;
  (run-or-raise &lt;span class=&quot;string&quot;&gt;&quot;firefox&quot;&lt;/span&gt; &#39;(&lt;span class=&quot;builtin&quot;&gt;:class&lt;/span&gt; &lt;span class=&quot;string&quot;&gt;&quot;Firefox&quot;&lt;/span&gt;)))
(define-key *root-map* (kbd &lt;span class=&quot;string&quot;&gt;&quot;f&quot;&lt;/span&gt;) &lt;span class=&quot;string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&lt;span class=&quot;flyspell-duplicate&quot;&gt;firefox&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;string&quot;&gt;&quot;&lt;/span&gt;)
&lt;/pre&gt;

&lt;p&gt;Some explanations of my configuration:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Prefix key&lt;/strong&gt;: I use &lt;kbd&gt;C-i&lt;/kbd&gt; instead of
  default &lt;kbd&gt;C-t&lt;/kbd&gt;. The reason is that &lt;kbd&gt;C-t&lt;/kbd&gt; is used in
  Firefox to open a new tab and also in Emacs for transpose. Then why
  choose &lt;kbd&gt;C-i&lt;/kbd&gt;? I&#39;d like to admit that it is quite difficult
  to select a prefix key for Emacs user. Before settle down
  on &lt;kbd&gt;C-i&lt;/kbd&gt;, I fired up Emacs to see whether there is any key
  binding &lt;kbd&gt;C-x&lt;/kbd&gt; where &lt;em&gt;x&lt;/em&gt; from a to z is not used by
  Emacs. Unfortunately (fortunately?), Emacs binds every
  combination. So I can only choose one prefix key which is easy to
  type and I uses infrequently in Emacs. Then &lt;kbd&gt;C-i&lt;/kbd&gt; is
  selected. Note that you can send &lt;kbd&gt;C-i&lt;/kbd&gt; to application like
  Emacs by typing &lt;kbd&gt;C-i i&lt;/kbd&gt;. For the following sections, please
  replace &lt;kbd&gt;C-i&lt;/kbd&gt; with your favorite prefix key.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;SLIME&lt;/strong&gt;: the section staring with
  comments &lt;em&gt;Load swank&lt;/em&gt; provides ways to load
  swank. Type &lt;kbd&gt;C-i C-s&lt;/kbd&gt; to start swank. To connect to swank,
  simply run Emacs, and type &lt;kbd&gt;slime-connect&lt;/kbd&gt; within Emacs,
  and type &lt;kbd&gt;RET&lt;/kbd&gt; and &lt;kbd&gt;RET&lt;/kbd&gt; to accept default host
  (127.0.0.1) and default port (4005). Then you can play with Stumpwm
  as you wish: change parameters, add your own functions etc. Note
  that I do not start swank automatically for security reasons. &lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Key bindings&lt;/strong&gt;: I use &lt;kbd&gt;C-i c&lt;/kbd&gt; to start
  console: &lt;em&gt;urxvt&lt;/em&gt; instead of &lt;em&gt;xterm&lt;/em&gt;. Note that I have
  also set the font for urxvt. In addition I have setup using &lt;kbd&gt;C-i
  f&lt;/kbd&gt; to start Firefox in case Firefox is not started, or bring
  Firefox window to front if it is already running.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Key Bindings&lt;/h3&gt;

&lt;p&gt;Following is a list of key bindings I used frequently. For
simplicity, I have omitted the prefix key.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;kbd&gt;?&lt;/kbd&gt;: Stumpwm help&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;;&lt;/kbd&gt;: Run Stumpwm commands&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;:&lt;/kbd&gt;: Send commands to Common Lisp interpreter.&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;Space&lt;/kbd&gt;: Go to next window&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;c&lt;/kbd&gt;: Run X terminal&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;e&lt;/kbd&gt;: Run Emacs or raise it if it is already running&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;f&lt;/kbd&gt;: Run Firefox or raise it if it is already running&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;k&lt;/kbd&gt;: Kill current window&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;g c&lt;/kbd&gt;: Create a new group&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;g k&lt;/kbd&gt;: Kill current group&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;g m&lt;/kbd&gt;: Move current window to a specified group&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;g Space&lt;/kbd&gt;: Next group&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;o&lt;/kbd&gt;: Focus shifts to next frame&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;Q&lt;/kbd&gt;: Remove all splits&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;s&lt;/kbd&gt;: Vertical split&lt;/li&gt;
  &lt;li&gt;&lt;kbd&gt;S&lt;/kbd&gt;: Horizontal split&lt;/li&gt;
&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/4078904903330752470/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/07/experiencing-stumpwm.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/4078904903330752470'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/4078904903330752470'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/07/experiencing-stumpwm.html' title='Experiencing Stumpwm'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-4753644910073532044</id><published>2008-05-21T20:13:00.001+08:00</published><updated>2010-02-23T11:16:54.505+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="colinux"/><category scheme="http://www.blogger.com/atom/ns#" term="gentoo"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><title type='text'>Using PulseAudio for OSS Applications</title><content type='html'>&lt;p&gt;In my &lt;a
href=&quot;yujianzhang.blogspot.com/2008/04/enable-sound-for-colinux.html&quot;&gt;previous
post&lt;/a&gt;, I discussed how to use PulseAudio to enable sound for
coLinux. This works fine for programs like MPlayer, but has issues
with some programs e.g. Solfege.&lt;/p&gt;

&lt;p&gt;The solution is simple: if the problematic applications have
support for OSS, then emerge them with &lt;em&gt;OSS&lt;/em&gt; USE flag on. In
addition, PulseAudio should also be emerged with &lt;em&gt;OSS&lt;/em&gt; USE flag
(to enable the building of padsp, a PulseAudio OSS wrapper, which will
be discussed below). Under Gentoo Linux, one way is to simply
add &lt;em&gt;OSS&lt;/em&gt; USE flag to &lt;em&gt;/etc/make.conf&lt;/em&gt;. Alternative way
is to enable the USE flag application by application. For example, to
enable OSS USE flag for Solfege, type the following:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# echo &quot;media-sound/solfege oss&quot; &gt;&gt; /etc/portage/package.use
&lt;/pre&gt;

&lt;p&gt;When running these applications, prefix the command line
with &lt;em&gt;padsp&lt;/em&gt; like the following:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
$ padsp solfege
&lt;/pre&gt;

&lt;p&gt;Note that you may need additional configurations in the application
 to use OSS for audio output.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/4753644910073532044/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/05/using-pulseaudio-for-oss-applications.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/4753644910073532044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/4753644910073532044'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/05/using-pulseaudio-for-oss-applications.html' title='Using PulseAudio for OSS Applications'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-2935692554054278519</id><published>2008-05-05T21:22:00.002+08:00</published><updated>2008-05-06T10:57:16.793+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="camcorder"/><category scheme="http://www.blogger.com/atom/ns#" term="gadget"/><category scheme="http://www.blogger.com/atom/ns#" term="hv30"/><title type='text'>HV30: Camcorder and Accessories</title><content type='html'>&lt;p&gt;I just bought Canon HV30 (&lt;a
href=&quot;http://www.amazon.com/dp/B00114PN1U/thoinair-20&quot;&gt;Amazon&lt;/a&gt;, &lt;a
href=&quot;http://www.camcorderinfo.com/content/Canon-HV30-Camcorder-Review-34401.htm&quot;&gt;Review&lt;/a&gt;)
recently for my baby. Before buying HV30, I was agonizing over the
selection between HV30 and Canon HF10 (&lt;a
href=&quot;http://www.amazon.com/dp/B001144JQU/thoinair-20&quot;&gt;Amazon&lt;/a&gt;, &lt;a
href=&quot;http://www.camcorderinfo.com/content/Canon-Vixia-HF10-Camcorder-Review-34711.htm&quot;&gt;Review&lt;/a&gt;)
(although I know that HF100 is better than HF10 from money point of
view since the internal 16GB flash drive of HF10 does not justify the
price difference, I do like the black paint job of HF10 and HV30).&lt;/p&gt;

&lt;h3&gt;Comparison of HV30 vs. HF10&lt;/h3&gt;

&lt;p&gt;So why I chose HV30 over HF10? The following is my comparison.&lt;/p&gt;

&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;1&quot; border=&quot;1&quot;&gt;
&lt;tr&gt;&lt;th&gt;Features&lt;/th&gt;&lt;th&gt;HV30&lt;/th&gt;&lt;th&gt;HF10&lt;/th&gt;&lt;th&gt;Comments&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Price&lt;/th&gt;
  &lt;td style=&quot;background: lime&quot;&gt;MSRP price is $999 in US and
  &amp;yen;10580.00 (about $1514) in China&lt;/td&gt;
  &lt;td&gt;MSRP price is $1099 in US and &amp;yen;14080.00 (about $2014) in
  China&lt;/td&gt;
  &lt;td&gt;The price difference in China is quite significant, which is
  true even for street price.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Performance&lt;/th&gt;
  &lt;td style=&quot;background: lime&quot;&gt;1/2.7 in. sensor&lt;/td&gt;
  &lt;td&gt;1/3.2 in. sensor&lt;/td&gt;
  &lt;td&gt;According to the &lt;a
href=&quot;http://www.camcorderinfo.com/content/Canon-Vixia-HF10-Camcorder-Review-34711.htm&quot;&gt;review&lt;/a&gt;,
HV30 has slightly better performance over HF10 thanks to larger
sensor, however the gain seems to be marginal for most cases.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Functionalities&lt;/th&gt;
  &lt;td style=&quot;background: lime&quot;&gt;Viewfinder, Zebra, Peaking&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Accessories&lt;/th&gt;
  &lt;td style=&quot;background: lime&quot;&gt;Standard accessory shoe&lt;/td&gt;
  &lt;td&gt;Canon proprietary accessory shoe&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Backup&lt;/th&gt;
  &lt;td style=&quot;background: lime&quot;&gt;Tapes are cheap for backup&lt;/td&gt;
  &lt;td&gt;Additional backup is needed since SDHC cards are expensive and
  will be reused.&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Community&lt;/th&gt;
  &lt;td style=&quot;background: lime&quot;&gt;A mature community (looking at hv20.com
  for example)&lt;/td&gt;
  &lt;td&gt;Situation will improve&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Form Factor&lt;/th&gt;
  &lt;td&gt;88x82x138 mm (3.5x3.2x5.4 in.), 535 g (1.2 lb.)&lt;/td&gt;
  &lt;td style=&quot;background: lime&quot;&gt;73x64x129 mm (2.9x2.5x5.1 in.), 380 g
  (13.4 oz)&lt;/td&gt;
  &lt;td&gt;HF10 is small and light, which is ideal for traveling. Normally
  the camcorder which you takes out often is the most useful one.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Media&lt;/th&gt;
  &lt;td&gt;Tape&lt;/td&gt;
  &lt;td style=&quot;background: lime&quot;&gt;SDHC card + internal Flash&lt;/td&gt;
  &lt;td&gt;Flash card is really convenient: just like small DCs. No hassles
  for rewinding and no worry for overriding.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Zoom&lt;/th&gt;
  &lt;td&gt;10x optical zoom&lt;/td&gt;
  &lt;td style=&quot;background: lime&quot;&gt;12x optical zoom&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
  &lt;th&gt;Noise&lt;/th&gt;
  &lt;td&gt;Tape noise can be heard in silent environment&lt;/td&gt;
  &lt;td style=&quot;background: lime&quot;&gt;No such noise since flash card is
  used.&lt;/td&gt;
  &lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;

&lt;h3&gt;Accessories&lt;/h3&gt;

&lt;p&gt;What I have:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Battery and charger: compatible ones&lt;/li&gt;
  &lt;li&gt;Camera bag: Lowepro Edit 120+&lt;/li&gt;
  &lt;li&gt;CPL filter: Kenko 43mm&lt;/li&gt;
  &lt;li&gt;HDMI cable&lt;/li&gt;
  &lt;li&gt;IEEE 1394 cable: Belkin 4-pin to 4-pin&lt;/li&gt;
  &lt;li&gt;Lens cap&lt;/li&gt;
  &lt;li&gt;miniSD: Transcend 2G. Not sure whether 4G could be used (the
  manual only states that up to 2G has been tested).&lt;/li&gt;
  &lt;li&gt;Tape: Panasonic AY-DVM63PQ&lt;/li&gt;
  &lt;li&gt;UV filter: Kenko MC-UV 43mm&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For future purchase:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;35mm adapter&lt;/li&gt;
  &lt;li&gt;Close-up lens: +1/+2/+4&lt;/li&gt;
  &lt;li&gt;Mic: Canon DM-50, or combination of Rode Videomic and stereo
  mic. Maybe XLR adapters with XLR Mics?&lt;/li&gt;
  &lt;li&gt;Neutral density filters: ND2/4/8&lt;/li&gt;
  &lt;li&gt;Shoulder strap&lt;/li&gt;
  &lt;li&gt;Steadicam Merlin&lt;/li&gt;
  &lt;li&gt;Telephoto lens: Canon TL-H43 (any black version?)&lt;/li&gt;
  &lt;li&gt;Tripod and fluid head: Manfrotto 190XPROB (tripod) + 701RC2
  (fluid head) + MBAG70 (bag)&lt;/li&gt;
  &lt;li&gt;Video light: Canon VL-3&lt;/li&gt;
  &lt;li&gt;Wide angle lens: Canon WD-H43 (any black version?)&lt;/li&gt;
  &lt;li&gt;Wrist strap&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Final Words&lt;/h3&gt;

&lt;p&gt;After over 1 month&#39;s usage of HV30, I&#39;m pretty satisfied with
it. There is a lot of things for me to learn: how to shoot, how to
edit, just to name a few. But all the efforts are worthy when you view
the video clips produced from it.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/2935692554054278519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/05/hv30-camcorder-and-accessories.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/2935692554054278519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/2935692554054278519'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/05/hv30-camcorder-and-accessories.html' title='HV30: Camcorder and Accessories'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-6830701535064161338</id><published>2008-05-02T16:30:00.000+08:00</published><updated>2008-05-02T16:31:13.062+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gentoo"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><title type='text'>Automatic Backup</title><content type='html'>&lt;p&gt;We need to backup our stuff in case that some disasters might
happen. One way is to backup to some external medias like tape, USB
drives, or CD/DVDs. However working with them is somehow tedious and
manual intervention is needed. People tend to be lazy therefore we are
reluctant to backup if the process is inconvenient. If we have one
additional machine with link in between (throughout this article, we
assume the remote machine is named as &lt;em&gt;remotebox&lt;/em&gt;), we can setup
an automatic backup mechanism.&lt;/p&gt;

&lt;h2&gt;Overview&lt;/h2&gt;

&lt;p&gt;We use crontab to schedule rsync jobs to backup our files to
another machine. Since rsync is secured with SSH, to suppress the
password prompt, we have to setup SSH keychain.&lt;/p&gt;

&lt;h2&gt;Setup SSH Keychain&lt;/h2&gt;

&lt;h3&gt;Generate Keys&lt;/h3&gt;

&lt;p&gt;This section mainly follows this &lt;a
href=&quot;http://www.ibm.com/developerworks/library/l-keyc.html&quot;&gt;nice
guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We use the DSA approach.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
$ ssh-keygen -t dsa
$ scp ~/.ssh/id_dsa.pub user@remotebox
&lt;/pre&gt;

&lt;p&gt;Then log in to &lt;em&gt;remotebox&lt;/em&gt; and append the public key to
~/.ssh/authorized_keys file like so:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
cat id_dsa.pub &gt;&gt; ~/.ssh/authorized_keys
rm id_dsa.pub
&lt;/pre&gt;

&lt;h3&gt;Install Keychain&lt;/h3&gt;

&lt;p&gt;Keychain is a nice package which prompt you for your passphrase
once you log into the system, and automatically provides passwords for
later SSH session. Note this incurs security risks (there are always
tradeoffs between security and convenience) therefore attention is
needed.&lt;/p&gt;

&lt;p&gt;This part mainly follows &lt;a
href=&quot;http://gentoo-wiki.com/TIP_keychain&quot;&gt;this guide&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First install keychain by typing &lt;kbd&gt;emerge keychain&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;Then add following lines to your ~/.bash_profile.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
/keychain id_dsa
. ~/.keychain/$HOSTNAME-sh
&lt;/pre&gt;

&lt;h2&gt;Setup Crontab Job&lt;/h2&gt;

&lt;p&gt;We can then setup our automatic backup system now. Since there are
almost infinite number of combinations of crontab and rsync patterns,
I just shown one example below (many interesting examples of rsync
usage can be found by typing &lt;kbd&gt;man rsync&lt;/kbd&gt;).&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
0 9,16 * * 1-5 rsync -az -e ssh --delete ~/work/ remotebox:~/backup/
&lt;/pre&gt;

&lt;p&gt;The above example synchronizes local directory &lt;em&gt;~/work&lt;/em&gt; to
remote directory &lt;em&gt;~/backup&lt;/em&gt; on host &lt;em&gt;remotebox&lt;/em&gt;, on 9
a.m. and 4 p.m. of every working day. Note that I have used
option &lt;em&gt;--delete&lt;/em&gt;, which will try to delete extraneous files
from destination directory. This can ensure that the destination
directory is an exact copy of source directory but it would be
dangerous if the destination directory contains some files already. So
test this option before you actually use it.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/6830701535064161338/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/05/automatic-backup.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/6830701535064161338'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/6830701535064161338'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/05/automatic-backup.html' title='Automatic Backup'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-6610153663891900827</id><published>2008-05-02T16:24:00.001+08:00</published><updated>2008-07-24T11:37:52.943+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="emacs"/><title type='text'>Switching Browsers in Emacs</title><content type='html'>&lt;p&gt;Recently, I have met one dilemma in Emacs. Since I&#39;m &lt;a
href=&quot;&quot;&gt;using Emacs for my blog writing&lt;/a&gt;, Firefox is used for
previewing. Also as an Common Lisp user, I use emacs-w3m to read
HyperSpec. Here comes the problem: I can only set one browser
for &lt;em&gt;browse-url-browser-function&lt;/em&gt;. How can I suit my
requirements simultaneously?&lt;/p&gt;

&lt;p&gt;Fortunately, Emacs is highly extensible. I just write one simple
interactive function &lt;em&gt;toggle-browser&lt;/em&gt;, which can toggle between
Firefox and emacs-w3m when pressing &lt;kbd&gt;M-x
toggle-browser&lt;/kbd&gt;. Following is the code:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
(&lt;span class=&quot;keyword&quot;&gt;defun&lt;/span&gt; &lt;span class=&quot;function-name&quot;&gt;toggle-browser&lt;/span&gt; ()
  &lt;span class=&quot;doc&quot;&gt;&quot;Toggle browser between Firefox and emacs-w3m.&quot;&lt;/span&gt;
  (interactive)
  (setq browse-url-browser-function 
        (&lt;span class=&quot;keyword&quot;&gt;if&lt;/span&gt; (eql browse-url-browser-function &#39;browse-url-firefox)
            &#39;w3m-browse-url
          &#39;browse-url-firefox))
  (message &lt;span class=&quot;string&quot;&gt;&quot;%s&quot;&lt;/span&gt; browse-url-browser-function))
&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: please look at the 1st comment from pedro for a better solution.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/6610153663891900827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/05/switching-browsers-in-emacs.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/6610153663891900827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/6610153663891900827'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/05/switching-browsers-in-emacs.html' title='Switching Browsers in Emacs'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-4250995800448979849</id><published>2008-04-10T00:37:00.002+08:00</published><updated>2008-04-11T11:46:02.134+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gentoo"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="maxima"/><category scheme="http://www.blogger.com/atom/ns#" term="texlive"/><title type='text'>Using Imaxima with Texlive in Gentoo Linux</title><content type='html'>&lt;p&gt;Imaxima is an Emacs extension to interface with Maxima (see &lt;a
href=&quot;http://bc.tech.coop/blog/051029.html&quot;&gt;here&lt;/a&gt; for a nice
tutorial). To use it, one need a LaTeX distribution. However with
default Texlive installation in Gentoo, imaxima cannot work. Following
is a sample session:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
(%i1) integrate(x,x);
LaTex error in: \ifracn{x^{2}}{2}
&lt;/pre&gt;

&lt;p&gt;The problem here is that there is another package &lt;em&gt;breqn&lt;/em&gt;
needed. Breqn is inlcuded in Texlive
package &lt;em&gt;texlive-mathextra&lt;/em&gt;, which is not installed when
you &lt;kbd&gt;emerge texlive&lt;/kbd&gt;. The package is also masked by default,
therefore you need to unmask it before emerging. Following is a list
of commands to install the package (substitute &lt;em&gt;x86&lt;/em&gt;
with &lt;em&gt;amd64&lt;/em&gt; for x86-64 systems).&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# echo &quot;dev-texlive/texlive-mathextra ~x86&quot; &gt;&gt; /etc/portage/package.keywords
# emerge texlive-mathextra
&lt;/pre&gt;

&lt;p&gt;After installation, fire up your Emacs and enjoy (I)maxima!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: if you are not comfortable with the
default equation size (as in my case), you can add the following line
into your .emacs (adjust the number to suit your own taste):&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
(setq imaxima-scale-factor 2.0)
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/4250995800448979849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/04/using-imaxima-with-texlive-in-gentoo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/4250995800448979849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/4250995800448979849'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/04/using-imaxima-with-texlive-in-gentoo.html' title='Using Imaxima with Texlive in Gentoo Linux'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-2215437040221583735</id><published>2008-04-08T21:36:00.001+08:00</published><updated>2008-04-08T21:36:36.937+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><title type='text'>Copy and Paste between Windows and Linux</title><content type='html'>&lt;p&gt;Many people use Windows as primary working machine and login to
remote Linux/Unix (we will use Linux as shorthand afterwards)
boxes. There are times when we need to &lt;a
href=&quot;http://en.wikipedia.org/wiki/Cut,_copy,_and_paste&quot;&gt;copy and
paste&lt;/a&gt; information between Windows and Linux. Below we are going to
discuss convenient ways to do so.&lt;/p&gt;

&lt;h3&gt;Tools&lt;/h3&gt;

&lt;p&gt;PuTTY and Xming are two popular programs to run in Windows host to
facilitate communication to Linux. PuTTY provides console connection
while Xming X Window connection. For Xming, Ensure you start Xming
with parameter &lt;em&gt;-clipboard&lt;/em&gt; (which is enabled by default). Our
discussion below is focused on how to copy/paste within
PuTTY/Xming. Copy/paste for other Windows applications is quite
general (&lt;kbd&gt;Ctrl+C&lt;/kbd&gt; and &lt;kbd&gt;Ctrl+V&lt;/kbd&gt;) and should be
familiar to the reader, therefore omitted.&lt;/p&gt;

&lt;h3&gt;Ways&lt;/h3&gt;

&lt;h4&gt;PuTTY&lt;/h4&gt;

&lt;p&gt;&lt;em&gt;Copy to clipboard&lt;/em&gt;: click-and-drag to
highlight. Just select, no need to press any key.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Paste from clipboard&lt;/em&gt;: &lt;em&gt;right&lt;/em&gt; mouse
button.&lt;/p&gt;

&lt;h4&gt;Xming&lt;/h4&gt;

&lt;p&gt;For Xming applications, copy/paste follows the X window
standard as discussed below.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Copy to clipboard&lt;/em&gt;: click-and-drag to
highlight. Same as PuTTY.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Paste from clipboard&lt;/em&gt;: &lt;em&gt;middle&lt;/em&gt; mouse
button.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/2215437040221583735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/04/copy-and-paste-between-windows-and.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/2215437040221583735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/2215437040221583735'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/04/copy-and-paste-between-windows-and.html' title='Copy and Paste between Windows and Linux'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-7264003697085114511</id><published>2008-04-07T21:17:00.002+08:00</published><updated>2008-06-10T08:48:48.443+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gentoo"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><title type='text'>Installation of Gentoo Linux 2008.0 Beta 1 with LiveCD</title><content type='html'>&lt;p&gt;I just started yet another process of installing Gentoo Linux, and
following is my record of the installation step by step. Previously I
preferred to install from stage 1/3 following
&lt;a href=&quot;http://forums.gentoo.org/viewtopic-t-319349.html&quot;&gt;this
guide&lt;/a&gt;. I decided to try LiveCD this time.&lt;/p&gt;

&lt;h2&gt;1. Boot the machine.&lt;/h2&gt;

&lt;p&gt;Download the 2008.0 LiveCD from &lt;a
href=&quot;http://www.gentoo.org/main/en/where.xml&quot;&gt;here&lt;/a&gt;. Burn the CD
and boot the machine with it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Caveat&lt;/strong&gt;: in my case, the boot process is stalled. I
solved it (according to &lt;a
href=&quot;http://www.gvenkat.com/archives/2007/08/09/gentoo-linux-20070-intel-dg965wh-and-ide-cddvd-drives/&quot;&gt;this
article&lt;/a&gt;) by appending kernel options during GRUB screen
(press &lt;kbd&gt;e&lt;/kbd&gt; to edit and append &lt;kbd&gt;all-generic-ide irqpoll
pci=nommconf&lt;/kbd&gt;).&lt;/p&gt;

&lt;h2&gt;2. Installation.&lt;/h2&gt;

&lt;p&gt;After boot, I click icon &quot;Gentoo Linux Installation (GTK+)&quot; in the
desktop.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Partitioning&lt;/strong&gt;: I selected &lt;em&gt;Recommended
Layout&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Local Mounts&lt;/strong&gt;: accept the defaults without any
changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Timezone&lt;/strong&gt;: Asia/Shanghai.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Networking&lt;/strong&gt;: Dhcp is used. Appropriate host and
domain name are provided.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Users&lt;/strong&gt;: Just add the regular user for daily
usage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Extra Packages&lt;/strong&gt;: I selected screen and slocate. In
my first installation I also selected xorg-x11, gdm, firefox
etc. However the installation simply failed when emerging
x11-apps/xinit (and I cannot rescue the system since even /etc/fstab
is not correctly setup), therefore my second try is quite
conservative.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Startup services&lt;/strong&gt;: I selected sshd.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other Settings&lt;/strong&gt;: Although I have not installed X11
or Gnome yet, I selected as following:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Display Manager: gdm&lt;/li&gt;
  &lt;li&gt;Clock: local&lt;/li&gt;
  &lt;li&gt;XSession: Gnome&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;3. Post Installation.&lt;/h2&gt;

&lt;p&gt;This section is similar as what I have described for coLinux
(see &lt;a
href=&quot;http://yujianzhang.blogspot.com/2008/03/install-gentoo-with-colinux.html&quot;&gt;here&lt;/a&gt;),
but is modified specifically for a standalone Gentoo Linux
installation.&lt;/p&gt;

&lt;h4&gt;3.0 Tiny Cleanups.&lt;/h4&gt;

&lt;p&gt;After rebooting, perform the following steps. Note that if your
system was stalled as described before, you can use same trick in GRUB
screen and you should add the kernel options to /boot/grub/grub.conf
after login.&lt;/p&gt;

&lt;p&gt;To avoid some warning, you might need to perform following
steps.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# mkdir -p /usr/local/portage
&lt;/pre&gt;

&lt;p&gt;To change host name (according to &lt;a
href=&quot;http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&amp;chap=8&quot;&gt;Gentoo
Handbook&lt;/a&gt;), edit file &lt;em&gt;/etc/conf.d/hostname&lt;/em&gt;, if you call
your coLinux machine as &lt;em&gt;tux&lt;/em&gt;, then set the following line.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
HOSTNAME=&quot;tux&quot;
&lt;/pre&gt;

&lt;p&gt;In addition, remove string &lt;em&gt;.\O&lt;/em&gt; from
file &lt;em&gt;/etc/issue&lt;/em&gt; to get rid of the
annoying &lt;em&gt;unknown_domain&lt;/em&gt; in the welcome message &quot;This is
host.unknown_domain ...&quot;.&lt;/p&gt;

&lt;h4&gt;3.1 Network&lt;/h4&gt;

&lt;p&gt;We have already specified using DHCP. It works but the
configuration files is using old syntax. Let&#39;s clean it up to avoid
future complaints. Edit file &lt;em&gt;/etc/conf.d/net&lt;/em&gt; as
follows.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
config_eth0=( &quot;dhcp&quot; )
&lt;/pre&gt;

&lt;h5&gt;3.1.1 Proxy&lt;/h5&gt;

&lt;p&gt;If you connect to Internet directly, you can skip this section.&lt;/p&gt;

&lt;p&gt;To use proxy server, add the
following lines into &lt;em&gt;/etc/env.d/99local&lt;/em&gt;:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
http_proxy=&quot;http://proxy.server.com:8080&quot;
ftp_proxy=&quot;http://proxy.server.com:8080&quot;
&lt;/pre&gt;

&lt;p&gt;Replace the port and domain name according to your situation.  Then
run:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
env-update &amp;amp;&amp;amp; source /etc/profile
&lt;/pre&gt;

&lt;h4&gt;3.2 Add additional locales&lt;/h4&gt;

&lt;p&gt;Modify file &lt;em&gt;/etc/locale.gen&lt;/em&gt;, select appropriate
locales. For me, the locales are:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
&lt;/pre&gt;

&lt;p&gt;Then run command &lt;kbd&gt;locale-gen&lt;/kbd&gt;.&lt;/p&gt;

&lt;h4&gt;3.3 Modify &lt;em&gt;/etc/make.conf&lt;/em&gt;&lt;/h4&gt;

&lt;p&gt;This is specific for your computer type and other
factors. Following is my configuration (I&#39;m using a Core 2 Duo
CPU). Please refer to Gentoo documentation for your own
reference. &lt;em&gt;GENTOO_MIRRORS&lt;/em&gt; reflects the fastest mirrors for my
connection, as discussed below.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
&lt;span class=&quot;variable-name&quot;&gt;CFLAGS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;-march=nocona -O2 -fomit-frame-pointer -pipe -fno-ident&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;CXXFLAGS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;${CFLAGS}&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;CHOST&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;x86_64-pc-linux-gnu&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;LDFLAGS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;-Wl,-O1&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;MAKEOPTS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;-j3&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;ACCEPT_KEYWORDS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;amd64&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;FEATURES&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;parallel-fetch&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;LINGUAS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;en zh zh_CN&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;INPUT_DEVICES&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;keyboard mouse&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;VIDEO_CARDS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;i810&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;PORTDIR_OVERLAY&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;/usr/local/portage&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;GENTOO_MIRRORS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;http://ftp.iij.ad.jp/pub/linux/gentoo/ http://ftp.kaist.ac.kr/pub/gentoo/&quot;&lt;/span&gt;

&lt;span class=&quot;variable-name&quot;&gt;USE_DEV&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;bash-completion doc emacs latex ruby sbcl source spell&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;USE_HW&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;cpudetection mmx sse sse2&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;USE_LIB&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;curl gd glibc-omitfp ncurses readline zlib&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;USE_MM&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;aac alsa encode ffmpeg flac midi mp3 ogg pulseaudio quicktime theora xvid&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;USE_PIC&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;gif jpeg png raw svg tiff xpm&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;USE_SECURITY&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;crypt pam ssl tcpd&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;USE_SW&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;bzip2&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;USE_SYS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;cjk nls nptl nptlonly opengl truetype unicode xinerama xml&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;USE_X11&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;cairo gnome gtk X xft xorg&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;USE&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;-* ${USE_DEV} ${USE_HW} ${USE_LIB} ${USE_MM} \
     ${USE_PIC} ${USE_SECURITY} ${USE_SW} ${USE_SYS} ${USE_X11}&quot;&lt;/span&gt;
&lt;/pre&gt;

&lt;h4&gt;3.4 Synchronize Portage&lt;/h4&gt;

&lt;p&gt;Use either &lt;kbd&gt;emerge --sync&lt;/kbd&gt; or &lt;kbd&gt;emerge-webrsync
-v&lt;/kbd&gt; to update the portage.&lt;/p&gt;

&lt;h4&gt;3.5 Mirror selection&lt;/h4&gt;

&lt;p&gt;First run &lt;kbd&gt;emerge mirrorselect&lt;/kbd&gt;. To select the fastest
mirror. I use the following command &lt;kbd&gt;mirrorselect -D -H
-s2&lt;/kbd&gt; to select the mirror. It means
that:&lt;/p&gt;

&lt;ul&gt;

  &lt;li&gt;-D: actual file will be downloaded from the mirror to test speed.&lt;/li&gt;
  &lt;li&gt;-H: test http mirrors only.&lt;/li&gt;
  &lt;li&gt;-s2: only select 2 mirrors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After running the command, original &lt;em&gt;/etc/make.conf&lt;/em&gt; will be
backed up as /etc/make.conf.backup and your selected mirrors will be
reflected in make.conf. Type &lt;kbd&gt;mirrorselect -h&lt;/kbd&gt; for
details.&lt;/p&gt;

&lt;h4&gt;3.6 Update system&lt;/h4&gt;

&lt;p&gt;Run the following suites of commands (we need the -p argument to
check what the commands are supposed to do since they&#39;re somehow
&quot;dangerous&quot;):&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
emerge -uDNpv world
emerge -uDNv world
emerge --depclean -pv 
emerge --depclean -v
revdep-rebuild -pv
revdep-rebuild -v
&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Caveat&lt;/strong&gt;: if you encounter circular dependency when
&lt;kbd&gt;emerge -uDNv world&lt;/kbd&gt;, try to remove &lt;em&gt;gtk&lt;/em&gt; USE flag
from &lt;em&gt;/etc/make.conf&lt;/em&gt;. After successful emerging, add
&lt;em&gt;gtk&lt;/em&gt; flag again and run &lt;kbd&gt;emerge -uDNv world&lt;/kbd&gt; again. &lt;/p&gt;

&lt;p&gt;After update, run &lt;kbd&gt;dispatch-conf&lt;/kbd&gt; to update the
configuration files.&lt;/p&gt;

&lt;h4&gt;3.7 Install X11 and GNOME.&lt;/h4&gt;

&lt;p&gt;Run command &lt;kbd&gt;emerge xorg-x11&lt;/kbd&gt; to install X11. Then
use &lt;kbd&gt;xorgcfg -textmode&lt;/kbd&gt; to configure X server.&lt;/p&gt;

&lt;p&gt;I&#39;m using a LCD with resolution of 1680x1050, which is not listed
in standard configurations. To use it, first run &lt;kbd&gt;gtf 1680 1050
60&lt;/kbd&gt;, copy the output to the &lt;em&gt;Monitor&lt;/em&gt; section
of &lt;em&gt;/etc/X11/xorg.conf&lt;/em&gt;, and modify section &lt;em&gt;Screen&lt;/em&gt; to
the resolution 1680x1050.&lt;/p&gt;

&lt;p&gt;For GNOME, I prefer to install gnome-light to avoid the gigantic
full GNOME installation. To do so, simply run &lt;kbd&gt;emerge
gnome-light&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;If one use &lt;em&gt;startx&lt;/em&gt; to run X11, one can simply
type &lt;kbd&gt;echo &quot;exec gnome-session&quot; &gt; ~/.xinitrc&lt;/kbd&gt; to configure
so.&lt;/p&gt;

&lt;p&gt;To make gdm the default login screen, run the following commands:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# emerge gdm
# rc-update add xdm default
&lt;/pre&gt;

&lt;p&gt;And then edit /etc/conf.d/xdm, changing DISPLAYMANAGER
to &lt;em&gt;gdm&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;3.8 Install Other programs.&lt;/h4&gt;

&lt;p&gt;This section is left empty intentionally :-)&lt;/p&gt;

&lt;hr/&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;It is quite convenient to install with LiveCD. There are some
hassles during installation, but I assume the reason is that I&#39;m using
a beta version. Since beta version is not stable, my suggestion is to
install minimal components therefore you can quickly finish the
installation and boot from hard drive.&lt;/p&gt;

&lt;p&gt;Although GRP install is not so optimal, the pre-compiled packages
should be quite close to optimal ones for 64-bit machines. Also as a
Gentoo user, I&#39;m always in the process of customization the OS to suit
my needs, therefore a not-so-ideal-initial-setup is not an issue. In
summary, livecd approach can save a lot of time, with almost similar
end result as installing from stage 1/3.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/7264003697085114511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/04/installation-of-gentoo-linux-20080-beta.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/7264003697085114511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/7264003697085114511'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/04/installation-of-gentoo-linux-20080-beta.html' title='Installation of Gentoo Linux 2008.0 Beta 1 with LiveCD'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-2580639685328970701</id><published>2008-04-07T21:15:00.000+08:00</published><updated>2008-04-07T21:16:05.499+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gentoo"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><title type='text'>Ripping CD to FLAC in Gentoo Linux</title><content type='html'>&lt;p&gt;This post is just a simple note, inspired from &lt;a
href=&quot;http://www.linuxquestions.org/linux/blog/Caysho/2006-12-29/Rip_CD_to_FLAC_then_convert_FLAC_to_Ogg_Vorbis&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First, install &lt;em&gt;cdparanoia&lt;/em&gt; and &lt;em&gt;flac&lt;/em&gt;:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# emerge cdparanoia flac
&lt;/pre&gt;

&lt;p&gt;Next, issue the following commands (I deleted the original WAV
files after conversion). All tracks are extracted and converted to
FLAC format.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# cdparanoia -B
# find . -name &quot;*.wav&quot; -print0 | xargs -0 flac
# rm *.wav
&lt;/pre&gt;

&lt;p&gt;Then enjoy the music with your favorite player. Since I&#39;m using
mplayer, I call Ruby to generate the playlist and invoke mplayer with
it (in the 1st line below, the last track number is 16. Change it
according to your own situation).&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
$ ruby -e &#39;(0..16).map{|i| printf(&quot;track%02d.cdda.flac\n&quot;, i)}&#39; &gt; pl
$ mplayer -playlist pl
&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/2580639685328970701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/04/ripping-cd-to-flac-in-gentoo-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/2580639685328970701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/2580639685328970701'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/04/ripping-cd-to-flac-in-gentoo-linux.html' title='Ripping CD to FLAC in Gentoo Linux'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-6022420268025695607</id><published>2008-04-02T20:36:00.000+08:00</published><updated>2008-04-02T20:43:52.812+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="colinux"/><category scheme="http://www.blogger.com/atom/ns#" term="gentoo"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><title type='text'>Enable Sound for coLinux</title><content type='html'>&lt;p&gt;In my previous post about &lt;a
href=&quot;http://yujianzhang.blogspot.com/2008/03/install-gentoo-with-colinux.html&quot;&gt;installing
coLinux with Gentoo&lt;/a&gt;, audio part is not touched. Here comes the
solution on how to use PulseAudio to bridge coLinux to sound
world. This is adapted from &lt;a
href=&quot;http://colinux.wikia.com/wiki/Sound_support_in_Colinux&quot;&gt;here&lt;/a&gt;
with contents modified for Gentoo Linux. &lt;/p&gt;

&lt;h3&gt;Windows side&lt;/h3&gt;

&lt;p&gt;We need to install PulseAudio &lt;em&gt;server&lt;/em&gt; on Windows. Frist
download binaries for Windows from &lt;a
href=&quot;http://www.cendio.com/pulseaudio&quot;&gt;here&lt;/a&gt;. Extract to one
directory (&lt;em&gt;c:\bin\pulseaudio&lt;/em&gt; in my case).&lt;/p&gt;

&lt;p&gt;In the directory of the binaries, create a text config file named
&lt;em&gt;default.pa&lt;/em&gt; with the content:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24
load-module module-esound-protocol-tcp auth-ip-acl=127.0.0.1;192.168.0.0/24
load-module module-detect
&lt;/pre&gt;

&lt;p&gt;We start PulseAudio automatically when coLinux starts, by adding
the following line to the coLinux configuration file:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
exec0=c:\bin\pulseaudio\pulseaudio.exe
&lt;/pre&gt;

&lt;h3&gt;Linux side&lt;/h3&gt;

&lt;h4&gt;Install and configure PulseAudio &lt;em&gt;client&lt;/em&gt;&lt;/h4&gt;

&lt;p&gt;Install PulseAudio by &lt;kbd&gt;emerge pulseaudio&lt;/kbd&gt;. Then
edit &lt;em&gt;/etc/pulse/client.conf&lt;/em&gt; to set the address of the Windows
host that runs the PulseAudio server:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
default-server = 192.168.0.1
&lt;/pre&gt;

&lt;p&gt;where &lt;em&gt;192.168.0.1&lt;/em&gt; is the IP address of the Windows
host.&lt;/p&gt;

&lt;p&gt;Make sure to add USE flag &lt;em&gt;alsa&lt;/em&gt;
to &lt;em&gt;/etc/make.conf&lt;/em&gt;. If you just add this USE flag, update your
system with &lt;kbd&gt;emerge -uDNv world&lt;/kbd&gt;. ALSA would be automatically
emerged.&lt;/p&gt;

&lt;h4&gt;Install alsa-plugins&lt;/h4&gt;

&lt;p&gt;In addition, we should install alsa-plugins:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# echo &quot;media-plugins/alsa-plugins pulseaudio&quot; &gt;&gt; /etc/portage/package.use
# emerge alsa-plugins
&lt;/pre&gt;

&lt;p&gt;Edit &lt;em&gt;~/.asoundrc&lt;/em&gt; with the following contents.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
pcm.!default {
    type pulse
}

ctl.!default {
    type pulse
}

pcm.pulse {
    type pulse
}

ctl.pulse {
    type pulse
}
&lt;/pre&gt;

&lt;h4&gt;Test&lt;/h4&gt;

&lt;p&gt;As a final step, you can test with an ALSA player:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
aplay /usr/share/sounds/alsa/Front_Center.wav
&lt;/pre&gt;

&lt;p&gt;You should hear a voice saying &quot;Front Center&quot;. Enjoy!&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/6022420268025695607/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/04/enable-sound-for-colinux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/6022420268025695607'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/6022420268025695607'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/04/enable-sound-for-colinux.html' title='Enable Sound for coLinux'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-2167155226705602904</id><published>2008-03-16T14:53:00.006+08:00</published><updated>2008-05-09T13:33:27.124+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="colinux"/><category scheme="http://www.blogger.com/atom/ns#" term="gentoo"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><title type='text'>Install Gentoo with coLinux</title><content type='html'>&lt;p&gt;coLinux is gaining momentum as a way to run Linux programs on
Windows, and I decided to try it. As a &lt;a
href=&quot;http://yujianzhang.blogspot.com/2007/11/is-gentoo-linux-choice-for-minimalists.html&quot;&gt;user
of Gentoo&lt;/a&gt;, my first choice is to use Gentoo with coLinux. The
following description documents what I have done to run Gentoo
&lt;em&gt;cooperatively&lt;/em&gt; in Windows laptop. I mainly follows up the &lt;a
href=&quot;http://gentoo-wiki.com/CoLinux&quot;&gt;Gentoo Wiki Howto article&lt;/a&gt;
and other coLinux resources.&lt;/p&gt;

&lt;h2&gt;1. Installation&lt;/h2&gt;

&lt;p&gt;First download the latest &lt;a
href=&quot;http://colinux.org/snapshots/&quot;&gt;coLinux snapshot&lt;/a&gt; (you can
also get it from &lt;a
href=&quot;http://sourceforge.net/project/showfiles.php?group_id=98788&quot;&gt;SourceForge&lt;/a&gt;). The
file I used is coLinux-0.7.2.exe from SourceForge. Run the
installer. Some notes during installation:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;In screen &lt;em&gt;Choose Components&lt;/em&gt;, leave the default settings
  on (i.e. selecting all components), but uncheck &lt;em&gt;Root FileSystem
  image download&lt;/em&gt; (we will download it separately).&lt;/li&gt;
  &lt;li&gt; In addition, change the &lt;em&gt;Destination folder&lt;/em&gt; to
  &lt;em&gt;c:\bin\coLinux&lt;/em&gt; (note that all the description below assumes
  coLinux is installed into this directory. If you prefer other
  directory, please modify accordingly in steps below). &lt;/li&gt;
  &lt;li&gt;Installer prompts to download and install WinPCap separately,
  but my network configuration does not need WinPCap therefore I don&#39;t
  install it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then download &lt;em&gt;Gentoo-colinux-i686-2007-03-03.7z&lt;/em&gt; from &lt;a
href=&quot;http://sourceforge.net/project/showfiles.php?group_id=98788&quot;&gt;SourceForge&lt;/a&gt;,
extract the archive into &lt;em&gt;c:\bin\coLinux&lt;/em&gt;, with a
&lt;em&gt;gentoo&lt;/em&gt; subdirectory created during extraction. Copy file
&lt;em&gt;gentoo.conf&lt;/em&gt; in &lt;em&gt;gentoo&lt;/em&gt; to the parent directory and
modify it as follows:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
kernel=vmlinux
cobd0=C:\bin\coLinux\gentoo\gentoo-root
cobd1=C:\bin\coLinux\gentoo\linux-swap
root=/dev/cobd0
hdc=\Device\Cdrom0
initrd=initrd.gz
mem=1024
eth0=tuntap
cofs0=c:\linux
&lt;/pre&gt;

&lt;p&gt;Some explanations of the above file, details will be covered in
later sections.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;For &lt;em&gt;mem&lt;/em&gt;, I set it to 1G. Choose according to your own
  situation.&lt;/li&gt;
  &lt;li&gt;For network, I only select TAP driver.&lt;/li&gt;
  &lt;li&gt;I shared Windows folder &lt;em&gt;c:\linux&lt;/em&gt; to coLinux.&lt;/li&gt;
  &lt;li&gt;CD/DVD-Drive is mounted. 
&lt;/ul&gt;

&lt;p&gt;To test drive, open a command prompt, change to the directory
&lt;em&gt;c:\bin\coLinux&lt;/em&gt;, and run the following command:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
colinux-daemon @gentoo.conf
&lt;/pre&gt;

&lt;p&gt;coLinux console should run. If there is something wrong, please
check previous steps. After some time, you are prompted for log in.
You can now login as root with password. Change your password
immediately.&lt;/p&gt;

&lt;p&gt;Congratulations! You just successfully run Gentoo in coLinux! You
can now fool around with the system. Type &lt;kbd&gt;halt&lt;/kbd&gt; when you are
tired. There is still a long road ahead to fully harness the
power. Following is two optional steps, but highly recommended.&lt;/p&gt;

&lt;h4&gt;Run coLinux during system startup&lt;/h4&gt;

&lt;p&gt;First, we need to install coLinux as a service. Open a command
prompt, change to the directory &lt;em&gt;c:\bin\coLinux&lt;/em&gt;, and run the
following command:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
colinux-daemon.exe @gentoo.conf --install-service &quot;CoGentoo Linux&quot; 
&lt;/pre&gt;

&lt;p&gt;Then open &lt;em&gt;Control Panel&lt;/em&gt;, first select &lt;em&gt;Administrative
Tools&lt;/em&gt;, then &lt;em&gt;Services&lt;/em&gt;, click service &lt;em&gt;CoGentoo Linux&lt;/em&gt;, and
change its &lt;em&gt;Startup type&lt;/em&gt; to &lt;em&gt;Automatic&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;Enlarge the image file&lt;/h4&gt;

&lt;p&gt;The original image size is 2G. This might not be sufficient. To
enlarge it, you need to download the tools from &lt;a
href=&quot;http://csemler.com/toporesize-0.7.zip&quot;&gt;here&lt;/a&gt;. Extract the
archive and run file &lt;em&gt;toporesize.bat&lt;/em&gt;. Use the program to
resize file &lt;em&gt;c:\bin\coLinux\gentoo\gentoo-root&lt;/em&gt; to whatever
size you want. Make sure you &lt;strong&gt;uncheck&lt;/strong&gt; &quot;resize file
only no resize2fs&quot;.&lt;/p&gt;

&lt;h2&gt;2. Configuration&lt;/h2&gt;

&lt;h4&gt;2.1 Timezone&lt;/h4&gt;

&lt;p&gt;Since I&#39;m located in Beijing, I set the corresponding info as
follows. The related configuration files is
&lt;em&gt;/etc/conf.d/clock&lt;/em&gt;. I changed two lines as follows.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
CLOCK=&quot;local&quot;
TIMEZONE=&quot;Asia/Shanghai&quot;
&lt;/pre&gt;

&lt;p&gt;Also run command &lt;kbd&gt;ln -fs /usr/share/zoneinfo/Asia/Shanghai
/etc/localtime&lt;/kbd&gt;.&lt;/p&gt;

&lt;p&gt;It is interesting that Beijing cannot manage to snap one place
inside &lt;em&gt;/usr/share/zoneinfo/Asia&lt;/em&gt;.&lt;/p&gt;

&lt;h4&gt;2.2 Network&lt;/h4&gt;

&lt;p&gt;Based on &lt;a href=&quot;http://colinux.wikia.com/wiki/Network&quot;&gt;coLinux
wiki article&lt;/a&gt;.&lt;/p&gt;

&lt;h5&gt;2.2.1 One network interface&lt;/h5&gt;

&lt;p&gt;This configuration only enable TAP, which is used to enable both
the high-speed private connection between Windows host and Linux
guest, and also to bridge the connection to Internet. One drawback of
this setup is that when you Internet connection changes (e.g. from
ADSL to WiFi, you have to adjust bridging and some parameters
manually).&lt;/p&gt;

&lt;p&gt;File &lt;em&gt;gentoo.conf&lt;/em&gt; discussed above already contains the
setup for coLinux. Next steps are as follows.&lt;/p&gt;

&lt;p&gt;On hosting OS (Windows), configure &lt;em&gt;TAP-Win32 Adapter V8
(coLinux)&lt;/em&gt; with following properties (make sure to leave
&lt;em&gt;Default Gateway&lt;/em&gt; as blank):&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
Ethernet adapter:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : TAP-Win32 Adapter V8 (coLinux)
        Dhcp Enabled. . . . . . . . . . . : No
        IP Address. . . . . . . . . . . . : 192.168.0.1
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . :
&lt;/pre&gt;

&lt;p&gt;We need to bridge the Internet connection with TAP interface. For
example, assume you&#39;re using an ADSL PPPoE connection. In Windows
host, select &lt;em&gt;Control Panel -&gt; Network Connections&lt;/em&gt;, right
click the PPPoE interface, and select &lt;em&gt;Properties&lt;/em&gt;. In tab
&lt;em&gt;Advanced&lt;/em&gt;, for &lt;em&gt;Internet Connection Sharing&lt;/em&gt;, check
&lt;em&gt;Allow other network users to connect through this computer&#39;s
Internet connection&lt;/em&gt;, and for the &lt;em&gt;Home networking
connection&lt;/em&gt;, select the TAP interface (e.g. Local Area Connection
2). When Windows prompts that TAP interface IP address will be set to
192.168.0.1, choose OK.&lt;/p&gt;

&lt;p&gt;Under coLinux, edit file &lt;em&gt;/etc/conf.d/net&lt;/em&gt; as follows.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
config_eth0=( &quot;192.168.0.20/24&quot; )
routes_eth0=( &quot;default via 192.168.0.1&quot; )
dns_servers_eth0=(&quot; xxx.xxx.xxx.xxx &quot; )
&lt;/pre&gt;

&lt;p&gt;Please change the DNS server information (shown as xxx above) to
those obtained in windows (e.g. via &lt;em&gt;ipconfig&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;We have to emphasize here that in this setup, Linux guest has IP
address 192.168.0.20 (this is arbitrarily selected, could be other
numbers like 192.168.0.x when 2 &lt;= x &lt;= 254), and Windows host has IP
address 192.168.0.1 interfacing Linux (of course Windows host has
external IP addresses as well).&lt;/p&gt;

&lt;h5&gt;2.2.2 For two network interfaces&lt;/h5&gt;

&lt;p&gt;Note this part is NOT compatible with other sections. The purpose
of this section is only to document alternatives to above solution. If
one interface solution is fine for you, you can skip this section.&lt;/p&gt;

&lt;p&gt;This configuration enables both SLiRP and TAP connections. SLiRP is
used to connect outside world while TAP enables the high-speed private
connection between Windows host and Linux guest, which is desirable
for X protocol. The benefits of this configuration includes improved
security and that SLiRP can automatically use current Windows Internet
connection for outgoing connections (i.e. you do not need to enter DNS
server information) without reconfigurations. This works fine for
Wireless LANs, but I did meet problems for ADSL and finally decided to
use TAP only.&lt;/p&gt;

&lt;p&gt;Anyway, let&#39;s look at how to setup two network interfaces.&lt;/p&gt;

&lt;p&gt;First, we need to modify the aforementioned file
&lt;em&gt;gentoo.conf&lt;/em&gt; located in coLinux directory. Change the line
&lt;em&gt;eth0=tuntap&lt;/em&gt; with two lines as below.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
eth0=slirp
eth1=tuntap
&lt;/pre&gt;

&lt;p&gt;Then edit file &lt;em&gt;/etc/conf.d/net&lt;/em&gt; on Linux guest. This
enables both SLiRP and TAP.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
config_eth0=( &quot;dhcp&quot; )
config_eth1=( &quot;192.168.37.20/24&quot; )
&lt;/pre&gt;

&lt;p&gt;We then need to setup DHCP client as following:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
emerge dhcpcd
rc-update add dhcpcd default
/etc/init.d/dhcpcd start
&lt;/pre&gt;

&lt;p&gt;Since only eth0 device is generated, we need to generate
&lt;em&gt;eth1&lt;/em&gt; device by &lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
cd /etc/init.d
ln -s net.lo net.eth1
&lt;/pre&gt;

&lt;p&gt;On hosting OS (Windows), configure &lt;em&gt;TAP-Win32 Adapter V8
(coLinux)&lt;/em&gt; with following properties (make sure to leave
&lt;em&gt;Default Gateway&lt;/em&gt; as blank):&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
Ethernet adapter:

        Connection-specific DNS Suffix  . :
        Description . . . . . . . . . . . : TAP-Win32 Adapter V8 (coLinux)
        Dhcp Enabled. . . . . . . . . . . : No
        IP Address. . . . . . . . . . . . : 192.168.37.10
        Subnet Mask . . . . . . . . . . . : 255.255.255.0
        Default Gateway . . . . . . . . . :
&lt;/pre&gt;

&lt;h5&gt;2.2.3 Proxy&lt;/h5&gt;

&lt;p&gt;If you connect to Internet directly, you can skip this section.&lt;/p&gt;

&lt;p&gt;To use proxy server, add the
following lines into &lt;em&gt;/etc/env.d/99local&lt;/em&gt;:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
http_proxy=&quot;http://proxy.server.com:8080&quot;
ftp_proxy=&quot;http://proxy.server.com:8080&quot;
&lt;/pre&gt;

&lt;p&gt;Replace the port and domain name according to your situation.  Then
run:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
env-update &amp;amp;&amp;amp; source /etc/profile
&lt;/pre&gt;

&lt;h4&gt;2.3 Add additional locales&lt;/h4&gt;

&lt;p&gt;Modify file &lt;em&gt;/etc/locale.gen&lt;/em&gt;, select appropriate
locales. For me, the locales are:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
en_US.UTF-8 UTF-8
zh_CN.UTF-8 UTF-8
&lt;/pre&gt;

&lt;p&gt;Then run command &lt;kbd&gt;locale-gen&lt;/kbd&gt;.&lt;/p&gt;

&lt;h4&gt;2.4 Mirror selection&lt;/h4&gt;

&lt;p&gt;First run &lt;kbd&gt;emerge mirrorselect&lt;/kbd&gt;. To select the fastest
mirror. I use the following command &lt;kbd&gt;mirrorselect -D -H
-s2&lt;/kbd&gt; to select the mirror. It means
that:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;-D: actual file will be downloaded from the mirror to test speed.&lt;/li&gt;
  &lt;li&gt;-H: test http mirrors only.&lt;/li&gt;
  &lt;li&gt;-s2: only select 2 mirrors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After running the command, original &lt;em&gt;/etc/make.conf&lt;/em&gt; will be
backed up as /etc/make.conf.backup and your selected mirrors will be
reflected in make.conf. Type &lt;kbd&gt;mirrorselect -h&lt;/kbd&gt; for
details.&lt;/p&gt;

&lt;h4&gt;2.5 Modify &lt;em&gt;/etc/make.conf&lt;/em&gt;&lt;/h4&gt;

&lt;p&gt;This is specific for your computer type and other
factors. Following is my configuration (I&#39;m using a Core 2 Duo CPU on
32 bit Windows). Please refer to Gentoo documentation for your own
reference. &lt;em&gt;GENTOO_MIRRORS&lt;/em&gt; reflects the fastest mirrors for my
connection, so you may skip that line if your have already performed
mirrorselect above.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
&lt;span class=&quot;variable-name&quot;&gt;CFLAGS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;-march=prescott -O2 -fomit-frame-pointer -pipe -fno-ident&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;CXXFLAGS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;${CFLAGS}&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;CHOST&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;i686-pc-linux-gnu&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;LDFLAGS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;-Wl,-O1&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;MAKEOPTS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;-j2&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;ACCEPT_KEYWORDS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;x86&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;FEATURES&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;parallel-fetch&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;LINGUAS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;en zh&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;USE&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;-* auctex bash-completion bzip2 cjk crypt curl doc emacs gd gif glibc-omitfp gtk \
     javascript jpeg mmx mozilla ncurses nls nptl nptlonly opengl pam png readline \
     ruby sbcl source spell sse sse2 ssl svg tcpd tiff truetype \
     unicode X xft xml xorg xpm zlib&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;PORTDIR_OVERLAY&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;/usr/local/portage&quot;&lt;/span&gt;
&lt;span class=&quot;variable-name&quot;&gt;GENTOO_MIRRORS&lt;/span&gt;=&lt;span class=&quot;string&quot;&gt;&quot;http://ftp.iij.ad.jp/pub/linux/gentoo/ http://ftp.kaist.ac.kr/pub/gentoo/&quot;&lt;/span&gt;
&lt;/pre&gt;

&lt;h4&gt;2.6 Update system&lt;/h4&gt;

&lt;p&gt;Since our original system is somehow outdated, we need to update
it. First run &lt;kbd&gt;emerge --sync&lt;/kbd&gt; or &lt;kbd&gt;emerge-webrsync
-v&lt;/kbd&gt; to synchronize portage, then run the following suites of
commands (we need the -p argument to check what the commands are
supposed to do since they&#39;re somehow &quot;dangerous&quot;):&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
emerge -uDNpv world
emerge -uDNv world
emerge --depclean -pv 
emerge --depclean -v
revdep-rebuild -pv
revdep-rebuild -v
&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Caveat&lt;/strong&gt;: if you encounter circular dependency when
&lt;kbd&gt;emerge -uDNv world&lt;/kbd&gt;, try to remove &lt;em&gt;gtk&lt;/em&gt; USE flag
from &lt;em&gt;/etc/make.conf&lt;/em&gt;. After successful emerging, add
&lt;em&gt;gtk&lt;/em&gt; flag again and run &lt;kbd&gt;emerge -uDNv world&lt;/kbd&gt; again. &lt;/p&gt;

&lt;p&gt;After update, run &lt;kbd&gt;dispatch-conf&lt;/kbd&gt; to update the
configuration files (you need to avoid the update of
&lt;em&gt;/bin/setfont&lt;/em&gt;. If you accidentally updated the file, you can
remedy the situation as discussed below):&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Caveat&lt;/strong&gt;: if during booting, you meet the error
message &lt;q&gt;putfont: PIO_FONT: Function not supported&lt;/q&gt;, Solve the
problem as follows (as discussed &lt;a
href=&quot;http://colinux.wikia.com/wiki/FedoraHowTo&quot;&gt;here&lt;/a&gt;):&lt;/p&gt;

&lt;p&gt;First, run command &lt;kbd&gt;mv /bin/setfont /bin/setfont.old&lt;/kbd&gt;&lt;/p&gt;

&lt;p&gt;Create a new file /bin/setfont with the following content:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
&lt;span class=&quot;comment-delimiter&quot;&gt;#&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;!/bin/&lt;/span&gt;&lt;span class=&quot;keyword&quot;&gt;bash&lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;
&lt;/span&gt;
&lt;span class=&quot;keyword&quot;&gt;if&lt;/span&gt; ! uname -r | grep -q -e &lt;span class=&quot;string&quot;&gt;&quot;-co-&quot;&lt;/span&gt;
&lt;span class=&quot;keyword&quot;&gt;then&lt;/span&gt;
        /bin/setfont.old $@
&lt;span class=&quot;keyword&quot;&gt;fi&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;and make it executable by running &lt;kbd&gt;chmod +x /bin/setfont&lt;/kbd&gt;&lt;/p&gt;

&lt;h2&gt;3. Run X&lt;/h2&gt;

&lt;p&gt;X.org is already installed in coLinux machine when we update the
system as discussed in section 2.6 (we have include &lt;em&gt;X&lt;/em&gt; USE
flag). Therefore the remaining steps are just to install X server in
Windows host.&lt;/p&gt;

&lt;p&gt;We choose Xming considering it is lightweight and widely used. To
install Xming, Download &lt;a
href=&quot;http://sourceforge.net/projechft/showfiles.php?group_id=156984&amp;package_id=175377&quot;&gt;Xming
installer&lt;/a&gt;, &lt;a
href=&quot;http://sourceforge.net/project/downloading.php?group_id=156984&amp;filename=Xming-fonts-7-3-0-11-setup.exe&quot;&gt;font
installer&lt;/a&gt; and &lt;a
href=&quot;http://sourceforge.net/project/downloading.php?group_id=156984&amp;filename=Xming-tools-and-clients-6-9-0-28.zip&quot;&gt;Xming-tools-and-clients&lt;/a&gt;. You
may use &lt;a
href=&quot;http://www.straightrunning.com/candidate/Xming-mesa-7-3-0-14-setup.exe&quot;&gt;Xming-mesa&lt;/a&gt;
installer to replace Xming installer for stable OpenGL operation (only
do so if you meet problems with Xming installer).&lt;/p&gt;

&lt;p&gt;My settings during installation of Xming are as follows:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Xming
    &lt;ul&gt;
      &lt;li&gt;Destination directory: changed to &lt;em&gt;c:\bin\Xming&lt;/em&gt;.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Xming-fonts
    &lt;ul&gt;
      &lt;li&gt;Destination directory: changed to the same directory as
      Xming (c:\bin\Xming)&lt;/li&gt;
      &lt;li&gt;Fonts to be installed: select according to your own taste.&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Xming-tools-and-clients &lt;ul&gt;&lt;li&gt;extract the zip file of
  Xming-tools-and-clients to the directory where Xming is installed
  (&lt;em&gt;c:\bin\Xming&lt;/em&gt; in this case).&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Settings on Windows host&lt;/h4&gt;

&lt;p&gt;For file &lt;em&gt;x0.hosts&lt;/em&gt; in Xming directory, make sure the IP
address of coLinux machines (192.168.0.20) is added.&lt;/p&gt;

&lt;p&gt;If you want to run the tools and clients bundled with Xming in
Windows host, you need to type &lt;kbd&gt;set DISPLAY=127.0.0.1:0&lt;/kbd&gt; in
your Windows host.&lt;/p&gt;

&lt;p&gt;Following steps are used to enable Windows fonts to be used by X
application. This step is &lt;em&gt;optional&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Open a command prompt window, change to directory
&lt;em&gt;c:\bin\Xming&lt;/em&gt;, and type the following commands:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
mkfontscale C:/WINDOWS/Fonts
mkfontscale -b -s -l C:/WINDOWS/Fonts
&lt;/pre&gt;

&lt;p&gt;Make sure that directory &lt;em&gt;C:\Windows\Fonts&lt;/em&gt; appeared in the
file &lt;em&gt;font-dirs&lt;/em&gt; in Xming directory.&lt;/p&gt;

&lt;h4&gt;On coLinux machine&lt;/h4&gt;

&lt;p&gt;Add the following line into &lt;em&gt;/etc/profile&lt;/em&gt;.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
export DISPLAY=192.168.0.1:0
&lt;/pre&gt;

&lt;p&gt;After start Xming (preferably to start it automatically when
Windows start), you can simply invoke any command inside Linux console
like:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
xterm &amp;amp;
&lt;/pre&gt;

&lt;h2&gt;4. Miscellaneous&lt;/h2&gt;

&lt;h4&gt;Change host name&lt;/h4&gt;

&lt;p&gt;According to &lt;a
href=&quot;http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&amp;chap=8&quot;&gt;Gentoo
Handbook&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Edit file &lt;em&gt;/etc/conf.d/hostname&lt;/em&gt;, if you call your coLinux
machine as &lt;em&gt;tux&lt;/em&gt;, then set the following line.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
HOSTNAME=&quot;tux&quot;
&lt;/pre&gt;

&lt;p&gt;Edit file &lt;em&gt;/etc/conf.d/net&lt;/em&gt;, if you call your domain as
&lt;em&gt;homenetwork&lt;/em&gt;, then set the following line.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
dns_domain_lo=&quot;homenetwork&quot;
&lt;/pre&gt;

&lt;p&gt;Remove string &lt;em&gt;.\O&lt;/em&gt; from file &lt;em&gt;/etc/issue&lt;/em&gt; to get rid
of the annoying &lt;em&gt;unknown_domain&lt;/em&gt; in the welcome message &quot;This
is host.unknown_domain ...&quot;.&lt;/p&gt;

&lt;h4&gt;Create regular user accounts&lt;/h4&gt;

&lt;p&gt;With the following command, I created a new user named foo as a
powerful user (with the ability to su to root and also invoke some
portage related commands). Pleas substitute &lt;em&gt;foo&lt;/em&gt; above with
your desired user name.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
useradd foo -m -G users,wheel,portage
passwd foo
&lt;/pre&gt;

&lt;h4&gt;Access Windows folder&lt;/h4&gt;

&lt;p&gt;When we edit &lt;em&gt;gentoo.conf&lt;/em&gt; above, we have already enabled
coLinux to share folder c:\linux. To make our regular user to access
this directory in Linux, edit file &lt;em&gt;/etc/fstab&lt;/em&gt; and add the
following line:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
cofs00  /home/foo/windows  cofs  uid=foo,gid=foo,dmask=0755,fmask=0644 0 0
&lt;/pre&gt;

&lt;p&gt;The above line will enable the Windows folder to be shared in Linux
as a folder /home/foo/windows. You can modify above line for your own
user.&lt;/p&gt;

&lt;h4&gt;Additional programs&lt;/h4&gt;

&lt;p&gt;Following is a list of commands to install my own favorite
programs. Your situation would be of course different.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
&lt;span class=&quot;comment-delimiter&quot;&gt;# &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;Some system utilities
&lt;/span&gt;emerge gentoolkit slocate

&lt;span class=&quot;comment-delimiter&quot;&gt;# &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;Development tools
&lt;/span&gt;&lt;span class=&quot;builtin&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;string&quot;&gt;&quot;dev-lang/erlang hipe&quot;&lt;/span&gt; &amp;gt;&amp;gt; /etc/portage/package.use
emerge aspell ruby sbcl erlang dev-util/git maxima

&lt;span class=&quot;comment-delimiter&quot;&gt;# &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;Gfx (GLEidescope is one of my favorite XScreenSaver)
&lt;/span&gt;emerge inkscape blender xscreensaver

&lt;span class=&quot;comment-delimiter&quot;&gt;# &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;Netowork
&lt;/span&gt;emerge mozilla-firefox

&lt;span class=&quot;comment-delimiter&quot;&gt;# &lt;/span&gt;&lt;span class=&quot;comment&quot;&gt;X tools
&lt;/span&gt;emerge xlsfonts xfontsel
&lt;/pre&gt;

&lt;p&gt;Before &lt;kbd&gt;emerge texlive&lt;/kbd&gt;, I have to add a bunch of keywords
for dependencies in &lt;em&gt;/etc/portage/package.keywords&lt;/em&gt; as
follows.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
app-text/texlive ~x86
app-text/texlive-core ~x86
dev-texlive/texlive-metapost ~x86
dev-texlive/texlive-basic ~x86
dev-texlive/texlive-documentation-base ~x86
dev-texlive/texlive-psutils ~x86
dev-texlive/texlive-langcjk ~x86
dev-tex/cjk-latex ~x86
dev-texlive/texlive-documentation-english ~x86
dev-texlive/texlive-genericrecommended ~x86
dev-texlive/texlive-latexrecommended ~x86
dev-texlive/texlive-latex ~x86
dev-texlive/texlive-texinfo ~x86
dev-texlive/texlive-latex3 ~x86
dev-texlive/texlive-htmlxml ~x86
app-text/jadetex ~x86
dev-texlive/texlive-fontsrecommended ~x86
app-text/dvipdfm ~x86
dev-texlive/texlive-documentation-chinese ~x86
dev-texlive/texlive-langmanju ~x86
&lt;/pre&gt;

&lt;h4&gt;Use CVS version of Emacs&lt;/h4&gt;

&lt;p&gt;Run the following commands:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
echo &quot;app-editors/emacs-cvs ~x86&quot; &gt;&gt; /etc/portage/package.keywords
emerge emacs-cvs
&lt;/pre&gt;

&lt;p&gt;If you want to use this bleeding-edge version &lt;em&gt;only&lt;/em&gt;, you
can uninstall the previous version of Emacs (if you have installed)
and type:&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
echo &quot;virtual/emacs ~x86&quot; &gt;&gt; /etc/portage/package.keywords
&lt;/pre&gt;

&lt;p&gt;Otherwise (i.e. you have multiple versions of Emacs), when you
emerge packages requiring Emacs, a &lt;em&gt;stable&lt;/em&gt; version
(e.g. v22.1) will be installed. For the multiple-version-installation,
you can use &lt;kbd&gt;eselect emacs list&lt;/kbd&gt; to see a list of available
version. To use Emacs 23 just installed, you can type &lt;kbd&gt;eselect
emacs set emacs-23&lt;/kbd&gt;. For details, please consult &lt;a
href=&quot;http://www.gentoo.org/proj/en/lisp/emacs/xft.xml&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;Emacs extensions&lt;/h4&gt;

&lt;p&gt;I run the following commands to install a few Emacs
extensions. Note that in Gentoo, many extensions (e.g. those related
to development) are automatically installed for you when you emerge
the related tools and enable &lt;em&gt;emacs&lt;/em&gt; USE flag.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
echo &quot;app-emacs/gentoo-syntax ~x86&quot; &gt;&gt; /etc/portage/package.keywords
echo &quot;app-emacs/imaxima ~x86&quot; &gt;&gt; /etc/portage/package.keywords
emerge htmlize imaxima app-emacs/gentoo-syntax keywiz
&lt;/pre&gt;

&lt;h4&gt;Enable SSH server&lt;/h4&gt;

&lt;p&gt;You may want to enable SSH access to your coLinux machine. There
are some benefits. Examples are shown below (assuming PuTTY is
used):&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;More flexibilities to configure the client (e.g. pretty fonts)
  and nice scrollbars.&lt;/li&gt;
  &lt;li&gt;The title of PuTTY indicates what coLinux is doing (such
  information might be useful during a long emerge process).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To start SSH server, type the following commands.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
rc-update add sshd default
/etc/init.d/sshd start
&lt;/pre&gt;

&lt;p&gt;When you use PuTTY client, you should fill &lt;em&gt;192.168.0.20&lt;/em&gt;
as the host address to utilize the high speed internal connection.&lt;/p&gt;

&lt;h4&gt;GTK configrations&lt;/h4&gt;

&lt;p&gt;Change the default GTK+ font. Edit file &lt;em&gt;~/.gtkrc-2.0&lt;/em&gt;, add
the following line, and change the font name and size to your
preferred one.&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
gtk-font-name = &quot;Arial 15&quot;
&lt;/pre&gt;

&lt;h4&gt;Mount CD&lt;/h4&gt;

&lt;p&gt;Simply type the following&lt;/p&gt;

&lt;pre class=&quot;code&quot;&gt;
# mount -t iso9660 -o ro /dev/hdc /mnt/cdrom
&lt;/pre&gt;

&lt;hr/&gt;

&lt;h2&gt;Final Words&lt;/h2&gt;

&lt;p&gt;coLinux is an interesting way to run Linux applications in Windows
host. One drawback of coLinux is that the daemon process is pinned to
one processor only. This avoids some bizarre issues, however it does
not utilize the potentials of modern multi-core systems. This is
disappointing especially for a Gentoo user who requires lots of
computation power. Hope the situation could be improved in the
future.&lt;/p&gt;

&lt;p&gt;&lt;ins&gt;Update: please refer this post on &lt;a href=&quot;http://yujianzhang.blogspot.com/2008/04/enable-sound-for-colinux.html&quot;&gt;how to enable sound.&lt;/a&gt;&lt;/ins&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/2167155226705602904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/03/install-gentoo-with-colinux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/2167155226705602904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/2167155226705602904'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/03/install-gentoo-with-colinux.html' title='Install Gentoo with coLinux'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-225433735601639295</id><published>2008-01-17T12:33:00.094+08:00</published><updated>2013-12-02T07:34:58.732+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><title type='text'>Reading List</title><content type='html'>&lt;p&gt;My previous post discussed my thoughts on &lt;a
href=&quot;http://yujianzhang.blogspot.com/2008/01/read-programming-books.html&quot;&gt;how to read programming books&lt;/a&gt;, here comes my reading list of programming/computer science books. The books I have completed reading after this post are listed for each year, afterwards come the books I am reading and those I plan to read (all books I have completed before this post is not listed here). Note that this is a &lt;strong&gt;living&lt;/strong&gt; document.&lt;/p&gt;&lt;script charset=&quot;utf-8&quot; type=&quot;text/javascript&quot; src=&quot;http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822/US/thoinair-20/8001/1f15069e-8d7c-4c8f-9fd2-6ccadb4149ad&quot;&gt; &lt;/SCRIPT&gt; &lt;noscript&gt;&lt;a HREF=&quot;http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822%2FUS%2Fthoinair-20%2F8001%2F1f15069e-8d7c-4c8f-9fd2-6ccadb4149ad&amp;Operation=NoScript&quot;&gt;Amazon.com Widgets&lt;/A&gt;&lt;/NOSCRIPT&gt;  &lt;script charset=&quot;utf-8&quot; type=&quot;text/javascript&quot; src=&quot;http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822/US/thoinair-20/8001/4ebe2414-e34e-4111-9620-02f669735b39&quot;&gt; &lt;/SCRIPT&gt; &lt;noscript&gt;&lt;a HREF=&quot;http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822%2FUS%2Fthoinair-20%2F8001%2F4ebe2414-e34e-4111-9620-02f669735b39&amp;Operation=NoScript&quot;&gt;Amazon.com Widgets&lt;/A&gt;&lt;/NOSCRIPT&gt;  &lt;script charset=&quot;utf-8&quot; type=&quot;text/javascript&quot; src=&quot;http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822/US/thoinair-20/8001/68dd4ab7-042d-4b20-a426-0f2f03cb7e8f&quot;&gt; &lt;/SCRIPT&gt; &lt;noscript&gt;&lt;a HREF=&quot;http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822%2FUS%2Fthoinair-20%2F8001%2F68dd4ab7-042d-4b20-a426-0f2f03cb7e8f&amp;Operation=NoScript&quot;&gt;Amazon.com Widgets&lt;/A&gt;&lt;/NOSCRIPT&gt;  &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.douban.com/subject/1844794/&quot;&gt;脂砚斋批评本红楼梦(上下)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.douban.com/subject/1200842/&quot;&gt;尘埃落定&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;script charset=&quot;utf-8&quot; type=&quot;text/javascript&quot; src=&quot;http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822/US/thoinair-20/8001/d4db9d8b-26d1-4381-9bde-af4763e79ac0&quot;&gt; &lt;/SCRIPT&gt; &lt;noscript&gt;&lt;a HREF=&quot;http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822%2FUS%2Fthoinair-20%2F8001%2Fd4db9d8b-26d1-4381-9bde-af4763e79ac0&amp;Operation=NoScript&quot;&gt;Amazon.com Widgets&lt;/A&gt;&lt;/NOSCRIPT&gt; &lt;br /&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://book.douban.com/subject/2567698/&quot;&gt;三体&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.douban.com/subject/3066477/&quot;&gt;三体II&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.douban.com/subject/5363767/&quot;&gt;三体III&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.douban.com/subject/6265750/&quot;&gt;三体X&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.douban.com/subject/1192090/&quot;&gt;球状闪电&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.douban.com/subject/3636385/&quot;&gt;超新星纪元&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.douban.com/subject/1013980/&quot;&gt;边城&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.douban.com/subject/3266609/&quot;&gt;流浪地球&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.douban.com/subject/4832901/&quot;&gt;白垩纪往事&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.douban.com/subject/3031773/&quot;&gt;作文入门&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt; 

&lt;SCRIPT charset=&quot;utf-8&quot; type=&quot;text/javascript&quot; src=&quot;http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822/US/thoinair-20/8001/a8d53cb4-b841-4118-a465-db9efc1c9c9c&quot;&gt; &lt;/SCRIPT&gt; &lt;NOSCRIPT&gt;&lt;A HREF=&quot;http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822%2FUS%2Fthoinair-20%2F8001%2Fa8d53cb4-b841-4118-a465-db9efc1c9c9c&amp;Operation=NoScript&quot;&gt;Amazon.com Widgets&lt;/A&gt;&lt;/NOSCRIPT&gt;
&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://book.douban.com/subject/3320907/&quot;&gt;追踪1789法国大革命&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://book.douban.com/subject/2775720/&quot;&gt;叶嘉莹说初盛唐诗:迦陵说诗&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;SCRIPT charset=&quot;utf-8&quot; type=&quot;text/javascript&quot; src=&quot;http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822/US/thoinair-20/8001/38990fa2-c959-472c-8a51-2699f4f97518&quot;&gt; &lt;/SCRIPT&gt; &lt;NOSCRIPT&gt;&lt;A HREF=&quot;http://ws.amazon.com/widgets/q?ServiceVersion=20070822&amp;MarketPlace=US&amp;ID=V20070822%2FUS%2Fthoinair-20%2F8001%2F38990fa2-c959-472c-8a51-2699f4f97518&amp;Operation=NoScript&quot;&gt;Amazon.com Widgets&lt;/A&gt;&lt;/NOSCRIPT&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://book.douban.com/subject/4884218/&quot;&gt;我的阿勒泰&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Reading&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0201558025/thoinair-20&quot;&gt;Concrete Mathematics &lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
  href=&quot;http://www.amazon.com/dp/0070004846/thoinair-20&quot;&gt;Structure and Interpretation of   Computer Programs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
  href=&quot;http://www.amazon.com/dp/0521562473/thoinair-20&quot;&gt;Lisp in Small Pieces&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
  href=&quot;http://www.amazon.com/dp/0201657880/thoinair-20&quot;&gt;Programming   Pearls&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
  href=&quot;http://www.amazon.com/dp/0195105192/thoinair-20&quot;&gt;What Is Mathematics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
  href=&quot;http://www.amazon.com/dp/0201021153/thoinair-20&quot;&gt;The Feynman Lectures   on Physics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
  href=&quot;http://www.amazon.com/dp/0324224729/thoinair-20&quot;&gt;Principles of Economics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a
  href=&quot;http://www.amazon.com/dp/0691025096/thoinair-20&quot;&gt;Mathematics and Plausible Reasoning (Volume I)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0131429388/thoinair-20&quot;&gt;Operating Systems Design and Implementation (3rd Edition)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0764579010/thoinair-20&quot;&gt;Professional Assembly Language&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0521845270/thoinair-20&quot;&gt;Fundamentals of Wireless Communication&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0072970545/thoinair-20&quot;&gt;Introduction to Algorithms (2nd Edition)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0262062798/thoinair-20&quot;&gt;Essentials of Programming Languages (3rd Edition)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0486256642/thoinair-20&quot;&gt;One Two Three . . . Infinity&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0140433937/thoinair-20&quot;&gt;The History of the Decline and Fall of the Roman Empire, Vol. 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/071671017X/thoinair-20&quot;&gt;Aha! Insight&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0136042597/thoinair-20&quot;&gt;Artificial Intelligence: A Modern Approach (3rd Edition)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/1590592395/thoinair-20&quot;&gt;Practical Common Lisp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.douban.com/subject/1478256/&quot;&gt;围棋死活大全&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.douban.com/subject/3610681/&quot;&gt;海子诗全集&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;h4&gt;To Read&lt;/h4&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0471694665/thoinair-20&quot;&gt;Operating System Concepts (7th Edition)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0321486811/thoinair-20&quot;&gt;Compilers: Principles, Techniques, and Tools (2nd Edition)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0201848406/thoinair-20&quot;&gt;Computer Graphics: Principles and Practice in C (2nd Edition)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0201896834/thoinair-20&quot;&gt;Art of Computer Programming, Volume 1: Fundamental Algorithms (3rd Edition)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0132400855/thoinair-20&quot;&gt;Astronomy Today (6th Edition)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/1420922610/thoinair-20&quot;&gt;Walden&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0195061357/thoinair-20&quot;&gt;Mathematical Thought from Ancient to Modern Times, Vol. 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0671201581/thoinair-20&quot;&gt;A History of Western Philosophy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/026256100X/thoinair-20&quot;&gt;The Seasoned Schemer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0262162091/thoinair-20&quot;&gt;Types and Programming Languages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0262220695/thoinair-20&quot;&gt;Concepts, Techniques, and Models of Computer Programming&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0521642981/thoinair-20&quot;&gt;Information Theory, Inference &amp; Learning Algorithms&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/1429215976/thoinair-20&quot;&gt;Psychology&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.amazon.com/dp/0763740632/thoinair-20&quot;&gt;Genes IX&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;hr/&gt;&lt;p&gt;&lt;strong&gt;Update (2008-8-18)&lt;/strong&gt;: started to add books other than CS/programming, e.g. mathematics, physics, literature, communications.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Update (2009-2-25)&lt;/strong&gt;: replaced table format with lists (lists with year heading consists books completed in that year), partly because lists are easier to update, but mainly because that I tend to sneak more books into reading queue when no free &quot;slots&quot; available, which makes the table format itself somehow &quot;cheating&quot;.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Update (2009-3-13)&lt;/strong&gt;: started to use Amazon widget; correct the 1st paragraph to reflect the status of reading.&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/225433735601639295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/01/reading-list.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/225433735601639295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/225433735601639295'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/01/reading-list.html' title='Reading List'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-3137409207504901216</id><published>2008-01-16T12:39:00.001+08:00</published><updated>2010-02-22T12:21:12.051+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><title type='text'>Read Programming Books</title><content type='html'>&lt;p&gt;Although learning programming can be achieved via online tutorials,
reading books is still the preferred way for systematic learning (see
some discussions &lt;a
href=&quot;http://www.codinghorror.com/blog/archives/000971.html&quot;&gt;here&lt;/a&gt;,
&lt;a href=&quot;http://www.charlespetzold.com/blog/0512130901.html&quot;&gt;here&lt;/a&gt;,
and &lt;a
href=&quot;http://www.charlespetzold.com/blog/2007/10/081247.html&quot;&gt;here&lt;/a&gt;
from author&#39;s point of view). Following list is gathered along my
adventure on reading programming books, especially on programming
&lt;em&gt;language&lt;/em&gt; books (for books &lt;strong&gt;not&lt;/strong&gt; requiring
active participations, it is recommended that you follow &lt;a
href=&quot;http://www.charlespetzold.com/blog/2007/06/230501.html&quot;&gt;advice
from Charles Petzold&lt;/a&gt;). Some suggestions are easier to be said than
to be done, therefore the list is also a reminder to myself.&lt;/p&gt;

&lt;h3&gt;1. Select the right book&lt;/h3&gt;

&lt;p&gt;Reading a programming book requires enormous time and
energy. Before embarking on the hundreds-hour-adventure, it is
justified to spend sometime to select the correct path. Sometimes
starting reading an excellent book itself is an achievement. So which
book to read? The simplest solution is to search in Google or Amazon
and select those with enthsiastic reviews.  Google/Amazon are always
handy since you can get more details/reviews on books. There are
alternatives of course, as we will discuss below.&lt;/p&gt;

&lt;p&gt;If you just want to read &lt;em&gt;great&lt;/em&gt; programming books without
any specific topics, you are lucky since this important question has
already been discussed again and again. For example, you may refer to
this &lt;a
href=&quot;http://programming.reddit.com/info/62dme/comments/&quot;&gt;Reddit
thread&lt;/a&gt;, or you can consult the opinions of some outstanding
programmers/bloggers (e.g. Steve Yegge&#39;s recommendations &lt;a
href=&quot;http://steve.yegge.googlepages.com/ten-great-books&quot;&gt;here&lt;/a&gt; and
&lt;a href=&quot;http://steve.yegge.googlepages.com/ten-challenges&quot;&gt;here&lt;/a&gt;,
&lt;a
href=&quot;http://www.joelonsoftware.com/navLinks/fog0000000262.html&quot;&gt;Joel
Spolsky&#39;s advice&lt;/a&gt;, and &lt;a
href=&quot;http://www.codinghorror.com/blog/archives/000020.html&quot;&gt;Jeff
Atwood&#39;s list&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;If you do have some topics in mind (e.g. one particular programming
language), there are various ways in addition to Google/Amazon
approach.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Lookup in Wikipedia. Typically for one programming language,
  there will be one related article. At the end of the article, there
  is one &lt;em&gt;References&lt;/em&gt; section, where you can find some
  interesting links to books. &lt;/li&gt;
 &lt;li&gt;Consult the FAQ of the language newsgroup. Normally, language X
 has one corresponding newsgroup like comp.lang.X. Generally the FAQ
 (sometimes quite outdated) of the newsgroup contains some book
 recommendations.&lt;/li&gt;
 &lt;li&gt;For some languages with &lt;em&gt;official&lt;/em&gt; website (e.g. &lt;a
 href=&quot;http://www.haskell.org&quot;&gt;Haskell&lt;/a&gt;, &lt;a
 href=&quot;http://www.perl.org&quot;&gt;Perl&lt;/a&gt;, and &lt;a
 href=&quot;http://www.python.org&quot;&gt;Python&lt;/a&gt;), you can easily find book
 recommendations in the site.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let&#39;s name a few commonly recommended books for some programming
languages: &lt;em&gt;&lt;acronym title=&quot;Structure and Interpretation of
Computer Programs&quot;&gt;SICP&lt;/acronym&gt;&lt;/em&gt; (a.k.a. Wizard Book) for
Scheme, &lt;em&gt;Practical Common Lisp&lt;/em&gt; for Common Lisp,
&lt;em&gt;Programming Ruby&lt;/em&gt; (a.k.a. The PickAxe Book) for Ruby, and
&lt;em&gt;Javascript, the Definitive Guide&lt;/em&gt; (a.k.a. The Rhino Book) for
the &lt;a
href=&quot;http://steve-yegge.blogspot.com/2007/02/next-big-language.html
&quot;&gt;Next Big Language&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;2. Setup programming environment and prepare related resources&lt;/h3&gt;

&lt;p&gt;You can&#39;t learn programming without getting your hands dirty. To study one
programming language, you have to install necessary package(s).
&quot;Modern&quot; programming books (e.g. &lt;em&gt;Practical Common Lisp&lt;/em&gt;,
&lt;em&gt;Programming Ruby&lt;/em&gt;, &lt;em&gt;Javascript, the Definitive Guide&lt;/em&gt;,
and &lt;em&gt;Programming Erlang&lt;/em&gt;) typically have one chapter getting
you started. If your book does not contain such part, you can always
consult online tutorials to setup the environment.&lt;/p&gt;

&lt;p&gt;Typically the package contains some kind of editor or IDE for
developing. You need to familiarize yourself with them either by
reading your book or tutorial. For Emacs users, you can install
related mode and simply fire up Emacs.&lt;/p&gt;

&lt;p&gt;If the book is not so cutting-edge, you can find abundant resources
in the web: source code, discussion on exercises, and even video
lectures. You can bookmark or download these resources for your future
reference. &lt;em&gt;SICP&lt;/em&gt; is an excellent example here: great &lt;a
href=&quot;http://swiss.csail.mit.edu/classes/6.001/abelson-sussman-lectures/&quot;&gt;video
lectures&lt;/a&gt;, and &lt;a href=&quot;http://sicp.org.ua/&quot;&gt;nice wiki&lt;/a&gt; to
discuss solutions to exercises.&lt;/p&gt;

&lt;h3&gt;3. Practice, practice, and practice&lt;/h3&gt;

&lt;p&gt;You can&#39;t learn a language without sustained practice. We will
focus on the examples and exercises contained in the book here. &lt;/p&gt;

&lt;p&gt;When you read one example, simply &lt;em&gt;reading&lt;/em&gt; is not
enough. It is better if you &lt;em&gt;type&lt;/em&gt; the example and run
it. Note: &lt;em&gt;type&lt;/em&gt;, not copy &amp;amp; paste. The reason is the same
as when you write programs. After compilation, you think your code has
done what it&#39;s supposed to do. But typically you need several iterations to make
it right. Similar thing happens for reading. You think you understand
the code on paper, but actually you do not. You should type it in and
run it to really understand it. When you type, you can think about the
meaning of the code, syntax and idioms associated simultaneously. A
more paranoid yet effective way is that you first read the example,
and then enter it without even referring to the book. You then run the
code, analyze the results, and compare your code with the example
supplied in the book.&lt;/p&gt;

&lt;p&gt;Now for exercises. Do them all if you can. Excellent books come
with excellent exercises, if any. You could gain more insight when you
employ the techniques you just learned. (If you have any doubt on the
value of exercises, you can look at &lt;a
href=&quot;http://steve.yegge.googlepages.com/scheming-is-believing&quot;&gt;Steve
Yegge&#39;s example&lt;/a&gt; on how doing exercises can change a person&#39;s view
about a language.) If you cannot solve one problem with
&lt;em&gt;serious&lt;/em&gt; try, you can leave it for a while and attack it
later. If you really cannot handle it, you can refer to the solutions,
which you can typically find online. Believe me, you can easily find
the answers to these hard problems of excellent books in the web.&lt;/p&gt;

&lt;h3&gt;4. Develop hobby project&lt;/h3&gt;

&lt;p&gt;When you have already read several chapters of the book and feel
comfortable to write a few small programs with the language you just
learned, you may consider to setup some hobby projects. You can use
the project to automate some day-to-day tasks, either in home or at
work. Or you may try to implement/interface some (emerging) cool
things (e.g. &lt;a href=&quot;http://code.google.com/apis/chart/&quot;&gt;Google Chart
API&lt;/a&gt; or &lt;a
href=&quot;http://www.ffconsultancy.com/languages/ray_tracer/&quot;&gt;Ray
tracing&lt;/a&gt;) with the language you are learning. Make sure the skills
to complete the project match the skills you just learned. You may
meet some problems you cannot handle with the skills you just
acquired. Don&#39;t panic. Just peep the later chapters of the book you
are reading, or Google around. Try to finish the project if you can
(and then you can blog about it if nobody has not done so or your way
is quite interesting). If you cannot finish it, you can leave it for a
later attempt. You may try several such projects when you progress in
the reading. The further you progress, the more ambitious task you can
try. Such hobby project itself can be viewed as extended exercises,
but designed by you, instead of the author.&lt;/p&gt;

&lt;p&gt;(Note: this section is largely influenced by a nice article/post
related to reading &lt;em&gt;On Lisp&lt;/em&gt;. Unfortunately I cannot find the
URL now.)&lt;/p&gt;

&lt;h3&gt;5. Never give up&lt;/h3&gt;

&lt;p&gt;The last but not the least advice is that you should read the book
from the beginning to the end. Spending a lot of time on one book but
giving it up when approaching say one third of it is just wasting
time. Since you only touched the surface of the book, which is easier
to learn and also easier to &lt;em&gt;forget&lt;/em&gt;. Authors arrange the books
in such a way that you could linearly read along, which typically
means that advanced topics come later. You may get stuck with one
chapter and cannot understand the topics discussed there. At this
point, don&#39;t give up. Remember that you can only achieve a higher
level of understanding of one language/technique if you can understand
the difficult part of it. Just read it, understand it, try it, or
Google around to find different (maybe better) treatment of the
topic. Attack this &lt;a
href=&quot;http://www.joelonsoftware.com/items/2007/12/06.html&quot;&gt;gnarly
problem&lt;/a&gt; and you will gain lots from it. You have now learned some
unique things of the language, you can now look at the language in a
different yet more insightful view, and of course, you can now proceed
further to read the great book and learn more.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Happy reading!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update (2010-2-21)&lt;/strong&gt;: editorial corrections (thank you justin for your suggestions).&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/3137409207504901216/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/01/read-programming-books.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/3137409207504901216'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/3137409207504901216'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/01/read-programming-books.html' title='Read Programming Books'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6613449007994858413.post-2553095749530564032</id><published>2008-01-14T12:48:00.001+08:00</published><updated>2009-03-23T09:55:53.515+08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gadget"/><category scheme="http://www.blogger.com/atom/ns#" term="mid"/><title type='text'>MID for Programmers</title><content type='html'>&lt;p&gt;Lots of &lt;acronym title=&quot;Mobile Internet Device&quot;&gt;&lt;a
href=&quot;http://en.wikipedia.org/wiki/Mobile_Internet_Device&quot;&gt;MID&lt;/a&gt;&lt;/acronym&gt;s
were showed off in CES 2008. However, none of them satisfy my
requirements. What I need is a device for web surfing, RSS feed
consuming, programming, and of course blogging. The one closest to my
criterial is &lt;a
href=&quot;http://www.engadget.com/2008/01/08/hands-on-with-lgs-new-menlow-based-mid/&quot;&gt;from
LG&lt;/a&gt;, however I shunned away from Windows. Following is a list of
features I expect an MID to have, from a programmer&#39;s perspective.&lt;/p&gt;

&lt;h4&gt;Mandatory factors:&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;em&gt;Around 5 inch touchscreen&lt;/em&gt;. Size matters. The screen
  size is the most difficult factor when making tradeoffs. We want it
  smaller for portability (otherwise why not a gorgeous 17 inch
  MacBook Pro?), but not so small to hurt our eyes. 5 inch seems to
  strike a nice balance. At this size, 800x600 resolution seems to be
  preferred.&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Full keyboard&lt;/em&gt; (similar as that of laptop in terms of
  keys equipped). Interface is critical. I am an Emacs fan, and the
  main usage of the MID is to try interesting programming ideas within
  Emacs and to compose blogs as well. Therefore I need the keyboard to
  have Ctrl and Alt equipped as a minimum. I also hope numerical keys
  have their independent positions (e.g. not shared with QWERTYUIOP as
  my Dopod 838, which is really painful). Keyboard from LG prototype
  satisfies all requirements here, therefore I do hope other vendors
  could follow suit.&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Fast CPU&lt;/em&gt;. &lt;a
  href=&quot;http://yujianzhang.blogspot.com/2007/11/is-gentoo-linux-choice-for-minimalists.html&quot;&gt;Gentoo
  is my favorite Linux distribution&lt;/a&gt;, therefore I may try to
  install it (somebody has already &lt;a
  href=&quot;http://gentoo-wiki.com/HARDWARE_Samsung_UMPC_Q1-Ultra&quot;&gt;done so
  on Q1 Ultra&lt;/a&gt;). In addition to satisfy a power-demanding
  distribution, a powerful CPU is also a &lt;a
  href=&quot;http://www.codinghorror.com/blog/archives/000666.html&quot;&gt;right
  for programmer&lt;/a&gt; even on such a tiny gadget.&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Linux based OS&lt;/em&gt;. Linux will shine on MID, which is
  actually an &lt;em&gt;old&lt;/em&gt; news. However, there are also devices
  running Windows at least for Menlow based MIDs, e.g. the one from
  LG. The reason for me to mandate Linux here is that I can easily
  install other flavors of Linux distributions if the device itself
  comes with one. With built-in Linux, we can make sure that source
  code for hardware is readily accessible: every vendor should learn
  something from the event of &lt;a
  href=&quot;http://www.google.com/search?hl=en&amp;q=eee+pc+gpl&quot;&gt;Eee PC GPL
  issues&lt;/a&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;WiFi access&lt;/em&gt;. Connection is important. Without WiFi
  access, I guess we can remove &lt;em&gt;Internet&lt;/em&gt; from the name of
  MID.&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Miscellaneous&lt;/em&gt;. We should match the fast CPU with at
  least 512 MB RAM. 8 GB internal storage is a minimum to fool
  around. SD card slot is a must to connect the MID with other
  devices, and Bluetooth with A2DP support is necessary to avoid hairy
  wires.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Optional features:&lt;/h4&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;em&gt;Phone capability&lt;/em&gt;. This feature is actually desperately
  needed. However I doubt whether I could find one MID if I insist on
  this feature. There are various reasons for vendors to drop this
  feature: maturity of the needed software, regulation aspects, and
  marketing issues (imagine the impact on N95 if N810 is a phone)
  etc.&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;GPS&lt;/em&gt;. This is always a nice feature to enjoy.&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;Nice camera&lt;/em&gt;. Just imagine the wow moment when you use
  your 5-inch-LCD-digital-camera.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, is it possible for MID + Android?&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://yujianzhang.blogspot.com/feeds/2553095749530564032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yujianzhang.blogspot.com/2008/01/mid-for-programmers.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/2553095749530564032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6613449007994858413/posts/default/2553095749530564032'/><link rel='alternate' type='text/html' href='http://yujianzhang.blogspot.com/2008/01/mid-for-programmers.html' title='MID for Programmers'/><author><name>Anonymous</name><uri>http://www.blogger.com/profile/11205967188770463624</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>