2007年8月29日 星期三

vim -- 在每行前加入行號

好久不見的 vim tip 又一發。如果已經有了一個(文字)檔,要怎麼更改內容,讓每行的前面加上行號呢?

答案有點複雜...可以用
:g/^/exe ":s/^/".line(".")."\t/"
這樣會將各行首塞個行號,再加個 tab 做分隔。詳細的 vim tip 連結在此


第一
:[range]g[lobal]/{pattern}/[cmd]
Execute the Ex command [cmd] (default ":p") on the
lines within [range] where {pattern} matches.
所以上面會走遍每一行首(其實就是每一行)執行 exe ":s/^/".line(".")."\t/"

第二
line( xxx ) 會回傳某個地方的行號,line(".") 會回傳目前游標所在的行號

所以綜合以上,上面的命令會讓 vim 走遍每一行,將行首代換成那一行的行號。

2007年8月28日 星期二

Over The Hills And Far Away -- Nightwish/Gary Moore

http://www.youtube.com/watch?v=14gSH_00LUQ

Nightwish。第一次聽到這首歌立刻就被憾動了,來自於女主唱如聲樂般雄厚的唱腔。不過也有種不協調感,因為後面樂團演奏搖滾的曲調。後來去查了歌詞,感覺更妙了。這個樂團應該很有趣 :D

後記:原來這首歌的原唱是 Gary Moore (youtube link)這個則是 Nightwish 的 MV (音質有點怪),嗯...視覺上和聽覺上有點不協調吧 :p


===

They came for him one winter's night.
Arrested, he was bound.
They said there'd been a robbery,
his pistol had been found.

They marched him to the station house,
he waited for the dawn.
And as they led him to the dock,
he knew that he'd been wronged.
"You stand accused of robbery,"
he heard the bailiff say.
He knew without an alibi,
tomorrow's light would mourn his freedom.

Over the hills and far away,
for ten long years he'll count the days.
Over the mountains and the seas,
a prisoner's life for him there'll be.

He knew that it would cost him dear,
but yet he dare not say.
Where he had been that fateful night,
a secret it must stay.
He had to fight the tears of rage.
His heart beat like a drum.
For with the wife of his best friend,
he spent his final night of freedom.

Over the hills and far away,
he swears he will return one day.
Far from the mountains and the seas,
back in her arms he swears he'll be.
Over the hills and far away.

Over the hills and,
over the hills and,
over the hills and far away.

Each night within his prison cell,
he looks out through the bars.
He reads the letters that she wrote.
One day he'll know the taste of freedom.

Over the hills and far away,
she prays he will return one day.
As sure as the rivers reach the seas,
back in his arms he swears she'll be.

Over the hills and far away,
he swears he will return one day.
Far from the mountains and the seas,
back in her arms he swears he'll be.

Over the hills and far away,
she prays he will return one day.
As sure as the rivers reach the sea,
back in her arms is where he'll be.

Over the hills,
over the hills and far away.

Over the hills,
over the hills and far away.

2007年8月14日 星期二

「分析網站是由哪些技術組成的」的網站

從網站製作學習誌看來的

BuiltWith.com 可以分析某個 site,告訴你這個網站用什麼樣的東西寫的、他的 framework, engine 等。不過,他好像不能輸入 IP address,也不能分析這個站下面的子頁面 :(