September 14, 2007

This is a test post from vimpress.

Hello world!

August 31, 2007

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

[DB] a good tutorial on how to optimize postgresql

June 20, 2007

http://www.postgresql.org/docs/8.1/interactive/performance-tips.html

Yeah, the documentation of Postgresql is a very good source to learn optimization of postgresql. Read it carefully and periodically.

[DB]The difference between ON and WHERE

June 19, 2007

Note: The join condition of an inner join can be written either in the WHERE clause or in the JOIN clause. For example, these table expressions are equivalent:

FROM a, b WHERE a.id = b.id AND b.val > 5

and

FROM a INNER JOIN b ON (a.id = b.id) WHERE b.val > 5

or perhaps even

FROM a NATURAL JOIN b WHERE b.val > 5

Which one of these you use is mainly a matter of style. The JOIN syntax in the FROM clause is probably not as portable to other SQL database management systems. For outer joins there is no choice in any case: they must be done in the FROM clause. An ON/USING clause of an outer join is not equivalent to a WHERE condition, because it determines the addition of rows (for unmatched input rows) as well as the removal of rows from the final result.

The above document comes from http://www.postgresql.org/docs/8.1/interactive/queries-table-expressions.html, the documentation of postgres.
In short, that means for INNER JOIN, the conditions under ON or WHERE have the same effect;but for OUTER JOIN, the conditions under ON and WHERE are different. After some thought, I think conditions under ON will be applied during or before table-joining, but conditions under WHERE will be applied after the table-joining. The time when conditions are applied is the key point.

For example:

FROM a, b WHERE a.id = b.id AND b.val > 5 [1]

and

FROM a INNER JOIN b ON (a.id = b.id) WHERE b.val > 5 [2]

are equivalent, but

FROM a LEFT JOIN b ON a.id = b.id AND b.val > 5 [3]

and

FROM a LEFT JOIN b ON a.id = b.id WHERE b.val > 5 [4]

are different.

For query [3], condition b.val > 5 will be applied to table b before table a joins table b;
For query [4], condition b.val > 5 will be applied to the joined table after table a joins table b;

PS: After passing the WHERE filter, the derived input table may be subject to grouping, using the GROUP BY clause, and elimination of group rows using the HAVING clause.

[MacOSX] 一个免费的中文输入法

April 29, 2007

今天从同事Jacky和Gary听说了一个Mac OSX 下面的中文输入法, Fun Input Toy[http://fit.coollittlethings.com/], 忍不住马上安装试用一下, 因为自从我开始使用MacOSX以来,就倍受Mac下自带的中文输入法折磨, 一直在寻找好用的中文输入法,在寻找了相当长的一段时间以后, 只找到一个商业软件QIM, 不幸的是QIM不支持双拼输入 :( . 今天听说了FIT以后, 就像发现了新大陆一样,马上安装!
安装以后,一切都非常的完美! 双拼用起来和Windows下面的IME软件基本没什么区别,好像还更好用一些 :)
希望FIT也同样带给你惊喜! Enjoy! ;)

来张图片:

use ssh tunnel when other application can not establish a stable connection

April 16, 2007

Recently I worked from home, to communicate with my mates, my company use IRC and there is an IRC server set up on office server. I use irssi as my IRC client. All work well until I change my work place from my home in BeiJing to my wife’s hometown(FuJian). It seems irssi can not establish a stable connection to the IRC server in office.
At first, I tried ssh to my computer in office and run irssi there. It works but there is some problems: I tweak a script that use Growl to notify me whenever there is a IRC message for me, and with Sound notification. It work very well locally, but not work well remotely, there is a delay for the sound playing(I use esound to play sound effect file).
Later, I got another solution from greg(thanks!), building an ssh tunnel for IRC server, then I can run irssi locally. After I gave it a try, it worked very well!
To make the ssh tunnel, run command:
$ ssh -Nf -L 6667:IRC_SERVER:6667 GATEWAY_IN_OFFICE
Then in irssi, connect to “localhost” as the IRC server.

It seems ssh does a really good work on network connection. Thank you, SSH!

Get resource from Wikipedia all the time!

March 28, 2007

Wikipedia is a wonderful place to many kinds of resouce, but unfortunately, it is not avaiable all the time in my country :(
To work around this, the following links are valuable for me:
http://en.wikilib.com
http://feedbus.com/wikis/wikipedia.php

use convmv to convert file name’s encoding

March 18, 2007

I find this tool in a serie articles at www.linux.com “Tools & Utilities , CLI Series”[http://enterprise.linux.com/article.pl?sid=06/03/27/2040218&tid=13&tid=89]. Seems interesting, check it out.

[irssi] eye candy in irssi

March 12, 2007

I found a funny script [http://juerd.nl/elsewhere.plp?href=../files/irssi/figlet.pl] for irssi, that use a tool named figlet[http://www.figlet.org/] to display large characters made up of ordinary screen character. And the script understands the color format control code in irssi, so with it you can create some outstanding colorful characters!

To use it,first install figlet tool; download the figlet script and put it into ~/.irssi/scripts folder, then in irssi run “/load script figlet” to load the script.

In irssi, input “/figlet ^C2 foo ^C4 bar” will generate following:

[irssi] completion in irssi

March 12, 2007

in irssi, you can define as many completions as you like by simply input command:
/completion ty thank you
/completion -auto ltns long time for no see

so when you input ‘ty’ and press Tab, then ‘ty’ will be replaced by ‘thank you’. If you use -auto option, then when you input ‘ltns’, to get the completion, you can press Tab or just press space. Simple and powerful. Try it!


Follow

Get every new post delivered to your Inbox.