基本語法格式: element { property: value }
如:
p { color: #ff000000; font-size: 10pt }
body { background: #ff0000; font-size: 10pt }
也可以 body,p { …. }
<head>
<style>
<!–
// css
–>
</style>
</head>
或
<head><style>
<!–
@import URL(./xxx.css);
–>
</style></head>
或
<link rel=stylesheet type="text/css" href="xxx.css">
或
<p style="….">aaa</p>
A:link {}
A:active {}
A:visited {}
A:hover {}
屬性: text-decoration, none, underline, overline, line-through, bilnk
屬性 cursor 可填的值: auto/crosshair/default/heand/move/e-resize/ne-resize/nw-resize/n-resize
/se-resize/sw-resize/s-resize/w-resize/text/wait/help
.layer1 {
position: absolute/relative/static;
top: 20px;
left: 30px;
z-index: 1;
}
前面加上 '.' 是配合 class 使用
這一段除文字可用外,圖片也可以用
Debian 2.2r6 設定
雖說是 Debian 2.2r6 設定,但我想 Debian 的設定應該就是這樣了吧~~
1.網路
主機名稱:/etc/hostname
網路卡為 dhcp 或 static : /etc/network/interfaces
iface eth0 inet dhcp
or
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
2.initscript
在 /etc/init.d 下建立 script
再使用 update-rc.d xxxx defaults 99 99 > /dev/nul
也有 update-inetd –add 針對 inetd 增加服務
ImageMagick
某天從 IBM 電子報上看到這篇http://www-106.ibm.com/developerworks/library/l-graf2/?ca=dgr-lnxw02GraphicsLine,才知道 ImageMagick 這麼神奇,直接用指令列就可以做很多圖片編輯的工作了~
把圖片的右上角弄成圓角
composite -gravity NorthEast rounded-ne.png lake.png lake-1.png
rounded-ne.png 是一個圓角的圖案,背景設成白色,圓角部份則設為透明.
composite 會將 rounded-ne.png 與 lake.png 結合,並輸出到 lake-1.png
是故,同理可證,你可以搞定四個角
composite -gravity NorthEast rounded-ne.png lake.png lake-1.png
composite -gravity NorthWest? rounded-nw.png lake-1.png lake-2.png
composite -gravity SouthEast? rounded-se.png lake-2.png lake-3.png
composite -gravity SouthWest? rounded-sw.png lake-3.png lake-4.png
寫成 script 就變成了:
for img in *.png do composite -gravity NorthEast rounded-ne.png $img.png $img-1.png
composite -gravity NorthWest rounded-nw.png $img-1.png $img-2.png
composite -gravity SouthEast rounded-se.png $img-2.png $img-3.png
composite -gravity SouthWest rounded-sw.png $img-3.png $img-4.png
done
讓圖片浮起來,變成像按鈕的樣子
convert -raise 5×5 tree.png tree-raised.png
凹下去的話就是用
convert +raise 5×5 tree.png tree-lowered.png
加個邊框吧
convert -bordercolor red -border 5×5 flower.png flower-border.png
也是加框,不過有點巧妙…
convert -mattecolor black -frame 5×5 beach.png beach-frame.png
convert -mattecolor black -frame 5×5+2 beach.png beach-frame.png
convert -mattecolor black -frame 5×5+2+2 beach.png beach-frame.png
或是
convert -mattecolor gray -frame 25×25+0+25 rock.png rock-frame1.png
convert -mattecolor gray -frame 25×25+25+0 rock.png rock-frame2.png
把所有 .jpg 縮圖
for img in *.jpg
do
convert -sample 25%x25% $img thumb-$img
done
或是
mogrify -sample 25%x25% *.jpg
mogrify -format png -sample 25%x25% *.jpg
把 pdf 中的圖檔解出來
convert foo.pdf pages-%03d.png
of course, 也可以反過來,把圖檔作成 .pdf
convert dsc* foo.pdf
利用 ssh + tar 作備份
以前看網路上某篇文章時,節錄下來的,出處已經不可考了.它是利用 ssh + tar 來作備份,不僅安全,也兼顧了部分的效率.
$target 表示目的機器,指遠端機器
$backup_server 表示備份機器,同樣也是指遠端機器
$save 則是指備份目錄
要求遠端備份並拉回 local
ssh $target tar -cf – / –exclude /mnt | bzip2 -9 | cat > $target.tar.bz2
解開本地備份並回存到遠端去
bunzip2 -dc $target.tar.bz2 | ssh $target “cd /;tar -pxkf -“
備份 local 資料,丟到遠端去壓縮並存檔
tar cf – / –exclude xxx | ssh $backup_server “bzip2 -9 > $save/test.tar.bz2”
把遠端資料拉回 local,作解壓縮動作
ssh $backup_server “cat $save/test.tar.bz2” | bunzip2 | tar -xpkf –
Windows Installer XML
今天看到 Taiwan C!Net 的一篇新聞: http://taiwan.cnet.com/news/software/0,2000064574,20088766,00.htm
想不到,微軟居然 release 專案到 http://sourceforge.net去,蠻破天荒的~~@_@
專案的名稱是 Windows Installer XML (WiX),而網址在: http://sourceforge.net/projects/wix/
是的,看專案名稱就知道這是一個有關 installer 的專案.
以下從原網站貼過來,並翻譯了一下.
The Windows Installer XML (WiX) is a toolset that builds Windows installation packages from XML source code. The toolset supports a command line environment that developers may integrate into their build processes to build MSI and MSM setup packages.
Windows Installer XML (WiX) 是一組用來從 XML 源碼裡建立 Windows 安裝套件的工具組.這個工具組提供了一個命令列的環境,讓使用者可以將製作 MSI 與 MSM 安裝套件的步驟整合到自己的開發程序裡面.
下載以後,稍稍的玩了一下,發現用法很簡單(難的是 .wxs 的內容,有點小複雜,目前也已經有人在 SourceForge 開了專案要來解決這個複雜的部分)~~
步驟大致是這樣的:先用 notepad 製作出一個 .wxs , 這個 .wxs 其實是一個特殊的 .xml,提供了所有 package 所需要的資訊.然後再使用 candle 這個指令將 .wxs 轉為 .wxiobj 中介檔.
你可以使用 notepad 去觀察 .wxiobj ,你會發現其實他也是一個 .xml 檔案,只是更讓人看不懂~~最後再使用 light 指令,就可以產生出 .msi (installer)或 .msm (installer module)檔案了.這裡也提供了另外一個有趣的工具叫 dark, 它是一個反向工程的工具,用來把 .msi 或 .msm 轉為 .wxs
仔細看一下上面提到的三個工具的名字: candle, light, dark 翻譯成中文正好就是蠟燭,點亮,吹滅. 很有趣不是嗎?! 🙂
WiX 專案發起人的 blog
Using the WiX Toolset to Integrate Setup into Your Development Process
視訊照
前一陣子玩小穎妹妹小涵的 Web cam 所留下的~~
ndoc
簡介
雖說 Visual Studio.Net 已經可以為 c# 程式製作說明文件,但是如果不想安裝這個龐然大物,卻又想要享受這樣的便利,那麼該怎麼辦呢??
其實,.Net Framework 內的 compiler: csc 已經具有這樣的選項.只要在編譯的時候指定了這個選項,那麼,compiler就會自動將程式中我們依照規定所加上的註解擷取為一個 xml 檔案,裡面就是說明文件啦~~
那麼,什麼是”依照規定所加上的註解”呢??
原來這個東西的正名應該是[XML Documentation in C#].它是一份由微軟所訂定的白皮書,裡面載明應該要怎麼註解.
他最主要的用意是讓開發者能夠為程式做一些註解,而不必在程式整個完成之後才去做 API 說明文件這個苦工.像是 Java, C/C++…等等都有類似的工具可以幫忙做掉這件事.
酒釀蛋湯
做法:
1.適量的水加酒釀加砂糖煮沸,
2.立即沖入以放好雞蛋的大碗中,即可享受香滑的蛋花和香味四逸的酒釀蛋湯.
我自己有作過,相當簡單~
口味也不錯~不過我覺得酒味有點小重~~不習慣的話,不好入喉~~
當兵好
歌手:林強
專輯:收錄於娛樂世界與2001向前走-十年精選這兩張專輯裡
歌名:當兵好
詞:林強
曲:林強
編曲:羅百吉
當兵好,沒煩惱,沒有戰爭又吃的飽
盡義務,不要逃,當過兵的男人最可靠
一人當兵,全家光榮,報效國家,真驕傲
捍衛家園,造福鄉里,犧牲奉獻,建設寶島
拿著槍,扛著炮,反攻復國救同胞
為種族,為宗教,戰爭殺人不用坐牢
三民主義,世界大同,是我們國家的目標
什麼時候,世界和平,祇有天知道
我靠!我幹!中華民國萬歲!中華民國萬歲!
當兵好,沒煩惱,沒有戰爭又吃的飽
盡義務,不要逃,當過兵的男人最可靠,當過兵的男人地位高
出了社會,容易適應,所學專長,不得了
鞠躬哈腰,欺下瞞上,表面功夫,技巧妙
當兵好,沒煩惱,沒有戰爭又吃的飽
盡義務,不要逃,當過兵的男人最可靠
FUCK !
為什麼喜歡這首歌,我也說不太上來,大概是因為喜歡他強烈的節奏還有諷刺的歌詞吧~~
好像當過兵的人都會有股怨氣~我也有一些~~ ^_^
向侯捷請問STL sort的問題
這是蠻久以前的事情了,那時候為了這個 sort 的問題,發 mail 向侯捷先生請教.雖然隔了很久才回覆我,不過心裡還是很感動~~也才知道自己的程式出了什麼錯.
回覆日期:2003年2月20日 上午 03:38
你的程式寫的邏輯不對。
> bool operator==( const myInt& l, const myInt& r) {
> bool operator>( const myInt& l, const myInt& r) {
> bool operator<( const myInt& l, const myInt& r) {
這三個都沒有完整判斷。sort 的時候,要求 class 需定義 operator<,
而 operator< 在什麼時候應該傳回 0, 什麼時候傳回 正值,什麼時候傳回負值,有一定的規則。
問題不是出在你指的地方,而在這裡。
— jjhou
—– Original Message —–
寄件者: "晏仁"
收件者:
傳送日期: 2002年10月8日 PM 11:07
主旨: 請教 STL sort() 的問題
> Dear 侯sir:
>
> 冒昧請教,以下是程式,而問題在最後面~
>
> #include <iostream>
> #include <algorithm>
> #include <vector>
>
> using namespace std;
>
> class myInt {
> protected:
> int id;
> public:
> myInt():id(0) {};
> explicit myInt( int i ):id(i) {};
> myInt( const myInt& i ):id(i.id) { };
> int getId( void ) const {
> return id;
> }
> myInt& operator=( myInt& i) {
> id=i.id;
> return *this;
> }
> myInt& operator=( int i ) {
> id=i;
> return *this;
> }
> myInt& operator*() { return *this; }
> myInt* operator->() { return this; }
> friend bool operator==( const myInt& l, const myInt& r );
> friend bool operator friend bool operator>( const myInt& l, const myInt& r );
> };
>
> bool operator==( const myInt& l, const myInt& r) {
> if( l.getId() == r.getId() )
> return true;
> }
>
> bool operator>( const myInt& l, const myInt& r) {
> if( l.getId() > r.getId() )
> return true;
> }
> bool operator if( l.getId() return true;
> }
>
> class myIntCompare {
> public:
> int operator()( myInt aa, myInt bb ) {
> if( aa.getId() > bb.getId() )
> return 1;
> if( aa.getId() == bb.getId() )
> return 0;
> if( aa.getId() return -1;
> }
> };
>
> int
> main( int argc, char* argv[] ) {
> const int COUNTS=10000;
> typedef vector intVector_t;
> intVector_t intVector;
> int i;
>
> /**
> * 下面的兩行 code 會導致 segmentation fault,這就是我要問的問題!!
> * for( i=COUNTS;i>=0;–i )
> * intVector.push_back( myInt(i) );
> */
> intVector.reserve( COUNTS );
> for( i=COUNTS; i>=0; –i )
> intVector[i]=i;
>
> // 以下兩種寫法都可以
> sort( intVector.begin(), intVector.end(), myIntCompare() );
> //sort( intVector.begin(), intVector.end() );
>
> for( i=0; i cout << intVector[i].getId() < }
>
> 為什麼把
> intVector.reserve( COUNTS );
> for( i=COUNTS; i>=0; –i )
> intVector[i]=i;
>
> 改成
> for( i=COUNTS;i>=0;–i )
> intVector.push_back( myInt(i) );
>
> 編譯後再執行
> 就會發生 segmentation fault 的問題呢??
> 真的是很奇怪
> 我知道 vector 在配置的時候會先預留一塊記憶體
> 在 push_back() 的時候,如果發現不夠大,會自動重新配置,
> 並把原來的內容搬到新的地方去.
> 我想可能是重新配置的問題~~
> 但卻不知道真正的原因是什麼?
> 希望侯 sir 能給我一些方向,讓我下手去找出答案~
>
> 喔,對了,我的環境是 linux g++ 2.96.
>
> With Best Regards.