Tuesday, December 16, 2008

Ubuntu is really nice release

I installed Ubuntu in my old latop several days ago. It works really fine on this 2.5 years old TOSHIBA M50 laptop, with 1.87GHZ CPU and 1G DDR. There are no error during the OS installation, all the drivers for this laptop were installed automatically without any problem, by the way, I installed the system with the burned 8.10 CD. Ubuntu gives easy way to install needed application. Package installed in my system are
  • Openoffice: office
  • firefox : browser
  • evince: pdf, djvu viewer
  • totem: media player
  • scilib: free scientific package as Matlab
  • Latex
  • vim
  • Amule
  • Wine
  • Urban terror: A Counter-Strike like FPS game. Free

Tuesday, November 11, 2008

Code to replace KVM hub

Find a very useful tools today named SYNERGY, which provide the possiblity to share single input device (mouse, keyboard) between several PCs or laptops with various operate systems. I currently use the Suse as the Synergy server and Windows XP laptop as the client, it works greatly. So for people with several PCs on your desktop, this is the easiest solution without any additional device.

Tuesday, June 10, 2008

Tips for Excel VBA

In a small Excel document, the input data need to be validated before saving. That is why a VBA code is needed. I hope this can also be done using formula, but a short VBA code look more sophisticated.

Firstly, Target is a range variable where the just input data located, it is a cell, generally. Secondly, I need to autofill or change some cells according to the new input data, I have to call the subroutine from the Change event, but, of cause, we can not modify the cell directly, otherwise, it will call such subroutine continously into a endless loop. What we need is inserting the code between
Application.EnableEvents = False
....
Application.EnableEvents = True

Finnally, to check if a cell is empty or not can be done by built-in function IsEmpty().

Sunday, June 08, 2008

08 端午


一糯一菰一角黍,
一羹一箸一望乡。
屈子无意随波去,
我辈怎可妄退耕。

Tuesday, June 03, 2008

Forecastfox™ 0.9.7.5 bug in status bar

With the new update of great extension Forecastfox for Firefox, there is a bug in status bar, error message is:

_______<label
id="ff-load-label" value="&ff.preview.loading.label;"/>

----------^




In order to sovle it, one need to do the following (Original from Forecastfox office support forum)

  • Close firefox.
  • Go to C:\Documents and Settings\[your user name]\Application Data\Mozilla\Firefox\Profiles\[some random string].default\extensions
  • view the folder in detaild mode and order by change date. Open the last changed folder.. Which probably is the forecastfox's folder...
  • Open the chrome folder..
  • open the forecastfox.jar with winrar...
  • Goto locale and select the language your using under forecastfox folder you will find forecastfox.dtd extract it and add

    <!ENTITY ff.preview.loading.label
    "Loading...">

Forecastfox™ 0.9.7.5 bug in status bar

With the new update of great extension Forecastfox for Firefox, there is a bug in status bar, error message is:

_______
----------^

In order to sovle it, one need to do the following (Original from Forecastfox office support forum)

  • Close firefox.
  • Go to C:\Documents and Settings\[your user name]\Application Data\Mozilla\Firefox\Profiles\[some random string].default\extensions
  • view the folder in detaild mode and order by change date. Open the last changed folder.. Which probably is the forecastfox's folder...
  • Open the chrome folder..
  • open the forecastfox.jar with winrar...
  • Goto locale and select the language your using under forecastfox folder you will find forecastfox.dtd extract it and add

Thursday, May 29, 2008

Mechenosets 捧剑者

一部很不错的俄罗斯电影,故事一般般,不过摄影相当出色。

男主角是极修长的那种精肉男子和印象中的好运种俄国大力士相去甚远,不过很符合这几年的影视风格,已经过了Stallone 和 Arnold 这种肌肉男的时代了,Arnold 从政了,Stallone 到缅甸了,也不敢露肉了,是这种干瘦的人精出来的时候了,就象 Adrien Brody这样的,主角和他还真有几分相似。

女主角是一个初看不怎么漂亮的姑娘,不过当她一笑,那双大眼立刻风情万种,再一查,原来好了 说是出演《再见列宁》的Chulpan Khamatova, 越看越有味道,尤其是那一段侧卧的镜头,加上摄影的高超水准,造就一幅古典的艺术画章。

片子的摄影很棒,每个场景都给人相当的视觉冲击和享受,颓废的、深远的、迷惑的、华丽的、深情的、黑暗的、无一不让人沉迷回味,要学摄影,这个电影可以成一个典范的。

至于故事本身,不能说上乘,立意有些意思,象那种X-men,只是经常失控,以致于自我毁灭都不行,右手无敌,不知道是不是得益于周星星的《新精武门》。其它比较一般,开始挺乱,后来才慢慢看出来门道,乱是一种风格,就看用得好不好了。血是给足了,只是有些细节特技做的不够好。

不管怎么说还算是部不错的片子,好象号称与《守日者》《守夜者》相承的作品,推荐看看。
IMDB 7/10 http://us.imdb.com/mymovies/list?l=6416408

Tuesday, April 15, 2008

Modify thunderbird display style.

Here is my userChrome.css to change the display style of thunderbird.


treechildren::-moz-tree-row(dummy) {
background-color: #96C0EF !important;
margin-bottom: 1px !important;
padding-left: 2px !important;
}

treechildren::-moz-tree-row(dummy, selected) {
background-color: -moz-Dialog !important;
}

treechildren::-moz-tree-row(dummy, selected, focus) {
background-color: Highlight !important;
}

treechildren::-moz-tree-cell-text(dummy) {
font-weight: bold !important;
font-size:12pt !important;
}


/* Label1 */
treechildren::-moz-tree-cell(lc-FFCCCC) { background-color: #DD0000 !important; }
treechildren::-moz-tree-cell(lc-FFCCCC, selected) { background-color: #DD0000 !important; }
treechildren::-moz-tree-cell-text(lc-FFCCCC) { color: #FFF0 !important; }
treechildren::-moz-tree-cell-text(lc-FFCCCC, selected) { color: #000 !important; }

/* Label2 */
treechildren::-moz-tree-cell(lc-CCCCFF) { background-color: #0000DD !important; }
treechildren::-moz-tree-cell(lc-CCCCFF, selected) { background-color: #0000DD !important; }
treechildren::-moz-tree-cell-text(lc-CCCCFF) { color: #FFF !important; }
treechildren::-moz-tree-cell-text(lc-CCCCFF, selected) { color: #000 !important; }

/* Label3 */
treechildren::-moz-tree-cell(lc-99FF99) { background-color: #00CC00 !important; }
treechildren::-moz-tree-cell(lc-99FF99, selected) { background-color: #99FF99 !important; }
treechildren::-moz-tree-cell-text(lc-99FF99) { color: #FFF !important; }
treechildren::-moz-tree-cell-text(lc-99FF99, selected) { color: #000 !important; }

/* Label4 */
treechildren::-moz-tree-cell(lc-FFFFCC) { background-color: #DDDD00 !important; }
treechildren::-moz-tree-cell(lc-FFFFCC, selected) { background-color: #DDDD00 !important; }
treechildren::-moz-tree-cell-text(lc-FFFFCC) { color: #FFF !important; }
treechildren::-moz-tree-cell-text(lc-FFFFCC, selected) { color: #000 !important; }

/* Label5 */
treechildren::-moz-tree-cell(lc-FFCCFF) { background-color: #CC33CC !important; }
treechildren::-moz-tree-cell(lc-FFCCFF, selected) { background-color: #CC33CC !important; }
treechildren::-moz-tree-cell-text(lc-FFCCFF) { color: #FFF !important; }
treechildren::-moz-tree-cell-text(lc-FFCCFF, selected) { color: #000 !important; }

/*
* Add vertical scrollbar for expanded header view
*/

#msgHeaderView {
max-height: 15em !important;
overflow: auto !important;
}

/*
* Limit height of attachment window
*/
#attachmentView {
-moz-appearance: none !important;
height: 74px !important;
overflow: auto !important;
}

Monday, April 07, 2008

vim tips about spell check

Spell checking is quite simplified after vim 7.0. I try to list some mostly used spell check functions. (Spellchecker is the integrated tool in vim 7.0, before that, script Spellchecker should be installed seperately.)

z= check the suggested word for the current marked wrong word

]s move to the next wrong word

zg add the word under cursor to the user dictionary

Thursday, January 24, 2008

Vim tips again, about ^M.

If you work in a mixed environment you will often open files that have ^M's in them. An example would be this:

------------------------------------------------------------------
import java.util.Hashtable; ^M
import java.util.Properties; ^Mimport java.io.IOException;
import org.xml.sax.AttributeList; ^M
import org.xml.sax.HandlerBase; ^Mimport org.xml.sax.SAXException;

/**^M
* XMLHandler: This class parses the elements contained^M
* within a XML message and builds a Hashtable^M

[snip]
------------------------------------------------------------------

Notice that some programs are not consistent in the way they insert the line breaks so you end up with some lines that have both a carrage return and a ^M and some lines that have a ^M and no carrage return (and so blend into one). There are two steps to clean this up.

1. replace all extraneous ^M:

:%s/^M$//g

BE SURE YOU MAKE the ^M USING "CTRL-V CTRL-M" NOT BY TYPING "CARROT M"! This expression will replace all the ^M's that have carriage returns after them with nothing. (The dollar ties the search to the end of a line)

2. replace all ^M's that need to have carriage returns:

:%s/^M/ /g

Once again: BE SURE YOU MAKE the ^M USING "CTRL-V CTRL-M" NOT BY TYPING "CARROT M"! This expression will replace all the ^M's that didn't have carriage returns after them with a carriage return.

Voila! Clean file. Map this to something if you do it frequently.

:help ffs - for more info on file formats


For more details, check this.

Thursday, January 10, 2008

Matlab debuging

By using debug function in Matlab, it is possible to trace the error and warning code effectively. Beside using the GUI dialog to define the debug options, this can also be done through command line code.

There are many options about debug setup. Check the documment if needed. Basically, we may use the following debug model often.

  • dbstop if error
  • dbstop if caught error
  • dbstop if warning
  • dbstop if caught error
If there is a error, the processing will paused at the error breakpoint, you can check the related variabls for the error reason. This does not mean the program is stop, so if you want to stop the running, you should type in dbquit.