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

Monday, September 22, 2008

8051 Linux programmer

I just had no luck searching for this topic. Any one come across the same idea please shed me some lights.

Any cheap (universal) programmer out there can be used to compile 8051 C programs and also capable of writing the hex file into 8051 derivatives? I would also like to know what packages/compilers/similators to drive this programmer.

vim autocomplete

For some reason Ubuntu 8.04 didn't install vim by default, thus no syntax.

There's also another tips I always forgot.  vim has a very nice autocomplete feature.  For example you've a variable name "apple", you can type "ap", then press Ctrl-n or ctrl-p, it would show all the functions and variables start with "ap".

Friday, September 12, 2008

How to change the default system shell back to bash

For some reason, Ubuntu changed the default system shell from bash to dash.  To what I noticed, I didn't see any speed improvement but many scripts shows error or are not compatible.

To restore the whole system back to bash, call this command:

sudo dpkg-reconfigure dash

Friday, August 08, 2008

Typing Chinese in English Ubuntu 8.04

Update on Sept 12, 2010
For tips to install Chinese in any Debian based system, please follow this links:





I always prefer to install the OS in English and enable Chinese.  However, Chinese tool (scim) is not installed by default. Followings are my steps to enable Chinese support and typing in Ubuntu(6.04 ?)

  1. Go to System -> Administration -> Language Support
    Choose Chinese (Traditional and/or Simplified)

  2. install packages scim-chinese, scim-tables-zh, and all other dependencies

  3. $ vi /etc/X11/xinit/xinput.d/scim
    change xim input to scim 

    GTK_IM_MODULE="scim"
    QT_IM_MODULE="scim"

  4. without using root, type
    $ im-switch -z <Your locale> -s scim
    your locale can be figured out by command
    $ locale | grep LANG

  5. restart your X (Ctrl-Alt Del), then Ctrl-spacebar should give you a scim toolbar


P.S. After the scim toolbar is poping up, you still need to right click the toolbar to setup what input method you would like to use.  Personally, I used Changjie3 to type Chinese, it seems the closest to the Windows version of Changjie.

P.S.  I wonder if there is easier way...

Thursday, July 03, 2008

yum database clean up

Sometimes when yum is not updating, or simply not synchronized with the repository, it's a good idea to clean up the cache database and fetch a new list from the server.

  1. yum clean all

  2. mv /var/cache/yum/ /tmp/

  3. mv /var/lib/rpm/__db* /tmp/

  4. rpm --rebuilddb


Somehow I tend to move the files to /tmp/ rather then just remove them, since the rm -rf command is the No. 1 enemy of idiocity.