Saturday, February 12, 2011

HKJC Moonlight

The Hong Kong Jockey Club (香港賽馬會) is one of the shittest websites, their online 投注站 only support IE.

Great news is that finally changed it. Although they are still sticking to Microsoft (Silverlight) now, we do have an alternative Moonlight for Firefox users. When IE and Safari get into the hkjc website, they can automatically detect and download the corresponding plug-in. Firefox failed to do so, because Silverlight is not open-source. Surprisingly, this time Microsoft is kind enough to create a similar open source project Moonlight. They provide a firefox plug-in, letting non-MS people to bet finally.

Friday, February 11, 2011

Typing Chinese in Sabayon5.5

I was trying out Sabayon, and as usual, one of the first things I would like to set up is to configure SCIM to type Chinese.

Speaking of which, Sabayon interested me for a few reasons.  It's based on Gentoo; every Linux user thought Gentoo is cool. While I didn't have the patient go through the installation of Gentoo, trying Sabayon seems to make a lot of sense. Just like I've been using LinuxMint instead of Ubuntu,  I love these distros because they just "works" after initial installation.   Even more, Sabayon has two powerful package managers - emerge and equo.  emerge uses Gentoo's infamous portage system to build packages straight from source, while equo provides package managers to install from pre-compiled binaries, just like yum in Fedora and apt in Ubuntu.  equo is fast, while emerge gives me the cutting edge versions instead of waiting others to pre-compil the binaries.  I've no complain.

To install scim and Chinese input methods (倉頡 is one of them), use the following command:
equo scim scim-tables

To make scim as default input method, put following lines to ~/.profile:
export XMODIFIERS='@im=SCIM'
export XIM="scim"
export XINPUT="xim"
export XIM_PROGRAM="scim -d"
export GTK_IM_MODULE="xim"
export QT_IM_MODULE="xim"
scim -d &

Now, restart X( by logout login again, or Ctrl+Alt+Backspace), then Ctrl-space, there should be the SCIM toolbar somewhere on your screen, then choose your favourite input method to use it.

And try the WenQuanYi Bitmap Song CJK Font, it is the best Chinese font I've seen.
equo install  wqy-bitmapfont

Thursday, February 10, 2011

sshd start at boot

This command should work for other distro. I just ran into this problem when I was trying out sabayon, which for reason doesn't start sshd by default.
# rc-update add sshd default

Thursday, February 03, 2011

Typing Chinese in English Ubuntu10.10 or LinuxMint10

aptitude install scim scim-chinese scim-tables-zh

im-switch -z ll_CC -s scim

Sunday, January 23, 2011

command to display motherboard's model

command to display hardware:
$ sudo lshw | less

command to display motherboard's model:
$ sudo dmidecode | less

Wednesday, December 22, 2010

QQ at Ubuntu crash

QQ is a very popular instant messenger software in China. Links to download QQ for Linux:
http://im.qq.com/qq/linux/download.shtml

However, when it runs, it always crash.
(Currently I'm using Ubuntu 8.04LTS)

Edit the following file can solve the problem:
vi /usr/bin/qq
#!/bin/sh

add the following line:
export GDK_NATIVE_WINDOWS=true

Friday, October 30, 2009

USB OTG

USB is a good interface but it can be very complicated and confusing(probably only for developers?)

The USB mini-male has 2 types:

  • Mini-A-male

  • Mini-B-male



The USB OTG devices detect itself as a host or client depends on the ID pin(pin 4). USB Mini-A-male has internal wiring to tie the ID pin to GND, which let the host to identify itself as USB host.

While most of the USB Mini-male cable you see on the market is Mini-B-male, which leave the pin unconnected.

Tuesday, October 13, 2009

gitweb on Ubuntu/Jaunty

Make sure these GIT packages are installed:

$ aptitude install git git-core gitk gitweb


Assume the default apache web server is /var/www/ ,
gitweb is the directory I want to install gitweb:

$ cd /var/www/
$ mkdir gitweb
$ cd gitweb


copy gitweb graphics and stylesheets(git-favicon.png git-logo.png gitweb.css) to its directory, their path should correspond to what states in /etc/gitweb.conf:

$ cd /var/www/gitweb/
$ cp /usr/share/gitweb/* .


add gitweb directory to apache2 configuration by creating a "gitweb" file inside apache conf.d directory:

$ vi /etc/apache/conf.d/gitweb


Paste the following text and modify if your path is different:

Alias /gitweb /var/www/gitweb

Options Indexes FollowSymlinks ExecCGI
DirectoryIndex /cgi-bin/gitweb.cgi
AllowOverride None


Modify gitweb.conf, assuming the public GIT repositories are located in /var/www/repo/

$ vi /etc/gitweb.conf



$projectroot = "/var/www/repo/";

# directory to use for temp files
$git_temp = "/tmp";

# target of the home link on top of all pages
#$home_link = $my_uri || "/";

# html text to include at home page
$home_text = "indextext.html";

# file with project list; by default, simply scan the projectroot dir.
$projects_list = $projectroot;

# stylesheet to use
# I took off the prefix / of the following path to put these files inside gitweb directory directly
$stylesheet = "gitweb.css";

# logo to use
$logo = "git-logo.png";

# the 'favicon'
$favicon = "git-favicon.png";



restart apache2 web server:

$ sudo /etc/init.d/apache2 restart


Now you should be able to view gitweb listing all GIT projects under /var/www/repo/:
http://localhost/gitweb

Friday, November 07, 2008

vi copy and paste format problem

when copy and paste in vi it automatically inserts many annoying indents and tabs. To disable the auto indents and formatting, use this command before you paste

:set paste


and paste your codes. After that, set it back

:set nopaste