Monday, November 19, 2007

another vimrc setup under windows

Under windows, vim or gvim need to be set according to users special purpose.
Today, I got something useful configuration.

  • Set the start size of the gvim window, is can be done using the following command in .vimrc file.

set lines=45 columns=100

For maximum the gvim windows, using

if (has("gui_running") && (winnr("$") > 1)
set lines=99999 columns=99999
endif


there are also some more detailed discussion about such setup, refer to the webpage.
http://www.nabble.com/size-of-gvim-window-on-WIN32-t357190.html.

  • In order to edit the file with vim from Total Commander or Speed Commander, just set the edit application in setting to whatever you prefer. This is similar to view command.

Friday, November 16, 2007

Vim for Windows

After I installed vim 7 in my Chinese XP system, all the menu and messages were set to Chinese language automatically, but I'm familiar to the default English language, so I try to set it back. The command is add

:let $LANG='en'

in the source file. Thean all the messages are in English now.

But the GUI menu are still in Chinese, the method is simple

set langmenu=none
maybe the source of the menu is necessory.

source $VIMRUNTIME/delmenu.vim
set langmenu=none
source $VIMRUNTIME/menu.vim

Thursday, August 30, 2007

Show shell type in a Konsole

very simple,
echo $0

show pc name

echo $HOST

show home directory
echo $HOME

show user name
echo $USER

Tuesday, August 21, 2007

Set to healthy background color for your monitor.

Set a suitable background for the montior will protect the eyes from eyestrain in some degree.

The best I find from a report is RGB = #cce8cf,
this cell is with the background color #cce8cf


HSL = 85, 90, 205

try to set this color for your browser and system back ground.

Monday, July 30, 2007

find command in Linux

find

find [pathnames] [conditions]

An extremely useful command for finding particular groups of files (numerous examples follow this description). find descends the directory tree beginning at each pathname and locates files that meet the specified conditions. The default pathname is the current directory. The most useful conditions include -name and -type (for general use), -exec and -size (for advanced use), and -mtime and -user (for administrators).

Conditions may be grouped by enclosing them in \( \) (escaped parentheses), negated with !, given as alternatives by separating them with -o, or repeated (adding restrictions to the match; usually only for -name, -type, or -perm). Note that "modification" refers to editing of a file's contents, whereas "change" means a modification, or permission or ownership changes. In other words, -ctime is more inclusive than -atime or -mtime.

Conditions and actions

-amin +n| -n| n

Find files last accessed more than n (+n), less than n (-n), or exactly n minutes ago.

-anewer file

Find files that were accessed after file was last modified. Affected by -follow when after -follow on the command line.

-atime +n| -n| n

Find files that were last accessed more than n (+n), less than n (-n), or exactly n days ago. Note that find changes the access time of directories supplied as pathnames.

-cmin +n| -n| n

Find files last changed more than n (+n), less than n (-n), or exactly n minutes ago.

-cnewer file

Find files that were changed after they were last modified. Affected by -follow when after -follow on the command line.

-ctime +n| -n| n

Find files that were changed more than n (+n), less than n (-n), or exactly n days ago. A change is anything that changes the directory entry for the file, such as a chmod.

-daystart

Calculate times from the start of the day today, not 24 hours ago.

-depth

Descend the directory tree, skipping directories and working on actual files first, and then the parent directories. Useful when files reside in unwritable directories (e.g., when using find with cpio).

-empty

Continue if file is empty. Applies to regular files and directories.

-exec command{ } \ ;

Run the Linux command, from the starting directory on each file matched by find (provided command executes successfully on that file—i.e., returns a 0 exit status). When command runs, the argument { } substitutes the current file. Follow the entire sequence with an escaped semicolon (\;). In some shells, the braces may need to be escaped as well.

-false

Return false value for each file encountered.

-follow

Follow symbolic links and track the directories visited (don't use with -type l).

-fstype type

Match files only on type filesystems. Acceptable types include minix, ext, ext2, xia, msdos, umsdos, vfat, proc, nfs, iso9660, hpfs, sysv, smb, and ncpfs.

-gid num

Find files with numeric group ID of num.

-group gname

Find files belonging to group gname. gname can be a group name or a group ID number.

-ilname pattern

A case-insensitive version of -lname.

-iname pattern

A case-insensitive version of -name.

-inum n

Find files whose inode number is n.

-ipath pattern

A case-insensitive version of -path.

-iregex pattern

A case-insensitive version of -regex.

-links n

Find files having n links.

-lname pattern

Search for files that are symbolic links, pointing to files named pattern. pattern can include shell metacharacters and does not treat / or . specially. The match is case-insensitive.

-maxdepth num

Do not descend more than num levels of directories.

-mindepth num

Begin applying tests and actions only at levels deeper than num levels.

-mmin +n| -n| n

Find files last modified more than n (+n), less than n (-n), or exactly n minutes ago.

-mount, -xdev

Search only for files that reside on the same filesystem as pathname.

-mtime +n| -n| n

Find files that were last modified more than n (+n), less than n (-n), or exactly n days ago. A modification is a change to a file's data.

-name pattern

Find files whose names match pattern. Filename metacharacters may be used but should be escaped or quoted.

-newer file

Find files that were modified more recently than file; similar to -mtime. Affected by -follow only if it occurs after -follow on the command line.

-nogroup

The file's group ID does not correspond to any group.

-noleaf

Normally, find assumes that each directory has at least two hard links that should be ignored (a hard link for its name and one for "."--i.e., two fewer "real" directories than its hard link count indicates). -noleaf turns off this assumption, a useful practice when find runs on non-Unix-style filesystems. This forces find to examine all entries, assuming that some might prove to be directories into which it must descend (a time-waster on Unix).

-nouser

The file's user ID does not correspond to any user.

-ok command { }\;

Same as -exec, but prompts user to respond with y before command is executed.

-path pattern

Find files whose names match pattern. Expect full pathnames relative to the starting pathname (i.e., do not treat / or . specially).

-perm nnn

Find files whose permission flags (e.g., rwx) match octal number nnn exactly (e.g., 664 matches -rw-rw-r--). Use a minus sign before nnn to make a "wildcard" match of any unspecified octal digit (e.g., -perm -600 matches -rw-******, where * can be any mode).

-print

Print the matching files and directories, using their full pathnames. Return true. This is the default behavior.

-regex pattern

Like -path, but uses grep-style regular expressions instead of the shell-like globbing used in -name and -path.

-size n[c]

Find files containing n blocks, or if c is specified, n characters long.

-type c

Find files whose type is c. c can be b (block special file), c (character special file), d (directory), p (fifo or named pipe), l (symbolic link), s (socket), or f (plain file).

-user user

Find files belonging to user (name or ID).

Examples

List all files (and subdirectories) in your home directory:

find $HOME -print

List all files named chapter1 in the /work directory:

find /work -name chapter1

List all files beginning with memo owned by ann:

find /work -name 'memo*' -user ann -print

Search the filesystem (begin at root) for manpage directories:

find / -type d -name 'man*' -print

Search the current directory, look for filenames that don't begin with a capital letter, and send them to the printer:

find . \! -name '[A-Z] *' -exec lpr { }\;

Find and compress files whose names don't end with .gz:

gzip `find . \! -name '*.gz' -print`

Remove all empty files on the system (prompting first):

find / -size 0 -ok rm { } \;

Search the system for files that were modified within the last two days (good candidates for backing up):

find / -mtime -2 -print

Recursively grep for a pattern down a directory tree:

find /book -print | xargs grep '[Nn] utshell'

If the files kt1 and kt2 exist in the current directory, their names can be printed with the command:

$ find . -name 'kt[0-9] ' ./kt1 ./kt2

Since the command prints these names with an initial ./ path, you need to specify the ./ when using the -path option:

$ find . -path './kt[0-9] ' ./kt1 ./kt2

The -regex option uses a complete pathname, like -path, but treats the following argument as a regular expression rather than a glob pattern (although in this case the result is the same):

$ find . -regex './kt[0-9] ' ./kt1 ./kt2

Thursday, July 26, 2007

The Ultimate Rejection Letter


Herbert A. Millington
Chair - Search Committee
412A Clarkson Hall, Whitson University
College Hill, MA 34109

Dear Professor Millington,

Thank you for your letter of March 16. After careful consideration, I
regret to inform you that I am unable to accept your refusal to offer me
an assistant professor position in your department.

This year I have been particularly fortunate in receiving an unusually
large number of rejection letters. With such a varied and promising field
of candidates, it is impossible for me to accept all refusals.

Despite Whitson's outstanding qualifications and previous experience in
rejecting applicants, I find that your rejection does not meet my needs at
this time. Therefore, I will assume the position of assistant professor
in your department this August. I look forward to seeing you then.

Best of luck in rejecting future applicants.

Sincerely,
Chris L. Jensen

Monday, July 23, 2007

Xauthority Error in SSH connection.

xauth -b quit

This command will the xuthoirty locks after errors.

Wednesday, July 04, 2007

Reynolds number(雷诺数Re)

Reynolds number(雷诺数Re)

Reynolds number(雷诺数Re)

液体的流动状态可用雷诺数判断。

雷诺数定义为

式中,d流束的特征长度,单位:m

V流体的平均流速,单位m/s

ν液体的运动粘度,单位:m2/s;或者,在CGS单位制中:cm2/s(斯);

μ—流体的动力粘度,也称绝对粘度,单位:Pa.s,它表示了单位速度梯度时内摩擦且应力的大小,μ之所以叫动力粘度,是因为在其量纲中存在动力学因素。

注:

l 对于圆形截面管路,其特征长度一般取管路直径D

l 对于非圆形截面管路,雷诺数定义为

水力直径dH可用下式计算

式中,A液流的有效面积;χ液流的湿周(液流有效截面的周界长度)。

l 对外流问题,vd一般取远前方来流速度和物体主要尺寸(如机翼弦长或圆球直径)

物理意义:流体力学中表示粘性影响的相似准数。Re是一个无因次量。

表示了流体流动时的惯性力Fg和粘性力(内摩擦力)Fm之比,它表示着流体流动的状态。

l 雷诺数Re小,意味着流体流动时各质点间的粘性力占主要地位,流体各质点平行于管路内壁有规则地流动,呈层流流动状态。

l 雷诺数Re大,意味着惯性力占主要地位,流体呈紊流流动状态,

一般管道雷诺数

Re2000为层流状态,

Re4000为紊流状态,

Re20004000为过渡状态。

在不同的流动状态下,流体的运动规律.流速的分布等都是不同的,因而管道内流体的平均流速υ与最大流速υmax的比值也是不同的。因此雷诺数的大小决定了粘性流体的流动特性。

外部条件几何相似时(几何相似的管子,流体流过几何相似的物体等),若它们的雷诺数相等,则流体流动状态也是几何相似的(流体动力学相似)。这一相似规律正是流量测量节流装置标准化的基础。

Tuesday, July 03, 2007

tar command for bz2 files.

Use

In Unix, bzip2 can be used combined with or independently of tar: bzip2 file to compress and bzip2 -d file.bz2 to uncompress (the alias bunzip2 for decompression may also be used).

bzip2's command line flags are mostly the same as in gzip. So, to extract from a bzip2-compressed tar-file:

bzip2 -d <archivefile.tar.bz2 | tar -xvf -     or
bunzip2 <archivefile.tar.bz2 | tar -xvf -

To create a bzip2-compressed tar-file:

tar -cvf - filenames | bzip2 >archivefile.tar.bz2

GNU tar supports a -j flag, which allows creation of tar.bz2 files without a pipeline:

tar -cvjf archivefile.tar.bz2 file-list 

Decompressing in GNU tar:

tar -xvjf archivefile.tar.bz2

Monday, May 14, 2007

Linux command to list only the directories.

I always forget the command to list the directories under Linux, so I write it here. I can check it everytime I forget it.
ls -d */
another command dto do this is using tree command
tree -d -L 1

Monday, April 23, 2007

BBQ on laster Sunday.





Racket string broken again

It is terrible, the string I replaced several weeks ago broken again in last Friday. It is the thrid damge from my badminton sport 2007, all of it happen in 2 month. Frist, the string of the Yonex racket, then the frame of the Oliver racket, now the string of the Yonex again. It is too bad, I have no racket aviable tonight. Anyother new racket or another string? I will think about it.

The BBQ yesterday is very nice, 13 friends with lots of meat, sausage, fruits, camarons, coke, beer. We even have some games afterwards, volleyball, badminton, football, frisbee. But the shoes are not for the sport, then we missed the game with other two east-Europ girls. :D . Maybe I will upload some photos later.

With the coming nice whether, I'm waiting for the further BBQ in this summer.

Monday, April 16, 2007

Chinese Peking Opera Mask Collection.


Zhou Cang

Zhang Fei

Pang Tong

Wei Yan

Guan Yu

Thursday, April 12, 2007

Another interesting thing about Firefox

type in the folloing string in your Firefox address bar:
chrome://browser/content/browser.xul

What you will get is a new browse window in your current tab.

Wednesday, April 04, 2007

Friday, March 30, 2007

Wednesday, March 21, 2007

Tranditional Chinese Painting


By Li Keran


By Zhang Daqian


By Qi Baishi


By Qi Baishi


By Zhang Daqian

Friday, March 16, 2007

Thursday, March 15, 2007

What is second grade fluid?

I read a interest paper about second grade flow in the channell. Unfortunatly, I just forget what is the second order fluid. It seems have some relation with the Non-Newtonian fluids. But I'm still not sure what it really is? I get second order fluid in WiKiPedia, maybe they are the same, maybe not. I will search for it.

Friday, March 09, 2007

Using Tabs in vim 7+

With above vim 7.0, it is possible to use the tabs in vim with a single console. Here are several basic vim tabs commands. (It works for vim and gvim either).

  • With the option -p in the command line, you can open the files in tabs style.
vim -p file1.c file2.h file3.txt
  • When you are already in vim, the following command will show all tabs.
:tabs
  • If you want to open a new tab when vim already on, use tabnew command
:tabnew filenew.txt
  • In order to rearrange the tab, use the command tabm n to put the the current to nth position, keep in mind that all tabs position are start from 0 rather than 1. the following command will set the current tab to the 4th. tabm without argument will move current tab to the last.
:tabm 3

Wednesday, March 07, 2007

Convert between different encoding file.

In order to read Chinese on my Symbian 60 mobile phone, I want to convert some chinese text file into unicode character set, because the handy is officially Europe version, it does not support Chinese, The chinese system is achieved by install some thrid applications. And MobiPocket, which I have introduced in my previous post.

But there is a problem that Mobipocket reader can only support Unicode for other character sets like Chinese, I must convert the Chinese text file into Unicode.

For Windows system, just open the text file with Notepad, Save the file as a new file, where select the encoding as Unicode. This works fine.


For Linux syste, it is a litlle bit confusing, first you should know the encoding type of your files. A Linux command file, with option --mime, you will get more information about the file. For example
> file --mime mytext.txt

After that, you can convert the file to Unicode from its original encoding using iconv. You can get lots of information of how to use iconv, here I open give a short example.

>iconv -f GB18030 -t Unicode -c ming01.txt -o ming01uni.txt

〖原创〗童言无忌之聋哑人

昨天老婆给苗苗讲个故事,里面有个瞎子,然后老婆说,世界上有些人很可怜.
有的人很可怜,
眼睛看不东西,
有的人可怜,
听不到东西,
还有的人是哑吧,
不会说话。

然后苗苗说,还有的人很可怜,鼻子不通气,

注:她这两天有点流鼻子,鼻子不通气 .

English version;

My wife always tell my daughter a story before she goes to sleep. It is the same yesterday. There is a blind man in the story.
After the the story. My wife said,
it is misfortunate that some people in the world are blind,
it is also misfortunate that some people are deaf,
it is misfortunate that some people are dumb.

Showing miserable face, my daughter added,
it is even misfortunate that some people have a stuffy nose.
(My daughter already have a stuffy nose for two days).

Tuesday, March 06, 2007

Fail to config Gtalk in Gaim under Suse

I planed to implement Gtalk into Gaim under my Suse.
First, I direct download the source code of gaim 1.5, configure, make, make install. Then I can start gaim. It looks very nice with may protocols like MSN, Yahoo messenger, and so on. After I follow the instruction of using gtalk in Gaim ,

it show the error message "server doesn't use any supported authentication method". With some google works, I found the tips to solve this error. It is from comment by Freddy on Chris Shiflett's google talk instruction. The idea is recomplie the source code the gnutls enabled.

./configure --enable-gnutls=yes


At that time, I realize I still have no gnutls lib installed. This lead me to the gaim office project pages about gnutls. Download the related libs and install all of it, I find there is a error in this FAQ section about lib installation, that is

LD_LIBRARY_PATH=$HOME/lib ./configure --prefix=$HOME --with-libgcrypt=$HOME

This can not pass the configuration, after I check the help of configure, I find the currect options should be

--prefix=$HOME --with-libgcrypt-prefix=$HOME

After all this effort, I can use MSN and Yahoo Messenger but when I use gtalk, gaim crashed. I have tried all I can do, but still no good solution. Maybe use the browser based gtalk is my only way, or there are other tips to solve the problem.

Monday, March 05, 2007

Faschingstag

Chinese cartoon in classical paint style.










There are some selected pages from a tranditional comic book of china around 1957 by artist Jiyou Liu(刘继卣)(1918—1983). The art work is from the famous story of Monkey King.


Thursday, March 01, 2007

Firefox about pages

Firefox has several interesting about page, that is the pages when you type in about:xxxxxx in the address bar.

about: A simple prompt without any parameter will display the Mozilla “about” information. Since it’s accessible from the top menus as well, it’s not quite a hidden feature.

about:buildconfig Obviously, it will show the build platform configuration and parameters

about:cache Will display info and statistics regarding your disk’s cache, including the name of your cache’s directory and a list of the entries you can find there. By default, Firefox doesn’t allow you to view the cached webpages, so this can be an useful option.

about:config Oh look, many many info. Indeed, it’s the most complex and meaningful of them all. Careful on what you plan to change here, your browser won’t run properly after if you play with the wrong things.

about:plugins Of course, what is Firefox without it’s powerful extensions? This option will display detailed information about all the plugins installed for Mozilla Firefox.

about:credits It’s time to give the credit to whoever deserves it. There’s an alphabetically sorted list of all the people that gave their contribution to the development of Firefox.

about:Mozilla This is a weird thing. It will display the so-called “Book of Mozilla”. Something similar was present in Netscape too. There’s actually no real book although the quotations might give you that impression.

Have fun browsing through your browser’s internal features.